{"version":3,"sources":["../../../node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/rng.js","../../../node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/regex.js","../../../node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/validate.js","../../../node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/stringify.js","../../../node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/v1.js","../../../node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/parse.js","../../../node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/v35.js","../../../node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/md5.js","../../../node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/v3.js","../../../node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/native.js","../../../node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/v4.js","../../../node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/sha1.js","../../../node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/v5.js","../../../node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/nil.js","../../../node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/version.js","../../../node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/index.js","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/Guid.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/PlatformEvent.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/AudioSourceEvents.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/ConnectionEvents.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/Error.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/ConnectionMessage.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/ConnectionOpenResponse.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/DeferralMap.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/DialogEvents.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/EventSource.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/Events.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/IConnection.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/IErrorMessages.js","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/List.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/Promise.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/Queue.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/RawWebsocketMessage.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/RiffPcmEncoder.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/Stream.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/TranslationStatus.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/ChunkedArrayBufferStream.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/Timeout.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/OCSPEvents.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/BackgroundError.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/Exports.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/HeaderNames.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/IAuthentication.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/CognitiveSubscriptionKeyAuthentication.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/CognitiveTokenAuthentication.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/RecognitionEvents.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/LogLevel.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/Contracts.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/src/common.browser/ConsoleLoggingListener.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/src/sdk/Audio/AudioStreamFormat.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/src/common.browser/MicAudioSource.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/src/common.browser/FileAudioSource.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/src/common.browser/PCMRecorder.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/src/common.browser/WebsocketMessageAdapter.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/src/common.browser/WebsocketConnection.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/src/common.browser/ReplayableAudioNode.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/src/sdk/Audio/AudioFileWriter.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/src/sdk/Audio/AudioInputStream.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechSynthesisOutputFormat.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/src/sdk/Audio/AudioOutputFormat.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/src/sdk/Audio/AudioOutputStream.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/src/sdk/Audio/AudioConfig.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/CancellationReason.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/src/sdk/Audio/PullAudioInputStreamCallback.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/src/sdk/Audio/PushAudioOutputStreamCallback.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/KeywordRecognitionModel.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SessionEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/RecognitionEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/OutputFormat.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/RecognitionResult.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechRecognitionResult.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechRecognitionEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/CancellationEventArgsBase.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechRecognitionCanceledEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/TranslationRecognitionEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/TranslationSynthesisEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/TranslationRecognitionResult.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/TranslationSynthesisResult.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/ResultReason.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechConfig.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechTranslationConfig.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/PropertyCollection.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/PropertyId.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/Recognizer.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/PhraseDetection/src/common.speech/ServiceMessages/PhraseDetection/PhraseDetectionContext.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechRecognizer.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/ConnectionMessage.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/Connection.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/TranslationRecognizer.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/Translations.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/NoMatchReason.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/NoMatchDetails.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/TranslationRecognitionCanceledEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/CancellationDetailsBase.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/CancellationDetails.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/CancellationErrorCodes.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/ConnectionEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/ServiceEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/PhraseListGrammar.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/DialogServiceConfig.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/BotFrameworkConfig.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/CustomCommandsConfig.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/QueryParameterNames.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/ConnectionFactoryBase.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/DialogConnectorFactory.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/DialogServiceConnector.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/ActivityReceivedEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/TurnStatusPayload.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/TurnStatusReceivedEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/ServicePropertyChannel.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/ProfanityOption.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/src/sdk/Audio/BaseAudioPlayer.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/ConnectionMessageEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/LanguageIdMode.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/AutoDetectSourceLanguageConfig.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/AutoDetectSourceLanguageResult.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SourceLanguageConfig.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/Conversation.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/ConversationCommon.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/ConversationExpirationEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/ConversationParticipantsChangedEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/ConversationTranslationCanceledEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/ConversationTranslationEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/ConversationTranslationResult.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/StringUtils.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/ConversationTranslatorConnectionFactory.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/ConversationTranslator.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/ConversationTranscriber.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/IParticipant.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/ParticipantChangedReason.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/Meeting.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/MeetingTranscriptionCanceledEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/MeetingTranscriber.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/ConversationTranscriptionResult.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/Exports.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/Synthesizer.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechSynthesizer.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SynthesisResult.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechSynthesisResult.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechSynthesisEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechSynthesisWordBoundaryEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechSynthesisBookmarkEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechSynthesisVisemeEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechSynthesisBoundaryType.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechSynthesisRequestInputType.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechSynthesisRequestInputStream.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechSynthesisRequest.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SynthesisVoicesResult.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/VoiceInfo.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/src/sdk/Audio/SpeakerAudioDestination.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/ConversationTranscriptionCanceledEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/MeetingTranscriptionCanceledEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/PronunciationAssessmentGradingSystem.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/PronunciationAssessmentGranularity.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/PronunciationAssessmentConfig.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/PronunciationAssessmentResult.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/AvatarConfig.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/AvatarEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/AvatarSceneConfig.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SpeechSynthesisConnectionFactory.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/AvatarSynthesizer.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/AvatarVideoFormat.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/AvatarWebRTCConnectionResult.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/Diagnostics.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/Exports.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/src/common.browser/ProxyInfo.ts","../../../node_modules/bent/src/core.js","../../../node_modules/bent/src/browser.js","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/src/common.browser/RestMessageAdapter.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/src/common.browser/RestConfigBase.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/src/common.browser/Exports.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SpeechConnectionMessage.Internal.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/PhraseDetection/src/common.speech/ServiceMessages/PhraseDetection/Segmentation.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/Translation/src/common.speech/ServiceMessages/Translation/OnSuccess.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/Translation/src/common.speech/ServiceMessages/Translation/InterimResults.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/LanguageId/src/common.speech/ServiceMessages/LanguageId/LanguageIdContext.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/LanguageId/src/common.speech/ServiceMessages/LanguageId/OnSuccess.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/LanguageId/src/common.speech/ServiceMessages/LanguageId/OnUnknown.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/PhraseOutput/src/common.speech/ServiceMessages/PhraseOutput/InterimResults.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/PhraseOutput/src/common.speech/ServiceMessages/PhraseOutput/PhraseResults.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/PhraseDetection/src/common.speech/ServiceMessages/PhraseDetection/OnSuccess.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/PhraseDetection/src/common.speech/ServiceMessages/PhraseDetection/InteractiveEnrichmentOptions.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/PhraseDetection/src/common.speech/ServiceMessages/PhraseDetection/ConversationEnrichmentOptions.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/PhraseDetection/src/common.speech/ServiceMessages/PhraseDetection/DictationEnrichmentOptions.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/PhraseDetection/src/common.speech/ServiceMessages/PhraseDetection/DisfluencyMode.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/ServiceRecognizerBase.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/ConversationServiceRecognizer.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/RecognizerConfig.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/WebsocketMessageFormatter.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SpeechConnectionFactory.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/ConversationTranscriberConnectionFactory.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/TranscriberConnectionFactory.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/TranslationConnectionFactory.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/EnumTranslation.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/Enums.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/TranslationSynthesisEnd.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/TranslationHypothesis.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/TranslationPhrase.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/TranslationServiceRecognizer.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/SpeechDetected.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/SpeechHypothesis.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/SpeechKeyword.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SpeechServiceRecognizer.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/PhraseDetection/src/common.speech/ServiceMessages/PhraseDetection/SpeakerDiarization.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/ConversationTranscriptionServiceRecognizer.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/TranscriptionServiceRecognizer.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/DetailedSpeechPhrase.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/SimpleSpeechPhrase.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/ServiceTelemetryListener.Internal.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/RequestSession.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/PhraseOutput/src/common.speech/ServiceMessages/PhraseOutput/PhraseOutput.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SpeechContext.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/Dgi/src/common.speech/ServiceMessages/Dgi/Group.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/DynamicGrammarBuilder.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/ActivityResponsePayload.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/DialogServiceTurnState.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/DialogServiceTurnStateManager.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/InvocationSource.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/KeywordDetection/src/common.speech/ServiceMessages/KeywordDetection/KeywordDetection.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/DialogServiceAdapter.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/AgentConfig.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/ConversationConnectionConfig.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/ConversationManager.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/ConversationConnectionMessage.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/ConversationWebsocketMessageFormatter.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/ConversationConnectionFactory.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/ConversationRequestSession.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/ConversationTranslatorEventArgs.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/ConversationTranslatorInterfaces.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/ServiceMessages/src/common.speech/Transcription/ServiceMessages/CommandResponsePayload.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/ServiceMessages/src/common.speech/Transcription/ServiceMessages/ParticipantResponsePayload.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/ServiceMessages/src/common.speech/Transcription/ServiceMessages/TranslationResponsePayload.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/ServiceMessages/src/common.speech/Transcription/ServiceMessages/Exports.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/ConversationServiceAdapter.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/ConversationTranslatorRecognizer.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/TranscriberRecognizer.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/Exports.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/SynthesisAudioMetadata.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SynthesisEvents.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SynthesisTurn.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SynthesisAdapterBase.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/AvatarSynthesisAdapter.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SpeechSynthesisAdapter.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SynthesisRestAdapter.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SynthesizerConfig.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SynthesisContext.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SpeechServiceConfig.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/Exports.ts","../../../node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/microsoft.cognitiveservices.speech.sdk.ts","../src/buildInfo.ts","../src/boot/actual/minimal.ts","../src/createBrowserWebSpeechPonyfillFactory.ts","../src/createDirectLine.ts","../src/boot/actual/private/getBotAgent.ts","../src/boot/actual/private/createDirectLine.ts","../src/createDirectLineAppServiceExtension.ts","../src/boot/actual/private/createDirectLineAppServiceExtension.ts","../src/renderWebChat.tsx","../src/boot/actual/renderWebChat/minimal.ts","../src/createFullStyleSet.ts","../src/boot/actual/renderWebChat/full.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/SpeechToText/createSpeechRecognitionPonyfill.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/patchOptions.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/resolveFunctionOrReturnValue.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/SpeechSDK.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/SpeechToText/validation/credentialsSchema.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/SpeechToText/validation/enableTelemetrySchema.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/SpeechToText/validation/initialSilenceTimeoutSchema.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/SpeechToText/validation/looseEventsSchema.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/SpeechToText/validation/referenceGrammarsSchema.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/SpeechToText/validation/speechRecognitionEndpointIdSchema.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/SpeechToText/validation/textNormalizationSchema.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/SpeechToText/createSpeechRecognitionPonyfillFromRecognizer.ts","../../../node_modules/p-defer/index.js","../../../node_modules/web-speech-cognitive-services/src/Util/createPromiseQueue.js","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/SpeechToText/SpeechRecognitionAlternative.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/SpeechToText/private/FakeArray.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/SpeechToText/SpeechRecognitionResult.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/SpeechToText/cognitiveServiceEventResultToWebSpeechRecognitionResult.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/SpeechToText/cognitiveServicesAsyncToPromise.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/SpeechToText/private/EventListenerMap.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/SpeechToText/private/prepareAudioConfig.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/SpeechToText/private/averageAmplitude.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/SpeechToText/private/serializeRecognitionResult.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/SpeechToText/SpeechGrammarList.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/SpeechToText/SpeechRecognitionErrorEvent.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/SpeechToText/SpeechRecognitionResultList.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/SpeechToText/SpeechRecognitionEvent.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/TextToSpeech/createSpeechSynthesisPonyfill.js","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/TextToSpeech/AudioContextQueue.js","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/TextToSpeech/AudioContextConsumer.js","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/TextToSpeech/SpeechSynthesisEvent.js","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/TextToSpeech/SpeechSynthesisUtterance.js","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/TextToSpeech/fetchSpeechData.js","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/TextToSpeech/buildSSML.js","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/TextToSpeech/isSSML.js","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/TextToSpeech/subscribeEvent.js","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/TextToSpeech/SpeechSynthesisVoice.js","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/TextToSpeech/fetchCustomVoices.js","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/TextToSpeech/fetchVoices.js","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/TextToSpeech.js","../../../node_modules/web-speech-cognitive-services/src/SpeechServices/fetchAuthorizationToken.ts","../../../node_modules/web-speech-cognitive-services/src/SpeechServices.ts","../../../node_modules/web-speech-cognitive-services/node_modules/src/lib/misc.ts","../../../node_modules/web-speech-cognitive-services/node_modules/src/lib/error-handler.ts","../../../node_modules/web-speech-cognitive-services/node_modules/src/lib/global.ts","../../../node_modules/web-speech-cognitive-services/node_modules/src/lib/warning-handler.ts","../../../node_modules/web-speech-cognitive-services/node_modules/src/lib/warnings.ts","../../../node_modules/web-speech-cognitive-services/node_modules/src/lib/event.ts","../../../node_modules/web-speech-cognitive-services/node_modules/src/lib/dom-exception.ts","../../../node_modules/web-speech-cognitive-services/node_modules/src/lib/event-wrapper.ts","../../../node_modules/web-speech-cognitive-services/node_modules/src/lib/listener.ts","../../../node_modules/web-speech-cognitive-services/node_modules/src/lib/listener-list.ts","../../../node_modules/web-speech-cognitive-services/node_modules/src/lib/listener-list-map.ts","../../../node_modules/web-speech-cognitive-services/node_modules/src/lib/event-target.ts","../../../node_modules/web-speech-cognitive-services/node_modules/src/lib/event-attribute-handler.ts","../../../node_modules/web-speech-cognitive-services/node_modules/src/lib/legacy.ts","../../../node_modules/on-error-resume-next/src/private/isPromise.ts","../../../node_modules/on-error-resume-next/src/index.async.ts","../../../node_modules/memoize-one/dist/memoize-one.esm.js","../../../node_modules/event-as-promise/src/index.ts","../../../node_modules/src/index.ts","../src/speech/createMicrophoneAudioConfigAndAudioContext.ts","../src/speech/bytesPerSample.ts","../src/speech/createAudioConfig.ts","../src/speech/CustomAudioInputStream.ts","../../../node_modules/uuid/dist/stringify.js","../../../node_modules/uuid/dist/rng.js","../../../node_modules/uuid/dist/v4.js","../src/speech/createAudioContext.ts","../src/speech/getUserMedia.ts","../src/speech/isPromiseLike.ts","../src/speech/removeBearerInAuthorizationToken.ts","../src/createCognitiveServicesSpeechServicesPonyfillFactory.ts","../src/createDirectLineSpeechAdapters.ts","../src/boot/actual/full.ts","../src/boot/exports/index.ts"],"sourcesContent":["\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = rng;\n// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\n\nfunction rng() {\n  // lazy load so that environments that need to polyfill have a chance to do so\n  if (!getRandomValues) {\n    // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n    getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n    if (!getRandomValues) {\n      throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n    }\n  }\n\n  return getRandomValues(rnds8);\n}","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\nvar _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\n\nvar _regex = _interopRequireDefault(require(\"./regex.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction validate(uuid) {\n  return typeof uuid === 'string' && _regex.default.test(uuid);\n}\n\nvar _default = validate;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\nexports.unsafeStringify = unsafeStringify;\n\nvar _validate = _interopRequireDefault(require(\"./validate.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n  byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nfunction unsafeStringify(arr, offset = 0) {\n  // Note: Be careful editing this code!  It's been tuned for performance\n  // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n  return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];\n}\n\nfunction stringify(arr, offset = 0) {\n  const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID.  If this throws, it's likely due to one\n  // of the following:\n  // - One or more input array values don't map to a hex octet (leading to\n  // \"undefined\" in the uuid)\n  // - Invalid input values for the RFC `version` or `variant` fields\n\n  if (!(0, _validate.default)(uuid)) {\n    throw TypeError('Stringified UUID is invalid');\n  }\n\n  return uuid;\n}\n\nvar _default = stringify;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\n\nvar _rng = _interopRequireDefault(require(\"./rng.js\"));\n\nvar _stringify = require(\"./stringify.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\nlet _nodeId;\n\nlet _clockseq; // Previous uuid creation time\n\n\nlet _lastMSecs = 0;\nlet _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details\n\nfunction v1(options, buf, offset) {\n  let i = buf && offset || 0;\n  const b = buf || new Array(16);\n  options = options || {};\n  let node = options.node || _nodeId;\n  let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not\n  // specified.  We do this lazily to minimize issues related to insufficient\n  // system entropy.  See #189\n\n  if (node == null || clockseq == null) {\n    const seedBytes = options.random || (options.rng || _rng.default)();\n\n    if (node == null) {\n      // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\n      node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];\n    }\n\n    if (clockseq == null) {\n      // Per 4.2.2, randomize (14 bit) clockseq\n      clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;\n    }\n  } // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n  // (1582-10-15 00:00).  JSNumbers aren't precise enough for this, so\n  // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n  // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n\n\n  let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock\n  // cycle to simulate higher resolution clock\n\n  let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)\n\n  const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression\n\n  if (dt < 0 && options.clockseq === undefined) {\n    clockseq = clockseq + 1 & 0x3fff;\n  } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n  // time interval\n\n\n  if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n    nsecs = 0;\n  } // Per 4.2.1.2 Throw error if too many uuids are requested\n\n\n  if (nsecs >= 10000) {\n    throw new Error(\"uuid.v1(): Can't create more than 10M uuids/sec\");\n  }\n\n  _lastMSecs = msecs;\n  _lastNSecs = nsecs;\n  _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n\n  msecs += 12219292800000; // `time_low`\n\n  const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n  b[i++] = tl >>> 24 & 0xff;\n  b[i++] = tl >>> 16 & 0xff;\n  b[i++] = tl >>> 8 & 0xff;\n  b[i++] = tl & 0xff; // `time_mid`\n\n  const tmh = msecs / 0x100000000 * 10000 & 0xfffffff;\n  b[i++] = tmh >>> 8 & 0xff;\n  b[i++] = tmh & 0xff; // `time_high_and_version`\n\n  b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n\n  b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n\n  b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`\n\n  b[i++] = clockseq & 0xff; // `node`\n\n  for (let n = 0; n < 6; ++n) {\n    b[i + n] = node[n];\n  }\n\n  return buf || (0, _stringify.unsafeStringify)(b);\n}\n\nvar _default = v1;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\n\nvar _validate = _interopRequireDefault(require(\"./validate.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction parse(uuid) {\n  if (!(0, _validate.default)(uuid)) {\n    throw TypeError('Invalid UUID');\n  }\n\n  let v;\n  const arr = new Uint8Array(16); // Parse ########-....-....-....-............\n\n  arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;\n  arr[1] = v >>> 16 & 0xff;\n  arr[2] = v >>> 8 & 0xff;\n  arr[3] = v & 0xff; // Parse ........-####-....-....-............\n\n  arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;\n  arr[5] = v & 0xff; // Parse ........-....-####-....-............\n\n  arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;\n  arr[7] = v & 0xff; // Parse ........-....-....-####-............\n\n  arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;\n  arr[9] = v & 0xff; // Parse ........-....-....-....-############\n  // (Use \"/\" to avoid 32-bit truncation when bit-shifting high-order bytes)\n\n  arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;\n  arr[11] = v / 0x100000000 & 0xff;\n  arr[12] = v >>> 24 & 0xff;\n  arr[13] = v >>> 16 & 0xff;\n  arr[14] = v >>> 8 & 0xff;\n  arr[15] = v & 0xff;\n  return arr;\n}\n\nvar _default = parse;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.URL = exports.DNS = void 0;\nexports.default = v35;\n\nvar _stringify = require(\"./stringify.js\");\n\nvar _parse = _interopRequireDefault(require(\"./parse.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction stringToBytes(str) {\n  str = unescape(encodeURIComponent(str)); // UTF8 escape\n\n  const bytes = [];\n\n  for (let i = 0; i < str.length; ++i) {\n    bytes.push(str.charCodeAt(i));\n  }\n\n  return bytes;\n}\n\nconst DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';\nexports.DNS = DNS;\nconst URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';\nexports.URL = URL;\n\nfunction v35(name, version, hashfunc) {\n  function generateUUID(value, namespace, buf, offset) {\n    var _namespace;\n\n    if (typeof value === 'string') {\n      value = stringToBytes(value);\n    }\n\n    if (typeof namespace === 'string') {\n      namespace = (0, _parse.default)(namespace);\n    }\n\n    if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {\n      throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');\n    } // Compute hash of namespace and value, Per 4.3\n    // Future: Use spread syntax when supported on all platforms, e.g. `bytes =\n    // hashfunc([...namespace, ... value])`\n\n\n    let bytes = new Uint8Array(16 + value.length);\n    bytes.set(namespace);\n    bytes.set(value, namespace.length);\n    bytes = hashfunc(bytes);\n    bytes[6] = bytes[6] & 0x0f | version;\n    bytes[8] = bytes[8] & 0x3f | 0x80;\n\n    if (buf) {\n      offset = offset || 0;\n\n      for (let i = 0; i < 16; ++i) {\n        buf[offset + i] = bytes[i];\n      }\n\n      return buf;\n    }\n\n    return (0, _stringify.unsafeStringify)(bytes);\n  } // Function#name is not settable on some platforms (#270)\n\n\n  try {\n    generateUUID.name = name; // eslint-disable-next-line no-empty\n  } catch (err) {} // For CommonJS default export support\n\n\n  generateUUID.DNS = DNS;\n  generateUUID.URL = URL;\n  return generateUUID;\n}","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\n\n/*\n * Browser-compatible JavaScript MD5\n *\n * Modification of JavaScript MD5\n * https://github.com/blueimp/JavaScript-MD5\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n *\n * Based on\n * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message\n * Digest Algorithm, as defined in RFC 1321.\n * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for more info.\n */\nfunction md5(bytes) {\n  if (typeof bytes === 'string') {\n    const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape\n\n    bytes = new Uint8Array(msg.length);\n\n    for (let i = 0; i < msg.length; ++i) {\n      bytes[i] = msg.charCodeAt(i);\n    }\n  }\n\n  return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8));\n}\n/*\n * Convert an array of little-endian words to an array of bytes\n */\n\n\nfunction md5ToHexEncodedArray(input) {\n  const output = [];\n  const length32 = input.length * 32;\n  const hexTab = '0123456789abcdef';\n\n  for (let i = 0; i < length32; i += 8) {\n    const x = input[i >> 5] >>> i % 32 & 0xff;\n    const hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);\n    output.push(hex);\n  }\n\n  return output;\n}\n/**\n * Calculate output length with padding and bit length\n */\n\n\nfunction getOutputLength(inputLength8) {\n  return (inputLength8 + 64 >>> 9 << 4) + 14 + 1;\n}\n/*\n * Calculate the MD5 of an array of little-endian words, and a bit length.\n */\n\n\nfunction wordsToMd5(x, len) {\n  /* append padding */\n  x[len >> 5] |= 0x80 << len % 32;\n  x[getOutputLength(len) - 1] = len;\n  let a = 1732584193;\n  let b = -271733879;\n  let c = -1732584194;\n  let d = 271733878;\n\n  for (let i = 0; i < x.length; i += 16) {\n    const olda = a;\n    const oldb = b;\n    const oldc = c;\n    const oldd = d;\n    a = md5ff(a, b, c, d, x[i], 7, -680876936);\n    d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);\n    c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);\n    b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);\n    a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);\n    d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);\n    c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);\n    b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);\n    a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);\n    d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);\n    c = md5ff(c, d, a, b, x[i + 10], 17, -42063);\n    b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);\n    a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);\n    d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);\n    c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);\n    b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);\n    a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);\n    d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);\n    c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);\n    b = md5gg(b, c, d, a, x[i], 20, -373897302);\n    a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);\n    d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);\n    c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);\n    b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);\n    a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);\n    d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);\n    c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);\n    b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);\n    a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);\n    d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);\n    c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);\n    b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);\n    a = md5hh(a, b, c, d, x[i + 5], 4, -378558);\n    d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);\n    c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);\n    b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);\n    a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);\n    d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);\n    c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);\n    b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);\n    a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);\n    d = md5hh(d, a, b, c, x[i], 11, -358537222);\n    c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);\n    b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);\n    a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);\n    d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);\n    c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);\n    b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);\n    a = md5ii(a, b, c, d, x[i], 6, -198630844);\n    d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);\n    c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);\n    b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);\n    a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);\n    d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);\n    c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);\n    b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);\n    a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);\n    d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);\n    c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);\n    b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);\n    a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);\n    d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);\n    c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);\n    b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);\n    a = safeAdd(a, olda);\n    b = safeAdd(b, oldb);\n    c = safeAdd(c, oldc);\n    d = safeAdd(d, oldd);\n  }\n\n  return [a, b, c, d];\n}\n/*\n * Convert an array bytes to an array of little-endian words\n * Characters >255 have their high-byte silently ignored.\n */\n\n\nfunction bytesToWords(input) {\n  if (input.length === 0) {\n    return [];\n  }\n\n  const length8 = input.length * 8;\n  const output = new Uint32Array(getOutputLength(length8));\n\n  for (let i = 0; i < length8; i += 8) {\n    output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;\n  }\n\n  return output;\n}\n/*\n * Add integers, wrapping at 2^32. This uses 16-bit operations internally\n * to work around bugs in some JS interpreters.\n */\n\n\nfunction safeAdd(x, y) {\n  const lsw = (x & 0xffff) + (y & 0xffff);\n  const msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n  return msw << 16 | lsw & 0xffff;\n}\n/*\n * Bitwise rotate a 32-bit number to the left.\n */\n\n\nfunction bitRotateLeft(num, cnt) {\n  return num << cnt | num >>> 32 - cnt;\n}\n/*\n * These functions implement the four basic operations the algorithm uses.\n */\n\n\nfunction md5cmn(q, a, b, x, s, t) {\n  return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);\n}\n\nfunction md5ff(a, b, c, d, x, s, t) {\n  return md5cmn(b & c | ~b & d, a, b, x, s, t);\n}\n\nfunction md5gg(a, b, c, d, x, s, t) {\n  return md5cmn(b & d | c & ~d, a, b, x, s, t);\n}\n\nfunction md5hh(a, b, c, d, x, s, t) {\n  return md5cmn(b ^ c ^ d, a, b, x, s, t);\n}\n\nfunction md5ii(a, b, c, d, x, s, t) {\n  return md5cmn(c ^ (b | ~d), a, b, x, s, t);\n}\n\nvar _default = md5;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\n\nvar _v = _interopRequireDefault(require(\"./v35.js\"));\n\nvar _md = _interopRequireDefault(require(\"./md5.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nconst v3 = (0, _v.default)('v3', 0x30, _md.default);\nvar _default = v3;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\nconst randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nvar _default = {\n  randomUUID\n};\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\n\nvar _native = _interopRequireDefault(require(\"./native.js\"));\n\nvar _rng = _interopRequireDefault(require(\"./rng.js\"));\n\nvar _stringify = require(\"./stringify.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction v4(options, buf, offset) {\n  if (_native.default.randomUUID && !buf && !options) {\n    return _native.default.randomUUID();\n  }\n\n  options = options || {};\n\n  const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n\n  rnds[6] = rnds[6] & 0x0f | 0x40;\n  rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n  if (buf) {\n    offset = offset || 0;\n\n    for (let i = 0; i < 16; ++i) {\n      buf[offset + i] = rnds[i];\n    }\n\n    return buf;\n  }\n\n  return (0, _stringify.unsafeStringify)(rnds);\n}\n\nvar _default = v4;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\n\n// Adapted from Chris Veness' SHA1 code at\n// http://www.movable-type.co.uk/scripts/sha1.html\nfunction f(s, x, y, z) {\n  switch (s) {\n    case 0:\n      return x & y ^ ~x & z;\n\n    case 1:\n      return x ^ y ^ z;\n\n    case 2:\n      return x & y ^ x & z ^ y & z;\n\n    case 3:\n      return x ^ y ^ z;\n  }\n}\n\nfunction ROTL(x, n) {\n  return x << n | x >>> 32 - n;\n}\n\nfunction sha1(bytes) {\n  const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];\n  const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];\n\n  if (typeof bytes === 'string') {\n    const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape\n\n    bytes = [];\n\n    for (let i = 0; i < msg.length; ++i) {\n      bytes.push(msg.charCodeAt(i));\n    }\n  } else if (!Array.isArray(bytes)) {\n    // Convert Array-like to Array\n    bytes = Array.prototype.slice.call(bytes);\n  }\n\n  bytes.push(0x80);\n  const l = bytes.length / 4 + 2;\n  const N = Math.ceil(l / 16);\n  const M = new Array(N);\n\n  for (let i = 0; i < N; ++i) {\n    const arr = new Uint32Array(16);\n\n    for (let j = 0; j < 16; ++j) {\n      arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3];\n    }\n\n    M[i] = arr;\n  }\n\n  M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);\n  M[N - 1][14] = Math.floor(M[N - 1][14]);\n  M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;\n\n  for (let i = 0; i < N; ++i) {\n    const W = new Uint32Array(80);\n\n    for (let t = 0; t < 16; ++t) {\n      W[t] = M[i][t];\n    }\n\n    for (let t = 16; t < 80; ++t) {\n      W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);\n    }\n\n    let a = H[0];\n    let b = H[1];\n    let c = H[2];\n    let d = H[3];\n    let e = H[4];\n\n    for (let t = 0; t < 80; ++t) {\n      const s = Math.floor(t / 20);\n      const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;\n      e = d;\n      d = c;\n      c = ROTL(b, 30) >>> 0;\n      b = a;\n      a = T;\n    }\n\n    H[0] = H[0] + a >>> 0;\n    H[1] = H[1] + b >>> 0;\n    H[2] = H[2] + c >>> 0;\n    H[3] = H[3] + d >>> 0;\n    H[4] = H[4] + e >>> 0;\n  }\n\n  return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];\n}\n\nvar _default = sha1;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\n\nvar _v = _interopRequireDefault(require(\"./v35.js\"));\n\nvar _sha = _interopRequireDefault(require(\"./sha1.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nconst v5 = (0, _v.default)('v5', 0x50, _sha.default);\nvar _default = v5;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\nvar _default = '00000000-0000-0000-0000-000000000000';\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\n\nvar _validate = _interopRequireDefault(require(\"./validate.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction version(uuid) {\n  if (!(0, _validate.default)(uuid)) {\n    throw TypeError('Invalid UUID');\n  }\n\n  return parseInt(uuid.slice(14, 15), 16);\n}\n\nvar _default = version;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nObject.defineProperty(exports, \"NIL\", {\n  enumerable: true,\n  get: function get() {\n    return _nil.default;\n  }\n});\nObject.defineProperty(exports, \"parse\", {\n  enumerable: true,\n  get: function get() {\n    return _parse.default;\n  }\n});\nObject.defineProperty(exports, \"stringify\", {\n  enumerable: true,\n  get: function get() {\n    return _stringify.default;\n  }\n});\nObject.defineProperty(exports, \"v1\", {\n  enumerable: true,\n  get: function get() {\n    return _v.default;\n  }\n});\nObject.defineProperty(exports, \"v3\", {\n  enumerable: true,\n  get: function get() {\n    return _v2.default;\n  }\n});\nObject.defineProperty(exports, \"v4\", {\n  enumerable: true,\n  get: function get() {\n    return _v3.default;\n  }\n});\nObject.defineProperty(exports, \"v5\", {\n  enumerable: true,\n  get: function get() {\n    return _v4.default;\n  }\n});\nObject.defineProperty(exports, \"validate\", {\n  enumerable: true,\n  get: function get() {\n    return _validate.default;\n  }\n});\nObject.defineProperty(exports, \"version\", {\n  enumerable: true,\n  get: function get() {\n    return _version.default;\n  }\n});\n\nvar _v = _interopRequireDefault(require(\"./v1.js\"));\n\nvar _v2 = _interopRequireDefault(require(\"./v3.js\"));\n\nvar _v3 = _interopRequireDefault(require(\"./v4.js\"));\n\nvar _v4 = _interopRequireDefault(require(\"./v5.js\"));\n\nvar _nil = _interopRequireDefault(require(\"./nil.js\"));\n\nvar _version = _interopRequireDefault(require(\"./version.js\"));\n\nvar _validate = _interopRequireDefault(require(\"./validate.js\"));\n\nvar _stringify = _interopRequireDefault(require(\"./stringify.js\"));\n\nvar _parse = _interopRequireDefault(require(\"./parse.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { v4 as uuid } from \"uuid\";\r\n\r\nconst createGuid: () => string = (): string => uuid();\r\n\r\nconst createNoDashGuid: () => string = (): string => createGuid().replace(new RegExp(\"-\", \"g\"), \"\").toUpperCase();\r\n\r\nexport { createGuid, createNoDashGuid };\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { createNoDashGuid } from \"./Guid.js\";\r\nimport { IStringDictionary } from \"./IDictionary.js\";\r\n\r\nexport enum EventType {\r\n    Debug,\r\n    Info,\r\n    Warning,\r\n    Error,\r\n    None,\r\n}\r\n\r\nexport class PlatformEvent {\r\n    private privName: string;\r\n    private privEventId: string;\r\n    private privEventTime: string;\r\n    private privEventType: EventType;\r\n    private privMetadata: IStringDictionary<string>;\r\n\r\n    public constructor(eventName: string, eventType: EventType) {\r\n        this.privName = eventName;\r\n        this.privEventId = createNoDashGuid();\r\n        this.privEventTime = new Date().toISOString();\r\n        this.privEventType = eventType;\r\n        this.privMetadata = { };\r\n    }\r\n\r\n    public get name(): string {\r\n        return this.privName;\r\n    }\r\n\r\n    public get eventId(): string {\r\n        return this.privEventId;\r\n    }\r\n\r\n    public get eventTime(): string {\r\n        return this.privEventTime;\r\n    }\r\n\r\n    public get eventType(): EventType {\r\n        return this.privEventType;\r\n    }\r\n\r\n    public get metadata(): IStringDictionary<string> {\r\n        return this.privMetadata;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport { EventType, PlatformEvent } from \"./PlatformEvent.js\";\r\n\r\nexport class AudioSourceEvent extends PlatformEvent {\r\n    private privAudioSourceId: string;\r\n\r\n    public constructor(eventName: string, audioSourceId: string, eventType: EventType = EventType.Info) {\r\n        super(eventName, eventType);\r\n        this.privAudioSourceId = audioSourceId;\r\n    }\r\n\r\n    public get audioSourceId(): string {\r\n        return this.privAudioSourceId;\r\n    }\r\n}\r\n\r\nexport class AudioSourceInitializingEvent extends AudioSourceEvent {\r\n    public constructor(audioSourceId: string) {\r\n        super(\"AudioSourceInitializingEvent\", audioSourceId);\r\n    }\r\n}\r\n\r\nexport class AudioSourceReadyEvent extends AudioSourceEvent {\r\n    public constructor(audioSourceId: string) {\r\n        super(\"AudioSourceReadyEvent\", audioSourceId);\r\n    }\r\n}\r\n\r\nexport class AudioSourceOffEvent extends AudioSourceEvent {\r\n    public constructor(audioSourceId: string) {\r\n        super(\"AudioSourceOffEvent\", audioSourceId);\r\n    }\r\n}\r\n\r\nexport class AudioSourceErrorEvent extends AudioSourceEvent {\r\n    private privError: string;\r\n\r\n    public constructor(audioSourceId: string, error: string) {\r\n        super(\"AudioSourceErrorEvent\", audioSourceId, EventType.Error);\r\n        this.privError = error;\r\n    }\r\n\r\n    public get error(): string {\r\n        return this.privError;\r\n    }\r\n}\r\n\r\nexport class AudioStreamNodeEvent extends AudioSourceEvent {\r\n    private privAudioNodeId: string;\r\n\r\n    public constructor(eventName: string, audioSourceId: string, audioNodeId: string) {\r\n        super(eventName, audioSourceId);\r\n        this.privAudioNodeId = audioNodeId;\r\n    }\r\n\r\n    public get audioNodeId(): string {\r\n        return this.privAudioNodeId;\r\n    }\r\n}\r\n\r\nexport class AudioStreamNodeAttachingEvent extends AudioStreamNodeEvent {\r\n    public constructor(audioSourceId: string, audioNodeId: string) {\r\n        super(\"AudioStreamNodeAttachingEvent\", audioSourceId, audioNodeId);\r\n    }\r\n}\r\n\r\nexport class AudioStreamNodeAttachedEvent extends AudioStreamNodeEvent {\r\n    public constructor(audioSourceId: string, audioNodeId: string) {\r\n        super(\"AudioStreamNodeAttachedEvent\", audioSourceId, audioNodeId);\r\n    }\r\n}\r\n\r\nexport class AudioStreamNodeDetachedEvent extends AudioStreamNodeEvent {\r\n    public constructor(audioSourceId: string, audioNodeId: string) {\r\n        super(\"AudioStreamNodeDetachedEvent\", audioSourceId, audioNodeId);\r\n    }\r\n}\r\n\r\nexport class AudioStreamNodeErrorEvent extends AudioStreamNodeEvent {\r\n    private privError: string;\r\n\r\n    public constructor(audioSourceId: string, audioNodeId: string, error: string) {\r\n        super(\"AudioStreamNodeErrorEvent\", audioSourceId, audioNodeId);\r\n        this.privError = error;\r\n    }\r\n\r\n    public get error(): string {\r\n        return this.privError;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport { ConnectionMessage } from \"./ConnectionMessage.js\";\r\nimport { IStringDictionary } from \"./IDictionary.js\";\r\nimport { EventType, PlatformEvent } from \"./PlatformEvent.js\";\r\n\r\nexport class ServiceEvent extends PlatformEvent {\r\n    private privJsonResult: string;\r\n\r\n    public constructor(eventName: string, jsonstring: string, eventType: EventType = EventType.Info) {\r\n      super(eventName, eventType);\r\n      this.privJsonResult = jsonstring;\r\n    }\r\n\r\n    public get jsonString(): string {\r\n        return this.privJsonResult;\r\n    }\r\n}\r\n\r\nexport class ConnectionEvent extends PlatformEvent {\r\n    private privConnectionId: string;\r\n\r\n    public constructor(eventName: string, connectionId: string, eventType: EventType = EventType.Info) {\r\n        super(eventName, eventType);\r\n        this.privConnectionId = connectionId;\r\n    }\r\n\r\n    public get connectionId(): string {\r\n        return this.privConnectionId;\r\n    }\r\n}\r\n\r\nexport class ConnectionStartEvent extends ConnectionEvent {\r\n    private privUri: string;\r\n    private privHeaders: IStringDictionary<string>;\r\n\r\n    public constructor(connectionId: string, uri: string, headers?: IStringDictionary<string>) {\r\n        super(\"ConnectionStartEvent\", connectionId);\r\n        this.privUri = uri;\r\n        this.privHeaders = headers;\r\n    }\r\n\r\n    public get uri(): string {\r\n        return this.privUri;\r\n    }\r\n\r\n    public get headers(): IStringDictionary<string> {\r\n        return this.privHeaders;\r\n    }\r\n}\r\n\r\nexport class ConnectionEstablishedEvent extends ConnectionEvent {\r\n    public constructor(connectionId: string) {\r\n        super(\"ConnectionEstablishedEvent\", connectionId);\r\n    }\r\n}\r\n\r\nexport class ConnectionClosedEvent extends ConnectionEvent {\r\n    private privReason: string;\r\n    private privStatusCode: number;\r\n\r\n    public constructor(connectionId: string, statusCode: number, reason: string) {\r\n        super(\"ConnectionClosedEvent\", connectionId, EventType.Debug);\r\n        this.privReason = reason;\r\n        this.privStatusCode = statusCode;\r\n    }\r\n\r\n    public get reason(): string {\r\n        return this.privReason;\r\n    }\r\n\r\n    public get statusCode(): number {\r\n        return this.privStatusCode;\r\n    }\r\n}\r\n\r\nexport class ConnectionErrorEvent extends ConnectionEvent {\r\n    private readonly privMessage: string;\r\n    private readonly privType: string;\r\n\r\n    public constructor(connectionId: string, message: string, type: string) {\r\n        super(\"ConnectionErrorEvent\", connectionId, EventType.Debug);\r\n        this.privMessage = message;\r\n        this.privType = type;\r\n    }\r\n\r\n    public get message(): string {\r\n        return this.privMessage;\r\n    }\r\n\r\n    public get type(): string {\r\n        return this.privType;\r\n    }\r\n}\r\n\r\nexport class ConnectionEstablishErrorEvent extends ConnectionEvent {\r\n    private privStatusCode: number;\r\n    private privReason: string;\r\n\r\n    public constructor(connectionId: string, statuscode: number, reason: string) {\r\n        super(\"ConnectionEstablishErrorEvent\", connectionId, EventType.Error);\r\n        this.privStatusCode = statuscode;\r\n        this.privReason = reason;\r\n    }\r\n\r\n    public get reason(): string {\r\n        return this.privReason;\r\n    }\r\n\r\n    public get statusCode(): number {\r\n        return this.privStatusCode;\r\n    }\r\n}\r\n\r\nexport class ConnectionMessageReceivedEvent extends ConnectionEvent {\r\n    private privNetworkReceivedTime: string;\r\n    private privMessage: ConnectionMessage;\r\n\r\n    public constructor(connectionId: string, networkReceivedTimeISO: string, message: ConnectionMessage) {\r\n        super(\"ConnectionMessageReceivedEvent\", connectionId);\r\n        this.privNetworkReceivedTime = networkReceivedTimeISO;\r\n        this.privMessage = message;\r\n    }\r\n\r\n    public get networkReceivedTime(): string {\r\n        return this.privNetworkReceivedTime;\r\n    }\r\n\r\n    public get message(): ConnectionMessage {\r\n        return this.privMessage;\r\n    }\r\n}\r\n\r\nexport class ConnectionMessageSentEvent extends ConnectionEvent {\r\n    private privNetworkSentTime: string;\r\n    private privMessage: ConnectionMessage;\r\n\r\n    public constructor(connectionId: string, networkSentTimeISO: string, message: ConnectionMessage) {\r\n        super(\"ConnectionMessageSentEvent\", connectionId);\r\n        this.privNetworkSentTime = networkSentTimeISO;\r\n        this.privMessage = message;\r\n    }\r\n\r\n    public get networkSentTime(): string {\r\n        return this.privNetworkSentTime;\r\n    }\r\n\r\n    public get message(): ConnectionMessage {\r\n        return this.privMessage;\r\n    }\r\n}\r\n\r\nexport class ConnectionRedirectEvent extends ConnectionEvent {\r\n    private privRedirectUrl: string;\r\n    private privOriginalUrl?: string;\r\n    private privContext?: string;\r\n\r\n    public constructor(connectionId: string, redirectUrl: string, originalUrl?: string, context?: string) {\r\n        super(\"ConnectionRedirectEvent\", connectionId, EventType.Info);\r\n        this.privRedirectUrl = redirectUrl;\r\n        this.privOriginalUrl = originalUrl;\r\n        this.privContext = context;\r\n    }\r\n\r\n    public get redirectUrl(): string {\r\n        return this.privRedirectUrl;\r\n    }\r\n\r\n    public get originalUrl(): string | undefined {\r\n        return this.privOriginalUrl;\r\n    }\r\n\r\n    public get context(): string | undefined {\r\n        return this.privContext;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\n/**\r\n * The error that is thrown when an argument passed in is null.\r\n *\r\n * @export\r\n * @class ArgumentNullError\r\n * @extends {Error}\r\n */\r\nexport class ArgumentNullError extends Error {\r\n\r\n    /**\r\n     * Creates an instance of ArgumentNullError.\r\n     *\r\n     * @param {string} argumentName - Name of the argument that is null\r\n     *\r\n     * @memberOf ArgumentNullError\r\n     */\r\n    public constructor(argumentName: string) {\r\n        super(argumentName);\r\n        this.name = \"ArgumentNull\";\r\n        this.message = argumentName;\r\n    }\r\n}\r\n\r\n/**\r\n * The error that is thrown when an invalid operation is performed in the code.\r\n *\r\n * @export\r\n * @class InvalidOperationError\r\n * @extends {Error}\r\n */\r\nexport class InvalidOperationError extends Error {\r\n\r\n    /**\r\n     * Creates an instance of InvalidOperationError.\r\n     *\r\n     * @param {string} error - The error\r\n     *\r\n     * @memberOf InvalidOperationError\r\n     */\r\n    public constructor(error: string) {\r\n        super(error);\r\n        this.name = \"InvalidOperation\";\r\n        this.message = error;\r\n    }\r\n}\r\n\r\n/**\r\n * The error that is thrown when an object is disposed.\r\n *\r\n * @export\r\n * @class ObjectDisposedError\r\n * @extends {Error}\r\n */\r\nexport class ObjectDisposedError extends Error {\r\n\r\n    /**\r\n     * Creates an instance of ObjectDisposedError.\r\n     *\r\n     * @param {string} objectName - The object that is disposed\r\n     * @param {string} error - The error\r\n     *\r\n     * @memberOf ObjectDisposedError\r\n     */\r\n    public constructor(objectName: string, error?: string) {\r\n        super(error);\r\n        this.name = objectName + \"ObjectDisposed\";\r\n        this.message = error;\r\n    }\r\n}\r\n","/* eslint-disable @typescript-eslint/no-unsafe-return */\r\n// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { InvalidOperationError } from \"./Error.js\";\r\nimport { createNoDashGuid } from \"./Guid.js\";\r\nimport { IStringDictionary } from \"./IDictionary.js\";\r\n\r\nexport enum MessageType {\r\n    Text,\r\n    Binary,\r\n}\r\n\r\nexport class ConnectionMessage {\r\n\r\n    private privMessageType: MessageType;\r\n    private privHeaders: IStringDictionary<string>;\r\n    private privBody: any = null;\r\n    private privSize: number;\r\n\r\n    private privId: string;\r\n\r\n    public constructor(\r\n        messageType: MessageType,\r\n        body: any,\r\n        headers?: IStringDictionary<string>,\r\n        id?: string) {\r\n\r\n        if (messageType === MessageType.Text && body && !(typeof (body) === \"string\")) {\r\n            throw new InvalidOperationError(\"Payload must be a string\");\r\n        }\r\n\r\n        if (messageType === MessageType.Binary && body && !(body instanceof ArrayBuffer)) {\r\n            throw new InvalidOperationError(\"Payload must be ArrayBuffer\");\r\n        }\r\n\r\n        this.privMessageType = messageType;\r\n        // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\r\n        this.privBody = body;\r\n        this.privHeaders = headers ? headers : {};\r\n        this.privId = id ? id : createNoDashGuid();\r\n        switch (this.messageType) {\r\n            case MessageType.Binary:\r\n                this.privSize = this.binaryBody !== null ? this.binaryBody.byteLength : 0;\r\n                break;\r\n            case MessageType.Text:\r\n                this.privSize = this.textBody.length;\r\n        }\r\n    }\r\n\r\n    public get messageType(): MessageType {\r\n        return this.privMessageType;\r\n    }\r\n\r\n    public get headers(): IStringDictionary<string> {\r\n        return this.privHeaders;\r\n    }\r\n\r\n    public get body(): any {\r\n        return this.privBody;\r\n    }\r\n\r\n    public get textBody(): string {\r\n        if (this.privMessageType === MessageType.Binary) {\r\n            throw new InvalidOperationError(\"Not supported for binary message\");\r\n        }\r\n\r\n        return this.privBody as string;\r\n    }\r\n\r\n    public get binaryBody(): ArrayBuffer {\r\n        if (this.privMessageType === MessageType.Text) {\r\n            throw new InvalidOperationError(\"Not supported for text message\");\r\n        }\r\n\r\n        return this.privBody;\r\n    }\r\n\r\n    public get id(): string {\r\n        return this.privId;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport class ConnectionOpenResponse {\r\n    private privStatusCode: number;\r\n    private privReason: string;\r\n\r\n    public constructor(statusCode: number, reason: string) {\r\n        this.privStatusCode = statusCode;\r\n        this.privReason = reason;\r\n    }\r\n\r\n    public get statusCode(): number {\r\n        return this.privStatusCode;\r\n    }\r\n\r\n    public get reason(): string {\r\n        return this.privReason;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Deferred } from \"./Promise.js\";\r\n\r\n/**\r\n * The error that is thrown when an argument passed in is null.\r\n *\r\n * @export\r\n * @class DefferalMap\r\n */\r\n\r\nexport class DeferralMap {\r\n    private privMap: { [id: string]: Deferred<any> } = {};\r\n\r\n    public add<T>(id: string, deferral: Deferred<T>): void {\r\n        this.privMap[id] = deferral;\r\n    }\r\n\r\n    public getId(id: string): Deferred<any> {\r\n        return this.privMap[id];\r\n    }\r\n\r\n    public complete<T>(id: string, result: T): void {\r\n        try {\r\n            this.privMap[id].resolve(result);\r\n        } catch (error) {\r\n            this.privMap[id].reject(error as string);\r\n        } finally {\r\n            this.privMap[id] = undefined;\r\n         }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport { AgentConfig } from \"../common.speech/Exports.js\";\r\nimport { EventType, PlatformEvent } from \"./PlatformEvent.js\";\r\n\r\nexport class DialogEvent extends PlatformEvent {\r\n\r\n    public constructor(eventName: string, eventType: EventType = EventType.Info) {\r\n        super(eventName, eventType);\r\n    }\r\n}\r\n\r\nexport class SendingAgentContextMessageEvent extends DialogEvent {\r\n    private privAgentConfig: AgentConfig;\r\n\r\n    public constructor(agentConfig: AgentConfig) {\r\n        super(\"SendingAgentContextMessageEvent\");\r\n        this.privAgentConfig = agentConfig;\r\n    }\r\n\r\n    public get agentConfig(): AgentConfig {\r\n        return this.privAgentConfig;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ObjectDisposedError } from \"./Error.js\";\r\nimport { createNoDashGuid } from \"./Guid.js\";\r\nimport { IDetachable } from \"./IDetachable.js\";\r\nimport { IStringDictionary } from \"./IDictionary.js\";\r\nimport { IEventListener } from \"./IEventListener.js\";\r\nimport { IEventSource } from \"./IEventSource.js\";\r\nimport { PlatformEvent } from \"./PlatformEvent.js\";\r\n\r\nexport class EventSource<TEvent extends PlatformEvent> implements IEventSource<TEvent> {\r\n    private privEventListeners: IStringDictionary<(event: TEvent) => void> = {};\r\n    private privMetadata: IStringDictionary<string>;\r\n    private privIsDisposed: boolean = false;\r\n    private privConsoleListener: IDetachable = undefined;\r\n\r\n    public constructor(metadata?: IStringDictionary<string>) {\r\n        this.privMetadata = metadata;\r\n    }\r\n\r\n    public onEvent(event: TEvent): void {\r\n        if (this.isDisposed()) {\r\n            throw (new ObjectDisposedError(\"EventSource\"));\r\n        }\r\n\r\n        if (this.metadata) {\r\n            for (const paramName in this.metadata) {\r\n                if (paramName) {\r\n                    if (event.metadata) {\r\n                        if (!event.metadata[paramName]) {\r\n                            event.metadata[paramName] = this.metadata[paramName];\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        for (const eventId in this.privEventListeners) {\r\n            if (eventId && this.privEventListeners[eventId]) {\r\n                this.privEventListeners[eventId](event);\r\n            }\r\n        }\r\n    }\r\n\r\n    public attach(onEventCallback: (event: TEvent) => void): IDetachable {\r\n        const id = createNoDashGuid();\r\n        this.privEventListeners[id] = onEventCallback;\r\n        return {\r\n            detach: (): Promise<void> => {\r\n                delete this.privEventListeners[id];\r\n                return Promise.resolve();\r\n            },\r\n        };\r\n    }\r\n\r\n    public attachListener(listener: IEventListener<TEvent>): IDetachable {\r\n        return this.attach((e: TEvent): void => listener.onEvent(e));\r\n    }\r\n\r\n    public attachConsoleListener(listener: IEventListener<TEvent>): IDetachable {\r\n        if (!!this.privConsoleListener) {\r\n            void this.privConsoleListener.detach(); // Detach implementation for eventListeners is synchronous\r\n        }\r\n        this.privConsoleListener = this.attach((e: TEvent): void => listener.onEvent(e));\r\n        return this.privConsoleListener;\r\n    }\r\n\r\n    public isDisposed(): boolean {\r\n        return this.privIsDisposed;\r\n    }\r\n\r\n    public dispose(): void {\r\n        this.privEventListeners = null;\r\n        this.privIsDisposed = true;\r\n    }\r\n\r\n    public get metadata(): IStringDictionary<string> {\r\n        return this.privMetadata;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ArgumentNullError } from \"./Error.js\";\r\nimport { EventSource } from \"./EventSource.js\";\r\nimport { IEventSource } from \"./IEventSource.js\";\r\nimport { PlatformEvent } from \"./PlatformEvent.js\";\r\n\r\nexport class Events {\r\n    private static privInstance: IEventSource<PlatformEvent> = new EventSource<PlatformEvent>();\r\n\r\n    public static setEventSource(eventSource: IEventSource<PlatformEvent>): void {\r\n        if (!eventSource) {\r\n            throw new ArgumentNullError(\"eventSource\");\r\n        }\r\n\r\n        Events.privInstance = eventSource;\r\n    }\r\n\r\n    public static get instance(): IEventSource<PlatformEvent> {\r\n        return Events.privInstance;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ConnectionEvent } from \"./ConnectionEvents.js\";\r\nimport { ConnectionMessage } from \"./ConnectionMessage.js\";\r\nimport { ConnectionOpenResponse } from \"./ConnectionOpenResponse.js\";\r\nimport { EventSource } from \"./EventSource.js\";\r\n\r\nexport enum ConnectionState {\r\n    None,\r\n    Connected,\r\n    Connecting,\r\n    Disconnected,\r\n}\r\n\r\nexport interface IConnection {\r\n    id: string;\r\n    state(): ConnectionState;\r\n    open(): Promise<ConnectionOpenResponse>;\r\n    send(message: ConnectionMessage): Promise<void>;\r\n    read(): Promise<ConnectionMessage>;\r\n    events: EventSource<ConnectionEvent>;\r\n    dispose(disposing?: string): Promise<void>;\r\n}\r\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n\n//# sourceMappingURL=IErrorMessages.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ObjectDisposedError } from \"./Error.js\";\r\nimport { IDetachable } from \"./IDetachable.js\";\r\nimport { IStringDictionary } from \"./IDictionary.js\";\r\nimport { IDisposable } from \"./IDisposable.js\";\r\n\r\nexport interface IList<TItem> extends IDisposable {\r\n    get(itemIndex: number): TItem;\r\n    first(): TItem;\r\n    last(): TItem;\r\n\r\n    add(item: TItem): void;\r\n    insertAt(index: number, item: TItem): void;\r\n\r\n    removeFirst(): TItem;\r\n    removeLast(): TItem;\r\n    removeAt(index: number): TItem;\r\n    remove(index: number, count: number): TItem[];\r\n    clear(): void;\r\n\r\n    length(): number;\r\n\r\n    onAdded(addedCallback: () => void): IDetachable;\r\n    onRemoved(removedCallback: () => void): IDetachable;\r\n    onDisposed(disposedCallback: () => void): IDetachable;\r\n\r\n    join(seperator?: string): string;\r\n\r\n    toArray(): TItem[];\r\n\r\n    any(callback?: (item: TItem, index: number) => boolean): boolean;\r\n    all(callback: (item: TItem) => boolean): boolean;\r\n    forEach(callback: (item: TItem, index: number) => void): void;\r\n    select<T2>(callback: (item: TItem, index: number) => T2): List<T2>;\r\n    where(callback: (item: TItem, index: number) => boolean): List<TItem>;\r\n    orderBy(compareFn: (a: TItem, b: TItem) => number): List<TItem>;\r\n    orderByDesc(compareFn: (a: TItem, b: TItem) => number): List<TItem>;\r\n    clone(): List<TItem>;\r\n    concat(list: List<TItem>): List<TItem>;\r\n    concatArray(array: TItem[]): List<TItem>;\r\n}\r\n\r\nexport class List<TItem> implements IList<TItem>  {\r\n    private privList: TItem[];\r\n    private privSubscriptionIdCounter: number = 0;\r\n    private privAddSubscriptions: IStringDictionary<() => void> = {};\r\n    private privRemoveSubscriptions: IStringDictionary<() => void> = {};\r\n    private privDisposedSubscriptions: IStringDictionary<() => void> = {};\r\n    private privDisposeReason: string = null;\r\n\r\n    public constructor(list?: TItem[]) {\r\n        this.privList = [];\r\n        // copy the list rather than taking as is.\r\n        if (list) {\r\n            for (const item of list) {\r\n                this.privList.push(item);\r\n            }\r\n        }\r\n    }\r\n\r\n    public get(itemIndex: number): TItem {\r\n        this.throwIfDisposed();\r\n        return this.privList[itemIndex];\r\n    }\r\n\r\n    public first(): TItem {\r\n        return this.get(0);\r\n    }\r\n\r\n    public last(): TItem {\r\n        return this.get(this.length() - 1);\r\n    }\r\n\r\n    public add(item: TItem): void {\r\n        this.throwIfDisposed();\r\n        this.insertAt(this.privList.length, item);\r\n    }\r\n\r\n    public insertAt(index: number, item: TItem): void {\r\n        this.throwIfDisposed();\r\n        if (index === 0) {\r\n            this.privList.unshift(item);\r\n        } else if (index === this.privList.length) {\r\n            this.privList.push(item);\r\n        } else {\r\n            this.privList.splice(index, 0, item);\r\n        }\r\n        this.triggerSubscriptions(this.privAddSubscriptions);\r\n    }\r\n\r\n    public removeFirst(): TItem {\r\n        this.throwIfDisposed();\r\n        return this.removeAt(0);\r\n    }\r\n\r\n    public removeLast(): TItem {\r\n        this.throwIfDisposed();\r\n        return this.removeAt(this.length() - 1);\r\n    }\r\n\r\n    public removeAt(index: number): TItem {\r\n        this.throwIfDisposed();\r\n        return this.remove(index, 1)[0];\r\n    }\r\n\r\n    public remove(index: number, count: number): TItem[] {\r\n        this.throwIfDisposed();\r\n        const removedElements = this.privList.splice(index, count);\r\n        this.triggerSubscriptions(this.privRemoveSubscriptions);\r\n        return removedElements;\r\n    }\r\n\r\n    public clear(): void {\r\n        this.throwIfDisposed();\r\n        this.remove(0, this.length());\r\n    }\r\n\r\n    public length(): number {\r\n        this.throwIfDisposed();\r\n        return this.privList.length;\r\n    }\r\n\r\n    public onAdded(addedCallback: () => void): IDetachable {\r\n        this.throwIfDisposed();\r\n        const subscriptionId = this.privSubscriptionIdCounter++;\r\n\r\n        this.privAddSubscriptions[subscriptionId] = addedCallback;\r\n\r\n        return {\r\n            detach: (): Promise<void> => {\r\n                delete this.privAddSubscriptions[subscriptionId];\r\n                return Promise.resolve();\r\n            },\r\n        };\r\n    }\r\n\r\n    public onRemoved(removedCallback: () => void): IDetachable {\r\n        this.throwIfDisposed();\r\n        const subscriptionId = this.privSubscriptionIdCounter++;\r\n\r\n        this.privRemoveSubscriptions[subscriptionId] = removedCallback;\r\n\r\n        return {\r\n            detach: (): Promise<void> => {\r\n                delete this.privRemoveSubscriptions[subscriptionId];\r\n                return Promise.resolve();\r\n            },\r\n        };\r\n    }\r\n\r\n    public onDisposed(disposedCallback: () => void): IDetachable {\r\n        this.throwIfDisposed();\r\n        const subscriptionId = this.privSubscriptionIdCounter++;\r\n\r\n        this.privDisposedSubscriptions[subscriptionId] = disposedCallback;\r\n\r\n        return {\r\n            detach: (): Promise<void> => {\r\n                delete this.privDisposedSubscriptions[subscriptionId];\r\n                return Promise.resolve();\r\n            },\r\n        };\r\n    }\r\n\r\n    public join(seperator?: string): string {\r\n        this.throwIfDisposed();\r\n        return this.privList.join(seperator);\r\n    }\r\n\r\n    public toArray(): TItem[] {\r\n        const cloneCopy = Array<TItem>();\r\n        this.privList.forEach((val: TItem): void => {\r\n            cloneCopy.push(val);\r\n        });\r\n        return cloneCopy;\r\n    }\r\n\r\n    public any(callback?: (item: TItem, index: number) => boolean): boolean {\r\n        this.throwIfDisposed();\r\n        if (callback) {\r\n            return this.where(callback).length() > 0;\r\n        } else {\r\n            return this.length() > 0;\r\n        }\r\n    }\r\n\r\n    public all(callback: (item: TItem) => boolean): boolean {\r\n        this.throwIfDisposed();\r\n        return this.where(callback).length() === this.length();\r\n    }\r\n\r\n    public forEach(callback: (item: TItem, index: number) => void): void {\r\n        this.throwIfDisposed();\r\n        for (let i = 0; i < this.length(); i++) {\r\n            callback(this.privList[i], i);\r\n        }\r\n    }\r\n\r\n    public select<T2>(callback: (item: TItem, index: number) => T2): List<T2> {\r\n        this.throwIfDisposed();\r\n        const selectList: T2[] = [];\r\n        for (let i = 0; i < this.privList.length; i++) {\r\n            selectList.push(callback(this.privList[i], i));\r\n        }\r\n\r\n        return new List<T2>(selectList);\r\n    }\r\n\r\n    public where(callback: (item: TItem, index: number) => boolean): List<TItem> {\r\n        this.throwIfDisposed();\r\n        const filteredList = new List<TItem>();\r\n        for (let i = 0; i < this.privList.length; i++) {\r\n            if (callback(this.privList[i], i)) {\r\n                filteredList.add(this.privList[i]);\r\n            }\r\n        }\r\n        return filteredList;\r\n    }\r\n\r\n    public orderBy(compareFn: (a: TItem, b: TItem) => number): List<TItem> {\r\n        this.throwIfDisposed();\r\n        const clonedArray = this.toArray();\r\n        const orderedArray = clonedArray.sort(compareFn);\r\n        return new List(orderedArray);\r\n    }\r\n\r\n    public orderByDesc(compareFn: (a: TItem, b: TItem) => number): List<TItem> {\r\n        this.throwIfDisposed();\r\n        return this.orderBy((a: TItem, b: TItem): number => compareFn(b, a));\r\n    }\r\n\r\n    public clone(): List<TItem> {\r\n        this.throwIfDisposed();\r\n        return new List<TItem>(this.toArray());\r\n    }\r\n\r\n    public concat(list: List<TItem>): List<TItem> {\r\n        this.throwIfDisposed();\r\n        return new List<TItem>(this.privList.concat(list.toArray()));\r\n    }\r\n\r\n    public concatArray(array: TItem[]): List<TItem> {\r\n        this.throwIfDisposed();\r\n        return new List<TItem>(this.privList.concat(array));\r\n    }\r\n\r\n    public isDisposed(): boolean {\r\n        return this.privList == null;\r\n    }\r\n\r\n    public dispose(reason?: string): void {\r\n        if (!this.isDisposed()) {\r\n            this.privDisposeReason = reason;\r\n            this.privList = null;\r\n            this.privAddSubscriptions = null;\r\n            this.privRemoveSubscriptions = null;\r\n            this.triggerSubscriptions(this.privDisposedSubscriptions);\r\n        }\r\n    }\r\n\r\n    private throwIfDisposed(): void {\r\n        if (this.isDisposed()) {\r\n            throw new ObjectDisposedError(\"List\", this.privDisposeReason);\r\n        }\r\n    }\r\n\r\n    private triggerSubscriptions(subscriptions: IStringDictionary<() => void>): void {\r\n        if (subscriptions) {\r\n            for (const subscriptionId in subscriptions) {\r\n                if (subscriptionId) {\r\n                    subscriptions[subscriptionId]();\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file, @typescript-eslint/typedef */\r\n\r\nexport enum PromiseState {\r\n    None,\r\n    Resolved,\r\n    Rejected,\r\n}\r\n\r\nexport interface IDeferred<T> {\r\n    readonly promise: Promise<T>;\r\n\r\n    resolve(result: T): IDeferred<T>;\r\n\r\n    reject(error: string): IDeferred<T>;\r\n}\r\n\r\nexport class PromiseResult<T> {\r\n    protected privIsCompleted: boolean;\r\n    protected privIsError: boolean;\r\n    protected privError: string;\r\n    protected privResult: T;\r\n\r\n    public constructor(promiseResultEventSource: PromiseResultEventSource<T>) {\r\n        promiseResultEventSource.on((result: T): void => {\r\n            if (!this.privIsCompleted) {\r\n                this.privIsCompleted = true;\r\n                this.privIsError = false;\r\n                this.privResult = result;\r\n            }\r\n        }, (error: string): void => {\r\n            if (!this.privIsCompleted) {\r\n                this.privIsCompleted = true;\r\n                this.privIsError = true;\r\n                this.privError = error;\r\n            }\r\n        });\r\n    }\r\n\r\n    public get isCompleted(): boolean {\r\n        return this.privIsCompleted;\r\n    }\r\n\r\n    public get isError(): boolean {\r\n        return this.privIsError;\r\n    }\r\n\r\n    public get error(): string {\r\n        return this.privError;\r\n    }\r\n\r\n    public get result(): T {\r\n        return this.privResult;\r\n    }\r\n\r\n    public throwIfError = (): void => {\r\n        if (this.isError) {\r\n            throw this.error;\r\n        }\r\n    };\r\n}\r\n\r\nexport class PromiseResultEventSource<T>  {\r\n\r\n    private privOnSetResult: (result: T) => void;\r\n    private privOnSetError: (error: string) => void;\r\n\r\n    public setResult = (result: T): void => {\r\n        this.privOnSetResult(result);\r\n    };\r\n\r\n    public setError = (error: string): void => {\r\n        this.privOnSetError(error);\r\n    };\r\n\r\n    public on = (onSetResult: (result: T) => void, onSetError: (error: string) => void): void => {\r\n        this.privOnSetResult = onSetResult;\r\n        this.privOnSetError = onSetError;\r\n    };\r\n}\r\n\r\nexport class Deferred<T> implements IDeferred<T> {\r\n    private privPromise: Promise<T>;\r\n    private privResolve: (value?: T | PromiseLike<T>) => void;\r\n    private privReject: (reason?: any) => void;\r\n\r\n    public constructor() {\r\n        // eslint-disable-next-line @typescript-eslint/explicit-function-return-type\r\n        this.privPromise = new Promise<T>((resolve: (value: T) => void, reject: (reason: any) => void) => {\r\n            this.privResolve = resolve;\r\n            this.privReject = reject;\r\n        });\r\n    }\r\n\r\n    public get promise(): Promise<T> {\r\n        return this.privPromise;\r\n    }\r\n\r\n    public resolve = (result: T | Promise<T>): Deferred<T> => {\r\n        this.privResolve(result);\r\n        return this;\r\n    };\r\n\r\n    public reject = (error: string): Deferred<T> => {\r\n        this.privReject(error);\r\n        return this;\r\n    };\r\n}\r\n\r\nexport class Sink<T> {\r\n    private privState: PromiseState = PromiseState.None;\r\n    private privPromiseResult: PromiseResult<T> = null;\r\n    private privPromiseResultEvents: PromiseResultEventSource<T> = null;\r\n\r\n    private privSuccessHandlers: ((result: T) => void)[] = [];\r\n    private privErrorHandlers: ((e: string) => void)[] = [];\r\n\r\n    public constructor() {\r\n        this.privPromiseResultEvents = new PromiseResultEventSource();\r\n        this.privPromiseResult = new PromiseResult(this.privPromiseResultEvents);\r\n    }\r\n\r\n    public get state(): PromiseState {\r\n        return this.privState;\r\n    }\r\n\r\n    public get result(): PromiseResult<T> {\r\n        return this.privPromiseResult;\r\n    }\r\n\r\n    public resolve(result: T): void {\r\n        if (this.privState !== PromiseState.None) {\r\n            throw new Error(\"'Cannot resolve a completed promise'\");\r\n        }\r\n\r\n        this.privState = PromiseState.Resolved;\r\n        this.privPromiseResultEvents.setResult(result);\r\n\r\n        for (let i = 0; i < this.privSuccessHandlers.length; i++) {\r\n            this.executeSuccessCallback(result, this.privSuccessHandlers[i], this.privErrorHandlers[i]);\r\n        }\r\n\r\n        this.detachHandlers();\r\n    }\r\n\r\n    public reject(error: string): void {\r\n        if (this.privState !== PromiseState.None) {\r\n            throw new Error(\"'Cannot reject a completed promise'\");\r\n        }\r\n\r\n        this.privState = PromiseState.Rejected;\r\n        this.privPromiseResultEvents.setError(error);\r\n\r\n        for (const errorHandler of this.privErrorHandlers) {\r\n            this.executeErrorCallback(error, errorHandler);\r\n        }\r\n\r\n        this.detachHandlers();\r\n    }\r\n\r\n    public on(\r\n        successCallback: (result: T) => void,\r\n        errorCallback: (error: string) => void): void {\r\n\r\n        if (successCallback == null) {\r\n            // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n            successCallback = (): void => { };\r\n        }\r\n\r\n        if (this.privState === PromiseState.None) {\r\n            this.privSuccessHandlers.push(successCallback);\r\n            this.privErrorHandlers.push(errorCallback);\r\n        } else {\r\n            if (this.privState === PromiseState.Resolved) {\r\n                this.executeSuccessCallback(this.privPromiseResult.result, successCallback, errorCallback);\r\n            } else if (this.privState === PromiseState.Rejected) {\r\n                this.executeErrorCallback(this.privPromiseResult.error, errorCallback);\r\n            }\r\n\r\n            this.detachHandlers();\r\n        }\r\n    }\r\n\r\n    private executeSuccessCallback(result: T, successCallback: (result: T) => void, errorCallback: (error: string) => void): void {\r\n        try {\r\n            successCallback(result);\r\n        } catch (e) {\r\n            this.executeErrorCallback(`'Unhandled callback error: ${e as string}'`, errorCallback);\r\n        }\r\n    }\r\n\r\n    private executeErrorCallback(error: string, errorCallback: (error: string) => void): void {\r\n        if (errorCallback) {\r\n            try {\r\n                errorCallback(error);\r\n            } catch (e) {\r\n                throw new Error(`'Unhandled callback error: ${e as string}. InnerError: ${error}'`);\r\n            }\r\n        } else {\r\n            throw new Error(`'Unhandled error: ${error}'`);\r\n        }\r\n    }\r\n\r\n    private detachHandlers(): void {\r\n        this.privErrorHandlers = [];\r\n        this.privSuccessHandlers = [];\r\n    }\r\n}\r\n\r\n// eslint-disable-next-line prefer-arrow/prefer-arrow-functions\r\nexport function marshalPromiseToCallbacks<T>(\r\n    promise: Promise<T>,\r\n    cb?: (value: T) => void,\r\n    err?: (error: string) => void): void {\r\n    promise.then((val: T): void => {\r\n        try {\r\n            if (!!cb) {\r\n                cb(val);\r\n            }\r\n        } catch (error) {\r\n            if (!!err) {\r\n                try {\r\n                    if (error instanceof Error) {\r\n                        const typedError: Error = error ;\r\n                        err(typedError.name + \": \" + typedError.message);\r\n                    } else {\r\n                        err(error as string);\r\n                    }\r\n                // eslint-disable-next-line no-empty\r\n                } catch (error) { }\r\n            }\r\n        }\r\n    }, (error: any): void => {\r\n        if (!!err) {\r\n            try {\r\n                if (error instanceof Error) {\r\n                    const typedError: Error = error;\r\n                    err(typedError.name + \": \" + typedError.message);\r\n                } else {\r\n                    err(error as string);\r\n                }\r\n            // eslint-disable-next-line no-empty\r\n            } catch (error) { }\r\n        }\r\n    });\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { InvalidOperationError, ObjectDisposedError } from \"./Error.js\";\r\nimport { IDetachable } from \"./IDetachable.js\";\r\nimport { IDisposable } from \"./IDisposable.js\";\r\nimport { List } from \"./List.js\";\r\nimport {\r\n    Deferred,\r\n} from \"./Promise.js\";\r\nexport interface IQueue<TItem> extends IDisposable {\r\n    enqueue(item: TItem): void;\r\n    enqueueFromPromise(promise: Promise<TItem>): void;\r\n    dequeue(): Promise<TItem>;\r\n    peek(): Promise<TItem>;\r\n    length(): number;\r\n}\r\n\r\nenum SubscriberType {\r\n    Dequeue,\r\n    Peek,\r\n}\r\n\r\nexport class Queue<TItem> implements IQueue<TItem> {\r\n    private privPromiseStore: List<Promise<TItem>> = new List<Promise<TItem>>();\r\n    private privList: List<TItem>;\r\n    private privDetachables: IDetachable[];\r\n    private privSubscribers: List<{ type: SubscriberType; deferral: Deferred<TItem> }>;\r\n    private privIsDrainInProgress: boolean = false;\r\n    private privIsDisposing: boolean = false;\r\n    private privDisposeReason: string = null;\r\n\r\n    public constructor(list?: List<TItem>) {\r\n        this.privList = list ? list : new List<TItem>();\r\n        this.privDetachables = [];\r\n        this.privSubscribers = new List<{ type: SubscriberType; deferral: Deferred<TItem> }>();\r\n        this.privDetachables.push(this.privList.onAdded((): void => this.drain()));\r\n    }\r\n\r\n    public enqueue(item: TItem): void {\r\n        this.throwIfDispose();\r\n        this.enqueueFromPromise(new Promise<TItem>((resolve: (value: TItem) => void): void => resolve(item)));\r\n    }\r\n\r\n    public enqueueFromPromise(promise: Promise<TItem>): void {\r\n        this.throwIfDispose();\r\n        promise.then((val: TItem): void => {\r\n            this.privList.add(val);\r\n        // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n        }, (): void => { });\r\n    }\r\n\r\n    public dequeue(): Promise<TItem> {\r\n        this.throwIfDispose();\r\n        const deferredSubscriber = new Deferred<TItem>();\r\n\r\n        if (this.privSubscribers) {\r\n            this.privSubscribers.add({ deferral: deferredSubscriber, type: SubscriberType.Dequeue });\r\n            this.drain();\r\n        }\r\n\r\n        return deferredSubscriber.promise;\r\n    }\r\n\r\n    public peek(): Promise<TItem> {\r\n        this.throwIfDispose();\r\n        const deferredSubscriber = new Deferred<TItem>();\r\n\r\n        const subs = this.privSubscribers;\r\n        if (subs) {\r\n            this.privSubscribers.add({ deferral: deferredSubscriber, type: SubscriberType.Peek });\r\n            this.drain();\r\n        }\r\n\r\n        return deferredSubscriber.promise;\r\n    }\r\n\r\n    public length(): number {\r\n        this.throwIfDispose();\r\n        return this.privList.length();\r\n    }\r\n\r\n    public isDisposed(): boolean {\r\n        return this.privSubscribers == null;\r\n    }\r\n\r\n    public async drainAndDispose(pendingItemProcessor: (pendingItemInQueue: TItem) => void, reason?: string): Promise<void> {\r\n        if (!this.isDisposed() && !this.privIsDisposing) {\r\n            this.privDisposeReason = reason;\r\n            this.privIsDisposing = true;\r\n\r\n            const subs = this.privSubscribers;\r\n            if (subs) {\r\n                while (subs.length() > 0) {\r\n                    const subscriber = subs.removeFirst();\r\n                    // TODO: this needs work (Resolve(null) instead?).\r\n                    subscriber.deferral.resolve(undefined);\r\n                    // subscriber.deferral.reject(\"Disposed\");\r\n                }\r\n\r\n                // note: this block assumes cooperative multitasking, i.e.,\r\n                // between the if-statement and the assignment there are no\r\n                // thread switches.\r\n                // Reason is that between the initial const = this.; and this\r\n                // point there is the derral.resolve() operation that might have\r\n                // caused recursive calls to the Queue, especially, calling\r\n                // Dispose() on the queue alredy (which would reset the var\r\n                // here to null!).\r\n                // That should generally hold true for javascript...\r\n                if (this.privSubscribers === subs) {\r\n                    this.privSubscribers = subs;\r\n                }\r\n            }\r\n\r\n            for (const detachable of this.privDetachables) {\r\n                await detachable.detach();\r\n            }\r\n\r\n            if (this.privPromiseStore.length() > 0 && pendingItemProcessor) {\r\n                const promiseArray: Promise<TItem>[] = [];\r\n\r\n                this.privPromiseStore.toArray().forEach((wrapper: Promise<TItem>): void => {\r\n                    promiseArray.push(wrapper);\r\n                });\r\n                return Promise.all(promiseArray).finally((): void => {\r\n                    this.privSubscribers = null;\r\n                    this.privList.forEach((item: TItem): void => {\r\n                        pendingItemProcessor(item);\r\n                    });\r\n                    this.privList = null;\r\n                    return;\r\n                }).then<void>();\r\n            } else {\r\n                this.privSubscribers = null;\r\n                this.privList = null;\r\n            }\r\n        }\r\n    }\r\n\r\n    public async dispose(reason?: string): Promise<void> {\r\n        await this.drainAndDispose(null, reason);\r\n    }\r\n\r\n    private drain(): void {\r\n        if (!this.privIsDrainInProgress && !this.privIsDisposing) {\r\n            this.privIsDrainInProgress = true;\r\n\r\n            const subs = this.privSubscribers;\r\n            const lists = this.privList;\r\n            if (subs && lists) {\r\n                while (lists.length() > 0 && subs.length() > 0 && !this.privIsDisposing) {\r\n                    const subscriber = subs.removeFirst();\r\n                    if (subscriber.type === SubscriberType.Peek) {\r\n                        subscriber.deferral.resolve(lists.first());\r\n                    } else {\r\n                        const dequeuedItem = lists.removeFirst();\r\n                        subscriber.deferral.resolve(dequeuedItem);\r\n                    }\r\n                }\r\n\r\n                // note: this block assumes cooperative multitasking, i.e.,\r\n                // between the if-statement and the assignment there are no\r\n                // thread switches.\r\n                // Reason is that between the initial const = this.; and this\r\n                // point there is the derral.resolve() operation that might have\r\n                // caused recursive calls to the Queue, especially, calling\r\n                // Dispose() on the queue alredy (which would reset the var\r\n                // here to null!).\r\n                // That should generally hold true for javascript...\r\n                if (this.privSubscribers === subs) {\r\n                    this.privSubscribers = subs;\r\n                }\r\n\r\n                // note: this block assumes cooperative multitasking, i.e.,\r\n                // between the if-statement and the assignment there are no\r\n                // thread switches.\r\n                // Reason is that between the initial const = this.; and this\r\n                // point there is the derral.resolve() operation that might have\r\n                // caused recursive calls to the Queue, especially, calling\r\n                // Dispose() on the queue alredy (which would reset the var\r\n                // here to null!).\r\n                // That should generally hold true for javascript...\r\n                if (this.privList === lists) {\r\n                    this.privList = lists;\r\n                }\r\n            }\r\n\r\n            this.privIsDrainInProgress = false;\r\n        }\r\n    }\r\n\r\n    private throwIfDispose(): void {\r\n        if (this.isDisposed()) {\r\n            if (this.privDisposeReason) {\r\n                throw new InvalidOperationError(this.privDisposeReason);\r\n            }\r\n\r\n            throw new ObjectDisposedError(\"Queue\");\r\n        } else if (this.privIsDisposing) {\r\n            throw new InvalidOperationError(\"Queue disposing\");\r\n        }\r\n    }\r\n}\r\n","/* eslint-disable @typescript-eslint/no-unsafe-assignment */\r\n// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { MessageType } from \"./ConnectionMessage.js\";\r\nimport { ArgumentNullError, InvalidOperationError } from \"./Error.js\";\r\nimport { createNoDashGuid } from \"./Guid.js\";\r\n\r\nexport class RawWebsocketMessage {\r\n    private privMessageType: MessageType;\r\n    private privPayload: any = null;\r\n    private privId: string;\r\n\r\n    public constructor(messageType: MessageType, payload: any, id?: string) {\r\n        if (!payload) {\r\n            throw new ArgumentNullError(\"payload\");\r\n        }\r\n\r\n        // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\r\n        if (messageType === MessageType.Binary && Object.getPrototypeOf(payload).constructor.name !== \"ArrayBuffer\") {\r\n            throw new InvalidOperationError(\"Payload must be ArrayBuffer\");\r\n        }\r\n\r\n        if (messageType === MessageType.Text && !(typeof (payload) === \"string\")) {\r\n            throw new InvalidOperationError(\"Payload must be a string\");\r\n        }\r\n\r\n        this.privMessageType = messageType;\r\n        this.privPayload = payload;\r\n        this.privId = id ? id : createNoDashGuid();\r\n    }\r\n\r\n    public get messageType(): MessageType {\r\n        return this.privMessageType;\r\n    }\r\n\r\n    public get payload(): any {\r\n        // eslint-disable-next-line @typescript-eslint/no-unsafe-return\r\n        return this.privPayload;\r\n    }\r\n\r\n    public get textContent(): string {\r\n        if (this.privMessageType === MessageType.Binary) {\r\n            throw new InvalidOperationError(\"Not supported for binary message\");\r\n        }\r\n\r\n        return this.privPayload as string;\r\n    }\r\n\r\n    public get binaryContent(): ArrayBuffer {\r\n        if (this.privMessageType === MessageType.Text) {\r\n            throw new InvalidOperationError(\"Not supported for text message\");\r\n        }\r\n\r\n        return this.privPayload as ArrayBuffer;\r\n    }\r\n\r\n    public get id(): string {\r\n        return this.privId;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport class RiffPcmEncoder {\r\n\r\n    private privActualSampleRate: number;\r\n    private privDesiredSampleRate: number;\r\n\r\n    public constructor(actualSampleRate: number, desiredSampleRate: number) {\r\n        this.privActualSampleRate = actualSampleRate;\r\n        this.privDesiredSampleRate = desiredSampleRate;\r\n    }\r\n\r\n    public encode(actualAudioFrame: Float32Array): ArrayBuffer {\r\n\r\n        const audioFrame = this.downSampleAudioFrame(actualAudioFrame, this.privActualSampleRate, this.privDesiredSampleRate);\r\n\r\n        if (!audioFrame) {\r\n            return null;\r\n        }\r\n\r\n        const audioLength = audioFrame.length * 2;\r\n\r\n        const buffer = new ArrayBuffer(audioLength);\r\n        const view = new DataView(buffer);\r\n        this.floatTo16BitPCM(view, 0, audioFrame);\r\n\r\n        return buffer;\r\n    }\r\n\r\n    private setString(view: DataView, offset: number, str: string): void {\r\n        for (let i = 0; i < str.length; i++) {\r\n            view.setUint8(offset + i, str.charCodeAt(i));\r\n        }\r\n    }\r\n\r\n    private floatTo16BitPCM(view: DataView, offset: number, input: Float32Array): void {\r\n        for (let i = 0; i < input.length; i++ , offset += 2) {\r\n            const s = Math.max(-1, Math.min(1, input[i]));\r\n            view.setInt16(offset, s < 0 ? s * 0x8000 : s * 0x7FFF, true);\r\n        }\r\n    }\r\n\r\n    private downSampleAudioFrame(\r\n        srcFrame: Float32Array,\r\n        srcRate: number,\r\n        dstRate: number): Float32Array {\r\n\r\n        if (!srcFrame) {\r\n            return null;\r\n        }\r\n\r\n        if (dstRate === srcRate || dstRate > srcRate) {\r\n            return srcFrame;\r\n        }\r\n\r\n        const ratio = srcRate / dstRate;\r\n        const dstLength = Math.round(srcFrame.length / ratio);\r\n        const dstFrame = new Float32Array(dstLength);\r\n        let srcOffset = 0;\r\n        let dstOffset = 0;\r\n        while (dstOffset < dstLength) {\r\n            const nextSrcOffset = Math.round((dstOffset + 1) * ratio);\r\n            let accum = 0;\r\n            let count = 0;\r\n            while (srcOffset < nextSrcOffset && srcOffset < srcFrame.length) {\r\n                accum += srcFrame[srcOffset++];\r\n                count++;\r\n            }\r\n            dstFrame[dstOffset++] = accum / count;\r\n        }\r\n\r\n        return dstFrame;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { InvalidOperationError } from \"./Error.js\";\r\nimport { createNoDashGuid } from \"./Guid.js\";\r\nimport { Queue } from \"./Queue.js\";\r\n\r\nexport interface IStreamChunk<TBuffer> {\r\n    isEnd: boolean;\r\n    buffer: TBuffer;\r\n    timeReceived: number;\r\n}\r\n\r\nexport class Stream<TBuffer> {\r\n    private privId: string;\r\n    private privIsWriteEnded: boolean = false;\r\n    private privIsReadEnded: boolean = false;\r\n    private privReaderQueue: Queue<IStreamChunk<TBuffer>>;\r\n\r\n    public constructor(streamId?: string) {\r\n        this.privId = streamId ? streamId : createNoDashGuid();\r\n        this.privReaderQueue = new Queue<IStreamChunk<TBuffer>>();\r\n    }\r\n\r\n    public get isClosed(): boolean {\r\n        return this.privIsWriteEnded;\r\n    }\r\n\r\n    public get isReadEnded(): boolean {\r\n        return this.privIsReadEnded;\r\n    }\r\n\r\n    public get id(): string {\r\n        return this.privId;\r\n    }\r\n\r\n    public close(): void {\r\n        if (!this.privIsWriteEnded) {\r\n            this.writeStreamChunk({\r\n                buffer: null,\r\n                isEnd: true,\r\n                timeReceived: Date.now(),\r\n            });\r\n            this.privIsWriteEnded = true;\r\n        }\r\n    }\r\n\r\n    public writeStreamChunk(streamChunk: IStreamChunk<TBuffer>): void {\r\n        this.throwIfClosed();\r\n        if (!this.privReaderQueue.isDisposed()) {\r\n            try {\r\n                this.privReaderQueue.enqueue(streamChunk);\r\n            } catch (e) {\r\n                // Do nothing\r\n            }\r\n        }\r\n    }\r\n\r\n    public read(): Promise<IStreamChunk<TBuffer>> {\r\n        if (this.privIsReadEnded) {\r\n            throw new InvalidOperationError(\"Stream read has already finished\");\r\n        }\r\n\r\n        return this.privReaderQueue\r\n            .dequeue()\r\n            .then(async (streamChunk: IStreamChunk<TBuffer>): Promise<IStreamChunk<TBuffer>> => {\r\n                if (streamChunk === undefined || streamChunk.isEnd) {\r\n                    await this.privReaderQueue.dispose(\"End of stream reached\");\r\n                }\r\n\r\n                return streamChunk;\r\n            });\r\n    }\r\n    public readEnded(): void {\r\n        if (!this.privIsReadEnded) {\r\n            this.privIsReadEnded = true;\r\n            this.privReaderQueue = new Queue<IStreamChunk<TBuffer>>();\r\n        }\r\n    }\r\n\r\n    private throwIfClosed(): void {\r\n        if (this.privIsWriteEnded) {\r\n            throw new InvalidOperationError(\"Stream closed\");\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines translation status.\r\n * @class TranslationStatus\r\n */\r\nexport enum TranslationStatus {\r\n    /**\r\n     * @member TranslationStatus.Success\r\n     */\r\n    Success = 0,\r\n\r\n    /**\r\n     * @member TranslationStatus.Error\r\n     */\r\n    Error,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { IStreamChunk, Stream } from \"./Exports.js\";\r\n\r\nexport class ChunkedArrayBufferStream extends Stream<ArrayBuffer> {\r\n    private privTargetChunkSize: number;\r\n    private privNextBufferToWrite: ArrayBuffer;\r\n    private privNextBufferStartTime: number;\r\n    private privNextBufferReadyBytes: number;\r\n\r\n    public constructor(targetChunkSize: number, streamId?: string) {\r\n        super(streamId);\r\n        this.privTargetChunkSize = Math.round(targetChunkSize);\r\n        this.privNextBufferReadyBytes = 0;\r\n    }\r\n\r\n    public writeStreamChunk(chunk: IStreamChunk<ArrayBuffer>): void {\r\n        // No pending write, and the buffer is the right size so write it.\r\n        if (chunk.isEnd ||\r\n            (0 === this.privNextBufferReadyBytes && chunk.buffer.byteLength === this.privTargetChunkSize)) {\r\n            super.writeStreamChunk(chunk);\r\n            return;\r\n        }\r\n\r\n        let bytesCopiedFromBuffer: number = 0;\r\n\r\n        while (bytesCopiedFromBuffer < chunk.buffer.byteLength) {\r\n            // Fill the next buffer.\r\n            if (undefined === this.privNextBufferToWrite) {\r\n                this.privNextBufferToWrite = new ArrayBuffer(this.privTargetChunkSize);\r\n                this.privNextBufferStartTime = chunk.timeReceived;\r\n            }\r\n\r\n            // Find out how many bytes we can copy into the read buffer.\r\n            const bytesToCopy: number = Math.min(chunk.buffer.byteLength - bytesCopiedFromBuffer, this.privTargetChunkSize - this.privNextBufferReadyBytes);\r\n            const targetView: Uint8Array = new Uint8Array(this.privNextBufferToWrite);\r\n            const sourceView: Uint8Array = new Uint8Array(chunk.buffer.slice(bytesCopiedFromBuffer, bytesToCopy + bytesCopiedFromBuffer));\r\n\r\n            targetView.set(sourceView, this.privNextBufferReadyBytes);\r\n            this.privNextBufferReadyBytes += bytesToCopy;\r\n            bytesCopiedFromBuffer += bytesToCopy;\r\n\r\n            // Are we ready to write?\r\n            if (this.privNextBufferReadyBytes === this.privTargetChunkSize) {\r\n                super.writeStreamChunk({\r\n                    buffer: this.privNextBufferToWrite,\r\n                    isEnd: false,\r\n                    timeReceived: this.privNextBufferStartTime,\r\n                });\r\n                this.privNextBufferReadyBytes = 0;\r\n                this.privNextBufferToWrite = undefined;\r\n            }\r\n        }\r\n    }\r\n\r\n    public close(): void {\r\n        // Send whatever is pending, then close the base class.\r\n        if (0 !== this.privNextBufferReadyBytes && !this.isClosed) {\r\n            super.writeStreamChunk({\r\n                buffer: this.privNextBufferToWrite.slice(0, this.privNextBufferReadyBytes),\r\n                isEnd: false,\r\n                timeReceived: this.privNextBufferStartTime,\r\n            });\r\n        }\r\n\r\n        super.close();\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\ntype TWorkerMessage = ICallNotification | IClearResponse | IErrorNotification | IErrorResponse;\r\n\r\ninterface IClearResponse {\r\n    error: null;\r\n    id: number;\r\n}\r\n\r\ninterface IErrorNotification {\r\n    error: {\r\n        message: string;\r\n    };\r\n    id: null;\r\n    result: null;\r\n}\r\n\r\ninterface IErrorResponse {\r\n    error: {\r\n        message: string;\r\n    };\r\n    id: number;\r\n    result: null;\r\n}\r\n\r\ninterface ICallNotification {\r\n    id: null;\r\n    method: \"call\";\r\n    params: {\r\n        timerId: number;\r\n    };\r\n}\r\n\r\ninterface ISetNotification {\r\n    id: null;\r\n    method: \"set\";\r\n    params: {\r\n        delay: number;\r\n        now: number;\r\n        timerId: number;\r\n    };\r\n}\r\n\r\ninterface IClearRequest {\r\n    id: number;\r\n    method: \"clear\";\r\n    params: {\r\n        timerId: number;\r\n    };\r\n}\r\n\r\ninterface IWorkerEvent extends Event {\r\n    data: TWorkerMessage;\r\n}\r\n\r\ninterface IWorkerTimers {\r\n    clearTimeout: (timerId: number) => void;\r\n    setTimeout: (func: () => any, delay: number) => number;\r\n}\r\n\r\ndeclare type Func = () => any;\r\n\r\nexport class Timeout {\r\n\r\n    private static workerTimers: null | IWorkerTimers = null;\r\n\r\n    public static clearTimeout: IWorkerTimers[\"clearTimeout\"] = (timerId: number): void => Timeout.timers().clearTimeout(timerId);\r\n\r\n    public static setTimeout: IWorkerTimers[\"setTimeout\"] = (func: () => any, delay: number): number => Timeout.timers().setTimeout(func, delay);\r\n\r\n    public static load(): any {\r\n        // Prefilling the Maps with a function indexed by zero is necessary to be compliant with the specification.\r\n        const scheduledTimeoutFunctions: Map<number, number | Func> = new Map([[0, (): void => { }]]); // eslint-disable-line @typescript-eslint/no-empty-function\r\n        const unhandledRequests: Map<number, number> = new Map();\r\n\r\n        // eslint-disable-next-line\r\n        const workerScript = `!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(e,\"__esModule\",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&\"object\"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,\"default\",{enumerable:!0,value:e}),2&t&&\"string\"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,\"a\",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=\"\",n(n.s=14)}([function(e,t,n){\"use strict\";n.d(t,\"a\",(function(){return i})),n.d(t,\"b\",(function(){return u})),n.d(t,\"c\",(function(){return a})),n.d(t,\"d\",(function(){return d}));const r=new Map,o=new Map,i=e=>{const t=r.get(e);if(void 0===t)throw new Error('There is no interval scheduled with the given id \"'.concat(e,'\".'));clearTimeout(t),r.delete(e)},u=e=>{const t=o.get(e);if(void 0===t)throw new Error('There is no timeout scheduled with the given id \"'.concat(e,'\".'));clearTimeout(t),o.delete(e)},f=(e,t)=>{let n,r;if(\"performance\"in self){const o=performance.now();n=o,r=e-Math.max(0,o-t)}else n=Date.now(),r=e;return{expected:n+r,remainingDelay:r}},c=(e,t,n,r)=>{const o=\"performance\"in self?performance.now():Date.now();o>n?postMessage({id:null,method:\"call\",params:{timerId:t}}):e.set(t,setTimeout(c,n-o,e,t,n))},a=(e,t,n)=>{const{expected:o,remainingDelay:i}=f(e,n);r.set(t,setTimeout(c,i,r,t,o))},d=(e,t,n)=>{const{expected:r,remainingDelay:i}=f(e,n);o.set(t,setTimeout(c,i,o,t,r))}},function(e,t,n){\"use strict\";n.r(t);var r=n(2);for(var o in r)\"default\"!==o&&function(e){n.d(t,e,(function(){return r[e]}))}(o);var i=n(3);for(var o in i)\"default\"!==o&&function(e){n.d(t,e,(function(){return i[e]}))}(o);var u=n(4);for(var o in u)\"default\"!==o&&function(e){n.d(t,e,(function(){return u[e]}))}(o);var f=n(5);for(var o in f)\"default\"!==o&&function(e){n.d(t,e,(function(){return f[e]}))}(o);var c=n(6);for(var o in c)\"default\"!==o&&function(e){n.d(t,e,(function(){return c[e]}))}(o);var a=n(7);for(var o in a)\"default\"!==o&&function(e){n.d(t,e,(function(){return a[e]}))}(o);var d=n(8);for(var o in d)\"default\"!==o&&function(e){n.d(t,e,(function(){return d[e]}))}(o);var s=n(9);for(var o in s)\"default\"!==o&&function(e){n.d(t,e,(function(){return s[e]}))}(o)},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,n){\"use strict\";n.r(t);var r=n(11);for(var o in r)\"default\"!==o&&function(e){n.d(t,e,(function(){return r[e]}))}(o);var i=n(12);for(var o in i)\"default\"!==o&&function(e){n.d(t,e,(function(){return i[e]}))}(o);var u=n(13);for(var o in u)\"default\"!==o&&function(e){n.d(t,e,(function(){return u[e]}))}(o)},function(e,t){},function(e,t){},function(e,t){},function(e,t,n){\"use strict\";n.r(t);var r=n(0),o=n(1);for(var i in o)\"default\"!==i&&function(e){n.d(t,e,(function(){return o[e]}))}(i);var u=n(10);for(var i in u)\"default\"!==i&&function(e){n.d(t,e,(function(){return u[e]}))}(i);addEventListener(\"message\",({data:e})=>{try{if(\"clear\"===e.method){const{id:t,params:{timerId:n}}=e;Object(r.b)(n),postMessage({error:null,id:t})}else{if(\"set\"!==e.method)throw new Error('The given method \"'.concat(e.method,'\" is not supported'));{const{params:{delay:t,now:n,timerId:o}}=e;Object(r.d)(t,o,n)}}}catch(t){postMessage({error:{message:t.message},id:e.id,result:null})}})}]);`;\r\n        const workerUrl = \"data:text/javascript;base64,\" + btoa(workerScript);\r\n        const worker = new Worker(workerUrl);\r\n\r\n        worker.addEventListener(\"message\", ({ data }: IWorkerEvent): void => {\r\n            if (Timeout.isCallNotification(data)) {\r\n                const {\r\n                    params: { timerId }\r\n                } = data;\r\n\r\n                const idOrFunc = scheduledTimeoutFunctions.get(timerId);\r\n\r\n                if (typeof idOrFunc === \"number\") {\r\n                    const unhandledTimerId = unhandledRequests.get(idOrFunc);\r\n\r\n                    if (\r\n                        unhandledTimerId === undefined ||\r\n                        unhandledTimerId !== timerId\r\n                    ) {\r\n                        throw new Error(\"The timer is in an undefined state.\");\r\n                    }\r\n                } else if (typeof idOrFunc !== \"undefined\") {\r\n                    idOrFunc();\r\n\r\n                    // A timeout can be safely deleted because it is only called once.\r\n                    scheduledTimeoutFunctions.delete(timerId);\r\n                } else {\r\n                    throw new Error(\"The timer is in an undefined state.\");\r\n                }\r\n            } else if (Timeout.isClearResponse(data)) {\r\n                const { id } = data;\r\n\r\n                const unhandledTimerId = unhandledRequests.get(id);\r\n\r\n                if (unhandledTimerId === undefined) {\r\n                    throw new Error(\"The timer is in an undefined state.\");\r\n                }\r\n\r\n                unhandledRequests.delete(id);\r\n\r\n                scheduledTimeoutFunctions.delete(unhandledTimerId);\r\n            } else {\r\n                const {\r\n                    error: { message }\r\n                } = data;\r\n\r\n                throw new Error(message);\r\n            }\r\n        });\r\n\r\n        const clearTimeout = (timerId: number): void => {\r\n            const id = Math.random();\r\n\r\n            unhandledRequests.set(id, timerId);\r\n            scheduledTimeoutFunctions.set(timerId, id);\r\n\r\n            worker.postMessage({\r\n                id,\r\n                method: \"clear\",\r\n                params: { timerId }\r\n            } as IClearRequest);\r\n        };\r\n\r\n        const setTimeout = (func: () => void, delay: number): number => {\r\n            const timerId = Math.random();\r\n\r\n            scheduledTimeoutFunctions.set(timerId, func);\r\n\r\n            worker.postMessage({\r\n                id: null,\r\n                method: \"set\",\r\n                params: {\r\n                    delay,\r\n                    now: performance.now(),\r\n                    timerId\r\n                }\r\n            } as ISetNotification);\r\n\r\n            return timerId;\r\n        };\r\n\r\n        return {\r\n            clearTimeout,\r\n            setTimeout\r\n        };\r\n    }\r\n\r\n    private static loadWorkerTimers(): () => IWorkerTimers {\r\n        return (): IWorkerTimers => {\r\n            if (Timeout.workerTimers !== null) {\r\n                return Timeout.workerTimers;\r\n            }\r\n\r\n            Timeout.workerTimers = Timeout.load() as IWorkerTimers;\r\n\r\n            return Timeout.workerTimers;\r\n        };\r\n    }\r\n\r\n    public static timers: () => IWorkerTimers = Timeout.loadWorkerTimers();\r\n\r\n    private static isCallNotification(message: TWorkerMessage): message is ICallNotification {\r\n        return (message as ICallNotification).method !== undefined && (message as ICallNotification).method === \"call\";\r\n    }\r\n\r\n    private static isClearResponse(message: TWorkerMessage): message is IClearResponse {\r\n        return (message as IClearResponse).error === null && typeof message.id === \"number\";\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport { EventType, PlatformEvent } from \"./PlatformEvent.js\";\r\n\r\nexport class OCSPEvent extends PlatformEvent {\r\n    private privSignature: string;\r\n\r\n    public constructor(eventName: string, eventType: EventType, signature: string) {\r\n        super(eventName, eventType);\r\n\r\n        this.privSignature = signature;\r\n    }\r\n}\r\n\r\nexport class OCSPMemoryCacheHitEvent extends OCSPEvent {\r\n    public constructor(signature: string) {\r\n        super(\"OCSPMemoryCacheHitEvent\", EventType.Debug, signature);\r\n    }\r\n}\r\n\r\nexport class OCSPCacheMissEvent extends OCSPEvent {\r\n    public constructor(signature: string) {\r\n        super(\"OCSPCacheMissEvent\", EventType.Debug, signature);\r\n    }\r\n}\r\n\r\nexport class OCSPDiskCacheHitEvent extends OCSPEvent {\r\n    public constructor(signature: string) {\r\n        super(\"OCSPDiskCacheHitEvent\", EventType.Debug, signature);\r\n    }\r\n}\r\n\r\nexport class OCSPCacheUpdateNeededEvent extends OCSPEvent {\r\n    public constructor(signature: string) {\r\n        super(\"OCSPCacheUpdateNeededEvent\", EventType.Debug, signature);\r\n    }\r\n}\r\n\r\nexport class OCSPMemoryCacheStoreEvent extends OCSPEvent {\r\n    public constructor(signature: string) {\r\n        super(\"OCSPMemoryCacheStoreEvent\", EventType.Debug, signature);\r\n    }\r\n}\r\n\r\nexport class OCSPDiskCacheStoreEvent extends OCSPEvent {\r\n    public constructor(signature: string) {\r\n        super(\"OCSPDiskCacheStoreEvent\", EventType.Debug, signature);\r\n    }\r\n}\r\n\r\nexport class OCSPCacheUpdateCompleteEvent extends OCSPEvent {\r\n    public constructor(signature: string) {\r\n        super(\"OCSPCacheUpdateCompleteEvent\", EventType.Debug, signature);\r\n    }\r\n}\r\n\r\nexport class OCSPStapleReceivedEvent extends OCSPEvent {\r\n    public constructor() {\r\n        super(\"OCSPStapleReceivedEvent\", EventType.Debug, \"\");\r\n    }\r\n}\r\n\r\nexport class OCSPWSUpgradeStartedEvent extends OCSPEvent {\r\n    public constructor(serialNumber: string) {\r\n        super(\"OCSPWSUpgradeStartedEvent\", EventType.Debug, serialNumber);\r\n    }\r\n}\r\n\r\nexport class OCSPCacheEntryExpiredEvent extends OCSPEvent {\r\n    private privExpireTime: number;\r\n\r\n    public constructor(serialNumber: string, expireTime: number) {\r\n        super(\"OCSPCacheEntryExpiredEvent\", EventType.Debug, serialNumber);\r\n        this.privExpireTime = expireTime;\r\n    }\r\n}\r\n\r\nexport class OCSPCacheEntryNeedsRefreshEvent extends OCSPEvent {\r\n    private privExpireTime: number;\r\n    private privStartTime: number;\r\n\r\n    public constructor(serialNumber: string, startTime: number, expireTime: number) {\r\n        super(\"OCSPCacheEntryNeedsRefreshEvent\", EventType.Debug, serialNumber);\r\n        this.privExpireTime = expireTime;\r\n        this.privStartTime = startTime;\r\n    }\r\n}\r\n\r\nexport class OCSPCacheHitEvent extends OCSPEvent {\r\n    private privExpireTime: number;\r\n    private privStartTime: number;\r\n    private privExpireTimeString: string;\r\n    private privStartTimeString: string;\r\n\r\n    public constructor(serialNumber: string, startTime: number, expireTime: number) {\r\n        super(\"OCSPCacheHitEvent\", EventType.Debug, serialNumber);\r\n        this.privExpireTime = expireTime;\r\n        this.privExpireTimeString = new Date(expireTime).toLocaleDateString();\r\n        this.privStartTime = startTime;\r\n        this.privStartTimeString = new Date(startTime).toLocaleTimeString();\r\n    }\r\n}\r\n\r\nexport class OCSPVerificationFailedEvent extends OCSPEvent {\r\n    private privError: string;\r\n\r\n    public constructor(serialNumber: string, error: string) {\r\n        super(\"OCSPVerificationFailedEvent\", EventType.Debug, serialNumber);\r\n        this.privError = error;\r\n    }\r\n}\r\n\r\nexport class OCSPCacheFetchErrorEvent extends OCSPEvent {\r\n    private privError: string;\r\n\r\n    public constructor(serialNumber: string, error: string) {\r\n        super(\"OCSPCacheFetchErrorEvent\", EventType.Debug, serialNumber);\r\n        this.privError = error;\r\n    }\r\n}\r\n\r\nexport class OCSPResponseRetrievedEvent extends OCSPEvent {\r\n    public constructor(serialNumber: string) {\r\n        super(\"OCSPResponseRetrievedEvent\", EventType.Debug, serialNumber);\r\n    }\r\n}\r\n\r\nexport class OCSPCacheUpdateErrorEvent extends OCSPEvent {\r\n    private privError: string;\r\n\r\n    public constructor(serialNumber: string, error: string) {\r\n        super(\"OCSPCacheUpdateErrorEvent\", EventType.Debug, serialNumber);\r\n        this.privError = error;\r\n    }\r\n}\r\n","\r\n// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    EventType,\r\n    PlatformEvent\r\n} from \"./Exports.js\";\r\n\r\nexport class BackgroundEvent extends PlatformEvent {\r\n    private privError: string;\r\n\r\n    public constructor(error: string) {\r\n        super(\"BackgroundEvent\", EventType.Error);\r\n        this.privError = error;\r\n    }\r\n\r\n    public get error(): string {\r\n        return this.privError;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport * from \"./AudioSourceEvents.js\";\r\nexport * from \"./ConnectionEvents.js\";\r\nexport * from \"./ConnectionMessage.js\";\r\nexport * from \"./ConnectionOpenResponse.js\";\r\nexport * from \"./DeferralMap.js\";\r\nexport * from \"./DialogEvents.js\";\r\nexport * from \"./Error.js\";\r\nexport * from \"./Events.js\";\r\nexport * from \"./EventSource.js\";\r\nexport * from \"./Guid.js\";\r\nexport * from \"./IAudioSource.js\";\r\nexport * from \"./IConnection.js\";\r\nexport * from \"./IDetachable.js\";\r\nexport * from \"./IDictionary.js\";\r\nexport * from \"./IDisposable.js\";\r\nexport * from \"./IEventListener.js\";\r\nexport * from \"./IEventSource.js\";\r\nexport * from \"./IErrorMessages.js\";\r\nexport * from \"./ITimer.js\";\r\nexport * from \"./IWebsocketMessageFormatter.js\";\r\nexport * from \"./List.js\";\r\nexport * from \"./PlatformEvent.js\";\r\nexport * from \"./Promise.js\";\r\nexport * from \"./Queue.js\";\r\nexport * from \"./RawWebsocketMessage.js\";\r\nexport * from \"./RiffPcmEncoder.js\";\r\nexport * from \"./Stream.js\";\r\nexport { TranslationStatus } from \"../common.speech/TranslationStatus.js\";\r\nexport * from \"./ChunkedArrayBufferStream.js\";\r\nexport * from \"./IAudioDestination.js\";\r\nexport * from \"./Timeout.js\";\r\nexport * from \"./OCSPEvents.js\";\r\nexport * from \"./BackgroundError.js\";\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport class HeaderNames {\r\n    public static AuthKey: string = \"Ocp-Apim-Subscription-Key\";\r\n    public static Authorization: string = \"Authorization\";\r\n    public static SpIDAuthKey: string = \"Apim-Subscription-Id\";\r\n    public static ConnectionId: string = \"X-ConnectionId\";\r\n    public static ContentType: string = \"Content-Type\";\r\n    public static CustomCommandsAppId: string = \"X-CommandsAppId\";\r\n    public static Path: string = \"Path\";\r\n    public static RequestId: string = \"X-RequestId\";\r\n    public static RequestStreamId: string = \"X-StreamId\";\r\n    public static RequestTimestamp: string = \"X-Timestamp\";\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport interface IAuthentication {\r\n    fetch(authFetchEventId: string): Promise<AuthInfo>;\r\n    fetchOnExpiry(authFetchEventId: string): Promise<AuthInfo>;\r\n}\r\n\r\nexport class AuthInfo {\r\n    private privHeaderName: string;\r\n    private privToken: string;\r\n\r\n    public constructor(headerName: string, token: string) {\r\n        this.privHeaderName = headerName;\r\n        this.privToken = token;\r\n    }\r\n\r\n    public get headerName(): string {\r\n        return this.privHeaderName;\r\n    }\r\n\r\n    public get token(): string {\r\n        return this.privToken;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ArgumentNullError,\r\n} from \"../common/Exports.js\";\r\nimport { HeaderNames } from \"./HeaderNames.js\";\r\nimport {\r\n    AuthInfo,\r\n    IAuthentication\r\n} from \"./IAuthentication.js\";\r\n\r\n/**\r\n * @class\r\n */\r\nexport class CognitiveSubscriptionKeyAuthentication implements IAuthentication {\r\n    private privAuthInfo: AuthInfo;\r\n\r\n    /**\r\n     * Creates and initializes an instance of the CognitiveSubscriptionKeyAuthentication class.\r\n     * @constructor\r\n     * @param {string} subscriptionKey - The subscription key\r\n     */\r\n    public constructor(subscriptionKey: string) {\r\n        if (!subscriptionKey) {\r\n            throw new ArgumentNullError(\"subscriptionKey\");\r\n        }\r\n\r\n        this.privAuthInfo = new AuthInfo(HeaderNames.AuthKey, subscriptionKey);\r\n    }\r\n\r\n    /**\r\n     * Fetches the subscription key.\r\n     * @member\r\n     * @function\r\n     * @public\r\n     * @param {string} authFetchEventId - The id to fetch.\r\n     */\r\n    // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n    public fetch(authFetchEventId: string): Promise<AuthInfo> {\r\n        return Promise.resolve(this.privAuthInfo);\r\n    }\r\n\r\n    /**\r\n     * Fetches the subscription key.\r\n     * @member\r\n     * @function\r\n     * @public\r\n     * @param {string} authFetchEventId - The id to fetch.\r\n     */\r\n    // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n    public fetchOnExpiry(authFetchEventId: string): Promise<AuthInfo> {\r\n        return Promise.resolve(this.privAuthInfo);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ArgumentNullError } from \"../common/Exports.js\";\r\nimport { AuthInfo, IAuthentication } from \"./IAuthentication.js\";\r\nimport { HeaderNames } from \"./HeaderNames.js\";\r\n\r\nexport class CognitiveTokenAuthentication implements IAuthentication {\r\n    private static privTokenPrefix: string = \"Bearer \";\r\n    private privFetchCallback: (authFetchEventId: string) => Promise<string>;\r\n    private privFetchOnExpiryCallback: (authFetchEventId: string) => Promise<string>;\r\n\r\n    public constructor(fetchCallback: (authFetchEventId: string) => Promise<string>, fetchOnExpiryCallback: (authFetchEventId: string) => Promise<string>) {\r\n        if (!fetchCallback) {\r\n            throw new ArgumentNullError(\"fetchCallback\");\r\n        }\r\n\r\n        if (!fetchOnExpiryCallback) {\r\n            throw new ArgumentNullError(\"fetchOnExpiryCallback\");\r\n        }\r\n\r\n        this.privFetchCallback = fetchCallback;\r\n        this.privFetchOnExpiryCallback = fetchOnExpiryCallback;\r\n    }\r\n\r\n    public fetch(authFetchEventId: string): Promise<AuthInfo> {\r\n        return this.privFetchCallback(authFetchEventId).then((token: string): AuthInfo => new AuthInfo(HeaderNames.Authorization, token === undefined ? undefined : CognitiveTokenAuthentication.privTokenPrefix + token));\r\n    }\r\n\r\n    public fetchOnExpiry(authFetchEventId: string): Promise<AuthInfo> {\r\n        return this.privFetchOnExpiryCallback(authFetchEventId).then((token: string): AuthInfo => new AuthInfo(HeaderNames.Authorization, token === undefined ? undefined : CognitiveTokenAuthentication.privTokenPrefix + token));\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport { EventType, PlatformEvent } from \"../common/Exports.js\";\r\n\r\nexport class SpeechRecognitionEvent extends PlatformEvent {\r\n    private privRequestId: string;\r\n    private privSessionId: string;\r\n\r\n    public constructor(eventName: string, requestId: string, sessionId: string, eventType: EventType = EventType.Info) {\r\n        super(eventName, eventType);\r\n\r\n        this.privRequestId = requestId;\r\n        this.privSessionId = sessionId;\r\n    }\r\n\r\n    public get requestId(): string {\r\n        return this.privRequestId;\r\n    }\r\n\r\n    public get sessionId(): string {\r\n        return this.privSessionId;\r\n    }\r\n}\r\n\r\nexport class RecognitionTriggeredEvent extends SpeechRecognitionEvent {\r\n    private privAudioSourceId: string;\r\n    private privAudioNodeId: string;\r\n\r\n    public constructor(requestId: string, sessionId: string, audioSourceId: string, audioNodeId: string) {\r\n        super(\"RecognitionTriggeredEvent\", requestId, sessionId);\r\n\r\n        this.privAudioSourceId = audioSourceId;\r\n        this.privAudioNodeId = audioNodeId;\r\n    }\r\n\r\n    public get audioSourceId(): string {\r\n        return this.privAudioSourceId;\r\n    }\r\n\r\n    public get audioNodeId(): string {\r\n        return this.privAudioNodeId;\r\n    }\r\n}\r\n\r\nexport class ListeningStartedEvent extends SpeechRecognitionEvent {\r\n    private privAudioSourceId: string;\r\n    private privAudioNodeId: string;\r\n\r\n    public constructor(requestId: string, sessionId: string, audioSourceId: string, audioNodeId: string) {\r\n        super(\"ListeningStartedEvent\", requestId, sessionId);\r\n        this.privAudioSourceId = audioSourceId;\r\n        this.privAudioNodeId = audioNodeId;\r\n    }\r\n\r\n    public get audioSourceId(): string {\r\n        return this.privAudioSourceId;\r\n    }\r\n\r\n    public get audioNodeId(): string {\r\n        return this.privAudioNodeId;\r\n    }\r\n}\r\n\r\nexport class ConnectingToServiceEvent extends SpeechRecognitionEvent {\r\n    private privAuthFetchEventid: string;\r\n\r\n    public constructor(requestId: string, authFetchEventid: string, sessionId: string) {\r\n        super(\"ConnectingToServiceEvent\", requestId, sessionId);\r\n        this.privAuthFetchEventid = authFetchEventid;\r\n    }\r\n\r\n    public get authFetchEventid(): string {\r\n        return this.privAuthFetchEventid;\r\n    }\r\n}\r\n\r\nexport class RecognitionStartedEvent extends SpeechRecognitionEvent {\r\n    private privAudioSourceId: string;\r\n    private privAudioNodeId: string;\r\n    private privAuthFetchEventId: string;\r\n\r\n    public constructor(requestId: string, audioSourceId: string, audioNodeId: string, authFetchEventId: string, sessionId: string) {\r\n        super(\"RecognitionStartedEvent\", requestId, sessionId);\r\n\r\n        this.privAudioSourceId = audioSourceId;\r\n        this.privAudioNodeId = audioNodeId;\r\n        this.privAuthFetchEventId = authFetchEventId;\r\n    }\r\n\r\n    public get audioSourceId(): string {\r\n        return this.privAudioSourceId;\r\n    }\r\n\r\n    public get audioNodeId(): string {\r\n        return this.privAudioNodeId;\r\n    }\r\n\r\n    public get authFetchEventId(): string {\r\n        return this.privAuthFetchEventId;\r\n    }\r\n}\r\n\r\nexport enum RecognitionCompletionStatus {\r\n    Success,\r\n    AudioSourceError,\r\n    AudioSourceTimeout,\r\n    AuthTokenFetchError,\r\n    AuthTokenFetchTimeout,\r\n    UnAuthorized,\r\n    ConnectTimeout,\r\n    ConnectError,\r\n    ClientRecognitionActivityTimeout,\r\n    UnknownError,\r\n}\r\n\r\nexport class RecognitionEndedEvent extends SpeechRecognitionEvent {\r\n    private privAudioSourceId: string;\r\n    private privAudioNodeId: string;\r\n    private privAuthFetchEventId: string;\r\n    private privServiceTag: string;\r\n    private privStatus: RecognitionCompletionStatus;\r\n    private privError: string;\r\n\r\n    public constructor(\r\n        requestId: string,\r\n        audioSourceId: string,\r\n        audioNodeId: string,\r\n        authFetchEventId: string,\r\n        sessionId: string,\r\n        serviceTag: string,\r\n        status: RecognitionCompletionStatus,\r\n        error: string) {\r\n\r\n        super(\"RecognitionEndedEvent\", requestId, sessionId, status === RecognitionCompletionStatus.Success ? EventType.Info : EventType.Error);\r\n\r\n        this.privAudioSourceId = audioSourceId;\r\n        this.privAudioNodeId = audioNodeId;\r\n        this.privAuthFetchEventId = authFetchEventId;\r\n        this.privStatus = status;\r\n        this.privError = error;\r\n        this.privServiceTag = serviceTag;\r\n    }\r\n\r\n    public get audioSourceId(): string {\r\n        return this.privAudioSourceId;\r\n    }\r\n\r\n    public get audioNodeId(): string {\r\n        return this.privAudioNodeId;\r\n    }\r\n\r\n    public get authFetchEventId(): string {\r\n        return this.privAuthFetchEventId;\r\n    }\r\n\r\n    public get serviceTag(): string {\r\n        return this.privServiceTag;\r\n    }\r\n\r\n    public get status(): RecognitionCompletionStatus {\r\n        return this.privStatus;\r\n    }\r\n\r\n    public get error(): string {\r\n        return this.privError;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { EventType } from \"../common/Exports.js\";\r\n\r\n/**\r\n * Define event severity types for setting logging output.\r\n * @class LogLevel\r\n */\r\n\r\nexport { EventType as LogLevel };\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * @class Contracts\r\n * @private\r\n */\r\nexport class Contracts {\r\n    public static throwIfNullOrUndefined(param: any, name: string): void {\r\n        if (param === undefined || param === null) {\r\n            throw new Error(\"throwIfNullOrUndefined:\" + name);\r\n        }\r\n    }\r\n\r\n    public static throwIfNull(param: any, name: string): void {\r\n        if (param === null) {\r\n            throw new Error(\"throwIfNull:\" + name);\r\n        }\r\n    }\r\n\r\n    public static throwIfNullOrWhitespace(param: string, name: string): void {\r\n        Contracts.throwIfNullOrUndefined(param, name);\r\n\r\n        if ((\"\" + param).trim().length < 1) {\r\n            throw new Error(\"throwIfNullOrWhitespace:\" + name);\r\n        }\r\n    }\r\n\r\n    public static throwIfNullOrTooLong(param: string, name: string, maxLength: number): void {\r\n        Contracts.throwIfNullOrUndefined(param, name);\r\n\r\n        if ((\"\" + param).length > maxLength) {\r\n            throw new Error(\"throwIfNullOrTooLong:\" + name + \" (more than \" + maxLength.toString() + \" characters)\");\r\n        }\r\n    }\r\n\r\n    public static throwIfNullOrTooShort(param: string, name: string, minLength: number): void {\r\n        Contracts.throwIfNullOrUndefined(param, name);\r\n\r\n        if ((\"\" + param).length < minLength) {\r\n            throw new Error(\"throwIfNullOrTooShort:\" + name + \" (less than \" + minLength.toString() + \" characters)\");\r\n        }\r\n    }\r\n\r\n    public static throwIfDisposed(isDisposed: boolean): void {\r\n        if (isDisposed) {\r\n            throw new Error(\"the object is already disposed\");\r\n        }\r\n    }\r\n\r\n    public static throwIfArrayEmptyOrWhitespace(array: string[], name: string): void {\r\n        Contracts.throwIfNullOrUndefined(array, name);\r\n\r\n        if (array.length === 0) {\r\n            throw new Error(\"throwIfArrayEmptyOrWhitespace:\" + name);\r\n        }\r\n\r\n        for (const item of array) {\r\n            Contracts.throwIfNullOrWhitespace(item, name);\r\n        }\r\n    }\r\n\r\n    public static throwIfFileDoesNotExist(param: string, name: string): void {\r\n        Contracts.throwIfNullOrWhitespace(param, name);\r\n\r\n        // TODO check for file existence.\r\n    }\r\n\r\n    public static throwIfNotUndefined(param: any, name: string): void {\r\n        if (param !== undefined) {\r\n            throw new Error(\"throwIfNotUndefined:\" + name);\r\n        }\r\n    }\r\n\r\n    public static throwIfNumberOutOfRange(value: number, name: string, rangeStart: number, rangeEnd: number): void {\r\n        Contracts.throwIfNullOrUndefined(value, name);\r\n\r\n        if (value < rangeStart || value > rangeEnd) {\r\n            throw new Error(\"throwIfNumberOutOfRange:\" + name + \" (must be between \" + rangeStart.toString() + \" and \" + rangeEnd.toString() + \")\");\r\n        }\r\n    }\r\n}\r\n","/* eslint-disable @typescript-eslint/no-unsafe-assignment */\r\n// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport * as fs from \"fs\";\r\nimport { LogLevel } from \"../sdk/LogLevel.js\";\r\nimport { IEventListener, PlatformEvent } from \"../common/Exports.js\";\r\nimport { Contracts } from \"../sdk/Contracts.js\";\r\n\r\nexport class ConsoleLoggingListener implements IEventListener<PlatformEvent> {\r\n    private privLogLevelFilter: LogLevel;\r\n    private privLogPath: fs.PathLike = undefined;\r\n    private privEnableConsoleOutput: boolean = true;\r\n\r\n    public logCallback: (s: string) => void;\r\n\r\n    public constructor(logLevelFilter: LogLevel = LogLevel.None) { // Console output disabled by default\r\n        this.privLogLevelFilter = logLevelFilter;\r\n    }\r\n\r\n    public set logPath(path: fs.PathLike) {\r\n        Contracts.throwIfNullOrUndefined(fs.openSync, \"\\nFile System access not available\");\r\n        this.privLogPath = path;\r\n    }\r\n\r\n    public set enableConsoleOutput(enableOutput: boolean) {\r\n        this.privEnableConsoleOutput = enableOutput;\r\n    }\r\n\r\n    public onEvent(event: PlatformEvent): void {\r\n        if (event.eventType >= this.privLogLevelFilter) {\r\n            const log = this.toString(event);\r\n            if (!!this.logCallback) {\r\n                this.logCallback(log);\r\n            }\r\n            if (!!this.privLogPath) {\r\n                fs.writeFileSync(this.privLogPath, log + \"\\n\", { flag: \"a+\" });\r\n            }\r\n\r\n            if (this.privEnableConsoleOutput) {\r\n                switch (event.eventType) {\r\n                    case LogLevel.Debug:\r\n                        // eslint-disable-next-line no-console\r\n                        console.debug(log);\r\n                        break;\r\n                    case LogLevel.Info:\r\n                        // eslint-disable-next-line no-console\r\n                        console.info(log);\r\n                        break;\r\n                    case LogLevel.Warning:\r\n                        // eslint-disable-next-line no-console\r\n                        console.warn(log);\r\n                        break;\r\n                    case LogLevel.Error:\r\n                        // eslint-disable-next-line no-console\r\n                        console.error(log);\r\n                        break;\r\n                    default:\r\n                        // eslint-disable-next-line no-console\r\n                        console.log(log);\r\n                        break;\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    private toString(event: PlatformEvent): string {\r\n        const logFragments = [\r\n            `${event.eventTime}`,\r\n            `${event.name}`,\r\n        ];\r\n\r\n        const e: any = event as any;\r\n        for (const prop in e) {\r\n            if (prop && event.hasOwnProperty(prop) &&\r\n                prop !== \"eventTime\" && prop !== \"eventType\" &&\r\n                prop !== \"eventId\" && prop !== \"name\" &&\r\n                prop !== \"constructor\") {\r\n                // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\r\n                const value = e[prop];\r\n                let valueToLog = \"<NULL>\";\r\n                if (value !== undefined && value !== null) {\r\n                    if (typeof (value) === \"number\" || typeof (value) === \"string\") {\r\n                        valueToLog = value.toString();\r\n                    } else {\r\n                        valueToLog = JSON.stringify(value);\r\n                    }\r\n                }\r\n\r\n                logFragments.push(`${prop}: ${valueToLog}`);\r\n            }\r\n\r\n        }\r\n\r\n        return logFragments.join(\" | \");\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n// eslint-disable-next-line max-classes-per-file\r\nexport enum AudioFormatTag {\r\n    PCM = 1,\r\n    MuLaw,\r\n    Siren,\r\n    MP3,\r\n    SILKSkype,\r\n    OGG_OPUS,\r\n    WEBM_OPUS,\r\n    ALaw,\r\n    FLAC,\r\n    OPUS,\r\n    AMR_WB,\r\n    G722,\r\n}\r\n\r\n/**\r\n * Represents audio stream format used for custom audio input configurations.\r\n * @class AudioStreamFormat\r\n */\r\nexport abstract class AudioStreamFormat {\r\n    /**\r\n     * Creates an audio stream format object representing the default audio stream\r\n     * format (16KHz 16bit mono PCM).\r\n     * @member AudioStreamFormat.getDefaultInputFormat\r\n     * @function\r\n     * @public\r\n     * @returns {AudioStreamFormat} The audio stream format being created.\r\n     */\r\n    public static getDefaultInputFormat(): AudioStreamFormat {\r\n        return AudioStreamFormatImpl.getDefaultInputFormat();\r\n    }\r\n\r\n    /**\r\n     * Creates an audio stream format object with the specified format characteristics.\r\n     * @member AudioStreamFormat.getWaveFormat\r\n     * @function\r\n     * @public\r\n     * @param {number} samplesPerSecond - Sample rate, in samples per second (Hertz).\r\n     * @param {number} bitsPerSample - Bits per sample, typically 16.\r\n     * @param {number} channels - Number of channels in the waveform-audio data. Monaural data\r\n     * uses one channel and stereo data uses two channels.\r\n     * @param {AudioFormatTag} format - Audio format (PCM, alaw or mulaw).\r\n     * @returns {AudioStreamFormat} The audio stream format being created.\r\n     */\r\n    public static getWaveFormat(samplesPerSecond: number, bitsPerSample: number, channels: number, format: AudioFormatTag): AudioStreamFormat {\r\n        return new AudioStreamFormatImpl(samplesPerSecond, bitsPerSample, channels, format);\r\n    }\r\n\r\n    /**\r\n     * Creates an audio stream format object with the specified pcm waveformat characteristics.\r\n     * @member AudioStreamFormat.getWaveFormatPCM\r\n     * @function\r\n     * @public\r\n     * @param {number} samplesPerSecond - Sample rate, in samples per second (Hertz).\r\n     * @param {number} bitsPerSample - Bits per sample, typically 16.\r\n     * @param {number} channels - Number of channels in the waveform-audio data. Monaural data\r\n     * uses one channel and stereo data uses two channels.\r\n     * @returns {AudioStreamFormat} The audio stream format being created.\r\n     */\r\n    public static getWaveFormatPCM(samplesPerSecond: number, bitsPerSample: number, channels: number): AudioStreamFormat {\r\n        return new AudioStreamFormatImpl(samplesPerSecond, bitsPerSample, channels);\r\n    }\r\n\r\n    /**\r\n     * Explicitly frees any external resource attached to the object\r\n     * @member AudioStreamFormat.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract close(): void;\r\n}\r\n\r\n/**\r\n * @private\r\n * @class AudioStreamFormatImpl\r\n */\r\nexport class AudioStreamFormatImpl extends AudioStreamFormat {\r\n    protected privHeader: ArrayBuffer;\r\n\r\n    /**\r\n     * Creates an instance with the given values.\r\n     * @constructor\r\n     * @param {number} samplesPerSec - Samples per second.\r\n     * @param {number} bitsPerSample - Bits per sample.\r\n     * @param {number} channels - Number of channels.\r\n     * @param {AudioFormatTag} format - Audio format (PCM, alaw or mulaw).\r\n     */\r\n    public constructor(samplesPerSec: number = 16000, bitsPerSample: number = 16, channels: number = 1, format: AudioFormatTag = AudioFormatTag.PCM) {\r\n        super();\r\n\r\n        let isWavFormat: boolean = true;\r\n        /* 1 for PCM; 6 for alaw; 7 for mulaw */\r\n        switch (format) {\r\n            case AudioFormatTag.PCM:\r\n                this.formatTag = 1;\r\n                break;\r\n            case AudioFormatTag.ALaw:\r\n                this.formatTag = 6;\r\n                break;\r\n            case AudioFormatTag.MuLaw:\r\n                this.formatTag = 7;\r\n                break;\r\n            default:\r\n                isWavFormat = false;\r\n        }\r\n        this.bitsPerSample = bitsPerSample;\r\n        this.samplesPerSec = samplesPerSec;\r\n        this.channels = channels;\r\n        this.avgBytesPerSec = this.samplesPerSec * this.channels * (this.bitsPerSample / 8);\r\n        this.blockAlign = this.channels * Math.max(this.bitsPerSample, 8);\r\n\r\n        if (isWavFormat) {\r\n            this.privHeader = new ArrayBuffer(44);\r\n\r\n            // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView\r\n            const view = new DataView(this.privHeader);\r\n\r\n            /* RIFF identifier */\r\n            this.setString(view, 0, \"RIFF\");\r\n            /* file length */\r\n            view.setUint32(4, 0, true);\r\n            /* RIFF type & Format */\r\n            this.setString(view, 8, \"WAVEfmt \");\r\n            /* format chunk length */\r\n            view.setUint32(16, 16, true);\r\n            /* audio format */\r\n            view.setUint16(20, this.formatTag, true);\r\n            /* channel count */\r\n            view.setUint16(22, this.channels, true);\r\n            /* sample rate */\r\n            view.setUint32(24, this.samplesPerSec, true);\r\n            /* byte rate (sample rate * block align) */\r\n            view.setUint32(28, this.avgBytesPerSec, true);\r\n            /* block align (channel count * bytes per sample) */\r\n            view.setUint16(32, this.channels * (this.bitsPerSample / 8), true);\r\n            /* bits per sample */\r\n            view.setUint16(34, this.bitsPerSample, true);\r\n            /* data chunk identifier */\r\n            this.setString(view, 36, \"data\");\r\n            /* data chunk length */\r\n            view.setUint32(40, 0, true);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Retrieves the default input format.\r\n     * @member AudioStreamFormatImpl.getDefaultInputFormat\r\n     * @function\r\n     * @public\r\n     * @returns {AudioStreamFormatImpl} The default input format.\r\n     */\r\n    public static getDefaultInputFormat(): AudioStreamFormatImpl {\r\n        return new AudioStreamFormatImpl();\r\n    }\r\n\r\n    /**\r\n     * Creates an audio context appropriate to current browser\r\n     * @member AudioStreamFormatImpl.getAudioContext\r\n     * @function\r\n     * @public\r\n     * @returns {AudioContext} An audio context instance\r\n     */\r\n    /* eslint-disable */\r\n    public static getAudioContext(sampleRate?: number): AudioContext {\r\n        // Workaround for Speech SDK bug in Safari.\r\n        const AudioContext = (window as any).AudioContext // our preferred impl\r\n            || (window as any).webkitAudioContext // fallback, mostly when on Safari\r\n            || false; // could not find.\r\n\r\n        // https://developer.mozilla.org/en-US/docs/Web/API/AudioContext\r\n        if (!!AudioContext) {\r\n            if (sampleRate !== undefined && navigator.mediaDevices.getSupportedConstraints().sampleRate) {\r\n                return new AudioContext({ sampleRate });\r\n            } else {\r\n                return new AudioContext();\r\n            }\r\n        } else {\r\n            throw new Error(\"Browser does not support Web Audio API (AudioContext is not available).\");\r\n        }\r\n    }\r\n    /* eslint-enable */\r\n\r\n    /**\r\n     * Closes the configuration object.\r\n     * @member AudioStreamFormatImpl.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(): void {\r\n        return;\r\n    }\r\n\r\n    /**\r\n     * The format of the audio, valid values: 1 (PCM)\r\n     * @member AudioStreamFormatImpl.prototype.formatTag\r\n     * @function\r\n     * @public\r\n     */\r\n    public formatTag: number;\r\n\r\n    /**\r\n     * The number of channels, valid values: 1 (Mono).\r\n     * @member AudioStreamFormatImpl.prototype.channels\r\n     * @function\r\n     * @public\r\n     */\r\n    public channels: number;\r\n\r\n    /**\r\n     * The sample rate, valid values: 16000.\r\n     * @member AudioStreamFormatImpl.prototype.samplesPerSec\r\n     * @function\r\n     * @public\r\n     */\r\n    public samplesPerSec: number;\r\n\r\n    /**\r\n     * The bits per sample, valid values: 16\r\n     * @member AudioStreamFormatImpl.prototype.b\r\n     * @function\r\n     * @public\r\n     */\r\n    public bitsPerSample: number;\r\n\r\n    /**\r\n     * Average bytes per second, usually calculated as nSamplesPerSec * nChannels * ceil(wBitsPerSample, 8).\r\n     * @member AudioStreamFormatImpl.prototype.avgBytesPerSec\r\n     * @function\r\n     * @public\r\n     */\r\n    public avgBytesPerSec: number;\r\n\r\n    /**\r\n     * The size of a single frame, valid values: nChannels * ceil(wBitsPerSample, 8).\r\n     * @member AudioStreamFormatImpl.prototype.blockAlign\r\n     * @function\r\n     * @public\r\n     */\r\n    public blockAlign: number;\r\n\r\n    public get header(): ArrayBuffer {\r\n        return this.privHeader;\r\n    }\r\n\r\n    protected setString(view: DataView, offset: number, str: string): void {\r\n        for (let i = 0; i < str.length; i++) {\r\n            view.setUint8(offset + i, str.charCodeAt(i));\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    connectivity,\r\n    ISpeechConfigAudioDevice,\r\n    type\r\n} from \"../common.speech/Exports.js\";\r\nimport {\r\n    AudioSourceErrorEvent,\r\n    AudioSourceEvent,\r\n    AudioSourceInitializingEvent,\r\n    AudioSourceOffEvent,\r\n    AudioSourceReadyEvent,\r\n    AudioStreamNodeAttachedEvent,\r\n    AudioStreamNodeAttachingEvent,\r\n    AudioStreamNodeDetachedEvent,\r\n    AudioStreamNodeErrorEvent,\r\n    ChunkedArrayBufferStream,\r\n    createNoDashGuid,\r\n    Deferred,\r\n    Events,\r\n    EventSource,\r\n    IAudioSource,\r\n    IAudioStreamNode,\r\n    IStringDictionary,\r\n    Stream,\r\n} from \"../common/Exports.js\";\r\nimport { IStreamChunk } from \"../common/Stream.js\";\r\nimport {\r\n    AudioStreamFormat,\r\n    AudioStreamFormatImpl,\r\n} from \"../sdk/Audio/AudioStreamFormat.js\";\r\nimport { IRecorder } from \"./IRecorder.js\";\r\n\r\ntype NavigatorUserMediaSuccessCallback = (stream: MediaStream) => void;\r\ntype NavigatorUserMediaErrorCallback = (error: DOMException) => void;\r\n\r\nexport const AudioWorkletSourceURLPropertyName = \"MICROPHONE-WorkletSourceUrl\";\r\n\r\nexport class MicAudioSource implements IAudioSource {\r\n\r\n    private static readonly AUDIOFORMAT: AudioStreamFormatImpl = AudioStreamFormat.getDefaultInputFormat() as AudioStreamFormatImpl;\r\n\r\n    private privStreams: IStringDictionary<Stream<ArrayBuffer>> = {};\r\n\r\n    private privId: string;\r\n\r\n    private privEvents: EventSource<AudioSourceEvent>;\r\n\r\n    private privInitializeDeferral: Deferred<void>;\r\n\r\n    private privMediaStream: MediaStream;\r\n\r\n    private privContext: AudioContext;\r\n\r\n    private privMicrophoneLabel: string;\r\n\r\n    private privOutputChunkSize: number;\r\n\r\n    private privIsClosing: boolean;\r\n\r\n    public constructor(\r\n        private readonly privRecorder: IRecorder,\r\n        private readonly deviceId?: string,\r\n        audioSourceId?: string,\r\n        mediaStream?: MediaStream\r\n        ) {\r\n\r\n        this.privOutputChunkSize = MicAudioSource.AUDIOFORMAT.avgBytesPerSec / 10;\r\n        this.privId = audioSourceId ? audioSourceId : createNoDashGuid();\r\n        this.privEvents = new EventSource<AudioSourceEvent>();\r\n        this.privMediaStream = mediaStream || null;\r\n        this.privIsClosing = false;\r\n    }\r\n\r\n    public get format(): Promise<AudioStreamFormatImpl> {\r\n        return Promise.resolve(MicAudioSource.AUDIOFORMAT);\r\n    }\r\n\r\n    public turnOn(): Promise<void> {\r\n        if (this.privInitializeDeferral) {\r\n            return this.privInitializeDeferral.promise;\r\n        }\r\n\r\n        this.privInitializeDeferral = new Deferred<void>();\r\n\r\n        try {\r\n            this.createAudioContext();\r\n        } catch (error) {\r\n            if (error instanceof Error) {\r\n                const typedError: Error = error;\r\n                this.privInitializeDeferral.reject(typedError.name + \": \" + typedError.message);\r\n            } else {\r\n                this.privInitializeDeferral.reject(error as string);\r\n            }\r\n            return this.privInitializeDeferral.promise;\r\n        }\r\n\r\n        const nav = window.navigator as unknown as {\r\n            webkitGetUserMedia?: (\r\n                constraints: MediaStreamConstraints,\r\n                successCallback: (stream: MediaStream) => void,\r\n                errorCallback: (error: any) => void\r\n            ) => void;\r\n            mozGetUserMedia?: (\r\n                constraints: MediaStreamConstraints,\r\n                successCallback: (stream: MediaStream) => void,\r\n                errorCallback: (error: any) => void\r\n            ) => void;\r\n            msGetUserMedia?: (\r\n                constraints: MediaStreamConstraints,\r\n                successCallback: (stream: MediaStream) => void,\r\n                errorCallback: (error: any) => void\r\n            ) => void;\r\n            getUserMedia?: (\r\n                constraints: MediaStreamConstraints,\r\n                successCallback: (stream: MediaStream) => void,\r\n                errorCallback: (error: any) => void\r\n            ) => void;\r\n            mediaDevices?: MediaDevices;\r\n        };\r\n\r\n        let getUserMedia = (\r\n            // eslint-disable-next-line\r\n            nav.getUserMedia ||\r\n            nav.webkitGetUserMedia ||\r\n            nav.mozGetUserMedia ||\r\n            nav.msGetUserMedia\r\n        );\r\n\r\n        if (!!nav.mediaDevices) {\r\n            getUserMedia = (constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void => {\r\n                nav.mediaDevices\r\n                    .getUserMedia(constraints)\r\n                    .then(successCallback)\r\n                    .catch(errorCallback);\r\n            };\r\n        }\r\n\r\n        if (!getUserMedia) {\r\n            const errorMsg = \"Browser does not support getUserMedia.\";\r\n            this.privInitializeDeferral.reject(errorMsg);\r\n            this.onEvent(new AudioSourceErrorEvent(errorMsg, \"\")); // mic initialized error - no streamid at this point\r\n        } else {\r\n            const next = (): void => {\r\n                this.onEvent(new AudioSourceInitializingEvent(this.privId)); // no stream id\r\n                if (this.privMediaStream && this.privMediaStream.active) {\r\n                    this.onEvent(new AudioSourceReadyEvent(this.privId));\r\n                    this.privInitializeDeferral.resolve();\r\n                } else {\r\n                    getUserMedia(\r\n                        { audio: this.deviceId ? { deviceId: this.deviceId } : true, video: false },\r\n                        (mediaStream: MediaStream): void => {\r\n                            this.privMediaStream = mediaStream;\r\n                            this.onEvent(new AudioSourceReadyEvent(this.privId));\r\n                            this.privInitializeDeferral.resolve();\r\n                        }, (error: any): void => {\r\n                            const errorMsg = `Error occurred during microphone initialization: ${error as string}`;\r\n                            this.privInitializeDeferral.reject(errorMsg);\r\n                            this.onEvent(new AudioSourceErrorEvent(this.privId, errorMsg));\r\n                        });\r\n                }\r\n            };\r\n\r\n            if (this.privContext.state === \"suspended\") {\r\n                // NOTE: On iOS, the Web Audio API requires sounds to be triggered from an explicit user action.\r\n                // https://github.com/WebAudio/web-audio-api/issues/790\r\n                this.privContext.resume()\r\n                    .then(next)\r\n                    .catch((reason: any): void => {\r\n                        this.privInitializeDeferral.reject(`Failed to initialize audio context: ${reason as string}`);\r\n                    });\r\n            } else {\r\n                next();\r\n            }\r\n        }\r\n\r\n        return this.privInitializeDeferral.promise;\r\n    }\r\n\r\n    public id(): string {\r\n        return this.privId;\r\n    }\r\n\r\n    public attach(audioNodeId: string): Promise<IAudioStreamNode> {\r\n        this.onEvent(new AudioStreamNodeAttachingEvent(this.privId, audioNodeId));\r\n\r\n        return this.listen(audioNodeId).then<IAudioStreamNode>(\r\n            (stream: Stream<ArrayBuffer>): IAudioStreamNode => {\r\n                this.onEvent(new AudioStreamNodeAttachedEvent(this.privId, audioNodeId));\r\n                return {\r\n                    detach: async (): Promise<void> => {\r\n                        stream.readEnded();\r\n                        delete this.privStreams[audioNodeId];\r\n                        this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\r\n                        return this.turnOff();\r\n                    },\r\n                    id: (): string => audioNodeId,\r\n                    read: (): Promise<IStreamChunk<ArrayBuffer>> => stream.read(),\r\n                };\r\n            });\r\n    }\r\n\r\n    public detach(audioNodeId: string): void {\r\n        if (audioNodeId && this.privStreams[audioNodeId]) {\r\n            this.privStreams[audioNodeId].close();\r\n            delete this.privStreams[audioNodeId];\r\n            this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\r\n        }\r\n    }\r\n\r\n    public async turnOff(): Promise<void> {\r\n        for (const streamId in this.privStreams) {\r\n            if (streamId) {\r\n                const stream = this.privStreams[streamId];\r\n                if (stream) {\r\n                    stream.close();\r\n                }\r\n            }\r\n        }\r\n\r\n        this.onEvent(new AudioSourceOffEvent(this.privId)); // no stream now\r\n        if (this.privInitializeDeferral) {\r\n            // Correctly handle when browser forces mic off before turnOn() completes\r\n            // eslint-disable-next-line @typescript-eslint/await-thenable\r\n            await this.privInitializeDeferral;\r\n            this.privInitializeDeferral = null;\r\n        }\r\n\r\n        await this.destroyAudioContext();\r\n\r\n        return;\r\n    }\r\n\r\n    public get events(): EventSource<AudioSourceEvent> {\r\n        return this.privEvents;\r\n    }\r\n\r\n    public get deviceInfo(): Promise<ISpeechConfigAudioDevice> {\r\n        return this.getMicrophoneLabel().then((label: string): ISpeechConfigAudioDevice => (\r\n            {\r\n                bitspersample: MicAudioSource.AUDIOFORMAT.bitsPerSample,\r\n                channelcount: MicAudioSource.AUDIOFORMAT.channels,\r\n                connectivity: connectivity.Unknown,\r\n                manufacturer: \"Speech SDK\",\r\n                model: label,\r\n                samplerate: MicAudioSource.AUDIOFORMAT.samplesPerSec,\r\n                type: type.Microphones,\r\n            }\r\n        ));\r\n    }\r\n\r\n    public setProperty(name: string, value: string): void {\r\n        if (name === AudioWorkletSourceURLPropertyName) {\r\n            this.privRecorder.setWorkletUrl(value);\r\n        } else {\r\n            throw new Error(\"Property '\" + name + \"' is not supported on Microphone.\");\r\n        }\r\n    }\r\n\r\n    private getMicrophoneLabel(): Promise<string> {\r\n        const defaultMicrophoneName: string = \"microphone\";\r\n\r\n        // If we did this already, return the value.\r\n        if (this.privMicrophoneLabel !== undefined) {\r\n            return Promise.resolve(this.privMicrophoneLabel);\r\n        }\r\n\r\n        // If the stream isn't currently running, we can't query devices because security.\r\n        if (this.privMediaStream === undefined || !this.privMediaStream.active) {\r\n            return Promise.resolve(defaultMicrophoneName);\r\n        }\r\n\r\n        // Setup a default\r\n        this.privMicrophoneLabel = defaultMicrophoneName;\r\n\r\n        // Get the id of the device running the audio track.\r\n        const microphoneDeviceId: string = this.privMediaStream.getTracks()[0].getSettings().deviceId;\r\n\r\n        // If the browser doesn't support getting the device ID, set a default and return.\r\n        if (undefined === microphoneDeviceId) {\r\n            return Promise.resolve(this.privMicrophoneLabel);\r\n        }\r\n\r\n        const deferred: Deferred<string> = new Deferred<string>();\r\n\r\n        // Enumerate the media devices.\r\n        navigator.mediaDevices.enumerateDevices().then((devices: MediaDeviceInfo[]): void => {\r\n            for (const device of devices) {\r\n                if (device.deviceId === microphoneDeviceId) {\r\n                    // Found the device\r\n                    this.privMicrophoneLabel = device.label;\r\n                    break;\r\n                }\r\n            }\r\n            deferred.resolve(this.privMicrophoneLabel);\r\n        }, (): Deferred<string> => deferred.resolve(this.privMicrophoneLabel));\r\n\r\n        return deferred.promise;\r\n    }\r\n\r\n    private async listen(audioNodeId: string): Promise<Stream<ArrayBuffer>> {\r\n        await this.turnOn();\r\n        const stream = new ChunkedArrayBufferStream(this.privOutputChunkSize, audioNodeId);\r\n        this.privStreams[audioNodeId] = stream;\r\n        try {\r\n            this.privRecorder.record(this.privContext, this.privMediaStream, stream);\r\n        } catch (error) {\r\n            this.onEvent(new AudioStreamNodeErrorEvent(this.privId, audioNodeId, error as string));\r\n            throw error;\r\n        }\r\n        const result: Stream<ArrayBuffer> = stream;\r\n        return result;\r\n    }\r\n\r\n    private onEvent(event: AudioSourceEvent): void {\r\n        this.privEvents.onEvent(event);\r\n        Events.instance.onEvent(event);\r\n    }\r\n\r\n    private createAudioContext(): void {\r\n        if (!!this.privContext) {\r\n            return;\r\n        }\r\n\r\n        this.privContext = AudioStreamFormatImpl.getAudioContext(MicAudioSource.AUDIOFORMAT.samplesPerSec);\r\n    }\r\n\r\n    private async destroyAudioContext(): Promise<void> {\r\n        if (!this.privContext) {\r\n            return;\r\n        }\r\n\r\n        this.privRecorder.releaseMediaResources(this.privContext);\r\n\r\n        // This pattern brought to you by a bug in the TypeScript compiler where it\r\n        // confuses the (\"close\" in this.privContext) with this.privContext always being null as the alternate.\r\n        // https://github.com/Microsoft/TypeScript/issues/11498\r\n        let hasClose: boolean = false;\r\n        if (\"close\" in this.privContext) {\r\n            hasClose = true;\r\n        }\r\n\r\n        if (hasClose) {\r\n            if (!this.privIsClosing) {\r\n                // The audio context close may take enough time that the close is called twice\r\n                this.privIsClosing = true;\r\n                await this.privContext.close();\r\n                this.privContext = null;\r\n                this.privIsClosing = false;\r\n            }\r\n        } else if (null !== this.privContext && this.privContext.state === \"running\") {\r\n            // Suspend actually takes a callback, but analogous to the\r\n            // resume method, it'll be only fired if suspend is called\r\n            // in a direct response to a user action. The later is not always\r\n            // the case, as TurnOff is also called, when we receive an\r\n            // end-of-speech message from the service. So, doing a best effort\r\n            // fire-and-forget here.\r\n            await this.privContext.suspend();\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    connectivity,\r\n    ISpeechConfigAudioDevice,\r\n    type,\r\n} from \"../common.speech/Exports.js\";\r\nimport {\r\n    AudioSourceErrorEvent,\r\n    AudioSourceEvent,\r\n    AudioSourceInitializingEvent,\r\n    AudioSourceOffEvent,\r\n    AudioSourceReadyEvent,\r\n    AudioStreamNodeAttachedEvent,\r\n    AudioStreamNodeAttachingEvent,\r\n    AudioStreamNodeDetachedEvent,\r\n    AudioStreamNodeErrorEvent,\r\n    ChunkedArrayBufferStream,\r\n    createNoDashGuid,\r\n    Deferred,\r\n    Events,\r\n    EventSource,\r\n    IAudioSource,\r\n    IAudioStreamNode,\r\n    IStreamChunk,\r\n    IStringDictionary,\r\n    Stream,\r\n} from \"../common/Exports.js\";\r\nimport { AudioStreamFormat, AudioStreamFormatImpl } from \"../sdk/Audio/AudioStreamFormat.js\";\r\n\r\nexport class FileAudioSource implements IAudioSource {\r\n\r\n    private privAudioFormatPromise: Promise<AudioStreamFormatImpl>;\r\n\r\n    private privStreams: IStringDictionary<Stream<ArrayBuffer>> = {};\r\n\r\n    private privId: string;\r\n\r\n    private privEvents: EventSource<AudioSourceEvent>;\r\n\r\n    private privSource: Blob | Buffer;\r\n\r\n    private privFilename: string;\r\n\r\n    private privHeaderEnd: number = 44;\r\n\r\n    public constructor(file: File | Buffer, filename?: string, audioSourceId?: string) {\r\n        this.privId = audioSourceId ? audioSourceId : createNoDashGuid();\r\n        this.privEvents = new EventSource<AudioSourceEvent>();\r\n        this.privSource = file;\r\n        if (typeof window !== \"undefined\" && typeof Blob !== \"undefined\" && this.privSource instanceof Blob) {\r\n            this.privFilename = (file as File).name;\r\n        } else {\r\n            this.privFilename = filename || \"unknown.wav\";\r\n        }\r\n\r\n        // Read the header.\r\n        this.privAudioFormatPromise = this.readHeader();\r\n    }\r\n\r\n    public get format(): Promise<AudioStreamFormatImpl> {\r\n        return this.privAudioFormatPromise;\r\n    }\r\n\r\n    public turnOn(): Promise<void> {\r\n        if (this.privFilename.lastIndexOf(\".wav\") !== this.privFilename.length - 4) {\r\n            const errorMsg = this.privFilename + \" is not supported. Only WAVE files are allowed at the moment.\";\r\n            this.onEvent(new AudioSourceErrorEvent(errorMsg, \"\"));\r\n            return Promise.reject(errorMsg);\r\n        }\r\n\r\n        this.onEvent(new AudioSourceInitializingEvent(this.privId)); // no stream id\r\n        this.onEvent(new AudioSourceReadyEvent(this.privId));\r\n        return;\r\n    }\r\n\r\n    public id(): string {\r\n        return this.privId;\r\n    }\r\n\r\n    public async attach(audioNodeId: string): Promise<IAudioStreamNode> {\r\n        this.onEvent(new AudioStreamNodeAttachingEvent(this.privId, audioNodeId));\r\n\r\n        const stream: Stream<ArrayBuffer> = await this.upload(audioNodeId);\r\n\r\n        this.onEvent(new AudioStreamNodeAttachedEvent(this.privId, audioNodeId));\r\n        return Promise.resolve({\r\n            detach: async (): Promise<void> => {\r\n                stream.readEnded();\r\n                delete this.privStreams[audioNodeId];\r\n                this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\r\n                await this.turnOff();\r\n            },\r\n            id: (): string => audioNodeId,\r\n            read: (): Promise<IStreamChunk<ArrayBuffer>> => stream.read(),\r\n        });\r\n    }\r\n\r\n    public detach(audioNodeId: string): void {\r\n        if (audioNodeId && this.privStreams[audioNodeId]) {\r\n            this.privStreams[audioNodeId].close();\r\n            delete this.privStreams[audioNodeId];\r\n            this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\r\n        }\r\n    }\r\n\r\n    public turnOff(): Promise<void> {\r\n        for (const streamId in this.privStreams) {\r\n            if (streamId) {\r\n                const stream = this.privStreams[streamId];\r\n                if (stream && !stream.isClosed) {\r\n                    stream.close();\r\n                }\r\n            }\r\n        }\r\n\r\n        this.onEvent(new AudioSourceOffEvent(this.privId)); // no stream now\r\n        return Promise.resolve();\r\n    }\r\n\r\n    public get events(): EventSource<AudioSourceEvent> {\r\n        return this.privEvents;\r\n    }\r\n\r\n    public get deviceInfo(): Promise<ISpeechConfigAudioDevice> {\r\n        return this.privAudioFormatPromise.then<ISpeechConfigAudioDevice>((result: AudioStreamFormatImpl): Promise<{\r\n            bitspersample: number;\r\n            channelcount: number;\r\n            connectivity: connectivity.Unknown;\r\n            manufacturer: string;\r\n            model: string;\r\n            samplerate: number;\r\n            type: type.File;\r\n        }> => ( Promise.resolve({\r\n                bitspersample: result.bitsPerSample,\r\n                channelcount: result.channels,\r\n                connectivity: connectivity.Unknown,\r\n                manufacturer: \"Speech SDK\",\r\n                model: \"File\",\r\n                samplerate: result.samplesPerSec,\r\n                type: type.File,\r\n            })\r\n        ));\r\n    }\r\n\r\n    private readHeader(): Promise<AudioStreamFormatImpl> {\r\n        // Read the wave header.\r\n        const maxHeaderSize: number = 4296;\r\n        const header: Blob | Buffer = this.privSource.slice(0, maxHeaderSize);\r\n\r\n        const headerResult: Deferred<AudioStreamFormatImpl> = new Deferred<AudioStreamFormatImpl>();\r\n\r\n        const processHeader = (header: ArrayBuffer): void => {\r\n            const view: DataView = new DataView(header);\r\n\r\n            const getWord = (index: number): string => String.fromCharCode(view.getUint8(index), view.getUint8(index + 1), view.getUint8(index + 2), view.getUint8(index + 3));\r\n\r\n            // RIFF 4 bytes.\r\n            if (\"RIFF\" !== getWord(0)) {\r\n                headerResult.reject(\"Invalid WAV header in file, RIFF was not found\");\r\n                return;\r\n            }\r\n\r\n            // length, 4 bytes\r\n            // RIFF Type & fmt 8 bytes\r\n            if (\"WAVE\" !== getWord(8) || \"fmt \" !== getWord(12)) {\r\n                headerResult.reject(\"Invalid WAV header in file, WAVEfmt was not found\");\r\n                return;\r\n            }\r\n\r\n            const formatSize: number = view.getInt32(16, true);\r\n            const channelCount: number = view.getUint16(22, true);\r\n            const sampleRate: number = view.getUint32(24, true);\r\n            const bitsPerSample: number = view.getUint16(34, true);\r\n            // Confirm if header is 44 bytes long.\r\n            let pos: number = 36 + Math.max(formatSize - 16, 0);\r\n            for (; getWord(pos) !== \"data\"; pos += 2) {\r\n                if (pos > maxHeaderSize - 8) {\r\n                    headerResult.reject(\"Invalid WAV header in file, data block was not found\");\r\n                    return;\r\n                }\r\n            }\r\n            this.privHeaderEnd = pos + 8;\r\n            headerResult.resolve(AudioStreamFormat.getWaveFormatPCM(sampleRate, bitsPerSample, channelCount) as AudioStreamFormatImpl);\r\n        };\r\n\r\n        if (typeof window !== \"undefined\" && typeof Blob !== \"undefined\" && header instanceof Blob) {\r\n            const reader: FileReader = new FileReader();\r\n\r\n            reader.onload = (event: Event): void => {\r\n                const header: ArrayBuffer = (event.target as FileReader).result as ArrayBuffer;\r\n                processHeader(header);\r\n            };\r\n\r\n            reader.readAsArrayBuffer(header);\r\n        } else {\r\n            const h: Buffer = header as Buffer;\r\n            processHeader(h.buffer.slice(h.byteOffset, h.byteOffset + h.byteLength));\r\n        }\r\n        return headerResult.promise;\r\n    }\r\n\r\n    private async upload(audioNodeId: string): Promise<Stream<ArrayBuffer>> {\r\n        const onerror = (error: string): void => {\r\n            const errorMsg = `Error occurred while processing '${this.privFilename}'. ${error}`;\r\n            this.onEvent(new AudioStreamNodeErrorEvent(this.privId, audioNodeId, errorMsg));\r\n            throw new Error(errorMsg);\r\n        };\r\n\r\n        try {\r\n            await this.turnOn();\r\n\r\n            const format: AudioStreamFormatImpl = await this.privAudioFormatPromise;\r\n            const stream = new ChunkedArrayBufferStream(format.avgBytesPerSec / 10, audioNodeId);\r\n\r\n            this.privStreams[audioNodeId] = stream;\r\n            const chunk: Blob | Buffer = this.privSource.slice(this.privHeaderEnd);\r\n\r\n            const processFile = (buff: ArrayBuffer): void => {\r\n                if (stream.isClosed) {\r\n                    return; // output stream was closed (somebody called TurnOff). We're done here.\r\n                }\r\n\r\n                stream.writeStreamChunk({\r\n                    buffer: buff,\r\n                    isEnd: false,\r\n                    timeReceived: Date.now(),\r\n                });\r\n                stream.close();\r\n            };\r\n\r\n            if (typeof window !== \"undefined\" && typeof Blob !== \"undefined\" && chunk instanceof Blob) {\r\n                const reader: FileReader = new FileReader();\r\n                reader.onerror = (ev: ProgressEvent<FileReader>): void  =>  onerror(ev.toString());\r\n\r\n                reader.onload = (event: Event): void => {\r\n                    const fileBuffer: ArrayBuffer = (event.target as FileReader).result as ArrayBuffer;\r\n                    processFile(fileBuffer);\r\n                };\r\n\r\n                reader.readAsArrayBuffer(chunk);\r\n            } else {\r\n                const c: Buffer = chunk as Buffer;\r\n                processFile(c.buffer.slice(c.byteOffset, c.byteOffset + c.byteLength));\r\n            }\r\n\r\n            return stream;\r\n        } catch (e) {\r\n            onerror(e as string);\r\n        }\r\n    }\r\n\r\n    private onEvent(event: AudioSourceEvent): void {\r\n        this.privEvents.onEvent(event);\r\n        Events.instance.onEvent(event);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { RiffPcmEncoder, Stream } from \"../common/Exports\";\r\nimport { IRecorder } from \"./IRecorder\";\r\n\r\nexport class PcmRecorder implements IRecorder {\r\n    private privMediaResources: IMediaResources;\r\n    private privSpeechProcessorScript: string; // speech-processor.js Url\r\n    private privStopInputOnRelease: boolean;\r\n\r\n    public constructor(stopInputOnRelease: boolean) {\r\n        this.privStopInputOnRelease = stopInputOnRelease;\r\n    }\r\n\r\n    public record(context: AudioContext, mediaStream: MediaStream, outputStream: Stream<ArrayBuffer>): void {\r\n        const desiredSampleRate = 16000;\r\n\r\n        const waveStreamEncoder = new RiffPcmEncoder(context.sampleRate, desiredSampleRate);\r\n\r\n        const micInput = context.createMediaStreamSource(mediaStream);\r\n\r\n        const attachScriptProcessor = (): void => {\r\n            // eslint-disable-next-line @typescript-eslint/explicit-function-return-type\r\n            const scriptNode = (() => {\r\n                let bufferSize = 0;\r\n                try {\r\n                    return context.createScriptProcessor(bufferSize, 1, 1);\r\n                } catch (error) {\r\n                    // Webkit (<= version 31) requires a valid bufferSize.\r\n                    bufferSize = 2048;\r\n                    let audioSampleRate = context.sampleRate;\r\n                    while (bufferSize < 16384 && audioSampleRate >= (2 * desiredSampleRate)) {\r\n                        bufferSize <<= 1;\r\n                        audioSampleRate >>= 1;\r\n                    }\r\n                    return context.createScriptProcessor(bufferSize, 1, 1);\r\n                }\r\n            })();\r\n            scriptNode.onaudioprocess = (event: AudioProcessingEvent): void => {\r\n                const inputFrame = event.inputBuffer.getChannelData(0);\r\n\r\n                if (outputStream && !outputStream.isClosed) {\r\n                    const waveFrame = waveStreamEncoder.encode(inputFrame);\r\n                    if (!!waveFrame) {\r\n                        outputStream.writeStreamChunk({\r\n                            buffer: waveFrame,\r\n                            isEnd: false,\r\n                            timeReceived: Date.now(),\r\n                        });\r\n                    }\r\n                }\r\n            };\r\n            micInput.connect(scriptNode);\r\n            scriptNode.connect(context.destination);\r\n            this.privMediaResources = {\r\n                scriptProcessorNode: scriptNode,\r\n                source: micInput,\r\n                stream: mediaStream,\r\n            };\r\n        };\r\n\r\n        // https://webaudio.github.io/web-audio-api/#audioworklet\r\n        // Using AudioWorklet to improve audio quality and avoid audio glitches due to blocking the UI thread\r\n        const skipAudioWorklet = !!this.privSpeechProcessorScript && this.privSpeechProcessorScript.toLowerCase() === \"ignore\";\r\n\r\n        if (!!context.audioWorklet && !skipAudioWorklet) {\r\n            if (!this.privSpeechProcessorScript) {\r\n                const workletScript = `class SP extends AudioWorkletProcessor {\r\n                    constructor(options) {\r\n                      super(options);\r\n                    }\r\n                    process(inputs, outputs) {\r\n                      const input = inputs[0];\r\n                      const output = [];\r\n                      for (let channel = 0; channel < input.length; channel += 1) {\r\n                        output[channel] = input[channel];\r\n                      }\r\n                      this.port.postMessage(output[0]);\r\n                      return true;\r\n                    }\r\n                  }\r\n                  registerProcessor('speech-processor', SP);`;\r\n                const blob = new Blob([workletScript], { type: \"application/javascript; charset=utf-8\" });\r\n                this.privSpeechProcessorScript = URL.createObjectURL(blob);\r\n            }\r\n\r\n            context.audioWorklet\r\n                .addModule(this.privSpeechProcessorScript)\r\n                .then((): void => {\r\n                    const workletNode = new AudioWorkletNode(context, \"speech-processor\");\r\n                    workletNode.port.onmessage = (ev: MessageEvent): void => {\r\n                        const inputFrame: Float32Array = ev.data as Float32Array;\r\n\r\n                        if (outputStream && !outputStream.isClosed) {\r\n                            const waveFrame = waveStreamEncoder.encode(inputFrame);\r\n                            if (!!waveFrame) {\r\n                                outputStream.writeStreamChunk({\r\n                                    buffer: waveFrame,\r\n                                    isEnd: false,\r\n                                    timeReceived: Date.now(),\r\n                                });\r\n                            }\r\n                        }\r\n                    };\r\n                    micInput.connect(workletNode);\r\n                    workletNode.connect(context.destination);\r\n                    this.privMediaResources = {\r\n                        scriptProcessorNode: workletNode,\r\n                        source: micInput,\r\n                        stream: mediaStream,\r\n                    };\r\n                })\r\n                .catch((): void => {\r\n                    attachScriptProcessor();\r\n                });\r\n        } else {\r\n            try {\r\n                attachScriptProcessor();\r\n            } catch (err) {\r\n                throw new Error(`Unable to start audio worklet node for PCMRecorder: ${err as string}`);\r\n            }\r\n        }\r\n    }\r\n\r\n    public releaseMediaResources(context: AudioContext): void {\r\n        if (this.privMediaResources) {\r\n            if (this.privMediaResources.scriptProcessorNode) {\r\n                this.privMediaResources.scriptProcessorNode.disconnect(context.destination);\r\n                this.privMediaResources.scriptProcessorNode = null;\r\n            }\r\n            if (this.privMediaResources.source) {\r\n                this.privMediaResources.source.disconnect();\r\n                if (this.privStopInputOnRelease) {\r\n                    this.privMediaResources.stream.getTracks().forEach((track: MediaStreamTrack): void => track.stop());\r\n                }\r\n                this.privMediaResources.source = null;\r\n            }\r\n        }\r\n    }\r\n\r\n    public setWorkletUrl(url: string): void {\r\n        this.privSpeechProcessorScript = url;\r\n    }\r\n}\r\n\r\ninterface IMediaResources {\r\n    source: MediaStreamAudioSourceNode;\r\n    scriptProcessorNode: ScriptProcessorNode | AudioWorkletNode;\r\n    stream: MediaStream;\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n// Node.JS specific web socket / browser support.\r\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\r\nimport * as http from \"http\";\r\nimport * as net from \"net\";\r\nimport * as tls from \"tls\";\r\nimport Agent from \"agent-base\";\r\nimport HttpsProxyAgent from \"https-proxy-agent\";\r\n\r\nimport ws from \"ws\";\r\nimport { HeaderNames } from \"../common.speech/HeaderNames.js\";\r\nimport {\r\n    ArgumentNullError,\r\n    BackgroundEvent,\r\n    ConnectionClosedEvent,\r\n    ConnectionErrorEvent,\r\n    ConnectionEstablishedEvent,\r\n    ConnectionEvent,\r\n    ConnectionMessage,\r\n    ConnectionMessageReceivedEvent,\r\n    ConnectionMessageSentEvent,\r\n    ConnectionOpenResponse,\r\n    ConnectionRedirectEvent,\r\n    ConnectionStartEvent,\r\n    ConnectionState,\r\n    Deferred,\r\n    Events,\r\n    EventSource,\r\n    IWebsocketMessageFormatter,\r\n    MessageType,\r\n    Queue,\r\n    RawWebsocketMessage,\r\n} from \"../common/Exports.js\";\r\nimport { ProxyInfo } from \"./ProxyInfo.js\";\r\n\r\ninterface ISendItem {\r\n    Message: ConnectionMessage;\r\n    RawWebsocketMessage: RawWebsocketMessage;\r\n    sendStatusDeferral: Deferred<void>;\r\n}\r\n\r\nexport class WebsocketMessageAdapter {\r\n    private privConnectionState: ConnectionState;\r\n    private privMessageFormatter: IWebsocketMessageFormatter;\r\n    private privWebsocketClient: WebSocket | ws;\r\n\r\n    private privSendMessageQueue: Queue<ISendItem>;\r\n    private privReceivingMessageQueue: Queue<ConnectionMessage>;\r\n    private privConnectionEstablishDeferral: Deferred<ConnectionOpenResponse>;\r\n    private privCertificateValidatedDeferral: Deferred<void>;\r\n    private privDisconnectDeferral: Deferred<void>;\r\n    private privConnectionEvents: EventSource<ConnectionEvent>;\r\n    private privConnectionId: string;\r\n    private privUri: string;\r\n    private proxyInfo: ProxyInfo;\r\n    private privHeaders: { [key: string]: string };\r\n    private privLastErrorReceived: string;\r\n    private privEnableCompression: boolean;\r\n\r\n    public static forceNpmWebSocket: boolean = false;\r\n\r\n    public constructor(\r\n        uri: string,\r\n        connectionId: string,\r\n        messageFormatter: IWebsocketMessageFormatter,\r\n        proxyInfo: ProxyInfo,\r\n        headers: { [key: string]: string },\r\n        enableCompression: boolean) {\r\n\r\n        if (!uri) {\r\n            throw new ArgumentNullError(\"uri\");\r\n        }\r\n\r\n        if (!messageFormatter) {\r\n            throw new ArgumentNullError(\"messageFormatter\");\r\n        }\r\n\r\n        this.proxyInfo = proxyInfo;\r\n        this.privConnectionEvents = new EventSource<ConnectionEvent>();\r\n        this.privConnectionId = connectionId;\r\n        this.privMessageFormatter = messageFormatter;\r\n        this.privConnectionState = ConnectionState.None;\r\n        this.privUri = uri;\r\n        this.privHeaders = headers;\r\n        this.privEnableCompression = enableCompression;\r\n\r\n        // Add the connection ID to the headers\r\n        this.privHeaders[HeaderNames.ConnectionId] = this.privConnectionId;\r\n        this.privHeaders.connectionId = this.privConnectionId;\r\n\r\n        this.privLastErrorReceived = \"\";\r\n    }\r\n\r\n    public get state(): ConnectionState {\r\n        return this.privConnectionState;\r\n    }\r\n\r\n    public open(): Promise<ConnectionOpenResponse> {\r\n        if (this.privConnectionState === ConnectionState.Disconnected) {\r\n            return Promise.reject<ConnectionOpenResponse>(`Cannot open a connection that is in ${this.privConnectionState} state`);\r\n        }\r\n\r\n        if (this.privConnectionEstablishDeferral) {\r\n            return this.privConnectionEstablishDeferral.promise;\r\n        }\r\n\r\n        this.privConnectionEstablishDeferral = new Deferred<ConnectionOpenResponse>();\r\n        this.privCertificateValidatedDeferral = new Deferred<void>();\r\n\r\n        this.privConnectionState = ConnectionState.Connecting;\r\n\r\n        try {\r\n\r\n            const proxyConfiguredInNode: boolean = typeof window === \"undefined\" && !!this.proxyInfo?.HostName;\r\n\r\n            if (typeof WebSocket !== \"undefined\" && !WebsocketMessageAdapter.forceNpmWebSocket && !proxyConfiguredInNode) {\r\n                // Browser handles cert checks.\r\n                this.privCertificateValidatedDeferral.resolve();\r\n\r\n                this.privWebsocketClient = new WebSocket(this.privUri);\r\n            } else {\r\n                // Workaround for https://github.com/microsoft/cognitive-services-speech-sdk-js/issues/465\r\n                // Which is root caused by https://github.com/TooTallNate/node-agent-base/issues/61\r\n                const uri = new URL(this.privUri);\r\n                let protocol: string = uri.protocol;\r\n\r\n                if (protocol?.toLocaleLowerCase() === \"wss:\") {\r\n                    protocol = \"https:\";\r\n                } else if (protocol?.toLocaleLowerCase() === \"ws:\") {\r\n                    protocol = \"http:\";\r\n                }\r\n\r\n                const options: ws.ClientOptions = { headers: this.privHeaders, perMessageDeflate: this.privEnableCompression, followRedirects: protocol.toLocaleLowerCase() === \"https:\" };\r\n                // The ocsp library will handle validation for us and fail the connection if needed.\r\n                this.privCertificateValidatedDeferral.resolve();\r\n\r\n                options.agent = this.getAgent();\r\n\r\n                // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\r\n                (options.agent as any).protocol = protocol;\r\n                this.privWebsocketClient = new ws(this.privUri, options);\r\n                this.privWebsocketClient.on(\"redirect\", (redirectUrl: string): void => {\r\n                    const event: ConnectionRedirectEvent = new ConnectionRedirectEvent(this.privConnectionId, redirectUrl, this.privUri, `Getting redirect URL from endpoint ${this.privUri} with redirect URL '${redirectUrl}'`);\r\n                    Events.instance.onEvent(event);\r\n                });\r\n            }\r\n\r\n            this.privWebsocketClient.binaryType = \"arraybuffer\";\r\n            this.privReceivingMessageQueue = new Queue<ConnectionMessage>();\r\n            this.privDisconnectDeferral = new Deferred<void>();\r\n            this.privSendMessageQueue = new Queue<ISendItem>();\r\n            this.processSendQueue().catch((reason: string): void => {\r\n                Events.instance.onEvent(new BackgroundEvent(reason));\r\n            });\r\n        } catch (error) {\r\n            this.privConnectionEstablishDeferral.resolve(new ConnectionOpenResponse(500, error as string));\r\n            return this.privConnectionEstablishDeferral.promise;\r\n        }\r\n\r\n        this.onEvent(new ConnectionStartEvent(this.privConnectionId, this.privUri));\r\n\r\n        this.privWebsocketClient.onopen = (): void => {\r\n            this.privCertificateValidatedDeferral.promise.then((): void => {\r\n                this.privConnectionState = ConnectionState.Connected;\r\n                this.onEvent(new ConnectionEstablishedEvent(this.privConnectionId));\r\n                this.privConnectionEstablishDeferral.resolve(new ConnectionOpenResponse(200, \"\"));\r\n            }, (error: string): void => {\r\n                this.privConnectionEstablishDeferral.reject(error);\r\n            });\r\n        };\r\n\r\n        this.privWebsocketClient.onerror = (e: { error: any; message: string; type: string; target: WebSocket | ws }): void => {\r\n            this.onEvent(new ConnectionErrorEvent(this.privConnectionId, e.message, e.type));\r\n            this.privLastErrorReceived = e.message;\r\n        };\r\n\r\n        this.privWebsocketClient.onclose = (e: { wasClean: boolean; code: number; reason: string; target: WebSocket | ws }): void => {\r\n            if (this.privConnectionState === ConnectionState.Connecting) {\r\n                this.privConnectionState = ConnectionState.Disconnected;\r\n                // this.onEvent(new ConnectionEstablishErrorEvent(this.connectionId, e.code, e.reason));\r\n                this.privConnectionEstablishDeferral.resolve(new ConnectionOpenResponse(e.code, e.reason + \" \" + this.privLastErrorReceived));\r\n            } else {\r\n                this.privConnectionState = ConnectionState.Disconnected;\r\n                this.privWebsocketClient = null;\r\n                this.onEvent(new ConnectionClosedEvent(this.privConnectionId, e.code, e.reason));\r\n            }\r\n\r\n            this.onClose(e.code, e.reason).catch((reason: string): void => {\r\n                Events.instance.onEvent(new BackgroundEvent(reason));\r\n            });\r\n        };\r\n\r\n        this.privWebsocketClient.onmessage = (e: { data: ws.Data; type: string; target: WebSocket | ws }): void => {\r\n            const networkReceivedTime = new Date().toISOString();\r\n            if (this.privConnectionState === ConnectionState.Connected) {\r\n                const deferred = new Deferred<ConnectionMessage>();\r\n                // let id = ++this.idCounter;\r\n                this.privReceivingMessageQueue.enqueueFromPromise(deferred.promise);\r\n                if (e.data instanceof ArrayBuffer) {\r\n                    const rawMessage = new RawWebsocketMessage(MessageType.Binary, e.data);\r\n                    this.privMessageFormatter\r\n                        .toConnectionMessage(rawMessage)\r\n                        .then((connectionMessage: ConnectionMessage): void => {\r\n                            this.onEvent(new ConnectionMessageReceivedEvent(this.privConnectionId, networkReceivedTime, connectionMessage));\r\n                            deferred.resolve(connectionMessage);\r\n                        }, (error: string): void => {\r\n                            // TODO: Events for these ?\r\n                            deferred.reject(`Invalid binary message format. Error: ${error}`);\r\n                        });\r\n                } else {\r\n                    const rawMessage = new RawWebsocketMessage(MessageType.Text, e.data);\r\n                    this.privMessageFormatter\r\n                        .toConnectionMessage(rawMessage)\r\n                        .then((connectionMessage: ConnectionMessage): void => {\r\n                            this.onEvent(new ConnectionMessageReceivedEvent(this.privConnectionId, networkReceivedTime, connectionMessage));\r\n                            deferred.resolve(connectionMessage);\r\n                        }, (error: string): void => {\r\n                            // TODO: Events for these ?\r\n                            deferred.reject(`Invalid text message format. Error: ${error}`);\r\n                        });\r\n                }\r\n            }\r\n        };\r\n\r\n        return this.privConnectionEstablishDeferral.promise;\r\n    }\r\n\r\n    public send(message: ConnectionMessage): Promise<void> {\r\n        if (this.privConnectionState !== ConnectionState.Connected) {\r\n            return Promise.reject(`Cannot send on connection that is in ${ConnectionState[this.privConnectionState]} state`);\r\n        }\r\n\r\n        const messageSendStatusDeferral = new Deferred<void>();\r\n        const messageSendDeferral = new Deferred<ISendItem>();\r\n\r\n        this.privSendMessageQueue.enqueueFromPromise(messageSendDeferral.promise);\r\n\r\n        this.privMessageFormatter\r\n            .fromConnectionMessage(message)\r\n            .then((rawMessage: RawWebsocketMessage): void => {\r\n                messageSendDeferral.resolve({\r\n                    Message: message,\r\n                    RawWebsocketMessage: rawMessage,\r\n                    sendStatusDeferral: messageSendStatusDeferral,\r\n                });\r\n            }, (error: string): void => {\r\n                messageSendDeferral.reject(`Error formatting the message. ${error}`);\r\n            });\r\n\r\n        return messageSendStatusDeferral.promise;\r\n    }\r\n\r\n    public read(): Promise<ConnectionMessage> {\r\n        if (this.privConnectionState !== ConnectionState.Connected) {\r\n            return Promise.reject<ConnectionMessage>(`Cannot read on connection that is in ${this.privConnectionState} state`);\r\n        }\r\n\r\n        return this.privReceivingMessageQueue.dequeue();\r\n    }\r\n\r\n    public close(reason?: string): Promise<void> {\r\n        if (this.privWebsocketClient) {\r\n            if (this.privConnectionState !== ConnectionState.Disconnected) {\r\n                this.privWebsocketClient.close(1000, reason ? reason : \"Normal closure by client\");\r\n            }\r\n        } else {\r\n            return Promise.resolve();\r\n        }\r\n\r\n        return this.privDisconnectDeferral.promise;\r\n    }\r\n\r\n    public get events(): EventSource<ConnectionEvent> {\r\n        return this.privConnectionEvents;\r\n    }\r\n\r\n    private sendRawMessage(sendItem: ISendItem): Promise<void> {\r\n        try {\r\n            // indicates we are draining the queue and it came with no message;\r\n            if (!sendItem) {\r\n                return Promise.resolve();\r\n            }\r\n\r\n            this.onEvent(new ConnectionMessageSentEvent(this.privConnectionId, new Date().toISOString(), sendItem.Message));\r\n\r\n            // add a check for the ws readystate in order to stop the red console error 'WebSocket is already in CLOSING or CLOSED state' appearing\r\n            if (this.isWebsocketOpen) {\r\n                // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\r\n                this.privWebsocketClient.send(sendItem.RawWebsocketMessage.payload);\r\n            } else {\r\n                return Promise.reject(\"websocket send error: Websocket not ready \" + this.privConnectionId + \" \" + sendItem.Message.id + \" \" + new Error().stack);\r\n            }\r\n            return Promise.resolve();\r\n\r\n        } catch (e) {\r\n            return Promise.reject(`websocket send error: ${e as string}`);\r\n        }\r\n    }\r\n\r\n    private async onClose(code: number, reason: string): Promise<void> {\r\n        const closeReason = `Connection closed. ${code}: ${reason}`;\r\n        this.privConnectionState = ConnectionState.Disconnected;\r\n        this.privDisconnectDeferral.resolve();\r\n        await this.privReceivingMessageQueue.drainAndDispose((): void => {\r\n            // TODO: Events for these ?\r\n            // Logger.instance.onEvent(new LoggingEvent(LogType.Warning, null, `Failed to process received message. Reason: ${closeReason}, Message: ${JSON.stringify(pendingReceiveItem)}`));\r\n        }, closeReason);\r\n\r\n        await this.privSendMessageQueue.drainAndDispose((pendingSendItem: ISendItem): void => {\r\n            pendingSendItem.sendStatusDeferral.reject(closeReason);\r\n        }, closeReason);\r\n    }\r\n\r\n    private async processSendQueue(): Promise<void> {\r\n        while (true) {\r\n            const itemToSend: Promise<ISendItem> = this.privSendMessageQueue.dequeue();\r\n            const sendItem: ISendItem = await itemToSend;\r\n            // indicates we are draining the queue and it came with no message;\r\n            if (!sendItem) {\r\n                return;\r\n            }\r\n\r\n            try {\r\n                await this.sendRawMessage(sendItem);\r\n                sendItem.sendStatusDeferral.resolve();\r\n            } catch (sendError) {\r\n                sendItem.sendStatusDeferral.reject(sendError as string);\r\n            }\r\n        }\r\n    }\r\n\r\n    private onEvent(event: ConnectionEvent): void {\r\n        this.privConnectionEvents.onEvent(event);\r\n        Events.instance.onEvent(event);\r\n    }\r\n\r\n    // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n    private getAgent(): http.Agent {\r\n        // eslint-disable-next-line @typescript-eslint/unbound-method\r\n        const agent: { proxyInfo: ProxyInfo } = new Agent.Agent(this.createConnection) as unknown as { proxyInfo: ProxyInfo };\r\n\r\n        if (this.proxyInfo !== undefined &&\r\n            this.proxyInfo.HostName !== undefined &&\r\n            this.proxyInfo.Port > 0) {\r\n            agent.proxyInfo = this.proxyInfo;\r\n        }\r\n\r\n        return agent as unknown as http.Agent;\r\n    }\r\n\r\n    private static GetProxyAgent(proxyInfo: ProxyInfo): HttpsProxyAgent {\r\n        const httpProxyOptions: HttpsProxyAgent.HttpsProxyAgentOptions = {\r\n            host: proxyInfo.HostName,\r\n            port: proxyInfo.Port,\r\n        };\r\n\r\n        if (!!proxyInfo.UserName) {\r\n            httpProxyOptions.headers = {\r\n                \"Proxy-Authentication\": \"Basic \" + Buffer.from(`${proxyInfo.UserName}:${(proxyInfo.Password === undefined) ? \"\" : proxyInfo.Password}`).toString(\"base64\"),\r\n            };\r\n        } else {\r\n            httpProxyOptions.headers = {};\r\n        }\r\n\r\n        httpProxyOptions.headers.requestOCSP = \"true\";\r\n\r\n        const httpProxyAgent: HttpsProxyAgent = new HttpsProxyAgent(httpProxyOptions);\r\n        return httpProxyAgent;\r\n    }\r\n\r\n    private createConnection(request: Agent.ClientRequest, options: Agent.RequestOptions): Promise<net.Socket> {\r\n        let socketPromise: Promise<net.Socket>;\r\n\r\n        options = {\r\n            ...options,\r\n            ...{\r\n                requestOCSP: true,\r\n                servername: options.host\r\n            }\r\n        };\r\n\r\n        if (!!this.proxyInfo) {\r\n            const httpProxyAgent: HttpsProxyAgent = WebsocketMessageAdapter.GetProxyAgent(this.proxyInfo);\r\n            const baseAgent: Agent.Agent = httpProxyAgent as unknown as Agent.Agent;\r\n\r\n            socketPromise = new Promise<net.Socket>((resolve: (value: net.Socket) => void, reject: (error: string | Error) => void): void => {\r\n                baseAgent.callback(request, options, (error: Error, socket: net.Socket): void => {\r\n                    if (!!error) {\r\n                        reject(error);\r\n                    } else {\r\n                        resolve(socket);\r\n                    }\r\n                });\r\n            });\r\n        } else {\r\n            if (!!options.secureEndpoint) {\r\n                socketPromise = Promise.resolve(tls.connect(options));\r\n            } else {\r\n                socketPromise = Promise.resolve(net.connect(options));\r\n            }\r\n        }\r\n\r\n        return socketPromise;\r\n    }\r\n\r\n    private get isWebsocketOpen(): boolean {\r\n        return this.privWebsocketClient && this.privWebsocketClient.readyState === this.privWebsocketClient.OPEN;\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ArgumentNullError,\r\n    ConnectionEvent,\r\n    ConnectionMessage,\r\n    ConnectionOpenResponse,\r\n    ConnectionState,\r\n    createNoDashGuid,\r\n    EventSource,\r\n    IConnection,\r\n    IStringDictionary,\r\n    IWebsocketMessageFormatter,\r\n} from \"../common/Exports.js\";\r\nimport { ProxyInfo } from \"./ProxyInfo.js\";\r\nimport { WebsocketMessageAdapter } from \"./WebsocketMessageAdapter.js\";\r\n\r\nexport class WebsocketConnection implements IConnection {\r\n\r\n    private privUri: string;\r\n    private privMessageFormatter: IWebsocketMessageFormatter;\r\n    private privConnectionMessageAdapter: WebsocketMessageAdapter;\r\n    private privId: string;\r\n    private privIsDisposed: boolean = false;\r\n\r\n    public constructor(\r\n        uri: string,\r\n        queryParameters: IStringDictionary<string>,\r\n        headers: IStringDictionary<string>,\r\n        messageFormatter: IWebsocketMessageFormatter,\r\n        proxyInfo: ProxyInfo,\r\n        enableCompression: boolean = false,\r\n        connectionId?: string) {\r\n\r\n        if (!uri) {\r\n            throw new ArgumentNullError(\"uri\");\r\n        }\r\n\r\n        if (!messageFormatter) {\r\n            throw new ArgumentNullError(\"messageFormatter\");\r\n        }\r\n\r\n        this.privMessageFormatter = messageFormatter;\r\n\r\n        let queryParams = \"\";\r\n        let i = 0;\r\n\r\n        if (queryParameters) {\r\n            for (const paramName in queryParameters) {\r\n                if (paramName) {\r\n                    queryParams += ((i === 0) && (uri.indexOf(\"?\") === -1)) ? \"?\" : \"&\";\r\n\r\n                    const key = encodeURIComponent(paramName);\r\n                    queryParams += key;\r\n\r\n                    let val = queryParameters[paramName];\r\n                    if (val) {\r\n                        val = encodeURIComponent(val);\r\n                        queryParams += `=${val}`;\r\n                    }\r\n\r\n                    i++;\r\n                }\r\n            }\r\n        }\r\n\r\n        if (headers) {\r\n            for (const headerName in headers) {\r\n                if (headerName) {\r\n                    queryParams += ((i === 0) && (uri.indexOf(\"?\") === -1)) ? \"?\" : \"&\";\r\n                    const val = encodeURIComponent(headers[headerName]);\r\n                    queryParams += `${headerName}=${val}`;\r\n                    i++;\r\n                }\r\n            }\r\n        }\r\n\r\n        this.privUri = uri + queryParams;\r\n        this.privId = connectionId ? connectionId : createNoDashGuid();\r\n\r\n        this.privConnectionMessageAdapter = new WebsocketMessageAdapter(\r\n            this.privUri,\r\n            this.id,\r\n            this.privMessageFormatter,\r\n            proxyInfo,\r\n            headers,\r\n            enableCompression);\r\n    }\r\n\r\n    public async dispose(): Promise<void> {\r\n        this.privIsDisposed = true;\r\n\r\n        if (this.privConnectionMessageAdapter) {\r\n            await this.privConnectionMessageAdapter.close();\r\n        }\r\n    }\r\n\r\n    public isDisposed(): boolean {\r\n        return this.privIsDisposed;\r\n    }\r\n\r\n    public get id(): string {\r\n        return this.privId;\r\n    }\r\n\r\n    public get uri(): string {\r\n        return this.privUri;\r\n    }\r\n\r\n    public state(): ConnectionState {\r\n        return this.privConnectionMessageAdapter.state;\r\n    }\r\n\r\n    public open(): Promise<ConnectionOpenResponse> {\r\n        return this.privConnectionMessageAdapter.open();\r\n    }\r\n\r\n    public send(message: ConnectionMessage): Promise<void> {\r\n        return this.privConnectionMessageAdapter.send(message);\r\n    }\r\n\r\n    public read(): Promise<ConnectionMessage> {\r\n        return this.privConnectionMessageAdapter.read();\r\n    }\r\n\r\n    public get events(): EventSource<ConnectionEvent> {\r\n        return this.privConnectionMessageAdapter.events;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n// eslint-disable-next-line max-classes-per-file\r\nimport {\r\n    IAudioStreamNode,\r\n    IStreamChunk,\r\n} from \"../common/Exports.js\";\r\n\r\nexport class ReplayableAudioNode implements IAudioStreamNode {\r\n    private privAudioNode: IAudioStreamNode;\r\n    private privBytesPerSecond: number;\r\n    private privBuffers: BufferEntry[] = [];\r\n    private privReplayOffset: number = 0;\r\n    private privLastShrinkOffset: number = 0;\r\n    private privBufferStartOffset: number = 0;\r\n    private privBufferSerial: number = 0;\r\n    private privBufferedBytes: number = 0;\r\n    private privReplay: boolean = false;\r\n    private privLastChunkAcquiredTime: number = 0;\r\n\r\n    public constructor(audioSource: IAudioStreamNode, bytesPerSecond: number) {\r\n        this.privAudioNode = audioSource;\r\n        this.privBytesPerSecond = bytesPerSecond;\r\n    }\r\n\r\n    public id(): string {\r\n        return this.privAudioNode.id();\r\n    }\r\n\r\n    // Reads and returns the next chunk of audio buffer.\r\n    // If replay of existing buffers are needed, read() will first seek and replay\r\n    // existing content, and upoin completion it will read new content from the underlying\r\n    // audio node, saving that content into the replayable buffers.\r\n    public read(): Promise<IStreamChunk<ArrayBuffer>> {\r\n        // if there is a replay request to honor.\r\n        if (!!this.privReplay && this.privBuffers.length !== 0) {\r\n            // Find the start point in the buffers.\r\n            // Offsets are in 100ns increments.\r\n            // So how many bytes do we need to seek to get the right offset?\r\n            const offsetToSeek: number = this.privReplayOffset - this.privBufferStartOffset;\r\n\r\n            let bytesToSeek: number = Math.round(offsetToSeek * this.privBytesPerSecond * 1e-7);\r\n            if (0 !== (bytesToSeek % 2)) {\r\n                bytesToSeek++;\r\n            }\r\n\r\n            let i: number = 0;\r\n\r\n            while (i < this.privBuffers.length && bytesToSeek >= this.privBuffers[i].chunk.buffer.byteLength) {\r\n                bytesToSeek -= this.privBuffers[i++].chunk.buffer.byteLength;\r\n            }\r\n\r\n            if (i < this.privBuffers.length) {\r\n                const retVal: ArrayBuffer = this.privBuffers[i].chunk.buffer.slice(bytesToSeek);\r\n\r\n                this.privReplayOffset += (retVal.byteLength / this.privBytesPerSecond) * 1e+7;\r\n\r\n                // If we've reached the end of the buffers, stop replaying.\r\n                if (i === this.privBuffers.length - 1) {\r\n                    this.privReplay = false;\r\n                }\r\n\r\n                return Promise.resolve<IStreamChunk<ArrayBuffer>>({\r\n                    buffer: retVal,\r\n                    isEnd: false,\r\n                    timeReceived: this.privBuffers[i].chunk.timeReceived,\r\n                });\r\n            }\r\n        }\r\n\r\n        return this.privAudioNode.read()\r\n            .then((result: IStreamChunk<ArrayBuffer>): IStreamChunk<ArrayBuffer> => {\r\n                if (result && result.buffer && this.privBuffers) {\r\n                    this.privBuffers.push(new BufferEntry(result, this.privBufferSerial++, this.privBufferedBytes));\r\n                    this.privBufferedBytes += result.buffer.byteLength;\r\n                }\r\n                return result;\r\n            });\r\n    }\r\n\r\n    public detach(): Promise<void> {\r\n        this.privBuffers = undefined;\r\n        return this.privAudioNode.detach();\r\n    }\r\n\r\n    public replay(): void {\r\n        if (this.privBuffers && 0 !== this.privBuffers.length) {\r\n            this.privReplay = true;\r\n            this.privReplayOffset = this.privLastShrinkOffset;\r\n        }\r\n    }\r\n\r\n    // Shrinks the existing audio buffers to start at the new offset, or at the\r\n    // beginning of the buffer closest to the requested offset.\r\n    // A replay request will start from the last shrink point.\r\n    public shrinkBuffers(offset: number): void {\r\n        if (this.privBuffers === undefined || this.privBuffers.length === 0) {\r\n            return;\r\n        }\r\n\r\n        this.privLastShrinkOffset = offset;\r\n\r\n        // Find the start point in the buffers.\r\n        // Offsets are in 100ns increments.\r\n        // So how many bytes do we need to seek to get the right offset?\r\n        const offsetToSeek: number = offset - this.privBufferStartOffset;\r\n\r\n        let bytesToSeek: number = Math.round(offsetToSeek * this.privBytesPerSecond * 1e-7);\r\n\r\n        let i: number = 0;\r\n\r\n        while (i < this.privBuffers.length && bytesToSeek >= this.privBuffers[i].chunk.buffer.byteLength) {\r\n            bytesToSeek -= this.privBuffers[i++].chunk.buffer.byteLength;\r\n        }\r\n        this.privBufferStartOffset = Math.round(offset - ((bytesToSeek / this.privBytesPerSecond) * 1e+7));\r\n        this.privBuffers = this.privBuffers.slice(i);\r\n    }\r\n\r\n    // Finds the time a buffer of audio was first seen by offset.\r\n    public findTimeAtOffset(offset: number): number {\r\n        if (offset < this.privBufferStartOffset || this.privBuffers === undefined) {\r\n            return 0;\r\n        }\r\n\r\n        for (const value of this.privBuffers) {\r\n            const startOffset: number = (value.byteOffset / this.privBytesPerSecond) * 1e7;\r\n            const endOffset: number = startOffset + ((value.chunk.buffer.byteLength / this.privBytesPerSecond) * 1e7);\r\n\r\n            if (offset >= startOffset && offset <= endOffset) {\r\n                return value.chunk.timeReceived;\r\n            }\r\n        }\r\n\r\n        return 0;\r\n    }\r\n}\r\n\r\n// Primary use of this class is to help debugging problems with the replay\r\n// code. If the memory cost of alloc / dealloc gets too much, drop it and just use\r\n// the ArrayBuffer directly.\r\nclass BufferEntry {\r\n    public chunk: IStreamChunk<ArrayBuffer>;\r\n    public serial: number;\r\n    public byteOffset: number;\r\n\r\n    public constructor(chunk: IStreamChunk<ArrayBuffer>, serial: number, byteOffset: number) {\r\n        this.chunk = chunk;\r\n        this.serial = serial;\r\n        this.byteOffset = byteOffset;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport * as fs from \"fs\";\r\nimport { IAudioDestination } from \"../../common/Exports.js\";\r\nimport { Contracts } from \"../Contracts.js\";\r\nimport { AudioStreamFormat } from \"../Exports.js\";\r\nimport { AudioOutputFormatImpl } from \"./AudioOutputFormat.js\";\r\n\r\nexport class AudioFileWriter implements IAudioDestination {\r\n    private privAudioFormat: AudioOutputFormatImpl;\r\n    private privFd: number;\r\n    private privId: string;\r\n    private privWriteStream: fs.WriteStream;\r\n\r\n    public constructor(filename: fs.PathLike) {\r\n        Contracts.throwIfNullOrUndefined(fs.openSync, \"\\nFile System access not available, please use Push or PullAudioOutputStream\");\r\n        this.privFd = fs.openSync(filename, \"w\");\r\n    }\r\n\r\n    public set format(format: AudioStreamFormat) {\r\n        Contracts.throwIfNotUndefined(this.privAudioFormat, \"format is already set\");\r\n        this.privAudioFormat = format as AudioOutputFormatImpl;\r\n        let headerOffset: number = 0;\r\n        if (this.privAudioFormat.hasHeader) {\r\n            headerOffset = this.privAudioFormat.header.byteLength;\r\n        }\r\n        if (this.privFd !== undefined) {\r\n            this.privWriteStream = fs.createWriteStream(\"\", {fd: this.privFd, start: headerOffset, autoClose: false});\r\n        }\r\n    }\r\n\r\n    public write(buffer: ArrayBuffer): void {\r\n        Contracts.throwIfNullOrUndefined(this.privAudioFormat, \"must set format before writing.\");\r\n        if (this.privWriteStream !== undefined) {\r\n            this.privWriteStream.write(new Uint8Array(buffer.slice(0)));\r\n        }\r\n    }\r\n\r\n    public close(): void {\r\n        if (this.privFd !== undefined) {\r\n            this.privWriteStream.on(\"finish\", (): void => {\r\n                if (this.privAudioFormat.hasHeader) {\r\n                    this.privAudioFormat.updateHeader(this.privWriteStream.bytesWritten);\r\n                    fs.writeSync(this.privFd,\r\n                        new Int8Array(this.privAudioFormat.header),\r\n                        0,\r\n                        this.privAudioFormat.header.byteLength,\r\n                        0);\r\n                }\r\n                fs.closeSync(this.privFd);\r\n                this.privFd = undefined;\r\n            });\r\n            this.privWriteStream.end();\r\n        }\r\n    }\r\n\r\n    public id(): string {\r\n        return this.privId;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport {\r\n    connectivity,\r\n    ISpeechConfigAudioDevice,\r\n    type,\r\n} from \"../../common.speech/Exports.js\";\r\nimport {\r\n    AudioSourceEvent,\r\n    AudioSourceInitializingEvent,\r\n    AudioSourceReadyEvent,\r\n    AudioStreamNodeAttachedEvent,\r\n    AudioStreamNodeAttachingEvent,\r\n    AudioStreamNodeDetachedEvent,\r\n    ChunkedArrayBufferStream,\r\n    Events,\r\n    EventSource,\r\n    IAudioSource,\r\n    IAudioStreamNode,\r\n    IStreamChunk,\r\n    Stream,\r\n} from \"../../common/Exports.js\";\r\nimport { createNoDashGuid } from \"../../common/Guid.js\";\r\nimport { AudioStreamFormat, PullAudioInputStreamCallback } from \"../Exports.js\";\r\nimport { AudioStreamFormatImpl } from \"./AudioStreamFormat.js\";\r\n\r\n/**\r\n * Represents audio input stream used for custom audio input configurations.\r\n * @class AudioInputStream\r\n */\r\nexport abstract class AudioInputStream {\r\n\r\n    /**\r\n     * Creates and initializes an instance.\r\n     * @constructor\r\n     */\r\n    protected constructor() {\r\n        return;\r\n    }\r\n\r\n    /**\r\n     * Creates a memory backed PushAudioInputStream with the specified audio format.\r\n     * @member AudioInputStream.createPushStream\r\n     * @function\r\n     * @public\r\n     * @param {AudioStreamFormat} format - The audio data format in which audio will be\r\n     * written to the push audio stream's write() method (Required if format is not 16 kHz 16bit mono PCM).\r\n     * @returns {PushAudioInputStream} The audio input stream being created.\r\n     */\r\n    public static createPushStream(format?: AudioStreamFormat): PushAudioInputStream {\r\n        return PushAudioInputStream.create(format);\r\n    }\r\n\r\n    /**\r\n     * Creates a PullAudioInputStream that delegates to the specified callback interface for read()\r\n     * and close() methods.\r\n     * @member AudioInputStream.createPullStream\r\n     * @function\r\n     * @public\r\n     * @param {PullAudioInputStreamCallback} callback - The custom audio input object, derived from\r\n     * PullAudioInputStreamCallback\r\n     * @param {AudioStreamFormat} format - The audio data format in which audio will be returned from\r\n     * the callback's read() method (Required if format is not 16 kHz 16bit mono PCM).\r\n     * @returns {PullAudioInputStream} The audio input stream being created.\r\n     */\r\n    public static createPullStream(callback: PullAudioInputStreamCallback, format?: AudioStreamFormat): PullAudioInputStream {\r\n        return PullAudioInputStream.create(callback, format);\r\n        // throw new Error(\"Oops\");\r\n    }\r\n\r\n    /**\r\n     * Explicitly frees any external resource attached to the object\r\n     * @member AudioInputStream.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract close(): void;\r\n}\r\n\r\n/**\r\n * Represents memory backed push audio input stream used for custom audio input configurations.\r\n * @class PushAudioInputStream\r\n */\r\nexport abstract class PushAudioInputStream extends AudioInputStream {\r\n\r\n    /**\r\n     * Creates a memory backed PushAudioInputStream with the specified audio format.\r\n     * @member PushAudioInputStream.create\r\n     * @function\r\n     * @public\r\n     * @param {AudioStreamFormat} format - The audio data format in which audio will be written to the\r\n     * push audio stream's write() method (Required if format is not 16 kHz 16bit mono PCM).\r\n     * @returns {PushAudioInputStream} The push audio input stream being created.\r\n     */\r\n    public static create(format?: AudioStreamFormat): PushAudioInputStream {\r\n        return new PushAudioInputStreamImpl(format);\r\n    }\r\n\r\n    /**\r\n     * Writes the audio data specified by making an internal copy of the data.\r\n     * @member PushAudioInputStream.prototype.write\r\n     * @function\r\n     * @public\r\n     * @param {ArrayBuffer} dataBuffer - The audio buffer of which this function will make a copy.\r\n     */\r\n    public abstract write(dataBuffer: ArrayBuffer): void;\r\n\r\n    /**\r\n     * Closes the stream.\r\n     * @member PushAudioInputStream.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract close(): void;\r\n}\r\n\r\n/**\r\n * Represents memory backed push audio input stream used for custom audio input configurations.\r\n * @private\r\n * @class PushAudioInputStreamImpl\r\n */\r\nexport class PushAudioInputStreamImpl extends PushAudioInputStream implements IAudioSource {\r\n\r\n    private privFormat: AudioStreamFormatImpl;\r\n    private privId: string;\r\n    private privEvents: EventSource<AudioSourceEvent>;\r\n    private privStream: Stream<ArrayBuffer>;\r\n\r\n    /**\r\n     * Creates and initalizes an instance with the given values.\r\n     * @constructor\r\n     * @param {AudioStreamFormat} format - The audio stream format.\r\n     */\r\n    public constructor(format?: AudioStreamFormat) {\r\n        super();\r\n        if (format === undefined) {\r\n            this.privFormat = AudioStreamFormatImpl.getDefaultInputFormat();\r\n        } else {\r\n            this.privFormat = format as AudioStreamFormatImpl;\r\n        }\r\n        this.privEvents = new EventSource<AudioSourceEvent>();\r\n        this.privId = createNoDashGuid();\r\n        this.privStream = new ChunkedArrayBufferStream(this.privFormat.avgBytesPerSec / 10);\r\n    }\r\n\r\n    /**\r\n     * Format information for the audio\r\n     */\r\n    public get format(): Promise<AudioStreamFormatImpl> {\r\n        return Promise.resolve(this.privFormat);\r\n    }\r\n\r\n    /**\r\n     * Writes the audio data specified by making an internal copy of the data.\r\n     * @member PushAudioInputStreamImpl.prototype.write\r\n     * @function\r\n     * @public\r\n     * @param {ArrayBuffer} dataBuffer - The audio buffer of which this function will make a copy.\r\n     */\r\n    public write(dataBuffer: ArrayBuffer): void {\r\n        this.privStream.writeStreamChunk({\r\n            buffer: dataBuffer,\r\n            isEnd: false,\r\n            timeReceived: Date.now()\r\n        });\r\n    }\r\n\r\n    /**\r\n     * Closes the stream.\r\n     * @member PushAudioInputStreamImpl.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(): void {\r\n        this.privStream.close();\r\n    }\r\n\r\n    public id(): string {\r\n        return this.privId;\r\n    }\r\n\r\n    public turnOn(): Promise<void> {\r\n        this.onEvent(new AudioSourceInitializingEvent(this.privId)); // no stream id\r\n        this.onEvent(new AudioSourceReadyEvent(this.privId));\r\n        return;\r\n    }\r\n\r\n    public async attach(audioNodeId: string): Promise<IAudioStreamNode> {\r\n        this.onEvent(new AudioStreamNodeAttachingEvent(this.privId, audioNodeId));\r\n\r\n        await this.turnOn();\r\n        const stream = this.privStream;\r\n        this.onEvent(new AudioStreamNodeAttachedEvent(this.privId, audioNodeId));\r\n        return {\r\n            detach: async (): Promise<void> => {\r\n                this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\r\n                return this.turnOff();\r\n            },\r\n            id: (): string => audioNodeId,\r\n            read: (): Promise<IStreamChunk<ArrayBuffer>> => stream.read(),\r\n        };\r\n    }\r\n\r\n    public detach(audioNodeId: string): void {\r\n        this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\r\n    }\r\n\r\n    public turnOff(): Promise<void> {\r\n        return;\r\n    }\r\n\r\n    public get events(): EventSource<AudioSourceEvent> {\r\n        return this.privEvents;\r\n    }\r\n\r\n    public get deviceInfo(): Promise<ISpeechConfigAudioDevice> {\r\n        return Promise.resolve({\r\n            bitspersample: this.privFormat.bitsPerSample,\r\n            channelcount: this.privFormat.channels,\r\n            connectivity: connectivity.Unknown,\r\n            manufacturer: \"Speech SDK\",\r\n            model: \"PushStream\",\r\n            samplerate: this.privFormat.samplesPerSec,\r\n            type: type.Stream,\r\n        });\r\n    }\r\n\r\n    private onEvent(event: AudioSourceEvent): void {\r\n        this.privEvents.onEvent(event);\r\n        Events.instance.onEvent(event);\r\n    }\r\n\r\n    private toBuffer(arrayBuffer: ArrayBuffer): Buffer {\r\n        const buf: Buffer = Buffer.alloc(arrayBuffer.byteLength);\r\n        const view: Uint8Array = new Uint8Array(arrayBuffer);\r\n        for (let i = 0; i < buf.length; ++i) {\r\n            buf[i] = view[i];\r\n        }\r\n        return buf;\r\n    }\r\n}\r\n\r\n/*\r\n * Represents audio input stream used for custom audio input configurations.\r\n * @class PullAudioInputStream\r\n */\r\nexport abstract class PullAudioInputStream extends AudioInputStream {\r\n    /**\r\n     * Creates and initializes and instance.\r\n     * @constructor\r\n     */\r\n    protected constructor() {\r\n super();\r\n}\r\n\r\n    /**\r\n     * Creates a PullAudioInputStream that delegates to the specified callback interface for\r\n     * read() and close() methods, using the default format (16 kHz 16bit mono PCM).\r\n     * @member PullAudioInputStream.create\r\n     * @function\r\n     * @public\r\n     * @param {PullAudioInputStreamCallback} callback - The custom audio input object,\r\n     * derived from PullAudioInputStreamCustomCallback\r\n     * @param {AudioStreamFormat} format - The audio data format in which audio will be\r\n     * returned from the callback's read() method (Required if format is not 16 kHz 16bit mono PCM).\r\n     * @returns {PullAudioInputStream} The push audio input stream being created.\r\n     */\r\n    public static create(callback: PullAudioInputStreamCallback, format?: AudioStreamFormat): PullAudioInputStream {\r\n        return new PullAudioInputStreamImpl(callback, format as AudioStreamFormatImpl);\r\n    }\r\n\r\n    /**\r\n     * Explicitly frees any external resource attached to the object\r\n     * @member PullAudioInputStream.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract close(): void;\r\n\r\n}\r\n\r\n/**\r\n * Represents audio input stream used for custom audio input configurations.\r\n * @private\r\n * @class PullAudioInputStreamImpl\r\n */\r\nexport class PullAudioInputStreamImpl extends PullAudioInputStream implements IAudioSource {\r\n\r\n    private privCallback: PullAudioInputStreamCallback;\r\n    private privFormat: AudioStreamFormatImpl;\r\n    private privId: string;\r\n    private privEvents: EventSource<AudioSourceEvent>;\r\n    private privIsClosed: boolean;\r\n    private privBufferSize: number;\r\n\r\n    /**\r\n     * Creates a PullAudioInputStream that delegates to the specified callback interface for\r\n     * read() and close() methods, using the default format (16 kHz 16bit mono PCM).\r\n     * @constructor\r\n     * @param {PullAudioInputStreamCallback} callback - The custom audio input object,\r\n     * derived from PullAudioInputStreamCustomCallback\r\n     * @param {AudioStreamFormat} format - The audio data format in which audio will be\r\n     * returned from the callback's read() method (Required if format is not 16 kHz 16bit mono PCM).\r\n     */\r\n    public constructor(callback: PullAudioInputStreamCallback, format?: AudioStreamFormatImpl) {\r\n        super();\r\n        if (undefined === format) {\r\n            this.privFormat = AudioStreamFormat.getDefaultInputFormat() as AudioStreamFormatImpl;\r\n        } else {\r\n            this.privFormat = format;\r\n        }\r\n        this.privEvents = new EventSource<AudioSourceEvent>();\r\n        this.privId = createNoDashGuid();\r\n        this.privCallback = callback;\r\n        this.privIsClosed = false;\r\n        this.privBufferSize = this.privFormat.avgBytesPerSec / 10;\r\n    }\r\n\r\n    /**\r\n     * Format information for the audio\r\n     */\r\n    public get format(): Promise<AudioStreamFormatImpl> {\r\n        return Promise.resolve(this.privFormat);\r\n    }\r\n\r\n    /**\r\n     * Closes the stream.\r\n     * @member PullAudioInputStreamImpl.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(): void {\r\n        this.privIsClosed = true;\r\n        this.privCallback.close();\r\n    }\r\n\r\n    public id(): string {\r\n        return this.privId;\r\n    }\r\n\r\n    public turnOn(): Promise<void> {\r\n        this.onEvent(new AudioSourceInitializingEvent(this.privId)); // no stream id\r\n        this.onEvent(new AudioSourceReadyEvent(this.privId));\r\n        return;\r\n    }\r\n\r\n    public async attach(audioNodeId: string): Promise<IAudioStreamNode> {\r\n        this.onEvent(new AudioStreamNodeAttachingEvent(this.privId, audioNodeId));\r\n\r\n        await this.turnOn();\r\n        this.onEvent(new AudioStreamNodeAttachedEvent(this.privId, audioNodeId));\r\n        return {\r\n            detach: (): Promise<void> => {\r\n                this.privCallback.close();\r\n                this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\r\n                return this.turnOff();\r\n            },\r\n            id: (): string => audioNodeId,\r\n            read: (): Promise<IStreamChunk<ArrayBuffer>> => {\r\n                let totalBytes: number = 0;\r\n                let transmitBuff: ArrayBuffer;\r\n                // Until we have the minimum number of bytes to send in a transmission, keep asking for more.\r\n                while (totalBytes < this.privBufferSize) {\r\n                    // Sizing the read buffer to the delta between the perfect size and what's left means we won't ever get too much\r\n                    // data back.\r\n                    const readBuff: ArrayBuffer = new ArrayBuffer(this.privBufferSize - totalBytes);\r\n                    const pulledBytes: number = this.privCallback.read(readBuff);\r\n                    // If there is no return buffer yet defined, set the return buffer to the that was just populated.\r\n                    // This was, if we have enough data there's no copy penalty, but if we don't we have a buffer that's the\r\n                    // preferred size allocated.\r\n                    if (undefined === transmitBuff) {\r\n                        transmitBuff = readBuff;\r\n                    } else {\r\n                        // Not the first bite at the apple, so fill the return buffer with the data we got back.\r\n                        const intView: Int8Array = new Int8Array(transmitBuff);\r\n                        intView.set(new Int8Array(readBuff), totalBytes);\r\n                    }\r\n                    // If there are no bytes to read, just break out and be done.\r\n                    if (0 === pulledBytes) {\r\n                        break;\r\n                    }\r\n                    totalBytes += pulledBytes;\r\n                }\r\n                return Promise.resolve<IStreamChunk<ArrayBuffer>>({\r\n                    buffer: transmitBuff.slice(0, totalBytes),\r\n                    isEnd: this.privIsClosed || totalBytes === 0,\r\n                    timeReceived: Date.now(),\r\n                });\r\n            },\r\n        };\r\n    }\r\n\r\n    public detach(audioNodeId: string): void {\r\n        this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\r\n    }\r\n\r\n    public turnOff(): Promise<void> {\r\n        return;\r\n    }\r\n\r\n    public get events(): EventSource<AudioSourceEvent> {\r\n        return this.privEvents;\r\n    }\r\n\r\n    public get deviceInfo(): Promise<ISpeechConfigAudioDevice> {\r\n        return Promise.resolve({\r\n            bitspersample: this.privFormat.bitsPerSample,\r\n            channelcount: this.privFormat.channels,\r\n            connectivity: connectivity.Unknown,\r\n            manufacturer: \"Speech SDK\",\r\n            model: \"PullStream\",\r\n            samplerate: this.privFormat.samplesPerSec,\r\n            type: type.Stream,\r\n        });\r\n    }\r\n\r\n    private onEvent(event: AudioSourceEvent): void {\r\n        this.privEvents.onEvent(event);\r\n        Events.instance.onEvent(event);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Define speech synthesis audio output formats.\r\n * @enum SpeechSynthesisOutputFormat\r\n * Updated in version 1.17.0\r\n */\r\nexport enum SpeechSynthesisOutputFormat {\r\n    /**\r\n     * raw-8khz-8bit-mono-mulaw\r\n     * @member SpeechSynthesisOutputFormat.Raw8Khz8BitMonoMULaw,\r\n     */\r\n    Raw8Khz8BitMonoMULaw,\r\n\r\n    /**\r\n     * riff-16khz-16kbps-mono-siren\r\n     * @note Unsupported by the service. Do not use this value.\r\n     * @member SpeechSynthesisOutputFormat.Riff16Khz16KbpsMonoSiren\r\n     */\r\n    Riff16Khz16KbpsMonoSiren,\r\n\r\n    /**\r\n     * audio-16khz-16kbps-mono-siren\r\n     * @note Unsupported by the service. Do not use this value.\r\n     * @member SpeechSynthesisOutputFormat.Audio16Khz16KbpsMonoSiren\r\n     */\r\n    Audio16Khz16KbpsMonoSiren,\r\n\r\n    /**\r\n     * audio-16khz-32kbitrate-mono-mp3\r\n     * @member SpeechSynthesisOutputFormat.Audio16Khz32KBitRateMonoMp3\r\n     */\r\n    Audio16Khz32KBitRateMonoMp3,\r\n\r\n    /**\r\n     * audio-16khz-128kbitrate-mono-mp3\r\n     * @member SpeechSynthesisOutputFormat.Audio16Khz128KBitRateMonoMp3\r\n     */\r\n    Audio16Khz128KBitRateMonoMp3,\r\n\r\n    /**\r\n     * audio-16khz-64kbitrate-mono-mp3\r\n     * @member SpeechSynthesisOutputFormat.Audio16Khz64KBitRateMonoMp3\r\n     */\r\n    Audio16Khz64KBitRateMonoMp3,\r\n\r\n    /**\r\n     * audio-24khz-48kbitrate-mono-mp3\r\n     * @member SpeechSynthesisOutputFormat.Audio24Khz48KBitRateMonoMp3\r\n     */\r\n    Audio24Khz48KBitRateMonoMp3,\r\n\r\n    /**\r\n     * audio-24khz-96kbitrate-mono-mp3\r\n     * @member SpeechSynthesisOutputFormat.Audio24Khz96KBitRateMonoMp3\r\n     */\r\n    Audio24Khz96KBitRateMonoMp3,\r\n\r\n    /**\r\n     * audio-24khz-160kbitrate-mono-mp3\r\n     * @member SpeechSynthesisOutputFormat.Audio24Khz160KBitRateMonoMp3\r\n     */\r\n    Audio24Khz160KBitRateMonoMp3,\r\n\r\n    /**\r\n     * raw-16khz-16bit-mono-truesilk\r\n     * @member SpeechSynthesisOutputFormat.Raw16Khz16BitMonoTrueSilk\r\n     */\r\n    Raw16Khz16BitMonoTrueSilk,\r\n\r\n    /**\r\n     * riff-16khz-16bit-mono-pcm\r\n     * @member SpeechSynthesisOutputFormat.Riff16Khz16BitMonoPcm\r\n     */\r\n    Riff16Khz16BitMonoPcm,\r\n\r\n    /**\r\n     * riff-8khz-16bit-mono-pcm\r\n     * @member SpeechSynthesisOutputFormat.Riff8Khz16BitMonoPcm\r\n     */\r\n    Riff8Khz16BitMonoPcm,\r\n\r\n    /**\r\n     * riff-24khz-16bit-mono-pcm\r\n     * @member SpeechSynthesisOutputFormat.Riff24Khz16BitMonoPcm\r\n     */\r\n    Riff24Khz16BitMonoPcm,\r\n\r\n    /**\r\n     * riff-8khz-8bit-mono-mulaw\r\n     * @member SpeechSynthesisOutputFormat.Riff8Khz8BitMonoMULaw\r\n     */\r\n    Riff8Khz8BitMonoMULaw,\r\n\r\n    /**\r\n     * raw-16khz-16bit-mono-pcm\r\n     * @member SpeechSynthesisOutputFormat.Raw16Khz16BitMonoPcm\r\n     */\r\n    Raw16Khz16BitMonoPcm,\r\n\r\n    /**\r\n     * raw-24khz-16bit-mono-pcm\r\n     * @member SpeechSynthesisOutputFormat.Raw24Khz16BitMonoPcm\r\n     */\r\n    Raw24Khz16BitMonoPcm,\r\n\r\n    /**\r\n     * raw-8khz-16bit-mono-pcm\r\n     * @member SpeechSynthesisOutputFormat.Raw8Khz16BitMonoPcm\r\n     */\r\n    Raw8Khz16BitMonoPcm,\r\n\r\n    /**\r\n     * ogg-16khz-16bit-mono-opus\r\n     * @member SpeechSynthesisOutputFormat.Ogg16Khz16BitMonoOpus\r\n     */\r\n    Ogg16Khz16BitMonoOpus,\r\n\r\n    /**\r\n     * ogg-24khz-16bit-mono-opus\r\n     * @member SpeechSynthesisOutputFormat.Ogg24Khz16BitMonoOpus\r\n     */\r\n    Ogg24Khz16BitMonoOpus,\r\n\r\n    /**\r\n     * raw-48khz-16bit-mono-pcm\r\n     * @member SpeechSynthesisOutputFormat.Raw48Khz16BitMonoPcm\r\n     */\r\n    Raw48Khz16BitMonoPcm,\r\n\r\n    /**\r\n     * riff-48khz-16bit-mono-pcm\r\n     * @member SpeechSynthesisOutputFormat.Riff48Khz16BitMonoPcm\r\n     */\r\n\r\n    Riff48Khz16BitMonoPcm,\r\n    /**\r\n     * audio-48khz-96kbitrate-mono-mp3\r\n     * @member SpeechSynthesisOutputFormat.Audio48Khz96KBitRateMonoMp3\r\n     */\r\n    Audio48Khz96KBitRateMonoMp3,\r\n\r\n    /**\r\n     * audio-48khz-192kbitrate-mono-mp3\r\n     * @member SpeechSynthesisOutputFormat.Audio48Khz192KBitRateMonoMp3\r\n     */\r\n    Audio48Khz192KBitRateMonoMp3,\r\n\r\n    /**\r\n     * ogg-48khz-16bit-mono-opus\r\n     * Added in version 1.16.0\r\n     * @member SpeechSynthesisOutputFormat.Ogg48Khz16BitMonoOpus\r\n     */\r\n    Ogg48Khz16BitMonoOpus,\r\n\r\n    /**\r\n     * webm-16khz-16bit-mono-opus\r\n     * Added in version 1.16.0\r\n     * @member SpeechSynthesisOutputFormat.Webm16Khz16BitMonoOpus\r\n     */\r\n    Webm16Khz16BitMonoOpus,\r\n\r\n    /**\r\n     * webm-24khz-16bit-mono-opus\r\n     * Added in version 1.16.0\r\n     * @member SpeechSynthesisOutputFormat.Webm24Khz16BitMonoOpus\r\n     */\r\n    Webm24Khz16BitMonoOpus,\r\n\r\n    /**\r\n     * raw-24khz-16bit-mono-truesilk\r\n     * Added in version 1.17.0\r\n     * @member SpeechSynthesisOutputFormat.Raw24Khz16BitMonoTrueSilk\r\n     */\r\n     Raw24Khz16BitMonoTrueSilk,\r\n\r\n    /**\r\n     * raw-8khz-8bit-mono-alaw\r\n     * Added in version 1.17.0\r\n     * @member SpeechSynthesisOutputFormat.Raw8Khz8BitMonoALaw\r\n     */\r\n     Raw8Khz8BitMonoALaw,\r\n\r\n    /**\r\n     * riff-8khz-8bit-mono-alaw\r\n     * Added in version 1.17.0\r\n     * @member SpeechSynthesisOutputFormat.Riff8Khz8BitMonoALaw\r\n     */\r\n     Riff8Khz8BitMonoALaw,\r\n\r\n    /**\r\n     * webm-24khz-16bit-24kbps-mono-opus\r\n     * Audio compressed by OPUS codec in a webm container, with bitrate of 24kbps, optimized for IoT scenario.\r\n     * Added in version 1.19.0\r\n     * @member SpeechSynthesisOutputFormat.Webm24Khz16Bit24KbpsMonoOpus\r\n     */\r\n    Webm24Khz16Bit24KbpsMonoOpus,\r\n\r\n    /**\r\n     * audio-16khz-16bit-32kbps-mono-opus\r\n     * Audio compressed by OPUS codec without container, with bitrate of 32kbps.\r\n     * Added in version 1.20.0\r\n     * @member SpeechSynthesisOutputFormat.Audio16Khz16Bit32KbpsMonoOpus\r\n     */\r\n    Audio16Khz16Bit32KbpsMonoOpus,\r\n\r\n    /**\r\n     * audio-24khz-16bit-48kbps-mono-opus\r\n     * Audio compressed by OPUS codec without container, with bitrate of 48kbps.\r\n     * Added in version 1.20.0\r\n     * @member SpeechSynthesisOutputFormat.Audio24Khz16Bit48KbpsMonoOpus\r\n     */\r\n    Audio24Khz16Bit48KbpsMonoOpus,\r\n\r\n    /**\r\n     * audio-24khz-16bit-24kbps-mono-opus\r\n     * Audio compressed by OPUS codec without container, with bitrate of 24kbps.\r\n     * Added in version 1.20.0\r\n     * @member SpeechSynthesisOutputFormat.Audio24Khz16Bit24KbpsMonoOpus\r\n     */\r\n    Audio24Khz16Bit24KbpsMonoOpus,\r\n\r\n    /**\r\n     * raw-22050hz-16bit-mono-pcm\r\n     * Raw PCM audio at 22050Hz sampling rate and 16-bit depth.\r\n     * Added in version 1.22.0\r\n     * @member SpeechSynthesisOutputFormat.Raw22050Hz16BitMonoPcm\r\n     */\r\n    Raw22050Hz16BitMonoPcm,\r\n\r\n    /**\r\n     * riff-22050hz-16bit-mono-pcm\r\n     * PCM audio at 22050Hz sampling rate and 16-bit depth, with RIFF header.\r\n     * Added in version 1.22.0\r\n     * @member SpeechSynthesisOutputFormat.Riff22050Hz16BitMonoPcm\r\n     */\r\n    Riff22050Hz16BitMonoPcm,\r\n\r\n    /**\r\n     * raw-44100hz-16bit-mono-pcm\r\n     * Raw PCM audio at 44100Hz sampling rate and 16-bit depth.\r\n     * Added in version 1.22.0\r\n     * @member SpeechSynthesisOutputFormat.Raw44100Hz16BitMonoPcm\r\n     */\r\n    Raw44100Hz16BitMonoPcm,\r\n\r\n    /**\r\n     * riff-44100hz-16bit-mono-pcm\r\n     * PCM audio at 44100Hz sampling rate and 16-bit depth, with RIFF header.\r\n     * Added in version 1.22.0\r\n     * @member SpeechSynthesisOutputFormat.Riff44100Hz16BitMonoPcm\r\n     */\r\n    Riff44100Hz16BitMonoPcm,\r\n\r\n    /**\r\n     * amr-wb-16000hz\r\n     * AMR-WB audio at 16kHz sampling rate.\r\n     * Added in version 1.38.0\r\n     * @member SpeechSynthesisOutputFormat.AmrWb16000Hz\r\n     */\r\n    AmrWb16000Hz,\r\n\r\n    /**\r\n     * g722-16khz-64kbps\r\n     * G.722 audio at 16kHz sampling rate and 64kbps bitrate.\r\n     * Added in version 1.38.0\r\n     */\r\n    G72216Khz64Kbps\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { INumberDictionary } from \"../../common/Exports.js\";\r\nimport { SpeechSynthesisOutputFormat } from \"../SpeechSynthesisOutputFormat.js\";\r\nimport { AudioFormatTag, AudioStreamFormatImpl } from \"./AudioStreamFormat.js\";\r\n\r\n/**\r\n * @private\r\n * @class AudioOutputFormatImpl\r\n * Updated in version 1.17.0\r\n */\r\n// eslint-disable-next-line max-classes-per-file\r\nexport class AudioOutputFormatImpl extends AudioStreamFormatImpl {\r\n    public static SpeechSynthesisOutputFormatToString: INumberDictionary<string> = {\r\n        [SpeechSynthesisOutputFormat.Raw8Khz8BitMonoMULaw]: \"raw-8khz-8bit-mono-mulaw\",\r\n        [SpeechSynthesisOutputFormat.Riff16Khz16KbpsMonoSiren]: \"riff-16khz-16kbps-mono-siren\",\r\n        [SpeechSynthesisOutputFormat.Audio16Khz16KbpsMonoSiren]: \"audio-16khz-16kbps-mono-siren\",\r\n        [SpeechSynthesisOutputFormat.Audio16Khz32KBitRateMonoMp3]: \"audio-16khz-32kbitrate-mono-mp3\",\r\n        [SpeechSynthesisOutputFormat.Audio16Khz128KBitRateMonoMp3]: \"audio-16khz-128kbitrate-mono-mp3\",\r\n        [SpeechSynthesisOutputFormat.Audio16Khz64KBitRateMonoMp3]: \"audio-16khz-64kbitrate-mono-mp3\",\r\n        [SpeechSynthesisOutputFormat.Audio24Khz48KBitRateMonoMp3]: \"audio-24khz-48kbitrate-mono-mp3\",\r\n        [SpeechSynthesisOutputFormat.Audio24Khz96KBitRateMonoMp3]: \"audio-24khz-96kbitrate-mono-mp3\",\r\n        [SpeechSynthesisOutputFormat.Audio24Khz160KBitRateMonoMp3]: \"audio-24khz-160kbitrate-mono-mp3\",\r\n        [SpeechSynthesisOutputFormat.Raw16Khz16BitMonoTrueSilk]: \"raw-16khz-16bit-mono-truesilk\",\r\n        [SpeechSynthesisOutputFormat.Riff16Khz16BitMonoPcm]: \"riff-16khz-16bit-mono-pcm\",\r\n        [SpeechSynthesisOutputFormat.Riff8Khz16BitMonoPcm]: \"riff-8khz-16bit-mono-pcm\",\r\n        [SpeechSynthesisOutputFormat.Riff24Khz16BitMonoPcm]: \"riff-24khz-16bit-mono-pcm\",\r\n        [SpeechSynthesisOutputFormat.Riff8Khz8BitMonoMULaw]: \"riff-8khz-8bit-mono-mulaw\",\r\n        [SpeechSynthesisOutputFormat.Raw16Khz16BitMonoPcm]: \"raw-16khz-16bit-mono-pcm\",\r\n        [SpeechSynthesisOutputFormat.Raw24Khz16BitMonoPcm]: \"raw-24khz-16bit-mono-pcm\",\r\n        [SpeechSynthesisOutputFormat.Raw8Khz16BitMonoPcm]: \"raw-8khz-16bit-mono-pcm\",\r\n        [SpeechSynthesisOutputFormat.Ogg16Khz16BitMonoOpus]: \"ogg-16khz-16bit-mono-opus\",\r\n        [SpeechSynthesisOutputFormat.Ogg24Khz16BitMonoOpus]: \"ogg-24khz-16bit-mono-opus\",\r\n        [SpeechSynthesisOutputFormat.Raw48Khz16BitMonoPcm]: \"raw-48khz-16bit-mono-pcm\",\r\n        [SpeechSynthesisOutputFormat.Riff48Khz16BitMonoPcm]: \"riff-48khz-16bit-mono-pcm\",\r\n        [SpeechSynthesisOutputFormat.Audio48Khz96KBitRateMonoMp3]: \"audio-48khz-96kbitrate-mono-mp3\",\r\n        [SpeechSynthesisOutputFormat.Audio48Khz192KBitRateMonoMp3]: \"audio-48khz-192kbitrate-mono-mp3\",\r\n        [SpeechSynthesisOutputFormat.Ogg48Khz16BitMonoOpus]: \"ogg-48khz-16bit-mono-opus\",\r\n        [SpeechSynthesisOutputFormat.Webm16Khz16BitMonoOpus]: \"webm-16khz-16bit-mono-opus\",\r\n        [SpeechSynthesisOutputFormat.Webm24Khz16BitMonoOpus]: \"webm-24khz-16bit-mono-opus\",\r\n        [SpeechSynthesisOutputFormat.Webm24Khz16Bit24KbpsMonoOpus]: \"webm-24khz-16bit-24kbps-mono-opus\",\r\n        [SpeechSynthesisOutputFormat.Raw24Khz16BitMonoTrueSilk]: \"raw-24khz-16bit-mono-truesilk\",\r\n        [SpeechSynthesisOutputFormat.Raw8Khz8BitMonoALaw]: \"raw-8khz-8bit-mono-alaw\",\r\n        [SpeechSynthesisOutputFormat.Riff8Khz8BitMonoALaw]: \"riff-8khz-8bit-mono-alaw\",\r\n        [SpeechSynthesisOutputFormat.Audio16Khz16Bit32KbpsMonoOpus]: \"audio-16khz-16bit-32kbps-mono-opus\",\r\n        [SpeechSynthesisOutputFormat.Audio24Khz16Bit48KbpsMonoOpus]: \"audio-24khz-16bit-48kbps-mono-opus\",\r\n        [SpeechSynthesisOutputFormat.Audio24Khz16Bit24KbpsMonoOpus]: \"audio-24khz-16bit-24kbps-mono-opus\",\r\n        [SpeechSynthesisOutputFormat.Raw22050Hz16BitMonoPcm]: \"raw-22050hz-16bit-mono-pcm\",\r\n        [SpeechSynthesisOutputFormat.Riff22050Hz16BitMonoPcm]: \"riff-22050hz-16bit-mono-pcm\",\r\n        [SpeechSynthesisOutputFormat.Raw44100Hz16BitMonoPcm]: \"raw-44100hz-16bit-mono-pcm\",\r\n        [SpeechSynthesisOutputFormat.Riff44100Hz16BitMonoPcm]: \"riff-44100hz-16bit-mono-pcm\",\r\n        [SpeechSynthesisOutputFormat.AmrWb16000Hz]: \"amr-wb-16000hz\",\r\n        [SpeechSynthesisOutputFormat.G72216Khz64Kbps]: \"g722-16khz-64kbps\",\r\n    };\r\n    private priAudioFormatString: string;\r\n    /**\r\n     * audio format string for synthesis request, which may differ from priAudioFormatString.\r\n     * e.g. for riff format, we will request raw format and add a header in SDK side.\r\n     */\r\n    private readonly priRequestAudioFormatString: string;\r\n    private readonly priHasHeader: boolean;\r\n\r\n    /**\r\n     * Creates an instance with the given values.\r\n     * @constructor\r\n     * @param formatTag\r\n     * @param {number} channels - Number of channels.\r\n     * @param {number} samplesPerSec - Samples per second.\r\n     * @param {number} avgBytesPerSec - Average bytes per second.\r\n     * @param {number} blockAlign - Block alignment.\r\n     * @param {number} bitsPerSample - Bits per sample.\r\n     * @param {string} audioFormatString - Audio format string\r\n     * @param {string} requestAudioFormatString - Audio format string sent to service.\r\n     * @param {boolean} hasHeader - If the format has header or not.\r\n     */\r\n    public constructor(formatTag: AudioFormatTag,\r\n                       channels: number,\r\n                       samplesPerSec: number,\r\n                       avgBytesPerSec: number,\r\n                       blockAlign: number,\r\n                       bitsPerSample: number,\r\n                       audioFormatString: string,\r\n                       requestAudioFormatString: string,\r\n                       hasHeader: boolean) {\r\n        super(samplesPerSec, bitsPerSample, channels, formatTag);\r\n        this.formatTag = formatTag;\r\n        this.avgBytesPerSec = avgBytesPerSec;\r\n        this.blockAlign = blockAlign;\r\n        this.priAudioFormatString = audioFormatString;\r\n        this.priRequestAudioFormatString = requestAudioFormatString;\r\n        this.priHasHeader = hasHeader;\r\n    }\r\n\r\n    public static fromSpeechSynthesisOutputFormat(speechSynthesisOutputFormat?: SpeechSynthesisOutputFormat): AudioOutputFormatImpl {\r\n        if (speechSynthesisOutputFormat === undefined) {\r\n            return AudioOutputFormatImpl.getDefaultOutputFormat();\r\n        }\r\n        return AudioOutputFormatImpl.fromSpeechSynthesisOutputFormatString(\r\n            AudioOutputFormatImpl.SpeechSynthesisOutputFormatToString[speechSynthesisOutputFormat]);\r\n    }\r\n\r\n    public static fromSpeechSynthesisOutputFormatString(speechSynthesisOutputFormatString: string): AudioOutputFormatImpl {\r\n        switch (speechSynthesisOutputFormatString) {\r\n            case \"raw-8khz-8bit-mono-mulaw\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.MuLaw,\r\n                    1,\r\n                    8000,\r\n                    8000,\r\n                    1,\r\n                    8,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"riff-16khz-16kbps-mono-siren\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.Siren,\r\n                    1,\r\n                    16000,\r\n                    2000,\r\n                    40,\r\n                    0,\r\n                    speechSynthesisOutputFormatString,\r\n                    \"audio-16khz-16kbps-mono-siren\",\r\n                    true);\r\n            case \"audio-16khz-16kbps-mono-siren\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.Siren,\r\n                    1,\r\n                    16000,\r\n                    2000,\r\n                    40,\r\n                    0,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"audio-16khz-32kbitrate-mono-mp3\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.MP3,\r\n                    1,\r\n                    16000,\r\n                    32 << 7,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"audio-16khz-128kbitrate-mono-mp3\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.MP3,\r\n                    1,\r\n                    16000,\r\n                    128 << 7,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"audio-16khz-64kbitrate-mono-mp3\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.MP3,\r\n                    1,\r\n                    16000,\r\n                    64 << 7,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"audio-24khz-48kbitrate-mono-mp3\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.MP3,\r\n                    1,\r\n                    24000,\r\n                    48 << 7,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"audio-24khz-96kbitrate-mono-mp3\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.MP3,\r\n                    1,\r\n                    24000,\r\n                    96 << 7,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"audio-24khz-160kbitrate-mono-mp3\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.MP3,\r\n                    1,\r\n                    24000,\r\n                    160 << 7,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"raw-16khz-16bit-mono-truesilk\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.SILKSkype,\r\n                    1,\r\n                    16000,\r\n                    32000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n\r\n            case \"riff-8khz-16bit-mono-pcm\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.PCM,\r\n                    1,\r\n                    8000,\r\n                    16000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    \"raw-8khz-16bit-mono-pcm\",\r\n                    true);\r\n            case \"riff-24khz-16bit-mono-pcm\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.PCM,\r\n                    1,\r\n                    24000,\r\n                    48000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    \"raw-24khz-16bit-mono-pcm\",\r\n                    true);\r\n            case \"riff-8khz-8bit-mono-mulaw\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.MuLaw,\r\n                    1,\r\n                    8000,\r\n                    8000,\r\n                    1,\r\n                    8,\r\n                    speechSynthesisOutputFormatString,\r\n                    \"raw-8khz-8bit-mono-mulaw\",\r\n                    true);\r\n            case \"raw-16khz-16bit-mono-pcm\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.PCM,\r\n                    1,\r\n                    16000,\r\n                    32000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    \"raw-16khz-16bit-mono-pcm\",\r\n                    false);\r\n            case \"raw-24khz-16bit-mono-pcm\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.PCM,\r\n                    1,\r\n                    24000,\r\n                    48000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    \"raw-24khz-16bit-mono-pcm\",\r\n                    false);\r\n            case \"raw-8khz-16bit-mono-pcm\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.PCM,\r\n                    1,\r\n                    8000,\r\n                    16000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    \"raw-8khz-16bit-mono-pcm\",\r\n                    false);\r\n            case \"ogg-16khz-16bit-mono-opus\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.OGG_OPUS,\r\n                    1,\r\n                    16000,\r\n                    8192,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"ogg-24khz-16bit-mono-opus\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.OGG_OPUS,\r\n                    1,\r\n                    24000,\r\n                    8192,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"raw-48khz-16bit-mono-pcm\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.PCM,\r\n                    1,\r\n                    48000,\r\n                    96000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    \"raw-48khz-16bit-mono-pcm\",\r\n                    false);\r\n            case \"riff-48khz-16bit-mono-pcm\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.PCM,\r\n                    1,\r\n                    48000,\r\n                    96000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    \"raw-48khz-16bit-mono-pcm\",\r\n                    true);\r\n            case \"audio-48khz-96kbitrate-mono-mp3\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.MP3,\r\n                    1,\r\n                    48000,\r\n                    96 << 7,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"audio-48khz-192kbitrate-mono-mp3\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.MP3,\r\n                    1,\r\n                    48000,\r\n                    192 << 7,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"ogg-48khz-16bit-mono-opus\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.OGG_OPUS,\r\n                    1,\r\n                    48000,\r\n                    12000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"webm-16khz-16bit-mono-opus\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.WEBM_OPUS,\r\n                    1,\r\n                    16000,\r\n                    4000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"webm-24khz-16bit-mono-opus\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.WEBM_OPUS,\r\n                    1,\r\n                    24000,\r\n                    6000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"webm-24khz-16bit-24kbps-mono-opus\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.WEBM_OPUS,\r\n                    1,\r\n                    24000,\r\n                    3000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"audio-16khz-16bit-32kbps-mono-opus\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.OPUS,\r\n                    1,\r\n                    16000,\r\n                    4000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"audio-24khz-16bit-48kbps-mono-opus\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.OPUS,\r\n                    1,\r\n                    24000,\r\n                    6000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"audio-24khz-16bit-24kbps-mono-opus\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.OPUS,\r\n                    1,\r\n                    24000,\r\n                    3000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"audio-24khz-16bit-mono-flac\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.FLAC,\r\n                    1,\r\n                    24000,\r\n                    24000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"audio-48khz-16bit-mono-flac\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.FLAC,\r\n                    1,\r\n                    48000,\r\n                    30000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"raw-24khz-16bit-mono-truesilk\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.SILKSkype,\r\n                    1,\r\n                    24000,\r\n                    48000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"raw-8khz-8bit-mono-alaw\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.ALaw,\r\n                    1,\r\n                    8000,\r\n                    8000,\r\n                    1,\r\n                    8,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"riff-8khz-8bit-mono-alaw\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.ALaw,\r\n                    1,\r\n                    8000,\r\n                    8000,\r\n                    1,\r\n                    8,\r\n                    speechSynthesisOutputFormatString,\r\n                    \"raw-8khz-8bit-mono-alaw\",\r\n                    true);\r\n            case \"raw-22050hz-16bit-mono-pcm\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.PCM,\r\n                    1,\r\n                    22050,\r\n                    44100,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"riff-22050hz-16bit-mono-pcm\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.PCM,\r\n                    1,\r\n                    22050,\r\n                    44100,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    \"raw-22050hz-16bit-mono-pcm\",\r\n                    true);\r\n            case \"raw-44100hz-16bit-mono-pcm\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.PCM,\r\n                    1,\r\n                    44100,\r\n                    88200,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"riff-44100hz-16bit-mono-pcm\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.PCM,\r\n                    1,\r\n                    44100,\r\n                    88200,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    \"raw-44100hz-16bit-mono-pcm\",\r\n                    true);\r\n            case \"amr-wb-16000h\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.AMR_WB,\r\n                    1,\r\n                    16000,\r\n                    3052,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"g722-16khz-64kbps\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.G722,\r\n                    1,\r\n                    16000,\r\n                    8000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"riff-16khz-16bit-mono-pcm\":\r\n            default:\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.PCM,\r\n                    1,\r\n                    16000,\r\n                    32000,\r\n                    2,\r\n                    16,\r\n                    \"riff-16khz-16bit-mono-pcm\",\r\n                    \"raw-16khz-16bit-mono-pcm\",\r\n                    true);\r\n        }\r\n    }\r\n\r\n    public static getDefaultOutputFormat(): AudioOutputFormatImpl {\r\n        return AudioOutputFormatImpl.fromSpeechSynthesisOutputFormatString(\r\n            (typeof window !== \"undefined\") ? \"audio-24khz-48kbitrate-mono-mp3\" : \"riff-16khz-16bit-mono-pcm\");\r\n    }\r\n\r\n    /**\r\n     * The format tag of the audio\r\n     * @AudioFormatTag AudioOutputFormatImpl.prototype.formatTag\r\n     * @function\r\n     * @public\r\n     */\r\n    public formatTag: AudioFormatTag;\r\n\r\n    /**\r\n     * Specifies if this audio output format has a header\r\n     * @boolean AudioOutputFormatImpl.prototype.hasHeader\r\n     * @function\r\n     * @public\r\n     */\r\n    public get hasHeader(): boolean {\r\n        return this.priHasHeader;\r\n    }\r\n\r\n    /**\r\n     * Specifies the header of this format\r\n     * @ArrayBuffer AudioOutputFormatImpl.prototype.header\r\n     * @function\r\n     * @public\r\n     */\r\n    public get header(): ArrayBuffer {\r\n        if (this.hasHeader) {\r\n            return this.privHeader;\r\n        }\r\n        return undefined;\r\n    }\r\n\r\n    /**\r\n     * Updates the header based on the audio length\r\n     * @member AudioOutputFormatImpl.updateHeader\r\n     * @function\r\n     * @public\r\n     * @param {number} audioLength - the audio length\r\n     */\r\n    public updateHeader(audioLength: number): void {\r\n        if (this.priHasHeader) {\r\n            const view = new DataView(this.privHeader);\r\n            view.setUint32(4, audioLength + this.privHeader.byteLength - 8, true);\r\n            view.setUint32(40, audioLength, true);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Specifies the audio format string to be sent to the service\r\n     * @string AudioOutputFormatImpl.prototype.requestAudioFormatString\r\n     * @function\r\n     * @public\r\n     */\r\n    public get requestAudioFormatString(): string {\r\n        return this.priRequestAudioFormatString;\r\n    }\r\n\r\n    /**\r\n     * Adds audio header\r\n     * @param audio the raw audio without header\r\n     * @returns the audio with header if applicable\r\n     */\r\n\r\n    public addHeader(audio: ArrayBuffer): ArrayBuffer {\r\n        if (!this.hasHeader) {\r\n            return audio;\r\n        }\r\n        this.updateHeader(audio.byteLength);\r\n        const tmp = new Uint8Array(audio.byteLength + this.header.byteLength);\r\n        tmp.set(new Uint8Array(this.header), 0);\r\n        tmp.set(new Uint8Array(audio), this.header.byteLength);\r\n        return tmp.buffer;\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport {\r\n    createNoDashGuid,\r\n    IAudioDestination,\r\n    IStreamChunk,\r\n    Stream,\r\n} from \"../../common/Exports.js\";\r\nimport { Contracts } from \"../Contracts.js\";\r\nimport {\r\n    AudioStreamFormat,\r\n    PushAudioOutputStreamCallback\r\n} from \"../Exports.js\";\r\nimport { AudioOutputFormatImpl } from \"./AudioOutputFormat.js\";\r\n\r\n/**\r\n * Represents audio output stream used for custom audio output configurations.\r\n * @class AudioOutputStream\r\n */\r\nexport abstract class AudioOutputStream {\r\n\r\n    /**\r\n     * Creates and initializes an instance.\r\n     * @constructor\r\n     */\r\n    protected constructor() {\r\n        return;\r\n    }\r\n\r\n    /**\r\n     * Sets the format of the AudioOutputStream\r\n     * Note: the format is set by the synthesizer before writing. Do not set it before passing it to AudioConfig\r\n     * @member AudioOutputStream.prototype.format\r\n     */\r\n    public abstract set format(format: AudioStreamFormat);\r\n\r\n    /**\r\n     * Creates a memory backed PullAudioOutputStream with the specified audio format.\r\n     * @member AudioOutputStream.createPullStream\r\n     * @function\r\n     * @public\r\n     * @returns {PullAudioOutputStream} The audio output stream being created.\r\n     */\r\n    public static createPullStream(): PullAudioOutputStream {\r\n        return PullAudioOutputStream.create();\r\n    }\r\n\r\n    /**\r\n     * Explicitly frees any external resource attached to the object\r\n     * @member AudioOutputStream.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract close(): void;\r\n}\r\n\r\n/**\r\n * Represents memory backed push audio output stream used for custom audio output configurations.\r\n * @class PullAudioOutputStream\r\n */\r\nexport abstract class PullAudioOutputStream extends AudioOutputStream {\r\n\r\n    /**\r\n     * Creates a memory backed PullAudioOutputStream with the specified audio format.\r\n     * @member PullAudioOutputStream.create\r\n     * @function\r\n     * @public\r\n     * @returns {PullAudioOutputStream} The push audio output stream being created.\r\n     */\r\n    public static create(): PullAudioOutputStream {\r\n        return new PullAudioOutputStreamImpl();\r\n    }\r\n\r\n    /**\r\n     * Reads audio data from the internal buffer.\r\n     * @member PullAudioOutputStream.prototype.read\r\n     * @function\r\n     * @public\r\n     * @param {ArrayBuffer} dataBuffer - An ArrayBuffer to store the read data.\r\n     * @returns {Promise<number>} Audio buffer length has been read.\r\n     */\r\n    public abstract read(dataBuffer: ArrayBuffer): Promise<number>;\r\n\r\n    /**\r\n     * Closes the stream.\r\n     * @member PullAudioOutputStream.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract close(): void;\r\n}\r\n\r\n/**\r\n * Represents memory backed push audio output stream used for custom audio output configurations.\r\n * @private\r\n * @class PullAudioOutputStreamImpl\r\n */\r\nexport class PullAudioOutputStreamImpl extends PullAudioOutputStream implements IAudioDestination {\r\n    private privFormat: AudioOutputFormatImpl;\r\n    private privId: string;\r\n    private privStream: Stream<ArrayBuffer>;\r\n    private privLastChunkView: Int8Array;\r\n\r\n    /**\r\n     * Creates and initializes an instance with the given values.\r\n     * @constructor\r\n     */\r\n    public constructor() {\r\n        super();\r\n        this.privId = createNoDashGuid();\r\n        this.privStream = new Stream<ArrayBuffer>();\r\n    }\r\n\r\n    /**\r\n     * Sets the format information to the stream. For internal use only.\r\n     * @param {AudioStreamFormat} format - the format to be set.\r\n     */\r\n    public set format(format: AudioStreamFormat) {\r\n        if (format === undefined || format === null) {\r\n            this.privFormat = AudioOutputFormatImpl.getDefaultOutputFormat();\r\n        }\r\n        this.privFormat = format as AudioOutputFormatImpl;\r\n    }\r\n\r\n    /**\r\n     * Format information for the audio\r\n     */\r\n    public get format(): AudioStreamFormat {\r\n        return this.privFormat;\r\n    }\r\n\r\n    /**\r\n     * Checks if the stream is closed\r\n     * @member PullAudioOutputStreamImpl.prototype.isClosed\r\n     * @property\r\n     * @public\r\n     */\r\n    public get isClosed(): boolean {\r\n        return this.privStream.isClosed;\r\n    }\r\n\r\n    /**\r\n     * Gets the id of the stream\r\n     * @member PullAudioOutputStreamImpl.prototype.id\r\n     * @property\r\n     * @public\r\n     */\r\n    public id(): string {\r\n        return this.privId;\r\n    }\r\n\r\n    /**\r\n     * Reads audio data from the internal buffer.\r\n     * @member PullAudioOutputStreamImpl.prototype.read\r\n     * @function\r\n     * @public\r\n     * @param {ArrayBuffer} dataBuffer - An ArrayBuffer to store the read data.\r\n     * @returns {Promise<number>} - Audio buffer length has been read.\r\n     */\r\n    public async read(dataBuffer: ArrayBuffer): Promise<number> {\r\n        const intView: Int8Array = new Int8Array(dataBuffer);\r\n        let totalBytes: number = 0;\r\n\r\n        if (this.privLastChunkView !== undefined) {\r\n            if (this.privLastChunkView.length > dataBuffer.byteLength) {\r\n                intView.set(this.privLastChunkView.slice(0, dataBuffer.byteLength));\r\n                this.privLastChunkView = this.privLastChunkView.slice(dataBuffer.byteLength);\r\n                return Promise.resolve(dataBuffer.byteLength);\r\n            }\r\n            intView.set(this.privLastChunkView);\r\n            totalBytes = this.privLastChunkView.length;\r\n            this.privLastChunkView = undefined;\r\n        }\r\n\r\n        // Until we have the minimum number of bytes to send in a transmission, keep asking for more.\r\n        while (totalBytes < dataBuffer.byteLength && !this.privStream.isReadEnded) {\r\n            const chunk: IStreamChunk<ArrayBuffer> = await this.privStream.read();\r\n            if (chunk !== undefined && !chunk.isEnd) {\r\n                let tmpBuffer: ArrayBuffer;\r\n                if (chunk.buffer.byteLength > dataBuffer.byteLength - totalBytes) {\r\n                    tmpBuffer = chunk.buffer.slice(0, dataBuffer.byteLength - totalBytes);\r\n                    this.privLastChunkView = new Int8Array(chunk.buffer.slice(dataBuffer.byteLength - totalBytes));\r\n                } else {\r\n                    tmpBuffer = chunk.buffer;\r\n                }\r\n                intView.set(new Int8Array(tmpBuffer), totalBytes);\r\n                totalBytes += tmpBuffer.byteLength;\r\n            } else {\r\n                this.privStream.readEnded();\r\n            }\r\n        }\r\n        return totalBytes;\r\n    }\r\n\r\n    /**\r\n     * Writes the audio data specified by making an internal copy of the data.\r\n     * @member PullAudioOutputStreamImpl.prototype.write\r\n     * @function\r\n     * @public\r\n     * @param {ArrayBuffer} dataBuffer - The audio buffer of which this function will make a copy.\r\n     */\r\n    public write(dataBuffer: ArrayBuffer): void {\r\n        Contracts.throwIfNullOrUndefined(this.privStream, \"must set format before writing\");\r\n        this.privStream.writeStreamChunk({\r\n            buffer: dataBuffer,\r\n            isEnd: false,\r\n            timeReceived: Date.now()\r\n        });\r\n    }\r\n\r\n    /**\r\n     * Closes the stream.\r\n     * @member PullAudioOutputStreamImpl.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(): void {\r\n        this.privStream.close();\r\n    }\r\n}\r\n\r\n/*\r\n * Represents audio output stream used for custom audio output configurations.\r\n * @class PushAudioOutputStream\r\n */\r\nexport abstract class PushAudioOutputStream extends AudioOutputStream {\r\n    /**\r\n     * Creates and initializes and instance.\r\n     * @constructor\r\n     */\r\n    protected constructor() {\r\n        super();\r\n    }\r\n\r\n    /**\r\n     * Creates a PushAudioOutputStream that delegates to the specified callback interface for\r\n     * write() and close() methods.\r\n     * @member PushAudioOutputStream.create\r\n     * @function\r\n     * @public\r\n     * @param {PushAudioOutputStreamCallback} callback - The custom audio output object,\r\n     * derived from PushAudioOutputStreamCallback\r\n     * @returns {PushAudioOutputStream} The push audio output stream being created.\r\n     */\r\n    public static create(callback: PushAudioOutputStreamCallback): PushAudioOutputStream {\r\n        return new PushAudioOutputStreamImpl(callback);\r\n    }\r\n\r\n    /**\r\n     * Explicitly frees any external resource attached to the object\r\n     * @member PushAudioOutputStream.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract close(): void;\r\n\r\n}\r\n\r\n/**\r\n * Represents audio output stream used for custom audio output configurations.\r\n * @private\r\n * @class PushAudioOutputStreamImpl\r\n */\r\nexport class PushAudioOutputStreamImpl extends PushAudioOutputStream implements IAudioDestination {\r\n    private readonly privId: string;\r\n    private privCallback: PushAudioOutputStreamCallback;\r\n\r\n    /**\r\n     * Creates a PushAudioOutputStream that delegates to the specified callback interface for\r\n     * read() and close() methods.\r\n     * @constructor\r\n     * @param {PushAudioOutputStreamCallback} callback - The custom audio output object,\r\n     * derived from PushAudioOutputStreamCallback\r\n     */\r\n    public constructor(callback: PushAudioOutputStreamCallback) {\r\n        super();\r\n        this.privId = createNoDashGuid();\r\n        this.privCallback = callback;\r\n    }\r\n\r\n    // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n    public set format(format: AudioStreamFormat) { }\r\n\r\n    public write(buffer: ArrayBuffer): void {\r\n        if (!!this.privCallback.write) {\r\n            this.privCallback.write(buffer);\r\n        }\r\n    }\r\n\r\n    public close(): void {\r\n        if (!!this.privCallback.close) {\r\n            this.privCallback.close();\r\n        }\r\n    }\r\n\r\n    public id(): string {\r\n        return this.privId;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport { PathLike } from \"fs\";\r\nimport {\r\n    FileAudioSource,\r\n    MicAudioSource,\r\n    PcmRecorder,\r\n} from \"../../common.browser/Exports.js\";\r\nimport { ISpeechConfigAudioDevice } from \"../../common.speech/Exports.js\";\r\nimport {\r\n    AudioSourceEvent,\r\n    EventSource,\r\n    IAudioDestination,\r\n    IAudioSource,\r\n    IAudioStreamNode\r\n} from \"../../common/Exports.js\";\r\nimport { Contracts } from \"../Contracts.js\";\r\nimport {\r\n    AudioInputStream,\r\n    AudioOutputStream,\r\n    AudioStreamFormat,\r\n    IPlayer,\r\n    PullAudioInputStreamCallback,\r\n    PullAudioOutputStream,\r\n    PushAudioOutputStream,\r\n    PushAudioOutputStreamCallback,\r\n    SpeakerAudioDestination\r\n} from \"../Exports.js\";\r\nimport { AudioFileWriter } from \"./AudioFileWriter.js\";\r\nimport { PullAudioInputStreamImpl, PushAudioInputStreamImpl } from \"./AudioInputStream.js\";\r\nimport { PullAudioOutputStreamImpl, PushAudioOutputStreamImpl } from \"./AudioOutputStream.js\";\r\nimport { AudioStreamFormatImpl } from \"./AudioStreamFormat.js\";\r\n\r\n/**\r\n * Represents audio input configuration used for specifying what type of input to use (microphone, file, stream).\r\n * @class AudioConfig\r\n * Updated in version 1.11.0\r\n */\r\nexport abstract class AudioConfig {\r\n    /**\r\n     * Creates an AudioConfig object representing the default microphone on the system.\r\n     * @member AudioConfig.fromDefaultMicrophoneInput\r\n     * @function\r\n     * @public\r\n     * @returns {AudioConfig} The audio input configuration being created.\r\n     */\r\n    public static fromDefaultMicrophoneInput(): AudioConfig {\r\n        const pcmRecorder = new PcmRecorder(true);\r\n        return new AudioConfigImpl(new MicAudioSource(pcmRecorder));\r\n    }\r\n\r\n    /**\r\n     * Creates an AudioConfig object representing a microphone with the specified device ID.\r\n     * @member AudioConfig.fromMicrophoneInput\r\n     * @function\r\n     * @public\r\n     * @param {string | undefined} deviceId - Specifies the device ID of the microphone to be used.\r\n     * Default microphone is used the value is omitted.\r\n     * @returns {AudioConfig} The audio input configuration being created.\r\n     */\r\n    public static fromMicrophoneInput(deviceId?: string): AudioConfig {\r\n        const pcmRecorder = new PcmRecorder(true);\r\n        return new AudioConfigImpl(new MicAudioSource(pcmRecorder, deviceId));\r\n    }\r\n\r\n    /**\r\n     * Creates an AudioConfig object representing the specified file.\r\n     * @member AudioConfig.fromWavFileInput\r\n     * @function\r\n     * @public\r\n     * @param {File} fileName - Specifies the audio input file. Currently, only WAV / PCM is supported.\r\n     * @returns {AudioConfig} The audio input configuration being created.\r\n     */\r\n    public static fromWavFileInput(file: File | Buffer, name: string = \"unnamedBuffer.wav\"): AudioConfig {\r\n        return new AudioConfigImpl(new FileAudioSource(file, name));\r\n    }\r\n\r\n    /**\r\n     * Creates an AudioConfig object representing the specified stream.\r\n     * @member AudioConfig.fromStreamInput\r\n     * @function\r\n     * @public\r\n     * @param {AudioInputStream | PullAudioInputStreamCallback | MediaStream} audioStream - Specifies the custom audio input\r\n     * stream. Currently, only WAV / PCM is supported.\r\n     * @returns {AudioConfig} The audio input configuration being created.\r\n     */\r\n    public static fromStreamInput(audioStream: AudioInputStream | PullAudioInputStreamCallback\r\n        | MediaStream): AudioConfig {\r\n        if (audioStream instanceof PullAudioInputStreamCallback) {\r\n            return new AudioConfigImpl(new PullAudioInputStreamImpl(audioStream));\r\n        }\r\n\r\n        if (audioStream instanceof AudioInputStream) {\r\n            return new AudioConfigImpl(audioStream as PushAudioInputStreamImpl);\r\n        }\r\n        if (typeof MediaStream !== \"undefined\" && audioStream instanceof MediaStream) {\r\n            const pcmRecorder = new PcmRecorder(false);\r\n            return new AudioConfigImpl(new MicAudioSource(pcmRecorder, null, null, audioStream));\r\n        }\r\n\r\n        throw new Error(\"Not Supported Type\");\r\n    }\r\n\r\n    /**\r\n     * Creates an AudioConfig object representing the default speaker.\r\n     * @member AudioConfig.fromDefaultSpeakerOutput\r\n     * @function\r\n     * @public\r\n     * @returns {AudioConfig} The audio output configuration being created.\r\n     * Added in version 1.11.0\r\n     */\r\n    public static fromDefaultSpeakerOutput(): AudioConfig {\r\n        return new AudioOutputConfigImpl(new SpeakerAudioDestination());\r\n    }\r\n\r\n    /**\r\n     * Creates an AudioConfig object representing the custom IPlayer object.\r\n     * You can use the IPlayer object to control pause, resume, etc.\r\n     * @member AudioConfig.fromSpeakerOutput\r\n     * @function\r\n     * @public\r\n     * @param {IPlayer} player - the IPlayer object for playback.\r\n     * @returns {AudioConfig} The audio output configuration being created.\r\n     * Added in version 1.12.0\r\n     */\r\n    public static fromSpeakerOutput(player?: IPlayer): AudioConfig {\r\n        if (player === undefined) {\r\n            return AudioConfig.fromDefaultSpeakerOutput();\r\n        }\r\n        if (player instanceof SpeakerAudioDestination) {\r\n            return new AudioOutputConfigImpl(player);\r\n        }\r\n\r\n        throw new Error(\"Not Supported Type\");\r\n    }\r\n\r\n    /**\r\n     * Creates an AudioConfig object representing a specified output audio file\r\n     * @member AudioConfig.fromAudioFileOutput\r\n     * @function\r\n     * @public\r\n     * @param {PathLike} filename - the filename of the output audio file\r\n     * @returns {AudioConfig} The audio output configuration being created.\r\n     * Added in version 1.11.0\r\n     */\r\n    public static fromAudioFileOutput(filename: PathLike): AudioConfig {\r\n        return new AudioOutputConfigImpl(new AudioFileWriter(filename));\r\n    }\r\n\r\n    /**\r\n     * Creates an AudioConfig object representing a specified audio output stream\r\n     * @member AudioConfig.fromStreamOutput\r\n     * @function\r\n     * @public\r\n     * @param {AudioOutputStream | PushAudioOutputStreamCallback} audioStream - Specifies the custom audio output\r\n     * stream.\r\n     * @returns {AudioConfig} The audio output configuration being created.\r\n     * Added in version 1.11.0\r\n     */\r\n    public static fromStreamOutput(audioStream: AudioOutputStream | PushAudioOutputStreamCallback): AudioConfig {\r\n        if (audioStream instanceof PushAudioOutputStreamCallback) {\r\n            return new AudioOutputConfigImpl(new PushAudioOutputStreamImpl(audioStream));\r\n        }\r\n\r\n        if (audioStream instanceof PushAudioOutputStream) {\r\n            return new AudioOutputConfigImpl(audioStream as PushAudioOutputStreamImpl);\r\n        }\r\n\r\n        if (audioStream instanceof PullAudioOutputStream) {\r\n            return new AudioOutputConfigImpl(audioStream as PullAudioOutputStreamImpl);\r\n        }\r\n\r\n        throw new Error(\"Not Supported Type\");\r\n    }\r\n\r\n    /**\r\n     * Explicitly frees any external resource attached to the object\r\n     * @member AudioConfig.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract close(): void;\r\n\r\n    /**\r\n     * Sets an arbitrary property.\r\n     * @member SpeechConfig.prototype.setProperty\r\n     * @function\r\n     * @public\r\n     * @param {string} name - The name of the property to set.\r\n     * @param {string} value - The new value of the property.\r\n     */\r\n    public abstract setProperty(name: string, value: string): void;\r\n\r\n    /**\r\n     * Returns the current value of an arbitrary property.\r\n     * @member SpeechConfig.prototype.getProperty\r\n     * @function\r\n     * @public\r\n     * @param {string} name - The name of the property to query.\r\n     * @param {string} def - The value to return in case the property is not known.\r\n     * @returns {string} The current value, or provided default, of the given property.\r\n     */\r\n    public abstract getProperty(name: string, def?: string): string;\r\n\r\n}\r\n\r\n/**\r\n * Represents audio input stream used for custom audio input configurations.\r\n * @private\r\n * @class AudioConfigImpl\r\n */\r\nexport class AudioConfigImpl extends AudioConfig implements IAudioSource {\r\n    private privSource: IAudioSource;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {IAudioSource} source - An audio source.\r\n     */\r\n    public constructor(source: IAudioSource) {\r\n        super();\r\n        this.privSource = source;\r\n    }\r\n\r\n    /**\r\n     * Format information for the audio\r\n     */\r\n    public get format(): Promise<AudioStreamFormatImpl> {\r\n        return this.privSource.format;\r\n    }\r\n\r\n    /**\r\n     * @member AudioConfigImpl.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(cb?: () => void, err?: (error: string) => void): void {\r\n        this.privSource.turnOff().then((): void => {\r\n            if (!!cb) {\r\n                cb();\r\n            }\r\n        }, (error: string): void => {\r\n            if (!!err) {\r\n                err(error);\r\n            }\r\n        });\r\n    }\r\n\r\n    /**\r\n     * @member AudioConfigImpl.prototype.id\r\n     * @function\r\n     * @public\r\n     */\r\n    public id(): string {\r\n        return this.privSource.id();\r\n    }\r\n\r\n    /**\r\n     * @member AudioConfigImpl.prototype.turnOn\r\n     * @function\r\n     * @public\r\n     * @returns {Promise<void>} A promise.\r\n     */\r\n    public turnOn(): Promise<void> {\r\n        return this.privSource.turnOn();\r\n    }\r\n\r\n    /**\r\n     * @member AudioConfigImpl.prototype.attach\r\n     * @function\r\n     * @public\r\n     * @param {string} audioNodeId - The audio node id.\r\n     * @returns {Promise<IAudioStreamNode>} A promise.\r\n     */\r\n    public attach(audioNodeId: string): Promise<IAudioStreamNode> {\r\n        return this.privSource.attach(audioNodeId);\r\n    }\r\n\r\n    /**\r\n     * @member AudioConfigImpl.prototype.detach\r\n     * @function\r\n     * @public\r\n     * @param {string} audioNodeId - The audio node id.\r\n     */\r\n    public detach(audioNodeId: string): void {\r\n        return this.privSource.detach(audioNodeId);\r\n    }\r\n\r\n    /**\r\n     * @member AudioConfigImpl.prototype.turnOff\r\n     * @function\r\n     * @public\r\n     * @returns {Promise<void>} A promise.\r\n     */\r\n    public turnOff(): Promise<void> {\r\n        return this.privSource.turnOff();\r\n    }\r\n\r\n    /**\r\n     * @member AudioConfigImpl.prototype.events\r\n     * @function\r\n     * @public\r\n     * @returns {EventSource<AudioSourceEvent>} An event source for audio events.\r\n     */\r\n    public get events(): EventSource<AudioSourceEvent> {\r\n        return this.privSource.events;\r\n    }\r\n\r\n    public setProperty(name: string, value: string): void {\r\n        Contracts.throwIfNull(value, \"value\");\r\n\r\n        if (undefined !== this.privSource.setProperty) {\r\n            this.privSource.setProperty(name, value);\r\n        } else {\r\n            throw new Error(\"This AudioConfig instance does not support setting properties.\");\r\n        }\r\n\r\n    }\r\n\r\n    public getProperty(name: string, def?: string): string {\r\n        if (undefined !== this.privSource.getProperty) {\r\n            return this.privSource.getProperty(name, def);\r\n        } else {\r\n            throw new Error(\"This AudioConfig instance does not support getting properties.\");\r\n        }\r\n\r\n        return def;\r\n    }\r\n\r\n    public get deviceInfo(): Promise<ISpeechConfigAudioDevice> {\r\n        return this.privSource.deviceInfo;\r\n    }\r\n}\r\n\r\nexport class AudioOutputConfigImpl extends AudioConfig implements IAudioDestination {\r\n    private privDestination: IAudioDestination;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {IAudioDestination} destination - An audio destination.\r\n     */\r\n    public constructor(destination: IAudioDestination) {\r\n        super();\r\n        this.privDestination = destination;\r\n    }\r\n\r\n    public set format(format: AudioStreamFormat) {\r\n        this.privDestination.format = format;\r\n    }\r\n\r\n    public write(buffer: ArrayBuffer): void {\r\n        this.privDestination.write(buffer);\r\n    }\r\n\r\n    public close(): void {\r\n        this.privDestination.close();\r\n    }\r\n\r\n    public id(): string {\r\n        return this.privDestination.id();\r\n    }\r\n\r\n    public setProperty(): void {\r\n        throw new Error(\"This AudioConfig instance does not support setting properties.\");\r\n    }\r\n\r\n    public getProperty(): string {\r\n        throw new Error(\"This AudioConfig instance does not support getting properties.\");\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines the possible reasons a recognition result might be canceled.\r\n * @class CancellationReason\r\n */\r\nexport enum CancellationReason {\r\n    /**\r\n     * Indicates that an error occurred during speech recognition.\r\n     * @member CancellationReason.Error\r\n     */\r\n    Error,\r\n\r\n    /**\r\n     * Indicates that the end of the audio stream was reached.\r\n     * @member CancellationReason.EndOfStream\r\n     */\r\n    EndOfStream,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n /**\r\n  * An abstract base class that defines callback methods (read() and close()) for\r\n  * custom audio input streams).\r\n  * @class PullAudioInputStreamCallback\r\n  */\r\nexport abstract class PullAudioInputStreamCallback {\r\n\r\n    /**\r\n     * Reads data from audio input stream into the data buffer. The maximal number of bytes\r\n     * to be read is determined by the size of dataBuffer.\r\n     * @member PullAudioInputStreamCallback.prototype.read\r\n     * @function\r\n     * @public\r\n     * @param {ArrayBuffer} dataBuffer - The byte array to store the read data.\r\n     * @returns {number} the number of bytes have been read.\r\n     */\r\n    public abstract read(dataBuffer: ArrayBuffer): number;\r\n\r\n    /**\r\n     * Closes the audio input stream.\r\n     * @member PullAudioInputStreamCallback.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract close(): void;\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n/**\r\n * An abstract base class that defines callback methods (write() and close()) for\r\n * custom audio output streams).\r\n * @class PushAudioOutputStreamCallback\r\n */\r\nexport abstract class PushAudioOutputStreamCallback {\r\n\r\n    /**\r\n     * Writes audio data into the data buffer.\r\n     * @member PushAudioOutputStreamCallback.prototype.write\r\n     * @function\r\n     * @public\r\n     * @param {ArrayBuffer} dataBuffer - The byte array that stores the audio data to write.\r\n     */\r\n    public abstract write(dataBuffer: ArrayBuffer): void;\r\n\r\n    /**\r\n     * Closes the audio output stream.\r\n     * @member PushAudioOutputStreamCallback.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract close(): void;\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Contracts } from \"./Contracts.js\";\r\n\r\n/**\r\n * Represents a keyword recognition model for recognizing when\r\n * the user says a keyword to initiate further speech recognition.\r\n * @class KeywordRecognitionModel\r\n */\r\nexport class KeywordRecognitionModel {\r\n    private privDisposed: boolean = false;\r\n\r\n    /**\r\n     * Create and initializes a new instance.\r\n     * @constructor\r\n     */\r\n    private constructor() {\r\n        return;\r\n    }\r\n\r\n    /**\r\n     * Creates a keyword recognition model using the specified filename.\r\n     * @member KeywordRecognitionModel.fromFile\r\n     * @function\r\n     * @public\r\n     * @param {string} fileName - A string that represents file name for the keyword recognition model.\r\n     * Note, the file can point to a zip file in which case the model\r\n     * will be extracted from the zip.\r\n     * @returns {KeywordRecognitionModel} The keyword recognition model being created.\r\n     */\r\n    public static fromFile(fileName: string): KeywordRecognitionModel {\r\n        Contracts.throwIfFileDoesNotExist(fileName, \"fileName\");\r\n\r\n        throw new Error(\"Not yet implemented.\");\r\n    }\r\n\r\n    /**\r\n     * Creates a keyword recognition model using the specified filename.\r\n     * @member KeywordRecognitionModel.fromStream\r\n     * @function\r\n     * @public\r\n     * @param {string} file - A File that represents file for the keyword recognition model.\r\n     * Note, the file can point to a zip file in which case the model will be extracted from the zip.\r\n     * @returns {KeywordRecognitionModel} The keyword recognition model being created.\r\n     */\r\n    public static fromStream(file: File): KeywordRecognitionModel {\r\n        Contracts.throwIfNull(file, \"file\");\r\n\r\n        throw new Error(\"Not yet implemented.\");\r\n    }\r\n\r\n    /**\r\n     * Dispose of associated resources.\r\n     * @member KeywordRecognitionModel.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(): void {\r\n        if (this.privDisposed) {\r\n            return;\r\n        }\r\n\r\n        this.privDisposed = true;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines content for session events like SessionStarted/Stopped, SoundStarted/Stopped.\r\n * @class SessionEventArgs\r\n */\r\nexport class SessionEventArgs {\r\n    private privSessionId: string;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {string} sessionId - The session id.\r\n     */\r\n    public constructor(sessionId: string) {\r\n        this.privSessionId = sessionId;\r\n    }\r\n\r\n    /**\r\n     * Represents the session identifier.\r\n     * @member SessionEventArgs.prototype.sessionId\r\n     * @function\r\n     * @public\r\n     * @returns {string} Represents the session identifier.\r\n     */\r\n    public get sessionId(): string {\r\n        return this.privSessionId;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { SessionEventArgs } from \"./Exports.js\";\r\n\r\n/**\r\n * Defines payload for session events like Speech Start/End Detected\r\n * @class\r\n */\r\nexport class RecognitionEventArgs extends SessionEventArgs {\r\n    private privOffset: number;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {number} offset - The offset.\r\n     * @param {string} sessionId - The session id.\r\n     */\r\n    public constructor(offset: number, sessionId?: string) {\r\n        super(sessionId);\r\n\r\n        this.privOffset = offset;\r\n    }\r\n\r\n    /**\r\n     * Represents the message offset\r\n     * @member RecognitionEventArgs.prototype.offset\r\n     * @function\r\n     * @public\r\n     */\r\n    public get offset(): number {\r\n        return this.privOffset;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Define Speech Recognizer output formats.\r\n * @class OutputFormat\r\n */\r\nexport enum OutputFormat {\r\n    /**\r\n     * @member OutputFormat.Simple\r\n     */\r\n    Simple = 0,\r\n\r\n    /**\r\n     * @member OutputFormat.Detailed\r\n     */\r\n    Detailed,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyCollection, ResultReason } from \"./Exports.js\";\r\n\r\n/**\r\n * Defines result of speech recognition.\r\n * @class RecognitionResult\r\n */\r\nexport class RecognitionResult {\r\n    private privResultId: string;\r\n    private privReason: ResultReason;\r\n    private privText: string;\r\n    private privDuration: number;\r\n    private privOffset: number;\r\n    private privLanguage: string;\r\n    private privLanguageDetectionConfidence: string;\r\n    private privErrorDetails: string;\r\n    private privJson: string;\r\n    private privProperties: PropertyCollection;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {string} resultId - The result id.\r\n     * @param {ResultReason} reason - The reason.\r\n     * @param {string} text - The recognized text.\r\n     * @param {number} duration - The duration.\r\n     * @param {number} offset - The offset into the stream.\r\n     * @param {string} language - Primary Language detected, if provided.\r\n     * @param {string} languageDetectionConfidence - Primary Language confidence (\"Unknown,\" \"Low,\" \"Medium,\" \"High\"...), if provided.\r\n     * @param {string} errorDetails - Error details, if provided.\r\n     * @param {string} json - Additional Json, if provided.\r\n     * @param {PropertyCollection} properties - Additional properties, if provided.\r\n     */\r\n    public constructor(resultId?: string, reason?: ResultReason, text?: string, duration?: number,\r\n                offset?: number, language?: string, languageDetectionConfidence?: string, errorDetails?: string, json?: string, properties?: PropertyCollection) {\r\n        this.privResultId = resultId;\r\n        this.privReason = reason;\r\n        this.privText = text;\r\n        this.privDuration = duration;\r\n        this.privOffset = offset;\r\n        this.privLanguage = language;\r\n        this.privLanguageDetectionConfidence = languageDetectionConfidence;\r\n        this.privErrorDetails = errorDetails;\r\n        this.privJson = json;\r\n        this.privProperties = properties;\r\n    }\r\n\r\n    /**\r\n     * Specifies the result identifier.\r\n     * @member RecognitionResult.prototype.resultId\r\n     * @function\r\n     * @public\r\n     * @returns {string} Specifies the result identifier.\r\n     */\r\n    public get resultId(): string {\r\n        return this.privResultId;\r\n    }\r\n\r\n    /**\r\n     * Specifies status of the result.\r\n     * @member RecognitionResult.prototype.reason\r\n     * @function\r\n     * @public\r\n     * @returns {ResultReason} Specifies status of the result.\r\n     */\r\n    public get reason(): ResultReason {\r\n        return this.privReason;\r\n    }\r\n\r\n    /**\r\n     * Presents the recognized text in the result.\r\n     * @member RecognitionResult.prototype.text\r\n     * @function\r\n     * @public\r\n     * @returns {string} Presents the recognized text in the result.\r\n     */\r\n    public get text(): string {\r\n        return this.privText;\r\n    }\r\n\r\n    /**\r\n     * Duration of recognized speech in 100 nano second increments.\r\n     * @member RecognitionResult.prototype.duration\r\n     * @function\r\n     * @public\r\n     * @returns {number} Duration of recognized speech in 100 nano second increments.\r\n     */\r\n    public get duration(): number {\r\n        return this.privDuration;\r\n    }\r\n\r\n    /**\r\n     * Offset of recognized speech in 100 nano second increments.\r\n     * @member RecognitionResult.prototype.offset\r\n     * @function\r\n     * @public\r\n     * @returns {number} Offset of recognized speech in 100 nano second increments.\r\n     */\r\n    public get offset(): number {\r\n        return this.privOffset;\r\n    }\r\n\r\n    /**\r\n     * Primary Language detected.\r\n     * @member RecognitionResult.prototype.language\r\n     * @function\r\n     * @public\r\n     * @returns {string} language detected.\r\n     */\r\n    public get language(): string {\r\n        return this.privLanguage;\r\n    }\r\n\r\n    /**\r\n     * Primary Language detection confidence (Unknown, Low, Medium, High).\r\n     * @member RecognitionResult.prototype.languageDetectionConfidence\r\n     * @function\r\n     * @public\r\n     * @returns {string} detection confidence strength.\r\n     */\r\n    public get languageDetectionConfidence(): string {\r\n        return this.privLanguageDetectionConfidence;\r\n    }\r\n\r\n    /**\r\n     * In case of an unsuccessful recognition, provides details of the occurred error.\r\n     * @member RecognitionResult.prototype.errorDetails\r\n     * @function\r\n     * @public\r\n     * @returns {string} a brief description of an error.\r\n     */\r\n    public get errorDetails(): string {\r\n        return this.privErrorDetails;\r\n    }\r\n\r\n    /**\r\n     * A string containing Json serialized recognition result as it was received from the service.\r\n     * @member RecognitionResult.prototype.json\r\n     * @function\r\n     * @private\r\n     * @returns {string} Json serialized representation of the result.\r\n     */\r\n    public get json(): string {\r\n        return this.privJson;\r\n    }\r\n\r\n    /**\r\n     * The set of properties exposed in the result.\r\n     * @member RecognitionResult.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} The set of properties exposed in the result.\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyCollection, RecognitionResult, ResultReason } from \"./Exports.js\";\r\n\r\n/**\r\n * Defines result of speech recognition.\r\n * @class SpeechRecognitionResult\r\n */\r\nexport class SpeechRecognitionResult extends RecognitionResult {\r\n    private readonly privSpeakerId: string;\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @public\r\n     * @param {string} resultId - The result id.\r\n     * @param {ResultReason} reason - The reason.\r\n     * @param {string} text - The recognized text.\r\n     * @param {number} duration - The duration.\r\n     * @param {number} offset - The offset into the stream.\r\n     * @param {string} language - Primary Language detected, if provided.\r\n     * @param {string} languageDetectionConfidence - Primary Language confidence (\"Unknown,\" \"Low,\" \"Medium,\" \"High\"...), if provided.\r\n     * @param {string} speakerId - speaker id for conversation transcription, if provided.\r\n     * @param {string} errorDetails - Error details, if provided.\r\n     * @param {string} json - Additional Json, if provided.\r\n     * @param {PropertyCollection} properties - Additional properties, if provided.\r\n     */\r\n    public constructor(resultId?: string, reason?: ResultReason, text?: string,\r\n                       duration?: number, offset?: number, language?: string,\r\n                       languageDetectionConfidence?: string, speakerId?: string, errorDetails?: string,\r\n                       json?: string, properties?: PropertyCollection) {\r\n        super(resultId, reason, text, duration, offset, language, languageDetectionConfidence, errorDetails, json, properties);\r\n        this.privSpeakerId = speakerId;\r\n    }\r\n\r\n    /**\r\n     * speaker id from conversation transcription/id scenarios\r\n     * @member SpeechRecognitionResult.prototype.speakerId\r\n     * @function\r\n     * @public\r\n     * @returns {string} id of speaker in given result\r\n     */\r\n    public get speakerId(): string {\r\n        return this.privSpeakerId;\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\nimport { RecognitionEventArgs, SpeechRecognitionResult, ConversationTranscriptionResult } from \"./Exports.js\";\r\n\r\n/**\r\n * Defines contents of speech recognizing/recognized event.\r\n * @class SpeechRecognitionEventArgs\r\n */\r\nexport class SpeechRecognitionEventArgs extends RecognitionEventArgs {\r\n    private privResult: SpeechRecognitionResult;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {SpeechRecognitionResult} result - The speech recognition result.\r\n     * @param {number} offset - The offset.\r\n     * @param {string} sessionId - The session id.\r\n     */\r\n    public constructor(result: SpeechRecognitionResult, offset?: number, sessionId?: string) {\r\n        super(offset, sessionId);\r\n\r\n        this.privResult = result;\r\n    }\r\n\r\n    /**\r\n     * Specifies the recognition result.\r\n     * @member SpeechRecognitionEventArgs.prototype.result\r\n     * @function\r\n     * @public\r\n     * @returns {SpeechRecognitionResult} the recognition result.\r\n     */\r\n    public get result(): SpeechRecognitionResult {\r\n        return this.privResult;\r\n    }\r\n}\r\n\r\n/**\r\n * Defines contents of conversation transcribed/transcribing event.\r\n * @class ConversationTranscriptionEventArgs\r\n */\r\nexport class ConversationTranscriptionEventArgs extends RecognitionEventArgs {\r\n    private privResult: ConversationTranscriptionResult;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {ConversationTranscriptionResult} result - The conversation transcription result.\r\n     * @param {number} offset - The offset.\r\n     * @param {string} sessionId - The session id.\r\n     */\r\n    public constructor(result: ConversationTranscriptionResult, offset?: number, sessionId?: string) {\r\n        super(offset, sessionId);\r\n\r\n        this.privResult = result;\r\n    }\r\n\r\n    /**\r\n     * Specifies the transcription result.\r\n     * @member ConversationTranscription1EventArgs.prototype.result\r\n     * @function\r\n     * @public\r\n     * @returns {ConversationTranscriptionResult} the recognition result.\r\n     */\r\n        public get result(): ConversationTranscriptionResult {\r\n            return this.privResult;\r\n        }\r\n}\r\n\r\n/**\r\n * Defines contents of meeting transcribed/transcribing event.\r\n * @class MeetingTranscriptionEventArgs\r\n */\r\nexport class MeetingTranscriptionEventArgs extends SpeechRecognitionEventArgs {\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationEventArgs,\r\n    CancellationReason,\r\n    RecognitionEventArgs\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Defines content of a CancellationEvent.\r\n * @class CancellationEventArgsBase\r\n */\r\nexport class CancellationEventArgsBase extends RecognitionEventArgs implements CancellationEventArgs {\r\n    private privReason: CancellationReason;\r\n    private privErrorDetails: string;\r\n    private privErrorCode: CancellationErrorCode;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {CancellationReason} reason - The cancellation reason.\r\n     * @param {string} errorDetails - Error details, if provided.\r\n     * @param {number} offset - The offset.\r\n     * @param {string} sessionId - The session id.\r\n     */\r\n    public constructor(reason: CancellationReason, errorDetails: string,\r\n                       errorCode: CancellationErrorCode, offset?: number, sessionId?: string) {\r\n        super(offset, sessionId);\r\n\r\n        this.privReason = reason;\r\n        this.privErrorDetails = errorDetails;\r\n        this.privErrorCode = errorCode;\r\n    }\r\n\r\n    /**\r\n     * The reason the recognition was canceled.\r\n     * @member CancellationEventArgsBase.prototype.reason\r\n     * @function\r\n     * @public\r\n     * @returns {CancellationReason} Specifies the reason canceled.\r\n     */\r\n    public get reason(): CancellationReason {\r\n        return this.privReason;\r\n    }\r\n\r\n    /**\r\n     * The error code in case of an unsuccessful operation.\r\n     * @return An error code that represents the error reason.\r\n     */\r\n    public get errorCode(): CancellationErrorCode {\r\n        return this.privErrorCode;\r\n    }\r\n\r\n    /**\r\n     * In case of an unsuccessful operation, provides details of the occurred error.\r\n     * @member CancellationEventArgsBase.prototype.errorDetails\r\n     * @function\r\n     * @public\r\n     * @returns {string} A String that represents the error details.\r\n     */\r\n    public get errorDetails(): string {\r\n        return this.privErrorDetails;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    CancellationEventArgsBase,\r\n} from \"./CancellationEventArgsBase.js\";\r\n\r\nexport class SpeechRecognitionCanceledEventArgs extends CancellationEventArgsBase {\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { RecognitionEventArgs, TranslationRecognitionResult } from \"./Exports.js\";\r\n\r\n/**\r\n * Translation text result event arguments.\r\n * @class TranslationRecognitionEventArgs\r\n */\r\nexport class TranslationRecognitionEventArgs extends RecognitionEventArgs {\r\n    private privResult: TranslationRecognitionResult;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {TranslationRecognitionResult} result - The translation recognition result.\r\n     * @param {number} offset - The offset.\r\n     * @param {string} sessionId - The session id.\r\n     */\r\n    public constructor(result: TranslationRecognitionResult, offset?: number, sessionId?: string) {\r\n        super(offset, sessionId);\r\n\r\n        this.privResult = result;\r\n    }\r\n\r\n    /**\r\n     * Specifies the recognition result.\r\n     * @member TranslationRecognitionEventArgs.prototype.result\r\n     * @function\r\n     * @public\r\n     * @returns {TranslationRecognitionResult} the recognition result.\r\n     */\r\n    public get result(): TranslationRecognitionResult {\r\n        return this.privResult;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { SessionEventArgs, TranslationSynthesisResult } from \"./Exports.js\";\r\n\r\n/**\r\n * Translation Synthesis event arguments\r\n * @class TranslationSynthesisEventArgs\r\n */\r\nexport class TranslationSynthesisEventArgs extends SessionEventArgs {\r\n    private privResult: TranslationSynthesisResult;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {TranslationSynthesisResult} result - The translation synthesis result.\r\n     * @param {string} sessionId - The session id.\r\n     */\r\n    public constructor(result: TranslationSynthesisResult, sessionId?: string) {\r\n        super(sessionId);\r\n\r\n        this.privResult = result;\r\n    }\r\n\r\n    /**\r\n     * Specifies the translation synthesis result.\r\n     * @member TranslationSynthesisEventArgs.prototype.result\r\n     * @function\r\n     * @public\r\n     * @returns {TranslationSynthesisResult} Specifies the translation synthesis result.\r\n     */\r\n    public get result(): TranslationSynthesisResult {\r\n        return this.privResult;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyCollection, ResultReason, SpeechRecognitionResult, Translations } from \"./Exports.js\";\r\n\r\n/**\r\n * Translation text result.\r\n * @class TranslationRecognitionResult\r\n */\r\nexport class TranslationRecognitionResult extends SpeechRecognitionResult {\r\n    private privTranslations: Translations;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {Translations} translations - The translations.\r\n     * @param {string} resultId - The result id.\r\n     * @param {ResultReason} reason - The reason.\r\n     * @param {string} text - The recognized text.\r\n     * @param {number} duration - The duration.\r\n     * @param {number} offset - The offset into the stream.\r\n     * @param {string} language - Primary Language detected, if provided.\r\n     * @param {string} languageDetectionConfidence - Primary Language confidence (\"Unknown,\" \"Low,\" \"Medium,\" \"High\"...), if provided.\r\n     * @param {string} errorDetails - Error details, if provided.\r\n     * @param {string} json - Additional Json, if provided.\r\n     * @param {PropertyCollection} properties - Additional properties, if provided.\r\n     */\r\n    public constructor(translations: Translations, resultId?: string, reason?: ResultReason,\r\n                       text?: string, duration?: number, offset?: number, language?: string,\r\n                       languageDetectionConfidence?: string, errorDetails?: string,\r\n                       json?: string, properties?: PropertyCollection) {\r\n        super(resultId, reason, text, duration, offset, language, languageDetectionConfidence, undefined, errorDetails, json, properties);\r\n\r\n        this.privTranslations = translations;\r\n    }\r\n\r\n    public static fromSpeechRecognitionResult(result: SpeechRecognitionResult): TranslationRecognitionResult {\r\n        return new TranslationRecognitionResult(undefined, result.resultId, result.reason, result.text, result.duration, result.offset, result.language, result.languageDetectionConfidence, result.errorDetails, result.json, result.properties);\r\n    }\r\n\r\n    /**\r\n     * Presents the translation results. Each item in the dictionary represents\r\n     * a translation result in one of target languages, where the key is the name\r\n     * of the target language, in BCP-47 format, and the value is the translation\r\n     * text in the specified language.\r\n     * @member TranslationRecognitionResult.prototype.translations\r\n     * @function\r\n     * @public\r\n     * @returns {Translations} the current translation map that holds all translations requested.\r\n     */\r\n    public get translations(): Translations {\r\n        return this.privTranslations;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ResultReason } from \"./ResultReason.js\";\r\n\r\n/**\r\n * Defines translation synthesis result, i.e. the voice output of the translated\r\n * text in the target language.\r\n * @class TranslationSynthesisResult\r\n */\r\nexport class TranslationSynthesisResult {\r\n    private privReason: ResultReason;\r\n    private privAudio: ArrayBuffer;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {ResultReason} reason - The synthesis reason.\r\n     * @param {ArrayBuffer} audio - The audio data.\r\n     */\r\n    public constructor(reason: ResultReason, audio: ArrayBuffer) {\r\n        this.privReason = reason;\r\n        this.privAudio = audio;\r\n    }\r\n\r\n    /**\r\n     * Translated text in the target language.\r\n     * @member TranslationSynthesisResult.prototype.audio\r\n     * @function\r\n     * @public\r\n     * @returns {ArrayBuffer} Translated audio in the target language.\r\n     */\r\n    public get audio(): ArrayBuffer {\r\n        return this.privAudio;\r\n    }\r\n\r\n    /**\r\n     * The synthesis status.\r\n     * @member TranslationSynthesisResult.prototype.reason\r\n     * @function\r\n     * @public\r\n     * @returns {ResultReason} The synthesis status.\r\n     */\r\n    public get reason(): ResultReason {\r\n        return this.privReason;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines the possible reasons a recognition result might be generated.\r\n * @class ResultReason\r\n */\r\nexport enum ResultReason {\r\n    /**\r\n     * Indicates speech could not be recognized. More details\r\n     * can be found in the NoMatchDetails object.\r\n     * @member ResultReason.NoMatch\r\n     */\r\n    NoMatch,\r\n\r\n    /**\r\n     * Indicates that the recognition was canceled. More details\r\n     * can be found using the CancellationDetails object.\r\n     * @member ResultReason.Canceled\r\n     */\r\n    Canceled,\r\n\r\n    /**\r\n     * Indicates the speech result contains hypothesis text.\r\n     * @member ResultReason.RecognizedSpeech\r\n     */\r\n    RecognizingSpeech,\r\n\r\n    /**\r\n     * Indicates the speech result contains final text that has been recognized.\r\n     * Speech Recognition is now complete for this phrase.\r\n     * @member ResultReason.RecognizedSpeech\r\n     */\r\n    RecognizedSpeech,\r\n\r\n    /**\r\n     * Indicates the speech result contains a finalized acceptance of a provided keyword.\r\n     * Speech recognition will continue unless otherwise configured.\r\n     * @member ResultReason.RecognizedKeyword\r\n     */\r\n    RecognizedKeyword,\r\n\r\n    /**\r\n     * Indicates the translation result contains hypothesis text and its translation(s).\r\n     * @member ResultReason.TranslatingSpeech\r\n     */\r\n    TranslatingSpeech,\r\n\r\n    /**\r\n     * Indicates the translation result contains final text and corresponding translation(s).\r\n     * Speech Recognition and Translation are now complete for this phrase.\r\n     * @member ResultReason.TranslatedSpeech\r\n     */\r\n    TranslatedSpeech,\r\n\r\n    /**\r\n     * Indicates the synthesized audio result contains a non-zero amount of audio data\r\n     * @member ResultReason.SynthesizingAudio\r\n     */\r\n    SynthesizingAudio,\r\n\r\n    /**\r\n     * Indicates the synthesized audio is now complete for this phrase.\r\n     * @member ResultReason.SynthesizingAudioCompleted\r\n     */\r\n    SynthesizingAudioCompleted,\r\n\r\n    /**\r\n     * Indicates the speech synthesis is now started\r\n     * @member ResultReason.SynthesizingAudioStarted\r\n     */\r\n    SynthesizingAudioStarted,\r\n\r\n    /**\r\n     * Indicates synthesis voices list has been successfully retrieved.\r\n     * @member ResultReason.VoicesListRetrieved\r\n     */\r\n    VoicesListRetrieved,\r\n\r\n    /**\r\n     * Indicates the transcription result contains hypothesis text and its translation(s) for\r\n     * other participants in the conversation.\r\n     * @member ResultReason.TranslatingParticipantSpeech\r\n     */\r\n    TranslatingParticipantSpeech,\r\n\r\n    /**\r\n     * Indicates the transcription result contains final text and corresponding translation(s)\r\n     * for other participants in the conversation. Speech Recognition and Translation are now\r\n     * complete for this phrase.\r\n     * @member ResultReason.TranslatedParticipantSpeech\r\n     */\r\n    TranslatedParticipantSpeech,\r\n\r\n    /**\r\n     * <summary>\r\n     * Indicates the transcription result contains the instant message and corresponding\r\n     * translation(s).\r\n     * @member ResultReason.TranslatedInstantMessage\r\n     */\r\n    TranslatedInstantMessage,\r\n\r\n    /**\r\n     * Indicates the transcription result contains the instant message for other participants\r\n     * in the conversation and corresponding translation(s).\r\n     * @member ResultReason.TranslatedParticipantInstantMessage\r\n     */\r\n    TranslatedParticipantInstantMessage,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport { KeyCredential, TokenCredential } from \"@azure/core-auth\";\r\nimport {\r\n    ForceDictationPropertyName,\r\n    OutputFormatPropertyName,\r\n    ServicePropertiesPropertyName\r\n} from \"../common.speech/Exports.js\";\r\nimport { IStringDictionary } from \"../common/Exports.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport {\r\n    OutputFormat,\r\n    ProfanityOption,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    ServicePropertyChannel,\r\n    SpeechSynthesisOutputFormat,\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Speech configuration.\r\n * @class SpeechConfig\r\n */\r\nexport abstract class SpeechConfig {\r\n    /**\r\n     * Creates and initializes an instance.\r\n     * @constructor\r\n     */\r\n    protected constructor() {\r\n        return;\r\n    }\r\n\r\n    /**\r\n     * Gets the TokenCredential instance if configured.\r\n     * Only available if using AAD-based authentication via TokenCredential.\r\n     * @returns {TokenCredential | undefined}\r\n     */\r\n    public abstract get tokenCredential(): TokenCredential | undefined;\r\n\r\n    /**\r\n     * Static instance of SpeechConfig returned by passing subscriptionKey and service region.\r\n     * @member SpeechConfig.fromSubscription\r\n     * @function\r\n     * @public\r\n     * @param {string} subscriptionKey - The subscription key.\r\n     * @param {string} region - The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\r\n     * @returns {SpeechConfig} The speech factory\r\n     */\r\n    public static fromSubscription(subscriptionKey: string, region: string): SpeechConfig {\r\n        Contracts.throwIfNullOrWhitespace(subscriptionKey, \"subscriptionKey\");\r\n        Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n        const speechImpl: SpeechConfigImpl = new SpeechConfigImpl();\r\n        speechImpl.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n        speechImpl.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\r\n\r\n        return speechImpl;\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of the speech config with specified endpoint and subscription key.\r\n     * This method is intended only for users who use a non-standard service endpoint or parameters.\r\n     * Note: The query parameters specified in the endpoint URL are not changed, even if they are set by any other APIs.\r\n     * For example, if language is defined in the uri as query parameter \"language=de-DE\", and also set by\r\n     * SpeechConfig.speechRecognitionLanguage = \"en-US\", the language setting in uri takes precedence,\r\n     * and the effective language is \"de-DE\". Only the parameters that are not specified in the\r\n     * endpoint URL can be set by other APIs.\r\n     * Note: To use authorization token with fromEndpoint, pass an empty string to the subscriptionKey in the\r\n     * fromEndpoint method, and then set authorizationToken=\"token\" on the created SpeechConfig instance to\r\n     * use the authorization token.\r\n     * @member SpeechConfig.fromEndpoint\r\n     * @function\r\n     * @public\r\n     * @param {URL} endpoint - The service endpoint to connect to.\r\n     * @param {string} subscriptionKey - The subscription key. If a subscription key is not specified, an authorization token must be set.\r\n     * @returns {SpeechConfig} A speech factory instance.\r\n     */\r\n    public static fromEndpoint(endpoint: URL, subscriptionKey?: string): SpeechConfig;\r\n\r\n    /**\r\n     * Creates an instance of SpeechConfig with a custom endpoint and a credential.\r\n     * The query parameters specified in the endpoint URI are not changed, even if they are set by any other API call.\r\n     * For example, if the recognition language is defined in the URI query parameter as \"language=de-DE\", and the property SpeechRecognitionLanguage is set to \"en-US\",\r\n     * the language set in the URI takes precedence, and \"de-DE\" remains the expected language.\r\n     * Since parameters included in the endpoint URI take priority, only parameters that are not specified in the endpoint URI can be set by other APIs.\r\n     * Supported credential types:\r\n     * - KeyCredential: For API key-based authentication.\r\n     * - TokenCredential: For Azure AD-based authentication.\r\n     * Note: To use authorization token with fromEndpoint, pass an empty string to the subscriptionKey in the\r\n     * fromEndpoint method, and then set authorizationToken=\"token\" on the created SpeechConfig instance to use the authorization token.\r\n     * @member SpeechConfig.fromEndpoint\r\n     * @function\r\n     * @public\r\n     * @param {URL} endpoint - The service endpoint to connect to.\r\n     * @param {KeyCredential | TokenCredential} credential - The credential used for authentication.\r\n     * @returns {SpeechConfig} A speech factory instance.\r\n     */\r\n    public static fromEndpoint(endpoint: URL, credential: KeyCredential | TokenCredential): SpeechConfig;\r\n\r\n    /**\r\n     * Internal implementation of fromEndpoint() overloads. Accepts either a subscription key or a TokenCredential.\r\n     * @private\r\n     */\r\n    public static fromEndpoint(endpoint: URL, auth: string | TokenCredential | KeyCredential): SpeechConfig {\r\n        Contracts.throwIfNull(endpoint, \"endpoint\");\r\n        const isValidString = typeof auth === \"string\" && auth.trim().length > 0;\r\n        const isTokenCredential = typeof auth === \"object\" && auth !== null && typeof (auth as TokenCredential).getToken === \"function\";\r\n        const isKeyCredential = typeof auth === \"object\" && auth !== null && typeof (auth as KeyCredential).key === \"string\";\r\n        if (auth !== undefined && !isValidString && !isTokenCredential && !isKeyCredential) {\r\n            throw new Error(\"Invalid 'auth' parameter: expected a non-empty API key string, a TokenCredential, or a KeyCredential.\");\r\n        }\r\n\r\n        let speechImpl: SpeechConfigImpl;\r\n        if (typeof auth === \"string\") {\r\n            speechImpl = new SpeechConfigImpl();\r\n            speechImpl.setProperty(PropertyId.SpeechServiceConnection_Key, auth);\r\n        } else if (typeof auth === \"object\" && typeof (auth as TokenCredential).getToken === \"function\") {\r\n            speechImpl = new SpeechConfigImpl(auth as TokenCredential);\r\n        } else if (typeof auth === \"object\" && typeof (auth as KeyCredential).key === \"string\") {\r\n            speechImpl = new SpeechConfigImpl();\r\n            speechImpl.setProperty(PropertyId.SpeechServiceConnection_Key, (auth as KeyCredential).key);\r\n        } else {\r\n            speechImpl = new SpeechConfigImpl();\r\n        }\r\n\r\n        speechImpl.setProperty(PropertyId.SpeechServiceConnection_Endpoint, endpoint.href);\r\n\r\n        return speechImpl;\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of the speech config with specified host and subscription key.\r\n     * This method is intended only for users who use a non-default service host. Standard resource path will be assumed.\r\n     * For services with a non-standard resource path or no path at all, use fromEndpoint instead.\r\n     * Note: Query parameters are not allowed in the host URI and must be set by other APIs.\r\n     * Note: To use an authorization token with fromHost, use fromHost(URL),\r\n     * and then set the AuthorizationToken property on the created SpeechConfig instance.\r\n     * Note: Added in version 1.9.0.\r\n     * @member SpeechConfig.fromHost\r\n     * @function\r\n     * @public\r\n     * @param {URL} host - The service endpoint to connect to. Format is \"protocol://host:port\" where \":port\" is optional.\r\n     * @param {string} subscriptionKey - The subscription key. If a subscription key is not specified, an authorization token must be set.\r\n     * @returns {SpeechConfig} A speech factory instance.\r\n     */\r\n    public static fromHost(hostName: URL, subscriptionKey?: string): SpeechConfig {\r\n        Contracts.throwIfNull(hostName, \"hostName\");\r\n\r\n        const speechImpl: SpeechConfigImpl = new SpeechConfigImpl();\r\n        speechImpl.setProperty(PropertyId.SpeechServiceConnection_Host, hostName.protocol + \"//\" + hostName.hostname + (hostName.port === \"\" ? \"\" : \":\" + hostName.port));\r\n\r\n        // Containers do not yet have /stt/speech/universal/v2 routes.\r\n        speechImpl.setProperty(PropertyId.SpeechServiceConnection_RecognitionEndpointVersion, \"1\");\r\n\r\n        if (undefined !== subscriptionKey) {\r\n            speechImpl.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\r\n        }\r\n        return speechImpl;\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of the speech factory with specified initial authorization token and region.\r\n     * Note: The caller needs to ensure that the authorization token is valid. Before the authorization token\r\n     * expires, the caller needs to refresh it by calling this setter with a new valid token.\r\n     * Note: As configuration values are copied when creating a new recognizer,\r\n     * the new token value will not apply to recognizers that have already been created. For recognizers\r\n     * that have been created before, you need to set authorization token of the corresponding recognizer\r\n     * to refresh the token. Otherwise, the recognizers will encounter errors during recognition.\r\n     * @member SpeechConfig.fromAuthorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} authorizationToken - The initial authorization token.\r\n     * @param {string} region - The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\r\n     * @returns {SpeechConfig} A speech factory instance.\r\n     */\r\n    public static fromAuthorizationToken(authorizationToken: string, region: string): SpeechConfig {\r\n        Contracts.throwIfNull(authorizationToken, \"authorizationToken\");\r\n        Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n        const speechImpl: SpeechConfigImpl = new SpeechConfigImpl();\r\n        speechImpl.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n        speechImpl.authorizationToken = authorizationToken;\r\n        return speechImpl;\r\n    }\r\n\r\n    /**\r\n     * Sets the proxy configuration.\r\n     * Only relevant in Node.js environments.\r\n     * Added in version 1.4.0.\r\n     * @param proxyHostName The host name of the proxy server.\r\n     * @param proxyPort The port number of the proxy server.\r\n     */\r\n    public abstract setProxy(proxyHostName: string, proxyPort: number): void;\r\n\r\n    /**\r\n     * Sets the proxy configuration.\r\n     * Only relevant in Node.js environments.\r\n     * Added in version 1.4.0.\r\n     * @param proxyHostName The host name of the proxy server, without the protocol scheme (http://)\r\n     * @param proxyPort The port number of the proxy server.\r\n     * @param proxyUserName The username of the proxy server.\r\n     * @param proxyPassword The password of the proxy server.\r\n     */\r\n    public abstract setProxy(proxyHostName: string, proxyPort: number, proxyUserName: string, proxyPassword: string): void;\r\n\r\n    /**\r\n     * Gets the authorization token.\r\n     * @member SpeechConfig.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract get authorizationToken(): string;\r\n\r\n    /**\r\n     * Gets/Sets the authorization token.\r\n     * Note: The caller needs to ensure that the authorization token is valid. Before the authorization token\r\n     * expires, the caller needs to refresh it by calling this setter with a new valid token.\r\n     * @member SpeechConfig.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The authorization token.\r\n     */\r\n    public abstract set authorizationToken(value: string);\r\n\r\n    /**\r\n     * Returns the configured language.\r\n     * @member SpeechConfig.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract get speechRecognitionLanguage(): string;\r\n\r\n    /**\r\n     * Gets/Sets the input language.\r\n     * @member SpeechConfig.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The authorization token.\r\n     */\r\n    public abstract set speechRecognitionLanguage(value: string);\r\n\r\n    /**\r\n     * Sets an arbitrary property.\r\n     * @member SpeechConfig.prototype.setProperty\r\n     * @function\r\n     * @public\r\n     * @param {string | PropertyId} name - The name of the property to set.\r\n     * @param {string} value - The new value of the property.\r\n     */\r\n    public abstract setProperty(name: string | PropertyId, value: string): void;\r\n\r\n    /**\r\n     * Returns the current value of an arbitrary property.\r\n     * @member SpeechConfig.prototype.getProperty\r\n     * @function\r\n     * @public\r\n     * @param {string} name - The name of the property to query.\r\n     * @param {string} def - The value to return in case the property is not known.\r\n     * @returns {string} The current value, or provided default, of the given property.\r\n     */\r\n    public abstract getProperty(name: string, def?: string): string;\r\n\r\n    /**\r\n     * Gets speech recognition output format (simple or detailed).\r\n     * Note: This output format is for speech recognition result, use [SpeechConfig.speechSynthesisOutputFormat] to\r\n     * get synthesized audio output format.\r\n     * @member SpeechConfig.prototype.outputFormat\r\n     * @function\r\n     * @public\r\n     * @returns {OutputFormat} Returns the output format.\r\n     */\r\n    public abstract get outputFormat(): OutputFormat;\r\n\r\n    /**\r\n     * Gets/Sets speech recognition output format (simple or detailed).\r\n     * Note: This output format is for speech recognition result, use [SpeechConfig.speechSynthesisOutputFormat] to\r\n     * set synthesized audio output format.\r\n     * @member SpeechConfig.prototype.outputFormat\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract set outputFormat(format: OutputFormat);\r\n\r\n    /**\r\n     * Gets the endpoint ID of a customized speech model that is used for speech recognition.\r\n     * @member SpeechConfig.prototype.endpointId\r\n     * @function\r\n     * @public\r\n     * @return {string} The endpoint ID\r\n     */\r\n    public abstract get endpointId(): string;\r\n\r\n    /**\r\n     * Gets/Sets the endpoint ID of a customized speech model that is used for speech recognition.\r\n     * @member SpeechConfig.prototype.endpointId\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The endpoint ID\r\n     */\r\n    public abstract set endpointId(value: string);\r\n\r\n    /**\r\n     * Closes the configuration.\r\n     * @member SpeechConfig.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n    public close(): void { }\r\n\r\n    /**\r\n     * @member SpeechConfig.prototype.subscriptionKey\r\n     * @function\r\n     * @public\r\n     * @return {string} The subscription key set on the config.\r\n     */\r\n    public abstract get subscriptionKey(): string;\r\n\r\n    /**\r\n     * @member SpeechConfig.prototype.region\r\n     * @function\r\n     * @public\r\n     * @return {region} The region set on the config.\r\n     */\r\n    public abstract get region(): string;\r\n\r\n    /**\r\n     * Sets a property value that will be passed to service using the specified channel.\r\n     * Added in version 1.7.0.\r\n     * @member SpeechConfig.prototype.setServiceProperty\r\n     * @function\r\n     * @public\r\n     * @param {name} The name of the property.\r\n     * @param {value} Value to set.\r\n     * @param {channel} The channel used to pass the specified property to service.\r\n     */\r\n    public abstract setServiceProperty(name: string, value: string, channel: ServicePropertyChannel): void;\r\n\r\n    /**\r\n     * Sets profanity option.\r\n     * Added in version 1.7.0.\r\n     * @member SpeechConfig.prototype.setProfanity\r\n     * @function\r\n     * @public\r\n     * @param {profanity} Profanity option to set.\r\n     */\r\n    public abstract setProfanity(profanity: ProfanityOption): void;\r\n\r\n    /**\r\n     * Enable audio logging in service.\r\n     * Audio and content logs are stored either in Microsoft-owned storage, or in your own storage account linked\r\n     * to your Cognitive Services subscription (Bring Your Own Storage (BYOS) enabled Speech resource).\r\n     * The logs will be removed after 30 days.\r\n     * Added in version 1.7.0.\r\n     * @member SpeechConfig.prototype.enableAudioLogging\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract enableAudioLogging(): void;\r\n\r\n    /**\r\n     * Includes word-level timestamps.\r\n     * Added in version 1.7.0.\r\n     * @member SpeechConfig.prototype.requestWordLevelTimestamps\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract requestWordLevelTimestamps(): void;\r\n\r\n    /**\r\n     * Enable dictation. Only supported in speech continuous recognition.\r\n     * Added in version 1.7.0.\r\n     * @member SpeechConfig.prototype.enableDictation\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract enableDictation(): void;\r\n\r\n    /**\r\n     * Gets the language of the speech synthesizer.\r\n     * Added in version 1.11.0.\r\n     * @member SpeechConfig.prototype.speechSynthesisLanguage\r\n     * @function\r\n     * @public\r\n     * @returns {string} Returns the speech synthesis language.\r\n     */\r\n    public abstract get speechSynthesisLanguage(): string;\r\n\r\n    /**\r\n     * Sets the language of the speech synthesizer.\r\n     * Added in version 1.11.0.\r\n     * @member SpeechConfig.prototype.speechSynthesisLanguage\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract set speechSynthesisLanguage(language: string);\r\n\r\n    /**\r\n     * Gets the voice of the speech synthesizer.\r\n     * Added in version 1.11.0.\r\n     * @member SpeechConfig.prototype.speechSynthesisVoiceName\r\n     * @function\r\n     * @public\r\n     * @returns {string} Returns the speech synthesis voice.\r\n     */\r\n    public abstract get speechSynthesisVoiceName(): string;\r\n\r\n    /**\r\n     * Sets the voice of the speech synthesizer. (see <a href=\"https://aka.ms/speech/tts-languages\">available voices</a>).\r\n     * Added in version 1.11.0.\r\n     * @member SpeechConfig.prototype.speechSynthesisVoiceName\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract set speechSynthesisVoiceName(voice: string);\r\n\r\n    /**\r\n     * Gets the speech synthesis output format.\r\n     * Added in version 1.11.0.\r\n     * @member SpeechConfig.prototype.speechSynthesisOutputFormat\r\n     * @function\r\n     * @public\r\n     * @returns {SpeechSynthesisOutputFormat} Returns the speech synthesis output format\r\n     */\r\n    public abstract get speechSynthesisOutputFormat(): SpeechSynthesisOutputFormat;\r\n\r\n    /**\r\n     * Sets the speech synthesis output format (e.g. Riff16Khz16BitMonoPcm).\r\n     * The default format is Audio16Khz64KBitRateMonoMp3 for browser and Riff16Khz16BitMonoPcm for Node.JS.\r\n     * Added in version 1.11.0.\r\n     * @member SpeechConfig.prototype.speechSynthesisOutputFormat\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract set speechSynthesisOutputFormat(format: SpeechSynthesisOutputFormat);\r\n}\r\n\r\n/**\r\n * @public\r\n * @class SpeechConfigImpl\r\n */\r\nexport class SpeechConfigImpl extends SpeechConfig {\r\n\r\n    private privProperties: PropertyCollection;\r\n    private readonly privTokenCredential?: TokenCredential;\r\n\r\n    public constructor(tokenCredential?: TokenCredential) {\r\n        super();\r\n        this.privProperties = new PropertyCollection();\r\n        this.speechRecognitionLanguage = \"en-US\"; // Should we have a default?\r\n        this.outputFormat = OutputFormat.Simple;\r\n        this.privTokenCredential = tokenCredential;\r\n    }\r\n\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    public get endPoint(): URL {\r\n        return new URL(this.privProperties.getProperty(PropertyId.SpeechServiceConnection_Endpoint));\r\n    }\r\n\r\n    public get subscriptionKey(): string {\r\n        return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_Key);\r\n    }\r\n\r\n    public get region(): string {\r\n        return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_Region);\r\n    }\r\n\r\n    public get authorizationToken(): string {\r\n        return this.privProperties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n    }\r\n\r\n    public set authorizationToken(value: string) {\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceAuthorization_Token, value);\r\n    }\r\n\r\n    public get speechRecognitionLanguage(): string {\r\n        return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage);\r\n    }\r\n\r\n    public set speechRecognitionLanguage(value: string) {\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceConnection_RecoLanguage, value);\r\n    }\r\n\r\n    public get autoDetectSourceLanguages(): string {\r\n        return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages);\r\n    }\r\n\r\n    public set autoDetectSourceLanguages(value: string) {\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, value);\r\n    }\r\n\r\n    public get outputFormat(): OutputFormat {\r\n        return OutputFormat[this.privProperties.getProperty(OutputFormatPropertyName, undefined) as keyof typeof OutputFormat];\r\n    }\r\n\r\n    public set outputFormat(value: OutputFormat) {\r\n        this.privProperties.setProperty(OutputFormatPropertyName, OutputFormat[value]);\r\n    }\r\n\r\n    public get endpointId(): string {\r\n        return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_EndpointId);\r\n    }\r\n\r\n    public set endpointId(value: string) {\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceConnection_EndpointId, value);\r\n    }\r\n\r\n    public get tokenCredential(): TokenCredential | undefined {\r\n        return this.privTokenCredential;\r\n    }\r\n\r\n    public setProperty(name: string | PropertyId, value: string): void {\r\n        Contracts.throwIfNull(value, \"value\");\r\n\r\n        this.privProperties.setProperty(name, value);\r\n    }\r\n\r\n    public getProperty(name: string | PropertyId, def?: string): string {\r\n\r\n        return this.privProperties.getProperty(name, def);\r\n    }\r\n\r\n    public setProxy(proxyHostName: string, proxyPort: number): void;\r\n    public setProxy(proxyHostName: string, proxyPort: number, proxyUserName: string, proxyPassword: string): void;\r\n    public setProxy(proxyHostName: any, proxyPort: any, proxyUserName?: any, proxyPassword?: any): void {\r\n        this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyHostName], proxyHostName as string);\r\n        this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyPort], proxyPort as string);\r\n        this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyUserName], proxyUserName as string);\r\n        this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyPassword], proxyPassword as string);\r\n    }\r\n\r\n    public setServiceProperty(name: string, value: string): void {\r\n        const currentProperties: IStringDictionary<string> = JSON.parse(this.privProperties.getProperty(ServicePropertiesPropertyName, \"{}\")) as IStringDictionary<string>;\r\n\r\n        currentProperties[name] = value;\r\n\r\n        this.privProperties.setProperty(ServicePropertiesPropertyName, JSON.stringify(currentProperties));\r\n    }\r\n\r\n    public setProfanity(profanity: ProfanityOption): void {\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceResponse_ProfanityOption, ProfanityOption[profanity]);\r\n    }\r\n\r\n    public enableAudioLogging(): void {\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceConnection_EnableAudioLogging, \"true\");\r\n    }\r\n    public requestWordLevelTimestamps(): void {\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps, \"true\");\r\n        this.privProperties.setProperty(OutputFormatPropertyName, OutputFormat[OutputFormat.Detailed]);\r\n    }\r\n    public enableDictation(): void {\r\n        this.privProperties.setProperty(ForceDictationPropertyName, \"true\");\r\n    }\r\n\r\n    public clone(): SpeechConfigImpl {\r\n        const ret: SpeechConfigImpl = new SpeechConfigImpl(this.tokenCredential);\r\n        ret.privProperties = this.privProperties.clone();\r\n        return ret;\r\n    }\r\n\r\n    public get speechSynthesisLanguage(): string {\r\n        return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_SynthLanguage);\r\n    }\r\n\r\n    public set speechSynthesisLanguage(language: string) {\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceConnection_SynthLanguage, language);\r\n    }\r\n\r\n    public get speechSynthesisVoiceName(): string {\r\n        return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_SynthVoice);\r\n    }\r\n\r\n    public set speechSynthesisVoiceName(voice: string) {\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceConnection_SynthVoice, voice);\r\n    }\r\n\r\n    public get speechSynthesisOutputFormat(): SpeechSynthesisOutputFormat {\r\n        return SpeechSynthesisOutputFormat[this.privProperties.getProperty(PropertyId.SpeechServiceConnection_SynthOutputFormat, undefined) as keyof typeof SpeechSynthesisOutputFormat];\r\n    }\r\n\r\n    public set speechSynthesisOutputFormat(format: SpeechSynthesisOutputFormat) {\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceConnection_SynthOutputFormat, SpeechSynthesisOutputFormat[format]);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\nimport { KeyCredential, TokenCredential } from \"@azure/core-auth\";\r\nimport {\r\n    ForceDictationPropertyName,\r\n    OutputFormatPropertyName,\r\n    ServicePropertiesPropertyName\r\n} from \"../common.speech/Exports.js\";\r\nimport { IStringDictionary } from \"../common/Exports.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport {\r\n    OutputFormat,\r\n    ProfanityOption,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    SpeechConfig,\r\n    SpeechSynthesisOutputFormat,\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Speech translation configuration.\r\n * @class SpeechTranslationConfig\r\n */\r\nexport abstract class SpeechTranslationConfig extends SpeechConfig {\r\n\r\n    /**\r\n     * Creates an instance of recognizer config.\r\n     */\r\n    protected constructor() {\r\n        super();\r\n    }\r\n\r\n    /**\r\n     * Static instance of SpeechTranslationConfig returned by passing a subscription key and service region.\r\n     * @member SpeechTranslationConfig.fromSubscription\r\n     * @function\r\n     * @public\r\n     * @param {string} subscriptionKey - The subscription key.\r\n     * @param {string} region - The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\r\n     * @returns {SpeechTranslationConfig} The speech translation config.\r\n     */\r\n    public static fromSubscription(subscriptionKey: string, region: string): SpeechTranslationConfig {\r\n        Contracts.throwIfNullOrWhitespace(subscriptionKey, \"subscriptionKey\");\r\n        Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n        const ret: SpeechTranslationConfigImpl = new SpeechTranslationConfigImpl();\r\n        ret.properties.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\r\n        ret.properties.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n        return ret;\r\n    }\r\n\r\n    /**\r\n     * Static instance of SpeechTranslationConfig returned by passing authorization token and service region.\r\n     * Note: The caller needs to ensure that the authorization token is valid. Before the authorization token\r\n     * expires, the caller needs to refresh it by setting the property authorizationToken with a new\r\n     * valid token. Otherwise, all the recognizers created by this SpeechTranslationConfig instance\r\n     * will encounter errors during recognition.\r\n     * As configuration values are copied when creating a new recognizer, the new token value will not apply\r\n     * to recognizers that have already been created.\r\n     * For recognizers that have been created before, you need to set authorization token of the corresponding recognizer\r\n     * to refresh the token. Otherwise, the recognizers will encounter errors during recognition.\r\n     * @member SpeechTranslationConfig.fromAuthorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} authorizationToken - The authorization token.\r\n     * @param {string} region - The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\r\n     * @returns {SpeechTranslationConfig} The speech translation config.\r\n     */\r\n    public static fromAuthorizationToken(authorizationToken: string, region: string): SpeechTranslationConfig {\r\n        Contracts.throwIfNullOrWhitespace(authorizationToken, \"authorizationToken\");\r\n        Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n        const ret: SpeechTranslationConfigImpl = new SpeechTranslationConfigImpl();\r\n        ret.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, authorizationToken);\r\n        ret.properties.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n        return ret;\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of the speech config with specified host and subscription key.\r\n     * This method is intended only for users who use a non-default service host. Standard resource path will be assumed.\r\n     * For services with a non-standard resource path or no path at all, use fromEndpoint instead.\r\n     * Note: Query parameters are not allowed in the host URI and must be set by other APIs.\r\n     * Note: To use an authorization token with fromHost, use fromHost(URL),\r\n     * and then set the AuthorizationToken property on the created SpeechConfig instance.\r\n     * Note: Added in version 1.9.0.\r\n     * @member SpeechConfig.fromHost\r\n     * @function\r\n     * @public\r\n     * @param {URL} host - The service endpoint to connect to. Format is \"protocol://host:port\" where \":port\" is optional.\r\n     * @param {string} subscriptionKey - The subscription key. If a subscription key is not specified, an authorization token must be set.\r\n     * @returns {SpeechConfig} A speech factory instance.\r\n     */\r\n    public static fromHost(hostName: URL, subscriptionKey?: string): SpeechTranslationConfig {\r\n        Contracts.throwIfNull(hostName, \"hostName\");\r\n\r\n        const speechImpl: SpeechTranslationConfigImpl = new SpeechTranslationConfigImpl();\r\n        speechImpl.setProperty(PropertyId.SpeechServiceConnection_Host, hostName.protocol + \"//\" + hostName.hostname + (hostName.port === \"\" ? \"\" : \":\" + hostName.port));\r\n\r\n        if (undefined !== subscriptionKey) {\r\n            speechImpl.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\r\n        }\r\n        return speechImpl;\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of the speech translation config with specified endpoint and subscription key.\r\n     * This method is intended only for users who use a non-standard service endpoint or paramters.\r\n     * Note: The query properties specified in the endpoint URL are not changed, even if they are\r\n     * set by any other APIs. For example, if language is defined in the uri as query parameter\r\n     * \"language=de-DE\", and also set by the speechRecognitionLanguage property, the language\r\n     * setting in uri takes precedence, and the effective language is \"de-DE\".\r\n     * Only the properties that are not specified in the endpoint URL can be set by other APIs.\r\n     * Note: To use authorization token with fromEndpoint, pass an empty string to the subscriptionKey in the\r\n     * fromEndpoint method, and then set authorizationToken=\"token\" on the created SpeechConfig instance to\r\n     * use the authorization token.\r\n     * @member SpeechTranslationConfig.fromEndpoint\r\n     * @function\r\n     * @public\r\n     * @param {URL} endpoint - The service endpoint to connect to.\r\n     * @param {string} subscriptionKey - The subscription key.\r\n     * @returns {SpeechTranslationConfig} A speech translation config instance.\r\n     */\r\n    public static fromEndpoint(endpoint: URL, subscriptionKey?: string): SpeechTranslationConfig;\r\n\r\n    /**\r\n     * Creates an instance of a speech translation config with a custom endpoint and a credential.\r\n     * The query parameters specified in the endpoint URI are not changed, even if they are set by any other API call.\r\n     * For example, if the recognition language is defined in the URI query parameter as \"language=de-DE\", and the property SpeechRecognitionLanguage is set to \"en-US\",\r\n     * the language set in the URI takes precedence, and \"de-DE\" remains the expected language.\r\n     * Since parameters included in the endpoint URI take priority, only parameters that are not specified in the endpoint URI can be set by other APIs.\r\n     * Supported credential types:\r\n     * - KeyCredential: For API key-based authentication.\r\n     * - TokenCredential: For Azure AD-based authentication.\r\n     * Note: To use authorization token with fromEndpoint, pass an empty string to the subscriptionKey in the\r\n     * fromEndpoint method, and then set authorizationToken=\"token\" on the created SpeechConfig instance to use the authorization token.\r\n     * @member SpeechConfig.fromEndpoint\r\n     * @function\r\n     * @public\r\n     * @param {URL} endpoint - The service endpoint to connect to.\r\n     * @param {KeyCredential | TokenCredential} credential - The credential used for authentication.\r\n     * @returns {SpeechTranslationConfig} A speech factory instance.\r\n     */\r\n    public static fromEndpoint(endpoint: URL, credential: KeyCredential | TokenCredential): SpeechTranslationConfig;\r\n\r\n    /**\r\n     * Internal implementation of fromEndpoint() overloads. Accepts either a subscription key or a TokenCredential.\r\n     * @private\r\n     */\r\n    public static fromEndpoint(endpoint: URL, auth: string | TokenCredential | KeyCredential): SpeechTranslationConfig {\r\n        Contracts.throwIfNull(endpoint, \"endpoint\");\r\n        const isValidString = typeof auth === \"string\" && auth.trim().length > 0;\r\n        const isTokenCredential = typeof auth === \"object\" && auth !== null && typeof (auth as TokenCredential).getToken === \"function\";\r\n        const isKeyCredential = typeof auth === \"object\" && auth !== null && typeof (auth as KeyCredential).key === \"string\";\r\n        if (auth !== undefined && !isValidString && !isTokenCredential && !isKeyCredential) {\r\n            throw new Error(\"Invalid 'auth' parameter: expected a non-empty API key string, a TokenCredential, or a KeyCredential.\");\r\n        }\r\n\r\n        let speechImpl: SpeechTranslationConfigImpl;\r\n        if (typeof auth === \"string\") {\r\n            speechImpl = new SpeechTranslationConfigImpl();\r\n            speechImpl.setProperty(PropertyId.SpeechServiceConnection_Key, auth);\r\n        } else if (typeof auth === \"object\" && typeof (auth as TokenCredential).getToken === \"function\") {\r\n            speechImpl = new SpeechTranslationConfigImpl(auth as TokenCredential);\r\n        } else if (typeof auth === \"object\" && typeof (auth as KeyCredential).key === \"string\") {\r\n            speechImpl = new SpeechTranslationConfigImpl();\r\n            speechImpl.setProperty(PropertyId.SpeechServiceConnection_Key, (auth as KeyCredential).key);\r\n        } else {\r\n            speechImpl = new SpeechTranslationConfigImpl();\r\n        }\r\n\r\n        speechImpl.setProperty(PropertyId.SpeechServiceConnection_Endpoint, endpoint.href);\r\n\r\n        return speechImpl;\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets the authorization token.\r\n     * Note: The caller needs to ensure that the authorization token is valid. Before the authorization token\r\n     * expires, the caller needs to refresh it by calling this setter with a new valid token.\r\n     * @member SpeechTranslationConfig.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The authorization token.\r\n     */\r\n    public abstract set authorizationToken(value: string);\r\n\r\n    /**\r\n     * Gets/Sets the speech recognition language.\r\n     * @member SpeechTranslationConfig.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The authorization token.\r\n     */\r\n    public abstract set speechRecognitionLanguage(value: string);\r\n\r\n    /**\r\n     * Add a (text) target language to translate into.\r\n     * @member SpeechTranslationConfig.prototype.addTargetLanguage\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The language such as de-DE\r\n     */\r\n    public abstract addTargetLanguage(value: string): void;\r\n\r\n    /**\r\n     * Gets the (text) target language to translate into.\r\n     * @member SpeechTranslationConfig.prototype.targetLanguages\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The language such as de-DE\r\n     */\r\n    public abstract get targetLanguages(): string[];\r\n\r\n    /**\r\n     * Gets the selected voice name.\r\n     * @member SpeechTranslationConfig.prototype.voiceName\r\n     * @function\r\n     * @public\r\n     * @returns {string} The voice name.\r\n     */\r\n    public abstract get voiceName(): string;\r\n\r\n    /**\r\n     * Gets/Sets voice of the translated language, enable voice synthesis output.\r\n     * @member SpeechTranslationConfig.prototype.voiceName\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The name of the voice.\r\n     */\r\n    public abstract set voiceName(value: string);\r\n\r\n    /**\r\n     * Sets a named property as value\r\n     * @member SpeechTranslationConfig.prototype.setProperty\r\n     * @function\r\n     * @public\r\n     * @param {string | PropertyId} name - The name of the property to set.\r\n     * @param {string} value - The new value of the property.\r\n     */\r\n    public abstract setProperty(name: string | PropertyId, value: string): void;\r\n\r\n    /**\r\n     * Dispose of associated resources.\r\n     * @member SpeechTranslationConfig.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract close(): void;\r\n}\r\n\r\n/**\r\n * @private\r\n * @class SpeechTranslationConfigImpl\r\n */\r\nexport class SpeechTranslationConfigImpl extends SpeechTranslationConfig {\r\n\r\n    private privSpeechProperties: PropertyCollection;\r\n    private readonly privTokenCredential?: TokenCredential;\r\n\r\n    public constructor(tokenCredential?: TokenCredential) {\r\n        super();\r\n        this.privSpeechProperties = new PropertyCollection();\r\n        this.outputFormat = OutputFormat.Simple;\r\n        this.privTokenCredential = tokenCredential;\r\n    }\r\n    /**\r\n     * Gets/Sets the authorization token.\r\n     * If this is set, subscription key is ignored.\r\n     * User needs to make sure the provided authorization token is valid and not expired.\r\n     * @member SpeechTranslationConfigImpl.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The authorization token.\r\n     */\r\n    public set authorizationToken(value: string) {\r\n        Contracts.throwIfNullOrWhitespace(value, \"value\");\r\n\r\n        this.privSpeechProperties.setProperty(PropertyId.SpeechServiceAuthorization_Token, value);\r\n    }\r\n\r\n    /**\r\n     * Sets the speech recognition language.\r\n     * @member SpeechTranslationConfigImpl.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The authorization token.\r\n     */\r\n    public set speechRecognitionLanguage(value: string) {\r\n        Contracts.throwIfNullOrWhitespace(value, \"value\");\r\n        this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_RecoLanguage, value);\r\n    }\r\n\r\n    /**\r\n     * Gets the speech recognition language.\r\n     * @member SpeechTranslationConfigImpl.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     * @return {string} The speechRecognitionLanguage.\r\n     */\r\n    public get speechRecognitionLanguage(): string {\r\n        return this.privSpeechProperties.getProperty(PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage]);\r\n    }\r\n\r\n    /**\r\n     * @member SpeechTranslationConfigImpl.prototype.subscriptionKey\r\n     * @function\r\n     * @public\r\n     */\r\n    public get subscriptionKey(): string {\r\n        return this.privSpeechProperties.getProperty(PropertyId[PropertyId.SpeechServiceConnection_Key]);\r\n    }\r\n\r\n    /**\r\n     * Gets the output format\r\n     * @member SpeechTranslationConfigImpl.prototype.outputFormat\r\n     * @function\r\n     * @public\r\n     */\r\n    public get outputFormat(): OutputFormat {\r\n        // eslint-disable-next-line\r\n        return (OutputFormat as any)[this.privSpeechProperties.getProperty(OutputFormatPropertyName, undefined)];\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets the output format\r\n     * @member SpeechTranslationConfigImpl.prototype.outputFormat\r\n     * @function\r\n     * @public\r\n     */\r\n    public set outputFormat(value: OutputFormat) {\r\n        this.privSpeechProperties.setProperty(OutputFormatPropertyName, OutputFormat[value]);\r\n    }\r\n\r\n    /**\r\n     * Gets the endpoint id.\r\n     * @member SpeechTranslationConfigImpl.prototype.endpointId\r\n     * @function\r\n     * @public\r\n     */\r\n    public get endpointId(): string {\r\n        return this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_EndpointId);\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets the endpoint id.\r\n     * @member SpeechTranslationConfigImpl.prototype.endpointId\r\n     * @function\r\n     * @public\r\n     */\r\n    public set endpointId(value: string) {\r\n        this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_EndpointId, value);\r\n    }\r\n\r\n    /**\r\n     * Add a (text) target language to translate into.\r\n     * @member SpeechTranslationConfigImpl.prototype.addTargetLanguage\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The language such as de-DE\r\n     */\r\n    public addTargetLanguage(value: string): void {\r\n        Contracts.throwIfNullOrWhitespace(value, \"value\");\r\n\r\n        const languages: string[] = this.targetLanguages;\r\n        if (!languages.includes(value)) {\r\n            languages.push(value);\r\n            this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages, languages.join(\",\"));\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Gets the (text) target language to translate into.\r\n     * @member SpeechTranslationConfigImpl.prototype.targetLanguages\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The language such as de-DE\r\n     */\r\n    public get targetLanguages(): string[] {\r\n\r\n        if (this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages, undefined) !== undefined) {\r\n            return this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages).split(\",\");\r\n        } else {\r\n            return [];\r\n        }\r\n\r\n    }\r\n\r\n    /**\r\n     * Gets the voice name.\r\n     * @member SpeechTranslationConfigImpl.prototype.voiceName\r\n     * @function\r\n     * @public\r\n     */\r\n    public get voiceName(): string {\r\n        return this.getProperty(PropertyId[PropertyId.SpeechServiceConnection_TranslationVoice]);\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets the voice of the translated language, enable voice synthesis output.\r\n     * @member SpeechTranslationConfigImpl.prototype.voiceName\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The name of the voice.\r\n     */\r\n    public set voiceName(value: string) {\r\n        Contracts.throwIfNullOrWhitespace(value, \"value\");\r\n\r\n        this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_TranslationVoice, value);\r\n    }\r\n\r\n    /**\r\n     * Provides the region.\r\n     * @member SpeechTranslationConfigImpl.prototype.region\r\n     * @function\r\n     * @public\r\n     * @returns {string} The region.\r\n     */\r\n    public get region(): string {\r\n        return this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_Region);\r\n    }\r\n\r\n    public get tokenCredential(): TokenCredential | undefined {\r\n        return this.privTokenCredential;\r\n    }\r\n\r\n    public setProxy(proxyHostName: string, proxyPort: number): void;\r\n    public setProxy(proxyHostName: string, proxyPort: number, proxyUserName: string, proxyPassword: string): void;\r\n    public setProxy(proxyHostName: any, proxyPort: any, proxyUserName?: any, proxyPassword?: any): void {\r\n        this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyHostName], proxyHostName as string);\r\n        this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyPort], proxyPort as string);\r\n        this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyUserName], proxyUserName as string);\r\n        this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyPassword], proxyPassword as string);\r\n    }\r\n\r\n    /**\r\n     * Gets an arbitrary property value.\r\n     * @member SpeechTranslationConfigImpl.prototype.getProperty\r\n     * @function\r\n     * @public\r\n     * @param {string} name - The name of the property.\r\n     * @param {string} def - The default value of the property in case it is not set.\r\n     * @returns {string} The value of the property.\r\n     */\r\n    public getProperty(name: string, def?: string): string {\r\n        return this.privSpeechProperties.getProperty(name, def);\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets an arbitrary property value.\r\n     * @member SpeechTranslationConfigImpl.prototype.setProperty\r\n     * @function\r\n     * @public\r\n     * @param {string | PropertyId} name - The name of the property to set.\r\n     * @param {string} value - The value of the property.\r\n     */\r\n    public setProperty(name: string | PropertyId, value: string): void {\r\n        this.privSpeechProperties.setProperty(name, value);\r\n    }\r\n\r\n    /**\r\n     * Provides access to custom properties.\r\n     * @member SpeechTranslationConfigImpl.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} The properties.\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privSpeechProperties;\r\n    }\r\n\r\n    /**\r\n     * Dispose of associated resources.\r\n     * @member SpeechTranslationConfigImpl.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(): void {\r\n        return;\r\n    }\r\n\r\n    public setServiceProperty(name: string, value: string): void {\r\n        const currentProperties: IStringDictionary<string> = JSON.parse(this.privSpeechProperties.getProperty(ServicePropertiesPropertyName, \"{}\")) as IStringDictionary<string>;\r\n\r\n        currentProperties[name] = value;\r\n\r\n        this.privSpeechProperties.setProperty(ServicePropertiesPropertyName, JSON.stringify(currentProperties));\r\n    }\r\n\r\n    public setProfanity(profanity: ProfanityOption): void {\r\n        this.privSpeechProperties.setProperty(PropertyId.SpeechServiceResponse_ProfanityOption, ProfanityOption[profanity]);\r\n    }\r\n\r\n    public enableAudioLogging(): void {\r\n        this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_EnableAudioLogging, \"true\");\r\n    }\r\n    public requestWordLevelTimestamps(): void {\r\n        this.privSpeechProperties.setProperty(PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps, \"true\");\r\n    }\r\n    public enableDictation(): void {\r\n        this.privSpeechProperties.setProperty(ForceDictationPropertyName, \"true\");\r\n    }\r\n\r\n    public get speechSynthesisLanguage(): string {\r\n        return this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_SynthLanguage);\r\n    }\r\n\r\n    public set speechSynthesisLanguage(language: string) {\r\n        this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_SynthLanguage, language);\r\n    }\r\n\r\n    public get speechSynthesisVoiceName(): string {\r\n        return this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_SynthVoice);\r\n    }\r\n\r\n    public set speechSynthesisVoiceName(voice: string) {\r\n        this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_SynthVoice, voice);\r\n    }\r\n\r\n    public get speechSynthesisOutputFormat(): SpeechSynthesisOutputFormat {\r\n        // eslint-disable-next-line\r\n        return (SpeechSynthesisOutputFormat as any)[this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_SynthOutputFormat, undefined)];\r\n    }\r\n\r\n    public set speechSynthesisOutputFormat(format: SpeechSynthesisOutputFormat) {\r\n        this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_SynthOutputFormat, SpeechSynthesisOutputFormat[format]);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyId } from \"./Exports.js\";\r\n\r\n/**\r\n * Represents collection of properties and their values.\r\n * @class PropertyCollection\r\n */\r\nexport class PropertyCollection {\r\n    private privKeys: string[] = [] as string[];\r\n    private privValues: string[] = [] as string[];\r\n\r\n    /**\r\n     * Returns the property value in type String.\r\n     * Currently only String, int and bool are allowed.\r\n     * If the name is not available, the specified defaultValue is returned.\r\n     * @member PropertyCollection.prototype.getProperty\r\n     * @function\r\n     * @public\r\n     * @param {string} key - The parameter name.\r\n     * @param {string | number | boolean} def - The default value which is returned if the parameter\r\n     * is not available in the collection.\r\n     * @returns {string} value of the parameter.\r\n     */\r\n    public getProperty(key: PropertyId | string, def?: string | number | boolean): string {\r\n        let keyToUse: string;\r\n\r\n        if (typeof key === \"string\") {\r\n            keyToUse = key;\r\n        } else {\r\n            keyToUse = PropertyId[key];\r\n        }\r\n\r\n        for (let n = 0; n < this.privKeys.length; n++) {\r\n            if (this.privKeys[n] === keyToUse) {\r\n                return this.privValues[n];\r\n            }\r\n        }\r\n\r\n        if (def === undefined) {\r\n            return undefined;\r\n        }\r\n\r\n        return String(def);\r\n    }\r\n\r\n    /**\r\n     * Sets the String value of the parameter specified by name.\r\n     * @member PropertyCollection.prototype.setProperty\r\n     * @function\r\n     * @public\r\n     * @param {string} key - The parameter name.\r\n     * @param {string} value - The value of the parameter.\r\n     */\r\n    public setProperty(key: string | PropertyId, value: string): void {\r\n        let keyToUse: string;\r\n\r\n        if (typeof key === \"string\") {\r\n            keyToUse = key;\r\n        } else {\r\n            keyToUse = PropertyId[key];\r\n        }\r\n\r\n        for (let n = 0; n < this.privKeys.length; n++) {\r\n            if (this.privKeys[n] === keyToUse) {\r\n                this.privValues[n] = value;\r\n                return;\r\n            }\r\n        }\r\n\r\n        this.privKeys.push(keyToUse);\r\n        this.privValues.push(value);\r\n    }\r\n\r\n    /**\r\n     * Clones the collection.\r\n     * @member PropertyCollection.prototype.clone\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} A copy of the collection.\r\n     */\r\n    public clone(): PropertyCollection {\r\n        const clonedMap = new PropertyCollection();\r\n\r\n        for (let n = 0; n < this.privKeys.length; n++) {\r\n            clonedMap.privKeys.push(this.privKeys[n]);\r\n            clonedMap.privValues.push(this.privValues[n]);\r\n        }\r\n\r\n        return clonedMap;\r\n    }\r\n\r\n    /**\r\n     * Merges this set of properties into another, no overwrites.\r\n     * @member PropertyCollection.prototype.mergeTo\r\n     * @function\r\n     * @public\r\n     * @param {PropertyCollection}  destinationCollection - The collection to merge into.\r\n     */\r\n    public mergeTo(destinationCollection: PropertyCollection): void {\r\n        this.privKeys.forEach((key: string | PropertyId): void => {\r\n            if (destinationCollection.getProperty(key, undefined) === undefined) {\r\n                const value = this.getProperty(key);\r\n                destinationCollection.setProperty(key, value);\r\n            }\r\n        });\r\n    }\r\n\r\n    /**\r\n     * Get the keys in Property Collection.\r\n     * @member PropertyCollection.prototype.keys\r\n     * @function\r\n     * @public\r\n     * @returns {string []} Keys in the collection.\r\n     */\r\n    public get keys(): string[] {\r\n        return this.privKeys;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines speech property ids.\r\n * @class PropertyId\r\n */\r\nexport enum PropertyId {\r\n\r\n    /**\r\n     * The Cognitive Services Speech Service subscription Key. Under normal circumstances, you shouldn't\r\n     * have to use this property directly.\r\n     * Instead, use [[SpeechConfig.fromSubscription]].\r\n     * @member PropertyId.SpeechServiceConnection_Key\r\n     */\r\n    SpeechServiceConnection_Key = 0,\r\n\r\n    /**\r\n     * The Cognitive Services Speech Service endpoint (url). Under normal circumstances, you shouldn't\r\n     * have to use this property directly.\r\n     * Instead, use [[SpeechConfig.fromEndpoint]].\r\n     * NOTE: This endpoint is not the same as the endpoint used to obtain an access token.\r\n     * @member PropertyId.SpeechServiceConnection_Endpoint\r\n     */\r\n    SpeechServiceConnection_Endpoint,\r\n\r\n    /**\r\n     * The Cognitive Services Speech Service region. Under normal circumstances, you shouldn't have to\r\n     * use this property directly.\r\n     * Instead, use [[SpeechConfig.fromSubscription]], [[SpeechConfig.fromEndpoint]], [[SpeechConfig.fromAuthorizationToken]].\r\n     * @member PropertyId.SpeechServiceConnection_Region\r\n     */\r\n    SpeechServiceConnection_Region,\r\n\r\n    /**\r\n     * The Cognitive Services Speech Service authorization token (aka access token). Under normal circumstances,\r\n     * you shouldn't have to use this property directly.\r\n     * Instead, use [[SpeechConfig.fromAuthorizationToken]], [[SpeechRecognizer.authorizationToken]],\r\n     * [[TranslationRecognizer.authorizationToken]], [[SpeakerRecognizer.authorizationToken]].\r\n     * @member PropertyId.SpeechServiceAuthorization_Token\r\n     */\r\n    SpeechServiceAuthorization_Token,\r\n\r\n    /**\r\n     * The Cognitive Services Speech Service authorization type. Currently unused.\r\n     * @member PropertyId.SpeechServiceAuthorization_Type\r\n     */\r\n    SpeechServiceAuthorization_Type,\r\n\r\n    /**\r\n     * The Cognitive Services Speech Service endpoint id. Under normal circumstances, you shouldn't\r\n     * have to use this property directly.\r\n     * Instead, use [[SpeechConfig.endpointId]].\r\n     * NOTE: The endpoint id is available in the Speech Portal, listed under Endpoint Details.\r\n     * @member PropertyId.SpeechServiceConnection_EndpointId\r\n     */\r\n    SpeechServiceConnection_EndpointId,\r\n\r\n    /**\r\n     * The list of comma separated languages (BCP-47 format) used as target translation languages. Under normal circumstances,\r\n     * you shouldn't have to use this property directly.\r\n     * Instead use [[SpeechTranslationConfig.addTargetLanguage]],\r\n     * [[SpeechTranslationConfig.targetLanguages]], [[TranslationRecognizer.targetLanguages]].\r\n     * @member PropertyId.SpeechServiceConnection_TranslationToLanguages\r\n     */\r\n    SpeechServiceConnection_TranslationToLanguages,\r\n\r\n    /**\r\n     * The name of the Cognitive Service Text to Speech Service Voice. Under normal circumstances, you shouldn't have to use this\r\n     * property directly.\r\n     * Instead, use [[SpeechTranslationConfig.voiceName]].\r\n     * NOTE: Valid voice names can be found <a href=\"https://aka.ms/csspeech/voicenames\">here</a>.\r\n     * @member PropertyId.SpeechServiceConnection_TranslationVoice\r\n     */\r\n    SpeechServiceConnection_TranslationVoice,\r\n\r\n    /**\r\n     * Translation features.\r\n     * @member PropertyId.SpeechServiceConnection_TranslationFeatures\r\n     */\r\n    SpeechServiceConnection_TranslationFeatures,\r\n\r\n    /**\r\n     * The category ID for translation.\r\n     * @member PropertyId.SpeechServiceConnection_TranslationCategoryId\r\n     */\r\n    SpeechServiceConnection_TranslationCategoryId,\r\n\r\n    /**\r\n     * The host name of the proxy server used to connect to the Cognitive Services Speech Service. Only relevant in Node.js environments.\r\n     * You shouldn't have to use this property directly.\r\n     * Instead use <see cref=\"SpeechConfig.SetProxy(string,int,string,string)\"/>.\r\n     * Added in version 1.4.0.\r\n     */\r\n    SpeechServiceConnection_ProxyHostName,\r\n\r\n    /**\r\n     * The port of the proxy server used to connect to the Cognitive Services Speech Service. Only relevant in Node.js environments.\r\n     * You shouldn't have to use this property directly.\r\n     * Instead use <see cref=\"SpeechConfig.SetProxy(string,int,string,string)\"/>.\r\n     * Added in version 1.4.0.\r\n     */\r\n    SpeechServiceConnection_ProxyPort,\r\n\r\n    /**\r\n     * The user name of the proxy server used to connect to the Cognitive Services Speech Service. Only relevant in Node.js environments.\r\n     * You shouldn't have to use this property directly.\r\n     * Instead use <see cref=\"SpeechConfig.SetProxy(string,int,string,string)\"/>.\r\n     * Added in version 1.4.0.\r\n     */\r\n    SpeechServiceConnection_ProxyUserName,\r\n\r\n    /**\r\n     * The password of the proxy server used to connect to the Cognitive Services Speech Service. Only relevant in Node.js environments.\r\n     * You shouldn't have to use this property directly.\r\n     * Instead use <see cref=\"SpeechConfig.SetProxy(string,int,string,string)\"/>.\r\n     * Added in version 1.4.0.\r\n     */\r\n    SpeechServiceConnection_ProxyPassword,\r\n\r\n    /**\r\n     * The Cognitive Services Speech Service recognition Mode. Can be \"INTERACTIVE\", \"CONVERSATION\", \"DICTATION\".\r\n     * This property is intended to be read-only. The SDK is using it internally.\r\n     * @member PropertyId.SpeechServiceConnection_RecoMode\r\n     */\r\n    SpeechServiceConnection_RecoMode,\r\n\r\n    /**\r\n     * The spoken language to be recognized (in BCP-47 format). Under normal circumstances, you shouldn't have to use this property\r\n     * directly.\r\n     * Instead, use [[SpeechConfig.speechRecognitionLanguage]].\r\n     * @member PropertyId.SpeechServiceConnection_RecoLanguage\r\n     */\r\n    SpeechServiceConnection_RecoLanguage,\r\n\r\n    /**\r\n     * The session id. This id is a universally unique identifier (aka UUID) representing a specific binding of an audio input stream\r\n     * and the underlying speech recognition instance to which it is bound. Under normal circumstances, you shouldn't have to use this\r\n     * property directly.\r\n     * Instead use [[SessionEventArgs.sessionId]].\r\n     * @member PropertyId.Speech_SessionId\r\n     */\r\n    Speech_SessionId,\r\n\r\n    /**\r\n     * The spoken language to be synthesized (e.g. en-US)\r\n     * @member PropertyId.SpeechServiceConnection_SynthLanguage\r\n     */\r\n    SpeechServiceConnection_SynthLanguage,\r\n\r\n    /**\r\n     * The name of the TTS voice to be used for speech synthesis\r\n     * @member PropertyId.SpeechServiceConnection_SynthVoice\r\n     */\r\n    SpeechServiceConnection_SynthVoice,\r\n\r\n    /**\r\n     * The string to specify TTS output audio format\r\n     * @member PropertyId.SpeechServiceConnection_SynthOutputFormat\r\n     */\r\n    SpeechServiceConnection_SynthOutputFormat,\r\n\r\n    /**\r\n     * The list of comma separated languages used as possible source languages\r\n     * Added in version 1.13.0\r\n     * @member PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages\r\n     */\r\n    SpeechServiceConnection_AutoDetectSourceLanguages,\r\n\r\n    /**\r\n     * The requested Cognitive Services Speech Service response output format (simple or detailed). Under normal circumstances, you shouldn't have\r\n     * to use this property directly.\r\n     * Instead use [[SpeechConfig.outputFormat]].\r\n     * @member PropertyId.SpeechServiceResponse_RequestDetailedResultTrueFalse\r\n     */\r\n    SpeechServiceResponse_RequestDetailedResultTrueFalse,\r\n\r\n    /**\r\n     * The requested Cognitive Services Speech Service response output profanity level. Currently unused.\r\n     * @member PropertyId.SpeechServiceResponse_RequestProfanityFilterTrueFalse\r\n     */\r\n    SpeechServiceResponse_RequestProfanityFilterTrueFalse,\r\n\r\n    /**\r\n     * The Cognitive Services Speech Service response output (in JSON format). This property is available on recognition result objects only.\r\n     * @member PropertyId.SpeechServiceResponse_JsonResult\r\n     */\r\n    SpeechServiceResponse_JsonResult,\r\n\r\n    /**\r\n     * The Cognitive Services Speech Service error details (in JSON format). Under normal circumstances, you shouldn't have to\r\n     * use this property directly. Instead use [[CancellationDetails.errorDetails]].\r\n     * @member PropertyId.SpeechServiceResponse_JsonErrorDetails\r\n     */\r\n    SpeechServiceResponse_JsonErrorDetails,\r\n\r\n    /**\r\n     * The cancellation reason. Currently unused.\r\n     * @member PropertyId.CancellationDetails_Reason\r\n     */\r\n    CancellationDetails_Reason,\r\n\r\n    /**\r\n     * The cancellation text. Currently unused.\r\n     * @member PropertyId.CancellationDetails_ReasonText\r\n     */\r\n    CancellationDetails_ReasonText,\r\n\r\n    /**\r\n     * The Cancellation detailed text. Currently unused.\r\n     * @member PropertyId.CancellationDetails_ReasonDetailedText\r\n     */\r\n    CancellationDetails_ReasonDetailedText,\r\n\r\n    /**\r\n     * The URL string built from speech configuration.\r\n     * This property is intended to be read-only. The SDK is using it internally.\r\n     * NOTE: Added in version 1.7.0.\r\n     */\r\n    SpeechServiceConnection_Url,\r\n\r\n    /**\r\n     * The initial silence timeout value (in milliseconds) used by the service.\r\n     * Added in version 1.7.0\r\n     */\r\n    SpeechServiceConnection_InitialSilenceTimeoutMs,\r\n\r\n    /**\r\n     * This property is deprecated.\r\n     * For current information about silence timeouts, please visit https://aka.ms/csspeech/timeouts.\r\n     */\r\n    SpeechServiceConnection_EndSilenceTimeoutMs,\r\n\r\n    /**\r\n     * A duration of detected silence, measured in milliseconds, after which speech-to-text will determine a spoken\r\n     * phrase has ended and generate a final Recognized result. Configuring this timeout may be helpful in situations\r\n     * where spoken input is significantly faster or slower than usual and default segmentation behavior consistently\r\n     * yields results that are too long or too short. Segmentation timeout values that are inappropriately high or low\r\n     * can negatively affect speech-to-text accuracy; this property should be carefully configured and the resulting\r\n     * behavior should be thoroughly validated as intended.\r\n     *\r\n     * Refer to the documentation for valid value ranges and additional details:\r\n     * https://aka.ms/csspeech/timeouts\r\n     *\r\n     * Added in version 1.42.0.\r\n     */\r\n    Speech_SegmentationSilenceTimeoutMs,\r\n\r\n    /**\r\n     * SegmentationMaximumTimeMs represents the maximum length of a spoken phrase when using the Time segmentation strategy.\r\n     * @member Speech_SegmentationSilenceTimeoutMs must be set in order to use this setting.\r\n     * As the length of a spoken phrase approaches this value, the @member Speech_SegmentationSilenceTimeoutMs will be reduced until either\r\n     * the phrase silence timeout is reached or the phrase reaches the maximum length.\r\n     *\r\n     * Valid range: **20,000 to 70,000** milliseconds.\r\n     *\r\n     * Added in version 1.42.0.\r\n     */\r\n    Speech_SegmentationMaximumTimeMs,\r\n\r\n    /**\r\n     * Specifies the strategy used to determine when a spoken phrase has ended,\r\n     * triggering the generation of a final recognition result.\r\n     *\r\n     * Supported values:\r\n     * - \"Default\": Uses the Speech Service's default segmentation strategy. Recommended for most use cases.\r\n     * - \"Time\": Uses a silence-based timeout. A final result is generated after a defined period of silence.\r\n     * Requires @member Speech_SegmentationMaximumTimeMs to be configured appropriately.\r\n     * Optional: Adjust @member Speech_SegmentationSilenceTimeoutMs to control how much silence ends a phrase.\r\n     * - \"Semantic\": Uses an AI model to semantically infer phrase boundaries based on content.\r\n     * No adjustable parameters are available for this strategy.\r\n     *\r\n     * Introduced in version 1.42.0.\r\n     */\r\n    Speech_SegmentationStrategy,\r\n\r\n    /**\r\n     * The sensitivity of how soon a potential speech start can be signaled.\r\n     * Allowed values are \"low\" (default), \"medium\" and \"high\".\r\n     */\r\n    Speech_StartEventSensitivity,\r\n\r\n    /**\r\n     * A boolean value specifying whether audio logging is enabled in the service or not.\r\n     * Audio and content logs are stored either in Microsoft-owned storage, or in your own storage account linked\r\n     * to your Cognitive Services subscription (Bring Your Own Storage (BYOS) enabled Speech resource).\r\n     * The logs will be removed after 30 days.\r\n     * Added in version 1.7.0\r\n     */\r\n    SpeechServiceConnection_EnableAudioLogging,\r\n\r\n    /**\r\n     * The speech service connection language identifier mode.\r\n     * Can be \"AtStart\" (the default), or \"Continuous\". See Language\r\n     * Identification document https://aka.ms/speech/lid?pivots=programming-language-javascript\r\n     * for more details.\r\n     * Added in 1.25.0\r\n     **/\r\n    SpeechServiceConnection_LanguageIdMode,\r\n\r\n    /**\r\n     * A string value representing the desired endpoint version to target for Speech Recognition.\r\n     * Added in version 1.21.0\r\n     */\r\n    SpeechServiceConnection_RecognitionEndpointVersion,\r\n\r\n    /**\r\n     * The requested Cognitive Services Speech Service response output profanity setting.\r\n     * Allowed values are \"masked\", \"removed\", and \"raw\".\r\n     * Added in version 1.7.0.\r\n     */\r\n    SpeechServiceResponse_ProfanityOption,\r\n\r\n    /**\r\n     * A string value specifying which post processing option should be used by service.\r\n     * Allowed values are \"TrueText\".\r\n     * Added in version 1.7.0\r\n     */\r\n    SpeechServiceResponse_PostProcessingOption,\r\n\r\n    /**\r\n     * A boolean value specifying whether to include word-level timestamps in the response result.\r\n     * Added in version 1.7.0\r\n     */\r\n    SpeechServiceResponse_RequestWordLevelTimestamps,\r\n\r\n    /**\r\n     * The number of times a word has to be in partial results to be returned.\r\n     * Added in version 1.7.0\r\n     */\r\n    SpeechServiceResponse_StablePartialResultThreshold,\r\n\r\n    /**\r\n     * A string value specifying the output format option in the response result. Internal use only.\r\n     * Added in version 1.7.0.\r\n     */\r\n    SpeechServiceResponse_OutputFormatOption,\r\n\r\n    /**\r\n     * A boolean value to request for stabilizing translation partial results by omitting words in the end.\r\n     * Added in version 1.7.0.\r\n     */\r\n    SpeechServiceResponse_TranslationRequestStablePartialResult,\r\n\r\n    /**\r\n     * A boolean value specifying whether to request WordBoundary events.\r\n     * @member PropertyId.SpeechServiceResponse_RequestWordBoundary\r\n     * Added in version 1.21.0.\r\n     */\r\n    SpeechServiceResponse_RequestWordBoundary,\r\n\r\n    /**\r\n     * A boolean value specifying whether to request punctuation boundary in WordBoundary Events. Default is true.\r\n     * @member PropertyId.SpeechServiceResponse_RequestPunctuationBoundary\r\n     * Added in version 1.21.0.\r\n     */\r\n    SpeechServiceResponse_RequestPunctuationBoundary,\r\n\r\n    /**\r\n     * A boolean value specifying whether to request sentence boundary in WordBoundary Events. Default is false.\r\n     * @member PropertyId.SpeechServiceResponse_RequestSentenceBoundary\r\n     * Added in version 1.21.0.\r\n     */\r\n    SpeechServiceResponse_RequestSentenceBoundary,\r\n\r\n    /**\r\n     * Determines if intermediate results contain speaker identification.\r\n     * Allowed values are \"true\" or \"false\". If set to \"true\", the intermediate results will contain speaker identification.\r\n     * The default value if unset or set to an invalid value is \"false\".\r\n     * This is currently only supported for scenarios using the ConversationTranscriber\".\r\n     * @member PropertyId.SpeechServiceResponse_DiarizeIntermediateResults\r\n     * Adding in version 1.41.\r\n     */\r\n    SpeechServiceResponse_DiarizeIntermediateResults,\r\n\r\n    /**\r\n     * Identifier used to connect to the backend service.\r\n     * @member PropertyId.Conversation_ApplicationId\r\n     */\r\n    Conversation_ApplicationId,\r\n\r\n    /**\r\n     * Type of dialog backend to connect to.\r\n     * @member PropertyId.Conversation_DialogType\r\n     */\r\n    Conversation_DialogType,\r\n\r\n    /**\r\n     * Silence timeout for listening\r\n     * @member PropertyId.Conversation_Initial_Silence_Timeout\r\n     */\r\n    Conversation_Initial_Silence_Timeout,\r\n\r\n    /**\r\n     * From Id to add to speech recognition activities.\r\n     * @member PropertyId.Conversation_From_Id\r\n     */\r\n    Conversation_From_Id,\r\n\r\n    /**\r\n     * ConversationId for the session.\r\n     * @member PropertyId.Conversation_Conversation_Id\r\n     */\r\n    Conversation_Conversation_Id,\r\n\r\n    /**\r\n     * Comma separated list of custom voice deployment ids.\r\n     * @member PropertyId.Conversation_Custom_Voice_Deployment_Ids\r\n     */\r\n    Conversation_Custom_Voice_Deployment_Ids,\r\n\r\n    /**\r\n     * Speech activity template, stamp properties from the template on the activity generated by the service for speech.\r\n     * @member PropertyId.Conversation_Speech_Activity_Template\r\n     * Added in version 1.10.0.\r\n     */\r\n    Conversation_Speech_Activity_Template,\r\n\r\n    /**\r\n     * Enables or disables the receipt of turn status messages as obtained on the turnStatusReceived event.\r\n     * @member PropertyId.Conversation_Request_Bot_Status_Messages\r\n     * Added in version 1.15.0.\r\n     */\r\n    Conversation_Request_Bot_Status_Messages,\r\n\r\n    /**\r\n     * Specifies the connection ID to be provided in the Agent configuration message, e.g. a Direct Line token for\r\n     * channel authentication.\r\n     * Added in version 1.15.1.\r\n     */\r\n    Conversation_Agent_Connection_Id,\r\n\r\n    /**\r\n     * The Cognitive Services Speech Service host (url). Under normal circumstances, you shouldn't have to use this property directly.\r\n     * Instead, use [[SpeechConfig.fromHost]].\r\n     */\r\n    SpeechServiceConnection_Host,\r\n\r\n    /**\r\n     * Set the host for service calls to the Conversation Translator REST management and websocket calls.\r\n     */\r\n    ConversationTranslator_Host,\r\n\r\n    /**\r\n     * Optionally set the the host's display name.\r\n     * Used when joining a conversation.\r\n     */\r\n    ConversationTranslator_Name,\r\n\r\n    /**\r\n     * Optionally set a value for the X-CorrelationId request header.\r\n     * Used for troubleshooting errors in the server logs. It should be a valid guid.\r\n     */\r\n    ConversationTranslator_CorrelationId,\r\n\r\n    /**\r\n     * Set the conversation token to be sent to the speech service. This enables the\r\n     * service to service call from the speech service to the Conversation Translator service for relaying\r\n     * recognitions. For internal use.\r\n     */\r\n    ConversationTranslator_Token,\r\n\r\n    /**\r\n     * The reference text of the audio for pronunciation evaluation.\r\n     * For this and the following pronunciation assessment parameters, see\r\n     * https://docs.microsoft.com/azure/cognitive-services/speech-service/rest-speech-to-text#pronunciation-assessment-parameters for details.\r\n     * Under normal circumstances, you shouldn't have to use this property directly.\r\n     * Added in version 1.15.0\r\n     */\r\n    PronunciationAssessment_ReferenceText,\r\n\r\n    /**\r\n     * The point system for pronunciation score calibration (FivePoint or HundredMark).\r\n     * Under normal circumstances, you shouldn't have to use this property directly.\r\n     * Added in version 1.15.0\r\n     */\r\n    PronunciationAssessment_GradingSystem,\r\n\r\n    /**\r\n     * The pronunciation evaluation granularity (Phoneme, Word, or FullText).\r\n     * Under normal circumstances, you shouldn't have to use this property directly.\r\n     * Added in version 1.15.0\r\n     */\r\n    PronunciationAssessment_Granularity,\r\n\r\n    /**\r\n     * Defines if enable miscue calculation.\r\n     * With this enabled, the pronounced words will be compared to the reference text,\r\n     * and will be marked with omission/insertion based on the comparison. The default setting is False.\r\n     * Under normal circumstances, you shouldn't have to use this property directly.\r\n     * Added in version 1.15.0\r\n     */\r\n    PronunciationAssessment_EnableMiscue,\r\n\r\n    /**\r\n     * The json string of pronunciation assessment parameters\r\n     * Under normal circumstances, you shouldn't have to use this property directly.\r\n     * Added in version 1.15.0\r\n     */\r\n    PronunciationAssessment_Json,\r\n\r\n    /**\r\n     * Pronunciation assessment parameters.\r\n     * This property is intended to be read-only. The SDK is using it internally.\r\n     * Added in version 1.15.0\r\n     */\r\n    PronunciationAssessment_Params,\r\n\r\n    /**\r\n     * Specifies whether to allow load of data URL for web worker\r\n     * Allowed values are \"off\" and \"on\". Default is \"on\".\r\n     * Added in version 1.32.0\r\n     */\r\n    WebWorkerLoadType,\r\n\r\n    /**\r\n     * Talking avatar service WebRTC session description protocol.\r\n     * This property is intended to be read-only. The SDK is using it internally.\r\n     * Added in version 1.33.0\r\n     */\r\n    TalkingAvatarService_WebRTC_SDP,\r\n\r\n    /**\r\n     * The timeout (in milliseconds) for stopping a recognizer.\r\n     * When set, if stopContinuousRecognitionAsync() doesn't complete within this time\r\n     * (due to the service being behind in processing audio), the operation will be\r\n     * cancelled and an error will be thrown.\r\n     *\r\n     * If not set or set to 0, the stop operation will wait indefinitely for the service\r\n     * to complete (existing behavior).\r\n     *\r\n     * Note: This timeout only applies to the graceful stop operation. It does not affect\r\n     * the disconnect() method which always cancels immediately.\r\n     *\r\n     * Added in version 1.48.0\r\n     */\r\n    Recognizer_StopTimeoutMs,\r\n\r\n    /**\r\n     * The recognition latency in milliseconds. Read-only, available on speech/translation recognition results.\r\n     * This measures the latency between when an audio input is received by the SDK, and the moment the result\r\n     * is received from the service.\r\n     * The SDK computes the time difference between the last audio fragment from the audio input that is\r\n     * contributing to the result, and the time the result is received from the speech service.\r\n     * Added in version 1.48.0\r\n     */\r\n    SpeechServiceResponse_RecognitionLatencyMs,\r\n\r\n    /**\r\n     * The speech synthesis first byte latency in milliseconds. Read-only, available on speech synthesis results.\r\n     * This measures the time from when the synthesis request is sent to when the first audio byte is received\r\n     * from the service, including network latency.\r\n     */\r\n    SpeechServiceResponse_SynthesisFirstByteLatencyMs,\r\n\r\n    /**\r\n     * The speech synthesis finish latency in milliseconds. Read-only, available on speech synthesis results.\r\n     * This measures the time from when the synthesis request is sent to when the full synthesized audio is\r\n     * received from the service, including network latency.\r\n     */\r\n    SpeechServiceResponse_SynthesisFinishLatencyMs,\r\n\r\n    /**\r\n     * The speech synthesis connection latency in milliseconds. Read-only, available on speech synthesis results.\r\n     * This measures the time to establish the WebSocket connection to the service.\r\n     * If the connection is reused from a previous synthesis, this value is 0.\r\n     */\r\n    SpeechServiceResponse_SynthesisConnectionLatencyMs,\r\n\r\n    /**\r\n     * The speech synthesis network latency in milliseconds. Read-only, available on speech synthesis results.\r\n     * This measures the network round-trip time between the client and the Azure TTS service.\r\n     */\r\n    SpeechServiceResponse_SynthesisNetworkLatencyMs,\r\n\r\n    /**\r\n     * The speech synthesis service latency in milliseconds. Read-only, available on speech synthesis results.\r\n     * This measures the time from when the Azure TTS service receives the synthesis request to when it sends\r\n     * back the first audio chunk.\r\n     */\r\n    SpeechServiceResponse_SynthesisServiceLatencyMs,\r\n\r\n    /*\r\n     * The pitch of the voice for a speech synthesis request.\r\n     * @member PropertyId.SpeechSynthesisRequest_Pitch\r\n     */\r\n    SpeechSynthesisRequest_Pitch,\r\n\r\n    /**\r\n     * The speaking rate of the voice for a speech synthesis request.\r\n     * @member PropertyId.SpeechSynthesisRequest_Rate\r\n     */\r\n    SpeechSynthesisRequest_Rate,\r\n\r\n    /**\r\n     * The volume of the voice for a speech synthesis request.\r\n     * @member PropertyId.SpeechSynthesisRequest_Volume\r\n     */\r\n    SpeechSynthesisRequest_Volume,\r\n\r\n    /**\r\n     * The style of the voice for a speech synthesis request.\r\n     * @member PropertyId.SpeechSynthesisRequest_Style\r\n     */\r\n    SpeechSynthesisRequest_Style,\r\n\r\n    /**\r\n     * The temperature of the voice synthesis for a speech synthesis request.\r\n     * @member PropertyId.SpeechSynthesisRequest_Temperature\r\n     */\r\n    SpeechSynthesisRequest_Temperature,\r\n\r\n    /**\r\n     * The custom lexicon URL for a speech synthesis request.\r\n     * @member PropertyId.SpeechSynthesisRequest_CustomLexiconUrl\r\n     */\r\n    SpeechSynthesisRequest_CustomLexiconUrl,\r\n\r\n    /**\r\n     * The preferred locales for a speech synthesis request.\r\n     * @member PropertyId.SpeechSynthesisRequest_PreferLocales\r\n     */\r\n    SpeechSynthesisRequest_PreferLocales,\r\n\r\n    /**\r\n     * The frame timeout interval (in ticks) for speech synthesis.\r\n     * @member PropertyId.SpeechSynthesis_FrameTimeoutInterval\r\n     */\r\n    SpeechSynthesis_FrameTimeoutInterval,\r\n\r\n    /**\r\n     * The RTF (Real-Time Factor) timeout threshold for speech synthesis.\r\n     * @member PropertyId.SpeechSynthesis_RtfTimeoutThreshold\r\n     */\r\n    SpeechSynthesis_RtfTimeoutThreshold,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\nimport {\r\n    TokenCredential\r\n} from \"@azure/core-auth\";\r\nimport {\r\n    CognitiveSubscriptionKeyAuthentication,\r\n    CognitiveTokenAuthentication,\r\n    Context,\r\n    IAuthentication,\r\n    IConnectionFactory,\r\n    OS,\r\n    RecognizerConfig,\r\n    ServiceRecognizerBase,\r\n    SpeechServiceConfig,\r\n} from \"../common.speech/Exports.js\";\r\nimport { RecognitionMode } from \"../common.speech/ServiceMessages/PhraseDetection/PhraseDetectionContext.js\";\r\nimport {\r\n    Deferred,\r\n    marshalPromiseToCallbacks\r\n} from \"../common/Exports.js\";\r\nimport {\r\n    Contracts\r\n} from \"./Contracts.js\";\r\nimport {\r\n    AudioConfig,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    RecognitionEventArgs,\r\n    SessionEventArgs,\r\n    SpeechRecognitionResult,\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Defines the base class Recognizer which mainly contains common event handlers.\r\n * @class Recognizer\r\n */\r\nexport abstract class Recognizer {\r\n    private privDisposed: boolean;\r\n    protected audioConfig: AudioConfig;\r\n    protected privReco: ServiceRecognizerBase;\r\n    protected privProperties: PropertyCollection;\r\n    protected tokenCredential?: TokenCredential;\r\n    private privConnectionFactory: IConnectionFactory;\r\n\r\n    /**\r\n     * Creates and initializes an instance of a Recognizer\r\n     * @constructor\r\n     * @param {AudioConfig} audioInput - An optional audio input stream associated with the recognizer\r\n     * @param {PropertyCollection} properties - A set of properties to set on the recognizer\r\n     * @param {IConnectionFactory} connectionFactory - The factory class used to create a custom IConnection for the recognizer\r\n     */\r\n    protected constructor(audioConfig: AudioConfig, properties: PropertyCollection, connectionFactory: IConnectionFactory, tokenCredential?: TokenCredential) {\r\n        this.audioConfig = (audioConfig !== undefined) ? audioConfig : AudioConfig.fromDefaultMicrophoneInput();\r\n        this.privDisposed = false;\r\n        this.privProperties = properties.clone();\r\n        this.privConnectionFactory = connectionFactory;\r\n        this.tokenCredential = tokenCredential;\r\n        this.implCommonRecognizerSetup();\r\n    }\r\n\r\n    /**\r\n     * Defines event handler for session started events.\r\n     * @member Recognizer.prototype.sessionStarted\r\n     * @function\r\n     * @public\r\n     */\r\n    public sessionStarted: (sender: Recognizer, event: SessionEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for session stopped events.\r\n     * @member Recognizer.prototype.sessionStopped\r\n     * @function\r\n     * @public\r\n     */\r\n    public sessionStopped: (sender: Recognizer, event: SessionEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for speech started events.\r\n     * @member Recognizer.prototype.speechStartDetected\r\n     * @function\r\n     * @public\r\n     */\r\n    public speechStartDetected: (sender: Recognizer, event: RecognitionEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for speech stopped events.\r\n     * @member Recognizer.prototype.speechEndDetected\r\n     * @function\r\n     * @public\r\n     */\r\n    public speechEndDetected: (sender: Recognizer, event: RecognitionEventArgs) => void;\r\n\r\n    /**\r\n     * Dispose of associated resources.\r\n     * @member Recognizer.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(cb?: () => void, errorCb?: (error: string) => void): void {\r\n        Contracts.throwIfDisposed(this.privDisposed);\r\n        marshalPromiseToCallbacks(this.dispose(true), cb, errorCb);\r\n    }\r\n\r\n    /**\r\n     * @Internal\r\n     * Internal data member to support fromRecognizer* pattern methods on other classes.\r\n     * Do not use externally, object returned will change without warning or notice.\r\n     */\r\n    public get internalData(): object {\r\n        return this.privReco;\r\n    }\r\n\r\n    /**\r\n     * This method performs cleanup of resources.\r\n     * The Boolean parameter disposing indicates whether the method is called\r\n     * from Dispose (if disposing is true) or from the finalizer (if disposing is false).\r\n     * Derived classes should override this method to dispose resource if needed.\r\n     * @member Recognizer.prototype.dispose\r\n     * @function\r\n     * @public\r\n     * @param {boolean} disposing - Flag to request disposal.\r\n     */\r\n    protected async dispose(disposing: boolean): Promise<void> {\r\n        if (this.privDisposed) {\r\n            return;\r\n        }\r\n\r\n        this.privDisposed = true;\r\n\r\n        if (disposing) {\r\n            if (this.privReco) {\r\n                await this.privReco.audioSource.turnOff();\r\n                await this.privReco.dispose();\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * This method returns the current state of the telemetry setting.\r\n     * @member Recognizer.prototype.telemetryEnabled\r\n     * @function\r\n     * @public\r\n     * @returns true if the telemetry is enabled, false otherwise.\r\n     */\r\n    public static get telemetryEnabled(): boolean {\r\n        return ServiceRecognizerBase.telemetryDataEnabled;\r\n    }\r\n\r\n    /**\r\n     * This method globally enables or disables telemetry.\r\n     * @member Recognizer.prototype.enableTelemetry\r\n     * @function\r\n     * @public\r\n     * @param enabled - Global setting for telemetry collection.\r\n     * If set to true, telemetry information like microphone errors,\r\n     * recognition errors are collected and sent to Microsoft.\r\n     * If set to false, no telemetry is sent to Microsoft.\r\n     */\r\n    public static enableTelemetry(enabled: boolean): void {\r\n        ServiceRecognizerBase.telemetryDataEnabled = enabled;\r\n    }\r\n\r\n    //\r\n    // ################################################################################################################\r\n    // IMPLEMENTATION.\r\n    // Move to independent class\r\n    // ################################################################################################################\r\n    //\r\n    protected abstract createRecognizerConfig(speechConfig: SpeechServiceConfig): RecognizerConfig;\r\n\r\n    // Creates the correct service recognizer for the type\r\n    protected abstract createServiceRecognizer(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioConfig: AudioConfig,\r\n        recognizerConfig: RecognizerConfig): ServiceRecognizerBase;\r\n\r\n    // Does the generic recognizer setup that is common across all recognizer types.\r\n    protected implCommonRecognizerSetup(): void {\r\n\r\n        let osPlatform = (typeof window !== \"undefined\") ? \"Browser\" : \"Node\";\r\n        let osName = \"unknown\";\r\n        let osVersion = \"unknown\";\r\n\r\n        if (typeof navigator !== \"undefined\") {\r\n            osPlatform = osPlatform + \"/\" + navigator.platform;\r\n            osName = navigator.userAgent;\r\n            osVersion = navigator.appVersion;\r\n        }\r\n\r\n        const recognizerConfig = this.createRecognizerConfig(\r\n            new SpeechServiceConfig(\r\n                new Context(new OS(osPlatform, osName, osVersion))));\r\n\r\n        this.privReco = this.createServiceRecognizer(\r\n            Recognizer.getAuth(this.privProperties, this.tokenCredential),\r\n            this.privConnectionFactory,\r\n            this.audioConfig,\r\n            recognizerConfig);\r\n    }\r\n\r\n    protected async recognizeOnceAsyncImpl(recognitionMode: RecognitionMode): Promise<SpeechRecognitionResult> {\r\n        Contracts.throwIfDisposed(this.privDisposed);\r\n        const ret: Deferred<SpeechRecognitionResult> = new Deferred<SpeechRecognitionResult>();\r\n\r\n        await this.implRecognizerStop();\r\n        await this.privReco.recognize(recognitionMode, ret.resolve, ret.reject);\r\n        const result: SpeechRecognitionResult = await ret.promise;\r\n        await this.implRecognizerStop();\r\n\r\n        return result;\r\n\r\n    }\r\n\r\n    protected async startContinuousRecognitionAsyncImpl(recognitionMode: RecognitionMode): Promise<void> {\r\n        Contracts.throwIfDisposed(this.privDisposed);\r\n\r\n        await this.implRecognizerStop();\r\n        await this.privReco.recognize(recognitionMode, undefined, undefined);\r\n    }\r\n\r\n    protected async stopContinuousRecognitionAsyncImpl(): Promise<void> {\r\n        Contracts.throwIfDisposed(this.privDisposed);\r\n        await this.implRecognizerStop();\r\n    }\r\n\r\n    protected async implRecognizerStop(): Promise<void> {\r\n        if (this.privReco) {\r\n            // Get timeout property - undefined/empty means no timeout (existing behavior)\r\n            const timeoutProperty = this.privProperties.getProperty(\r\n                PropertyId.Recognizer_StopTimeoutMs,\r\n                undefined\r\n            );\r\n\r\n            // Only apply timeout if explicitly set to a positive value\r\n            if (timeoutProperty !== undefined && timeoutProperty !== \"\") {\r\n                const timeoutMs = parseInt(timeoutProperty, 10);\r\n\r\n                if (timeoutMs > 0) {\r\n                    // User wants timeout protection\r\n                    try {\r\n                        await this.withTimeout(\r\n                            this.privReco.stopRecognizing(),\r\n                            timeoutMs,\r\n                            `Stop operation timed out after ${timeoutMs}ms waiting for service to complete turn`\r\n                        );\r\n                    } catch (error) {\r\n                        // On timeout, use existing disconnect() which cancels immediately\r\n                        await this.privReco.disconnect();\r\n                        throw error;\r\n                    }\r\n                    return;\r\n                }\r\n            }\r\n\r\n            // No timeout configured - use existing behavior (wait indefinitely)\r\n            await this.privReco.stopRecognizing();\r\n        }\r\n        return;\r\n    }\r\n\r\n    private withTimeout<T>(promise: Promise<T>, timeoutMs: number, errorMessage: string): Promise<T> {\r\n        return Promise.race([\r\n            promise,\r\n            new Promise<T>((_: (value: T) => void, reject: (reason: Error) => void): void => {\r\n                setTimeout((): void => {\r\n                    reject(new Error(errorMessage));\r\n                }, timeoutMs);\r\n            })\r\n        ]);\r\n    }\r\n\r\n    protected static getAuth(properties: PropertyCollection, tokenCredential?: TokenCredential): IAuthentication {\r\n        const subscriptionKey = properties.getProperty(PropertyId.SpeechServiceConnection_Key, undefined);\r\n        if (subscriptionKey && subscriptionKey !== \"\") {\r\n            return new CognitiveSubscriptionKeyAuthentication(subscriptionKey);\r\n        }\r\n\r\n        if (tokenCredential) {\r\n            return new CognitiveTokenAuthentication(\r\n                async (): Promise<string> => {\r\n                    try {\r\n                        const tokenResponse = await tokenCredential.getToken(\"https://cognitiveservices.azure.com/.default\");\r\n                        return tokenResponse?.token ?? \"\";\r\n                    } catch (err) {\r\n                        throw err;\r\n                    }\r\n                },\r\n                async (): Promise<string> => {\r\n                    try {\r\n                        const tokenResponse = await tokenCredential.getToken(\"https://cognitiveservices.azure.com/.default\");\r\n                        return tokenResponse?.token ?? \"\";\r\n                    } catch (err) {\r\n                        throw err;\r\n                    }\r\n                }\r\n            );\r\n        }\r\n\r\n        return new CognitiveTokenAuthentication(\r\n            (): Promise<string> => {\r\n                const authorizationToken = properties.getProperty(PropertyId.SpeechServiceAuthorization_Token, undefined);\r\n                return Promise.resolve(authorizationToken);\r\n            },\r\n            (): Promise<string> => {\r\n                const authorizationToken = properties.getProperty(PropertyId.SpeechServiceAuthorization_Token, undefined);\r\n                return Promise.resolve(authorizationToken);\r\n            }\r\n        );\r\n    }\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\nimport { Dictation } from \"./Dictation\";\r\nimport { Enrichment } from \"./Enrichment\";\r\nimport { Interactive } from \"./Interactive\";\r\nimport { Conversation } from \"./Conversation\";\r\nimport { SpeakerDiarization } from \"./SpeakerDiarization\";\r\nimport { SentimentAnalysis } from \"./SentimentAnalysis\";\r\nimport { GeoLocation } from \"./GeoLocation\";\r\nimport { OnSuccess } from \"./OnSuccess\";\r\nimport { OnInterim } from \"./OnInterim\";\r\n\r\n/**\r\n * The Recognition modes\r\n */\r\nexport enum RecognitionMode {\r\n    Interactive = \"Interactive\",\r\n    Dictation = \"Dictation\",\r\n    Conversation = \"Conversation\",\r\n    None = \"None\"\r\n}\r\n\r\n/**\r\n * The speech start event sensitivity.\r\n */\r\nexport enum SpeechStartEventSensitivity {\r\n    Low = \"low\",\r\n    Medium = \"medium\",\r\n    High = \"high\"\r\n}\r\n\r\n/**\r\n * Defines the phrase detection payload in the speech Context message\r\n */\r\nexport interface PhraseDetectionContext {\r\n    /**\r\n     * The initial silence timeout.\r\n     */\r\n    initialSilenceTimeout?: number;\r\n\r\n    /**\r\n     * The trailing silence timeout.\r\n     */\r\n    trailingSilenceTimeout?: number;\r\n\r\n    /**\r\n     * The recognition mode.\r\n     */\r\n    mode?: RecognitionMode;\r\n\r\n    /**\r\n     * The enrichment option.\r\n     */\r\n    enrichment?: Enrichment;\r\n\r\n    /**\r\n     * The Interactive options.\r\n     */\r\n    interactive?: Interactive;\r\n\r\n    /**\r\n     * The Dictation options.\r\n     */\r\n    dictation?: Dictation;\r\n\r\n    /**\r\n     * The Conversation options.\r\n     */\r\n    conversation?: Conversation;\r\n\r\n    /**\r\n     * The grammar scenario that allows clients to use sophisticated acoustic and language models\r\n     */\r\n    grammarScenario?: string;\r\n\r\n    /**\r\n     * A flag that indicates whether to enable interim results or not. If true, interim results are returned to the client application.\r\n     */\r\n    interimResults?: boolean;\r\n\r\n    /**\r\n     * The configuration of speaker diarization.\r\n     */\r\n    speakerDiarization?: SpeakerDiarization;\r\n\r\n    /**\r\n     * The configuration of sentiment analysis.\r\n     */\r\n    sentimentAnalysis?: SentimentAnalysis;\r\n\r\n    /**\r\n     * The geo location.\r\n     */\r\n    geoLocation?: GeoLocation;\r\n\r\n    /**\r\n     * The on success.\r\n     */\r\n    onSuccess?: OnSuccess;\r\n\r\n    /**\r\n     * The on interim.\r\n     */\r\n    onInterim?: OnInterim;\r\n\r\n    /**\r\n     * The mapping from language to custom model id, if required.\r\n     */\r\n    customModels?: CustomLanguageMappingEntry[];\r\n\r\n    /**\r\n     * The detection language.\r\n     */\r\n    language?: string;\r\n\r\n    /**\r\n     * The speech start event sensitivity.\r\n     */\r\n    voiceOnsetSensitivity?: string;\r\n}\r\n\r\n/**\r\n * Defines a mapping entry from a language to a custom endpoint.\r\n */\r\nexport interface CustomLanguageMappingEntry {\r\n    /**\r\n     * The language for there is a custom endpoint.\r\n     */\r\n    language: string;\r\n\r\n    /**\r\n     * The custom endpoint id.\r\n     */\r\n    endpoint: string;\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ForceDictationPropertyName,\r\n    IAuthentication,\r\n    IConnectionFactory,\r\n    OutputFormatPropertyName,\r\n    RecognizerConfig,\r\n    ServiceRecognizerBase,\r\n    SpeechConnectionFactory,\r\n    SpeechServiceConfig,\r\n    SpeechServiceRecognizer,\r\n} from \"../common.speech/Exports.js\";\r\nimport { RecognitionMode } from \"../common.speech/ServiceMessages/PhraseDetection/PhraseDetectionContext.js\";\r\nimport { marshalPromiseToCallbacks } from \"../common/Exports.js\";\r\nimport { AudioConfigImpl } from \"./Audio/AudioConfig.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport {\r\n    AudioConfig,\r\n    AutoDetectSourceLanguageConfig,\r\n    KeywordRecognitionModel,\r\n    OutputFormat,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    Recognizer,\r\n    SpeechRecognitionCanceledEventArgs,\r\n    SpeechRecognitionEventArgs,\r\n    SpeechRecognitionResult,\r\n} from \"./Exports.js\";\r\nimport { SpeechConfig, SpeechConfigImpl } from \"./SpeechConfig.js\";\r\n\r\n/**\r\n * Performs speech recognition from microphone, file, or other audio input streams, and gets transcribed text as result.\r\n * @class SpeechRecognizer\r\n */\r\nexport class SpeechRecognizer extends Recognizer {\r\n    private privDisposedRecognizer: boolean;\r\n\r\n    /**\r\n     * SpeechRecognizer constructor.\r\n     * @constructor\r\n     * @param {SpeechConfig} speechConfig - an set of initial properties for this recognizer\r\n     * @param {AudioConfig} audioConfig - An optional audio configuration associated with the recognizer\r\n     */\r\n    public constructor(speechConfig: SpeechConfig, audioConfig?: AudioConfig) {\r\n        const speechConfigImpl: SpeechConfigImpl = speechConfig as SpeechConfigImpl;\r\n        Contracts.throwIfNull(speechConfigImpl, \"speechConfig\");\r\n\r\n        Contracts.throwIfNullOrWhitespace(\r\n            speechConfigImpl.properties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage),\r\n            PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage]);\r\n\r\n        super(audioConfig, speechConfigImpl.properties, new SpeechConnectionFactory(), speechConfig.tokenCredential);\r\n        this.privDisposedRecognizer = false;\r\n    }\r\n\r\n    /**\r\n     * SpeechRecognizer constructor.\r\n     * @constructor\r\n     * @param {SpeechConfig} speechConfig - an set of initial properties for this recognizer\r\n     * @param {AutoDetectSourceLanguageConfig} autoDetectSourceLanguageConfig - An source language detection configuration associated with the recognizer\r\n     * @param {AudioConfig} audioConfig - An optional audio configuration associated with the recognizer\r\n     */\r\n    public static FromConfig(speechConfig: SpeechConfig, autoDetectSourceLanguageConfig: AutoDetectSourceLanguageConfig, audioConfig?: AudioConfig): SpeechRecognizer {\r\n        const speechConfigImpl: SpeechConfigImpl = speechConfig as SpeechConfigImpl;\r\n        autoDetectSourceLanguageConfig.properties.mergeTo(speechConfigImpl.properties);\r\n        const recognizer = new SpeechRecognizer(speechConfig, audioConfig);\r\n        return recognizer;\r\n    }\r\n\r\n    /**\r\n     * The event recognizing signals that an intermediate recognition result is received.\r\n     * @member SpeechRecognizer.prototype.recognizing\r\n     * @function\r\n     * @public\r\n     */\r\n    public recognizing: (sender: Recognizer, event: SpeechRecognitionEventArgs) => void;\r\n\r\n    /**\r\n     * The event recognized signals that a final recognition result is received.\r\n     * @member SpeechRecognizer.prototype.recognized\r\n     * @function\r\n     * @public\r\n     */\r\n    public recognized: (sender: Recognizer, event: SpeechRecognitionEventArgs) => void;\r\n\r\n    /**\r\n     * The event canceled signals that an error occurred during recognition.\r\n     * @member SpeechRecognizer.prototype.canceled\r\n     * @function\r\n     * @public\r\n     */\r\n    public canceled: (sender: Recognizer, event: SpeechRecognitionCanceledEventArgs) => void;\r\n\r\n    /**\r\n     * Gets the endpoint id of a customized speech model that is used for speech recognition.\r\n     * @member SpeechRecognizer.prototype.endpointId\r\n     * @function\r\n     * @public\r\n     * @returns {string} the endpoint id of a customized speech model that is used for speech recognition.\r\n     */\r\n    public get endpointId(): string {\r\n        Contracts.throwIfDisposed(this.privDisposedRecognizer);\r\n\r\n        return this.properties.getProperty(PropertyId.SpeechServiceConnection_EndpointId, \"00000000-0000-0000-0000-000000000000\");\r\n    }\r\n\r\n    /**\r\n     * Gets the authorization token used to communicate with the service.\r\n     * @member SpeechRecognizer.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @returns {string} Authorization token.\r\n     */\r\n    public get authorizationToken(): string {\r\n        return this.properties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets the authorization token used to communicate with the service.\r\n     * @member SpeechRecognizer.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} token - Authorization token.\r\n     */\r\n    public set authorizationToken(token: string) {\r\n        Contracts.throwIfNullOrWhitespace(token, \"token\");\r\n        this.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, token);\r\n    }\r\n\r\n    /**\r\n     * Gets the spoken language of recognition.\r\n     * @member SpeechRecognizer.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     * @returns {string} The spoken language of recognition.\r\n     */\r\n    public get speechRecognitionLanguage(): string {\r\n        Contracts.throwIfDisposed(this.privDisposedRecognizer);\r\n\r\n        return this.properties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage);\r\n    }\r\n\r\n    /**\r\n     * Gets the output format of recognition.\r\n     * @member SpeechRecognizer.prototype.outputFormat\r\n     * @function\r\n     * @public\r\n     * @returns {OutputFormat} The output format of recognition.\r\n     */\r\n    public get outputFormat(): OutputFormat {\r\n        Contracts.throwIfDisposed(this.privDisposedRecognizer);\r\n\r\n        if (this.properties.getProperty(OutputFormatPropertyName, OutputFormat[OutputFormat.Simple]) === OutputFormat[OutputFormat.Simple]) {\r\n            return OutputFormat.Simple;\r\n        } else {\r\n            return OutputFormat.Detailed;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * The collection of properties and their values defined for this SpeechRecognizer.\r\n     * @member SpeechRecognizer.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} The collection of properties and their values defined for this SpeechRecognizer.\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    /**\r\n     * Starts speech recognition, and stops after the first utterance is recognized.\r\n     * The task returns the recognition text as result.\r\n     * Note: RecognizeOnceAsync() returns when the first utterance has been recognized,\r\n     * so it is suitable only for single shot recognition\r\n     * like command or query. For long-running recognition, use StartContinuousRecognitionAsync() instead.\r\n     * @member SpeechRecognizer.prototype.recognizeOnceAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback that received the SpeechRecognitionResult.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public recognizeOnceAsync(cb?: (e: SpeechRecognitionResult) => void, err?: (e: string) => void): void {\r\n        marshalPromiseToCallbacks(this.recognizeOnceAsyncImpl(RecognitionMode.Interactive), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Starts speech recognition, until stopContinuousRecognitionAsync() is called.\r\n     * User must subscribe to events to receive recognition results.\r\n     * @member SpeechRecognizer.prototype.startContinuousRecognitionAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback invoked once the recognition has started.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public startContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void): void {\r\n        marshalPromiseToCallbacks(this.startContinuousRecognitionAsyncImpl(this.properties.getProperty(ForceDictationPropertyName, undefined) === undefined ? RecognitionMode.Conversation : RecognitionMode.Dictation), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Stops continuous speech recognition.\r\n     * @member SpeechRecognizer.prototype.stopContinuousRecognitionAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback invoked once the recognition has stopped.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public stopContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void): void {\r\n        marshalPromiseToCallbacks(this.stopContinuousRecognitionAsyncImpl(), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Starts speech recognition with keyword spotting, until\r\n     * stopKeywordRecognitionAsync() is called.\r\n     * User must subscribe to events to receive recognition results.\r\n     * Note: Key word spotting functionality is only available on the\r\n     * Speech Devices SDK. This functionality is currently not included in the SDK itself.\r\n     * @member SpeechRecognizer.prototype.startKeywordRecognitionAsync\r\n     * @function\r\n     * @public\r\n     * @param {KeywordRecognitionModel} model The keyword recognition model that\r\n     * specifies the keyword to be recognized.\r\n     * @param cb - Callback invoked once the recognition has started.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public startKeywordRecognitionAsync(model: KeywordRecognitionModel, cb?: () => void, err?: (e: string) => void): void {\r\n        Contracts.throwIfNull(model, \"model\");\r\n\r\n        if (!!err) {\r\n            err(\"Not yet implemented.\");\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Stops continuous speech recognition.\r\n     * Note: Key word spotting functionality is only available on the\r\n     * Speech Devices SDK. This functionality is currently not included in the SDK itself.\r\n     * @member SpeechRecognizer.prototype.stopKeywordRecognitionAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback invoked once the recognition has stopped.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public stopKeywordRecognitionAsync(cb?: () => void): void {\r\n        if (!!cb) {\r\n            cb();\r\n        }\r\n    }\r\n\r\n    /**\r\n     * closes all external resources held by an instance of this class.\r\n     * @member SpeechRecognizer.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(cb?: () => void, errorCb?: (error: string) => void): void {\r\n        Contracts.throwIfDisposed(this.privDisposedRecognizer);\r\n        marshalPromiseToCallbacks(this.dispose(true), cb, errorCb);\r\n    }\r\n\r\n    /**\r\n     * Disposes any resources held by the object.\r\n     * @member SpeechRecognizer.prototype.dispose\r\n     * @function\r\n     * @public\r\n     * @param {boolean} disposing - true if disposing the object.\r\n     */\r\n    protected async dispose(disposing: boolean): Promise<void> {\r\n        if (this.privDisposedRecognizer) {\r\n            return;\r\n        }\r\n\r\n        if (disposing) {\r\n            this.privDisposedRecognizer = true;\r\n            await this.implRecognizerStop();\r\n        }\r\n\r\n        await super.dispose(disposing);\r\n    }\r\n\r\n    protected createRecognizerConfig(speechConfig: SpeechServiceConfig): RecognizerConfig {\r\n        return new RecognizerConfig(speechConfig, this.privProperties);\r\n    }\r\n\r\n    protected createServiceRecognizer(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioConfig: AudioConfig,\r\n        recognizerConfig: RecognizerConfig): ServiceRecognizerBase {\r\n        const configImpl: AudioConfigImpl = audioConfig as AudioConfigImpl;\r\n        return new SpeechServiceRecognizer(authentication, connectionFactory, configImpl, recognizerConfig, this);\r\n    }\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\n// eslint-disable-next-line max-classes-per-file\r\nimport { HeaderNames } from \"../common.speech/HeaderNames.js\";\r\nimport {\r\n    ConnectionMessage as IntConnectionMessage,\r\n    MessageType\r\n} from \"../common/Exports.js\";\r\nimport {\r\n    PropertyCollection\r\n} from \"./PropertyCollection.js\";\r\nimport { PropertyId } from \"./PropertyId.js\";\r\n\r\n/**\r\n * ConnectionMessage represents implementation specific messages sent to and received from\r\n * the speech service. These messages are provided for debugging purposes and should not\r\n * be used for production use cases with the Azure Cognitive Services Speech Service.\r\n * Messages sent to and received from the Speech Service are subject to change without\r\n * notice. This includes message contents, headers, payloads, ordering, etc.\r\n * Added in version 1.11.0.\r\n */\r\nexport abstract class ConnectionMessage {\r\n    /**\r\n     * The message path.\r\n     */\r\n    public abstract get path(): string;\r\n\r\n    /**\r\n     * Checks to see if the ConnectionMessage is a text message.\r\n     * See also IsBinaryMessage().\r\n     */\r\n    public abstract get isTextMessage(): boolean;\r\n\r\n    /**\r\n     * Checks to see if the ConnectionMessage is a binary message.\r\n     * See also GetBinaryMessage().\r\n     */\r\n    public abstract get isBinaryMessage(): boolean;\r\n\r\n    /**\r\n     * Gets the text message payload. Typically the text message content-type is\r\n     * application/json. To determine other content-types use\r\n     * Properties.GetProperty(\"Content-Type\").\r\n     */\r\n    public abstract get TextMessage(): string;\r\n\r\n    /**\r\n     * Gets the binary message payload.\r\n     */\r\n    public abstract get binaryMessage(): ArrayBuffer;\r\n\r\n    /**\r\n     * A collection of properties and their values defined for this <see cref=\"ConnectionMessage\"/>.\r\n     * Message headers can be accessed via this collection (e.g. \"Content-Type\").\r\n     */\r\n    public abstract get properties(): PropertyCollection;\r\n\r\n    /**\r\n     * Returns a string that represents the connection message.\r\n     */\r\n    public abstract toString(): string;\r\n}\r\n\r\nexport class ConnectionMessageImpl {\r\n\r\n    private privConnectionMessage: IntConnectionMessage;\r\n    private privProperties: PropertyCollection;\r\n\r\n    public constructor(message: IntConnectionMessage) {\r\n        this.privConnectionMessage = message;\r\n        this.privProperties = new PropertyCollection();\r\n        if (!!this.privConnectionMessage.headers[HeaderNames.ConnectionId]) {\r\n            this.privProperties.setProperty(PropertyId.Speech_SessionId, this.privConnectionMessage.headers[HeaderNames.ConnectionId]);\r\n        }\r\n\r\n        Object.keys(this.privConnectionMessage.headers).forEach((header: string): void => {\r\n            this.privProperties.setProperty(header, this.privConnectionMessage.headers[header]);\r\n        });\r\n    }\r\n\r\n    /**\r\n     * The message path.\r\n     */\r\n    public get path(): string {\r\n        return this.privConnectionMessage.headers[Object.keys(this.privConnectionMessage.headers).find((key: string): boolean => key.toLowerCase() === \"path\".toLowerCase())];\r\n    }\r\n\r\n    /**\r\n     * Checks to see if the ConnectionMessage is a text message.\r\n     * See also IsBinaryMessage().\r\n     */\r\n    public get isTextMessage(): boolean {\r\n        return this.privConnectionMessage.messageType === MessageType.Text;\r\n    }\r\n\r\n    /**\r\n     * Checks to see if the ConnectionMessage is a binary message.\r\n     * See also GetBinaryMessage().\r\n     */\r\n    public get isBinaryMessage(): boolean {\r\n        return this.privConnectionMessage.messageType === MessageType.Binary;\r\n    }\r\n\r\n    /**\r\n     * Gets the text message payload. Typically the text message content-type is\r\n     * application/json. To determine other content-types use\r\n     * Properties.GetProperty(\"Content-Type\").\r\n     */\r\n    public get TextMessage(): string {\r\n        return this.privConnectionMessage.textBody;\r\n    }\r\n\r\n    /**\r\n     * Gets the binary message payload.\r\n     */\r\n    public get binaryMessage(): ArrayBuffer {\r\n        return this.privConnectionMessage.binaryBody;\r\n    }\r\n\r\n    /**\r\n     * A collection of properties and their values defined for this <see cref=\"ConnectionMessage\"/>.\r\n     * Message headers can be accessed via this collection (e.g. \"Content-Type\").\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    /**\r\n     * Returns a string that represents the connection message.\r\n     */\r\n    public toString(): string {\r\n        return \"\";\r\n    }\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\nimport {\r\n    ServiceRecognizerBase,\r\n    SynthesisAdapterBase,\r\n} from \"../common.speech/Exports.js\";\r\nimport {\r\n    ConnectionEvent,\r\n    ConnectionMessageReceivedEvent,\r\n    ConnectionMessageSentEvent,\r\n    IDetachable,\r\n    marshalPromiseToCallbacks,\r\n    ServiceEvent,\r\n} from \"../common/Exports.js\";\r\nimport {\r\n    ConnectionMessageImpl\r\n} from \"./ConnectionMessage.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport {\r\n    ConnectionEventArgs,\r\n    ConnectionMessageEventArgs,\r\n    ConversationTranscriber,\r\n    Recognizer,\r\n    ServiceEventArgs,\r\n    SpeechSynthesizer,\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Connection is a proxy class for managing connection to the speech service of the specified Recognizer.\r\n * By default, a Recognizer autonomously manages connection to service when needed.\r\n * The Connection class provides additional methods for users to explicitly open or close a connection and\r\n * to subscribe to connection status changes.\r\n * The use of Connection is optional, and mainly for scenarios where fine tuning of application\r\n * behavior based on connection status is needed. Users can optionally call Open() to manually set up a connection\r\n * in advance before starting recognition on the Recognizer associated with this Connection.\r\n * If the Recognizer needs to connect or disconnect to service, it will\r\n * setup or shutdown the connection independently. In this case the Connection will be notified by change of connection\r\n * status via Connected/Disconnected events.\r\n * Added in version 1.2.1.\r\n */\r\nexport class Connection {\r\n    private privInternalData: ServiceRecognizerBase | SynthesisAdapterBase;\r\n    private privEventListener: IDetachable;\r\n    private privServiceEventListener: IDetachable;\r\n\r\n    /**\r\n     * Gets the Connection instance from the specified recognizer.\r\n     * @param recognizer The recognizer associated with the connection.\r\n     * @return The Connection instance of the recognizer.\r\n     */\r\n    public static fromRecognizer(recognizer: Recognizer | ConversationTranscriber): Connection {\r\n        const recoBase = recognizer.internalData as ServiceRecognizerBase;\r\n        const ret: Connection = new Connection();\r\n\r\n        ret.privInternalData = recoBase;\r\n        ret.setupEvents();\r\n        return ret;\r\n    }\r\n\r\n    /**\r\n     * Gets the Connection instance from the specified synthesizer.\r\n     * @param synthesizer The synthesizer associated with the connection.\r\n     * @return The Connection instance of the synthesizer.\r\n     */\r\n    public static fromSynthesizer(synthesizer: SpeechSynthesizer): Connection {\r\n        const synthBase: SynthesisAdapterBase = synthesizer.internalData as SynthesisAdapterBase;\r\n\r\n        const ret: Connection = new Connection();\r\n\r\n        ret.privInternalData = synthBase;\r\n        ret.setupEvents();\r\n        return ret;\r\n    }\r\n\r\n    /**\r\n     * Starts to set up connection to the service.\r\n     * Users can optionally call openConnection() to manually set up a connection in advance before starting recognition on the\r\n     * Recognizer associated with this Connection. After starting recognition, calling Open() will have no effect\r\n     *\r\n     * Note: On return, the connection might not be ready yet. Please subscribe to the Connected event to\r\n     * be notified when the connection is established.\r\n     */\r\n    public openConnection(cb?: () => void, err?: (error: string) => void): void {\r\n        marshalPromiseToCallbacks(this.privInternalData.connect(), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Closes the connection the service.\r\n     * Users can optionally call closeConnection() to manually shutdown the connection of the associated Recognizer.\r\n     *\r\n     * If closeConnection() is called during recognition, recognition will fail and cancel with an error.\r\n     */\r\n    public closeConnection(cb?: () => void, err?: (error: string) => void): void {\r\n        if (this.privInternalData instanceof SynthesisAdapterBase) {\r\n            throw new Error(\"Disconnecting a synthesizer's connection is currently not supported\");\r\n        } else {\r\n            marshalPromiseToCallbacks(this.privInternalData.disconnect(), cb, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Appends a parameter in a message to service.\r\n     * Added in version 1.12.1.\r\n     * @param path The path of the network message.\r\n     * @param propertyName Name of the property\r\n     * @param propertyValue Value of the property. This is a json string.\r\n     */\r\n    public setMessageProperty(path: string, propertyName: string, propertyValue: string | object): void {\r\n        Contracts.throwIfNullOrWhitespace(propertyName, \"propertyName\");\r\n\r\n        if (this.privInternalData instanceof ServiceRecognizerBase) {\r\n            if (path.toLowerCase() !== \"speech.context\") {\r\n                throw new Error(\"Only speech.context message property sets are currently supported for recognizer\");\r\n            } else {\r\n                const context = this.privInternalData.speechContext.getContext();\r\n                context[propertyName] = propertyValue;\r\n            }\r\n        } else if (this.privInternalData instanceof SynthesisAdapterBase) {\r\n            if (path.toLowerCase() !== \"speech.config\" && path.toLowerCase() !== \"synthesis.context\") {\r\n                throw new Error(\"Only speech.config and synthesis.context message paths are currently supported for synthesizer\");\r\n            } else if (path.toLowerCase() === \"speech.config\") {\r\n                if (propertyName.toLowerCase() !== \"context\") {\r\n                    throw new Error(\"Only context property is currently supported for speech.config message path for synthesizer\");\r\n                } else {\r\n                    this.privInternalData.synthesizerConfig.setContextFromJson(propertyValue);\r\n                }\r\n            } else {\r\n                this.privInternalData.synthesisContext.setSection(propertyName, propertyValue);\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Sends a message to the speech service.\r\n     * Added in version 1.13.0.\r\n     * @param path The WebSocket path of the message\r\n     * @param payload The payload of the message. This is a json string or a ArrayBuffer.\r\n     * @param success A callback to indicate success.\r\n     * @param error A callback to indicate an error.\r\n     */\r\n    public sendMessageAsync(path: string, payload: string | ArrayBuffer, success?: () => void, error?: (error: string) => void): void {\r\n        marshalPromiseToCallbacks(this.privInternalData.sendNetworkMessage(path, payload), success, error);\r\n    }\r\n\r\n    /**\r\n     * Any message from service that is not being processed by any other top level recognizers.\r\n     *\r\n     * Will be removed in 2.0.\r\n     */\r\n    public receivedServiceMessage: (args: ServiceEventArgs) => void;\r\n\r\n    /**\r\n     * Any message received from the Speech Service.\r\n     */\r\n    public messageReceived: (args: ConnectionMessageEventArgs) => void;\r\n\r\n    /**\r\n     * Any message sent to the Speech Service.\r\n     */\r\n    public messageSent: (args: ConnectionMessageEventArgs) => void;\r\n\r\n    /**\r\n     * The Connected event to indicate that the recognizer is connected to service.\r\n     */\r\n    public connected: (args: ConnectionEventArgs) => void;\r\n\r\n    /**\r\n     * The Disconnected event to indicate that the recognizer is disconnected from service.\r\n     */\r\n    public disconnected: (args: ConnectionEventArgs) => void;\r\n\r\n    /**\r\n     * Dispose of associated resources.\r\n     */\r\n    public close(): void {\r\n        /* eslint-disable no-empty */\r\n    }\r\n\r\n    private setupEvents(): void {\r\n        this.privEventListener = this.privInternalData.connectionEvents.attach((connectionEvent: ConnectionEvent): void => {\r\n            if (connectionEvent.name === \"ConnectionEstablishedEvent\") {\r\n                if (!!this.connected) {\r\n                    this.connected(new ConnectionEventArgs(connectionEvent.connectionId));\r\n                }\r\n            } else if (connectionEvent.name === \"ConnectionClosedEvent\") {\r\n                if (!!this.disconnected) {\r\n                    this.disconnected(new ConnectionEventArgs(connectionEvent.connectionId));\r\n                }\r\n            } else if (connectionEvent.name === \"ConnectionMessageSentEvent\") {\r\n                if (!!this.messageSent) {\r\n                    this.messageSent(new ConnectionMessageEventArgs(new ConnectionMessageImpl((connectionEvent as ConnectionMessageSentEvent).message)));\r\n                }\r\n            } else if (connectionEvent.name === \"ConnectionMessageReceivedEvent\") {\r\n                if (!!this.messageReceived) {\r\n                    this.messageReceived(new ConnectionMessageEventArgs(new ConnectionMessageImpl((connectionEvent as ConnectionMessageReceivedEvent).message)));\r\n                }\r\n            }\r\n        });\r\n\r\n        this.privServiceEventListener = this.privInternalData.serviceEvents.attach((e: ServiceEvent): void => {\r\n            if (!!this.receivedServiceMessage) {\r\n                this.receivedServiceMessage(new ServiceEventArgs(e.jsonString, e.name));\r\n            }\r\n        });\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    AutoDetectSourceLanguagesOpenRangeOptionName,\r\n    IAuthentication,\r\n    IConnectionFactory,\r\n    RecognizerConfig,\r\n    ServiceRecognizerBase,\r\n    SpeechServiceConfig,\r\n    TranslationConnectionFactory,\r\n    TranslationServiceRecognizer\r\n} from \"../common.speech/Exports.js\";\r\nimport { RecognitionMode } from \"../common.speech/ServiceMessages/PhraseDetection/PhraseDetectionContext.js\";\r\nimport { marshalPromiseToCallbacks } from \"../common/Exports.js\";\r\nimport { AudioConfigImpl } from \"./Audio/AudioConfig.js\";\r\nimport { Connection } from \"./Connection.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport {\r\n    AudioConfig,\r\n    AutoDetectSourceLanguageConfig,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    Recognizer,\r\n    TranslationRecognitionCanceledEventArgs,\r\n    TranslationRecognitionEventArgs,\r\n    TranslationRecognitionResult,\r\n    TranslationSynthesisEventArgs\r\n} from \"./Exports.js\";\r\nimport { SpeechTranslationConfig, SpeechTranslationConfigImpl } from \"./SpeechTranslationConfig.js\";\r\n\r\n/**\r\n * Translation recognizer\r\n * @class TranslationRecognizer\r\n */\r\nexport class TranslationRecognizer extends Recognizer {\r\n    /**\r\n     * The event recognizing signals that an intermediate recognition result is received.\r\n     * @member TranslationRecognizer.prototype.recognizing\r\n     * @function\r\n     * @public\r\n     */\r\n    public recognizing: (sender: TranslationRecognizer, event: TranslationRecognitionEventArgs) => void;\r\n\r\n    /**\r\n     * The event recognized signals that a final recognition result is received.\r\n     * @member TranslationRecognizer.prototype.recognized\r\n     * @function\r\n     * @public\r\n     */\r\n    public recognized: (sender: TranslationRecognizer, event: TranslationRecognitionEventArgs) => void;\r\n\r\n    /**\r\n     * The event canceled signals that an error occurred during recognition.\r\n     * @member TranslationRecognizer.prototype.canceled\r\n     * @function\r\n     * @public\r\n     */\r\n    public canceled: (sender: TranslationRecognizer, event: TranslationRecognitionCanceledEventArgs) => void;\r\n\r\n    /**\r\n     * The event synthesizing signals that a translation synthesis result is received.\r\n     * @member TranslationRecognizer.prototype.synthesizing\r\n     * @function\r\n     * @public\r\n     */\r\n    public synthesizing: (sender: TranslationRecognizer, event: TranslationSynthesisEventArgs) => void;\r\n\r\n    private privDisposedTranslationRecognizer: boolean;\r\n\r\n    /**\r\n     * Initializes an instance of the TranslationRecognizer.\r\n     * @constructor\r\n     * @param {SpeechTranslationConfig} speechConfig - Set of properties to configure this recognizer.\r\n     * @param {AudioConfig} audioConfig - An optional audio config associated with the recognizer\r\n     * @param {IConnectionFactory} connectionFactory - An optional connection factory to use to generate the endpoint URIs, headers to set, etc...\r\n     */\r\n    public constructor(speechConfig: SpeechTranslationConfig, audioConfig?: AudioConfig, connectionFactory?: IConnectionFactory) {\r\n        const configImpl = speechConfig as SpeechTranslationConfigImpl;\r\n        Contracts.throwIfNull(configImpl, \"speechConfig\");\r\n\r\n        super(audioConfig, configImpl.properties, connectionFactory || new TranslationConnectionFactory(), speechConfig.tokenCredential);\r\n\r\n        this.privDisposedTranslationRecognizer = false;\r\n\r\n        if (this.properties.getProperty(PropertyId.SpeechServiceConnection_TranslationVoice, undefined) !== undefined) {\r\n            Contracts.throwIfNullOrWhitespace(\r\n                this.properties.getProperty(PropertyId.SpeechServiceConnection_TranslationVoice),\r\n                PropertyId[PropertyId.SpeechServiceConnection_TranslationVoice]);\r\n        }\r\n\r\n        Contracts.throwIfNullOrWhitespace(\r\n            this.properties.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages),\r\n            PropertyId[PropertyId.SpeechServiceConnection_TranslationToLanguages]);\r\n\r\n        if (this.properties.getProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, undefined) === undefined) {\r\n            Contracts.throwIfNullOrWhitespace(this.properties.getProperty(\r\n                PropertyId.SpeechServiceConnection_RecoLanguage),\r\n                PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage]);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * TranslationRecognizer constructor.\r\n     * @constructor\r\n     * @param {SpeechTranslationConfig} speechTranslationConfig - an set of initial properties for this recognizer\r\n     * @param {AutoDetectSourceLanguageConfig} autoDetectSourceLanguageConfig - An source language detection configuration associated with the recognizer\r\n     * @param {AudioConfig} audioConfig - An optional audio configuration associated with the recognizer\r\n     */\r\n    public static FromConfig(speechTranslationConfig: SpeechTranslationConfig, autoDetectSourceLanguageConfig: AutoDetectSourceLanguageConfig, audioConfig?: AudioConfig): TranslationRecognizer {\r\n        const speechTranslationConfigImpl: SpeechTranslationConfigImpl = speechTranslationConfig as SpeechTranslationConfigImpl;\r\n        autoDetectSourceLanguageConfig.properties.mergeTo(speechTranslationConfigImpl.properties);\r\n\r\n        if (autoDetectSourceLanguageConfig.properties.getProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, undefined) === AutoDetectSourceLanguagesOpenRangeOptionName) {\r\n            speechTranslationConfigImpl.properties.setProperty(PropertyId.SpeechServiceConnection_RecoLanguage, \"en-US\");\r\n        }\r\n        return new TranslationRecognizer(speechTranslationConfig, audioConfig);\r\n    }\r\n\r\n    /**\r\n     * Gets the language name that was set when the recognizer was created.\r\n     * @member TranslationRecognizer.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     * @returns {string} Gets the language name that was set when the recognizer was created.\r\n     */\r\n    public get speechRecognitionLanguage(): string {\r\n        Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer);\r\n\r\n        return this.properties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage);\r\n    }\r\n\r\n    /**\r\n     * Gets target languages for translation that were set when the recognizer was created.\r\n     * The language is specified in BCP-47 format. The translation will provide translated text for each of language.\r\n     * @member TranslationRecognizer.prototype.targetLanguages\r\n     * @function\r\n     * @public\r\n     * @returns {string[]} Gets target languages for translation that were set when the recognizer was created.\r\n     */\r\n    public get targetLanguages(): string[] {\r\n        Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer);\r\n\r\n        return this.properties.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages).split(\",\");\r\n    }\r\n\r\n    /**\r\n     * Gets the name of output voice.\r\n     * @member TranslationRecognizer.prototype.voiceName\r\n     * @function\r\n     * @public\r\n     * @returns {string} the name of output voice.\r\n     */\r\n    public get voiceName(): string {\r\n        Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer);\r\n\r\n        return this.properties.getProperty(PropertyId.SpeechServiceConnection_TranslationVoice, undefined);\r\n    }\r\n\r\n    /**\r\n     * The collection of properties and their values defined for this TranslationRecognizer.\r\n     * @member TranslationRecognizer.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} The collection of properties and their values defined for this TranslationRecognizer.\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    /**\r\n     * Gets the authorization token used to communicate with the service.\r\n     * @member TranslationRecognizer.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @returns {string} Authorization token.\r\n     */\r\n    public get authorizationToken(): string {\r\n        return this.properties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets the authorization token used to communicate with the service.\r\n     * @member TranslationRecognizer.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} value - Authorization token.\r\n     */\r\n    public set authorizationToken(value: string) {\r\n        this.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, value);\r\n    }\r\n\r\n    /**\r\n     * Starts recognition and translation, and stops after the first utterance is recognized.\r\n     * The task returns the translation text as result.\r\n     * Note: recognizeOnceAsync returns when the first utterance has been recognized, so it is suitable only\r\n     * for single shot recognition like command or query. For long-running recognition,\r\n     * use startContinuousRecognitionAsync() instead.\r\n     * @member TranslationRecognizer.prototype.recognizeOnceAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback that received the result when the translation has completed.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public recognizeOnceAsync(cb?: (e: TranslationRecognitionResult) => void, err?: (e: string) => void): void {\r\n        Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer);\r\n        marshalPromiseToCallbacks(this.recognizeOnceAsyncImpl(RecognitionMode.Interactive), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Starts recognition and translation, until stopContinuousRecognitionAsync() is called.\r\n     * User must subscribe to events to receive translation results.\r\n     * @member TranslationRecognizer.prototype.startContinuousRecognitionAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback that received the translation has started.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public startContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void): void {\r\n        marshalPromiseToCallbacks(this.startContinuousRecognitionAsyncImpl(RecognitionMode.Conversation), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Stops continuous recognition and translation.\r\n     * @member TranslationRecognizer.prototype.stopContinuousRecognitionAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback that received the translation has stopped.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public stopContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void): void {\r\n        marshalPromiseToCallbacks(this.stopContinuousRecognitionAsyncImpl(), cb, err);\r\n    }\r\n\r\n    /**\r\n     * dynamically remove a language from list of target language\r\n     * (can be used while recognition is ongoing)\r\n     * @member TranslationRecognizer.prototype.removeTargetLanguage\r\n     * @function\r\n     * @param lang - language to be removed\r\n     * @public\r\n     */\r\n    public removeTargetLanguage(lang: string): void {\r\n        Contracts.throwIfNullOrUndefined(lang, \"language to be removed\");\r\n        if (this.properties.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages, undefined) !== undefined) {\r\n            const languages: string[] = this.properties.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages).split(\",\");\r\n            const index: number = languages.indexOf(lang);\r\n            if (index > -1) {\r\n                languages.splice(index, 1);\r\n                this.properties.setProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages, languages.join(\",\"));\r\n                this.updateLanguages(languages);\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * dynamically add a language to list of target language\r\n     * (can be used while recognition is ongoing)\r\n     * @member TranslationRecognizer.prototype.addTargetLanguage\r\n     * @function\r\n     * @param lang - language to be added\r\n     * @public\r\n     */\r\n    public addTargetLanguage(lang: string): void {\r\n        Contracts.throwIfNullOrUndefined(lang, \"language to be added\");\r\n        let languages: string[] = [];\r\n        if (this.properties.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages, undefined) !== undefined) {\r\n            languages = this.properties.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages).split(\",\");\r\n            if (!languages.includes(lang)) {\r\n                languages.push(lang);\r\n                this.properties.setProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages, languages.join(\",\"));\r\n            }\r\n        } else {\r\n            this.properties.setProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages, lang);\r\n            languages = [lang];\r\n        }\r\n        this.updateLanguages(languages);\r\n    }\r\n\r\n    /**\r\n     * closes all external resources held by an instance of this class.\r\n     * @member TranslationRecognizer.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(cb?: () => void, errorCb?: (error: string) => void): void {\r\n        Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer);\r\n        marshalPromiseToCallbacks(this.dispose(true), cb, errorCb);\r\n    }\r\n\r\n    /**\r\n     * handles ConnectionEstablishedEvent for conversation translation scenarios.\r\n     * @member TranslationRecognizer.prototype.onConnection\r\n     * @function\r\n     * @public\r\n     */\r\n    // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n    public onConnection(): void { }\r\n\r\n    protected async dispose(disposing: boolean): Promise<void> {\r\n        if (this.privDisposedTranslationRecognizer) {\r\n            return;\r\n        }\r\n\r\n        this.privDisposedTranslationRecognizer = true;\r\n\r\n        if (disposing) {\r\n            await this.implRecognizerStop();\r\n            await super.dispose(disposing);\r\n        }\r\n    }\r\n\r\n\r\n    protected createRecognizerConfig(speechConfig: SpeechServiceConfig): RecognizerConfig {\r\n        return new RecognizerConfig(speechConfig, this.privProperties);\r\n    }\r\n\r\n    protected createServiceRecognizer(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioConfig: AudioConfig,\r\n        recognizerConfig: RecognizerConfig): ServiceRecognizerBase {\r\n\r\n        const configImpl: AudioConfigImpl = audioConfig as AudioConfigImpl;\r\n\r\n        return new TranslationServiceRecognizer(authentication, connectionFactory, configImpl, recognizerConfig, this);\r\n    }\r\n\r\n    private updateLanguages(languages: string[]): void {\r\n        const conn: Connection = Connection.fromRecognizer(this);\r\n        if (!!conn) {\r\n            conn.setMessageProperty(\"speech.context\", \"translationcontext\", { to: languages });\r\n\r\n            const voiceName: string = this.properties.getProperty(PropertyId.SpeechServiceConnection_TranslationVoice, undefined);\r\n            let payload: string;\r\n\r\n            if (!!voiceName) {\r\n                const languageToVoiceMap: { [key: string]: string } = {};\r\n                for (const lang of languages) {\r\n                    languageToVoiceMap[lang] = voiceName;\r\n                }\r\n                payload = JSON.stringify({\r\n                    id: \"translation\",\r\n                    name: \"updateLanguage\",\r\n                    synthesis: { defaultVoices: languageToVoiceMap },\r\n                    to: languages,\r\n                });\r\n            } else {\r\n                payload = JSON.stringify({\r\n                    id: \"translation\",\r\n                    name: \"updateLanguage\",\r\n                    to: languages\r\n                });\r\n            }\r\n\r\n            conn.sendMessageAsync(\"event\", payload);\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyCollection } from \"./Exports.js\";\r\n\r\n/**\r\n * Represents collection of parameters and their values.\r\n * @class Translations\r\n */\r\nexport class Translations {\r\n    // Use an PropertyCollection internally, just wrapping it to hide the | enum syntax it has.\r\n    private privMap: PropertyCollection = new PropertyCollection();\r\n\r\n    /**\r\n     * Get the languages in the object in a String array.\r\n     * @member Translations.prototype.languages\r\n     * @function\r\n     * @public\r\n     * @returns {string[]} languages in translations object.\r\n     */\r\n    public get languages(): string[] {\r\n        return this.privMap.keys;\r\n    }\r\n\r\n    /**\r\n     * Returns the parameter value in type String. The parameter must have the same type as String.\r\n     * Currently only String, int and bool are allowed.\r\n     * If the name is not available, the specified defaultValue is returned.\r\n     * @member Translations.prototype.get\r\n     * @function\r\n     * @public\r\n     * @param {string} key - The parameter name.\r\n     * @param {string} def - The default value which is returned if the parameter is not available in the collection.\r\n     * @returns {string} value of the parameter.\r\n     */\r\n    public get(key: string, def?: string): string {\r\n        return this.privMap.getProperty(key, def);\r\n    }\r\n\r\n    /**\r\n     * Sets the String value of the parameter specified by name.\r\n     * @member Translations.prototype.set\r\n     * @function\r\n     * @public\r\n     * @param {string} key - The parameter name.\r\n     * @param {string} value - The value of the parameter.\r\n     */\r\n    public set(key: string, value: string): void {\r\n        this.privMap.setProperty(key, value);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines the possible reasons a recognition result might not be recognized.\r\n * @class NoMatchReason\r\n */\r\nexport enum NoMatchReason {\r\n\r\n    /**\r\n     * Indicates that speech was detected, but not recognized.\r\n     * @member NoMatchReason.NotRecognized\r\n     */\r\n    NotRecognized,\r\n\r\n    /**\r\n     * Indicates that the start of the audio stream contained only silence,\r\n     * and the service timed out waiting for speech.\r\n     * @member NoMatchReason.InitialSilenceTimeout\r\n     */\r\n    InitialSilenceTimeout,\r\n\r\n    /**\r\n     * Indicates that the start of the audio stream contained only noise,\r\n     * and the service timed out waiting for speech.\r\n     * @member NoMatchReason.InitialBabbleTimeout\r\n     */\r\n    InitialBabbleTimeout,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { RecognitionStatus, SimpleSpeechPhrase } from \"../../src/common.speech/Exports.js\";\r\nimport { NoMatchReason, SpeechRecognitionResult, TranslationRecognitionResult } from \"./Exports.js\";\r\n\r\n/**\r\n * Contains detailed information for NoMatch recognition results.\r\n * @class NoMatchDetails\r\n */\r\nexport class NoMatchDetails {\r\n    private privReason: NoMatchReason;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {NoMatchReason} reason - The no-match reason.\r\n     */\r\n    private constructor(reason: NoMatchReason) {\r\n        this.privReason = reason;\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of NoMatchDetails object for the NoMatch SpeechRecognitionResults.\r\n     * @member NoMatchDetails.fromResult\r\n     * @function\r\n     * @public\r\n     * @param {SpeechRecognitionResult | TranslationRecognitionResult}\r\n     * result - The recognition result that was not recognized.\r\n     * @returns {NoMatchDetails} The no match details object being created.\r\n     */\r\n    public static fromResult(result: SpeechRecognitionResult | TranslationRecognitionResult): NoMatchDetails {\r\n        const simpleSpeech: SimpleSpeechPhrase = SimpleSpeechPhrase.fromJSON(result.json, 0); // Offset fixups are already done.\r\n\r\n        let reason: NoMatchReason = NoMatchReason.NotRecognized;\r\n\r\n        switch (simpleSpeech.RecognitionStatus) {\r\n            case RecognitionStatus.BabbleTimeout:\r\n                reason = NoMatchReason.InitialBabbleTimeout;\r\n                break;\r\n            case RecognitionStatus.InitialSilenceTimeout:\r\n                reason = NoMatchReason.InitialSilenceTimeout;\r\n                break;\r\n            default:\r\n                reason = NoMatchReason.NotRecognized;\r\n                break;\r\n        }\r\n        return new NoMatchDetails(reason);\r\n    }\r\n\r\n    /**\r\n     * The reason the recognition was canceled.\r\n     * @member NoMatchDetails.prototype.reason\r\n     * @function\r\n     * @public\r\n     * @returns {NoMatchReason} Specifies the reason canceled.\r\n     */\r\n    public get reason(): NoMatchReason {\r\n        return this.privReason;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { CancellationErrorCode, CancellationReason, TranslationRecognitionResult } from \"./Exports.js\";\r\n\r\n/**\r\n * Define payload of speech recognition canceled result events.\r\n * @class TranslationRecognitionCanceledEventArgs\r\n */\r\nexport class TranslationRecognitionCanceledEventArgs {\r\n    private privResult: TranslationRecognitionResult;\r\n    private privSessionId: string;\r\n    private privCancelReason: CancellationReason;\r\n    private privErrorDetails: string;\r\n    private privErrorCode: CancellationErrorCode;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {string} sessionid - The session id.\r\n     * @param {CancellationReason} cancellationReason - The cancellation reason.\r\n     * @param {string} errorDetails - Error details, if provided.\r\n     * @param {TranslationRecognitionResult} result - The result.\r\n     */\r\n    public constructor(\r\n        sessionid: string,\r\n        cancellationReason: CancellationReason,\r\n        errorDetails: string,\r\n        errorCode: CancellationErrorCode,\r\n        result: TranslationRecognitionResult) {\r\n        this.privCancelReason = cancellationReason;\r\n        this.privErrorDetails = errorDetails;\r\n        this.privResult = result;\r\n        this.privSessionId = sessionid;\r\n        this.privErrorCode = errorCode;\r\n    }\r\n\r\n    /**\r\n     * Specifies the recognition result.\r\n     * @member TranslationRecognitionCanceledEventArgs.prototype.result\r\n     * @function\r\n     * @public\r\n     * @returns {TranslationRecognitionResult} the recognition result.\r\n     */\r\n    public get result(): TranslationRecognitionResult {\r\n        return this.privResult;\r\n    }\r\n\r\n    /**\r\n     * Specifies the session identifier.\r\n     * @member TranslationRecognitionCanceledEventArgs.prototype.sessionId\r\n     * @function\r\n     * @public\r\n     * @returns {string} the session identifier.\r\n     */\r\n    public get sessionId(): string {\r\n        return this.privSessionId;\r\n    }\r\n\r\n    /**\r\n     * The reason the recognition was canceled.\r\n     * @member TranslationRecognitionCanceledEventArgs.prototype.reason\r\n     * @function\r\n     * @public\r\n     * @returns {CancellationReason} Specifies the reason canceled.\r\n     */\r\n    public get reason(): CancellationReason {\r\n        return this.privCancelReason;\r\n    }\r\n\r\n    /**\r\n     * The error code in case of an unsuccessful recognition.\r\n     * Added in version 1.1.0.\r\n     * @return An error code that represents the error reason.\r\n     */\r\n    public get errorCode(): CancellationErrorCode {\r\n        return this.privErrorCode;\r\n    }\r\n\r\n    /**\r\n     * In case of an unsuccessful recognition, provides details of the occurred error.\r\n     * @member TranslationRecognitionCanceledEventArgs.prototype.errorDetails\r\n     * @function\r\n     * @public\r\n     * @returns {string} A String that represents the error details.\r\n     */\r\n    public get errorDetails(): string {\r\n        return this.privErrorDetails;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Contains detailed information about why a result was canceled.\r\n * @class CancellationDetailsBase\r\n */\r\nexport class CancellationDetailsBase {\r\n    private privReason: CancellationReason;\r\n    private privErrorDetails: string;\r\n    private privErrorCode: CancellationErrorCode;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {CancellationReason} reason - The cancellation reason.\r\n     * @param {string} errorDetails - The error details, if provided.\r\n     */\r\n    protected constructor(reason: CancellationReason, errorDetails: string, errorCode: CancellationErrorCode) {\r\n        this.privReason = reason;\r\n        this.privErrorDetails = errorDetails;\r\n        this.privErrorCode = errorCode;\r\n    }\r\n\r\n    /**\r\n     * The reason the recognition was canceled.\r\n     * @member CancellationDetailsBase.prototype.reason\r\n     * @function\r\n     * @public\r\n     * @returns {CancellationReason} Specifies the reason canceled.\r\n     */\r\n    public get reason(): CancellationReason {\r\n        return this.privReason;\r\n    }\r\n\r\n    /**\r\n     * In case of an unsuccessful recognition, provides details of the occurred error.\r\n     * @member CancellationDetailsBase.prototype.errorDetails\r\n     * @function\r\n     * @public\r\n     * @returns {string} A String that represents the error details.\r\n     */\r\n    public get errorDetails(): string {\r\n        return this.privErrorDetails;\r\n    }\r\n\r\n    /**\r\n     * The error code in case of an unsuccessful recognition.\r\n     * Added in version 1.1.0.\r\n     * @return An error code that represents the error reason.\r\n     */\r\n    public get ErrorCode(): CancellationErrorCode {\r\n        return this.privErrorCode;\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { CancellationErrorCodePropertyName, EnumTranslation, SimpleSpeechPhrase } from \"../common.speech/Exports.js\";\r\nimport { CancellationDetailsBase } from \"./CancellationDetailsBase.js\";\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    RecognitionResult,\r\n    SpeechSynthesisResult\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Contains detailed information about why a result was canceled.\r\n * @class CancellationDetails\r\n */\r\nexport class CancellationDetails extends CancellationDetailsBase {\r\n\r\n    private constructor(reason: CancellationReason, errorDetails: string, errorCode: CancellationErrorCode) {\r\n        super(reason, errorDetails, errorCode);\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of CancellationDetails object for the canceled RecognitionResult.\r\n     * @member CancellationDetails.fromResult\r\n     * @function\r\n     * @public\r\n     * @param {RecognitionResult | SpeechSynthesisResult} result - The result that was canceled.\r\n     * @returns {CancellationDetails} The cancellation details object being created.\r\n     */\r\n    public static fromResult(result: RecognitionResult | SpeechSynthesisResult): CancellationDetails {\r\n        let reason = CancellationReason.Error;\r\n        let errorCode: CancellationErrorCode = CancellationErrorCode.NoError;\r\n\r\n        if (result instanceof RecognitionResult && !!result.json) {\r\n            const simpleSpeech: SimpleSpeechPhrase = SimpleSpeechPhrase.fromJSON(result.json, 0); // Offset fixups are already done.\r\n            reason = EnumTranslation.implTranslateCancelResult(simpleSpeech.RecognitionStatus);\r\n        }\r\n\r\n        if (!!result.properties) {\r\n            errorCode = CancellationErrorCode[result.properties.getProperty(CancellationErrorCodePropertyName, CancellationErrorCode[CancellationErrorCode.NoError]) as keyof typeof CancellationErrorCode];\r\n        }\r\n\r\n        return new CancellationDetails(reason, result.errorDetails || EnumTranslation.implTranslateErrorDetails(errorCode), errorCode);\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines error code in case that CancellationReason is Error.\r\n * Added in version 1.1.0.\r\n */\r\nexport enum CancellationErrorCode {\r\n    /**\r\n     * Indicates that no error occurred during speech recognition.\r\n     */\r\n    NoError,\r\n\r\n    /**\r\n     * Indicates an authentication error.\r\n     */\r\n    AuthenticationFailure,\r\n\r\n    /**\r\n     * Indicates that one or more recognition parameters are invalid.\r\n     */\r\n    BadRequestParameters,\r\n\r\n    /**\r\n     * Indicates that the number of parallel requests exceeded the number of allowed\r\n     * concurrent transcriptions for the subscription.\r\n     */\r\n    TooManyRequests,\r\n\r\n    /**\r\n     * Indicates a connection error.\r\n     */\r\n    ConnectionFailure,\r\n\r\n    /**\r\n     * Indicates a time-out error when waiting for response from service.\r\n     */\r\n    ServiceTimeout,\r\n\r\n    /**\r\n     * Indicates that an error is returned by the service.\r\n     */\r\n    ServiceError,\r\n\r\n    /**\r\n     * Indicates an unexpected runtime error.\r\n     */\r\n    RuntimeError,\r\n\r\n    /**\r\n     * Indicates an quota overrun on existing key.\r\n     */\r\n    Forbidden,\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\nimport { SessionEventArgs } from \"./Exports.js\";\r\n\r\n/**\r\n * Defines payload for connection events like Connected/Disconnected.\r\n * Added in version 1.2.0\r\n */\r\nexport class ConnectionEventArgs extends SessionEventArgs {\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\nimport { SessionEventArgs } from \"./Exports.js\";\r\n\r\n/**\r\n * Defines payload for any Service message event\r\n * Added in version 1.9.0\r\n */\r\n\r\nexport class ServiceEventArgs extends SessionEventArgs {\r\n    private privJsonResult: string;\r\n    private privEventName: string;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {string} json - json payload of the USP message.\r\n     */\r\n    public constructor(json: string,  name: string, sessionId?: string) {\r\n        super(sessionId);\r\n        this.privJsonResult = json;\r\n        this.privEventName = name;\r\n    }\r\n\r\n    public get jsonString(): string {\r\n        return this.privJsonResult;\r\n    }\r\n\r\n    public get eventName(): string {\r\n        return this.privEventName;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    DynamicGrammarBuilder,\r\n    ServiceRecognizerBase,\r\n} from \"../common.speech/Exports.js\";\r\nimport {\r\n    ConversationTranscriber,\r\n    MeetingTranscriber,\r\n    Recognizer\r\n} from \"./Exports.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\n\r\n/**\r\n * Allows additions of new phrases to improve speech recognition.\r\n *\r\n * Phrases added to the recognizer are effective at the start of the next recognition, or the next time the SpeechSDK must reconnect\r\n * to the speech service.\r\n */\r\nexport class PhraseListGrammar {\r\n    private privGrammerBuilder: DynamicGrammarBuilder;\r\n\r\n    private constructor(recogBase: ServiceRecognizerBase) {\r\n        this.privGrammerBuilder = recogBase.dynamicGrammar;\r\n    }\r\n\r\n    /**\r\n     * Creates a PhraseListGrammar from a given speech recognizer. Will accept any recognizer that derives from @class Recognizer.\r\n     * @param recognizer The recognizer to add phrase lists to.\r\n     */\r\n    public static fromRecognizer(recognizer: Recognizer | ConversationTranscriber | MeetingTranscriber): PhraseListGrammar {\r\n        const recoBase = recognizer.internalData as ServiceRecognizerBase;\r\n        return new PhraseListGrammar(recoBase);\r\n    }\r\n\r\n    /**\r\n     * Adds a single phrase to the current recognizer.\r\n     * @param phrase Phrase to add.\r\n     */\r\n    public addPhrase(phrase: string): void {\r\n        this.privGrammerBuilder.addPhrase(phrase);\r\n    }\r\n\r\n    /**\r\n     * Adds multiple phrases to the current recognizer.\r\n     * @param phrases Array of phrases to add.\r\n     */\r\n    public addPhrases(phrases: string[]): void {\r\n        this.privGrammerBuilder.addPhrase(phrases);\r\n    }\r\n\r\n    /**\r\n     * Clears all phrases added to the current recognizer.\r\n     */\r\n    public clear(): void {\r\n        this.privGrammerBuilder.clearPhrases();\r\n    }\r\n\r\n    /**\r\n     * Sets the phrase list grammar biasing weight.\r\n     * The allowed range is [0.0, 2.0].\r\n     * The default weight is 1.0. Value zero disables the phrase list.\r\n     * @param weight Phrase list grammar biasing weight.\r\n     */\r\n    public setWeight(weight: number): void {\r\n        Contracts.throwIfNumberOutOfRange(weight, \"weight\", 0.0, 2.0);\r\n        this.privGrammerBuilder.setWeight(weight);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport { PropertyCollection, PropertyId, ServicePropertyChannel, SpeechConfigImpl } from \"./Exports.js\";\r\nimport { OutputFormat } from \"./OutputFormat.js\";\r\n\r\n/**\r\n * Class that defines base configurations for dialog service connector\r\n * @class DialogServiceConfig\r\n */\r\nexport abstract class DialogServiceConfig {\r\n\r\n    /**\r\n     * Creates an instance of DialogService config.\r\n     * @constructor\r\n     */\r\n    protected constructor() {\r\n        return;\r\n    }\r\n\r\n    /**\r\n     * Sets an arbitrary property.\r\n     * @member DialogServiceConfig.prototype.setProperty\r\n     * @function\r\n     * @public\r\n     * @param {string} name - The name of the property to set.\r\n     * @param {string} value - The new value of the property.\r\n     */\r\n    public abstract setProperty(name: string | PropertyId, value: string): void;\r\n\r\n    /**\r\n     * Returns the current value of an arbitrary property.\r\n     * @member DialogServiceConfig.prototype.getProperty\r\n     * @function\r\n     * @public\r\n     * @param {string} name - The name of the property to query.\r\n     * @param {string} def - The value to return in case the property is not known.\r\n     * @returns {string} The current value, or provided default, of the given property.\r\n     */\r\n    public abstract getProperty(name: string | PropertyId, def?: string): string;\r\n\r\n    /**\r\n     * @member DialogServiceConfig.prototype.setServiceProperty\r\n     * @function\r\n     * @public\r\n     * @param {name} The name of the property.\r\n     * @param {value} Value to set.\r\n     * @param {channel} The channel used to pass the specified property to service.\r\n     * @summary Sets a property value that will be passed to service using the specified channel.\r\n     */\r\n    public abstract setServiceProperty(name: string, value: string, channel: ServicePropertyChannel): void;\r\n\r\n    /**\r\n     * Sets the proxy configuration.\r\n     * Only relevant in Node.js environments.\r\n     * Added in version 1.4.0.\r\n     * @param proxyHostName The host name of the proxy server.\r\n     * @param proxyPort The port number of the proxy server.\r\n     */\r\n    public abstract setProxy(proxyHostName: string, proxyPort: number): void;\r\n\r\n    /**\r\n     * Sets the proxy configuration.\r\n     * Only relevant in Node.js environments.\r\n     * Added in version 1.4.0.\r\n     * @param proxyHostName The host name of the proxy server, without the protocol scheme (http://)\r\n     * @param porxyPort The port number of the proxy server.\r\n     * @param proxyUserName The user name of the proxy server.\r\n     * @param proxyPassword The password of the proxy server.\r\n     */\r\n    public abstract setProxy(proxyHostName: string, proxyPort: number, proxyUserName: string, proxyPassword: string): void;\r\n\r\n    /**\r\n     * Returns the configured language.\r\n     * @member DialogServiceConfig.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract get speechRecognitionLanguage(): string;\r\n\r\n    /**\r\n     * Gets/Sets the input language.\r\n     * @member DialogServiceConfig.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The language to use for recognition.\r\n     */\r\n    public abstract set speechRecognitionLanguage(value: string);\r\n\r\n    /**\r\n     * Sets the corresponding backend application identifier.\r\n     * @member DialogServiceConfig.prototype.Conversation_ApplicationId\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The application identifier to set.\r\n     */\r\n    // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n    public set applicationId(value: string) { }\r\n\r\n    public static get DialogTypes(): { BotFramework: string; CustomCommands: string } {\r\n        return {\r\n            BotFramework: \"bot_framework\",\r\n            CustomCommands: \"custom_commands\"\r\n        };\r\n    }\r\n}\r\n\r\n/**\r\n * Dialog Service configuration.\r\n * @class DialogServiceConfigImpl\r\n */\r\nexport class DialogServiceConfigImpl extends DialogServiceConfig {\r\n\r\n    private privSpeechConfig: SpeechConfigImpl;\r\n\r\n    /**\r\n     * Creates an instance of dialogService config.\r\n     */\r\n    public constructor() {\r\n        super();\r\n        this.privSpeechConfig = new SpeechConfigImpl();\r\n    }\r\n\r\n    /**\r\n     * Provides access to custom properties.\r\n     * @member DialogServiceConfigImpl.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} The properties.\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privSpeechConfig.properties;\r\n    }\r\n\r\n    /**\r\n     * Gets the speech recognition language.\r\n     * @member DialogServiceConfigImpl.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     */\r\n    public get speechRecognitionLanguage(): string {\r\n        return this.privSpeechConfig.speechRecognitionLanguage;\r\n    }\r\n\r\n    /**\r\n     * Sets the speech recognition language.\r\n     * @member DialogServiceConfigImpl.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The language to set.\r\n     */\r\n    public set speechRecognitionLanguage(value: string) {\r\n        Contracts.throwIfNullOrWhitespace(value, \"value\");\r\n        this.privSpeechConfig.speechRecognitionLanguage = value;\r\n    }\r\n\r\n    public get outputFormat(): OutputFormat {\r\n        return this.privSpeechConfig.outputFormat;\r\n    }\r\n\r\n    public set outputFormat(value: OutputFormat) {\r\n        this.privSpeechConfig.outputFormat = value;\r\n    }\r\n\r\n    /**\r\n     * Sets a named property as value\r\n     * @member DialogServiceConfigImpl.prototype.setProperty\r\n     * @function\r\n     * @public\r\n     * @param {PropertyId | string} name - The property to set.\r\n     * @param {string} value - The value.\r\n     */\r\n    public setProperty(name: string | PropertyId, value: string): void {\r\n        this.privSpeechConfig.setProperty(name, value);\r\n    }\r\n\r\n    /**\r\n     * Sets a named property as value\r\n     * @member DialogServiceConfigImpl.prototype.getProperty\r\n     * @function\r\n     * @public\r\n     * @param {PropertyId | string} name - The property to get.\r\n     * @param {string} def - The default value to return in case the property is not known.\r\n     * @returns {string} The current value, or provided default, of the given property.\r\n     */\r\n    public getProperty(name: string | PropertyId, def?: string): string {\r\n        void def;\r\n        return this.privSpeechConfig.getProperty(name);\r\n    }\r\n\r\n    /**\r\n     * Sets the proxy configuration.\r\n     * Only relevant in Node.js environments.\r\n     * Added in version 1.4.0.\r\n     * @param proxyHostName The host name of the proxy server, without the protocol scheme (http://)\r\n     * @param proxyPort The port number of the proxy server.\r\n     * @param proxyUserName The user name of the proxy server.\r\n     * @param proxyPassword The password of the proxy server.\r\n     */\r\n    public setProxy(proxyHostName: string, proxyPort: number, proxyUserName?: string, proxyPassword?: string): void {\r\n        this.setProperty(PropertyId.SpeechServiceConnection_ProxyHostName, proxyHostName);\r\n        this.setProperty(PropertyId.SpeechServiceConnection_ProxyPort, `${proxyPort}`);\r\n        if (proxyUserName) {\r\n            this.setProperty(PropertyId.SpeechServiceConnection_ProxyUserName, proxyUserName);\r\n        }\r\n        if (proxyPassword) {\r\n            this.setProperty(PropertyId.SpeechServiceConnection_ProxyPassword, proxyPassword);\r\n        }\r\n    }\r\n\r\n    public setServiceProperty(name: string, value: string, channel: ServicePropertyChannel): void {\r\n        void channel;\r\n        this.privSpeechConfig.setServiceProperty(name, value);\r\n    }\r\n\r\n    /**\r\n     * Dispose of associated resources.\r\n     * @member DialogServiceConfigImpl.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(): void {\r\n        return;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport { DialogServiceConfig, DialogServiceConfigImpl } from \"./DialogServiceConfig.js\";\r\nimport { PropertyId } from \"./Exports.js\";\r\n\r\n/**\r\n * Class that defines configurations for the dialog service connector object for using a Bot Framework backend.\r\n * @class BotFrameworkConfig\r\n */\r\nexport class BotFrameworkConfig extends DialogServiceConfigImpl {\r\n\r\n    /**\r\n     * Creates an instance of BotFrameworkConfig.\r\n     */\r\n    public constructor() {\r\n        super();\r\n    }\r\n\r\n    /**\r\n     * Creates a bot framework configuration instance with the provided subscription information.\r\n     * @member BotFrameworkConfig.fromSubscription\r\n     * @function\r\n     * @public\r\n     * @param subscription Subscription key associated with the bot\r\n     * @param region The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\r\n     * @param botId Optional. Identifier for using a specific bot within an Azure resource group. Equivalent to the\r\n     * resource name.\r\n     * @returns {BotFrameworkConfig} A new bot framework configuration instance.\r\n     */\r\n    public static fromSubscription(subscription: string, region: string, botId?: string): BotFrameworkConfig {\r\n        Contracts.throwIfNullOrWhitespace(subscription, \"subscription\");\r\n        Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n        const botFrameworkConfig: BotFrameworkConfig = new DialogServiceConfigImpl();\r\n        botFrameworkConfig.setProperty(\r\n            PropertyId.Conversation_DialogType,\r\n            DialogServiceConfig.DialogTypes.BotFramework);\r\n        botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Key, subscription);\r\n        botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n\r\n        if (botId) {\r\n            botFrameworkConfig.setProperty(PropertyId.Conversation_ApplicationId, botId);\r\n        }\r\n\r\n        return botFrameworkConfig;\r\n    }\r\n\r\n    /**\r\n     * Creates a bot framework configuration instance for the specified authorization token and region.\r\n     * Note: The caller must ensure that an authorization token is valid. Before an authorization token expires, the\r\n     * caller must refresh it by setting the authorizationToken property on the corresponding\r\n     * DialogServiceConnector instance created with this config. The contents of configuration objects are copied\r\n     * when connectors are created, so setting authorizationToken on a DialogServiceConnector will not update the\r\n     * original configuration's authorization token. Create a new configuration instance or set the\r\n     * SpeechServiceAuthorization_Token property to update an existing instance if it will be used to create\r\n     * further DialogServiceConnectors.\r\n     * @member BotFrameworkConfig.fromAuthorizationToken\r\n     * @function\r\n     * @public\r\n     * @param authorizationToken The authorization token associated with the bot\r\n     * @param region The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\r\n     * @param botId Optional. Identifier for using a specific bot within an Azure resource group. Equivalent to the\r\n     * resource name.\r\n     * @returns {BotFrameworkConfig} A new bot framework configuration instance.\r\n     */\r\n    public static fromAuthorizationToken(\r\n        authorizationToken: string, region: string, botId?: string\r\n    ): BotFrameworkConfig {\r\n        Contracts.throwIfNullOrWhitespace(authorizationToken, \"authorizationToken\");\r\n        Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n        const botFrameworkConfig: BotFrameworkConfig = new DialogServiceConfigImpl();\r\n        botFrameworkConfig.setProperty(\r\n            PropertyId.Conversation_DialogType,\r\n            DialogServiceConfig.DialogTypes.BotFramework);\r\n        botFrameworkConfig.setProperty(PropertyId.SpeechServiceAuthorization_Token, authorizationToken);\r\n        botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n\r\n        if (botId) {\r\n            botFrameworkConfig.setProperty(PropertyId.Conversation_ApplicationId, botId);\r\n        }\r\n\r\n        return botFrameworkConfig;\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of a BotFrameworkConfig.\r\n     * This method is intended only for users who use a non-default service host. The standard resource path will be\r\n     * assumed. For services with a non-standard resource path or no path at all, use fromEndpoint instead.\r\n     * Note: Query parameters are not allowed in the host URI and must be set by other APIs.\r\n     * Note: To use an authorization token with fromHost, use fromHost(URL) and then set the AuthorizationToken\r\n     * property on the created BotFrameworkConfig instance.\r\n     * Note: Added in version 1.15.0.\r\n     * @member BotFrameworkConfig.fromHost\r\n     * @function\r\n     * @public\r\n     * @param {URL | string} host - If a URL is provided, the fully-qualified host with protocol (e.g.\r\n     * wss://your.host.com:1234) will be used. If a string is provided, it will be embedded in\r\n     * wss://{host}.convai.speech.azure.us.\r\n     * @param {string} subscriptionKey - The subscription key. If a subscription key is not specified, an authorization\r\n     * token must be set.\r\n     * @param botId Optional. Identifier for using a specific bot within an Azure resource group. Equivalent to the\r\n     * resource name.\r\n     * @returns {BotFrameworkConfig} A new bot framework configuration instance.\r\n     */\r\n    public static fromHost(\r\n        host: URL | string,\r\n        subscriptionKey?: string,\r\n        botId?: string): BotFrameworkConfig {\r\n\r\n        void botId;\r\n        Contracts.throwIfNullOrUndefined(host, \"host\");\r\n        const resolvedHost: URL = host instanceof URL ? host : new URL(`wss://${host}.convai.speech.azure.us`);\r\n        Contracts.throwIfNullOrUndefined(resolvedHost, \"resolvedHost\");\r\n\r\n        const botFrameworkConfig: BotFrameworkConfig = new DialogServiceConfigImpl();\r\n        botFrameworkConfig.setProperty(\r\n            PropertyId.Conversation_DialogType,\r\n            DialogServiceConfig.DialogTypes.BotFramework);\r\n        botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Host, resolvedHost.toString());\r\n\r\n        if (undefined !== subscriptionKey) {\r\n            botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\r\n        }\r\n\r\n        return botFrameworkConfig;\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of a BotFrameworkConfig.\r\n     * This method is intended only for users who use a non-standard service endpoint or parameters.\r\n     * Note: The query parameters specified in the endpoint URL are not changed, even if they are set by any other APIs.\r\n     * Note: To use authorization token with fromEndpoint, pass an empty string to the subscriptionKey in the\r\n     * fromEndpoint method, and then set authorizationToken=\"token\" on the created BotFrameworkConfig instance to\r\n     * use the authorization token.\r\n     * Note: Added in version 1.15.0.\r\n     * @member BotFrameworkConfig.fromEndpoint\r\n     * @function\r\n     * @public\r\n     * @param {URL} endpoint - The service endpoint to connect to.\r\n     * @param {string} subscriptionKey - The subscription key. If a subscription key is not specified, an authorization\r\n     * token must be set.\r\n     * @returns {BotFrameworkConfig} - A new bot framework configuration instance using the provided endpoint.\r\n     */\r\n    public static fromEndpoint(endpoint: URL, subscriptionKey?: string): BotFrameworkConfig {\r\n        Contracts.throwIfNull(endpoint, \"endpoint\");\r\n\r\n        const botFrameworkConfig: BotFrameworkConfig = new DialogServiceConfigImpl();\r\n        botFrameworkConfig.setProperty(\r\n            PropertyId.Conversation_DialogType,\r\n            DialogServiceConfig.DialogTypes.BotFramework);\r\n        botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Endpoint, endpoint.toString());\r\n\r\n        if (undefined !== subscriptionKey) {\r\n            botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\r\n        }\r\n\r\n        return botFrameworkConfig;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport { DialogServiceConfig, DialogServiceConfigImpl } from \"./DialogServiceConfig.js\";\r\nimport { PropertyId } from \"./Exports.js\";\r\n\r\n/**\r\n * Class that defines configurations for the dialog service connector object for using a CustomCommands backend.\r\n * @class CustomCommandsConfig\r\n */\r\nexport class CustomCommandsConfig extends DialogServiceConfigImpl {\r\n\r\n    /**\r\n     * Creates an instance of CustomCommandsConfig.\r\n     */\r\n    public constructor() {\r\n        super();\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of the bot framework config with the specified subscription and region.\r\n     * @member CustomCommandsConfig.fromSubscription\r\n     * @function\r\n     * @public\r\n     * @param applicationId Speech Commands application id.\r\n     * @param subscription Subscription key associated with the bot\r\n     * @param region The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\r\n     * @returns {CustomCommandsConfig} A new bot framework config.\r\n     */\r\n    public static fromSubscription(applicationId: string, subscription: string, region: string): CustomCommandsConfig {\r\n        Contracts.throwIfNullOrWhitespace(applicationId, \"applicationId\");\r\n        Contracts.throwIfNullOrWhitespace(subscription, \"subscription\");\r\n        Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n        const customCommandsConfig: CustomCommandsConfig = new DialogServiceConfigImpl();\r\n        customCommandsConfig.setProperty(PropertyId.Conversation_DialogType, DialogServiceConfig.DialogTypes.CustomCommands);\r\n        customCommandsConfig.setProperty(PropertyId.Conversation_ApplicationId, applicationId);\r\n        customCommandsConfig.setProperty(PropertyId.SpeechServiceConnection_Key, subscription);\r\n        customCommandsConfig.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n        return customCommandsConfig;\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of the bot framework config with the specified Speech Commands application id, authorization token and region.\r\n     * Note: The caller needs to ensure that the authorization token is valid. Before the authorization token\r\n     * expires, the caller needs to refresh it by calling this setter with a new valid token.\r\n     * As configuration values are copied when creating a new recognizer, the new token value will not apply to recognizers that have already been created.\r\n     * For recognizers that have been created before, you need to set authorization token of the corresponding recognizer\r\n     * to refresh the token. Otherwise, the recognizers will encounter errors during recognition.\r\n     * @member CustomCommandsConfig.fromAuthorizationToken\r\n     * @function\r\n     * @public\r\n     * @param applicationId Speech Commands application id.\r\n     * @param authorizationToken The authorization token associated with the application.\r\n     * @param region The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\r\n     * @returns {CustomCommandsConfig} A new speech commands config.\r\n     */\r\n    public static fromAuthorizationToken(applicationId: string, authorizationToken: string, region: string): CustomCommandsConfig {\r\n        Contracts.throwIfNullOrWhitespace(applicationId, \"applicationId\");\r\n        Contracts.throwIfNullOrWhitespace(authorizationToken, \"authorizationToken\");\r\n        Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n        const customCommandsConfig: CustomCommandsConfig = new DialogServiceConfigImpl();\r\n        customCommandsConfig.setProperty(PropertyId.Conversation_DialogType, DialogServiceConfig.DialogTypes.CustomCommands);\r\n        customCommandsConfig.setProperty(PropertyId.Conversation_ApplicationId, applicationId);\r\n        customCommandsConfig.setProperty(PropertyId.SpeechServiceAuthorization_Token, authorizationToken);\r\n        customCommandsConfig.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n        return customCommandsConfig;\r\n    }\r\n\r\n    /**\r\n     * Sets the corresponding backend application identifier.\r\n     * @member CustomCommandsConfig.prototype.Conversation_ApplicationId\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The application identifier to set.\r\n     */\r\n    public set applicationId(value: string) {\r\n        Contracts.throwIfNullOrWhitespace(value, \"value\");\r\n        this.setProperty(PropertyId.Conversation_ApplicationId, value);\r\n    }\r\n\r\n    /**\r\n     * Gets the corresponding backend application identifier.\r\n     * @member CustomCommandsConfig.prototype.Conversation_ApplicationId\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The application identifier to get.\r\n     */\r\n    public get applicationId(): string {\r\n        return this.getProperty(PropertyId.Conversation_ApplicationId);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport class QueryParameterNames {\r\n    public static BotId: string = \"botid\";\r\n    public static CustomSpeechDeploymentId: string = \"cid\";\r\n    public static CustomVoiceDeploymentId: string = \"deploymentId\";\r\n    public static EnableAudioLogging: string = \"storeAudio\";\r\n    public static EnableLanguageId: string = \"lidEnabled\";\r\n    public static EnableWordLevelTimestamps: string = \"wordLevelTimestamps\";\r\n    public static EndSilenceTimeoutMs: string = \"endSilenceTimeoutMs\";\r\n    public static SegmentationSilenceTimeoutMs: string = \"segmentationSilenceTimeoutMs\";\r\n    public static SegmentationMaximumTimeMs: string = \"segmentationMaximumTimeMs\";\r\n    public static SegmentationStrategy: string = \"segmentationStrategy\";\r\n    public static Format: string = \"format\";\r\n    public static InitialSilenceTimeoutMs: string = \"initialSilenceTimeoutMs\";\r\n    public static Language: string = \"language\";\r\n    public static Profanity: string = \"profanity\";\r\n    public static RequestBotStatusMessages: string = \"enableBotMessageStatus\";\r\n    public static StableIntermediateThreshold: string = \"stableIntermediateThreshold\";\r\n    public static StableTranslation: string = \"stableTranslation\";\r\n    public static TestHooks: string = \"testhooks\";\r\n    public static Postprocessing: string = \"postprocessing\";\r\n    public static CtsMeetingId: string = \"meetingId\";\r\n    public static CtsDeviceId: string = \"deviceId\";\r\n    public static CtsIsParticipant: string = \"isParticipant\";\r\n    public static EnableAvatar: string = \"enableTalkingAvatar\";\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ServicePropertiesPropertyName,\r\n} from \"../common.speech/Exports.js\";\r\nimport { ConnectionRedirectEvent, Events, IConnection, IStringDictionary } from \"../common/Exports.js\";\r\nimport { PropertyId } from \"../sdk/Exports.js\";\r\nimport { AuthInfo, IConnectionFactory, RecognizerConfig } from \"./Exports.js\";\r\nimport { QueryParameterNames } from \"./QueryParameterNames.js\";\r\n\r\nexport abstract class ConnectionFactoryBase implements IConnectionFactory {\r\n\r\n    public static getHostSuffix(region: string): string {\r\n        if (!!region) {\r\n            if (region.toLowerCase().startsWith(\"china\")) {\r\n                return \".azure.cn\";\r\n            }\r\n            if (region.toLowerCase().startsWith(\"usgov\")) {\r\n                return \".azure.us\";\r\n            }\r\n        }\r\n        return \".microsoft.com\";\r\n    }\r\n\r\n    public abstract create(\r\n        config: RecognizerConfig,\r\n        authInfo: AuthInfo,\r\n        connectionId?: string): Promise<IConnection>;\r\n\r\n    protected setCommonUrlParams(\r\n        config: RecognizerConfig,\r\n        queryParams: IStringDictionary<string>,\r\n        endpoint: string): void {\r\n\r\n        const propertyIdToParameterMap: Map<number, string> = new Map([\r\n            [PropertyId.Speech_SegmentationSilenceTimeoutMs, QueryParameterNames.SegmentationSilenceTimeoutMs],\r\n            [PropertyId.SpeechServiceConnection_EnableAudioLogging, QueryParameterNames.EnableAudioLogging],\r\n            [PropertyId.SpeechServiceConnection_EndSilenceTimeoutMs, QueryParameterNames.EndSilenceTimeoutMs],\r\n            [PropertyId.SpeechServiceConnection_InitialSilenceTimeoutMs, QueryParameterNames.InitialSilenceTimeoutMs],\r\n            [PropertyId.SpeechServiceResponse_ProfanityOption, QueryParameterNames.Profanity],\r\n            [PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps, QueryParameterNames.EnableWordLevelTimestamps],\r\n            [PropertyId.SpeechServiceResponse_StablePartialResultThreshold, QueryParameterNames.StableIntermediateThreshold],\r\n        ]);\r\n\r\n        propertyIdToParameterMap.forEach((parameterName: string, propertyId: PropertyId): void => {\r\n            this.setUrlParameter(propertyId, parameterName, config, queryParams, endpoint);\r\n        });\r\n\r\n\r\n        const serviceProperties: IStringDictionary<string> = JSON.parse(config.parameters.getProperty(ServicePropertiesPropertyName, \"{}\")) as IStringDictionary<string>;\r\n\r\n        Object.keys(serviceProperties).forEach((value: string): void => {\r\n            queryParams[value] = serviceProperties[value];\r\n        });\r\n    }\r\n\r\n    protected setUrlParameter(\r\n        propId: PropertyId,\r\n        parameterName: string,\r\n        config: RecognizerConfig,\r\n        queryParams: IStringDictionary<string>,\r\n        endpoint: string): void {\r\n\r\n        const value: string = config.parameters.getProperty(propId, undefined);\r\n\r\n        // FIXME: The .search() check will incorrectly match parameter name anywhere in the string\r\n        //        including e.g. the path portion, or even as a substring of other query parameters\r\n        if (value && (!endpoint || endpoint.search(parameterName) === -1)) {\r\n            queryParams[parameterName] = value.toLocaleLowerCase();\r\n        }\r\n    }\r\n\r\n    public static async getRedirectUrlFromEndpoint(endpoint: string): Promise<string> {\r\n        // make a rest call to the endpoint to get the redirect url\r\n        const redirectUrl: URL = new URL(endpoint);\r\n        redirectUrl.protocol = \"https:\";\r\n        redirectUrl.port = \"443\";\r\n        const params: URLSearchParams = redirectUrl.searchParams;\r\n        params.append(\"GenerateRedirectResponse\", \"true\");\r\n\r\n        const redirectedUrlString: string = redirectUrl.toString();\r\n        Events.instance.onEvent(new ConnectionRedirectEvent(\"\", redirectedUrlString, undefined, \"ConnectionFactoryBase: redirectUrl request\"));\r\n\r\n        const redirectResponse: Response = await fetch(redirectedUrlString);\r\n\r\n        if (redirectResponse.status !== 200) {\r\n            return endpoint;\r\n        }\r\n\r\n        // Fix: properly read the response text\r\n        const redirectUrlString = await redirectResponse.text();\r\n\r\n        Events.instance.onEvent(new ConnectionRedirectEvent(\"\", redirectUrlString, endpoint, \"ConnectionFactoryBase: redirectUrlString\"));\r\n\r\n        try {\r\n            // Validate the URL before returning\r\n            const redirectUrl = new URL(redirectUrlString.trim());\r\n            if (redirectUrl.protocol === \"https:\") {\r\n                redirectUrl.protocol = \"wss:\";\r\n            } else if (redirectUrl.protocol === \"http:\") {\r\n                redirectUrl.protocol = \"ws:\";\r\n            }\r\n\r\n            return redirectUrl.toString();\r\n        } catch (error) {\r\n            return endpoint; // Return original endpoint if the redirect URL is invalid\r\n        }\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\nimport {\r\n    ProxyInfo,\r\n    WebsocketConnection,\r\n} from \"../common.browser/Exports.js\";\r\nimport { OutputFormatPropertyName } from \"../common.speech/Exports.js\";\r\nimport { IConnection, IStringDictionary } from \"../common/Exports.js\";\r\nimport { DialogServiceConfig, OutputFormat, PropertyId } from \"../sdk/Exports.js\";\r\nimport { ConnectionFactoryBase } from \"./ConnectionFactoryBase.js\";\r\nimport { AuthInfo, RecognizerConfig, WebsocketMessageFormatter } from \"./Exports.js\";\r\nimport { HeaderNames } from \"./HeaderNames.js\";\r\nimport { QueryParameterNames } from \"./QueryParameterNames.js\";\r\n\r\nexport class DialogConnectionFactory extends ConnectionFactoryBase {\r\n\r\n    private static readonly ApiKey: string = \"api\";\r\n    private static readonly BaseUrl: string = \"convai.speech\";\r\n\r\n    public create(\r\n        config: RecognizerConfig,\r\n        authInfo: AuthInfo,\r\n        connectionId?: string): Promise<IConnection> {\r\n\r\n        const applicationId: string = config.parameters.getProperty(PropertyId.Conversation_ApplicationId, \"\");\r\n        const dialogType: string = config.parameters.getProperty(PropertyId.Conversation_DialogType);\r\n        const region: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Region);\r\n        const language: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage, \"en-US\");\r\n        const requestTurnStatus: string = config.parameters.getProperty(PropertyId.Conversation_Request_Bot_Status_Messages, \"true\");\r\n\r\n        const queryParams: IStringDictionary<string> = {};\r\n        queryParams[HeaderNames.ConnectionId] = connectionId;\r\n        queryParams[QueryParameterNames.Format] = config.parameters.getProperty(OutputFormatPropertyName, OutputFormat[OutputFormat.Simple]).toLowerCase();\r\n        queryParams[QueryParameterNames.Language] = language;\r\n        queryParams[QueryParameterNames.RequestBotStatusMessages] = requestTurnStatus;\r\n        if (applicationId) {\r\n            queryParams[QueryParameterNames.BotId] = applicationId;\r\n            if (dialogType === DialogServiceConfig.DialogTypes.CustomCommands) {\r\n                queryParams[HeaderNames.CustomCommandsAppId] = applicationId;\r\n            }\r\n        }\r\n\r\n        const resourceInfix: string =\r\n            dialogType === DialogServiceConfig.DialogTypes.CustomCommands ? \"commands/\"\r\n            : \"\";\r\n        const version: string =\r\n            dialogType === DialogServiceConfig.DialogTypes.CustomCommands ? \"v1\"\r\n            : dialogType === DialogServiceConfig.DialogTypes.BotFramework ? \"v3\"\r\n            : \"v0\";\r\n\r\n        const headers: IStringDictionary<string> = {};\r\n\r\n        if (authInfo.token != null && authInfo.token !== \"\") {\r\n            headers[authInfo.headerName] = authInfo.token;\r\n        }\r\n\r\n        // The URL used for connection is chosen in a priority order of specification:\r\n        //  1. If a custom endpoint is provided, that URL is used verbatim.\r\n        //  2. If a custom host is provided (e.g. \"wss://my.custom.endpoint.com:1123\"), a URL is constructed from it.\r\n        //  3. If no custom connection details are provided, a URL is constructed from default values.\r\n        let endpoint: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint, \"\");\r\n        if (!endpoint) {\r\n            const hostSuffix: string = ConnectionFactoryBase.getHostSuffix(region);\r\n            const host: string = config.parameters.getProperty(\r\n                PropertyId.SpeechServiceConnection_Host,\r\n                `wss://${region}.${DialogConnectionFactory.BaseUrl}${hostSuffix}`);\r\n            const standardizedHost: string = host.endsWith(\"/\") ? host : host + \"/\";\r\n            endpoint = `${standardizedHost}${resourceInfix}${DialogConnectionFactory.ApiKey}/${version}`;\r\n        }\r\n\r\n        this.setCommonUrlParams(config, queryParams, endpoint);\r\n\r\n        const enableCompression: boolean = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\r\n        return Promise.resolve(new WebsocketConnection(endpoint, queryParams, headers, new WebsocketMessageFormatter(), ProxyInfo.fromRecognizerConfig(config), enableCompression, connectionId));\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { DialogConnectionFactory } from \"../common.speech/DialogConnectorFactory.js\";\r\nimport {\r\n    DialogServiceAdapter,\r\n    IAgentConfig,\r\n    IAuthentication,\r\n    IConnectionFactory,\r\n    RecognizerConfig,\r\n    ServiceRecognizerBase,\r\n    SpeechServiceConfig\r\n} from \"../common.speech/Exports.js\";\r\nimport { RecognitionMode } from \"../common.speech/ServiceMessages/PhraseDetection/PhraseDetectionContext.js\";\r\nimport {\r\n    Deferred,\r\n    marshalPromiseToCallbacks\r\n} from \"../common/Exports.js\";\r\nimport { ActivityReceivedEventArgs } from \"./ActivityReceivedEventArgs.js\";\r\nimport { AudioConfigImpl } from \"./Audio/AudioConfig.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport { DialogServiceConfig, DialogServiceConfigImpl } from \"./DialogServiceConfig.js\";\r\nimport {\r\n    AudioConfig,\r\n    PropertyCollection,\r\n    Recognizer,\r\n    SpeechRecognitionCanceledEventArgs,\r\n    SpeechRecognitionEventArgs,\r\n    SpeechRecognitionResult\r\n} from \"./Exports.js\";\r\nimport { PropertyId } from \"./PropertyId.js\";\r\nimport { TurnStatusReceivedEventArgs } from \"./TurnStatusReceivedEventArgs.js\";\r\n\r\n/**\r\n * Dialog Service Connector\r\n * @class DialogServiceConnector\r\n */\r\nexport class DialogServiceConnector extends Recognizer {\r\n    private privIsDisposed: boolean;\r\n    private isTurnComplete: boolean;\r\n\r\n    /**\r\n     * Initializes an instance of the DialogServiceConnector.\r\n     * @constructor\r\n     * @param {DialogServiceConfig} dialogConfig - Set of properties to configure this recognizer.\r\n     * @param {AudioConfig} audioConfig - An optional audio config associated with the recognizer\r\n     */\r\n    public constructor(dialogConfig: DialogServiceConfig, audioConfig?: AudioConfig) {\r\n        const dialogServiceConfigImpl = dialogConfig as DialogServiceConfigImpl;\r\n        Contracts.throwIfNull(dialogConfig, \"dialogConfig\");\r\n\r\n        super(audioConfig, dialogServiceConfigImpl.properties, new DialogConnectionFactory());\r\n\r\n        this.isTurnComplete = true;\r\n        this.privIsDisposed = false;\r\n        this.privProperties = dialogServiceConfigImpl.properties.clone();\r\n\r\n        const agentConfig = this.buildAgentConfig();\r\n        this.privReco.agentConfig.set(agentConfig);\r\n    }\r\n\r\n    /**\r\n     * The event recognizing signals that an intermediate recognition result is received.\r\n     * @member DialogServiceConnector.prototype.recognizing\r\n     * @function\r\n     * @public\r\n     */\r\n    public recognizing: (sender: DialogServiceConnector, event: SpeechRecognitionEventArgs) => void;\r\n\r\n    /**\r\n     * The event recognized signals that a final recognition result is received.\r\n     * @member DialogServiceConfig.prototype.recognized\r\n     * @function\r\n     * @public\r\n     */\r\n    public recognized: (sender: DialogServiceConnector, event: SpeechRecognitionEventArgs) => void;\r\n\r\n    /**\r\n     * The event canceled signals that an error occurred during recognition.\r\n     * @member DialogServiceConnector.prototype.canceled\r\n     * @function\r\n     * @public\r\n     */\r\n    public canceled: (sender: DialogServiceConnector, event: SpeechRecognitionCanceledEventArgs) => void;\r\n\r\n    /**\r\n     * The event activityReceived signals that an activity has been received.\r\n     * @member DialogServiceConnector.prototype.activityReceived\r\n     * @function\r\n     * @public\r\n     */\r\n    public activityReceived: (sender: DialogServiceConnector, event: ActivityReceivedEventArgs) => void;\r\n\r\n    /**\r\n     * The event turnStatusReceived signals that a turn status message has been received. These messages are\r\n     * associated with both an interaction and a conversation. They are used to notify the client in the event\r\n     * of an interaction failure with the dialog backend, e.g. in the event of a network issue, timeout, crash,\r\n     * or other problem.\r\n     * @member DialogServiceConnector.prototype.turnStatusReceived\r\n     * @function\r\n     * @public\r\n     */\r\n    public turnStatusReceived: (sender: DialogServiceConnector, event: TurnStatusReceivedEventArgs) => void;\r\n\r\n    /**\r\n     * Starts a connection to the service.\r\n     * Users can optionally call connect() to manually set up a connection in advance, before starting interactions.\r\n     *\r\n     * Note: On return, the connection might not be ready yet. Please subscribe to the Connected event to\r\n     * be notified when the connection is established.\r\n     * @member DialogServiceConnector.prototype.connect\r\n     * @function\r\n     * @public\r\n     */\r\n    public connect(cb?: () => void, err?: (error: string) => void): void {\r\n        marshalPromiseToCallbacks(this.privReco.connect(), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Closes the connection the service.\r\n     * Users can optionally call disconnect() to manually shutdown the connection of the associated DialogServiceConnector.\r\n     *\r\n     * If disconnect() is called during a recognition, recognition will fail and cancel with an error.\r\n     */\r\n    public disconnect(cb?: () => void, err?: (error: string) => void): void {\r\n        marshalPromiseToCallbacks(this.privReco.disconnect(), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Gets the authorization token used to communicate with the service.\r\n     * @member DialogServiceConnector.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @returns {string} Authorization token.\r\n     */\r\n    public get authorizationToken(): string {\r\n        return this.properties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n    }\r\n\r\n    /**\r\n     * Sets the authorization token used to communicate with the service.\r\n     * @member DialogServiceConnector.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} token - Authorization token.\r\n     */\r\n    public set authorizationToken(token: string) {\r\n        Contracts.throwIfNullOrWhitespace(token, \"token\");\r\n        this.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, token);\r\n    }\r\n\r\n    /**\r\n     * The collection of properties and their values defined for this DialogServiceConnector.\r\n     * @member DialogServiceConnector.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} The collection of properties and their values defined for this DialogServiceConnector.\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    /** Gets the template for the activity generated by service from speech.\r\n     * Properties from the template will be stamped on the generated activity.\r\n     * It can be empty\r\n     */\r\n    public get speechActivityTemplate(): string {\r\n        return this.properties.getProperty(PropertyId.Conversation_Speech_Activity_Template);\r\n    }\r\n\r\n    /** Sets the template for the activity generated by service from speech.\r\n     * Properties from the template will be stamped on the generated activity.\r\n     * It can be null or empty.\r\n     * Note: it has to be a valid Json object.\r\n     */\r\n    public set speechActivityTemplate(speechActivityTemplate: string) {\r\n        this.properties.setProperty(PropertyId.Conversation_Speech_Activity_Template, speechActivityTemplate);\r\n    }\r\n\r\n    /**\r\n     * Starts recognition and stops after the first utterance is recognized.\r\n     * @member DialogServiceConnector.prototype.listenOnceAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback that received the result when the reco has completed.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public listenOnceAsync(cb?: (e: SpeechRecognitionResult) => void, err?: (e: string) => void): void {\r\n        if (this.isTurnComplete) {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            const callbackHolder = async (): Promise<SpeechRecognitionResult> => {\r\n                await this.privReco.connect();\r\n                await this.implRecognizerStop();\r\n                this.isTurnComplete = false;\r\n\r\n                const ret: Deferred<SpeechRecognitionResult> = new Deferred<SpeechRecognitionResult>();\r\n                await this.privReco.recognize(RecognitionMode.Conversation, ret.resolve, ret.reject);\r\n\r\n                const e: SpeechRecognitionResult = await ret.promise;\r\n                await this.implRecognizerStop();\r\n\r\n                return e;\r\n            };\r\n\r\n            const retPromise: Promise<SpeechRecognitionResult> = callbackHolder();\r\n\r\n            retPromise.catch((): void => {\r\n                // Destroy the recognizer.\r\n                // We've done all we can here.\r\n                // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n                this.dispose(true).catch((): void => { });\r\n            });\r\n\r\n            marshalPromiseToCallbacks(retPromise.finally((): void => {\r\n                this.isTurnComplete = true;\r\n            }), cb, err);\r\n        }\r\n    }\r\n\r\n    public sendActivityAsync(activity: string, cb?: () => void, errCb?: (error: string) => void): void {\r\n        marshalPromiseToCallbacks((this.privReco as DialogServiceAdapter).sendMessage(activity), cb, errCb);\r\n    }\r\n\r\n    /**\r\n     * closes all external resources held by an instance of this class.\r\n     * @member DialogServiceConnector.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(cb?: () => void, err?: (error: string) => void): void {\r\n        Contracts.throwIfDisposed(this.privIsDisposed);\r\n\r\n        marshalPromiseToCallbacks(this.dispose(true), cb, err);\r\n    }\r\n\r\n    protected async dispose(disposing: boolean): Promise<void> {\r\n        if (this.privIsDisposed) {\r\n            return;\r\n        }\r\n\r\n        if (disposing) {\r\n            this.privIsDisposed = true;\r\n            await this.implRecognizerStop();\r\n            await super.dispose(disposing);\r\n        }\r\n    }\r\n\r\n    protected createRecognizerConfig(speechConfig: SpeechServiceConfig): RecognizerConfig {\r\n        return new RecognizerConfig(speechConfig, this.privProperties);\r\n    }\r\n\r\n    protected createServiceRecognizer(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioConfig: AudioConfig,\r\n        recognizerConfig: RecognizerConfig): ServiceRecognizerBase {\r\n\r\n        const audioSource: AudioConfigImpl = audioConfig as AudioConfigImpl;\r\n\r\n        return new DialogServiceAdapter(authentication, connectionFactory, audioSource, recognizerConfig, this);\r\n    }\r\n\r\n    private buildAgentConfig(): IAgentConfig {\r\n        const communicationType = this.properties.getProperty(\"Conversation_Communication_Type\", \"Default\");\r\n\r\n        return {\r\n            botInfo: {\r\n                commType: communicationType,\r\n                commandsCulture: undefined,\r\n                connectionId: this.properties.getProperty(PropertyId.Conversation_Agent_Connection_Id),\r\n                conversationId: this.properties.getProperty(PropertyId.Conversation_Conversation_Id, undefined),\r\n                fromId: this.properties.getProperty(PropertyId.Conversation_From_Id, undefined),\r\n                ttsAudioFormat: this.properties.getProperty(PropertyId.SpeechServiceConnection_SynthOutputFormat, undefined)\r\n            },\r\n            version: 0.2\r\n        };\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\nimport { PullAudioOutputStream } from \"./Audio/AudioOutputStream.js\";\r\n\r\ninterface IActivity {\r\n    conversation?: any;\r\n    id?: string;\r\n    replyToId?: string;\r\n    type?: string;\r\n    text?: string;\r\n    speak?: any;\r\n}\r\n\r\n/**\r\n * Defines contents of received message/events.\r\n * @class ActivityReceivedEventArgs\r\n */\r\nexport class ActivityReceivedEventArgs {\r\n    private privActivity: IActivity;\r\n    private privAudioStream: PullAudioOutputStream;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {any} activity - The activity..\r\n     */\r\n    public constructor(activity: any, audioStream?: PullAudioOutputStream) {\r\n        this.privActivity = activity as IActivity;\r\n        this.privAudioStream = audioStream;\r\n    }\r\n\r\n    /**\r\n     * Gets the received activity\r\n     * @member ActivityReceivedEventArgs.prototype.activity\r\n     * @function\r\n     * @public\r\n     * @returns {any} the received activity.\r\n     */\r\n    public get activity(): any {\r\n        return this.privActivity;\r\n    }\r\n\r\n    public get audioStream(): PullAudioOutputStream {\r\n        return this.privAudioStream;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport interface ITurnStatusResponsePayload {\r\n    interactionId: string;\r\n    conversationId: string;\r\n    statusCode: any;\r\n}\r\n\r\nexport class TurnStatusResponsePayload implements ITurnStatusResponsePayload {\r\n    private privMessageStatusResponse: ITurnStatusResponsePayload;\r\n\r\n    private constructor(json: string) {\r\n        this.privMessageStatusResponse = JSON.parse(json) as ITurnStatusResponsePayload;\r\n    }\r\n\r\n    public static fromJSON(json: string): TurnStatusResponsePayload {\r\n        return new TurnStatusResponsePayload(json);\r\n    }\r\n\r\n    public get interactionId(): string {\r\n        return this.privMessageStatusResponse.interactionId;\r\n    }\r\n\r\n    public get conversationId(): string {\r\n        return this.privMessageStatusResponse.conversationId;\r\n    }\r\n\r\n    public get statusCode(): any {\r\n        // Payloads may contain a limited set of textual representations or a numeric status\r\n        // code. The textual values are here converted into numeric ones.\r\n        switch (this.privMessageStatusResponse.statusCode) {\r\n            case \"Success\":\r\n                return 200;\r\n            case \"Failed\":\r\n                return 400;\r\n            case \"TimedOut\":\r\n                return 429;\r\n            default:\r\n                // eslint-disable-next-line @typescript-eslint/no-unsafe-return\r\n                return this.privMessageStatusResponse.statusCode;\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ITurnStatusResponsePayload,\r\n    TurnStatusResponsePayload\r\n    } from \"../common.speech/ServiceMessages/TurnStatusPayload.js\";\r\n\r\n/**\r\n * Defines contents of received message/events.\r\n * @class TurnStatusReceivedEventArgs\r\n */\r\nexport class TurnStatusReceivedEventArgs {\r\n    private privTurnStatus: ITurnStatusResponsePayload;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {string} turnStatus - The JSON-encoded turn status message.\r\n     */\r\n    public constructor(turnStatus: string) {\r\n        this.privTurnStatus = TurnStatusResponsePayload.fromJSON(turnStatus);\r\n    }\r\n\r\n    /**\r\n     * Gets the interaction identifier associated with this turn status event.\r\n     * @member TurnStatusReceivedEventArgs.prototype.interactionId\r\n     * @function\r\n     * @public\r\n     * @returns {any} the received interaction id.\r\n     */\r\n    public get interactionId(): any {\r\n        return this.privTurnStatus.interactionId;\r\n    }\r\n\r\n    /**\r\n     * Gets the conversation identifier associated with this turn status event.\r\n     * @member TurnStatusReceivedEventArgs.prototype.conversationId\r\n     * @function\r\n     * @public\r\n     * @returns {any} the received conversation id.\r\n     */\r\n    public get conversationId(): any {\r\n        return this.privTurnStatus.conversationId;\r\n    }\r\n\r\n    /**\r\n     * Gets the received turn status code.\r\n     * @member TurnStatusReceivedEventArgs.prototype.statusCode\r\n     * @function\r\n     * @public\r\n     * @returns {number} the received turn status.\r\n     */\r\n    public get statusCode(): number {\r\n        return this.privTurnStatus.statusCode; // eslint-disable-line @typescript-eslint/no-unsafe-return\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines channels used to pass property settings to service.\r\n * Added in version 1.7.0.\r\n */\r\nexport enum ServicePropertyChannel {\r\n    /**\r\n     * Uses URI query parameter to pass property settings to service.\r\n     */\r\n    UriQueryParameter = 0.\r\n}\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Profanity option.\r\n * Added in version 1.7.0.\r\n */\r\nexport enum ProfanityOption {\r\n    Masked = 0,\r\n    Removed = 1,\r\n    Raw = 2\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { InvalidOperationError } from \"../../common/Error.js\";\r\nimport { AudioStreamFormat } from \"../Exports.js\";\r\nimport { AudioStreamFormatImpl } from \"./AudioStreamFormat.js\";\r\n\r\ntype AudioDataTypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array;\r\n/**\r\n * Base audio player class\r\n * TODO: Plays only PCM for now.\r\n * @class\r\n */\r\nexport class BaseAudioPlayer {\r\n\r\n    private audioContext: AudioContext = null;\r\n    private gainNode: GainNode = null;\r\n    private audioFormat: AudioStreamFormatImpl;\r\n    private autoUpdateBufferTimer: any = 0;\r\n    private samples: Float32Array;\r\n    private startTime: number;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {AudioStreamFormat} audioFormat audio stream format recognized by the player.\r\n     */\r\n    public constructor(audioFormat?: AudioStreamFormat) {\r\n        if (audioFormat === undefined) {\r\n            audioFormat = AudioStreamFormat.getDefaultInputFormat();\r\n        }\r\n        this.init(audioFormat);\r\n    }\r\n\r\n    /**\r\n     * play Audio sample\r\n     * @param newAudioData audio data to be played.\r\n     */\r\n    public playAudioSample(newAudioData: ArrayBuffer, cb?: () => void, err?: (error: string) => void): void {\r\n        try {\r\n            this.ensureInitializedContext();\r\n            const audioData = this.formatAudioData(newAudioData);\r\n            const newSamplesData = new Float32Array(this.samples.length + audioData.length);\r\n            newSamplesData.set(this.samples, 0);\r\n            newSamplesData.set(audioData, this.samples.length);\r\n            this.samples = newSamplesData;\r\n            if (!!cb) {\r\n                cb();\r\n            }\r\n        } catch (e) {\r\n            if (!!err) {\r\n                err(e as string);\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * stops audio and clears the buffers\r\n     */\r\n    public stopAudio(cb?: () => void, err?: (error: string) => void): void {\r\n        if (this.audioContext !== null) {\r\n            this.samples = new Float32Array();\r\n            // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\r\n            clearInterval(this.autoUpdateBufferTimer);\r\n            this.audioContext.close().then((): void => {\r\n                if (!!cb) {\r\n                    cb();\r\n                }\r\n            }, (error: string): void => {\r\n                if (!!err) {\r\n                    err(error);\r\n                }\r\n            });\r\n            this.audioContext = null;\r\n        }\r\n    }\r\n\r\n    private init(audioFormat: AudioStreamFormat): void {\r\n        this.audioFormat = audioFormat as AudioStreamFormatImpl;\r\n        this.samples = new Float32Array();\r\n    }\r\n\r\n    private ensureInitializedContext(): void {\r\n        if (this.audioContext === null) {\r\n            this.createAudioContext();\r\n            const timerPeriod = 200;\r\n            this.autoUpdateBufferTimer = setInterval((): void => {\r\n                this.updateAudioBuffer();\r\n            }, timerPeriod);\r\n        }\r\n    }\r\n\r\n    private createAudioContext(): void {\r\n        // new ((window as any).AudioContext || (window as any).webkitAudioContext)();\r\n        this.audioContext = AudioStreamFormatImpl.getAudioContext();\r\n\r\n        // TODO: Various examples shows this gain node, it does not seem to be needed unless we plan\r\n        // to control the volume, not likely\r\n        this.gainNode = this.audioContext.createGain();\r\n        this.gainNode.gain.value = 1;\r\n        this.gainNode.connect(this.audioContext.destination);\r\n        this.startTime = this.audioContext.currentTime;\r\n    }\r\n\r\n    private formatAudioData(audioData: ArrayBuffer): Float32Array {\r\n        switch (this.audioFormat.bitsPerSample) {\r\n            case 8:\r\n                return this.formatArrayBuffer(new Int8Array(audioData), 128);\r\n            case 16:\r\n                return this.formatArrayBuffer(new Int16Array(audioData), 32768);\r\n            case 32:\r\n                return this.formatArrayBuffer(new Int32Array(audioData), 2147483648);\r\n            default:\r\n                throw new InvalidOperationError(\"Only WAVE_FORMAT_PCM (8/16/32 bps) format supported at this time\");\r\n        }\r\n    }\r\n\r\n    private formatArrayBuffer(audioData: AudioDataTypedArray, maxValue: number): Float32Array {\r\n        const float32Data = new Float32Array(audioData.length);\r\n        for (let i = 0; i < audioData.length; i++) {\r\n            float32Data[i] = audioData[i] / maxValue;\r\n        }\r\n        return float32Data;\r\n    }\r\n\r\n    private updateAudioBuffer(): void {\r\n        if (this.samples.length === 0) {\r\n            return;\r\n        }\r\n\r\n        const channelCount = this.audioFormat.channels;\r\n        const bufferSource = this.audioContext.createBufferSource();\r\n        const frameCount = this.samples.length / channelCount;\r\n        const audioBuffer = this.audioContext.createBuffer(channelCount, frameCount, this.audioFormat.samplesPerSec);\r\n\r\n        // TODO: Should we do the conversion in the pushAudioSample instead?\r\n        for (let channel = 0; channel < channelCount; channel++) {\r\n            // Fill in individual channel data\r\n            let channelOffset = channel;\r\n            const audioData = audioBuffer.getChannelData(channel);\r\n            for (let i = 0; i < this.samples.length; i++, channelOffset += channelCount) {\r\n                audioData[i] = this.samples[channelOffset];\r\n            }\r\n        }\r\n\r\n        if (this.startTime < this.audioContext.currentTime) {\r\n            this.startTime = this.audioContext.currentTime;\r\n        }\r\n\r\n        bufferSource.buffer = audioBuffer;\r\n        bufferSource.connect(this.gainNode);\r\n        bufferSource.start(this.startTime);\r\n\r\n        // Make sure we play the next sample after the current one.\r\n        this.startTime += audioBuffer.duration;\r\n\r\n        // Clear the samples for the next pushed data.\r\n        this.samples = new Float32Array();\r\n    }\r\n\r\n    private async playAudio(audioData: ArrayBuffer): Promise<void> {\r\n        if (this.audioContext === null) {\r\n            this.createAudioContext();\r\n        }\r\n        const source: AudioBufferSourceNode = this.audioContext.createBufferSource();\r\n        const destination: AudioDestinationNode = this.audioContext.destination;\r\n        await this.audioContext.decodeAudioData(audioData, (newBuffer: AudioBuffer): void => {\r\n            source.buffer = newBuffer;\r\n            source.connect(destination);\r\n            source.start(0);\r\n        });\r\n    }\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\nimport {\r\n    ConnectionMessage\r\n} from \"./Exports.js\";\r\n\r\nexport class ConnectionMessageEventArgs {\r\n\r\n    private privConnectionMessage: ConnectionMessage;\r\n\r\n    public constructor(message: ConnectionMessage) {\r\n        this.privConnectionMessage = message;\r\n    }\r\n\r\n    /**\r\n     * Gets the <see cref=\"ConnectionMessage\"/> associated with this <see cref=\"ConnectionMessageEventArgs\"/>.\r\n     */\r\n    public get message(): ConnectionMessage {\r\n        return this.privConnectionMessage;\r\n    }\r\n\r\n    /**\r\n     * Returns a string that represents the connection message event.\r\n     */\r\n    public toString(): string {\r\n        return \"Message: \" + this.privConnectionMessage.toString();\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Language Identification mode\r\n * @class LanguageIdMode\r\n */\r\nexport enum LanguageIdMode {\r\n\r\n    /**\r\n     * Detect language at audio start\r\n     * @member LanguageIdMode.AtStart\r\n     */\r\n    AtStart,\r\n\r\n    /**\r\n     * Continuously detect language\r\n     * @member LanguageIdMode.Continuous\r\n     */\r\n    Continuous,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { AutoDetectSourceLanguagesOpenRangeOptionName } from \"../common.speech/Exports.js\";\r\nimport {Contracts} from \"./Contracts.js\";\r\nimport {\r\n    PropertyCollection,\r\n    PropertyId,\r\n    SourceLanguageConfig,\r\n} from \"./Exports.js\";\r\nimport { LanguageIdMode } from \"./LanguageIdMode.js\";\r\n\r\n/**\r\n * Language auto detect configuration.\r\n * @class AutoDetectSourceLanguageConfig\r\n * Added in version 1.13.0.\r\n */\r\nexport class AutoDetectSourceLanguageConfig {\r\n    private privProperties: PropertyCollection;\r\n    private privLanguageIdMode: LanguageIdMode;\r\n\r\n    private constructor() {\r\n        this.privProperties = new PropertyCollection();\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceConnection_LanguageIdMode, \"AtStart\");\r\n        this.privLanguageIdMode = LanguageIdMode.AtStart;\r\n    }\r\n\r\n    /**\r\n     * @member AutoDetectSourceLanguageConfig.fromOpenRange\r\n     * @function\r\n     * @public\r\n     * Only [[SpeechSynthesizer]] supports source language auto detection from open range,\r\n     * for [[Recognizer]], please use AutoDetectSourceLanguageConfig with specific source languages.\r\n     * @return {AutoDetectSourceLanguageConfig} Instance of AutoDetectSourceLanguageConfig\r\n     * @summary Creates an instance of the AutoDetectSourceLanguageConfig with open range.\r\n     */\r\n    public static fromOpenRange(): AutoDetectSourceLanguageConfig {\r\n        const config = new AutoDetectSourceLanguageConfig();\r\n        config.properties.setProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, AutoDetectSourceLanguagesOpenRangeOptionName);\r\n        config.properties.setProperty(PropertyId.SpeechServiceConnection_RecoLanguage, \"en-US\");\r\n        return config;\r\n    }\r\n\r\n    /**\r\n     * @member AutoDetectSourceLanguageConfig.fromLanguages\r\n     * @function\r\n     * @public\r\n     * @param {string[]} languages Comma-separated string of languages (eg. \"en-US,fr-FR\") to populate properties of config.\r\n     * @return {AutoDetectSourceLanguageConfig} Instance of AutoDetectSourceLanguageConfig\r\n     * @summary Creates an instance of the AutoDetectSourceLanguageConfig with given languages.\r\n     */\r\n    public static fromLanguages(languages: string[]): AutoDetectSourceLanguageConfig {\r\n        Contracts.throwIfArrayEmptyOrWhitespace(languages, \"languages\");\r\n        const config = new AutoDetectSourceLanguageConfig();\r\n        config.properties.setProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, languages.join());\r\n        return config;\r\n    }\r\n\r\n    /**\r\n     * @member AutoDetectSourceLanguageConfig.fromSourceLanguageConfigs\r\n     * @function\r\n     * @public\r\n     * @param {SourceLanguageConfig[]} configs SourceLanguageConfigs to populate properties of config.\r\n     * @return {AutoDetectSourceLanguageConfig} Instance of AutoDetectSourceLanguageConfig\r\n     * @summary Creates an instance of the AutoDetectSourceLanguageConfig with given SourceLanguageConfigs.\r\n     */\r\n    public static fromSourceLanguageConfigs(configs: SourceLanguageConfig[]): AutoDetectSourceLanguageConfig {\r\n        if (configs.length < 1) {\r\n            throw new Error(\"Expected non-empty SourceLanguageConfig array.\");\r\n        }\r\n        const autoConfig = new AutoDetectSourceLanguageConfig();\r\n        const langs: string[] = [];\r\n        configs.forEach((config: SourceLanguageConfig): void => {\r\n            langs.push(config.language);\r\n            if (config.endpointId !== undefined && config.endpointId !== \"\") {\r\n                const customProperty = config.language + PropertyId.SpeechServiceConnection_EndpointId.toString();\r\n                autoConfig.properties.setProperty(customProperty, config.endpointId);\r\n            }\r\n        });\r\n        autoConfig.properties.setProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, langs.join());\r\n\r\n        return autoConfig;\r\n    }\r\n\r\n    /**\r\n     * @member AutoDetectSourceLanguageConfig.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @return {PropertyCollection} Properties of the config.\r\n     * @summary Gets an auto detected language config properties\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    /**\r\n     * @member AutoDetectSourceLanguageConfig.prototype.mode\r\n     * @function\r\n     * @public\r\n     * @param {LanguageIdMode} mode LID mode desired.\r\n     * @summary Sets LID operation to desired mode\r\n     */\r\n    public set mode(mode: LanguageIdMode) {\r\n        if (mode === LanguageIdMode.Continuous) {\r\n            this.privProperties.setProperty(PropertyId.SpeechServiceConnection_RecognitionEndpointVersion, \"2\");\r\n            this.privProperties.setProperty(PropertyId.SpeechServiceConnection_LanguageIdMode, \"Continuous\");\r\n        } else { // LanguageIdMode.AtStart\r\n            this.privProperties.setProperty(PropertyId.SpeechServiceConnection_RecognitionEndpointVersion, \"1\");\r\n            this.privProperties.setProperty(PropertyId.SpeechServiceConnection_LanguageIdMode, \"AtStart\");\r\n        }\r\n        this.privLanguageIdMode = mode;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport {\r\n    SpeechRecognitionResult,\r\n    ConversationTranscriptionResult\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Output format\r\n * @class AutoDetectSourceLanguageResult\r\n */\r\nexport class AutoDetectSourceLanguageResult {\r\n\r\n    private privLanguage: string;\r\n    private privLanguageDetectionConfidence: string;\r\n\r\n    private constructor(language: string, languageDetectionConfidence: string) {\r\n        Contracts.throwIfNullOrUndefined(language, \"language\");\r\n        Contracts.throwIfNullOrUndefined(languageDetectionConfidence, \"languageDetectionConfidence\");\r\n        this.privLanguage = language;\r\n        this.privLanguageDetectionConfidence = languageDetectionConfidence;\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of AutoDetectSourceLanguageResult object from a SpeechRecognitionResult instance.\r\n     * @member AutoDetectSourceLanguageResult.fromResult\r\n     * @function\r\n     * @public\r\n     * @param {SpeechRecognitionResult} result - The recognition result.\r\n     * @returns {AutoDetectSourceLanguageResult} AutoDetectSourceLanguageResult object being created.\r\n     */\r\n    public static fromResult(result: SpeechRecognitionResult): AutoDetectSourceLanguageResult {\r\n        return new AutoDetectSourceLanguageResult(result.language, result.languageDetectionConfidence);\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of AutoDetectSourceLanguageResult object from a ConversationTranscriptionResult instance.\r\n     * @member AutoDetectSourceLanguageResult.fromConversationTranscriptionResult\r\n     * @function\r\n     * @public\r\n     * @param {ConversationTranscriptionResult} result - The transcription result.\r\n     * @returns {AutoDetectSourceLanguageResult} AutoDetectSourceLanguageResult object being created.\r\n     */\r\n        public static fromConversationTranscriptionResult(result: ConversationTranscriptionResult): AutoDetectSourceLanguageResult {\r\n            return new AutoDetectSourceLanguageResult(result.language, result.languageDetectionConfidence);\r\n        }\r\n\r\n    public get language(): string {\r\n        return this.privLanguage;\r\n    }\r\n\r\n    public get languageDetectionConfidence(): string {\r\n        return this.privLanguageDetectionConfidence;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Contracts } from \"./Contracts.js\";\r\n\r\n/**\r\n * Source Language configuration.\r\n * @class SourceLanguageConfig\r\n */\r\nexport class SourceLanguageConfig {\r\n    private privLanguage: string;\r\n    private privEndpointId: string;\r\n\r\n    private constructor(language: string, endpointId?: string) {\r\n        Contracts.throwIfNullOrUndefined(language, \"language\");\r\n        this.privLanguage = language;\r\n        this.privEndpointId = endpointId;\r\n    }\r\n\r\n    /**\r\n     * @member SourceLanguageConfig.fromLanguage\r\n     * @function\r\n     * @public\r\n     * @param {string} language language (eg. \"en-US\") value of config.\r\n     * @param {string?} endpointId endpointId of model bound to given language of config.\r\n     * @return {SourceLanguageConfig} Instance of SourceLanguageConfig\r\n     * @summary Creates an instance of the SourceLanguageConfig with the given language and optional endpointId.\r\n     * Added in version 1.13.0.\r\n     */\r\n    public static fromLanguage(language: string, endpointId?: string): SourceLanguageConfig {\r\n        return new SourceLanguageConfig(language, endpointId);\r\n    }\r\n\r\n    public get language(): string {\r\n        return this.privLanguage;\r\n    }\r\n\r\n    public get endpointId(): string {\r\n        return this.privEndpointId;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// Multi-device Conversation is a Preview feature.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport {\r\n    ConversationConnectionConfig,\r\n    ConversationManager,\r\n    ConversationReceivedTranslationEventArgs,\r\n    ConversationRecognizer,\r\n    ConversationRecognizerFactory,\r\n    ConversationTranslatorCommandTypes,\r\n    ConversationTranslatorMessageTypes,\r\n    IAuthentication,\r\n    IInternalConversation,\r\n    IInternalParticipant,\r\n    InternalParticipants,\r\n    MuteAllEventArgs,\r\n    ParticipantAttributeEventArgs,\r\n    ParticipantEventArgs,\r\n    ParticipantsListEventArgs,\r\n    TranscriberRecognizer\r\n} from \"../../common.speech/Exports.js\";\r\nimport {\r\n    IDisposable,\r\n    IErrorMessages,\r\n    marshalPromiseToCallbacks\r\n} from \"../../common/Exports.js\";\r\nimport { Contracts } from \"../Contracts.js\";\r\nimport {\r\n    ConnectionEventArgs,\r\n    ConversationExpirationEventArgs,\r\n    ConversationParticipantsChangedEventArgs,\r\n    ConversationTranslationCanceledEventArgs,\r\n    ConversationTranslationEventArgs,\r\n    ConversationTranslator,\r\n    Participant,\r\n    ParticipantChangedReason,\r\n    ProfanityOption,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    SpeechTranslationConfig,\r\n} from \"../Exports.js\";\r\nimport { SpeechTranslationConfigImpl } from \"../SpeechTranslationConfig.js\";\r\nimport { Callback, ConversationInfo, ConversationProperties, IConversation } from \"./IConversation.js\";\r\nimport { IParticipant, IUser, TranscriptionParticipant } from \"./IParticipant.js\";\r\n\r\nexport abstract class Conversation implements IConversation {\r\n\r\n    protected constructor() {\r\n        return;\r\n    }\r\n\r\n    public abstract get authorizationToken(): string;\r\n\r\n    public abstract get config(): SpeechTranslationConfig;\r\n\r\n    public abstract get conversationId(): string;\r\n    public abstract get conversationInfo(): ConversationInfo;\r\n    public abstract get properties(): PropertyCollection;\r\n    public abstract get speechRecognitionLanguage(): string;\r\n    public abstract get participants(): Participant[];\r\n    public abstract set authorizationToken(value: string);\r\n    public abstract get isConnected(): boolean;\r\n\r\n    /**\r\n     * Create a conversation\r\n     * @param speechConfig\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public static createConversationAsync(speechConfig: SpeechTranslationConfig, arg2?: string | Callback, arg3?: Callback, arg4?: Callback): Conversation {\r\n        Contracts.throwIfNullOrUndefined(speechConfig, ConversationConnectionConfig.restErrors.invalidArgs.replace(\"{arg}\", \"config\"));\r\n        Contracts.throwIfNullOrUndefined(speechConfig.region, ConversationConnectionConfig.restErrors.invalidArgs.replace(\"{arg}\", \"SpeechServiceConnection_Region\"));\r\n        if (!speechConfig.subscriptionKey && !speechConfig.getProperty(PropertyId[PropertyId.SpeechServiceAuthorization_Token])) {\r\n            Contracts.throwIfNullOrUndefined(speechConfig.subscriptionKey, ConversationConnectionConfig.restErrors.invalidArgs.replace(\"{arg}\", \"SpeechServiceConnection_Key\"));\r\n        }\r\n        let conversationImpl: ConversationImpl;\r\n        let cb: Callback;\r\n        let err: Callback;\r\n        if (typeof arg2 === \"string\") {\r\n            conversationImpl = new ConversationImpl(speechConfig, arg2);\r\n            // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n            marshalPromiseToCallbacks((async (): Promise<void> => {})(), arg3, arg4);\r\n        } else {\r\n            conversationImpl = new ConversationImpl(speechConfig);\r\n            cb = arg2;\r\n            err = arg3;\r\n            conversationImpl.createConversationAsync(\r\n                ((): void => {\r\n                    if (!!cb) {\r\n                        cb();\r\n                    }\r\n                }),\r\n                (error: any): void => {\r\n                    if (!!err) {\r\n                        err(error);\r\n                    }\r\n                });\r\n        }\r\n        return conversationImpl;\r\n\r\n    }\r\n\r\n    /** Start a conversation. */\r\n    public abstract startConversationAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /** Delete a conversation. After this no one will be able to join the conversation. */\r\n    public abstract deleteConversationAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /** End a conversation. */\r\n    public abstract endConversationAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /** Lock a conversation. This will prevent new participants from joining. */\r\n    public abstract lockConversationAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /** Add Participant to Conversation. */\r\n    public abstract addParticipantAsync(participant: IParticipant, cb?: Callback, err?: Callback): void;\r\n\r\n    /**\r\n     * Mute all other participants in the conversation. After this no other participants will\r\n     * have their speech recognitions broadcast, nor be able to send text messages.\r\n     */\r\n    public abstract muteAllParticipantsAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /**\r\n     * Mute a participant.\r\n     * @param userId A user identifier\r\n     */\r\n    public abstract muteParticipantAsync(userId: string, cb?: Callback, err?: Callback): void;\r\n\r\n    /**\r\n     * Remove a participant from a conversation using the user id, Participant or User object\r\n     * @param userId A user identifier\r\n     */\r\n    public abstract removeParticipantAsync(userId: string | IParticipant | IUser, cb?: Callback, err?: Callback): void;\r\n\r\n    /** Unlocks a conversation. */\r\n    public abstract unlockConversationAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /** Unmute all other participants in the conversation. */\r\n    public abstract unmuteAllParticipantsAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /**\r\n     * Unmute a participant.\r\n     * @param userId A user identifier\r\n     */\r\n    public abstract unmuteParticipantAsync(userId: string, cb?: Callback, err?: Callback): void;\r\n}\r\n\r\nexport class ConversationImpl extends Conversation implements IDisposable {\r\n\r\n    private privConfig: SpeechTranslationConfig;\r\n    private privProperties: PropertyCollection;\r\n    private privLanguage: string;\r\n    private privToken: string;\r\n    private privIsDisposed: boolean;\r\n    private privRoom: IInternalConversation;\r\n    private privManager: ConversationManager;\r\n    private privConversationRecognizer: ConversationRecognizer;\r\n    private privIsConnected: boolean;\r\n    private privParticipants: InternalParticipants;\r\n    private privIsReady: boolean;\r\n    private privConversationTranslator: ConversationTranslator;\r\n    private privTranscriberRecognizer: TranscriberRecognizer;\r\n    private privErrors: IErrorMessages = ConversationConnectionConfig.restErrors;\r\n    private privConversationId: string;\r\n    private readonly privTextMessageMaxLength: number;\r\n\r\n    /**\r\n     * Create a conversation impl\r\n     * @param speechConfig\r\n     * @param {string} id - optional conversationId\r\n     */\r\n    public constructor(speechConfig: SpeechTranslationConfig, id?: string) {\r\n        super();\r\n        this.privIsConnected = false;\r\n        this.privIsDisposed = false;\r\n        this.privConversationId = \"\";\r\n        this.privProperties = new PropertyCollection();\r\n        this.privManager = new ConversationManager();\r\n\r\n        // check the speech language\r\n        const language: string = speechConfig.getProperty(PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage]);\r\n        if (!language) {\r\n            speechConfig.setProperty(PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage], ConversationConnectionConfig.defaultLanguageCode);\r\n        }\r\n        this.privLanguage = speechConfig.getProperty(PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage]);\r\n\r\n        if (!id) {\r\n            // check the target language(s)\r\n            if (speechConfig.targetLanguages.length === 0) {\r\n                speechConfig.addTargetLanguage(this.privLanguage);\r\n            }\r\n\r\n            // check the profanity setting: speech and conversationTranslator should be in sync\r\n            const profanity: string = speechConfig.getProperty(PropertyId[PropertyId.SpeechServiceResponse_ProfanityOption]);\r\n            if (!profanity) {\r\n                speechConfig.setProfanity(ProfanityOption.Masked);\r\n            }\r\n            // check the nickname: it should pass this regex: ^\\w+([\\s-][\\w\\(\\)]+)*$\"\r\n            // TODO: specify the regex required. Nicknames must be unique or get the duplicate nickname error\r\n            // TODO: check what the max length is and if a truncation is required or if the service handles it without an error\r\n            let hostNickname: string = speechConfig.getProperty(PropertyId[PropertyId.ConversationTranslator_Name]);\r\n            if (hostNickname === undefined || hostNickname === null) {\r\n                hostNickname = \"Host\";\r\n            }\r\n            Contracts.throwIfNullOrTooLong(hostNickname, \"nickname\", 50);\r\n            Contracts.throwIfNullOrTooShort(hostNickname, \"nickname\", 2);\r\n            speechConfig.setProperty(PropertyId[PropertyId.ConversationTranslator_Name], hostNickname);\r\n\r\n        } else {\r\n            this.privConversationId = id;\r\n        }\r\n\r\n        // save the speech config for future usage\r\n        this.privConfig = speechConfig;\r\n\r\n        // save the config properties\r\n        const configImpl = speechConfig as SpeechTranslationConfigImpl;\r\n        Contracts.throwIfNull(configImpl, \"speechConfig\");\r\n        this.privProperties = configImpl.properties.clone();\r\n        this.privIsConnected = false;\r\n        this.privParticipants = new InternalParticipants();\r\n        this.privIsReady = false;\r\n        this.privTextMessageMaxLength = 1000;\r\n    }\r\n\r\n    // get the internal data about a conversation\r\n    public get room(): IInternalConversation {\r\n        return this.privRoom;\r\n    }\r\n\r\n    // get the wrapper for connecting to the websockets\r\n    public get connection(): ConversationRecognizer {\r\n        return this.privConversationRecognizer; // this.privConnection;\r\n    }\r\n\r\n    // get the config\r\n    public get config(): SpeechTranslationConfig {\r\n        return this.privConfig;\r\n    }\r\n\r\n    // get the conversation Id\r\n    public get conversationId(): string {\r\n        return this.privRoom ? this.privRoom.roomId : this.privConversationId;\r\n    }\r\n\r\n    // get the properties\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    // get the speech language\r\n    public get speechRecognitionLanguage(): string {\r\n        return this.privLanguage;\r\n    }\r\n\r\n    public get isMutedByHost(): boolean {\r\n        return this.privParticipants.me?.isHost ? false : this.privParticipants.me?.isMuted;\r\n    }\r\n\r\n    public get isConnected(): boolean {\r\n        return this.privIsConnected && this.privIsReady;\r\n    }\r\n\r\n    public get participants(): Participant[] {\r\n        return this.toParticipants(true);\r\n    }\r\n\r\n    public get me(): Participant {\r\n        return this.toParticipant(this.privParticipants.me);\r\n    }\r\n\r\n    public get host(): Participant {\r\n        return this.toParticipant(this.privParticipants.host);\r\n    }\r\n\r\n    public get transcriberRecognizer(): TranscriberRecognizer {\r\n        return this.privTranscriberRecognizer;\r\n    }\r\n\r\n    public get conversationInfo(): ConversationInfo {\r\n        const convId: string = this.conversationId;\r\n        const p: TranscriptionParticipant[] = this.participants.map((part: Participant): TranscriptionParticipant => (\r\n            {\r\n                id: part.id,\r\n                preferredLanguage: part.preferredLanguage,\r\n                voice: part.voice\r\n            }\r\n        ));\r\n        const props: ConversationProperties = {};\r\n        for (const key of ConversationConnectionConfig.transcriptionEventKeys) {\r\n            const val: string = this.properties.getProperty(key, \"\");\r\n            if (val !== \"\") {\r\n                props[key] = val;\r\n            }\r\n        }\r\n        const info: ConversationInfo = { id: convId, participants: p, conversationProperties: props };\r\n        return info;\r\n    }\r\n\r\n    private get canSend(): boolean {\r\n        return this.privIsConnected && !this.privParticipants.me?.isMuted;\r\n    }\r\n\r\n    private get canSendAsHost(): boolean {\r\n        return this.privIsConnected && this.privParticipants.me?.isHost;\r\n    }\r\n\r\n    // get / set the speech auth token\r\n    // eslint-disable-next-line @typescript-eslint/member-ordering\r\n    public get authorizationToken(): string {\r\n        return this.privToken;\r\n    }\r\n\r\n    public set authorizationToken(value: string) {\r\n        Contracts.throwIfNullOrWhitespace(value, \"authorizationToken\");\r\n        this.privToken = value;\r\n    }\r\n\r\n    public set conversationTranslator(conversationTranslator: ConversationTranslator) {\r\n        this.privConversationTranslator = conversationTranslator;\r\n    }\r\n\r\n    public onToken(token: IAuthentication): void {\r\n        this.privConversationTranslator.onToken(token);\r\n    }\r\n\r\n    /**\r\n     * Create a new conversation as Host\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public createConversationAsync(cb?: Callback, err?: Callback): void {\r\n        try {\r\n            if (!!this.privConversationRecognizer) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedStart), err);\r\n            }\r\n            this.privManager.createOrJoin(this.privProperties, undefined,\r\n                ((room: IInternalConversation): void => {\r\n                    if (!room) {\r\n                        this.handleError(new Error(this.privErrors.permissionDeniedConnect), err);\r\n                    }\r\n                    this.privRoom = room;\r\n                    this.handleCallback(cb, err);\r\n                }),\r\n                ((error: any): void => {\r\n                    this.handleError(error, err);\r\n                }));\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Starts a new conversation as host.\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public startConversationAsync(cb?: Callback, err?: Callback): void {\r\n        try {\r\n            // check if there is already a recognizer\r\n            if (!!this.privConversationRecognizer) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedStart), err);\r\n            }\r\n            // check if there is conversation data available\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedConnect);\r\n            // connect to the conversation websocket\r\n            this.privParticipants.meId = this.privRoom.participantId;\r\n            this.privConversationRecognizer = ConversationRecognizerFactory.fromConfig(this, this.privConfig);\r\n\r\n            // Because ConversationTranslator manually sets up and manages the connection, Conversation\r\n            // has to forward serviceRecognizer connection events that usually get passed automatically\r\n            this.privConversationRecognizer.connected = this.onConnected;\r\n            this.privConversationRecognizer.disconnected = this.onDisconnected;\r\n            this.privConversationRecognizer.canceled = this.onCanceled;\r\n\r\n            this.privConversationRecognizer.participantUpdateCommandReceived = this.onParticipantUpdateCommandReceived;\r\n            this.privConversationRecognizer.lockRoomCommandReceived = this.onLockRoomCommandReceived;\r\n            this.privConversationRecognizer.muteAllCommandReceived = this.onMuteAllCommandReceived;\r\n            this.privConversationRecognizer.participantJoinCommandReceived = this.onParticipantJoinCommandReceived;\r\n            this.privConversationRecognizer.participantLeaveCommandReceived = this.onParticipantLeaveCommandReceived;\r\n            this.privConversationRecognizer.translationReceived = this.onTranslationReceived;\r\n            this.privConversationRecognizer.participantsListReceived = this.onParticipantsListReceived;\r\n            this.privConversationRecognizer.conversationExpiration = this.onConversationExpiration;\r\n\r\n            this.privConversationRecognizer.connect(this.privRoom.token,\r\n                ((): void => {\r\n                    this.handleCallback(cb, err);\r\n                }),\r\n                ((error: any): void => {\r\n                    this.handleError(error, err);\r\n                }));\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Join a conversation as a participant.\r\n     * @param { IParticipant } participant - participant to add\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public addParticipantAsync(participant: IParticipant, cb?: Callback, err?: Callback): void {\r\n        Contracts.throwIfNullOrUndefined(participant, \"Participant\");\r\n        marshalPromiseToCallbacks(this.addParticipantImplAsync(participant), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Join a conversation as a participant.\r\n     * @param conversation\r\n     * @param nickname\r\n     * @param lang\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public joinConversationAsync(conversationId: string, nickname: string, lang: string, cb?: Callback, err?: Callback): void {\r\n        try {\r\n            // TODO\r\n            // if (!!this.privConversationRecognizer) {\r\n            //     throw new Error(this.privErrors.permissionDeniedStart);\r\n            // }\r\n            Contracts.throwIfNullOrWhitespace(conversationId, this.privErrors.invalidArgs.replace(\"{arg}\", \"conversationId\"));\r\n            Contracts.throwIfNullOrWhitespace(nickname, this.privErrors.invalidArgs.replace(\"{arg}\", \"nickname\"));\r\n            Contracts.throwIfNullOrWhitespace(lang, this.privErrors.invalidArgs.replace(\"{arg}\", \"language\"));\r\n            // join the conversation\r\n            this.privManager.createOrJoin(this.privProperties, conversationId,\r\n                ((room: IInternalConversation): void => {\r\n                    Contracts.throwIfNullOrUndefined(room, this.privErrors.permissionDeniedConnect);\r\n                    this.privRoom = room;\r\n                    this.privConfig.authorizationToken = room.cognitiveSpeechAuthToken;\r\n                    // join callback\r\n                    if (!!cb) {\r\n                        cb(room.cognitiveSpeechAuthToken);\r\n                    }\r\n                }),\r\n                ((error: any): void => {\r\n                    this.handleError(error, err);\r\n                }));\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Deletes a conversation\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public deleteConversationAsync(cb?: Callback, err?: Callback): void {\r\n        marshalPromiseToCallbacks(this.deleteConversationImplAsync(), cb, err);\r\n    }\r\n\r\n    public async deleteConversationImplAsync(): Promise<void> {\r\n            Contracts.throwIfNullOrUndefined(this.privProperties, this.privErrors.permissionDeniedConnect);\r\n            Contracts.throwIfNullOrWhitespace(this.privRoom.token, this.privErrors.permissionDeniedConnect);\r\n            await this.privManager.leave(this.privProperties, this.privRoom.token);\r\n\r\n            this.dispose();\r\n    }\r\n\r\n    /**\r\n     * Issues a request to close the client websockets\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public endConversationAsync(cb?: Callback, err?: Callback): void {\r\n        marshalPromiseToCallbacks(this.endConversationImplAsync(), cb, err);\r\n    }\r\n\r\n    public endConversationImplAsync(): Promise<void> {\r\n        return this.close(true);\r\n    }\r\n\r\n    /**\r\n     * Issues a request to lock the conversation\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public lockConversationAsync(cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            if (!this.canSendAsHost) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace(\"{command}\", \"lock\")), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getLockCommand(true),\r\n                    ((): void => {\r\n                        this.handleCallback(cb, err);\r\n                    }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Issues a request to mute the conversation\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public muteAllParticipantsAsync(cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrUndefined(this.privConversationRecognizer, this.privErrors.permissionDeniedSend);\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            // check the user's permissions\r\n            if (!this.canSendAsHost) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace(\"{command}\", \"mute\")), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getMuteAllCommand(true),\r\n                    ((): void => {\r\n                        this.handleCallback(cb, err);\r\n                    }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Issues a request to mute a participant in the conversation\r\n     * @param userId\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public muteParticipantAsync(userId: string, cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrWhitespace(userId, this.privErrors.invalidArgs.replace(\"{arg}\", \"userId\"));\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            // check the connection is open (host + participant can perform the mute command)\r\n            if (!this.canSend) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedSend), err);\r\n            }\r\n            // if not host, check the participant is not muting another participant\r\n            if (!this.me.isHost && this.me.id !== userId) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedParticipant.replace(\"{command}\", \"mute\")), err);\r\n            }\r\n            // check the user exists\r\n            const exists: number = this.privParticipants.getParticipantIndex(userId);\r\n            if (exists === -1) {\r\n                this.handleError(new Error(this.privErrors.invalidParticipantRequest), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getMuteCommand(userId, true), ((): void => {\r\n                        this.handleCallback(cb, err);\r\n                    }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Issues a request to remove a participant from the conversation\r\n     * @param userId\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public removeParticipantAsync(userId: string | IParticipant | IUser, cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            if (!!this.privTranscriberRecognizer && userId.hasOwnProperty(\"id\")) {\r\n                // Assume this is a transcription participant\r\n                marshalPromiseToCallbacks(this.removeParticipantImplAsync(userId as IParticipant), cb, err);\r\n            } else {\r\n                Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n                Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n                if (!this.canSendAsHost) {\r\n                    this.handleError(new Error(this.privErrors.permissionDeniedParticipant.replace(\"{command}\", \"remove\")), err);\r\n                }\r\n                let participantId = \"\";\r\n                if (typeof userId === \"string\") {\r\n                    participantId = userId;\r\n                } else if (userId.hasOwnProperty(\"id\")) {\r\n                    const participant: IParticipant = userId as IParticipant;\r\n                    participantId = participant.id;\r\n                } else if (userId.hasOwnProperty(\"userId\")) {\r\n                    const user: IUser = userId as IUser;\r\n                    participantId = user.userId;\r\n                }\r\n                Contracts.throwIfNullOrWhitespace(participantId, this.privErrors.invalidArgs.replace(\"{arg}\", \"userId\"));\r\n                // check the participant exists\r\n                const index: number = this.participants.findIndex((p: Participant): boolean => p.id === participantId);\r\n                if (index === -1) {\r\n                    this.handleError(new Error(this.privErrors.invalidParticipantRequest), err);\r\n                }\r\n                if (!!this.privConversationRecognizer) {\r\n                    this.privConversationRecognizer.sendRequest(this.getEjectCommand(participantId), ((): void => {\r\n                        this.handleCallback(cb, err);\r\n                    }),\r\n                        ((error: any): void => {\r\n                            this.handleError(error, err);\r\n                        }));\r\n                }\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Issues a request to unlock the conversation\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public unlockConversationAsync(cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            if (!this.canSendAsHost) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace(\"{command}\", \"unlock\")), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getLockCommand(false), ((): void => {\r\n                    this.handleCallback(cb, err);\r\n                }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n                }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Issues a request to unmute all participants in the conversation\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public unmuteAllParticipantsAsync(cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            if (!this.canSendAsHost) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace(\"{command}\", \"unmute all\")), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getMuteAllCommand(false), ((): void => {\r\n                    this.handleCallback(cb, err);\r\n                }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Issues a request to unmute a participant in the conversation\r\n     * @param userId\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public unmuteParticipantAsync(userId: string, cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrWhitespace(userId, this.privErrors.invalidArgs.replace(\"{arg}\", \"userId\"));\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            // check the connection is open (host + participant can perform the mute command)\r\n            if (!this.canSend) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedSend), err);\r\n            }\r\n            // if not host, check the participant is not muting another participant\r\n            if (!this.me.isHost && this.me.id !== userId) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedParticipant.replace(\"{command}\", \"mute\")), err);\r\n            }\r\n            // check the user exists\r\n            const exists: number = this.privParticipants.getParticipantIndex(userId);\r\n            if (exists === -1) {\r\n                this.handleError(new Error(this.privErrors.invalidParticipantRequest), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getMuteCommand(userId, false), ((): void => {\r\n                    this.handleCallback(cb, err);\r\n                }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Send a text message\r\n     * @param message\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public sendTextMessageAsync(message: string, cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrWhitespace(message, this.privErrors.invalidArgs.replace(\"{arg}\", \"message\"));\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            if (!this.canSend) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedSend), err);\r\n            }\r\n            // TODO: is a max length check required?\r\n            if (message.length > this.privTextMessageMaxLength) {\r\n                this.handleError(new Error(this.privErrors.invalidArgs.replace(\"{arg}\", \"message length\")), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getMessageCommand(message), ((): void => {\r\n                    this.handleCallback(cb, err);\r\n                }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Set translated to languages\r\n     * @param {string[]} languages - languages to translate to\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public setTranslatedLanguagesAsync(languages: string[], cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfArrayEmptyOrWhitespace(languages, this.privErrors.invalidArgs.replace(\"{arg}\", \"languages\"));\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            if (!this.canSend) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedSend), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getSetTranslateToLanguagesCommand(languages),\r\n                    ((): void => {\r\n                        this.handleCallback(cb, err);\r\n                    }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Change nickname\r\n     * @param {string} nickname - new nickname for the room\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public changeNicknameAsync(nickname: string, cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrWhitespace(nickname, this.privErrors.invalidArgs.replace(\"{arg}\", \"nickname\"));\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            if (!this.canSend) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedSend), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getChangeNicknameCommand(nickname),\r\n                    ((): void => {\r\n                        this.handleCallback(cb, err);\r\n                    }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    public isDisposed(): boolean {\r\n        return this.privIsDisposed;\r\n    }\r\n\r\n    public dispose(): void {\r\n        if (this.isDisposed) {\r\n            return;\r\n        }\r\n        this.privIsDisposed = true;\r\n        if (!!this.config) {\r\n            this.config.close();\r\n        }\r\n        this.privConfig = undefined;\r\n        this.privLanguage = undefined;\r\n        this.privProperties = undefined;\r\n        this.privRoom = undefined;\r\n        this.privToken = undefined;\r\n        this.privManager = undefined;\r\n        this.privIsConnected = false;\r\n        this.privIsReady = false;\r\n        this.privParticipants = undefined;\r\n    }\r\n\r\n    public async connectTranscriberRecognizer(recognizer: TranscriberRecognizer): Promise<void> {\r\n        if (!!this.privTranscriberRecognizer) {\r\n            await this.privTranscriberRecognizer.close();\r\n        }\r\n        await recognizer.enforceAudioGating();\r\n        this.privTranscriberRecognizer = recognizer;\r\n        this.privTranscriberRecognizer.conversation = this;\r\n    }\r\n\r\n    public getKeepAlive(): string {\r\n        const nickname: string = (!!this.me) ? this.me.displayName : \"default_nickname\";\r\n        return JSON.stringify({\r\n            id: \"0\",\r\n            nickname,\r\n            participantId: this.privRoom.participantId,\r\n            roomId: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.keepAlive\r\n        });\r\n    }\r\n\r\n    /** websocket callbacks */\r\n    /* eslint-disable @typescript-eslint/typedef */\r\n    private onConnected = (e: ConnectionEventArgs): void => {\r\n        this.privIsConnected = true;\r\n        try {\r\n            if (!!this.privConversationTranslator?.sessionStarted) {\r\n                this.privConversationTranslator.sessionStarted(this.privConversationTranslator, e);\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onDisconnected = (e: ConnectionEventArgs): void => {\r\n        try {\r\n            if (!!this.privConversationTranslator?.sessionStopped) {\r\n                this.privConversationTranslator.sessionStopped(this.privConversationTranslator, e);\r\n            }\r\n        } catch (e) {\r\n            //\r\n        } finally {\r\n            void this.close(false);\r\n        }\r\n    };\r\n\r\n    private onCanceled = (r: ConversationRecognizer, e: ConversationTranslationCanceledEventArgs): void => {\r\n        try {\r\n            if (!!this.privConversationTranslator?.canceled) {\r\n                this.privConversationTranslator.canceled(this.privConversationTranslator, e);\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onParticipantUpdateCommandReceived = (r: ConversationRecognizer, e: ParticipantAttributeEventArgs): void => {\r\n        try {\r\n            const updatedParticipant: IInternalParticipant = this.privParticipants.getParticipant(e.id);\r\n            if (updatedParticipant !== undefined) {\r\n\r\n                switch (e.key) {\r\n                    case ConversationTranslatorCommandTypes.changeNickname:\r\n                        updatedParticipant.displayName = e.value as string;\r\n                        break;\r\n                    case ConversationTranslatorCommandTypes.setUseTTS:\r\n                        updatedParticipant.isUsingTts = e.value as boolean;\r\n                        break;\r\n                    case ConversationTranslatorCommandTypes.setProfanityFiltering:\r\n                        updatedParticipant.profanity = e.value as boolean;\r\n                        break;\r\n                    case ConversationTranslatorCommandTypes.setMute:\r\n                        updatedParticipant.isMuted = e.value as boolean;\r\n                        break;\r\n                    case ConversationTranslatorCommandTypes.setTranslateToLanguages:\r\n                        updatedParticipant.translateToLanguages = e.value as string[];\r\n                        break;\r\n                }\r\n                this.privParticipants.addOrUpdateParticipant(updatedParticipant);\r\n\r\n                if (!!this.privConversationTranslator) {\r\n                    this.privConversationTranslator.participantsChanged(\r\n                        this.privConversationTranslator,\r\n                        new ConversationParticipantsChangedEventArgs(ParticipantChangedReason.Updated,\r\n                            [this.toParticipant(updatedParticipant)], e.sessionId));\r\n                }\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onLockRoomCommandReceived = (): void => {\r\n        // TODO\r\n    };\r\n\r\n    private onMuteAllCommandReceived = (r: ConversationRecognizer, e: MuteAllEventArgs): void => {\r\n        try {\r\n            this.privParticipants.participants.forEach((p: IInternalParticipant): boolean => p.isMuted = (p.isHost ? false : e.isMuted));\r\n            if (!!this.privConversationTranslator) {\r\n                this.privConversationTranslator.participantsChanged(\r\n                    this.privConversationTranslator,\r\n                    new ConversationParticipantsChangedEventArgs(ParticipantChangedReason.Updated,\r\n                        this.toParticipants(false), e.sessionId));\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onParticipantJoinCommandReceived = (r: ConversationRecognizer, e: ParticipantEventArgs): void => {\r\n        try {\r\n            const newParticipant: IInternalParticipant = this.privParticipants.addOrUpdateParticipant(e.participant);\r\n            if (newParticipant !== undefined) {\r\n                if (!!this.privConversationTranslator) {\r\n                    this.privConversationTranslator.participantsChanged(\r\n                        this.privConversationTranslator,\r\n                        new ConversationParticipantsChangedEventArgs(ParticipantChangedReason.JoinedConversation,\r\n                            [this.toParticipant(newParticipant)], e.sessionId));\r\n                }\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onParticipantLeaveCommandReceived = (r: ConversationRecognizer, e: ParticipantEventArgs): void => {\r\n        try {\r\n            const ejectedParticipant: IInternalParticipant = this.privParticipants.getParticipant(e.participant.id);\r\n            if (ejectedParticipant !== undefined) {\r\n                // remove the participant from the internal participants list\r\n                this.privParticipants.deleteParticipant(e.participant.id);\r\n                if (!!this.privConversationTranslator) {\r\n                    // notify subscribers that the participant has left the conversation\r\n                    this.privConversationTranslator.participantsChanged(\r\n                        this.privConversationTranslator,\r\n                        new ConversationParticipantsChangedEventArgs(ParticipantChangedReason.LeftConversation,\r\n                            [this.toParticipant(ejectedParticipant)], e.sessionId));\r\n                }\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onTranslationReceived = (r: ConversationRecognizer, e: ConversationReceivedTranslationEventArgs): void => {\r\n        try {\r\n            switch (e.command) {\r\n                case ConversationTranslatorMessageTypes.final:\r\n                    if (!!this.privConversationTranslator) {\r\n                        this.privConversationTranslator.transcribed(\r\n                            this.privConversationTranslator,\r\n                            new ConversationTranslationEventArgs(e.payload, undefined, e.sessionId));\r\n                    }\r\n                    break;\r\n                case ConversationTranslatorMessageTypes.partial:\r\n                    if (!!this.privConversationTranslator) {\r\n                        this.privConversationTranslator.transcribing(\r\n                            this.privConversationTranslator,\r\n                            new ConversationTranslationEventArgs(e.payload, undefined, e.sessionId));\r\n                    }\r\n                    break;\r\n                case ConversationTranslatorMessageTypes.instantMessage:\r\n                    if (!!this.privConversationTranslator) {\r\n                        this.privConversationTranslator.textMessageReceived(\r\n                            this.privConversationTranslator,\r\n                            new ConversationTranslationEventArgs(e.payload, undefined, e.sessionId));\r\n                    }\r\n                    break;\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onParticipantsListReceived = (r: ConversationRecognizer, e: ParticipantsListEventArgs): void => {\r\n        try {\r\n            // check if the session token needs to be updated\r\n            if (e.sessionToken !== undefined && e.sessionToken !== null) {\r\n                this.privRoom.token = e.sessionToken;\r\n            }\r\n            // save the participants\r\n            this.privParticipants.participants = [...e.participants];\r\n            // enable the conversation\r\n            if (this.privParticipants.me !== undefined) {\r\n                this.privIsReady = true;\r\n            }\r\n            if (!!this.privConversationTranslator) {\r\n                this.privConversationTranslator.participantsChanged(\r\n                    this.privConversationTranslator,\r\n                    new ConversationParticipantsChangedEventArgs(ParticipantChangedReason.JoinedConversation, this.toParticipants(true), e.sessionId));\r\n            }\r\n            // if this is the host, update the nickname if needed\r\n            if (this.me.isHost) {\r\n                const nickname: string = this.privConversationTranslator?.properties.getProperty(PropertyId.ConversationTranslator_Name);\r\n                if (nickname !== undefined && nickname.length > 0 && nickname !== this.me.displayName) {\r\n                    // issue a change nickname request\r\n                    this.changeNicknameAsync(nickname);\r\n                }\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onConversationExpiration = (r: ConversationRecognizer, e: ConversationExpirationEventArgs): void => {\r\n        try {\r\n            if (!!this.privConversationTranslator) {\r\n                this.privConversationTranslator.conversationExpiration(this.privConversationTranslator, e);\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n    /* eslint-enable @typescript-eslint/typedef */\r\n\r\n    private addParticipantImplAsync(participant: IParticipant): Promise<void> {\r\n        const newParticipant: IInternalParticipant = this.privParticipants.addOrUpdateParticipant(participant);\r\n        if (newParticipant !== undefined) {\r\n            if (!!this.privTranscriberRecognizer) {\r\n                const conversationInfo = this.conversationInfo;\r\n                conversationInfo.participants = [participant];\r\n                return this.privTranscriberRecognizer.pushConversationEvent(conversationInfo, \"join\");\r\n            }\r\n        }\r\n    }\r\n\r\n    private removeParticipantImplAsync(participant: IParticipant): Promise<void> {\r\n        this.privParticipants.deleteParticipant(participant.id);\r\n        const conversationInfo = this.conversationInfo;\r\n        conversationInfo.participants = [participant];\r\n        return this.privTranscriberRecognizer.pushConversationEvent(conversationInfo, \"leave\");\r\n    }\r\n\r\n    private async close(dispose: boolean): Promise<void> {\r\n        try {\r\n            this.privIsConnected = false;\r\n            await this.privConversationRecognizer?.close();\r\n            this.privConversationRecognizer = undefined;\r\n            if (!!this.privConversationTranslator) {\r\n                this.privConversationTranslator.dispose();\r\n            }\r\n        } catch (e) {\r\n            // ignore error\r\n            throw e;\r\n        }\r\n        if (dispose) {\r\n            this.dispose();\r\n        }\r\n    }\r\n\r\n    /** Helpers */\r\n    private handleCallback(cb: () => void, err: (message: string) => void): void {\r\n        if (!!cb) {\r\n            try {\r\n                cb();\r\n            } catch (e) {\r\n                if (!!err) {\r\n                    err(e as string);\r\n                }\r\n            }\r\n            cb = undefined;\r\n        }\r\n    }\r\n\r\n    private handleError(error: any, err: (message: string) => void): void {\r\n        if (!!err) {\r\n            if (error instanceof Error) {\r\n                const typedError: Error = error;\r\n                err(typedError.name + \": \" + typedError.message);\r\n\r\n            } else {\r\n                err(error as string);\r\n            }\r\n        }\r\n    }\r\n\r\n    /** Participant Helpers */\r\n    private toParticipants(includeHost: boolean): Participant[] {\r\n\r\n        const participants: Participant[] = this.privParticipants.participants.map((p: IInternalParticipant): Participant => ( this.toParticipant(p) ) );\r\n        if (!includeHost) {\r\n            return participants.filter((p: Participant): boolean => p.isHost === false);\r\n        } else {\r\n            return participants;\r\n        }\r\n    }\r\n\r\n    private toParticipant(p: IInternalParticipant): Participant {\r\n        return new Participant(p.id, p.avatar, p.displayName, p.isHost, p.isMuted, p.isUsingTts, p.preferredLanguage, p.voice);\r\n    }\r\n\r\n    private getMuteAllCommand(isMuted: boolean): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"conversationId\");\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.participantId, \"participantId\");\r\n\r\n        return JSON.stringify({\r\n            command: ConversationTranslatorCommandTypes.setMuteAll,\r\n            participantId: this.privRoom.participantId, // the id of the host\r\n            roomid: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.participantCommand,\r\n            value: isMuted\r\n        });\r\n    }\r\n\r\n    private getMuteCommand(participantId: string, isMuted: boolean): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"conversationId\");\r\n        Contracts.throwIfNullOrWhitespace(participantId, \"participantId\");\r\n\r\n        return JSON.stringify({\r\n            command: ConversationTranslatorCommandTypes.setMute,\r\n            // eslint-disable-next-line object-shorthand\r\n            participantId: participantId,\r\n            roomid: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.participantCommand,\r\n            value: isMuted\r\n        });\r\n    }\r\n\r\n    private getLockCommand(isLocked: boolean): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"conversationId\");\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.participantId, \"participantId\");\r\n\r\n        return JSON.stringify({\r\n            command: ConversationTranslatorCommandTypes.setLockState,\r\n            participantId: this.privRoom.participantId,\r\n            roomid: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.participantCommand,\r\n            value: isLocked\r\n        });\r\n    }\r\n\r\n    private getEjectCommand(participantId: string): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"conversationId\");\r\n        Contracts.throwIfNullOrWhitespace(participantId, \"participantId\");\r\n\r\n        return JSON.stringify({\r\n            command: ConversationTranslatorCommandTypes.ejectParticipant,\r\n            // eslint-disable-next-line object-shorthand\r\n            participantId: participantId,\r\n            roomid: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.participantCommand,\r\n        });\r\n    }\r\n\r\n    private getSetTranslateToLanguagesCommand(languages: string[]): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"conversationId\");\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.participantId, \"participantId\");\r\n\r\n        return JSON.stringify({\r\n            command: ConversationTranslatorCommandTypes.setTranslateToLanguages,\r\n            participantId: this.privRoom.participantId, // the id of the host\r\n            roomid: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.participantCommand,\r\n            value: languages\r\n        });\r\n    }\r\n\r\n    private getChangeNicknameCommand(nickname: string): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"conversationId\");\r\n        Contracts.throwIfNullOrWhitespace(nickname, \"nickname\");\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.participantId, \"participantId\");\r\n\r\n        return JSON.stringify({\r\n            command: ConversationTranslatorCommandTypes.changeNickname,\r\n            nickname,\r\n            participantId: this.privRoom.participantId, // the id of the host\r\n            roomid: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.participantCommand,\r\n            value: nickname\r\n        });\r\n    }\r\n\r\n    private getMessageCommand(message: string): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"conversationId\");\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.participantId, \"participantId\");\r\n        Contracts.throwIfNullOrWhitespace(message, \"message\");\r\n\r\n        return JSON.stringify({\r\n            participantId: this.privRoom.participantId,\r\n            roomId: this.privRoom.roomId,\r\n            text: message,\r\n            type: ConversationTranslatorMessageTypes.instantMessage\r\n        });\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    AudioConfig,\r\n    SpeechTranslationConfig\r\n} from \"../Exports.js\";\r\nimport { Callback } from \"./IConversation.js\";\r\n\r\nexport class ConversationCommon {\r\n\r\n    protected privAudioConfig: AudioConfig;\r\n    protected privSpeechTranslationConfig: SpeechTranslationConfig;\r\n\r\n    public constructor(audioConfig?: AudioConfig) {\r\n        this.privAudioConfig = audioConfig;\r\n    }\r\n\r\n    protected handleCallback(cb: Callback, err: Callback): void {\r\n        if (!!cb) {\r\n            try {\r\n                cb();\r\n            } catch (e) {\r\n                if (!!err) {\r\n                    err(e);\r\n                }\r\n            }\r\n            cb = undefined;\r\n        }\r\n    }\r\n\r\n    protected handleError(error: any, err: Callback): void {\r\n        if (!!err) {\r\n            if (error instanceof Error) {\r\n                const typedError: Error = error;\r\n                err(typedError.name + \": \" + typedError.message);\r\n\r\n            } else {\r\n                err(error);\r\n            }\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// Multi-device Conversation is a Preview feature.\r\n\r\nimport { SessionEventArgs } from \"../Exports.js\";\r\n\r\nexport class ConversationExpirationEventArgs extends SessionEventArgs {\r\n    private privExpirationTime: number;\r\n\r\n    public constructor(expirationTime: number, sessionId?: string) {\r\n        super(sessionId);\r\n        this.privExpirationTime = expirationTime;\r\n    }\r\n\r\n    /** How much longer until the conversation expires (in minutes). */\r\n    public get expirationTime(): number {\r\n        return this.privExpirationTime;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// Multi-device Conversation is a Preview feature.\r\n\r\nimport { SessionEventArgs } from \"../Exports.js\";\r\nimport { ParticipantChangedReason } from \"./Exports.js\";\r\nimport { IParticipant } from \"./IParticipant.js\";\r\n\r\nexport class ConversationParticipantsChangedEventArgs extends SessionEventArgs {\r\n    private privReason: ParticipantChangedReason;\r\n    private privParticipant: IParticipant[];\r\n\r\n    public constructor(reason: ParticipantChangedReason, participants: IParticipant[], sessionId?: string) {\r\n        super(sessionId);\r\n        this.privReason = reason;\r\n        this.privParticipant = participants;\r\n    }\r\n\r\n    public get reason(): ParticipantChangedReason {\r\n        return this.privReason;\r\n    }\r\n\r\n    public get participants(): IParticipant[] {\r\n        return this.privParticipant;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// Multi-device Conversation is a Preview feature.\r\n\r\nimport { CancellationEventArgsBase } from \"../CancellationEventArgsBase.js\";\r\n\r\nexport class ConversationTranslationCanceledEventArgs extends CancellationEventArgsBase {\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// Multi-device Conversation is a Preview feature.\r\n\r\nimport { RecognitionEventArgs } from \"../Exports.js\";\r\nimport { ConversationTranslationResult } from \"./Exports.js\";\r\n\r\nexport class ConversationTranslationEventArgs extends RecognitionEventArgs {\r\n    private privResult: ConversationTranslationResult;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {ConversationTranslationResult} result - The translation recognition result.\r\n     * @param {number} offset - The offset.\r\n     * @param {string} sessionId - The session id.\r\n     */\r\n    public constructor(result: ConversationTranslationResult, offset?: number, sessionId?: string) {\r\n        super(offset, sessionId);\r\n        this.privResult = result;\r\n    }\r\n\r\n    /**\r\n     * Specifies the recognition result.\r\n     * @returns {ConversationTranslationResult} the recognition result.\r\n     */\r\n    public get result(): ConversationTranslationResult {\r\n        return this.privResult;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// Multi-device Conversation is a Preview feature.\r\n\r\nimport { PropertyCollection } from \"../PropertyCollection.js\";\r\nimport { ResultReason } from \"../ResultReason.js\";\r\nimport { TranslationRecognitionResult } from \"../TranslationRecognitionResult.js\";\r\nimport { Translations } from \"../Translations.js\";\r\n\r\nexport class ConversationTranslationResult extends TranslationRecognitionResult {\r\n    private privId: string;\r\n    private privOrigLang: string;\r\n\r\n    public constructor(participantId: string,\r\n                       translations: Translations,\r\n                       originalLanguage?: string,\r\n                       resultId?: string,\r\n                       reason?: ResultReason,\r\n                       text?: string,\r\n                       duration?: number,\r\n                       offset?: number,\r\n                       errorDetails?: string,\r\n                       json?: string,\r\n                       properties?: PropertyCollection) {\r\n        super(translations, resultId, reason, text, duration, offset, undefined, undefined, errorDetails, json, properties);\r\n        this.privId = participantId;\r\n        this.privOrigLang = originalLanguage;\r\n    }\r\n\r\n    /**\r\n     * The unique identifier for the participant this result is for.\r\n     */\r\n    public get participantId(): string {\r\n        return this.privId;\r\n    }\r\n\r\n    /**\r\n     * The original language this result was in.\r\n     */\r\n    public get originalLang(): string {\r\n        return this.privOrigLang;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { IStringDictionary } from \"./IDictionary.js\";\r\n\r\n/**\r\n * String helper functions\r\n */\r\nexport class StringUtils {\r\n\r\n    /**\r\n     * Formats a string by replacing the named {keys} in the string with the values contained in the replacement dictionary.\r\n     * @param format The format string that contains the parts to replace surrounded by {}. For example: \"wss://{region}.cts.speech.microsoft.com\".\r\n     * If your string needs to contain a { or } you can use the {{ and }} escape sequences respectively.\r\n     * @param replacements The dictionary of replacements. If a replacement is not found, it is replaced with an empty string\r\n     * @returns The formatted string. If you pass in a null or undefined format string, an empty string will be returned\r\n     */\r\n    public static formatString(format: string, replacements: IStringDictionary<string>): string {\r\n        if (!format) {\r\n            return \"\";\r\n        }\r\n\r\n        if (!replacements) {\r\n            return format;\r\n        }\r\n\r\n        let formatted: string = \"\";\r\n        let key: string = \"\";\r\n\r\n        const appendToFormatted = (str: string): void => {\r\n            formatted += str;\r\n        };\r\n        const appendToKey = (str: string): void => {\r\n            key += str;\r\n        };\r\n        let appendFunc: (str: string) => void = appendToFormatted;\r\n\r\n        for (let i = 0; i < format.length; i++) {\r\n            const c: string = format[i];\r\n            const next: string = i + 1 < format.length ? format[i + 1] : \"\";\r\n\r\n            switch (c) {\r\n                case \"{\":\r\n                    if (next === \"{\") {\r\n                        appendFunc(\"{\");\r\n                        i++;\r\n                    } else {\r\n                        appendFunc = appendToKey;\r\n                    }\r\n                    break;\r\n\r\n                case \"}\":\r\n                    if (next === \"}\") {\r\n                        appendFunc(\"}\");\r\n                        i++;\r\n                    } else {\r\n                        if (replacements.hasOwnProperty(key)) {\r\n                            formatted += replacements[key];\r\n                        }\r\n\r\n                        appendFunc = appendToFormatted;\r\n                        key = \"\";\r\n                    }\r\n                    break;\r\n\r\n                default:\r\n                    appendFunc(c);\r\n                    break;\r\n            }\r\n        }\r\n\r\n        return formatted;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ProxyInfo,\r\n    RestConfigBase,\r\n    WebsocketConnection,\r\n} from \"../../common.browser/Exports.js\";\r\nimport {\r\n    IConnection,\r\n    IStringDictionary,\r\n} from \"../../common/Exports.js\";\r\nimport { StringUtils } from \"../../common/StringUtils.js\";\r\nimport { Contracts } from \"../../sdk/Contracts.js\";\r\nimport {\r\n    PropertyId\r\n} from \"../../sdk/Exports.js\";\r\nimport {\r\n    ConversationImpl\r\n} from \"../../sdk/Transcription/Conversation.js\";\r\nimport { HeaderNames } from \"../HeaderNames.js\";\r\nimport { QueryParameterNames } from \"../QueryParameterNames.js\";\r\nimport {\r\n    ConnectionFactoryBase\r\n} from \"./../ConnectionFactoryBase.js\";\r\nimport {\r\n    AuthInfo,\r\n    RecognizerConfig,\r\n    TranscriberConnectionFactory,\r\n    TranslationConnectionFactory,\r\n    WebsocketMessageFormatter,\r\n} from \"./../Exports.js\";\r\n\r\n/**\r\n * Connection factory for the conversation translator. Handles connecting to the regular translator endpoint,\r\n * as well as the virtual microphone array transcription endpoint\r\n */\r\nexport class ConversationTranslatorConnectionFactory extends ConnectionFactoryBase {\r\n\r\n    private static readonly CTS_VIRT_MIC_PATH: string = \"/speech/recognition/dynamicaudio\";\r\n\r\n    private privConvGetter: () => ConversationImpl;\r\n\r\n    public constructor(convGetter: () => ConversationImpl) {\r\n        super();\r\n\r\n        Contracts.throwIfNullOrUndefined(convGetter, \"convGetter\");\r\n        this.privConvGetter = convGetter;\r\n    }\r\n\r\n    public create(config: RecognizerConfig, authInfo: AuthInfo, connectionId?: string): Promise<IConnection> {\r\n        const isVirtMicArrayEndpoint = config.parameters.getProperty(\"ConversationTranslator_MultiChannelAudio\", \"\").toUpperCase() === \"TRUE\";\r\n\r\n        const convInfo = this.privConvGetter().room;\r\n        const region = convInfo.cognitiveSpeechRegion || config.parameters.getProperty(PropertyId.SpeechServiceConnection_Region, \"\");\r\n\r\n        const replacementValues: IStringDictionary<string> = {\r\n            hostSuffix: ConnectionFactoryBase.getHostSuffix(region),\r\n            path: ConversationTranslatorConnectionFactory.CTS_VIRT_MIC_PATH,\r\n            region: encodeURIComponent(region)\r\n        };\r\n        replacementValues[QueryParameterNames.Language] = encodeURIComponent(config.parameters.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage, \"\"));\r\n        replacementValues[QueryParameterNames.CtsMeetingId] = encodeURIComponent(convInfo.roomId);\r\n        replacementValues[QueryParameterNames.CtsDeviceId] = encodeURIComponent(convInfo.participantId);\r\n        replacementValues[QueryParameterNames.CtsIsParticipant] = convInfo.isHost ? \"\" : (\"&\" + QueryParameterNames.CtsIsParticipant);\r\n\r\n        let endpointUrl: string = \"\";\r\n        const queryParams: IStringDictionary<string> = {};\r\n        const headers: IStringDictionary<string> = {};\r\n\r\n        if (isVirtMicArrayEndpoint) {\r\n            // connecting to the conversation transcription virtual microphone array endpoint\r\n            endpointUrl = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint);\r\n            if (!endpointUrl) {\r\n                const hostName = config.parameters.getProperty(\r\n                    PropertyId.SpeechServiceConnection_Host,\r\n                    \"transcribe.{region}.cts.speech{hostSuffix}\");\r\n\r\n                endpointUrl = \"wss://\" + hostName + \"{path}\";\r\n            }\r\n\r\n            // because the region can change during a session, we support being passed a format string which we can then\r\n            // replace with the correct information.\r\n            endpointUrl = StringUtils.formatString(endpointUrl, replacementValues);\r\n\r\n            const parsedUrl = new URL(endpointUrl);\r\n            parsedUrl.searchParams.forEach((val: string, key: string): void => {\r\n                queryParams[key] = val;\r\n            });\r\n\r\n            const connFactory = new TranscriberConnectionFactory();\r\n            connFactory.setQueryParams(queryParams, config, endpointUrl);\r\n\r\n            // Some query parameters are required for the CTS endpoint, let's explicity set them here\r\n            queryParams[QueryParameterNames.CtsMeetingId] = replacementValues[QueryParameterNames.CtsMeetingId];\r\n            queryParams[QueryParameterNames.CtsDeviceId] = replacementValues[QueryParameterNames.CtsDeviceId];\r\n            if (!convInfo.isHost) {\r\n                queryParams[QueryParameterNames.CtsIsParticipant] = \"\"; // this doesn't have a value so set to an empty string\r\n            }\r\n\r\n            if (!(QueryParameterNames.Format in queryParams)) {\r\n                queryParams[QueryParameterNames.Format] = \"simple\";\r\n            }\r\n\r\n            parsedUrl.searchParams.forEach((val: string, key: string): void => {\r\n                parsedUrl.searchParams.set(key, queryParams[key]);\r\n                delete queryParams[key];\r\n            });\r\n\r\n            endpointUrl = parsedUrl.toString();\r\n\r\n        } else {\r\n            // connecting to regular translation endpoint\r\n            const connFactory = new TranslationConnectionFactory();\r\n\r\n            endpointUrl = connFactory.getEndpointUrl(config, true);\r\n            endpointUrl = StringUtils.formatString(endpointUrl, replacementValues);\r\n\r\n            connFactory.setQueryParams(queryParams, config, endpointUrl);\r\n        }\r\n\r\n        headers[HeaderNames.ConnectionId] = connectionId;\r\n        headers[RestConfigBase.configParams.token] = convInfo.token;\r\n        if (!!authInfo.token) {\r\n            headers[authInfo.headerName] = authInfo.token;\r\n        }\r\n\r\n        const enableCompression = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"\").toUpperCase() === \"TRUE\";\r\n        return Promise.resolve(new WebsocketConnection(endpointUrl, queryParams, headers, new WebsocketMessageFormatter(), ProxyInfo.fromRecognizerConfig(config), enableCompression, connectionId));\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// Multi-device Conversation is a Preview feature.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport {\r\n    ConversationConnectionConfig,\r\n    IAuthentication,\r\n    ServicePropertiesPropertyName,\r\n} from \"../../common.speech/Exports.js\";\r\nimport { ConversationTranslatorConnectionFactory } from \"../../common.speech/Transcription/ConversationTranslatorConnectionFactory.js\";\r\nimport {\r\n    IDisposable,\r\n    IErrorMessages,\r\n    IStringDictionary,\r\n    marshalPromiseToCallbacks\r\n} from \"../../common/Exports.js\";\r\nimport { Contracts } from \"../Contracts.js\";\r\nimport {\r\n    AudioConfig,\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    ProfanityOption,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    ServicePropertyChannel,\r\n    SessionEventArgs,\r\n    SpeechTranslationConfig,\r\n    TranslationRecognitionEventArgs,\r\n    TranslationRecognizer\r\n} from \"../Exports.js\";\r\nimport { ConversationImpl } from \"./Conversation.js\";\r\nimport {\r\n    ConversationCommon,\r\n    ConversationExpirationEventArgs,\r\n    ConversationHandler,\r\n    ConversationParticipantsChangedEventArgs,\r\n    ConversationTranslationCanceledEventArgs,\r\n    ConversationTranslationEventArgs,\r\n    IConversationTranslator,\r\n    Participant\r\n} from \"./Exports.js\";\r\nimport { Callback, IConversation } from \"./IConversation.js\";\r\n\r\nexport enum SpeechState {\r\n    Inactive, Connecting, Connected\r\n}\r\n\r\n// child class of TranslationRecognizer meant only for use with ConversationTranslator\r\nclass ConversationTranslationRecognizer extends TranslationRecognizer {\r\n    private privTranslator: ConversationTranslator;\r\n    private privSpeechState: SpeechState;\r\n\r\n    public constructor(speechConfig: SpeechTranslationConfig, audioConfig: AudioConfig, translator: ConversationTranslator, convGetter: () => ConversationImpl) {\r\n\r\n        super(speechConfig, audioConfig, new ConversationTranslatorConnectionFactory(convGetter));\r\n\r\n        this.privSpeechState = SpeechState.Inactive;\r\n        if (!!translator) {\r\n            this.privTranslator = translator;\r\n            this.sessionStarted = (): void => {\r\n                this.privSpeechState = SpeechState.Connected;\r\n            };\r\n\r\n            this.sessionStopped = (): void => {\r\n                this.privSpeechState = SpeechState.Inactive;\r\n            };\r\n\r\n            this.recognizing = (tr: TranslationRecognizer, e: TranslationRecognitionEventArgs): void => {\r\n                if (!!this.privTranslator.recognizing) {\r\n                    this.privTranslator.recognizing(this.privTranslator, e);\r\n                }\r\n            };\r\n\r\n            // eslint-disable-next-line @typescript-eslint/no-misused-promises\r\n            this.recognized = async (tr: TranslationRecognizer, e: TranslationRecognitionEventArgs): Promise<void> => {\r\n                // if there is an error connecting to the conversation service from the speech service the error will be returned in the ErrorDetails field.\r\n                if (e.result?.errorDetails) {\r\n                    await this.cancelSpeech();\r\n                    // TODO: format the error message contained in 'errorDetails'\r\n                    this.fireCancelEvent(e.result.errorDetails);\r\n                } else {\r\n                    if (!!this.privTranslator.recognized) {\r\n                        this.privTranslator.recognized(this.privTranslator, e);\r\n                    }\r\n                }\r\n                return;\r\n            };\r\n\r\n            // eslint-disable-next-line @typescript-eslint/no-misused-promises\r\n            this.canceled = async (): Promise<void> => {\r\n                if (this.privSpeechState !== SpeechState.Inactive) {\r\n                    try {\r\n                        await this.cancelSpeech();\r\n                    } catch (error) {\r\n                        this.privSpeechState = SpeechState.Inactive;\r\n                    }\r\n                }\r\n            };\r\n        }\r\n    }\r\n\r\n    public get state(): SpeechState {\r\n        return this.privSpeechState;\r\n    }\r\n\r\n    public set state(newState: SpeechState) {\r\n        this.privSpeechState = newState;\r\n    }\r\n\r\n    public set authentication(token: IAuthentication) {\r\n        this.privReco.authentication = token;\r\n    }\r\n\r\n\r\n    public onConnection(): void {\r\n        this.privSpeechState = SpeechState.Connected;\r\n    }\r\n\r\n    public async onCancelSpeech(): Promise<void> {\r\n        this.privSpeechState = SpeechState.Inactive;\r\n        await this.cancelSpeech();\r\n    }\r\n\r\n    /**\r\n     * Fire a cancel event\r\n     * @param error\r\n     */\r\n    private fireCancelEvent(error: string): void {\r\n        try {\r\n            if (!!this.privTranslator.canceled) {\r\n                const cancelEvent: ConversationTranslationCanceledEventArgs = new ConversationTranslationCanceledEventArgs(\r\n                    CancellationReason.Error,\r\n                    error,\r\n                    CancellationErrorCode.RuntimeError\r\n                    );\r\n\r\n                this.privTranslator.canceled(this.privTranslator, cancelEvent);\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    }\r\n\r\n    private async cancelSpeech(): Promise<void> {\r\n        try {\r\n            this.stopContinuousRecognitionAsync();\r\n            await this.privReco?.disconnect();\r\n            this.privSpeechState = SpeechState.Inactive;\r\n        } catch (e) {\r\n            // ignore the error\r\n        }\r\n    }\r\n}\r\n\r\n/**\r\n * Join, leave or connect to a conversation.\r\n */\r\nexport class ConversationTranslator extends ConversationCommon implements IConversationTranslator, IDisposable {\r\n\r\n    public canceled: (sender: ConversationHandler, event: ConversationTranslationCanceledEventArgs) => void;\r\n    public conversationExpiration: (sender: IConversationTranslator, event: ConversationExpirationEventArgs) => void;\r\n    public participantsChanged: (sender: IConversationTranslator, event: ConversationParticipantsChangedEventArgs) => void;\r\n    public sessionStarted: (sender: ConversationHandler, event: SessionEventArgs) => void;\r\n    public sessionStopped: (sender: ConversationHandler, event: SessionEventArgs) => void;\r\n    public textMessageReceived: (sender: IConversationTranslator, event: ConversationTranslationEventArgs) => void;\r\n\r\n    // Callbacks for whole conversation results\r\n    public transcribed: (sender: IConversationTranslator, event: ConversationTranslationEventArgs) => void;\r\n    public transcribing: (sender: IConversationTranslator, event: ConversationTranslationEventArgs) => void;\r\n\r\n    // Callbacks for detecting speech/translation results from self\r\n    public recognized: (sender: IConversationTranslator, event: TranslationRecognitionEventArgs) => void;\r\n    public recognizing: (sender: IConversationTranslator, event: TranslationRecognitionEventArgs) => void;\r\n\r\n    private privSpeechRecognitionLanguage: string;\r\n    private privProperties: PropertyCollection;\r\n    private privIsDisposed: boolean;\r\n    private privCTRecognizer: ConversationTranslationRecognizer;\r\n    private privIsSpeaking: boolean;\r\n    private privConversation: ConversationImpl;\r\n    private privErrors: IErrorMessages = ConversationConnectionConfig.restErrors;\r\n    private privPlaceholderKey: string;\r\n    private privPlaceholderRegion: string;\r\n\r\n    public constructor(audioConfig?: AudioConfig) {\r\n        super(audioConfig);\r\n        this.privIsDisposed = false;\r\n        this.privIsSpeaking = false;\r\n        this.privPlaceholderKey = \"abcdefghijklmnopqrstuvwxyz012345\";\r\n        this.privPlaceholderRegion = \"westus\";\r\n        this.privProperties = new PropertyCollection();\r\n    }\r\n\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    public get speechRecognitionLanguage(): string {\r\n        return this.privSpeechRecognitionLanguage;\r\n    }\r\n\r\n    public get participants(): Participant[] {\r\n        return this.privConversation?.participants;\r\n    }\r\n\r\n    private get canSpeak(): boolean {\r\n\r\n        // is there a Conversation websocket available and has the Recognizer been set up\r\n        if (!this.privConversation.isConnected || !this.privCTRecognizer) {\r\n            return false;\r\n        }\r\n\r\n        // is the user already speaking\r\n        if (this.privIsSpeaking || this.privCTRecognizer.state === SpeechState.Connected || this.privCTRecognizer.state === SpeechState.Connecting) {\r\n            return false;\r\n        }\r\n\r\n        // is the user muted\r\n        if (this.privConversation.isMutedByHost) {\r\n            return false;\r\n        }\r\n\r\n        return true;\r\n    }\r\n\r\n    public onToken(token: IAuthentication): void {\r\n        this.privCTRecognizer.authentication = token;\r\n    }\r\n\r\n    public setServiceProperty(name: string, value: string): void {\r\n        const currentProperties: IStringDictionary<string> = JSON.parse(this.privProperties.getProperty(ServicePropertiesPropertyName, \"{}\")) as IStringDictionary<string>;\r\n\r\n        currentProperties[name] = value;\r\n\r\n        this.privProperties.setProperty(ServicePropertiesPropertyName, JSON.stringify(currentProperties));\r\n    }\r\n\r\n    /**\r\n     * Join a conversation. If this is the host, pass in the previously created Conversation object.\r\n     * @param conversation\r\n     * @param nickname\r\n     * @param lang\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public joinConversationAsync(conversation: IConversation, nickname: string, cb?: Callback, err?: Callback): void;\r\n    public joinConversationAsync(conversationId: string, nickname: string, lang: string, cb?: Callback, err?: Callback): void;\r\n    public joinConversationAsync(conversation: string | IConversation, nickname: string, param1?: string | Callback, param2?: Callback, param3?: Callback): void {\r\n\r\n        try {\r\n\r\n            if (typeof conversation === \"string\") {\r\n\r\n                Contracts.throwIfNullOrUndefined(conversation, this.privErrors.invalidArgs.replace(\"{arg}\", \"conversation id\"));\r\n                Contracts.throwIfNullOrWhitespace(nickname, this.privErrors.invalidArgs.replace(\"{arg}\", \"nickname\"));\r\n\r\n                if (!!this.privConversation) {\r\n                    this.handleError(new Error(this.privErrors.permissionDeniedStart), param3);\r\n                }\r\n\r\n                let lang: string = param1 as string;\r\n                if (lang === undefined || lang === null || lang === \"\") {\r\n                    lang = ConversationConnectionConfig.defaultLanguageCode;\r\n                }\r\n\r\n                // create a placeholder config\r\n                this.privSpeechTranslationConfig = SpeechTranslationConfig.fromSubscription(\r\n                    this.privPlaceholderKey,\r\n                    this.privPlaceholderRegion);\r\n                this.privSpeechTranslationConfig.setProfanity(ProfanityOption.Masked);\r\n                this.privSpeechTranslationConfig.addTargetLanguage(lang);\r\n                this.privSpeechTranslationConfig.setProperty(PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage], lang);\r\n                this.privSpeechTranslationConfig.setProperty(PropertyId[PropertyId.ConversationTranslator_Name], nickname);\r\n\r\n                const propertyIdsToCopy: (string | PropertyId)[] = [\r\n                    PropertyId.SpeechServiceConnection_Host,\r\n                    PropertyId.ConversationTranslator_Host,\r\n                    PropertyId.SpeechServiceConnection_Endpoint,\r\n                    PropertyId.SpeechServiceConnection_ProxyHostName,\r\n                    PropertyId.SpeechServiceConnection_ProxyPassword,\r\n                    PropertyId.SpeechServiceConnection_ProxyPort,\r\n                    PropertyId.SpeechServiceConnection_ProxyUserName,\r\n                    \"ConversationTranslator_MultiChannelAudio\",\r\n                    \"ConversationTranslator_Region\"\r\n                ];\r\n\r\n                for (const prop of propertyIdsToCopy) {\r\n                    const value = this.privProperties.getProperty(prop);\r\n                    if (value) {\r\n                        const key = typeof prop === \"string\" ? prop : PropertyId[prop];\r\n                        this.privSpeechTranslationConfig.setProperty(key, value);\r\n                    }\r\n                }\r\n\r\n                const currentProperties  = JSON.parse(this.privProperties.getProperty(ServicePropertiesPropertyName, \"{}\")) as IStringDictionary<string>;\r\n                for (const prop of Object.keys(currentProperties)) {\r\n                    this.privSpeechTranslationConfig.setServiceProperty(prop, currentProperties[prop], ServicePropertyChannel.UriQueryParameter);\r\n                }\r\n\r\n                // join the conversation\r\n                this.privConversation = new ConversationImpl(this.privSpeechTranslationConfig);\r\n                this.privConversation.conversationTranslator = this;\r\n\r\n                this.privConversation.joinConversationAsync(\r\n                    conversation,\r\n                    nickname,\r\n                    lang,\r\n                    ((result: string): void => {\r\n\r\n                        if (!result) {\r\n                            this.handleError(new Error(this.privErrors.permissionDeniedConnect), param3);\r\n                        }\r\n\r\n                        this.privSpeechTranslationConfig.authorizationToken = result;\r\n                        this.privConversation.room.isHost = false;\r\n\r\n                        // connect to the ws\r\n                        this.privConversation.startConversationAsync(\r\n                            ((): void => {\r\n                                this.handleCallback(param2, param3);\r\n                            }),\r\n                            ((error: any): void => {\r\n                                this.handleError(error, param3);\r\n                            }));\r\n\r\n                    }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, param3);\r\n                    }));\r\n\r\n            } else if (typeof conversation === \"object\") {\r\n\r\n                Contracts.throwIfNullOrUndefined(conversation, this.privErrors.invalidArgs.replace(\"{arg}\", \"conversation id\"));\r\n                Contracts.throwIfNullOrWhitespace(nickname, this.privErrors.invalidArgs.replace(\"{arg}\", \"nickname\"));\r\n\r\n                // save the nickname\r\n                this.privProperties.setProperty(PropertyId.ConversationTranslator_Name, nickname);\r\n                // ref the conversation object\r\n                this.privConversation = conversation as ConversationImpl;\r\n                // ref the conversation translator object\r\n                this.privConversation.conversationTranslator = this;\r\n                this.privConversation.room.isHost = true;\r\n\r\n                Contracts.throwIfNullOrUndefined(this.privConversation, this.privErrors.permissionDeniedConnect);\r\n                Contracts.throwIfNullOrUndefined(this.privConversation.room.token, this.privErrors.permissionDeniedConnect);\r\n\r\n                this.privSpeechTranslationConfig = conversation.config;\r\n\r\n                this.handleCallback(param1 as Callback, param2);\r\n            } else {\r\n                this.handleError(\r\n                    new Error(this.privErrors.invalidArgs.replace(\"{arg}\", \"invalid conversation type\")),\r\n                    param2);\r\n            }\r\n\r\n        } catch (error) {\r\n            this.handleError(error, typeof param1 === \"string\" ? param3 : param2);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Leave the conversation\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public leaveConversationAsync(cb?: Callback, err?: Callback): void {\r\n\r\n        marshalPromiseToCallbacks((async (): Promise<void> => {\r\n\r\n            // stop the speech websocket\r\n            await this.cancelSpeech();\r\n            // stop the websocket\r\n            await this.privConversation.endConversationImplAsync();\r\n            // https delete request\r\n            await this.privConversation.deleteConversationImplAsync();\r\n            this.dispose();\r\n\r\n        })(), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Send a text message\r\n     * @param message\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public sendTextMessageAsync(message: string, cb?: Callback, err?: Callback): void {\r\n\r\n        try {\r\n            Contracts.throwIfNullOrUndefined(this.privConversation, this.privErrors.permissionDeniedSend);\r\n            Contracts.throwIfNullOrWhitespace(message, this.privErrors.invalidArgs.replace(\"{arg}\", message));\r\n\r\n            this.privConversation.sendTextMessageAsync(message, cb, err);\r\n        } catch (error) {\r\n\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Start speaking\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public startTranscribingAsync(cb?: Callback, err?: Callback): void {\r\n        marshalPromiseToCallbacks((async (): Promise<void> => {\r\n            try {\r\n                Contracts.throwIfNullOrUndefined(this.privConversation, this.privErrors.permissionDeniedSend);\r\n                Contracts.throwIfNullOrUndefined(this.privConversation.room.token, this.privErrors.permissionDeniedConnect);\r\n\r\n                if (this.privCTRecognizer === undefined) {\r\n                    await this.connectTranslatorRecognizer();\r\n                }\r\n                Contracts.throwIfNullOrUndefined(this.privCTRecognizer, this.privErrors.permissionDeniedSend);\r\n\r\n                if (!this.canSpeak) {\r\n                    this.handleError(new Error(this.privErrors.permissionDeniedSend), err);\r\n                }\r\n\r\n                await this.startContinuousRecognition();\r\n\r\n                this.privIsSpeaking = true;\r\n            } catch (error) {\r\n                this.privIsSpeaking = false;\r\n                await this.cancelSpeech();\r\n                throw error;\r\n            }\r\n        })(), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Stop speaking\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public stopTranscribingAsync(cb?: Callback, err?: Callback): void {\r\n        marshalPromiseToCallbacks((async (): Promise<void> => {\r\n            try {\r\n                if (!this.privIsSpeaking) {\r\n                    // stop speech\r\n                    await this.cancelSpeech();\r\n                    return;\r\n                }\r\n\r\n                // stop the recognition but leave the websocket open\r\n                this.privIsSpeaking = false;\r\n                await new Promise<void>((resolve: (value: void) => void, reject: (reason?: any) => void): void => {\r\n                    this.privCTRecognizer.stopContinuousRecognitionAsync(resolve, reject);\r\n                });\r\n\r\n            } catch (error) {\r\n                await this.cancelSpeech();\r\n            }\r\n        })(), cb, err);\r\n    }\r\n\r\n    public isDisposed(): boolean {\r\n        return this.privIsDisposed;\r\n    }\r\n\r\n    public dispose(reason?: string, success?: () => void, err?: (error: string) => void): void {\r\n        marshalPromiseToCallbacks((async (): Promise<void> => {\r\n            if (this.isDisposed && !this.privIsSpeaking) {\r\n                return;\r\n            }\r\n            await this.cancelSpeech();\r\n            this.privIsDisposed = true;\r\n            this.privSpeechTranslationConfig.close();\r\n            this.privSpeechRecognitionLanguage = undefined;\r\n            this.privProperties = undefined;\r\n            this.privAudioConfig = undefined;\r\n            this.privSpeechTranslationConfig = undefined;\r\n            this.privConversation.dispose();\r\n            this.privConversation = undefined;\r\n        })(), success, err);\r\n    }\r\n\r\n    /**\r\n     * Cancel the speech websocket\r\n     */\r\n    private async cancelSpeech(): Promise<void> {\r\n        try {\r\n            this.privIsSpeaking = false;\r\n            await this.privCTRecognizer?.onCancelSpeech();\r\n            this.privCTRecognizer = undefined;\r\n        } catch (e) {\r\n            // ignore the error\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Connect to the speech translation recognizer.\r\n     * Currently there is no language validation performed before sending the SpeechLanguage code to the service.\r\n     * If it's an invalid language the raw error will be: 'Error during WebSocket handshake: Unexpected response code: 400'\r\n     * e.g. pass in 'fr' instead of 'fr-FR', or a text-only language 'cy'\r\n     */\r\n    private async connectTranslatorRecognizer(): Promise<void> {\r\n        try {\r\n\r\n            if (this.privAudioConfig === undefined) {\r\n                this.privAudioConfig = AudioConfig.fromDefaultMicrophoneInput();\r\n            }\r\n\r\n            // clear the temp subscription key if it's a participant joining\r\n            if (this.privSpeechTranslationConfig.getProperty(PropertyId[PropertyId.SpeechServiceConnection_Key])\r\n                === this.privPlaceholderKey) {\r\n                this.privSpeechTranslationConfig.setProperty(PropertyId[PropertyId.SpeechServiceConnection_Key], \"\");\r\n            }\r\n\r\n            const convGetter = (): ConversationImpl => this.privConversation;\r\n            this.privCTRecognizer = new ConversationTranslationRecognizer(this.privSpeechTranslationConfig, this.privAudioConfig, this, convGetter);\r\n        } catch (error) {\r\n            await this.cancelSpeech();\r\n            throw error;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Handle the start speaking request\r\n     */\r\n    private startContinuousRecognition(): Promise<void> {\r\n        return new Promise((resolve: () => void, reject: (error: string) => void): void => {\r\n            this.privCTRecognizer.startContinuousRecognitionAsync(resolve, reject);\r\n        });\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    IAuthentication,\r\n    IConnectionFactory,\r\n    OutputFormatPropertyName,\r\n    RecognizerConfig,\r\n    ServiceRecognizerBase,\r\n    // SpeechConnectionFactory,\r\n    ConversationTranscriberConnectionFactory,\r\n    SpeechServiceConfig,\r\n    ConversationTranscriptionServiceRecognizer,\r\n} from \"../../common.speech/Exports.js\";\r\nimport { RecognitionMode } from \"../../common.speech/ServiceMessages/PhraseDetection/PhraseDetectionContext.js\";\r\nimport { marshalPromiseToCallbacks } from \"../../common/Exports.js\";\r\nimport { AudioConfigImpl } from \"../Audio/AudioConfig.js\";\r\nimport { Contracts } from \"../Contracts.js\";\r\nimport {\r\n    AudioConfig,\r\n    AutoDetectSourceLanguageConfig,\r\n    ConversationTranscriptionEventArgs,\r\n    ConversationTranscriptionCanceledEventArgs,\r\n    OutputFormat,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    Recognizer,\r\n} from \"../Exports.js\";\r\nimport { SpeechConfig, SpeechConfigImpl } from \"../SpeechConfig.js\";\r\n\r\n/**\r\n * Performs speech recognition with speaker separation from microphone, file, or other audio input streams, and gets transcribed text as result.\r\n * @class ConversationTranscriber\r\n */\r\nexport class ConversationTranscriber extends Recognizer {\r\n    private privDisposedRecognizer: boolean;\r\n\r\n    /**\r\n     * ConversationTranscriber constructor.\r\n     * @constructor\r\n     * @param {SpeechConfig} speechConfig - an set of initial properties for this recognizer\r\n     * @param {AudioConfig} audioConfig - An optional audio configuration associated with the recognizer\r\n     */\r\n    public constructor(speechConfig: SpeechConfig, audioConfig?: AudioConfig) {\r\n        const speechConfigImpl: SpeechConfigImpl = speechConfig as SpeechConfigImpl;\r\n        Contracts.throwIfNull(speechConfigImpl, \"speechConfig\");\r\n\r\n        Contracts.throwIfNullOrWhitespace(\r\n            speechConfigImpl.properties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage),\r\n            PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage]);\r\n\r\n        super(audioConfig, speechConfigImpl.properties, new ConversationTranscriberConnectionFactory(), speechConfig.tokenCredential);\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceConnection_RecognitionEndpointVersion, \"2\");\r\n        this.privDisposedRecognizer = false;\r\n    }\r\n\r\n    /**\r\n     * ConversationTranscriber constructor.\r\n     * @constructor\r\n     * @param {SpeechConfig} speechConfig - an set of initial properties for this recognizer\r\n     * @param {AutoDetectSourceLanguageConfig} autoDetectSourceLanguageConfig - An source language detection configuration associated with the recognizer\r\n     * @param {AudioConfig} audioConfig - An optional audio configuration associated with the recognizer\r\n     */\r\n    public static FromConfig(speechConfig: SpeechConfig, autoDetectSourceLanguageConfig: AutoDetectSourceLanguageConfig, audioConfig?: AudioConfig): ConversationTranscriber {\r\n        const speechConfigImpl: SpeechConfigImpl = speechConfig as SpeechConfigImpl;\r\n        autoDetectSourceLanguageConfig.properties.mergeTo(speechConfigImpl.properties);\r\n        const recognizer = new ConversationTranscriber(speechConfig, audioConfig);\r\n        return recognizer;\r\n    }\r\n\r\n    /**\r\n     * The event transcribing signals that an intermediate transcription result is received.\r\n     * @member ConversationTranscriber.prototype.transcribing\r\n     * @function\r\n     * @public\r\n     */\r\n    public transcribing: (sender: Recognizer, event: ConversationTranscriptionEventArgs) => void;\r\n\r\n    /**\r\n     * The event transcriber signals that a final recognition result is received.\r\n     * @member ConversationTranscriber.prototype.transcribed\r\n     * @function\r\n     * @public\r\n     */\r\n    public transcribed: (sender: Recognizer, event: ConversationTranscriptionEventArgs) => void;\r\n\r\n    /**\r\n     * The event canceled signals that an error occurred during transcription.\r\n     * @member ConversationTranscriber.prototype.canceled\r\n     * @function\r\n     * @public\r\n     */\r\n    public canceled: (sender: Recognizer, event: ConversationTranscriptionCanceledEventArgs) => void;\r\n\r\n    /**\r\n     * Gets the endpoint id of a customized speech model that is used for transcription.\r\n     * @member ConversationTranscriber.prototype.endpointId\r\n     * @function\r\n     * @public\r\n     * @returns {string} the endpoint id of a customized speech model that is used for speech recognition.\r\n     */\r\n    public get endpointId(): string {\r\n        Contracts.throwIfDisposed(this.privDisposedRecognizer);\r\n\r\n        return this.properties.getProperty(PropertyId.SpeechServiceConnection_EndpointId, \"00000000-0000-0000-0000-000000000000\");\r\n    }\r\n\r\n    /**\r\n     * Gets the authorization token used to communicate with the service.\r\n     * @member ConversationTranscriber.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @returns {string} Authorization token.\r\n     */\r\n    public get authorizationToken(): string {\r\n        return this.properties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets the authorization token used to communicate with the service.\r\n     * @member ConversationTranscriber.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} token - Authorization token.\r\n     */\r\n    public set authorizationToken(token: string) {\r\n        Contracts.throwIfNullOrWhitespace(token, \"token\");\r\n        this.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, token);\r\n    }\r\n\r\n    /**\r\n     * Gets the spoken language of transcription.\r\n     * @member ConversationTranscriber.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     * @returns {string} The spoken language of transcription.\r\n     */\r\n    public get speechRecognitionLanguage(): string {\r\n        Contracts.throwIfDisposed(this.privDisposedRecognizer);\r\n\r\n        return this.properties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage);\r\n    }\r\n\r\n    /**\r\n     * Gets the output format of transcription.\r\n     * @member ConversationTranscriber.prototype.outputFormat\r\n     * @function\r\n     * @public\r\n     * @returns {OutputFormat} The output format of transcription.\r\n     */\r\n    public get outputFormat(): OutputFormat {\r\n        Contracts.throwIfDisposed(this.privDisposedRecognizer);\r\n\r\n        if (this.properties.getProperty(OutputFormatPropertyName, OutputFormat[OutputFormat.Simple]) === OutputFormat[OutputFormat.Simple]) {\r\n            return OutputFormat.Simple;\r\n        } else {\r\n            return OutputFormat.Detailed;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * The collection of properties and their values defined for this conversation transcriber.\r\n     * @member ConversationTranscriber.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} The collection of properties and their values defined for this SpeechRecognizer.\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    /**\r\n     * Starts conversation transcription, until stopTranscribingAsync() is called.\r\n     * User must subscribe to events to receive transcription results.\r\n     * @member ConversationTranscriber.prototype.startTranscribingAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback invoked once the transcription has started.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public startTranscribingAsync(cb?: () => void, err?: (e: string) => void): void {\r\n        marshalPromiseToCallbacks(this.startContinuousRecognitionAsyncImpl(RecognitionMode.Conversation), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Stops conversation transcription.\r\n     * @member ConversationTranscriber.prototype.stopTranscribingAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback invoked once the transcription has stopped.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public stopTranscribingAsync(cb?: () => void, err?: (e: string) => void): void {\r\n        marshalPromiseToCallbacks(this.stopContinuousRecognitionAsyncImpl(), cb, err);\r\n    }\r\n\r\n    /**\r\n     * closes all external resources held by an instance of this class.\r\n     * @member ConversationTranscriber.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(cb?: () => void, errorCb?: (error: string) => void): void {\r\n        Contracts.throwIfDisposed(this.privDisposedRecognizer);\r\n        marshalPromiseToCallbacks(this.dispose(true), cb, errorCb);\r\n    }\r\n\r\n    /**\r\n     * Disposes any resources held by the object.\r\n     * @member SpeechRecognizer.prototype.dispose\r\n     * @function\r\n     * @public\r\n     * @param {boolean} disposing - true if disposing the object.\r\n     */\r\n    protected async dispose(disposing: boolean): Promise<void> {\r\n        if (this.privDisposedRecognizer) {\r\n            return;\r\n        }\r\n\r\n        if (disposing) {\r\n            this.privDisposedRecognizer = true;\r\n            await this.implRecognizerStop();\r\n        }\r\n\r\n        await super.dispose(disposing);\r\n    }\r\n\r\n    protected createRecognizerConfig(speechConfig: SpeechServiceConfig): RecognizerConfig {\r\n        return new RecognizerConfig(speechConfig, this.privProperties);\r\n    }\r\n\r\n    protected createServiceRecognizer(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioConfig: AudioConfig,\r\n        recognizerConfig: RecognizerConfig): ServiceRecognizerBase {\r\n        const configImpl: AudioConfigImpl = audioConfig as AudioConfigImpl;\r\n        recognizerConfig.isSpeakerDiarizationEnabled = true;\r\n        return new ConversationTranscriptionServiceRecognizer(authentication, connectionFactory, configImpl, recognizerConfig, this);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// Multi-device Conversation is a Preview feature.\r\n\r\n/* eslint-disable max-classes-per-file */\r\nimport { PropertyCollection } from \"../Exports.js\";\r\n\r\n/**\r\n * Represents a user in a conversation.\r\n * Added in version 1.4.0\r\n */\r\nexport interface IUser {\r\n    /** Gets the user's ID */\r\n    readonly userId: string;\r\n}\r\n\r\nexport class User implements IUser {\r\n    private privUserId: string;\r\n\r\n    public constructor(userId: string) {\r\n        this.privUserId = userId;\r\n    }\r\n\r\n    public get userId(): string {\r\n        return this.privUserId;\r\n    }\r\n}\r\n\r\nexport interface VoiceSignature {\r\n    Version: number;\r\n    Tag: string;\r\n    Data: string;\r\n}\r\n\r\nexport interface TranscriptionParticipant {\r\n    /** The unique identifier for the participant. */\r\n    readonly id: string;\r\n    /** The participant's preferred spoken language. */\r\n    readonly preferredLanguage: string;\r\n    /** The participant's voice signature */\r\n    readonly voice: string;\r\n}\r\n\r\n/**\r\n * Represents a participant in a conversation.\r\n * Added in version 1.4.0\r\n */\r\nexport interface IParticipant extends TranscriptionParticipant {\r\n    /** Gets the colour of the user's avatar as an HTML hex string (e.g. FF0000 for red). */\r\n    readonly avatar: string;\r\n    /**\r\n     * The participant's display name. Please note that there may be more than one participant\r\n     * with the same name. You can use <see cref=\"Id\"/> property to tell them apart.\r\n     */\r\n    readonly displayName: string;\r\n    /** Gets whether or not this participant is the host. */\r\n    readonly isHost: boolean;\r\n    /** Gets whether or not this participant is muted. */\r\n    readonly isMuted: boolean;\r\n    /** Gets whether or not the participant is using Text To Speech (TTS). */\r\n    readonly isUsingTts: boolean;\r\n    /** Contains properties of the participant. */\r\n    readonly properties: PropertyCollection;\r\n}\r\n\r\nexport class Participant implements IParticipant {\r\n    private privAvatar: string;\r\n    private privDisplayName: string;\r\n    private privId: string;\r\n    private privIsHost: boolean;\r\n    private privIsMuted: boolean;\r\n    private privIsUsingTts: boolean;\r\n    private privPreferredLanguage: string;\r\n    private privVoice: string;\r\n    private privProperties: PropertyCollection;\r\n\r\n    public constructor(id: string, avatar: string, displayName: string, isHost: boolean, isMuted: boolean, isUsingTts: boolean, preferredLanguage: string, voice?: string) {\r\n        this.privId = id;\r\n        this.privAvatar = avatar;\r\n        this.privDisplayName = displayName;\r\n        this.privIsHost = isHost;\r\n        this.privIsMuted = isMuted;\r\n        this.privIsUsingTts = isUsingTts;\r\n        this.privPreferredLanguage = preferredLanguage;\r\n        this.privVoice = voice;\r\n        this.privProperties = new PropertyCollection();\r\n    }\r\n\r\n    public get avatar(): string {\r\n        return this.privAvatar;\r\n    }\r\n\r\n    public get displayName(): string {\r\n        return this.privDisplayName;\r\n    }\r\n\r\n    public get id(): string {\r\n        return this.privId;\r\n    }\r\n\r\n    public get preferredLanguage(): string {\r\n        return this.privPreferredLanguage;\r\n    }\r\n\r\n    public get isHost(): boolean {\r\n        return this.privIsHost;\r\n    }\r\n\r\n    public get isMuted(): boolean {\r\n        return this.privIsMuted;\r\n    }\r\n\r\n    public get isUsingTts(): boolean {\r\n        return this.privIsUsingTts;\r\n    }\r\n\r\n    public get voice(): string {\r\n        return this.privVoice;\r\n    }\r\n\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    public static From(id: string, language: string, voice: string): IParticipant {\r\n        return new Participant(id, \"\", id, false, false, false, language, voice);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// Multi-device Conversation is a Preview feature.\r\n\r\nexport enum ParticipantChangedReason {\r\n    /** Participant has joined the conversation. */\r\n    JoinedConversation,\r\n\r\n    /** Participant has left the conversation. This could be voluntary, or involuntary\r\n     * (e.g. they are experiencing networking issues).\r\n     */\r\n    LeftConversation,\r\n\r\n    /** The participants' state has changed (e.g. they became muted, changed their nickname). */\r\n    Updated\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// Multi-device Conversation is a Preview feature.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport {\r\n    ConversationConnectionConfig,\r\n    ConversationManager,\r\n    ConversationReceivedTranslationEventArgs,\r\n    ConversationRecognizer,\r\n    ConversationTranslatorCommandTypes,\r\n    ConversationTranslatorMessageTypes,\r\n    IInternalConversation,\r\n    IInternalParticipant,\r\n    InternalParticipants,\r\n    MuteAllEventArgs,\r\n    ParticipantAttributeEventArgs,\r\n    ParticipantEventArgs,\r\n    ParticipantsListEventArgs,\r\n    TranscriberRecognizer\r\n} from \"../../common.speech/Exports.js\";\r\nimport {\r\n    IDisposable,\r\n    IErrorMessages,\r\n    marshalPromiseToCallbacks\r\n} from \"../../common/Exports.js\";\r\nimport { Contracts } from \"../Contracts.js\";\r\nimport {\r\n    ConnectionEventArgs,\r\n    ConversationExpirationEventArgs,\r\n    ConversationParticipantsChangedEventArgs,\r\n    ConversationTranslationCanceledEventArgs,\r\n    ConversationTranslationEventArgs,\r\n    ConversationTranslator,\r\n    Participant,\r\n    ParticipantChangedReason,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    SpeechTranslationConfig,\r\n} from \"../Exports.js\";\r\nimport { SpeechTranslationConfigImpl } from \"../SpeechTranslationConfig.js\";\r\nimport { Callback, MeetingInfo, MeetingProperties, IMeeting } from \"./IMeeting.js\";\r\nimport { IParticipant, IUser, TranscriptionParticipant } from \"./IParticipant.js\";\r\n\r\nexport abstract class Meeting implements IMeeting {\r\n\r\n    protected constructor() {\r\n        return;\r\n    }\r\n\r\n    public abstract get authorizationToken(): string;\r\n\r\n    public abstract get config(): SpeechTranslationConfig;\r\n\r\n    public abstract get meetingId(): string;\r\n    public abstract get meetingInfo(): MeetingInfo;\r\n    public abstract get properties(): PropertyCollection;\r\n    public abstract get speechRecognitionLanguage(): string;\r\n    public abstract get participants(): Participant[];\r\n    public abstract set authorizationToken(value: string);\r\n    public abstract get isConnected(): boolean;\r\n\r\n    /**\r\n     * Create a meeting\r\n     * @param speechConfig\r\n     * @param meetingId\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public static createMeetingAsync(speechConfig: SpeechTranslationConfig, meetingId: string, arg3?: Callback, arg4?: Callback): Meeting {\r\n        Contracts.throwIfNullOrUndefined(speechConfig, ConversationConnectionConfig.restErrors.invalidArgs.replace(\"{arg}\", \"config\"));\r\n        Contracts.throwIfNullOrUndefined(speechConfig.region, ConversationConnectionConfig.restErrors.invalidArgs.replace(\"{arg}\", \"SpeechServiceConnection_Region\"));\r\n        Contracts.throwIfNull(meetingId, \"meetingId\");\r\n        if (meetingId.length === 0) {\r\n            throw new Error(\"meetingId cannot be empty\");\r\n        }\r\n        if (!speechConfig.subscriptionKey && !speechConfig.getProperty(PropertyId[PropertyId.SpeechServiceAuthorization_Token])) {\r\n            Contracts.throwIfNullOrUndefined(speechConfig.subscriptionKey, ConversationConnectionConfig.restErrors.invalidArgs.replace(\"{arg}\", \"SpeechServiceConnection_Key\"));\r\n        }\r\n        const meetingImpl = new MeetingImpl(speechConfig, meetingId);\r\n        // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n        marshalPromiseToCallbacks((async (): Promise<void> => {})(), arg3, arg4);\r\n        return meetingImpl;\r\n    }\r\n\r\n    /** Start a meeting. */\r\n    public abstract startMeetingAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /** Delete a meeting. After this no one will be able to join the meeting. */\r\n    public abstract deleteMeetingAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /** End a meeting. */\r\n    public abstract endMeetingAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /** Lock a meeting. This will prevent new participants from joining. */\r\n    public abstract lockMeetingAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /** Add Participant to Meeting. */\r\n    public abstract addParticipantAsync(participant: IParticipant, cb?: Callback, err?: Callback): void;\r\n\r\n    /**\r\n     * Mute all other participants in the Meeting. After this no other participants will\r\n     * have their speech recognitions broadcast, nor be able to send text messages.\r\n     */\r\n    public abstract muteAllParticipantsAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /**\r\n     * Mute a participant.\r\n     * @param userId A user identifier\r\n     */\r\n    public abstract muteParticipantAsync(userId: string, cb?: Callback, err?: Callback): void;\r\n\r\n    /**\r\n     * Remove a participant from a meeting using the user id, Participant or User object\r\n     * @param userId A user identifier\r\n     */\r\n    public abstract removeParticipantAsync(userId: string | IParticipant | IUser, cb?: Callback, err?: Callback): void;\r\n\r\n    /** Unlocks a meeting. */\r\n    public abstract unlockMeetingAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /** Unmute all other participants in the meeting. */\r\n    public abstract unmuteAllParticipantsAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /**\r\n     * Unmute a participant.\r\n     * @param userId A user identifier\r\n     */\r\n    public abstract unmuteParticipantAsync(userId: string, cb?: Callback, err?: Callback): void;\r\n}\r\n\r\nexport class MeetingImpl extends Meeting implements IDisposable {\r\n\r\n    private privConfig: SpeechTranslationConfig;\r\n    private privProperties: PropertyCollection;\r\n    private privLanguage: string;\r\n    private privToken: string;\r\n    private privIsDisposed: boolean;\r\n    private privRoom: IInternalConversation;\r\n    private privManager: ConversationManager;\r\n    private privConversationRecognizer: ConversationRecognizer;\r\n    private privIsConnected: boolean;\r\n    private privParticipants: InternalParticipants;\r\n    private privIsReady: boolean;\r\n    private privConversationTranslator: ConversationTranslator;\r\n    private privTranscriberRecognizer: TranscriberRecognizer;\r\n    private privErrors: IErrorMessages = ConversationConnectionConfig.restErrors;\r\n    private privConversationId: string;\r\n    private readonly privTextMessageMaxLength: number;\r\n\r\n    /**\r\n     * Create a Meeting impl\r\n     * @param speechConfig\r\n     * @param {string} id - optional conversationId\r\n     */\r\n    public constructor(speechConfig: SpeechTranslationConfig, id: string) {\r\n        super();\r\n        this.privIsConnected = false;\r\n        this.privIsDisposed = false;\r\n        this.privConversationId = \"\";\r\n        this.privProperties = new PropertyCollection();\r\n        this.privManager = new ConversationManager();\r\n\r\n        // check the speech language\r\n        const language: string = speechConfig.getProperty(PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage]);\r\n        if (!language) {\r\n            speechConfig.setProperty(PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage], ConversationConnectionConfig.defaultLanguageCode);\r\n        }\r\n        this.privLanguage = speechConfig.getProperty(PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage]);\r\n        this.privConversationId = id;\r\n\r\n        // save the speech config for future usage\r\n        this.privConfig = speechConfig;\r\n\r\n        // save the config properties\r\n        const configImpl = speechConfig as SpeechTranslationConfigImpl;\r\n        Contracts.throwIfNull(configImpl, \"speechConfig\");\r\n        this.privProperties = configImpl.properties.clone();\r\n        this.privIsConnected = false;\r\n        this.privParticipants = new InternalParticipants();\r\n        this.privIsReady = false;\r\n        this.privTextMessageMaxLength = 1000;\r\n    }\r\n\r\n    // get the internal data about a conversation\r\n    public get room(): IInternalConversation {\r\n        return this.privRoom;\r\n    }\r\n\r\n    // get the wrapper for connecting to the websockets\r\n    public get connection(): ConversationRecognizer {\r\n        return this.privConversationRecognizer; // this.privConnection;\r\n    }\r\n\r\n    // get the config\r\n    public get config(): SpeechTranslationConfig {\r\n        return this.privConfig;\r\n    }\r\n\r\n    // get the meeting Id\r\n    public get meetingId(): string {\r\n        return this.privRoom ? this.privRoom.roomId : this.privConversationId;\r\n    }\r\n\r\n    // get the properties\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    // get the speech language\r\n    public get speechRecognitionLanguage(): string {\r\n        return this.privLanguage;\r\n    }\r\n\r\n    public get isMutedByHost(): boolean {\r\n        return this.privParticipants.me?.isHost ? false : this.privParticipants.me?.isMuted;\r\n    }\r\n\r\n    public get isConnected(): boolean {\r\n        return this.privIsConnected && this.privIsReady;\r\n    }\r\n\r\n    public get participants(): Participant[] {\r\n        return this.toParticipants(true);\r\n    }\r\n\r\n    public get me(): Participant {\r\n        return this.toParticipant(this.privParticipants.me);\r\n    }\r\n\r\n    public get host(): Participant {\r\n        return this.toParticipant(this.privParticipants.host);\r\n    }\r\n\r\n    public get transcriberRecognizer(): TranscriberRecognizer {\r\n        return this.privTranscriberRecognizer;\r\n    }\r\n\r\n    public get meetingInfo(): MeetingInfo {\r\n        const convId: string = this.meetingId;\r\n        const p: TranscriptionParticipant[] = this.participants.map((part: Participant): TranscriptionParticipant => (\r\n            {\r\n                id: part.id,\r\n                preferredLanguage: part.preferredLanguage,\r\n                voice: part.voice\r\n            }\r\n        ));\r\n        const props: MeetingProperties = {};\r\n        for (const key of ConversationConnectionConfig.transcriptionEventKeys) {\r\n            const val: string = this.properties.getProperty(key, \"\");\r\n            if (val !== \"\") {\r\n                props[key] = val;\r\n            }\r\n        }\r\n        const info: MeetingInfo = { id: convId, participants: p, meetingProperties: props };\r\n        return info;\r\n    }\r\n\r\n    private get canSend(): boolean {\r\n        return this.privIsConnected && !this.privParticipants.me?.isMuted;\r\n    }\r\n\r\n    private get canSendAsHost(): boolean {\r\n        return this.privIsConnected && this.privParticipants.me?.isHost;\r\n    }\r\n\r\n    // get / set the speech auth token\r\n    // eslint-disable-next-line @typescript-eslint/member-ordering\r\n    public get authorizationToken(): string {\r\n        return this.privToken;\r\n    }\r\n\r\n    public set authorizationToken(value: string) {\r\n        Contracts.throwIfNullOrWhitespace(value, \"authorizationToken\");\r\n        this.privToken = value;\r\n    }\r\n\r\n    /**\r\n     * Create a new meeting as Host\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public createMeetingAsync(cb?: Callback, err?: Callback): void {\r\n        try {\r\n            if (!!this.privConversationRecognizer) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedStart), err);\r\n            }\r\n            this.privManager.createOrJoin(this.privProperties, undefined,\r\n                ((room: IInternalConversation): void => {\r\n                    if (!room) {\r\n                        this.handleError(new Error(this.privErrors.permissionDeniedConnect), err);\r\n                    }\r\n                    this.privRoom = room;\r\n                    this.handleCallback(cb, err);\r\n                }),\r\n                ((error: any): void => {\r\n                    this.handleError(error, err);\r\n                }));\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Starts a new meeting as host.\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public startMeetingAsync(cb?: Callback, err?: Callback): void {\r\n        try {\r\n            // check if there is already a recognizer\r\n            if (!!this.privConversationRecognizer) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedStart), err);\r\n            }\r\n            // check if there is conversation data available\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedConnect);\r\n            // connect to the conversation websocket\r\n            this.privParticipants.meId = this.privRoom.participantId;\r\n\r\n            // Because ConversationTranslator manually sets up and manages the connection, Conversation\r\n            // has to forward serviceRecognizer connection events that usually get passed automatically\r\n            this.privConversationRecognizer.connected = this.onConnected;\r\n            this.privConversationRecognizer.disconnected = this.onDisconnected;\r\n            this.privConversationRecognizer.canceled = this.onCanceled;\r\n\r\n            this.privConversationRecognizer.participantUpdateCommandReceived = this.onParticipantUpdateCommandReceived;\r\n            this.privConversationRecognizer.lockRoomCommandReceived = this.onLockRoomCommandReceived;\r\n            this.privConversationRecognizer.muteAllCommandReceived = this.onMuteAllCommandReceived;\r\n            this.privConversationRecognizer.participantJoinCommandReceived = this.onParticipantJoinCommandReceived;\r\n            this.privConversationRecognizer.participantLeaveCommandReceived = this.onParticipantLeaveCommandReceived;\r\n            this.privConversationRecognizer.translationReceived = this.onTranslationReceived;\r\n            this.privConversationRecognizer.participantsListReceived = this.onParticipantsListReceived;\r\n            this.privConversationRecognizer.conversationExpiration = this.onConversationExpiration;\r\n\r\n            this.privConversationRecognizer.connect(this.privRoom.token,\r\n                ((): void => {\r\n                    this.handleCallback(cb, err);\r\n                }),\r\n                ((error: any): void => {\r\n                    this.handleError(error, err);\r\n                }));\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Join a meeting as a participant.\r\n     * @param { IParticipant } participant - participant to add\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public addParticipantAsync(participant: IParticipant, cb?: Callback, err?: Callback): void {\r\n        Contracts.throwIfNullOrUndefined(participant, \"Participant\");\r\n        marshalPromiseToCallbacks(this.addParticipantImplAsync(participant), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Join a meeting as a participant.\r\n     * @param meeting\r\n     * @param nickname\r\n     * @param lang\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public joinMeetingAsync(meetingId: string, nickname: string, lang: string, cb?: Callback, err?: Callback): void {\r\n        try {\r\n            // TODO\r\n            // if (!!this.privConversationRecognizer) {\r\n            //     throw new Error(this.privErrors.permissionDeniedStart);\r\n            // }\r\n            Contracts.throwIfNullOrWhitespace(meetingId, this.privErrors.invalidArgs.replace(\"{arg}\", \"conversationId\"));\r\n            Contracts.throwIfNullOrWhitespace(nickname, this.privErrors.invalidArgs.replace(\"{arg}\", \"nickname\"));\r\n            Contracts.throwIfNullOrWhitespace(lang, this.privErrors.invalidArgs.replace(\"{arg}\", \"language\"));\r\n            // join the conversation\r\n            this.privManager.createOrJoin(this.privProperties, meetingId,\r\n                ((room: IInternalConversation): void => {\r\n                    Contracts.throwIfNullOrUndefined(room, this.privErrors.permissionDeniedConnect);\r\n                    this.privRoom = room;\r\n                    this.privConfig.authorizationToken = room.cognitiveSpeechAuthToken;\r\n                    // join callback\r\n                    if (!!cb) {\r\n                        cb(room.cognitiveSpeechAuthToken);\r\n                    }\r\n                }),\r\n                ((error: any): void => {\r\n                    this.handleError(error, err);\r\n                }));\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Deletes a meeting\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public deleteMeetingAsync(cb?: Callback, err?: Callback): void {\r\n        marshalPromiseToCallbacks(this.deleteMeetingImplAsync(), cb, err);\r\n    }\r\n\r\n    public async deleteMeetingImplAsync(): Promise<void> {\r\n            Contracts.throwIfNullOrUndefined(this.privProperties, this.privErrors.permissionDeniedConnect);\r\n            Contracts.throwIfNullOrWhitespace(this.privRoom.token, this.privErrors.permissionDeniedConnect);\r\n            await this.privManager.leave(this.privProperties, this.privRoom.token);\r\n\r\n            this.dispose();\r\n    }\r\n\r\n    /**\r\n     * Issues a request to close the client websockets\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public endMeetingAsync(cb?: Callback, err?: Callback): void {\r\n        marshalPromiseToCallbacks(this.endMeetingImplAsync(), cb, err);\r\n    }\r\n\r\n    public endMeetingImplAsync(): Promise<void> {\r\n        return this.close(true);\r\n    }\r\n\r\n    /**\r\n     * Issues a request to lock the conversation\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public lockMeetingAsync(cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            if (!this.canSendAsHost) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace(\"{command}\", \"lock\")), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getLockCommand(true),\r\n                    ((): void => {\r\n                        this.handleCallback(cb, err);\r\n                    }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Issues a request to mute the meeting\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public muteAllParticipantsAsync(cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrUndefined(this.privConversationRecognizer, this.privErrors.permissionDeniedSend);\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            // check the user's permissions\r\n            if (!this.canSendAsHost) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace(\"{command}\", \"mute\")), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getMuteAllCommand(true),\r\n                    ((): void => {\r\n                        this.handleCallback(cb, err);\r\n                    }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Issues a request to mute a participant in the meeting\r\n     * @param userId\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public muteParticipantAsync(userId: string, cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrWhitespace(userId, this.privErrors.invalidArgs.replace(\"{arg}\", \"userId\"));\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            // check the connection is open (host + participant can perform the mute command)\r\n            if (!this.canSend) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedSend), err);\r\n            }\r\n            // if not host, check the participant is not muting another participant\r\n            if (!this.me.isHost && this.me.id !== userId) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedParticipant.replace(\"{command}\", \"mute\")), err);\r\n            }\r\n            // check the user exists\r\n            const exists: number = this.privParticipants.getParticipantIndex(userId);\r\n            if (exists === -1) {\r\n                this.handleError(new Error(this.privErrors.invalidParticipantRequest), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getMuteCommand(userId, true), ((): void => {\r\n                        this.handleCallback(cb, err);\r\n                    }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Issues a request to remove a participant from the conversation\r\n     * @param userId\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public removeParticipantAsync(userId: string | IParticipant | IUser, cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            if (!!this.privTranscriberRecognizer && userId.hasOwnProperty(\"id\")) {\r\n                // Assume this is a transcription participant\r\n                marshalPromiseToCallbacks(this.removeParticipantImplAsync(userId as IParticipant), cb, err);\r\n            } else {\r\n                Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n                Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n                if (!this.canSendAsHost) {\r\n                    this.handleError(new Error(this.privErrors.permissionDeniedParticipant.replace(\"{command}\", \"remove\")), err);\r\n                }\r\n                let participantId = \"\";\r\n                if (typeof userId === \"string\") {\r\n                    participantId = userId;\r\n                } else if (userId.hasOwnProperty(\"id\")) {\r\n                    const participant: IParticipant = userId as IParticipant;\r\n                    participantId = participant.id;\r\n                } else if (userId.hasOwnProperty(\"userId\")) {\r\n                    const user: IUser = userId as IUser;\r\n                    participantId = user.userId;\r\n                }\r\n                Contracts.throwIfNullOrWhitespace(participantId, this.privErrors.invalidArgs.replace(\"{arg}\", \"userId\"));\r\n                // check the participant exists\r\n                const index: number = this.participants.findIndex((p: Participant): boolean => p.id === participantId);\r\n                if (index === -1) {\r\n                    this.handleError(new Error(this.privErrors.invalidParticipantRequest), err);\r\n                }\r\n                if (!!this.privConversationRecognizer) {\r\n                    this.privConversationRecognizer.sendRequest(this.getEjectCommand(participantId), ((): void => {\r\n                        this.handleCallback(cb, err);\r\n                    }),\r\n                        ((error: any): void => {\r\n                            this.handleError(error, err);\r\n                        }));\r\n                }\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Issues a request to unlock the meeting\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public unlockMeetingAsync(cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            if (!this.canSendAsHost) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace(\"{command}\", \"unlock\")), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getLockCommand(false), ((): void => {\r\n                    this.handleCallback(cb, err);\r\n                }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n                }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Issues a request to unmute all participants in the meeting\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public unmuteAllParticipantsAsync(cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            if (!this.canSendAsHost) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace(\"{command}\", \"unmute all\")), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getMuteAllCommand(false), ((): void => {\r\n                    this.handleCallback(cb, err);\r\n                }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Issues a request to unmute a participant in the meeting\r\n     * @param userId\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public unmuteParticipantAsync(userId: string, cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrWhitespace(userId, this.privErrors.invalidArgs.replace(\"{arg}\", \"userId\"));\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            // check the connection is open (host + participant can perform the mute command)\r\n            if (!this.canSend) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedSend), err);\r\n            }\r\n            // if not host, check the participant is not muting another participant\r\n            if (!this.me.isHost && this.me.id !== userId) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedParticipant.replace(\"{command}\", \"mute\")), err);\r\n            }\r\n            // check the user exists\r\n            const exists: number = this.privParticipants.getParticipantIndex(userId);\r\n            if (exists === -1) {\r\n                this.handleError(new Error(this.privErrors.invalidParticipantRequest), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getMuteCommand(userId, false), ((): void => {\r\n                    this.handleCallback(cb, err);\r\n                }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Send a text message\r\n     * @param message\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public sendTextMessageAsync(message: string, cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrWhitespace(message, this.privErrors.invalidArgs.replace(\"{arg}\", \"message\"));\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            if (!this.canSend) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedSend), err);\r\n            }\r\n            // TODO: is a max length check required?\r\n            if (message.length > this.privTextMessageMaxLength) {\r\n                this.handleError(new Error(this.privErrors.invalidArgs.replace(\"{arg}\", \"message length\")), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getMessageCommand(message), ((): void => {\r\n                    this.handleCallback(cb, err);\r\n                }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Set translated to languages\r\n     * @param {string[]} languages - languages to translate to\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public setTranslatedLanguagesAsync(languages: string[], cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfArrayEmptyOrWhitespace(languages, this.privErrors.invalidArgs.replace(\"{arg}\", \"languages\"));\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            if (!this.canSend) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedSend), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getSetTranslateToLanguagesCommand(languages),\r\n                    ((): void => {\r\n                        this.handleCallback(cb, err);\r\n                    }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Change nickname\r\n     * @param {string} nickname - new nickname for the room\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public changeNicknameAsync(nickname: string, cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrWhitespace(nickname, this.privErrors.invalidArgs.replace(\"{arg}\", \"nickname\"));\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            if (!this.canSend) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedSend), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getChangeNicknameCommand(nickname),\r\n                    ((): void => {\r\n                        this.handleCallback(cb, err);\r\n                    }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    public isDisposed(): boolean {\r\n        return this.privIsDisposed;\r\n    }\r\n\r\n    public dispose(): void {\r\n        if (this.isDisposed) {\r\n            return;\r\n        }\r\n        this.privIsDisposed = true;\r\n        if (!!this.config) {\r\n            this.config.close();\r\n        }\r\n        this.privConfig = undefined;\r\n        this.privLanguage = undefined;\r\n        this.privProperties = undefined;\r\n        this.privRoom = undefined;\r\n        this.privToken = undefined;\r\n        this.privManager = undefined;\r\n        this.privIsConnected = false;\r\n        this.privIsReady = false;\r\n        this.privParticipants = undefined;\r\n    }\r\n\r\n    public async connectTranscriberRecognizer(recognizer: TranscriberRecognizer): Promise<void> {\r\n        if (!!this.privTranscriberRecognizer) {\r\n            await this.privTranscriberRecognizer.close();\r\n        }\r\n        await recognizer.enforceAudioGating();\r\n        this.privTranscriberRecognizer = recognizer;\r\n        this.privTranscriberRecognizer.meeting = this;\r\n    }\r\n\r\n    public getKeepAlive(): string {\r\n        const nickname: string = (!!this.me) ? this.me.displayName : \"default_nickname\";\r\n        return JSON.stringify({\r\n            id: \"0\",\r\n            nickname,\r\n            participantId: this.privRoom.participantId,\r\n            roomId: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.keepAlive\r\n        });\r\n    }\r\n\r\n    /** websocket callbacks */\r\n    /* eslint-disable @typescript-eslint/typedef */\r\n    private onConnected = (e: ConnectionEventArgs): void => {\r\n        this.privIsConnected = true;\r\n        try {\r\n            if (!!this.privConversationTranslator?.sessionStarted) {\r\n                this.privConversationTranslator.sessionStarted(this.privConversationTranslator, e);\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onDisconnected = (e: ConnectionEventArgs): void => {\r\n        try {\r\n            if (!!this.privConversationTranslator?.sessionStopped) {\r\n                this.privConversationTranslator.sessionStopped(this.privConversationTranslator, e);\r\n            }\r\n        } catch (e) {\r\n            //\r\n        } finally {\r\n            void this.close(false);\r\n        }\r\n    };\r\n\r\n    private onCanceled = (r: ConversationRecognizer, e: ConversationTranslationCanceledEventArgs): void => {\r\n        try {\r\n            if (!!this.privConversationTranslator?.canceled) {\r\n                this.privConversationTranslator.canceled(this.privConversationTranslator, e);\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onParticipantUpdateCommandReceived = (r: ConversationRecognizer, e: ParticipantAttributeEventArgs): void => {\r\n        try {\r\n            const updatedParticipant: IInternalParticipant = this.privParticipants.getParticipant(e.id);\r\n            if (updatedParticipant !== undefined) {\r\n\r\n                switch (e.key) {\r\n                    case ConversationTranslatorCommandTypes.changeNickname:\r\n                        updatedParticipant.displayName = e.value as string;\r\n                        break;\r\n                    case ConversationTranslatorCommandTypes.setUseTTS:\r\n                        updatedParticipant.isUsingTts = e.value as boolean;\r\n                        break;\r\n                    case ConversationTranslatorCommandTypes.setProfanityFiltering:\r\n                        updatedParticipant.profanity = e.value as boolean;\r\n                        break;\r\n                    case ConversationTranslatorCommandTypes.setMute:\r\n                        updatedParticipant.isMuted = e.value as boolean;\r\n                        break;\r\n                    case ConversationTranslatorCommandTypes.setTranslateToLanguages:\r\n                        updatedParticipant.translateToLanguages = e.value as string[];\r\n                        break;\r\n                }\r\n                this.privParticipants.addOrUpdateParticipant(updatedParticipant);\r\n\r\n                if (!!this.privConversationTranslator) {\r\n                    this.privConversationTranslator.participantsChanged(\r\n                        this.privConversationTranslator,\r\n                        new ConversationParticipantsChangedEventArgs(ParticipantChangedReason.Updated,\r\n                            [this.toParticipant(updatedParticipant)], e.sessionId));\r\n                }\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onLockRoomCommandReceived = (): void => {\r\n        // TODO\r\n    };\r\n\r\n    private onMuteAllCommandReceived = (r: ConversationRecognizer, e: MuteAllEventArgs): void => {\r\n        try {\r\n            this.privParticipants.participants.forEach((p: IInternalParticipant): boolean => p.isMuted = (p.isHost ? false : e.isMuted));\r\n            if (!!this.privConversationTranslator) {\r\n                this.privConversationTranslator.participantsChanged(\r\n                    this.privConversationTranslator,\r\n                    new ConversationParticipantsChangedEventArgs(ParticipantChangedReason.Updated,\r\n                        this.toParticipants(false), e.sessionId));\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onParticipantJoinCommandReceived = (r: ConversationRecognizer, e: ParticipantEventArgs): void => {\r\n        try {\r\n            const newParticipant: IInternalParticipant = this.privParticipants.addOrUpdateParticipant(e.participant);\r\n            if (newParticipant !== undefined) {\r\n                if (!!this.privConversationTranslator) {\r\n                    this.privConversationTranslator.participantsChanged(\r\n                        this.privConversationTranslator,\r\n                        new ConversationParticipantsChangedEventArgs(ParticipantChangedReason.JoinedConversation,\r\n                            [this.toParticipant(newParticipant)], e.sessionId));\r\n                }\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onParticipantLeaveCommandReceived = (r: ConversationRecognizer, e: ParticipantEventArgs): void => {\r\n        try {\r\n            const ejectedParticipant: IInternalParticipant = this.privParticipants.getParticipant(e.participant.id);\r\n            if (ejectedParticipant !== undefined) {\r\n                // remove the participant from the internal participants list\r\n                this.privParticipants.deleteParticipant(e.participant.id);\r\n                if (!!this.privConversationTranslator) {\r\n                    // notify subscribers that the participant has left the conversation\r\n                    this.privConversationTranslator.participantsChanged(\r\n                        this.privConversationTranslator,\r\n                        new ConversationParticipantsChangedEventArgs(ParticipantChangedReason.LeftConversation,\r\n                            [this.toParticipant(ejectedParticipant)], e.sessionId));\r\n                }\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onTranslationReceived = (r: ConversationRecognizer, e: ConversationReceivedTranslationEventArgs): void => {\r\n        try {\r\n            switch (e.command) {\r\n                case ConversationTranslatorMessageTypes.final:\r\n                    if (!!this.privConversationTranslator) {\r\n                        this.privConversationTranslator.transcribed(\r\n                            this.privConversationTranslator,\r\n                            new ConversationTranslationEventArgs(e.payload, undefined, e.sessionId));\r\n                    }\r\n                    break;\r\n                case ConversationTranslatorMessageTypes.partial:\r\n                    if (!!this.privConversationTranslator) {\r\n                        this.privConversationTranslator.transcribing(\r\n                            this.privConversationTranslator,\r\n                            new ConversationTranslationEventArgs(e.payload, undefined, e.sessionId));\r\n                    }\r\n                    break;\r\n                case ConversationTranslatorMessageTypes.instantMessage:\r\n                    if (!!this.privConversationTranslator) {\r\n                        this.privConversationTranslator.textMessageReceived(\r\n                            this.privConversationTranslator,\r\n                            new ConversationTranslationEventArgs(e.payload, undefined, e.sessionId));\r\n                    }\r\n                    break;\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onParticipantsListReceived = (r: ConversationRecognizer, e: ParticipantsListEventArgs): void => {\r\n        try {\r\n            // check if the session token needs to be updated\r\n            if (e.sessionToken !== undefined && e.sessionToken !== null) {\r\n                this.privRoom.token = e.sessionToken;\r\n            }\r\n            // save the participants\r\n            this.privParticipants.participants = [...e.participants];\r\n            // enable the conversation\r\n            if (this.privParticipants.me !== undefined) {\r\n                this.privIsReady = true;\r\n            }\r\n            if (!!this.privConversationTranslator) {\r\n                this.privConversationTranslator.participantsChanged(\r\n                    this.privConversationTranslator,\r\n                    new ConversationParticipantsChangedEventArgs(ParticipantChangedReason.JoinedConversation, this.toParticipants(true), e.sessionId));\r\n            }\r\n            // if this is the host, update the nickname if needed\r\n            if (this.me.isHost) {\r\n                const nickname: string = this.privConversationTranslator?.properties.getProperty(PropertyId.ConversationTranslator_Name);\r\n                if (nickname !== undefined && nickname.length > 0 && nickname !== this.me.displayName) {\r\n                    // issue a change nickname request\r\n                    this.changeNicknameAsync(nickname);\r\n                }\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onConversationExpiration = (r: ConversationRecognizer, e: ConversationExpirationEventArgs): void => {\r\n        try {\r\n            if (!!this.privConversationTranslator) {\r\n                this.privConversationTranslator.conversationExpiration(this.privConversationTranslator, e);\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n    /* eslint-enable @typescript-eslint/typedef */\r\n\r\n    private addParticipantImplAsync(participant: IParticipant): Promise<void> {\r\n        const newParticipant: IInternalParticipant = this.privParticipants.addOrUpdateParticipant(participant);\r\n        if (newParticipant !== undefined) {\r\n            if (!!this.privTranscriberRecognizer) {\r\n                const meetingInfo = this.meetingInfo;\r\n                meetingInfo.participants = [participant];\r\n                return this.privTranscriberRecognizer.pushMeetingEvent(meetingInfo, \"join\");\r\n            }\r\n        }\r\n    }\r\n\r\n    private removeParticipantImplAsync(participant: IParticipant): Promise<void> {\r\n        this.privParticipants.deleteParticipant(participant.id);\r\n        const meetingInfo = this.meetingInfo;\r\n        meetingInfo.participants = [participant];\r\n        return this.privTranscriberRecognizer.pushMeetingEvent(meetingInfo, \"leave\");\r\n    }\r\n\r\n    private async close(dispose: boolean): Promise<void> {\r\n        try {\r\n            this.privIsConnected = false;\r\n            await this.privConversationRecognizer?.close();\r\n            this.privConversationRecognizer = undefined;\r\n            if (!!this.privConversationTranslator) {\r\n                this.privConversationTranslator.dispose();\r\n            }\r\n        } catch (e) {\r\n            // ignore error\r\n            throw e;\r\n        }\r\n        if (dispose) {\r\n            this.dispose();\r\n        }\r\n    }\r\n\r\n    /** Helpers */\r\n    private handleCallback(cb: () => void, err: (message: string) => void): void {\r\n        if (!!cb) {\r\n            try {\r\n                cb();\r\n            } catch (e) {\r\n                if (!!err) {\r\n                    err(e as string);\r\n                }\r\n            }\r\n            cb = undefined;\r\n        }\r\n    }\r\n\r\n    private handleError(error: any, err: (message: string) => void): void {\r\n        if (!!err) {\r\n            if (error instanceof Error) {\r\n                const typedError: Error = error;\r\n                err(typedError.name + \": \" + typedError.message);\r\n\r\n            } else {\r\n                err(error as string);\r\n            }\r\n        }\r\n    }\r\n\r\n    /** Participant Helpers */\r\n    private toParticipants(includeHost: boolean): Participant[] {\r\n\r\n        const participants: Participant[] = this.privParticipants.participants.map((p: IInternalParticipant): Participant => ( this.toParticipant(p) ) );\r\n        if (!includeHost) {\r\n            return participants.filter((p: Participant): boolean => p.isHost === false);\r\n        } else {\r\n            return participants;\r\n        }\r\n    }\r\n\r\n    private toParticipant(p: IInternalParticipant): Participant {\r\n        return new Participant(p.id, p.avatar, p.displayName, p.isHost, p.isMuted, p.isUsingTts, p.preferredLanguage, p.voice);\r\n    }\r\n\r\n    private getMuteAllCommand(isMuted: boolean): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"meetingd\");\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.participantId, \"participantId\");\r\n\r\n        return JSON.stringify({\r\n            command: ConversationTranslatorCommandTypes.setMuteAll,\r\n            participantId: this.privRoom.participantId, // the id of the host\r\n            roomid: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.participantCommand,\r\n            value: isMuted\r\n        });\r\n    }\r\n\r\n    private getMuteCommand(participantId: string, isMuted: boolean): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"conversationId\");\r\n        Contracts.throwIfNullOrWhitespace(participantId, \"participantId\");\r\n\r\n        return JSON.stringify({\r\n            command: ConversationTranslatorCommandTypes.setMute,\r\n            // eslint-disable-next-line object-shorthand\r\n            participantId: participantId,\r\n            roomid: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.participantCommand,\r\n            value: isMuted\r\n        });\r\n    }\r\n\r\n    private getLockCommand(isLocked: boolean): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"meetingId\");\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.participantId, \"participantId\");\r\n\r\n        return JSON.stringify({\r\n            command: ConversationTranslatorCommandTypes.setLockState,\r\n            participantId: this.privRoom.participantId,\r\n            roomid: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.participantCommand,\r\n            value: isLocked\r\n        });\r\n    }\r\n\r\n    private getEjectCommand(participantId: string): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"meetingId\");\r\n        Contracts.throwIfNullOrWhitespace(participantId, \"participantId\");\r\n\r\n        return JSON.stringify({\r\n            command: ConversationTranslatorCommandTypes.ejectParticipant,\r\n            // eslint-disable-next-line object-shorthand\r\n            participantId: participantId,\r\n            roomid: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.participantCommand,\r\n        });\r\n    }\r\n\r\n    private getSetTranslateToLanguagesCommand(languages: string[]): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"meetingId\");\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.participantId, \"participantId\");\r\n\r\n        return JSON.stringify({\r\n            command: ConversationTranslatorCommandTypes.setTranslateToLanguages,\r\n            participantId: this.privRoom.participantId, // the id of the host\r\n            roomid: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.participantCommand,\r\n            value: languages\r\n        });\r\n    }\r\n\r\n    private getChangeNicknameCommand(nickname: string): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"meetingId\");\r\n        Contracts.throwIfNullOrWhitespace(nickname, \"nickname\");\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.participantId, \"participantId\");\r\n\r\n        return JSON.stringify({\r\n            command: ConversationTranslatorCommandTypes.changeNickname,\r\n            nickname,\r\n            participantId: this.privRoom.participantId, // the id of the host\r\n            roomid: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.participantCommand,\r\n            value: nickname\r\n        });\r\n    }\r\n\r\n    private getMessageCommand(message: string): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"meetingId\");\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.participantId, \"participantId\");\r\n        Contracts.throwIfNullOrWhitespace(message, \"message\");\r\n\r\n        return JSON.stringify({\r\n            participantId: this.privRoom.participantId,\r\n            roomId: this.privRoom.roomId,\r\n            text: message,\r\n            type: ConversationTranslatorMessageTypes.instantMessage\r\n        });\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// Multi-device Conversation is a Preview feature.\r\n\r\nimport { CancellationEventArgsBase } from \"../CancellationEventArgsBase.js\";\r\n\r\nexport class MeetingTranscriptionCanceledEventArgs extends CancellationEventArgsBase {\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { TranscriberRecognizer } from \"../../common.speech/Exports.js\";\r\nimport { marshalPromiseToCallbacks } from \"../../common/Exports.js\";\r\nimport { Contracts } from \"../Contracts.js\";\r\nimport {\r\n    AudioConfig,\r\n    CancellationEventArgs,\r\n    Connection,\r\n    MeetingTranscriptionEventArgs,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    SessionEventArgs\r\n} from \"../Exports.js\";\r\nimport {\r\n    MeetingHandler,\r\n    MeetingImpl,\r\n    MeetingTranscriptionHandler\r\n} from \"./Exports.js\";\r\nimport { Callback, IMeeting } from \"./IMeeting.js\";\r\n\r\nexport class MeetingTranscriber implements MeetingTranscriptionHandler {\r\n\r\n    /**\r\n     * The event canceled signals that an error occurred during the meeting.\r\n     * @member MeetingTranscriber.prototype.MeetingCanceled\r\n     * @function\r\n     * @public\r\n     */\r\n    public MeetingCanceled: (sender: MeetingHandler, event: CancellationEventArgs) => void;\r\n\r\n    /**\r\n     * The event canceled signals that an error occurred during transcription.\r\n     * @member MeetingTranscriber.prototype.canceled\r\n     * @function\r\n     * @public\r\n     */\r\n    public canceled: (sender: MeetingHandler, event: CancellationEventArgs) => void;\r\n\r\n     /**\r\n      * The event recognized signals that a final meeting transcription result is received.\r\n      * @member MeetingTranscriber.prototype.transcribed\r\n      * @function\r\n      * @public\r\n      */\r\n    public transcribed: (sender: MeetingTranscriptionHandler, event: MeetingTranscriptionEventArgs) => void;\r\n\r\n     /**\r\n      * The event recognizing signals that an intermediate meeting transcription result is received.\r\n      * @member MeetingTranscriber.prototype.transcribing\r\n      * @function\r\n      * @public\r\n      */\r\n    public transcribing: (sender: MeetingTranscriptionHandler, event: MeetingTranscriptionEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for session started events.\r\n     * @member MeetingTranscriber.prototype.sessionStarted\r\n     * @function\r\n     * @public\r\n     */\r\n    public sessionStarted: (sender: MeetingHandler, event: SessionEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for session stopped events.\r\n     * @member MeetingTranscriber.prototype.sessionStopped\r\n     * @function\r\n     * @public\r\n     */\r\n    public sessionStopped: (sender: MeetingHandler, event: SessionEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for meeting started events.\r\n     * @member MeetingTranscriber.prototype.MeetingStarted\r\n     * @function\r\n     * @public\r\n     */\r\n    public MeetingStarted: (sender: MeetingHandler, event: SessionEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for meeting stopped events.\r\n     * @member MeetingTranscriber.prototype.MeetingStopped\r\n     * @function\r\n     * @public\r\n     */\r\n    public meetingStopped: (sender: MeetingHandler, event: SessionEventArgs) => void;\r\n\r\n    protected privAudioConfig: AudioConfig;\r\n    private privDisposedRecognizer: boolean;\r\n    private privRecognizer: TranscriberRecognizer;\r\n    private privProperties: PropertyCollection;\r\n\r\n    /**\r\n     * MeetingTranscriber constructor.\r\n     * @constructor\r\n     * @param {AudioConfig} audioConfig - An optional audio configuration associated with the recognizer\r\n     */\r\n    public constructor(audioConfig?: AudioConfig) {\r\n        this.privAudioConfig = audioConfig;\r\n        this.privProperties = new PropertyCollection();\r\n        this.privRecognizer = undefined;\r\n        this.privDisposedRecognizer = false;\r\n    }\r\n\r\n    /**\r\n     * Gets the spoken language of recognition.\r\n     * @member MeetingTranscriber.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     * @returns {string} The spoken language of recognition.\r\n     */\r\n    public get speechRecognitionLanguage(): string {\r\n        Contracts.throwIfDisposed(this.privDisposedRecognizer);\r\n\r\n        return this.properties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage);\r\n    }\r\n\r\n    /**\r\n     * The collection of properties and their values defined for this MeetingTranscriber.\r\n     * @member MeetingTranscriber.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} The collection of properties and their values defined for this MeetingTranscriber.\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    /**\r\n     * @Internal\r\n     * Internal data member to support fromRecognizer* pattern methods on other classes.\r\n     * Do not use externally, object returned will change without warning or notice.\r\n     */\r\n    public get internalData(): object {\r\n        return this.privRecognizer.internalData;\r\n    }\r\n\r\n    /**\r\n     * @Deprecated\r\n     * @Obsolete\r\n     * Please use the Connection.fromRecognizer pattern to obtain a connection object\r\n     */\r\n    public get connection(): Connection {\r\n        return Connection.fromRecognizer(this.privRecognizer);\r\n    }\r\n\r\n    /**\r\n     * Gets the authorization token used to communicate with the service.\r\n     * @member MeetingTranscriber.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @returns {string} Authorization token.\r\n     */\r\n    public get authorizationToken(): string {\r\n        return this.properties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets the authorization token used to communicate with the service.\r\n     * @member MeetingTranscriber.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} token - Authorization token.\r\n     */\r\n    public set authorizationToken(token: string) {\r\n        Contracts.throwIfNullOrWhitespace(token, \"token\");\r\n        this.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, token);\r\n    }\r\n\r\n    /**\r\n     * @param {Meeting} meeting - meeting to be recognized\r\n     */\r\n    public joinMeetingAsync(meeting: IMeeting, cb?: Callback, err?: Callback): void {\r\n        /* eslint-disable no-console */\r\n        // console.log(\">> MeetingTranscriber::joinMeetingAsync\");\r\n        /* eslint-enable no-console */\r\n        const meetingImpl = meeting as MeetingImpl;\r\n        Contracts.throwIfNullOrUndefined(MeetingImpl, \"Meeting\");\r\n\r\n        // ref the meeting object\r\n        // create recognizer and subscribe to recognizer events\r\n        this.privRecognizer = new TranscriberRecognizer(meeting.config, this.privAudioConfig);\r\n        Contracts.throwIfNullOrUndefined(this.privRecognizer, \"Recognizer\");\r\n        this.privRecognizer.connectMeetingCallbacks(this);\r\n\r\n        marshalPromiseToCallbacks(meetingImpl.connectTranscriberRecognizer(this.privRecognizer), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Starts meeting transcription, until stopTranscribingAsync() is called.\r\n     * User must subscribe to events to receive transcription results.\r\n     * @member MeetingTranscriber.prototype.startTranscribingAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback invoked once the transcription has started.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public startTranscribingAsync(cb?: Callback, err?: Callback): void {\r\n        this.privRecognizer.startContinuousRecognitionAsync(cb, err);\r\n    }\r\n\r\n    /**\r\n     * Starts meeting transcription, until stopTranscribingAsync() is called.\r\n     * User must subscribe to events to receive transcription results.\r\n     * @member MeetingTranscriber.prototype.stopTranscribingAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback invoked once the transcription has started.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public stopTranscribingAsync(cb?: Callback, err?: Callback): void {\r\n        this.privRecognizer.stopContinuousRecognitionAsync(cb, err);\r\n    }\r\n\r\n    /**\r\n     * Leave the current meeting. After this is called, you will no longer receive any events.\r\n     */\r\n    public leaveMeetingAsync(cb?: Callback, err?: Callback): void {\r\n        this.privRecognizer.disconnectCallbacks();\r\n        // eslint-disable-next-line\r\n        marshalPromiseToCallbacks((async (): Promise<void> => { return; })(), cb, err);\r\n    }\r\n\r\n    /**\r\n     * closes all external resources held by an instance of this class.\r\n     * @member MeetingTranscriber.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(cb?: () => void, errorCb?: (error: string) => void): void {\r\n        Contracts.throwIfDisposed(this.privDisposedRecognizer);\r\n        marshalPromiseToCallbacks(this.dispose(true), cb, errorCb);\r\n    }\r\n\r\n    /**\r\n     * Disposes any resources held by the object.\r\n     * @member MeetingTranscriber.prototype.dispose\r\n     * @function\r\n     * @public\r\n     * @param {boolean} disposing - true if disposing the object.\r\n     */\r\n    protected async dispose(disposing: boolean): Promise<void> {\r\n        if (this.privDisposedRecognizer) {\r\n            return;\r\n        }\r\n        if (!!this.privRecognizer) {\r\n            await this.privRecognizer.close();\r\n            this.privRecognizer = undefined;\r\n        }\r\n        if (disposing) {\r\n            this.privDisposedRecognizer = true;\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyCollection, RecognitionResult, ResultReason } from \"../Exports.js\";\r\n\r\n/**\r\n * Defines result of conversation transcription.\r\n * @class ConversationTranscriptionResult\r\n */\r\nexport class ConversationTranscriptionResult extends RecognitionResult {\r\n    private readonly privSpeakerId: string;\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @public\r\n     * @param {string} resultId - The result id.\r\n     * @param {ResultReason} reason - The reason.\r\n     * @param {string} text - The recognized text.\r\n     * @param {number} duration - The duration.\r\n     * @param {number} offset - The offset into the stream.\r\n     * @param {string} language - Primary Language detected, if provided.\r\n     * @param {string} languageDetectionConfidence - Primary Language confidence (\"Unknown,\" \"Low,\" \"Medium,\" \"High\"...), if provided.\r\n     * @param {string} speakerId - speaker id for conversation transcription.\r\n     * @param {string} errorDetails - Error details, if provided.\r\n     * @param {string} json - Additional Json, if provided.\r\n     * @param {PropertyCollection} properties - Additional properties, if provided.\r\n     */\r\n    public constructor(resultId?: string, reason?: ResultReason, text?: string,\r\n                       duration?: number, offset?: number, language?: string,\r\n                       languageDetectionConfidence?: string, speakerId?: string, errorDetails?: string,\r\n                       json?: string, properties?: PropertyCollection) {\r\n        super(resultId, reason, text, duration, offset, language, languageDetectionConfidence, errorDetails, json, properties);\r\n        this.privSpeakerId = speakerId;\r\n    }\r\n\r\n    /**\r\n     * speaker id\r\n     * @member ConversationTranscriptionResult.prototype.speakerId\r\n     * @function\r\n     * @public\r\n     * @returns {string} id of speaker in given result\r\n     */\r\n    public get speakerId(): string {\r\n        return this.privSpeakerId;\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// Multi-device Conversation is a Preview feature.\r\n\r\nexport { Conversation, ConversationImpl } from \"./Conversation.js\";\r\nexport { ConversationInfo } from \"./IConversation.js\";\r\nexport { ConversationCommon } from \"./ConversationCommon.js\";\r\nexport { ConversationExpirationEventArgs } from \"./ConversationExpirationEventArgs.js\";\r\nexport { ConversationParticipantsChangedEventArgs } from \"./ConversationParticipantsChangedEventArgs.js\";\r\nexport { ConversationTranslationCanceledEventArgs } from \"./ConversationTranslationCanceledEventArgs.js\";\r\nexport { ConversationTranslationEventArgs } from \"./ConversationTranslationEventArgs.js\";\r\nexport { ConversationTranslationResult } from \"./ConversationTranslationResult.js\";\r\nexport { ConversationTranslator } from \"./ConversationTranslator.js\";\r\nexport { ConversationTranscriber } from \"./ConversationTranscriber.js\";\r\nexport { IParticipant, Participant, User, VoiceSignature } from \"./IParticipant.js\";\r\nexport { ParticipantChangedReason } from \"./ParticipantChangedReason.js\";\r\nexport { ConversationHandler, ConversationTranscriptionHandler, IConversationTranslator } from \"./ConversationHandler.js\";\r\nexport { Meeting, MeetingImpl } from \"./Meeting.js\";\r\nexport { MeetingInfo } from \"./IMeeting.js\";\r\nexport { MeetingTranscriptionCanceledEventArgs } from \"./MeetingTranscriptionCanceledEventArgs.js\";\r\nexport { MeetingTranscriber } from \"./MeetingTranscriber.js\";\r\nexport { MeetingHandler, MeetingTranscriptionHandler } from \"./MeetingHandler.js\";\r\nexport { ConversationTranscriptionResult } from \"./ConversationTranscriptionResult.js\";\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport { TokenCredential } from \"@azure/core-auth\";\r\nimport {\r\n    AutoDetectSourceLanguagesOpenRangeOptionName,\r\n    CognitiveSubscriptionKeyAuthentication,\r\n    CognitiveTokenAuthentication,\r\n    Context,\r\n    IAuthentication,\r\n    ISynthesisConnectionFactory,\r\n    OS,\r\n    SpeechServiceConfig,\r\n    SynthesisAdapterBase,\r\n    SynthesisRestAdapter,\r\n    SynthesizerConfig } from \"../common.speech/Exports.js\";\r\nimport { IAudioDestination, IStringDictionary, Queue } from \"../common/Exports.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport { PropertyCollection, PropertyId, SpeechConfig, SpeechConfigImpl, SpeechSynthesisResult } from \"./Exports.js\";\r\nimport { SpeechSynthesisRequest } from \"./SpeechSynthesisRequest.js\";\r\n\r\nexport abstract class Synthesizer {\r\n    private tokenCredential?: TokenCredential;\r\n    protected privAdapter: SynthesisAdapterBase;\r\n    protected privRestAdapter: SynthesisRestAdapter;\r\n    protected privProperties: PropertyCollection;\r\n    protected privConnectionFactory: ISynthesisConnectionFactory;\r\n    protected privDisposed: boolean;\r\n    protected privSynthesizing: boolean;\r\n    protected synthesisRequestQueue: Queue<SynthesisRequest | StreamingSynthesisRequest>;\r\n\r\n    /**\r\n     * Gets the authorization token used to communicate with the service.\r\n     * @member Synthesizer.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @returns {string} Authorization token.\r\n     */\r\n    public get authorizationToken(): string {\r\n        return this.properties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets the authorization token used to communicate with the service.\r\n     * @member Synthesizer.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} token - Authorization token.\r\n     */\r\n    public set authorizationToken(token: string) {\r\n        Contracts.throwIfNullOrWhitespace(token, \"token\");\r\n        this.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, token);\r\n    }\r\n\r\n    /**\r\n     * The collection of properties and their values defined for this Synthesizer.\r\n     * @member Synthesizer.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} The collection of properties and their values defined for this SpeechSynthesizer.\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    /**\r\n     * Indicates if auto detect source language is enabled\r\n     * @member Synthesizer.prototype.autoDetectSourceLanguage\r\n     * @function\r\n     * @public\r\n     * @returns {boolean} if auto detect source language is enabled\r\n     */\r\n    public get autoDetectSourceLanguage(): boolean {\r\n        return this.properties.getProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages) === AutoDetectSourceLanguagesOpenRangeOptionName;\r\n    }\r\n\r\n    /**\r\n     * Creates and initializes an instance of a Recognizer\r\n     * @constructor\r\n     * @param {SpeechConfig} speechConfig - The speech config to initialize the synthesizer.\r\n     */\r\n    protected constructor(speechConfig: SpeechConfig) {\r\n        const speechConfigImpl: SpeechConfigImpl = speechConfig as SpeechConfigImpl;\r\n        Contracts.throwIfNull(speechConfigImpl, \"speechConfig\");\r\n\r\n        this.privProperties = speechConfigImpl.properties.clone();\r\n        this.privDisposed = false;\r\n        this.privSynthesizing = false;\r\n        this.synthesisRequestQueue = new Queue<SynthesisRequest | StreamingSynthesisRequest>();\r\n        this.tokenCredential = speechConfig.tokenCredential;\r\n    }\r\n\r\n    public buildSsml(text: string): string {\r\n        const languageToDefaultVoice: IStringDictionary<string>  = {\r\n            [\"af-ZA\"]: \"af-ZA-AdriNeural\",\r\n            [\"am-ET\"]: \"am-ET-AmehaNeural\",\r\n            [\"ar-AE\"]: \"ar-AE-FatimaNeural\",\r\n            [\"ar-BH\"]: \"ar-BH-AliNeural\",\r\n            [\"ar-DZ\"]: \"ar-DZ-AminaNeural\",\r\n            [\"ar-EG\"]: \"ar-EG-SalmaNeural\",\r\n            [\"ar-IQ\"]: \"ar-IQ-BasselNeural\",\r\n            [\"ar-JO\"]: \"ar-JO-SanaNeural\",\r\n            [\"ar-KW\"]: \"ar-KW-FahedNeural\",\r\n            [\"ar-LY\"]: \"ar-LY-ImanNeural\",\r\n            [\"ar-MA\"]: \"ar-MA-JamalNeural\",\r\n            [\"ar-QA\"]: \"ar-QA-AmalNeural\",\r\n            [\"ar-SA\"]: \"ar-SA-HamedNeural\",\r\n            [\"ar-SY\"]: \"ar-SY-AmanyNeural\",\r\n            [\"ar-TN\"]: \"ar-TN-HediNeural\",\r\n            [\"ar-YE\"]: \"ar-YE-MaryamNeural\",\r\n            [\"bg-BG\"]: \"bg-BG-BorislavNeural\",\r\n            [\"bn-BD\"]: \"bn-BD-NabanitaNeural\",\r\n            [\"bn-IN\"]: \"bn-IN-BashkarNeural\",\r\n            [\"ca-ES\"]: \"ca-ES-JoanaNeural\",\r\n            [\"cs-CZ\"]: \"cs-CZ-AntoninNeural\",\r\n            [\"cy-GB\"]: \"cy-GB-AledNeural\",\r\n            [\"da-DK\"]: \"da-DK-ChristelNeural\",\r\n            [\"de-AT\"]: \"de-AT-IngridNeural\",\r\n            [\"de-CH\"]: \"de-CH-JanNeural\",\r\n            [\"de-DE\"]: \"de-DE-KatjaNeural\",\r\n            [\"el-GR\"]: \"el-GR-AthinaNeural\",\r\n            [\"en-AU\"]: \"en-AU-NatashaNeural\",\r\n            [\"en-CA\"]: \"en-CA-ClaraNeural\",\r\n            [\"en-GB\"]: \"en-GB-LibbyNeural\",\r\n            [\"en-HK\"]: \"en-HK-SamNeural\",\r\n            [\"en-IE\"]: \"en-IE-ConnorNeural\",\r\n            [\"en-IN\"]: \"en-IN-NeerjaNeural\",\r\n            [\"en-KE\"]: \"en-KE-AsiliaNeural\",\r\n            [\"en-NG\"]: \"en-NG-AbeoNeural\",\r\n            [\"en-NZ\"]: \"en-NZ-MitchellNeural\",\r\n            [\"en-PH\"]: \"en-PH-JamesNeural\",\r\n            [\"en-SG\"]: \"en-SG-LunaNeural\",\r\n            [\"en-TZ\"]: \"en-TZ-ElimuNeural\",\r\n            [\"en-US\"]: \"en-US-AvaMultilingualNeural\",\r\n            [\"en-ZA\"]: \"en-ZA-LeahNeural\",\r\n            [\"es-AR\"]: \"es-AR-ElenaNeural\",\r\n            [\"es-BO\"]: \"es-BO-MarceloNeural\",\r\n            [\"es-CL\"]: \"es-CL-CatalinaNeural\",\r\n            [\"es-CO\"]: \"es-CO-GonzaloNeural\",\r\n            [\"es-CR\"]: \"es-CR-JuanNeural\",\r\n            [\"es-CU\"]: \"es-CU-BelkysNeural\",\r\n            [\"es-DO\"]: \"es-DO-EmilioNeural\",\r\n            [\"es-EC\"]: \"es-EC-AndreaNeural\",\r\n            [\"es-ES\"]: \"es-ES-AlvaroNeural\",\r\n            [\"es-GQ\"]: \"es-GQ-JavierNeural\",\r\n            [\"es-GT\"]: \"es-GT-AndresNeural\",\r\n            [\"es-HN\"]: \"es-HN-CarlosNeural\",\r\n            [\"es-MX\"]: \"es-MX-DaliaNeural\",\r\n            [\"es-NI\"]: \"es-NI-FedericoNeural\",\r\n            [\"es-PA\"]: \"es-PA-MargaritaNeural\",\r\n            [\"es-PE\"]: \"es-PE-AlexNeural\",\r\n            [\"es-PR\"]: \"es-PR-KarinaNeural\",\r\n            [\"es-PY\"]: \"es-PY-MarioNeural\",\r\n            [\"es-SV\"]: \"es-SV-LorenaNeural\",\r\n            [\"es-US\"]: \"es-US-AlonsoNeural\",\r\n            [\"es-UY\"]: \"es-UY-MateoNeural\",\r\n            [\"es-VE\"]: \"es-VE-PaolaNeural\",\r\n            [\"et-EE\"]: \"et-EE-AnuNeural\",\r\n            [\"fa-IR\"]: \"fa-IR-DilaraNeural\",\r\n            [\"fi-FI\"]: \"fi-FI-SelmaNeural\",\r\n            [\"fil-PH\"]: \"fil-PH-AngeloNeural\",\r\n            [\"fr-BE\"]: \"fr-BE-CharlineNeural\",\r\n            [\"fr-CA\"]: \"fr-CA-SylvieNeural\",\r\n            [\"fr-CH\"]: \"fr-CH-ArianeNeural\",\r\n            [\"fr-FR\"]: \"fr-FR-DeniseNeural\",\r\n            [\"ga-IE\"]: \"ga-IE-ColmNeural\",\r\n            [\"gl-ES\"]: \"gl-ES-RoiNeural\",\r\n            [\"gu-IN\"]: \"gu-IN-DhwaniNeural\",\r\n            [\"he-IL\"]: \"he-IL-AvriNeural\",\r\n            [\"hi-IN\"]: \"hi-IN-MadhurNeural\",\r\n            [\"hr-HR\"]: \"hr-HR-GabrijelaNeural\",\r\n            [\"hu-HU\"]: \"hu-HU-NoemiNeural\",\r\n            [\"id-ID\"]: \"id-ID-ArdiNeural\",\r\n            [\"is-IS\"]: \"is-IS-GudrunNeural\",\r\n            [\"it-IT\"]: \"it-IT-IsabellaNeural\",\r\n            [\"ja-JP\"]: \"ja-JP-NanamiNeural\",\r\n            [\"jv-ID\"]: \"jv-ID-DimasNeural\",\r\n            [\"kk-KZ\"]: \"kk-KZ-AigulNeural\",\r\n            [\"km-KH\"]: \"km-KH-PisethNeural\",\r\n            [\"kn-IN\"]: \"kn-IN-GaganNeural\",\r\n            [\"ko-KR\"]: \"ko-KR-SunHiNeural\",\r\n            [\"lo-LA\"]: \"lo-LA-ChanthavongNeural\",\r\n            [\"lt-LT\"]: \"lt-LT-LeonasNeural\",\r\n            [\"lv-LV\"]: \"lv-LV-EveritaNeural\",\r\n            [\"mk-MK\"]: \"mk-MK-AleksandarNeural\",\r\n            [\"ml-IN\"]: \"ml-IN-MidhunNeural\",\r\n            [\"mr-IN\"]: \"mr-IN-AarohiNeural\",\r\n            [\"ms-MY\"]: \"ms-MY-OsmanNeural\",\r\n            [\"mt-MT\"]: \"mt-MT-GraceNeural\",\r\n            [\"my-MM\"]: \"my-MM-NilarNeural\",\r\n            [\"nb-NO\"]: \"nb-NO-PernilleNeural\",\r\n            [\"nl-BE\"]: \"nl-BE-ArnaudNeural\",\r\n            [\"nl-NL\"]: \"nl-NL-ColetteNeural\",\r\n            [\"pl-PL\"]: \"pl-PL-AgnieszkaNeural\",\r\n            [\"ps-AF\"]: \"ps-AF-GulNawazNeural\",\r\n            [\"pt-BR\"]: \"pt-BR-FranciscaNeural\",\r\n            [\"pt-PT\"]: \"pt-PT-DuarteNeural\",\r\n            [\"ro-RO\"]: \"ro-RO-AlinaNeural\",\r\n            [\"ru-RU\"]: \"ru-RU-SvetlanaNeural\",\r\n            [\"si-LK\"]: \"si-LK-SameeraNeural\",\r\n            [\"sk-SK\"]: \"sk-SK-LukasNeural\",\r\n            [\"sl-SI\"]: \"sl-SI-PetraNeural\",\r\n            [\"so-SO\"]: \"so-SO-MuuseNeural\",\r\n            [\"sr-RS\"]: \"sr-RS-NicholasNeural\",\r\n            [\"su-ID\"]: \"su-ID-JajangNeural\",\r\n            [\"sv-SE\"]: \"sv-SE-SofieNeural\",\r\n            [\"sw-KE\"]: \"sw-KE-RafikiNeural\",\r\n            [\"sw-TZ\"]: \"sw-TZ-DaudiNeural\",\r\n            [\"ta-IN\"]: \"ta-IN-PallaviNeural\",\r\n            [\"ta-LK\"]: \"ta-LK-KumarNeural\",\r\n            [\"ta-SG\"]: \"ta-SG-AnbuNeural\",\r\n            [\"te-IN\"]: \"te-IN-MohanNeural\",\r\n            [\"th-TH\"]: \"th-TH-PremwadeeNeural\",\r\n            [\"tr-TR\"]: \"tr-TR-AhmetNeural\",\r\n            [\"uk-UA\"]: \"uk-UA-OstapNeural\",\r\n            [\"ur-IN\"]: \"ur-IN-GulNeural\",\r\n            [\"ur-PK\"]: \"ur-PK-AsadNeural\",\r\n            [\"uz-UZ\"]: \"uz-UZ-MadinaNeural\",\r\n            [\"vi-VN\"]: \"vi-VN-HoaiMyNeural\",\r\n            [\"zh-CN\"]: \"zh-CN-XiaoxiaoNeural\",\r\n            [\"zh-HK\"]: \"zh-HK-HiuMaanNeural\",\r\n            [\"zh-TW\"]: \"zh-TW-HsiaoChenNeural\",\r\n            [\"zu-ZA\"]: \"zu-ZA-ThandoNeural\",\r\n        };\r\n\r\n        let language = this.properties.getProperty(PropertyId.SpeechServiceConnection_SynthLanguage, \"en-US\");\r\n        let voice = this.properties.getProperty(PropertyId.SpeechServiceConnection_SynthVoice, \"\");\r\n        let ssml: string = Synthesizer.XMLEncode(text);\r\n        if (this.autoDetectSourceLanguage) {\r\n            language = \"en-US\";\r\n        } else {\r\n            voice = voice || languageToDefaultVoice[language];\r\n        }\r\n        if (voice) {\r\n            ssml = `<voice name='${voice}'>${ssml}</voice>`;\r\n        }\r\n        ssml = `<speak version='1.0' xmlns='http://www.w3.org/2001/10/synthesis' xmlns:mstts='http://www.w3.org/2001/mstts' xmlns:emo='http://www.w3.org/2009/10/emotionml' xml:lang='${language}'>${ssml}</speak>`;\r\n        return ssml;\r\n    }\r\n\r\n    /**\r\n     * This method performs cleanup of resources.\r\n     * The Boolean parameter disposing indicates whether the method is called\r\n     * from Dispose (if disposing is true) or from the finalizer (if disposing is false).\r\n     * Derived classes should override this method to dispose resource if needed.\r\n     * @member Synthesizer.prototype.dispose\r\n     * @function\r\n     * @public\r\n     * @param {boolean} disposing - Flag to request disposal.\r\n     */\r\n    protected async dispose(disposing: boolean): Promise<void> {\r\n        if (this.privDisposed) {\r\n            return;\r\n        }\r\n\r\n        if (disposing) {\r\n            if (this.privAdapter) {\r\n                await this.privAdapter.dispose();\r\n            }\r\n        }\r\n\r\n        this.privDisposed = true;\r\n    }\r\n\r\n    protected async adapterSpeak(): Promise<void> {\r\n        if (!this.privDisposed && !this.privSynthesizing) {\r\n            this.privSynthesizing = true;\r\n            const request = await this.synthesisRequestQueue.dequeue();\r\n            if (request instanceof StreamingSynthesisRequest) {\r\n                return this.privAdapter.SpeakStream(\r\n                    request.speechSynthesisRequest,\r\n                    request.requestId,\r\n                    request.cb,\r\n                    request.err,\r\n                    request.dataStream\r\n                );\r\n            }\r\n            return this.privAdapter.Speak(request.text, request.isSSML, request.requestId, request.cb, request.err, request.dataStream);\r\n        }\r\n    }\r\n\r\n    //\r\n    // ################################################################################################################\r\n    // IMPLEMENTATION.\r\n    // Move to independent class\r\n    // ################################################################################################################\r\n    //\r\n\r\n    // Creates the synthesis adapter\r\n    protected abstract createSynthesisAdapter(\r\n        authentication: IAuthentication,\r\n        connectionFactory: ISynthesisConnectionFactory,\r\n        synthesizerConfig: SynthesizerConfig): SynthesisAdapterBase;\r\n\r\n    // Creates the REST synthesis adapter\r\n    protected abstract createRestSynthesisAdapter(\r\n        authentication: IAuthentication,\r\n        synthesizerConfig: SynthesizerConfig): SynthesisRestAdapter;\r\n\r\n    protected createSynthesizerConfig(speechConfig: SpeechServiceConfig): SynthesizerConfig {\r\n        return new SynthesizerConfig(\r\n            speechConfig,\r\n            this.privProperties);\r\n    }\r\n\r\n    // Does the generic synthesizer setup that is common across all synthesizer types.\r\n    protected implCommonSynthesizeSetup(): void {\r\n\r\n        let osPlatform = (typeof window !== \"undefined\") ? \"Browser\" : \"Node\";\r\n        let osName = \"unknown\";\r\n        let osVersion = \"unknown\";\r\n\r\n        if (typeof navigator !== \"undefined\") {\r\n            osPlatform = osPlatform + \"/\" + navigator.platform;\r\n            osName = navigator.userAgent;\r\n            osVersion = navigator.appVersion;\r\n        }\r\n\r\n        const synthesizerConfig: SynthesizerConfig = this.createSynthesizerConfig(\r\n            new SpeechServiceConfig(\r\n                new Context(new OS(osPlatform, osName, osVersion))));\r\n\r\n        const subscriptionKey = this.privProperties.getProperty(PropertyId.SpeechServiceConnection_Key, undefined);\r\n        const authentication = (subscriptionKey && subscriptionKey !== \"\")\r\n        ? new CognitiveSubscriptionKeyAuthentication(subscriptionKey)\r\n        : (this.tokenCredential)\r\n            ? new CognitiveTokenAuthentication(\r\n                async (): Promise<string> => {\r\n                    try {\r\n                        const tokenResponse = await this.tokenCredential.getToken(\"https://cognitiveservices.azure.com/.default\");\r\n                        return tokenResponse?.token ?? \"\";\r\n                    } catch (err) {\r\n                        throw err;\r\n                    }\r\n                },\r\n                async (): Promise<string> => {\r\n                    try {\r\n                        const tokenResponse = await this.tokenCredential.getToken(\"https://cognitiveservices.azure.com/.default\");\r\n                        return tokenResponse?.token ?? \"\";\r\n                    } catch (err) {\r\n                        throw err;\r\n                    }\r\n                }\r\n            )\r\n            : new CognitiveTokenAuthentication(\r\n                (): Promise<string> => {\r\n                    const authorizationToken = this.privProperties.getProperty(PropertyId.SpeechServiceAuthorization_Token, undefined);\r\n                    return Promise.resolve(authorizationToken);\r\n                },\r\n                (): Promise<string> => {\r\n                    const authorizationToken = this.privProperties.getProperty(PropertyId.SpeechServiceAuthorization_Token, undefined);\r\n                    return Promise.resolve(authorizationToken);\r\n                }\r\n            );\r\n\r\n        this.privAdapter = this.createSynthesisAdapter(\r\n            authentication,\r\n            this.privConnectionFactory,\r\n            synthesizerConfig);\r\n\r\n        this.privRestAdapter = this.createRestSynthesisAdapter(\r\n            authentication,\r\n            synthesizerConfig);\r\n    }\r\n\r\n    protected static XMLEncode(text: string): string {\r\n        return text.replace(/&/g, \"&amp;\")\r\n            .replace(/</g, \"&lt;\")\r\n            .replace(/>/g, \"&gt;\")\r\n            .replace(/\"/g, \"&quot;\")\r\n            .replace(/'/g, \"&apos;\");\r\n    }\r\n}\r\n\r\nexport class SynthesisRequest {\r\n    public requestId: string;\r\n    public text: string;\r\n    public isSSML: boolean;\r\n    public cb: (e: SpeechSynthesisResult) => void;\r\n    public err: (e: string) => void;\r\n    public dataStream: IAudioDestination | undefined;\r\n\r\n    public constructor(requestId: string, text: string, isSSML: boolean, cb?: (e: SpeechSynthesisResult) => void, err?: (e: string) => void, dataStream?: IAudioDestination) {\r\n        this.requestId = requestId;\r\n        this.text = text;\r\n        this.isSSML = isSSML;\r\n        // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n        this.cb = cb ?? ((): void => { });\r\n        // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n        this.err = err ?? ((): void => { });\r\n        this.dataStream = dataStream ?? undefined;\r\n    }\r\n}\r\n\r\nexport class StreamingSynthesisRequest {\r\n    public requestId: string;\r\n    public speechSynthesisRequest: SpeechSynthesisRequest;\r\n    public cb: (e: SpeechSynthesisResult) => void;\r\n    public err: (e: string) => void;\r\n    public dataStream: IAudioDestination | undefined;\r\n\r\n    public constructor(\r\n        requestId: string,\r\n        speechSynthesisRequest: SpeechSynthesisRequest,\r\n        cb?: (e: SpeechSynthesisResult) => void,\r\n        err?: (e: string) => void,\r\n        dataStream?: IAudioDestination\r\n    ) {\r\n        this.requestId = requestId;\r\n        this.speechSynthesisRequest = speechSynthesisRequest;\r\n        // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n        this.cb = cb ?? ((): void => { });\r\n        // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n        this.err = err ?? ((): void => { });\r\n        this.dataStream = dataStream ?? undefined;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable @typescript-eslint/no-empty-function */\r\n\r\nimport { PathLike } from \"fs\";\r\nimport { IRestResponse } from \"../common.browser/RestMessageAdapter.js\";\r\nimport {\r\n    IAuthentication,\r\n    ISynthesisConnectionFactory,\r\n    SpeechSynthesisConnectionFactory,\r\n    SynthesisAdapterBase,\r\n    SpeechSynthesisAdapter,\r\n    SynthesisRestAdapter,\r\n    SynthesizerConfig,\r\n} from \"../common.speech/Exports.js\";\r\nimport {\r\n    createNoDashGuid,\r\n    IAudioDestination,\r\n    marshalPromiseToCallbacks,\r\n} from \"../common/Exports.js\";\r\nimport { AudioOutputConfigImpl } from \"./Audio/AudioConfig.js\";\r\nimport { AudioFileWriter } from \"./Audio/AudioFileWriter.js\";\r\nimport { AudioOutputFormatImpl } from \"./Audio/AudioOutputFormat.js\";\r\nimport {\r\n    PullAudioOutputStreamImpl,\r\n    PushAudioOutputStreamImpl\r\n} from \"./Audio/AudioOutputStream.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport {\r\n    AudioConfig,\r\n    AudioOutputStream,\r\n    AutoDetectSourceLanguageConfig,\r\n    PropertyId,\r\n    PullAudioOutputStream,\r\n    PushAudioOutputStreamCallback,\r\n    SpeechConfig,\r\n    SpeechSynthesisBookmarkEventArgs,\r\n    SpeechSynthesisEventArgs,\r\n    SpeechSynthesisOutputFormat,\r\n    SpeechSynthesisResult,\r\n    SpeechSynthesisVisemeEventArgs,\r\n    SpeechSynthesisWordBoundaryEventArgs,\r\n    SynthesisVoicesResult,\r\n    Synthesizer\r\n} from \"./Exports.js\";\r\nimport { SpeechConfigImpl } from \"./SpeechConfig.js\";\r\nimport { SpeechSynthesisRequest } from \"./SpeechSynthesisRequest.js\";\r\nimport { StreamingSynthesisRequest, SynthesisRequest } from \"./Synthesizer.js\";\r\n\r\n/**\r\n * Defines the class SpeechSynthesizer for text to speech.\r\n * Updated in version 1.16.0\r\n * @class SpeechSynthesizer\r\n */\r\nexport class SpeechSynthesizer extends Synthesizer {\r\n    protected audioConfig: AudioConfig;\r\n\r\n    /**\r\n     * Defines event handler for synthesis start events.\r\n     * @member SpeechSynthesizer.prototype.synthesisStarted\r\n     * @function\r\n     * @public\r\n     */\r\n    public synthesisStarted: (sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for synthesizing events.\r\n     * @member SpeechSynthesizer.prototype.synthesizing\r\n     * @function\r\n     * @public\r\n     */\r\n    public synthesizing: (sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for synthesis completed events.\r\n     * @member SpeechSynthesizer.prototype.synthesisCompleted\r\n     * @function\r\n     * @public\r\n     */\r\n    public synthesisCompleted: (sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for synthesis cancelled events.\r\n     * @member SpeechSynthesizer.prototype.SynthesisCanceled\r\n     * @function\r\n     * @public\r\n     */\r\n    public SynthesisCanceled: (sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for word boundary events\r\n     * @member SpeechSynthesizer.prototype.wordBoundary\r\n     * @function\r\n     * @public\r\n     */\r\n    public wordBoundary: (sender: SpeechSynthesizer, event: SpeechSynthesisWordBoundaryEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for bookmark reached events\r\n     * Added in version 1.16.0\r\n     * @member SpeechSynthesizer.prototype.bookmarkReached\r\n     * @function\r\n     * @public\r\n     */\r\n    public bookmarkReached: (sender: SpeechSynthesizer, event: SpeechSynthesisBookmarkEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for viseme received event\r\n     * Added in version 1.16.0\r\n     * @member SpeechSynthesizer.prototype.visemeReceived\r\n     * @function\r\n     * @public\r\n     */\r\n    public visemeReceived: (sender: SpeechSynthesizer, event: SpeechSynthesisVisemeEventArgs) => void;\r\n\r\n    /**\r\n     * SpeechSynthesizer constructor.\r\n     * @constructor\r\n     * @param {SpeechConfig} speechConfig - An set of initial properties for this synthesizer.\r\n     * @param {AudioConfig} audioConfig - An optional audio configuration associated with the synthesizer.\r\n     */\r\n    public constructor(speechConfig: SpeechConfig, audioConfig?: AudioConfig | null) {\r\n        super(speechConfig);\r\n\r\n        if (audioConfig !== null) {\r\n            if (audioConfig === undefined) {\r\n                this.audioConfig = (typeof window === \"undefined\") ? undefined : AudioConfig.fromDefaultSpeakerOutput();\r\n            } else {\r\n                this.audioConfig = audioConfig;\r\n            }\r\n        }\r\n\r\n        this.privConnectionFactory = new SpeechSynthesisConnectionFactory();\r\n        this.implCommonSynthesizeSetup();\r\n    }\r\n\r\n    /**\r\n     * SpeechSynthesizer constructor.\r\n     * @constructor\r\n     * @param {SpeechConfig} speechConfig - an set of initial properties for this synthesizer\r\n     * @param {AutoDetectSourceLanguageConfig} autoDetectSourceLanguageConfig - An source language detection configuration associated with the synthesizer\r\n     * @param {AudioConfig} audioConfig - An optional audio configuration associated with the synthesizer\r\n     */\r\n    public static FromConfig(speechConfig: SpeechConfig, autoDetectSourceLanguageConfig: AutoDetectSourceLanguageConfig, audioConfig?: AudioConfig | null): SpeechSynthesizer {\r\n        const speechConfigImpl: SpeechConfigImpl = speechConfig as SpeechConfigImpl;\r\n        autoDetectSourceLanguageConfig.properties.mergeTo(speechConfigImpl.properties);\r\n        return new SpeechSynthesizer(speechConfig, audioConfig);\r\n    }\r\n\r\n    /**\r\n     * Executes speech synthesis on plain text.\r\n     * The task returns the synthesis result.\r\n     * @member SpeechSynthesizer.prototype.speakTextAsync\r\n     * @function\r\n     * @public\r\n     * @param text - Text to be synthesized.\r\n     * @param cb - Callback that received the SpeechSynthesisResult.\r\n     * @param err - Callback invoked in case of an error.\r\n     * @param stream - AudioOutputStream to receive the synthesized audio.\r\n     */\r\n    public speakTextAsync(text: string, cb?: (e: SpeechSynthesisResult) => void, err?: (e: string) => void, stream?: AudioOutputStream | PushAudioOutputStreamCallback | PathLike): void {\r\n        this.speakImpl(text, false, cb, err, stream);\r\n    }\r\n\r\n    /**\r\n     * Executes speech synthesis on SSML.\r\n     * The task returns the synthesis result.\r\n     * @member SpeechSynthesizer.prototype.speakSsmlAsync\r\n     * @function\r\n     * @public\r\n     * @param ssml - SSML to be synthesized.\r\n     * @param cb - Callback that received the SpeechSynthesisResult.\r\n     * @param err - Callback invoked in case of an error.\r\n     * @param stream - AudioOutputStream to receive the synthesized audio.\r\n     */\r\n    public speakSsmlAsync(ssml: string, cb?: (e: SpeechSynthesisResult) => void, err?: (e: string) => void, stream?: AudioOutputStream | PushAudioOutputStreamCallback | PathLike): void {\r\n        this.speakImpl(ssml, true, cb, err, stream);\r\n    }\r\n\r\n    /**\r\n     * Performs synthesis using a SpeechSynthesisRequest, which supports text streaming.\r\n     * This method is in preview and may be subject to change in future versions.\r\n     * @member SpeechSynthesizer.prototype.speakAsync\r\n     * @function\r\n     * @public\r\n     * @param request - The speech synthesis request (supports text streaming input).\r\n     * @param cb - Callback that received the SpeechSynthesisResult.\r\n     * @param err - Callback invoked in case of an error.\r\n     * @param stream - AudioOutputStream to receive the synthesized audio.\r\n     */\r\n    public speakAsync(\r\n        request: SpeechSynthesisRequest,\r\n        cb?: (e: SpeechSynthesisResult) => void,\r\n        err?: (e: string) => void,\r\n        stream?: AudioOutputStream | PushAudioOutputStreamCallback | PathLike\r\n    ): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privDisposed);\r\n            const requestId = createNoDashGuid();\r\n            const audioDestination = this.resolveAudioDestination(stream);\r\n            const { onSuccess, onError } = this.createSynthesisCallbacks(cb, err, (): void => {\r\n                /* eslint-disable no-empty */\r\n                this.adapterSpeak().catch((): void => { });\r\n            });\r\n\r\n            this.synthesisRequestQueue.enqueue(new StreamingSynthesisRequest(\r\n                requestId,\r\n                request,\r\n                onSuccess,\r\n                onError,\r\n                audioDestination\r\n            ));\r\n\r\n            /* eslint-disable no-empty-function */\r\n            this.adapterSpeak().catch((): void => { });\r\n        } catch (error) {\r\n            this.handleSpeakError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Get list of synthesis voices available.\r\n     * The task returns the synthesis voice result.\r\n     * @member SpeechSynthesizer.prototype.getVoicesAsync\r\n     * @function\r\n     * @async\r\n     * @public\r\n     * @param locale - Locale of voices in BCP-47 format; if left empty, get all available voices.\r\n     * @return {Promise<SynthesisVoicesResult>} - Promise of a SynthesisVoicesResult.\r\n     */\r\n    public async getVoicesAsync(locale: string = \"\"): Promise<SynthesisVoicesResult> {\r\n        return this.getVoices(locale);\r\n    }\r\n\r\n    /**\r\n     * Dispose of associated resources.\r\n     * @member SpeechSynthesizer.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(cb?: () => void, err?: (error: string) => void): void {\r\n        Contracts.throwIfDisposed(this.privDisposed);\r\n\r\n        marshalPromiseToCallbacks(this.dispose(true), cb, err);\r\n    }\r\n\r\n    /**\r\n     * @Internal\r\n     * Do not use externally, object returned will change without warning or notice.\r\n     */\r\n    public get internalData(): object {\r\n        return this.privAdapter;\r\n    }\r\n\r\n    //\r\n    // ################################################################################################################\r\n    // IMPLEMENTATION.\r\n    // ################################################################################################################\r\n    //\r\n\r\n    // Creates the synthesis adapter\r\n    protected createSynthesisAdapter(\r\n        authentication: IAuthentication,\r\n        connectionFactory: ISynthesisConnectionFactory,\r\n        synthesizerConfig: SynthesizerConfig): SynthesisAdapterBase {\r\n        return new SpeechSynthesisAdapter(authentication, connectionFactory,\r\n            synthesizerConfig, this, this.audioConfig as AudioOutputConfigImpl);\r\n    }\r\n\r\n    protected createRestSynthesisAdapter(\r\n        authentication: IAuthentication,\r\n        synthesizerConfig: SynthesizerConfig): SynthesisRestAdapter {\r\n        return new SynthesisRestAdapter(synthesizerConfig, authentication);\r\n    }\r\n\r\n    protected implCommonSynthesizeSetup(): void {\r\n        super.implCommonSynthesizeSetup();\r\n\r\n        this.privAdapter.audioOutputFormat = AudioOutputFormatImpl.fromSpeechSynthesisOutputFormat(\r\n            SpeechSynthesisOutputFormat[this.properties.getProperty(PropertyId.SpeechServiceConnection_SynthOutputFormat, undefined) as keyof typeof SpeechSynthesisOutputFormat]\r\n        );\r\n    }\r\n\r\n    protected speakImpl(text: string, IsSsml: boolean, cb?: (e: SpeechSynthesisResult) => void, err?: (e: string) => void, dataStream?: AudioOutputStream | PushAudioOutputStreamCallback | PathLike): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privDisposed);\r\n            const requestId = createNoDashGuid();\r\n            const audioDestination = this.resolveAudioDestination(dataStream);\r\n            const { onSuccess, onError } = this.createSynthesisCallbacks(cb, err, (): void => {\r\n                /* eslint-disable no-empty */\r\n                this.adapterSpeak().catch((): void => { });\r\n            });\r\n\r\n            this.synthesisRequestQueue.enqueue(new SynthesisRequest(requestId, text, IsSsml, onSuccess, onError, audioDestination));\r\n\r\n            /* eslint-disable no-empty-function */\r\n            this.adapterSpeak().catch((): void => { });\r\n        } catch (error) {\r\n            this.handleSpeakError(error, err);\r\n        }\r\n    }\r\n\r\n    private resolveAudioDestination(stream?: AudioOutputStream | PushAudioOutputStreamCallback | PathLike): IAudioDestination | undefined {\r\n        if (stream instanceof PushAudioOutputStreamCallback) {\r\n            return new PushAudioOutputStreamImpl(stream);\r\n        } else if (stream instanceof PullAudioOutputStream) {\r\n            return stream as PullAudioOutputStreamImpl;\r\n        } else if (stream !== undefined) {\r\n            return new AudioFileWriter(stream as PathLike);\r\n        }\r\n        return undefined;\r\n    }\r\n\r\n    private createSynthesisCallbacks(\r\n        cb?: (e: SpeechSynthesisResult) => void,\r\n        err?: (e: string) => void,\r\n        processNext?: () => void\r\n    ): { onSuccess: (e: SpeechSynthesisResult) => void; onError: (e: string) => void } {\r\n        let successCb = cb;\r\n        return {\r\n            onError: (e: string): void => {\r\n                this.privSynthesizing = false;\r\n                if (!!err) {\r\n                    err(e);\r\n                }\r\n                if (processNext) {\r\n                    processNext();\r\n                }\r\n            },\r\n            onSuccess: (e: SpeechSynthesisResult): void => {\r\n                this.privSynthesizing = false;\r\n                if (!!successCb) {\r\n                    try {\r\n                        successCb(e);\r\n                    } catch (e) {\r\n                        if (!!err) {\r\n                            err(e as string);\r\n                        }\r\n                    }\r\n                }\r\n                successCb = undefined;\r\n                if (processNext) {\r\n                    processNext();\r\n                }\r\n            }\r\n        };\r\n    }\r\n\r\n    private handleSpeakError(error: unknown, err?: (e: string) => void): void {\r\n        if (!!err) {\r\n            if (error instanceof Error) {\r\n                const typedError: Error = error;\r\n                err(typedError.name + \": \" + typedError.message);\r\n            } else {\r\n                err(error as string);\r\n            }\r\n        }\r\n        // Destroy the synthesizer.\r\n        /* eslint-disable no-empty */\r\n        this.dispose(true).catch((): void => { });\r\n    }\r\n\r\n    protected async getVoices(locale: string): Promise<SynthesisVoicesResult> {\r\n        const requestId = createNoDashGuid();\r\n        const response: IRestResponse = await this.privRestAdapter.getVoicesList(requestId);\r\n        if (response.ok && Array.isArray(response.json)) {\r\n            let json = response.json;\r\n            if (!!locale && locale.length > 0) {\r\n                json = json.filter((item: { Locale: string }): boolean => !!item.Locale && item.Locale.toLowerCase() === locale.toLowerCase() );\r\n            }\r\n            return new SynthesisVoicesResult(requestId, json, undefined);\r\n        } else {\r\n            return new SynthesisVoicesResult(requestId, undefined, `Error: ${response.status}: ${response.statusText}`);\r\n        }\r\n   }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyCollection, ResultReason } from \"./Exports.js\";\r\n\r\n/**\r\n * Base class for synthesis results\r\n * @class SynthesisResult\r\n * Added in version 1.20.0\r\n */\r\nexport class SynthesisResult {\r\n    private privResultId: string;\r\n    private privReason: ResultReason;\r\n    private privErrorDetails: string;\r\n    private privProperties: PropertyCollection;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {string} resultId - The result id.\r\n     * @param {ResultReason} reason - The reason.\r\n     * @param {string} errorDetails - Error details, if provided.\r\n     * @param {PropertyCollection} properties - Additional properties, if provided.\r\n     */\r\n    public constructor(resultId?: string, reason?: ResultReason, errorDetails?: string, properties?: PropertyCollection) {\r\n        this.privResultId = resultId;\r\n        this.privReason = reason;\r\n        this.privErrorDetails = errorDetails;\r\n        this.privProperties = properties;\r\n    }\r\n\r\n    /**\r\n     * Specifies the result identifier.\r\n     * @member SynthesisResult.prototype.resultId\r\n     * @function\r\n     * @public\r\n     * @returns {string} Specifies the result identifier.\r\n     */\r\n    public get resultId(): string {\r\n        return this.privResultId;\r\n    }\r\n\r\n    /**\r\n     * Specifies status of the result.\r\n     * @member SynthesisResult.prototype.reason\r\n     * @function\r\n     * @public\r\n     * @returns {ResultReason} Specifies status of the result.\r\n     */\r\n    public get reason(): ResultReason {\r\n        return this.privReason;\r\n    }\r\n\r\n    /**\r\n     * In case of an unsuccessful synthesis, provides details of the occurred error.\r\n     * @member SynthesisResult.prototype.errorDetails\r\n     * @function\r\n     * @public\r\n     * @returns {string} a brief description of an error.\r\n     */\r\n    public get errorDetails(): string {\r\n        return this.privErrorDetails;\r\n    }\r\n\r\n    /**\r\n     * The set of properties exposed in the result.\r\n     * @member SynthesisResult.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} The set of properties exposed in the result.\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    PropertyCollection,\r\n    ResultReason,\r\n    SynthesisResult\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Defines result of speech synthesis.\r\n * @class SpeechSynthesisResult\r\n * Added in version 1.11.0\r\n */\r\nexport class SpeechSynthesisResult extends SynthesisResult {\r\n    private readonly privAudioData: ArrayBuffer;\r\n    private readonly privAudioDuration: number;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {string} resultId - The result id.\r\n     * @param {ResultReason} reason - The reason.\r\n     * @param {ArrayBuffer} audioData - The synthesized audio binary.\r\n     * @param {string} errorDetails - Error details, if provided.\r\n     * @param {PropertyCollection} properties - Additional properties, if provided.\r\n     * @param {number} audioDuration - The audio duration.\r\n     */\r\n    public constructor(resultId?: string, reason?: ResultReason, audioData?: ArrayBuffer,\r\n                errorDetails?: string, properties?: PropertyCollection, audioDuration?: number) {\r\n        super(resultId, reason, errorDetails, properties);\r\n        this.privAudioData = audioData;\r\n        this.privAudioDuration = audioDuration;\r\n    }\r\n\r\n    /**\r\n     * The synthesized audio data\r\n     * @member SpeechSynthesisResult.prototype.audioData\r\n     * @function\r\n     * @public\r\n     * @returns {ArrayBuffer} The synthesized audio data.\r\n     */\r\n    public get audioData(): ArrayBuffer {\r\n        return this.privAudioData;\r\n    }\r\n\r\n    /**\r\n     * The time duration of synthesized audio, in ticks (100 nanoseconds).\r\n     * @member SpeechSynthesisResult.prototype.audioDuration\r\n     * @function\r\n     * @public\r\n     * @returns {number} The time duration of synthesized audio.\r\n     */\r\n    public get audioDuration(): number {\r\n        return this.privAudioDuration;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { SpeechSynthesisResult } from \"./Exports.js\";\r\n\r\n/**\r\n * Defines contents of speech synthesis events.\r\n * @class SpeechSynthesisEventArgs\r\n * Added in version 1.11.0\r\n */\r\nexport class SpeechSynthesisEventArgs {\r\n    private readonly privResult: SpeechSynthesisResult;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {SpeechSynthesisResult} result - The speech synthesis result.\r\n     */\r\n    public constructor(result: SpeechSynthesisResult) {\r\n        this.privResult = result;\r\n    }\r\n\r\n    /**\r\n     * Specifies the synthesis result.\r\n     * @member SpeechSynthesisEventArgs.prototype.result\r\n     * @function\r\n     * @public\r\n     * @returns {SpeechSynthesisResult} the synthesis result.\r\n     */\r\n    public get result(): SpeechSynthesisResult {\r\n        return this.privResult;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { SpeechSynthesisBoundaryType } from \"./SpeechSynthesisBoundaryType.js\";\r\n\r\n/**\r\n * Defines contents of speech synthesis word boundary event.\r\n * @class SpeechSynthesisWordBoundaryEventArgs\r\n * Added in version 1.11.0\r\n */\r\nexport class SpeechSynthesisWordBoundaryEventArgs {\r\n    private readonly privAudioOffset: number;\r\n    private readonly privDuration: number;\r\n    private readonly privText: string;\r\n    private readonly privWordLength: number;\r\n    private readonly privTextOffset: number;\r\n    private readonly privBoundaryType: SpeechSynthesisBoundaryType;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {number} audioOffset - The audio offset.\r\n     * @param {number} duration - The audio duration.\r\n     * @param {string} text - The text.\r\n     * @param {number} wordLength - The length of the word.\r\n     * @param {number} textOffset - The text offset.\r\n     * @param {SpeechSynthesisBoundaryType} boundaryType - The boundary type\r\n     */\r\n    public constructor(audioOffset: number, duration: number, text: string, wordLength: number,\r\n                       textOffset: number, boundaryType: SpeechSynthesisBoundaryType) {\r\n        this.privAudioOffset = audioOffset;\r\n        this.privDuration = duration;\r\n        this.privText = text;\r\n        this.privWordLength = wordLength;\r\n        this.privTextOffset = textOffset;\r\n        this.privBoundaryType = boundaryType;\r\n    }\r\n\r\n    /**\r\n     * Specifies the audio offset.\r\n     * @member SpeechSynthesisWordBoundaryEventArgs.prototype.audioOffset\r\n     * @function\r\n     * @public\r\n     * @returns {number} the audio offset.\r\n     */\r\n    public get audioOffset(): number {\r\n        return this.privAudioOffset;\r\n    }\r\n\r\n    /**\r\n     * Specifies the duration, in ticks (100 nanoseconds).\r\n     * @member SpeechSynthesisWordBoundaryEventArgs.prototype.duration\r\n     * @function\r\n     * @public\r\n     * @returns {number} Duration in 100 nanosecond increments.\r\n     */\r\n    public get duration(): number {\r\n        return this.privDuration;\r\n    }\r\n\r\n    /**\r\n     * Specifies the text of the word boundary event.\r\n     * @member SpeechSynthesisWordBoundaryEventArgs.prototype.text\r\n     * @function\r\n     * @public\r\n     * @returns {string} the text.\r\n     */\r\n    public get text(): string {\r\n        return this.privText;\r\n    }\r\n\r\n    /**\r\n     * Specifies the word length\r\n     * @member SpeechSynthesisWordBoundaryEventArgs.prototype.wordLength\r\n     * @function\r\n     * @public\r\n     * @returns {number} the word length\r\n     */\r\n    public get wordLength(): number {\r\n        return this.privWordLength;\r\n    }\r\n\r\n    /**\r\n     * Specifies the text offset.\r\n     * @member SpeechSynthesisWordBoundaryEventArgs.prototype.textOffset\r\n     * @function\r\n     * @public\r\n     * @returns {number} the text offset.\r\n     */\r\n    public get textOffset(): number {\r\n        return this.privTextOffset;\r\n    }\r\n\r\n    /**\r\n     * Specifies the boundary type.\r\n     * @member SpeechSynthesisWordBoundaryEventArgs.prototype.boundaryType\r\n     * @function\r\n     * @public\r\n     * @returns {SpeechSynthesisBoundaryType} the boundary type.\r\n     */\r\n    public get boundaryType(): SpeechSynthesisBoundaryType {\r\n        return this.privBoundaryType;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines contents of speech synthesis bookmark event.\r\n * @class SpeechSynthesisBookmarkEventArgs\r\n * Added in version 1.16.0\r\n */\r\nexport class SpeechSynthesisBookmarkEventArgs {\r\n    private privAudioOffset: number;\r\n    private privText: string;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {number} audioOffset - The audio offset.\r\n     * @param {string} text - The bookmark text.\r\n     */\r\n    public constructor(audioOffset: number, text: string) {\r\n        this.privAudioOffset = audioOffset;\r\n        this.privText = text;\r\n    }\r\n\r\n    /**\r\n     * Specifies the audio offset.\r\n     * @member SpeechSynthesisBookmarkEventArgs.prototype.audioOffset\r\n     * @function\r\n     * @public\r\n     * @returns {number} the audio offset.\r\n     */\r\n    public get audioOffset(): number {\r\n        return this.privAudioOffset;\r\n    }\r\n\r\n    /**\r\n     * Specifies the bookmark.\r\n     * @member SpeechSynthesisBookmarkEventArgs.prototype.text\r\n     * @function\r\n     * @public\r\n     * @returns {string} the bookmark text.\r\n     */\r\n    public get text(): string {\r\n        return this.privText;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines contents of speech synthesis viseme event.\r\n * @class SpeechSynthesisVisemeEventArgs\r\n * Added in version 1.16.0\r\n */\r\nexport class SpeechSynthesisVisemeEventArgs {\r\n    private privAudioOffset: number;\r\n    private privVisemeId: number;\r\n    private privAnimation: string;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {number} audioOffset - The audio offset.\r\n     * @param {number} visemeId - The viseme ID.\r\n     * @param {string} animation - The animation, could be in svg or other format.\r\n     */\r\n    public constructor(audioOffset: number, visemeId: number, animation: string) {\r\n        this.privAudioOffset = audioOffset;\r\n        this.privVisemeId = visemeId;\r\n        this.privAnimation = animation;\r\n    }\r\n\r\n    /**\r\n     * Specifies the audio offset.\r\n     * @member SpeechSynthesisVisemeEventArgs.prototype.audioOffset\r\n     * @function\r\n     * @public\r\n     * @returns {number} the audio offset.\r\n     */\r\n    public get audioOffset(): number {\r\n        return this.privAudioOffset;\r\n    }\r\n\r\n    /**\r\n     * Specifies the viseme ID.\r\n     * @member SpeechSynthesisVisemeEventArgs.prototype.visemeId\r\n     * @function\r\n     * @public\r\n     * @returns {number} the viseme ID.\r\n     */\r\n    public get visemeId(): number {\r\n        return this.privVisemeId;\r\n    }\r\n\r\n    /**\r\n     * Specifies the animation.\r\n     * @member SpeechSynthesisVisemeEventArgs.prototype.animation\r\n     * @function\r\n     * @public\r\n     * @returns {string} the animation, could be in svg or other format.\r\n     */\r\n    public get animation(): string {\r\n        return this.privAnimation;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines the boundary type of speech synthesis boundary event.\r\n * @class SpeechSynthesisBoundaryType\r\n * Added in version 1.21.0\r\n */\r\nexport enum SpeechSynthesisBoundaryType {\r\n    /**\r\n     * Indicates the boundary text is a word.\r\n     * @member SpeechSynthesisBoundaryType.Word\r\n     */\r\n    Word = \"WordBoundary\",\r\n\r\n    /**\r\n     * Indicates the boundary text is a punctuation.\r\n     * @member SpeechSynthesisBoundaryType.Punctuation\r\n     */\r\n    Punctuation = \"PunctuationBoundary\",\r\n\r\n    /**\r\n     * Indicates the boundary text is a sentence.\r\n     * @member SpeechSynthesisBoundaryType.Sentence\r\n     */\r\n    Sentence = \"SentenceBoundary\"\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines the input type of speech synthesis request.\r\n * @enum SpeechSynthesisRequestInputType\r\n */\r\nexport enum SpeechSynthesisRequestInputType {\r\n    /**\r\n     * Plain text input.\r\n     */\r\n    Text = 1,\r\n\r\n    /**\r\n     * SSML (Speech Synthesis Markup Language) input.\r\n     */\r\n    SSML = 2,\r\n\r\n    /**\r\n     * Text stream input, for streaming text to the synthesizer.\r\n     */\r\n    TextStream = 3,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * @internal\r\n * Interface for the parent request that the input stream delegates to.\r\n */\r\ninterface ISpeechSynthesisRequestInputStreamHost {\r\n    onTextPieceReceived(text: string): void;\r\n    onInputStreamClosed(): void;\r\n}\r\n\r\n/**\r\n * Represents an input stream for speech synthesis request text streaming.\r\n * Note: This class is in preview and may be subject to change in future versions.\r\n * @class SpeechSynthesisRequestInputStream\r\n */\r\nexport class SpeechSynthesisRequestInputStream {\r\n    private privParent: ISpeechSynthesisRequestInputStreamHost;\r\n    private privClosed: boolean = false;\r\n\r\n    /**\r\n     * Constructor for internal use.\r\n     * @param parent The parent SpeechSynthesisRequest.\r\n     */\r\n    public constructor(parent: ISpeechSynthesisRequestInputStreamHost) {\r\n        this.privParent = parent;\r\n    }\r\n\r\n    /**\r\n     * Writes the specified text to the input stream.\r\n     * @param text The text to be written to the input stream.\r\n     */\r\n    public write(text: string): void {\r\n        if (this.privClosed) {\r\n            throw new Error(\"Cannot write to a closed input stream.\");\r\n        }\r\n        this.privParent.onTextPieceReceived(text);\r\n    }\r\n\r\n    /**\r\n     * Closes the input stream, signaling that no more text will be written.\r\n     */\r\n    public close(): void {\r\n        if (!this.privClosed) {\r\n            this.privClosed = true;\r\n            this.privParent.onInputStreamClosed();\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Gets whether the input stream is closed.\r\n     */\r\n    public get isClosed(): boolean {\r\n        return this.privClosed;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyCollection, PropertyId } from \"./Exports.js\";\r\nimport { SpeechSynthesisRequestInputType } from \"./SpeechSynthesisRequestInputType.js\";\r\nimport { SpeechSynthesisRequestInputStream } from \"./SpeechSynthesisRequestInputStream.js\";\r\n\r\nexport { SpeechSynthesisRequestInputStream } from \"./SpeechSynthesisRequestInputStream.js\";\r\n\r\n/**\r\n * Represents a speech synthesis request with support for text streaming.\r\n * Note: This class is in preview and may be subject to change in future versions.\r\n * @class SpeechSynthesisRequest\r\n */\r\nexport class SpeechSynthesisRequest {\r\n    private privInputType: SpeechSynthesisRequestInputType;\r\n    private privInputStream: SpeechSynthesisRequestInputStream;\r\n    private privProperties: PropertyCollection;\r\n    private privTextPieceCallback: (text: string) => void;\r\n    private privStreamCloseCallback: () => void;\r\n    private privBufferedTextPieces: string[] = [];\r\n    private privStreamClosedBeforeReady: boolean = false;\r\n\r\n    /**\r\n     * Creates a speech synthesis request.\r\n     * @param inputType The input type for the speech synthesis request.\r\n     */\r\n    public constructor(inputType: SpeechSynthesisRequestInputType) {\r\n        if (inputType !== SpeechSynthesisRequestInputType.TextStream) {\r\n            throw new Error(\"Only TextStream input type is supported in this version.\");\r\n        }\r\n        this.privInputType = inputType;\r\n        this.privInputStream = new SpeechSynthesisRequestInputStream(this);\r\n        this.privProperties = new PropertyCollection();\r\n    }\r\n\r\n    /**\r\n     * Gets the input type of this request.\r\n     */\r\n    public get inputType(): SpeechSynthesisRequestInputType {\r\n        return this.privInputType;\r\n    }\r\n\r\n    /**\r\n     * Gets the input stream for writing text pieces.\r\n     */\r\n    public get inputStream(): SpeechSynthesisRequestInputStream {\r\n        return this.privInputStream;\r\n    }\r\n\r\n    /**\r\n     * Gets the properties collection for this request.\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    /**\r\n     * Sets the pitch of the voice.\r\n     */\r\n    public set pitch(value: string) {\r\n        this.privProperties.setProperty(PropertyId.SpeechSynthesisRequest_Pitch, value);\r\n    }\r\n\r\n    /**\r\n     * Sets the speaking rate of the voice.\r\n     */\r\n    public set rate(value: string) {\r\n        this.privProperties.setProperty(PropertyId.SpeechSynthesisRequest_Rate, value);\r\n    }\r\n\r\n    /**\r\n     * Sets the volume of the voice.\r\n     */\r\n    public set volume(value: string) {\r\n        this.privProperties.setProperty(PropertyId.SpeechSynthesisRequest_Volume, value);\r\n    }\r\n\r\n    /**\r\n     * Sets the style of the voice.\r\n     */\r\n    public set style(value: string) {\r\n        this.privProperties.setProperty(PropertyId.SpeechSynthesisRequest_Style, value);\r\n    }\r\n\r\n    /**\r\n     * Sets the temperature of the voice synthesis.\r\n     */\r\n    public set temperature(value: number) {\r\n        this.privProperties.setProperty(PropertyId.SpeechSynthesisRequest_Temperature, value.toString());\r\n    }\r\n\r\n    /**\r\n     * Sets the custom lexicon URL.\r\n     */\r\n    public set customLexiconUrl(value: string) {\r\n        this.privProperties.setProperty(PropertyId.SpeechSynthesisRequest_CustomLexiconUrl, value);\r\n    }\r\n\r\n    /**\r\n     * Sets the preferred locales for the voice.\r\n     */\r\n    public set preferLocales(value: string) {\r\n        this.privProperties.setProperty(PropertyId.SpeechSynthesisRequest_PreferLocales, value);\r\n    }\r\n\r\n    /**\r\n     * @internal\r\n     * Called by InputStream when a text piece is written.\r\n     * Buffers text if no callback is registered yet.\r\n     */\r\n    public onTextPieceReceived(text: string): void {\r\n        if (this.privTextPieceCallback) {\r\n            this.privTextPieceCallback(text);\r\n        } else {\r\n            this.privBufferedTextPieces.push(text);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * @internal\r\n     * Called by InputStream when it is closed.\r\n     * Buffers close event if no callback is registered yet.\r\n     */\r\n    public onInputStreamClosed(): void {\r\n        if (this.privStreamCloseCallback) {\r\n            this.privStreamCloseCallback();\r\n        } else {\r\n            this.privStreamClosedBeforeReady = true;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * @internal\r\n     * Sets the callback for receiving text pieces.\r\n     * Flushes any buffered text pieces immediately.\r\n     */\r\n    public set onTextPiece(callback: (text: string) => void) {\r\n        this.privTextPieceCallback = callback;\r\n        // Flush buffered text pieces\r\n        for (const text of this.privBufferedTextPieces) {\r\n            callback(text);\r\n        }\r\n        this.privBufferedTextPieces = [];\r\n    }\r\n\r\n    /**\r\n     * @internal\r\n     * Sets the callback for stream close events.\r\n     * Fires immediately if stream was already closed.\r\n     */\r\n    public set onClose(callback: () => void) {\r\n        this.privStreamCloseCallback = callback;\r\n        // Fire if stream was already closed before callback was set\r\n        if (this.privStreamClosedBeforeReady) {\r\n            this.privStreamClosedBeforeReady = false;\r\n            callback();\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    IVoiceJson,\r\n    PropertyCollection,\r\n    ResultReason,\r\n    SynthesisResult,\r\n    VoiceInfo,\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Defines result of speech synthesis.\r\n * @class SynthesisVoicesResult\r\n * Added in version 1.20.0\r\n */\r\nexport class SynthesisVoicesResult extends SynthesisResult {\r\n    private privVoices: VoiceInfo[];\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param requestId - result id for request.\r\n     * @param json - json payload from endpoint.\r\n     */\r\n    public constructor(requestId: string, json: any, errorDetails: string ) {\r\n        if (Array.isArray(json)) {\r\n            super(requestId, ResultReason.VoicesListRetrieved, undefined, new PropertyCollection());\r\n            this.privVoices = [];\r\n            for (const item of json) {\r\n                this.privVoices.push(new VoiceInfo(item as IVoiceJson));\r\n            }\r\n        } else {\r\n            super(requestId, ResultReason.Canceled, errorDetails ? errorDetails : \"Error information unavailable\", new PropertyCollection());\r\n        }\r\n    }\r\n\r\n    /**\r\n     * The list of voices\r\n     * @member SynthesisVoicesResult.prototype.voices\r\n     * @function\r\n     * @public\r\n     * @returns {VoiceInfo[]} List of synthesized voices.\r\n     */\r\n    public get voices(): VoiceInfo[] {\r\n        return this.privVoices;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { IVoiceJson, IVoiceTag } from \"./IVoiceJson\";\r\n\r\n/**\r\n * Defines the gender of synthesis voices.\r\n * Added in version 1.20.0.\r\n */\r\nexport enum SynthesisVoiceGender {\r\n\r\n    /** Gender unknown */\r\n    Unknown,\r\n\r\n    /** Female voice */\r\n    Female,\r\n\r\n    /** Male voice */\r\n    Male,\r\n\r\n    /** Neutral voice */\r\n    Neutral\r\n}\r\n\r\nexport enum SynthesisVoiceType {\r\n    /**\r\n     * Voice type is not known.\r\n     */\r\n    Unknown = 0,\r\n\r\n    /**\r\n     * Online neural voices.\r\n     */\r\n    OnlineNeural = 1,\r\n\r\n    /**\r\n     * Online standard voices. These voices are deprecated.\r\n     */\r\n    OnlineStandard = 2,\r\n\r\n    /**\r\n     * Offline neural voices.\r\n     */\r\n    OfflineNeural = 3,\r\n\r\n    /**\r\n     * Offline standard voices.\r\n     */\r\n    OfflineStandard = 4,\r\n\r\n    /**\r\n     * High definition (HD) voices. Refer to https://learn.microsoft.com/azure/ai-services/speech-service/high-definition-voices\r\n     */\r\n    OnlineNeuralHD = 5,\r\n}\r\n\r\nconst GENDER_LOOKUP: Record<string, SynthesisVoiceGender> = {\r\n    [SynthesisVoiceGender[SynthesisVoiceGender.Neutral]]: SynthesisVoiceGender.Neutral,\r\n    [SynthesisVoiceGender[SynthesisVoiceGender.Male]]: SynthesisVoiceGender.Male,\r\n    [SynthesisVoiceGender[SynthesisVoiceGender.Female]]: SynthesisVoiceGender.Female,\r\n};\r\n\r\nconst VOICE_TYPE_LOOKUP: Record<string, SynthesisVoiceType> = {\r\n    Neural: SynthesisVoiceType.OnlineNeural,\r\n    NeuralHD: SynthesisVoiceType.OnlineNeuralHD,\r\n};\r\n\r\n/**\r\n * Information about Speech Synthesis voice\r\n * Added in version 1.20.0.\r\n * @class VoiceInfo\r\n */\r\nexport class VoiceInfo {\r\n    private privName: IVoiceJson[\"Name\"];\r\n    private privLocale: IVoiceJson[\"Locale\"];\r\n    private privShortName: IVoiceJson[\"ShortName\"];\r\n    private privDisplayName: IVoiceJson[\"DisplayName\"];\r\n    private privLocalName: IVoiceJson[\"LocalName\"];\r\n    private privLocaleName: IVoiceJson[\"LocaleName\"];\r\n    private privGender: SynthesisVoiceGender;\r\n    private privVoiceType: SynthesisVoiceType;\r\n    private privStyleList: IVoiceJson[\"StyleList\"] = [];\r\n    private privSampleRateHertz: IVoiceJson[\"SampleRateHertz\"];\r\n    private privStatus: IVoiceJson[\"Status\"];\r\n    private privExtendedPropertyMap: IVoiceJson[\"ExtendedPropertyMap\"];\r\n    private privWordsPerMinute: IVoiceJson[\"WordsPerMinute\"];\r\n    private privSecondaryLocaleList: IVoiceJson[\"SecondaryLocaleList\"];\r\n    private privRolePlayList: IVoiceJson[\"RolePlayList\"];\r\n    private privVoiceTag: IVoiceTag;\r\n\r\n    public constructor(json: IVoiceJson) {\r\n        if (!!json) {\r\n            this.privName = json.Name;\r\n            this.privLocale = json.Locale;\r\n            this.privShortName = json.ShortName;\r\n            this.privLocaleName = json.LocaleName;\r\n            this.privDisplayName = json.DisplayName;\r\n            this.privLocalName = json.LocalName;\r\n            this.privVoiceType = VOICE_TYPE_LOOKUP[json.VoiceType] || SynthesisVoiceType.Unknown;\r\n            this.privGender = GENDER_LOOKUP[json.Gender] || SynthesisVoiceGender.Unknown;\r\n\r\n            if (!!json.StyleList && Array.isArray(json.StyleList)) {\r\n                for (const style of json.StyleList) {\r\n                    this.privStyleList.push(style);\r\n                }\r\n            }\r\n\r\n            this.privSampleRateHertz = json.SampleRateHertz;\r\n            this.privStatus = json.Status;\r\n\r\n            if (json.ExtendedPropertyMap) {\r\n                // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\r\n                this.privExtendedPropertyMap = json.ExtendedPropertyMap;\r\n            }\r\n\r\n            this.privWordsPerMinute = json.WordsPerMinute;\r\n\r\n            if (Array.isArray(json.SecondaryLocaleList)) {\r\n                this.privSecondaryLocaleList = [...json.SecondaryLocaleList];\r\n            }\r\n\r\n            if (Array.isArray(json.RolePlayList)) {\r\n                this.privRolePlayList = [...json.RolePlayList];\r\n            }\r\n\r\n            if (json.VoiceTag) {\r\n                this.privVoiceTag = json.VoiceTag;\r\n            }\r\n        }\r\n    }\r\n\r\n    public get name(): IVoiceJson[\"Name\"] {\r\n        return this.privName;\r\n    }\r\n\r\n    public get locale(): IVoiceJson[\"Locale\"] {\r\n        return this.privLocale;\r\n    }\r\n\r\n    public get shortName(): IVoiceJson[\"ShortName\"] {\r\n        return this.privShortName;\r\n    }\r\n\r\n    public get displayName(): IVoiceJson[\"DisplayName\"] {\r\n        return this.privDisplayName;\r\n    }\r\n\r\n    public get localName(): IVoiceJson[\"LocalName\"] {\r\n        return this.privLocalName;\r\n    }\r\n\r\n    public get localeName(): IVoiceJson[\"LocaleName\"] {\r\n        return this.privLocaleName;\r\n    }\r\n\r\n    public get gender(): SynthesisVoiceGender {\r\n        return this.privGender;\r\n    }\r\n\r\n    public get voiceType(): SynthesisVoiceType {\r\n        return this.privVoiceType;\r\n    }\r\n\r\n    public get styleList(): IVoiceJson[\"StyleList\"] {\r\n        return this.privStyleList;\r\n    }\r\n\r\n    public get sampleRateHertz(): IVoiceJson[\"SampleRateHertz\"] {\r\n        return this.privSampleRateHertz;\r\n    }\r\n\r\n    public get status(): IVoiceJson[\"Status\"] {\r\n        return this.privStatus;\r\n    }\r\n\r\n    public get extendedPropertyMap(): IVoiceJson[\"ExtendedPropertyMap\"] {\r\n        // eslint-disable-next-line @typescript-eslint/no-unsafe-return\r\n        return this.privExtendedPropertyMap;\r\n    }\r\n\r\n    public get wordsPerMinute(): IVoiceJson[\"WordsPerMinute\"] {\r\n        return this.privWordsPerMinute;\r\n    }\r\n\r\n    public get secondaryLocaleList(): IVoiceJson[\"SecondaryLocaleList\"] {\r\n        return this.privSecondaryLocaleList;\r\n    }\r\n\r\n    public get rolePlayList(): IVoiceJson[\"RolePlayList\"] {\r\n        return this.privRolePlayList;\r\n    }\r\n\r\n    public get voiceTag(): IVoiceTag {\r\n        return this.privVoiceTag;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    BackgroundEvent,\r\n    createNoDashGuid,\r\n    Events,\r\n    IAudioDestination,\r\n    INumberDictionary\r\n} from \"../../common/Exports.js\";\r\nimport { AudioStreamFormat, IPlayer } from \"../Exports.js\";\r\nimport { AudioOutputFormatImpl } from \"./AudioOutputFormat.js\";\r\nimport { PullAudioOutputStreamImpl } from \"./AudioOutputStream.js\";\r\nimport { AudioFormatTag } from \"./AudioStreamFormat.js\";\r\n\r\nconst MediaDurationPlaceholderSeconds = 60 * 30;\r\n\r\nconst AudioFormatToMimeType: INumberDictionary<string> = {\r\n    [AudioFormatTag.PCM]: \"audio/wav\",\r\n    [AudioFormatTag.MuLaw]: \"audio/x-wav\",\r\n    [AudioFormatTag.MP3]: \"audio/mpeg\",\r\n    [AudioFormatTag.OGG_OPUS]: \"audio/ogg\",\r\n    [AudioFormatTag.WEBM_OPUS]: \"audio/webm; codecs=opus\",\r\n    [AudioFormatTag.ALaw]: \"audio/x-wav\",\r\n    [AudioFormatTag.FLAC]: \"audio/flac\",\r\n    [AudioFormatTag.AMR_WB]: \"audio/amr-wb\",\r\n    [AudioFormatTag.G722]: \"audio/G722\",\r\n};\r\n\r\n/**\r\n * Represents the speaker playback audio destination, which only works in browser.\r\n * Note: the SDK will try to use <a href=\"https://www.w3.org/TR/media-source/\">Media Source Extensions</a> to play audio.\r\n * Mp3 format has better supports on Microsoft Edge, Chrome and Safari (desktop), so, it's better to specify mp3 format for playback.\r\n * @class SpeakerAudioDestination\r\n * Updated in version 1.17.0\r\n */\r\nexport class SpeakerAudioDestination implements IAudioDestination, IPlayer {\r\n    private readonly privId: string;\r\n    private privFormat: AudioOutputFormatImpl;\r\n    private privAudio: HTMLAudioElement;\r\n    private privMediaSource: MediaSource;\r\n    private privSourceBuffer: SourceBuffer;\r\n    private privPlaybackStarted: boolean = false;\r\n    private privAudioBuffer: ArrayBuffer[];\r\n    private privAppendingToBuffer: boolean = false;\r\n    private privMediaSourceOpened: boolean = false;\r\n    private privIsClosed: boolean;\r\n    private privIsPaused: boolean;\r\n    private privAudioOutputStream: PullAudioOutputStreamImpl;\r\n    private privBytesReceived: number = 0;\r\n\r\n    public constructor(audioDestinationId?: string) {\r\n        this.privId = audioDestinationId ? audioDestinationId : createNoDashGuid();\r\n        this.privIsPaused = false;\r\n        this.privIsClosed = false;\r\n    }\r\n\r\n    public id(): string {\r\n        return this.privId;\r\n    }\r\n\r\n    public write(buffer: ArrayBuffer, cb?: () => void, err?: (error: string) => void): void {\r\n        if (this.privAudioBuffer !== undefined) {\r\n            this.privAudioBuffer.push(buffer);\r\n            this.updateSourceBuffer().then((): void => {\r\n                if (!!cb) {\r\n                    cb();\r\n                }\r\n            }, (error: string): void => {\r\n                if (!!err) {\r\n                    err(error);\r\n                }\r\n            });\r\n        } else if (this.privAudioOutputStream !== undefined) {\r\n            this.privAudioOutputStream.write(buffer);\r\n            this.privBytesReceived += buffer.byteLength;\r\n        }\r\n    }\r\n\r\n    public close(cb?: () => void, err?: (error: string) => void): void {\r\n        this.privIsClosed = true;\r\n        if (this.privSourceBuffer !== undefined) {\r\n            this.handleSourceBufferUpdateEnd().then((): void => {\r\n                if (!!cb) {\r\n                    cb();\r\n                }\r\n            }, (error: string): void => {\r\n                if (!!err) {\r\n                    err(error);\r\n                }\r\n            });\r\n        } else if (this.privAudioOutputStream !== undefined && typeof window !== \"undefined\") {\r\n            if ((this.privFormat.formatTag === AudioFormatTag.PCM || this.privFormat.formatTag === AudioFormatTag.MuLaw\r\n                || this.privFormat.formatTag === AudioFormatTag.ALaw) && this.privFormat.hasHeader === false) {\r\n                // eslint-disable-next-line no-console\r\n                console.warn(\"Play back is not supported for raw PCM, mulaw or alaw format without header.\");\r\n                if (!!this.onAudioEnd) {\r\n                    this.onAudioEnd(this);\r\n                }\r\n            } else {\r\n                let receivedAudio = new ArrayBuffer(this.privBytesReceived);\r\n                this.privAudioOutputStream.read(receivedAudio).then((): void => {\r\n                    receivedAudio = this.privFormat.addHeader(receivedAudio);\r\n                    const audioBlob = new Blob([receivedAudio], { type: AudioFormatToMimeType[this.privFormat.formatTag] });\r\n                    this.privAudio.src = window.URL.createObjectURL(audioBlob);\r\n                    this.notifyPlayback().then((): void => {\r\n                        if (!!cb) {\r\n                            cb();\r\n                        }\r\n                    }, (error: string): void => {\r\n                        if (!!err) {\r\n                            err(error);\r\n                        }\r\n                    });\r\n                }, (error: string): void => {\r\n                    if (!!err) {\r\n                        err(error);\r\n                    }\r\n                });\r\n            }\r\n        } else {\r\n            // unsupported format, call onAudioEnd directly.\r\n            if (!!this.onAudioEnd) {\r\n                this.onAudioEnd(this);\r\n            }\r\n        }\r\n    }\r\n\r\n    public set format(format: AudioStreamFormat) {\r\n        // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\r\n        if (typeof (AudioContext) !== \"undefined\" || (typeof (window) !== \"undefined\" && typeof ((window as any).webkitAudioContext) !== \"undefined\")) {\r\n            this.privFormat = format as AudioOutputFormatImpl;\r\n            const mimeType: string = AudioFormatToMimeType[this.privFormat.formatTag];\r\n            if (mimeType === undefined) {\r\n                // eslint-disable-next-line no-console\r\n                console.warn(\r\n                    `Unknown mimeType for format ${AudioFormatTag[this.privFormat.formatTag]}; playback is not supported.`);\r\n\r\n            } else if (typeof (MediaSource) !== \"undefined\" && MediaSource.isTypeSupported(mimeType)) {\r\n                this.privAudio = new Audio();\r\n                this.privAudioBuffer = [];\r\n                this.privMediaSource = new MediaSource();\r\n                this.privAudio.src = URL.createObjectURL(this.privMediaSource);\r\n                this.privAudio.load();\r\n                this.privMediaSource.onsourceopen = (): void => {\r\n                    this.privMediaSourceOpened = true;\r\n                    this.privMediaSource.duration = MediaDurationPlaceholderSeconds;\r\n                    this.privSourceBuffer = this.privMediaSource.addSourceBuffer(mimeType);\r\n                    this.privSourceBuffer.onupdate = (): void => {\r\n                        this.updateSourceBuffer().catch((reason: string): void => {\r\n                            Events.instance.onEvent(new BackgroundEvent(reason));\r\n                        });\r\n                    };\r\n                    this.privSourceBuffer.onupdateend = (): void => {\r\n                        this.handleSourceBufferUpdateEnd().catch((reason: string): void => {\r\n                            Events.instance.onEvent(new BackgroundEvent(reason));\r\n                        });\r\n                    };\r\n                    this.privSourceBuffer.onupdatestart = (): void => {\r\n                        this.privAppendingToBuffer = false;\r\n                    };\r\n                };\r\n                this.updateSourceBuffer().catch((reason: string): void => {\r\n                    Events.instance.onEvent(new BackgroundEvent(reason));\r\n                });\r\n\r\n            } else {\r\n                // eslint-disable-next-line no-console\r\n                console.warn(\r\n                    `Format ${AudioFormatTag[this.privFormat.formatTag]} could not be played by MSE, streaming playback is not enabled.`);\r\n                this.privAudioOutputStream = new PullAudioOutputStreamImpl();\r\n                this.privAudioOutputStream.format = this.privFormat;\r\n                this.privAudio = new Audio();\r\n            }\r\n        }\r\n    }\r\n\r\n    public get volume(): number {\r\n        return this.privAudio?.volume ?? -1;\r\n    }\r\n\r\n    public set volume(volume: number) {\r\n        if (!!this.privAudio) {\r\n            this.privAudio.volume = volume;\r\n        }\r\n    }\r\n\r\n    public mute(): void {\r\n        if (!!this.privAudio) {\r\n            this.privAudio.muted = true;\r\n        }\r\n    }\r\n\r\n    public unmute(): void {\r\n        if (!!this.privAudio) {\r\n            this.privAudio.muted = false;\r\n        }\r\n    }\r\n\r\n    public get isClosed(): boolean {\r\n        return this.privIsClosed;\r\n    }\r\n\r\n    public get currentTime(): number {\r\n        if (this.privAudio !== undefined) {\r\n            return this.privAudio.currentTime;\r\n        }\r\n        return -1;\r\n    }\r\n\r\n    public pause(): void {\r\n        if (!this.privIsPaused && this.privAudio !== undefined) {\r\n            this.privAudio.pause();\r\n            this.privIsPaused = true;\r\n        }\r\n    }\r\n\r\n    public resume(cb?: () => void, err?: (error: string) => void): void {\r\n        if (this.privIsPaused && this.privAudio !== undefined) {\r\n            this.privAudio.play().then((): void => {\r\n                if (!!cb) {\r\n                    cb();\r\n                }\r\n            }, (error: string): void => {\r\n                if (!!err) {\r\n                    err(error);\r\n                }\r\n            });\r\n            this.privIsPaused = false;\r\n        }\r\n    }\r\n\r\n    public onAudioStart: (sender: IPlayer) => void;\r\n\r\n    public onAudioEnd: (sender: IPlayer) => void;\r\n\r\n    public get internalAudio(): HTMLAudioElement {\r\n        return this.privAudio;\r\n    }\r\n\r\n    private async updateSourceBuffer(): Promise<void> {\r\n        if (this.privAudioBuffer !== undefined && (this.privAudioBuffer.length > 0) && this.sourceBufferAvailable()) {\r\n            this.privAppendingToBuffer = true;\r\n            const binary = this.privAudioBuffer.shift();\r\n            try {\r\n                this.privSourceBuffer.appendBuffer(binary);\r\n            } catch (error) {\r\n                this.privAudioBuffer.unshift(binary);\r\n                // eslint-disable-next-line no-console\r\n                console.log(\r\n                    \"buffer filled, pausing addition of binaries until space is made\");\r\n                return;\r\n            }\r\n            await this.notifyPlayback();\r\n        } else if (this.canEndStream()) {\r\n            await this.handleSourceBufferUpdateEnd();\r\n        }\r\n    }\r\n\r\n    private async handleSourceBufferUpdateEnd(): Promise<void> {\r\n        if (this.canEndStream() && this.sourceBufferAvailable()) {\r\n            this.privMediaSource.endOfStream();\r\n            await this.notifyPlayback();\r\n        }\r\n    }\r\n\r\n    private async notifyPlayback(): Promise<void> {\r\n        if (!this.privPlaybackStarted && this.privAudio !== undefined) {\r\n            this.privPlaybackStarted = true;\r\n            if (!!this.onAudioStart) {\r\n                this.onAudioStart(this);\r\n            }\r\n            this.privAudio.onended = (): void => {\r\n                if (!!this.onAudioEnd) {\r\n                    this.onAudioEnd(this);\r\n                }\r\n            };\r\n            if (!this.privIsPaused) {\r\n                await this.privAudio.play();\r\n            }\r\n        }\r\n    }\r\n\r\n    private canEndStream(): boolean {\r\n        return (this.isClosed && this.privSourceBuffer !== undefined && (this.privAudioBuffer.length === 0)\r\n            && this.privMediaSourceOpened && !this.privAppendingToBuffer && this.privMediaSource.readyState === \"open\");\r\n    }\r\n\r\n    private sourceBufferAvailable(): boolean {\r\n        return (this.privSourceBuffer !== undefined && !this.privSourceBuffer.updating);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    CancellationEventArgsBase,\r\n} from \"./CancellationEventArgsBase.js\";\r\n\r\n/**\r\n * Defines content of a RecognitionErrorEvent.\r\n * @class ConversationTranscriptionCanceledEventArgs\r\n */\r\nexport class ConversationTranscriptionCanceledEventArgs extends CancellationEventArgsBase {\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    CancellationEventArgsBase,\r\n} from \"./CancellationEventArgsBase.js\";\r\n\r\n/**\r\n * Defines content of a MeetingTranscriptionCanceledEvent.\r\n * @class MeetingTranscriptionCanceledEventArgs\r\n */\r\nexport class MeetingTranscriptionCanceledEventArgs extends CancellationEventArgsBase {\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines the point system for pronunciation score calibration; default value is FivePoint.\r\n * Added in version 1.15.0\r\n * @class PronunciationAssessmentGradingSystem\r\n */\r\nexport enum PronunciationAssessmentGradingSystem {\r\n    /**\r\n     * Five point calibration\r\n     * @member PronunciationAssessmentGradingSystem.FivePoint\r\n     */\r\n    FivePoint = 1,\r\n\r\n    /**\r\n     * Hundred mark\r\n     * @member PronunciationAssessmentGradingSystem.HundredMark\r\n     */\r\n    HundredMark,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines the pronunciation evaluation granularity; default value is Phoneme.\r\n * Added in version 1.15.0\r\n * @class PronunciationAssessmentGranularity\r\n */\r\nexport enum PronunciationAssessmentGranularity {\r\n    /**\r\n     * Shows the score on the full text, word and phoneme level\r\n     * @member PronunciationAssessmentGranularity.Phoneme\r\n     */\r\n    Phoneme = 1,\r\n\r\n    /**\r\n     * Shows the score on the full text and word level\r\n     * @member PronunciationAssessmentGranularity.Word\r\n     */\r\n    Word,\r\n\r\n    /**\r\n     * Shows the score on the full text level only\r\n     * @member PronunciationAssessmentGranularity.FullText\r\n     */\r\n    FullText,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ServiceRecognizerBase } from \"../common.speech/ServiceRecognizerBase.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport {\r\n    PronunciationAssessmentGradingSystem,\r\n    PronunciationAssessmentGranularity,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    Recognizer\r\n} from \"./Exports.js\";\r\n\r\ninterface PronunciationAssessmentJSON {\r\n    referenceText: string;\r\n    gradingSystem: string;\r\n    granularity: string;\r\n    phonemeAlphabet: string;\r\n    nbestPhonemeCount: number;\r\n    dimension: string;\r\n    enableMiscue: boolean;\r\n    enableProsodyAssessment: boolean;\r\n}\r\n\r\n/**\r\n * Pronunciation assessment configuration.\r\n * @class PronunciationAssessmentConfig\r\n * Added in version 1.15.0.\r\n */\r\nexport class PronunciationAssessmentConfig {\r\n    private privProperties: PropertyCollection;\r\n    private privPhonemeAlphabet: string;\r\n    private privNBestPhonemeCount: number;\r\n    private privEnableProsodyAssessment: boolean;\r\n\r\n    /**\r\n     * PronunciationAssessmentConfig constructor.\r\n     * @constructor\r\n     * @param {string} referenceText\r\n     * @param gradingSystem\r\n     * @param granularity\r\n     * @param enableMiscue\r\n     */\r\n    public constructor(referenceText: string,\r\n                       gradingSystem: PronunciationAssessmentGradingSystem = PronunciationAssessmentGradingSystem.FivePoint,\r\n                       granularity: PronunciationAssessmentGranularity = PronunciationAssessmentGranularity.Phoneme,\r\n                       enableMiscue: boolean = false) {\r\n        Contracts.throwIfNullOrUndefined(referenceText, \"referenceText\");\r\n        this.privProperties = new PropertyCollection();\r\n        this.privProperties.setProperty(PropertyId.PronunciationAssessment_ReferenceText, referenceText);\r\n        this.privProperties.setProperty(PropertyId.PronunciationAssessment_GradingSystem, PronunciationAssessmentGradingSystem[gradingSystem]);\r\n        this.privProperties.setProperty(PropertyId.PronunciationAssessment_Granularity, PronunciationAssessmentGranularity[granularity]);\r\n        this.privProperties.setProperty(PropertyId.PronunciationAssessment_EnableMiscue, String(enableMiscue));\r\n    }\r\n\r\n    /**\r\n     * @member PronunciationAssessmentConfig.fromJSON\r\n     * @function\r\n     * @public\r\n     * @param {string} json The json string containing the pronunciation assessment parameters.\r\n     * @return {PronunciationAssessmentConfig} Instance of PronunciationAssessmentConfig\r\n     * @summary Creates an instance of the PronunciationAssessmentConfig from json.\r\n     * This method is designed to support the pronunciation assessment parameters still in preview.\r\n     * Under normal circumstances, use the constructor instead.\r\n     */\r\n    public static fromJSON(json: string): PronunciationAssessmentConfig {\r\n        Contracts.throwIfNullOrUndefined(json, \"json\");\r\n        const config = new PronunciationAssessmentConfig(\"\");\r\n        config.privProperties = new PropertyCollection();\r\n        config.properties.setProperty(PropertyId.PronunciationAssessment_Json, json);\r\n        return config;\r\n    }\r\n\r\n    public toJSON(): string {\r\n        this.updateJson();\r\n        return this.privProperties.getProperty(PropertyId.PronunciationAssessment_Params);\r\n    }\r\n\r\n    public applyTo(recognizer: Recognizer): void {\r\n        this.updateJson();\r\n        const recoBase = recognizer.internalData as ServiceRecognizerBase;\r\n        recoBase.speechContext.setPronunciationAssessmentParams(\r\n            this.properties.getProperty(PropertyId.PronunciationAssessment_Params), recoBase.isSpeakerDiarizationEnabled);\r\n    }\r\n\r\n    /**\r\n     * Gets the reference text.\r\n     * @member PronunciationAssessmentConfig.prototype.referenceText\r\n     * @function\r\n     * @public\r\n     * @returns {string} Reference text.\r\n     */\r\n    public get referenceText(): string {\r\n        return this.properties.getProperty(PropertyId.PronunciationAssessment_ReferenceText);\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets the reference text.\r\n     * @member PronunciationAssessmentConfig.prototype.referenceText\r\n     * @function\r\n     * @public\r\n     * @param {string} referenceText - Reference text.\r\n     */\r\n    public set referenceText(referenceText: string) {\r\n        Contracts.throwIfNullOrWhitespace(referenceText, \"referenceText\");\r\n        this.properties.setProperty(PropertyId.PronunciationAssessment_ReferenceText, referenceText);\r\n    }\r\n\r\n    /**\r\n     * Sets the phoneme alphabet.\r\n     * The valid values are \"SAPI\" (default) and \"IPA\".\r\n     * Added in version 1.20.0\r\n     * @member PronunciationAssessmentConfig.prototype.phonemeAlphabet\r\n     * @function\r\n     * @public\r\n     * @param {string} phonemeAlphabet - Phoneme alphabet.\r\n     */\r\n    public set phonemeAlphabet(phonemeAlphabet: string) {\r\n        Contracts.throwIfNullOrWhitespace(phonemeAlphabet, \"phonemeAlphabet\");\r\n        this.privPhonemeAlphabet = phonemeAlphabet;\r\n    }\r\n\r\n    /**\r\n     * Sets the boolean enableMiscue property.\r\n     * Added in version 1.26.0\r\n     * @member PronunciationAssessmentConfig.prototype.enableMiscue\r\n     * @function\r\n     * @public\r\n     * @param {boolean} enableMiscue - enable miscue.\r\n     */\r\n    public set enableMiscue(enableMiscue: boolean) {\r\n        const enableMiscueString = enableMiscue ? \"true\" : \"false\";\r\n        this.properties.setProperty(PropertyId.PronunciationAssessment_EnableMiscue, enableMiscueString);\r\n    }\r\n\r\n    /**\r\n     * Gets the boolean enableMiscue property.\r\n     * Added in version 1.26.0\r\n     * @member PronunciationAssessmentConfig.prototype.enableMiscue\r\n     * @function\r\n     * @public\r\n     * @return {boolean} enableMiscue - enable miscue.\r\n     */\r\n    public get enableMiscue(): boolean {\r\n        const enableMiscueString = this.properties.getProperty(PropertyId.PronunciationAssessment_EnableMiscue, \"false\");\r\n        return (enableMiscueString.toLowerCase() === \"true\");\r\n    }\r\n\r\n    /**\r\n     * Sets the nbest phoneme count\r\n     * Added in version 1.20.0\r\n     * @member PronunciationAssessmentConfig.prototype.nbestPhonemeCount\r\n     * @function\r\n     * @public\r\n     * @param {number} nbestPhonemeCount - NBest phoneme count.\r\n     */\r\n    public set nbestPhonemeCount(nbestPhonemeCount: number) {\r\n        this.privNBestPhonemeCount = nbestPhonemeCount;\r\n    }\r\n\r\n    /**\r\n     * Enables the prosody assessment.\r\n     * Added in version 1.34.0\r\n     * @member PronunciationAssessmentConfig.prototype.enableProsodyAssessment\r\n     * @function\r\n     * @public\r\n     * @param {boolean} enableProsodyAssessment - enable prosody assessment.\r\n     */\r\n    public set enableProsodyAssessment(enableProsodyAssessment: boolean) {\r\n        this.privEnableProsodyAssessment = enableProsodyAssessment;\r\n    }\r\n\r\n    /**\r\n     * @member PronunciationAssessmentConfig.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @return {PropertyCollection} Properties of the config.\r\n     * @summary Gets a pronunciation assessment config properties\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    private updateJson(): void {\r\n        const jsonString = this.privProperties.getProperty(PropertyId.PronunciationAssessment_Json, \"{}\");\r\n        const paramsJson: PronunciationAssessmentJSON = JSON.parse(jsonString) as PronunciationAssessmentJSON;\r\n\r\n        const referenceText = this.privProperties.getProperty(PropertyId.PronunciationAssessment_ReferenceText);\r\n        if (referenceText) {\r\n            paramsJson.referenceText = referenceText;\r\n        }\r\n\r\n        const gradingSystem = this.privProperties.getProperty(PropertyId.PronunciationAssessment_GradingSystem);\r\n        if (gradingSystem) {\r\n            paramsJson.gradingSystem = gradingSystem;\r\n        }\r\n\r\n        const granularity = this.privProperties.getProperty(PropertyId.PronunciationAssessment_Granularity);\r\n        if (granularity) {\r\n            paramsJson.granularity = granularity;\r\n        }\r\n\r\n        if (this.privPhonemeAlphabet) {\r\n            paramsJson.phonemeAlphabet = this.privPhonemeAlphabet;\r\n        }\r\n\r\n        if (this.privNBestPhonemeCount) {\r\n            paramsJson.nbestPhonemeCount = this.privNBestPhonemeCount;\r\n        }\r\n\r\n        paramsJson.enableProsodyAssessment = this.privEnableProsodyAssessment;\r\n\r\n        // always set dimension to Comprehensive\r\n        paramsJson.dimension = \"Comprehensive\";\r\n\r\n        const enableMiscueString = this.privProperties.getProperty(PropertyId.PronunciationAssessment_EnableMiscue);\r\n        if (enableMiscueString) {\r\n            paramsJson.enableMiscue = this.enableMiscue;\r\n        }\r\n\r\n        this.privProperties.setProperty(PropertyId.PronunciationAssessment_Params, JSON.stringify(paramsJson));\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport {Contracts} from \"./Contracts.js\";\r\nimport {\r\n    PropertyId,\r\n    RecognitionResult\r\n} from \"./Exports.js\";\r\n\r\ninterface AssessmentResult {\r\n    NBest: DetailResult[];\r\n}\r\n\r\ninterface DetailResult {\r\n    Words: WordResult[];\r\n    PronunciationAssessment: {\r\n        AccuracyScore: number;\r\n        CompletenessScore: number;\r\n        FluencyScore: number;\r\n        PronScore: number;\r\n        ProsodyScore: number;\r\n    };\r\n}\r\n\r\ninterface WordResult {\r\n    Word: string;\r\n    Phonemes: {\r\n        Phoneme?: string;\r\n        PronunciationAssessment?: {\r\n            NBestPhonemes: { Phoneme: string }[];\r\n        };\r\n     }[];\r\n    PronunciationAssessment?: {\r\n        AccuracyScore: number;\r\n        ErrorType: string;\r\n    };\r\n    Syllables: { Syllable: string }[];\r\n}\r\n\r\n/**\r\n * Pronunciation assessment results.\r\n * @class PronunciationAssessmentResult\r\n * Added in version 1.15.0.\r\n */\r\nexport class PronunciationAssessmentResult {\r\n    private privPronJson: DetailResult;\r\n\r\n    private constructor(jsonString: string) {\r\n        const j = JSON.parse(jsonString) as AssessmentResult;\r\n        Contracts.throwIfNullOrUndefined(j.NBest[0], \"NBest\");\r\n        this.privPronJson = j.NBest[0];\r\n    }\r\n\r\n    /**\r\n     * @member PronunciationAssessmentResult.fromResult\r\n     * @function\r\n     * @public\r\n     * @param {RecognitionResult} result The recognition result.\r\n     * @return {PronunciationAssessmentConfig} Instance of PronunciationAssessmentConfig\r\n     * @summary Creates an instance of the PronunciationAssessmentResult from recognition result.\r\n     */\r\n    public static fromResult(result: RecognitionResult): PronunciationAssessmentResult {\r\n        Contracts.throwIfNullOrUndefined(result, \"result\");\r\n        const json: string = result.properties.getProperty(PropertyId.SpeechServiceResponse_JsonResult);\r\n        Contracts.throwIfNullOrUndefined(json, \"json\");\r\n        return new PronunciationAssessmentResult(json);\r\n    }\r\n\r\n    /**\r\n     * Gets the detail result of pronunciation assessment.\r\n     * @member PronunciationAssessmentConfig.prototype.detailResult\r\n     * @function\r\n     * @public\r\n     * @returns {DetailResult} detail result.\r\n     */\r\n    public get detailResult(): DetailResult {\r\n        return this.privPronJson;\r\n    }\r\n\r\n    /**\r\n     * The score indicating the pronunciation accuracy of the given speech, which indicates\r\n     * how closely the phonemes match a native speaker's pronunciation.\r\n     * @member PronunciationAssessmentResult.prototype.accuracyScore\r\n     * @function\r\n     * @public\r\n     * @returns {number} Accuracy score.\r\n     */\r\n    public get accuracyScore(): number {\r\n        return this.detailResult.PronunciationAssessment?.AccuracyScore;\r\n    }\r\n\r\n    /**\r\n     * The overall score indicating the pronunciation quality of the given speech.\r\n     * This is calculated from AccuracyScore, FluencyScore and CompletenessScore with weight.\r\n     * @member PronunciationAssessmentResult.prototype.pronunciationScore\r\n     * @function\r\n     * @public\r\n     * @returns {number} Pronunciation score.\r\n     */\r\n    public get pronunciationScore(): number {\r\n        return this.detailResult.PronunciationAssessment?.PronScore;\r\n    }\r\n\r\n    /**\r\n     * The score indicating the completeness of the given speech by calculating the ratio of pronounced words towards entire input.\r\n     * @member PronunciationAssessmentResult.prototype.completenessScore\r\n     * @function\r\n     * @public\r\n     * @returns {number} Completeness score.\r\n     */\r\n    public get completenessScore(): number {\r\n        return this.detailResult.PronunciationAssessment?.CompletenessScore;\r\n    }\r\n\r\n    /**\r\n     * The score indicating the fluency of the given speech.\r\n     * @member PronunciationAssessmentResult.prototype.fluencyScore\r\n     * @function\r\n     * @public\r\n     * @returns {number} Fluency score.\r\n     */\r\n    public get fluencyScore(): number {\r\n        return this.detailResult.PronunciationAssessment?.FluencyScore;\r\n    }\r\n\r\n    /**\r\n     * The prosody score, which indicates how nature of the given speech, including stress, intonation, speaking speed and rhythm.\r\n     * @member PronunciationAssessmentResult.prototype.prosodyScore\r\n     * @function\r\n     * @public\r\n     * @returns {number} Prosody score.\r\n     */\r\n    public get prosodyScore(): number {\r\n        return this.detailResult.PronunciationAssessment?.ProsodyScore;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport { AvatarSceneConfig, AvatarVideoFormat } from \"./Exports.js\";\r\n\r\n/**\r\n * Defines the talking avatar configuration.\r\n * @class AvatarConfig\r\n * Added in version 1.33.0\r\n *\r\n * @experimental This feature is experimental and might change or have limited support.\r\n */\r\nexport class AvatarConfig {\r\n    private privCustomized: boolean = false;\r\n    private privUseBuiltInVoice: boolean = false;\r\n    private privPhotoAvatarBaseModel: string;\r\n    private privBackgroundColor: string;\r\n    private privBackgroundImage: URL;\r\n    private privRemoteIceServers: RTCIceServer[];\r\n    private privScene: AvatarSceneConfig;\r\n\r\n    /**\r\n     * Defines the avatar character.\r\n     */\r\n    public character: string;\r\n    /**\r\n     * Defines the avatar style.\r\n     */\r\n    public style: string;\r\n    /**\r\n     * Defines the talking avatar output video format.\r\n     */\r\n    public videoFormat: AvatarVideoFormat;\r\n\r\n    /**\r\n     * Indicates if the talking avatar is customized.\r\n     */\r\n    public get customized(): boolean {\r\n        return this.privCustomized;\r\n    }\r\n\r\n    /**\r\n     * Sets if the talking avatar is customized.\r\n     */\r\n    public set customized(value: boolean) {\r\n        this.privCustomized = value;\r\n    }\r\n\r\n    /**\r\n     * Indicates whether to use built-in voice for custom avatar.\r\n     */\r\n    public get useBuiltInVoice(): boolean {\r\n        return this.privUseBuiltInVoice;\r\n    }\r\n\r\n    /**\r\n     * Sets whether to use built-in voice for custom avatar.\r\n     */\r\n    public set useBuiltInVoice(value: boolean) {\r\n        this.privUseBuiltInVoice = value;\r\n    }\r\n\r\n    /**\r\n     * Gets the photo avatar base model name.\r\n     */\r\n    public get photoAvatarBaseModel(): string {\r\n        return this.privPhotoAvatarBaseModel;\r\n    }\r\n\r\n    /**\r\n     * Sets the photo avatar base model name.\r\n     */\r\n    public set photoAvatarBaseModel(value: string) {\r\n        this.privPhotoAvatarBaseModel = value;\r\n    }\r\n\r\n    /**\r\n     * Gets the background color.\r\n     */\r\n    public get backgroundColor(): string {\r\n        return this.privBackgroundColor;\r\n    }\r\n\r\n    /**\r\n     * Sets the background color.\r\n     */\r\n    public set backgroundColor(value: string) {\r\n        this.privBackgroundColor = value;\r\n    }\r\n\r\n    /**\r\n     * Gets the background image.\r\n     */\r\n    public get backgroundImage(): URL {\r\n        return this.privBackgroundImage;\r\n    }\r\n\r\n    /**\r\n     * Sets the background image.\r\n     * @param {URL} value - The background image.\r\n     */\r\n    public set backgroundImage(value: URL) {\r\n        this.privBackgroundImage = value;\r\n    }\r\n\r\n    /**\r\n     * Gets the remote ICE servers.\r\n     * @remarks This method is designed to be used internally in the SDK.\r\n     * @returns {RTCIceServer[]} The remote ICE servers.\r\n     */\r\n    public get remoteIceServers(): RTCIceServer[] {\r\n        return this.privRemoteIceServers;\r\n    }\r\n\r\n    /**\r\n     * Sets the remote ICE servers.\r\n     * @remarks Normally, the ICE servers are gathered from the PeerConnection,\r\n     * set this property to override the ICE servers. E.g., the ICE servers are\r\n     * different in client and server side.\r\n     * @param {RTCIceServer[]} value - The remote ICE servers.\r\n     */\r\n    public set remoteIceServers(value: RTCIceServer[]) {\r\n        this.privRemoteIceServers = value;\r\n    }\r\n\r\n    /**\r\n     * Gets the scene configuration for avatar positioning and orientation.\r\n     * @returns {AvatarSceneConfig} The scene configuration.\r\n     */\r\n    public get scene(): AvatarSceneConfig {\r\n        return this.privScene;\r\n    }\r\n\r\n    /**\r\n     * Sets the scene configuration for avatar positioning and orientation.\r\n     * @param {AvatarSceneConfig} value - The scene configuration.\r\n     */\r\n    public set scene(value: AvatarSceneConfig) {\r\n        this.privScene = value;\r\n    }\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {string} character - The avatar character.\r\n     * @param {string} style - The avatar style.\r\n     * @param {AvatarVideoFormat} videoFormat - The talking avatar output video format.\r\n     */\r\n    public constructor(character: string, style: string, videoFormat: AvatarVideoFormat) {\r\n        Contracts.throwIfNullOrWhitespace(character, \"character\");\r\n        this.character = character;\r\n        this.style = style;\r\n        if (videoFormat === undefined) {\r\n            videoFormat = new AvatarVideoFormat();\r\n        }\r\n        this.videoFormat = videoFormat;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport enum AvatarEventTypes {\r\n    SwitchedToSpeaking = \"SwitchedToSpeaking\",\r\n    SwitchedToIdle = \"SwitchedToIdle\",\r\n    SessionClosed = \"SessionClosed\",\r\n}\r\n\r\n/**\r\n * Defines content for talking avatar events.\r\n * @class AvatarEventArgs\r\n * Added in version 1.33.0\r\n *\r\n * @experimental This feature is experimental and might change or have limited support.\r\n */\r\nexport class AvatarEventArgs {\r\n    private privType: AvatarEventTypes;\r\n    private privOffset: number;\r\n    private privDescription: string;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {number} audioOffset - The audio offset.\r\n     * @param {string} description - The description of the event.\r\n     */\r\n    public constructor(audioOffset: number, description: string) {\r\n        this.privOffset = audioOffset;\r\n        this.privDescription = description;\r\n    }\r\n\r\n    /**\r\n     * The type of the event.\r\n     * @public\r\n     * @returns {AvatarEventTypes} The type of the event.\r\n     */\r\n    public get type(): AvatarEventTypes {\r\n        return this.privType;\r\n    }\r\n\r\n    /**\r\n     * The time offset associated with this event.\r\n     * @public\r\n     * @returns {number} The time offset associated with this event.\r\n     */\r\n    public get offset(): number {\r\n        return this.privOffset;\r\n    }\r\n\r\n    /**\r\n     * The description of the event.\r\n     * @public\r\n     * @returns {string} The description of the event.\r\n     */\r\n    public get description(): string {\r\n        return this.privDescription;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines the avatar scene configuration for controlling avatar positioning and orientation.\r\n * @class AvatarSceneConfig\r\n * Added in version 1.44.0\r\n *\r\n * @experimental This feature is experimental and might change or have limited support.\r\n */\r\nexport class AvatarSceneConfig {\r\n    /**\r\n     * The zoom level of the avatar. Value should be between 0 and 1, where 1 is the default (no zoom).\r\n     * @default 1.0\r\n     */\r\n    public zoom: number;\r\n\r\n    /**\r\n     * The horizontal position offset of the avatar. Value should be between -1 and 1, where 0 is centered.\r\n     * @default 0.0\r\n     */\r\n    public positionX: number;\r\n\r\n    /**\r\n     * The vertical position offset of the avatar. Value should be between -1 and 1, where 0 is centered.\r\n     * @default 0.0\r\n     */\r\n    public positionY: number;\r\n\r\n    /**\r\n     * The rotation around the X axis (pitch) in radians.\r\n     * @default 0.0\r\n     */\r\n    public rotationX: number;\r\n\r\n    /**\r\n     * The rotation around the Y axis (yaw) in radians.\r\n     * @default 0.0\r\n     */\r\n    public rotationY: number;\r\n\r\n    /**\r\n     * The rotation around the Z axis (roll) in radians.\r\n     * @default 0.0\r\n     */\r\n    public rotationZ: number;\r\n\r\n    /**\r\n     * The amplitude of the avatar's movements. Value should be between 0 and 1, where 1 is the default (full amplitude).\r\n     * @default 1.0\r\n     */\r\n    public amplitude: number;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class with default values.\r\n     * @constructor\r\n     * @param {number} zoom - The zoom level (0-1, default 1.0).\r\n     * @param {number} positionX - The horizontal position offset (-1 to 1, default 0.0).\r\n     * @param {number} positionY - The vertical position offset (-1 to 1, default 0.0).\r\n     * @param {number} rotationX - The rotation around the X axis in radians (default 0.0).\r\n     * @param {number} rotationY - The rotation around the Y axis in radians (default 0.0).\r\n     * @param {number} rotationZ - The rotation around the Z axis in radians (default 0.0).\r\n     * @param {number} amplitude - The amplitude of the avatar's movements (0 to 1, default 1.0).\r\n     */\r\n    public constructor(\r\n        zoom: number = 1.0,\r\n        positionX: number = 0.0,\r\n        positionY: number = 0.0,\r\n        rotationX: number = 0.0,\r\n        rotationY: number = 0.0,\r\n        rotationZ: number = 0.0,\r\n        amplitude: number = 1.0\r\n    ) {\r\n        this.zoom = zoom;\r\n        this.positionX = positionX;\r\n        this.positionY = positionY;\r\n        this.rotationX = rotationX;\r\n        this.rotationY = rotationY;\r\n        this.rotationZ = rotationZ;\r\n        this.amplitude = amplitude;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ProxyInfo,\r\n    WebsocketConnection\r\n} from \"../common.browser/Exports.js\";\r\nimport {\r\n    IConnection,\r\n    IStringDictionary\r\n} from \"../common/Exports.js\";\r\nimport { PropertyId } from \"../sdk/Exports.js\";\r\nimport { ConnectionFactoryBase } from \"./ConnectionFactoryBase.js\";\r\nimport {\r\n    AuthInfo,\r\n    SynthesizerConfig,\r\n    WebsocketMessageFormatter\r\n} from \"./Exports.js\";\r\nimport { HeaderNames } from \"./HeaderNames.js\";\r\nimport { ISynthesisConnectionFactory } from \"./ISynthesisConnectionFactory.js\";\r\nimport {\r\n    QueryParameterNames\r\n} from \"./QueryParameterNames.js\";\r\n\r\nexport class SpeechSynthesisConnectionFactory implements ISynthesisConnectionFactory {\r\n\r\n    private readonly synthesisUri: string = \"/tts/cognitiveservices/websocket/v1\";\r\n\r\n    public async create(\r\n        config: SynthesizerConfig,\r\n        authInfo: AuthInfo,\r\n        connectionId?: string): Promise<IConnection> {\r\n\r\n        let endpoint: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint, undefined);\r\n        const region: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Region, undefined);\r\n        const hostSuffix: string = ConnectionFactoryBase.getHostSuffix(region);\r\n        const endpointId = config.parameters.getProperty(PropertyId.SpeechServiceConnection_EndpointId, undefined);\r\n        const hostPrefix = (endpointId === undefined) ? \"tts\" : \"voice\";\r\n        const host: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Host, \"wss://\" + region + \".\" + hostPrefix + \".speech\" + hostSuffix);\r\n\r\n        const queryParams: IStringDictionary<string> = {};\r\n        const headers: IStringDictionary<string> = {};\r\n\r\n        if (authInfo.token !== undefined && authInfo.token !== \"\") {\r\n            headers[authInfo.headerName] = authInfo.token;\r\n        }\r\n        headers[HeaderNames.ConnectionId] = connectionId;\r\n        if (endpointId !== undefined && endpointId !== \"\") {\r\n            if (!endpoint || endpoint.search(QueryParameterNames.CustomVoiceDeploymentId) === -1) {\r\n                queryParams[QueryParameterNames.CustomVoiceDeploymentId] = endpointId;\r\n            }\r\n        }\r\n\r\n        if (config.avatarEnabled) {\r\n            if (!endpoint || endpoint.search(QueryParameterNames.EnableAvatar) === -1) {\r\n                queryParams[QueryParameterNames.EnableAvatar] = \"true\";\r\n            }\r\n        }\r\n\r\n        if (!!endpoint) {\r\n            const endpointUrl = new URL(endpoint);\r\n            const pathName = endpointUrl.pathname;\r\n\r\n            if (pathName === \"\" || pathName === \"/\" || pathName.toLowerCase() === this.synthesisUri) {\r\n                // We need to generate the path, and we need to check for a redirect.\r\n                endpointUrl.pathname = this.synthesisUri;\r\n\r\n                endpoint = await ConnectionFactoryBase.getRedirectUrlFromEndpoint(endpointUrl.toString());\r\n            }\r\n        }\r\n\r\n        if (!endpoint) {\r\n            endpoint = host + this.synthesisUri;\r\n        }\r\n\r\n        config.parameters.setProperty(PropertyId.SpeechServiceConnection_Url, endpoint);\r\n\r\n        const enableCompression: boolean = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\r\n        return new WebsocketConnection(endpoint, queryParams, headers, new WebsocketMessageFormatter(), ProxyInfo.fromParameters(config.parameters), enableCompression, connectionId);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { SpeechSynthesisConnectionFactory } from \"../common.speech/SpeechSynthesisConnectionFactory.js\";\r\nimport { SynthesisRestAdapter } from \"../common.speech/SynthesisRestAdapter.js\";\r\nimport { SynthesizerConfig } from \"../common.speech/SynthesizerConfig.js\";\r\nimport {\r\n    AvatarSynthesisAdapter,\r\n    IAuthentication,\r\n    ISynthesisConnectionFactory,\r\n    SpeechServiceConfig,\r\n    SynthesisAdapterBase\r\n} from \"../common.speech/Exports.js\";\r\nimport { createNoDashGuid, Deferred, Events, EventType, PlatformEvent } from \"../common/Exports.js\";\r\nimport { AudioOutputFormatImpl } from \"./Audio/AudioOutputFormat.js\";\r\nimport {\r\n    AvatarConfig,\r\n    AvatarEventArgs,\r\n    AvatarSceneConfig,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    ResultReason,\r\n    SpeechConfig,\r\n    SpeechSynthesisOutputFormat,\r\n    SpeechSynthesisResult,\r\n    SynthesisResult,\r\n    Synthesizer\r\n} from \"./Exports.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport { SynthesisRequest } from \"./Synthesizer.js\";\r\n\r\n/**\r\n * Defines the avatar synthesizer.\r\n * @class AvatarSynthesizer\r\n * Added in version 1.33.0\r\n *\r\n * @experimental This feature is experimental and might change or have limited support.\r\n */\r\nexport class AvatarSynthesizer extends Synthesizer {\r\n    protected privProperties: PropertyCollection;\r\n    private privAvatarConfig: AvatarConfig;\r\n    private privIceServers: RTCIceServer[];\r\n    /**\r\n     * Defines event handler for avatar events.\r\n     * @member AvatarSynthesizer.prototype.avatarEventReceived\r\n     * @function\r\n     * @public\r\n     */\r\n    public avatarEventReceived: (sender: AvatarSynthesizer, event: AvatarEventArgs) => void;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {SpeechConfig} speechConfig - The speech config.\r\n     * @param {AvatarConfig} avatarConfig - The talking avatar config.\r\n     */\r\n    public constructor(speechConfig: SpeechConfig, avatarConfig: AvatarConfig) {\r\n        super(speechConfig);\r\n\r\n        Contracts.throwIfNullOrUndefined(avatarConfig, \"avatarConfig\");\r\n\r\n        this.privConnectionFactory = new SpeechSynthesisConnectionFactory();\r\n        this.privAvatarConfig = avatarConfig;\r\n        this.implCommonSynthesizeSetup();\r\n    }\r\n\r\n    protected implCommonSynthesizeSetup(): void {\r\n        super.implCommonSynthesizeSetup();\r\n\r\n        // The service checks the audio format setting while it ignores it in avatar synthesis.\r\n        this.privAdapter.audioOutputFormat = AudioOutputFormatImpl.fromSpeechSynthesisOutputFormat(\r\n            SpeechSynthesisOutputFormat.Riff24Khz16BitMonoPcm\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Starts the talking avatar session and establishes the WebRTC connection.\r\n     * @member AvatarSynthesizer.prototype.startAvatarAsync\r\n     * @function\r\n     * @public\r\n     * @param {AvatarWebRTCConnectionInfo} peerConnection - The peer connection.\r\n     * @returns {Promise<SynthesisResult>} The promise of the connection result.\r\n     */\r\n    public async startAvatarAsync(peerConnection: RTCPeerConnection): Promise<SynthesisResult> {\r\n        Contracts.throwIfNullOrUndefined(peerConnection, \"peerConnection\");\r\n        this.privIceServers = peerConnection.getConfiguration().iceServers;\r\n        Contracts.throwIfNullOrUndefined(this.privIceServers, \"Ice servers must be set.\");\r\n        const iceGatheringDone = new Deferred<void>();\r\n        // https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/icegatheringstatechange_event\r\n        peerConnection.onicegatheringstatechange = (): void => {\r\n            Events.instance.onEvent(new PlatformEvent(\"peer connection: ice gathering state: \" + peerConnection.iceGatheringState, EventType.Debug));\r\n            if (peerConnection.iceGatheringState === \"complete\") {\r\n                Events.instance.onEvent(new PlatformEvent(\"peer connection: ice gathering complete.\", EventType.Info));\r\n                iceGatheringDone.resolve();\r\n            }\r\n        };\r\n        peerConnection.onicecandidate = (event: RTCPeerConnectionIceEvent): void => {\r\n            if (event.candidate) {\r\n                Events.instance.onEvent(new PlatformEvent(\"peer connection: ice candidate: \" + event.candidate.candidate, EventType.Debug));\r\n            } else {\r\n                Events.instance.onEvent(new PlatformEvent(\"peer connection: ice candidate: complete\", EventType.Debug));\r\n                iceGatheringDone.resolve();\r\n            }\r\n        };\r\n        // Set a timeout for ice gathering, currently 2 seconds.\r\n        setTimeout((): void => {\r\n            if (peerConnection.iceGatheringState !== \"complete\") {\r\n                Events.instance.onEvent(new PlatformEvent(\"peer connection: ice gathering timeout.\", EventType.Warning));\r\n                iceGatheringDone.resolve();\r\n            }\r\n        }, 2000);\r\n        const sdp: RTCSessionDescriptionInit = await peerConnection.createOffer();\r\n        await peerConnection.setLocalDescription(sdp);\r\n        await iceGatheringDone.promise;\r\n        Events.instance.onEvent(new PlatformEvent(\"peer connection: got local SDP.\", EventType.Info));\r\n        this.privProperties.setProperty(PropertyId.TalkingAvatarService_WebRTC_SDP, JSON.stringify(peerConnection.localDescription));\r\n\r\n        const result: SpeechSynthesisResult = await this.speak(\"\", false);\r\n        if (result.reason !== ResultReason.SynthesizingAudioCompleted) {\r\n            return new SynthesisResult(\r\n                result.resultId,\r\n                result.reason,\r\n                result.errorDetails,\r\n                result.properties,\r\n            );\r\n        }\r\n        const sdpAnswerString: string = atob(result.properties.getProperty(PropertyId.TalkingAvatarService_WebRTC_SDP));\r\n        const sdpAnswer: RTCSessionDescription = new RTCSessionDescription(\r\n            JSON.parse(sdpAnswerString) as RTCSessionDescriptionInit,\r\n        );\r\n        await peerConnection.setRemoteDescription(sdpAnswer);\r\n        return new SynthesisResult(\r\n            result.resultId,\r\n            result.reason,\r\n            undefined,\r\n            result.properties,\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Speaks plain text asynchronously. The rendered audio and video will be sent via the WebRTC connection.\r\n     * @member AvatarSynthesizer.prototype.speakTextAsync\r\n     * @function\r\n     * @public\r\n     * @param {string} text - The plain text to speak.\r\n     * @returns {Promise<SynthesisResult>} The promise of the synthesis result.\r\n     */\r\n    public async speakTextAsync(text: string): Promise<SynthesisResult> {\r\n        const r = await this.speak(text, false);\r\n        return new SynthesisResult(\r\n            r.resultId,\r\n            r.reason,\r\n            r.errorDetails,\r\n            r.properties,\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Speaks SSML asynchronously. The rendered audio and video will be sent via the WebRTC connection.\r\n     * @member AvatarSynthesizer.prototype.speakSsmlAsync\r\n     * @function\r\n     * @public\r\n     * @param {string} ssml - The SSML text to speak.\r\n     * @returns {Promise<SynthesisResult>} The promise of the synthesis result.\r\n     */\r\n    public async speakSsmlAsync(ssml: string): Promise<SynthesisResult> {\r\n        const r = await this.speak(ssml, true);\r\n        return new SynthesisResult(\r\n            r.resultId,\r\n            r.reason,\r\n            r.errorDetails,\r\n            r.properties,\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Speaks text asynchronously. The avatar will switch to idle state.\r\n     * @member AvatarSynthesizer.prototype.stopSpeakingAsync\r\n     * @function\r\n     * @public\r\n     * @returns {Promise<void>} The promise of the void result.\r\n     */\r\n    public async stopSpeakingAsync(): Promise<void> {\r\n        while (this.synthesisRequestQueue.length() > 0) {\r\n            const request = await this.synthesisRequestQueue.dequeue();\r\n            request.err(\"Synthesis is canceled by user.\");\r\n        }\r\n        return this.privAdapter.stopSpeaking();\r\n    }\r\n\r\n    /**\r\n     * Updates the avatar scene configuration at runtime.\r\n     * This allows changing the avatar's zoom, position, amplitude, and rotation while the session is active.\r\n     * @member AvatarSynthesizer.prototype.updateSceneAsync\r\n     * @function\r\n     * @public\r\n     * @param {AvatarSceneConfig} sceneConfig - The new scene configuration to apply.\r\n     * @returns {Promise<void>} The promise of the void result.\r\n     */\r\n    public async updateSceneAsync(sceneConfig: AvatarSceneConfig): Promise<void> {\r\n        Contracts.throwIfDisposed(this.privDisposed);\r\n        Contracts.throwIfNullOrUndefined(sceneConfig, \"sceneConfig\");\r\n\r\n        const sceneMessage = {\r\n            avatarScene: {\r\n                amplitude: sceneConfig.amplitude,\r\n                positionX: sceneConfig.positionX,\r\n                positionY: sceneConfig.positionY,\r\n                rotationX: sceneConfig.rotationX,\r\n                rotationY: sceneConfig.rotationY,\r\n                rotationZ: sceneConfig.rotationZ,\r\n                zoom: sceneConfig.zoom,\r\n            }\r\n        };\r\n\r\n        return this.privAdapter.sendNetworkMessage(\"synthesis.control\", JSON.stringify(sceneMessage));\r\n    }\r\n\r\n    /**\r\n     * Stops the talking avatar session and closes the WebRTC connection.\r\n     * For now, this is the same as close().\r\n     * You need to create a new AvatarSynthesizer instance to start a new session.\r\n     * @member AvatarSynthesizer.prototype.stopAvatarAsync\r\n     * @function\r\n     * @public\r\n     * @returns {Promise<void>} The promise of the void result.\r\n     */\r\n    public async stopAvatarAsync(): Promise<void> {\r\n        Contracts.throwIfDisposed(this.privDisposed);\r\n        return this.dispose(true);\r\n    }\r\n\r\n    /**\r\n     * Dispose of associated resources.\r\n     * @member AvatarSynthesizer.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public async close(): Promise<void> {\r\n        if (this.privDisposed) {\r\n            return;\r\n        }\r\n\r\n        return this.dispose(true);\r\n    }\r\n\r\n    /**\r\n     * Gets the ICE servers. Internal use only.\r\n     */\r\n    public get iceServers(): RTCIceServer[] {\r\n        return this.privIceServers;\r\n    }\r\n\r\n    // Creates the synthesis adapter\r\n    protected createSynthesisAdapter(\r\n        authentication: IAuthentication,\r\n        connectionFactory: ISynthesisConnectionFactory,\r\n        synthesizerConfig: SynthesizerConfig): SynthesisAdapterBase {\r\n        return new AvatarSynthesisAdapter(\r\n            authentication,\r\n            connectionFactory,\r\n            synthesizerConfig,\r\n            this,\r\n            this.privAvatarConfig);\r\n    }\r\n\r\n    protected createRestSynthesisAdapter(\r\n        _authentication: IAuthentication,\r\n        _synthesizerConfig: SynthesizerConfig): SynthesisRestAdapter {\r\n        return undefined;\r\n    }\r\n\r\n    protected createSynthesizerConfig(speechConfig: SpeechServiceConfig): SynthesizerConfig {\r\n        const config = super.createSynthesizerConfig(speechConfig);\r\n        config.avatarEnabled = true;\r\n        return config;\r\n    }\r\n\r\n    protected async speak(text: string, isSSML: boolean): Promise<SpeechSynthesisResult> {\r\n        const requestId = createNoDashGuid();\r\n        const deferredResult = new Deferred<SpeechSynthesisResult>();\r\n        this.synthesisRequestQueue.enqueue(new SynthesisRequest(requestId, text, isSSML,\r\n            (e: SpeechSynthesisResult): void => {\r\n                deferredResult.resolve(e);\r\n                this.privSynthesizing = false;\r\n                void this.adapterSpeak();\r\n            },\r\n            (e: string): void => {\r\n                deferredResult.reject(e);\r\n                this.privSynthesizing = false;\r\n            }));\r\n        void this.adapterSpeak();\r\n        return deferredResult.promise;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\n/**\r\n * Defines a coordinate in 2D space.\r\n * @class Coordinate\r\n * Added in version 1.33.0\r\n */\r\nexport class Coordinate {\r\n    public x: number;\r\n    public y: number;\r\n\r\n    public constructor(x: number, y: number) {\r\n        this.x = x;\r\n        this.y = y;\r\n    }\r\n}\r\n\r\n/**\r\n * Defines the avatar output video format.\r\n * @class AvatarVideoFormat\r\n * Added in version 1.33.0\r\n *\r\n * @experimental This feature is experimental and might change in the future.\r\n */\r\nexport class AvatarVideoFormat {\r\n    /**\r\n     * Defines the video codec.\r\n     * @default \"H264\"\r\n     */\r\n    public codec: string;\r\n    /**\r\n     * Defines the video bitrate.\r\n     * @default 2000000\r\n     */\r\n    public bitrate: number;\r\n    /**\r\n     * Defines the video width.\r\n     * @default 1920\r\n     */\r\n    public width: number;\r\n    /**\r\n     * Defines the video height.\r\n     * @default 1080\r\n     */\r\n    public height: number;\r\n\r\n    /**\r\n     * Sets the video crop range.\r\n     */\r\n    public setCropRange(topLeft: Coordinate, bottomRight: Coordinate): void {\r\n        this.cropRange = {\r\n            bottomRight,\r\n            topLeft,\r\n        };\r\n    }\r\n\r\n    /**\r\n     * Defines the video crop range.\r\n     * @default undefined\r\n     * @internal\r\n     */\r\n    public cropRange: {\r\n        topLeft: Coordinate;\r\n        bottomRight: Coordinate;\r\n    };\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {string} codec - The video codec.\r\n     * @param {number} bitrate - The video bitrate.\r\n     * @param {number} width - The video width.\r\n     * @param {number} height - The video height.\r\n     */\r\n    public constructor(codec: string = \"H264\",\r\n                       bitrate: number = 2000000,\r\n                       width: number = 1920,\r\n                       height: number = 1080,\r\n    ) {\r\n        this.codec = codec;\r\n        this.bitrate = bitrate;\r\n        this.width = width;\r\n        this.height = height;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ResultReason,\r\n    PropertyCollection,\r\n    SynthesisResult\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Defines the avatar WebRTC connection result.\r\n * @class AvatarWebRTCConnectionResult\r\n * Added in version 1.33.0\r\n *\r\n * @experimental This feature is experimental and might change in the future.\r\n */\r\nexport class AvatarWebRTCConnectionResult extends SynthesisResult {\r\n    private readonly privSDPAnswer: RTCSessionDescriptionInit;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {RTCSessionDescriptionInit} SDPAnswer - The SDP answer of WebRTC connection.\r\n     * @param {string} resultId - The result id.\r\n     * @param {ResultReason} reason - The reason.\r\n     * @param {string} errorDetails - Error details, if provided.\r\n     * @param {PropertyCollection} properties - Additional properties, if provided.\r\n     */\r\n    public constructor(SDPAnswer?: RTCSessionDescriptionInit, resultId?: string, reason?: ResultReason, errorDetails?: string, properties?: PropertyCollection) {\r\n        super(resultId, reason, errorDetails, properties);\r\n        this.privSDPAnswer = SDPAnswer;\r\n    }\r\n\r\n    /**\r\n     * Specifies SDP (Session Description Protocol) answer of WebRTC connection.\r\n     * @member AvatarWebRTCConnectionResult.prototype.SDPAnswer\r\n     * @function\r\n     * @public\r\n     * @returns {RTCSessionDescriptionInit} Specifies the SDP answer of WebRTC connection.\r\n     */\r\n    public get SDPAnswer(): RTCSessionDescriptionInit {\r\n        return this.privSDPAnswer;\r\n    }\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\nimport { ConsoleLoggingListener } from \"../common.browser/Exports.js\";\r\nimport { Events } from \"../common/Exports.js\";\r\nimport { LogLevel } from \"./LogLevel.js\";\r\n\r\ntype LogCallback = (s: string) => void;\r\n\r\n/**\r\n * Defines diagnostics API for managing console output\r\n * Added in version 1.21.0\r\n */\r\nexport class Diagnostics {\r\n    private static privListener: ConsoleLoggingListener = undefined;\r\n\r\n    public static SetLoggingLevel(logLevel: LogLevel): void {\r\n        this.privListener = new ConsoleLoggingListener(logLevel);\r\n        Events.instance.attachConsoleListener(this.privListener);\r\n    }\r\n\r\n    public static StartConsoleOutput(): void {\r\n        if (!!this.privListener) {\r\n            this.privListener.enableConsoleOutput = true;\r\n        }\r\n    }\r\n\r\n    public static StopConsoleOutput(): void {\r\n        if (!!this.privListener) {\r\n            this.privListener.enableConsoleOutput = false;\r\n        }\r\n    }\r\n\r\n    public static SetLogOutputPath(path: string): void {\r\n        if (typeof window === \"undefined\") {\r\n            if (!!this.privListener) {\r\n                this.privListener.logPath = path;\r\n            }\r\n        } else {\r\n            throw new Error(\"File system logging not available in browser.\");\r\n        }\r\n    }\r\n\r\n\r\n    public static set onLogOutput( callback: LogCallback ) {\r\n        if (!!this.privListener) {\r\n            this.privListener.logCallback = callback;\r\n        }\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport { AudioConfig } from \"./Audio/AudioConfig.js\";\r\nexport { AudioStreamFormat, AudioFormatTag } from \"./Audio/AudioStreamFormat.js\";\r\nexport { AudioInputStream, PullAudioInputStream, PushAudioInputStream } from \"./Audio/AudioInputStream.js\";\r\nexport { AudioOutputStream, PullAudioOutputStream, PushAudioOutputStream} from \"./Audio/AudioOutputStream.js\";\r\nexport { CancellationReason } from \"./CancellationReason.js\";\r\nexport { PullAudioInputStreamCallback } from \"./Audio/PullAudioInputStreamCallback.js\";\r\nexport { PushAudioOutputStreamCallback } from \"./Audio/PushAudioOutputStreamCallback.js\";\r\nexport { KeywordRecognitionModel } from \"./KeywordRecognitionModel.js\";\r\nexport { SessionEventArgs } from \"./SessionEventArgs.js\";\r\nexport { RecognitionEventArgs } from \"./RecognitionEventArgs.js\";\r\nexport { OutputFormat } from \"./OutputFormat.js\";\r\nexport { RecognitionResult } from \"./RecognitionResult.js\";\r\nexport { SpeechRecognitionResult } from \"./SpeechRecognitionResult.js\";\r\nexport { SpeechRecognitionEventArgs, ConversationTranscriptionEventArgs, MeetingTranscriptionEventArgs } from \"./SpeechRecognitionEventArgs.js\";\r\nexport { SpeechRecognitionCanceledEventArgs } from \"./SpeechRecognitionCanceledEventArgs.js\";\r\nexport { TranslationRecognitionEventArgs } from \"./TranslationRecognitionEventArgs.js\";\r\nexport { TranslationSynthesisEventArgs } from \"./TranslationSynthesisEventArgs.js\";\r\nexport { TranslationRecognitionResult } from \"./TranslationRecognitionResult.js\";\r\nexport { TranslationSynthesisResult } from \"./TranslationSynthesisResult.js\";\r\nexport { ResultReason } from \"./ResultReason.js\";\r\nexport { SpeechConfig, SpeechConfigImpl } from \"./SpeechConfig.js\";\r\nexport { SpeechTranslationConfig, SpeechTranslationConfigImpl } from \"./SpeechTranslationConfig.js\";\r\nexport { PropertyCollection } from \"./PropertyCollection.js\";\r\nexport { PropertyId } from \"./PropertyId.js\";\r\nexport { Recognizer } from \"./Recognizer.js\";\r\nexport { SpeechRecognizer } from \"./SpeechRecognizer.js\";\r\nexport { TranslationRecognizer } from \"./TranslationRecognizer.js\";\r\nexport { Translations } from \"./Translations.js\";\r\nexport { NoMatchReason } from \"./NoMatchReason.js\";\r\nexport { NoMatchDetails } from \"./NoMatchDetails.js\";\r\nexport { TranslationRecognitionCanceledEventArgs } from \"./TranslationRecognitionCanceledEventArgs.js\";\r\nexport { CancellationDetailsBase } from \"./CancellationDetailsBase.js\";\r\nexport { CancellationDetails } from \"./CancellationDetails.js\";\r\nexport { CancellationErrorCode } from \"./CancellationErrorCodes.js\";\r\nexport { ConnectionEventArgs } from \"./ConnectionEventArgs.js\";\r\nexport { ServiceEventArgs } from \"./ServiceEventArgs.js\";\r\nexport { Connection } from \"./Connection.js\";\r\nexport { PhraseListGrammar } from \"./PhraseListGrammar.js\";\r\nexport { DialogServiceConfig } from \"./DialogServiceConfig.js\";\r\nexport { BotFrameworkConfig } from \"./BotFrameworkConfig.js\";\r\nexport { CustomCommandsConfig } from \"./CustomCommandsConfig.js\";\r\nexport { DialogServiceConnector } from \"./DialogServiceConnector.js\";\r\nexport { ActivityReceivedEventArgs } from \"./ActivityReceivedEventArgs.js\";\r\nexport { TurnStatusReceivedEventArgs } from \"./TurnStatusReceivedEventArgs.js\";\r\nexport { ServicePropertyChannel } from \"./ServicePropertyChannel.js\";\r\nexport { ProfanityOption } from \"./ProfanityOption.js\";\r\nexport { BaseAudioPlayer } from \"./Audio/BaseAudioPlayer.js\";\r\nexport { ConnectionMessageEventArgs } from \"./ConnectionMessageEventArgs.js\";\r\nexport { ConnectionMessage } from \"./ConnectionMessage.js\";\r\nexport { AutoDetectSourceLanguageConfig } from \"./AutoDetectSourceLanguageConfig.js\";\r\nexport { AutoDetectSourceLanguageResult } from \"./AutoDetectSourceLanguageResult.js\";\r\nexport { SourceLanguageConfig } from \"./SourceLanguageConfig.js\";\r\nexport { Conversation,\r\n    ConversationExpirationEventArgs,\r\n    ConversationInfo,\r\n    ConversationParticipantsChangedEventArgs,\r\n    ConversationTranslationCanceledEventArgs,\r\n    ConversationTranslationEventArgs,\r\n    ConversationTranslationResult,\r\n    ConversationTranslator,\r\n    ConversationTranscriber,\r\n    ConversationTranscriptionResult,\r\n    Meeting,\r\n    MeetingInfo,\r\n    MeetingTranscriber,\r\n    IParticipant,\r\n    Participant,\r\n    ParticipantChangedReason,\r\n    User,\r\n    VoiceSignature\r\n    } from \"./Transcription/Exports.js\";\r\nexport { Synthesizer } from \"./Synthesizer.js\";\r\nexport { SpeechSynthesisOutputFormat } from \"./SpeechSynthesisOutputFormat.js\";\r\nexport { SpeechSynthesizer } from \"./SpeechSynthesizer.js\";\r\nexport { SynthesisResult } from \"./SynthesisResult.js\";\r\nexport { SpeechSynthesisResult } from \"./SpeechSynthesisResult.js\";\r\nexport { SpeechSynthesisEventArgs } from \"./SpeechSynthesisEventArgs.js\";\r\nexport { SpeechSynthesisWordBoundaryEventArgs } from \"./SpeechSynthesisWordBoundaryEventArgs.js\";\r\nexport { SpeechSynthesisBookmarkEventArgs } from \"./SpeechSynthesisBookmarkEventArgs.js\";\r\nexport { SpeechSynthesisVisemeEventArgs } from \"./SpeechSynthesisVisemeEventArgs.js\";\r\nexport { SpeechSynthesisBoundaryType } from \"./SpeechSynthesisBoundaryType.js\";\r\nexport { SpeechSynthesisRequest, SpeechSynthesisRequestInputStream } from \"./SpeechSynthesisRequest.js\";\r\nexport { SpeechSynthesisRequestInputType } from \"./SpeechSynthesisRequestInputType.js\";\r\nexport { SynthesisVoicesResult } from \"./SynthesisVoicesResult.js\";\r\nexport { SynthesisVoiceGender, SynthesisVoiceType, VoiceInfo } from \"./VoiceInfo.js\";\r\nexport { IPlayer } from \"./Audio/IPlayer.js\";\r\nexport { SpeakerAudioDestination } from \"./Audio/SpeakerAudioDestination.js\";\r\nexport { CancellationEventArgs } from \"./CancellationEventArgs.js\";\r\nexport { ConversationTranscriptionCanceledEventArgs } from \"./ConversationTranscriptionCanceledEventArgs.js\";\r\nexport { MeetingTranscriptionCanceledEventArgs } from \"./MeetingTranscriptionCanceledEventArgs.js\";\r\nexport { PronunciationAssessmentGradingSystem } from \"./PronunciationAssessmentGradingSystem.js\";\r\nexport { PronunciationAssessmentGranularity } from \"./PronunciationAssessmentGranularity.js\";\r\nexport { PronunciationAssessmentConfig } from \"./PronunciationAssessmentConfig.js\";\r\nexport { PronunciationAssessmentResult } from \"./PronunciationAssessmentResult.js\";\r\nexport { LanguageIdMode } from \"./LanguageIdMode.js\";\r\nexport { AvatarConfig } from \"./AvatarConfig.js\";\r\nexport { AvatarEventArgs } from \"./AvatarEventArgs.js\";\r\nexport { AvatarSceneConfig } from \"./AvatarSceneConfig.js\";\r\nexport { AvatarSynthesizer } from \"./AvatarSynthesizer.js\";\r\nexport { AvatarVideoFormat, Coordinate } from \"./AvatarVideoFormat.js\";\r\nexport { AvatarWebRTCConnectionResult } from \"./AvatarWebRTCConnectionResult.js\";\r\nexport { Diagnostics } from \"./Diagnostics.js\";\r\nexport { LogLevel } from \"./LogLevel.js\";\r\nexport { IVoiceJson } from \"./IVoiceJson.js\";\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { RecognizerConfig } from \"../common.speech/Exports.js\";\r\nimport { PropertyCollection, PropertyId } from \"../sdk/Exports.js\";\r\n\r\nexport class ProxyInfo {\r\n    private privProxyHostName: string;\r\n    private privProxyPort: number;\r\n    private privProxyUserName: string;\r\n    private privProxyPassword: string;\r\n\r\n    private constructor(proxyHostName: string, proxyPort: number, proxyUserName: string, proxyPassword: string) {\r\n        this.privProxyHostName = proxyHostName;\r\n        this.privProxyPort = proxyPort;\r\n        this.privProxyUserName = proxyUserName;\r\n        this.privProxyPassword = proxyPassword;\r\n    }\r\n\r\n    public static fromParameters(parameters: PropertyCollection): ProxyInfo {\r\n        return new ProxyInfo(parameters.getProperty(PropertyId.SpeechServiceConnection_ProxyHostName),\r\n            parseInt(parameters.getProperty(PropertyId.SpeechServiceConnection_ProxyPort), 10),\r\n            parameters.getProperty(PropertyId.SpeechServiceConnection_ProxyUserName),\r\n            parameters.getProperty(PropertyId.SpeechServiceConnection_ProxyPassword));\r\n    }\r\n\r\n    public static fromRecognizerConfig(config: RecognizerConfig): ProxyInfo {\r\n        return this.fromParameters(config.parameters);\r\n    }\r\n\r\n    public get HostName(): string {\r\n        return this.privProxyHostName;\r\n    }\r\n\r\n    public get Port(): number {\r\n        return this.privProxyPort;\r\n    }\r\n\r\n    public get UserName(): string {\r\n        return this.privProxyUserName;\r\n    }\r\n\r\n    public get Password(): string {\r\n        return this.privProxyPassword;\r\n    }\r\n}\r\n","'use strict'\nconst encodings = new Set(['json', 'buffer', 'string'])\n\nmodule.exports = mkrequest => (...args) => {\n  const statusCodes = new Set()\n  let method\n  let encoding\n  let headers\n  let baseurl = ''\n\n  args.forEach(arg => {\n    if (typeof arg === 'string') {\n      if (arg.toUpperCase() === arg) {\n        if (method) {\n          const msg = `Can't set method to ${arg}, already set to ${method}.`\n          throw new Error(msg)\n        } else {\n          method = arg\n        }\n      } else if (arg.startsWith('http:') || arg.startsWith('https:')) {\n        baseurl = arg\n      } else {\n        if (encodings.has(arg)) {\n          encoding = arg\n        } else {\n          throw new Error(`Unknown encoding, ${arg}`)\n        }\n      }\n    } else if (typeof arg === 'number') {\n      statusCodes.add(arg)\n    } else if (typeof arg === 'object') {\n      if (Array.isArray(arg) || arg instanceof Set) {\n        arg.forEach(code => statusCodes.add(code))\n      } else {\n        if (headers) {\n          throw new Error('Cannot set headers twice.')\n        }\n        headers = arg\n      }\n    } else {\n      throw new Error(`Unknown type: ${typeof arg}`)\n    }\n  })\n\n  if (!method) method = 'GET'\n  if (statusCodes.size === 0) {\n    statusCodes.add(200)\n  }\n\n  return mkrequest(statusCodes, method, encoding, headers, baseurl)\n}\n","'use strict'\n/* global fetch, btoa, Headers */\nconst core = require('./core')\n\nclass StatusError extends Error {\n  constructor (res, ...params) {\n    super(...params)\n\n    if (Error.captureStackTrace) {\n      Error.captureStackTrace(this, StatusError)\n    }\n\n    this.name = 'StatusError'\n    this.message = res.statusMessage\n    this.statusCode = res.status\n    this.res = res\n    this.json = res.json.bind(res)\n    this.text = res.text.bind(res)\n    this.arrayBuffer = res.arrayBuffer.bind(res)\n    let buffer\n    const get = () => {\n      if (!buffer) buffer = this.arrayBuffer()\n      return buffer\n    }\n    Object.defineProperty(this, 'responseBody', { get })\n    // match Node.js headers object\n    this.headers = {}\n    for (const [key, value] of res.headers.entries()) {\n      this.headers[key.toLowerCase()] = value\n    }\n  }\n}\n\nconst mkrequest = (statusCodes, method, encoding, headers, baseurl) => async (_url, body, _headers = {}) => {\n  _url = baseurl + (_url || '')\n  let parsed = new URL(_url)\n\n  if (!headers) headers = {}\n  if (parsed.username) {\n    headers.Authorization = 'Basic ' + btoa(parsed.username + ':' + parsed.password)\n    parsed = new URL(parsed.protocol + '//' + parsed.host + parsed.pathname + parsed.search)\n  }\n  if (parsed.protocol !== 'https:' && parsed.protocol !== 'http:') {\n    throw new Error(`Unknown protocol, ${parsed.protocol}`)\n  }\n\n  if (body) {\n    if (body instanceof ArrayBuffer ||\n      ArrayBuffer.isView(body) ||\n      typeof body === 'string'\n    ) {\n      // noop\n    } else if (typeof body === 'object') {\n      body = JSON.stringify(body)\n      headers['Content-Type'] = 'application/json'\n    } else {\n      throw new Error('Unknown body type.')\n    }\n  }\n\n  _headers = new Headers({ ...(headers || {}), ..._headers })\n\n  const resp = await fetch(parsed, { method, headers: _headers, body })\n  resp.statusCode = resp.status\n\n  if (!statusCodes.has(resp.status)) {\n    throw new StatusError(resp)\n  }\n\n  if (encoding === 'json') return resp.json()\n  else if (encoding === 'buffer') return resp.arrayBuffer()\n  else if (encoding === 'string') return resp.text()\n  else return resp\n}\n\nmodule.exports = core(mkrequest)\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport bent, { BentResponse, RequestBody } from \"bent\";\r\nimport {\r\n    ArgumentNullError,\r\n    Deferred\r\n} from \"../common/Exports.js\";\r\nimport { IRequestOptions } from \"./Exports.js\";\r\n\r\nexport enum RestRequestType {\r\n    Get = \"GET\",\r\n    Post = \"POST\",\r\n    Delete = \"DELETE\",\r\n    File = \"file\",\r\n}\r\n\r\nexport interface IRestResponse {\r\n    ok: boolean;\r\n    status: number;\r\n    statusText: string;\r\n    data: string;\r\n    json: any;\r\n    headers: string;\r\n}\r\n\r\ninterface JsonError {\r\n    error?: {\r\n        message: string;\r\n    };\r\n}\r\n\r\n// accept rest operations via request method and return abstracted objects from server response\r\nexport class RestMessageAdapter {\r\n\r\n    private privIgnoreCache: boolean;\r\n    private privHeaders: { [key: string]: string };\r\n\r\n    public constructor(\r\n        configParams: IRequestOptions\r\n        ) {\r\n\r\n        if (!configParams) {\r\n            throw new ArgumentNullError(\"configParams\");\r\n        }\r\n\r\n        this.privHeaders = configParams.headers;\r\n        this.privIgnoreCache = configParams.ignoreCache;\r\n    }\r\n\r\n    public static extractHeaderValue(headerKey: string, headers: string): string {\r\n        let headerValue: string = \"\";\r\n\r\n        try {\r\n            const arr = headers.trim().split(/[\\r\\n]+/);\r\n            const headerMap: { [key: string]: string } = {};\r\n            arr.forEach((line: string): void => {\r\n                const parts = line.split(\": \");\r\n                const header = parts.shift().toLowerCase();\r\n                const value = parts.join(\": \");\r\n                headerMap[header] = value;\r\n            });\r\n\r\n            headerValue = headerMap[headerKey.toLowerCase()];\r\n        } catch (e) {\r\n            // ignore the error\r\n        }\r\n\r\n        return headerValue;\r\n    }\r\n\r\n    public set options(configParams: IRequestOptions) {\r\n        this.privHeaders = configParams.headers;\r\n        this.privIgnoreCache = configParams.ignoreCache;\r\n    }\r\n\r\n    public setHeaders(key: string, value: string): void {\r\n        this.privHeaders[key] = value;\r\n    }\r\n\r\n    public request(\r\n        method: RestRequestType,\r\n        uri: string,\r\n        queryParams: { [key: string]: any } = {},\r\n        body: any = null,\r\n        ): Promise<IRestResponse> {\r\n\r\n        const responseReceivedDeferral = new Deferred<IRestResponse>();\r\n\r\n        const requestCommand = method === RestRequestType.File ? \"POST\" : method;\r\n        const handleRestResponse = (data: BentResponse, j: JsonError = {}): IRestResponse => {\r\n            const d: { statusText?: string; statusMessage?: string } = data;\r\n            return {\r\n                data: JSON.stringify(j),\r\n                headers: JSON.stringify(data.headers),\r\n                json: j,\r\n                ok: data.statusCode >= 200 && data.statusCode < 300,\r\n                status: data.statusCode,\r\n                statusText: j.error ? j.error.message : d.statusText ? d.statusText : d.statusMessage\r\n            };\r\n        };\r\n\r\n        const send = (postData: RequestBody): void => {\r\n            const sendRequest = bent(uri, requestCommand, this.privHeaders, 200, 201, 202, 204, 400, 401, 402, 403, 404);\r\n            const params = this.queryParams(queryParams) === \"\" ? \"\" : `?${this.queryParams(queryParams)}`;\r\n            sendRequest(params, postData).then( async (data: BentResponse): Promise<void> => {\r\n                if (method === RestRequestType.Delete || data.statusCode === 204) {\r\n                    // No JSON from Delete and reset (204) operations\r\n                    responseReceivedDeferral.resolve(handleRestResponse(data));\r\n                } else {\r\n                    try {\r\n                        const j: JsonError = await data.json() as JsonError;\r\n                        responseReceivedDeferral.resolve(handleRestResponse(data, j));\r\n                    } catch {\r\n                        responseReceivedDeferral.resolve(handleRestResponse(data));\r\n                    }\r\n                }\r\n            }).catch((error: string): void => {\r\n                responseReceivedDeferral.reject(error);\r\n            });\r\n        };\r\n\r\n        if (this.privIgnoreCache) {\r\n            this.privHeaders[\"Cache-Control\"] = \"no-cache\";\r\n        }\r\n\r\n        if (method === RestRequestType.Post && body) {\r\n            this.privHeaders[\"content-type\"] = \"application/json\";\r\n            this.privHeaders[\"Content-Type\"] = \"application/json\";\r\n        }\r\n        send(body as RequestBody);\r\n        return responseReceivedDeferral.promise;\r\n    }\r\n\r\n    private queryParams(params: { [key: string]: string } = {}): string {\r\n        return Object.keys(params)\r\n            .map((k: string): string => encodeURIComponent(k) + \"=\" + encodeURIComponent(params[k]))\r\n            .join(\"&\");\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { IErrorMessages } from \"../common/Exports.js\";\r\n/**\r\n * HTTP request helper\r\n */\r\nexport interface IRequestOptions {\r\n    headers?: {[key: string]: string};\r\n    ignoreCache?: boolean;\r\n    timeout?: number;\r\n}\r\n\r\nexport interface IRestParams {\r\n    apiVersion: string;\r\n    authorization: string;\r\n    clientAppId: string;\r\n    contentTypeKey: string;\r\n    correlationId: string;\r\n    languageCode: string;\r\n    nickname: string;\r\n    profanity: string;\r\n    requestId: string;\r\n    roomId: string;\r\n    sessionToken: string;\r\n    subscriptionKey: string;\r\n    subscriptionRegion: string;\r\n    token: string;\r\n}\r\n\r\nexport class RestConfigBase {\r\n\r\n    public static get requestOptions(): IRequestOptions {\r\n        return RestConfigBase.privDefaultRequestOptions;\r\n    }\r\n\r\n    public static get configParams(): IRestParams {\r\n        return RestConfigBase.privDefaultParams;\r\n    }\r\n\r\n    public static get restErrors(): IErrorMessages {\r\n        return RestConfigBase.privRestErrors;\r\n    }\r\n\r\n    private static readonly privDefaultRequestOptions: IRequestOptions = {\r\n        headers: {\r\n            Accept: \"application/json\",\r\n        },\r\n        ignoreCache: false,\r\n        timeout: 10000,\r\n    };\r\n\r\n    private static readonly privRestErrors: IErrorMessages = {\r\n        authInvalidSubscriptionKey: \"You must specify either an authentication token to use, or a Cognitive Speech subscription key.\",\r\n        authInvalidSubscriptionRegion: \"You must specify the Cognitive Speech region to use.\",\r\n        invalidArgs: \"Required input not found: {arg}.\",\r\n        invalidCreateJoinConversationResponse: \"Creating/Joining conversation failed with HTTP {status}.\",\r\n        invalidParticipantRequest: \"The requested participant was not found.\",\r\n        permissionDeniedConnect: \"Required credentials not found.\",\r\n        permissionDeniedConversation: \"Invalid operation: only the host can {command} the conversation.\",\r\n        permissionDeniedParticipant: \"Invalid operation: only the host can {command} a participant.\",\r\n        permissionDeniedSend: \"Invalid operation: the conversation is not in a connected state.\",\r\n        permissionDeniedStart: \"Invalid operation: there is already an active conversation.\",\r\n    };\r\n\r\n    private static readonly privDefaultParams: IRestParams = {\r\n        apiVersion: \"api-version\",\r\n        authorization: \"Authorization\",\r\n        clientAppId: \"X-ClientAppId\",\r\n        contentTypeKey: \"Content-Type\",\r\n        correlationId: \"X-CorrelationId\",\r\n        languageCode: \"language\",\r\n        nickname: \"nickname\",\r\n        profanity: \"profanity\",\r\n        requestId: \"X-RequestId\",\r\n        roomId: \"roomid\",\r\n        sessionToken: \"token\",\r\n        subscriptionKey: \"Ocp-Apim-Subscription-Key\",\r\n        subscriptionRegion: \"Ocp-Apim-Subscription-Region\",\r\n        token: \"X-CapitoToken\",\r\n    };\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport * from \"./ConsoleLoggingListener.js\";\r\nexport * from \"./IRecorder.js\";\r\nexport * from \"./MicAudioSource.js\";\r\nexport * from \"./FileAudioSource.js\";\r\nexport * from \"./PCMRecorder.js\";\r\nexport * from \"./WebsocketConnection.js\";\r\nexport * from \"./WebsocketMessageAdapter.js\";\r\nexport * from \"./ReplayableAudioNode.js\";\r\nexport * from \"./ProxyInfo.js\";\r\nexport * from \"./RestMessageAdapter.js\";\r\nexport * from \"./RestConfigBase.js\";\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ArgumentNullError, ConnectionMessage, IStringDictionary, MessageType } from \"../common/Exports.js\";\r\nimport { HeaderNames } from \"./HeaderNames.js\";\r\n\r\nexport class SpeechConnectionMessage extends ConnectionMessage {\r\n\r\n    private privPath: string;\r\n    private privRequestId: string;\r\n    private privContentType: string;\r\n    private privStreamId: string;\r\n    private privAdditionalHeaders: IStringDictionary<string>;\r\n\r\n    public constructor(\r\n        messageType: MessageType,\r\n        path: string,\r\n        requestId: string,\r\n        contentType: string,\r\n        body: any,\r\n        streamId?: string,\r\n        additionalHeaders?: IStringDictionary<string>,\r\n        id?: string) {\r\n\r\n        if (!path) {\r\n            throw new ArgumentNullError(\"path\");\r\n        }\r\n\r\n        if (!requestId) {\r\n            throw new ArgumentNullError(\"requestId\");\r\n        }\r\n\r\n        const headers: IStringDictionary<string> = {};\r\n        headers[HeaderNames.Path] = path;\r\n        headers[HeaderNames.RequestId] = requestId;\r\n        headers[HeaderNames.RequestTimestamp] = new Date().toISOString();\r\n        if (contentType) {\r\n            headers[HeaderNames.ContentType] = contentType;\r\n        }\r\n\r\n        if (streamId) {\r\n            headers[HeaderNames.RequestStreamId] = streamId;\r\n        }\r\n\r\n        if (additionalHeaders) {\r\n            for (const headerName in additionalHeaders) {\r\n                if (headerName) {\r\n                    headers[headerName] = additionalHeaders[headerName];\r\n                }\r\n\r\n            }\r\n        }\r\n\r\n        if (id) {\r\n            super(messageType, body, headers, id);\r\n        } else {\r\n            super(messageType, body, headers);\r\n        }\r\n\r\n        this.privPath = path;\r\n        this.privRequestId = requestId;\r\n        this.privContentType = contentType;\r\n        this.privStreamId = streamId;\r\n        this.privAdditionalHeaders = additionalHeaders;\r\n    }\r\n\r\n    public get path(): string {\r\n        return this.privPath;\r\n    }\r\n\r\n    public get requestId(): string {\r\n        return this.privRequestId;\r\n    }\r\n\r\n    public get contentType(): string {\r\n        return this.privContentType;\r\n    }\r\n\r\n    public get streamId(): string {\r\n        return this.privStreamId;\r\n    }\r\n\r\n    public get additionalHeaders(): IStringDictionary<string> {\r\n        return this.privAdditionalHeaders;\r\n    }\r\n\r\n    public static fromConnectionMessage(message: ConnectionMessage): SpeechConnectionMessage {\r\n        let path = null;\r\n        let requestId = null;\r\n        let contentType = null;\r\n        // let requestTimestamp = null;\r\n        let streamId = null;\r\n        const additionalHeaders: IStringDictionary<string> = {};\r\n\r\n        if (message.headers) {\r\n            for (const headerName in message.headers) {\r\n                if (headerName) {\r\n                    if (headerName.toLowerCase() === HeaderNames.Path.toLowerCase()) {\r\n                        path = message.headers[headerName];\r\n                    } else if (headerName.toLowerCase() === HeaderNames.RequestId.toLowerCase()) {\r\n                        requestId = message.headers[headerName];\r\n                    // } else if (headerName.toLowerCase() === HeaderNames.RequestTimestamp.toLowerCase()) {\r\n                       //  requestTimestamp = message.headers[headerName];\r\n                    } else if (headerName.toLowerCase() === HeaderNames.ContentType.toLowerCase()) {\r\n                        contentType = message.headers[headerName];\r\n                    } else if (headerName.toLowerCase() === HeaderNames.RequestStreamId.toLowerCase()) {\r\n                        streamId = message.headers[headerName];\r\n                    } else {\r\n                        additionalHeaders[headerName] = message.headers[headerName];\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        return new SpeechConnectionMessage(\r\n            message.messageType,\r\n            path,\r\n            requestId,\r\n            contentType,\r\n            message.body,\r\n            streamId,\r\n            additionalHeaders,\r\n            message.id);\r\n    }\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\n/**\r\n * The segmentation mode.\r\n */\r\nexport enum SegmentationMode {\r\n    Normal = \"Normal\",\r\n    Disabled = \"Disabled\",\r\n    Custom = \"Custom\",\r\n    Semantic = \"Semantic\"\r\n}\r\n\r\n/**\r\n * Defines the segmentation configuration in the speech Context message\r\n */\r\nexport interface Segmentation {\r\n    /**\r\n     * The segmentation mode.\r\n     */\r\n    mode?: SegmentationMode;\r\n\r\n    /**\r\n     * The segmentation silence timeout in milliseconds.\r\n     */\r\n    segmentationSilenceTimeoutMs?: number;\r\n\r\n    /**\r\n     * The segmentation timeout after which a segmentation is forced,\r\n     * even if speaker is still talking without pause, in milliseconds.\r\n     */\r\n    segmentationForcedTimeoutMs?: number;\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\n/**\r\n * The action to take on success\r\n */\r\nexport enum NextAction {\r\n    None = \"None\",\r\n    Synthesize = \"Synthesize\"\r\n}\r\n\r\n/**\r\n * The on success configuration\r\n */\r\nexport interface OnSuccess {\r\n    /**\r\n     * The action to take on success\r\n     */\r\n    action?: NextAction;\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\n/**\r\n * Result type\r\n */\r\nexport enum Mode {\r\n    None = \"None\",\r\n    Always = \"Always\"\r\n}\r\n\r\n/**\r\n * Interim results\r\n */\r\nexport interface InterimResults {\r\n    /**\r\n     * The mode for interim results\r\n     */\r\n    mode?: Mode;\r\n\r\n    /**\r\n     * If true, intermediate results only contain stable parts\r\n     */\r\n    stableOnly?: boolean;\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\nimport { OnSuccess } from \"./OnSuccess\";\r\nimport { OnUnknown } from \"./OnUnknown\";\r\nimport { LanguageIdOutput } from \"./LanguageIdOutput\";\r\n\r\n/**\r\n * The enum that represents which mode will language detection take place\r\n * There is only detectAtAudioStart mode for now as language detection models are not trained for different modes\r\n * This enum can be extended in future to support different modes\r\n */\r\nexport enum LanguageIdDetectionMode {\r\n    DetectAtAudioStart = \"DetectAtAudioStart\",\r\n    DetectContinuous = \"DetectContinuous\",\r\n    DetectSegments = \"DetectSegments\"\r\n}\r\n\r\n/**\r\n * The language id detection mode, setting this will load the detection setting of MaxAudioDuration and MaxSpeechDuration\r\n * If the maxAudioDuration and maxSpeechDuration is set in the speech.context, then this detection mode will be ignored\r\n */\r\nexport enum LanguageIdDetectionPriority {\r\n    /**\r\n     * default, Service decides the best mode to use.\r\n     */\r\n    Auto = \"Auto\",\r\n\r\n    /**\r\n     * Offers lower latency via a trade-off of accuracy.\r\n     */\r\n    PrioritizeLatency = \"PrioritizeLatency\",\r\n\r\n    /**\r\n     * Offers higher accuracy via a trade-off of latency.\r\n     */\r\n    PrioritizeAccuracy = \"PrioritizeAccuracy\"\r\n}\r\n\r\n/**\r\n * The language id context\r\n */\r\nexport interface LanguageIdContext {\r\n    /**\r\n     * The candidate languages for speaker language detection.\r\n     */\r\n    languages: string[];\r\n\r\n    /**\r\n     * The on success action.\r\n     */\r\n    onSuccess?: OnSuccess;\r\n\r\n    /**\r\n     * The language detection mode.\r\n     */\r\n    mode?: LanguageIdDetectionMode;\r\n\r\n    /**\r\n     * The fallback language.\r\n     */\r\n    onUnknown?: OnUnknown;\r\n\r\n    /**\r\n     * The output\r\n     */\r\n    output?: LanguageIdOutput;\r\n\r\n    /**\r\n     * The max audio duration\r\n     */\r\n    maxAudioDuration?: number;\r\n\r\n    /**\r\n     * The max speech duration\r\n     */\r\n    maxSpeechDuration?: number;\r\n\r\n    /**\r\n     * The priority.\r\n     */\r\n    priority?: LanguageIdDetectionPriority;\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\n/**\r\n * The action to take on successful language detection\r\n */\r\nexport enum NextAction {\r\n    Recognize = \"Recognize\",\r\n    None = \"None\"\r\n}\r\n\r\n/**\r\n * This type defines the OnSuccess configuration for LanguageDetection\r\n */\r\nexport interface OnSuccess {\r\n    /**\r\n     * The action to take on success\r\n     */\r\n    action?: NextAction;\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\n/**\r\n * An enum that defines actions that can be taken on unknown language detection\r\n */\r\nexport enum OnUnknownAction {\r\n    RecognizeWithDefaultLanguage = \"RecognizeWithDefaultLanguage\",\r\n    None = \"None\"\r\n}\r\n\r\n/**\r\n * The on unknown configuration\r\n */\r\nexport interface OnUnknown {\r\n    /**\r\n     * The action to take when language is unknown\r\n     */\r\n    action?: OnUnknownAction;\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\n/**\r\n * The result type enum\r\n */\r\nexport enum ResultType {\r\n    Auto = \"Auto\",\r\n    StableFragment = \"StableFragment\",\r\n    Hypothesis = \"Hypothesis\",\r\n    None = \"None\"\r\n}\r\n\r\n/**\r\n * The interim results\r\n */\r\nexport interface InterimResults {\r\n    /**\r\n     * The result type\r\n     */\r\n    resultType?: ResultType;\r\n\r\n    /**\r\n     * The stable threshold\r\n     */\r\n    stableThreshold?: number;\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\n/**\r\n * The phrase result output type\r\n */\r\nexport enum PhraseResultOutputType {\r\n    Always = \"Always\",\r\n    None = \"None\"\r\n}\r\n\r\n/**\r\n * The phrase results configuration\r\n */\r\nexport interface PhraseResults {\r\n    /**\r\n     * The result type\r\n     */\r\n    resultType?: PhraseResultOutputType;\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\n/**\r\n * The action enum when speech recognition return a final phrase result\r\n */\r\nexport enum NextAction {\r\n    None = \"None\",\r\n    Translate = \"Translate\"\r\n}\r\n\r\n/**\r\n * The on success configuration\r\n */\r\nexport interface OnSuccess {\r\n    /**\r\n     * The action to take on success\r\n     */\r\n    action?: NextAction;\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\nimport { DisfluencyMode } from \"./DisfluencyMode\";\r\n\r\n/**\r\n * The interactive punctuation mode.\r\n */\r\nexport enum InteractivePunctuationMode {\r\n    None = \"None\",\r\n    Implicit = \"Implicit\",\r\n    Explicit = \"Explicit\",\r\n    Intelligent = \"Intelligent\"\r\n}\r\n\r\n/**\r\n * Defines the phrase enrichment options for interactive scenario.\r\n */\r\nexport interface InteractiveEnrichmentOptions {\r\n    /**\r\n     * The punctuation mode.\r\n     */\r\n    punctuationMode?: InteractivePunctuationMode;\r\n\r\n    /**\r\n     * The disfluency mode.\r\n     */\r\n    disfluencyMode?: DisfluencyMode;\r\n\r\n    /**\r\n     * The punctuation mode for intermediate results.\r\n     */\r\n    intermediatePunctuationMode?: InteractivePunctuationMode;\r\n\r\n    /**\r\n     * The disfluency mode for intermediate results.\r\n     */\r\n    intermediateDisfluencyMode?: DisfluencyMode;\r\n\r\n    /**\r\n     * The post processing option passed directly to the service.\r\n     */\r\n    postprocessingoption?: string;\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\nimport { DisfluencyMode } from \"./DisfluencyMode\";\r\n\r\n/**\r\n * The conversation punctuation mode.\r\n */\r\nexport enum ConversationPunctuationMode {\r\n    None = \"None\",\r\n    Intelligent = \"Intelligent\",\r\n    Implicit = \"Implicit\",\r\n    Explicit = \"Explicit\"\r\n}\r\n\r\n/**\r\n * Defines the phrase enrichment options for conversation scenario.\r\n */\r\nexport interface ConversationEnrichmentOptions {\r\n    /**\r\n     * The punctuation mode.\r\n     */\r\n    punctuationMode?: ConversationPunctuationMode;\r\n\r\n    /**\r\n     * The disfluency mode.\r\n     */\r\n    disfluencyMode?: DisfluencyMode;\r\n\r\n    /**\r\n     * The punctuation mode for intermediate results.\r\n     */\r\n    intermediatePunctuationMode?: ConversationPunctuationMode;\r\n\r\n    /**\r\n     * The disfluency mode for intermediate results.\r\n     */\r\n    intermediateDisfluencyMode?: DisfluencyMode;\r\n\r\n    /**\r\n     * The post processing option passed directly to the service.\r\n     */\r\n    postprocessingoption?: string;\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\nimport { DisfluencyMode } from \"./DisfluencyMode\";\r\n\r\n/**\r\n * The dictation punctuation mode.\r\n */\r\nexport enum DictationPunctuationMode {\r\n    None = \"None\",\r\n    Intelligent = \"Intelligent\",\r\n    Implicit = \"Implicit\",\r\n    Explicit = \"Explicit\"\r\n}\r\n\r\n/**\r\n * Defines the phrase enrichment options for dictation scenario.\r\n */\r\nexport interface DictationEnrichmentOptions {\r\n    /**\r\n     * The punctuation mode.\r\n     */\r\n    punctuationMode?: DictationPunctuationMode;\r\n\r\n    /**\r\n     * The disfluency mode.\r\n     */\r\n    disfluencyMode?: DisfluencyMode;\r\n\r\n    /**\r\n     * The punctuation mode for intermediate results.\r\n     */\r\n    intermediatePunctuationMode?: DictationPunctuationMode;\r\n\r\n    /**\r\n     * The disfluency mode for intermediate results.\r\n     */\r\n    intermediateDisfluencyMode?: DisfluencyMode;\r\n\r\n    /**\r\n     * The post processing option passed directly to the service.\r\n     */\r\n    postprocessingoption?: string;\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\n/**\r\n * Disfluency handling options.\r\n */\r\nexport enum DisfluencyMode {\r\n    /**\r\n     * The Microsoft Speech Service does not remove disfluencies from all results.\r\n     */\r\n    Raw = \"Raw\",\r\n\r\n    /**\r\n     * The Microsoft Speech Service removes disfluencies from all results.\r\n     */\r\n    Removed = \"Removed\",\r\n\r\n    /**\r\n     * The Microsoft Speech Service tags disfluencies in the phrase result.\r\n     */\r\n    Labeled = \"Labeled\"\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ReplayableAudioNode } from \"../common.browser/Exports.js\";\r\nimport { ConnectionOpenResponse } from \"../common/ConnectionOpenResponse.js\";\r\nimport {\r\n    ArgumentNullError,\r\n    ConnectionClosedEvent,\r\n    ConnectionEvent,\r\n    ConnectionState,\r\n    createNoDashGuid,\r\n    EventSource,\r\n    IAudioSource,\r\n    IAudioStreamNode,\r\n    IConnection,\r\n    IDisposable,\r\n    IStreamChunk,\r\n    MessageType,\r\n    ServiceEvent,\r\n    Timeout\r\n} from \"../common/Exports.js\";\r\nimport { AudioStreamFormatImpl } from \"../sdk/Audio/AudioStreamFormat.js\";\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    PropertyId,\r\n    RecognitionEventArgs,\r\n    Recognizer,\r\n    SessionEventArgs,\r\n    SpeechRecognitionResult,\r\n    OutputFormat\r\n} from \"../sdk/Exports.js\";\r\nimport { Callback } from \"../sdk/Transcription/IConversation.js\";\r\nimport {\r\n    AgentConfig,\r\n    AutoDetectSourceLanguagesOpenRangeOptionName,\r\n    DynamicGrammarBuilder,\r\n    ISpeechConfigAudioDevice,\r\n    RequestSession,\r\n    SpeechContext,\r\n    SpeechDetected,\r\n    type,\r\n    OutputFormatPropertyName\r\n} from \"./Exports.js\";\r\nimport {\r\n    AuthInfo,\r\n    IAuthentication,\r\n} from \"./IAuthentication.js\";\r\nimport { IConnectionFactory } from \"./IConnectionFactory.js\";\r\nimport { RecognizerConfig } from \"./RecognizerConfig.js\";\r\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal.js\";\r\nimport { Segmentation, SegmentationMode } from \"./ServiceMessages/PhraseDetection/Segmentation.js\";\r\nimport { CustomLanguageMappingEntry, PhraseDetectionContext, RecognitionMode, SpeechStartEventSensitivity } from \"./ServiceMessages/PhraseDetection/PhraseDetectionContext.js\";\r\nimport { NextAction as NextTranslationAction } from \"./ServiceMessages/Translation/OnSuccess.js\";\r\nimport { Mode } from \"./ServiceMessages/Translation/InterimResults.js\";\r\nimport { LanguageIdDetectionMode, LanguageIdDetectionPriority } from \"./ServiceMessages/LanguageId/LanguageIdContext.js\";\r\nimport { NextAction as NextLangaugeIdAction } from \"./ServiceMessages/LanguageId/OnSuccess.js\";\r\nimport { OnUnknownAction } from \"./ServiceMessages/LanguageId/OnUnknown.js\";\r\nimport { ResultType } from \"./ServiceMessages/PhraseOutput/InterimResults.js\";\r\nimport { PhraseResultOutputType } from \"./ServiceMessages/PhraseOutput/PhraseResults.js\";\r\nimport { NextAction as NextPhraseDetectionAction } from \"./ServiceMessages/PhraseDetection/OnSuccess.js\";\r\nimport { InteractivePunctuationMode } from \"./ServiceMessages/PhraseDetection/InteractiveEnrichmentOptions.js\";\r\nimport { ConversationPunctuationMode } from \"./ServiceMessages/PhraseDetection/ConversationEnrichmentOptions.js\";\r\nimport { DictationPunctuationMode } from \"./ServiceMessages/PhraseDetection/DictationEnrichmentOptions.js\";\r\nimport { DisfluencyMode } from \"./ServiceMessages/PhraseDetection/DisfluencyMode.js\";\r\n\r\nexport abstract class ServiceRecognizerBase implements IDisposable {\r\n    private privAuthentication: IAuthentication;\r\n    private privConnectionFactory: IConnectionFactory;\r\n\r\n    // A promise for a configured connection.\r\n    // Do not consume directly, call fetchConnection instead.\r\n    private privConnectionConfigurationPromise?: Promise<IConnection> = undefined;\r\n\r\n    // A promise for a connection, but one that has not had the speech context sent yet.\r\n    // Do not consume directly, call fetchConnection instead.\r\n    private privConnectionPromise?: Promise<IConnection> = undefined;\r\n    private privAuthFetchEventId: string;\r\n    private privIsDisposed: boolean;\r\n    private privMustReportEndOfStream: boolean;\r\n    private privConnectionEvents: EventSource<ConnectionEvent>;\r\n    private privServiceEvents: EventSource<ServiceEvent>;\r\n    private privDynamicGrammar: DynamicGrammarBuilder;\r\n    private privAgentConfig: AgentConfig;\r\n    private privServiceHasSentMessage: boolean;\r\n    private privActivityTemplate: string;\r\n    private privSetTimeout: (cb: () => void, delay: number) => number = setTimeout;\r\n    private privAudioSource: IAudioSource;\r\n    private privIsLiveAudio: boolean = false;\r\n    private privAverageBytesPerMs: number = 0;\r\n    protected privSpeechContext: SpeechContext;\r\n    protected privRequestSession: RequestSession;\r\n    protected privConnectionId?: string | null;\r\n    protected privDiarizationSessionId: string;\r\n    protected privRecognizerConfig: RecognizerConfig;\r\n    protected privRecognizer: Recognizer;\r\n    protected privSuccessCallback: (e: SpeechRecognitionResult) => void;\r\n    protected privErrorCallback: (e: string) => void;\r\n    protected privEnableSpeakerId: boolean = false;\r\n    protected privExpectContentAssessmentResponse: boolean = false;\r\n\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioSource: IAudioSource,\r\n        recognizerConfig: RecognizerConfig,\r\n        recognizer: Recognizer) {\r\n\r\n        if (!authentication) {\r\n            throw new ArgumentNullError(\"authentication\");\r\n        }\r\n\r\n        if (!connectionFactory) {\r\n            throw new ArgumentNullError(\"connectionFactory\");\r\n        }\r\n\r\n        if (!audioSource) {\r\n            throw new ArgumentNullError(\"audioSource\");\r\n        }\r\n\r\n        if (!recognizerConfig) {\r\n            throw new ArgumentNullError(\"recognizerConfig\");\r\n        }\r\n\r\n        this.privEnableSpeakerId = recognizerConfig.isSpeakerDiarizationEnabled;\r\n        this.privMustReportEndOfStream = false;\r\n        this.privAuthentication = authentication;\r\n        this.privConnectionFactory = connectionFactory;\r\n        this.privAudioSource = audioSource;\r\n        this.privRecognizerConfig = recognizerConfig;\r\n        this.privIsDisposed = false;\r\n        this.privRecognizer = recognizer;\r\n        this.privRequestSession = new RequestSession(this.privAudioSource.id());\r\n        this.privConnectionEvents = new EventSource<ConnectionEvent>();\r\n        this.privServiceEvents = new EventSource<ServiceEvent>();\r\n        this.privDynamicGrammar = new DynamicGrammarBuilder();\r\n        this.privSpeechContext = new SpeechContext(this.privDynamicGrammar);\r\n        this.privAgentConfig = new AgentConfig();\r\n        const webWorkerLoadType: string = this.privRecognizerConfig.parameters.getProperty(PropertyId.WebWorkerLoadType, \"on\").toLowerCase();\r\n        if (webWorkerLoadType === \"on\" && typeof (Blob) !== \"undefined\" && typeof (Worker) !== \"undefined\") {\r\n            this.privSetTimeout = Timeout.setTimeout;\r\n        } else {\r\n            if (typeof window !== \"undefined\") {\r\n                // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\r\n                this.privSetTimeout = window.setTimeout.bind(window);\r\n            }\r\n            if (typeof globalThis !== \"undefined\") {\r\n                // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\r\n                this.privSetTimeout = globalThis.setTimeout.bind(globalThis);\r\n            }\r\n        }\r\n\r\n        this.connectionEvents.attach((connectionEvent: ConnectionEvent): void => {\r\n            if (connectionEvent.name === \"ConnectionClosedEvent\") {\r\n                const connectionClosedEvent = connectionEvent as ConnectionClosedEvent;\r\n                if (connectionClosedEvent.statusCode === 1003 ||\r\n                    connectionClosedEvent.statusCode === 1007 ||\r\n                    connectionClosedEvent.statusCode === 1002 ||\r\n                    connectionClosedEvent.statusCode === 4000 ||\r\n                    this.privRequestSession.numConnectionAttempts > this.privRecognizerConfig.maxRetryCount\r\n                ) {\r\n                    void this.cancelRecognitionLocal(CancellationReason.Error,\r\n                        connectionClosedEvent.statusCode === 1007 ? CancellationErrorCode.BadRequestParameters : CancellationErrorCode.ConnectionFailure,\r\n                        `${connectionClosedEvent.reason} websocket error code: ${connectionClosedEvent.statusCode}`);\r\n                }\r\n            }\r\n        });\r\n\r\n        if (this.privEnableSpeakerId) {\r\n            this.privDiarizationSessionId = createNoDashGuid();\r\n        }\r\n    }\r\n\r\n    protected setTranslationJson(): void {\r\n        const targetLanguages: string = this.privRecognizerConfig.parameters.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages, undefined);\r\n        if (targetLanguages !== undefined) {\r\n            const languages = targetLanguages.split(\",\");\r\n            const translationVoice: string = this.privRecognizerConfig.parameters.getProperty(PropertyId.SpeechServiceConnection_TranslationVoice, undefined);\r\n            const categoryId: string = this.privRecognizerConfig.parameters.getProperty(PropertyId.SpeechServiceConnection_TranslationCategoryId, undefined);\r\n\r\n            const action = (translationVoice !== undefined) ? NextTranslationAction.Synthesize : NextTranslationAction.None;\r\n\r\n            this.privSpeechContext.getContext().translation = {\r\n                onPassthrough: { action },  // Add onPassthrough with same action\r\n                onSuccess: { action },\r\n                output: {\r\n                    includePassThroughResults: true,  // Explicitly set pass-through results\r\n                    interimResults: { mode: Mode.Always }\r\n                },\r\n                targetLanguages: languages,\r\n            };\r\n\r\n            // Add category if specified\r\n            if (categoryId !== undefined) {\r\n                this.privSpeechContext.getContext().translation.category = categoryId;\r\n            }\r\n\r\n            if (translationVoice !== undefined) {\r\n                const languageToVoiceMap: { [key: string]: string } = {};\r\n                for (const lang of languages) {\r\n                    languageToVoiceMap[lang] = translationVoice;\r\n                }\r\n                this.privSpeechContext.getContext().synthesis = {\r\n                    defaultVoices: languageToVoiceMap\r\n                };\r\n            }\r\n\r\n            // Configure phrase detection for translation\r\n            const phraseDetection = this.privSpeechContext.getContext().phraseDetection || {};\r\n            phraseDetection.onSuccess = { action: NextPhraseDetectionAction.Translate };\r\n            phraseDetection.onInterim = { action: NextPhraseDetectionAction.Translate };\r\n            this.privSpeechContext.getContext().phraseDetection = phraseDetection;\r\n        }\r\n    }\r\n\r\n    protected setSpeechSegmentationTimeoutJson(): void {\r\n        const speechSegmentationSilenceTimeoutMs: string = this.privRecognizerConfig.parameters.getProperty(PropertyId.Speech_SegmentationSilenceTimeoutMs, undefined);\r\n        const speechSegmentationMaximumTimeMs: string = this.privRecognizerConfig.parameters.getProperty(PropertyId.Speech_SegmentationMaximumTimeMs, undefined);\r\n        const speechSegmentationStrategy: string = this.privRecognizerConfig.parameters.getProperty(PropertyId.Speech_SegmentationStrategy, undefined);\r\n        const segmentation: Segmentation = {\r\n            mode: SegmentationMode.Normal,\r\n        };\r\n\r\n        let configuredSegment = false;\r\n\r\n        if (speechSegmentationStrategy !== undefined) {\r\n            configuredSegment = true;\r\n            let segMode: SegmentationMode = SegmentationMode.Normal;\r\n            switch (speechSegmentationStrategy.toLowerCase()) {\r\n                case \"default\":\r\n                    break;\r\n                case \"time\":\r\n                    segMode = SegmentationMode.Custom;\r\n                    break;\r\n                case \"semantic\":\r\n                    segMode = SegmentationMode.Semantic;\r\n                    break;\r\n            }\r\n\r\n            segmentation.mode = segMode;\r\n        }\r\n\r\n        if (speechSegmentationSilenceTimeoutMs !== undefined) {\r\n            configuredSegment = true;\r\n            const segmentationSilenceTimeoutMs: number = parseInt(speechSegmentationSilenceTimeoutMs, 10);\r\n            segmentation.mode = SegmentationMode.Custom;\r\n            segmentation.segmentationSilenceTimeoutMs = segmentationSilenceTimeoutMs;\r\n        }\r\n\r\n        if (speechSegmentationMaximumTimeMs !== undefined) {\r\n            configuredSegment = true;\r\n            const segmentationMaximumTimeMs: number = parseInt(speechSegmentationMaximumTimeMs, 10);\r\n            segmentation.mode = SegmentationMode.Custom;\r\n            segmentation.segmentationForcedTimeoutMs = segmentationMaximumTimeMs;\r\n        }\r\n\r\n        if (configuredSegment) {\r\n            const phraseDetection: PhraseDetectionContext = this.privSpeechContext.getContext().phraseDetection || {};\r\n            phraseDetection.mode = this.recognitionMode;\r\n\r\n            switch (this.recognitionMode) {\r\n                case RecognitionMode.Conversation:\r\n                    phraseDetection.conversation = phraseDetection.conversation ?? { segmentation: {} };\r\n                    phraseDetection.conversation.segmentation = segmentation;\r\n\r\n                    break;\r\n                case RecognitionMode.Interactive:\r\n                    phraseDetection.interactive = phraseDetection.interactive ?? { segmentation: {} };\r\n                    phraseDetection.interactive.segmentation = segmentation;\r\n                    break;\r\n                case RecognitionMode.Dictation:\r\n                    phraseDetection.dictation = phraseDetection.dictation ?? {};\r\n                    phraseDetection.dictation.segmentation = segmentation;\r\n\r\n                    break;\r\n            }\r\n            this.privSpeechContext.getContext().phraseDetection = phraseDetection;\r\n        }\r\n    }\r\n\r\n    protected setLanguageIdJson(): void {\r\n        const phraseDetection: PhraseDetectionContext = this.privSpeechContext.getContext().phraseDetection || {};\r\n        if (this.privRecognizerConfig.autoDetectSourceLanguages !== undefined) {\r\n            const sourceLanguages: string[] = this.privRecognizerConfig.autoDetectSourceLanguages.split(\",\");\r\n\r\n            if (sourceLanguages.length === 1 && sourceLanguages[0] === AutoDetectSourceLanguagesOpenRangeOptionName) {\r\n                sourceLanguages[0] = \"UND\";\r\n            }\r\n\r\n            let speechContextLidMode;\r\n            if (this.privRecognizerConfig.languageIdMode === \"Continuous\") {\r\n                speechContextLidMode = LanguageIdDetectionMode.DetectContinuous;\r\n            } else {// recognizerConfig.languageIdMode === \"AtStart\"\r\n                speechContextLidMode = LanguageIdDetectionMode.DetectAtAudioStart;\r\n            }\r\n\r\n            this.privSpeechContext.getContext().languageId = {\r\n                languages: sourceLanguages,\r\n                mode: speechContextLidMode,\r\n                onSuccess: { action: NextLangaugeIdAction.Recognize },\r\n                onUnknown: { action: OnUnknownAction.None },\r\n                priority: LanguageIdDetectionPriority.PrioritizeLatency\r\n            };\r\n            this.privSpeechContext.getContext().phraseOutput = {\r\n                interimResults: {\r\n                    resultType: ResultType.Auto\r\n                },\r\n                phraseResults: {\r\n                    resultType: PhraseResultOutputType.Always\r\n                }\r\n            };\r\n            const customModels: CustomLanguageMappingEntry[] = this.privRecognizerConfig.sourceLanguageModels;\r\n            if (customModels !== undefined) {\r\n                phraseDetection.customModels = customModels;\r\n                phraseDetection.onInterim = { action: NextPhraseDetectionAction.None };\r\n                phraseDetection.onSuccess = { action: NextPhraseDetectionAction.None };\r\n            }\r\n        }\r\n        // No longer setting translation-specific configuration here\r\n        // This is now handled in setTranslationJson and setupTranslationWithLanguageId methods\r\n\r\n        this.privSpeechContext.getContext().phraseDetection = phraseDetection;\r\n    }\r\n\r\n    protected setOutputDetailLevelJson(): void {\r\n        const requestWordLevelTimestamps: string = this.privRecognizerConfig.parameters.getProperty(PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps, \"false\").toLowerCase();\r\n        if (requestWordLevelTimestamps === \"true\") {\r\n            this.privSpeechContext.setWordLevelTimings();\r\n        } else {\r\n            const outputFormat: string = this.privRecognizerConfig.parameters.getProperty(OutputFormatPropertyName, OutputFormat[OutputFormat.Simple]).toLowerCase();\r\n            if (outputFormat === OutputFormat[OutputFormat.Detailed].toLocaleLowerCase()) {\r\n                this.privSpeechContext.setDetailedOutputFormat();\r\n            }\r\n        }\r\n    }\r\n\r\n    protected setSpeechStartEventSensitivityJson(): void {\r\n        const sensitivity: string = this.privRecognizerConfig.parameters.getProperty(PropertyId.Speech_StartEventSensitivity, undefined);\r\n\r\n        if (sensitivity !== undefined) {\r\n            let configuredSensitivity = false;\r\n            switch (sensitivity.toLowerCase()) {\r\n                case SpeechStartEventSensitivity.Low:\r\n                case SpeechStartEventSensitivity.Medium:\r\n                case SpeechStartEventSensitivity.High:\r\n                    configuredSensitivity = true;\r\n                    break;\r\n            }\r\n\r\n            if (configuredSensitivity) {\r\n                const phraseDetection: PhraseDetectionContext = this.privSpeechContext.getContext().phraseDetection || {};\r\n                phraseDetection.voiceOnsetSensitivity = sensitivity.toLowerCase();\r\n                this.privSpeechContext.getContext().phraseDetection = phraseDetection;\r\n            }\r\n        }\r\n    }\r\n\r\n    protected setPostProcessingOptionJson(): void {\r\n        const postProcessingOption: string = this.privRecognizerConfig.parameters.getProperty(PropertyId.SpeechServiceResponse_PostProcessingOption, undefined);\r\n        if (postProcessingOption !== undefined) {\r\n            const phraseDetection: PhraseDetectionContext = this.privSpeechContext.getContext().phraseDetection || {};\r\n            phraseDetection.enrichment = phraseDetection.enrichment || {};\r\n\r\n            if (postProcessingOption.toLowerCase() === \"truetext\") {\r\n                // Client-side expansion for \"truetext\" - set specific properties\r\n                switch (this.recognitionMode) {\r\n                    case RecognitionMode.Conversation:\r\n                        phraseDetection.enrichment.conversation = phraseDetection.enrichment.conversation || {};\r\n                        phraseDetection.enrichment.conversation.punctuationMode = ConversationPunctuationMode.Implicit;\r\n                        phraseDetection.enrichment.conversation.disfluencyMode = DisfluencyMode.Removed;\r\n                        phraseDetection.enrichment.conversation.intermediatePunctuationMode = ConversationPunctuationMode.Implicit;\r\n                        (phraseDetection.enrichment.conversation as Record<string, unknown>).intermediatedisfluencymode = DisfluencyMode.Removed;\r\n                        break;\r\n                    case RecognitionMode.Interactive:\r\n                        phraseDetection.enrichment.interactive = phraseDetection.enrichment.interactive || {};\r\n                        phraseDetection.enrichment.interactive.punctuationMode = InteractivePunctuationMode.Implicit;\r\n                        phraseDetection.enrichment.interactive.disfluencyMode = DisfluencyMode.Removed;\r\n                        phraseDetection.enrichment.interactive.intermediatePunctuationMode = InteractivePunctuationMode.Implicit;\r\n                        (phraseDetection.enrichment.interactive as Record<string, unknown>).intermediatedisfluencymode = DisfluencyMode.Removed;\r\n                        break;\r\n                    case RecognitionMode.Dictation:\r\n                        phraseDetection.enrichment.dictation = phraseDetection.enrichment.dictation || {};\r\n                        phraseDetection.enrichment.dictation.punctuationMode = DictationPunctuationMode.Implicit;\r\n                        phraseDetection.enrichment.dictation.disfluencyMode = DisfluencyMode.Removed;\r\n                        phraseDetection.enrichment.dictation.intermediatePunctuationMode = DictationPunctuationMode.Implicit;\r\n                        (phraseDetection.enrichment.dictation as Record<string, unknown>).intermediatedisfluencymode = DisfluencyMode.Removed;\r\n                        break;\r\n                }\r\n                // Don't set postprocessingoption - we've expanded \"truetext\" into specific settings\r\n            } else {\r\n                // Service-side handling for all other strings\r\n                // Pass the developer-provided value directly to the service.\r\n                // Input validation is handled on the service side.\r\n                switch (this.recognitionMode) {\r\n                    case RecognitionMode.Conversation:\r\n                        phraseDetection.enrichment.conversation = phraseDetection.enrichment.conversation || {};\r\n                        phraseDetection.enrichment.conversation.postprocessingoption = postProcessingOption;\r\n                        break;\r\n                    case RecognitionMode.Interactive:\r\n                        phraseDetection.enrichment.interactive = phraseDetection.enrichment.interactive || {};\r\n                        phraseDetection.enrichment.interactive.postprocessingoption = postProcessingOption;\r\n                        break;\r\n                    case RecognitionMode.Dictation:\r\n                        phraseDetection.enrichment.dictation = phraseDetection.enrichment.dictation || {};\r\n                        phraseDetection.enrichment.dictation.postprocessingoption = postProcessingOption;\r\n                        break;\r\n                }\r\n            }\r\n\r\n            this.privSpeechContext.getContext().phraseDetection = phraseDetection;\r\n        }\r\n    }\r\n\r\n    public get isSpeakerDiarizationEnabled(): boolean {\r\n        return this.privEnableSpeakerId;\r\n    }\r\n\r\n    public get audioSource(): IAudioSource {\r\n        return this.privAudioSource;\r\n    }\r\n\r\n    public get speechContext(): SpeechContext {\r\n        return this.privSpeechContext;\r\n    }\r\n\r\n    public get dynamicGrammar(): DynamicGrammarBuilder {\r\n        return this.privDynamicGrammar;\r\n    }\r\n\r\n    public get agentConfig(): AgentConfig {\r\n        return this.privAgentConfig;\r\n    }\r\n\r\n    public set conversationTranslatorToken(token: string) {\r\n        this.privRecognizerConfig.parameters.setProperty(PropertyId.ConversationTranslator_Token, token);\r\n    }\r\n\r\n    public set authentication(auth: IAuthentication) {\r\n        this.privAuthentication = auth;\r\n    }\r\n\r\n    public isDisposed(): boolean {\r\n        return this.privIsDisposed;\r\n    }\r\n\r\n    public async dispose(reason?: string): Promise<void> {\r\n        this.privIsDisposed = true;\r\n        if (this.privConnectionPromise !== undefined) {\r\n            try {\r\n                const connection: IConnection = await this.privConnectionPromise;\r\n                await connection.dispose(reason);\r\n            } catch (error) {\r\n                // The connection is in a bad state. But we're trying to kill it, so...\r\n                return;\r\n            }\r\n        }\r\n    }\r\n\r\n    public get connectionEvents(): EventSource<ConnectionEvent> {\r\n        return this.privConnectionEvents;\r\n    }\r\n\r\n    public get serviceEvents(): EventSource<ServiceEvent> {\r\n        return this.privServiceEvents;\r\n    }\r\n\r\n    public get recognitionMode(): RecognitionMode {\r\n        return this.privRecognizerConfig.recognitionMode;\r\n    }\r\n\r\n    protected recognizeOverride: (recoMode: RecognitionMode, sc: (e: SpeechRecognitionResult) => void, ec: (e: string) => void) => Promise<void> = undefined;\r\n\r\n    public async recognize(\r\n        recoMode: RecognitionMode,\r\n        successCallback: (e: SpeechRecognitionResult) => void,\r\n        errorCallBack: (e: string) => void,\r\n    ): Promise<void> {\r\n\r\n        if (this.recognizeOverride !== undefined) {\r\n            await this.recognizeOverride(recoMode, successCallback, errorCallBack);\r\n            return;\r\n        }\r\n        // Clear the existing configuration promise to force a re-transmission of config and context.\r\n        this.privConnectionConfigurationPromise = undefined;\r\n        this.privRecognizerConfig.recognitionMode = recoMode;\r\n\r\n        if (this.privRecognizerConfig.recognitionEndpointVersion === \"2\") {\r\n            const phraseDetection: PhraseDetectionContext = this.privSpeechContext.getContext().phraseDetection || {};\r\n            phraseDetection.mode = recoMode;\r\n            this.privSpeechContext.getContext().phraseDetection = phraseDetection;\r\n        }\r\n\r\n        // Set language ID (if configured)\r\n        this.setLanguageIdJson();\r\n\r\n        // Then set translation (if configured)\r\n        this.setTranslationJson();\r\n\r\n        // Configure the integration between language ID and translation (if both are used)\r\n        if (this.privRecognizerConfig.autoDetectSourceLanguages !== undefined &&\r\n            this.privRecognizerConfig.parameters.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages, undefined) !== undefined) {\r\n            this.setupTranslationWithLanguageId();\r\n        }\r\n\r\n        this.setSpeechSegmentationTimeoutJson();\r\n        this.setOutputDetailLevelJson();\r\n        this.setSpeechStartEventSensitivityJson();\r\n        this.setPostProcessingOptionJson();\r\n\r\n        this.privSuccessCallback = successCallback;\r\n        this.privErrorCallback = errorCallBack;\r\n\r\n        this.privRequestSession.startNewRecognition();\r\n        this.privRequestSession.listenForServiceTelemetry(this.privAudioSource.events);\r\n\r\n        // Start the connection to the service. The promise this will create is stored and will be used by configureConnection().\r\n        const conPromise: Promise<IConnection> = this.connectImpl();\r\n        let audioNode: ReplayableAudioNode;\r\n\r\n        try {\r\n            const audioStreamNode: IAudioStreamNode = await this.audioSource.attach(this.privRequestSession.audioNodeId);\r\n            const format: AudioStreamFormatImpl = await this.audioSource.format;\r\n            const deviceInfo: ISpeechConfigAudioDevice = await this.audioSource.deviceInfo;\r\n            this.privIsLiveAudio = deviceInfo.type && deviceInfo.type === type.Microphones;\r\n\r\n            audioNode = new ReplayableAudioNode(audioStreamNode, format.avgBytesPerSec);\r\n            await this.privRequestSession.onAudioSourceAttachCompleted(audioNode, false);\r\n            this.privRecognizerConfig.SpeechServiceConfig.Context.audio = { source: deviceInfo };\r\n\r\n        } catch (error) {\r\n            await this.privRequestSession.onStopRecognizing();\r\n            throw error;\r\n        }\r\n\r\n        try {\r\n            await conPromise;\r\n        } catch (error) {\r\n            await this.cancelRecognitionLocal(CancellationReason.Error, CancellationErrorCode.ConnectionFailure, error as string);\r\n            return;\r\n        }\r\n\r\n        const sessionStartEventArgs: SessionEventArgs = new SessionEventArgs(this.privRequestSession.sessionId);\r\n\r\n        if (!!this.privRecognizer.sessionStarted) {\r\n            this.privRecognizer.sessionStarted(this.privRecognizer, sessionStartEventArgs);\r\n        }\r\n\r\n        void this.receiveMessage();\r\n        const audioSendPromise = this.sendAudio(audioNode);\r\n\r\n        audioSendPromise.catch(async (error: string): Promise<void> => {\r\n            await this.cancelRecognitionLocal(CancellationReason.Error, CancellationErrorCode.RuntimeError, error);\r\n        });\r\n\r\n        return;\r\n    }\r\n\r\n    public async stopRecognizing(): Promise<void> {\r\n        if (this.privRequestSession.isRecognizing) {\r\n            try {\r\n                await this.audioSource.turnOff();\r\n                await this.sendFinalAudio();\r\n                await this.privRequestSession.onStopRecognizing();\r\n                await this.privRequestSession.turnCompletionPromise;\r\n            } finally {\r\n                await this.privRequestSession.dispose();\r\n            }\r\n        }\r\n        return;\r\n    }\r\n\r\n    public async connect(): Promise<void> {\r\n        await this.connectImpl();\r\n        return Promise.resolve();\r\n    }\r\n\r\n    public connectAsync(cb?: Callback, err?: Callback): void {\r\n        this.connectImpl().then((): void => {\r\n            try {\r\n                if (!!cb) {\r\n                    cb();\r\n                }\r\n            } catch (e) {\r\n                if (!!err) {\r\n                    err(e);\r\n                }\r\n            }\r\n        }, (reason: any): void => {\r\n            try {\r\n                if (!!err) {\r\n                    err(reason);\r\n                }\r\n                /* eslint-disable no-empty */\r\n            } catch (error) {\r\n            }\r\n        });\r\n    }\r\n\r\n    protected disconnectOverride: () => Promise<void> = undefined;\r\n\r\n    public async disconnect(): Promise<void> {\r\n        await this.cancelRecognitionLocal(CancellationReason.Error,\r\n            CancellationErrorCode.NoError,\r\n            \"Disconnecting\");\r\n\r\n        if (this.disconnectOverride !== undefined) {\r\n            await this.disconnectOverride();\r\n        }\r\n\r\n        if (this.privConnectionPromise !== undefined) {\r\n            try {\r\n                await (await this.privConnectionPromise).dispose();\r\n            } catch (error) {\r\n\r\n            }\r\n        }\r\n        this.privConnectionPromise = undefined;\r\n    }\r\n\r\n    // Called when telemetry data is sent to the service.\r\n    // Used for testing Telemetry capture.\r\n    public static telemetryData: (json: string) => void;\r\n    public static telemetryDataEnabled: boolean = true;\r\n\r\n    // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n    public sendMessage(message: string): Promise<void> {\r\n        return;\r\n    }\r\n\r\n    public async sendNetworkMessage(path: string, payload: string | ArrayBuffer): Promise<void> {\r\n        const type: MessageType = typeof payload === \"string\" ? MessageType.Text : MessageType.Binary;\r\n        const contentType: string = typeof payload === \"string\" ? \"application/json\" : \"\";\r\n\r\n        const connection: IConnection = await this.fetchConnection();\r\n        return connection.send(new SpeechConnectionMessage(type, path, this.privRequestSession.requestId, contentType, payload));\r\n    }\r\n\r\n    public set activityTemplate(messagePayload: string) {\r\n        this.privActivityTemplate = messagePayload;\r\n    }\r\n\r\n    public get activityTemplate(): string {\r\n        return this.privActivityTemplate;\r\n    }\r\n\r\n    public set expectContentAssessmentResponse(value: boolean) {\r\n        this.privExpectContentAssessmentResponse = value;\r\n    }\r\n\r\n    protected abstract processTypeSpecificMessages(\r\n        connectionMessage: SpeechConnectionMessage,\r\n        successCallback?: (e: SpeechRecognitionResult) => void,\r\n        errorCallBack?: (e: string) => void): Promise<boolean>;\r\n\r\n    protected async sendTelemetryData(): Promise<void> {\r\n        const telemetryData = this.privRequestSession.getTelemetry();\r\n        if (ServiceRecognizerBase.telemetryDataEnabled !== true ||\r\n            this.privIsDisposed ||\r\n            null === telemetryData) {\r\n            return;\r\n        }\r\n\r\n        if (!!ServiceRecognizerBase.telemetryData) {\r\n            try {\r\n                ServiceRecognizerBase.telemetryData(telemetryData);\r\n                /* eslint-disable no-empty */\r\n            } catch { }\r\n        }\r\n\r\n        const connection: IConnection = await this.fetchConnection();\r\n        await connection.send(new SpeechConnectionMessage(\r\n            MessageType.Text,\r\n            \"telemetry\",\r\n            this.privRequestSession.requestId,\r\n            \"application/json\",\r\n            telemetryData));\r\n    }\r\n\r\n    // Cancels recognition.\r\n    protected abstract cancelRecognition(\r\n        sessionId: string,\r\n        requestId: string,\r\n        cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): void;\r\n\r\n    // Cancels recognition.\r\n    protected async cancelRecognitionLocal(\r\n        cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): Promise<void> {\r\n\r\n        if (!!this.privRequestSession.isRecognizing) {\r\n            await this.privRequestSession.onStopRecognizing();\r\n\r\n            this.cancelRecognition(\r\n                this.privRequestSession.sessionId,\r\n                this.privRequestSession.requestId,\r\n                cancellationReason,\r\n                errorCode,\r\n                error);\r\n        }\r\n    }\r\n\r\n    protected receiveMessageOverride: () => Promise<void> = undefined;\r\n\r\n    protected async receiveMessage(): Promise<void> {\r\n        try {\r\n            if (this.privIsDisposed) {\r\n                // We're done.\r\n                return;\r\n            }\r\n\r\n            let connection = await this.fetchConnection();\r\n            const message = await connection.read();\r\n\r\n            if (this.receiveMessageOverride !== undefined) {\r\n                return this.receiveMessageOverride();\r\n            }\r\n\r\n            // indicates we are draining the queue and it came with no message;\r\n            if (!message) {\r\n                return this.receiveMessage();\r\n            }\r\n\r\n            this.privServiceHasSentMessage = true;\r\n            const connectionMessage = SpeechConnectionMessage.fromConnectionMessage(message);\r\n\r\n            if (connectionMessage.requestId.toLowerCase() === this.privRequestSession.requestId.toLowerCase()) {\r\n                switch (connectionMessage.path.toLowerCase()) {\r\n                    case \"turn.start\":\r\n                        this.privMustReportEndOfStream = true;\r\n                        this.privRequestSession.onServiceTurnStartResponse();\r\n                        break;\r\n\r\n                    case \"speech.startdetected\":\r\n                        const speechStartDetected: SpeechDetected = SpeechDetected.fromJSON(connectionMessage.textBody, this.privRequestSession.currentTurnAudioOffset);\r\n                        const speechStartEventArgs = new RecognitionEventArgs(speechStartDetected.Offset, this.privRequestSession.sessionId);\r\n                        if (!!this.privRecognizer.speechStartDetected) {\r\n                            this.privRecognizer.speechStartDetected(this.privRecognizer, speechStartEventArgs);\r\n                        }\r\n                        break;\r\n\r\n                    case \"speech.enddetected\":\r\n                        let json: string;\r\n                        if (connectionMessage.textBody.length > 0) {\r\n                            json = connectionMessage.textBody;\r\n                        } else {\r\n                            // If the request was empty, the JSON returned is empty.\r\n                            json = \"{ Offset: 0 }\";\r\n                        }\r\n                        const speechStopDetected: SpeechDetected = SpeechDetected.fromJSON(json, this.privRequestSession.currentTurnAudioOffset);\r\n                        const speechStopEventArgs = new RecognitionEventArgs(speechStopDetected.Offset + this.privRequestSession.currentTurnAudioOffset, this.privRequestSession.sessionId);\r\n                        if (!!this.privRecognizer.speechEndDetected) {\r\n                            this.privRecognizer.speechEndDetected(this.privRecognizer, speechStopEventArgs);\r\n                        }\r\n                        break;\r\n\r\n                    case \"turn.end\":\r\n                        await this.sendTelemetryData();\r\n                        if (this.privRequestSession.isSpeechEnded && this.privMustReportEndOfStream) {\r\n                            this.privMustReportEndOfStream = false;\r\n                            await this.cancelRecognitionLocal(CancellationReason.EndOfStream, CancellationErrorCode.NoError, undefined);\r\n                        }\r\n                        const sessionStopEventArgs: SessionEventArgs = new SessionEventArgs(this.privRequestSession.sessionId);\r\n                        await this.privRequestSession.onServiceTurnEndResponse(this.privRecognizerConfig.isContinuousRecognition);\r\n                        if (!this.privRecognizerConfig.isContinuousRecognition || this.privRequestSession.isSpeechEnded || !this.privRequestSession.isRecognizing) {\r\n                            if (!!this.privRecognizer.sessionStopped) {\r\n                                this.privRecognizer.sessionStopped(this.privRecognizer, sessionStopEventArgs);\r\n                            }\r\n                            return;\r\n                        } else {\r\n                            connection = await this.fetchConnection();\r\n                            await this.sendPrePayloadJSON(connection);\r\n                        }\r\n                        break;\r\n\r\n                    default:\r\n                        if (!await this.processTypeSpecificMessages(connectionMessage)) {\r\n                            // here are some messages that the derived class has not processed, dispatch them to connect class\r\n                            if (!!this.privServiceEvents) {\r\n                                this.serviceEvents.onEvent(new ServiceEvent(connectionMessage.path.toLowerCase(), connectionMessage.textBody));\r\n                            }\r\n                        }\r\n                }\r\n            }\r\n            return this.receiveMessage();\r\n        } catch (error) {\r\n            return null;\r\n        }\r\n    }\r\n\r\n    private updateSpeakerDiarizationAudioOffset(): void {\r\n        const bytesSent: number = this.privRequestSession.recognitionBytesSent;\r\n        const audioOffsetMs: number = this.privAverageBytesPerMs !== 0 ? bytesSent / this.privAverageBytesPerMs : 0;\r\n        this.privSpeechContext.setSpeakerDiarizationAudioOffsetMs(audioOffsetMs);\r\n    }\r\n\r\n    protected sendSpeechContext(connection: IConnection, generateNewRequestId: boolean): Promise<void> {\r\n        if (this.privEnableSpeakerId) {\r\n            this.updateSpeakerDiarizationAudioOffset();\r\n        }\r\n\r\n        const speechContextJson = this.speechContext.toJSON();\r\n        if (generateNewRequestId) {\r\n            this.privRequestSession.onSpeechContext();\r\n        }\r\n\r\n        if (speechContextJson) {\r\n            return connection.send(new SpeechConnectionMessage(\r\n                MessageType.Text,\r\n                \"speech.context\",\r\n                this.privRequestSession.requestId,\r\n                \"application/json\",\r\n                speechContextJson));\r\n        }\r\n        return;\r\n    }\r\n\r\n    protected sendPrePayloadJSONOverride: (connection: IConnection) => Promise<void> = undefined;\r\n\r\n    protected setupTranslationWithLanguageId(): void {\r\n        const targetLanguages: string = this.privRecognizerConfig.parameters.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages, undefined);\r\n        const hasLanguageId = this.privRecognizerConfig.autoDetectSourceLanguages !== undefined;\r\n\r\n        if (targetLanguages !== undefined && hasLanguageId) {\r\n            // Configure phraseOutput for translation + language ID scenario\r\n            this.privSpeechContext.getContext().phraseOutput = {\r\n                interimResults: {\r\n                    resultType: ResultType.None\r\n                },\r\n                phraseResults: {\r\n                    resultType: PhraseResultOutputType.None\r\n                }\r\n            };\r\n\r\n            // Handle custom language models and voice mapping\r\n            const translationContext = this.privSpeechContext.getContext().translation;\r\n            if (translationContext) {\r\n                const customModels = this.privRecognizerConfig.sourceLanguageModels;\r\n                if (customModels !== undefined && customModels.length > 0) {\r\n                    const phraseDetection = this.privSpeechContext.getContext().phraseDetection || {};\r\n                    phraseDetection.customModels = customModels;\r\n                    this.privSpeechContext.getContext().phraseDetection = phraseDetection;\r\n                }\r\n\r\n                const translationVoice = this.privRecognizerConfig.parameters.getProperty(\r\n                    PropertyId.SpeechServiceConnection_TranslationVoice, undefined);\r\n\r\n                if (translationVoice !== undefined) {\r\n                    // Update translation actions for synthesis\r\n                    translationContext.onSuccess = { action: NextTranslationAction.Synthesize };\r\n                    translationContext.onPassthrough = { action: NextTranslationAction.Synthesize };\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    protected noOp(): Promise<void> {\r\n        // operation not supported\r\n        return;\r\n    }\r\n\r\n    // Encapsulated for derived service recognizers that need to send additional JSON\r\n    protected async sendPrePayloadJSON(connection: IConnection, generateNewRequestId: boolean = true): Promise<void> {\r\n        if (this.sendPrePayloadJSONOverride !== undefined) {\r\n            return this.sendPrePayloadJSONOverride(connection);\r\n        }\r\n\r\n        await this.sendSpeechContext(connection, generateNewRequestId);\r\n        await this.sendWaveHeader(connection);\r\n        return;\r\n    }\r\n\r\n    protected async sendWaveHeader(connection: IConnection): Promise<void> {\r\n        const format: AudioStreamFormatImpl = await this.audioSource.format;\r\n        // this.writeBufferToConsole(format.header);\r\n        return connection.send(new SpeechConnectionMessage(\r\n            MessageType.Binary,\r\n            \"audio\",\r\n            this.privRequestSession.requestId,\r\n            \"audio/x-wav\",\r\n            format.header\r\n        ));\r\n    }\r\n\r\n    protected postConnectImplOverride: (connection: Promise<IConnection>) => Promise<IConnection> = undefined;\r\n\r\n    private reconnect(): Promise<IConnection> {\r\n        if (this.privConnectionPromise !== undefined && !this.privServiceHasSentMessage) {\r\n            return this.privConnectionPromise;\r\n        }\r\n        this.privConnectionId = null;\r\n        this.privConnectionPromise = undefined;\r\n        this.privServiceHasSentMessage = false;\r\n        return this.connectImpl();\r\n    }\r\n\r\n    // Establishes a websocket connection to the end point.\r\n    protected connectImpl(): Promise<IConnection> {\r\n        if (this.privConnectionPromise !== undefined) {\r\n            return this.privConnectionPromise.then((connection: IConnection): Promise<IConnection> => {\r\n                if (connection.state() === ConnectionState.Disconnected) {\r\n                    return this.reconnect();\r\n                }\r\n                return this.privConnectionPromise;\r\n            }, (): Promise<IConnection> => this.reconnect());\r\n        }\r\n\r\n        this.privConnectionPromise = this.retryableConnect();\r\n\r\n        // Attach an empty handler to allow the promise to run in the background while\r\n        // other startup events happen. It'll eventually be awaited on.\r\n        // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n        this.privConnectionPromise.catch((): void => { });\r\n\r\n        if (this.postConnectImplOverride !== undefined) {\r\n            return this.postConnectImplOverride(this.privConnectionPromise);\r\n        }\r\n\r\n        return this.privConnectionPromise;\r\n    }\r\n\r\n    protected configConnectionOverride: (connection: IConnection) => Promise<IConnection> = undefined;\r\n    protected handleSpeechPhraseMessage: (textBody: string) => Promise<void> = undefined;\r\n    protected handleSpeechHypothesisMessage: (textBody: string) => void = undefined;\r\n\r\n    protected sendSpeechServiceConfig(connection: IConnection, requestSession: RequestSession, SpeechServiceConfigJson: string): Promise<void> {\r\n        requestSession.onSpeechContext();\r\n        // filter out anything that is not required for the service to work.\r\n        if (ServiceRecognizerBase.telemetryDataEnabled !== true) {\r\n            const withTelemetry: { context: { system: string } } = JSON.parse(SpeechServiceConfigJson) as { context: { system: string } };\r\n\r\n            const replacement: any = {\r\n                context: {\r\n                    system: withTelemetry.context.system,\r\n                },\r\n            };\r\n\r\n            SpeechServiceConfigJson = JSON.stringify(replacement);\r\n        }\r\n\r\n        if (this.privRecognizerConfig.parameters.getProperty(\"f0f5debc-f8c9-4892-ac4b-90a7ab359fd2\", \"false\").toLowerCase() === \"true\") {\r\n            const json: { context: { DisableReferenceChannel: string; MicSpec: string } } = JSON.parse(SpeechServiceConfigJson) as { context: { DisableReferenceChannel: string; MicSpec: string } };\r\n            json.context.DisableReferenceChannel = \"True\";\r\n            json.context.MicSpec = \"1_0_0\";\r\n            SpeechServiceConfigJson = JSON.stringify(json);\r\n        }\r\n\r\n        if (SpeechServiceConfigJson) {\r\n            return connection.send(new SpeechConnectionMessage(\r\n                MessageType.Text,\r\n                \"speech.config\",\r\n                requestSession.requestId,\r\n                \"application/json\",\r\n                SpeechServiceConfigJson));\r\n        }\r\n\r\n        return;\r\n    }\r\n\r\n    protected async fetchConnection(): Promise<IConnection> {\r\n        if (this.privConnectionConfigurationPromise !== undefined) {\r\n            return this.privConnectionConfigurationPromise.then((connection: IConnection): Promise<IConnection> => {\r\n                if (connection.state() === ConnectionState.Disconnected) {\r\n                    this.privConnectionConfigurationPromise = undefined;\r\n                    return this.fetchConnection();\r\n                }\r\n                return this.privConnectionConfigurationPromise;\r\n            }, (): Promise<IConnection> => {\r\n                this.privConnectionConfigurationPromise = undefined;\r\n                return this.fetchConnection();\r\n            });\r\n        }\r\n\r\n        this.privConnectionConfigurationPromise = this.configureConnection();\r\n        return await this.privConnectionConfigurationPromise;\r\n    }\r\n\r\n    protected async sendAudio(audioStreamNode: IAudioStreamNode): Promise<void> {\r\n        const audioFormat: AudioStreamFormatImpl = await this.audioSource.format;\r\n        this.privAverageBytesPerMs = audioFormat.avgBytesPerSec / 1000;\r\n        // The time we last sent data to the service.\r\n        let nextSendTime: number = Date.now();\r\n\r\n        // Max amount to send before we start to throttle\r\n        const fastLaneSizeMs: string = this.privRecognizerConfig.parameters.getProperty(\"SPEECH-TransmitLengthBeforThrottleMs\", \"5000\");\r\n        const maxSendUnthrottledBytes: number = audioFormat.avgBytesPerSec / 1000 * parseInt(fastLaneSizeMs, 10);\r\n        const startRecogNumber: number = this.privRequestSession.recogNumber;\r\n\r\n        const readAndUploadCycle = async (): Promise<void> => {\r\n            // If speech is done, stop sending audio.\r\n            if (!this.privIsDisposed &&\r\n                !this.privRequestSession.isSpeechEnded &&\r\n                this.privRequestSession.isRecognizing &&\r\n                this.privRequestSession.recogNumber === startRecogNumber) {\r\n\r\n                const connection: IConnection = await this.fetchConnection();\r\n                const audioStreamChunk: IStreamChunk<ArrayBuffer> = await audioStreamNode.read();\r\n                // we have a new audio chunk to upload.\r\n                if (this.privRequestSession.isSpeechEnded) {\r\n                    // If service already recognized audio end then don't send any more audio\r\n                    return;\r\n                }\r\n\r\n                let payload: ArrayBuffer;\r\n                let sendDelay: number;\r\n\r\n                if (!audioStreamChunk || audioStreamChunk.isEnd) {\r\n                    payload = null;\r\n                    sendDelay = 0;\r\n                } else {\r\n                    payload = audioStreamChunk.buffer;\r\n\r\n                    this.privRequestSession.onAudioSent(payload.byteLength);\r\n\r\n                    if (maxSendUnthrottledBytes >= this.privRequestSession.bytesSent) {\r\n                        sendDelay = 0;\r\n                    } else {\r\n                        sendDelay = Math.max(0, nextSendTime - Date.now());\r\n                    }\r\n                }\r\n\r\n                if (0 !== sendDelay) {\r\n                    await this.delay(sendDelay);\r\n                }\r\n\r\n                if (payload !== null) {\r\n                    nextSendTime = Date.now() + (payload.byteLength * 1000 / (audioFormat.avgBytesPerSec * 2));\r\n                }\r\n\r\n                // Are we still alive?\r\n                if (!this.privIsDisposed &&\r\n                    !this.privRequestSession.isSpeechEnded &&\r\n                    this.privRequestSession.isRecognizing &&\r\n                    this.privRequestSession.recogNumber === startRecogNumber) {\r\n                    connection.send(\r\n                        new SpeechConnectionMessage(MessageType.Binary, \"audio\", this.privRequestSession.requestId, null, payload)\r\n                    ).catch((): void => {\r\n                        // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n                        this.privRequestSession.onServiceTurnEndResponse(this.privRecognizerConfig.isContinuousRecognition).catch((): void => { });\r\n                    });\r\n\r\n                    if (!audioStreamChunk?.isEnd) {\r\n                        // this.writeBufferToConsole(payload);\r\n                        // Regardless of success or failure, schedule the next upload.\r\n                        // If the underlying connection was broken, the next cycle will\r\n                        // get a new connection and re-transmit missing audio automatically.\r\n                        return readAndUploadCycle();\r\n                    } else {\r\n                        // the audio stream has been closed, no need to schedule next\r\n                        // read-upload cycle.\r\n                        if (!this.privIsLiveAudio) {\r\n                            this.privRequestSession.onSpeechEnded();\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        };\r\n\r\n        return readAndUploadCycle();\r\n    }\r\n\r\n    private async retryableConnect(): Promise<IConnection> {\r\n        let isUnAuthorized: boolean = false;\r\n\r\n        this.privAuthFetchEventId = createNoDashGuid();\r\n        const sessionId: string = this.privRequestSession.sessionId;\r\n        this.privConnectionId = (sessionId !== undefined) ? sessionId : createNoDashGuid();\r\n\r\n        this.privRequestSession.onPreConnectionStart(this.privAuthFetchEventId, this.privConnectionId);\r\n        let lastStatusCode: number = 0;\r\n        let lastReason: string = \"\";\r\n\r\n        while (this.privRequestSession.numConnectionAttempts <= this.privRecognizerConfig.maxRetryCount) {\r\n            this.privRequestSession.onRetryConnection();\r\n\r\n            // Get the auth information for the connection. This is a bit of overkill for the current API surface, but leaving the plumbing in place to be able to raise a developer-customer\r\n            // facing event when a connection fails to let them try and provide new auth information.\r\n            const authPromise = isUnAuthorized ? this.privAuthentication.fetchOnExpiry(this.privAuthFetchEventId) : this.privAuthentication.fetch(this.privAuthFetchEventId);\r\n            const auth: AuthInfo = await authPromise;\r\n\r\n            await this.privRequestSession.onAuthCompleted(false);\r\n\r\n            // Create the connection\r\n            const connection: IConnection = await this.privConnectionFactory.create(this.privRecognizerConfig, auth, this.privConnectionId);\r\n            // Attach the telemetry handlers.\r\n            this.privRequestSession.listenForServiceTelemetry(connection.events);\r\n\r\n            // Attach to the underlying event. No need to hold onto the detach pointers as in the event the connection goes away,\r\n            // it'll stop sending events.\r\n            connection.events.attach((event: ConnectionEvent): void => {\r\n                this.connectionEvents.onEvent(event);\r\n            });\r\n\r\n            const response: ConnectionOpenResponse = await connection.open();\r\n            // 200 == everything is fine.\r\n            if (response.statusCode === 200) {\r\n                await this.privRequestSession.onConnectionEstablishCompleted(response.statusCode);\r\n                return Promise.resolve(connection);\r\n            } else if (response.statusCode === 1006) {\r\n                isUnAuthorized = true;\r\n            }\r\n\r\n            lastStatusCode = response.statusCode;\r\n            lastReason = response.reason;\r\n        }\r\n\r\n        await this.privRequestSession.onConnectionEstablishCompleted(lastStatusCode, lastReason);\r\n        return Promise.reject(`Unable to contact server. StatusCode: ${lastStatusCode}, ${this.privRecognizerConfig.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint)} Reason: ${lastReason}`);\r\n    }\r\n\r\n    private delay(delayMs: number): Promise<void> {\r\n        return new Promise((resolve: () => void): number => this.privSetTimeout(resolve, delayMs));\r\n    }\r\n\r\n    private writeBufferToConsole(buffer: ArrayBuffer): void {\r\n        let out: string = \"Buffer Size: \";\r\n        if (null === buffer) {\r\n            out += \"null\";\r\n        } else {\r\n            const readView: Uint8Array = new Uint8Array(buffer);\r\n            out += `${buffer.byteLength}\\r\\n`;\r\n            for (let i: number = 0; i < buffer.byteLength; i++) {\r\n                out += readView[i].toString(16).padStart(2, \"0\") + \" \";\r\n                if (((i + 1) % 16) === 0) {\r\n                    // eslint-disable-next-line no-console\r\n                    console.info(out);\r\n                    out = \"\";\r\n                }\r\n            }\r\n        }\r\n        // eslint-disable-next-line no-console\r\n        console.info(out);\r\n    }\r\n\r\n    private async sendFinalAudio(): Promise<void> {\r\n        const connection: IConnection = await this.fetchConnection();\r\n        await connection.send(new SpeechConnectionMessage(MessageType.Binary, \"audio\", this.privRequestSession.requestId, null, null));\r\n        return;\r\n    }\r\n\r\n    // Takes an established websocket connection to the endpoint and sends speech configuration information.\r\n    private async configureConnection(): Promise<IConnection> {\r\n        const connection: IConnection = await this.connectImpl();\r\n        if (this.configConnectionOverride !== undefined) {\r\n            return this.configConnectionOverride(connection);\r\n        }\r\n        await this.sendSpeechServiceConfig(connection, this.privRequestSession, this.privRecognizerConfig.SpeechServiceConfig.serialize());\r\n        await this.sendPrePayloadJSON(connection, false);\r\n        return connection;\r\n    }\r\n}\r\n","import { IAudioSource } from \"../common/Exports.js\";\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    OutputFormat,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    Recognizer,\r\n    ResultReason,\r\n    SpeechRecognitionResult\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    DetailedSpeechPhrase,\r\n    EnumTranslation,\r\n    IAuthentication,\r\n    IConnectionFactory,\r\n    OutputFormatPropertyName,\r\n    RecognitionStatus,\r\n    RecognizerConfig,\r\n    ServiceRecognizerBase,\r\n    SimpleSpeechPhrase,\r\n    SpeechHypothesis\r\n} from \"./Exports.js\";\r\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal.js\";\r\n\r\nexport class ConversationServiceRecognizer extends ServiceRecognizerBase {\r\n\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioSource: IAudioSource,\r\n        recognizerConfig: RecognizerConfig,\r\n        recognizer: Recognizer) {\r\n        super(authentication, connectionFactory, audioSource, recognizerConfig, recognizer);\r\n        this.handleSpeechPhraseMessage = async (textBody: string): Promise<void> => this.handleSpeechPhrase(textBody);\r\n        this.handleSpeechHypothesisMessage = (textBody: string): void => this.handleSpeechHypothesis(textBody);\r\n    }\r\n\r\n    protected processTypeSpecificMessages(connectionMessage: SpeechConnectionMessage): Promise<boolean> {\r\n        void connectionMessage;\r\n        return;\r\n    }\r\n\r\n    protected handleRecognizedCallback(result: SpeechRecognitionResult, offset: number, sessionId: string): void {\r\n        void result;\r\n        void offset;\r\n        void sessionId;\r\n        return;\r\n    }\r\n\r\n    protected handleRecognizingCallback(result: SpeechRecognitionResult, duration: number, sessionId: string): void {\r\n        void result;\r\n        void duration;\r\n        void sessionId;\r\n        return;\r\n    }\r\n\r\n    protected async processSpeechMessages(connectionMessage: SpeechConnectionMessage): Promise<boolean> {\r\n        let processed: boolean = false;\r\n        switch (connectionMessage.path.toLowerCase()) {\r\n            case \"speech.hypothesis\":\r\n            case \"speech.fragment\":\r\n                if (!!this.handleSpeechHypothesisMessage) {\r\n                    this.handleSpeechHypothesisMessage(connectionMessage.textBody);\r\n                }\r\n                processed = true;\r\n                break;\r\n            case \"speech.phrase\":\r\n                if (!!this.handleSpeechPhraseMessage) {\r\n                    await this.handleSpeechPhraseMessage(connectionMessage.textBody);\r\n                }\r\n                processed = true;\r\n                break;\r\n            default:\r\n                break;\r\n        }\r\n        return processed;\r\n    }\r\n\r\n    protected cancelRecognition(\r\n        sessionId: string,\r\n        requestId: string,\r\n        cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): void {\r\n        // Implementing to allow inheritance\r\n        void sessionId;\r\n        void requestId;\r\n        void cancellationReason;\r\n        void errorCode;\r\n        void error;\r\n    }\r\n\r\n    protected async handleSpeechPhrase(textBody: string): Promise<void> {\r\n\r\n        const simple: SimpleSpeechPhrase = SimpleSpeechPhrase.fromJSON(textBody, this.privRequestSession.currentTurnAudioOffset);\r\n        const resultReason: ResultReason = EnumTranslation.implTranslateRecognitionResult(simple.RecognitionStatus);\r\n        let result: SpeechRecognitionResult;\r\n        const resultProps: PropertyCollection = new PropertyCollection();\r\n        resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, textBody);\r\n\r\n        this.privRequestSession.onPhraseRecognized(simple.Offset + simple.Duration);\r\n\r\n        if (ResultReason.Canceled === resultReason) {\r\n            const cancelReason: CancellationReason = EnumTranslation.implTranslateCancelResult(simple.RecognitionStatus);\r\n            const cancellationErrorCode: CancellationErrorCode = EnumTranslation.implTranslateCancelErrorCode(simple.RecognitionStatus);\r\n\r\n            await this.cancelRecognitionLocal(\r\n                cancelReason,\r\n                cancellationErrorCode,\r\n                EnumTranslation.implTranslateErrorDetails(cancellationErrorCode));\r\n\r\n        } else {\r\n            if (simple.RecognitionStatus !== RecognitionStatus.EndOfDictation) {\r\n                if (this.privRecognizerConfig.parameters.getProperty(OutputFormatPropertyName) === OutputFormat[OutputFormat.Simple]) {\r\n                    result = new SpeechRecognitionResult(\r\n                        this.privRequestSession.requestId,\r\n                        resultReason,\r\n                        simple.DisplayText,\r\n                        simple.Duration,\r\n                        simple.Offset,\r\n                        simple.Language,\r\n                        simple.LanguageDetectionConfidence,\r\n                        simple.SpeakerId,\r\n                        undefined,\r\n                        simple.asJson(),\r\n                        resultProps);\r\n                } else {\r\n                    const detailed: DetailedSpeechPhrase = DetailedSpeechPhrase.fromJSON(textBody, this.privRequestSession.currentTurnAudioOffset);\r\n\r\n                    result = new SpeechRecognitionResult(\r\n                        this.privRequestSession.requestId,\r\n                        resultReason,\r\n                        detailed.Text,\r\n                        detailed.Duration,\r\n                        detailed.Offset,\r\n                        detailed.Language,\r\n                        detailed.LanguageDetectionConfidence,\r\n                        detailed.SpeakerId,\r\n                        undefined,\r\n                        detailed.asJson(),\r\n                        resultProps);\r\n                }\r\n\r\n                this.handleRecognizedCallback(result, result.offset, this.privRequestSession.sessionId);\r\n            }\r\n        }\r\n    }\r\n\r\n    protected handleSpeechHypothesis(textBody: string): void {\r\n        const hypothesis: SpeechHypothesis = SpeechHypothesis.fromJSON(textBody, this.privRequestSession.currentTurnAudioOffset);\r\n        const resultProps: PropertyCollection = new PropertyCollection();\r\n        resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, textBody);\r\n\r\n        const result = new SpeechRecognitionResult(\r\n            this.privRequestSession.requestId,\r\n            ResultReason.RecognizingSpeech,\r\n            hypothesis.Text,\r\n            hypothesis.Duration,\r\n            hypothesis.Offset,\r\n            hypothesis.Language,\r\n            hypothesis.LanguageDetectionConfidence,\r\n            hypothesis.SpeakerId,\r\n            undefined,\r\n            hypothesis.asJson(),\r\n            resultProps);\r\n\r\n        this.privRequestSession.onHypothesis(hypothesis.Offset);\r\n\r\n        this.handleRecognizingCallback(result, hypothesis.Duration, this.privRequestSession.sessionId);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport { PropertyCollection, PropertyId } from \"../sdk/Exports.js\";\r\nimport { Context, SpeechServiceConfig } from \"./Exports.js\";\r\nimport { RecognitionMode } from \"./ServiceMessages/PhraseDetection/PhraseDetectionContext.js\";\r\n\r\nexport enum SpeechResultFormat {\r\n    Simple,\r\n    Detailed,\r\n}\r\n\r\nexport class RecognizerConfig {\r\n    private privRecognitionMode: RecognitionMode;\r\n    private privLanguageIdMode: string;\r\n    private privSpeechServiceConfig: SpeechServiceConfig;\r\n    private privRecognitionActivityTimeout: number;\r\n    private privParameters: PropertyCollection;\r\n    private privMaxRetryCount: number;\r\n    private privEnableSpeakerId: boolean;\r\n\r\n    public constructor(\r\n        speechServiceConfig: SpeechServiceConfig,\r\n        parameters: PropertyCollection) {\r\n        this.privSpeechServiceConfig = speechServiceConfig ? speechServiceConfig : new SpeechServiceConfig(new Context(null));\r\n        this.privParameters = parameters;\r\n        this.privMaxRetryCount = parseInt(parameters.getProperty(\"SPEECH-Error-MaxRetryCount\", \"4\"), 10);\r\n        this.privLanguageIdMode = parameters.getProperty(PropertyId.SpeechServiceConnection_LanguageIdMode, undefined);\r\n        this.privEnableSpeakerId = false;\r\n    }\r\n\r\n    public get parameters(): PropertyCollection {\r\n        return this.privParameters;\r\n    }\r\n\r\n    public get recognitionMode(): RecognitionMode {\r\n        return this.privRecognitionMode;\r\n    }\r\n\r\n    public set recognitionMode(value: RecognitionMode) {\r\n        this.privRecognitionMode = value;\r\n        this.privRecognitionActivityTimeout = value === RecognitionMode.Interactive ? 8000 : 25000;\r\n        this.privSpeechServiceConfig.Recognition = RecognitionMode[value];\r\n    }\r\n\r\n    public get SpeechServiceConfig(): SpeechServiceConfig {\r\n        return this.privSpeechServiceConfig;\r\n    }\r\n\r\n    public get recognitionActivityTimeout(): number {\r\n        return this.privRecognitionActivityTimeout;\r\n    }\r\n\r\n    public get isContinuousRecognition(): boolean {\r\n        return this.privRecognitionMode !== RecognitionMode.Interactive;\r\n    }\r\n\r\n    public get languageIdMode(): string {\r\n        return this.privLanguageIdMode;\r\n    }\r\n\r\n    public get autoDetectSourceLanguages(): string {\r\n        return this.parameters.getProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, undefined);\r\n    }\r\n\r\n    public get recognitionEndpointVersion(): string {\r\n        return this.parameters.getProperty(PropertyId.SpeechServiceConnection_RecognitionEndpointVersion, \"2\");\r\n    }\r\n\r\n    public set recognitionEndpointVersion(version: string) {\r\n        this.parameters.setProperty(PropertyId.SpeechServiceConnection_RecognitionEndpointVersion, version);\r\n    }\r\n\r\n    public get sourceLanguageModels(): { language: string; endpoint: string }[] {\r\n        const models: { language: string; endpoint: string }[] = [];\r\n        let modelsExist: boolean = false;\r\n        if (this.autoDetectSourceLanguages !== undefined) {\r\n            for (const language of this.autoDetectSourceLanguages.split(\",\")) {\r\n                const customProperty = language + PropertyId.SpeechServiceConnection_EndpointId.toString();\r\n                const modelId: string = this.parameters.getProperty(customProperty, undefined);\r\n                if (modelId !== undefined) {\r\n                    models.push({ language, endpoint: modelId });\r\n                    modelsExist = true;\r\n                } else {\r\n                    models.push({ language, endpoint: \"\" });\r\n                }\r\n            }\r\n        }\r\n        return modelsExist ? models : undefined;\r\n    }\r\n\r\n    public get maxRetryCount(): number {\r\n        return this.privMaxRetryCount;\r\n    }\r\n\r\n    public get isSpeakerDiarizationEnabled(): boolean {\r\n        return this.privEnableSpeakerId;\r\n    }\r\n\r\n    public set isSpeakerDiarizationEnabled(value: boolean) {\r\n        this.privEnableSpeakerId = value;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ConnectionMessage,\r\n    Deferred,\r\n    IStringDictionary,\r\n    IWebsocketMessageFormatter,\r\n    MessageType,\r\n    RawWebsocketMessage,\r\n} from \"../common/Exports.js\";\r\n\r\nconst CRLF: string = \"\\r\\n\";\r\n\r\nexport class WebsocketMessageFormatter implements IWebsocketMessageFormatter {\r\n\r\n    public toConnectionMessage(message: RawWebsocketMessage): Promise<ConnectionMessage> {\r\n        const deferral = new Deferred<ConnectionMessage>();\r\n\r\n        try {\r\n            if (message.messageType === MessageType.Text) {\r\n                const textMessage: string = message.textContent;\r\n                let headers: IStringDictionary<string> = {};\r\n                let body: string = null;\r\n\r\n                if (textMessage) {\r\n                    const headerBodySplit = textMessage.split(\"\\r\\n\\r\\n\");\r\n                    if (headerBodySplit && headerBodySplit.length > 0) {\r\n                        headers = this.parseHeaders(headerBodySplit[0]);\r\n                        if (headerBodySplit.length > 1) {\r\n                            body = headerBodySplit[1];\r\n                        }\r\n                    }\r\n                }\r\n\r\n                deferral.resolve(new ConnectionMessage(message.messageType, body, headers, message.id));\r\n            } else if (message.messageType === MessageType.Binary) {\r\n                const binaryMessage: ArrayBuffer = message.binaryContent;\r\n                let headers: IStringDictionary<string> = {};\r\n                let body: ArrayBuffer = null;\r\n\r\n                if (!binaryMessage || binaryMessage.byteLength < 2) {\r\n                    throw new Error(\"Invalid binary message format. Header length missing.\");\r\n                }\r\n\r\n                const dataView = new DataView(binaryMessage);\r\n                const headerLength = dataView.getInt16(0);\r\n\r\n                if (binaryMessage.byteLength < headerLength + 2) {\r\n                    throw new Error(\"Invalid binary message format. Header content missing.\");\r\n                }\r\n\r\n                let headersString = \"\";\r\n                for (let i = 0; i < headerLength; i++) {\r\n                    headersString += String.fromCharCode((dataView).getInt8(i + 2));\r\n                }\r\n\r\n                headers = this.parseHeaders(headersString);\r\n\r\n                if (binaryMessage.byteLength > headerLength + 2) {\r\n                    body = binaryMessage.slice(2 + headerLength);\r\n                }\r\n\r\n                deferral.resolve(new ConnectionMessage(message.messageType, body, headers, message.id));\r\n            }\r\n        } catch (e) {\r\n            deferral.reject(`Error formatting the message. Error: ${e as string}`);\r\n        }\r\n\r\n        return deferral.promise;\r\n    }\r\n\r\n    public fromConnectionMessage(message: ConnectionMessage): Promise<RawWebsocketMessage> {\r\n        const deferral = new Deferred<RawWebsocketMessage>();\r\n\r\n        try {\r\n            if (message.messageType === MessageType.Text) {\r\n                const payload = `${this.makeHeaders(message)}${CRLF}${message.textBody ? message.textBody : \"\"}`;\r\n\r\n                deferral.resolve(new RawWebsocketMessage(MessageType.Text, payload, message.id));\r\n\r\n            } else if (message.messageType === MessageType.Binary) {\r\n                const headersString = this.makeHeaders(message);\r\n                const content = message.binaryBody;\r\n\r\n                const headerBuffer = this.stringToArrayBuffer(headersString);\r\n                const headerInt8Array = new Int8Array(headerBuffer);\r\n                const headerLength = headerInt8Array.byteLength;\r\n\r\n                const payloadInt8Array = new Int8Array(2 + headerLength + (content ? content.byteLength : 0));\r\n                payloadInt8Array[0] = ((headerLength >> 8) & 0xff);\r\n                payloadInt8Array[1] = headerLength & 0xff;\r\n                payloadInt8Array.set(headerInt8Array, 2);\r\n\r\n                if (content) {\r\n                    const bodyInt8Array = new Int8Array(content);\r\n                    payloadInt8Array.set(bodyInt8Array, 2 + headerLength);\r\n                }\r\n\r\n                const payload: ArrayBuffer = payloadInt8Array.buffer;\r\n\r\n                deferral.resolve(new RawWebsocketMessage(MessageType.Binary, payload, message.id));\r\n            }\r\n        } catch (e) {\r\n            deferral.reject(`Error formatting the message. ${e as string}`);\r\n        }\r\n\r\n        return deferral.promise;\r\n    }\r\n\r\n    private makeHeaders(message: ConnectionMessage): string {\r\n        let headersString: string = \"\";\r\n\r\n        if (message.headers) {\r\n            for (const header in message.headers) {\r\n                if (header) {\r\n                    headersString += `${header}: ${message.headers[header]}${CRLF}`;\r\n                }\r\n            }\r\n        }\r\n\r\n        return headersString;\r\n    }\r\n\r\n    private parseHeaders(headersString: string): IStringDictionary<string> {\r\n        const headers: IStringDictionary<string> = {};\r\n\r\n        if (headersString) {\r\n            const headerMatches = headersString.match(/[^\\r\\n]+/g);\r\n            if (headers) {\r\n                for (const header of headerMatches) {\r\n                    if (header) {\r\n                        const separatorIndex = header.indexOf(\":\");\r\n                        const headerName = separatorIndex > 0 ? header.substr(0, separatorIndex).trim().toLowerCase() : header;\r\n                        const headerValue =\r\n                            separatorIndex > 0 && header.length > (separatorIndex + 1) ?\r\n                                header.substr(separatorIndex + 1).trim() :\r\n                                \"\";\r\n\r\n                        headers[headerName] = headerValue;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        return headers;\r\n    }\r\n\r\n    private stringToArrayBuffer(str: string): ArrayBuffer {\r\n        const buffer = new ArrayBuffer(str.length);\r\n        const view = new DataView(buffer);\r\n        for (let i = 0; i < str.length; i++) {\r\n            view.setUint8(i, str.charCodeAt(i));\r\n        }\r\n        return buffer;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ProxyInfo,\r\n    WebsocketConnection,\r\n} from \"../common.browser/Exports.js\";\r\nimport {\r\n    ForceDictationPropertyName,\r\n    OutputFormatPropertyName,\r\n} from \"../common.speech/Exports.js\";\r\nimport {\r\n    IConnection,\r\n    IStringDictionary\r\n} from \"../common/Exports.js\";\r\nimport {\r\n    OutputFormat,\r\n    PropertyId\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    ConnectionFactoryBase\r\n} from \"./ConnectionFactoryBase.js\";\r\nimport {\r\n    AuthInfo,\r\n    RecognizerConfig,\r\n    WebsocketMessageFormatter\r\n} from \"./Exports.js\";\r\nimport { HeaderNames } from \"./HeaderNames.js\";\r\nimport {\r\n    QueryParameterNames\r\n} from \"./QueryParameterNames.js\";\r\nimport { RecognitionMode } from \"./ServiceMessages/PhraseDetection/PhraseDetectionContext.js\";\r\n\r\nexport class SpeechConnectionFactory extends ConnectionFactoryBase {\r\n\r\n    private readonly interactiveRelativeUri: string = \"/speech/recognition/interactive/cognitiveservices/v1\";\r\n    private readonly conversationRelativeUri: string = \"/speech/recognition/conversation/cognitiveservices/v1\";\r\n    private readonly dictationRelativeUri: string = \"/speech/recognition/dictation/cognitiveservices/v1\";\r\n    private readonly universalUri: string = \"/stt/speech/universal/v\";\r\n\r\n    public async create(\r\n        config: RecognizerConfig,\r\n        authInfo: AuthInfo,\r\n        connectionId?: string): Promise<IConnection> {\r\n\r\n        let endpoint: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint, undefined);\r\n        const region: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Region, undefined);\r\n        const hostSuffix: string = ConnectionFactoryBase.getHostSuffix(region);\r\n        const host: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Host, \"wss://\" + region + \".stt.speech\" + hostSuffix);\r\n        const queryParams: IStringDictionary<string> = {};\r\n        const endpointId: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_EndpointId, undefined);\r\n        const language: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage, undefined);\r\n\r\n        if (endpointId) {\r\n            if (!endpoint || endpoint.search(QueryParameterNames.CustomSpeechDeploymentId) === -1) {\r\n                queryParams[QueryParameterNames.CustomSpeechDeploymentId] = endpointId;\r\n            }\r\n        } else if (language) {\r\n            if (!endpoint || endpoint.search(QueryParameterNames.Language) === -1) {\r\n                queryParams[QueryParameterNames.Language] = language;\r\n            }\r\n        }\r\n\r\n        if (!endpoint || endpoint.search(QueryParameterNames.Format) === -1) {\r\n            queryParams[QueryParameterNames.Format] = config.parameters.getProperty(OutputFormatPropertyName, OutputFormat[OutputFormat.Simple]).toLowerCase();\r\n        }\r\n\r\n        if (config.autoDetectSourceLanguages !== undefined) {\r\n            queryParams[QueryParameterNames.EnableLanguageId] = \"true\";\r\n        }\r\n\r\n        this.setCommonUrlParams(config, queryParams, endpoint);\r\n\r\n        if (!!endpoint) {\r\n            const endpointUrl = new URL(endpoint);\r\n            const pathName = endpointUrl.pathname;\r\n\r\n            if (pathName === \"\" || pathName === \"/\") {\r\n                // We need to generate the path, and we need to check for a redirect.\r\n                endpointUrl.pathname = this.universalUri + config.recognitionEndpointVersion;\r\n\r\n                endpoint = await ConnectionFactoryBase.getRedirectUrlFromEndpoint(endpointUrl.toString());\r\n            }\r\n        }\r\n\r\n        if (!endpoint) {\r\n            switch (config.recognitionMode) {\r\n                case RecognitionMode.Conversation:\r\n                    if (config.parameters.getProperty(ForceDictationPropertyName, \"false\") === \"true\") {\r\n                        endpoint = host + this.dictationRelativeUri;\r\n                    } else {\r\n                        if (config.recognitionEndpointVersion !== undefined && parseInt(config.recognitionEndpointVersion, 10) > 1) {\r\n                            endpoint = `${host}${this.universalUri}${config.recognitionEndpointVersion}`;\r\n                        } else {\r\n                            endpoint = host + this.conversationRelativeUri;\r\n                        }\r\n                    }\r\n                    break;\r\n                case RecognitionMode.Dictation:\r\n                    endpoint = host + this.dictationRelativeUri;\r\n                    break;\r\n                default:\r\n                    if (config.recognitionEndpointVersion !== undefined && parseInt(config.recognitionEndpointVersion, 10) > 1) {\r\n                        endpoint = `${host}${this.universalUri}${config.recognitionEndpointVersion}`;\r\n                    } else {\r\n                        endpoint = host + this.interactiveRelativeUri; // default is interactive\r\n                    }\r\n                    break;\r\n            }\r\n        }\r\n\r\n        const headers: IStringDictionary<string> = {};\r\n        if (authInfo.token !== undefined && authInfo.token !== \"\") {\r\n            headers[authInfo.headerName] = authInfo.token;\r\n        }\r\n        headers[HeaderNames.ConnectionId] = connectionId;\r\n        headers.connectionId = connectionId;\r\n\r\n        const enableCompression: boolean = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\r\n\r\n        const webSocketConnection = new WebsocketConnection(endpoint, queryParams, headers, new WebsocketMessageFormatter(), ProxyInfo.fromRecognizerConfig(config), enableCompression, connectionId);\r\n\r\n        // Set the value of SpeechServiceConnection_Url to webSocketConnection.uri (and not to `endpoint`), since this value is the final\r\n        // URI that was used to make the connection (including query parameters).\r\n        const uri: string = webSocketConnection.uri;\r\n        config.parameters.setProperty(PropertyId.SpeechServiceConnection_Url, uri);\r\n\r\n        return webSocketConnection;\r\n    }\r\n\r\n\r\n}\r\n\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ProxyInfo,\r\n    WebsocketConnection,\r\n} from \"../common.browser/Exports.js\";\r\nimport {\r\n    IConnection,\r\n    IStringDictionary\r\n} from \"../common/Exports.js\";\r\nimport {\r\n    PropertyId\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    ServicePropertiesPropertyName\r\n} from \"../common.speech/Exports.js\";\r\nimport {\r\n    ConnectionFactoryBase\r\n} from \"./ConnectionFactoryBase.js\";\r\nimport {\r\n    AuthInfo,\r\n    RecognizerConfig,\r\n    WebsocketMessageFormatter\r\n} from \"./Exports.js\";\r\nimport { HeaderNames } from \"./HeaderNames.js\";\r\nimport {\r\n    QueryParameterNames\r\n} from \"./QueryParameterNames.js\";\r\n\r\nexport class ConversationTranscriberConnectionFactory extends ConnectionFactoryBase {\r\n    private readonly universalUri: string = \"/stt/speech/universal/v2\";\r\n    private readonly conversationRelativeUriV1: string = \"/speech/recognition/conversation/cognitiveservices/v1\";\r\n\r\n    public async create(\r\n        config: RecognizerConfig,\r\n        authInfo: AuthInfo,\r\n        connectionId?: string): Promise<IConnection> {\r\n\r\n        let endpoint: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint, undefined);\r\n        const region: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Region, undefined);\r\n        const hostSuffix: string = ConnectionFactoryBase.getHostSuffix(region);\r\n        const host: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Host, \"wss://\" + region + \".stt.speech\" + hostSuffix);\r\n        const queryParams: IStringDictionary<string> = {};\r\n        const endpointId: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_EndpointId, undefined);\r\n        const language: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage, undefined);\r\n\r\n        if (endpointId) {\r\n            if (!endpoint || endpoint.search(QueryParameterNames.CustomSpeechDeploymentId) === -1) {\r\n                queryParams[QueryParameterNames.CustomSpeechDeploymentId] = endpointId;\r\n            }\r\n        } else if (language) {\r\n            if (!endpoint || endpoint.search(QueryParameterNames.Language) === -1) {\r\n                queryParams[QueryParameterNames.Language] = language;\r\n            }\r\n        }\r\n\r\n        if (config.autoDetectSourceLanguages !== undefined) {\r\n            queryParams[QueryParameterNames.EnableLanguageId] = \"true\";\r\n        }\r\n\r\n        const apiVersion = config.parameters.getProperty(PropertyId.SpeechServiceConnection_RecognitionEndpointVersion, undefined);\r\n        if (apiVersion === \"1\") {\r\n            endpoint = `${host}${this.universalUri}`;\r\n        } else {\r\n            this.setV2UrlParams(config, queryParams, endpoint);\r\n            if (!!endpoint) {\r\n                const endpointUrl = new URL(endpoint);\r\n                const pathName = endpointUrl.pathname;\r\n\r\n                if (pathName === \"\" || pathName === \"/\") {\r\n                    // We need to generate the path, and we need to check for a redirect.\r\n                    endpointUrl.pathname = this.universalUri;\r\n\r\n                    endpoint = await ConnectionFactoryBase.getRedirectUrlFromEndpoint(endpointUrl.toString());\r\n                }\r\n            }\r\n\r\n            if (!endpoint) {\r\n                endpoint = `${host}${this.conversationRelativeUriV1}`;\r\n            }\r\n        }\r\n\r\n        const headers: IStringDictionary<string> = {};\r\n        if (authInfo.token !== undefined && authInfo.token !== \"\") {\r\n            headers[authInfo.headerName] = authInfo.token;\r\n        }\r\n        headers[HeaderNames.ConnectionId] = connectionId;\r\n\r\n        const enableCompression: boolean = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\r\n\r\n        const webSocketConnection = new WebsocketConnection(endpoint, queryParams, headers, new WebsocketMessageFormatter(), ProxyInfo.fromRecognizerConfig(config), enableCompression, connectionId);\r\n\r\n        // Set the value of SpeechServiceConnection_Url to webSocketConnection.uri (and not to `endpoint`), since this value is the final\r\n        // URI that was used to make the connection (including query parameters).\r\n        const uri: string = webSocketConnection.uri;\r\n        config.parameters.setProperty(PropertyId.SpeechServiceConnection_Url, uri);\r\n\r\n        return webSocketConnection;\r\n    }\r\n\r\n    protected setV2UrlParams(\r\n        config: RecognizerConfig,\r\n        queryParams: IStringDictionary<string>,\r\n        endpoint: string): void {\r\n\r\n        const propertyIdToParameterMap: Map<number, string> = new Map([\r\n            [PropertyId.Speech_SegmentationSilenceTimeoutMs, QueryParameterNames.SegmentationSilenceTimeoutMs],\r\n            [PropertyId.SpeechServiceConnection_EnableAudioLogging, QueryParameterNames.EnableAudioLogging],\r\n            [PropertyId.SpeechServiceConnection_EndSilenceTimeoutMs, QueryParameterNames.EndSilenceTimeoutMs],\r\n            [PropertyId.SpeechServiceConnection_InitialSilenceTimeoutMs, QueryParameterNames.InitialSilenceTimeoutMs],\r\n            [PropertyId.SpeechServiceResponse_ProfanityOption, QueryParameterNames.Profanity],\r\n            [PropertyId.SpeechServiceResponse_StablePartialResultThreshold, QueryParameterNames.StableIntermediateThreshold],\r\n        ]);\r\n\r\n        propertyIdToParameterMap.forEach((parameterName: string, propertyId: PropertyId): void => {\r\n            this.setUrlParameter(propertyId, parameterName, config, queryParams, endpoint);\r\n        });\r\n\r\n\r\n        const serviceProperties: IStringDictionary<string> = JSON.parse(config.parameters.getProperty(ServicePropertiesPropertyName, \"{}\")) as IStringDictionary<string>;\r\n\r\n        Object.keys(serviceProperties).forEach((value: string): void => {\r\n            queryParams[value] = serviceProperties[value];\r\n        });\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ProxyInfo,\r\n    WebsocketConnection,\r\n} from \"../common.browser/Exports.js\";\r\nimport {\r\n    IConnection,\r\n    IStringDictionary\r\n} from \"../common/Exports.js\";\r\nimport {\r\n    OutputFormat,\r\n    PropertyId\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    ConnectionFactoryBase\r\n} from \"./ConnectionFactoryBase.js\";\r\nimport {\r\n    AuthInfo,\r\n    OutputFormatPropertyName,\r\n    RecognizerConfig,\r\n    WebsocketMessageFormatter\r\n} from \"./Exports.js\";\r\nimport { HeaderNames } from \"./HeaderNames.js\";\r\nimport {\r\n    QueryParameterNames\r\n} from \"./QueryParameterNames.js\";\r\n\r\nexport class TranscriberConnectionFactory extends ConnectionFactoryBase {\r\n\r\n    private readonly multiaudioRelativeUri: string = \"/speech/recognition/multiaudio\";\r\n\r\n    public create(\r\n        config: RecognizerConfig,\r\n        authInfo: AuthInfo,\r\n        connectionId?: string): Promise<IConnection> {\r\n\r\n        let endpoint: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint, undefined);\r\n        const region: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Region, \"centralus\");\r\n        const hostSuffix: string = ConnectionFactoryBase.getHostSuffix(region);\r\n        const hostDefault: string = \"wss://transcribe.\" + region + \".cts.speech\" + hostSuffix + this.multiaudioRelativeUri;\r\n        const host: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Host, hostDefault);\r\n\r\n        const queryParams: IStringDictionary<string> = {};\r\n        this.setQueryParams(queryParams, config, endpoint);\r\n\r\n        if (!endpoint) {\r\n            endpoint = host;\r\n        }\r\n\r\n        const headers: IStringDictionary<string> = {};\r\n        if (authInfo.token !== undefined && authInfo.token !== \"\") {\r\n            headers[authInfo.headerName] = authInfo.token;\r\n        }\r\n        headers[HeaderNames.ConnectionId] = connectionId;\r\n\r\n        config.parameters.setProperty(PropertyId.SpeechServiceConnection_Url, endpoint);\r\n\r\n        const enableCompression: boolean = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\r\n        return Promise.resolve(new WebsocketConnection(endpoint, queryParams, headers, new WebsocketMessageFormatter(), ProxyInfo.fromRecognizerConfig(config), enableCompression, connectionId));\r\n    }\r\n\r\n    public setQueryParams(queryParams: IStringDictionary<string>, config: RecognizerConfig, endpointUrl: string): void {\r\n\r\n        const endpointId: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_EndpointId, undefined);\r\n        const language: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage, undefined);\r\n\r\n        if (endpointId && !(QueryParameterNames.CustomSpeechDeploymentId in queryParams)) {\r\n            queryParams[QueryParameterNames.CustomSpeechDeploymentId] = endpointId;\r\n        }\r\n\r\n        if (language && !(QueryParameterNames.Language in queryParams)) {\r\n            queryParams[QueryParameterNames.Language] = language;\r\n        }\r\n\r\n        const wordLevelTimings: boolean = config.parameters.getProperty(PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps, \"false\").toLowerCase() === \"true\";\r\n        const detailed: boolean = config.parameters.getProperty(OutputFormatPropertyName, OutputFormat[OutputFormat.Simple]) !== OutputFormat[OutputFormat.Simple];\r\n        if (wordLevelTimings || detailed) {\r\n            queryParams[QueryParameterNames.Format] = OutputFormat[OutputFormat.Detailed].toLowerCase();\r\n        }\r\n\r\n        this.setCommonUrlParams(config, queryParams, endpointUrl);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ProxyInfo,\r\n    WebsocketConnection,\r\n} from \"../common.browser/Exports.js\";\r\nimport {\r\n    IConnection,\r\n    IStringDictionary,\r\n} from \"../common/Exports.js\";\r\nimport { StringUtils } from \"../common/StringUtils.js\";\r\nimport {\r\n    PropertyId\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    ConnectionFactoryBase\r\n} from \"./ConnectionFactoryBase.js\";\r\nimport {\r\n    AuthInfo,\r\n    RecognizerConfig,\r\n    WebsocketMessageFormatter,\r\n} from \"./Exports.js\";\r\nimport { HeaderNames } from \"./HeaderNames.js\";\r\nimport { QueryParameterNames } from \"./QueryParameterNames.js\";\r\nimport { RecognitionMode } from \"./ServiceMessages/PhraseDetection/PhraseDetectionContext.js\";\r\n\r\nexport class TranslationConnectionFactory extends ConnectionFactoryBase {\r\n\r\n    private readonly universalUri: string = \"/stt/speech/universal/v2\";\r\n    private readonly translationV1Uri: string = \"/speech/translation/cognitiveservices/v1\";\r\n\r\n    public async create(\r\n        config: RecognizerConfig,\r\n        authInfo: AuthInfo,\r\n        connectionId?: string): Promise<IConnection> {\r\n\r\n        let endpoint: string = this.getEndpointUrl(config);\r\n\r\n        const queryParams: IStringDictionary<string> = {};\r\n\r\n        // Determine if we're using V1 or V2 endpoint\r\n        this.setQueryParams(queryParams, config, endpoint);\r\n\r\n        if (!!endpoint) {\r\n            const endpointUrl = new URL(endpoint);\r\n            const pathName = endpointUrl.pathname;\r\n\r\n            if (pathName === \"\" || pathName === \"/\") {\r\n                // We need to generate the path, and we need to check for a redirect.\r\n                endpointUrl.pathname = this.universalUri;\r\n\r\n                endpoint = await ConnectionFactoryBase.getRedirectUrlFromEndpoint(endpointUrl.toString());\r\n            }\r\n        }\r\n\r\n        const headers: IStringDictionary<string> = {};\r\n        if (authInfo.token !== undefined && authInfo.token !== \"\") {\r\n            headers[authInfo.headerName] = authInfo.token;\r\n        }\r\n        headers[HeaderNames.ConnectionId] = connectionId;\r\n\r\n        config.parameters.setProperty(PropertyId.SpeechServiceConnection_Url, endpoint);\r\n\r\n        const enableCompression: boolean = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\r\n        const webSocketConnection = new WebsocketConnection(endpoint, queryParams, headers, new WebsocketMessageFormatter(), ProxyInfo.fromRecognizerConfig(config), enableCompression, connectionId);\r\n\r\n        return webSocketConnection;\r\n    }\r\n\r\n    public getEndpointUrl(config: RecognizerConfig, returnRegionPlaceholder?: boolean): string {\r\n        const region: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Region);\r\n        const hostSuffix: string = ConnectionFactoryBase.getHostSuffix(region);\r\n\r\n        // First check for an explicitly specified endpoint\r\n        let endpointUrl: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint, undefined);\r\n\r\n        // If an explicit endpoint is provided, use it\r\n        if (endpointUrl) {\r\n            if (returnRegionPlaceholder === true) {\r\n                return endpointUrl;\r\n            }\r\n            return StringUtils.formatString(endpointUrl, { region });\r\n        }\r\n\r\n        // Check if V1 endpoint is explicitly requested\r\n        const forceV1Endpoint: boolean = config.parameters.getProperty(\"SPEECH-ForceV1Endpoint\", \"false\") === \"true\";\r\n\r\n        if (forceV1Endpoint) {\r\n            // Use V1 endpoint with s2s.speech host\r\n            const host: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Host, \"wss://{region}.s2s.speech\" + hostSuffix);\r\n            endpointUrl = host + this.translationV1Uri;\r\n        } else {\r\n            // Default to V2 endpoint with stt.speech host\r\n            const host: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Host, \"wss://{region}.stt.speech\" + hostSuffix);\r\n            endpointUrl = host + this.universalUri;\r\n        }\r\n\r\n        if (returnRegionPlaceholder === true) {\r\n            return endpointUrl;\r\n        }\r\n\r\n        return StringUtils.formatString(endpointUrl, { region });\r\n    }\r\n\r\n    public setQueryParams(queryParams: IStringDictionary<string>, config: RecognizerConfig, endpointUrl: string): void {\r\n        // Common parameters for both V1 and V2 endpoints\r\n        queryParams.from = config.parameters.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage);\r\n        queryParams.to = config.parameters.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages);\r\n        queryParams.scenario = config.recognitionMode === RecognitionMode.Interactive ? \"interactive\" :\r\n            config.recognitionMode === RecognitionMode.Conversation ? \"conversation\" : \"\";\r\n\r\n        // Set common parameters\r\n        this.setCommonUrlParams(config, queryParams, endpointUrl);\r\n        this.setUrlParameter(\r\n            PropertyId.SpeechServiceResponse_TranslationRequestStablePartialResult,\r\n            QueryParameterNames.StableTranslation,\r\n            config,\r\n            queryParams,\r\n            endpointUrl\r\n        );\r\n\r\n        // Handle translation voice if specified\r\n        const translationVoice: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_TranslationVoice, undefined);\r\n        if (translationVoice !== undefined) {\r\n            queryParams.voice = translationVoice;\r\n            // Updated to match C++ implementation\r\n            queryParams.features = \"requireVoice\";\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    ResultReason\r\n} from \"../sdk/Exports.js\";\r\nimport { RecognitionStatus } from \"./Exports.js\";\r\n\r\nexport class EnumTranslation {\r\n    public static implTranslateRecognitionResult(recognitionStatus: RecognitionStatus, expectEndOfDictation: boolean = false): ResultReason {\r\n        let reason = ResultReason.Canceled;\r\n        switch (recognitionStatus) {\r\n            case RecognitionStatus.Success:\r\n                reason = ResultReason.RecognizedSpeech;\r\n                break;\r\n            case RecognitionStatus.EndOfDictation:\r\n                // If we need the result in EndOfDictation (typically some session level result),\r\n                // translate into RecognizedSpeech, otherwise NoMatch\r\n                reason = expectEndOfDictation ? ResultReason.RecognizedSpeech : ResultReason.NoMatch;\r\n                break;\r\n            case RecognitionStatus.NoMatch:\r\n            case RecognitionStatus.InitialSilenceTimeout:\r\n            case RecognitionStatus.BabbleTimeout:\r\n                reason = ResultReason.NoMatch;\r\n                break;\r\n            case RecognitionStatus.Error:\r\n            case RecognitionStatus.BadRequest:\r\n            case RecognitionStatus.Forbidden:\r\n            default:\r\n                reason = ResultReason.Canceled;\r\n                break;\r\n        }\r\n        return reason;\r\n    }\r\n\r\n    public static implTranslateCancelResult(recognitionStatus: RecognitionStatus): CancellationReason {\r\n        let reason = CancellationReason.EndOfStream;\r\n        switch (recognitionStatus) {\r\n            case RecognitionStatus.Success:\r\n            case RecognitionStatus.EndOfDictation:\r\n            case RecognitionStatus.NoMatch:\r\n                reason = CancellationReason.EndOfStream;\r\n                break;\r\n            case RecognitionStatus.InitialSilenceTimeout:\r\n            case RecognitionStatus.BabbleTimeout:\r\n            case RecognitionStatus.Error:\r\n            case RecognitionStatus.BadRequest:\r\n            case RecognitionStatus.Forbidden:\r\n            default:\r\n                reason = CancellationReason.Error;\r\n                break;\r\n        }\r\n        return reason;\r\n    }\r\n\r\n    public static implTranslateCancelErrorCode(recognitionStatus: RecognitionStatus): CancellationErrorCode {\r\n        let reason: CancellationErrorCode = CancellationErrorCode.NoError;\r\n        switch (recognitionStatus) {\r\n            case RecognitionStatus.Error:\r\n                reason = CancellationErrorCode.ServiceError;\r\n                break;\r\n            case RecognitionStatus.TooManyRequests:\r\n                reason = CancellationErrorCode.TooManyRequests;\r\n                break;\r\n            case RecognitionStatus.BadRequest:\r\n                reason = CancellationErrorCode.BadRequestParameters;\r\n                break;\r\n            case RecognitionStatus.Forbidden:\r\n                reason = CancellationErrorCode.Forbidden;\r\n                break;\r\n            default:\r\n                reason = CancellationErrorCode.NoError;\r\n                break;\r\n        }\r\n\r\n        return reason;\r\n\r\n    }\r\n\r\n    public static implTranslateErrorDetails(cancellationErrorCode: CancellationErrorCode): string {\r\n        let errorDetails: string = \"The speech service encountered an internal error and could not continue.\";\r\n        switch (cancellationErrorCode) {\r\n            case CancellationErrorCode.Forbidden:\r\n                errorDetails = \"The recognizer is using a free subscription that ran out of quota.\";\r\n                break;\r\n            case CancellationErrorCode.BadRequestParameters:\r\n                errorDetails = \"Invalid parameter or unsupported audio format in the request.\";\r\n                break;\r\n            case CancellationErrorCode.TooManyRequests:\r\n                errorDetails = \"The number of parallel requests exceeded the number of allowed concurrent transcriptions.\";\r\n                break;\r\n            default:\r\n                break;\r\n        }\r\n        return errorDetails;\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * @class SynthesisStatus\r\n * @private\r\n */\r\nexport enum SynthesisStatus {\r\n    /**\r\n     * The response contains valid audio data.\r\n     * @member SynthesisStatus.Success\r\n     */\r\n    Success,\r\n\r\n    /**\r\n     * Indicates the end of audio data. No valid audio data is included in the message.\r\n     * @member SynthesisStatus.SynthesisEnd\r\n     */\r\n    SynthesisEnd,\r\n\r\n    /**\r\n     * Indicates an error occurred during synthesis data processing.\r\n     * @member SynthesisStatus.Error\r\n     */\r\n    Error,\r\n}\r\n\r\nexport enum RecognitionStatus {\r\n    Success,\r\n    NoMatch,\r\n    InitialSilenceTimeout,\r\n    BabbleTimeout,\r\n    Error,\r\n    EndOfDictation,\r\n    TooManyRequests,\r\n    BadRequest,\r\n    Forbidden,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { SynthesisStatus } from \"../Exports.js\";\r\n\r\n// translation.synthesis.end\r\nexport interface ITranslationSynthesisEnd {\r\n    SynthesisStatus?: SynthesisStatus;\r\n    FailureReason?: string;\r\n    Status?: SynthesisStatus;\r\n}\r\n\r\nexport class TranslationSynthesisEnd implements ITranslationSynthesisEnd {\r\n    private privSynthesisEnd: ITranslationSynthesisEnd;\r\n\r\n    private constructor(json: string) {\r\n        this.privSynthesisEnd = JSON.parse(json) as ITranslationSynthesisEnd;\r\n        if (!!this.privSynthesisEnd.SynthesisStatus) {\r\n            this.privSynthesisEnd.SynthesisStatus = SynthesisStatus[this.privSynthesisEnd.SynthesisStatus as unknown as keyof typeof SynthesisStatus];\r\n        }\r\n        if (!!this.privSynthesisEnd.Status) {\r\n            this.privSynthesisEnd.SynthesisStatus = SynthesisStatus[this.privSynthesisEnd.Status as unknown as keyof typeof SynthesisStatus];\r\n        }\r\n    }\r\n\r\n    public static fromJSON(json: string): TranslationSynthesisEnd {\r\n        return new TranslationSynthesisEnd(json);\r\n    }\r\n\r\n    public get SynthesisStatus(): SynthesisStatus {\r\n        return this.privSynthesisEnd.SynthesisStatus;\r\n    }\r\n\r\n    public get FailureReason(): string {\r\n        return this.privSynthesisEnd.FailureReason;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Contracts } from \"../../sdk/Contracts.js\";\r\nimport { IPrimaryLanguage, ITranslations } from \"../Exports.js\";\r\nimport { TranslationStatus } from \"../TranslationStatus.js\";\r\n\r\n// translation.hypothesis\r\nexport interface ITranslationHypothesis {\r\n    Duration: number;\r\n    Offset: number;\r\n    PrimaryLanguage?: IPrimaryLanguage;\r\n    Text: string;\r\n    Translation: ITranslations;\r\n}\r\n\r\nexport class TranslationHypothesis implements ITranslationHypothesis {\r\n    private privTranslationHypothesis: ITranslationHypothesis;\r\n\r\n    private constructor(hypothesis: ITranslationHypothesis, baseOffset: number) {\r\n        this.privTranslationHypothesis = hypothesis;\r\n        this.privTranslationHypothesis.Offset += baseOffset;\r\n        this.privTranslationHypothesis.Translation.TranslationStatus = this.mapTranslationStatus(this.privTranslationHypothesis.Translation.TranslationStatus);\r\n    }\r\n\r\n    public static fromJSON(json: string, baseOffset: number): TranslationHypothesis {\r\n        return new TranslationHypothesis(JSON.parse(json) as ITranslationHypothesis, baseOffset);\r\n    }\r\n\r\n    public static fromTranslationResponse(translationHypothesis: { SpeechHypothesis: ITranslationHypothesis }, baseOffset: number): TranslationHypothesis {\r\n        Contracts.throwIfNullOrUndefined(translationHypothesis, \"translationHypothesis\");\r\n        const hypothesis: ITranslationHypothesis = translationHypothesis.SpeechHypothesis;\r\n        translationHypothesis.SpeechHypothesis = undefined;\r\n        hypothesis.Translation = (translationHypothesis as unknown as ITranslations);\r\n        return new TranslationHypothesis(hypothesis, baseOffset);\r\n    }\r\n\r\n    public get Duration(): number {\r\n        return this.privTranslationHypothesis.Duration;\r\n    }\r\n\r\n    public get Offset(): number {\r\n        return this.privTranslationHypothesis.Offset;\r\n    }\r\n\r\n    public get Text(): string {\r\n        return this.privTranslationHypothesis.Text;\r\n    }\r\n\r\n    public get Translation(): ITranslations {\r\n        return this.privTranslationHypothesis.Translation;\r\n    }\r\n\r\n    public get Language(): string {\r\n        return this.privTranslationHypothesis.PrimaryLanguage?.Language;\r\n    }\r\n\r\n    public asJson(): string {\r\n        const jsonObj = { ...this.privTranslationHypothesis };\r\n        // Convert the enum value to its string representation for serialization purposes.\r\n\r\n        return jsonObj.Translation !== undefined ? JSON.stringify({\r\n            ...jsonObj,\r\n            TranslationStatus: TranslationStatus[jsonObj.Translation.TranslationStatus] as keyof typeof TranslationStatus\r\n        }) : JSON.stringify(jsonObj);\r\n    }\r\n\r\n    private mapTranslationStatus(status: any): TranslationStatus {\r\n        if (typeof status === \"string\") {\r\n            return TranslationStatus[status as keyof typeof TranslationStatus];\r\n        } else if (typeof status === \"number\") {\r\n            return status;\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Contracts } from \"../../sdk/Contracts.js\";\r\nimport { IPrimaryLanguage, ITranslations, RecognitionStatus } from \"../Exports.js\";\r\nimport { TranslationStatus } from \"../TranslationStatus.js\";\r\n\r\n// translation.phrase\r\nexport interface ITranslationPhrase {\r\n    RecognitionStatus: RecognitionStatus;\r\n    Offset: number;\r\n    Duration: number;\r\n    Translation?: ITranslations;\r\n    Text?: string;\r\n    DisplayText?: string;\r\n    PrimaryLanguage?: IPrimaryLanguage;\r\n}\r\n\r\nexport class TranslationPhrase implements ITranslationPhrase {\r\n    private privTranslationPhrase: ITranslationPhrase;\r\n\r\n    private constructor(phrase: ITranslationPhrase, baseOffset: number) {\r\n        this.privTranslationPhrase = phrase;\r\n        this.privTranslationPhrase.Offset += baseOffset;\r\n        this.privTranslationPhrase.RecognitionStatus = this.mapRecognitionStatus(this.privTranslationPhrase.RecognitionStatus);\r\n        if (this.privTranslationPhrase.Translation !== undefined) {\r\n            this.privTranslationPhrase.Translation.TranslationStatus = this.mapTranslationStatus(this.privTranslationPhrase.Translation.TranslationStatus);\r\n        }\r\n    }\r\n\r\n    public static fromJSON(json: string, baseOffset: number): TranslationPhrase {\r\n        return new TranslationPhrase(JSON.parse(json) as ITranslationPhrase, baseOffset);\r\n    }\r\n\r\n    public static fromTranslationResponse(translationResponse: { SpeechPhrase: ITranslationPhrase }, baseOffset: number): TranslationPhrase {\r\n        Contracts.throwIfNullOrUndefined(translationResponse, \"translationResponse\");\r\n        const phrase: ITranslationPhrase = translationResponse.SpeechPhrase;\r\n        translationResponse.SpeechPhrase = undefined;\r\n        phrase.Translation = (translationResponse as unknown as ITranslations);\r\n        phrase.Text = phrase.DisplayText;\r\n        return new TranslationPhrase(phrase, baseOffset);\r\n    }\r\n\r\n    public get RecognitionStatus(): RecognitionStatus {\r\n        return this.privTranslationPhrase.RecognitionStatus;\r\n    }\r\n\r\n    public get Offset(): number {\r\n        return this.privTranslationPhrase.Offset;\r\n    }\r\n\r\n    public get Duration(): number {\r\n        return this.privTranslationPhrase.Duration;\r\n    }\r\n\r\n    public get Text(): string | undefined {\r\n        return this.privTranslationPhrase.Text;\r\n    }\r\n\r\n    public get Language(): string | undefined {\r\n        return this.privTranslationPhrase.PrimaryLanguage?.Language;\r\n    }\r\n\r\n    public get Confidence(): string | undefined {\r\n        return this.privTranslationPhrase.PrimaryLanguage?.Confidence;\r\n    }\r\n\r\n    public get Translation(): ITranslations | undefined {\r\n        return this.privTranslationPhrase.Translation;\r\n    }\r\n\r\n    public asJson(): string {\r\n        const jsonObj = { ...this.privTranslationPhrase };\r\n\r\n        // Convert the enum values to their string representations for serialization\r\n        const serializedObj: any = {\r\n            ...jsonObj,\r\n            RecognitionStatus: RecognitionStatus[jsonObj.RecognitionStatus]\r\n        };\r\n\r\n        if (jsonObj.Translation) {\r\n            // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\r\n            serializedObj.Translation = {\r\n                ...jsonObj.Translation,\r\n                TranslationStatus: TranslationStatus[jsonObj.Translation.TranslationStatus]\r\n            };\r\n        }\r\n\r\n        return JSON.stringify(serializedObj);\r\n    }\r\n\r\n    private mapRecognitionStatus(status: any): RecognitionStatus {\r\n        if (typeof status === \"string\") {\r\n            return RecognitionStatus[status as keyof typeof RecognitionStatus];\r\n        } else if (typeof status === \"number\") {\r\n            return status;\r\n        }\r\n    }\r\n\r\n    private mapTranslationStatus(status: any): TranslationStatus {\r\n        if (typeof status === \"string\") {\r\n            return TranslationStatus[status as keyof typeof TranslationStatus];\r\n        } else if (typeof status === \"number\") {\r\n            return status;\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ConnectionEvent,\r\n    IAudioSource,\r\n    MessageType,\r\n    TranslationStatus,\r\n} from \"../common/Exports.js\";\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    ResultReason,\r\n    SpeechRecognitionResult,\r\n    TranslationRecognitionCanceledEventArgs,\r\n    TranslationRecognitionEventArgs,\r\n    TranslationRecognitionResult,\r\n    TranslationRecognizer,\r\n    Translations,\r\n    TranslationSynthesisEventArgs,\r\n    TranslationSynthesisResult,\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    CancellationErrorCodePropertyName,\r\n    ConversationServiceRecognizer,\r\n    EnumTranslation,\r\n    ITranslationHypothesis,\r\n    RecognitionStatus,\r\n    SynthesisStatus,\r\n    TranslationHypothesis,\r\n    TranslationPhrase,\r\n    TranslationSynthesisEnd,\r\n} from \"./Exports.js\";\r\nimport { IAuthentication } from \"./IAuthentication.js\";\r\nimport { IConnectionFactory } from \"./IConnectionFactory.js\";\r\nimport { RecognizerConfig } from \"./RecognizerConfig.js\";\r\nimport { ITranslationPhrase } from \"./ServiceMessages/TranslationPhrase.js\";\r\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal.js\";\r\n\r\n// eslint-disable-next-line max-classes-per-file\r\nexport class TranslationServiceRecognizer extends ConversationServiceRecognizer {\r\n    private privTranslationRecognizer: TranslationRecognizer;\r\n\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioSource: IAudioSource,\r\n        recognizerConfig: RecognizerConfig,\r\n        translationRecognizer: TranslationRecognizer) {\r\n\r\n        super(authentication, connectionFactory, audioSource, recognizerConfig, translationRecognizer);\r\n        this.privTranslationRecognizer = translationRecognizer;\r\n        this.connectionEvents.attach((connectionEvent: ConnectionEvent): void => {\r\n            if (connectionEvent.name === \"ConnectionEstablishedEvent\") {\r\n                this.privTranslationRecognizer.onConnection();\r\n            }\r\n        });\r\n\r\n    }\r\n\r\n    protected async processTypeSpecificMessages(connectionMessage: SpeechConnectionMessage): Promise<boolean> {\r\n\r\n        const resultProps: PropertyCollection = new PropertyCollection();\r\n        let processed: boolean = await this.processSpeechMessages(connectionMessage);\r\n        if (processed) {\r\n            return true;\r\n        }\r\n\r\n        const handleTranslationPhrase = async (translatedPhrase: TranslationPhrase): Promise<void> => {\r\n            resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, translatedPhrase.asJson());\r\n\r\n            const phraseLatencyMs = this.privRequestSession.onPhraseRecognized(translatedPhrase.Offset + translatedPhrase.Duration);\r\n            if (phraseLatencyMs > 0) {\r\n                resultProps.setProperty(PropertyId.SpeechServiceResponse_RecognitionLatencyMs, phraseLatencyMs.toString());\r\n            }\r\n\r\n            if (translatedPhrase.RecognitionStatus === RecognitionStatus.Success) {\r\n\r\n                // OK, the recognition was successful. How'd the translation do?\r\n                const result: TranslationRecognitionEventArgs = this.fireEventForResult(translatedPhrase, resultProps);\r\n                if (!!this.privTranslationRecognizer.recognized) {\r\n                    try {\r\n                        this.privTranslationRecognizer.recognized(this.privTranslationRecognizer, result);\r\n                        /* eslint-disable no-empty */\r\n                    } catch (error) {\r\n                        // Not going to let errors in the event handler\r\n                        // trip things up.\r\n                    }\r\n                }\r\n\r\n                // report result to promise.\r\n                if (!!this.privSuccessCallback) {\r\n                    try {\r\n                        this.privSuccessCallback(result.result);\r\n                    } catch (e) {\r\n                        if (!!this.privErrorCallback) {\r\n                            this.privErrorCallback(e as string);\r\n                        }\r\n                    }\r\n                    // Only invoke the call back once.\r\n                    // and if it's successful don't invoke the\r\n                    // error after that.\r\n                    this.privSuccessCallback = undefined;\r\n                    this.privErrorCallback = undefined;\r\n                }\r\n            } else {\r\n                const reason: ResultReason = EnumTranslation.implTranslateRecognitionResult(translatedPhrase.RecognitionStatus);\r\n\r\n                const result = new TranslationRecognitionResult(\r\n                    undefined,\r\n                    this.privRequestSession.requestId,\r\n                    reason,\r\n                    translatedPhrase.Text,\r\n                    translatedPhrase.Duration,\r\n                    translatedPhrase.Offset,\r\n                    translatedPhrase.Language,\r\n                    translatedPhrase.Confidence,\r\n                    undefined,\r\n                    translatedPhrase.asJson(),\r\n                    resultProps);\r\n\r\n                if (reason === ResultReason.Canceled) {\r\n                    const cancelReason: CancellationReason = EnumTranslation.implTranslateCancelResult(translatedPhrase.RecognitionStatus);\r\n                    const cancellationErrorCode: CancellationErrorCode = EnumTranslation.implTranslateCancelErrorCode(translatedPhrase.RecognitionStatus);\r\n\r\n                    await this.cancelRecognitionLocal(\r\n                        cancelReason,\r\n                        cancellationErrorCode,\r\n                        EnumTranslation.implTranslateErrorDetails(cancellationErrorCode));\r\n\r\n                } else {\r\n                    if (translatedPhrase.RecognitionStatus !== RecognitionStatus.EndOfDictation) {\r\n                        const ev = new TranslationRecognitionEventArgs(result, result.offset, this.privRequestSession.sessionId);\r\n\r\n                        if (!!this.privTranslationRecognizer.recognized) {\r\n                            try {\r\n                                this.privTranslationRecognizer.recognized(this.privTranslationRecognizer, ev);\r\n                                /* eslint-disable no-empty */\r\n                            } catch (error) {\r\n                                // Not going to let errors in the event handler\r\n                                // trip things up.\r\n                            }\r\n                        }\r\n\r\n                        // report result to promise.\r\n                        if (!!this.privSuccessCallback) {\r\n                            try {\r\n                                this.privSuccessCallback(result);\r\n                            } catch (e) {\r\n                                if (!!this.privErrorCallback) {\r\n                                    this.privErrorCallback(e as string);\r\n                                }\r\n                            }\r\n                            // Only invoke the call back once.\r\n                            // and if it's successful don't invoke the\r\n                            // error after that.\r\n                            this.privSuccessCallback = undefined;\r\n                            this.privErrorCallback = undefined;\r\n                        }\r\n                    }\r\n                }\r\n                processed = true;\r\n            }\r\n\r\n        };\r\n\r\n        const handleTranslationHypothesis = (hypothesis: TranslationHypothesis): void => {\r\n            resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, hypothesis.asJson());\r\n\r\n            const hypothesisLatencyMs = this.privRequestSession.onHypothesis(hypothesis.Offset);\r\n            if (hypothesisLatencyMs > 0) {\r\n                resultProps.setProperty(PropertyId.SpeechServiceResponse_RecognitionLatencyMs, hypothesisLatencyMs.toString());\r\n            }\r\n\r\n            const result: TranslationRecognitionEventArgs = this.fireEventForResult(hypothesis, resultProps);\r\n\r\n            if (!!this.privTranslationRecognizer.recognizing) {\r\n                try {\r\n                    this.privTranslationRecognizer.recognizing(this.privTranslationRecognizer, result);\r\n                    /* eslint-disable no-empty */\r\n                } catch (error) {\r\n                    // Not going to let errors in the event handler\r\n                    // trip things up.\r\n                }\r\n            }\r\n            processed = true;\r\n        };\r\n\r\n        if (connectionMessage.messageType === MessageType.Text) {\r\n            resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, connectionMessage.textBody);\r\n        }\r\n\r\n        switch (connectionMessage.path.toLowerCase()) {\r\n            case \"translation.hypothesis\":\r\n                handleTranslationHypothesis(TranslationHypothesis.fromJSON(connectionMessage.textBody, this.privRequestSession.currentTurnAudioOffset));\r\n                break;\r\n\r\n            case \"translation.response\":\r\n                const phrase: { SpeechPhrase: ITranslationPhrase } = JSON.parse(connectionMessage.textBody) as { SpeechPhrase: ITranslationPhrase };\r\n                if (!!phrase.SpeechPhrase) {\r\n                    await handleTranslationPhrase(TranslationPhrase.fromTranslationResponse(phrase, this.privRequestSession.currentTurnAudioOffset));\r\n                } else {\r\n                    const hypothesis: { SpeechHypothesis: ITranslationHypothesis } = JSON.parse(connectionMessage.textBody) as { SpeechHypothesis: ITranslationHypothesis };\r\n                    if (!!hypothesis.SpeechHypothesis) {\r\n                        handleTranslationHypothesis(TranslationHypothesis.fromTranslationResponse(hypothesis, this.privRequestSession.currentTurnAudioOffset));\r\n                    }\r\n                }\r\n                break;\r\n            case \"translation.phrase\":\r\n                await handleTranslationPhrase(TranslationPhrase.fromJSON(connectionMessage.textBody, this.privRequestSession.currentTurnAudioOffset));\r\n                break;\r\n\r\n            case \"translation.synthesis\":\r\n            case \"audio\":\r\n                this.sendSynthesisAudio(connectionMessage.binaryBody, this.privRequestSession.sessionId);\r\n                processed = true;\r\n                break;\r\n\r\n            case \"audio.end\":\r\n            case \"translation.synthesis.end\":\r\n                const synthEnd: TranslationSynthesisEnd = TranslationSynthesisEnd.fromJSON(connectionMessage.textBody);\r\n\r\n                switch (synthEnd.SynthesisStatus) {\r\n                    case SynthesisStatus.Error:\r\n                        if (!!this.privTranslationRecognizer.synthesizing) {\r\n                            const result = new TranslationSynthesisResult(ResultReason.Canceled, undefined);\r\n                            const retEvent: TranslationSynthesisEventArgs = new TranslationSynthesisEventArgs(result, this.privRequestSession.sessionId);\r\n\r\n                            try {\r\n                                this.privTranslationRecognizer.synthesizing(this.privTranslationRecognizer, retEvent);\r\n                                /* eslint-disable no-empty */\r\n                            } catch (error) {\r\n                                // Not going to let errors in the event handler\r\n                                // trip things up.\r\n                            }\r\n                        }\r\n\r\n                        if (!!this.privTranslationRecognizer.canceled) {\r\n                            // And raise a canceled event to send the rich(er) error message back.\r\n                            const canceledResult: TranslationRecognitionCanceledEventArgs = new TranslationRecognitionCanceledEventArgs(\r\n                                this.privRequestSession.sessionId,\r\n                                CancellationReason.Error,\r\n                                synthEnd.FailureReason,\r\n                                CancellationErrorCode.ServiceError,\r\n                                null);\r\n\r\n                            try {\r\n                                this.privTranslationRecognizer.canceled(this.privTranslationRecognizer, canceledResult);\r\n                                /* eslint-disable no-empty */\r\n                            } catch (error) {\r\n                                // Not going to let errors in the event handler\r\n                                // trip things up.\r\n                            }\r\n                        }\r\n                        break;\r\n                    case SynthesisStatus.Success:\r\n                        this.sendSynthesisAudio(undefined, this.privRequestSession.sessionId);\r\n                        break;\r\n                    default:\r\n                        break;\r\n                }\r\n                processed = true;\r\n                break;\r\n            default:\r\n                break;\r\n        }\r\n        return processed;\r\n    }\r\n\r\n    // Cancels recognition.\r\n    protected cancelRecognition(\r\n        sessionId: string,\r\n        requestId: string,\r\n        cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): void {\r\n\r\n        const properties: PropertyCollection = new PropertyCollection();\r\n        properties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[errorCode]);\r\n\r\n        if (!!this.privTranslationRecognizer.canceled) {\r\n\r\n            const cancelEvent: TranslationRecognitionCanceledEventArgs = new TranslationRecognitionCanceledEventArgs(\r\n                sessionId,\r\n                cancellationReason,\r\n                error,\r\n                errorCode,\r\n                undefined);\r\n\r\n            try {\r\n                this.privTranslationRecognizer.canceled(this.privTranslationRecognizer, cancelEvent);\r\n                /* eslint-disable no-empty */\r\n            } catch { }\r\n        }\r\n\r\n        if (!!this.privSuccessCallback) {\r\n            const result: TranslationRecognitionResult = new TranslationRecognitionResult(\r\n                undefined, // Translations\r\n                requestId,\r\n                ResultReason.Canceled,\r\n                undefined, // Text\r\n                undefined, // Druation\r\n                undefined, // Offset\r\n                undefined, // Language\r\n                undefined, // LanguageDetectionConfidence\r\n                error,\r\n                undefined, // Json\r\n                properties);\r\n            try {\r\n                this.privSuccessCallback(result);\r\n                /* eslint-disable no-empty */\r\n                this.privSuccessCallback = undefined;\r\n            } catch { }\r\n        }\r\n    }\r\n\r\n    protected handleRecognizingCallback(result: SpeechRecognitionResult, offset: number, sessionId: string): void {\r\n        try {\r\n            const ev = new TranslationRecognitionEventArgs(TranslationRecognitionResult.fromSpeechRecognitionResult(result), offset, sessionId);\r\n            this.privTranslationRecognizer.recognizing(this.privTranslationRecognizer, ev);\r\n            /* eslint-disable no-empty */\r\n        } catch (error) {\r\n            // Not going to let errors in the event handler\r\n            // trip things up.\r\n        }\r\n    }\r\n\r\n    protected handleRecognizedCallback(result: SpeechRecognitionResult, offset: number, sessionId: string): void {\r\n        try {\r\n            const ev = new TranslationRecognitionEventArgs(TranslationRecognitionResult.fromSpeechRecognitionResult(result), offset, sessionId);\r\n            this.privTranslationRecognizer.recognized(this.privTranslationRecognizer, ev);\r\n        } catch (error) {\r\n            // Not going to let errors in the event handler\r\n            // trip things up.\r\n        }\r\n    }\r\n\r\n    private fireEventForResult(serviceResult: TranslationHypothesis | TranslationPhrase, properties: PropertyCollection): TranslationRecognitionEventArgs {\r\n        let translations: Translations;\r\n\r\n        if (undefined !== serviceResult.Translation.Translations) {\r\n            translations = new Translations();\r\n            for (const translation of serviceResult.Translation.Translations) {\r\n                translations.set(translation.Language, translation.Text || translation.DisplayText);\r\n            }\r\n        }\r\n\r\n        let resultReason: ResultReason;\r\n        let confidence: string;\r\n        if (serviceResult instanceof TranslationPhrase) {\r\n            if (!!serviceResult.Translation && serviceResult.Translation.TranslationStatus === TranslationStatus.Success) {\r\n                resultReason = ResultReason.TranslatedSpeech;\r\n            } else {\r\n                resultReason = ResultReason.RecognizedSpeech;\r\n            }\r\n            confidence = serviceResult.Confidence;\r\n        } else {\r\n            resultReason = ResultReason.TranslatingSpeech;\r\n        }\r\n        const language = serviceResult.Language;\r\n\r\n        const result = new TranslationRecognitionResult(\r\n            translations,\r\n            this.privRequestSession.requestId,\r\n            resultReason,\r\n            serviceResult.Text,\r\n            serviceResult.Duration,\r\n            serviceResult.Offset,\r\n            language,\r\n            confidence,\r\n            serviceResult.Translation.FailureReason,\r\n            serviceResult.asJson(),\r\n            properties);\r\n\r\n        const ev = new TranslationRecognitionEventArgs(result, serviceResult.Offset, this.privRequestSession.sessionId);\r\n        return ev;\r\n    }\r\n\r\n    private sendSynthesisAudio(audio: ArrayBuffer, sessionId: string): void {\r\n        const reason = (undefined === audio) ? ResultReason.SynthesizingAudioCompleted : ResultReason.SynthesizingAudio;\r\n        const result = new TranslationSynthesisResult(reason, audio);\r\n        const retEvent: TranslationSynthesisEventArgs = new TranslationSynthesisEventArgs(result, sessionId);\r\n\r\n        if (!!this.privTranslationRecognizer.synthesizing) {\r\n            try {\r\n                this.privTranslationRecognizer.synthesizing(this.privTranslationRecognizer, retEvent);\r\n                /* eslint-disable no-empty */\r\n            } catch (error) {\r\n                // Not going to let errors in the event handler\r\n                // trip things up.\r\n            }\r\n        }\r\n\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n// speech.endDetected\r\nexport interface ISpeechDetected {\r\n    Offset: number;\r\n}\r\n\r\nexport class SpeechDetected implements ISpeechDetected {\r\n    private privSpeechStartDetected: ISpeechDetected;\r\n\r\n    private constructor(json: string, baseOffset: number) {\r\n        this.privSpeechStartDetected = JSON.parse(json) as ISpeechDetected;\r\n        this.privSpeechStartDetected.Offset += baseOffset;\r\n    }\r\n\r\n    public static fromJSON(json: string, baseOffset: number): SpeechDetected {\r\n        return new SpeechDetected(json, baseOffset);\r\n    }\r\n\r\n    public get Offset(): number {\r\n        return this.privSpeechStartDetected.Offset;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { IPrimaryLanguage } from \"./SimpleSpeechPhrase.js\";\r\n\r\n// speech.hypothesis\r\nexport interface ISpeechHypothesis {\r\n    Text: string;\r\n    Offset: number;\r\n    Duration: number;\r\n    PrimaryLanguage?: IPrimaryLanguage;\r\n    SpeakerId?: string;\r\n    [key: string]: any;\r\n}\r\n\r\nexport class SpeechHypothesis implements ISpeechHypothesis {\r\n    private privSpeechHypothesis: ISpeechHypothesis;\r\n\r\n    private constructor(json: string, baseOffset: number) {\r\n        this.privSpeechHypothesis = JSON.parse(json) as ISpeechHypothesis;\r\n        this.updateOffset(baseOffset);\r\n    }\r\n\r\n    public static fromJSON(json: string, baseOffset: number): SpeechHypothesis {\r\n        return new SpeechHypothesis(json, baseOffset);\r\n    }\r\n\r\n    private updateOffset(baseOffset: number): void {\r\n        this.privSpeechHypothesis.Offset += baseOffset;\r\n    }\r\n\r\n    public asJson(): string {\r\n        return JSON.stringify(this.privSpeechHypothesis);\r\n    }\r\n\r\n    public get Text(): string {\r\n        return this.privSpeechHypothesis.Text;\r\n    }\r\n\r\n    public get Offset(): number {\r\n        return this.privSpeechHypothesis.Offset;\r\n    }\r\n\r\n    public get Duration(): number {\r\n        return this.privSpeechHypothesis.Duration;\r\n    }\r\n\r\n    public get Language(): string {\r\n        return this.privSpeechHypothesis.PrimaryLanguage === undefined ? undefined : this.privSpeechHypothesis.PrimaryLanguage.Language;\r\n    }\r\n\r\n    public get LanguageDetectionConfidence(): string {\r\n        return this.privSpeechHypothesis.PrimaryLanguage === undefined ? undefined : this.privSpeechHypothesis.PrimaryLanguage.Confidence;\r\n    }\r\n\r\n    public get SpeakerId(): string {\r\n        return this.privSpeechHypothesis.SpeakerId;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n// speech.keyword\r\nexport interface ISpeechKeyword {\r\n    Status: string;\r\n    Text: string;\r\n    Offset: number;\r\n    Duration: number;\r\n    [key: string]: any;\r\n}\r\n\r\nexport class SpeechKeyword implements ISpeechKeyword {\r\n    private privSpeechKeyword: ISpeechKeyword;\r\n\r\n    private constructor(json: string, baseOffset: number) {\r\n        this.privSpeechKeyword = JSON.parse(json) as ISpeechKeyword;\r\n        this.privSpeechKeyword.Offset += baseOffset;\r\n    }\r\n\r\n    public static fromJSON(json: string, baseOffset: number): SpeechKeyword {\r\n        return new SpeechKeyword(json, baseOffset);\r\n    }\r\n\r\n    public get Status(): string {\r\n        return this.privSpeechKeyword.Status;\r\n    }\r\n\r\n    public get Text(): string {\r\n        return this.privSpeechKeyword.Text;\r\n    }\r\n\r\n    public get Offset(): number {\r\n        return this.privSpeechKeyword.Offset;\r\n    }\r\n\r\n    public get Duration(): number {\r\n        return this.privSpeechKeyword.Duration;\r\n    }\r\n\r\n    public asJson(): string {\r\n        return JSON.stringify(this.privSpeechKeyword);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { IAudioSource } from \"../common/Exports.js\";\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    OutputFormat,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    ResultReason,\r\n    SpeechRecognitionCanceledEventArgs,\r\n    SpeechRecognitionEventArgs,\r\n    SpeechRecognitionResult,\r\n    SpeechRecognizer,\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    CancellationErrorCodePropertyName,\r\n    DetailedSpeechPhrase,\r\n    EnumTranslation,\r\n    OutputFormatPropertyName,\r\n    RecognitionStatus,\r\n    ServiceRecognizerBase,\r\n    SimpleSpeechPhrase,\r\n    SpeechHypothesis,\r\n} from \"./Exports.js\";\r\nimport { IAuthentication } from \"./IAuthentication.js\";\r\nimport { IConnectionFactory } from \"./IConnectionFactory.js\";\r\nimport { RecognizerConfig } from \"./RecognizerConfig.js\";\r\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal.js\";\r\n\r\n// eslint-disable-next-line max-classes-per-file\r\nexport class SpeechServiceRecognizer extends ServiceRecognizerBase {\r\n\r\n    private privSpeechRecognizer: SpeechRecognizer;\r\n\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioSource: IAudioSource,\r\n        recognizerConfig: RecognizerConfig,\r\n        speechRecognizer: SpeechRecognizer) {\r\n        super(authentication, connectionFactory, audioSource, recognizerConfig, speechRecognizer);\r\n        this.privSpeechRecognizer = speechRecognizer;\r\n\r\n    }\r\n\r\n    protected async processTypeSpecificMessages(connectionMessage: SpeechConnectionMessage): Promise<boolean> {\r\n\r\n        let result: SpeechRecognitionResult;\r\n\r\n        const resultProps: PropertyCollection = new PropertyCollection();\r\n\r\n        let processed: boolean = false;\r\n\r\n        switch (connectionMessage.path.toLowerCase()) {\r\n            case \"speech.hypothesis\":\r\n            case \"speech.fragment\":\r\n                const hypothesis: SpeechHypothesis = SpeechHypothesis.fromJSON(connectionMessage.textBody, this.privRequestSession.currentTurnAudioOffset);\r\n                resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, hypothesis.asJson());\r\n\r\n                const hypothesisLatencyMs = this.privRequestSession.onHypothesis(hypothesis.Offset);\r\n                if (hypothesisLatencyMs > 0) {\r\n                    resultProps.setProperty(PropertyId.SpeechServiceResponse_RecognitionLatencyMs, hypothesisLatencyMs.toString());\r\n                }\r\n\r\n                result = new SpeechRecognitionResult(\r\n                    this.privRequestSession.requestId,\r\n                    ResultReason.RecognizingSpeech,\r\n                    hypothesis.Text,\r\n                    hypothesis.Duration,\r\n                    hypothesis.Offset,\r\n                    hypothesis.Language,\r\n                    hypothesis.LanguageDetectionConfidence,\r\n                    undefined, // Speaker Id\r\n                    undefined,\r\n                    hypothesis.asJson(),\r\n                    resultProps);\r\n\r\n                const ev = new SpeechRecognitionEventArgs(result, hypothesis.Offset, this.privRequestSession.sessionId);\r\n\r\n                if (!!this.privSpeechRecognizer.recognizing) {\r\n                    try {\r\n                        this.privSpeechRecognizer.recognizing(this.privSpeechRecognizer, ev);\r\n                        /* eslint-disable no-empty */\r\n                    } catch (error) {\r\n                        // Not going to let errors in the event handler\r\n                        // trip things up.\r\n                    }\r\n                }\r\n                processed = true;\r\n                break;\r\n            case \"speech.phrase\":\r\n                const simple: SimpleSpeechPhrase = SimpleSpeechPhrase.fromJSON(connectionMessage.textBody, this.privRequestSession.currentTurnAudioOffset);\r\n                resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, simple.asJson());\r\n\r\n                const resultReason: ResultReason = EnumTranslation.implTranslateRecognitionResult(simple.RecognitionStatus, this.privExpectContentAssessmentResponse);\r\n\r\n                const phraseLatencyMs = this.privRequestSession.onPhraseRecognized(simple.Offset + simple.Duration);\r\n                if (phraseLatencyMs > 0) {\r\n                    resultProps.setProperty(PropertyId.SpeechServiceResponse_RecognitionLatencyMs, phraseLatencyMs.toString());\r\n                }\r\n\r\n                if (ResultReason.Canceled === resultReason) {\r\n                    const cancelReason: CancellationReason = EnumTranslation.implTranslateCancelResult(simple.RecognitionStatus);\r\n                    const cancellationErrorCode: CancellationErrorCode = EnumTranslation.implTranslateCancelErrorCode(simple.RecognitionStatus);\r\n\r\n                    await this.cancelRecognitionLocal(\r\n                        cancelReason,\r\n                        cancellationErrorCode,\r\n                        EnumTranslation.implTranslateErrorDetails(cancellationErrorCode));\r\n\r\n                } else {\r\n                    // Like the native SDK's, don't event / return an EndOfDictation message.\r\n                    if (simple.RecognitionStatus === RecognitionStatus.EndOfDictation) {\r\n                        break;\r\n                    }\r\n\r\n                    if (this.privRecognizerConfig.parameters.getProperty(OutputFormatPropertyName) === OutputFormat[OutputFormat.Simple]) {\r\n                        result = new SpeechRecognitionResult(\r\n                            this.privRequestSession.requestId,\r\n                            resultReason,\r\n                            simple.DisplayText,\r\n                            simple.Duration,\r\n                            simple.Offset,\r\n                            simple.Language,\r\n                            simple.LanguageDetectionConfidence,\r\n                            undefined, // Speaker Id\r\n                            undefined,\r\n                            simple.asJson(),\r\n                            resultProps);\r\n                    } else {\r\n                        const detailed: DetailedSpeechPhrase = DetailedSpeechPhrase.fromJSON(connectionMessage.textBody, this.privRequestSession.currentTurnAudioOffset);\r\n                        resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, detailed.asJson());\r\n\r\n                        result = new SpeechRecognitionResult(\r\n                            this.privRequestSession.requestId,\r\n                            resultReason,\r\n                            detailed.RecognitionStatus === RecognitionStatus.Success ? detailed.NBest[0].Display : \"\",\r\n                            detailed.Duration,\r\n                            detailed.Offset,\r\n                            detailed.Language,\r\n                            detailed.LanguageDetectionConfidence,\r\n                            undefined, // Speaker Id\r\n                            undefined,\r\n                            detailed.asJson(),\r\n                            resultProps);\r\n                    }\r\n\r\n                    const event: SpeechRecognitionEventArgs = new SpeechRecognitionEventArgs(result, result.offset, this.privRequestSession.sessionId);\r\n\r\n                    if (!!this.privSpeechRecognizer.recognized) {\r\n                        try {\r\n                            this.privSpeechRecognizer.recognized(this.privSpeechRecognizer, event);\r\n                            /* eslint-disable no-empty */\r\n                        } catch (error) {\r\n                            // Not going to let errors in the event handler\r\n                            // trip things up.\r\n                        }\r\n                    }\r\n\r\n\r\n                    if (!!this.privSuccessCallback) {\r\n                        try {\r\n                            this.privSuccessCallback(result);\r\n                        } catch (e) {\r\n                            if (!!this.privErrorCallback) {\r\n                                this.privErrorCallback(e as string);\r\n                            }\r\n                        }\r\n                        // Only invoke the call back once.\r\n                        // and if it's successful don't invoke the\r\n                        // error after that.\r\n                        this.privSuccessCallback = undefined;\r\n                        this.privErrorCallback = undefined;\r\n                    }\r\n                }\r\n                processed = true;\r\n                break;\r\n            default:\r\n                break;\r\n        }\r\n        return processed;\r\n    }\r\n\r\n    // Cancels recognition.\r\n    protected cancelRecognition(\r\n        sessionId: string,\r\n        requestId: string,\r\n        cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): void {\r\n\r\n        const properties: PropertyCollection = new PropertyCollection();\r\n        properties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[errorCode]);\r\n\r\n        if (!!this.privSpeechRecognizer.canceled) {\r\n            const cancelEvent: SpeechRecognitionCanceledEventArgs = new SpeechRecognitionCanceledEventArgs(\r\n                cancellationReason,\r\n                error,\r\n                errorCode,\r\n                undefined,\r\n                sessionId);\r\n            try {\r\n                this.privSpeechRecognizer.canceled(this.privSpeechRecognizer, cancelEvent);\r\n                /* eslint-disable no-empty */\r\n            } catch { }\r\n        }\r\n\r\n        if (!!this.privSuccessCallback) {\r\n            const result: SpeechRecognitionResult = new SpeechRecognitionResult(\r\n                requestId,\r\n                ResultReason.Canceled,\r\n                undefined, // Text\r\n                undefined, // Duration\r\n                undefined, // Offset\r\n                undefined, // Language\r\n                undefined, // Language Detection Confidence\r\n                undefined, // Speaker Id\r\n                error,\r\n                undefined, // Json\r\n                properties);\r\n            try {\r\n                this.privSuccessCallback(result);\r\n                this.privSuccessCallback = undefined;\r\n                /* eslint-disable no-empty */\r\n            } catch { }\r\n        }\r\n    }\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\n/**\r\n * The speaker diarization mode\r\n */\r\nexport enum SpeakerDiarizationMode {\r\n    None = \"None\",\r\n    Identity = \"Identity\",\r\n    Anonymous = \"Anonymous\"\r\n}\r\n\r\n/**\r\n * The identity provider\r\n */\r\nexport enum IdentityProvider {\r\n    CallCenter = \"CallCenter\"\r\n}\r\n\r\n/**\r\n * The speaker diarization configuration\r\n */\r\nexport interface SpeakerDiarization {\r\n    /**\r\n     * The mode\r\n     */\r\n    mode?: SpeakerDiarizationMode;\r\n\r\n    /**\r\n     * The identity provider\r\n     */\r\n    identityProvider?: IdentityProvider;\r\n\r\n    /**\r\n     * A token that identifies a diarization session across reconnects\r\n     */\r\n    audioSessionId?: string;\r\n\r\n    /**\r\n     * The audio offset measured in msec to apply to the audio stream in case this is a session reconnect\r\n     */\r\n    audioOffsetMs?: number;\r\n\r\n    /**\r\n     * If set to true the diarization will be performed on the intermediate results\r\n     */\r\n    diarizeIntermediates?: boolean;\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { IAudioSource } from \"../common/Exports.js\";\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    OutputFormat,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    ResultReason,\r\n    ConversationTranscriptionCanceledEventArgs,\r\n    ConversationTranscriptionEventArgs,\r\n    ConversationTranscriptionResult,\r\n    ConversationTranscriber,\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    CancellationErrorCodePropertyName,\r\n    DetailedSpeechPhrase,\r\n    EnumTranslation,\r\n    OutputFormatPropertyName,\r\n    RecognitionStatus,\r\n    ServiceRecognizerBase,\r\n    SimpleSpeechPhrase,\r\n    SpeechHypothesis,\r\n} from \"./Exports.js\";\r\nimport { IAuthentication } from \"./IAuthentication.js\";\r\nimport { IConnectionFactory } from \"./IConnectionFactory.js\";\r\nimport { RecognizerConfig } from \"./RecognizerConfig.js\";\r\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal.js\";\r\nimport { SpeakerDiarization, SpeakerDiarizationMode } from \"./ServiceMessages/PhraseDetection/SpeakerDiarization.js\";\r\nimport { RecognitionMode } from \"./ServiceMessages/PhraseDetection/PhraseDetectionContext.js\";\r\n\r\n// eslint-disable-next-line max-classes-per-file\r\nexport class ConversationTranscriptionServiceRecognizer extends ServiceRecognizerBase {\r\n\r\n    private privConversationTranscriber: ConversationTranscriber;\r\n\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioSource: IAudioSource,\r\n        recognizerConfig: RecognizerConfig,\r\n        conversationTranscriber: ConversationTranscriber) {\r\n        super(authentication, connectionFactory, audioSource, recognizerConfig, conversationTranscriber);\r\n        this.privConversationTranscriber = conversationTranscriber;\r\n        this.setSpeakerDiarizationJson();\r\n    }\r\n\r\n    protected setSpeakerDiarizationJson(): void {\r\n        if (this.privEnableSpeakerId) {\r\n            const phraseDetection = this.privSpeechContext.getContext().phraseDetection || {};\r\n            phraseDetection.mode = RecognitionMode.Conversation;\r\n            const speakerDiarization: SpeakerDiarization = {};\r\n            speakerDiarization.mode = SpeakerDiarizationMode.Anonymous;\r\n            speakerDiarization.audioSessionId = this.privDiarizationSessionId;\r\n            speakerDiarization.audioOffsetMs = 0;\r\n            speakerDiarization.diarizeIntermediates = this.privRecognizerConfig.parameters.getProperty(PropertyId.SpeechServiceResponse_DiarizeIntermediateResults, \"false\") === \"true\";\r\n            phraseDetection.speakerDiarization = speakerDiarization;\r\n            this.privSpeechContext.getContext().phraseDetection = phraseDetection;\r\n        }\r\n    }\r\n\r\n    protected async processTypeSpecificMessages(connectionMessage: SpeechConnectionMessage): Promise<boolean> {\r\n\r\n        let result: ConversationTranscriptionResult;\r\n        const resultProps: PropertyCollection = new PropertyCollection();\r\n        resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, connectionMessage.textBody);\r\n        let processed: boolean = false;\r\n\r\n        switch (connectionMessage.path.toLowerCase()) {\r\n            case \"speech.hypothesis\":\r\n            case \"speech.fragment\":\r\n                const hypothesis: SpeechHypothesis = SpeechHypothesis.fromJSON(connectionMessage.textBody, this.privRequestSession.currentTurnAudioOffset);\r\n\r\n                const hypothesisLatencyMs = this.privRequestSession.onHypothesis(hypothesis.Offset);\r\n                if (hypothesisLatencyMs > 0) {\r\n                    resultProps.setProperty(PropertyId.SpeechServiceResponse_RecognitionLatencyMs, hypothesisLatencyMs.toString());\r\n                }\r\n\r\n                result = new ConversationTranscriptionResult(\r\n                    this.privRequestSession.requestId,\r\n                    ResultReason.RecognizingSpeech,\r\n                    hypothesis.Text,\r\n                    hypothesis.Duration,\r\n                    hypothesis.Offset,\r\n                    hypothesis.Language,\r\n                    hypothesis.LanguageDetectionConfidence,\r\n                    hypothesis.SpeakerId,\r\n                    undefined,\r\n                    hypothesis.asJson(),\r\n                    resultProps);\r\n\r\n                const ev = new ConversationTranscriptionEventArgs(result, hypothesis.Duration, this.privRequestSession.sessionId);\r\n\r\n                if (!!this.privConversationTranscriber.transcribing) {\r\n                    try {\r\n                        this.privConversationTranscriber.transcribing(this.privConversationTranscriber, ev);\r\n                        /* eslint-disable no-empty */\r\n                    } catch (error) {\r\n                        // Not going to let errors in the event handler\r\n                        // trip things up.\r\n                    }\r\n                }\r\n                processed = true;\r\n                break;\r\n            case \"speech.phrase\":\r\n                const simple: SimpleSpeechPhrase = SimpleSpeechPhrase.fromJSON(connectionMessage.textBody, this.privRequestSession.currentTurnAudioOffset);\r\n                const resultReason: ResultReason = EnumTranslation.implTranslateRecognitionResult(simple.RecognitionStatus);\r\n\r\n                const phraseLatencyMs = this.privRequestSession.onPhraseRecognized(simple.Offset + simple.Duration);\r\n                if (phraseLatencyMs > 0) {\r\n                    resultProps.setProperty(PropertyId.SpeechServiceResponse_RecognitionLatencyMs, phraseLatencyMs.toString());\r\n                }\r\n\r\n                if (ResultReason.Canceled === resultReason) {\r\n                    const cancelReason: CancellationReason = EnumTranslation.implTranslateCancelResult(simple.RecognitionStatus);\r\n                    const cancellationErrorCode: CancellationErrorCode = EnumTranslation.implTranslateCancelErrorCode(simple.RecognitionStatus);\r\n\r\n                    await this.cancelRecognitionLocal(\r\n                        cancelReason,\r\n                        cancellationErrorCode,\r\n                        EnumTranslation.implTranslateErrorDetails(cancellationErrorCode));\r\n\r\n                } else {\r\n                    if (!(this.privRequestSession.isSpeechEnded && resultReason === ResultReason.NoMatch && simple.RecognitionStatus !== RecognitionStatus.InitialSilenceTimeout)) {\r\n                        if (this.privRecognizerConfig.parameters.getProperty(OutputFormatPropertyName) === OutputFormat[OutputFormat.Simple]) {\r\n                            result = new ConversationTranscriptionResult(\r\n                                this.privRequestSession.requestId,\r\n                                resultReason,\r\n                                simple.DisplayText,\r\n                                simple.Duration,\r\n                                simple.Offset,\r\n                                simple.Language,\r\n                                simple.LanguageDetectionConfidence,\r\n                                simple.SpeakerId,\r\n                                undefined,\r\n                                simple.asJson(),\r\n                                resultProps);\r\n                        } else {\r\n                            const detailed: DetailedSpeechPhrase = DetailedSpeechPhrase.fromJSON(connectionMessage.textBody, this.privRequestSession.currentTurnAudioOffset);\r\n\r\n                            result = new ConversationTranscriptionResult(\r\n                                this.privRequestSession.requestId,\r\n                                resultReason,\r\n                                detailed.RecognitionStatus === RecognitionStatus.Success ? detailed.NBest[0].Display : undefined,\r\n                                detailed.Duration,\r\n                                detailed.Offset,\r\n                                detailed.Language,\r\n                                detailed.LanguageDetectionConfidence,\r\n                                simple.SpeakerId,\r\n                                undefined,\r\n                                detailed.asJson(),\r\n                                resultProps);\r\n                        }\r\n\r\n                        const event: ConversationTranscriptionEventArgs = new ConversationTranscriptionEventArgs(result, result.offset, this.privRequestSession.sessionId);\r\n\r\n                        if (!!this.privConversationTranscriber.transcribed) {\r\n                            try {\r\n                                this.privConversationTranscriber.transcribed(this.privConversationTranscriber, event);\r\n                                /* eslint-disable no-empty */\r\n                            } catch (error) {\r\n                                // Not going to let errors in the event handler\r\n                                // trip things up.\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n                processed = true;\r\n                break;\r\n            default:\r\n                break;\r\n        }\r\n        return processed;\r\n    }\r\n\r\n    // Cancels recognition.\r\n    protected cancelRecognition(\r\n        sessionId: string,\r\n        requestId: string,\r\n        cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): void {\r\n\r\n        const properties: PropertyCollection = new PropertyCollection();\r\n        properties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[errorCode]);\r\n\r\n        if (!!this.privConversationTranscriber.canceled) {\r\n            const cancelEvent: ConversationTranscriptionCanceledEventArgs = new ConversationTranscriptionCanceledEventArgs(\r\n                cancellationReason,\r\n                error,\r\n                errorCode,\r\n                undefined,\r\n                sessionId);\r\n            try {\r\n                this.privConversationTranscriber.canceled(this.privConversationTranscriber, cancelEvent);\r\n                /* eslint-disable no-empty */\r\n            } catch { }\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    IAudioSource,\r\n    IConnection,\r\n    MessageType\r\n} from \"../common/Exports.js\";\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    ConversationTranscriptionCanceledEventArgs,\r\n    MeetingTranscriptionCanceledEventArgs,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    ResultReason,\r\n    SpeechRecognitionEventArgs,\r\n    SpeechRecognitionResult,\r\n} from \"../sdk/Exports.js\";\r\nimport { ConversationInfo, MeetingInfo } from \"../sdk/Transcription/Exports.js\";\r\nimport { ConversationProperties } from \"../sdk/Transcription/IConversation.js\";\r\nimport { MeetingProperties } from \"../sdk/Transcription/IMeeting.js\";\r\nimport {\r\n    CancellationErrorCodePropertyName,\r\n    ConversationServiceRecognizer,\r\n    TranscriberRecognizer\r\n} from \"./Exports.js\";\r\nimport { IAuthentication } from \"./IAuthentication.js\";\r\nimport { IConnectionFactory } from \"./IConnectionFactory.js\";\r\nimport { RecognizerConfig } from \"./RecognizerConfig.js\";\r\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal.js\";\r\n\r\n// eslint-disable-next-line max-classes-per-file\r\nexport class TranscriptionServiceRecognizer extends ConversationServiceRecognizer {\r\n\r\n    private privTranscriberRecognizer: TranscriberRecognizer;\r\n\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioSource: IAudioSource,\r\n        recognizerConfig: RecognizerConfig,\r\n        transcriber: TranscriberRecognizer) {\r\n        super(authentication, connectionFactory, audioSource, recognizerConfig, transcriber);\r\n        this.privTranscriberRecognizer = transcriber;\r\n        this.sendPrePayloadJSONOverride = (connection: IConnection): Promise<void> => this.sendTranscriptionStartJSON(connection);\r\n        if (this.privRecognizerConfig.parameters.getProperty(PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps) === \"true\") {\r\n            this.privSpeechContext.setWordLevelTimings();\r\n        }\r\n    }\r\n\r\n    public async sendSpeechEventAsync(info: ConversationInfo, command: string): Promise<void> {\r\n        if (!!this.privRequestSession.isRecognizing) {\r\n            const connection: IConnection = await this.fetchConnection();\r\n            await this.sendSpeechEvent(connection, this.createSpeechEventPayload(info, command));\r\n        }\r\n    }\r\n\r\n    public async sendMeetingSpeechEventAsync(info: MeetingInfo, command: string): Promise<void> {\r\n        if (!!this.privRequestSession.isRecognizing) {\r\n            const connection: IConnection = await this.fetchConnection();\r\n            await this.sendSpeechEvent(connection, this.createMeetingSpeechEventPayload(info, command));\r\n        }\r\n    }\r\n\r\n    protected processTypeSpecificMessages(connectionMessage: SpeechConnectionMessage): Promise<boolean> {\r\n        return this.processSpeechMessages(connectionMessage);\r\n    }\r\n\r\n    protected handleRecognizedCallback(result: SpeechRecognitionResult, offset: number, sessionId: string): void {\r\n        try {\r\n            const event: SpeechRecognitionEventArgs = new SpeechRecognitionEventArgs(result, offset, sessionId);\r\n            this.privTranscriberRecognizer.recognized(this.privTranscriberRecognizer, event);\r\n            if (!!this.privSuccessCallback) {\r\n                try {\r\n                    this.privSuccessCallback(result);\r\n                } catch (e) {\r\n                    if (!!this.privErrorCallback) {\r\n                        this.privErrorCallback(e as string);\r\n                    }\r\n                }\r\n                // Only invoke the call back once.\r\n                // and if it's successful don't invoke the\r\n                // error after that.\r\n                this.privSuccessCallback = undefined;\r\n                this.privErrorCallback = undefined;\r\n            }\r\n        /* eslint-disable no-empty */\r\n        } catch (error) {\r\n            // Not going to let errors in the event handler\r\n            // trip things up.\r\n        }\r\n    }\r\n\r\n    protected handleRecognizingCallback(result: SpeechRecognitionResult, duration: number, sessionId: string): void {\r\n        try {\r\n            const ev = new SpeechRecognitionEventArgs(result, duration, sessionId);\r\n            this.privTranscriberRecognizer.recognizing(this.privTranscriberRecognizer, ev);\r\n            /* eslint-disable no-empty */\r\n        } catch (error) {\r\n            // Not going to let errors in the event handler\r\n            // trip things up.\r\n        }\r\n    }\r\n\r\n    // Cancels recognition.\r\n    protected cancelRecognition(\r\n        sessionId: string,\r\n        requestId: string,\r\n        cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): void {\r\n\r\n        const properties: PropertyCollection = new PropertyCollection();\r\n        properties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[errorCode]);\r\n\r\n        if (this.privTranscriberRecognizer.IsMeetingRecognizer()) {\r\n            if (!!this.privTranscriberRecognizer.canceled) {\r\n                const cancelEvent: MeetingTranscriptionCanceledEventArgs = new MeetingTranscriptionCanceledEventArgs(\r\n                    cancellationReason,\r\n                    error,\r\n                    errorCode,\r\n                    undefined,\r\n                    sessionId);\r\n                try {\r\n                    this.privTranscriberRecognizer.canceled(this.privTranscriberRecognizer, cancelEvent);\r\n                    /* eslint-disable no-empty */\r\n                } catch { }\r\n            }\r\n        } else {\r\n            if (!!this.privTranscriberRecognizer.canceled) {\r\n                const cancelEvent: ConversationTranscriptionCanceledEventArgs = new ConversationTranscriptionCanceledEventArgs(\r\n                    cancellationReason,\r\n                    error,\r\n                    errorCode,\r\n                    undefined,\r\n                    sessionId);\r\n                try {\r\n                    this.privTranscriberRecognizer.canceled(this.privTranscriberRecognizer, cancelEvent);\r\n                    /* eslint-disable no-empty */\r\n                } catch { }\r\n            }\r\n        }\r\n\r\n        if (!!this.privSuccessCallback) {\r\n            const result: SpeechRecognitionResult = new SpeechRecognitionResult(\r\n                requestId,\r\n                ResultReason.Canceled,\r\n                undefined, // Text\r\n                undefined, // Duration\r\n                undefined, // Offset\r\n                undefined, // Language\r\n                undefined, // Language Detection Confidence\r\n                undefined, // Speaker Id\r\n                error,\r\n                undefined, // Json\r\n                properties);\r\n            try {\r\n                this.privSuccessCallback(result);\r\n                this.privSuccessCallback = undefined;\r\n                /* eslint-disable no-empty */\r\n            } catch { }\r\n        }\r\n    }\r\n\r\n    // Encapsulated for derived service recognizers that need to send additional JSON\r\n    protected async sendTranscriptionStartJSON(connection: IConnection): Promise<void> {\r\n        await this.sendSpeechContext(connection, true);\r\n        if (this.privTranscriberRecognizer.IsMeetingRecognizer()) {\r\n            const info: MeetingInfo = this.privTranscriberRecognizer.getMeetingInfo();\r\n            const payload: { [id: string]: any } = this.createMeetingSpeechEventPayload(info, \"start\");\r\n            await this.sendSpeechEvent(connection, payload);\r\n        } else {\r\n            const info: ConversationInfo = this.privTranscriberRecognizer.getConversationInfo();\r\n            const payload: { [id: string]: any } = this.createSpeechEventPayload(info, \"start\");\r\n            await this.sendSpeechEvent(connection, payload);\r\n        }\r\n        await this.sendWaveHeader(connection);\r\n        return;\r\n    }\r\n\r\n    protected sendSpeechEvent(connection: IConnection, payload: { [id: string]: any }): Promise<void> {\r\n        const speechEventJson = JSON.stringify(payload);\r\n\r\n        if (speechEventJson) {\r\n            return connection.send(new SpeechConnectionMessage(\r\n                MessageType.Text,\r\n                \"speech.event\",\r\n                this.privRequestSession.requestId,\r\n                \"application/json\",\r\n                speechEventJson));\r\n        }\r\n        return;\r\n    }\r\n\r\n    private createSpeechEventPayload(info: ConversationInfo, command: string): { [id: string]: any } {\r\n        const eventDict: { id: string; name: string; meeting: ConversationProperties } = { id: \"meeting\", name: command, meeting: info.conversationProperties };\r\n        eventDict.meeting.id = info.id;\r\n        eventDict.meeting.attendees = info.participants;\r\n        return eventDict;\r\n    }\r\n\r\n    private createMeetingSpeechEventPayload(info: MeetingInfo, command: string): { [id: string]: any } {\r\n        const eventDict: { id: string; name: string; meeting: MeetingProperties } = { id: \"meeting\", name: command, meeting: info.meetingProperties };\r\n        eventDict.meeting.id = info.id;\r\n        eventDict.meeting.attendees = info.participants;\r\n        return eventDict;\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { IPrimaryLanguage, RecognitionStatus } from \"../Exports.js\";\r\n\r\n// speech.phrase for detailed\r\nexport interface IDetailedSpeechPhrase {\r\n    RecognitionStatus: RecognitionStatus;\r\n    NBest: IPhrase[];\r\n    Duration?: number;\r\n    Offset?: number;\r\n    PrimaryLanguage?: IPrimaryLanguage;\r\n    DisplayText?: string;\r\n    SpeakerId?: string;\r\n    [key: string]: any;\r\n}\r\n\r\nexport interface IPhrase {\r\n    Confidence?: number;\r\n    Lexical: string;\r\n    ITN: string;\r\n    MaskedITN: string;\r\n    Display?: string;\r\n    DisplayText?: string;\r\n    Words?: IWord[];\r\n    DisplayWords?: IWord[];\r\n}\r\n\r\nexport interface IWord {\r\n    Word: string;\r\n    Offset: number;\r\n    Duration: number;\r\n}\r\n\r\nexport class DetailedSpeechPhrase implements IDetailedSpeechPhrase {\r\n    private privDetailedSpeechPhrase: IDetailedSpeechPhrase;\r\n\r\n    private constructor(json: string, baseOffset: number) {\r\n        this.privDetailedSpeechPhrase = JSON.parse(json) as IDetailedSpeechPhrase;\r\n        this.privDetailedSpeechPhrase.RecognitionStatus = this.mapRecognitionStatus(this.privDetailedSpeechPhrase.RecognitionStatus);\r\n        this.updateOffsets(baseOffset);\r\n    }\r\n\r\n    public static fromJSON(json: string, baseOffset: number): DetailedSpeechPhrase {\r\n        return new DetailedSpeechPhrase(json, baseOffset);\r\n    }\r\n\r\n    private updateOffsets(baseOffset: number): void {\r\n        this.privDetailedSpeechPhrase.Offset += baseOffset;\r\n\r\n        if (!!this.privDetailedSpeechPhrase.NBest) {\r\n            for (const phrase of this.privDetailedSpeechPhrase.NBest) {\r\n                if (!!phrase.Words) {\r\n                    for (const word of phrase.Words) {\r\n                        word.Offset += baseOffset;\r\n                    }\r\n                }\r\n                if (!!phrase.DisplayWords) {\r\n                    for (const word of phrase.DisplayWords) {\r\n                        word.Offset += baseOffset;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    public asJson(): string {\r\n        const jsonObj = { ...this.privDetailedSpeechPhrase };\r\n        // Convert the enum value to its string representation for serialization purposes.\r\n        return JSON.stringify({\r\n            ...jsonObj,\r\n            RecognitionStatus: RecognitionStatus[jsonObj.RecognitionStatus] as keyof typeof RecognitionStatus\r\n        });\r\n    }\r\n\r\n    public get RecognitionStatus(): RecognitionStatus {\r\n        return this.privDetailedSpeechPhrase.RecognitionStatus;\r\n    }\r\n    public get NBest(): IPhrase[] {\r\n        return this.privDetailedSpeechPhrase.NBest;\r\n    }\r\n    public get Duration(): number {\r\n        return this.privDetailedSpeechPhrase.Duration;\r\n    }\r\n    public get Offset(): number {\r\n        return this.privDetailedSpeechPhrase.Offset;\r\n    }\r\n    public get Language(): string {\r\n        return this.privDetailedSpeechPhrase.PrimaryLanguage === undefined ? undefined : this.privDetailedSpeechPhrase.PrimaryLanguage.Language;\r\n    }\r\n    public get LanguageDetectionConfidence(): string {\r\n        return this.privDetailedSpeechPhrase.PrimaryLanguage === undefined ? undefined : this.privDetailedSpeechPhrase.PrimaryLanguage.Confidence;\r\n    }\r\n    public get Text(): string {\r\n        if (!!this.privDetailedSpeechPhrase.NBest && this.privDetailedSpeechPhrase.NBest[0]) {\r\n            return this.privDetailedSpeechPhrase.NBest[0].Display || this.privDetailedSpeechPhrase.NBest[0].DisplayText;\r\n        }\r\n        return this.privDetailedSpeechPhrase.DisplayText;\r\n    }\r\n    public get SpeakerId(): string {\r\n        return this.privDetailedSpeechPhrase.SpeakerId;\r\n    }\r\n    private mapRecognitionStatus(status: any): RecognitionStatus {\r\n        if (typeof status === \"string\") {\r\n            return RecognitionStatus[status as keyof typeof RecognitionStatus];\r\n        } else if (typeof status === \"number\") {\r\n            return status;\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { RecognitionStatus } from \"../Exports.js\";\r\n\r\n// speech.phrase\r\nexport interface ISimpleSpeechPhrase {\r\n    RecognitionStatus: RecognitionStatus;\r\n    DisplayText: string;\r\n    Offset?: number;\r\n    Duration?: number;\r\n    PrimaryLanguage?: IPrimaryLanguage;\r\n    SpeakerId?: string;\r\n    [key: string]: any;\r\n}\r\n\r\nexport interface IPrimaryLanguage {\r\n    Language: string;\r\n    Confidence: string;\r\n}\r\n\r\nexport class SimpleSpeechPhrase implements ISimpleSpeechPhrase {\r\n    private privSimpleSpeechPhrase: ISimpleSpeechPhrase;\r\n\r\n    private constructor(json: string, baseOffset: number = 0) {\r\n        this.privSimpleSpeechPhrase = JSON.parse(json) as ISimpleSpeechPhrase;\r\n        this.privSimpleSpeechPhrase.RecognitionStatus = this.mapRecognitionStatus(this.privSimpleSpeechPhrase.RecognitionStatus); // RecognitionStatus[this.privSimpleSpeechPhrase.RecognitionStatus as unknown as keyof typeof RecognitionStatus];\r\n        this.updateOffset(baseOffset);\r\n    }\r\n\r\n    public static fromJSON(json: string, baseOffset: number): SimpleSpeechPhrase {\r\n        return new SimpleSpeechPhrase(json, baseOffset);\r\n    }\r\n\r\n    private updateOffset(baseOffset: number): void {\r\n        this.privSimpleSpeechPhrase.Offset += baseOffset;\r\n    }\r\n\r\n    public asJson(): string {\r\n        const jsonObj = { ...this.privSimpleSpeechPhrase };\r\n        // Convert the enum value to its string representation for serialization purposes.\r\n        return JSON.stringify({\r\n            ...jsonObj,\r\n            RecognitionStatus: RecognitionStatus[jsonObj.RecognitionStatus] as keyof typeof RecognitionStatus\r\n        });\r\n    }\r\n\r\n    public get RecognitionStatus(): RecognitionStatus {\r\n        return this.privSimpleSpeechPhrase.RecognitionStatus;\r\n    }\r\n\r\n    public get DisplayText(): string {\r\n        return this.privSimpleSpeechPhrase.DisplayText;\r\n    }\r\n\r\n    public get Offset(): number {\r\n        return this.privSimpleSpeechPhrase.Offset;\r\n    }\r\n\r\n    public get Duration(): number {\r\n        return this.privSimpleSpeechPhrase.Duration;\r\n    }\r\n\r\n    public get Language(): string {\r\n        return this.privSimpleSpeechPhrase.PrimaryLanguage === undefined ? undefined : this.privSimpleSpeechPhrase.PrimaryLanguage.Language;\r\n    }\r\n\r\n    public get LanguageDetectionConfidence(): string {\r\n        return this.privSimpleSpeechPhrase.PrimaryLanguage === undefined ? undefined : this.privSimpleSpeechPhrase.PrimaryLanguage.Confidence;\r\n    }\r\n\r\n    public get SpeakerId(): string {\r\n        return this.privSimpleSpeechPhrase.SpeakerId;\r\n    }\r\n\r\n    private mapRecognitionStatus(status: any): RecognitionStatus {\r\n        if (typeof status === \"string\") {\r\n            return RecognitionStatus[status as keyof typeof RecognitionStatus];\r\n        } else if (typeof status === \"number\") {\r\n            return status;\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport {\r\n    AudioSourceErrorEvent,\r\n    AudioStreamNodeAttachedEvent,\r\n    AudioStreamNodeAttachingEvent,\r\n    AudioStreamNodeDetachedEvent,\r\n    AudioStreamNodeErrorEvent,\r\n    ConnectionEstablishedEvent,\r\n    ConnectionEstablishErrorEvent,\r\n    ConnectionMessageReceivedEvent,\r\n    ConnectionStartEvent,\r\n    IEventListener,\r\n    IStringDictionary,\r\n    PlatformEvent,\r\n} from \"../common/Exports.js\";\r\nimport { ConnectingToServiceEvent, RecognitionTriggeredEvent } from \"./RecognitionEvents.js\";\r\n\r\nexport interface ITelemetry {\r\n    Metrics: IMetric[];\r\n    ReceivedMessages: IStringDictionary<string[]>;\r\n}\r\n\r\nexport interface IMetric {\r\n    End?: string;\r\n    Error?: string;\r\n    Id?: string;\r\n    Name?: string;\r\n    Start?: string;\r\n    PhraseLatencyMs?: number[];\r\n    FirstHypothesisLatencyMs?: number[];\r\n}\r\n\r\nexport class ServiceTelemetryListener implements IEventListener<PlatformEvent> {\r\n    private privIsDisposed: boolean = false;\r\n\r\n    private privRequestId: string;\r\n    private privAudioSourceId: string;\r\n    private privAudioNodeId: string;\r\n\r\n    private privListeningTriggerMetric: IMetric = null;\r\n    private privMicMetric: IMetric = null;\r\n    private privConnectionEstablishMetric: IMetric = null;\r\n\r\n    private privMicStartTime: string;\r\n\r\n    private privConnectionId: string;\r\n    private privConnectionStartTime: string;\r\n\r\n    private privReceivedMessages: IStringDictionary<string[]>;\r\n    private privPhraseLatencies: number[];\r\n    private privHypothesisLatencies: number[];\r\n\r\n    public constructor(requestId: string, audioSourceId: string, audioNodeId: string) {\r\n        this.privRequestId = requestId;\r\n        this.privAudioSourceId = audioSourceId;\r\n        this.privAudioNodeId = audioNodeId;\r\n\r\n        this.privReceivedMessages = {};\r\n        this.privPhraseLatencies = [];\r\n        this.privHypothesisLatencies = [];\r\n    }\r\n\r\n    public phraseReceived(audioReceivedTime: number): void {\r\n        if (audioReceivedTime > 0) { // 0 indicates the time is unknown. Drop it.\r\n            this.privPhraseLatencies.push(Date.now() - audioReceivedTime);\r\n        }\r\n    }\r\n\r\n    public hypothesisReceived(audioReceivedTime: number): void {\r\n        if (audioReceivedTime > 0) { // 0 indicates the time is unknown. Drop it.\r\n            this.privHypothesisLatencies.push(Date.now() - audioReceivedTime);\r\n        }\r\n    }\r\n\r\n    public onEvent(e: PlatformEvent): void {\r\n        if (this.privIsDisposed) {\r\n            return;\r\n        }\r\n\r\n        if (e instanceof RecognitionTriggeredEvent && e.requestId === this.privRequestId) {\r\n            this.privListeningTriggerMetric = {\r\n                End: e.eventTime,\r\n                Name: \"ListeningTrigger\",\r\n                Start: e.eventTime,\r\n            };\r\n        }\r\n\r\n        if (e instanceof AudioStreamNodeAttachingEvent && e.audioSourceId === this.privAudioSourceId && e.audioNodeId === this.privAudioNodeId) {\r\n            this.privMicStartTime = e.eventTime;\r\n        }\r\n\r\n        if (e instanceof AudioStreamNodeAttachedEvent && e.audioSourceId === this.privAudioSourceId && e.audioNodeId === this.privAudioNodeId) {\r\n            this.privMicStartTime = e.eventTime;\r\n        }\r\n\r\n        if (e instanceof AudioSourceErrorEvent && e.audioSourceId === this.privAudioSourceId) {\r\n            if (!this.privMicMetric) {\r\n                this.privMicMetric = {\r\n                    End: e.eventTime,\r\n                    Error: e.error,\r\n                    Name: \"Microphone\",\r\n                    Start: this.privMicStartTime,\r\n                };\r\n            }\r\n        }\r\n\r\n        if (e instanceof AudioStreamNodeErrorEvent && e.audioSourceId === this.privAudioSourceId && e.audioNodeId === this.privAudioNodeId) {\r\n            if (!this.privMicMetric) {\r\n                this.privMicMetric = {\r\n                    End: e.eventTime,\r\n                    Error: e.error,\r\n                    Name: \"Microphone\",\r\n                    Start: this.privMicStartTime,\r\n                };\r\n            }\r\n        }\r\n\r\n        if (e instanceof AudioStreamNodeDetachedEvent && e.audioSourceId === this.privAudioSourceId && e.audioNodeId === this.privAudioNodeId) {\r\n            if (!this.privMicMetric) {\r\n                this.privMicMetric = {\r\n                    End: e.eventTime,\r\n                    Name: \"Microphone\",\r\n                    Start: this.privMicStartTime,\r\n                };\r\n            }\r\n        }\r\n\r\n        if (e instanceof ConnectingToServiceEvent && e.requestId === this.privRequestId) {\r\n            this.privConnectionId = e.sessionId;\r\n        }\r\n\r\n        if (e instanceof ConnectionStartEvent && e.connectionId === this.privConnectionId) {\r\n            this.privConnectionStartTime = e.eventTime;\r\n        }\r\n\r\n        if (e instanceof ConnectionEstablishedEvent && e.connectionId === this.privConnectionId) {\r\n            if (!this.privConnectionEstablishMetric) {\r\n                this.privConnectionEstablishMetric = {\r\n                    End: e.eventTime,\r\n                    Id: this.privConnectionId,\r\n                    Name: \"Connection\",\r\n                    Start: this.privConnectionStartTime,\r\n                };\r\n            }\r\n        }\r\n\r\n        if (e instanceof ConnectionEstablishErrorEvent && e.connectionId === this.privConnectionId) {\r\n            if (!this.privConnectionEstablishMetric) {\r\n                this.privConnectionEstablishMetric = {\r\n                    End: e.eventTime,\r\n                    Error: this.getConnectionError(e.statusCode),\r\n                    Id: this.privConnectionId,\r\n                    Name: \"Connection\",\r\n                    Start: this.privConnectionStartTime,\r\n                };\r\n            }\r\n        }\r\n\r\n        if (e instanceof ConnectionMessageReceivedEvent && e.connectionId === this.privConnectionId) {\r\n            if (e.message && e.message.headers && e.message.headers.path) {\r\n                if (!this.privReceivedMessages[e.message.headers.path]) {\r\n                    this.privReceivedMessages[e.message.headers.path] = new Array<string>();\r\n                }\r\n                const maxMessagesToSend = 50;\r\n                if (this.privReceivedMessages[e.message.headers.path].length < maxMessagesToSend) {\r\n                    this.privReceivedMessages[e.message.headers.path].push(e.networkReceivedTime);\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    public getTelemetry(): string {\r\n        const metrics = new Array<IMetric>();\r\n\r\n        if (this.privListeningTriggerMetric) {\r\n            metrics.push(this.privListeningTriggerMetric);\r\n        }\r\n\r\n        if (this.privMicMetric) {\r\n            metrics.push(this.privMicMetric);\r\n        }\r\n\r\n        if (this.privConnectionEstablishMetric) {\r\n            metrics.push(this.privConnectionEstablishMetric);\r\n        }\r\n\r\n        if (this.privPhraseLatencies.length > 0) {\r\n            metrics.push({\r\n                PhraseLatencyMs: this.privPhraseLatencies,\r\n            });\r\n        }\r\n\r\n        if (this.privHypothesisLatencies.length > 0) {\r\n            metrics.push({\r\n                FirstHypothesisLatencyMs: this.privHypothesisLatencies,\r\n            });\r\n        }\r\n\r\n        const telemetry: ITelemetry = {\r\n            Metrics: metrics,\r\n            ReceivedMessages: this.privReceivedMessages,\r\n        };\r\n\r\n        const json = JSON.stringify(telemetry);\r\n\r\n        // We dont want to send the same telemetry again. So clean those out.\r\n        this.privReceivedMessages = {};\r\n        this.privListeningTriggerMetric = null;\r\n        this.privMicMetric = null;\r\n        this.privConnectionEstablishMetric = null;\r\n        this.privPhraseLatencies = [];\r\n        this.privHypothesisLatencies = [];\r\n        return json;\r\n    }\r\n\r\n    // Determines if there are any telemetry events to send to the service.\r\n    public get hasTelemetry(): boolean {\r\n        return (Object.keys(this.privReceivedMessages).length !== 0 ||\r\n            this.privListeningTriggerMetric !== null ||\r\n            this.privMicMetric !== null ||\r\n            this.privConnectionEstablishMetric !== null ||\r\n            this.privPhraseLatencies.length !== 0 ||\r\n            this.privHypothesisLatencies.length !== 0);\r\n    }\r\n\r\n    public dispose(): void {\r\n        this.privIsDisposed = true;\r\n    }\r\n\r\n    private getConnectionError(statusCode: number): string {\r\n        /*\r\n        -- Websocket status codes --\r\n        NormalClosure = 1000,\r\n        EndpointUnavailable = 1001,\r\n        ProtocolError = 1002,\r\n        InvalidMessageType = 1003,\r\n        Empty = 1005,\r\n        InvalidPayloadData = 1007,\r\n        PolicyViolation = 1008,\r\n        MessageTooBig = 1009,\r\n        MandatoryExtension = 1010,\r\n        InternalServerError = 1011\r\n        */\r\n\r\n        switch (statusCode) {\r\n            case 400:\r\n            case 1002:\r\n            case 1003:\r\n            case 1005:\r\n            case 1007:\r\n            case 1008:\r\n            case 1009: return \"BadRequest\";\r\n            case 401: return \"Unauthorized\";\r\n            case 403: return \"Forbidden\";\r\n            case 503:\r\n            case 1001: return \"ServerUnavailable\";\r\n            case 500:\r\n            case 1011: return \"ServerError\";\r\n            case 408:\r\n            case 504: return \"Timeout\";\r\n            default: return \"statuscode:\" + statusCode.toString();\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ReplayableAudioNode } from \"../common.browser/Exports.js\";\r\nimport {\r\n    createNoDashGuid,\r\n    Deferred,\r\n    Events,\r\n    IDetachable,\r\n    IEventSource,\r\n    PlatformEvent\r\n} from \"../common/Exports.js\";\r\nimport {\r\n    ConnectingToServiceEvent,\r\n    ListeningStartedEvent,\r\n    RecognitionStartedEvent,\r\n    RecognitionTriggeredEvent,\r\n    SpeechRecognitionEvent,\r\n} from \"./RecognitionEvents.js\";\r\nimport { ServiceTelemetryListener } from \"./ServiceTelemetryListener.Internal.js\";\r\n\r\nexport class RequestSession {\r\n    private privIsDisposed: boolean = false;\r\n    private privServiceTelemetryListener: ServiceTelemetryListener;\r\n    private privDetachables: IDetachable[] = new Array<IDetachable>();\r\n    private privRequestId: string;\r\n    private privAudioSourceId: string;\r\n    private privAudioNodeId: string;\r\n    private privAudioNode: ReplayableAudioNode;\r\n    private privAuthFetchEventId: string;\r\n    private privIsAudioNodeDetached: boolean = false;\r\n    private privIsRecognizing: boolean = false;\r\n    private privIsSpeechEnded: boolean = false;\r\n    private privTurnStartAudioOffset: number = 0;\r\n    private privLastRecoOffset: number = 0;\r\n    private privHypothesisReceived: boolean = false;\r\n    private privBytesSent: number = 0;\r\n    private privRecognitionBytesSent: number = 0;\r\n    private privRecogNumber: number = 0;\r\n    private privSessionId: string;\r\n    private privTurnDeferral: Deferred<void>;\r\n    private privInTurn: boolean = false;\r\n    private privConnectionAttempts: number = 0;\r\n\r\n    public constructor(audioSourceId: string) {\r\n        this.privAudioSourceId = audioSourceId;\r\n        this.privRequestId = createNoDashGuid();\r\n        this.privAudioNodeId = createNoDashGuid();\r\n        this.privTurnDeferral = new Deferred<void>();\r\n\r\n        // We're not in a turn, so resolve.\r\n        this.privTurnDeferral.resolve();\r\n    }\r\n\r\n    public get sessionId(): string {\r\n        return this.privSessionId;\r\n    }\r\n\r\n    public get requestId(): string {\r\n        return this.privRequestId;\r\n    }\r\n\r\n    public get audioNodeId(): string {\r\n        return this.privAudioNodeId;\r\n    }\r\n\r\n    public get turnCompletionPromise(): Promise<void> {\r\n        return this.privTurnDeferral.promise;\r\n    }\r\n\r\n    public get isSpeechEnded(): boolean {\r\n        return this.privIsSpeechEnded;\r\n    }\r\n\r\n    public get isRecognizing(): boolean {\r\n        return this.privIsRecognizing;\r\n    }\r\n\r\n    public get currentTurnAudioOffset(): number {\r\n        return this.privTurnStartAudioOffset;\r\n    }\r\n\r\n    public get recogNumber(): number {\r\n        return this.privRecogNumber;\r\n    }\r\n\r\n    public get numConnectionAttempts(): number {\r\n        return this.privConnectionAttempts;\r\n    }\r\n\r\n    // The number of bytes sent for the current connection.\r\n    // Counter is reset to 0 each time a connection is established.\r\n    public get bytesSent(): number {\r\n        return this.privBytesSent;\r\n    }\r\n\r\n    // The number of bytes sent for the current recognition.\r\n    // Counter is reset to 0 each time recognition is started.\r\n    public get recognitionBytesSent(): number {\r\n        return this.privRecognitionBytesSent;\r\n    }\r\n\r\n    public listenForServiceTelemetry(eventSource: IEventSource<PlatformEvent>): void {\r\n        if (!!this.privServiceTelemetryListener) {\r\n            this.privDetachables.push(eventSource.attachListener(this.privServiceTelemetryListener));\r\n        }\r\n    }\r\n\r\n    public startNewRecognition(): void {\r\n        this.privRecognitionBytesSent = 0;\r\n        this.privIsSpeechEnded = false;\r\n        this.privIsRecognizing = true;\r\n        this.privTurnStartAudioOffset = 0;\r\n        this.privLastRecoOffset = 0;\r\n        this.privRecogNumber++;\r\n        this.privServiceTelemetryListener = new ServiceTelemetryListener(this.privRequestId, this.privAudioSourceId, this.privAudioNodeId);\r\n        this.onEvent(new RecognitionTriggeredEvent(this.requestId, this.privSessionId, this.privAudioSourceId, this.privAudioNodeId));\r\n    }\r\n\r\n    public async onAudioSourceAttachCompleted(audioNode: ReplayableAudioNode, isError: boolean): Promise<void> {\r\n        this.privAudioNode = audioNode;\r\n        this.privIsAudioNodeDetached = false;\r\n\r\n        if (isError) {\r\n            await this.onComplete();\r\n        } else {\r\n            this.onEvent(new ListeningStartedEvent(this.privRequestId, this.privSessionId, this.privAudioSourceId, this.privAudioNodeId));\r\n        }\r\n    }\r\n\r\n    public onPreConnectionStart(authFetchEventId: string, connectionId: string): void {\r\n        this.privAuthFetchEventId = authFetchEventId;\r\n        this.privSessionId = connectionId;\r\n        this.onEvent(new ConnectingToServiceEvent(this.privRequestId, this.privAuthFetchEventId, this.privSessionId));\r\n    }\r\n\r\n    public async onAuthCompleted(isError: boolean): Promise<void> {\r\n        if (isError) {\r\n            await this.onComplete();\r\n        }\r\n    }\r\n\r\n    // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n    public async onConnectionEstablishCompleted(statusCode: number, reason?: string): Promise<void> {\r\n        if (statusCode === 200) {\r\n            this.onEvent(new RecognitionStartedEvent(this.requestId, this.privAudioSourceId, this.privAudioNodeId, this.privAuthFetchEventId, this.privSessionId));\r\n            if (!!this.privAudioNode) {\r\n                this.privAudioNode.replay();\r\n            }\r\n            this.privTurnStartAudioOffset = this.privLastRecoOffset;\r\n            this.privBytesSent = 0;\r\n            return;\r\n        } else if (statusCode === 403) {\r\n            await this.onComplete();\r\n        }\r\n    }\r\n\r\n    public async onServiceTurnEndResponse(continuousRecognition: boolean): Promise<void> {\r\n        this.privTurnDeferral.resolve();\r\n\r\n        if (!continuousRecognition || this.isSpeechEnded) {\r\n            await this.onComplete();\r\n            this.privInTurn = false;\r\n        } else {\r\n            // Start a new request set.\r\n            this.privTurnStartAudioOffset = this.privLastRecoOffset;\r\n            this.privAudioNode.replay();\r\n        }\r\n    }\r\n\r\n    public onSpeechContext(): void {\r\n        this.privRequestId = createNoDashGuid();\r\n    }\r\n\r\n    public onServiceTurnStartResponse(): void {\r\n        if (!!this.privTurnDeferral && !!this.privInTurn) {\r\n            // What? How are we starting a turn with another not done?\r\n            this.privTurnDeferral.reject(\"Another turn started before current completed.\");\r\n            // Avoid UnhandledPromiseRejection if privTurnDeferral is not being awaited\r\n            // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n            this.privTurnDeferral.promise.then().catch((): void => { });\r\n        }\r\n        this.privInTurn = true;\r\n        this.privTurnDeferral = new Deferred<void>();\r\n    }\r\n\r\n    public onHypothesis(offset: number): number {\r\n        const audioReceivedTime = this.privAudioNode.findTimeAtOffset(offset);\r\n        if (!this.privHypothesisReceived) {\r\n            this.privHypothesisReceived = true;\r\n            this.privServiceTelemetryListener.hypothesisReceived(audioReceivedTime);\r\n        }\r\n        return audioReceivedTime > 0 ? Date.now() - audioReceivedTime : 0;\r\n    }\r\n\r\n    public onPhraseRecognized(offset: number): number {\r\n        const audioReceivedTime = this.privAudioNode.findTimeAtOffset(offset);\r\n        this.privServiceTelemetryListener.phraseReceived(audioReceivedTime);\r\n        this.onServiceRecognized(offset);\r\n        return audioReceivedTime > 0 ? Date.now() - audioReceivedTime : 0;\r\n    }\r\n\r\n    public onServiceRecognized(offset: number): void {\r\n        this.privLastRecoOffset = offset;\r\n        this.privHypothesisReceived = false;\r\n        this.privAudioNode.shrinkBuffers(offset);\r\n        this.privConnectionAttempts = 0;\r\n    }\r\n\r\n    public onAudioSent(bytesSent: number): void {\r\n        this.privBytesSent += bytesSent;\r\n        this.privRecognitionBytesSent += bytesSent;\r\n    }\r\n\r\n    public onRetryConnection(): void {\r\n        this.privConnectionAttempts++;\r\n    }\r\n\r\n    public async dispose(): Promise<void> {\r\n        if (!this.privIsDisposed) {\r\n            // we should have completed by now. If we did not its an unknown error.\r\n            this.privIsDisposed = true;\r\n            for (const detachable of this.privDetachables) {\r\n                await detachable.detach();\r\n            }\r\n\r\n            if (!!this.privServiceTelemetryListener) {\r\n                this.privServiceTelemetryListener.dispose();\r\n            }\r\n            this.privIsRecognizing = false;\r\n        }\r\n    }\r\n\r\n    public getTelemetry(): string {\r\n        if (this.privServiceTelemetryListener.hasTelemetry) {\r\n            return this.privServiceTelemetryListener.getTelemetry();\r\n        } else {\r\n            return null;\r\n        }\r\n    }\r\n\r\n    public async onStopRecognizing(): Promise<void> {\r\n        await this.onComplete();\r\n    }\r\n\r\n    // Should be called with the audioNode for this session has indicated that it is out of speech.\r\n    public onSpeechEnded(): void {\r\n        this.privIsSpeechEnded = true;\r\n    }\r\n\r\n    protected onEvent(event: SpeechRecognitionEvent): void {\r\n        if (!!this.privServiceTelemetryListener) {\r\n            this.privServiceTelemetryListener.onEvent(event);\r\n        }\r\n        Events.instance.onEvent(event);\r\n    }\r\n\r\n    private async onComplete(): Promise<void> {\r\n        if (!!this.privIsRecognizing) {\r\n            this.privIsRecognizing = false;\r\n            await this.detachAudioNode();\r\n        }\r\n    }\r\n\r\n    private async detachAudioNode(): Promise<void> {\r\n        if (!this.privIsAudioNodeDetached) {\r\n            this.privIsAudioNodeDetached = true;\r\n            if (this.privAudioNode) {\r\n                await this.privAudioNode.detach();\r\n            }\r\n        }\r\n    }\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\nimport { DetailedOptions } from \"./DetailedOptions\";\r\nimport { SimpleOptions } from \"./SimpleOptions\";\r\nimport { InterimResults } from \"./InterimResults\";\r\nimport { PhraseResults } from \"./PhraseResults\";\r\n\r\n/**\r\n * The detailed output options.\r\n */\r\nexport enum PhraseOption {\r\n    WordTimings = \"WordTimings\",\r\n    SNR = \"SNR\",\r\n    Pronunciation = \"Pronunciation\",\r\n    WordPronunciation = \"WordPronunciation\",\r\n    WordConfidence = \"WordConfidence\",\r\n    Words = \"Words\",\r\n    Sentiment = \"Sentiment\",\r\n    PronunciationAssessment = \"PronunciationAssessment\",\r\n    ContentAssessment = \"ContentAssessment\",\r\n    PhraseAMScore = \"PhraseAMScore\",\r\n    PhraseLMScore = \"PhraseLMScore\",\r\n    WordAMScore = \"WordAMScore\",\r\n    WordLMScore = \"WordLMScore\",\r\n    RuleTree = \"RuleTree\",\r\n    NBestTimings = \"NBestTimings\",\r\n    DecoderDiagnostics = \"DecoderDiagnostics\",\r\n    DisplayWordTimings = \"DisplayWordTimings\",\r\n    DisplayWords = \"DisplayWords\"\r\n}\r\n\r\n/**\r\n * The detailed output extensions.\r\n */\r\nexport enum PhraseExtension {\r\n    Graph = \"Graph\",\r\n    Corrections = \"Corrections\",\r\n    Sentiment = \"Sentiment\"\r\n}\r\n\r\n/**\r\n * The Recognition modes\r\n */\r\nexport enum OutputFormat {\r\n    Simple = \"Simple\",\r\n    Detailed = \"Detailed\"\r\n}\r\n\r\n/**\r\n * The Tentative Phrase Results option\r\n */\r\nexport enum TentativePhraseResultsOption {\r\n    None = \"None\",\r\n    Always = \"Always\"\r\n}\r\n\r\n/**\r\n * Defines the phrase output in the speech Context message\r\n */\r\nexport interface PhraseOutput {\r\n    /**\r\n     * The output format.\r\n     */\r\n    format?: OutputFormat;\r\n\r\n    /**\r\n     * The detailed options.\r\n     */\r\n    detailed?: DetailedOptions;\r\n\r\n    /**\r\n     * The simple options.\r\n     */\r\n    simple?: SimpleOptions;\r\n\r\n    /**\r\n     * The interim results.\r\n     */\r\n    interimResults?: InterimResults;\r\n\r\n    /**\r\n     * The phrase results.\r\n     */\r\n    phraseResults?: PhraseResults;\r\n\r\n    /**\r\n     * The tentative phrase results option\r\n     */\r\n    tentativePhraseResults?: TentativePhraseResultsOption;\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    DynamicGrammarBuilder,\r\n} from \"./Exports.js\";\r\nimport { Dgi } from \"./ServiceMessages/Dgi/Dgi.js\";\r\nimport { RecognitionMode } from \"./ServiceMessages/PhraseDetection/PhraseDetectionContext.js\";\r\nimport { OutputFormat, PhraseOption } from \"./ServiceMessages/PhraseOutput/PhraseOutput.js\";\r\nimport { PronunciationAssessmentOptions } from \"./ServiceMessages/PronunciationScore/PronunciationAssessmentOptions.js\";\r\n\r\nimport { SpeechContext as SpeechServiceContext } from \"./ServiceMessages/SpeechContext.js\";\r\n\r\n/**\r\n * Represents the JSON used in the speech.context message sent to the speech service.\r\n * The dynamic grammar is always refreshed from the encapsulated dynamic grammar object.\r\n */\r\nexport class SpeechContext {\r\n    private privContext: SpeechServiceContext = {};\r\n    private privDynamicGrammar: DynamicGrammarBuilder;\r\n\r\n    public constructor(dynamicGrammar: DynamicGrammarBuilder) {\r\n        this.privDynamicGrammar = dynamicGrammar;\r\n    }\r\n\r\n    public getContext(): SpeechServiceContext {\r\n        return this.privContext;\r\n    }\r\n\r\n    /**\r\n     * @Internal\r\n     * This is only used by pronunciation assessment config.\r\n     * Do not use externally, object returned will change without warning or notice.\r\n     */\r\n    public setPronunciationAssessmentParams(params: string, isSpeakerDiarizationEnabled: boolean = false): void {\r\n        if (this.privContext.phraseDetection === undefined) {\r\n            this.privContext.phraseDetection = {\r\n                enrichment: {\r\n                    pronunciationAssessment: {}\r\n                }\r\n            };\r\n        }\r\n        if (this.privContext.phraseDetection.enrichment === undefined) {\r\n            this.privContext.phraseDetection.enrichment = {\r\n                pronunciationAssessment: {}\r\n            };\r\n        }\r\n        this.privContext.phraseDetection.enrichment.pronunciationAssessment = JSON.parse(params) as PronunciationAssessmentOptions || {};\r\n        if (isSpeakerDiarizationEnabled) {\r\n            this.privContext.phraseDetection.mode = RecognitionMode.Conversation;\r\n        }\r\n        this.setWordLevelTimings();\r\n        this.privContext.phraseOutput.detailed.options.push(PhraseOption.PronunciationAssessment);\r\n        if (this.privContext.phraseOutput.detailed.options.indexOf(PhraseOption.SNR) === -1) {\r\n            this.privContext.phraseOutput.detailed.options.push(PhraseOption.SNR);\r\n        }\r\n    }\r\n\r\n    public setDetailedOutputFormat(): void {\r\n        if (this.privContext.phraseOutput === undefined) {\r\n            this.privContext.phraseOutput = {\r\n                detailed: {\r\n                    options: []\r\n                }\r\n            };\r\n        }\r\n        if (this.privContext.phraseOutput.detailed === undefined) {\r\n            this.privContext.phraseOutput.detailed = {\r\n                options: []\r\n            };\r\n        }\r\n        this.privContext.phraseOutput.format = OutputFormat.Detailed;\r\n    }\r\n\r\n    public setWordLevelTimings(): void {\r\n        if (this.privContext.phraseOutput === undefined) {\r\n            this.privContext.phraseOutput = {\r\n                detailed: {\r\n                    options: []\r\n                }\r\n            };\r\n        }\r\n        if (this.privContext.phraseOutput.detailed === undefined) {\r\n            this.privContext.phraseOutput.detailed = {\r\n                options: []\r\n            };\r\n        }\r\n        this.privContext.phraseOutput.format = OutputFormat.Detailed;\r\n        if (this.privContext.phraseOutput.detailed.options.indexOf(PhraseOption.WordTimings) === -1) {\r\n            this.privContext.phraseOutput.detailed.options.push(PhraseOption.WordTimings);\r\n        }\r\n    }\r\n\r\n    public setSpeakerDiarizationAudioOffsetMs(audioOffsetMs: number): void {\r\n        this.privContext.phraseDetection.speakerDiarization.audioOffsetMs = audioOffsetMs;\r\n    }\r\n\r\n    public toJSON(): string {\r\n\r\n        const dgi: Dgi = this.privDynamicGrammar.generateGrammarObject();\r\n        this.privContext.dgi = dgi;\r\n\r\n        const ret: string = JSON.stringify(this.privContext);\r\n        return ret;\r\n    }\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\nimport { Hints } from \"./Hints\";\r\nimport { Item } from \"./Item\";\r\n\r\n/**\r\n * Represents the type of the Intent.\r\n */\r\nexport enum GroupType {\r\n    IntentText = \"IntentText\",\r\n    IntentEntity = \"IntentEntity\",\r\n    Generic = \"Generic\",\r\n    People = \"People\",\r\n    Place = \"Place\",\r\n    DynamicEntity = \"DynamicEntity\"\r\n}\r\n\r\n/**\r\n * Represents the type of the substring match.\r\n */\r\nexport enum SubstringMatchType {\r\n    None = \"None\",\r\n    LeftRooted = \"LeftRooted\",\r\n    PartialName = \"PartialName\",\r\n    MiddleOfSentence = \"MiddleOfSentence\"\r\n}\r\n\r\n/**\r\n * Internal class representing a Group in the DGI v1 grammar.\r\n */\r\nexport interface Group {\r\n    /**\r\n     * The Type of the Group in the grammar.\r\n     */\r\n    type: GroupType;\r\n\r\n    /**\r\n     * Gets the Hints in the Grammar.\r\n     * Required when Type=IntentEntity\r\n     */\r\n    hints?: Hints;\r\n\r\n    /**\r\n     * Gets the Grammar name.\r\n     */\r\n    name?: string;\r\n\r\n    /**\r\n     * Gets the substring match.\r\n     */\r\n    substringMatch?: SubstringMatchType;\r\n\r\n    /**\r\n     * Gets the Items in the Grammar.\r\n     * Required when Type=IntentText, Optional when Type=IntentEntity but need to remove unused Open IntentEntity\r\n     */\r\n    items?: Item[];\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Dgi } from \"./ServiceMessages/Dgi/Dgi.js\";\r\nimport { GroupType } from \"./ServiceMessages/Dgi/Group.js\";\r\nimport { Item } from \"./ServiceMessages/Dgi/Item.js\";\r\n/**\r\n * Responsible for building the object to be sent to the speech service to support dynamic grammars.\r\n * @class DynamicGrammarBuilder\r\n */\r\nexport class DynamicGrammarBuilder {\r\n\r\n    private privPhrases: string[];\r\n    private privGrammars: string[];\r\n    private privWeight: number = 1.0;\r\n\r\n    // Adds one more reference phrases to the dynamic grammar to send.\r\n    // All added phrases are generic phrases.\r\n    public addPhrase(phrase: string | string[]): void {\r\n        if (!this.privPhrases) {\r\n            this.privPhrases = [];\r\n        }\r\n\r\n        if (phrase instanceof Array) {\r\n            this.privPhrases = this.privPhrases.concat(phrase);\r\n        } else {\r\n            this.privPhrases.push(phrase);\r\n        }\r\n    }\r\n\r\n    // Clears all phrases stored in the current object.\r\n    public clearPhrases(): void {\r\n        this.privPhrases = undefined;\r\n    }\r\n\r\n    // Adds one or more reference grammars to the current grammar.\r\n    public addReferenceGrammar(grammar: string | string[]): void {\r\n        if (!this.privGrammars) {\r\n            this.privGrammars = [];\r\n        }\r\n\r\n        if (grammar instanceof Array) {\r\n            this.privGrammars = this.privGrammars.concat(grammar);\r\n        } else {\r\n            this.privGrammars.push(grammar);\r\n        }\r\n    }\r\n\r\n    // clears all grammars stored on the recognizer.\r\n    public clearGrammars(): void {\r\n        this.privGrammars = undefined;\r\n    }\r\n\r\n    // Sets the weight for the dynamic grammar.\r\n    public setWeight(weight: number): void {\r\n        this.privWeight = weight;\r\n    }\r\n\r\n    // Generates an object that represents the dynamic grammar used by the Speech Service.\r\n    // This is done by building an object with the correct layout based on the phrases and reference grammars added to this instance\r\n    // of a DynamicGrammarBuilder\r\n    public generateGrammarObject(): Dgi {\r\n        if (this.privGrammars === undefined && this.privPhrases === undefined) {\r\n            return undefined;\r\n        }\r\n\r\n        const retObj: Dgi = {};\r\n        retObj.referenceGrammars = this.privGrammars;\r\n\r\n        if (undefined !== this.privPhrases && 0 !== this.privPhrases.length) {\r\n            const retPhrases: Item[] = [];\r\n\r\n            this.privPhrases.forEach((value: string): void => {\r\n                retPhrases.push({\r\n                    text: value,\r\n                });\r\n            });\r\n\r\n            retObj.groups = [{ type: GroupType.Generic, items: retPhrases }];\r\n            retObj.bias = this.privWeight;\r\n        }\r\n\r\n        return retObj;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// response\r\n\r\nexport interface IActivityPayloadResponse {\r\n    conversationId: string;\r\n    messageDataStreamType: number;\r\n    messagePayload: string | object;\r\n    version: number;\r\n}\r\n\r\nexport class ActivityPayloadResponse implements IActivityPayloadResponse {\r\n    private privActivityResponse: IActivityPayloadResponse;\r\n\r\n    private constructor(json: string) {\r\n        this.privActivityResponse = JSON.parse(json) as IActivityPayloadResponse;\r\n    }\r\n\r\n    public static fromJSON(json: string): ActivityPayloadResponse {\r\n        return new ActivityPayloadResponse(json);\r\n    }\r\n\r\n    public get conversationId(): string {\r\n        return this.privActivityResponse.conversationId;\r\n    }\r\n\r\n    public get messageDataStreamType(): number {\r\n        return this.privActivityResponse.messageDataStreamType;\r\n    }\r\n\r\n    public get messagePayload(): string | object {\r\n        return this.privActivityResponse.messagePayload;\r\n    }\r\n\r\n    public get version(): number {\r\n        return this.privActivityResponse.version;\r\n    }\r\n}\r\n\r\nexport enum MessageDataStreamType {\r\n    None = 0,\r\n    TextToSpeechAudio = 1,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { AudioOutputFormatImpl } from \"../sdk/Audio/AudioOutputFormat.js\";\r\nimport { AudioOutputStream, PullAudioOutputStreamImpl } from \"../sdk/Audio/AudioOutputStream.js\";\r\nimport { DialogServiceTurnStateManager } from \"./DialogServiceTurnStateManager.js\";\r\nimport { ActivityPayloadResponse, MessageDataStreamType } from \"./ServiceMessages/ActivityResponsePayload.js\";\r\n\r\nexport class DialogServiceTurnState {\r\n    private privRequestId: string;\r\n    private privIsCompleted: boolean;\r\n    private privAudioStream: PullAudioOutputStreamImpl;\r\n    private privTimeoutToken: any;\r\n    private privTurnManager: DialogServiceTurnStateManager;\r\n\r\n    public constructor(manager: DialogServiceTurnStateManager, requestId: string) {\r\n        this.privRequestId = requestId;\r\n        this.privIsCompleted = false;\r\n        this.privAudioStream = null;\r\n        this.privTurnManager = manager;\r\n        this.resetTurnEndTimeout();\r\n    }\r\n\r\n    public get audioStream(): PullAudioOutputStreamImpl {\r\n        // Called when is needed to stream.\r\n        this.resetTurnEndTimeout();\r\n        return this.privAudioStream;\r\n    }\r\n\r\n    public processActivityPayload(payload: ActivityPayloadResponse, audioFormat?: AudioOutputFormatImpl): PullAudioOutputStreamImpl {\r\n        if (payload.messageDataStreamType === MessageDataStreamType.TextToSpeechAudio) {\r\n            this.privAudioStream = AudioOutputStream.createPullStream() as PullAudioOutputStreamImpl;\r\n            this.privAudioStream.format = (audioFormat !== undefined) ? audioFormat : AudioOutputFormatImpl.getDefaultOutputFormat();\r\n        }\r\n        return this.privAudioStream;\r\n    }\r\n\r\n    public endAudioStream(): void {\r\n        if (this.privAudioStream !== null && !this.privAudioStream.isClosed) {\r\n            this.privAudioStream.close();\r\n        }\r\n    }\r\n\r\n    public complete(): void {\r\n        if (this.privTimeoutToken !== undefined) {\r\n            // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\r\n            clearTimeout(this.privTimeoutToken);\r\n        }\r\n        this.endAudioStream();\r\n    }\r\n\r\n    private resetTurnEndTimeout(): void {\r\n        if (this.privTimeoutToken !== undefined) {\r\n            // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\r\n            clearTimeout(this.privTimeoutToken);\r\n        }\r\n        this.privTimeoutToken = setTimeout((): void => {\r\n            this.privTurnManager.CompleteTurn(this.privRequestId);\r\n            return;\r\n        }, 2000);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { InvalidOperationError } from \"../common/Error.js\";\r\nimport { DialogServiceTurnState } from \"./DialogServiceTurnState.js\";\r\n\r\nexport class DialogServiceTurnStateManager {\r\n    private privTurnMap: Map<string, DialogServiceTurnState>;\r\n\r\n    public constructor() {\r\n        this.privTurnMap = new Map<string, DialogServiceTurnState>();\r\n        return;\r\n    }\r\n\r\n    public StartTurn(id: string): DialogServiceTurnState {\r\n        if (this.privTurnMap.has(id)) {\r\n            throw new InvalidOperationError(\"Service error: There is already a turn with id:\" + id);\r\n        }\r\n        const turnState: DialogServiceTurnState = new DialogServiceTurnState(this, id);\r\n        this.privTurnMap.set(id, turnState);\r\n        return this.privTurnMap.get(id);\r\n    }\r\n\r\n    public GetTurn(id: string): DialogServiceTurnState {\r\n        return this.privTurnMap.get(id);\r\n    }\r\n\r\n    public CompleteTurn(id: string): DialogServiceTurnState {\r\n        if (!this.privTurnMap.has(id)) {\r\n            throw new InvalidOperationError(\"Service error: Received turn end for an unknown turn id:\" + id);\r\n        }\r\n        const turnState = this.privTurnMap.get(id);\r\n        turnState.complete();\r\n        this.privTurnMap.delete(id);\r\n        return turnState;\r\n    }\r\n}\r\n","/**\r\n * Represents the source of speech recognition invocation.\r\n */\r\nexport enum InvocationSource {\r\n    /**\r\n     * No invocation source specified.\r\n     */\r\n    None = \"None\",\r\n\r\n    /**\r\n     * Voice activation with a keyword.\r\n     */\r\n    VoiceActivationWithKeyword = \"VoiceActivationWithKeyword\"\r\n}\r\n","/**\r\n * Represents the type of keyword detection.\r\n */\r\nexport enum KeywordDetectionType {\r\n    /**\r\n     * Triggered at the start of input.\r\n     */\r\n    StartTrigger = \"StartTrigger\"\r\n}\r\n\r\n/**\r\n * Represents a keyword detected by the client.\r\n */\r\nexport interface ClientDetectedKeyword {\r\n    /**\r\n     * The text of the detected keyword.\r\n     */\r\n    text: string;\r\n\r\n    /**\r\n     * The confidence score of the detection.\r\n     */\r\n    confidence?: number;\r\n\r\n    /**\r\n     * The start offset in 100-nanoseconds.\r\n     */\r\n    startOffset?: number;\r\n\r\n    /**\r\n     * The duration in 100-nanoseconds.\r\n     */\r\n    duration?: number;\r\n}\r\n\r\n/**\r\n * The action to take when a keyword is rejected.\r\n */\r\nexport enum OnRejectAction {\r\n    /**\r\n     * End the current turn.\r\n     */\r\n    EndOfTurn = \"EndOfTurn\",\r\n\r\n    /**\r\n     * Continue processing.\r\n     */\r\n    Continue = \"Continue\"\r\n}\r\n\r\n/**\r\n * Settings for handling keyword rejection.\r\n */\r\nexport interface OnReject {\r\n    /**\r\n     * The action to take on keyword rejection.\r\n     */\r\n    action: OnRejectAction;\r\n}\r\n\r\n/**\r\n * Represents keyword detection configuration.\r\n */\r\nexport interface KeywordDetection {\r\n    /**\r\n     * The type of keyword detection.\r\n     */\r\n    type: KeywordDetectionType;\r\n\r\n    /**\r\n     * Keywords detected by the client.\r\n     */\r\n    clientDetectedKeywords: ClientDetectedKeyword[];\r\n\r\n    /**\r\n     * Settings for handling keyword rejection.\r\n     */\r\n    onReject: OnReject;\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ReplayableAudioNode\r\n} from \"../common.browser/Exports.js\";\r\nimport { SendingAgentContextMessageEvent } from \"../common/DialogEvents.js\";\r\nimport {\r\n    BackgroundEvent,\r\n    ConnectionEvent,\r\n    ConnectionMessage,\r\n    createGuid,\r\n    createNoDashGuid,\r\n    Deferred,\r\n    DialogEvent,\r\n    Events,\r\n    EventSource,\r\n    IAudioSource,\r\n    IAudioStreamNode,\r\n    IConnection,\r\n    MessageType,\r\n    ServiceEvent,\r\n} from \"../common/Exports.js\";\r\nimport { AudioOutputFormatImpl } from \"../sdk/Audio/AudioOutputFormat.js\";\r\nimport { PullAudioOutputStreamImpl } from \"../sdk/Audio/AudioOutputStream.js\";\r\nimport { AudioStreamFormatImpl } from \"../sdk/Audio/AudioStreamFormat.js\";\r\nimport {\r\n    ActivityReceivedEventArgs,\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    DialogServiceConfig,\r\n    DialogServiceConnector,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    RecognitionEventArgs,\r\n    ResultReason,\r\n    SessionEventArgs,\r\n    SpeechRecognitionCanceledEventArgs,\r\n    SpeechRecognitionEventArgs,\r\n    SpeechRecognitionResult,\r\n    TurnStatusReceivedEventArgs,\r\n} from \"../sdk/Exports.js\";\r\nimport { DialogServiceTurnStateManager } from \"./DialogServiceTurnStateManager.js\";\r\nimport {\r\n    CancellationErrorCodePropertyName,\r\n    EnumTranslation,\r\n    ISpeechConfigAudioDevice,\r\n    RecognitionStatus,\r\n    ServiceRecognizerBase,\r\n    SimpleSpeechPhrase,\r\n    SpeechDetected,\r\n    SpeechHypothesis,\r\n    SpeechKeyword,\r\n} from \"./Exports.js\";\r\nimport { IAuthentication } from \"./IAuthentication.js\";\r\nimport { IConnectionFactory } from \"./IConnectionFactory.js\";\r\nimport { RecognizerConfig } from \"./RecognizerConfig.js\";\r\nimport { ActivityPayloadResponse } from \"./ServiceMessages/ActivityResponsePayload.js\";\r\nimport { InvocationSource } from \"./ServiceMessages/InvocationSource.js\";\r\nimport { ClientDetectedKeyword, KeywordDetectionType, OnRejectAction } from \"./ServiceMessages/KeywordDetection/KeywordDetection.js\";\r\nimport { RecognitionMode } from \"./ServiceMessages/PhraseDetection/PhraseDetectionContext.js\";\r\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal.js\";\r\n\r\nexport class DialogServiceAdapter extends ServiceRecognizerBase {\r\n    private privDialogServiceConnector: DialogServiceConnector;\r\n\r\n    private privDialogAudioSource: IAudioSource;\r\n\r\n    private privConnectionLoop: Promise<void>;\r\n    private terminateMessageLoop: boolean;\r\n    private agentConfigSent: boolean;\r\n    private privLastResult: SpeechRecognitionResult;\r\n    private privEvents: EventSource<DialogEvent>;\r\n\r\n    // Turns are of two kinds:\r\n    // 1: SR turns, end when the SR result is returned and then turn end.\r\n    // 2: Service turns where an activity is sent by the service along with the audio.\r\n    private privTurnStateManager: DialogServiceTurnStateManager;\r\n\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioSource: IAudioSource,\r\n        recognizerConfig: RecognizerConfig,\r\n        dialogServiceConnector: DialogServiceConnector) {\r\n\r\n        super(authentication, connectionFactory, audioSource, recognizerConfig, dialogServiceConnector);\r\n\r\n        this.privEvents = new EventSource<DialogEvent>();\r\n        this.privDialogServiceConnector = dialogServiceConnector;\r\n        this.receiveMessageOverride = (): Promise<void> => this.receiveDialogMessageOverride();\r\n        this.privTurnStateManager = new DialogServiceTurnStateManager();\r\n        this.recognizeOverride =\r\n            (recoMode: RecognitionMode, successCallback: (e: SpeechRecognitionResult) => void, errorCallback: (e: string) => void): Promise<void> =>\r\n                this.listenOnce(recoMode, successCallback, errorCallback);\r\n        this.postConnectImplOverride = (connection: Promise<IConnection>): Promise<IConnection> => this.dialogConnectImpl(connection);\r\n        this.configConnectionOverride = (connection: IConnection): Promise<IConnection> => this.configConnection(connection);\r\n        this.disconnectOverride = (): Promise<void> => this.privDisconnect();\r\n        this.privDialogAudioSource = audioSource;\r\n\r\n        this.agentConfigSent = false;\r\n        this.privLastResult = null;\r\n        this.connectionEvents.attach((connectionEvent: ConnectionEvent): void => {\r\n            if (connectionEvent.name === \"ConnectionClosedEvent\") {\r\n                this.terminateMessageLoop = true;\r\n            }\r\n        });\r\n    }\r\n\r\n    public async sendMessage(message: string): Promise<void> {\r\n        const interactionGuid: string = createGuid();\r\n        const requestId: string = createNoDashGuid();\r\n\r\n        const agentMessage: any = {\r\n            context: {\r\n                interactionId: interactionGuid\r\n            },\r\n            // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\r\n            messagePayload: JSON.parse(message),\r\n            version: 0.5\r\n        };\r\n\r\n        const agentMessageJson = JSON.stringify(agentMessage);\r\n        const connection: IConnection = await this.fetchConnection();\r\n        await connection.send(new SpeechConnectionMessage(\r\n            MessageType.Text,\r\n            \"agent\",\r\n            requestId,\r\n            \"application/json\",\r\n            agentMessageJson));\r\n\r\n    }\r\n\r\n    protected async privDisconnect(): Promise<void> {\r\n        await this.cancelRecognition(this.privRequestSession.sessionId,\r\n            this.privRequestSession.requestId,\r\n            CancellationReason.Error,\r\n            CancellationErrorCode.NoError,\r\n            \"Disconnecting\");\r\n\r\n        this.terminateMessageLoop = true;\r\n        this.agentConfigSent = false;\r\n        return;\r\n    }\r\n\r\n    protected processTypeSpecificMessages(connectionMessage: SpeechConnectionMessage): Promise<boolean> {\r\n\r\n        const resultProps: PropertyCollection = new PropertyCollection();\r\n        if (connectionMessage.messageType === MessageType.Text) {\r\n            resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, connectionMessage.textBody);\r\n        }\r\n\r\n        let result: SpeechRecognitionResult;\r\n        let processed: boolean;\r\n\r\n        switch (connectionMessage.path.toLowerCase()) {\r\n            case \"speech.phrase\":\r\n                const speechPhrase: SimpleSpeechPhrase = SimpleSpeechPhrase.fromJSON(connectionMessage.textBody, this.privRequestSession.currentTurnAudioOffset);\r\n\r\n                this.privRequestSession.onPhraseRecognized(speechPhrase.Offset + speechPhrase.Duration);\r\n\r\n                if (speechPhrase.RecognitionStatus !== RecognitionStatus.TooManyRequests && speechPhrase.RecognitionStatus !== RecognitionStatus.Error) {\r\n                    const args: SpeechRecognitionEventArgs = this.fireEventForResult(speechPhrase, resultProps);\r\n                    this.privLastResult = args.result;\r\n\r\n                    if (!!this.privDialogServiceConnector.recognized) {\r\n                        try {\r\n                            this.privDialogServiceConnector.recognized(this.privDialogServiceConnector, args);\r\n                            /* eslint-disable no-empty */\r\n                        } catch (error) {\r\n                            // Not going to let errors in the event handler\r\n                            // trip things up.\r\n                        }\r\n                    }\r\n                }\r\n                processed = true;\r\n                break;\r\n            case \"speech.hypothesis\":\r\n                const hypothesis: SpeechHypothesis = SpeechHypothesis.fromJSON(connectionMessage.textBody, this.privRequestSession.currentTurnAudioOffset);\r\n\r\n                result = new SpeechRecognitionResult(\r\n                    this.privRequestSession.requestId,\r\n                    ResultReason.RecognizingSpeech,\r\n                    hypothesis.Text,\r\n                    hypothesis.Duration,\r\n                    hypothesis.Offset,\r\n                    hypothesis.Language,\r\n                    hypothesis.LanguageDetectionConfidence,\r\n                    undefined,\r\n                    undefined,\r\n                    hypothesis.asJson(),\r\n                    resultProps);\r\n\r\n                this.privRequestSession.onHypothesis(hypothesis.Offset);\r\n\r\n                const ev = new SpeechRecognitionEventArgs(result, hypothesis.Offset, this.privRequestSession.sessionId);\r\n\r\n                if (!!this.privDialogServiceConnector.recognizing) {\r\n                    try {\r\n                        this.privDialogServiceConnector.recognizing(this.privDialogServiceConnector, ev);\r\n                        /* eslint-disable no-empty */\r\n                    } catch (error) {\r\n                        // Not going to let errors in the event handler\r\n                        // trip things up.\r\n                    }\r\n                }\r\n                processed = true;\r\n                break;\r\n            case \"speech.keyword\":\r\n                const keyword: SpeechKeyword = SpeechKeyword.fromJSON(connectionMessage.textBody, this.privRequestSession.currentTurnAudioOffset);\r\n\r\n                result = new SpeechRecognitionResult(\r\n                    this.privRequestSession.requestId,\r\n                    keyword.Status === \"Accepted\" ? ResultReason.RecognizedKeyword : ResultReason.NoMatch,\r\n                    keyword.Text,\r\n                    keyword.Duration,\r\n                    keyword.Offset,\r\n                    undefined,\r\n                    undefined,\r\n                    undefined,\r\n                    undefined,\r\n                    keyword.asJson(),\r\n                    resultProps);\r\n\r\n                if (keyword.Status !== \"Accepted\") {\r\n                    this.privLastResult = result;\r\n                }\r\n\r\n                const event = new SpeechRecognitionEventArgs(result, result.duration, result.resultId);\r\n\r\n                if (!!this.privDialogServiceConnector.recognized) {\r\n                    try {\r\n                        this.privDialogServiceConnector.recognized(this.privDialogServiceConnector, event);\r\n                        /* eslint-disable no-empty */\r\n                    } catch (error) {\r\n                        // Not going to let errors in the event handler\r\n                        // trip things up.\r\n                    }\r\n                }\r\n                processed = true;\r\n                break;\r\n            case \"audio\":\r\n                {\r\n                    const audioRequestId = connectionMessage.requestId.toUpperCase();\r\n                    const turn = this.privTurnStateManager.GetTurn(audioRequestId);\r\n                    try {\r\n                        // Empty binary message signals end of stream.\r\n                        if (!connectionMessage.binaryBody) {\r\n                            turn.endAudioStream();\r\n                        } else {\r\n                            turn.audioStream.write(connectionMessage.binaryBody);\r\n                        }\r\n                    } catch (error) {\r\n                        // Not going to let errors in the event handler\r\n                        // trip things up.\r\n                    }\r\n                }\r\n                processed = true;\r\n                break;\r\n\r\n            case \"response\":\r\n                {\r\n                    this.handleResponseMessage(connectionMessage);\r\n                }\r\n                processed = true;\r\n                break;\r\n\r\n            default:\r\n                break;\r\n        }\r\n        const defferal = new Deferred<boolean>();\r\n        defferal.resolve(processed);\r\n        return defferal.promise;\r\n    }\r\n\r\n    // Cancels recognition.\r\n    protected async cancelRecognition(\r\n        sessionId: string,\r\n        requestId: string,\r\n        cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): Promise<void> {\r\n\r\n        this.terminateMessageLoop = true;\r\n\r\n        if (!!this.privRequestSession.isRecognizing) {\r\n            await this.privRequestSession.onStopRecognizing();\r\n        }\r\n\r\n        if (!!this.privDialogServiceConnector.canceled) {\r\n            const properties: PropertyCollection = new PropertyCollection();\r\n            properties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[errorCode]);\r\n\r\n            const cancelEvent: SpeechRecognitionCanceledEventArgs = new SpeechRecognitionCanceledEventArgs(\r\n                cancellationReason,\r\n                error,\r\n                errorCode,\r\n                undefined,\r\n                sessionId);\r\n\r\n            try {\r\n                this.privDialogServiceConnector.canceled(this.privDialogServiceConnector, cancelEvent);\r\n                /* eslint-disable no-empty */\r\n            } catch { }\r\n\r\n            if (!!this.privSuccessCallback) {\r\n                const result: SpeechRecognitionResult = new SpeechRecognitionResult(\r\n                    undefined, // ResultId\r\n                    ResultReason.Canceled,\r\n                    undefined, // Text\r\n                    undefined, // Duration\r\n                    undefined, // Offset\r\n                    undefined, // Language\r\n                    undefined, // Language Detection Confidence\r\n                    undefined, // Speaker Id\r\n                    error,\r\n                    undefined, // Json\r\n                    properties);\r\n                try {\r\n                    this.privSuccessCallback(result);\r\n                    this.privSuccessCallback = undefined;\r\n                    /* eslint-disable no-empty */\r\n                } catch { }\r\n            }\r\n        }\r\n    }\r\n\r\n    protected async listenOnce(\r\n        recoMode: RecognitionMode,\r\n        successCallback: (e: SpeechRecognitionResult) => void,\r\n        errorCallback: (e: string) => void\r\n    ): Promise<void> {\r\n        this.privRecognizerConfig.recognitionMode = recoMode;\r\n\r\n        this.privSuccessCallback = successCallback;\r\n        this.privErrorCallback = errorCallback;\r\n\r\n        this.privRequestSession.startNewRecognition();\r\n        this.privRequestSession.listenForServiceTelemetry(this.privDialogAudioSource.events);\r\n\r\n        this.privRecognizerConfig.parameters.setProperty(PropertyId.Speech_SessionId, this.privRequestSession.sessionId);\r\n\r\n        // Start the connection to the service. The promise this will create is stored and will be used by configureConnection().\r\n        const conPromise: Promise<IConnection> = this.connectImpl();\r\n\r\n        const preAudioPromise: Promise<void> = this.sendPreAudioMessages();\r\n\r\n        const node: IAudioStreamNode = await this.privDialogAudioSource.attach(this.privRequestSession.audioNodeId);\r\n        const format: AudioStreamFormatImpl = await this.privDialogAudioSource.format;\r\n        const deviceInfo: ISpeechConfigAudioDevice = await this.privDialogAudioSource.deviceInfo;\r\n\r\n        const audioNode = new ReplayableAudioNode(node, format.avgBytesPerSec);\r\n        await this.privRequestSession.onAudioSourceAttachCompleted(audioNode, false);\r\n\r\n        this.privRecognizerConfig.SpeechServiceConfig.Context.audio = { source: deviceInfo };\r\n\r\n        try {\r\n            await conPromise;\r\n            await preAudioPromise;\r\n        } catch (error) {\r\n            await this.cancelRecognition(this.privRequestSession.sessionId, this.privRequestSession.requestId, CancellationReason.Error, CancellationErrorCode.ConnectionFailure, error as string);\r\n            return Promise.resolve();\r\n        }\r\n\r\n        const sessionStartEventArgs: SessionEventArgs = new SessionEventArgs(this.privRequestSession.sessionId);\r\n\r\n        if (!!this.privRecognizer.sessionStarted) {\r\n            this.privRecognizer.sessionStarted(this.privRecognizer, sessionStartEventArgs);\r\n        }\r\n\r\n        const audioSendPromise = this.sendAudio(audioNode);\r\n\r\n        // /* eslint-disable no-empty */\r\n        audioSendPromise.then((): void => { /* add? return true;*/ }, async (error: string): Promise<void> => {\r\n            await this.cancelRecognition(this.privRequestSession.sessionId, this.privRequestSession.requestId, CancellationReason.Error, CancellationErrorCode.RuntimeError, error);\r\n        });\r\n    }\r\n\r\n    // Establishes a websocket connection to the end point.\r\n    private dialogConnectImpl(connection: Promise<IConnection>): Promise<IConnection> {\r\n        this.privConnectionLoop = this.startMessageLoop();\r\n        return connection;\r\n    }\r\n\r\n    private receiveDialogMessageOverride(): Promise<void> {\r\n\r\n        // we won't rely on the cascading promises of the connection since we want to continually be available to receive messages\r\n        const communicationCustodian: Deferred<void> = new Deferred<void>();\r\n\r\n        const loop = async (): Promise<void> => {\r\n            try {\r\n                const isDisposed: boolean = this.isDisposed();\r\n                const terminateMessageLoop = (!this.isDisposed() && this.terminateMessageLoop);\r\n                if (isDisposed || terminateMessageLoop) {\r\n                    // We're done.\r\n                    communicationCustodian.resolve(undefined);\r\n                    return;\r\n                }\r\n\r\n                const connection: IConnection = await this.fetchConnection();\r\n                const message: ConnectionMessage = await connection.read();\r\n\r\n                if (!message) {\r\n                    return loop();\r\n                }\r\n\r\n                const connectionMessage = SpeechConnectionMessage.fromConnectionMessage(message);\r\n\r\n                switch (connectionMessage.path.toLowerCase()) {\r\n                    case \"turn.start\":\r\n                        {\r\n                            const turnRequestId = connectionMessage.requestId.toUpperCase();\r\n                            const audioSessionReqId = this.privRequestSession.requestId.toUpperCase();\r\n\r\n                            // turn started by the service\r\n                            if (turnRequestId !== audioSessionReqId) {\r\n                                this.privTurnStateManager.StartTurn(turnRequestId);\r\n                            } else {\r\n                                this.privRequestSession.onServiceTurnStartResponse();\r\n                            }\r\n                        }\r\n                        break;\r\n\r\n                    case \"speech.startdetected\":\r\n                        const speechStartDetected: SpeechDetected = SpeechDetected.fromJSON(connectionMessage.textBody, this.privRequestSession.currentTurnAudioOffset);\r\n\r\n                        const speechStartEventArgs = new RecognitionEventArgs(speechStartDetected.Offset, this.privRequestSession.sessionId);\r\n\r\n                        if (!!this.privRecognizer.speechStartDetected) {\r\n                            this.privRecognizer.speechStartDetected(this.privRecognizer, speechStartEventArgs);\r\n                        }\r\n\r\n                        break;\r\n\r\n                    case \"speech.enddetected\":\r\n\r\n                        let json: string;\r\n\r\n                        if (connectionMessage.textBody.length > 0) {\r\n                            json = connectionMessage.textBody;\r\n                        } else {\r\n                            // If the request was empty, the JSON returned is empty.\r\n                            json = \"{ Offset: 0 }\";\r\n                        }\r\n\r\n                        const speechStopDetected: SpeechDetected = SpeechDetected.fromJSON(json, this.privRequestSession.currentTurnAudioOffset);\r\n\r\n                        this.privRequestSession.onServiceRecognized(speechStopDetected.Offset);\r\n\r\n                        const speechStopEventArgs = new RecognitionEventArgs(speechStopDetected.Offset, this.privRequestSession.sessionId);\r\n\r\n                        if (!!this.privRecognizer.speechEndDetected) {\r\n                            this.privRecognizer.speechEndDetected(this.privRecognizer, speechStopEventArgs);\r\n                        }\r\n                        break;\r\n\r\n                    case \"turn.end\":\r\n                        {\r\n                            const turnEndRequestId = connectionMessage.requestId.toUpperCase();\r\n\r\n                            const audioSessionReqId = this.privRequestSession.requestId.toUpperCase();\r\n\r\n                            // turn started by the service\r\n                            if (turnEndRequestId !== audioSessionReqId) {\r\n                                this.privTurnStateManager.CompleteTurn(turnEndRequestId);\r\n                            } else {\r\n                                // Audio session turn\r\n\r\n                                const sessionStopEventArgs: SessionEventArgs = new SessionEventArgs(this.privRequestSession.sessionId);\r\n                                await this.privRequestSession.onServiceTurnEndResponse(false);\r\n\r\n                                if (!this.privRecognizerConfig.isContinuousRecognition || this.privRequestSession.isSpeechEnded || !this.privRequestSession.isRecognizing) {\r\n                                    if (!!this.privRecognizer.sessionStopped) {\r\n                                        this.privRecognizer.sessionStopped(this.privRecognizer, sessionStopEventArgs);\r\n                                    }\r\n                                }\r\n\r\n                                // report result to promise.\r\n                                if (!!this.privSuccessCallback && this.privLastResult) {\r\n                                    try {\r\n                                        this.privSuccessCallback(this.privLastResult);\r\n                                        this.privLastResult = null;\r\n                                    } catch (e) {\r\n                                        if (!!this.privErrorCallback) {\r\n                                            this.privErrorCallback(e as string);\r\n                                        }\r\n                                    }\r\n                                    // Only invoke the call back once.\r\n                                    // and if it's successful don't invoke the\r\n                                    // error after that.\r\n                                    this.privSuccessCallback = undefined;\r\n                                    this.privErrorCallback = undefined;\r\n                                }\r\n                            }\r\n                        }\r\n                        break;\r\n\r\n                    default:\r\n                        try {\r\n                            const processed = await this.processTypeSpecificMessages(connectionMessage);\r\n                            if (!processed) {\r\n                                if (!!this.serviceEvents) {\r\n                                    this.serviceEvents.onEvent(new ServiceEvent(connectionMessage.path.toLowerCase(), connectionMessage.textBody));\r\n                                }\r\n                            }\r\n                        } catch (e) {\r\n                            //\r\n                        }\r\n                }\r\n                const ret: Promise<void> = loop();\r\n\r\n                return ret;\r\n            } catch (error) {\r\n                this.terminateMessageLoop = true;\r\n                communicationCustodian.resolve();\r\n            }\r\n        };\r\n\r\n        loop().catch((reason: string): void => {\r\n            Events.instance.onEvent(new BackgroundEvent(reason));\r\n        });\r\n\r\n        return communicationCustodian.promise;\r\n    }\r\n\r\n    private async startMessageLoop(): Promise<void> {\r\n\r\n        this.terminateMessageLoop = false;\r\n\r\n        try {\r\n            await this.receiveDialogMessageOverride();\r\n        } catch (error) {\r\n            await this.cancelRecognition(this.privRequestSession.sessionId, this.privRequestSession.requestId, CancellationReason.Error, CancellationErrorCode.RuntimeError, error as string);\r\n        }\r\n\r\n        return Promise.resolve();\r\n    }\r\n\r\n    // Takes an established websocket connection to the endpoint and sends speech configuration information.\r\n    private async configConnection(connection: IConnection): Promise<IConnection> {\r\n        if (this.terminateMessageLoop) {\r\n            this.terminateMessageLoop = false;\r\n            return Promise.reject(\"Connection to service terminated.\");\r\n        }\r\n\r\n        await this.sendSpeechServiceConfig(connection, this.privRequestSession, this.privRecognizerConfig.SpeechServiceConfig.serialize());\r\n        await this.sendAgentConfig(connection);\r\n        return connection;\r\n    }\r\n\r\n    private async sendPreAudioMessages(): Promise<void> {\r\n        const connection: IConnection = await this.fetchConnection();\r\n        this.addKeywordContextData();\r\n        await this.sendSpeechContext(connection, true);\r\n        await this.sendAgentContext(connection);\r\n        await this.sendWaveHeader(connection);\r\n    }\r\n\r\n    private sendAgentConfig(connection: IConnection): Promise<void> {\r\n        if (this.agentConfig && !this.agentConfigSent) {\r\n\r\n            if (this.privRecognizerConfig\r\n                .parameters\r\n                .getProperty(PropertyId.Conversation_DialogType) === DialogServiceConfig.DialogTypes.CustomCommands) {\r\n                const config = this.agentConfig.get();\r\n                config.botInfo.commandsCulture = this.privRecognizerConfig.parameters.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage, \"en-us\");\r\n                this.agentConfig.set(config);\r\n            }\r\n            this.onEvent(new SendingAgentContextMessageEvent(this.agentConfig));\r\n\r\n            const agentConfigJson = this.agentConfig.toJsonString();\r\n\r\n            // guard against sending this multiple times on one connection\r\n            this.agentConfigSent = true;\r\n\r\n            return connection.send(new SpeechConnectionMessage(\r\n                MessageType.Text,\r\n                \"agent.config\",\r\n                this.privRequestSession.requestId,\r\n                \"application/json\",\r\n                agentConfigJson));\r\n        }\r\n\r\n        return;\r\n    }\r\n\r\n    private sendAgentContext(connection: IConnection): Promise<void> {\r\n        const guid: string = createGuid();\r\n\r\n        const speechActivityTemplate = this.privDialogServiceConnector.properties.getProperty(PropertyId.Conversation_Speech_Activity_Template);\r\n\r\n        const agentContext: any = {\r\n            channelData: \"\",\r\n            context: {\r\n                interactionId: guid\r\n            },\r\n            messagePayload: typeof speechActivityTemplate === undefined ? undefined : speechActivityTemplate,\r\n            version: 0.5\r\n        };\r\n\r\n        const agentContextJson = JSON.stringify(agentContext);\r\n\r\n        return connection.send(new SpeechConnectionMessage(\r\n            MessageType.Text,\r\n            \"speech.agent.context\",\r\n            this.privRequestSession.requestId,\r\n            \"application/json\",\r\n            agentContextJson));\r\n    }\r\n\r\n    private fireEventForResult(serviceResult: SimpleSpeechPhrase, properties: PropertyCollection): SpeechRecognitionEventArgs {\r\n        const resultReason: ResultReason = EnumTranslation.implTranslateRecognitionResult(serviceResult.RecognitionStatus);\r\n\r\n        const result = new SpeechRecognitionResult(\r\n            this.privRequestSession.requestId,\r\n            resultReason,\r\n            serviceResult.DisplayText,\r\n            serviceResult.Duration,\r\n            serviceResult.Offset,\r\n            serviceResult.Language,\r\n            serviceResult.LanguageDetectionConfidence,\r\n            undefined,\r\n            undefined,\r\n            serviceResult.asJson(),\r\n            properties);\r\n\r\n        const ev = new SpeechRecognitionEventArgs(result, serviceResult.Offset, this.privRequestSession.sessionId);\r\n        return ev;\r\n    }\r\n\r\n    private handleResponseMessage(responseMessage: SpeechConnectionMessage): void {\r\n        // \"response\" messages can contain either \"message\" (activity) or \"MessageStatus\" data. Fire the appropriate\r\n        // event according to the message type that's specified.\r\n        const responsePayload: { messageType: string } = JSON.parse(responseMessage.textBody) as { messageType: string };\r\n        switch (responsePayload.messageType.toLowerCase()) {\r\n            case \"message\":\r\n                const responseRequestId = responseMessage.requestId.toUpperCase();\r\n                const activityPayload: ActivityPayloadResponse = ActivityPayloadResponse.fromJSON(responseMessage.textBody);\r\n                const turn = this.privTurnStateManager.GetTurn(responseRequestId);\r\n\r\n                // update the conversation Id\r\n                if (activityPayload.conversationId) {\r\n                    const updateAgentConfig = this.agentConfig.get();\r\n                    updateAgentConfig.botInfo.conversationId = activityPayload.conversationId;\r\n                    this.agentConfig.set(updateAgentConfig);\r\n                }\r\n\r\n                const pullAudioOutputStream: PullAudioOutputStreamImpl = turn.processActivityPayload(\r\n                    activityPayload,\r\n                    AudioOutputFormatImpl.fromSpeechSynthesisOutputFormatString(this.privDialogServiceConnector.properties.getProperty(PropertyId.SpeechServiceConnection_SynthOutputFormat, undefined)));\r\n                const activity = new ActivityReceivedEventArgs(activityPayload.messagePayload, pullAudioOutputStream);\r\n                if (!!this.privDialogServiceConnector.activityReceived) {\r\n                    try {\r\n                        this.privDialogServiceConnector.activityReceived(this.privDialogServiceConnector, activity);\r\n                        /* eslint-disable-next-line no-empty */\r\n                    } catch (error) {\r\n                        // Not going to let errors in the event handler\r\n                        // trip things up.\r\n                    }\r\n                }\r\n                break;\r\n\r\n            case \"messagestatus\":\r\n                if (!!this.privDialogServiceConnector.turnStatusReceived) {\r\n                    try {\r\n                        this.privDialogServiceConnector.turnStatusReceived(\r\n                            this.privDialogServiceConnector,\r\n                            new TurnStatusReceivedEventArgs(responseMessage.textBody));\r\n                        /* eslint-disable-next-line no-empty */\r\n                    } catch (error) {\r\n                        // Not going to let errors in the event handler\r\n                        // trip things up.\r\n                    }\r\n                }\r\n                break;\r\n\r\n            default:\r\n                Events.instance.onEvent(\r\n                    new BackgroundEvent(`Unexpected response of type ${responsePayload.messageType}. Ignoring.`));\r\n                break;\r\n        }\r\n    }\r\n\r\n    private onEvent(event: DialogEvent): void {\r\n        this.privEvents.onEvent(event);\r\n        Events.instance.onEvent(event);\r\n    }\r\n\r\n    private addKeywordContextData(): void {\r\n        const keywordPropertyValue: string = this.privRecognizerConfig.parameters.getProperty(\"SPEECH-KeywordsToDetect\");\r\n        if (keywordPropertyValue === undefined) {\r\n            return;\r\n        }\r\n\r\n        const keywordOffsetPropertyValue: string = this.privRecognizerConfig.parameters\r\n            .getProperty(\"SPEECH-KeywordsToDetect-Offsets\");\r\n        const keywordDurationPropertyValue: string = this.privRecognizerConfig.parameters\r\n            .getProperty(\"SPEECH-KeywordsToDetect-Durations\");\r\n\r\n        const keywords = keywordPropertyValue.split(\";\");\r\n        const keywordOffsets = keywordOffsetPropertyValue === undefined ? [] : keywordOffsetPropertyValue.split(\";\");\r\n        const keywordDurations = keywordDurationPropertyValue === undefined ? [] : keywordDurationPropertyValue.split(\";\");\r\n\r\n        const keywordDefinitionArray: ClientDetectedKeyword[] = [];\r\n        for (let i = 0; i < keywords.length; i++) {\r\n            const definition: ClientDetectedKeyword = {\r\n                text: keywords[i]\r\n            };\r\n            if (i < keywordOffsets.length) {\r\n                definition.startOffset = Number(keywordOffsets[i]);\r\n            }\r\n            if (i < keywordDurations.length) {\r\n                definition.duration = Number(keywordDurations[i]);\r\n            }\r\n            keywordDefinitionArray.push(definition);\r\n        }\r\n\r\n        this.speechContext.getContext().invocationSource = InvocationSource.VoiceActivationWithKeyword;\r\n        this.speechContext.getContext().keywordDetection = [{\r\n            clientDetectedKeywords: keywordDefinitionArray,\r\n            onReject: { action: OnRejectAction.EndOfTurn },\r\n            type: KeywordDetectionType.StartTrigger\r\n        }];\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Represents the JSON used in the agent.config message sent to the speech service.\r\n */\r\nexport class AgentConfig {\r\n    private iPrivConfig: IAgentConfig;\r\n\r\n    public toJsonString(): string {\r\n        return JSON.stringify(this.iPrivConfig);\r\n    }\r\n\r\n    public get(): IAgentConfig {\r\n        return this.iPrivConfig;\r\n    }\r\n\r\n    /**\r\n     * Setter for the agent.config object.\r\n     * @param value a JSON serializable object.\r\n     */\r\n    public set(value: IAgentConfig): void {\r\n        this.iPrivConfig = value;\r\n    }\r\n}\r\n\r\nexport interface IAgentConfig {\r\n    botInfo: {\r\n        commType: string;\r\n        connectionId: string;\r\n        conversationId: string;\r\n        fromId: string;\r\n        commandsCulture: string;\r\n        ttsAudioFormat: string;\r\n    };\r\n    version: number;\r\n}\r\n","\r\n// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    RestConfigBase\r\n} from \"../../common.browser/RestConfigBase.js\";\r\n\r\nexport class ConversationConnectionConfig extends RestConfigBase {\r\n\r\n    private static readonly privHost: string = \"dev.microsofttranslator.com\";\r\n    private static readonly privRestPath: string = \"/capito/room\";\r\n    private static readonly privApiVersion: string = \"2.0\";\r\n    private static readonly privDefaultLanguageCode: string = \"en-US\";\r\n    private static readonly privClientAppId: string = \"FC539C22-1767-4F1F-84BC-B4D811114F15\";\r\n    private static readonly privWebSocketPath: string = \"/capito/translate\";\r\n    private static readonly privTranscriptionEventKeys: string[] = [\"iCalUid\", \"callId\", \"organizer\", \"FLAC\", \"MTUri\", \"DifferentiateGuestSpeakers\", \"audiorecording\", \"Threadid\", \"OrganizerMri\", \"OrganizerTenantId\", \"UserToken\"];\r\n\r\n    public static get host(): string {\r\n        return ConversationConnectionConfig.privHost;\r\n    }\r\n\r\n    public static get apiVersion(): string {\r\n        return ConversationConnectionConfig.privApiVersion;\r\n    }\r\n\r\n    public static get clientAppId(): string {\r\n        return ConversationConnectionConfig.privClientAppId;\r\n    }\r\n\r\n    public static get defaultLanguageCode(): string {\r\n        return ConversationConnectionConfig.privDefaultLanguageCode;\r\n    }\r\n\r\n    public static get restPath(): string {\r\n        return ConversationConnectionConfig.privRestPath;\r\n    }\r\n\r\n    public static get webSocketPath(): string {\r\n        return ConversationConnectionConfig.privWebSocketPath;\r\n    }\r\n\r\n    public static get transcriptionEventKeys(): string[] {\r\n        return ConversationConnectionConfig.privTranscriptionEventKeys;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    IRequestOptions,\r\n    IRestParams,\r\n    IRestResponse,\r\n    RestMessageAdapter,\r\n    RestRequestType\r\n} from \"../../common.browser/Exports.js\";\r\nimport { IErrorMessages, IStringDictionary } from \"../../common/Exports.js\";\r\nimport { Contracts } from \"../../sdk/Contracts.js\";\r\nimport { PropertyCollection, PropertyId } from \"../../sdk/Exports.js\";\r\nimport { ConversationConnectionConfig } from \"./ConversationConnectionConfig.js\";\r\nimport { IConversationResponseError, IInternalConversation } from \"./ConversationTranslatorInterfaces.js\";\r\n\r\nexport class ConversationManager {\r\n\r\n    private privRequestParams: IRestParams;\r\n    private privErrors: IErrorMessages;\r\n    private privHost: string;\r\n    private privApiVersion: string;\r\n    private privRestPath: string;\r\n    private privRestAdapter: RestMessageAdapter;\r\n\r\n    public constructor() {\r\n        //\r\n        this.privRequestParams = ConversationConnectionConfig.configParams;\r\n        this.privErrors = ConversationConnectionConfig.restErrors;\r\n        this.privHost = ConversationConnectionConfig.host;\r\n        this.privApiVersion = ConversationConnectionConfig.apiVersion;\r\n        this.privRestPath = ConversationConnectionConfig.restPath;\r\n        this.privRestAdapter = new RestMessageAdapter({});\r\n    }\r\n\r\n    /**\r\n     * Make a POST request to the Conversation Manager service endpoint to create or join a conversation.\r\n     * @param args\r\n     * @param conversationCode\r\n     * @param callback\r\n     * @param errorCallback\r\n     */\r\n    public createOrJoin(args: PropertyCollection, conversationCode: string, cb?: (c: any) => void, err?: (e: string) => void): void {\r\n\r\n        try {\r\n\r\n            Contracts.throwIfNullOrUndefined(args, \"args\");\r\n\r\n            const languageCode: string = args.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage, ConversationConnectionConfig.defaultLanguageCode);\r\n            const nickname: string = args.getProperty(PropertyId.ConversationTranslator_Name, \"conversation_host\");\r\n            const endpointHost: string = args.getProperty(PropertyId.ConversationTranslator_Host, this.privHost);\r\n            const correlationId: string = args.getProperty(PropertyId.ConversationTranslator_CorrelationId);\r\n            const subscriptionKey: string = args.getProperty(PropertyId.SpeechServiceConnection_Key);\r\n            const subscriptionRegion: string = args.getProperty(PropertyId.SpeechServiceConnection_Region);\r\n            const authToken: string = args.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n\r\n            Contracts.throwIfNullOrWhitespace(languageCode, \"languageCode\");\r\n            Contracts.throwIfNullOrWhitespace(nickname, \"nickname\");\r\n            Contracts.throwIfNullOrWhitespace(endpointHost, \"endpointHost\");\r\n\r\n            const queryParams: IStringDictionary<string> = {};\r\n            queryParams[this.privRequestParams.apiVersion] = this.privApiVersion;\r\n            queryParams[this.privRequestParams.languageCode] = languageCode;\r\n            queryParams[this.privRequestParams.nickname] = nickname;\r\n\r\n            const headers: IStringDictionary<string> = {};\r\n            if (correlationId) {\r\n                headers[this.privRequestParams.correlationId] = correlationId;\r\n            }\r\n            headers[this.privRequestParams.clientAppId] = ConversationConnectionConfig.clientAppId;\r\n\r\n            if (conversationCode !== undefined) {\r\n                queryParams[this.privRequestParams.roomId] = conversationCode;\r\n            } else {\r\n                Contracts.throwIfNullOrUndefined(subscriptionRegion, this.privErrors.authInvalidSubscriptionRegion);\r\n                headers[this.privRequestParams.subscriptionRegion] = subscriptionRegion;\r\n                if (subscriptionKey) {\r\n                    headers[this.privRequestParams.subscriptionKey] = subscriptionKey;\r\n                } else if (authToken) {\r\n                    headers[this.privRequestParams.authorization] = `Bearer ${authToken}`;\r\n                } else {\r\n                    Contracts.throwIfNullOrUndefined(subscriptionKey, this.privErrors.authInvalidSubscriptionKey);\r\n                }\r\n            }\r\n\r\n            const config: IRequestOptions = {};\r\n            config.headers = headers;\r\n            this.privRestAdapter.options = config;\r\n\r\n            const endpoint: string = `https://${endpointHost}${this.privRestPath}`;\r\n\r\n            // TODO: support a proxy and certificate validation\r\n            this.privRestAdapter.request(RestRequestType.Post, endpoint, queryParams, null).then((response: IRestResponse): void => {\r\n\r\n                const requestId: string = RestMessageAdapter.extractHeaderValue(this.privRequestParams.requestId, response.headers);\r\n\r\n                if (!response.ok) {\r\n                    if (!!err) {\r\n                        // get the error\r\n                        let errorMessage: string = this.privErrors.invalidCreateJoinConversationResponse.replace(\"{status}\", response.status.toString());\r\n                        let errMessageRaw: IConversationResponseError;\r\n                        try {\r\n                            errMessageRaw = JSON.parse(response.data) as IConversationResponseError;\r\n                            errorMessage += ` [${errMessageRaw.error.code}: ${errMessageRaw.error.message}]`;\r\n                        } catch (e) {\r\n                            errorMessage += ` [${response.data}]`;\r\n                        }\r\n                        if (requestId) {\r\n                            errorMessage += ` ${requestId}`;\r\n                        }\r\n\r\n                        err(errorMessage);\r\n                    }\r\n                    return;\r\n                }\r\n                const conversation: IInternalConversation = JSON.parse(response.data) as IInternalConversation;\r\n                if (conversation) {\r\n                    conversation.requestId = requestId;\r\n                }\r\n                if (!!cb) {\r\n                    try {\r\n                        cb(conversation);\r\n                    } catch (e) {\r\n                        if (!!err) {\r\n                            err(e as string);\r\n                        }\r\n                    }\r\n                    cb = undefined;\r\n                }\r\n            // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n            }).catch( (): void => { });\r\n\r\n        } catch (error) {\r\n            if (!!err) {\r\n                if (error instanceof Error) {\r\n                    const typedError: Error = error;\r\n                    err(typedError.name + \": \" + typedError.message);\r\n\r\n                } else {\r\n                    err(error as string);\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Make a DELETE request to the Conversation Manager service endpoint to leave the conversation.\r\n     * @param args\r\n     * @param sessionToken\r\n     * @param callback\r\n     */\r\n    public leave(args: PropertyCollection, sessionToken: string): Promise<void> {\r\n        return new Promise<void>((resolve: () => void, reject: (reason: string) => void): void => {\r\n            try {\r\n\r\n                Contracts.throwIfNullOrUndefined(args, this.privErrors.invalidArgs.replace(\"{arg}\", \"config\"));\r\n                Contracts.throwIfNullOrWhitespace(sessionToken, this.privErrors.invalidArgs.replace(\"{arg}\", \"token\"));\r\n\r\n                const endpointHost: string = args.getProperty(PropertyId.ConversationTranslator_Host, this.privHost);\r\n                const correlationId: string = args.getProperty(PropertyId.ConversationTranslator_CorrelationId);\r\n\r\n                const queryParams: IStringDictionary<string> = {};\r\n                queryParams[this.privRequestParams.apiVersion] = this.privApiVersion;\r\n                queryParams[this.privRequestParams.sessionToken] = sessionToken;\r\n\r\n                const headers: IStringDictionary<string> = {};\r\n                if (correlationId) {\r\n                    headers[this.privRequestParams.correlationId] = correlationId;\r\n                }\r\n\r\n                const config: IRequestOptions = {};\r\n                config.headers = headers;\r\n                this.privRestAdapter.options = config;\r\n\r\n                const endpoint: string = `https://${endpointHost}${this.privRestPath}`;\r\n\r\n                // TODO: support a proxy and certificate validation\r\n                this.privRestAdapter.request(RestRequestType.Delete, endpoint, queryParams, null).then((response: IRestResponse): void => {\r\n\r\n                    if (!response.ok) {\r\n                        // ignore errors on delete\r\n                    }\r\n\r\n                    resolve();\r\n                // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n                }).catch( (): void => {});\r\n\r\n            } catch (error) {\r\n                if (error instanceof Error) {\r\n                    const typedError: Error = error;\r\n                    reject(typedError.name + \": \" + typedError.message);\r\n\r\n                } else {\r\n                    reject(error as string);\r\n                }\r\n            }\r\n        });\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ConnectionMessage, IStringDictionary, MessageType } from \"../../common/Exports.js\";\r\n\r\nexport class ConversationConnectionMessage extends ConnectionMessage {\r\n    private privConversationMessageType: string;\r\n\r\n    public constructor(\r\n        messageType: MessageType,\r\n        body: any,\r\n        headers?: IStringDictionary<string>,\r\n        id?: string) {\r\n            super(messageType, body, headers, id);\r\n            const json: { type: string } = JSON.parse(this.textBody) as { type: string };\r\n            if (json.type !== undefined) {\r\n                this.privConversationMessageType = json.type;\r\n            }\r\n    }\r\n\r\n    public get conversationMessageType(): string {\r\n        return this.privConversationMessageType;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ConnectionMessage,\r\n    Deferred,\r\n    IWebsocketMessageFormatter,\r\n    MessageType,\r\n    RawWebsocketMessage,\r\n} from \"../../common/Exports.js\";\r\nimport { ConversationConnectionMessage } from \"./ConversationConnectionMessage.js\";\r\n\r\n/**\r\n * Based off WebsocketMessageFormatter. The messages for Conversation Translator have some variations from the Speech messages.\r\n */\r\nexport class ConversationWebsocketMessageFormatter implements IWebsocketMessageFormatter {\r\n\r\n    /**\r\n     * Format incoming messages: text (speech partial/final, IM) or binary (tts)\r\n     */\r\n    public toConnectionMessage(message: RawWebsocketMessage): Promise<ConversationConnectionMessage> {\r\n        const deferral = new Deferred<ConversationConnectionMessage>();\r\n\r\n        try {\r\n            if (message.messageType === MessageType.Text) {\r\n                const incomingMessage: ConversationConnectionMessage = new ConversationConnectionMessage(message.messageType, message.textContent, {}, message.id);\r\n                deferral.resolve(incomingMessage);\r\n            } else if (message.messageType === MessageType.Binary) {\r\n                deferral.resolve(new ConversationConnectionMessage(message.messageType, message.binaryContent, undefined, message.id));\r\n            }\r\n        } catch (e) {\r\n            deferral.reject(`Error formatting the message. Error: ${e as string}`);\r\n        }\r\n\r\n        return deferral.promise;\r\n    }\r\n\r\n    /**\r\n     * Format outgoing messages: text (commands or IM)\r\n     */\r\n    public fromConnectionMessage(message: ConnectionMessage): Promise<RawWebsocketMessage> {\r\n\r\n        const deferral = new Deferred<RawWebsocketMessage>();\r\n\r\n        try {\r\n            if (message.messageType === MessageType.Text) {\r\n                const payload = `${message.textBody ? message.textBody : \"\"}`;\r\n                deferral.resolve(new RawWebsocketMessage(MessageType.Text, payload, message.id));\r\n            }\r\n        } catch (e) {\r\n            deferral.reject(`Error formatting the message. ${e as string}`);\r\n        }\r\n\r\n        return deferral.promise;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ProxyInfo, WebsocketConnection } from \"../../common.browser/Exports.js\";\r\nimport { createGuid, IConnection, IStringDictionary } from \"../../common/Exports.js\";\r\nimport { Contracts } from \"../../sdk/Contracts.js\";\r\nimport { PropertyId } from \"../../sdk/Exports.js\";\r\nimport { ConnectionFactoryBase } from \"../ConnectionFactoryBase.js\";\r\nimport { AuthInfo, RecognizerConfig } from \"../Exports.js\";\r\nimport { ConversationConnectionConfig } from \"./ConversationConnectionConfig.js\";\r\nimport { ConversationWebsocketMessageFormatter } from \"./ConversationWebsocketMessageFormatter.js\";\r\n\r\n/**\r\n * Create a connection to the Conversation Translator websocket for sending instant messages and commands, and for receiving translated messages.\r\n * The conversation must already have been started or joined.\r\n */\r\nexport class ConversationConnectionFactory extends ConnectionFactoryBase {\r\n\r\n    public create(config: RecognizerConfig, authInfo: AuthInfo, connectionId?: string): Promise<IConnection> {\r\n\r\n        const endpointHost: string = config.parameters.getProperty(PropertyId.ConversationTranslator_Host, ConversationConnectionConfig.host);\r\n        const correlationId: string = config.parameters.getProperty(PropertyId.ConversationTranslator_CorrelationId, createGuid());\r\n\r\n        const endpoint: string = `wss://${endpointHost}${ConversationConnectionConfig.webSocketPath}`;\r\n        const token: string = config.parameters.getProperty(PropertyId.ConversationTranslator_Token, undefined);\r\n        Contracts.throwIfNullOrUndefined(token, \"token\");\r\n\r\n        const queryParams: IStringDictionary<string> = {};\r\n        queryParams[ConversationConnectionConfig.configParams.apiVersion] = ConversationConnectionConfig.apiVersion;\r\n        queryParams[ConversationConnectionConfig.configParams.token] = token;\r\n        queryParams[ConversationConnectionConfig.configParams.correlationId] = correlationId;\r\n        const enableCompression: boolean = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\r\n        return Promise.resolve(new WebsocketConnection(endpoint, queryParams, {}, new ConversationWebsocketMessageFormatter(), ProxyInfo.fromRecognizerConfig(config), enableCompression, connectionId));\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    createNoDashGuid,\r\n    Deferred,\r\n    IDetachable,\r\n} from \"../../common/Exports.js\";\r\n\r\n/**\r\n * Placeholder class for the Conversation Request Session. Based off RequestSession.\r\n * TODO: define what telemetry is required.\r\n */\r\nexport class ConversationRequestSession {\r\n    private privIsDisposed: boolean = false;\r\n    private privDetachables: IDetachable[] = new Array<IDetachable>();\r\n    private privRequestId: string;\r\n    private privRequestCompletionDeferral: Deferred<void>;\r\n    private privSessionId: string;\r\n\r\n    public constructor(sessionId: string) {\r\n        this.privSessionId = sessionId;\r\n        this.privRequestId = createNoDashGuid();\r\n        this.privRequestCompletionDeferral = new Deferred<void>();\r\n    }\r\n\r\n    public get sessionId(): string {\r\n        return this.privSessionId;\r\n    }\r\n\r\n    public get requestId(): string {\r\n        return this.privRequestId;\r\n    }\r\n\r\n    public get completionPromise(): Promise<void> {\r\n        return this.privRequestCompletionDeferral.promise;\r\n    }\r\n\r\n    public onPreConnectionStart(authFetchEventId: string, connectionId: string): void {\r\n        this.privSessionId = connectionId;\r\n    }\r\n\r\n    public onAuthCompleted(isError: boolean): void {\r\n        if (isError) {\r\n            this.onComplete();\r\n        }\r\n    }\r\n\r\n    public onConnectionEstablishCompleted(statusCode: number): void {\r\n        if (statusCode === 200) {\r\n            return;\r\n        } else if (statusCode === 403) {\r\n            this.onComplete();\r\n        }\r\n    }\r\n\r\n    public onServiceTurnEndResponse(continuousRecognition: boolean): void {\r\n        if (!continuousRecognition) {\r\n            this.onComplete();\r\n        } else {\r\n            this.privRequestId = createNoDashGuid();\r\n        }\r\n    }\r\n\r\n    public async dispose(): Promise<void> {\r\n        if (!this.privIsDisposed) {\r\n            // we should have completed by now. If we did not its an unknown error.\r\n            this.privIsDisposed = true;\r\n            for (const detachable of this.privDetachables) {\r\n                await detachable.detach();\r\n            }\r\n        }\r\n    }\r\n\r\n    private onComplete(): void {\r\n        //\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n/* eslint-disable max-classes-per-file */\r\nimport { ConversationTranslationResult, SessionEventArgs } from \"../../sdk/Exports.js\";\r\nimport { IInternalParticipant } from \"./ConversationTranslatorInterfaces.js\";\r\n\r\nexport class MuteAllEventArgs extends SessionEventArgs {\r\n    private privIsMuted: boolean;\r\n\r\n    public constructor(isMuted: boolean, sessionId?: string) {\r\n        super(sessionId);\r\n\r\n        this.privIsMuted = isMuted;\r\n    }\r\n\r\n    public get isMuted(): boolean {\r\n        return this.privIsMuted;\r\n    }\r\n}\r\n\r\nexport class LockRoomEventArgs extends SessionEventArgs {\r\n    private privIsLocked: boolean;\r\n\r\n    public constructor(isLocked: boolean, sessionId?: string) {\r\n        super(sessionId);\r\n\r\n        this.privIsLocked = isLocked;\r\n    }\r\n\r\n    public get isMuted(): boolean {\r\n        return this.privIsLocked;\r\n    }\r\n}\r\n\r\nexport class ParticipantEventArgs extends SessionEventArgs {\r\n    private privParticipant: IInternalParticipant;\r\n\r\n    public constructor(participant: IInternalParticipant, sessionId?: string) {\r\n        super(sessionId);\r\n        this.privParticipant = participant;\r\n    }\r\n\r\n    public get participant(): IInternalParticipant {\r\n        return this.privParticipant;\r\n    }\r\n}\r\n\r\nexport class ParticipantAttributeEventArgs extends SessionEventArgs {\r\n    private privValue: boolean | number | string | string[];\r\n    private privKey: string;\r\n    private privParticipantId: string;\r\n\r\n    public constructor(participantId: string, key: string, value: boolean | number | string |  string[], sessionId?: string) {\r\n        super(sessionId);\r\n\r\n        this.privKey = key;\r\n        this.privValue = value;\r\n        this.privParticipantId = participantId;\r\n    }\r\n\r\n    public get value(): boolean | number | string |  string[] {\r\n        return this.privValue;\r\n    }\r\n\r\n    public get key(): string {\r\n        return this.privKey;\r\n    }\r\n    public get id(): string {\r\n        return this.privParticipantId;\r\n    }\r\n}\r\n\r\nexport class ParticipantsListEventArgs extends SessionEventArgs {\r\n\r\n    private privRoomId: string;\r\n    private privSessionToken: string;\r\n    private privTranslateTo: string[];\r\n    private privProfanityFilter: string;\r\n    private privRoomProfanityFilter: string;\r\n    private privIsRoomLocked: boolean;\r\n    private privIsMuteAll: boolean;\r\n    private privParticipants: IInternalParticipant[];\r\n\r\n    public constructor(conversationId: string, token: string, translateTo: string[], profanityFilter: string,\r\n                       roomProfanityFilter: string, isRoomLocked: boolean, isMuteAll: boolean, participants: IInternalParticipant[], sessionId?: string) {\r\n        super(sessionId);\r\n        this.privRoomId = conversationId;\r\n        this.privSessionToken = token;\r\n        this.privTranslateTo = translateTo;\r\n        this.privProfanityFilter = profanityFilter;\r\n        this.privRoomProfanityFilter = roomProfanityFilter;\r\n        this.privIsRoomLocked = isRoomLocked;\r\n        this.privIsRoomLocked = isMuteAll;\r\n        this.privParticipants = participants;\r\n    }\r\n    public get sessionToken(): string {\r\n        return this.privSessionToken;\r\n    }\r\n\r\n    public get conversationId(): string {\r\n        return this.privRoomId;\r\n    }\r\n\r\n    public get translateTo(): string[] {\r\n        return this.privTranslateTo;\r\n    }\r\n\r\n    public get profanityFilter(): string {\r\n        return this.privProfanityFilter;\r\n    }\r\n\r\n    public get roomProfanityFilter(): string {\r\n        return this.privRoomProfanityFilter;\r\n    }\r\n\r\n    public get isRoomLocked(): boolean {\r\n        return this.privIsRoomLocked;\r\n    }\r\n\r\n    public get isMuteAll(): boolean {\r\n        return this.privIsMuteAll;\r\n    }\r\n\r\n    public get participants(): IInternalParticipant[] {\r\n        return this.privParticipants;\r\n    }\r\n}\r\n\r\nexport class ConversationReceivedTranslationEventArgs {\r\n    private privPayload: ConversationTranslationResult;\r\n    private privCommand: string;\r\n    private privSessionId: string;\r\n\r\n    public constructor(command: string, payload: ConversationTranslationResult,  sessionId?: string) {\r\n        this.privPayload = payload;\r\n        this.privCommand = command;\r\n        this.privSessionId = sessionId;\r\n    }\r\n\r\n    public get payload(): ConversationTranslationResult {\r\n        return this.privPayload;\r\n    }\r\n\r\n    public get command(): string {\r\n        return this.privCommand;\r\n    }\r\n\r\n    public get sessionId(): string {\r\n        return this.privSessionId;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ConnectionEventArgs,\r\n    ConversationExpirationEventArgs,\r\n    ConversationTranslationCanceledEventArgs,\r\n    SessionEventArgs,\r\n    } from \"../../sdk/Exports.js\";\r\n// import { ConversationClient } from \"./ConversationConnection\";\r\nimport {\r\n    ConversationReceivedTranslationEventArgs,\r\n    LockRoomEventArgs,\r\n    MuteAllEventArgs,\r\n    ParticipantAttributeEventArgs,\r\n    ParticipantEventArgs,\r\n    ParticipantsListEventArgs } from \"./ConversationTranslatorEventArgs.js\";\r\n\r\n/**\r\n * Internal conversation data\r\n */\r\nexport interface IInternalConversation {\r\n    // the token to use for connecting to the Speech Service\r\n    cognitiveSpeechAuthToken: string;\r\n    // the region to use for connecting to the Speech Service\r\n    cognitiveSpeechRegion: string;\r\n    // the unique id of the user who started or joined the Conversation\r\n    participantId: string;\r\n    // a descriptive name for the Conversation\r\n    name: string;\r\n    // a descriptive name for the Conversation\r\n    description: string;\r\n    // the speech model ID for custom speech\r\n    speechModel: string;\r\n    // represents the level of speech supported in the Conversation (0: everyone can speak, 2: only host can speak, 3: no-one can speak)\r\n    modalities: number;\r\n    // ?\r\n    isApproved: boolean;\r\n    // the mute flag has been set at conversation level and only the host can speak\r\n    isMuted: boolean;\r\n    // the 5 character conversation Id\r\n    roomId: string;\r\n    // the hex color string to represent a user. If there are many users this hex color may be reused (?).\r\n    avatar: string;\r\n    // the token to use when calling the websocket\r\n    token: string;\r\n    // used for tracking the session and help with troubleshooting problems in the logs\r\n    correlationId: string;\r\n    // extracted from the headers\r\n    requestId: string;\r\n    // set programmatically\r\n    isHost: boolean;\r\n}\r\n\r\n/**\r\n * The user who is participating in the conversation.\r\n */\r\nexport interface IInternalParticipant {\r\n    avatar?: string;\r\n    displayName?: string;\r\n    id?: string;\r\n    isHost?: boolean;\r\n    isMuted?: boolean;\r\n    isUsingTts?: boolean;\r\n    profanity?: boolean;\r\n    preferredLanguage?: string;\r\n    translateToLanguages?: string[];\r\n    voice?: string;\r\n}\r\n\r\n/** Users participating in the conversation */\r\nexport class InternalParticipants {\r\n\r\n    public constructor(public participants: IInternalParticipant[] = [], public meId?: string) {\r\n\r\n    }\r\n\r\n    /**\r\n     * Add or update a participant\r\n     * @param value\r\n     */\r\n    public addOrUpdateParticipant(value: IInternalParticipant): IInternalParticipant {\r\n        if (value === undefined) {\r\n            return;\r\n        }\r\n\r\n        const exists: number = this.getParticipantIndex(value.id);\r\n        if (exists > -1) {\r\n            this.participants.splice(exists, 1, value);\r\n        } else {\r\n            this.participants.push(value);\r\n        }\r\n\r\n        // ensure it was added ok\r\n        return this.getParticipant(value.id);\r\n    }\r\n\r\n    /**\r\n     * Find the participant's position in the participants list.\r\n     * @param id\r\n     */\r\n    public getParticipantIndex(id: string): number {\r\n        return this.participants.findIndex((p: IInternalParticipant): boolean => p.id === id);\r\n    }\r\n\r\n    /**\r\n     * Find the participant by id.\r\n     * @param id\r\n     */\r\n    public getParticipant(id: string): IInternalParticipant {\r\n        return this.participants.find((p: IInternalParticipant): boolean => p.id === id);\r\n    }\r\n\r\n    /**\r\n     * Remove a participant from the participants list.\r\n     */\r\n    public deleteParticipant(id: string): void {\r\n        this.participants = this.participants.filter((p: IInternalParticipant): boolean => p.id !== id);\r\n    }\r\n\r\n    /**\r\n     * Helper to return the conversation host.\r\n     */\r\n    public get host(): IInternalParticipant {\r\n        return this.participants.find((p: IInternalParticipant): boolean => p.isHost === true );\r\n    }\r\n\r\n    /**\r\n     * Helper to return the current user.\r\n     */\r\n    public get me(): IInternalParticipant {\r\n        return this.getParticipant(this.meId);\r\n    }\r\n}\r\n\r\n/**\r\n * Recognizer for handling Conversation Translator websocket messages\r\n */\r\nexport interface ConversationRecognizer {\r\n    isDisposed(): boolean;\r\n    sendRequest: (command: string, cb?: () => void, err?: (e: string) => void) => void;\r\n    cancelSpeech?: () => Promise<void>;\r\n    close?: () => Promise<void>;\r\n    conversationExpiration?: (sender: ConversationRecognizer, event: ConversationExpirationEventArgs) => void;\r\n    connected?: (e: ConnectionEventArgs) => void;\r\n    disconnected?: (e: ConnectionEventArgs) => void;\r\n    canceled?: (sender: ConversationRecognizer, event: ConversationTranslationCanceledEventArgs) => void;\r\n    connectionOpened?: (sender: ConversationRecognizer, event: SessionEventArgs) => void;\r\n    connectionClosed?: (sender: ConversationRecognizer, event: SessionEventArgs) => void;\r\n    participantsListReceived?: (sender: ConversationRecognizer, event: ParticipantsListEventArgs) => void;\r\n    translationReceived?: (sender: ConversationRecognizer, event: ConversationReceivedTranslationEventArgs) => void;\r\n    lockRoomCommandReceived?: (sender: ConversationRecognizer, event: LockRoomEventArgs) => void;\r\n    muteAllCommandReceived?: (sender: ConversationRecognizer, event: MuteAllEventArgs) => void;\r\n    participantJoinCommandReceived?: (sender: ConversationRecognizer, event: ParticipantEventArgs) => void;\r\n    participantLeaveCommandReceived?: (sender: ConversationRecognizer, event: ParticipantEventArgs) => void;\r\n    participantUpdateCommandReceived?: (sender: ConversationRecognizer, event: ParticipantAttributeEventArgs) => void;\r\n    connect?: (token: string, cb?: () => void, err?: (e: string) => void) => void;\r\n}\r\n\r\n/**\r\n * Error message returned from the Conversation Translator websocket\r\n */\r\nexport interface IConversationResponseErrorMessage {\r\n    code: string;\r\n    message: string;\r\n}\r\n\r\n/**\r\n * Error returned from the Conversation Translator websocket\r\n */\r\nexport interface IConversationResponseError {\r\n    error: IConversationResponseErrorMessage;\r\n}\r\n\r\n/**\r\n * Base message command\r\n */\r\nexport interface IClientMessage {\r\n    type: any;\r\n}\r\n\r\n/**\r\n * Command message\r\n */\r\nexport interface ICommandMessage extends IClientMessage {\r\n    command?: string;\r\n}\r\n\r\n/**\r\n * Text message command\r\n */\r\nexport interface IInstantMessageCommand extends ICommandMessage {\r\n    roomId: string;\r\n    nickname?: string;\r\n    participantId: string;\r\n    text: string;\r\n}\r\n\r\n/**\r\n * Lock command\r\n */\r\nexport interface ILockConversationCommand extends ICommandMessage {\r\n    id?: string; // incoming ws\r\n    nickname?: string; // incoming ws\r\n    participantId: string; // host - incoming ws\r\n    roomid: string;\r\n    value: boolean;\r\n}\r\n\r\n/**\r\n * Mute all command\r\n */\r\nexport interface IMuteAllCommand extends ICommandMessage {\r\n    roomid: string;\r\n    nickname?: string;  // incoming ws\r\n    participantId: string; // host\r\n    value: boolean;\r\n    id?: string; // incoming ws\r\n}\r\n\r\n/**\r\n * Mute participant command\r\n */\r\nexport interface IMuteCommand extends ICommandMessage {\r\n    roomid: string;\r\n    nickname?: string;\r\n    participantId: string; // participant\r\n    value: boolean;\r\n    id?: string; // incoming ws\r\n}\r\n\r\n/**\r\n * Remove participant command\r\n */\r\nexport interface IEjectParticipantCommand extends ICommandMessage {\r\n    roomid: string;\r\n    participantId: string; // participant\r\n}\r\n\r\n/**\r\n * Change nickname command\r\n */\r\nexport interface IChangeNicknameCommand extends ICommandMessage {\r\n    roomid: string;\r\n    participantId: string;\r\n    nickname: string;\r\n    value: string;\r\n}\r\n\r\n/**\r\n * List of command message types\r\n */\r\nexport const ConversationTranslatorMessageTypes = {\r\n    command: \"command\",\r\n    final: \"final\",\r\n    info: \"info\",\r\n    instantMessage: \"instant_message\",\r\n    keepAlive: \"keep_alive\",\r\n    partial: \"partial\",\r\n    participantCommand: \"participant_command\",\r\n    translatedMessage: \"translated_message\"\r\n};\r\n\r\n/**\r\n * List of command types\r\n */\r\nexport const ConversationTranslatorCommandTypes = {\r\n    changeNickname: \"ChangeNickname\",\r\n    disconnectSession: \"DisconnectSession\",\r\n    ejectParticipant: \"EjectParticipant\",\r\n    instant_message: \"instant_message\",\r\n    joinSession: \"JoinSession\",\r\n    leaveSession: \"LeaveSession\",\r\n    participantList: \"ParticipantList\",\r\n    roomExpirationWarning: \"RoomExpirationWarning\",\r\n    setLockState: \"SetLockState\",\r\n    setMute: \"SetMute\",\r\n    setMuteAll: \"SetMuteAll\",\r\n    setProfanityFiltering: \"SetProfanityFiltering\",\r\n    setTranslateToLanguages: \"SetTranslateToLanguages\",\r\n    setUseTTS: \"SetUseTTS\"\r\n};\r\n\r\n/**\r\n * HTTP response helper\r\n */\r\nexport interface IResponse {\r\n    ok: boolean;\r\n    status: number;\r\n    statusText: string;\r\n    data: string;\r\n    json: <T>() => T;\r\n    headers: string;\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines the payload for incoming websocket commands\r\n */\r\nexport interface ICommandResponsePayload {\r\n    type: string;\r\n    command?: string;\r\n    id?: string; // incoming ws\r\n    nickname?: string; // incoming ws\r\n    participantId?: string;\r\n    roomid?: string;\r\n    value: boolean | number | string;\r\n    token?: string;\r\n}\r\n\r\nconst parseCommandResponse = (json: string): ICommandResponsePayload => JSON.parse(json) as ICommandResponsePayload;\r\n\r\nexport class CommandResponsePayload implements ICommandResponsePayload {\r\n    private privCommandResponse: ICommandResponsePayload;\r\n\r\n    public constructor(json: string) {\r\n        this.privCommandResponse = parseCommandResponse(json);\r\n    }\r\n\r\n    public get type(): string {\r\n        return this.privCommandResponse.type;\r\n    }\r\n    public get command(): string {\r\n        return this.privCommandResponse.command;\r\n    }\r\n    public get id(): string {\r\n        return this.privCommandResponse.id;\r\n    }\r\n    public get nickname(): string {\r\n        return this.privCommandResponse.nickname;\r\n    }\r\n    public get participantId(): string {\r\n        return this.privCommandResponse.participantId;\r\n    }\r\n    public get roomid(): string {\r\n        return this.privCommandResponse.roomid;\r\n    }\r\n    public get value(): boolean | number | string {\r\n        return this.privCommandResponse.value;\r\n    }\r\n    public get token(): string {\r\n        return this.privCommandResponse.token;\r\n    }\r\n\r\n    public static fromJSON(json: string): CommandResponsePayload {\r\n        return new CommandResponsePayload(json);\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n/**\r\n * Defines the payload for incoming list of participants\r\n */\r\nexport interface IParticipantsListPayloadResponse {\r\n    roomid: string;\r\n    id: string;\r\n    command: string;\r\n    participants: IParticipantPayloadResponse[];\r\n    token: string;\r\n    translateTo: string[];\r\n    profanityFilter: string;\r\n    roomProfanityFilter: string;\r\n    roomLocked: boolean;\r\n    muteAll: boolean;\r\n    type: string;\r\n}\r\n\r\n/**\r\n * Defines the payload for incoming participant\r\n */\r\nexport interface IParticipantPayloadResponse {\r\n    nickname: string;\r\n    locale: string;\r\n    usetts: boolean;\r\n    ismuted: boolean;\r\n    ishost: boolean;\r\n    participantId: string;\r\n    avatar?: string;\r\n}\r\n\r\nconst parseListResponse = (json: string): IParticipantsListPayloadResponse => JSON.parse(json) as IParticipantsListPayloadResponse;\r\nconst parseParticipantResponse = (json: string): IParticipantPayloadResponse => JSON.parse(json) as IParticipantPayloadResponse;\r\n\r\nexport class ParticipantsListPayloadResponse implements IParticipantsListPayloadResponse {\r\n    private privParticipantsPayloadResponse: IParticipantsListPayloadResponse;\r\n\r\n    private constructor(json: string) {\r\n        this.privParticipantsPayloadResponse = parseListResponse(json);\r\n    }\r\n\r\n    public get roomid(): string {\r\n        return this.privParticipantsPayloadResponse.roomid;\r\n    }\r\n\r\n    public get id(): string {\r\n        return this.privParticipantsPayloadResponse.id;\r\n    }\r\n\r\n    public get command(): string {\r\n        return this.privParticipantsPayloadResponse.command;\r\n    }\r\n\r\n    public get participants(): IParticipantPayloadResponse[] {\r\n        return this.privParticipantsPayloadResponse.participants;\r\n    }\r\n\r\n    public get token(): string {\r\n        return this.privParticipantsPayloadResponse.token;\r\n    }\r\n\r\n    public get translateTo(): string[] {\r\n        return this.privParticipantsPayloadResponse.translateTo;\r\n    }\r\n\r\n    public get profanityFilter(): string {\r\n        return this.privParticipantsPayloadResponse.profanityFilter;\r\n    }\r\n\r\n    public get roomProfanityFilter(): string {\r\n        return this.privParticipantsPayloadResponse.roomProfanityFilter;\r\n    }\r\n\r\n    public get roomLocked(): boolean {\r\n        return this.privParticipantsPayloadResponse.roomLocked;\r\n    }\r\n\r\n    public get muteAll(): boolean {\r\n        return this.privParticipantsPayloadResponse.muteAll;\r\n    }\r\n\r\n    public get type(): string {\r\n        return this.privParticipantsPayloadResponse.type;\r\n    }\r\n\r\n    public static fromJSON(json: string): ParticipantsListPayloadResponse {\r\n        return new ParticipantsListPayloadResponse(json);\r\n    }\r\n\r\n}\r\n\r\nexport class ParticipantPayloadResponse implements IParticipantPayloadResponse {\r\n\r\n    private privParticipantPayloadResponse: IParticipantPayloadResponse;\r\n\r\n    private constructor(json: string) {\r\n        this.privParticipantPayloadResponse = parseParticipantResponse(json);\r\n    }\r\n\r\n    public get nickname(): string {\r\n        return this.privParticipantPayloadResponse.nickname;\r\n    }\r\n\r\n    public get locale(): string {\r\n        return this.privParticipantPayloadResponse.locale;\r\n    }\r\n\r\n    public get usetts(): boolean {\r\n        return this.privParticipantPayloadResponse.usetts;\r\n    }\r\n\r\n    public get ismuted(): boolean {\r\n        return this.privParticipantPayloadResponse.ismuted;\r\n    }\r\n\r\n    public get ishost(): boolean {\r\n        return this.privParticipantPayloadResponse.ishost;\r\n    }\r\n\r\n    public get participantId(): string {\r\n        return this.privParticipantPayloadResponse.participantId;\r\n    }\r\n\r\n    public get avatar(): string {\r\n        return this.privParticipantPayloadResponse.avatar;\r\n    }\r\n\r\n    public static fromJSON(json: string): ParticipantPayloadResponse {\r\n        return new ParticipantPayloadResponse(json);\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n/**\r\n * Defines the payload for incoming translation messages\r\n */\r\nexport interface ITranslationResponsePayload {\r\n    lang: string;\r\n    translation: string;\r\n}\r\n\r\nexport interface ITranslationCommandMessage {\r\n    translations: ITranslationResponsePayload[];\r\n    id: string;\r\n    language: string;\r\n    nickname: string;\r\n    participantId: string;\r\n    roomid: string;\r\n    timestamp: string;\r\n    type: string;\r\n}\r\n\r\nexport interface ISpeechResponsePayload extends ITranslationCommandMessage {\r\n    recognition: string;\r\n    isFinal: boolean;\r\n}\r\n\r\nexport interface ITextResponsePayload extends ITranslationCommandMessage {\r\n    originalText: string;\r\n}\r\n\r\nconst parseSpeechResponse = (json: string): ISpeechResponsePayload => JSON.parse(json) as ISpeechResponsePayload;\r\nconst parseTextResponse = (json: string): ITextResponsePayload => JSON.parse(json) as ITextResponsePayload;\r\n\r\nexport class SpeechResponsePayload implements ISpeechResponsePayload {\r\n\r\n    private privSpeechResponse: ISpeechResponsePayload;\r\n\r\n    private constructor(json: string) {\r\n        this.privSpeechResponse = parseSpeechResponse(json);\r\n    }\r\n\r\n    public get recognition(): string {\r\n        return this.privSpeechResponse.recognition;\r\n    }\r\n\r\n    public get translations(): ITranslationResponsePayload[] {\r\n        return this.privSpeechResponse.translations;\r\n    }\r\n\r\n    public get id(): string {\r\n        return this.privSpeechResponse.id;\r\n    }\r\n\r\n    public get language(): string {\r\n        return this.privSpeechResponse.language;\r\n    }\r\n\r\n    public get nickname(): string {\r\n        return this.privSpeechResponse.nickname;\r\n    }\r\n\r\n    public get participantId(): string {\r\n        return this.privSpeechResponse.participantId;\r\n    }\r\n\r\n    public get roomid(): string {\r\n        return this.privSpeechResponse.roomid;\r\n    }\r\n\r\n    public get timestamp(): string {\r\n        return this.privSpeechResponse.timestamp;\r\n    }\r\n\r\n    public get type(): string {\r\n        return this.privSpeechResponse.type;\r\n    }\r\n\r\n    public get isFinal(): boolean {\r\n        return this.privSpeechResponse.type === \"final\";\r\n    }\r\n\r\n    public static fromJSON(json: string): SpeechResponsePayload {\r\n        return new SpeechResponsePayload(json);\r\n    }\r\n\r\n}\r\n\r\nexport class TextResponsePayload implements ITextResponsePayload {\r\n\r\n    private privTextResponse: ITextResponsePayload;\r\n\r\n    private constructor(json: string) {\r\n        this.privTextResponse = parseTextResponse(json);\r\n    }\r\n\r\n    public get originalText(): string {\r\n        return this.privTextResponse.originalText;\r\n    }\r\n\r\n    public get translations(): ITranslationResponsePayload[] {\r\n        return this.privTextResponse.translations;\r\n    }\r\n\r\n    public get id(): string {\r\n        return this.privTextResponse.id;\r\n    }\r\n\r\n    public get language(): string {\r\n        return this.privTextResponse.language;\r\n    }\r\n\r\n    public get nickname(): string {\r\n        return this.privTextResponse.nickname;\r\n    }\r\n\r\n    public get participantId(): string {\r\n        return this.privTextResponse.participantId;\r\n    }\r\n\r\n    public get roomid(): string {\r\n        return this.privTextResponse.roomid;\r\n    }\r\n\r\n    public get timestamp(): string {\r\n        return this.privTextResponse.timestamp;\r\n    }\r\n\r\n    public get type(): string {\r\n        return this.privTextResponse.type;\r\n    }\r\n\r\n    public static fromJSON(json: string): TextResponsePayload {\r\n        return new TextResponsePayload(json);\r\n    }\r\n\r\n}\r\n","export { CommandResponsePayload } from \"./CommandResponsePayload.js\";\r\nexport { IParticipantsListPayloadResponse, IParticipantPayloadResponse, ParticipantsListPayloadResponse, ParticipantPayloadResponse } from \"./ParticipantResponsePayload.js\";\r\nexport { ITranslationResponsePayload, SpeechResponsePayload, TextResponsePayload } from \"./TranslationResponsePayload.js\";\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ConnectionState,\r\n    createNoDashGuid,\r\n    Deferred,\r\n    IAudioSource,\r\n    IConnection,\r\n    MessageType,\r\n} from \"../../common/Exports.js\";\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    ConversationExpirationEventArgs,\r\n    ConversationTranslationCanceledEventArgs,\r\n    ConversationTranslationResult,\r\n    ResultReason,\r\n    Translations\r\n} from \"../../sdk/Exports.js\";\r\nimport {\r\n    CognitiveTokenAuthentication,\r\n    IAuthentication,\r\n    IConnectionFactory,\r\n    RecognizerConfig,\r\n    ServiceRecognizerBase\r\n} from \"../Exports.js\";\r\nimport { ConversationConnectionMessage } from \"./ConversationConnectionMessage.js\";\r\nimport { ConversationRequestSession } from \"./ConversationRequestSession.js\";\r\nimport {\r\n    ConversationReceivedTranslationEventArgs,\r\n    LockRoomEventArgs,\r\n    MuteAllEventArgs,\r\n    ParticipantAttributeEventArgs,\r\n    ParticipantEventArgs,\r\n    ParticipantsListEventArgs\r\n} from \"./ConversationTranslatorEventArgs.js\";\r\nimport {\r\n    ConversationTranslatorCommandTypes,\r\n    ConversationTranslatorMessageTypes,\r\n    IInternalParticipant\r\n} from \"./ConversationTranslatorInterfaces.js\";\r\nimport { ConversationTranslatorRecognizer } from \"./ConversationTranslatorRecognizer.js\";\r\nimport {\r\n    CommandResponsePayload,\r\n    IParticipantPayloadResponse,\r\n    IParticipantsListPayloadResponse,\r\n    ITranslationResponsePayload,\r\n    ParticipantPayloadResponse,\r\n    ParticipantsListPayloadResponse,\r\n    SpeechResponsePayload,\r\n    TextResponsePayload\r\n} from \"./ServiceMessages/Exports.js\";\r\n\r\n/**\r\n * The service adapter handles sending and receiving messages to the Conversation Translator websocket.\r\n */\r\nexport class ConversationServiceAdapter extends ServiceRecognizerBase {\r\n    private privConversationServiceConnector: ConversationTranslatorRecognizer;\r\n    private privConversationConnectionFactory: IConnectionFactory;\r\n    private privConversationAuthFetchEventId: string;\r\n    private privConversationAuthentication: IAuthentication;\r\n    private privConversationRequestSession: ConversationRequestSession;\r\n    private privConnectionConfigPromise: Promise<IConnection> = undefined;\r\n    private privConnectionLoop: Promise<void>;\r\n    private terminateMessageLoop: boolean;\r\n    private privLastPartialUtteranceId: string;\r\n    private privConversationIsDisposed: boolean;\r\n\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioSource: IAudioSource,\r\n        recognizerConfig: RecognizerConfig,\r\n        conversationServiceConnector: ConversationTranslatorRecognizer) {\r\n\r\n        super(authentication, connectionFactory, audioSource, recognizerConfig, conversationServiceConnector);\r\n\r\n        this.privLastPartialUtteranceId = \"\";\r\n        this.privConversationServiceConnector = conversationServiceConnector;\r\n        this.privConversationAuthentication = authentication;\r\n        this.receiveMessageOverride = (): Promise<void> => this.receiveConversationMessageOverride();\r\n        this.recognizeOverride = (): Promise<void> => this.noOp();\r\n        this.postConnectImplOverride = (connection: Promise<IConnection>): Promise<IConnection> => this.conversationConnectImpl(connection);\r\n        this.configConnectionOverride = (): Promise<IConnection> => this.configConnection();\r\n        this.disconnectOverride = (): Promise<void> => this.privDisconnect();\r\n        this.privConversationRequestSession = new ConversationRequestSession(createNoDashGuid());\r\n        this.privConversationConnectionFactory = connectionFactory;\r\n        this.privConversationIsDisposed = false;\r\n    }\r\n\r\n    public isDisposed(): boolean {\r\n        return super.isDisposed() || this.privConversationIsDisposed;\r\n    }\r\n\r\n    public async dispose(reason?: string): Promise<void> {\r\n        this.privConversationIsDisposed = true;\r\n        if (this.privConnectionConfigPromise !== undefined) {\r\n            const connection: IConnection = await this.privConnectionConfigPromise;\r\n            await connection.dispose(reason);\r\n        }\r\n        await super.dispose(reason);\r\n    }\r\n\r\n    public async sendMessage(message: string): Promise<void> {\r\n        const connection: IConnection = await this.fetchConnection();\r\n        return connection.send(new ConversationConnectionMessage(\r\n            MessageType.Text,\r\n            message));\r\n    }\r\n\r\n    public async sendMessageAsync(message: string): Promise<void> {\r\n        const connection: IConnection = await this.fetchConnection();\r\n\r\n        await connection.send(new ConversationConnectionMessage(MessageType.Text, message));\r\n    }\r\n\r\n    protected privDisconnect(): Promise<void> {\r\n        if (this.terminateMessageLoop) {\r\n            return;\r\n        }\r\n        this.cancelRecognition(this.privConversationRequestSession.sessionId,\r\n            this.privConversationRequestSession.requestId,\r\n            CancellationReason.Error,\r\n            CancellationErrorCode.NoError,\r\n            \"Disconnecting\");\r\n\r\n        this.terminateMessageLoop = true;\r\n        return Promise.resolve();\r\n    }\r\n\r\n    // eslint-disable-next-line @typescript-eslint/require-await\r\n    protected async processTypeSpecificMessages(): Promise<boolean> {\r\n        return true;\r\n    }\r\n\r\n    // Cancels recognition.\r\n    protected cancelRecognition(\r\n        sessionId: string,\r\n        requestId: string,\r\n        cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): void {\r\n\r\n        this.terminateMessageLoop = true;\r\n\r\n        const cancelEvent: ConversationTranslationCanceledEventArgs = new ConversationTranslationCanceledEventArgs(\r\n            cancellationReason,\r\n            error,\r\n            errorCode,\r\n            undefined,\r\n            sessionId);\r\n\r\n        try {\r\n            if (!!this.privConversationServiceConnector.canceled) {\r\n                this.privConversationServiceConnector.canceled(this.privConversationServiceConnector, cancelEvent);\r\n            }\r\n        } catch {\r\n            // continue on error\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Establishes a websocket connection to the end point.\r\n     */\r\n    protected async conversationConnectImpl(connection: Promise<IConnection>): Promise<IConnection> {\r\n        this.privConnectionLoop = this.startMessageLoop();\r\n        return connection;\r\n    }\r\n\r\n    /**\r\n     * Process incoming websocket messages\r\n     */\r\n    private async receiveConversationMessageOverride(): Promise<void> {\r\n        if (this.isDisposed() || this.terminateMessageLoop) {\r\n            return Promise.resolve();\r\n        }\r\n        // we won't rely on the cascading promises of the connection since we want to continually be available to receive messages\r\n        const communicationCustodian: Deferred<void> = new Deferred<void>();\r\n\r\n        try {\r\n            const connection: IConnection = await this.fetchConnection();\r\n            const message: ConversationConnectionMessage = await connection.read() as ConversationConnectionMessage;\r\n            if (this.isDisposed() || this.terminateMessageLoop) {\r\n                // We're done.\r\n                communicationCustodian.resolve();\r\n                return Promise.resolve();\r\n            }\r\n\r\n            if (!message) {\r\n                return this.receiveConversationMessageOverride();\r\n            }\r\n\r\n            const sessionId: string = this.privConversationRequestSession.sessionId;\r\n            const conversationMessageType: string = message.conversationMessageType.toLowerCase();\r\n            let sendFinal: boolean = false;\r\n\r\n            try {\r\n                switch (conversationMessageType) {\r\n                    case \"info\":\r\n                    case \"participant_command\":\r\n                    case \"command\":\r\n                        const commandPayload: CommandResponsePayload = CommandResponsePayload.fromJSON(message.textBody);\r\n                        switch (commandPayload.command.toLowerCase()) {\r\n\r\n                            /**\r\n                             * 'ParticpantList' is the first message sent to the user after the websocket connection has opened.\r\n                             * The consuming client must wait for this message to arrive\r\n                             * before starting to send their own data.\r\n                             */\r\n                            case \"participantlist\":\r\n\r\n                                const participantsPayload: IParticipantsListPayloadResponse = ParticipantsListPayloadResponse.fromJSON(message.textBody);\r\n\r\n                                const participantsResult: IInternalParticipant[] = participantsPayload.participants.map((p: IParticipantPayloadResponse): IInternalParticipant => {\r\n                                    const participant: IInternalParticipant = {\r\n                                        avatar: p.avatar,\r\n                                        displayName: p.nickname,\r\n                                        id: p.participantId,\r\n                                        isHost: p.ishost,\r\n                                        isMuted: p.ismuted,\r\n                                        isUsingTts: p.usetts,\r\n                                        preferredLanguage: p.locale\r\n                                    };\r\n                                    return participant;\r\n                                });\r\n\r\n                                if (!!this.privConversationServiceConnector.participantsListReceived) {\r\n                                    this.privConversationServiceConnector.participantsListReceived(this.privConversationServiceConnector,\r\n                                        new ParticipantsListEventArgs(participantsPayload.roomid, participantsPayload.token,\r\n                                            participantsPayload.translateTo, participantsPayload.profanityFilter,\r\n                                            participantsPayload.roomProfanityFilter, participantsPayload.roomLocked,\r\n                                            participantsPayload.muteAll, participantsResult, sessionId));\r\n                                }\r\n                                break;\r\n\r\n                            /**\r\n                             * 'SetTranslateToLanguages' represents the list of languages being used in the Conversation by all users(?).\r\n                             * This is sent at the start of the Conversation\r\n                             */\r\n                            case \"settranslatetolanguages\":\r\n\r\n                                if (!!this.privConversationServiceConnector.participantUpdateCommandReceived) {\r\n                                    this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,\r\n                                        new ParticipantAttributeEventArgs(commandPayload.participantId,\r\n                                            ConversationTranslatorCommandTypes.setTranslateToLanguages,\r\n                                            commandPayload.value, sessionId));\r\n                                }\r\n\r\n                                break;\r\n\r\n                            /**\r\n                             * 'SetProfanityFiltering' lets the client set the level of profanity filtering.\r\n                             * If sent by the participant the setting will effect only their own profanity level.\r\n                             * If sent by the host, the setting will effect all participants including the host.\r\n                             * Note: the profanity filters differ from Speech Service (?): 'marked', 'raw', 'removed', 'tagged'\r\n                             */\r\n                            case \"setprofanityfiltering\":\r\n\r\n                                if (!!this.privConversationServiceConnector.participantUpdateCommandReceived) {\r\n                                    this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,\r\n                                        new ParticipantAttributeEventArgs(commandPayload.participantId,\r\n                                            ConversationTranslatorCommandTypes.setProfanityFiltering,\r\n                                            commandPayload.value, sessionId));\r\n                                }\r\n\r\n                                break;\r\n\r\n                            /**\r\n                             * 'SetMute' is sent if the participant has been muted by the host.\r\n                             * Check the 'participantId' to determine if the current user has been muted.\r\n                             */\r\n                            case \"setmute\":\r\n\r\n                                if (!!this.privConversationServiceConnector.participantUpdateCommandReceived) {\r\n                                    this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,\r\n                                        new ParticipantAttributeEventArgs(commandPayload.participantId,\r\n                                            ConversationTranslatorCommandTypes.setMute,\r\n                                            commandPayload.value, sessionId));\r\n                                }\r\n\r\n                                break;\r\n\r\n                            /**\r\n                             * 'SetMuteAll' is sent if the Conversation has been muted by the host.\r\n                             */\r\n                            case \"setmuteall\":\r\n\r\n                                if (!!this.privConversationServiceConnector.muteAllCommandReceived) {\r\n                                    this.privConversationServiceConnector.muteAllCommandReceived(this.privConversationServiceConnector,\r\n                                        new MuteAllEventArgs(commandPayload.value as boolean, sessionId));\r\n                                }\r\n\r\n                                break;\r\n\r\n                            /**\r\n                             * 'RoomExpirationWarning' is sent towards the end of the Conversation session to give a timeout warning.\r\n                             */\r\n                            case \"roomexpirationwarning\":\r\n\r\n                                if (!!this.privConversationServiceConnector.conversationExpiration) {\r\n                                    this.privConversationServiceConnector.conversationExpiration(this.privConversationServiceConnector,\r\n                                        new ConversationExpirationEventArgs(commandPayload.value as number, this.privConversationRequestSession.sessionId));\r\n                                }\r\n\r\n                                break;\r\n\r\n                            /**\r\n                             * 'SetUseTts' is sent as a confirmation if the user requests TTS to be turned on or off.\r\n                             */\r\n                            case \"setusetts\":\r\n\r\n                                if (!!this.privConversationServiceConnector.participantUpdateCommandReceived) {\r\n                                    this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,\r\n                                        new ParticipantAttributeEventArgs(commandPayload.participantId,\r\n                                            ConversationTranslatorCommandTypes.setUseTTS,\r\n                                            commandPayload.value, sessionId));\r\n                                }\r\n\r\n                                break;\r\n\r\n                            /**\r\n                             * 'SetLockState' is set if the host has locked or unlocked the Conversation.\r\n                             */\r\n                            case \"setlockstate\":\r\n\r\n                                if (!!this.privConversationServiceConnector.lockRoomCommandReceived) {\r\n                                    this.privConversationServiceConnector.lockRoomCommandReceived(this.privConversationServiceConnector,\r\n                                        new LockRoomEventArgs(commandPayload.value as boolean, sessionId));\r\n                                }\r\n\r\n                                break;\r\n\r\n                            /**\r\n                             * 'ChangeNickname' is received if a user changes their display name.\r\n                             * Any cached particpiants list should be updated to reflect the display name.\r\n                             */\r\n                            case \"changenickname\":\r\n\r\n                                if (!!this.privConversationServiceConnector.participantUpdateCommandReceived) {\r\n                                    this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,\r\n                                        new ParticipantAttributeEventArgs(commandPayload.participantId,\r\n                                            ConversationTranslatorCommandTypes.changeNickname,\r\n                                            commandPayload.value, sessionId));\r\n                                }\r\n\r\n                                break;\r\n\r\n                            /**\r\n                             * 'JoinSession' is sent when a user joins the Conversation.\r\n                             */\r\n                            case \"joinsession\":\r\n\r\n                                const joinParticipantPayload: ParticipantPayloadResponse = ParticipantPayloadResponse.fromJSON(message.textBody);\r\n\r\n                                const joiningParticipant: IInternalParticipant = {\r\n                                    avatar: joinParticipantPayload.avatar,\r\n                                    displayName: joinParticipantPayload.nickname,\r\n                                    id: joinParticipantPayload.participantId,\r\n                                    isHost: joinParticipantPayload.ishost,\r\n                                    isMuted: joinParticipantPayload.ismuted,\r\n                                    isUsingTts: joinParticipantPayload.usetts,\r\n                                    preferredLanguage: joinParticipantPayload.locale,\r\n                                };\r\n\r\n                                if (!!this.privConversationServiceConnector.participantJoinCommandReceived) {\r\n                                    this.privConversationServiceConnector.participantJoinCommandReceived(this.privConversationServiceConnector,\r\n                                        new ParticipantEventArgs(\r\n                                            joiningParticipant,\r\n                                            sessionId));\r\n                                }\r\n\r\n                                break;\r\n\r\n                            /**\r\n                             * 'LeaveSession' is sent when a user leaves the Conversation'.\r\n                             */\r\n                            case \"leavesession\":\r\n\r\n                                const leavingParticipant: IInternalParticipant = {\r\n                                    id: commandPayload.participantId\r\n                                };\r\n\r\n                                if (!!this.privConversationServiceConnector.participantLeaveCommandReceived) {\r\n                                    this.privConversationServiceConnector.participantLeaveCommandReceived(this.privConversationServiceConnector,\r\n                                        new ParticipantEventArgs(leavingParticipant, sessionId));\r\n                                }\r\n\r\n                                break;\r\n\r\n                            /**\r\n                             * 'DisconnectSession' is sent when a user is disconnected from the session (e.g. network problem).\r\n                             * Check the 'ParticipantId' to check whether the message is for the current user.\r\n                             */\r\n                            case \"disconnectsession\":\r\n\r\n                                // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n                                const disconnectParticipant: IInternalParticipant = {\r\n                                    id: commandPayload.participantId\r\n                                };\r\n\r\n                                break;\r\n\r\n                            case \"token\":\r\n                                const token = new CognitiveTokenAuthentication(\r\n                                    (): Promise<string> => {\r\n                                        const authorizationToken = commandPayload.token;\r\n                                        return Promise.resolve(authorizationToken);\r\n                                    },\r\n                                    (): Promise<string> => {\r\n                                        const authorizationToken = commandPayload.token;\r\n                                        return Promise.resolve(authorizationToken);\r\n                                    });\r\n                                this.authentication = token;\r\n                                this.privConversationServiceConnector.onToken(token);\r\n\r\n                                break;\r\n\r\n                            /**\r\n                             * Message not recognized.\r\n                             */\r\n                            default:\r\n                                break;\r\n                        }\r\n                        break;\r\n\r\n                    /**\r\n                     * 'partial' (or 'hypothesis') represents a unfinalized speech message.\r\n                     */\r\n                    case \"partial\":\r\n\r\n                    /**\r\n                     * 'final' (or 'phrase') represents a finalized speech message.\r\n                     */\r\n                    case \"final\":\r\n\r\n                        const speechPayload: SpeechResponsePayload = SpeechResponsePayload.fromJSON(message.textBody);\r\n                        const conversationResultReason: ResultReason = (conversationMessageType === \"final\") ? ResultReason.TranslatedParticipantSpeech : ResultReason.TranslatingParticipantSpeech;\r\n\r\n                        const speechResult: ConversationTranslationResult = new ConversationTranslationResult(speechPayload.participantId,\r\n                            this.getTranslations(speechPayload.translations),\r\n                            speechPayload.language,\r\n                            speechPayload.id,\r\n                            conversationResultReason,\r\n                            speechPayload.recognition,\r\n                            undefined,\r\n                            undefined,\r\n                            message.textBody,\r\n                            undefined);\r\n\r\n                        if (speechPayload.isFinal) {\r\n                            // check the length, sometimes empty finals are returned\r\n                            if (speechResult.text !== undefined && speechResult.text.length > 0) {\r\n                                sendFinal = true;\r\n                            } else if (speechPayload.id === this.privLastPartialUtteranceId) {\r\n                                // send final as normal. We had a non-empty partial for this same utterance\r\n                                // so sending the empty final is important\r\n                                sendFinal = true;\r\n                            } else {\r\n                                // suppress unneeded final\r\n                            }\r\n\r\n                            if (sendFinal) {\r\n                                if (!!this.privConversationServiceConnector.translationReceived) {\r\n                                    this.privConversationServiceConnector.translationReceived(this.privConversationServiceConnector,\r\n                                        new ConversationReceivedTranslationEventArgs(ConversationTranslatorMessageTypes.final, speechResult, sessionId));\r\n                                }\r\n                            }\r\n                        } else if (speechResult.text !== undefined) {\r\n                            this.privLastPartialUtteranceId = speechPayload.id;\r\n                            if (!!this.privConversationServiceConnector.translationReceived) {\r\n                                this.privConversationServiceConnector.translationReceived(this.privConversationServiceConnector,\r\n                                    new ConversationReceivedTranslationEventArgs(ConversationTranslatorMessageTypes.partial, speechResult, sessionId));\r\n                            }\r\n                        }\r\n\r\n                        break;\r\n\r\n                    /**\r\n                     * \"translated_message\" is a text message or instant message (IM).\r\n                     */\r\n                    case \"translated_message\":\r\n\r\n                        const textPayload: TextResponsePayload = TextResponsePayload.fromJSON(message.textBody);\r\n                        // TODO: (Native parity) a result reason should be set based whether the participantId is ours or not\r\n\r\n                        const textResult: ConversationTranslationResult = new ConversationTranslationResult(textPayload.participantId,\r\n                            this.getTranslations(textPayload.translations),\r\n                            textPayload.language,\r\n                            undefined,\r\n                            undefined,\r\n                            textPayload.originalText,\r\n                            undefined,\r\n                            undefined,\r\n                            undefined,\r\n                            message.textBody,\r\n                            undefined);\r\n\r\n                        if (!!this.privConversationServiceConnector.translationReceived) {\r\n                            this.privConversationServiceConnector.translationReceived(this.privConversationServiceConnector,\r\n                                new ConversationReceivedTranslationEventArgs(ConversationTranslatorMessageTypes.instantMessage, textResult, sessionId));\r\n                        }\r\n                        break;\r\n\r\n                    default:\r\n                        // ignore any unsupported message types\r\n                        break;\r\n                }\r\n            } catch (e) {\r\n                // continue\r\n            }\r\n            return this.receiveConversationMessageOverride();\r\n        } catch (e) {\r\n            this.terminateMessageLoop = true;\r\n        }\r\n\r\n        return communicationCustodian.promise;\r\n    }\r\n\r\n    private async startMessageLoop(): Promise<void> {\r\n        if (this.isDisposed()) {\r\n            return Promise.resolve();\r\n        }\r\n        this.terminateMessageLoop = false;\r\n\r\n        const messageRetrievalPromise = this.receiveConversationMessageOverride();\r\n\r\n        try {\r\n            const r = await messageRetrievalPromise;\r\n            return r;\r\n        } catch (error) {\r\n            this.cancelRecognition(this.privRequestSession ? this.privRequestSession.sessionId : \"\", this.privRequestSession ? this.privRequestSession.requestId : \"\", CancellationReason.Error, CancellationErrorCode.RuntimeError, error as string);\r\n            return null;\r\n        }\r\n    }\r\n\r\n    // Takes an established websocket connection to the endpoint\r\n    private configConnection(): Promise<IConnection> {\r\n        if (this.isDisposed()) {\r\n            return Promise.resolve<IConnection>(undefined);\r\n        }\r\n        if (this.privConnectionConfigPromise !== undefined) {\r\n            return this.privConnectionConfigPromise.then((connection: IConnection): Promise<IConnection> => {\r\n                if (connection.state() === ConnectionState.Disconnected) {\r\n                    this.privConnectionId = null;\r\n                    this.privConnectionConfigPromise = undefined;\r\n                    return this.configConnection();\r\n                }\r\n                return this.privConnectionConfigPromise;\r\n            }, (): Promise<IConnection> => {\r\n                this.privConnectionId = null;\r\n                this.privConnectionConfigPromise = undefined;\r\n                return this.configConnection();\r\n            });\r\n        }\r\n        if (this.terminateMessageLoop) {\r\n            return Promise.resolve<IConnection>(undefined);\r\n        }\r\n\r\n        this.privConnectionConfigPromise = this.connectImpl().then((connection: IConnection): IConnection => connection);\r\n\r\n        return this.privConnectionConfigPromise;\r\n    }\r\n\r\n    private getTranslations(serviceResultTranslations: ITranslationResponsePayload[]): Translations {\r\n        let translations: Translations;\r\n\r\n        if (undefined !== serviceResultTranslations) {\r\n            translations = new Translations();\r\n            for (const translation of serviceResultTranslations) {\r\n                translations.set(translation.lang, translation.translation);\r\n            }\r\n        }\r\n\r\n        return translations;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n// eslint-disable-next-line max-classes-per-file\r\nimport {\r\n    IAuthentication,\r\n    IConnectionFactory,\r\n    RecognizerConfig,\r\n    ServiceRecognizerBase,\r\n    SpeechServiceConfig\r\n} from \"../../common.speech/Exports.js\";\r\nimport {\r\n    BackgroundEvent,\r\n    Events,\r\n    Timeout,\r\n} from \"../../common/Exports.js\";\r\nimport { AudioConfigImpl } from \"../../sdk/Audio/AudioConfig.js\";\r\nimport { Contracts } from \"../../sdk/Contracts.js\";\r\nimport {\r\n    AudioConfig,\r\n    Connection,\r\n    ConnectionEventArgs,\r\n    ConversationExpirationEventArgs,\r\n    ConversationParticipantsChangedEventArgs,\r\n    ConversationTranslationCanceledEventArgs,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    Recognizer,\r\n    SessionEventArgs,\r\n    SpeechTranslationConfig\r\n} from \"../../sdk/Exports.js\";\r\nimport { SpeechTranslationConfigImpl } from \"../../sdk/SpeechTranslationConfig.js\";\r\nimport { ConversationImpl } from \"../../sdk/Transcription/Conversation.js\";\r\nimport { Callback, IConversation } from \"../../sdk/Transcription/IConversation.js\";\r\nimport { ConversationConnectionFactory } from \"./ConversationConnectionFactory.js\";\r\nimport { ConversationServiceAdapter } from \"./ConversationServiceAdapter.js\";\r\nimport {\r\n    ConversationReceivedTranslationEventArgs,\r\n    LockRoomEventArgs,\r\n    MuteAllEventArgs,\r\n    ParticipantAttributeEventArgs,\r\n    ParticipantEventArgs,\r\n    ParticipantsListEventArgs\r\n} from \"./ConversationTranslatorEventArgs.js\";\r\nimport {\r\n    ConversationRecognizer,\r\n} from \"./ConversationTranslatorInterfaces.js\";\r\n\r\nexport class ConversationRecognizerFactory {\r\n    public static fromConfig(conversation: IConversation, speechConfig: SpeechTranslationConfig, audioConfig?: AudioConfig): ConversationRecognizer {\r\n        return new ConversationTranslatorRecognizer(conversation, speechConfig, audioConfig);\r\n    }\r\n}\r\n\r\n/**\r\n * Sends messages to the Conversation Translator websocket and listens for incoming events containing websocket messages.\r\n * Based off the recognizers in the SDK folder.\r\n */\r\nexport class ConversationTranslatorRecognizer extends Recognizer implements ConversationRecognizer {\r\n\r\n    private privIsDisposed: boolean;\r\n    private privSpeechRecognitionLanguage: string;\r\n    private privConnection: Connection;\r\n    private privConversation: ConversationImpl;\r\n    private privTimeoutToken: any;\r\n    private privSetTimeout: (cb: () => void, delay: number) => number;\r\n    private privClearTimeout: (id: number) => void;\r\n\r\n    public constructor(conversation: IConversation, speechConfig: SpeechTranslationConfig, audioConfig?: AudioConfig) {\r\n        const serviceConfigImpl = speechConfig as SpeechTranslationConfigImpl;\r\n        Contracts.throwIfNull(serviceConfigImpl, \"speechConfig\");\r\n        const conversationImpl = conversation as ConversationImpl;\r\n        Contracts.throwIfNull(conversationImpl, \"conversationImpl\");\r\n\r\n        super(audioConfig, serviceConfigImpl.properties, new ConversationConnectionFactory());\r\n\r\n        this.privConversation = conversationImpl;\r\n        this.privIsDisposed = false;\r\n        this.privProperties = serviceConfigImpl.properties.clone();\r\n        this.privConnection = Connection.fromRecognizer(this);\r\n        const webWorkerLoadType: string = this.privProperties.getProperty(PropertyId.WebWorkerLoadType, \"on\").toLowerCase();\r\n        if (webWorkerLoadType === \"on\" && typeof (Blob) !== \"undefined\" && typeof (Worker) !== \"undefined\") {\r\n            this.privSetTimeout = Timeout.setTimeout;\r\n            this.privClearTimeout = Timeout.clearTimeout;\r\n        } else {\r\n            if (typeof window !== \"undefined\") {\r\n                // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\r\n                this.privSetTimeout = window.setTimeout.bind(window);\r\n                // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\r\n                this.privClearTimeout = window.clearTimeout.bind(window);\r\n            } else {\r\n                this.privSetTimeout = setTimeout;\r\n                this.privClearTimeout = clearTimeout;\r\n            }\r\n        }\r\n    }\r\n\r\n    public canceled: (sender: ConversationRecognizer, event: ConversationTranslationCanceledEventArgs) => void;\r\n    public conversationExpiration: (sender: ConversationRecognizer, event: ConversationExpirationEventArgs) => void;\r\n    public lockRoomCommandReceived: (sender: ConversationRecognizer, event: LockRoomEventArgs) => void;\r\n    public muteAllCommandReceived: (sender: ConversationRecognizer, event: MuteAllEventArgs) => void;\r\n    public participantJoinCommandReceived: (sender: ConversationRecognizer, event: ParticipantEventArgs) => void;\r\n    public participantLeaveCommandReceived: (sender: ConversationRecognizer, event: ParticipantEventArgs) => void;\r\n    public participantUpdateCommandReceived: (sender: ConversationRecognizer, event: ParticipantAttributeEventArgs) => void;\r\n    public connectionOpened: (sender: ConversationRecognizer, event: SessionEventArgs) => void;\r\n    public connectionClosed: (sender: ConversationRecognizer, event: SessionEventArgs) => void;\r\n    public translationReceived: (sender: ConversationRecognizer, event: ConversationReceivedTranslationEventArgs) => void;\r\n    public participantsListReceived: (sender: ConversationRecognizer, event: ParticipantsListEventArgs) => void;\r\n    public participantsChanged: (sender: ConversationRecognizer, event: ConversationParticipantsChangedEventArgs) => void;\r\n\r\n    public set connected(cb: (e: ConnectionEventArgs) => void) {\r\n        this.privConnection.connected = cb;\r\n    }\r\n\r\n    public set disconnected(cb: (e: ConnectionEventArgs) => void) {\r\n        this.privConnection.disconnected = cb;\r\n    }\r\n\r\n    /**\r\n     * Return the speech language used by the recognizer\r\n     */\r\n    public get speechRecognitionLanguage(): string {\r\n        return this.privSpeechRecognitionLanguage;\r\n    }\r\n\r\n    /**\r\n     * Return the properties for the recognizer\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    public isDisposed(): boolean {\r\n        return this.privIsDisposed;\r\n    }\r\n\r\n    /**\r\n     * Connect to the recognizer\r\n     * @param token\r\n     */\r\n    public connect(token: string, cb?: () => void, err?: (e: string) => void): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfNullOrWhitespace(token, \"token\");\r\n            this.privReco.conversationTranslatorToken = token;\r\n            this.resetConversationTimeout();\r\n            this.privReco.connectAsync(cb, err);\r\n        } catch (error) {\r\n            if (!!err) {\r\n                if (error instanceof Error) {\r\n                    const typedError: Error = error;\r\n                    err(typedError.name + \": \" + typedError.message);\r\n                } else {\r\n                    err(error as string);\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Disconnect from the recognizer\r\n     */\r\n    public disconnect(cb?: () => void, err?: (e: string) => void): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            if (this.privTimeoutToken !== undefined) {\r\n               // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\r\n               this.privClearTimeout(this.privTimeoutToken);\r\n            }\r\n            this.privReco.disconnect().then((): void => {\r\n                if (!!cb) {\r\n                    cb();\r\n                }\r\n            }, (error: string): void => {\r\n                if (!!err) {\r\n                    err(error);\r\n                }\r\n            });\r\n        } catch (error) {\r\n            if (!!err) {\r\n                if (error instanceof Error) {\r\n                    const typedError: Error = error;\r\n                    err(typedError.name + \": \" + typedError.message);\r\n                } else {\r\n                    err(error as string);\r\n                }\r\n            }\r\n            // Destroy the recognizer.\r\n            this.dispose(true).catch((reason: string): void => {\r\n                Events.instance.onEvent(new BackgroundEvent(reason));\r\n            });\r\n\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Send the mute all participants command to the websocket\r\n     * @param conversationId\r\n     * @param participantId\r\n     * @param isMuted\r\n     */\r\n    public sendRequest(command: string, cb?: () => void, err?: (e: string) => void): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            this.sendMessage(command, cb, err);\r\n        } catch (error) {\r\n            if (!!err) {\r\n                if (error instanceof Error) {\r\n                    const typedError: Error = error;\r\n                    err(typedError.name + \": \" + typedError.message);\r\n                } else {\r\n                    err(error as string);\r\n                }\r\n            }\r\n\r\n            // Destroy the recognizer.\r\n            this.dispose(true).catch((reason: string): void => {\r\n                Events.instance.onEvent(new BackgroundEvent(reason));\r\n            });\r\n\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Handle update of service auth token (#694)\r\n     */\r\n    public onToken(token: IAuthentication): void {\r\n        this.privConversation.onToken(token);\r\n    }\r\n\r\n    /**\r\n     * Close and dispose the recognizer\r\n     */\r\n    public async close(): Promise<void> {\r\n        if (!this.privIsDisposed) {\r\n            if (!!this.privConnection) {\r\n                this.privConnection.closeConnection();\r\n                this.privConnection.close();\r\n            }\r\n            this.privConnection = undefined;\r\n            await this.dispose(true);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Dispose the recognizer\r\n     * @param disposing\r\n     */\r\n    protected async dispose(disposing: boolean): Promise<void> {\r\n        if (this.privIsDisposed) {\r\n            return;\r\n        }\r\n        if (disposing) {\r\n            if (this.privTimeoutToken !== undefined) {\r\n                // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\r\n                this.privClearTimeout(this.privTimeoutToken);\r\n            }\r\n            this.privIsDisposed = true;\r\n            if (!!this.privConnection) {\r\n                this.privConnection.closeConnection();\r\n                this.privConnection.close();\r\n                this.privConnection = undefined;\r\n            }\r\n            await super.dispose(disposing);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Create the config for the recognizer\r\n     * @param speechConfig\r\n     */\r\n    protected createRecognizerConfig(speechConfig: SpeechServiceConfig): RecognizerConfig {\r\n        return new RecognizerConfig(speechConfig, this.privProperties);\r\n    }\r\n\r\n    /**\r\n     * Create the service recognizer.\r\n     * The audio source is redundnant here but is required by the implementation.\r\n     * @param authentication\r\n     * @param connectionFactory\r\n     * @param audioConfig\r\n     * @param recognizerConfig\r\n     */\r\n    protected createServiceRecognizer(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioConfig: AudioConfig,\r\n        recognizerConfig: RecognizerConfig): ServiceRecognizerBase {\r\n\r\n        const audioSource: AudioConfigImpl = audioConfig as AudioConfigImpl;\r\n\r\n        return new ConversationServiceAdapter(authentication, connectionFactory, audioSource, recognizerConfig, this);\r\n    }\r\n\r\n    private sendMessage(msg: string, cb?: Callback, err?: Callback): void {\r\n        const withAsync = this.privReco as ConversationServiceAdapter;\r\n        const PromiseToEmptyCallback = <T>(promise: Promise<T>, cb?: Callback, err?: Callback): void => {\r\n            if (promise !== undefined) {\r\n                promise.then((): void => {\r\n                    try {\r\n                        if (!!cb) {\r\n                            cb();\r\n                        }\r\n                    } catch (e) {\r\n                        if (!!err) {\r\n                            err(`'Unhandled error on promise callback: ${e as string}'`);\r\n                        }\r\n                    }\r\n                }, (reason: any): void => {\r\n                    try {\r\n                        if (!!err) {\r\n                            err(reason);\r\n                        }\r\n                        // eslint-disable-next-line no-empty\r\n                    } catch (error) { }\r\n                });\r\n            } else {\r\n                if (!!err) {\r\n                    err(\"Null promise\");\r\n                }\r\n            }\r\n        };\r\n\r\n        PromiseToEmptyCallback(withAsync.sendMessageAsync(msg), cb, err);\r\n        this.resetConversationTimeout();\r\n    }\r\n\r\n    private resetConversationTimeout(): void {\r\n        if (this.privTimeoutToken !== undefined) {\r\n            // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\r\n            this.privClearTimeout(this.privTimeoutToken);\r\n        }\r\n\r\n        this.privTimeoutToken = this.privSetTimeout((): void => {\r\n            this.sendRequest(this.privConversation.getKeepAlive());\r\n        }, 60000);\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\nimport { marshalPromiseToCallbacks } from \"../../common/Exports.js\";\r\nimport { AudioConfigImpl } from \"../../sdk/Audio/AudioConfig.js\";\r\nimport { AudioStreamFormatImpl } from \"../../sdk/Audio/AudioStreamFormat.js\";\r\nimport { Contracts } from \"../../sdk/Contracts.js\";\r\nimport {\r\n    AudioConfig,\r\n    CancellationEventArgs,\r\n    Conversation,\r\n    ConversationInfo,\r\n    Meeting,\r\n    MeetingInfo,\r\n    MeetingTranscriber,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    Recognizer,\r\n    SessionEventArgs,\r\n    SpeechRecognitionEventArgs,\r\n    SpeechTranslationConfig,\r\n    SpeechTranslationConfigImpl,\r\n} from \"../../sdk/Exports.js\";\r\nimport {\r\n    IAuthentication,\r\n    IConnectionFactory,\r\n    RecognizerConfig,\r\n    ServiceRecognizerBase,\r\n    SpeechServiceConfig,\r\n    TranscriberConnectionFactory,\r\n    TranscriptionServiceRecognizer,\r\n} from \"../Exports.js\";\r\nimport { RecognitionMode } from \"../ServiceMessages/PhraseDetection/PhraseDetectionContext.js\";\r\n\r\nexport class TranscriberRecognizer extends Recognizer {\r\n\r\n    public recognizing: (sender: Recognizer, event: SpeechRecognitionEventArgs) => void;\r\n\r\n    public recognized: (sender: Recognizer, event: SpeechRecognitionEventArgs) => void;\r\n\r\n    public canceled: (sender: Recognizer, event: CancellationEventArgs) => void;\r\n\r\n    private privDisposedRecognizer: boolean;\r\n    private privConversation: Conversation;\r\n    private privMeeting: Meeting;\r\n    private isMeetingRecognizer: boolean;\r\n\r\n    /**\r\n     * TranscriberRecognizer constructor.\r\n     * @constructor\r\n     * @param {SpeechTranslationConfig} speechTranslationConfig - Non-audio configuration associated with the recognizer\r\n     * @param {AudioConfig} audioConfig - An audio configuration associated with the recognizer\r\n     */\r\n    public constructor(speechTranslationConfig: SpeechTranslationConfig, audioConfig: AudioConfig) {\r\n        const speechTranslationConfigImpl: SpeechTranslationConfigImpl = speechTranslationConfig as SpeechTranslationConfigImpl;\r\n        Contracts.throwIfNull(speechTranslationConfigImpl, \"speechTranslationConfig\");\r\n\r\n        const audioConfigImpl: AudioConfigImpl = audioConfig as AudioConfigImpl;\r\n        Contracts.throwIfNull(audioConfigImpl, \"audioConfigImpl\");\r\n\r\n        Contracts.throwIfNullOrWhitespace(\r\n            speechTranslationConfigImpl.speechRecognitionLanguage,\r\n            PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage]);\r\n\r\n        super(audioConfig, speechTranslationConfigImpl.properties, new TranscriberConnectionFactory());\r\n        this.privDisposedRecognizer = false;\r\n        this.isMeetingRecognizer = false;\r\n    }\r\n\r\n    public get speechRecognitionLanguage(): string {\r\n        Contracts.throwIfDisposed(this.privDisposedRecognizer);\r\n\r\n        return this.properties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage);\r\n    }\r\n\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    public get authorizationToken(): string {\r\n        return this.properties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n    }\r\n\r\n    public set authorizationToken(token: string) {\r\n        Contracts.throwIfNullOrWhitespace(token, \"token\");\r\n        this.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, token);\r\n    }\r\n\r\n    public set conversation(c: Conversation) {\r\n        Contracts.throwIfNullOrUndefined(c, \"Conversation\");\r\n        this.isMeetingRecognizer = false;\r\n        this.privConversation = c;\r\n    }\r\n\r\n    public getConversationInfo(): ConversationInfo {\r\n        Contracts.throwIfNullOrUndefined(this.privConversation, \"Conversation\");\r\n        return this.privConversation.conversationInfo;\r\n    }\r\n\r\n    public set meeting(m: Meeting) {\r\n        Contracts.throwIfNullOrUndefined(m, \"Meeting\");\r\n        this.isMeetingRecognizer = true;\r\n        this.privMeeting = m;\r\n    }\r\n\r\n    public getMeetingInfo(): MeetingInfo {\r\n        Contracts.throwIfNullOrUndefined(this.privMeeting, \"Meeting\");\r\n        return this.privMeeting.meetingInfo;\r\n    }\r\n\r\n    public IsMeetingRecognizer(): boolean {\r\n        return this.isMeetingRecognizer;\r\n    }\r\n\r\n    public startContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void): void {\r\n        marshalPromiseToCallbacks(this.startContinuousRecognitionAsyncImpl(RecognitionMode.Conversation), cb, err);\r\n    }\r\n\r\n    public stopContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void): void {\r\n        marshalPromiseToCallbacks(this.stopContinuousRecognitionAsyncImpl(), cb, err);\r\n    }\r\n\r\n    public async close(): Promise<void> {\r\n        if (!this.privDisposedRecognizer) {\r\n            await this.dispose(true);\r\n        }\r\n    }\r\n\r\n    // Push async join/leave conversation message via serviceRecognizer\r\n    public async pushConversationEvent(conversationInfo: ConversationInfo, command: string): Promise<void> {\r\n        const reco = (this.privReco) as TranscriptionServiceRecognizer;\r\n        Contracts.throwIfNullOrUndefined(reco, \"serviceRecognizer\");\r\n        await reco.sendSpeechEventAsync(conversationInfo, command);\r\n    }\r\n\r\n    // Push async join/leave meeting message via serviceRecognizer\r\n    public async pushMeetingEvent(meetingInfo: MeetingInfo, command: string): Promise<void> {\r\n        const reco = (this.privReco) as TranscriptionServiceRecognizer;\r\n        Contracts.throwIfNullOrUndefined(reco, \"serviceRecognizer\");\r\n        await reco.sendMeetingSpeechEventAsync(meetingInfo, command);\r\n    }\r\n\r\n    public async enforceAudioGating(): Promise<void> {\r\n        const audioConfigImpl = this.audioConfig as AudioConfigImpl;\r\n        const format: AudioStreamFormatImpl = await audioConfigImpl.format;\r\n        const channels = format.channels;\r\n        if (channels === 1) {\r\n            if (this.properties.getProperty(\"f0f5debc-f8c9-4892-ac4b-90a7ab359fd2\", \"false\").toLowerCase() !== \"true\") {\r\n                throw new Error(\"Single channel audio configuration for MeetingTranscriber is currently under private preview, please contact diarizationrequest@microsoft.com for more details\");\r\n            }\r\n        } else if (channels !== 8) {\r\n            throw new Error(`Unsupported audio configuration: Detected ${channels}-channel audio`);\r\n        }\r\n        return;\r\n    }\r\n\r\n    public connectMeetingCallbacks(transcriber: MeetingTranscriber): void {\r\n        this.isMeetingRecognizer = true;\r\n        this.canceled = (s: any, e: CancellationEventArgs): void => {\r\n            if (!!transcriber.canceled) {\r\n                transcriber.canceled(transcriber, e);\r\n            }\r\n        };\r\n        this.recognizing = (s: any, e: SpeechRecognitionEventArgs): void => {\r\n            if (!!transcriber.transcribing) {\r\n                transcriber.transcribing(transcriber, e);\r\n            }\r\n        };\r\n        this.recognized = (s: any, e: SpeechRecognitionEventArgs): void => {\r\n            if (!!transcriber.transcribed) {\r\n                transcriber.transcribed(transcriber, e);\r\n            }\r\n        };\r\n        this.sessionStarted = (s: any, e: SessionEventArgs): void => {\r\n            if (!!transcriber.sessionStarted) {\r\n                transcriber.sessionStarted(transcriber, e);\r\n            }\r\n        };\r\n        this.sessionStopped = (s: any, e: SessionEventArgs): void => {\r\n            if (!!transcriber.sessionStopped) {\r\n                transcriber.sessionStopped(transcriber, e);\r\n            }\r\n        };\r\n    }\r\n\r\n    public disconnectCallbacks(): void {\r\n        this.canceled = undefined;\r\n        this.recognizing = undefined;\r\n        this.recognized = undefined;\r\n        this.sessionStarted = undefined;\r\n        this.sessionStopped = undefined;\r\n    }\r\n\r\n    /**\r\n     * Disposes any resources held by the object.\r\n     * @member ConversationTranscriber.prototype.dispose\r\n     * @function\r\n     * @public\r\n     * @param {boolean} disposing - true if disposing the object.\r\n     */\r\n    protected async dispose(disposing: boolean): Promise<void> {\r\n        if (this.privDisposedRecognizer) {\r\n            return;\r\n        }\r\n\r\n        if (disposing) {\r\n            this.privDisposedRecognizer = true;\r\n            await this.implRecognizerStop();\r\n        }\r\n\r\n        await super.dispose(disposing);\r\n    }\r\n\r\n    protected createRecognizerConfig(speechConfig: SpeechServiceConfig): RecognizerConfig {\r\n        return new RecognizerConfig(\r\n            speechConfig,\r\n            this.properties);\r\n    }\r\n\r\n    protected createServiceRecognizer(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioConfig: AudioConfig,\r\n        recognizerConfig: RecognizerConfig): ServiceRecognizerBase {\r\n        const configImpl: AudioConfigImpl = audioConfig as AudioConfigImpl;\r\n        return new TranscriptionServiceRecognizer(authentication, connectionFactory, configImpl, recognizerConfig, this);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport { ConversationManager } from \"./ConversationManager.js\";\r\nexport { ConversationConnectionConfig } from \"./ConversationConnectionConfig.js\";\r\nexport { ConversationRecognizerFactory } from \"./ConversationTranslatorRecognizer.js\";\r\nexport { TranscriberRecognizer } from \"./TranscriberRecognizer.js\";\r\nexport {\r\n    ConversationReceivedTranslationEventArgs,\r\n    LockRoomEventArgs,\r\n    MuteAllEventArgs,\r\n    ParticipantAttributeEventArgs,\r\n    ParticipantEventArgs,\r\n    ParticipantsListEventArgs } from \"./ConversationTranslatorEventArgs.js\";\r\nexport {\r\n    ConversationRecognizer,\r\n    ConversationTranslatorCommandTypes,\r\n    ConversationTranslatorMessageTypes,\r\n    IInternalConversation,\r\n    IInternalParticipant,\r\n    InternalParticipants} from \"./ConversationTranslatorInterfaces.js\";\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { SpeechSynthesisBoundaryType } from \"../../sdk/Exports.js\";\r\n\r\nexport enum MetadataType {\r\n    WordBoundary = \"WordBoundary\",\r\n    Bookmark = \"Bookmark\",\r\n    Viseme = \"Viseme\",\r\n    SentenceBoundary = \"SentenceBoundary\",\r\n    SessionEnd = \"SessionEnd\",\r\n    AvatarSignal = \"TalkingAvatarSignal\",\r\n}\r\n\r\nexport interface ISynthesisMetadata {\r\n    Type: MetadataType;\r\n    Data: {\r\n        Offset: number;\r\n        Duration: number;\r\n        text: {\r\n            Text: string;\r\n            Length: number;\r\n            BoundaryType: SpeechSynthesisBoundaryType;\r\n        };\r\n        Bookmark: string;\r\n        VisemeId: number;\r\n        AnimationChunk: string;\r\n        IsLastAnimation: boolean;\r\n        Name: string;\r\n    };\r\n}\r\n\r\n// audio.metadata\r\nexport interface ISynthesisAudioMetadata {\r\n    Metadata: ISynthesisMetadata[];\r\n}\r\n\r\nexport class SynthesisAudioMetadata implements ISynthesisAudioMetadata {\r\n    private privSynthesisAudioMetadata: ISynthesisAudioMetadata;\r\n\r\n    private constructor(json: string) {\r\n        this.privSynthesisAudioMetadata = JSON.parse(json) as ISynthesisAudioMetadata;\r\n    }\r\n\r\n    public static fromJSON(json: string): SynthesisAudioMetadata {\r\n        return new SynthesisAudioMetadata(json);\r\n    }\r\n\r\n    public get Metadata(): ISynthesisMetadata[] {\r\n        return this.privSynthesisAudioMetadata.Metadata;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport { EventType, PlatformEvent } from \"../common/Exports.js\";\r\n\r\nexport class SpeechSynthesisEvent extends PlatformEvent {\r\n    private privRequestId: string;\r\n\r\n    public constructor(eventName: string, requestId: string, eventType: EventType = EventType.Info) {\r\n        super(eventName, eventType);\r\n\r\n        this.privRequestId = requestId;\r\n    }\r\n\r\n    public get requestId(): string {\r\n        return this.privRequestId;\r\n    }\r\n}\r\n\r\nexport class SynthesisTriggeredEvent extends SpeechSynthesisEvent {\r\n    private privSessionAudioDestinationId: string;\r\n    private privTurnAudioDestinationId: string;\r\n\r\n    public constructor(requestId: string, sessionAudioDestinationId: string, turnAudioDestinationId: string) {\r\n        super(\"SynthesisTriggeredEvent\", requestId);\r\n\r\n        this.privSessionAudioDestinationId = sessionAudioDestinationId;\r\n        this.privTurnAudioDestinationId = turnAudioDestinationId;\r\n    }\r\n\r\n    public get audioSessionDestinationId(): string {\r\n        return this.privSessionAudioDestinationId;\r\n    }\r\n\r\n    public get audioTurnDestinationId(): string {\r\n        return this.privTurnAudioDestinationId;\r\n    }\r\n}\r\n\r\nexport class ConnectingToSynthesisServiceEvent extends SpeechSynthesisEvent {\r\n    private privAuthFetchEventId: string;\r\n\r\n    public constructor(requestId: string, authFetchEventId: string) {\r\n        super(\"ConnectingToSynthesisServiceEvent\", requestId);\r\n        this.privAuthFetchEventId = authFetchEventId;\r\n    }\r\n\r\n    public get authFetchEventId(): string {\r\n        return this.privAuthFetchEventId;\r\n    }\r\n}\r\n\r\nexport class SynthesisStartedEvent extends SpeechSynthesisEvent {\r\n    private privAuthFetchEventId: string;\r\n\r\n    public constructor(requestId: string, authFetchEventId: string) {\r\n        super(\"SynthesisStartedEvent\", requestId);\r\n\r\n        this.privAuthFetchEventId = authFetchEventId;\r\n    }\r\n\r\n    public get authFetchEventId(): string {\r\n        return this.privAuthFetchEventId;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    createNoDashGuid,\r\n    Deferred,\r\n    Events,\r\n    IAudioDestination\r\n} from \"../common/Exports.js\";\r\nimport { AudioOutputFormatImpl } from \"../sdk/Audio/AudioOutputFormat.js\";\r\nimport { PullAudioOutputStreamImpl } from \"../sdk/Audio/AudioOutputStream.js\";\r\nimport {\r\n    PropertyCollection,\r\n    PropertyId,\r\n    ResultReason,\r\n    SpeechSynthesisResult,\r\n} from \"../sdk/Exports.js\";\r\nimport { ISynthesisMetadata, MetadataType } from \"./ServiceMessages/SynthesisAudioMetadata.js\";\r\nimport {\r\n    ConnectingToSynthesisServiceEvent,\r\n    SpeechSynthesisEvent,\r\n    SynthesisStartedEvent,\r\n    SynthesisTriggeredEvent,\r\n} from \"./SynthesisEvents.js\";\r\n\r\nexport interface ISynthesisResponseContext {\r\n    serviceTag: string;\r\n}\r\n\r\nexport interface ISynthesisResponseAudio {\r\n    type: string;\r\n    streamId: string;\r\n}\r\n\r\nexport interface ISynthesisResponse {\r\n    context: ISynthesisResponseContext;\r\n    audio: ISynthesisResponseAudio;\r\n    webrtc: {\r\n        connectionString: string;\r\n    };\r\n}\r\n\r\nexport class SynthesisTurn {\r\n\r\n    public get requestId(): string {\r\n        return this.privRequestId;\r\n    }\r\n\r\n    public get streamId(): string {\r\n        return this.privStreamId;\r\n    }\r\n\r\n    public set streamId(value: string) {\r\n        this.privStreamId = value;\r\n    }\r\n\r\n    public get audioOutputFormat(): AudioOutputFormatImpl {\r\n        return this.privAudioOutputFormat;\r\n    }\r\n\r\n    public set audioOutputFormat(format: AudioOutputFormatImpl) {\r\n        this.privAudioOutputFormat = format;\r\n    }\r\n\r\n    public get turnCompletionPromise(): Promise<void> {\r\n        return this.privTurnDeferral.promise;\r\n    }\r\n\r\n    public get isSynthesisEnded(): boolean {\r\n        return this.privIsSynthesisEnded;\r\n    }\r\n\r\n    public get isSynthesizing(): boolean {\r\n        return this.privIsSynthesizing;\r\n    }\r\n\r\n    public get currentTextOffset(): number {\r\n        return this.privTextOffset;\r\n    }\r\n\r\n    public get currentSentenceOffset(): number {\r\n        return this.privSentenceOffset;\r\n    }\r\n\r\n    // The number of bytes received for current turn\r\n    public get bytesReceived(): number {\r\n        return this.privBytesReceived;\r\n    }\r\n\r\n    public get audioDuration(): number {\r\n        return this.privAudioDuration;\r\n    }\r\n\r\n    public get extraProperties(): PropertyCollection {\r\n        if (!!this.privWebRTCSDP) {\r\n            const properties = new PropertyCollection();\r\n            properties.setProperty(PropertyId.TalkingAvatarService_WebRTC_SDP, this.privWebRTCSDP);\r\n            return properties;\r\n        }\r\n\r\n        return undefined;\r\n    }\r\n\r\n    private privIsDisposed: boolean = false;\r\n    private privAuthFetchEventId: string;\r\n    private privIsSynthesizing: boolean = false;\r\n    private privIsSynthesisEnded: boolean = false;\r\n    private privBytesReceived: number = 0;\r\n    private privRequestId: string;\r\n    private privStreamId: string;\r\n    private privTurnDeferral: Deferred<void>;\r\n    private privInTurn: boolean = false;\r\n    private privAudioOutputFormat: AudioOutputFormatImpl;\r\n    private privAudioOutputStream: PullAudioOutputStreamImpl;\r\n    private privReceivedAudio: ArrayBuffer;\r\n    private privReceivedAudioWithHeader: ArrayBuffer;\r\n    private privTextOffset: number = 0;\r\n    private privNextSearchTextIndex: number = 0;\r\n    private privSentenceOffset: number = 0;\r\n    private privNextSearchSentenceIndex: number = 0;\r\n    private privPartialVisemeAnimation: string;\r\n    private privRawText: string;\r\n    private privIsSSML: boolean;\r\n    private privTurnAudioDestination: IAudioDestination;\r\n    private privAudioDuration: number;\r\n    private privWebRTCSDP: string;\r\n\r\n    // Latency tracking\r\n    private privSynthesisStartTime: number = 0;\r\n    private privConnectionLatency: number = -1;\r\n    private privNetworkLatency: number = -1;\r\n    private privFirstByteLatency: number = -1;\r\n    private privServiceLatency: number = -1;\r\n\r\n    public constructor() {\r\n        this.privRequestId = createNoDashGuid();\r\n        this.privTurnDeferral = new Deferred<void>();\r\n\r\n        // We're not in a turn, so resolve.\r\n        this.privTurnDeferral.resolve();\r\n    }\r\n\r\n    public async getAllReceivedAudio(): Promise<ArrayBuffer> {\r\n        if (!!this.privReceivedAudio) {\r\n            return Promise.resolve(this.privReceivedAudio);\r\n        }\r\n        if (!this.privIsSynthesisEnded) {\r\n            return null;\r\n        }\r\n        await this.readAllAudioFromStream();\r\n        return Promise.resolve(this.privReceivedAudio);\r\n    }\r\n\r\n    public async getAllReceivedAudioWithHeader(): Promise<ArrayBuffer> {\r\n        if (!!this.privReceivedAudioWithHeader) {\r\n            return this.privReceivedAudioWithHeader;\r\n        }\r\n        if (!this.privIsSynthesisEnded) {\r\n            return null;\r\n        }\r\n        if (this.audioOutputFormat.hasHeader) {\r\n            const audio: ArrayBuffer = await this.getAllReceivedAudio();\r\n            this.privReceivedAudioWithHeader = this.audioOutputFormat.addHeader(audio);\r\n            return this.privReceivedAudioWithHeader;\r\n        } else {\r\n            return this.getAllReceivedAudio();\r\n        }\r\n    }\r\n\r\n    public startNewSynthesis(requestId: string, rawText: string, isSSML: boolean, audioDestination?: IAudioDestination): void {\r\n        this.privIsSynthesisEnded = false;\r\n        this.privIsSynthesizing = true;\r\n        this.privRequestId = requestId;\r\n        this.privRawText = rawText;\r\n        this.privIsSSML = isSSML;\r\n        this.privAudioOutputStream = new PullAudioOutputStreamImpl();\r\n        this.privAudioOutputStream.format = this.privAudioOutputFormat;\r\n        this.privReceivedAudio = null;\r\n        this.privReceivedAudioWithHeader = null;\r\n        this.privBytesReceived = 0;\r\n        this.privTextOffset = 0;\r\n        this.privNextSearchTextIndex = 0;\r\n        this.privSentenceOffset = 0;\r\n        this.privNextSearchSentenceIndex = 0;\r\n        this.privPartialVisemeAnimation = \"\";\r\n        this.privWebRTCSDP = \"\";\r\n        // Reset latency tracking for this synthesis request\r\n        this.privSynthesisStartTime = Date.now();\r\n        this.privConnectionLatency = -1;\r\n        this.privNetworkLatency = -1;\r\n        this.privFirstByteLatency = -1;\r\n        this.privServiceLatency = -1;\r\n        if (audioDestination !== undefined) {\r\n            this.privTurnAudioDestination = audioDestination;\r\n            this.privTurnAudioDestination.format = this.privAudioOutputFormat;\r\n        }\r\n        this.onEvent(new SynthesisTriggeredEvent(this.requestId, undefined, audioDestination === undefined ? undefined : audioDestination.id()));\r\n    }\r\n\r\n    public onPreConnectionStart(authFetchEventId: string): void {\r\n        this.privAuthFetchEventId = authFetchEventId;\r\n        this.onEvent(new ConnectingToSynthesisServiceEvent(this.privRequestId, this.privAuthFetchEventId));\r\n    }\r\n\r\n    public onAuthCompleted(isError: boolean): void {\r\n        if (isError) {\r\n            this.onComplete();\r\n        }\r\n    }\r\n\r\n    public onConnectionEstablishCompleted(statusCode: number): void {\r\n        if (statusCode === 200) {\r\n            this.privConnectionLatency = Date.now() - this.privSynthesisStartTime;\r\n            this.onEvent(new SynthesisStartedEvent(this.requestId, this.privAuthFetchEventId));\r\n            this.privBytesReceived = 0;\r\n            return;\r\n        } else if (statusCode === 403) {\r\n            this.onComplete();\r\n        }\r\n    }\r\n\r\n    public onServiceResponseMessage(responseJson: string): void {\r\n        const response: ISynthesisResponse = JSON.parse(responseJson) as ISynthesisResponse;\r\n        this.streamId = response.audio.streamId;\r\n    }\r\n\r\n    public onServiceTurnEndResponse(): void {\r\n        this.privInTurn = false;\r\n        this.privTurnDeferral.resolve();\r\n        this.onComplete();\r\n    }\r\n\r\n    public onServiceTurnStartResponse(responseJson: string): void {\r\n        if (!!this.privTurnDeferral && !!this.privInTurn) {\r\n            // What? How are we starting a turn with another not done?\r\n            this.privTurnDeferral.reject(\"Another turn started before current completed.\");\r\n            // Avoid UnhandledPromiseRejection if privTurnDeferral is not being awaited\r\n            // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n            this.privTurnDeferral.promise.then().catch((): void => { });\r\n        }\r\n        this.privInTurn = true;\r\n        this.privTurnDeferral = new Deferred<void>();\r\n        // If connection was reused, onConnectionEstablishCompleted was never called; treat as 0.\r\n        if (this.privConnectionLatency < 0) {\r\n            this.privConnectionLatency = 0;\r\n        }\r\n        this.privNetworkLatency = Date.now() - this.privSynthesisStartTime - this.privConnectionLatency;\r\n        const response: ISynthesisResponse = JSON.parse(responseJson) as ISynthesisResponse;\r\n        if (!!response.webrtc) {\r\n            this.privWebRTCSDP = response.webrtc.connectionString;\r\n        }\r\n    }\r\n\r\n    public onAudioChunkReceived(data: ArrayBuffer): void {\r\n        if (this.isSynthesizing) {\r\n            if (this.privFirstByteLatency < 0) {\r\n                this.privFirstByteLatency = Date.now() - this.privSynthesisStartTime;\r\n                if (this.privNetworkLatency >= 0) {\r\n                    this.privServiceLatency = this.privFirstByteLatency - this.privConnectionLatency - this.privNetworkLatency;\r\n                }\r\n            }\r\n            this.privAudioOutputStream.write(data);\r\n            this.privBytesReceived += data.byteLength;\r\n            if (this.privTurnAudioDestination !== undefined) {\r\n                this.privTurnAudioDestination.write(data);\r\n            }\r\n        }\r\n    }\r\n\r\n    public onTextBoundaryEvent(metadata: ISynthesisMetadata): void {\r\n        this.updateTextOffset(metadata.Data.text.Text, metadata.Type);\r\n    }\r\n\r\n    public onVisemeMetadataReceived(metadata: ISynthesisMetadata): void {\r\n        if (metadata.Data.AnimationChunk !== undefined) {\r\n            this.privPartialVisemeAnimation += metadata.Data.AnimationChunk;\r\n        }\r\n    }\r\n\r\n    public onSessionEnd(metadata: ISynthesisMetadata): void {\r\n        this.privAudioDuration = metadata.Data.Offset;\r\n    }\r\n\r\n    public async constructSynthesisResult(): Promise<SpeechSynthesisResult> {\r\n        const finishLatency = Date.now() - this.privSynthesisStartTime;\r\n        const audioBuffer: ArrayBuffer = await this.getAllReceivedAudioWithHeader();\r\n        const properties = new PropertyCollection();\r\n        if (!!this.privWebRTCSDP) {\r\n            properties.setProperty(PropertyId.TalkingAvatarService_WebRTC_SDP, this.privWebRTCSDP);\r\n        }\r\n        properties.setProperty(PropertyId.SpeechServiceResponse_SynthesisFirstByteLatencyMs, String(Math.max(0, this.privFirstByteLatency)));\r\n        properties.setProperty(PropertyId.SpeechServiceResponse_SynthesisFinishLatencyMs, String(finishLatency));\r\n        properties.setProperty(PropertyId.SpeechServiceResponse_SynthesisConnectionLatencyMs, String(Math.max(0, this.privConnectionLatency)));\r\n        properties.setProperty(PropertyId.SpeechServiceResponse_SynthesisNetworkLatencyMs, String(Math.max(0, this.privNetworkLatency)));\r\n        properties.setProperty(PropertyId.SpeechServiceResponse_SynthesisServiceLatencyMs, String(Math.max(0, this.privServiceLatency)));\r\n        return new SpeechSynthesisResult(\r\n            this.requestId,\r\n            ResultReason.SynthesizingAudioCompleted,\r\n            audioBuffer,\r\n            undefined,\r\n            properties,\r\n            this.audioDuration\r\n        );\r\n    }\r\n\r\n    public dispose(): void {\r\n        if (!this.privIsDisposed) {\r\n            // we should have completed by now. If we did not its an unknown error.\r\n            this.privIsDisposed = true;\r\n        }\r\n    }\r\n\r\n    public onStopSynthesizing(): void {\r\n        this.onComplete();\r\n    }\r\n\r\n    /**\r\n     * Gets the viseme animation string (merged from animation chunk), and clears the internal\r\n     * partial animation.\r\n     */\r\n    public getAndClearVisemeAnimation(): string {\r\n        const animation: string = this.privPartialVisemeAnimation;\r\n        this.privPartialVisemeAnimation = \"\";\r\n        return animation;\r\n    }\r\n\r\n    protected onEvent(event: SpeechSynthesisEvent): void {\r\n        Events.instance.onEvent(event);\r\n    }\r\n\r\n    /**\r\n     * Check if the text is an XML(SSML) tag\r\n     * @param text\r\n     * @private\r\n     */\r\n    private static isXmlTag(text: string): boolean {\r\n        return text.length >= 2 && text[0] === \"<\" && text[text.length - 1] === \">\";\r\n    }\r\n\r\n    private updateTextOffset(text: string, type: MetadataType): void {\r\n        if (type === MetadataType.WordBoundary) {\r\n            this.privTextOffset = this.privRawText.indexOf(text, this.privNextSearchTextIndex);\r\n            if (this.privTextOffset >= 0) {\r\n                this.privNextSearchTextIndex = this.privTextOffset + text.length;\r\n                if (this.privIsSSML) {\r\n                    if (this.withinXmlTag(this.privTextOffset) && !SynthesisTurn.isXmlTag(text)) {\r\n                        this.updateTextOffset(text, type);\r\n                    }\r\n                }\r\n            }\r\n        } else {\r\n            this.privSentenceOffset = this.privRawText.indexOf(text, this.privNextSearchSentenceIndex);\r\n            if (this.privSentenceOffset >= 0) {\r\n                this.privNextSearchSentenceIndex = this.privSentenceOffset + text.length;\r\n                if (this.privIsSSML) {\r\n                    if (this.withinXmlTag(this.privSentenceOffset) && !SynthesisTurn.isXmlTag(text)) {\r\n                        this.updateTextOffset(text, type);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    private onComplete(): void {\r\n        if (this.privIsSynthesizing) {\r\n            this.privIsSynthesizing = false;\r\n            this.privIsSynthesisEnded = true;\r\n            this.privAudioOutputStream.close();\r\n            this.privInTurn = false;\r\n            if (this.privTurnAudioDestination !== undefined) {\r\n                this.privTurnAudioDestination.close();\r\n                this.privTurnAudioDestination = undefined;\r\n            }\r\n        }\r\n    }\r\n\r\n    private async readAllAudioFromStream(): Promise<void> {\r\n        if (this.privIsSynthesisEnded) {\r\n            this.privReceivedAudio = new ArrayBuffer(this.bytesReceived);\r\n            try {\r\n                await this.privAudioOutputStream.read(this.privReceivedAudio);\r\n            } catch (e) {\r\n                this.privReceivedAudio = new ArrayBuffer(0);\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Check if current idx is in XML(SSML) tag\r\n     * @param idx\r\n     * @private\r\n     */\r\n    private withinXmlTag(idx: number): boolean {\r\n        return this.privRawText.indexOf(\"<\", idx + 1) > this.privRawText.indexOf(\">\", idx + 1);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ArgumentNullError,\r\n    ConnectionClosedEvent,\r\n    ConnectionEvent,\r\n    ConnectionMessage,\r\n    ConnectionState,\r\n    createNoDashGuid,\r\n    EventSource,\r\n    IAudioDestination,\r\n    IConnection,\r\n    IDisposable,\r\n    MessageType,\r\n    ServiceEvent,\r\n} from \"../common/Exports.js\";\r\nimport { AudioOutputFormatImpl } from \"../sdk/Audio/AudioOutputFormat.js\";\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    ResultReason,\r\n    SpeechSynthesisBookmarkEventArgs,\r\n    SpeechSynthesisResult,\r\n    SpeechSynthesisVisemeEventArgs,\r\n    SpeechSynthesisWordBoundaryEventArgs,\r\n    Synthesizer,\r\n} from \"../sdk/Exports.js\";\r\nimport { SpeechSynthesisRequest } from \"../sdk/SpeechSynthesisRequest.js\";\r\nimport {\r\n    AgentConfig,\r\n    CancellationErrorCodePropertyName,\r\n    ISynthesisConnectionFactory,\r\n    ISynthesisMetadata,\r\n    MetadataType,\r\n    SynthesisAudioMetadata,\r\n    SynthesisContext,\r\n    SynthesisTurn,\r\n    SynthesizerConfig\r\n} from \"./Exports.js\";\r\nimport { AuthInfo, IAuthentication } from \"./IAuthentication.js\";\r\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal.js\";\r\n\r\nexport abstract class SynthesisAdapterBase implements IDisposable {\r\n    protected privSynthesisTurn: SynthesisTurn;\r\n    protected privConnectionId: string;\r\n    protected privSynthesizerConfig: SynthesizerConfig;\r\n    protected privSynthesizer: Synthesizer;\r\n    protected privSuccessCallback: (e: SpeechSynthesisResult) => void;\r\n    protected privErrorCallback: (e: string) => void;\r\n\r\n    public get synthesizerConfig(): SynthesizerConfig {\r\n        return this.privSynthesizerConfig;\r\n    }\r\n\r\n    public get synthesisContext(): SynthesisContext {\r\n        return this.privSynthesisContext;\r\n    }\r\n\r\n    public get agentConfig(): AgentConfig {\r\n        return this.privAgentConfig;\r\n    }\r\n\r\n    public get connectionEvents(): EventSource<ConnectionEvent> {\r\n        return this.privConnectionEvents;\r\n    }\r\n\r\n    public get serviceEvents(): EventSource<ServiceEvent> {\r\n        return this.privServiceEvents;\r\n    }\r\n\r\n    protected speakOverride: (ssml: string, requestId: string, sc: (e: SpeechSynthesisResult) => void, ec: (e: string) => void) => void = undefined;\r\n\r\n    // Called when telemetry data is sent to the service.\r\n    // Used for testing Telemetry capture.\r\n    public static telemetryData: (json: string) => void;\r\n    public static telemetryDataEnabled: boolean = true;\r\n\r\n    public set activityTemplate(messagePayload: string) {\r\n        this.privActivityTemplate = messagePayload;\r\n    }\r\n    public get activityTemplate(): string {\r\n        return this.privActivityTemplate;\r\n    }\r\n\r\n    protected receiveMessageOverride: () => void = undefined;\r\n\r\n    protected connectImplOverride: (isUnAuthorized: boolean) => void = undefined;\r\n\r\n    protected configConnectionOverride: (connection: IConnection) => Promise<IConnection> = undefined;\r\n\r\n    public set audioOutputFormat(format: AudioOutputFormatImpl) {\r\n        this.privAudioOutputFormat = format;\r\n        this.privSynthesisTurn.audioOutputFormat = format;\r\n        if (this.privSessionAudioDestination !== undefined) {\r\n            this.privSessionAudioDestination.format = format;\r\n        }\r\n        if (this.synthesisContext !== undefined) {\r\n            this.synthesisContext.audioOutputFormat = format;\r\n        }\r\n    }\r\n    private privAuthentication: IAuthentication;\r\n    private privConnectionFactory: ISynthesisConnectionFactory;\r\n\r\n    // A promise for a configured connection.\r\n    // Do not consume directly, call fetchConnection instead.\r\n    private privConnectionConfigurationPromise: Promise<IConnection> = undefined;\r\n\r\n    // A promise for a connection, but one that has not had the speech context sent yet.\r\n    // Do not consume directly, call fetchConnection instead.\r\n    private privConnectionPromise: Promise<IConnection>;\r\n    private privAuthFetchEventId: string;\r\n    private privIsDisposed: boolean;\r\n    private privConnectionEvents: EventSource<ConnectionEvent>;\r\n    private privServiceEvents: EventSource<ServiceEvent>;\r\n    protected privSynthesisContext: SynthesisContext;\r\n    private privAgentConfig: AgentConfig;\r\n    private privActivityTemplate: string;\r\n    protected privAudioOutputFormat: AudioOutputFormatImpl;\r\n    private privSessionAudioDestination: IAudioDestination;\r\n\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: ISynthesisConnectionFactory,\r\n        synthesizerConfig: SynthesizerConfig,\r\n        audioDestination: IAudioDestination) {\r\n\r\n        if (!authentication) {\r\n            throw new ArgumentNullError(\"authentication\");\r\n        }\r\n\r\n        if (!connectionFactory) {\r\n            throw new ArgumentNullError(\"connectionFactory\");\r\n        }\r\n\r\n        if (!synthesizerConfig) {\r\n            throw new ArgumentNullError(\"synthesizerConfig\");\r\n        }\r\n\r\n        this.privAuthentication = authentication;\r\n        this.privConnectionFactory = connectionFactory;\r\n        this.privSynthesizerConfig = synthesizerConfig;\r\n        this.privIsDisposed = false;\r\n        this.privSessionAudioDestination = audioDestination;\r\n        this.privSynthesisTurn = new SynthesisTurn();\r\n        this.privConnectionEvents = new EventSource<ConnectionEvent>();\r\n        this.privServiceEvents = new EventSource<ServiceEvent>();\r\n        this.privSynthesisContext = new SynthesisContext();\r\n        this.privAgentConfig = new AgentConfig();\r\n\r\n        this.connectionEvents.attach((connectionEvent: ConnectionEvent): void => {\r\n            if (connectionEvent.name === \"ConnectionClosedEvent\") {\r\n                const connectionClosedEvent = connectionEvent as ConnectionClosedEvent;\r\n                if (connectionClosedEvent.statusCode !== 1000) {\r\n                    this.cancelSynthesisLocal(CancellationReason.Error,\r\n                        connectionClosedEvent.statusCode === 1007 ? CancellationErrorCode.BadRequestParameters : CancellationErrorCode.ConnectionFailure,\r\n                        `${connectionClosedEvent.reason} websocket error code: ${connectionClosedEvent.statusCode}`);\r\n                }\r\n            }\r\n        });\r\n    }\r\n\r\n    public isDisposed(): boolean {\r\n        return this.privIsDisposed;\r\n    }\r\n\r\n    public async dispose(reason?: string): Promise<void> {\r\n        this.privIsDisposed = true;\r\n        if (this.privSessionAudioDestination !== undefined) {\r\n            this.privSessionAudioDestination.close();\r\n        }\r\n        if (this.privConnectionConfigurationPromise !== undefined) {\r\n            try {\r\n                const connection: IConnection = await this.privConnectionConfigurationPromise;\r\n                await connection.dispose(reason);\r\n            } catch {\r\n                // Connection was never successfully established, nothing to dispose\r\n            }\r\n        }\r\n    }\r\n\r\n    public async connect(): Promise<void> {\r\n        await this.connectImpl();\r\n    }\r\n\r\n    public async sendNetworkMessage(path: string, payload: string | ArrayBuffer): Promise<void> {\r\n        const type: MessageType = typeof payload === \"string\" ? MessageType.Text : MessageType.Binary;\r\n        const contentType: string = typeof payload === \"string\" ? \"application/json\" : \"\";\r\n\r\n        const connection: IConnection = await this.fetchConnection();\r\n        return connection.send(new SpeechConnectionMessage(type, path, this.privSynthesisTurn.requestId, contentType, payload));\r\n    }\r\n\r\n    public async Speak(\r\n        text: string,\r\n        isSSML: boolean,\r\n        requestId: string,\r\n        successCallback: (e: SpeechSynthesisResult) => void,\r\n        errorCallBack: (e: string) => void,\r\n        audioDestination: IAudioDestination | undefined,\r\n    ): Promise<void> {\r\n\r\n        let ssml: string;\r\n\r\n        if (isSSML) {\r\n            ssml = text;\r\n        } else {\r\n            ssml = this.privSynthesizer.buildSsml(text);\r\n        }\r\n\r\n        if (this.speakOverride !== undefined) {\r\n            return this.speakOverride(ssml, requestId, successCallback, errorCallBack);\r\n        }\r\n\r\n        this.privSuccessCallback = successCallback;\r\n        this.privErrorCallback = errorCallBack;\r\n\r\n        this.privSynthesisTurn.startNewSynthesis(requestId, text, isSSML, audioDestination);\r\n\r\n        try {\r\n            const connection: IConnection = await this.fetchConnection();\r\n            await this.sendSynthesisContext(connection);\r\n            await this.sendSsmlMessage(connection, ssml, requestId);\r\n            this.onSynthesisStarted(requestId);\r\n\r\n            void this.receiveMessage();\r\n        } catch (e) {\r\n            this.cancelSynthesisLocal(CancellationReason.Error, CancellationErrorCode.ConnectionFailure, e as string);\r\n            return Promise.reject(e);\r\n        }\r\n    }\r\n\r\n    public async stopSpeaking(): Promise<void> {\r\n        const connection: IConnection = await this.fetchConnection();\r\n\r\n        return connection.send(new SpeechConnectionMessage(\r\n            MessageType.Text,\r\n            \"synthesis.control\",\r\n            this.privSynthesisTurn.requestId,\r\n            \"application/json\",\r\n            JSON.stringify({\r\n                action: \"stop\"\r\n            })\r\n        ));\r\n    }\r\n\r\n    /**\r\n     * Performs text streaming synthesis using a SpeechSynthesisRequest.\r\n     * Text pieces are sent over WebSocket as they arrive via the request's input stream.\r\n     */\r\n    public async SpeakStream(\r\n        request: SpeechSynthesisRequest,\r\n        requestId: string,\r\n        successCallback: (e: SpeechSynthesisResult) => void,\r\n        errorCallBack: (e: string) => void,\r\n        audioDestination: IAudioDestination | undefined,\r\n    ): Promise<void> {\r\n\r\n        this.privSuccessCallback = successCallback;\r\n        this.privErrorCallback = errorCallBack;\r\n\r\n        this.privSynthesisTurn.startNewSynthesis(requestId, \"\", false, audioDestination);\r\n\r\n        try {\r\n            const connection: IConnection = await this.fetchConnection();\r\n\r\n            // Send synthesis.context with streaming input section embedded\r\n            await this.sendStreamingSynthesisContext(connection, request, requestId);\r\n\r\n            this.onSynthesisStarted(requestId);\r\n\r\n            // Set up text piece callback - each piece is sent as a text.piece message\r\n            request.onTextPiece = (text: string): void => {\r\n                this.sendTextPiece(connection, text, requestId).catch((e: unknown): void => {\r\n                    this.cancelSynthesisLocal(CancellationReason.Error, CancellationErrorCode.ConnectionFailure, e as string);\r\n                });\r\n            };\r\n\r\n            // Set up close callback - sends the finish signal\r\n            request.onClose = (): void => {\r\n                this.sendTextStreamEnd(connection, requestId).catch((e: unknown): void => {\r\n                    this.cancelSynthesisLocal(CancellationReason.Error, CancellationErrorCode.ConnectionFailure, e as string);\r\n                });\r\n            };\r\n\r\n            void this.receiveMessage();\r\n        } catch (e) {\r\n            this.cancelSynthesisLocal(CancellationReason.Error, CancellationErrorCode.ConnectionFailure, e as string);\r\n            return Promise.reject(e);\r\n        }\r\n    }\r\n\r\n    // Cancels synthesis.\r\n    protected cancelSynthesis(\r\n        requestId: string,\r\n        _cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): void {\r\n        const properties: PropertyCollection = new PropertyCollection();\r\n        properties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[errorCode]);\r\n        const result: SpeechSynthesisResult = new SpeechSynthesisResult(\r\n            requestId,\r\n            ResultReason.Canceled,\r\n            undefined,\r\n            error,\r\n            properties\r\n        );\r\n\r\n        this.onSynthesisCancelled(result);\r\n\r\n        if (!!this.privSuccessCallback) {\r\n            try {\r\n                this.privSuccessCallback(result);\r\n                /* eslint-disable no-empty */\r\n            } catch { }\r\n        }\r\n    }\r\n\r\n    // Cancels synthesis.\r\n    protected cancelSynthesisLocal(\r\n        cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): void {\r\n\r\n        if (!!this.privSynthesisTurn.isSynthesizing) {\r\n            this.privSynthesisTurn.onStopSynthesizing();\r\n\r\n            this.cancelSynthesis(\r\n                this.privSynthesisTurn.requestId,\r\n                cancellationReason,\r\n                errorCode,\r\n                error);\r\n        }\r\n    }\r\n\r\n    // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n    protected processTypeSpecificMessages(_connectionMessage: SpeechConnectionMessage): boolean {\r\n        return true;\r\n    }\r\n\r\n    protected async receiveMessage(): Promise<void> {\r\n        try {\r\n            const connection: IConnection = await this.fetchConnection();\r\n            const message: ConnectionMessage = await connection.read();\r\n\r\n            if (this.receiveMessageOverride !== undefined) {\r\n                return this.receiveMessageOverride();\r\n            }\r\n            if (this.privIsDisposed) {\r\n                // We're done.\r\n                return;\r\n            }\r\n\r\n            // indicates we are draining the queue and it came with no message;\r\n            if (!message) {\r\n                if (!this.privSynthesisTurn.isSynthesizing) {\r\n                    return;\r\n                } else {\r\n                    return this.receiveMessage();\r\n                }\r\n            }\r\n\r\n\r\n            const connectionMessage = SpeechConnectionMessage.fromConnectionMessage(message);\r\n\r\n            if (connectionMessage.requestId.toLowerCase() === this.privSynthesisTurn.requestId.toLowerCase()) {\r\n                switch (connectionMessage.path.toLowerCase()) {\r\n                    case \"turn.start\":\r\n                        this.privSynthesisTurn.onServiceTurnStartResponse(connectionMessage.textBody);\r\n                        break;\r\n                    case \"response\":\r\n                        this.privSynthesisTurn.onServiceResponseMessage(connectionMessage.textBody);\r\n                        break;\r\n                    case \"audio\":\r\n                        if (this.privSynthesisTurn.streamId.toLowerCase() === connectionMessage.streamId.toLowerCase()\r\n                            && !!connectionMessage.binaryBody) {\r\n                            this.privSynthesisTurn.onAudioChunkReceived(connectionMessage.binaryBody);\r\n                            this.onSynthesizing(connectionMessage.binaryBody);\r\n                            if (this.privSessionAudioDestination !== undefined) {\r\n                                this.privSessionAudioDestination.write(connectionMessage.binaryBody);\r\n                            }\r\n                        }\r\n                        break;\r\n                    case \"audio.metadata\":\r\n                        const metadataList = SynthesisAudioMetadata.fromJSON(connectionMessage.textBody).Metadata;\r\n                        for (const metadata of metadataList) {\r\n                            switch (metadata.Type) {\r\n                                case MetadataType.WordBoundary:\r\n                                case MetadataType.SentenceBoundary:\r\n                                    this.privSynthesisTurn.onTextBoundaryEvent(metadata);\r\n                                    const wordBoundaryEventArgs: SpeechSynthesisWordBoundaryEventArgs = new SpeechSynthesisWordBoundaryEventArgs(\r\n                                        metadata.Data.Offset,\r\n                                        metadata.Data.Duration,\r\n                                        metadata.Data.text.Text,\r\n                                        metadata.Data.text.Length,\r\n                                        metadata.Type === MetadataType.WordBoundary\r\n                                            ? this.privSynthesisTurn.currentTextOffset : this.privSynthesisTurn.currentSentenceOffset,\r\n                                        metadata.Data.text.BoundaryType);\r\n                                    this.onWordBoundary(wordBoundaryEventArgs);\r\n                                    break;\r\n                                case MetadataType.Bookmark:\r\n                                    const bookmarkEventArgs: SpeechSynthesisBookmarkEventArgs = new SpeechSynthesisBookmarkEventArgs(\r\n                                        metadata.Data.Offset,\r\n                                        metadata.Data.Bookmark);\r\n                                    this.onBookmarkReached(bookmarkEventArgs);\r\n                                    break;\r\n                                case MetadataType.Viseme:\r\n                                    this.privSynthesisTurn.onVisemeMetadataReceived(metadata);\r\n                                    if (metadata.Data.IsLastAnimation) {\r\n                                        const visemeEventArgs: SpeechSynthesisVisemeEventArgs = new SpeechSynthesisVisemeEventArgs(\r\n                                            metadata.Data.Offset,\r\n                                            metadata.Data.VisemeId,\r\n                                            this.privSynthesisTurn.getAndClearVisemeAnimation());\r\n                                        this.onVisemeReceived(visemeEventArgs);\r\n                                    }\r\n                                    break;\r\n                                case MetadataType.AvatarSignal:\r\n                                    this.onAvatarEvent(metadata);\r\n                                    break;\r\n                                case MetadataType.SessionEnd:\r\n                                    this.privSynthesisTurn.onSessionEnd(metadata);\r\n                                    break;\r\n                            }\r\n                        }\r\n                        break;\r\n                    case \"turn.end\":\r\n                        this.privSynthesisTurn.onServiceTurnEndResponse();\r\n                        let result: SpeechSynthesisResult;\r\n                        try {\r\n                            result = await this.privSynthesisTurn.constructSynthesisResult();\r\n                            this.onSynthesisCompleted(result);\r\n                            if (!!this.privSuccessCallback) {\r\n                                this.privSuccessCallback(result);\r\n                            }\r\n                        } catch (error) {\r\n                            if (!!this.privErrorCallback) {\r\n                                this.privErrorCallback(error as string);\r\n                            }\r\n                        }\r\n                        break;\r\n\r\n                    default:\r\n                        if (!this.processTypeSpecificMessages(connectionMessage)) {\r\n                            // here are some messages that the derived class has not processed, dispatch them to connect class\r\n                            if (!!this.privServiceEvents) {\r\n                                this.serviceEvents.onEvent(new ServiceEvent(connectionMessage.path.toLowerCase(), connectionMessage.textBody));\r\n                            }\r\n                        }\r\n\r\n                }\r\n            }\r\n\r\n            return this.receiveMessage();\r\n\r\n        } catch (e) {\r\n            // TODO: What goes here?\r\n        }\r\n    }\r\n\r\n    protected sendSynthesisContext(connection: IConnection): Promise<void> {\r\n        this.setSynthesisContextSynthesisSection();\r\n        const synthesisContextJson = this.synthesisContext.toJSON();\r\n\r\n        if (synthesisContextJson) {\r\n            return connection.send(new SpeechConnectionMessage(\r\n                MessageType.Text,\r\n                \"synthesis.context\",\r\n                this.privSynthesisTurn.requestId,\r\n                \"application/json\",\r\n                synthesisContextJson));\r\n        }\r\n        return;\r\n    }\r\n\r\n    protected abstract setSynthesisContextSynthesisSection(): void;\r\n\r\n    protected setSpeechConfigSynthesisSection(): void {\r\n        return;\r\n    }\r\n\r\n    protected connectImpl(isUnAuthorized: boolean = false): Promise<IConnection> {\r\n        if (this.privConnectionPromise != null) {\r\n            return this.privConnectionPromise.then((connection: IConnection): Promise<IConnection> => {\r\n                if (connection.state() === ConnectionState.Disconnected) {\r\n                    this.privConnectionId = null;\r\n                    this.privConnectionPromise = null;\r\n                    return this.connectImpl();\r\n                }\r\n                return this.privConnectionPromise;\r\n            }, (): Promise<IConnection> => {\r\n                this.privConnectionId = null;\r\n                this.privConnectionPromise = null;\r\n                return this.connectImpl();\r\n            });\r\n        }\r\n        this.privAuthFetchEventId = createNoDashGuid();\r\n        this.privConnectionId = createNoDashGuid();\r\n\r\n        this.privSynthesisTurn.onPreConnectionStart(this.privAuthFetchEventId);\r\n\r\n        const authPromise = isUnAuthorized ? this.privAuthentication.fetchOnExpiry(this.privAuthFetchEventId) : this.privAuthentication.fetch(this.privAuthFetchEventId);\r\n\r\n        this.privConnectionPromise = authPromise.then(async (result: AuthInfo): Promise<IConnection> => {\r\n            this.privSynthesisTurn.onAuthCompleted(false);\r\n\r\n            const connection: IConnection = await this.privConnectionFactory.create(this.privSynthesizerConfig, result, this.privConnectionId);\r\n\r\n            // Attach to the underlying event. No need to hold onto the detach pointers as in the event the connection goes away,\r\n            // it'll stop sending events.\r\n            connection.events.attach((event: ConnectionEvent): void => {\r\n                this.connectionEvents.onEvent(event);\r\n            });\r\n            const response = await connection.open();\r\n            if (response.statusCode === 200) {\r\n                this.privSynthesisTurn.onConnectionEstablishCompleted(response.statusCode);\r\n                return Promise.resolve(connection);\r\n            } else if (response.statusCode === 403 && !isUnAuthorized) {\r\n                return this.connectImpl(true);\r\n            } else {\r\n                this.privSynthesisTurn.onConnectionEstablishCompleted(response.statusCode);\r\n                return Promise.reject(\r\n                    `Unable to contact server. StatusCode: ${response.statusCode},\r\n                    ${this.privSynthesizerConfig.parameters.getProperty(PropertyId.SpeechServiceConnection_Url)} Reason: ${response.reason}`);\r\n            }\r\n        }, (error: string): Promise<IConnection> => {\r\n            this.privSynthesisTurn.onAuthCompleted(true);\r\n            throw new Error(error);\r\n        });\r\n\r\n        // Attach an empty handler to allow the promise to run in the background while\r\n        // other startup events happen. It'll eventually be awaited on.\r\n        // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n        this.privConnectionPromise.catch((): void => { });\r\n\r\n        return this.privConnectionPromise;\r\n    }\r\n    protected sendSpeechServiceConfig(connection: IConnection, SpeechServiceConfigJson: string): Promise<void> {\r\n        if (SpeechServiceConfigJson) {\r\n            return connection.send(new SpeechConnectionMessage(\r\n                MessageType.Text,\r\n                \"speech.config\",\r\n                this.privSynthesisTurn.requestId,\r\n                \"application/json\",\r\n                SpeechServiceConfigJson));\r\n        }\r\n    }\r\n\r\n    protected sendSsmlMessage(connection: IConnection, ssml: string, requestId: string): Promise<void> {\r\n        return connection.send(new SpeechConnectionMessage(\r\n            MessageType.Text,\r\n            \"ssml\",\r\n            requestId,\r\n            \"application/ssml+xml\",\r\n            ssml));\r\n    }\r\n\r\n    /**\r\n     * Sends the synthesis.context message for text streaming mode.\r\n     * Includes the standard audio/language sections plus an input section\r\n     * with bidirectionalStreamingMode, voice name, and per-request properties.\r\n     */\r\n    protected async sendStreamingSynthesisContext(\r\n        connection: IConnection,\r\n        request: SpeechSynthesisRequest,\r\n        requestId: string\r\n    ): Promise<void> {\r\n        // Build the standard synthesis context first\r\n        this.setSynthesisContextSynthesisSection();\r\n\r\n        // Build the streaming input section\r\n        const inputSection: { [key: string]: any } = {\r\n            bidirectionalStreamingMode: true,\r\n        };\r\n\r\n        // Add voice name and language from synthesizer properties\r\n        const voiceName = this.privSynthesizerConfig.parameters.getProperty(\r\n            PropertyId.SpeechServiceConnection_SynthVoice, \"\");\r\n        const language = this.privSynthesizerConfig.parameters.getProperty(\r\n            PropertyId.SpeechServiceConnection_SynthLanguage, \"en-US\");\r\n\r\n        if (voiceName) {\r\n            inputSection.voiceName = voiceName;\r\n        }\r\n        inputSection.language = language;\r\n\r\n        // Add per-request voice properties\r\n        const pitch = request.properties.getProperty(PropertyId.SpeechSynthesisRequest_Pitch, undefined);\r\n        const rate = request.properties.getProperty(PropertyId.SpeechSynthesisRequest_Rate, undefined);\r\n        const volume = request.properties.getProperty(PropertyId.SpeechSynthesisRequest_Volume, undefined);\r\n        const style = request.properties.getProperty(PropertyId.SpeechSynthesisRequest_Style, undefined);\r\n        const temperature = request.properties.getProperty(PropertyId.SpeechSynthesisRequest_Temperature, undefined);\r\n        const customLexiconUrl = request.properties.getProperty(PropertyId.SpeechSynthesisRequest_CustomLexiconUrl, undefined);\r\n        const preferLocales = request.properties.getProperty(PropertyId.SpeechSynthesisRequest_PreferLocales, undefined);\r\n\r\n        if (pitch !== undefined) {\r\n            inputSection.pitch = pitch;\r\n        }\r\n        if (rate !== undefined) {\r\n            inputSection.rate = rate;\r\n        }\r\n        if (volume !== undefined) {\r\n            inputSection.volume = volume;\r\n        }\r\n        if (style !== undefined) {\r\n            inputSection.style = style;\r\n        }\r\n        if (temperature !== undefined) {\r\n            inputSection.temperature = temperature;\r\n        }\r\n        if (customLexiconUrl !== undefined) {\r\n            inputSection.customLexiconUrl = customLexiconUrl;\r\n        }\r\n        if (preferLocales !== undefined) {\r\n            inputSection.preferLocales = preferLocales;\r\n        }\r\n\r\n        // Add the input section to the synthesis context\r\n        const existingSynthesis = this.privSynthesisContext.getSection<Record<string, unknown>>(\"synthesis\") ?? {};\r\n        this.privSynthesisContext.setSection(\"synthesis\", {\r\n            ...existingSynthesis,\r\n            input: inputSection,\r\n        } as Record<string, unknown>);\r\n\r\n        const synthesisContextJson = this.privSynthesisContext.toJSON();\r\n        if (synthesisContextJson) {\r\n            return connection.send(new SpeechConnectionMessage(\r\n                MessageType.Text,\r\n                \"synthesis.context\",\r\n                requestId,\r\n                \"application/json\",\r\n                synthesisContextJson));\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Sends a text piece for streaming synthesis.\r\n     * Path: text.piece, Content-Type: text/plain, Body: raw text\r\n     */\r\n    protected async sendTextPiece(connection: IConnection, text: string, requestId: string): Promise<void> {\r\n        return connection.send(new SpeechConnectionMessage(\r\n            MessageType.Text,\r\n            \"text.piece\",\r\n            requestId,\r\n            \"text/plain\",\r\n            text));\r\n    }\r\n\r\n    /**\r\n     * Sends the end-of-stream signal for text streaming synthesis.\r\n     * Path: text.end, Content-Type: text/plain, Body: empty\r\n     */\r\n    protected async sendTextStreamEnd(connection: IConnection, requestId: string): Promise<void> {\r\n        return connection.send(new SpeechConnectionMessage(\r\n            MessageType.Text,\r\n            \"text.end\",\r\n            requestId,\r\n            \"text/plain\",\r\n            \"\"));\r\n    }\r\n\r\n    private async fetchConnection(): Promise<IConnection> {\r\n        if (this.privConnectionConfigurationPromise !== undefined) {\r\n            return this.privConnectionConfigurationPromise.then((connection: IConnection): Promise<IConnection> => {\r\n                if (connection.state() === ConnectionState.Disconnected) {\r\n                    this.privConnectionId = null;\r\n                    this.privConnectionConfigurationPromise = undefined;\r\n                    return this.fetchConnection();\r\n                }\r\n                return this.privConnectionConfigurationPromise;\r\n            }, (): Promise<IConnection> => {\r\n                this.privConnectionId = null;\r\n                this.privConnectionConfigurationPromise = undefined;\r\n                return this.fetchConnection();\r\n            });\r\n        }\r\n        this.privConnectionConfigurationPromise = this.configureConnection();\r\n        return await this.privConnectionConfigurationPromise;\r\n    }\r\n\r\n    // Takes an established websocket connection to the endpoint and sends speech configuration information.\r\n    private async configureConnection(): Promise<IConnection> {\r\n        const connection: IConnection = await this.connectImpl();\r\n        if (this.configConnectionOverride !== undefined) {\r\n            return this.configConnectionOverride(connection);\r\n        }\r\n        this.setSpeechConfigSynthesisSection();\r\n        await this.sendSpeechServiceConfig(connection, this.privSynthesizerConfig.SpeechServiceConfig.serialize());\r\n        return connection;\r\n    }\r\n\r\n    protected onAvatarEvent(_metadata: ISynthesisMetadata): void {\r\n        return;\r\n    }\r\n\r\n    protected onSynthesisStarted(_requestId: string): void {\r\n        return;\r\n    }\r\n\r\n    protected onSynthesizing(_audio: ArrayBuffer): void {\r\n        return;\r\n    }\r\n\r\n    protected onSynthesisCancelled(_result: SpeechSynthesisResult): void {\r\n        return;\r\n    }\r\n\r\n    protected onSynthesisCompleted(_result: SpeechSynthesisResult): void {\r\n        return;\r\n    }\r\n\r\n    protected onWordBoundary(_wordBoundaryEventArgs: SpeechSynthesisWordBoundaryEventArgs): void {\r\n        return;\r\n    }\r\n\r\n    protected onVisemeReceived(_visemeEventArgs: SpeechSynthesisVisemeEventArgs): void {\r\n        return;\r\n    }\r\n\r\n    protected onBookmarkReached(_bookmarkEventArgs: SpeechSynthesisBookmarkEventArgs): void {\r\n        return;\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    AvatarConfig,\r\n    AvatarEventArgs,\r\n    AvatarSynthesizer,\r\n    PropertyId,\r\n    Synthesizer,\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    ISynthesisConnectionFactory,\r\n    ISynthesisMetadata,\r\n    ISynthesisSectionVideo,\r\n    SynthesisAdapterBase,\r\n    SynthesizerConfig\r\n} from \"./Exports.js\";\r\nimport { IAuthentication } from \"./IAuthentication.js\";\r\n\r\nexport class AvatarSynthesisAdapter extends SynthesisAdapterBase {\r\n    private readonly privAvatarSynthesizer: AvatarSynthesizer;\r\n    private readonly privAvatarConfig: AvatarConfig;\r\n\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: ISynthesisConnectionFactory,\r\n        synthesizerConfig: SynthesizerConfig,\r\n        avatarSynthesizer: AvatarSynthesizer,\r\n        avatarConfig: AvatarConfig,\r\n        ) {\r\n\r\n        super(authentication, connectionFactory,\r\n            synthesizerConfig, undefined);\r\n        this.privAvatarSynthesizer = avatarSynthesizer;\r\n        this.privSynthesizer = avatarSynthesizer as Synthesizer;\r\n        this.privAvatarConfig = avatarConfig;\r\n    }\r\n\r\n    protected setSynthesisContextSynthesisSection(): void {\r\n        this.privSynthesisContext.setSynthesisSection(undefined);\r\n    }\r\n\r\n    protected setSpeechConfigSynthesisSection(): void {\r\n        const talkingAvatarConfig: ISynthesisSectionVideo[\"talkingAvatar\"] = {\r\n            background: {\r\n                color: this.privAvatarConfig.backgroundColor,\r\n                image: {\r\n                    url: this.privAvatarConfig.backgroundImage?.toString(),\r\n                }\r\n            },\r\n            character: this.privAvatarConfig.character,\r\n            customized: this.privAvatarConfig.customized,\r\n            photoAvatarBaseModel: this.privAvatarConfig.photoAvatarBaseModel,\r\n            style: this.privAvatarConfig.style,\r\n            useBuiltInVoice: this.privAvatarConfig.useBuiltInVoice,\r\n        };\r\n\r\n        // Add scene configuration if provided\r\n        if (this.privAvatarConfig.scene) {\r\n            talkingAvatarConfig.scene = {\r\n                amplitude: this.privAvatarConfig.scene.amplitude,\r\n                positionX: this.privAvatarConfig.scene.positionX,\r\n                positionY: this.privAvatarConfig.scene.positionY,\r\n                rotationX: this.privAvatarConfig.scene.rotationX,\r\n                rotationY: this.privAvatarConfig.scene.rotationY,\r\n                rotationZ: this.privAvatarConfig.scene.rotationZ,\r\n                zoom: this.privAvatarConfig.scene.zoom,\r\n            };\r\n        }\r\n\r\n        this.privSynthesizerConfig.synthesisVideoSection = {\r\n            format: {\r\n                bitrate: this.privAvatarConfig.videoFormat?.bitrate,\r\n                codec: this.privAvatarConfig.videoFormat?.codec,\r\n                crop: {\r\n                    bottomRight: {\r\n                        x: this.privAvatarConfig.videoFormat?.cropRange?.bottomRight?.x,\r\n                        y: this.privAvatarConfig.videoFormat?.cropRange?.bottomRight?.y,\r\n                    },\r\n                    topLeft: {\r\n                        x: this.privAvatarConfig.videoFormat?.cropRange?.topLeft?.x,\r\n                        y: this.privAvatarConfig.videoFormat?.cropRange?.topLeft?.y,\r\n                    },\r\n                },\r\n                resolution: {\r\n                    height: this.privAvatarConfig.videoFormat?.height,\r\n                    width: this.privAvatarConfig.videoFormat?.width,\r\n                },\r\n            },\r\n            protocol: {\r\n                name: \"WebRTC\",\r\n                webrtcConfig: {\r\n                    clientDescription: btoa(this.privSynthesizerConfig.parameters.getProperty(PropertyId.TalkingAvatarService_WebRTC_SDP)),\r\n                    iceServers: this.privAvatarConfig.remoteIceServers ?? this.privAvatarSynthesizer.iceServers,\r\n                },\r\n            },\r\n            talkingAvatar: talkingAvatarConfig,\r\n        } as ISynthesisSectionVideo;\r\n    }\r\n\r\n\r\n    protected onAvatarEvent(metadata: ISynthesisMetadata): void {\r\n        if (!!this.privAvatarSynthesizer.avatarEventReceived) {\r\n            const avatarEventArgs: AvatarEventArgs = new AvatarEventArgs(\r\n                metadata.Data.Offset,\r\n                metadata.Data.Name);\r\n            try {\r\n                this.privAvatarSynthesizer.avatarEventReceived(this.privAvatarSynthesizer, avatarEventArgs);\r\n            } catch (error) {\r\n                // Not going to let errors in the event handler\r\n                // trip things up.\r\n            }\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { IAudioDestination } from \"../common/Exports.js\";\r\nimport {\r\n    ResultReason,\r\n    SpeechSynthesisBookmarkEventArgs,\r\n    SpeechSynthesisEventArgs,\r\n    SpeechSynthesisResult,\r\n    SpeechSynthesisVisemeEventArgs,\r\n    SpeechSynthesisWordBoundaryEventArgs,\r\n    SpeechSynthesizer,\r\n    Synthesizer,\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    IAuthentication,\r\n    ISynthesisConnectionFactory,\r\n    SynthesisAdapterBase,\r\n    SynthesizerConfig\r\n} from \"./Exports.js\";\r\n\r\nexport class SpeechSynthesisAdapter extends SynthesisAdapterBase {\r\n    private privSpeechSynthesizer: SpeechSynthesizer;\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: ISynthesisConnectionFactory,\r\n        synthesizerConfig: SynthesizerConfig,\r\n        speechSynthesizer: SpeechSynthesizer,\r\n        audioDestination: IAudioDestination) {\r\n            super(authentication, connectionFactory, synthesizerConfig, audioDestination);\r\n            this.privSpeechSynthesizer = speechSynthesizer;\r\n            this.privSynthesizer = speechSynthesizer as Synthesizer;\r\n        }\r\n\r\n    protected setSynthesisContextSynthesisSection(): void {\r\n        this.privSynthesisContext.setSynthesisSection(this.privSpeechSynthesizer);\r\n    }\r\n\r\n    protected onSynthesisStarted(requestId: string): void {\r\n        const synthesisStartEventArgs: SpeechSynthesisEventArgs = new SpeechSynthesisEventArgs(\r\n            new SpeechSynthesisResult(\r\n                requestId,\r\n                ResultReason.SynthesizingAudioStarted,\r\n            )\r\n        );\r\n\r\n        if (!!this.privSpeechSynthesizer.synthesisStarted) {\r\n            this.privSpeechSynthesizer.synthesisStarted(this.privSpeechSynthesizer, synthesisStartEventArgs);\r\n        }\r\n    }\r\n\r\n    protected onSynthesizing(audio: ArrayBuffer): void {\r\n        if (!!this.privSpeechSynthesizer.synthesizing) {\r\n            try {\r\n                const audioWithHeader = this.privSynthesisTurn.audioOutputFormat.addHeader(audio);\r\n                const ev: SpeechSynthesisEventArgs = new SpeechSynthesisEventArgs(\r\n                    new SpeechSynthesisResult(\r\n                        this.privSynthesisTurn.requestId,\r\n                        ResultReason.SynthesizingAudio,\r\n                        audioWithHeader));\r\n                this.privSpeechSynthesizer.synthesizing(this.privSpeechSynthesizer, ev);\r\n            } catch (error) {\r\n                // Not going to let errors in the event handler\r\n                // trip things up.\r\n            }\r\n        }\r\n    }\r\n\r\n    protected onSynthesisCancelled(result: SpeechSynthesisResult): void {\r\n        if (!!this.privSpeechSynthesizer.SynthesisCanceled) {\r\n            const cancelEvent: SpeechSynthesisEventArgs = new SpeechSynthesisEventArgs(result);\r\n            try {\r\n                this.privSpeechSynthesizer.SynthesisCanceled(this.privSpeechSynthesizer, cancelEvent);\r\n                /* eslint-disable no-empty */\r\n            } catch { }\r\n        }\r\n    }\r\n\r\n    protected onSynthesisCompleted(result: SpeechSynthesisResult): void {\r\n        if (this.privSpeechSynthesizer.synthesisCompleted) {\r\n            try {\r\n                this.privSpeechSynthesizer.synthesisCompleted(\r\n                    this.privSpeechSynthesizer,\r\n                    new SpeechSynthesisEventArgs(result)\r\n                );\r\n            } catch (e) {\r\n                // Not going to let errors in the event handler\r\n                // trip things up.\r\n            }\r\n        }\r\n    }\r\n\r\n    protected onWordBoundary(wordBoundaryEventArgs: SpeechSynthesisWordBoundaryEventArgs): void {\r\n        if (!!this.privSpeechSynthesizer.wordBoundary) {\r\n            try {\r\n                this.privSpeechSynthesizer.wordBoundary(this.privSpeechSynthesizer, wordBoundaryEventArgs);\r\n            } catch (error) {\r\n                // Not going to let errors in the event handler\r\n                // trip things up.\r\n            }\r\n        }\r\n    }\r\n\r\n    protected onVisemeReceived(visemeEventArgs: SpeechSynthesisVisemeEventArgs): void {\r\n        if (!!this.privSpeechSynthesizer.visemeReceived) {\r\n            try {\r\n                this.privSpeechSynthesizer.visemeReceived(this.privSpeechSynthesizer, visemeEventArgs);\r\n            } catch (error) {\r\n                // Not going to let errors in the event handler\r\n                // trip things up.\r\n            }\r\n        }\r\n    }\r\n\r\n    protected onBookmarkReached(bookmarkEventArgs: SpeechSynthesisBookmarkEventArgs): void {\r\n        if (!!this.privSpeechSynthesizer.bookmarkReached) {\r\n            try {\r\n                this.privSpeechSynthesizer.bookmarkReached(this.privSpeechSynthesizer, bookmarkEventArgs);\r\n            } catch (error) {\r\n                // Not going to let errors in the event handler\r\n                // trip things up.\r\n            }\r\n        }\r\n    }\r\n}\r\n","import {\r\n    IRequestOptions,\r\n    IRestResponse,\r\n    RestConfigBase,\r\n    RestMessageAdapter,\r\n    RestRequestType,\r\n} from \"../common.browser/Exports.js\";\r\nimport {\r\n    PropertyId,\r\n} from \"../sdk/Exports.js\";\r\nimport { ConnectionFactoryBase } from \"./ConnectionFactoryBase.js\";\r\nimport { AuthInfo, IAuthentication, SynthesizerConfig } from \"./Exports.js\";\r\nimport { HeaderNames } from \"./HeaderNames.js\";\r\n\r\n/**\r\n * Implements methods for speech synthesis classes, sending requests to endpoint\r\n * and parsing response into expected format\r\n * @class SynthesisRestAdapter\r\n */\r\nexport class SynthesisRestAdapter {\r\n    private privRestAdapter: RestMessageAdapter;\r\n    private privUri: string;\r\n    private privAuthentication: IAuthentication;\r\n\r\n    public constructor(config: SynthesizerConfig, authentication: IAuthentication) {\r\n\r\n        let endpoint = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint, undefined);\r\n        if (!endpoint) {\r\n            const region: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Region, \"westus\");\r\n            const hostSuffix: string = ConnectionFactoryBase.getHostSuffix(region);\r\n            endpoint = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Host, `https://${region}.tts.speech${hostSuffix}`);\r\n        }\r\n        this.privUri = `${endpoint}/cognitiveservices/voices/list`;\r\n\r\n        const options: IRequestOptions = RestConfigBase.requestOptions;\r\n        this.privRestAdapter = new RestMessageAdapter(options);\r\n        this.privAuthentication = authentication;\r\n    }\r\n\r\n    /**\r\n     * Sends list voices request to endpoint.\r\n     * @function\r\n     * @public\r\n     * @param connectionId - guid for connectionId\r\n     * @returns {Promise<IRestResponse>} rest response to status request\r\n     */\r\n    public getVoicesList(connectionId: string): Promise<IRestResponse> {\r\n        this.privRestAdapter.setHeaders(HeaderNames.ConnectionId, connectionId);\r\n        return this.privAuthentication.fetch(connectionId).then((authInfo: AuthInfo): Promise<IRestResponse> => {\r\n            this.privRestAdapter.setHeaders(authInfo.headerName, authInfo.token);\r\n            return this.privRestAdapter.request(RestRequestType.Get, this.privUri);\r\n        });\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyCollection } from \"../sdk/Exports.js\";\r\nimport {\r\n    Context,\r\n    ISynthesisSectionVideo,\r\n    SpeechServiceConfig\r\n    } from \"./Exports.js\";\r\n\r\nexport enum SynthesisServiceType {\r\n    Standard,\r\n    Custom,\r\n}\r\n\r\nexport class SynthesizerConfig {\r\n    private privSynthesisServiceType: SynthesisServiceType = SynthesisServiceType.Standard;\r\n    private privSpeechServiceConfig: SpeechServiceConfig;\r\n    private privParameters: PropertyCollection;\r\n    public avatarEnabled: boolean = false;\r\n\r\n    public constructor(\r\n        speechServiceConfig: SpeechServiceConfig,\r\n        parameters: PropertyCollection) {\r\n        this.privSpeechServiceConfig = speechServiceConfig ? speechServiceConfig : new SpeechServiceConfig(new Context(null));\r\n        this.privParameters = parameters;\r\n    }\r\n\r\n    public get parameters(): PropertyCollection {\r\n        return this.privParameters;\r\n    }\r\n\r\n    public get synthesisServiceType(): SynthesisServiceType {\r\n        return this.privSynthesisServiceType;\r\n    }\r\n\r\n    public set synthesisServiceType(value: SynthesisServiceType) {\r\n        this.privSynthesisServiceType = value;\r\n    }\r\n\r\n    public set synthesisVideoSection(value: ISynthesisSectionVideo) {\r\n        this.privSpeechServiceConfig.Context.synthesis = {\r\n            video: value\r\n        };\r\n    }\r\n\r\n    public get SpeechServiceConfig(): SpeechServiceConfig {\r\n        return this.privSpeechServiceConfig;\r\n    }\r\n\r\n    public setContextFromJson(contextJson: string | object): void {\r\n        const context: Context = JSON.parse(contextJson as string) as Context;\r\n        if (context.system) {\r\n            this.privSpeechServiceConfig.Context.system = context.system;\r\n        }\r\n\r\n        if (context.os) {\r\n            this.privSpeechServiceConfig.Context.os = context.os;\r\n        }\r\n\r\n        if (context.audio) {\r\n            this.privSpeechServiceConfig.Context.audio = context.audio;\r\n        }\r\n\r\n        if (context.synthesis) {\r\n            this.privSpeechServiceConfig.Context.synthesis = context.synthesis;\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { AudioOutputFormatImpl } from \"../sdk/Audio/AudioOutputFormat.js\";\r\nimport { PropertyId, SpeechSynthesizer } from \"../sdk/Exports.js\";\r\n\r\n/**\r\n * Represents the JSON used in the synthesis.context message sent to the speech service.\r\n * The dynamic grammar is always refreshed from the encapsulated dynamic grammar object.\r\n */\r\nexport class SynthesisContext {\r\n    private privContext: { [section: string]: any } = {};\r\n    private privAudioOutputFormat: AudioOutputFormatImpl;\r\n\r\n    /**\r\n     * Adds a section to the synthesis.context object.\r\n     * @param sectionName Name of the section to add.\r\n     * @param value JSON serializable object that represents the value.\r\n     */\r\n    public setSection(sectionName: string, value: string | object): void {\r\n        this.privContext[sectionName] = value;\r\n    }\r\n\r\n    /**\r\n     * Sets the audio output format for synthesis context generation.\r\n     * @param format {AudioOutputFormatImpl} the output format\r\n     */\r\n    public set audioOutputFormat(format: AudioOutputFormatImpl) {\r\n        this.privAudioOutputFormat = format;\r\n    }\r\n\r\n    public toJSON(): string {\r\n        return JSON.stringify(this.privContext);\r\n    }\r\n\r\n    /**\r\n     * Gets a previously set section by name.\r\n     * @param sectionName Name of the section to retrieve.\r\n     */\r\n    public getSection<T = string | object>(sectionName: string): T | undefined {\r\n        return this.privContext[sectionName] as T | undefined;\r\n    }\r\n\r\n    public setSynthesisSection(speechSynthesizer: SpeechSynthesizer): void {\r\n        const synthesisSection: ISynthesisSection = this.buildSynthesisContext(speechSynthesizer);\r\n        this.setSection(\"synthesis\", synthesisSection);\r\n    }\r\n\r\n    private buildSynthesisContext(speechSynthesizer: SpeechSynthesizer): ISynthesisSection {\r\n        return {\r\n            audio: {\r\n                metadataOptions: {\r\n                    bookmarkEnabled: (!!speechSynthesizer?.bookmarkReached),\r\n                    punctuationBoundaryEnabled: speechSynthesizer?.properties.getProperty(\r\n                        PropertyId.SpeechServiceResponse_RequestPunctuationBoundary, (!!speechSynthesizer?.wordBoundary)),\r\n                    sentenceBoundaryEnabled: speechSynthesizer?.properties.getProperty(\r\n                        PropertyId.SpeechServiceResponse_RequestSentenceBoundary, false),\r\n                    sessionEndEnabled: true,\r\n                    visemeEnabled: (!!speechSynthesizer?.visemeReceived),\r\n                    wordBoundaryEnabled: speechSynthesizer?.properties.getProperty(\r\n                        PropertyId.SpeechServiceResponse_RequestWordBoundary, (!!speechSynthesizer?.wordBoundary)),\r\n                },\r\n                outputFormat: this.privAudioOutputFormat.requestAudioFormatString,\r\n            },\r\n            language: {\r\n                autoDetection: speechSynthesizer?.autoDetectSourceLanguage\r\n            }\r\n        } as ISynthesisSection;\r\n    }\r\n}\r\n\r\ninterface ISynthesisSection {\r\n    audio: {\r\n        outputFormat: string;\r\n        metadataOptions: {\r\n            bookmarkEnabled: boolean;\r\n            wordBoundaryEnabled: string;\r\n            punctuationBoundaryEnabled: string;\r\n            visemeEnabled: boolean;\r\n            sentenceBoundaryEnabled: string;\r\n            sessionEndEnabled: boolean;\r\n        };\r\n    };\r\n    language: {\r\n        autoDetection: boolean;\r\n    };\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\n// The config is serialized and sent as the Speech.Config\r\nexport class SpeechServiceConfig {\r\n    private context: Context;\r\n    private recognition: string;\r\n\r\n    public constructor(context: Context) {\r\n        this.context = context;\r\n    }\r\n\r\n    public serialize(): string {\r\n        return JSON.stringify(this, (key: any, value: { [k: string]: any }): any => {\r\n            if (value && typeof value === \"object\" && !Array.isArray(value)) {\r\n                const replacement: { [k: string ]: any } = {};\r\n                for (const k in value) {\r\n                    if (Object.hasOwnProperty.call(value, k)) {\r\n                        // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\r\n                        replacement[k && k.charAt(0).toLowerCase() + k.substring(1)] = value[k];\r\n                    }\r\n                }\r\n                return replacement;\r\n            }\r\n            return value;\r\n        });\r\n    }\r\n\r\n    public get Context(): Context {\r\n        return this.context;\r\n    }\r\n\r\n    public get Recognition(): string {\r\n        return this.recognition;\r\n    }\r\n\r\n    public set Recognition(value: string) {\r\n        this.recognition = value.toLowerCase();\r\n    }\r\n}\r\n\r\nexport class Context {\r\n    public system: System;\r\n    public os: OS;\r\n    public audio: ISpeechConfigAudio;\r\n    public synthesis: {\r\n        video: ISynthesisSectionVideo;\r\n    };\r\n\r\n    public constructor(os: OS) {\r\n        this.system = new System();\r\n        this.os = os;\r\n    }\r\n}\r\n\r\nexport class System {\r\n    public name: string;\r\n    public version: string;\r\n    public build: string;\r\n    public lang: string;\r\n\r\n    public constructor() {\r\n        // Note: below will be patched for official builds.\r\n        const SPEECHSDK_CLIENTSDK_VERSION = \"1.50.0\";\r\n\r\n        this.name = \"SpeechSDK\";\r\n        this.version = SPEECHSDK_CLIENTSDK_VERSION;\r\n        this.build = \"JavaScript\";\r\n        this.lang = \"JavaScript\";\r\n    }\r\n}\r\n\r\nexport class OS {\r\n    public platform: string;\r\n    public name: string;\r\n    public version: string;\r\n\r\n    public constructor(platform: string, name: string, version: string) {\r\n        this.platform = platform;\r\n        this.name = name;\r\n        this.version = version;\r\n    }\r\n}\r\n\r\nexport class Device {\r\n    public manufacturer: string;\r\n    public model: string;\r\n    public version: string;\r\n\r\n    public constructor(manufacturer: string, model: string, version: string) {\r\n        this.manufacturer = manufacturer;\r\n        this.model = model;\r\n        this.version = version;\r\n    }\r\n}\r\n\r\nexport interface ISpeechConfigAudio {\r\n    source?: ISpeechConfigAudioDevice;\r\n    playback?: ISpeechConfigAudioDevice;\r\n}\r\n\r\nexport interface ISpeechConfigAudioDevice {\r\n    manufacturer: string;\r\n    model: string;\r\n    connectivity: connectivity;\r\n    type: type;\r\n    samplerate: number;\r\n    bitspersample: number;\r\n    channelcount: number;\r\n}\r\n\r\nexport enum connectivity {\r\n    Bluetooth = \"Bluetooth\",\r\n    Wired = \"Wired\",\r\n    WiFi = \"WiFi\",\r\n    Cellular = \"Cellular\",\r\n    InBuilt = \"InBuilt\",\r\n    Unknown = \"Unknown\",\r\n}\r\n\r\nexport enum type {\r\n    Phone = \"Phone\",\r\n    Speaker = \"Speaker\",\r\n    Car = \"Car\",\r\n    Headset = \"Headset\",\r\n    Thermostat = \"Thermostat\",\r\n    Microphones = \"Microphones\",\r\n    Deskphone = \"Deskphone\",\r\n    RemoteControl = \"RemoteControl\",\r\n    Unknown = \"Unknown\",\r\n    File = \"File\",\r\n    Stream = \"Stream\",\r\n}\r\n\r\nexport interface ICoordinate {\r\n    x: number;\r\n    y: number;\r\n}\r\n\r\n// For avatar synthesis\r\nexport interface ISynthesisSectionVideo {\r\n    protocol: {\r\n        name: string;\r\n        webrtcConfig: {\r\n            clientDescription: string;\r\n            iceServers: {\r\n                urls: string[];\r\n                username: string;\r\n                credential: string;\r\n            }[];\r\n        };\r\n    };\r\n    format: {\r\n        bitrate: number;\r\n        codec: string;\r\n        crop: {\r\n            topLeft: ICoordinate;\r\n            bottomRight: ICoordinate;\r\n        };\r\n        resolution: {\r\n            width: number;\r\n            height: number;\r\n        };\r\n    };\r\n    talkingAvatar: {\r\n        character: string;\r\n        customized: boolean;\r\n        useBuiltInVoice: boolean;\r\n        style: string;\r\n        photoAvatarBaseModel: string;\r\n        background: {\r\n            color: string;\r\n            image?: {\r\n                url: string;\r\n            };\r\n        };\r\n        scene?: {\r\n            zoom: number;\r\n            positionX: number;\r\n            positionY: number;\r\n            rotationX: number;\r\n            rotationY: number;\r\n            rotationZ: number;\r\n            amplitude: number;\r\n        };\r\n    };\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n// Make sure not to export internal modules.\r\n//\r\nexport * from \"./CognitiveSubscriptionKeyAuthentication.js\";\r\nexport * from \"./CognitiveTokenAuthentication.js\";\r\nexport * from \"./IAuthentication.js\";\r\nexport * from \"./IConnectionFactory.js\";\r\nexport * from \"./ISynthesisConnectionFactory.js\";\r\nexport * from \"./RecognitionEvents.js\";\r\nexport * from \"./ServiceRecognizerBase.js\";\r\nexport * from \"./ConversationServiceRecognizer.js\";\r\nexport * from \"./RecognizerConfig.js\";\r\nexport * from \"./SpeechServiceInterfaces.js\";\r\nexport * from \"./WebsocketMessageFormatter.js\";\r\nexport * from \"./SpeechConnectionFactory.js\";\r\nexport * from \"./ConversationTranscriberConnectionFactory.js\";\r\nexport * from \"./TranscriberConnectionFactory.js\";\r\nexport * from \"./TranslationConnectionFactory.js\";\r\nexport * from \"./SpeechSynthesisConnectionFactory.js\";\r\nexport * from \"./EnumTranslation.js\";\r\nexport * from \"./ServiceMessages/Enums.js\";\r\nexport * from \"./ServiceMessages/TranslationSynthesisEnd.js\";\r\nexport * from \"./ServiceMessages/TranslationHypothesis.js\";\r\nexport * from \"./ServiceMessages/TranslationPhrase.js\";\r\nexport * from \"./TranslationServiceRecognizer.js\";\r\nexport * from \"./ServiceMessages/SpeechDetected.js\";\r\nexport * from \"./ServiceMessages/SpeechHypothesis.js\";\r\nexport * from \"./ServiceMessages/SpeechKeyword.js\";\r\nexport * from \"./SpeechServiceRecognizer.js\";\r\nexport * from \"./ConversationTranscriptionServiceRecognizer.js\";\r\nexport * from \"./TranscriptionServiceRecognizer.js\";\r\nexport * from \"./ServiceMessages/DetailedSpeechPhrase.js\";\r\nexport * from \"./ServiceMessages/SimpleSpeechPhrase.js\";\r\nexport * from \"./RequestSession.js\";\r\nexport * from \"./SpeechContext.js\";\r\nexport * from \"./DynamicGrammarBuilder.js\";\r\nexport * from \"./DialogServiceAdapter.js\";\r\nexport * from \"./AgentConfig.js\";\r\nexport * from \"./Transcription/Exports.js\";\r\nexport * from \"./ServiceMessages/SynthesisAudioMetadata.js\";\r\nexport * from \"./SynthesisTurn.js\";\r\nexport * from \"./SynthesisAdapterBase.js\";\r\nexport { AvatarSynthesisAdapter } from \"./AvatarSynthesisAdapter.js\";\r\nexport { SpeechSynthesisAdapter } from \"./SpeechSynthesisAdapter.js\";\r\nexport * from \"./SynthesisRestAdapter.js\";\r\nexport * from \"./SynthesizerConfig.js\";\r\nexport * from \"./SynthesisContext.js\";\r\nexport * from \"./SpeechServiceConfig.js\";\r\n\r\nexport const OutputFormatPropertyName: string = \"OutputFormat\";\r\nexport const CancellationErrorCodePropertyName: string = \"CancellationErrorCode\";\r\nexport const ServicePropertiesPropertyName: string = \"ServiceProperties\";\r\nexport const ForceDictationPropertyName: string = \"ForceDictation\";\r\nexport const AutoDetectSourceLanguagesOpenRangeOptionName: string = \"UND\";\r\n","/* eslint-disable @typescript-eslint/no-unused-vars */\r\n// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\nimport { AgentConfig } from \"./src/common.speech/Exports.js\";\r\n\r\n// Note: this instantiation ensures the above import isn't\r\n// removed on compile. The import being absent causes an error on running\r\nvoid new AgentConfig();\r\n\r\n// Speech SDK API\r\nexport * from \"./src/sdk/Exports.js\";\r\n","import { createBuildInfo } from '@msinternal/botframework-webchat-base/utils';\n\nconst buildInfo = createBuildInfo('botframework-webchat');\n\nbuildInfo.set('buildTool', globalThis.WEB_CHAT_BUILD_INFO_BUILD_TOOL);\nbuildInfo.set('moduleFormat', globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT);\nbuildInfo.set('version', globalThis.WEB_CHAT_BUILD_INFO_VERSION);\n\nexport default buildInfo;\n","import buildInfo from '../../buildInfo';\n\n// #region Build info\nbuildInfo.set('variant', 'minimal');\n\nconst { object: buildInfoObject, version } = buildInfo;\n// #endregion\n\nexport { concatMiddleware, createStyleSet, testIds, withEmoji } from 'botframework-webchat-component';\nexport { Constants, createStore, createStoreWithDevTools, createStoreWithOptions } from 'botframework-webchat-core';\nexport { default as createBrowserWebSpeechPonyfillFactory } from '../../createBrowserWebSpeechPonyfillFactory';\nexport { ReactWebChat, type ReactWebChatProps } from './component/minimal';\nexport { default as createDirectLine } from './private/createDirectLine';\nexport { default as createDirectLineAppServiceExtension } from './private/createDirectLineAppServiceExtension';\nexport { renderWebChat } from './renderWebChat/minimal';\nexport { type StrictStyleOptions, type StyleOptions } from './styleOptions/minimal';\nexport { buildInfoObject as buildInfo, version };\n","import { WebSpeechPonyfill } from 'botframework-webchat-api';\n\nexport default function createBrowserWebSpeechPonyfillFactory(): () => WebSpeechPonyfill {\n  if (!window.SpeechRecognition && !window.webkitSpeechRecognition) {\n    console.warn('Web Chat: This browser does not support Web Speech API Speech Recognition.');\n  }\n\n  if (!window.speechSynthesis) {\n    console.warn('Web Chat: This browser does not support Web Speech API Speech Synthesis.');\n  }\n\n  return () => ({\n    SpeechGrammarList: window.SpeechGrammarList || window.webkitSpeechGrammarList,\n    SpeechRecognition:\n      window.SpeechRecognition ||\n      (window.webkitSpeechRecognition\n        ? Object.assign(window.webkitSpeechRecognition, {\n            available: (): Promise<AvailabilityStatus> => Promise.resolve('unavailable'),\n            install: (): Promise<boolean> => Promise.resolve(false)\n          })\n        : undefined),\n    speechSynthesis: window.speechSynthesis,\n    SpeechSynthesisUtterance: window.SpeechSynthesisUtterance\n  });\n}\n","import { DirectLine } from 'botframework-directlinejs';\n\ntype CreateDirectLineOptions = {\n  botAgent?: string;\n  conversationId?: string;\n  conversationStartProperties?: any;\n  domain?: string;\n  fetch?: typeof window.fetch;\n  pollingInterval?: number;\n  secret?: string;\n  streaming?: boolean;\n  streamUrl?: string;\n  token?: string;\n  watermark?: string;\n  webSocket?: typeof WebSocket;\n};\n\nexport default function createDirectLine({\n  botAgent,\n  conversationId,\n  conversationStartProperties,\n  domain,\n  fetch,\n  pollingInterval,\n  secret,\n  streaming,\n  streamUrl,\n  token,\n  watermark,\n  webSocket\n}: CreateDirectLineOptions) {\n  // TODO: [P3] Checks if DLJS supports ponyfilling fetch.\n  return new DirectLine({\n    botAgent,\n    conversationId,\n    conversationStartProperties,\n    domain,\n    fetch,\n    pollingInterval,\n    secret,\n    streaming,\n    streamUrl,\n    token,\n    watermark,\n    webSocket,\n    createFormData: attachments => {\n      const formData = new FormData();\n\n      attachments.forEach(\n        ({\n          contentType,\n          data,\n          filename,\n          name\n        }: {\n          contentType?: string;\n          data: BlobPart[];\n          filename?: string;\n          name?: string;\n        }) => {\n          formData.append(name, new Blob(data, { type: contentType }), filename);\n        }\n      );\n\n      return formData;\n    }\n  } as any);\n}\n","import { type ReadonlyBuildInfo } from '@msinternal/botframework-webchat-base/utils';\n\nexport default function getBotAgent(buildInfo: ReadonlyBuildInfo): `WebChat/${string} (${string})` {\n  switch (buildInfo.get('variant')) {\n    case 'full':\n      return `WebChat/${buildInfo.version} (Full)`;\n\n    case 'full-es5':\n      return `WebChat/${buildInfo.version} (ES5)`;\n\n    case 'minimal':\n      return `WebChat/${buildInfo.version} (Minimal)`;\n\n    default:\n      return `WebChat/${buildInfo.version} (Unknown)`;\n  }\n}\n","import buildInfo from '../../../buildInfo';\nimport defaultCreateDirectLine from '../../../createDirectLine';\nimport getBotAgent from './getBotAgent';\n\nexport default function createDirectLine(options: Omit<Parameters<typeof defaultCreateDirectLine>[0], 'botAgent'>) {\n  (options as any).botAgent &&\n    console.warn(\n      'Web Chat: Developers are not currently allowed to set botAgent. See https://github.com/microsoft/BotFramework-WebChat/issues/2119 for more details.'\n    );\n\n  // TODO: Put the \"botAgent\" string in \"define\" could simplify code here..\n  return defaultCreateDirectLine({ ...options, botAgent: getBotAgent(buildInfo) });\n}\n","import { DirectLineStreaming } from 'botframework-directlinejs';\n\nexport default function createDirectLineAppServiceExtension({\n  botAgent,\n  conversationId,\n  domain,\n  token\n}: {\n  botAgent?: string;\n  conversationId?: string;\n  domain?: string;\n  token: string;\n}): Promise<any> {\n  return Promise.resolve(\n    new DirectLineStreaming({\n      botAgent,\n      conversationId,\n      domain,\n      token\n    })\n  );\n}\n","import buildInfo from '../../../buildInfo';\nimport defaultCreateDirectLineAppServiceExtension from '../../../createDirectLineAppServiceExtension';\nimport getBotAgent from './getBotAgent';\n\nexport default function createDirectLineAppServiceExtension(\n  options: Omit<Parameters<typeof defaultCreateDirectLineAppServiceExtension>[0], 'botAgent'>\n) {\n  (options as any).botAgent &&\n    console.warn(\n      'Web Chat: Developers are not currently allowed to set botAgent. See https://github.com/microsoft/BotFramework-WebChat/issues/2119 for more details.'\n    );\n\n  return defaultCreateDirectLineAppServiceExtension({ ...options, botAgent: getBotAgent(buildInfo) });\n}\n","import React, { ComponentType } from 'react';\nimport ReactDOM from 'react-dom';\n\nexport default function renderWebChat(ReactWebChat: ComponentType<any>, props: any, element: HTMLElement): void {\n  ReactDOM.render(<ReactWebChat {...props} />, element);\n}\n","import coreRenderWebChat from '../../../renderWebChat';\nimport { ReactWebChat } from '../component/minimal';\n\nconst renderWebChat = coreRenderWebChat.bind(null, ReactWebChat);\n\nexport { renderWebChat };\n","import { createStyleSet } from 'botframework-webchat-component';\n\nimport createAdaptiveCardsStyleSet from './adaptiveCards/Styles/createAdaptiveCardsStyleSet';\nimport type { FullBundleStyleOptions } from './types/FullBundleStyleOptions';\n\n// TODO: [P4] We should add a notice for people who want to use \"styleSet\" instead of \"styleOptions\".\n//       \"styleSet\" is actually CSS stylesheet and it is based on the DOM tree.\n//       DOM tree may change from time to time, thus, maintaining \"styleSet\" becomes a constant effort.\n\nexport default function createFullStyleSet(options: FullBundleStyleOptions) {\n  return {\n    ...createStyleSet(options),\n    ...createAdaptiveCardsStyleSet(options)\n  };\n}\n","import coreRenderWebChat from '../../../renderWebChat';\nimport { ReactWebChat } from '../component/full';\n\nconst renderWebChat = coreRenderWebChat.bind(null, ReactWebChat);\n\nexport { renderWebChat };\n","/* eslint class-methods-use-this: \"off\" */\n/* eslint complexity: [\"error\", 70] */\n/* eslint no-await-in-loop: \"off\" */\n/* eslint no-empty-function: \"off\" */\n/* eslint no-magic-numbers: [\"error\", { \"ignore\": [0, 100, 150] }] */\n\nimport { PropertyId } from 'microsoft-cognitiveservices-speech-sdk';\nimport patchOptions, { type PatchOptionsInit } from '../patchOptions.ts';\nimport SpeechSDK from '../SpeechSDK.ts';\nimport createSpeechRecognitionPonyfillFromRecognizer from './createSpeechRecognitionPonyfillFromRecognizer.ts';\n\nconst { OutputFormat, SpeechConfig, SpeechRecognizer } = SpeechSDK;\n\nexport default function createSpeechRecognitionPonyfill(options: PatchOptionsInit) {\n  const {\n    audioConfig,\n    enableTelemetry,\n    fetchCredentials,\n    initialSilenceTimeout,\n    looseEvents,\n    referenceGrammars,\n    speechRecognitionEndpointId,\n    textNormalization\n  } = patchOptions(options);\n\n  if (!audioConfig && (!window.navigator.mediaDevices || !window.navigator.mediaDevices.getUserMedia)) {\n    throw new Error(\n      'web-speech-cognitive-services: This browser does not support Media Capture and Streams API and it will not work with Cognitive Services Speech Services.'\n    );\n  }\n\n  const createRecognizer = async (lang: string) => {\n    const credentials = await fetchCredentials();\n    let speechConfig;\n\n    if (typeof credentials.speechRecognitionHostname !== 'undefined') {\n      const host = new URL('wss://localhost:443');\n\n      host.hostname = credentials.speechRecognitionHostname;\n\n      if (credentials.authorizationToken) {\n        speechConfig = SpeechConfig.fromHost(host);\n        speechConfig.authorizationToken = credentials.authorizationToken;\n      } else {\n        speechConfig = SpeechConfig.fromHost(host, credentials.subscriptionKey);\n      }\n    } else {\n      speechConfig =\n        typeof credentials.authorizationToken !== 'undefined'\n          ? SpeechConfig.fromAuthorizationToken(credentials.authorizationToken, credentials.region)\n          : SpeechConfig.fromSubscription(credentials.subscriptionKey, credentials.region);\n    }\n\n    if (speechRecognitionEndpointId) {\n      speechConfig.endpointId = speechRecognitionEndpointId;\n    }\n\n    speechConfig.outputFormat = OutputFormat.Detailed;\n    speechConfig.speechRecognitionLanguage = lang || 'en-US';\n    typeof initialSilenceTimeout === 'number' &&\n      speechConfig.setProperty(PropertyId.SpeechServiceConnection_InitialSilenceTimeoutMs, '' + initialSilenceTimeout);\n\n    return new SpeechRecognizer(speechConfig, audioConfig);\n  };\n\n  return createSpeechRecognitionPonyfillFromRecognizer({\n    createRecognizer,\n    enableTelemetry,\n    looseEvents,\n    referenceGrammars,\n    textNormalization\n  });\n}\n","import { type AudioConfig as AudioConfigType } from 'microsoft-cognitiveservices-speech-sdk';\nimport { parse } from 'valibot';\n\nimport resolveFunctionOrReturnValue from './resolveFunctionOrReturnValue.ts';\nimport SpeechSDK from './SpeechSDK.ts';\nimport credentialsSchema, { type Credentials } from './SpeechToText/validation/credentialsSchema.ts';\nimport enableTelemetrySchema, { EnableTelemetry } from './SpeechToText/validation/enableTelemetrySchema.ts';\nimport initialSilenceTimeoutSchema, {\n  InitialSilenceTimeout\n} from './SpeechToText/validation/initialSilenceTimeoutSchema.ts';\nimport looseEventsSchema, { LooseEvents } from './SpeechToText/validation/looseEventsSchema.ts';\nimport referenceGrammarsSchema, { ReferenceGrammars } from './SpeechToText/validation/referenceGrammarsSchema.ts';\nimport speechRecognitionEndpointIdSchema, {\n  SpeechRecognitionEndpointId\n} from './SpeechToText/validation/speechRecognitionEndpointIdSchema.ts';\nimport textNormalizationSchema, { TextNormalization } from './SpeechToText/validation/textNormalizationSchema.ts';\n\nconst { AudioConfig } = SpeechSDK;\n\nlet shouldWarnOnSubscriptionKey = true;\n\ntype PatchOptionsInit = {\n  audioConfig?: AudioConfigType | undefined;\n  credentials: (() => Credentials | Promise<Credentials>) | Credentials | Promise<Credentials>;\n  enableTelemetry?: boolean | undefined;\n  initialSilenceTimeout?: number | undefined;\n  looseEvent?: boolean | undefined;\n  looseEvents?: boolean | undefined;\n  referenceGrammars?: readonly string[] | undefined;\n  speechRecognitionEndpointId?: string | undefined;\n  textNormalization?: 'display' | 'itn' | 'lexical' | 'maskeditn' | undefined;\n};\n\ntype PatchedOptions = Readonly<{\n  audioConfig: AudioConfigType;\n  enableTelemetry: EnableTelemetry;\n  fetchCredentials: () => Promise<Credentials>;\n  initialSilenceTimeout: InitialSilenceTimeout;\n  looseEvents: LooseEvents;\n  referenceGrammars: ReferenceGrammars;\n  speechRecognitionEndpointId: SpeechRecognitionEndpointId;\n  textNormalization: TextNormalization;\n}>;\n\nexport default function patchOptions(init: PatchOptionsInit): PatchedOptions {\n  const {\n    audioConfig,\n    credentials,\n    enableTelemetry,\n    initialSilenceTimeout,\n    looseEvent,\n    referenceGrammars,\n    speechRecognitionEndpointId,\n    textNormalization\n  } = init;\n\n  let { looseEvents } = init;\n\n  if (typeof looseEvent !== 'undefined') {\n    console.warn('web-speech-cognitive-services: The option \"looseEvent\" should be named as \"looseEvents\".');\n\n    looseEvents = looseEvent;\n  }\n\n  return Object.freeze({\n    audioConfig: audioConfig || AudioConfig.fromDefaultMicrophoneInput(),\n    // We set telemetry to true to honor the default telemetry settings of Speech SDK\n    // https://github.com/Microsoft/cognitive-services-speech-sdk-js#data--telemetry\n    enableTelemetry: parse(enableTelemetrySchema, enableTelemetry),\n    fetchCredentials: async () => {\n      const parsedCredentials = parse(credentialsSchema, await resolveFunctionOrReturnValue<Credentials>(credentials));\n\n      if (shouldWarnOnSubscriptionKey && parsedCredentials.subscriptionKey) {\n        console.warn(\n          'web-speech-cognitive-services: In production environment, subscription key should not be used, authorization token should be used instead.'\n        );\n\n        shouldWarnOnSubscriptionKey = false;\n      }\n\n      return parsedCredentials;\n    },\n    initialSilenceTimeout: parse(initialSilenceTimeoutSchema, initialSilenceTimeout),\n    looseEvents: parse(looseEventsSchema, looseEvents),\n    referenceGrammars: parse(referenceGrammarsSchema, referenceGrammars),\n    speechRecognitionEndpointId: parse(speechRecognitionEndpointIdSchema, speechRecognitionEndpointId),\n    textNormalization: parse(textNormalizationSchema, textNormalization)\n  });\n}\n\nexport type { Credentials, PatchedOptions, PatchOptionsInit };\n","function isFunction(value: unknown): value is () => unknown {\n  return typeof value === 'function';\n}\n\nexport default function resolveFunctionOrReturnValue<T>(\n  fnOrValue: (() => Promise<T> | T) | Promise<T> | T\n): Promise<T> | T {\n  return isFunction(fnOrValue) ? fnOrValue() : fnOrValue;\n}\n","// We are only importing what we need.\n\nimport {\n  AudioConfig,\n  OutputFormat,\n  ResultReason,\n  SpeechConfig,\n  SpeechRecognizer\n} from 'microsoft-cognitiveservices-speech-sdk/distrib/lib/microsoft.cognitiveservices.speech.sdk.js';\n\nconst SpeechSDK = {\n  AudioConfig,\n  OutputFormat,\n  ResultReason,\n  SpeechConfig,\n  SpeechRecognizer\n};\n\nexport default SpeechSDK;\n","import { type InferOutput, intersect, object, optional, pipe, readonly, string, undefined_, union } from 'valibot';\n\nconst credentialsSchema = pipe(\n  intersect([\n    union(\n      [\n        object({\n          authorizationToken: string(),\n          subscriptionKey: optional(undefined_('\"subscriptionKey\" must be unset when \"authorizationToken\" is set.'))\n        }),\n        object({\n          authorizationToken: optional(undefined_('\"authorizationToken\" must be unset when \"subscriptionKey\" is set.')),\n          subscriptionKey: string()\n        })\n      ],\n      'The object must either have either \"authorizationToken\" or \"subscriptionKey\" set, but not both.'\n    ),\n    union(\n      [\n        object({\n          customVoiceHostname: optional(undefined_('\"customVoiceHostname\" must be unest when \"region\" is set.')),\n          region: string(),\n          speechRecognitionHostname: optional(\n            undefined_('\"speechRecognitionHostname\" must be unest when \"region\" is set.')\n          ),\n          speechSynthesisHostname: optional(undefined_('\"speechSynthesisHostname\" must be unest when \"region\" is set.'))\n        }),\n        object({\n          customVoiceHostname: optional(union([string(), undefined_()])),\n          region: optional(undefined_('\"region\" must be unset when \"*Hostname\" is set.')),\n          speechRecognitionHostname: string(),\n          speechSynthesisHostname: string()\n        })\n      ],\n      'The object must either have either \"region\" or \"*Hostname\" set, but not both.'\n    )\n  ]),\n  readonly()\n);\n\nexport default credentialsSchema;\n\nexport type Credentials = InferOutput<typeof credentialsSchema>;\n","import { boolean, type InferOutput, optional } from 'valibot';\n\nconst enableTelemetrySchema = optional(boolean());\n\nexport type EnableTelemetry = InferOutput<typeof enableTelemetrySchema>;\n\nexport default enableTelemetrySchema;\n","import { type InferOutput, maxValue, minValue, number, optional, pipe } from 'valibot';\n\n// 60_000 is an arbitrary value, we can set it to a larger number.\nconst initialSilenceTimeoutSchema = optional(pipe(number(), minValue(1), maxValue(60_000)));\n\nexport type InitialSilenceTimeout = InferOutput<typeof initialSilenceTimeoutSchema>;\n\nexport default initialSilenceTimeoutSchema;\n","import { type InferOutput, boolean, optional } from 'valibot';\n\nconst looseEventsSchema = optional(boolean(), false);\n\nexport type LooseEvents = InferOutput<typeof looseEventsSchema>;\n\nexport default looseEventsSchema;\n","import { array, type InferOutput, optional, pipe, string, transform } from 'valibot';\n\nconst referenceGrammarsSchema = pipe(\n  optional(array(string()), []),\n  // any(),\n  // array(string()),\n  // transform<string[], readonly string[]>(value => (Object.isFrozen(value) ? value : Object.freeze([...value])))\n  transform<string[], readonly string[]>(value => (Object.isFrozen(value) ? value : Object.freeze([...value])))\n);\n\nexport type ReferenceGrammars = InferOutput<typeof referenceGrammarsSchema>;\n\nexport default referenceGrammarsSchema;\n","import { type InferOutput, optional, string } from 'valibot';\n\nconst speechRecognitionEndpointIdSchema = optional(string());\n\nexport type SpeechRecognitionEndpointId = InferOutput<typeof speechRecognitionEndpointIdSchema>;\n\nexport default speechRecognitionEndpointIdSchema;\n","import { type InferOutput, enum_, optional } from 'valibot';\n\nconst textNormalizationSchema = optional(\n  enum_({\n    display: 'display',\n    itn: 'itn',\n    lexical: 'lexical',\n    maskeditn: 'maskeditn'\n  }),\n  'display'\n);\n\nexport type TextNormalization = InferOutput<typeof textNormalizationSchema>;\n\nexport default textNormalizationSchema;\n","/* eslint class-methods-use-this: \"off\" */\n/* eslint complexity: [\"error\", 70] */\n/* eslint no-await-in-loop: \"off\" */\n/* eslint no-empty-function: \"off\" */\n/* eslint no-magic-numbers: [\"error\", { \"ignore\": [0, 100, 150] }] */\n\nimport {\n  type CancellationEventArgs,\n  type RecognitionEventArgs,\n  type SessionEventArgs,\n  type SpeechRecognitionEventArgs,\n  type SpeechRecognizer as SpeechRecognizerType\n} from 'microsoft-cognitiveservices-speech-sdk';\nimport { type AudioConfigImpl } from 'microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/AudioConfig.js';\nimport { boolean, function_, parse, undefined_, union } from 'valibot';\nimport createPromiseQueue from '../../Util/createPromiseQueue.js';\nimport SpeechSDK from '../SpeechSDK.ts';\nimport cognitiveServiceEventResultToWebSpeechRecognitionResult from './cognitiveServiceEventResultToWebSpeechRecognitionResult.ts';\nimport cognitiveServicesAsyncToPromise from './cognitiveServicesAsyncToPromise.ts';\nimport EventListenerMap from './private/EventListenerMap.ts';\nimport prepareAudioConfig from './private/prepareAudioConfig.ts';\nimport serializeRecognitionResult from './private/serializeRecognitionResult.ts';\nimport SpeechGrammarList from './SpeechGrammarList.ts';\nimport SpeechRecognitionErrorEvent from './SpeechRecognitionErrorEvent.ts';\nimport SpeechRecognitionEvent from './SpeechRecognitionEvent.ts';\nimport { type SpeechRecognitionEventListenerMap } from './SpeechRecognitionEventListenerMap.ts';\nimport type SpeechRecognitionResult from './SpeechRecognitionResult.ts';\nimport SpeechRecognitionResultList from './SpeechRecognitionResultList.ts';\nimport referenceGrammarsSchema from './validation/referenceGrammarsSchema.ts';\nimport textNormalizationSchema from './validation/textNormalizationSchema.ts';\n\n// https://docs.microsoft.com/en-us/javascript/api/microsoft-cognitiveservices-speech-sdk/speechconfig?view=azure-node-latest#outputformat\n// {\n//   \"RecognitionStatus\": \"Success\",\n//   \"Offset\": 900000,\n//   \"Duration\": 49000000,\n//   \"NBest\": [\n//     {\n//       \"Confidence\": 0.738919,\n//       \"Lexical\": \"second\",\n//       \"ITN\": \"second\",\n//       \"MaskedITN\": \"second\",\n//       \"Display\": \"Second.\"\n//     }\n//   ]\n// }\n\n// {\n//   \"RecognitionStatus\": \"InitialSilenceTimeout\",\n//   \"Offset\": 50000000,\n//   \"Duration\": 0\n// }\n\nconst { ResultReason, SpeechRecognizer } = SpeechSDK;\n\ntype CreateSpeechRecognitionPonyfillFromRecognizerInit = {\n  createRecognizer: (lang: string) => Promise<SpeechRecognizerType>;\n  enableTelemetry: boolean | undefined;\n  looseEvents: boolean;\n  referenceGrammars?: readonly string[] | undefined;\n  textNormalization: 'display' | 'itn' | 'lexical' | 'maskeditn';\n};\n\nconst enableTelemetrySchema = union([boolean(), undefined_()]);\n\nexport default function createSpeechRecognitionPonyfillFromRecognizer({\n  createRecognizer,\n  enableTelemetry,\n  looseEvents,\n  referenceGrammars,\n  textNormalization\n}: CreateSpeechRecognitionPonyfillFromRecognizerInit) {\n  createRecognizer = parse(function_(), createRecognizer) as typeof createRecognizer;\n  enableTelemetry = parse(enableTelemetrySchema, enableTelemetry);\n  looseEvents = parse(boolean(), looseEvents);\n  referenceGrammars = parse(referenceGrammarsSchema, referenceGrammars);\n  textNormalization = parse(textNormalizationSchema, textNormalization);\n\n  // If enableTelemetry is set to null or non-boolean, we will default to true.\n  typeof enableTelemetry !== 'undefined' && SpeechRecognizer.enableTelemetry(enableTelemetry);\n\n  class SpeechRecognition extends EventTarget {\n    #continuous = false;\n    #eventListenerMap: SpeechRecognitionEventListenerMap = new EventListenerMap(this);\n    #grammars: SpeechGrammarList = new SpeechGrammarList();\n    #interimResults = false;\n    #lang =\n      typeof window !== 'undefined'\n        ? window.document.documentElement.getAttribute('lang') || window.navigator.language\n        : 'en-US';\n    // eslint-disable-next-line no-magic-numbers\n    #maxAlternatives: number = 1;\n\n    emitCognitiveServices<T extends { type: string }>(type: string, event: T) {\n      this.dispatchEvent(\n        new SpeechRecognitionEvent('cognitiveservices', {\n          data: {\n            ...event,\n            type\n          }\n        })\n      );\n    }\n\n    get continuous(): boolean {\n      return this.#continuous;\n    }\n\n    set continuous(value: boolean) {\n      this.#continuous = value;\n    }\n\n    get grammars(): SpeechGrammarList {\n      return this.#grammars;\n    }\n\n    set grammars(value: SpeechGrammarList) {\n      if (value instanceof SpeechGrammarList) {\n        this.#grammars = value;\n      } else {\n        throw new Error(`The provided value is not of type 'SpeechGrammarList'`);\n      }\n    }\n\n    get interimResults() {\n      return this.#interimResults;\n    }\n\n    set interimResults(value) {\n      this.#interimResults = value;\n    }\n\n    get maxAlternatives() {\n      return this.#maxAlternatives;\n    }\n\n    set maxAlternatives(value) {\n      this.#maxAlternatives = value;\n    }\n\n    get lang() {\n      return this.#lang;\n    }\n\n    set lang(value) {\n      this.#lang = value;\n    }\n\n    get onaudioend(): ((event: SpeechRecognitionEvent<'audioend'>) => void) | undefined {\n      return this.#eventListenerMap.getProperty('audioend');\n    }\n\n    set onaudioend(value: ((event: SpeechRecognitionEvent<'audioend'>) => void) | undefined) {\n      this.#eventListenerMap.setProperty('audioend', value);\n    }\n\n    /** @type { ((event: SpeechRecognitionEvent<'audiostart'>) => void) | undefined } */\n    get onaudiostart() {\n      return this.#eventListenerMap.getProperty('audiostart');\n    }\n\n    set onaudiostart(\n      /** @type { ((event: SpeechRecognitionEvent<'audiostart'>) => void) | undefined } */\n      value\n    ) {\n      this.#eventListenerMap.setProperty('audiostart', value);\n    }\n\n    /** @type { ((event: SpeechRecognitionEvent<'cognitiveservices'>) => void) | undefined } */\n    get oncognitiveservices() {\n      return this.#eventListenerMap.getProperty('cognitiveservices');\n    }\n\n    set oncognitiveservices(\n      /** @type { ((event: SpeechRecognitionEvent<'cognitiveservices'>) => void) | undefined } */\n      value\n    ) {\n      this.#eventListenerMap.setProperty('cognitiveservices', value);\n    }\n\n    /** @type { ((event: SpeechRecognitionEvent<'end'>) => void) | undefined } */\n    get onend() {\n      return this.#eventListenerMap.getProperty('end');\n    }\n\n    set onend(\n      /** @type { ((event: SpeechRecognitionEvent<'end'>) => void) | undefined } */\n      value\n    ) {\n      this.#eventListenerMap.setProperty('end', value);\n    }\n\n    /** @type { ((event: SpeechRecognitionErrorEvent) => void) | undefined } */\n    get onerror() {\n      return this.#eventListenerMap.getProperty('error');\n    }\n\n    set onerror(\n      /** @type { ((event: SpeechRecognitionErrorEvent) => void) | undefined } */\n      value\n    ) {\n      this.#eventListenerMap.setProperty('error', value);\n    }\n\n    /** @type { ((event: SpeechRecognitionEvent<'result'>) => void) | undefined } */\n    get onresult() {\n      return this.#eventListenerMap.getProperty('result');\n    }\n\n    set onresult(\n      /** @type { ((event: SpeechRecognitionEvent<'result'>) => void) | undefined } */\n      value\n    ) {\n      this.#eventListenerMap.setProperty('result', value);\n    }\n\n    /** @type { ((event: SpeechRecognitionEvent<'soundend'>) => void) | undefined } */\n    get onsoundend() {\n      return this.#eventListenerMap.getProperty('soundend');\n    }\n\n    set onsoundend(\n      /** @type { ((event: SpeechRecognitionEvent<'soundend'>) => void) | undefined } */\n      value\n    ) {\n      this.#eventListenerMap.setProperty('soundend', value);\n    }\n\n    /** @type { ((event: SpeechRecognitionEvent<'soundstart'>) => void) | undefined } */\n    get onsoundstart() {\n      return this.#eventListenerMap.getProperty('soundstart');\n    }\n\n    set onsoundstart(\n      /** @type { ((event: SpeechRecognitionEvent<'soundstart'>) => void) | undefined } */\n      value\n    ) {\n      this.#eventListenerMap.setProperty('soundstart', value);\n    }\n\n    /** @type { ((event: SpeechRecognitionEvent<'speechend'>) => void) | undefined } */\n    get onspeechend() {\n      return this.#eventListenerMap.getProperty('speechend');\n    }\n\n    set onspeechend(\n      /** @type { ((event: SpeechRecognitionEvent<'speechend'>) => void) | undefined } */\n      value\n    ) {\n      this.#eventListenerMap.setProperty('speechend', value);\n    }\n\n    /** @type { ((event: SpeechRecognitionEvent<'speechstart'>) => void) | undefined } */\n    get onspeechstart() {\n      return this.#eventListenerMap.getProperty('speechstart');\n    }\n\n    set onspeechstart(\n      /** @type { ((event: SpeechRecognitionEvent<'speechstart'>) => void) | undefined } */\n      value\n    ) {\n      this.#eventListenerMap.setProperty('speechstart', value);\n    }\n\n    /** @type { ((event: SpeechRecognitionEvent<'start'>) => void) | undefined } */\n    get onstart() {\n      return this.#eventListenerMap.getProperty('start');\n    }\n\n    set onstart(\n      /** @type { ((event: SpeechRecognitionEvent<'start'>) => void) | undefined } */\n      value\n    ) {\n      this.#eventListenerMap.setProperty('start', value);\n    }\n\n    abort: (() => void) | undefined;\n    stop: (() => void) | undefined;\n\n    start() {\n      this._startOnce().catch(err => {\n        this.dispatchEvent(\n          new SpeechRecognitionErrorEvent('error', { error: err, message: err && (err.stack || err.message) })\n        );\n      });\n    }\n\n    async _startOnce() {\n      // TODO: [P2] Should check if recognition is active, we should not start recognition twice\n      const recognizer = await createRecognizer(this.lang);\n\n      const { pause, unprepare } = prepareAudioConfig(recognizer['audioConfig']);\n\n      try {\n        const queue = createPromiseQueue();\n        let soundStarted;\n        let speechStarted;\n        let stopping;\n\n        const { detach: detachAudioConfigEvent } = (recognizer['audioConfig'] as AudioConfigImpl).events.attach(\n          event => {\n            const { name } = event;\n\n            if (name === 'AudioSourceReadyEvent') {\n              queue.push({ audioSourceReady: {} });\n            } else if (name === 'AudioSourceOffEvent') {\n              queue.push({ audioSourceOff: {} });\n            } else if (name === 'FirstAudibleChunk') {\n              queue.push({ firstAudibleChunk: {} });\n            }\n          }\n        );\n\n        recognizer.canceled = (_, { errorDetails, offset, reason, sessionId }: CancellationEventArgs) => {\n          queue.push({\n            canceled: {\n              errorDetails,\n              offset,\n              reason,\n              sessionId\n            }\n          });\n        };\n\n        recognizer.recognized = (_, { offset, result, sessionId }: SpeechRecognitionEventArgs) => {\n          queue.push({\n            recognized: {\n              offset,\n              result: serializeRecognitionResult(result),\n              sessionId\n            }\n          });\n        };\n\n        recognizer.recognizing = (_, { offset, result, sessionId }: SpeechRecognitionEventArgs) => {\n          queue.push({\n            recognizing: {\n              offset,\n              result: serializeRecognitionResult(result),\n              sessionId\n            }\n          });\n        };\n\n        recognizer.sessionStarted = (_, { sessionId }: SessionEventArgs) => {\n          queue.push({ sessionStarted: { sessionId } });\n        };\n\n        recognizer.sessionStopped = (_, { sessionId }: SessionEventArgs) => {\n          // \"sessionStopped\" is never fired, probably because we are using startContinuousRecognitionAsync instead of recognizeOnceAsync.\n          queue.push({ sessionStopped: { sessionId } });\n        };\n\n        recognizer.speechStartDetected = (_, { offset, sessionId }: RecognitionEventArgs) => {\n          queue.push({ speechStartDetected: { offset, sessionId } });\n        };\n\n        recognizer.speechEndDetected = (_, { sessionId }: RecognitionEventArgs) => {\n          // \"speechEndDetected\" is never fired, probably because we are using startContinuousRecognitionAsync instead of recognizeOnceAsync.\n          // Update: \"speechEndDetected\" is fired for DLSpeech.listenOnceAsync()\n          queue.push({ speechEndDetected: { sessionId } });\n        };\n\n        const { phrases } = this.grammars;\n\n        // HACK: We are using the internal of SpeechRecognizer because they did not expose it\n        const { dynamicGrammar } = recognizer['privReco'];\n\n        referenceGrammars && referenceGrammars.length && dynamicGrammar.addReferenceGrammar([...referenceGrammars]);\n        phrases && phrases.length && dynamicGrammar.addPhrase([...phrases]);\n\n        await cognitiveServicesAsyncToPromise<void>(recognizer.startContinuousRecognitionAsync, recognizer)();\n\n        if (typeof recognizer.stopContinuousRecognitionAsync === 'function') {\n          this.abort = () => queue.push({ abort: {} });\n          this.stop = () => queue.push({ stop: {} });\n        } else {\n          this.abort = this.stop = undefined;\n        }\n\n        let audioStarted;\n        let finalEvent: SpeechRecognitionErrorEvent | SpeechRecognitionEvent<'result'> | undefined = undefined;\n        let finalizedResults: readonly SpeechRecognitionResult[] = [];\n\n        for (let loop = 0; !stopping || audioStarted; loop++) {\n          const event = await queue.shift();\n          const {\n            abort,\n            audioSourceOff,\n            audioSourceReady,\n            canceled,\n            firstAudibleChunk,\n            recognized,\n            recognizing,\n            stop\n          } = event;\n\n          // We are emitting event \"cognitiveservices\" for debugging purpose.\n          Object.keys(event).forEach(name => this.emitCognitiveServices(name, event[name]));\n\n          const errorMessage = canceled && canceled.errorDetails;\n\n          if (/Permission\\sdenied/u.test(errorMessage || '')) {\n            // If microphone is not allowed, we should not emit \"start\" event.\n\n            finalEvent = new SpeechRecognitionErrorEvent('error', { error: 'not-allowed' });\n\n            break;\n          }\n\n          if (!loop) {\n            this.dispatchEvent(new SpeechRecognitionEvent('start'));\n          }\n\n          if (errorMessage) {\n            if (/1006/u.test(errorMessage)) {\n              if (!audioStarted) {\n                this.dispatchEvent(new SpeechRecognitionEvent('audiostart'));\n                this.dispatchEvent(new SpeechRecognitionEvent('audioend'));\n              }\n\n              finalEvent = new SpeechRecognitionErrorEvent('error', { error: 'network' });\n            } else {\n              finalEvent = new SpeechRecognitionErrorEvent('error', { error: 'unknown' });\n            }\n\n            break;\n          } else if (abort || stop) {\n            if (abort) {\n              finalEvent = new SpeechRecognitionErrorEvent('error', { error: 'aborted' });\n\n              // If we are aborting, we will ignore lingering recognizing/recognized events. But if we are stopping, we need them.\n              stopping = 'abort';\n            } else {\n              // When we pause, we will send { isEnd: true }, Speech Services will send us \"recognized\" event.\n              pause();\n              stopping = 'stop';\n            }\n\n            // Abort should not be dispatched without support of \"stopContinuousRecognitionAsync\".\n            // But for defensive purpose, we make sure \"stopContinuousRecognitionAsync\" is available before we can call.\n            if (abort && recognizer.stopContinuousRecognitionAsync) {\n              await cognitiveServicesAsyncToPromise<void>(recognizer.stopContinuousRecognitionAsync, recognizer)();\n            }\n          } else if (audioSourceReady) {\n            this.dispatchEvent(new SpeechRecognitionEvent('audiostart'));\n\n            audioStarted = true;\n          } else if (firstAudibleChunk) {\n            this.dispatchEvent(new SpeechRecognitionEvent('soundstart'));\n\n            soundStarted = true;\n          } else if (audioSourceOff) {\n            // Looks like we don't need this line and all the tests are still working.\n            // Guessing probably stopping is already truthy.\n            // stopping = true;\n\n            speechStarted && this.dispatchEvent(new SpeechRecognitionEvent('speechend'));\n            soundStarted && this.dispatchEvent(new SpeechRecognitionEvent('soundend'));\n            audioStarted && this.dispatchEvent(new SpeechRecognitionEvent('audioend'));\n\n            audioStarted = soundStarted = speechStarted = false;\n\n            break;\n          } else if (stopping !== 'abort') {\n            if (recognized && recognized.result && recognized.result.reason === ResultReason.NoMatch) {\n              // Quirks: 2024-11-19 with Speech SDK 1.41.0\n              //   When microphone is muted, `reason` is `NoMatch` (0) in both interactive mode and continuous mode.\n              //   After receiving this \"recognized but no match\" event, both modes will continue to recognize speech with \"speechStartDetected\" and \"recognizing\" events.\n              //   That means, we need to end this manually in interactive mode, and continuous-but-stopping mode.\n              if (!this.continuous || stopping === 'stop') {\n                // Empty result will turn into \"no-speech\" later in the code.\n                finalEvent = new SpeechRecognitionEvent('result', {\n                  results: new SpeechRecognitionResultList(finalizedResults)\n                });\n\n                // Quirks: 2024-11-19 with Speech SDK 1.14.0\n                //   Speech SDK did not stop after NoMatch even in interactive mode.\n                recognizer.stopContinuousRecognitionAsync &&\n                  (await cognitiveServicesAsyncToPromise<void>(\n                    recognizer.stopContinuousRecognitionAsync,\n                    recognizer\n                  )());\n\n                // Quirks: 2024-11-19 with Speech SDK 1.14.0\n                //   After calling stopContinuousRecognitionAsync, no \"audioSourceOff\" is fired.\n\n                break;\n              }\n            } else if (recognized || recognizing) {\n              if (!audioStarted) {\n                // Unconfirmed prevention of quirks\n                this.dispatchEvent(new SpeechRecognitionEvent('audiostart'));\n\n                audioStarted = true;\n              }\n\n              if (!soundStarted) {\n                this.dispatchEvent(new SpeechRecognitionEvent('soundstart'));\n\n                soundStarted = true;\n              }\n\n              if (!speechStarted) {\n                this.dispatchEvent(new SpeechRecognitionEvent('speechstart'));\n\n                speechStarted = true;\n              }\n\n              if (recognized) {\n                const result = cognitiveServiceEventResultToWebSpeechRecognitionResult(recognized.result, {\n                  maxAlternatives: this.maxAlternatives,\n                  textNormalization\n                });\n\n                const recognizable = !!result[0]?.transcript;\n\n                if (recognizable) {\n                  finalizedResults = [...finalizedResults, result];\n\n                  this.continuous &&\n                    this.dispatchEvent(\n                      new SpeechRecognitionEvent('result', {\n                        results: new SpeechRecognitionResultList(finalizedResults)\n                      })\n                    );\n                }\n\n                // If it is continuous, we just sent the finalized results. So we don't need to send it again after \"audioend\" event.\n                if (this.continuous && recognizable) {\n                  finalEvent = undefined;\n                } else {\n                  finalEvent = new SpeechRecognitionEvent('result', {\n                    results: new SpeechRecognitionResultList(finalizedResults)\n                  });\n                }\n\n                // If it is interactive, stop after first recognition.\n                // If it is continuous and it is stopping, stop it too.\n                if ((!this.continuous || stopping === 'stop') && recognizer.stopContinuousRecognitionAsync) {\n                  await cognitiveServicesAsyncToPromise<void>(recognizer.stopContinuousRecognitionAsync, recognizer)();\n                }\n\n                // If event order can be loosened, we can send the recognized event as soon as we receive it.\n                // 1. If it is not recognizable (no-speech), we should send an \"error\" event just before \"end\" event. We will not loosen \"error\" events.\n                if (looseEvents && finalEvent && recognizable) {\n                  this.dispatchEvent(finalEvent);\n                  finalEvent = undefined;\n                }\n              } else if (recognizing) {\n                this.interimResults &&\n                  this.dispatchEvent(\n                    new SpeechRecognitionEvent('result', {\n                      results: new SpeechRecognitionResultList([\n                        ...finalizedResults,\n                        cognitiveServiceEventResultToWebSpeechRecognitionResult(recognizing.result, {\n                          maxAlternatives: this.maxAlternatives,\n                          textNormalization\n                        })\n                      ])\n                    })\n                  );\n              }\n            }\n          }\n        }\n\n        if (speechStarted) {\n          this.dispatchEvent(new SpeechRecognitionEvent('speechend'));\n        }\n\n        if (soundStarted) {\n          this.dispatchEvent(new SpeechRecognitionEvent('soundend'));\n        }\n\n        if (audioStarted) {\n          this.dispatchEvent(new SpeechRecognitionEvent('audioend'));\n        }\n\n        if (finalEvent) {\n          if (finalEvent.type === 'result' && !finalEvent.results.length) {\n            finalEvent = new SpeechRecognitionErrorEvent('error', { error: 'no-speech' });\n          }\n\n          this.dispatchEvent(finalEvent);\n        }\n\n        // Even though there is no \"start\" event emitted, we will still emit \"end\" event\n        // This is mainly for \"microphone blocked\" story.\n        this.dispatchEvent(new SpeechRecognitionEvent('end'));\n\n        detachAudioConfigEvent();\n      } catch (err) {\n        // Logging out the erorr because Speech SDK would fail silently.\n        console.error(err);\n\n        throw err;\n      } finally {\n        unprepare();\n        recognizer['dispose'](false);\n      }\n    }\n  }\n\n  return {\n    SpeechGrammarList,\n    SpeechRecognition,\n    SpeechRecognitionEvent\n  };\n}\n","export default function pDefer() {\n\tconst deferred = {};\n\n\tdeferred.promise = new Promise((resolve, reject) => {\n\t\tdeferred.resolve = resolve;\n\t\tdeferred.reject = reject;\n\t});\n\n\treturn deferred;\n}\n","import createDeferred from 'p-defer';\n\nexport default function createPromiseQueue() {\n  let shiftDeferred;\n  const queue = [];\n\n  const push = value => {\n    if (shiftDeferred) {\n      const { resolve } = shiftDeferred;\n\n      shiftDeferred = null;\n      resolve(value);\n    } else {\n      queue.push(value);\n    }\n  };\n\n  const shift = () => {\n    if (queue.length) {\n      return Promise.resolve(queue.shift());\n    }\n\n    return (shiftDeferred || (shiftDeferred = createDeferred())).promise;\n  };\n\n  return {\n    push,\n    shift\n  };\n}\n","export type SpeechRecognitionAlternativeInit = {\n  confidence: number;\n  transcript: string;\n};\n\nexport default class SpeechRecognitionAlternative {\n  constructor({ confidence, transcript }: SpeechRecognitionAlternativeInit) {\n    this.#confidence = confidence;\n    this.#transcript = transcript;\n  }\n\n  #confidence: number;\n  #transcript: string;\n\n  get confidence() {\n    return this.#confidence;\n  }\n\n  get transcript() {\n    return this.#transcript;\n  }\n}\n","interface FakeArrayInterface<T> {\n  [index: number]: T | undefined;\n  get length(): number;\n}\n\nexport default class FakeArray<T> implements FakeArrayInterface<T> {\n  constructor(array: readonly T[]) {\n    if (!array) {\n      throw new Error('array must be set.');\n    }\n\n    this.#array = array;\n\n    for (const key in array) {\n      Object.defineProperty(this, key, {\n        enumerable: true,\n        get() {\n          return array[key];\n        }\n      });\n    }\n  }\n\n  #array: readonly T[];\n  [index: number]: T | undefined;\n  [Symbol.iterator]() {\n    return this.#array[Symbol.iterator]();\n  }\n\n  get length(): number {\n    return this.#array.length;\n  }\n}\n","import FakeArray from './private/FakeArray.ts';\n\nexport type SpeechRecognitionResultInit = {\n  isFinal: boolean;\n  results: readonly SpeechRecognitionAlternative[];\n};\n\nexport default class SpeechRecognitionResult extends FakeArray<SpeechRecognitionAlternative> {\n  constructor(init: SpeechRecognitionResultInit) {\n    super(init.results);\n\n    this.#isFinal = init.isFinal;\n  }\n\n  #isFinal: boolean;\n\n  get isFinal(): boolean {\n    return this.#isFinal;\n  }\n}\n","import SpeechSDK from '../SpeechSDK.ts';\n\nimport SpeechRecognitionAlternative from './SpeechRecognitionAlternative.ts';\nimport SpeechRecognitionResult from './SpeechRecognitionResult.ts';\nimport { type SerializedRecognitionResult } from './private/serializeRecognitionResult.ts';\n\nconst {\n  ResultReason: { RecognizingSpeech, RecognizedSpeech }\n} = SpeechSDK;\n\nexport default function cognitiveServiceEventResultToWebSpeechRecognitionResult(\n  result: SerializedRecognitionResult,\n  init?:\n    | {\n        maxAlternatives: number;\n        textNormalization: 'display' | 'itn' | 'lexical' | 'maskeditn';\n      }\n    | undefined\n): SpeechRecognitionResult {\n  const { maxAlternatives = Infinity, textNormalization = 'display' } = init || {};\n  const json: {\n    NBest: readonly {\n      Confidence: number;\n      Display: string;\n      ITN: string;\n      Lexical: string;\n      MaskedITN: string;\n    }[];\n  } = typeof result.json === 'string' ? JSON.parse(result.json) : result.json;\n\n  if (result.reason === RecognizingSpeech || (result.reason === RecognizedSpeech && !json.NBest)) {\n    return new SpeechRecognitionResult({\n      isFinal: result.reason === RecognizedSpeech,\n      results: [\n        new SpeechRecognitionAlternative({\n          confidence: 0.5,\n          transcript: result.text\n        })\n      ]\n    });\n  } else if (result.reason === RecognizedSpeech) {\n    return new SpeechRecognitionResult({\n      isFinal: true,\n      results: (json.NBest || []).slice(0, maxAlternatives).map(\n        ({ Confidence: confidence, Display: display, ITN: itn, Lexical: lexical, MaskedITN: maskedITN }) =>\n          new SpeechRecognitionAlternative({\n            confidence,\n            transcript:\n              textNormalization === 'itn'\n                ? itn\n                : textNormalization === 'lexical'\n                  ? lexical\n                  : textNormalization === 'maskeditn'\n                    ? maskedITN\n                    : display\n          })\n      )\n    });\n  }\n\n  return new SpeechRecognitionResult({ isFinal: false, results: [] });\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nexport default function cognitiveServicesAsyncToPromise<\n  R,\n  T extends (resolve: (returnValue: R) => void, reject: (error: unknown) => void) => void = (\n    resolve: (returnValue: R) => void,\n    reject: (error: unknown) => void\n  ) => void\n>(fn: T, context?: undefined | unknown): () => Promise<R>;\n\nexport default function cognitiveServicesAsyncToPromise<\n  R,\n  P0 = any,\n  T extends (arg0: P0, resolve: (returnValue: R) => void, reject: (error: unknown) => void) => void = (\n    arg0: P0,\n    resolve: (returnValue: R) => void,\n    reject: (error: unknown) => void\n  ) => void\n>(fn: T, context?: undefined | unknown): (arg0: P0) => Promise<R>;\n\nexport default function cognitiveServicesAsyncToPromise<\n  R,\n  P0 = any,\n  P1 = any,\n  T extends (arg0: P0, arg1: P1, resolve: (returnValue: R) => void, reject: (error: unknown) => void) => void = (\n    arg0: P0,\n    arg1: P1,\n    resolve: (returnValue: R) => void,\n    reject: (error: unknown) => void\n  ) => void\n>(fn: T, context?: undefined | unknown): (arg0: P0, arg1: P1) => Promise<R>;\n\nexport default function cognitiveServicesAsyncToPromise<\n  R,\n  P0 = any,\n  P1 = any,\n  P2 = any,\n  T extends (\n    arg0: P0,\n    arg1: P1,\n    arg2: P2,\n    resolve: (returnValue: R) => void,\n    reject: (error: unknown) => void\n  ) => void = (\n    arg0: P0,\n    arg1: P1,\n    arg2: P2,\n    resolve: (returnValue: R) => void,\n    reject: (error: unknown) => void\n  ) => void\n>(fn: T, context?: undefined | unknown): (arg0: P0, arg1: P1, arg2: P2) => Promise<R>;\n\nexport default function cognitiveServicesAsyncToPromise<\n  R,\n  P0 = any,\n  P1 = any,\n  P2 = any,\n  P3 = any,\n  T extends (\n    arg0: P0,\n    arg1: P1,\n    arg2: P2,\n    arg3: P3,\n    resolve: (returnValue: R) => void,\n    reject: (error: unknown) => void\n  ) => void = (\n    arg0: P0,\n    arg1: P1,\n    arg2: P2,\n    arg3: P3,\n    resolve: (returnValue: R) => void,\n    reject: (error: unknown) => void\n  ) => void\n>(fn: T, context?: undefined | unknown): (arg0: P0, arg1: P1, arg2: P2, arg3: P3) => Promise<R>;\n\nexport default function cognitiveServicesAsyncToPromise<\n  R,\n  T extends (...args: any[]) => void = (...args: any[]) => void\n>(fn: T, context: undefined | unknown = undefined): (...args: Parameters<T>) => Promise<R> {\n  return (...args: Parameters<T>) =>\n    // eslint-disable-next-line prefer-spread\n    new Promise<R>((resolve, reject) => fn.apply(context, [...args, resolve, reject] as unknown as Parameters<T>));\n}\n","type EventListener<T> = (event: T) => void;\n\nexport default class EventListenerMap<T extends string, EventMap extends { [Name in T]: unknown }> {\n  constructor(eventTarget: EventTarget) {\n    this.#eventTarget = eventTarget;\n    this.#propertyMap = {};\n  }\n\n  #eventTarget: EventTarget;\n  #propertyMap: { [Name in keyof EventMap]?: EventListener<EventMap[Name]> | undefined };\n\n  getProperty<U extends T>(name: U): ((event: EventMap[U]) => void) | undefined {\n    return this.#propertyMap[name];\n  }\n\n  setProperty<U extends T>(name: U, value: ((event: EventMap[U]) => void) | undefined) {\n    const existing = this.#propertyMap[name];\n\n    existing && this.#eventTarget.removeEventListener(name, existing as EventListener<Event>);\n\n    if (value) {\n      this.#eventTarget.addEventListener(name, value as EventListener<Event>);\n    }\n\n    this.#propertyMap[name] = value;\n  }\n}\n","import { AudioSourceEvent } from 'microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/AudioSourceEvents.js';\nimport {\n  type AudioConfig,\n  type AudioConfigImpl\n} from 'microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/AudioConfig.js';\nimport averageAmplitude from './averageAmplitude.ts';\n\nexport default function prepareAudioConfig(audioConfig: AudioConfig) {\n  // Speech SDK also force cast AudioConfig to AudioConfigImpl and pass it to ServiceRecognizerBase to use attach() and other methods.\n  // https://github.com/microsoft/cognitive-services-speech-sdk-js/blob/a6e9d2a202534565ccc97650861a6b296de48ecf/src/sdk/SpeechRecognizer.ts#L291C27-L291C43\n  const audioConfigImpl = audioConfig as AudioConfigImpl;\n  const originalAttach = audioConfigImpl.attach;\n  const boundOriginalAttach = audioConfigImpl.attach.bind(audioConfigImpl);\n  let firstChunk = false;\n  let muted = false;\n\n  // We modify \"attach\" function and detect when audible chunk is read.\n  // We will only modify \"attach\" function once.\n  audioConfigImpl.attach = async () => {\n    const reader = await boundOriginalAttach('');\n\n    return {\n      ...reader,\n      read: async () => {\n        const chunk = await reader.read();\n\n        // The magic number 150 is measured by:\n        // 1. Set microphone volume to 0\n        // 2. Observe the amplitude (100-110) for the first few chunks\n        //    (There is a short static caught when turning on the microphone)\n        // 3. Set the number a bit higher than the observation\n        if (!firstChunk && averageAmplitude(chunk.buffer) > 150) {\n          audioConfigImpl.events.onEvent(new AudioSourceEvent('FirstAudibleChunk', ''));\n          firstChunk = true;\n        }\n\n        if (muted) {\n          return { buffer: new ArrayBuffer(0), isEnd: true, timeReceived: Date.now() };\n        }\n\n        return chunk;\n      }\n    };\n  };\n\n  return {\n    audioConfig,\n    pause: () => {\n      muted = true;\n    },\n    unprepare: () => {\n      audioConfigImpl.attach = originalAttach;\n    }\n  };\n}\n","export default function averageAmplitude(arrayBuffer: ArrayBuffer): number {\n  const array = Array.from(new Int16Array(arrayBuffer));\n\n  return array.reduce((averageAmplitude, amplitude) => averageAmplitude + Math.abs(amplitude), 0) / array.length;\n}\n","import { type SpeechRecognitionResult } from 'microsoft-cognitiveservices-speech-sdk';\n\nexport type SerializedRecognitionResult = Readonly<{\n  duration: number;\n  errorDetails: string;\n  json: unknown;\n  offset: number;\n  properties: unknown;\n  reason: number;\n  resultId: string;\n  text: string;\n}>;\n\nexport default function serializeRecognitionResult({\n  duration,\n  errorDetails,\n  json,\n  offset,\n  properties,\n  reason,\n  resultId,\n  text\n}: SpeechRecognitionResult): SerializedRecognitionResult {\n  return Object.freeze({\n    duration,\n    errorDetails,\n    json: json && JSON.parse(json),\n    offset,\n    properties,\n    reason,\n    resultId,\n    text\n  });\n}\n","interface W3CSpeechGrammar {\n  src: string;\n  weight: number;\n}\n\ninterface W3CSpeechGrammarList {\n  readonly length: number;\n  addFromString(string: string, weight?: number): void;\n  addFromURI(src: string, weight?: number): void;\n  item(index: number): W3CSpeechGrammar;\n  [index: number]: W3CSpeechGrammar;\n}\n\n/* eslint class-methods-use-this: \"off\" */\n\nexport default class SpeechGrammarList implements W3CSpeechGrammarList {\n  constructor() {\n    this.#phrases = [];\n  }\n\n  addFromString() {\n    throw new Error('JSGF is not supported');\n  }\n\n  addFromURI() {\n    throw new Error('JSGF is not supported');\n  }\n\n  item(): W3CSpeechGrammar {\n    throw new Error('JSGF is not supported');\n  }\n\n  get length(): number {\n    throw new Error('JSGF is not supported');\n  }\n\n  [index: number]: { src: string; weight: number };\n\n  #phrases: readonly string[];\n\n  get phrases(): readonly string[] {\n    return this.#phrases;\n  }\n\n  set phrases(value: readonly string[]) {\n    if (Array.isArray(value)) {\n      this.#phrases = Object.freeze([...value]);\n    } else if (typeof value === 'string') {\n      this.#phrases = Object.freeze([value]);\n    } else {\n      throw new Error(`The provided value is not an array or of type 'string'`);\n    }\n  }\n}\n","export type SpeechRecognitionErrorType =\n  | 'aborted'\n  | 'audio-capture'\n  | 'bad-grammar'\n  | 'language-not-supported'\n  | 'network'\n  | 'no-speech'\n  | 'not-allowed'\n  | 'service-not-allowed'\n  | 'unknown';\n\nexport type SpeechRecognitionErrorEventInit = {\n  error: SpeechRecognitionErrorType;\n  message?: string | undefined;\n};\n\nexport default class SpeechRecognitionErrorEvent extends Event {\n  constructor(type: 'error', { error, message }: SpeechRecognitionErrorEventInit) {\n    super(type);\n\n    this.#error = error;\n    this.#message = message;\n  }\n\n  #error: SpeechRecognitionErrorType;\n  #message: string | undefined;\n\n  get error(): SpeechRecognitionErrorType {\n    return this.#error;\n  }\n\n  get message(): string | undefined {\n    return this.#message;\n  }\n\n  override get type(): 'error' {\n    return 'error';\n  }\n}\n","import FakeArray from './private/FakeArray.ts';\nimport type SpeechRecognitionResult from './SpeechRecognitionResult';\n\nexport default class SpeechRecognitionResultList extends FakeArray<SpeechRecognitionResult> {\n  constructor(result: readonly SpeechRecognitionResult[]) {\n    super(result);\n  }\n}\n","import SpeechRecognitionResultList from './SpeechRecognitionResultList.ts';\n\nexport type SpeechRecognitionEventInit = {\n  data?: undefined | unknown;\n  resultIndex?: number | undefined;\n  results?: SpeechRecognitionResultList | undefined;\n};\n\nexport default class SpeechRecognitionEvent<\n  T extends\n    | 'audioend'\n    | 'audiostart'\n    | 'cognitiveservices'\n    | 'end'\n    | 'result'\n    | 'soundend'\n    | 'soundstart'\n    | 'speechend'\n    | 'speechstart'\n    | 'start'\n> extends Event {\n  constructor(type: 'cognitiveservices', init: SpeechRecognitionEventInit & { data: { type: string } });\n  constructor(type: 'audioend');\n  constructor(type: 'audiostart');\n  constructor(type: 'end');\n  constructor(type: 'result', init: SpeechRecognitionEventInit);\n  constructor(type: 'soundend');\n  constructor(type: 'soundstart');\n  constructor(type: 'speechend');\n  constructor(type: 'speechstart');\n  constructor(type: 'start');\n\n  constructor(type: T, { data, resultIndex, results }: SpeechRecognitionEventInit = {}) {\n    super(type);\n\n    this.#data = data;\n    this.#resultIndex = resultIndex;\n    this.#results = results || new SpeechRecognitionResultList([]);\n  }\n\n  #data: undefined | unknown;\n  // TODO: \"resultIndex\" should be set.\n  #resultIndex: number | undefined;\n  #results: SpeechRecognitionResultList;\n\n  get data(): unknown {\n    return this.#data;\n  }\n\n  get resultIndex(): number | undefined {\n    return this.#resultIndex;\n  }\n\n  get results(): SpeechRecognitionResultList {\n    return this.#results;\n  }\n\n  override get type(): T {\n    return super.type as T;\n  }\n}\n","/* eslint class-methods-use-this: 0 */\n\nimport { EventTarget, getEventAttributeValue, setEventAttributeValue } from 'event-target-shim';\nimport { onErrorResumeNext } from 'on-error-resume-next/async';\nimport createDeferred from 'p-defer';\n\nimport patchOptions from '../patchOptions.ts';\nimport AudioContextQueue from './AudioContextQueue.js';\nimport SpeechSynthesisEvent from './SpeechSynthesisEvent.js';\nimport SpeechSynthesisUtterance from './SpeechSynthesisUtterance.js';\nimport fetchCustomVoices from './fetchCustomVoices.js';\nimport fetchVoices from './fetchVoices.js';\n\n// Supported output format can be found at https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/rest-text-to-speech#audio-outputs\nconst DEFAULT_OUTPUT_FORMAT = 'audio-24khz-160kbitrate-mono-mp3';\nconst EMPTY_ARRAY = [];\n\nfunction createSpeechRecognitionPonyfill(options) {\n  const {\n    audioContext,\n    fetchCredentials,\n    ponyfill = {\n      AudioContext: window.AudioContext || window.webkitAudioContext\n    },\n    speechSynthesisDeploymentId,\n    speechSynthesisOutputFormat = DEFAULT_OUTPUT_FORMAT\n  } = patchOptions(options);\n\n  if (!audioContext && !ponyfill.AudioContext) {\n    console.warn(\n      'web-speech-cognitive-services: This browser does not support Web Audio and it will not work with Cognitive Services Speech Services.'\n    );\n\n    return {};\n  }\n\n  class SpeechSynthesis extends EventTarget {\n    constructor() {\n      super();\n\n      this.queue = new AudioContextQueue({ audioContext, ponyfill });\n\n      this.updateVoices();\n    }\n\n    cancel() {\n      this.queue.stop();\n    }\n\n    getVoices() {\n      return EMPTY_ARRAY;\n    }\n\n    get onvoiceschanged() {\n      return getEventAttributeValue(this, 'voiceschanged');\n    }\n\n    set onvoiceschanged(value) {\n      setEventAttributeValue(this, 'voiceschanged', value);\n    }\n\n    pause() {\n      this.queue.pause();\n    }\n\n    resume() {\n      this.queue.resume();\n    }\n\n    speak(utterance) {\n      if (!(utterance instanceof SpeechSynthesisUtterance)) {\n        throw new Error('invalid utterance');\n      }\n\n      const { reject, resolve, promise } = createDeferred();\n      const handleError = ({ error: errorCode, message }) => {\n        const error = new Error(errorCode);\n\n        error.stack = message;\n\n        reject(error);\n      };\n\n      utterance.addEventListener('end', resolve);\n      utterance.addEventListener('error', handleError);\n\n      utterance.preload({\n        deploymentId: speechSynthesisDeploymentId,\n        fetchCredentials,\n        outputFormat: speechSynthesisOutputFormat\n      });\n\n      this.queue.push(utterance);\n\n      return promise.finally(() => {\n        utterance.removeEventListener('end', resolve);\n        utterance.removeEventListener('error', handleError);\n      });\n    }\n\n    get speaking() {\n      return this.queue.speaking;\n    }\n\n    async updateVoices() {\n      const { customVoiceHostname, region, speechSynthesisHostname, subscriptionKey } = await fetchCredentials();\n\n      if (speechSynthesisDeploymentId) {\n        if (subscriptionKey) {\n          console.warn(\n            'web-speech-cognitive-services: Listing of custom voice models are only available when using subscription key.'\n          );\n\n          await onErrorResumeNext(async () => {\n            const voices = await fetchCustomVoices({\n              customVoiceHostname,\n              deploymentId: speechSynthesisDeploymentId,\n              region,\n              speechSynthesisHostname,\n              subscriptionKey\n            });\n\n            this.getVoices = () => voices;\n          });\n        }\n      } else {\n        // If fetch voice list failed, we will not emit \"voiceschanged\" event.\n        // In the spec, there is no \"error\" event.\n\n        await onErrorResumeNext(async () => {\n          const voices = await fetchVoices(await fetchCredentials());\n\n          this.getVoices = () => voices;\n        });\n      }\n\n      this.dispatchEvent(new SpeechSynthesisEvent('voiceschanged'));\n    }\n  }\n\n  return {\n    speechSynthesis: new SpeechSynthesis(),\n    SpeechSynthesisEvent,\n    SpeechSynthesisUtterance\n  };\n}\n\nexport default createSpeechRecognitionPonyfill;\n","/* eslint no-await-in-loop: \"off\" */\n\nimport memoize from 'memoize-one';\n\nimport AudioContextConsumer from './AudioContextConsumer.js';\n\nexport default class AudioContextQueue {\n  constructor({ audioContext, ponyfill }) {\n    this.consumer = null;\n    this.paused = false;\n    this.queue = [];\n\n    this.getAudioContext = memoize(() => audioContext || new ponyfill.AudioContext());\n  }\n\n  pause() {\n    this.paused = true;\n    this.consumer && this.consumer.pause();\n  }\n\n  push(utterance) {\n    this.queue.push(utterance);\n    this.startConsumer();\n  }\n\n  resume() {\n    this.paused = false;\n\n    if (this.consumer) {\n      this.consumer.resume();\n    } else {\n      this.startConsumer();\n    }\n  }\n\n  get speaking() {\n    return !!this.consumer;\n  }\n\n  async startConsumer() {\n    while (!this.paused && this.queue.length && !this.consumer) {\n      this.consumer = new AudioContextConsumer(this.getAudioContext());\n\n      await this.consumer.start(this.queue);\n\n      this.consumer = null;\n    }\n  }\n\n  stop() {\n    this.queue.splice(0);\n    this.consumer && this.consumer.stop();\n  }\n}\n","/* eslint no-await-in-loop: \"off\" */\n\nexport default class AudioContextConsumer {\n  constructor(audioContext) {\n    this.audioContext = audioContext;\n  }\n\n  pause() {\n    this.audioContext && this.audioContext.suspend();\n    this.playingUtterance && this.playingUtterance.dispatchEvent(new CustomEvent('pause'));\n  }\n\n  resume() {\n    this.audioContext && this.audioContext.resume();\n    this.playingUtterance && this.playingUtterance.dispatchEvent(new CustomEvent('resume'));\n  }\n\n  async start(queue) {\n    let utterance;\n\n    while ((utterance = queue.shift())) {\n      this.playingUtterance = utterance;\n\n      await utterance.play(this.audioContext);\n\n      this.playingUtterance = null;\n    }\n  }\n\n  stop() {\n    this.playingUtterance && this.playingUtterance.stop();\n\n    if (this.audioContext.state === 'suspended') {\n      // Play -> Pause -> Cancel (stop)\n      // This would generate these events: \"start\", \"pause\", \"end\"\n\n      // Without this code, the \"end\" event will not emit until resume() is called\n      // Cancelling an unstarted utterance will not emit any \"start\" or \"end\" event\n      this.audioContext.resume();\n    }\n  }\n}\n","import { Event } from 'event-target-shim';\n\nexport default class SpeechSynthesisEvent extends Event {\n  constructor(type) {\n    super(type);\n  }\n}\n","/* eslint no-empty: [\"error\", { \"allowEmptyCatch\": true }] */\n\nimport { EventAsPromise } from 'event-as-promise';\nimport { EventTarget, getEventAttributeValue, setEventAttributeValue } from 'event-target-shim';\n\nimport fetchSpeechData from './fetchSpeechData.js';\nimport SpeechSynthesisEvent from './SpeechSynthesisEvent.js';\nimport subscribeEvent from './subscribeEvent.js';\n\nfunction asyncDecodeAudioData(audioContext, arrayBuffer) {\n  return new Promise((resolve, reject) => {\n    const promise = audioContext.decodeAudioData(arrayBuffer, resolve, reject);\n\n    // Newer implementation of \"decodeAudioData\" will return a Promise\n    promise && typeof promise.then === 'function' && resolve(promise);\n  });\n}\n\nfunction playDecoded(audioContext, audioBuffer, source) {\n  return new Promise((resolve, reject) => {\n    const audioContextClosed = new EventAsPromise();\n    const sourceEnded = new EventAsPromise();\n    const unsubscribe = subscribeEvent(\n      audioContext,\n      'statechange',\n      ({ target: { state } }) => state === 'closed' && audioContextClosed.eventListener()\n    );\n\n    try {\n      source.buffer = audioBuffer;\n      // \"ended\" may not fire if the underlying AudioContext is closed prematurely\n      source.onended = sourceEnded.eventListener;\n\n      source.connect(audioContext.destination);\n      source.start(0);\n\n      Promise.race([audioContextClosed.upcoming(), sourceEnded.upcoming()]).then(resolve);\n    } catch (err) {\n      reject(err);\n    } finally {\n      unsubscribe();\n    }\n  });\n}\n\nclass SpeechSynthesisUtterance extends EventTarget {\n  constructor(text) {\n    super();\n\n    this._lang = null;\n    this._pitch = 1;\n    this._rate = 1;\n    this._voice = null;\n    this._volume = 1;\n\n    this.text = text;\n\n    this.onboundary = null;\n    this.onend = null;\n    this.onerror = null;\n    this.onmark = null;\n    this.onpause = null;\n    this.onresume = null;\n    this.onstart = null;\n  }\n\n  get lang() {\n    return this._lang;\n  }\n\n  set lang(value) {\n    this._lang = value;\n  }\n\n  get onboundary() {\n    return getEventAttributeValue(this, 'boundary');\n  }\n\n  set onboundary(value) {\n    setEventAttributeValue(this, 'boundary', value);\n  }\n\n  get onend() {\n    return getEventAttributeValue(this, 'end');\n  }\n\n  set onend(value) {\n    setEventAttributeValue(this, 'end', value);\n  }\n\n  get onerror() {\n    return getEventAttributeValue(this, 'error');\n  }\n\n  set onerror(value) {\n    setEventAttributeValue(this, 'error', value);\n  }\n\n  get onmark() {\n    return getEventAttributeValue(this, 'mark');\n  }\n\n  set onmark(value) {\n    setEventAttributeValue(this, 'mark', value);\n  }\n\n  get onpause() {\n    return getEventAttributeValue(this, 'pause');\n  }\n\n  set onpause(value) {\n    setEventAttributeValue(this, 'pause', value);\n  }\n\n  get onresume() {\n    return getEventAttributeValue(this, 'resume');\n  }\n\n  set onresume(value) {\n    setEventAttributeValue(this, 'resume', value);\n  }\n\n  get onstart() {\n    return getEventAttributeValue(this, 'start');\n  }\n\n  set onstart(value) {\n    setEventAttributeValue(this, 'start', value);\n  }\n\n  get pitch() {\n    return this._pitch;\n  }\n\n  set pitch(value) {\n    this._pitch = value;\n  }\n\n  get rate() {\n    return this._rate;\n  }\n\n  set rate(value) {\n    this._rate = value;\n  }\n\n  get voice() {\n    return this._voice;\n  }\n\n  set voice(value) {\n    this._voice = value;\n  }\n\n  get volume() {\n    return this._volume;\n  }\n\n  set volume(value) {\n    this._volume = value;\n  }\n\n  preload({ deploymentId, fetchCredentials, outputFormat }) {\n    this.arrayBufferPromise = fetchSpeechData({\n      fetchCredentials,\n      deploymentId,\n      lang: this.lang || window.navigator.language,\n      outputFormat,\n      pitch: this.pitch,\n      rate: this.rate,\n      text: this.text,\n      voice: this.voice && this.voice.voiceURI,\n      volume: this.volume\n    });\n\n    // We need to call \"catch\" to make sure the Promise is running.\n    // We will ignore the reject result and handled in play() later.\n    this.arrayBufferPromise.catch();\n  }\n\n  async play(audioContext) {\n    try {\n      // We should emit \"start\" event even if preload() failed.\n      this.dispatchEvent(new SpeechSynthesisEvent('start'));\n\n      // HACK: iOS requires bufferSourceNode to be constructed before decoding data.\n      const source = audioContext.createBufferSource();\n      const audioBuffer = await asyncDecodeAudioData(audioContext, await this.arrayBufferPromise);\n\n      this._playingSource = source;\n\n      await playDecoded(audioContext, audioBuffer, source);\n\n      this._playingSource = null;\n      this.dispatchEvent(new SpeechSynthesisEvent('end'));\n    } catch (error) {\n      // \"message\" is not in spec but to provide a friendly message.\n      this.dispatchEvent(new ErrorEvent('error', { error: 'synthesis-failed', message: error.stack }));\n    }\n  }\n\n  stop() {\n    this._playingSource && this._playingSource.stop();\n  }\n}\n\nexport default SpeechSynthesisUtterance;\n","import { decode } from 'base64-arraybuffer';\nimport buildSSML from './buildSSML.js';\nimport isSSML from './isSSML.js';\n\nconst DEFAULT_LANGUAGE = 'en-US';\nconst DEFAULT_OUTPUT_FORMAT = 'riff-16khz-16bit-mono-pcm';\nconst DEFAULT_VOICE = 'Microsoft Server Speech Text to Speech Voice (en-US, AriaNeural)';\nconst EMPTY_MP3_BASE64 =\n  'SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU3LjU2LjEwMQAAAAAAAAAAAAAA//tAwAAAAAAAAAAAAAAAAAAAAAAASW5mbwAAAA8AAAACAAABhgC7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7//////////////////////////////////////////////////////////////////8AAAAATGF2YzU3LjY0AAAAAAAAAAAAAAAAJAUHAAAAAAAAAYYoRBqpAAAAAAD/+xDEAAPAAAGkAAAAIAAANIAAAARMQU1FMy45OS41VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7EMQpg8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV';\n\nexport default async function fetchSpeechData({\n  deploymentId,\n  fetchCredentials,\n  lang = DEFAULT_LANGUAGE,\n  outputFormat = DEFAULT_OUTPUT_FORMAT,\n  pitch,\n  rate,\n  text,\n  voice = DEFAULT_VOICE,\n  volume\n}) {\n  if (!text) {\n    // If text is empty, play a short audio clip. This allows developers to easily prime the AudioContext object by playing an empty string.\n    return decode(EMPTY_MP3_BASE64);\n  }\n\n  const { authorizationToken, region, speechSynthesisHostname, subscriptionKey } = await fetchCredentials();\n\n  if ((authorizationToken && subscriptionKey) || (!authorizationToken && !subscriptionKey)) {\n    throw new Error('Only \"authorizationToken\" or \"subscriptionKey\" should be set.');\n  } else if ((region && speechSynthesisHostname) || (!region && !speechSynthesisHostname)) {\n    throw new Error('Only \"region\" or \"speechSynthesisHostnamename\" should be set.');\n  }\n\n  const ssml = isSSML(text) ? text : buildSSML({ lang, pitch, rate, text, voice, volume });\n\n  // Although calling encodeURI on hostname does not actually works, it fails faster and safer.\n  const hostname =\n    speechSynthesisHostname ||\n    (deploymentId\n      ? `${encodeURI(region)}.voice.speech.microsoft.com`\n      : `${encodeURI(region)}.tts.speech.microsoft.com`);\n  const search = deploymentId ? `?deploymentId=${encodeURI(deploymentId)}` : '';\n  const url = `https://${hostname}/cognitiveservices/v1${search}`;\n\n  const res = await fetch(url, {\n    headers: {\n      'Content-Type': 'application/ssml+xml',\n      'X-Microsoft-OutputFormat': outputFormat,\n      ...(authorizationToken\n        ? {\n            Authorization: `Bearer ${authorizationToken}`\n          }\n        : {\n            'Ocp-Apim-Subscription-Key': subscriptionKey\n          })\n    },\n    method: 'POST',\n    body: ssml\n  });\n\n  if (!res.ok) {\n    throw new Error(`web-speech-cognitive-services: Failed to syntheis speech, server returned ${res.status}`);\n  }\n\n  return res.arrayBuffer();\n}\n","/* eslint no-magic-numbers: [\"error\", { \"ignore\": [0, 1, 100] }] */\n\n// Cognitive Services does not support unsigned percentage\n// It must be converted into +/- first.\nfunction relativePercentage(value) {\n  let relative = Math.round((value - 1) * 100);\n\n  if (relative >= 0) {\n    relative = '+' + relative;\n  }\n\n  return relative + '%';\n}\n\nexport default function buildSSML({ lang, pitch = 1, rate = 1, text, voice, volume }) {\n  return `<speak version=\"1.0\" xml:lang=\"${lang}\">\n  <voice xml:lang=\"${lang}\" name=\"${voice}\">\n    <prosody pitch=\"${relativePercentage(pitch)}\" rate=\"${relativePercentage(rate)}\" volume=\"${relativePercentage(\n      volume\n    )}\">\n      ${text}\n    </prosody>\n  </voice>\n</speak>`;\n}\n","const SPEAK_TAG_PATTERN = /^\\s*<speak(\\s|\\/?>)/u;\nconst XML_PROLOG_PATTERN = /^\\s*<\\?xml\\s/u;\n\nexport default function isSSML(text) {\n  return SPEAK_TAG_PATTERN.test(text) || XML_PROLOG_PATTERN.test(text);\n}\n","export default function subscribeEvent(target, name, handler) {\n  target.addEventListener(name, handler);\n\n  return () => target.removeEventListener(name, handler);\n}\n","export default class SpeechSynthesisVoice {\n  constructor({ gender, lang, voiceURI }) {\n    this._default = false;\n    this._gender = gender;\n    this._lang = lang;\n    this._localService = false;\n    this._name = voiceURI;\n    this._voiceURI = voiceURI;\n  }\n\n  get default() {\n    return this._default;\n  }\n\n  get gender() {\n    return this._gender;\n  }\n\n  get lang() {\n    return this._lang;\n  }\n\n  get localService() {\n    return this._localService;\n  }\n\n  get name() {\n    return this._name;\n  }\n\n  get voiceURI() {\n    return this._voiceURI;\n  }\n}\n","/* eslint no-magic-numbers: [\"error\", { \"ignore\": [0, 1, -1] }] */\n\nimport SpeechSynthesisVoice from './SpeechSynthesisVoice.js';\n\nasync function fetchCustomVoices_({ customVoiceHostname, deploymentId, region, subscriptionKey }) {\n  const hostname = customVoiceHostname || `${region}.customvoice.api.speech.microsoft.com`;\n\n  // Although encodeURI on a hostname doesn't work as expected for hostname, at least, it will fail peacefully.\n  const res = await fetch(\n    `https://${encodeURI(hostname)}/api/texttospeech/v2.0/endpoints/${encodeURIComponent(deploymentId)}`,\n    {\n      headers: {\n        accept: 'application/json',\n        'ocp-apim-subscription-key': subscriptionKey\n      }\n    }\n  );\n\n  if (!res.ok) {\n    throw new Error('Failed to fetch custom voices');\n  }\n\n  return res.json();\n}\n\nexport default async function fetchCustomVoices({ customVoiceHostname, deploymentId, region, subscriptionKey }) {\n  const { models } = await fetchCustomVoices_({ customVoiceHostname, deploymentId, region, subscriptionKey });\n\n  return models\n    .map(\n      ({ properties: { Gender: gender }, locale: lang, name: voiceURI }) =>\n        new SpeechSynthesisVoice({ gender, lang, voiceURI })\n    )\n    .sort(({ name: x }, { name: y }) => (x > y ? 1 : x < y ? -1 : 0));\n}\n","/* eslint no-magic-numbers: [\"error\", { \"ignore\": [0, 1, -1] }] */\n\nimport SpeechSynthesisVoice from './SpeechSynthesisVoice.js';\n\nexport default async function fetchVoices({ authorizationToken, region, speechSynthesisHostname, subscriptionKey }) {\n  // Although encodeURI on a hostname doesn't work as expected for hostname, at least, it will fail peacefully.\n  const hostname = speechSynthesisHostname || `${encodeURI(region)}.tts.speech.microsoft.com`;\n  const res = await fetch(`https://${hostname}/cognitiveservices/voices/list`, {\n    headers: {\n      'content-type': 'application/json',\n      ...(authorizationToken\n        ? {\n            authorization: `Bearer ${authorizationToken}`\n          }\n        : {\n            'Ocp-Apim-Subscription-Key': subscriptionKey\n          })\n    }\n  });\n\n  if (!res.ok) {\n    throw new Error('Failed to fetch voices');\n  }\n\n  const voices = await res.json();\n\n  return voices\n    .map(({ Gender: gender, Locale: lang, Name: voiceURI }) => new SpeechSynthesisVoice({ gender, lang, voiceURI }))\n    .sort(({ name: x }, { name: y }) => (x > y ? 1 : x < y ? -1 : 0));\n}\n","import createSpeechSynthesisPonyfill from './TextToSpeech/createSpeechSynthesisPonyfill.js';\n\nexport default createSpeechSynthesisPonyfill;\n","const TOKEN_URL_TEMPLATE = 'https://{region}.api.cognitive.microsoft.com/sts/v1.0/issueToken';\n\ntype FetchAuthorizationTokenInit = {\n  region: string;\n  subscriptionKey: string;\n};\n\nexport default async function fetchAuthorizationToken({\n  region,\n  subscriptionKey\n}: FetchAuthorizationTokenInit): Promise<string> {\n  const res = await fetch(TOKEN_URL_TEMPLATE.replace(/\\{region\\}/u, region), {\n    headers: {\n      'Ocp-Apim-Subscription-Key': subscriptionKey\n    },\n    method: 'POST'\n  });\n\n  if (!res.ok) {\n    throw new Error(`Failed to fetch authorization token, server returned ${res.status}`);\n  }\n\n  return res.text();\n}\n","/* global process */\n\nimport {\n  createSpeechRecognitionPonyfill,\n  createSpeechRecognitionPonyfillFromRecognizer,\n  type SpeechGrammarList,\n  type SpeechRecognitionAlternative,\n  type SpeechRecognitionErrorEvent,\n  type SpeechRecognitionEvent,\n  type SpeechRecognitionEventListenerMap,\n  type SpeechRecognitionResult,\n  type SpeechRecognitionResultList\n} from './SpeechServices/SpeechToText.ts';\nimport createSpeechSynthesisPonyfill from './SpeechServices/TextToSpeech.js';\nimport fetchAuthorizationToken from './SpeechServices/fetchAuthorizationToken.ts';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction createSpeechServicesPonyfill(options: any = {}): any {\n  return {\n    ...createSpeechRecognitionPonyfill(options),\n    ...createSpeechSynthesisPonyfill(options)\n  };\n}\n\nconst meta = document.createElement('meta');\n\nmeta.setAttribute('name', 'web-speech-cognitive-services');\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nmeta.setAttribute('content', `version=${process.env.npm_package_version}`);\n\ndocument.head.appendChild(meta);\n\nexport default createSpeechServicesPonyfill;\nexport {\n  createSpeechRecognitionPonyfill,\n  createSpeechRecognitionPonyfillFromRecognizer,\n  createSpeechSynthesisPonyfill,\n  fetchAuthorizationToken,\n  type SpeechGrammarList,\n  type SpeechRecognitionAlternative,\n  type SpeechRecognitionErrorEvent,\n  type SpeechRecognitionEvent,\n  type SpeechRecognitionEventListenerMap,\n  type SpeechRecognitionResult,\n  type SpeechRecognitionResultList\n};\n","/**\n * Assert a condition.\n * @param condition The condition that it should satisfy.\n * @param message The error message.\n * @param args The arguments for replacing placeholders in the message.\n */\nexport function assertType(\n    condition: boolean,\n    message: string,\n    ...args: any[]\n): asserts condition {\n    if (!condition) {\n        throw new TypeError(format(message, args))\n    }\n}\n\n/**\n * Convert a text and arguments to one string.\n * @param message The formating text\n * @param args The arguments.\n */\nexport function format(message: string, args: any[]): string {\n    let i = 0\n    return message.replace(/%[os]/gu, () => anyToString(args[i++]))\n}\n\n/**\n * Convert a value to a string representation.\n * @param x The value to get the string representation.\n */\nexport function anyToString(x: any): string {\n    if (typeof x !== \"object\" || x === null) {\n        return String(x)\n    }\n    return Object.prototype.toString.call(x)\n}\n","import { anyToString, assertType } from \"./misc\"\n\ndeclare const console: any\ndeclare const dispatchEvent: any\ndeclare const ErrorEvent: any\ndeclare const process: any\n\nlet currentErrorHandler: setErrorHandler.ErrorHandler | undefined\n\n/**\n * Set the error handler.\n * @param value The error handler to set.\n */\nexport function setErrorHandler(\n    value: setErrorHandler.ErrorHandler | undefined,\n): void {\n    assertType(\n        typeof value === \"function\" || value === undefined,\n        \"The error handler must be a function or undefined, but got %o.\",\n        value,\n    )\n    currentErrorHandler = value\n}\nexport namespace setErrorHandler {\n    /**\n     * The error handler.\n     * @param error The thrown error object.\n     */\n    export type ErrorHandler = (error: Error) => void\n}\n\n/**\n * Print a error message.\n * @param maybeError The error object.\n */\nexport function reportError(maybeError: unknown): void {\n    try {\n        const error =\n            maybeError instanceof Error\n                ? maybeError\n                : new Error(anyToString(maybeError))\n\n        // Call the user-defined error handler if exists.\n        if (currentErrorHandler) {\n            currentErrorHandler(error)\n            return\n        }\n\n        // Dispatch an `error` event if this is on a browser.\n        if (\n            typeof dispatchEvent === \"function\" &&\n            typeof ErrorEvent === \"function\"\n        ) {\n            dispatchEvent(\n                new ErrorEvent(\"error\", { error, message: error.message }),\n            )\n        }\n\n        // Emit an `uncaughtException` event if this is on Node.js.\n        //istanbul ignore else\n        else if (\n            typeof process !== \"undefined\" &&\n            typeof process.emit === \"function\"\n        ) {\n            process.emit(\"uncaughtException\", error)\n            return\n        }\n\n        // Otherwise, print the error.\n        console.error(error)\n    } catch {\n        // ignore.\n    }\n}\n","declare const globalThis: any\ndeclare const window: any\ndeclare const self: any\ndeclare const global: any\n\n/**\n * The global object.\n */\n//istanbul ignore next\nexport const Global: any =\n    typeof window !== \"undefined\"\n        ? window\n        : typeof self !== \"undefined\"\n        ? self\n        : typeof global !== \"undefined\"\n        ? global\n        : typeof globalThis !== \"undefined\"\n        ? globalThis\n        : undefined\n","import { assertType } from \"./misc\"\n\ndeclare const console: any\n\nlet currentWarnHandler: setWarningHandler.WarningHandler | undefined\n\n/**\n * Set the warning handler.\n * @param value The warning handler to set.\n */\nexport function setWarningHandler(\n    value: setWarningHandler.WarningHandler | undefined,\n): void {\n    assertType(\n        typeof value === \"function\" || value === undefined,\n        \"The warning handler must be a function or undefined, but got %o.\",\n        value,\n    )\n    currentWarnHandler = value\n}\nexport namespace setWarningHandler {\n    /**\n     * The warning information.\n     */\n    export interface Warning {\n        /**\n         * The code of this warning.\n         */\n        code: string\n        /**\n         * The message in English.\n         */\n        message: string\n        /**\n         * The arguments for replacing placeholders in the text.\n         */\n        args: any[]\n    }\n\n    /**\n     * The warning handler.\n     * @param warning The warning.\n     */\n    export type WarningHandler = (warning: Warning) => void\n}\n\n/**\n * The warning information.\n */\nexport class Warning<TArgs extends any[]> {\n    readonly code: string\n    readonly message: string\n\n    constructor(code: string, message: string) {\n        this.code = code\n        this.message = message\n    }\n\n    /**\n     * Report this warning.\n     * @param args The arguments of the warning.\n     */\n    warn(...args: TArgs): void {\n        try {\n            // Call the user-defined warning handler if exists.\n            if (currentWarnHandler) {\n                currentWarnHandler({ ...this, args })\n                return\n            }\n\n            // Otherwise, print the warning.\n            const stack = (new Error().stack ?? \"\").replace(\n                /^(?:.+?\\n){2}/gu,\n                \"\\n\",\n            )\n            console.warn(this.message, ...args, stack)\n        } catch {\n            // Ignore.\n        }\n    }\n}\n","import { EventTarget } from \"./event-target\" // Used as only type, so no circular.\nimport { Warning } from \"./warning-handler\"\n\nexport const InitEventWasCalledWhileDispatching = new Warning<[]>(\n    \"W01\",\n    \"Unable to initialize event under dispatching.\",\n)\n\nexport const FalsyWasAssignedToCancelBubble = new Warning<[]>(\n    \"W02\",\n    \"Assigning any falsy value to 'cancelBubble' property has no effect.\",\n)\n\nexport const TruthyWasAssignedToReturnValue = new Warning<[]>(\n    \"W03\",\n    \"Assigning any truthy value to 'returnValue' property has no effect.\",\n)\n\nexport const NonCancelableEventWasCanceled = new Warning<[]>(\n    \"W04\",\n    \"Unable to preventDefault on non-cancelable events.\",\n)\n\nexport const CanceledInPassiveListener = new Warning<[]>(\n    \"W05\",\n    \"Unable to preventDefault inside passive event listener invocation.\",\n)\n\nexport const EventListenerWasDuplicated = new Warning<\n    [type: \"bubble\" | \"capture\", callback: EventTarget.EventListener<any, any>]\n>(\n    \"W06\",\n    \"An event listener wasn't added because it has been added already: %o, %o\",\n)\n\nexport const OptionWasIgnored = new Warning<\n    [name: \"passive\" | \"once\" | \"signal\"]\n>(\n    \"W07\",\n    \"The %o option value was abandoned because the event listener wasn't added as duplicated.\",\n)\n\nexport const InvalidEventListener = new Warning<\n    [callback: EventTarget.EventListener<any, any> | {} | null | undefined]\n>(\n    \"W08\",\n    \"The 'callback' argument must be a function or an object that has 'handleEvent' method: %o\",\n)\n\nexport const InvalidAttributeHandler = new Warning<\n    [callback: EventTarget.EventListener<any, any> | {}]\n>(\"W09\", \"Event attribute handler must be a function: %o\")\n","import { EventTarget } from \"./event-target\" // Used as only type, so no circular.\nimport { Global } from \"./global\"\nimport { assertType } from \"./misc\"\nimport {\n    CanceledInPassiveListener,\n    FalsyWasAssignedToCancelBubble,\n    InitEventWasCalledWhileDispatching,\n    NonCancelableEventWasCanceled,\n    TruthyWasAssignedToReturnValue,\n} from \"./warnings\"\n\n/*eslint-disable class-methods-use-this */\n\n/**\n * An implementation of `Event` interface, that wraps a given event object.\n * `EventTarget` shim can control the internal state of this `Event` objects.\n * @see https://dom.spec.whatwg.org/#event\n */\nexport class Event<TEventType extends string = string> {\n    /**\n     * @see https://dom.spec.whatwg.org/#dom-event-none\n     */\n    static get NONE(): number {\n        return NONE\n    }\n\n    /**\n     * @see https://dom.spec.whatwg.org/#dom-event-capturing_phase\n     */\n    static get CAPTURING_PHASE(): number {\n        return CAPTURING_PHASE\n    }\n\n    /**\n     * @see https://dom.spec.whatwg.org/#dom-event-at_target\n     */\n    static get AT_TARGET(): number {\n        return AT_TARGET\n    }\n\n    /**\n     * @see https://dom.spec.whatwg.org/#dom-event-bubbling_phase\n     */\n    static get BUBBLING_PHASE(): number {\n        return BUBBLING_PHASE\n    }\n\n    /**\n     * Initialize this event instance.\n     * @param type The type of this event.\n     * @param eventInitDict Options to initialize.\n     * @see https://dom.spec.whatwg.org/#dom-event-event\n     */\n    constructor(type: TEventType, eventInitDict?: Event.EventInit) {\n        Object.defineProperty(this, \"isTrusted\", {\n            value: false,\n            enumerable: true,\n        })\n\n        const opts = eventInitDict ?? {}\n        internalDataMap.set(this, {\n            type: String(type),\n            bubbles: Boolean(opts.bubbles),\n            cancelable: Boolean(opts.cancelable),\n            composed: Boolean(opts.composed),\n            target: null,\n            currentTarget: null,\n            stopPropagationFlag: false,\n            stopImmediatePropagationFlag: false,\n            canceledFlag: false,\n            inPassiveListenerFlag: false,\n            dispatchFlag: false,\n            timeStamp: Date.now(),\n        })\n    }\n\n    /**\n     * The type of this event.\n     * @see https://dom.spec.whatwg.org/#dom-event-type\n     */\n    get type(): TEventType {\n        return $(this).type as TEventType\n    }\n\n    /**\n     * The event target of the current dispatching.\n     * @see https://dom.spec.whatwg.org/#dom-event-target\n     */\n    get target(): EventTarget | null {\n        return $(this).target\n    }\n\n    /**\n     * The event target of the current dispatching.\n     * @deprecated Use the `target` property instead.\n     * @see https://dom.spec.whatwg.org/#dom-event-srcelement\n     */\n    get srcElement(): EventTarget | null {\n        return $(this).target\n    }\n\n    /**\n     * The event target of the current dispatching.\n     * @see https://dom.spec.whatwg.org/#dom-event-currenttarget\n     */\n    get currentTarget(): EventTarget | null {\n        return $(this).currentTarget\n    }\n\n    /**\n     * The event target of the current dispatching.\n     * This doesn't support node tree.\n     * @see https://dom.spec.whatwg.org/#dom-event-composedpath\n     */\n    composedPath(): EventTarget[] {\n        const currentTarget = $(this).currentTarget\n        if (currentTarget) {\n            return [currentTarget]\n        }\n        return []\n    }\n\n    /**\n     * @see https://dom.spec.whatwg.org/#dom-event-none\n     */\n    get NONE(): number {\n        return NONE\n    }\n\n    /**\n     * @see https://dom.spec.whatwg.org/#dom-event-capturing_phase\n     */\n    get CAPTURING_PHASE(): number {\n        return CAPTURING_PHASE\n    }\n\n    /**\n     * @see https://dom.spec.whatwg.org/#dom-event-at_target\n     */\n    get AT_TARGET(): number {\n        return AT_TARGET\n    }\n\n    /**\n     * @see https://dom.spec.whatwg.org/#dom-event-bubbling_phase\n     */\n    get BUBBLING_PHASE(): number {\n        return BUBBLING_PHASE\n    }\n\n    /**\n     * The current event phase.\n     * @see https://dom.spec.whatwg.org/#dom-event-eventphase\n     */\n    get eventPhase(): number {\n        return $(this).dispatchFlag ? 2 : 0\n    }\n\n    /**\n     * Stop event bubbling.\n     * Because this shim doesn't support node tree, this merely changes the `cancelBubble` property value.\n     * @see https://dom.spec.whatwg.org/#dom-event-stoppropagation\n     */\n    stopPropagation(): void {\n        $(this).stopPropagationFlag = true\n    }\n\n    /**\n     * `true` if event bubbling was stopped.\n     * @deprecated\n     * @see https://dom.spec.whatwg.org/#dom-event-cancelbubble\n     */\n    get cancelBubble(): boolean {\n        return $(this).stopPropagationFlag\n    }\n\n    /**\n     * Stop event bubbling if `true` is set.\n     * @deprecated Use the `stopPropagation()` method instead.\n     * @see https://dom.spec.whatwg.org/#dom-event-cancelbubble\n     */\n    set cancelBubble(value: boolean) {\n        if (value) {\n            $(this).stopPropagationFlag = true\n        } else {\n            FalsyWasAssignedToCancelBubble.warn()\n        }\n    }\n\n    /**\n     * Stop event bubbling and subsequent event listener callings.\n     * @see https://dom.spec.whatwg.org/#dom-event-stopimmediatepropagation\n     */\n    stopImmediatePropagation(): void {\n        const data = $(this)\n        data.stopPropagationFlag = data.stopImmediatePropagationFlag = true\n    }\n\n    /**\n     * `true` if this event will bubble.\n     * @see https://dom.spec.whatwg.org/#dom-event-bubbles\n     */\n    get bubbles(): boolean {\n        return $(this).bubbles\n    }\n\n    /**\n     * `true` if this event can be canceled by the `preventDefault()` method.\n     * @see https://dom.spec.whatwg.org/#dom-event-cancelable\n     */\n    get cancelable(): boolean {\n        return $(this).cancelable\n    }\n\n    /**\n     * `true` if the default behavior will act.\n     * @deprecated Use the `defaultPrevented` proeprty instead.\n     * @see https://dom.spec.whatwg.org/#dom-event-returnvalue\n     */\n    get returnValue(): boolean {\n        return !$(this).canceledFlag\n    }\n\n    /**\n     * Cancel the default behavior if `false` is set.\n     * @deprecated Use the `preventDefault()` method instead.\n     * @see https://dom.spec.whatwg.org/#dom-event-returnvalue\n     */\n    set returnValue(value: boolean) {\n        if (!value) {\n            setCancelFlag($(this))\n        } else {\n            TruthyWasAssignedToReturnValue.warn()\n        }\n    }\n\n    /**\n     * Cancel the default behavior.\n     * @see https://dom.spec.whatwg.org/#dom-event-preventdefault\n     */\n    preventDefault(): void {\n        setCancelFlag($(this))\n    }\n\n    /**\n     * `true` if the default behavior was canceled.\n     * @see https://dom.spec.whatwg.org/#dom-event-defaultprevented\n     */\n    get defaultPrevented(): boolean {\n        return $(this).canceledFlag\n    }\n\n    /**\n     * @see https://dom.spec.whatwg.org/#dom-event-composed\n     */\n    get composed(): boolean {\n        return $(this).composed\n    }\n\n    /**\n     * @see https://dom.spec.whatwg.org/#dom-event-istrusted\n     */\n    //istanbul ignore next\n    get isTrusted(): boolean {\n        return false\n    }\n\n    /**\n     * @see https://dom.spec.whatwg.org/#dom-event-timestamp\n     */\n    get timeStamp(): number {\n        return $(this).timeStamp\n    }\n\n    /**\n     * @deprecated Don't use this method. The constructor did initialization.\n     */\n    initEvent(type: string, bubbles = false, cancelable = false) {\n        const data = $(this)\n        if (data.dispatchFlag) {\n            InitEventWasCalledWhileDispatching.warn()\n            return\n        }\n\n        internalDataMap.set(this, {\n            ...data,\n            type: String(type),\n            bubbles: Boolean(bubbles),\n            cancelable: Boolean(cancelable),\n            target: null,\n            currentTarget: null,\n            stopPropagationFlag: false,\n            stopImmediatePropagationFlag: false,\n            canceledFlag: false,\n        })\n    }\n}\n\n/*eslint-enable class-methods-use-this */\n\nexport namespace Event {\n    /**\n     * The options of the `Event` constructor.\n     * @see https://dom.spec.whatwg.org/#dictdef-eventinit\n     */\n    export interface EventInit {\n        bubbles?: boolean\n        cancelable?: boolean\n        composed?: boolean\n    }\n}\n\nexport { $ as getEventInternalData }\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\nconst NONE = 0\nconst CAPTURING_PHASE = 1\nconst AT_TARGET = 2\nconst BUBBLING_PHASE = 3\n\n/**\n * Private data.\n */\ninterface EventInternalData {\n    /**\n     * The value of `type` attribute.\n     */\n    readonly type: string\n    /**\n     * The value of `bubbles` attribute.\n     */\n    readonly bubbles: boolean\n    /**\n     * The value of `cancelable` attribute.\n     */\n    readonly cancelable: boolean\n    /**\n     * The value of `composed` attribute.\n     */\n    readonly composed: boolean\n    /**\n     * The value of `timeStamp` attribute.\n     */\n    readonly timeStamp: number\n\n    /**\n     * @see https://dom.spec.whatwg.org/#dom-event-target\n     */\n    target: EventTarget | null\n    /**\n     * @see https://dom.spec.whatwg.org/#dom-event-currenttarget\n     */\n    currentTarget: EventTarget | null\n    /**\n     * @see https://dom.spec.whatwg.org/#stop-propagation-flag\n     */\n    stopPropagationFlag: boolean\n    /**\n     * @see https://dom.spec.whatwg.org/#stop-immediate-propagation-flag\n     */\n    stopImmediatePropagationFlag: boolean\n    /**\n     * @see https://dom.spec.whatwg.org/#canceled-flag\n     */\n    canceledFlag: boolean\n    /**\n     * @see https://dom.spec.whatwg.org/#in-passive-listener-flag\n     */\n    inPassiveListenerFlag: boolean\n    /**\n     * @see https://dom.spec.whatwg.org/#dispatch-flag\n     */\n    dispatchFlag: boolean\n}\n\n/**\n * Private data for event wrappers.\n */\nconst internalDataMap = new WeakMap<any, EventInternalData>()\n\n/**\n * Get private data.\n * @param event The event object to get private data.\n * @param name The variable name to report.\n * @returns The private data of the event.\n */\nfunction $(event: unknown, name = \"this\"): EventInternalData {\n    const retv = internalDataMap.get(event)\n    assertType(\n        retv != null,\n        \"'%s' must be an object that Event constructor created, but got another one: %o\",\n        name,\n        event,\n    )\n    return retv\n}\n\n/**\n * https://dom.spec.whatwg.org/#set-the-canceled-flag\n * @param data private data.\n */\nfunction setCancelFlag(data: EventInternalData) {\n    if (data.inPassiveListenerFlag) {\n        CanceledInPassiveListener.warn()\n        return\n    }\n    if (!data.cancelable) {\n        NonCancelableEventWasCanceled.warn()\n        return\n    }\n\n    data.canceledFlag = true\n}\n\n// Set enumerable\nObject.defineProperty(Event, \"NONE\", { enumerable: true })\nObject.defineProperty(Event, \"CAPTURING_PHASE\", { enumerable: true })\nObject.defineProperty(Event, \"AT_TARGET\", { enumerable: true })\nObject.defineProperty(Event, \"BUBBLING_PHASE\", { enumerable: true })\nconst keys = Object.getOwnPropertyNames(Event.prototype)\nfor (let i = 0; i < keys.length; ++i) {\n    if (keys[i] === \"constructor\") {\n        continue\n    }\n    Object.defineProperty(Event.prototype, keys[i], { enumerable: true })\n}\n\n// Ensure `event instanceof window.Event` is `true`.\nif (typeof Global !== \"undefined\" && typeof Global.Event !== \"undefined\") {\n    Object.setPrototypeOf(Event.prototype, Global.Event.prototype)\n}\n","import { Global } from \"./global\"\n\n/**\n * Create a new InvalidStateError instance.\n * @param message The error message.\n */\nexport function createInvalidStateError(message: string): Error {\n    if (Global.DOMException) {\n        return new Global.DOMException(message, \"InvalidStateError\")\n    }\n\n    if (DOMException == null) {\n        DOMException = class DOMException extends Error {\n            constructor(msg: string) {\n                super(msg)\n                if ((Error as any).captureStackTrace) {\n                    ;(Error as any).captureStackTrace(this, DOMException)\n                }\n            }\n            // eslint-disable-next-line class-methods-use-this\n            get code() {\n                return 11\n            }\n            // eslint-disable-next-line class-methods-use-this\n            get name() {\n                return \"InvalidStateError\"\n            }\n        }\n        Object.defineProperties(DOMException.prototype, {\n            code: { enumerable: true },\n            name: { enumerable: true },\n        })\n        defineErrorCodeProperties(DOMException)\n        defineErrorCodeProperties(DOMException.prototype)\n    }\n    return new DOMException(message)\n}\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\nlet DOMException: { new (message: string): Error } | undefined\n\nconst ErrorCodeMap = {\n    INDEX_SIZE_ERR: 1,\n    DOMSTRING_SIZE_ERR: 2,\n    HIERARCHY_REQUEST_ERR: 3,\n    WRONG_DOCUMENT_ERR: 4,\n    INVALID_CHARACTER_ERR: 5,\n    NO_DATA_ALLOWED_ERR: 6,\n    NO_MODIFICATION_ALLOWED_ERR: 7,\n    NOT_FOUND_ERR: 8,\n    NOT_SUPPORTED_ERR: 9,\n    INUSE_ATTRIBUTE_ERR: 10,\n    INVALID_STATE_ERR: 11,\n    SYNTAX_ERR: 12,\n    INVALID_MODIFICATION_ERR: 13,\n    NAMESPACE_ERR: 14,\n    INVALID_ACCESS_ERR: 15,\n    VALIDATION_ERR: 16,\n    TYPE_MISMATCH_ERR: 17,\n    SECURITY_ERR: 18,\n    NETWORK_ERR: 19,\n    ABORT_ERR: 20,\n    URL_MISMATCH_ERR: 21,\n    QUOTA_EXCEEDED_ERR: 22,\n    TIMEOUT_ERR: 23,\n    INVALID_NODE_TYPE_ERR: 24,\n    DATA_CLONE_ERR: 25,\n}\ntype ErrorCodeMap = typeof ErrorCodeMap\n\nfunction defineErrorCodeProperties(obj: any): void {\n    const keys = Object.keys(ErrorCodeMap) as (keyof ErrorCodeMap)[]\n    for (let i = 0; i < keys.length; ++i) {\n        const key = keys[i]\n        const value = ErrorCodeMap[key]\n        Object.defineProperty(obj, key, {\n            get() {\n                return value\n            },\n            configurable: true,\n            enumerable: true,\n        })\n    }\n}\n","import { Event } from \"./event\"\nimport { Global } from \"./global\"\nimport { assertType } from \"./misc\"\n\n/**\n * An implementation of `Event` interface, that wraps a given event object.\n * This class controls the internal state of `Event`.\n * @see https://dom.spec.whatwg.org/#interface-event\n */\nexport class EventWrapper<TEventType extends string> extends Event<TEventType> {\n    /**\n     * Wrap a given event object to control states.\n     * @param event The event-like object to wrap.\n     */\n    static wrap<T extends EventLike>(event: T): EventWrapperOf<T> {\n        return new (getWrapperClassOf(event))(event)\n    }\n\n    protected constructor(event: Event<TEventType>) {\n        super(event.type, {\n            bubbles: event.bubbles,\n            cancelable: event.cancelable,\n            composed: event.composed,\n        })\n\n        if (event.cancelBubble) {\n            super.stopPropagation()\n        }\n        if (event.defaultPrevented) {\n            super.preventDefault()\n        }\n\n        internalDataMap.set(this, { original: event })\n\n        // Define accessors\n        const keys = Object.keys(event)\n        for (let i = 0; i < keys.length; ++i) {\n            const key = keys[i]\n            if (!(key in this)) {\n                Object.defineProperty(\n                    this,\n                    key,\n                    defineRedirectDescriptor(event, key),\n                )\n            }\n        }\n    }\n\n    stopPropagation(): void {\n        super.stopPropagation()\n\n        const { original } = $(this)\n        if (\"stopPropagation\" in original) {\n            original.stopPropagation!()\n        }\n    }\n\n    get cancelBubble(): boolean {\n        return super.cancelBubble\n    }\n    set cancelBubble(value: boolean) {\n        super.cancelBubble = value\n\n        const { original } = $(this)\n        if (\"cancelBubble\" in original) {\n            original.cancelBubble = value\n        }\n    }\n\n    stopImmediatePropagation(): void {\n        super.stopImmediatePropagation()\n\n        const { original } = $(this)\n        if (\"stopImmediatePropagation\" in original) {\n            original.stopImmediatePropagation!()\n        }\n    }\n\n    get returnValue(): boolean {\n        return super.returnValue\n    }\n    set returnValue(value: boolean) {\n        super.returnValue = value\n\n        const { original } = $(this)\n        if (\"returnValue\" in original) {\n            original.returnValue = value\n        }\n    }\n\n    preventDefault(): void {\n        super.preventDefault()\n\n        const { original } = $(this)\n        if (\"preventDefault\" in original) {\n            original.preventDefault!()\n        }\n    }\n\n    get timeStamp(): number {\n        const { original } = $(this)\n        if (\"timeStamp\" in original) {\n            return original.timeStamp!\n        }\n        return super.timeStamp\n    }\n}\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\ntype EventLike = { readonly type: string } & Partial<Event>\ntype EventWrapperOf<T extends EventLike> = Event<T[\"type\"]> &\n    Omit<T, keyof Event>\n\ninterface EventWrapperInternalData {\n    readonly original: EventLike\n}\n\n/**\n * Private data for event wrappers.\n */\nconst internalDataMap = new WeakMap<any, EventWrapperInternalData>()\n\n/**\n * Get private data.\n * @param event The event object to get private data.\n * @returns The private data of the event.\n */\nfunction $(event: unknown): EventWrapperInternalData {\n    const retv = internalDataMap.get(event)\n    assertType(\n        retv != null,\n        \"'this' is expected an Event object, but got\",\n        event,\n    )\n    return retv\n}\n\n/**\n * Cache for wrapper classes.\n * @type {WeakMap<Object, Function>}\n * @private\n */\nconst wrapperClassCache = new WeakMap()\n\n// Make association for wrappers.\nwrapperClassCache.set(Object.prototype, EventWrapper)\nif (typeof Global !== \"undefined\" && typeof Global.Event !== \"undefined\") {\n    wrapperClassCache.set(Global.Event.prototype, EventWrapper)\n}\n\n/**\n * Get the wrapper class of a given prototype.\n * @param originalEvent The event object to wrap.\n */\nfunction getWrapperClassOf<T extends EventLike>(\n    originalEvent: T,\n): { new (e: T): EventWrapperOf<T> } {\n    const prototype = Object.getPrototypeOf(originalEvent)\n    if (prototype == null) {\n        return EventWrapper as any\n    }\n\n    let wrapper: any = wrapperClassCache.get(prototype)\n    if (wrapper == null) {\n        wrapper = defineWrapper(getWrapperClassOf(prototype), prototype)\n        wrapperClassCache.set(prototype, wrapper)\n    }\n\n    return wrapper\n}\n\n/**\n * Define new wrapper class.\n * @param BaseEventWrapper The base wrapper class.\n * @param originalPrototype The prototype of the original event.\n */\nfunction defineWrapper(BaseEventWrapper: any, originalPrototype: any): any {\n    class CustomEventWrapper extends BaseEventWrapper {}\n\n    const keys = Object.keys(originalPrototype)\n    for (let i = 0; i < keys.length; ++i) {\n        Object.defineProperty(\n            CustomEventWrapper.prototype,\n            keys[i],\n            defineRedirectDescriptor(originalPrototype, keys[i]),\n        )\n    }\n\n    return CustomEventWrapper\n}\n\n/**\n * Get the property descriptor to redirect a given property.\n */\nfunction defineRedirectDescriptor(obj: any, key: string): PropertyDescriptor {\n    const d = Object.getOwnPropertyDescriptor(obj, key)!\n    return {\n        get() {\n            const original: any = $(this).original\n            const value = original[key]\n            if (typeof value === \"function\") {\n                return value.bind(original)\n            }\n            return value\n        },\n        set(value: any) {\n            const original: any = $(this).original\n            original[key] = value\n        },\n        configurable: d.configurable,\n        enumerable: d.enumerable,\n    }\n}\n","import { reportError } from \"./error-handler\"\nimport { Event } from \"./event\" // Used as only type, so no circular.\nimport { EventTarget } from \"./event-target\" // Used as only type, so no circular.\n\n/**\n * The event listener concept.\n * @see https://dom.spec.whatwg.org/#concept-event-listener\n */\nexport interface Listener {\n    /**\n     * The callback function.\n     */\n    readonly callback: Listener.Callback<any, any>\n    /**\n     * The flags of this listener.\n     * This is writable to add the removed flag.\n     */\n    flags: ListenerFlags\n    /**\n     * The `AbortSignal` to remove this listener.\n     */\n    readonly signal: Listener.AbortSignal | undefined\n    /**\n     * The `abort` event listener for the `signal`.\n     * To remove it from the `signal`.\n     */\n    readonly signalListener: (() => void) | undefined\n}\n\nexport namespace Listener {\n    export type Callback<\n        TEventTarget extends EventTarget<any, any>,\n        TEvent extends Event\n    > = CallbackFunction<TEventTarget, TEvent> | CallbackObject<TEvent>\n\n    export interface CallbackFunction<\n        TEventTarget extends EventTarget<any, any>,\n        TEvent extends Event\n    > {\n        (this: TEventTarget, event: TEvent): void\n    }\n\n    export interface CallbackObject<TEvent extends Event> {\n        handleEvent(event: TEvent): void\n    }\n\n    export interface AbortSignal {\n        addEventListener(type: string, callback: Callback<any, Event>): void\n        removeEventListener(type: string, callback: Callback<any, Event>): void\n    }\n}\n\n/**\n * Create a new listener.\n * @param callback The callback function.\n * @param capture The capture flag.\n * @param passive The passive flag.\n * @param once The once flag.\n * @param signal The abort signal.\n * @param signalListener The abort event listener for the abort signal.\n */\nexport function createListener(\n    callback: Listener.Callback<any, any>,\n    capture: boolean,\n    passive: boolean,\n    once: boolean,\n    signal: Listener.AbortSignal | undefined,\n    signalListener: (() => void) | undefined,\n): Listener {\n    return {\n        callback,\n        flags:\n            (capture ? ListenerFlags.Capture : 0) |\n            (passive ? ListenerFlags.Passive : 0) |\n            (once ? ListenerFlags.Once : 0),\n        signal,\n        signalListener,\n    }\n}\n\n/**\n * Set the `removed` flag to the given listener.\n * @param listener The listener to check.\n */\nexport function setRemoved(listener: Listener): void {\n    listener.flags |= ListenerFlags.Removed\n}\n\n/**\n * Check if the given listener has the `capture` flag or not.\n * @param listener The listener to check.\n */\nexport function isCapture(listener: Listener): boolean {\n    return (listener.flags & ListenerFlags.Capture) === ListenerFlags.Capture\n}\n\n/**\n * Check if the given listener has the `passive` flag or not.\n * @param listener The listener to check.\n */\nexport function isPassive(listener: Listener): boolean {\n    return (listener.flags & ListenerFlags.Passive) === ListenerFlags.Passive\n}\n\n/**\n * Check if the given listener has the `once` flag or not.\n * @param listener The listener to check.\n */\nexport function isOnce(listener: Listener): boolean {\n    return (listener.flags & ListenerFlags.Once) === ListenerFlags.Once\n}\n\n/**\n * Check if the given listener has the `removed` flag or not.\n * @param listener The listener to check.\n */\nexport function isRemoved(listener: Listener): boolean {\n    return (listener.flags & ListenerFlags.Removed) === ListenerFlags.Removed\n}\n\n/**\n * Call an event listener.\n * @param listener The listener to call.\n * @param target The event target object for `thisArg`.\n * @param event The event object for the first argument.\n * @param attribute `true` if this callback is an event attribute handler.\n */\nexport function invokeCallback(\n    { callback }: Listener,\n    target: EventTarget<any, any>,\n    event: Event<any>,\n): void {\n    try {\n        if (typeof callback === \"function\") {\n            callback.call(target, event)\n        } else if (typeof callback.handleEvent === \"function\") {\n            callback.handleEvent(event)\n        }\n    } catch (thrownError) {\n        reportError(thrownError)\n    }\n}\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * The flags of listeners.\n */\nconst enum ListenerFlags {\n    Capture = 0x01,\n    Passive = 0x02,\n    Once = 0x04,\n    Removed = 0x08,\n}\n","import { createListener, isCapture, Listener, setRemoved } from \"./listener\"\n\n/**\n * Information of an listener list.\n */\nexport interface ListenerList {\n    /**\n     * The callback function of the event attribute handler.\n     */\n    attrCallback: Listener.CallbackFunction<any, any> | undefined\n    /**\n     * The listener of the event attribute handler.\n     */\n    attrListener: Listener | undefined\n    /**\n     * `true` if the `dispatchEvent` method is traversing the current `listeners` array.\n     */\n    cow: boolean\n    /**\n     * The listeners.\n     * This is writable for copy-on-write.\n     */\n    listeners: Listener[]\n}\n\n/**\n * Find the index of given listener.\n * This returns `-1` if not found.\n * @param list The listener list.\n * @param callback The callback function to find.\n * @param capture The capture flag to find.\n */\nexport function findIndexOfListener(\n    { listeners }: ListenerList,\n    callback: Listener.Callback<any, any>,\n    capture: boolean,\n): number {\n    for (let i = 0; i < listeners.length; ++i) {\n        if (\n            listeners[i].callback === callback &&\n            isCapture(listeners[i]) === capture\n        ) {\n            return i\n        }\n    }\n    return -1\n}\n\n/**\n * Add the given listener.\n * Does copy-on-write if needed.\n * @param list The listener list.\n * @param callback The callback function.\n * @param capture The capture flag.\n * @param passive The passive flag.\n * @param once The once flag.\n * @param signal The abort signal.\n */\nexport function addListener(\n    list: ListenerList,\n    callback: Listener.Callback<any, any>,\n    capture: boolean,\n    passive: boolean,\n    once: boolean,\n    signal: Listener.AbortSignal | undefined,\n): Listener {\n    let signalListener: (() => void) | undefined\n    if (signal) {\n        signalListener = removeListener.bind(null, list, callback, capture)\n        signal.addEventListener(\"abort\", signalListener)\n    }\n\n    const listener = createListener(\n        callback,\n        capture,\n        passive,\n        once,\n        signal,\n        signalListener,\n    )\n\n    if (list.cow) {\n        list.cow = false\n        list.listeners = [...list.listeners, listener]\n    } else {\n        list.listeners.push(listener)\n    }\n\n    return listener\n}\n\n/**\n * Remove a listener.\n * @param list The listener list.\n * @param callback The callback function to find.\n * @param capture The capture flag to find.\n * @returns `true` if it mutated the list directly.\n */\nexport function removeListener(\n    list: ListenerList,\n    callback: Listener.Callback<any, any>,\n    capture: boolean,\n): boolean {\n    const index = findIndexOfListener(list, callback, capture)\n    if (index !== -1) {\n        return removeListenerAt(list, index)\n    }\n    return false\n}\n\n/**\n * Remove a listener.\n * @param list The listener list.\n * @param index The index of the target listener.\n * @param disableCow Disable copy-on-write if true.\n * @returns `true` if it mutated the `listeners` array directly.\n */\nexport function removeListenerAt(\n    list: ListenerList,\n    index: number,\n    disableCow = false,\n): boolean {\n    const listener = list.listeners[index]\n\n    // Set the removed flag.\n    setRemoved(listener)\n\n    // Dispose the abort signal listener if exists.\n    if (listener.signal) {\n        listener.signal.removeEventListener(\"abort\", listener.signalListener!)\n    }\n\n    // Remove it from the array.\n    if (list.cow && !disableCow) {\n        list.cow = false\n        list.listeners = list.listeners.filter((_, i) => i !== index)\n        return false\n    }\n    list.listeners.splice(index, 1)\n    return true\n}\n","import { ListenerList } from \"./listener-list\"\n\n/**\n * The map from event types to each listener list.\n */\nexport interface ListenerListMap {\n    [type: string]: ListenerList | undefined\n}\n\n/**\n * Create a new `ListenerListMap` object.\n */\nexport function createListenerListMap(): ListenerListMap {\n    return Object.create(null)\n}\n\n/**\n * Get the listener list of the given type.\n * If the listener list has not been initialized, initialize and return it.\n * @param listenerMap The listener list map.\n * @param type The event type to get.\n */\nexport function ensureListenerList(\n    listenerMap: Record<string, ListenerList | undefined>,\n    type: string,\n): ListenerList {\n    return (listenerMap[type] ??= {\n        attrCallback: undefined,\n        attrListener: undefined,\n        cow: false,\n        listeners: [],\n    })\n}\n","import { createInvalidStateError } from \"./dom-exception\"\nimport { Event, getEventInternalData } from \"./event\"\nimport { EventWrapper } from \"./event-wrapper\"\nimport { Global } from \"./global\"\nimport {\n    invokeCallback,\n    isCapture,\n    isOnce,\n    isPassive,\n    isRemoved,\n    Listener,\n} from \"./listener\"\nimport {\n    addListener,\n    findIndexOfListener,\n    removeListener,\n    removeListenerAt,\n} from \"./listener-list\"\nimport {\n    createListenerListMap,\n    ensureListenerList,\n    ListenerListMap,\n} from \"./listener-list-map\"\nimport { assertType, format } from \"./misc\"\nimport {\n    EventListenerWasDuplicated,\n    InvalidEventListener,\n    OptionWasIgnored,\n} from \"./warnings\"\n\n/**\n * An implementation of the `EventTarget` interface.\n * @see https://dom.spec.whatwg.org/#eventtarget\n */\nexport class EventTarget<\n    TEventMap extends Record<string, Event> = Record<string, Event>,\n    TMode extends \"standard\" | \"strict\" = \"standard\"\n> {\n    /**\n     * Initialize this instance.\n     */\n    constructor() {\n        internalDataMap.set(this, createListenerListMap())\n    }\n\n    /**\n     * Add an event listener.\n     * @param type The event type.\n     * @param callback The event listener.\n     * @param options Options.\n     */\n    addEventListener<T extends string & keyof TEventMap>(\n        type: T,\n        callback?: EventTarget.EventListener<this, TEventMap[T]> | null,\n        options?: EventTarget.AddOptions,\n    ): void\n\n    /**\n     * Add an event listener.\n     * @param type The event type.\n     * @param callback The event listener.\n     * @param options Options.\n     */\n    addEventListener(\n        type: string,\n        callback?: EventTarget.FallbackEventListener<this, TMode>,\n        options?: EventTarget.AddOptions,\n    ): void\n\n    /**\n     * Add an event listener.\n     * @param type The event type.\n     * @param callback The event listener.\n     * @param capture The capture flag.\n     * @deprecated Use `{capture: boolean}` object instead of a boolean value.\n     */\n    addEventListener<T extends string & keyof TEventMap>(\n        type: T,\n        callback:\n            | EventTarget.EventListener<this, TEventMap[T]>\n            | null\n            | undefined,\n        capture: boolean,\n    ): void\n\n    /**\n     * Add an event listener.\n     * @param type The event type.\n     * @param callback The event listener.\n     * @param capture The capture flag.\n     * @deprecated Use `{capture: boolean}` object instead of a boolean value.\n     */\n    addEventListener(\n        type: string,\n        callback: EventTarget.FallbackEventListener<this, TMode>,\n        capture: boolean,\n    ): void\n\n    // Implementation\n    addEventListener<T extends string & keyof TEventMap>(\n        type0: T,\n        callback0?: EventTarget.EventListener<this, TEventMap[T]> | null,\n        options0?: boolean | EventTarget.AddOptions,\n    ): void {\n        const listenerMap = $(this)\n        const {\n            callback,\n            capture,\n            once,\n            passive,\n            signal,\n            type,\n        } = normalizeAddOptions(type0, callback0, options0)\n        if (callback == null || signal?.aborted) {\n            return\n        }\n        const list = ensureListenerList(listenerMap, type)\n\n        // Find existing listener.\n        const i = findIndexOfListener(list, callback, capture)\n        if (i !== -1) {\n            warnDuplicate(list.listeners[i], passive, once, signal)\n            return\n        }\n\n        // Add the new listener.\n        addListener(list, callback, capture, passive, once, signal)\n    }\n\n    /**\n     * Remove an added event listener.\n     * @param type The event type.\n     * @param callback The event listener.\n     * @param options Options.\n     */\n    removeEventListener<T extends string & keyof TEventMap>(\n        type: T,\n        callback?: EventTarget.EventListener<this, TEventMap[T]> | null,\n        options?: EventTarget.Options,\n    ): void\n\n    /**\n     * Remove an added event listener.\n     * @param type The event type.\n     * @param callback The event listener.\n     * @param options Options.\n     */\n    removeEventListener(\n        type: string,\n        callback?: EventTarget.FallbackEventListener<this, TMode>,\n        options?: EventTarget.Options,\n    ): void\n\n    /**\n     * Remove an added event listener.\n     * @param type The event type.\n     * @param callback The event listener.\n     * @param capture The capture flag.\n     * @deprecated Use `{capture: boolean}` object instead of a boolean value.\n     */\n    removeEventListener<T extends string & keyof TEventMap>(\n        type: T,\n        callback:\n            | EventTarget.EventListener<this, TEventMap[T]>\n            | null\n            | undefined,\n        capture: boolean,\n    ): void\n\n    /**\n     * Remove an added event listener.\n     * @param type The event type.\n     * @param callback The event listener.\n     * @param capture The capture flag.\n     * @deprecated Use `{capture: boolean}` object instead of a boolean value.\n     */\n    removeEventListener(\n        type: string,\n        callback: EventTarget.FallbackEventListener<this, TMode>,\n        capture: boolean,\n    ): void\n\n    // Implementation\n    removeEventListener<T extends string & keyof TEventMap>(\n        type0: T,\n        callback0?: EventTarget.EventListener<this, TEventMap[T]> | null,\n        options0?: boolean | EventTarget.Options,\n    ): void {\n        const listenerMap = $(this)\n        const { callback, capture, type } = normalizeOptions(\n            type0,\n            callback0,\n            options0,\n        )\n        const list = listenerMap[type]\n\n        if (callback != null && list) {\n            removeListener(list, callback, capture)\n        }\n    }\n\n    /**\n     * Dispatch an event.\n     * @param event The `Event` object to dispatch.\n     */\n    dispatchEvent<T extends string & keyof TEventMap>(\n        event: EventTarget.EventData<TEventMap, TMode, T>,\n    ): boolean\n\n    /**\n     * Dispatch an event.\n     * @param event The `Event` object to dispatch.\n     */\n    dispatchEvent(event: EventTarget.FallbackEvent<TMode>): boolean\n\n    // Implementation\n    dispatchEvent(\n        e:\n            | EventTarget.EventData<TEventMap, TMode, string>\n            | EventTarget.FallbackEvent<TMode>,\n    ): boolean {\n        const list = $(this)[String(e.type)]\n        if (list == null) {\n            return true\n        }\n\n        const event = e instanceof Event ? e : EventWrapper.wrap(e)\n        const eventData = getEventInternalData(event, \"event\")\n        if (eventData.dispatchFlag) {\n            throw createInvalidStateError(\"This event has been in dispatching.\")\n        }\n\n        eventData.dispatchFlag = true\n        eventData.target = eventData.currentTarget = this\n\n        if (!eventData.stopPropagationFlag) {\n            const { cow, listeners } = list\n\n            // Set copy-on-write flag.\n            list.cow = true\n\n            // Call listeners.\n            for (let i = 0; i < listeners.length; ++i) {\n                const listener = listeners[i]\n\n                // Skip if removed.\n                if (isRemoved(listener)) {\n                    continue\n                }\n\n                // Remove this listener if has the `once` flag.\n                if (isOnce(listener) && removeListenerAt(list, i, !cow)) {\n                    // Because this listener was removed, the next index is the\n                    // same as the current value.\n                    i -= 1\n                }\n\n                // Call this listener with the `passive` flag.\n                eventData.inPassiveListenerFlag = isPassive(listener)\n                invokeCallback(listener, this, event)\n                eventData.inPassiveListenerFlag = false\n\n                // Stop if the `event.stopImmediatePropagation()` method was called.\n                if (eventData.stopImmediatePropagationFlag) {\n                    break\n                }\n            }\n\n            // Restore copy-on-write flag.\n            if (!cow) {\n                list.cow = false\n            }\n        }\n\n        eventData.target = null\n        eventData.currentTarget = null\n        eventData.stopImmediatePropagationFlag = false\n        eventData.stopPropagationFlag = false\n        eventData.dispatchFlag = false\n\n        return !eventData.canceledFlag\n    }\n}\n\nexport namespace EventTarget {\n    /**\n     * The event listener.\n     */\n    export type EventListener<\n        TEventTarget extends EventTarget<any, any>,\n        TEvent extends Event\n    > = CallbackFunction<TEventTarget, TEvent> | CallbackObject<TEvent>\n\n    /**\n     * The event listener function.\n     */\n    export interface CallbackFunction<\n        TEventTarget extends EventTarget<any, any>,\n        TEvent extends Event\n    > {\n        (this: TEventTarget, event: TEvent): void\n    }\n\n    /**\n     * The event listener object.\n     * @see https://dom.spec.whatwg.org/#callbackdef-eventlistener\n     */\n    export interface CallbackObject<TEvent extends Event> {\n        handleEvent(event: TEvent): void\n    }\n\n    /**\n     * The common options for both `addEventListener` and `removeEventListener` methods.\n     * @see https://dom.spec.whatwg.org/#dictdef-eventlisteneroptions\n     */\n    export interface Options {\n        capture?: boolean\n    }\n\n    /**\n     * The options for the `addEventListener` methods.\n     * @see https://dom.spec.whatwg.org/#dictdef-addeventlisteneroptions\n     */\n    export interface AddOptions extends Options {\n        passive?: boolean\n        once?: boolean\n        signal?: AbortSignal | null | undefined\n    }\n\n    /**\n     * The abort signal.\n     * @see https://dom.spec.whatwg.org/#abortsignal\n     */\n    export interface AbortSignal extends EventTarget<{ abort: Event }> {\n        readonly aborted: boolean\n        onabort: CallbackFunction<this, Event> | null\n    }\n\n    /**\n     * The event data to dispatch in strict mode.\n     */\n    export type EventData<\n        TEventMap extends Record<string, Event>,\n        TMode extends \"standard\" | \"strict\",\n        TEventType extends string\n    > = TMode extends \"strict\"\n        ? IsValidEventMap<TEventMap> extends true\n            ? ExplicitType<TEventType> &\n                  Omit<TEventMap[TEventType], keyof Event> &\n                  Partial<Omit<Event, \"type\">>\n            : never\n        : never\n\n    /**\n     * Define explicit `type` property if `T` is a string literal.\n     * Otherwise, never.\n     */\n    export type ExplicitType<T extends string> = string extends T\n        ? never\n        : { readonly type: T }\n\n    /**\n     * The event listener type in standard mode.\n     * Otherwise, never.\n     */\n    export type FallbackEventListener<\n        TEventTarget extends EventTarget<any, any>,\n        TMode extends \"standard\" | \"strict\"\n    > = TMode extends \"standard\"\n        ? EventListener<TEventTarget, Event> | null | undefined\n        : never\n\n    /**\n     * The event type in standard mode.\n     * Otherwise, never.\n     */\n    export type FallbackEvent<\n        TMode extends \"standard\" | \"strict\"\n    > = TMode extends \"standard\" ? Event : never\n\n    /**\n     * Check if given event map is valid.\n     * It's valid if the keys of the event map are narrower than `string`.\n     */\n    export type IsValidEventMap<T> = string extends keyof T ? false : true\n}\n\nexport { $ as getEventTargetInternalData }\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * Internal data for EventTarget\n */\ntype EventTargetInternalData = ListenerListMap\n\n/**\n * Internal data.\n */\nconst internalDataMap = new WeakMap<any, EventTargetInternalData>()\n\n/**\n * Get private data.\n * @param target The event target object to get private data.\n * @param name The variable name to report.\n * @returns The private data of the event.\n */\nfunction $(target: any, name = \"this\"): EventTargetInternalData {\n    const retv = internalDataMap.get(target)\n    assertType(\n        retv != null,\n        \"'%s' must be an object that EventTarget constructor created, but got another one: %o\",\n        name,\n        target,\n    )\n    return retv\n}\n\n/**\n * Normalize options.\n * @param options The options to normalize.\n */\nfunction normalizeAddOptions(\n    type: string,\n    callback: EventTarget.EventListener<any, any> | null | undefined,\n    options: boolean | EventTarget.AddOptions | undefined,\n): {\n    type: string\n    callback: EventTarget.EventListener<any, any> | undefined\n    capture: boolean\n    passive: boolean\n    once: boolean\n    signal: EventTarget.AbortSignal | undefined\n} {\n    assertCallback(callback)\n\n    if (typeof options === \"object\" && options !== null) {\n        return {\n            type: String(type),\n            callback: callback ?? undefined,\n            capture: Boolean(options.capture),\n            passive: Boolean(options.passive),\n            once: Boolean(options.once),\n            signal: options.signal ?? undefined,\n        }\n    }\n\n    return {\n        type: String(type),\n        callback: callback ?? undefined,\n        capture: Boolean(options),\n        passive: false,\n        once: false,\n        signal: undefined,\n    }\n}\n\n/**\n * Normalize options.\n * @param options The options to normalize.\n */\nfunction normalizeOptions(\n    type: string,\n    callback: EventTarget.EventListener<any, any> | null | undefined,\n    options: boolean | EventTarget.Options | undefined,\n): {\n    type: string\n    callback: EventTarget.EventListener<any, any> | undefined\n    capture: boolean\n} {\n    assertCallback(callback)\n\n    if (typeof options === \"object\" && options !== null) {\n        return {\n            type: String(type),\n            callback: callback ?? undefined,\n            capture: Boolean(options.capture),\n        }\n    }\n\n    return {\n        type: String(type),\n        callback: callback ?? undefined,\n        capture: Boolean(options),\n    }\n}\n\n/**\n * Assert the type of 'callback' argument.\n * @param callback The callback to check.\n */\nfunction assertCallback(callback: any): void {\n    if (\n        typeof callback === \"function\" ||\n        (typeof callback === \"object\" &&\n            callback !== null &&\n            typeof callback.handleEvent === \"function\")\n    ) {\n        return\n    }\n    if (callback == null || typeof callback === \"object\") {\n        InvalidEventListener.warn(callback)\n        return\n    }\n\n    throw new TypeError(format(InvalidEventListener.message, [callback]))\n}\n\n/**\n * Print warning for duplicated.\n * @param listener The current listener that is duplicated.\n * @param passive The passive flag of the new duplicated listener.\n * @param once The once flag of the new duplicated listener.\n * @param signal The signal object of the new duplicated listener.\n */\nfunction warnDuplicate(\n    listener: Listener,\n    passive: boolean,\n    once: boolean,\n    signal: EventTarget.AbortSignal | undefined,\n): void {\n    EventListenerWasDuplicated.warn(\n        isCapture(listener) ? \"capture\" : \"bubble\",\n        listener.callback,\n    )\n\n    if (isPassive(listener) !== passive) {\n        OptionWasIgnored.warn(\"passive\")\n    }\n    if (isOnce(listener) !== once) {\n        OptionWasIgnored.warn(\"once\")\n    }\n    if (listener.signal !== signal) {\n        OptionWasIgnored.warn(\"signal\")\n    }\n}\n\n// Set enumerable\nconst keys = Object.getOwnPropertyNames(EventTarget.prototype)\nfor (let i = 0; i < keys.length; ++i) {\n    if (keys[i] === \"constructor\") {\n        continue\n    }\n    Object.defineProperty(EventTarget.prototype, keys[i], { enumerable: true })\n}\n\n// Ensure `eventTarget instanceof window.EventTarget` is `true`.\nif (\n    typeof Global !== \"undefined\" &&\n    typeof Global.EventTarget !== \"undefined\"\n) {\n    Object.setPrototypeOf(EventTarget.prototype, Global.EventTarget.prototype)\n}\n","import { Event } from \"./event\"\nimport { EventTarget, getEventTargetInternalData } from \"./event-target\"\nimport { addListener, ListenerList, removeListener } from \"./listener-list\"\nimport { ensureListenerList } from \"./listener-list-map\"\nimport { InvalidAttributeHandler } from \"./warnings\"\n\n/**\n * Get the current value of a given event attribute.\n * @param target The `EventTarget` object to get.\n * @param type The event type.\n */\nexport function getEventAttributeValue<\n    TEventTarget extends EventTarget<any, any>,\n    TEvent extends Event\n>(\n    target: TEventTarget,\n    type: string,\n): EventTarget.CallbackFunction<TEventTarget, TEvent> | null {\n    const listMap = getEventTargetInternalData(target, \"target\")\n    return listMap[type]?.attrCallback ?? null\n}\n\n/**\n * Set an event listener to a given event attribute.\n * @param target The `EventTarget` object to set.\n * @param type The event type.\n * @param callback The event listener.\n */\nexport function setEventAttributeValue(\n    target: EventTarget<any, any>,\n    type: string,\n    callback: EventTarget.CallbackFunction<any, any> | null,\n): void {\n    if (callback != null && typeof callback !== \"function\") {\n        InvalidAttributeHandler.warn(callback)\n    }\n\n    if (\n        typeof callback === \"function\" ||\n        (typeof callback === \"object\" && callback !== null)\n    ) {\n        upsertEventAttributeListener(target, type, callback)\n    } else {\n        removeEventAttributeListener(target, type)\n    }\n}\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * Update or insert the given event attribute handler.\n * @param target The `EventTarget` object to set.\n * @param type The event type.\n * @param callback The event listener.\n */\nfunction upsertEventAttributeListener<\n    TEventTarget extends EventTarget<any, any>\n>(\n    target: TEventTarget,\n    type: string,\n    callback: EventTarget.CallbackFunction<TEventTarget, any>,\n): void {\n    const list = ensureListenerList(\n        getEventTargetInternalData(target, \"target\"),\n        String(type),\n    )\n    list.attrCallback = callback\n\n    if (list.attrListener == null) {\n        list.attrListener = addListener(\n            list,\n            defineEventAttributeCallback(list),\n            false,\n            false,\n            false,\n            undefined,\n        )\n    }\n}\n\n/**\n * Remove the given event attribute handler.\n * @param target The `EventTarget` object to remove.\n * @param type The event type.\n * @param callback The event listener.\n */\nfunction removeEventAttributeListener(\n    target: EventTarget<any, any>,\n    type: string,\n): void {\n    const listMap = getEventTargetInternalData(target, \"target\")\n    const list = listMap[String(type)]\n    if (list && list.attrListener) {\n        removeListener(list, list.attrListener.callback, false)\n        list.attrCallback = list.attrListener = undefined\n    }\n}\n\n/**\n * Define the callback function for the given listener list object.\n * It calls `attrCallback` property if the property value is a function.\n * @param list The `ListenerList` object.\n */\nfunction defineEventAttributeCallback(\n    list: ListenerList,\n): EventTarget.CallbackFunction<any, any> {\n    return function (event) {\n        const callback = list.attrCallback\n        if (typeof callback === \"function\") {\n            callback.call(this, event)\n        }\n    }\n}\n","import { Event } from \"./event\"\nimport {\n    getEventAttributeValue,\n    setEventAttributeValue,\n} from \"./event-attribute-handler\"\nimport { EventTarget } from \"./event-target\"\n\n/**\n * Define an `EventTarget` class that has event attibutes.\n * @param types The types to define event attributes.\n * @deprecated Use `getEventAttributeValue`/`setEventAttributeValue` pair on your derived class instead because of static analysis friendly.\n */\nexport function defineCustomEventTarget<\n    TEventMap extends Record<string, Event>,\n    TMode extends \"standard\" | \"strict\" = \"standard\"\n>(\n    ...types: (string & keyof TEventMap)[]\n): defineCustomEventTarget.CustomEventTargetConstructor<TEventMap, TMode> {\n    class CustomEventTarget extends EventTarget {}\n    for (let i = 0; i < types.length; ++i) {\n        defineEventAttribute(CustomEventTarget.prototype, types[i])\n    }\n\n    return CustomEventTarget as any\n}\n\nexport namespace defineCustomEventTarget {\n    /**\n     * The interface of CustomEventTarget constructor.\n     */\n    export type CustomEventTargetConstructor<\n        TEventMap extends Record<string, Event>,\n        TMode extends \"standard\" | \"strict\"\n    > = {\n        /**\n         * Create a new instance.\n         */\n        new (): CustomEventTarget<TEventMap, TMode>\n        /**\n         * prototype object.\n         */\n        prototype: CustomEventTarget<TEventMap, TMode>\n    }\n\n    /**\n     * The interface of CustomEventTarget.\n     */\n    export type CustomEventTarget<\n        TEventMap extends Record<string, Event>,\n        TMode extends \"standard\" | \"strict\"\n    > = EventTarget<TEventMap, TMode> &\n        defineEventAttribute.EventAttributes<any, TEventMap>\n}\n\n/**\n * Define an event attribute.\n * @param target The `EventTarget` object to define an event attribute.\n * @param type The event type to define.\n * @param _eventClass Unused, but to infer `Event` class type.\n * @deprecated Use `getEventAttributeValue`/`setEventAttributeValue` pair on your derived class instead because of static analysis friendly.\n */\nexport function defineEventAttribute<\n    TEventTarget extends EventTarget,\n    TEventType extends string,\n    TEventConstrucor extends typeof Event\n>(\n    target: TEventTarget,\n    type: TEventType,\n    _eventClass?: TEventConstrucor,\n): asserts target is TEventTarget &\n    defineEventAttribute.EventAttributes<\n        TEventTarget,\n        Record<TEventType, InstanceType<TEventConstrucor>>\n    > {\n    Object.defineProperty(target, `on${type}`, {\n        get() {\n            return getEventAttributeValue(this, type)\n        },\n        set(value) {\n            setEventAttributeValue(this, type, value)\n        },\n        configurable: true,\n        enumerable: true,\n    })\n}\n\nexport namespace defineEventAttribute {\n    /**\n     * Definition of event attributes.\n     */\n    export type EventAttributes<\n        TEventTarget extends EventTarget<any, any>,\n        TEventMap extends Record<string, Event>\n    > = {\n        [P in string &\n            keyof TEventMap as `on${P}`]: EventTarget.CallbackFunction<\n            TEventTarget,\n            TEventMap[P]\n        > | null\n    }\n}\n","export default function isPromise(value: unknown): value is PromiseLike<unknown> {\n  return !!(\n    (typeof value === 'function' || typeof value === 'object') &&\n    value &&\n    'then' in value &&\n    typeof value.then === 'function'\n  );\n}\n","import isPromise from './private/isPromise.ts';\n\nexport function onErrorResumeNext<T extends () => Promise<U>, U = unknown>(\n  fn: T,\n  context?: undefined\n): Promise<U | undefined>;\n\nexport function onErrorResumeNext<T extends (this: V) => Promise<U>, U = unknown, V = undefined>(\n  fn: T,\n  context: V\n): Promise<U | undefined>;\n\nexport function onErrorResumeNext<T extends (this: V) => Promise<U>, U = unknown, V = undefined>(\n  fn: T,\n  context: V\n): Promise<U | undefined> {\n  return new Promise<U | undefined>(resolve => {\n    try {\n      const result = fn.call(context);\n\n      if (isPromise(result)) {\n        result.then(resolve, () => resolve(undefined));\n      } else {\n        resolve(result);\n      }\n    } catch {\n      resolve(undefined);\n    }\n  });\n}\n","var safeIsNaN = Number.isNaN ||\n    function ponyfill(value) {\n        return typeof value === 'number' && value !== value;\n    };\nfunction isEqual(first, second) {\n    if (first === second) {\n        return true;\n    }\n    if (safeIsNaN(first) && safeIsNaN(second)) {\n        return true;\n    }\n    return false;\n}\nfunction areInputsEqual(newInputs, lastInputs) {\n    if (newInputs.length !== lastInputs.length) {\n        return false;\n    }\n    for (var i = 0; i < newInputs.length; i++) {\n        if (!isEqual(newInputs[i], lastInputs[i])) {\n            return false;\n        }\n    }\n    return true;\n}\n\nfunction memoizeOne(resultFn, isEqual) {\n    if (isEqual === void 0) { isEqual = areInputsEqual; }\n    var cache = null;\n    function memoized() {\n        var newArgs = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n            newArgs[_i] = arguments[_i];\n        }\n        if (cache && cache.lastThis === this && isEqual(newArgs, cache.lastArgs)) {\n            return cache.lastResult;\n        }\n        var lastResult = resultFn.apply(this, newArgs);\n        cache = {\n            lastResult: lastResult,\n            lastArgs: newArgs,\n            lastThis: this,\n        };\n        return lastResult;\n    }\n    memoized.clear = function clear() {\n        cache = null;\n    };\n    return memoized;\n}\n\nexport { memoizeOne as default };\n","type Resolvers<T> = {\n  reject: (error: unknown) => void;\n  resolve: (value: T) => void;\n  promise: Promise<T>;\n};\n\nfunction withResolvers<T>(): Resolvers<T> {\n  const resolvers: Partial<Resolvers<T>> = {};\n\n  resolvers.promise = new Promise((resolve, reject) => {\n    resolvers.reject = reject;\n    resolvers.resolve = resolve;\n  });\n\n  return resolvers as Resolvers<T>;\n}\n\nexport class EventAsPromise<T> {\n  constructor() {\n    this.#eventListener = (event: T) => {\n      const deferred = this.#orderedResolvers.shift();\n\n      // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n      deferred && deferred.resolve(event);\n\n      if (this.#upcomingResolvers) {\n        this.#upcomingResolvers.resolve(event);\n        this.#upcomingResolvers = undefined;\n      }\n    };\n  }\n\n  #eventListener: (event: T) => void;\n  #orderedResolvers: Resolvers<T>[] = [];\n  #upcomingResolvers: Resolvers<T> | undefined = undefined;\n\n  get eventListener() {\n    return this.#eventListener;\n  }\n\n  [Symbol.iterator]() {\n    return {\n      next: () => ({\n        done: false,\n        value: this.upcoming()\n      })\n    };\n  }\n\n  one() {\n    const deferred = withResolvers<T>();\n\n    this.#orderedResolvers.push(deferred);\n\n    return deferred.promise;\n  }\n\n  upcoming() {\n    if (!this.#upcomingResolvers) {\n      this.#upcomingResolvers = withResolvers<T>();\n    }\n\n    return this.#upcomingResolvers.promise;\n  }\n}\n","const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\n// Use a lookup table to find the index.\nconst lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);\nfor (let i = 0; i < chars.length; i++) {\n    lookup[chars.charCodeAt(i)] = i;\n}\n\nexport const encode = (arraybuffer: ArrayBuffer): string => {\n    let bytes = new Uint8Array(arraybuffer),\n        i,\n        len = bytes.length,\n        base64 = '';\n\n    for (i = 0; i < len; i += 3) {\n        base64 += chars[bytes[i] >> 2];\n        base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];\n        base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];\n        base64 += chars[bytes[i + 2] & 63];\n    }\n\n    if (len % 3 === 2) {\n        base64 = base64.substring(0, base64.length - 1) + '=';\n    } else if (len % 3 === 1) {\n        base64 = base64.substring(0, base64.length - 2) + '==';\n    }\n\n    return base64;\n};\n\nexport const decode = (base64: string): ArrayBuffer => {\n    let bufferLength = base64.length * 0.75,\n        len = base64.length,\n        i,\n        p = 0,\n        encoded1,\n        encoded2,\n        encoded3,\n        encoded4;\n\n    if (base64[base64.length - 1] === '=') {\n        bufferLength--;\n        if (base64[base64.length - 2] === '=') {\n            bufferLength--;\n        }\n    }\n\n    const arraybuffer = new ArrayBuffer(bufferLength),\n        bytes = new Uint8Array(arraybuffer);\n\n    for (i = 0; i < len; i += 4) {\n        encoded1 = lookup[base64.charCodeAt(i)];\n        encoded2 = lookup[base64.charCodeAt(i + 1)];\n        encoded3 = lookup[base64.charCodeAt(i + 2)];\n        encoded4 = lookup[base64.charCodeAt(i + 3)];\n\n        bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);\n        bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);\n        bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);\n    }\n\n    return arraybuffer;\n};\n","import { ChunkedArrayBufferStream } from 'microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/Exports.js';\nimport { PcmRecorder } from 'microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/Exports.js';\n\nimport { AudioStreamNode, DeviceInfo, Format } from './CustomAudioInputStream';\nimport bytesPerSample from './bytesPerSample';\nimport createAudioConfig from './createAudioConfig';\nimport createAudioContext from './createAudioContext';\nimport getUserMedia from './getUserMedia';\n\n// This is how often we are flushing audio buffer to the network. Modify this value will affect latency.\nconst DEFAULT_BUFFER_DURATION_IN_MS = 100;\n\n// TODO: [P2] #3975 We should consider building our own PcmRecorder:\n//       - Use Audio Worklet via blob URL\n//       - Not hardcoding the sample rate or other values\n// PcmRecorder always downscale to 16000 Hz. We cannot use the dynamic value from MediaConstraints or MediaTrackSettings.\nconst PCM_RECORDER_HARDCODED_SETTINGS: MediaTrackSettings = Object.freeze({\n  channelCount: 1,\n  sampleRate: 16000,\n  sampleSize: 16\n});\n\nconst PCM_RECORDER_HARDCODED_FORMAT: Format = Object.freeze({\n  bitsPerSample: PCM_RECORDER_HARDCODED_SETTINGS.sampleSize,\n  // `channelCount` is not on @types/web@0.0.54 yet, related to https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/1290.\n  // @ts-ignore\n  channels: PCM_RECORDER_HARDCODED_SETTINGS.channelCount,\n  samplesPerSec: PCM_RECORDER_HARDCODED_SETTINGS.sampleRate\n});\n\ntype MicrophoneAudioInputStreamOptions = {\n  /** Specifies the constraints for selecting an audio device. */\n  audioConstraints?: true | MediaTrackConstraints;\n\n  /** Specifies the `AudioContext` to use. This object must be primed and ready to use. */\n  audioContext: AudioContext;\n\n  /** Specifies the buffering delay on how often to flush audio data to network. Increasing the value will increase audio latency. Default is 100 ms. */\n  bufferDurationInMS?: number;\n\n  /** Specifies whether to display diagnostic information. */\n  debug?: true;\n\n  /** Specifies if telemetry data should be sent. If not specified, telemetry data will NOT be sent. */\n  enableTelemetry?: true;\n\n  /** Specifies the `AudioWorklet` URL for `PcmRecorder`. If not specified, will use script processor on UI thread instead. */\n  pcmRecorderWorkletUrl?: string;\n};\n\nfunction createMicrophoneAudioConfig(options: MicrophoneAudioInputStreamOptions) {\n  const { audioConstraints, audioContext, debug, enableTelemetry, pcmRecorderWorkletUrl } = options;\n  const bufferDurationInMS = options.bufferDurationInMS || DEFAULT_BUFFER_DURATION_IN_MS;\n\n  // Related to #4523.\n  // Pass \"true\" as required by microsoft-cognitiveservices-speech-sdk (see #4523).\n  const pcmRecorder = new PcmRecorder(true);\n\n  pcmRecorderWorkletUrl && pcmRecorder.setWorkletUrl(pcmRecorderWorkletUrl);\n\n  return createAudioConfig({\n    async attach(audioNodeId: string): Promise<{\n      audioStreamNode: AudioStreamNode;\n      deviceInfo: DeviceInfo;\n      format: Format;\n    }> {\n      // We need to get new MediaStream on every attach().\n      // This is because PcmRecorder.releaseMediaResources() disconnected/stopped them.\n      const mediaStream = await getUserMedia({ audio: audioConstraints, video: false });\n\n      const [firstAudioTrack] = mediaStream.getAudioTracks();\n\n      if (!firstAudioTrack) {\n        throw new Error('No audio device is found.');\n      }\n\n      const outputStream = new ChunkedArrayBufferStream(\n        // Speech SDK quirks: PcmRecorder hardcoded sample rate of 16000 Hz.\n        bytesPerSample(PCM_RECORDER_HARDCODED_SETTINGS) *\n          // eslint-disable-next-line no-magic-numbers\n          ((bufferDurationInMS || DEFAULT_BUFFER_DURATION_IN_MS) / 1000),\n        audioNodeId\n      );\n\n      pcmRecorder.record(audioContext, mediaStream, outputStream);\n\n      return {\n        audioStreamNode: {\n          // Speech SDK quirks: In SDK's original MicAudioSource implementation, it call turnOff() during detach().\n          //                    That means, it call turnOff(), then detach(), then turnOff() again. Seems redundant.\n          //                    When using with Direct Line Speech, turnOff() is never called.\n          detach: (): Promise<void> => {\n            // Speech SDK quirks: In SDK, it call outputStream.close() in turnOff() before outputStream.readEnded() in detach().\n            //                    I think it make sense to call readEnded() before close().\n            outputStream.readEnded();\n            outputStream.close();\n\n            // PcmRecorder.releaseMediaResources() will disconnect/stop the MediaStream.\n            // We cannot use MediaStream again after turned off.\n            pcmRecorder.releaseMediaResources(audioContext);\n\n            // MediaStream will become inactive after all tracks are removed.\n            mediaStream.getTracks().forEach(track => mediaStream.removeTrack(track));\n\n            // ESLint: \"return\" is required by TypeScript\n            // eslint-disable-next-line no-useless-return\n            return;\n          },\n          id: () => audioNodeId,\n          read: () => outputStream.read()\n        },\n        deviceInfo: {\n          manufacturer: 'Bot Framework Web Chat',\n          model: enableTelemetry ? firstAudioTrack.label : '',\n          type: enableTelemetry ? 'Microphones' : 'Unknown'\n        },\n        // Speech SDK quirks: PcmRecorder hardcoded sample rate of 16000 Hz.\n        //                    We cannot obtain this number other than looking at their source code.\n        //                    I.e. no getter property.\n        // PcmRecorder always downscale to 16000 Hz. We cannot use the dynamic value from MediaConstraints or MediaTrackSettings.\n        format: PCM_RECORDER_HARDCODED_FORMAT\n      };\n    },\n    debug\n  });\n}\n\nexport default function createMicrophoneAudioConfigAndAudioContext({\n  audioContext,\n  audioInputDeviceId,\n  enableTelemetry\n}: {\n  audioContext?: AudioContext;\n  audioInputDeviceId?: string;\n  enableTelemetry?: true;\n}) {\n  // Web Chat has an implementation of AudioConfig for microphone that would enable better support on Safari:\n  // - Maintain same instance of `AudioContext` across recognitions;\n  // - Resume suspended `AudioContext` on user gestures.\n  //\n  // This is filed as https://github.com/microsoft/cognitive-services-speech-sdk-js/issues/571.\n  // Before Speech SDK team take our suggestion, we need to continue using a custom AudioConfig object to persist the blessing.\n  audioContext || (audioContext = createAudioContext());\n\n  return {\n    audioConfig: createMicrophoneAudioConfig({\n      audioConstraints: audioInputDeviceId ? { deviceId: audioInputDeviceId } : true,\n      audioContext,\n      enableTelemetry: enableTelemetry ? true : undefined\n    }),\n    audioContext\n  };\n}\n","export default function bytesPerSample(settings: MediaTrackSettings) {\n  // `channelCount` is not on @types/web@0.0.54 yet, related to https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/1290.\n  // @ts-ignore\n  // eslint-disable-next-line no-magic-numbers\n  return ((settings.sampleSize as number) >> 3) * (settings.channelCount as number) * (settings.sampleRate as number);\n}\n","// TODO: [P2] #3976 We should export this to allow web developers to bring in their own microphone.\n//       For example, it should enable React Native devs to bring in their microphone implementation and use Cognitive Services Speech Services.\n\nimport { AudioConfig } from 'microsoft-cognitiveservices-speech-sdk';\n\nimport CustomAudioInputStream, { AudioStreamNode, DeviceInfo, Format } from './CustomAudioInputStream';\n\ntype AttachFunction = (audioNodeId: string) => Promise<{\n  audioStreamNode: AudioStreamNode;\n  deviceInfo: DeviceInfo;\n  format: Format;\n}>;\n\ntype TurnOffFunction = () => Promise<void>;\n\nconst SYMBOL_ATTACH = Symbol('attach');\nconst SYMBOL_TURN_OFF = Symbol('turnOff');\n\ntype CreateAudioConfigOptions = {\n  /** Callback function for attaching the device by returning an audio node. */\n  attach: AttachFunction;\n\n  /** `true` to enable diagnostic information, otherwise, `false`. */\n  debug?: true;\n\n  /**\n   * Callback function for turning off the device before detaching its node from an audio graph.\n   *\n   * Note: this is not called for Direct Line Speech.\n   */\n  turnOff?: TurnOffFunction;\n};\n\nclass CreateAudioConfigAudioInputStream extends CustomAudioInputStream {\n  constructor({ attach, debug, turnOff }: CreateAudioConfigOptions) {\n    if (!attach || typeof attach !== 'function') {\n      throw new Error('\"attach\" must be a function.');\n    }\n\n    if (turnOff && typeof turnOff !== 'function') {\n      throw new Error('\"turnOff\", if defined, must be a function.');\n    }\n\n    super({ debug });\n\n    // False alarm: indexer is a constant of type Symbol.\n    // eslint-disable-next-line security/detect-object-injection\n    this[SYMBOL_ATTACH] = attach;\n\n    // False alarm: indexer is a constant of type Symbol.\n    // eslint-disable-next-line security/detect-object-injection\n    this[SYMBOL_TURN_OFF] = turnOff;\n  }\n\n  [SYMBOL_ATTACH]: AttachFunction;\n  [SYMBOL_TURN_OFF]: TurnOffFunction;\n\n  protected performAttach(audioNodeId: string): Promise<{\n    audioStreamNode: AudioStreamNode;\n    deviceInfo: DeviceInfo;\n    format: Format;\n  }> {\n    // False alarm: indexer is a constant of type Symbol.\n    // eslint-disable-next-line security/detect-object-injection\n    return this[SYMBOL_ATTACH](audioNodeId);\n  }\n\n  protected performTurnOff(): Promise<void> {\n    const { [SYMBOL_TURN_OFF]: turnOff } = this;\n\n    return turnOff && turnOff();\n  }\n}\n\nexport default function createAudioConfig(options: CreateAudioConfigOptions) {\n  return AudioConfig.fromStreamInput(new CreateAudioConfigAudioInputStream(options));\n}\n","import { AudioInputStream } from 'microsoft-cognitiveservices-speech-sdk';\n\nimport {\n  AudioSourceErrorEvent,\n  AudioSourceEvent,\n  AudioSourceInitializingEvent,\n  AudioSourceOffEvent,\n  AudioSourceReadyEvent,\n  AudioStreamNodeAttachedEvent,\n  AudioStreamNodeAttachingEvent,\n  AudioStreamNodeDetachedEvent,\n  AudioStreamNodeErrorEvent,\n  Events,\n  EventSource\n} from 'microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/Exports.js';\n\nimport { AudioStreamFormatImpl } from 'microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/AudioStreamFormat.js';\n\nimport {\n  connectivity as Connectivity,\n  ISpeechConfigAudioDevice,\n  type as Type\n} from 'microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Exports.js';\n\nimport { isForbiddenPropertyName, withResolvers } from 'botframework-webchat-core';\nimport { v4 } from 'uuid';\n\ntype AudioStreamNode = {\n  detach: () => Promise<void>;\n  id: () => string;\n  read: () => Promise<StreamChunk<ArrayBuffer>>;\n};\n\ntype DeviceInfo = {\n  connectivity?: Connectivity | 'Bluetooth' | 'Wired' | 'WiFi' | 'Cellular' | 'InBuilt' | 'Unknown';\n  manufacturer?: string;\n  model?: string;\n  type?:\n    | Type\n    | 'Phone'\n    | 'Speaker'\n    | 'Car'\n    | 'Headset'\n    | 'Thermostat'\n    | 'Microphones'\n    | 'Deskphone'\n    | 'RemoteControl'\n    | 'Unknown'\n    | 'File'\n    | 'Stream';\n};\n\ntype Format = {\n  bitsPerSample: number;\n  channels: number;\n  samplesPerSec: number;\n};\n\ntype NormalizedOptions = Required<Omit<Options, 'debug'>> & {\n  debug: boolean;\n};\n\ntype Options = {\n  debug?: true;\n  id?: string;\n};\n\ntype StreamChunk<T> = {\n  isEnd: boolean;\n  buffer: T;\n  timeReceived: number;\n};\n\nconst SYMBOL_DEVICE_INFO_DEFERRED = Symbol('deviceInfoDeferred');\nconst SYMBOL_EVENTS = Symbol('events');\nconst SYMBOL_FORMAT_DEFERRED = Symbol('formatDeferred');\nconst SYMBOL_OPTIONS = Symbol('options');\n\n// Speech SDK quirks: Only 2 lifecycle functions are actually used.\n//                    They are: attach() and turnOff().\n//                    Others are not used, including: blob(), close(), detach(), turnOn().\nabstract class CustomAudioInputStream extends AudioInputStream {\n  constructor(options: Options = {}) {\n    super();\n\n    const normalizedOptions: NormalizedOptions = {\n      debug: options.debug || false,\n      id: options.id || v4().replace(/-/gu, '')\n    };\n\n    // False alarm: indexer is a constant of type Symbol.\n    // eslint-disable-next-line security/detect-object-injection\n    this[SYMBOL_DEVICE_INFO_DEFERRED] = withResolvers<DeviceInfo>();\n\n    // False alarm: indexer is a constant of type Symbol.\n    // eslint-disable-next-line security/detect-object-injection\n    this[SYMBOL_EVENTS] = new EventSource<AudioSourceEvent>();\n\n    // False alarm: indexer is a constant of type Symbol.\n    // eslint-disable-next-line security/detect-object-injection\n    this[SYMBOL_FORMAT_DEFERRED] = withResolvers<AudioStreamFormatImpl>();\n\n    // False alarm: indexer is a constant of type Symbol.\n    // eslint-disable-next-line security/detect-object-injection\n    this[SYMBOL_OPTIONS] = normalizedOptions;\n  }\n\n  [SYMBOL_DEVICE_INFO_DEFERRED]: PromiseWithResolvers<DeviceInfo>;\n  [SYMBOL_EVENTS]: EventSource<AudioSourceEvent>;\n  [SYMBOL_FORMAT_DEFERRED]: PromiseWithResolvers<AudioStreamFormatImpl>;\n  [SYMBOL_OPTIONS]: NormalizedOptions;\n\n  /** Gets the event source for listening to events. */\n  // ESLint: This code will only works in browsers other than IE11. Only works in ES5 is okay.\n  // @ts-ignore Accessors are only available when targeting ECMAScript 5 and higher.ts(1056)\n  get events(): EventSource<AudioSourceEvent> {\n    // False alarm: indexer is a constant of type Symbol.\n    // eslint-disable-next-line security/detect-object-injection\n    return this[SYMBOL_EVENTS];\n  }\n\n  /** Gets the format of the audio stream. */\n  // Speech SDK quirks: `AudioStreamFormatImpl` is internal implementation while `AudioStreamFormat` is public.\n  //                    It is weird to expose `AudioStreamFormatImpl` instead of `AudioStreamFormat`.\n  // Speech SDK quirks: It is weird to return a `Promise` in a property.\n  // Speech SDK quirks: In normal speech recognition, getter of \"format\" is called only after \"attach\".\n  //                    But in Direct Line Speech, it is called before \"attach\".\n  // ESLint: This code will only works in browsers other than IE11. Only works in ES5 is okay.\n  // @ts-ignore Accessors are only available when targeting ECMAScript 5 and higher.ts(1056)\n  get format(): Promise<AudioStreamFormatImpl> {\n    this.debug('Getting \"format\".');\n\n    // False alarm: indexer is a constant of type Symbol.\n    // eslint-disable-next-line security/detect-object-injection\n    return this[SYMBOL_FORMAT_DEFERRED].promise;\n  }\n\n  /** Gets the ID of this audio stream. */\n  id(): string {\n    // False alarm: indexer is a constant of type Symbol.\n    // eslint-disable-next-line security/detect-object-injection\n    return this[SYMBOL_OPTIONS].id;\n  }\n\n  /** Emits an event. */\n  // Speech SDK quirks: In JavaScript, onXxx means \"listen to event XXX\".\n  //                    Instead, in Speech SDK, it means \"emit event XXX\".\n  protected onEvent(event: AudioSourceEvent): void {\n    // False alarm: indexer is a constant of type Symbol.\n    // eslint-disable-next-line security/detect-object-injection\n    this[SYMBOL_EVENTS].onEvent(event);\n    Events.instance.onEvent(event);\n  }\n\n  /** Emits an `AudioSourceInitializingEvent`. */\n  protected emitInitializing(): void {\n    this.debug('Emitting \"AudioSourceInitializingEvent\".');\n    this.onEvent(new AudioSourceInitializingEvent(this.id()));\n  }\n\n  /** Emits an `AudioSourceReadyEvent`. */\n  protected emitReady(): void {\n    this.debug('Emitting \"AudioSourceReadyEvent\".');\n    this.onEvent(new AudioSourceReadyEvent(this.id()));\n  }\n\n  /** Emits an `AudioSourceErrorEvent`. */\n  // Speech SDK quirks: Since \"turnOn\" is never called and \"turnOff\" does not work in Direct Line Speech, the \"source error\" event is not emitted at all.\n  //                    Instead, we only emit \"node error\" event.\n  protected emitError(error: Error): void {\n    this.debug('Emitting \"AudioSourceErrorEvent\".', { error });\n\n    // Speech SDK quirks: \"error\" is a string, instead of object of type \"Error\".\n    this.onEvent(new AudioSourceErrorEvent(this.id(), error.message));\n  }\n\n  /** Emits an `AudioStreamNodeAttachingEvent`. */\n  protected emitNodeAttaching(audioNodeId: string): void {\n    this.debug(`Emitting \"AudioStreamNodeAttachingEvent\" for node \"${audioNodeId}\".`);\n    this.onEvent(new AudioStreamNodeAttachingEvent(this.id(), audioNodeId));\n  }\n\n  /** Emits an `AudioStreamNodeAttachedEvent`. */\n  protected emitNodeAttached(audioNodeId: string): void {\n    this.debug(`Emitting \"AudioStreamNodeAttachedEvent\" for node \"${audioNodeId}\".`);\n    this.onEvent(new AudioStreamNodeAttachedEvent(this.id(), audioNodeId));\n  }\n\n  /** Emits an `AudioStreamNodeErrorEvent`. */\n  protected emitNodeError(audioNodeId: string, error: Error): void {\n    this.debug(`Emitting \"AudioStreamNodeErrorEvent\" for node \"${audioNodeId}\".`, { error });\n\n    // Speech SDK quirks: \"error\" is a string, instead of object of type \"Error\".\n    this.onEvent(new AudioStreamNodeErrorEvent(this.id(), audioNodeId, error.message));\n  }\n\n  /** Emits an `AudioStreamNodeDetachedEvent`. */\n  protected emitNodeDetached(audioNodeId: string): void {\n    this.debug('Emitting \"AudioStreamNodeDetachedEvent\".');\n    this.onEvent(new AudioStreamNodeDetachedEvent(this.id(), audioNodeId));\n  }\n\n  /** Emits an `AudioSourceOffEvent`. */\n  protected emitOff(): void {\n    this.debug('Emitting \"AudioSourceOffEvent\".');\n    this.onEvent(new AudioSourceOffEvent(this.id()));\n  }\n\n  // Speech SDK quirks: Although \"close\" is marked as abstract, it is never called in our observations.\n  // ESLint: Speech SDK requires this function, but we are not implementing it.\n  close(): void {\n    this.debug('Callback for \"close\".');\n\n    throw new Error('Not implemented');\n  }\n\n  // Speech SDK quirks: Although \"turnOn\" is implemented in Speech SDK Push/PullAudioInputStream, it is never called in our observations.\n  turnOn(): void {\n    this.debug('Callback for \"turnOn\".');\n\n    throw new Error('Not implemented');\n  }\n\n  // Speech SDK quirks: Although \"detach\" is implemented in Speech SDK Push/PullAudioInputStream, it is never called in our observations.\n  detach(): void {\n    this.debug('Callback for \"detach\".');\n\n    throw new Error('Not implemented');\n  }\n\n  /** Log the message to console if `debug` is set to `true`. */\n  private debug(message, ...args) {\n    // ESLint: For debugging, will only log when \"debug\" is set to \"true\".\n    // False alarm: indexer is a constant of type Symbol.\n    // eslint-disable-next-line no-console, security/detect-object-injection\n    this[SYMBOL_OPTIONS].debug && console.info(`CustomAudioInputStream: ${message}`, ...args);\n  }\n\n  /** Implements this function. When called, it should start recording and return an `IAudioStreamNode`. */\n  protected abstract performAttach(audioNodeId: string): Promise<{\n    audioStreamNode: AudioStreamNode;\n    deviceInfo: DeviceInfo;\n    format: Format;\n  }>;\n\n  /** Attaches the device by returning an audio node. */\n  attach(audioNodeId: string): Promise<AudioStreamNode> {\n    this.debug(`Callback for \"attach\" with \"${audioNodeId}\".`);\n\n    this.emitNodeAttaching(audioNodeId);\n\n    return Promise.resolve().then<AudioStreamNode>(async () => {\n      this.emitInitializing();\n\n      try {\n        const { audioStreamNode, deviceInfo, format } = await this.performAttach(audioNodeId);\n\n        // Although only getter of \"format\" is called before \"attach\" (in Direct Line Speech),\n        // we are handling both \"deviceInfo\" and \"format\" in similar way for uniformity.\n\n        // False alarm: indexer is a constant of type Symbol.\n        // eslint-disable-next-line security/detect-object-injection\n        this[SYMBOL_DEVICE_INFO_DEFERRED].resolve(deviceInfo);\n\n        // False alarm: indexer is a constant of type Symbol.\n        // eslint-disable-next-line security/detect-object-injection\n        this[SYMBOL_FORMAT_DEFERRED].resolve(\n          new AudioStreamFormatImpl(format.samplesPerSec, format.bitsPerSample, format.channels)\n        );\n\n        this.emitReady();\n        this.emitNodeAttached(audioNodeId);\n\n        return {\n          detach: async () => {\n            this.debug(`Detaching audio node \"${audioNodeId}\".`);\n\n            await audioStreamNode.detach();\n\n            // Speech SDK quirks: Since \"turnOff\" is not called in Direct Line Speech, we will emit event \"source off\" here instead.\n            this.emitOff();\n            this.emitNodeDetached(audioNodeId);\n          },\n          id: () => audioStreamNode.id(),\n          read: () => {\n            this.debug('Reading');\n\n            return audioStreamNode.read();\n          }\n        };\n      } catch (error) {\n        this.emitNodeError(audioNodeId, error);\n\n        throw error;\n      }\n    });\n  }\n\n  /**\n   * Implements this function. When called, it should stop recording. This is called before the `IAudioStreamNode.detach` function.\n   *\n   * Note: when using with Direct Line Speech, this function is never called.\n   */\n\n  // ESLint: We are not implementing this function because it is not called by Direct Line Speech.\n  // eslint-disable-next-line class-methods-use-this\n  protected performTurnOff(): Promise<void> {\n    // ESLint: \"return\" is required by TypeScript\n    // eslint-disable-next-line no-useless-return\n    return;\n  }\n\n  /** Turn off the audio device. This is called before detaching from the graph. */\n  // Speech SDK quirks: It is confused to have both \"turnOff\" and \"detach\". \"turnOff\" is called before \"detach\".\n  //                    Why don't we put all logics at \"detach\"?\n  // Speech SDK quirks: Direct Line Speech never call \"turnOff\". \"Source off\" event need to be emitted during \"detach\" instead.\n  //                    Also, custom implementation should be done at \"detach\" instead, such as ending and closing output streams.\n  async turnOff(): Promise<void> {\n    this.debug(`Callback for \"turnOff\".`);\n\n    await this.performTurnOff();\n  }\n\n  /** Gets the device information. */\n  // ESLint: This code will only works in browsers other than IE11. Only works in ES5 is okay.\n  // @ts-ignore Accessors are only available when targeting ECMAScript 5 and higher.ts(1056)\n  get deviceInfo(): Promise<ISpeechConfigAudioDevice> {\n    this.debug(`Getting \"deviceInfo\".`);\n\n    // False alarm: indexer is a constant of type Symbol.\n    // eslint-disable-next-line security/detect-object-injection\n    return Promise.all([this[SYMBOL_DEVICE_INFO_DEFERRED].promise, this[SYMBOL_FORMAT_DEFERRED].promise]).then(\n      ([{ connectivity, manufacturer, model, type }, { bitsPerSample, channels, samplesPerSec }]) => ({\n        bitspersample: bitsPerSample,\n        channelcount: channels,\n        connectivity:\n          (typeof connectivity === 'string' &&\n            !isForbiddenPropertyName(connectivity) && // Mitigated through denylisting.\n            // eslint-disable-next-line security/detect-object-injection\n            Connectivity[connectivity]) ||\n          Connectivity.Unknown,\n        manufacturer: manufacturer || '',\n        model: model || '',\n        samplerate: samplesPerSec,\n        // Mitigated through denylisting.\n        // eslint-disable-next-line security/detect-object-injection\n        type: (typeof type === 'string' && !isForbiddenPropertyName(type) && Type[type]) || Type.Unknown\n      })\n    );\n  }\n}\n\nexport default CustomAudioInputStream;\n\nexport type { AudioStreamNode, DeviceInfo, Format, Options };\n","import validate from './validate.js';\nconst byteToHex = [];\nfor (let i = 0; i < 256; ++i) {\n    byteToHex.push((i + 0x100).toString(16).slice(1));\n}\nexport function unsafeStringify(arr, offset = 0) {\n    return (byteToHex[arr[offset + 0]] +\n        byteToHex[arr[offset + 1]] +\n        byteToHex[arr[offset + 2]] +\n        byteToHex[arr[offset + 3]] +\n        '-' +\n        byteToHex[arr[offset + 4]] +\n        byteToHex[arr[offset + 5]] +\n        '-' +\n        byteToHex[arr[offset + 6]] +\n        byteToHex[arr[offset + 7]] +\n        '-' +\n        byteToHex[arr[offset + 8]] +\n        byteToHex[arr[offset + 9]] +\n        '-' +\n        byteToHex[arr[offset + 10]] +\n        byteToHex[arr[offset + 11]] +\n        byteToHex[arr[offset + 12]] +\n        byteToHex[arr[offset + 13]] +\n        byteToHex[arr[offset + 14]] +\n        byteToHex[arr[offset + 15]]).toLowerCase();\n}\nfunction stringify(arr, offset = 0) {\n    const uuid = unsafeStringify(arr, offset);\n    if (!validate(uuid)) {\n        throw TypeError('Stringified UUID is invalid');\n    }\n    return uuid;\n}\nexport default stringify;\n","const rnds8 = new Uint8Array(16);\nexport default function rng() {\n    return crypto.getRandomValues(rnds8);\n}\n","import rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\nfunction v4(options, buf, offset) {\n    if (!buf && !options && crypto.randomUUID) {\n        return crypto.randomUUID();\n    }\n    return _v4(options, buf, offset);\n}\nfunction _v4(options, buf, offset) {\n    options = options || {};\n    const rnds = options.random ?? options.rng?.() ?? rng();\n    if (rnds.length < 16) {\n        throw new Error('Random bytes length must be >= 16');\n    }\n    rnds[6] = (rnds[6] & 0x0f) | 0x40;\n    rnds[8] = (rnds[8] & 0x3f) | 0x80;\n    if (buf) {\n        offset = offset || 0;\n        if (offset < 0 || offset + 16 > buf.length) {\n            throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);\n        }\n        for (let i = 0; i < 16; ++i) {\n            buf[offset + i] = rnds[i];\n        }\n        return buf;\n    }\n    return unsafeStringify(rnds);\n}\nexport default v4;\n","/** Creates an AudioContext object. */\nexport default function createAudioContext(): AudioContext {\n  if (typeof window.AudioContext !== 'undefined') {\n    return new window.AudioContext();\n\n    // Required by TypeScript.\n  } else if (typeof window['webkitAudioContext'] !== 'undefined') {\n    // This is for Safari as Web Audio API is still under vendor-prefixed.\n    return new window['webkitAudioContext']();\n  }\n\n  // TODO: Fix this.\n  throw new Error('This browser does not support Web Audio API.');\n}\n","export default function getUserMedia(constraints: MediaStreamConstraints): Promise<MediaStream> {\n  const { navigator } = window;\n\n  if (typeof navigator.mediaDevices !== 'undefined') {\n    return navigator.mediaDevices.getUserMedia(constraints);\n  }\n\n  // We are intentionally using the deprecated `navigator.getUserMedia` to make sure backward compatibility.\n  // @ts-ignore\n  if (typeof navigator.getUserMedia !== 'undefined') {\n    // We are intentionally using the deprecated `navigator.getUserMedia` to make sure backward compatibility.\n    // @ts-ignore\n    return new Promise((resolve, reject) => navigator.getUserMedia(constraints, resolve, reject));\n  }\n\n  throw new Error('This browser does not support Web Audio API.');\n}\n","export default function isPromiseLike<T>(promiseLike: unknown): promiseLike is PromiseLike<T> {\n  return (\n    !!promiseLike && typeof promiseLike === 'object' && 'then' in promiseLike && typeof promiseLike.then === 'function'\n  );\n}\n","import { warnOnce } from '@msinternal/botframework-webchat-base/utils';\nimport CognitiveServicesCredentials from '../types/CognitiveServicesCredentials';\nimport isPromiseLike from './isPromiseLike';\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\ntype CognitiveServicesBaseCredentials = Exclude<Exclude<CognitiveServicesCredentials, Function>, Promise<any>>;\n\nconst BEARER_PREFIX_LOWERCASE = 'bearer ';\n\nconst warnBearerPrefix = warnOnce('botframework-webchat: Remove \"Bearer\" from the speech authorization token.');\n\nfunction removeBearerInAuthorizationTokenForResolved(\n  credentials: CognitiveServicesBaseCredentials\n): CognitiveServicesBaseCredentials {\n  if (\n    'authorizationToken' in credentials &&\n    credentials.authorizationToken?.toLowerCase().startsWith(BEARER_PREFIX_LOWERCASE)\n  ) {\n    warnBearerPrefix();\n\n    return Object.freeze({\n      ...credentials,\n      authorizationToken: credentials.authorizationToken.substring(BEARER_PREFIX_LOWERCASE.length)\n    });\n  }\n\n  return credentials;\n}\n\nfunction removeBearerInAuthorizationTokenForPromiseOrResolved(\n  credentials: CognitiveServicesBaseCredentials | Promise<CognitiveServicesBaseCredentials>\n): CognitiveServicesBaseCredentials | Promise<CognitiveServicesBaseCredentials> {\n  if (isPromiseLike<CognitiveServicesBaseCredentials>(credentials)) {\n    return credentials.then(credentials => removeBearerInAuthorizationTokenForResolved(credentials));\n  }\n\n  return removeBearerInAuthorizationTokenForResolved(credentials);\n}\n\nfunction removeBearerInAuthorizationToken(credentials: CognitiveServicesCredentials) {\n  if (typeof credentials === 'function') {\n    return (() => removeBearerInAuthorizationTokenForPromiseOrResolved(credentials())) satisfies () =>\n      | CognitiveServicesBaseCredentials\n      | Promise<CognitiveServicesBaseCredentials> as CognitiveServicesCredentials;\n  }\n\n  return removeBearerInAuthorizationTokenForPromiseOrResolved(credentials);\n}\n\nexport default removeBearerInAuthorizationToken;\n","import { WebSpeechPonyfillFactory } from 'botframework-webchat-api';\nimport { AudioConfig } from 'microsoft-cognitiveservices-speech-sdk';\nimport { createSpeechServicesPonyfill } from 'web-speech-cognitive-services';\n\nimport createMicrophoneAudioConfigAndAudioContext from './speech/createMicrophoneAudioConfigAndAudioContext';\nimport removeBearerInAuthorizationToken from './speech/removeBearerInAuthorizationToken';\nimport CognitiveServicesAudioOutputFormat from './types/CognitiveServicesAudioOutputFormat';\nimport CognitiveServicesCredentials from './types/CognitiveServicesCredentials';\nimport CognitiveServicesTextNormalization from './types/CognitiveServicesTextNormalization';\n\nexport default function createCognitiveServicesSpeechServicesPonyfillFactory({\n  audioConfig,\n  audioContext,\n  audioInputDeviceId,\n  credentials,\n  enableTelemetry,\n  initialSilenceTimeout,\n  speechRecognitionEndpointId,\n  speechSynthesisDeploymentId,\n  speechSynthesisOutputFormat,\n  textNormalization\n}: {\n  audioConfig?: AudioConfig;\n  audioContext?: AudioContext;\n  audioInputDeviceId?: string;\n  credentials: CognitiveServicesCredentials;\n  enableTelemetry?: true;\n  initialSilenceTimeout?: number | undefined;\n  speechRecognitionEndpointId?: string;\n  speechSynthesisDeploymentId?: string;\n  speechSynthesisOutputFormat?: CognitiveServicesAudioOutputFormat;\n  textNormalization?: CognitiveServicesTextNormalization;\n}): WebSpeechPonyfillFactory {\n  if (!window.navigator.mediaDevices && !audioConfig) {\n    console.warn(\n      'botframework-webchat: Your browser does not support Web Audio or the page is not loaded via HTTPS or localhost. Cognitive Services Speech Services is disabled. However, you may pass a custom AudioConfig to enable speech in this environment.'\n    );\n\n    return () => ({});\n  }\n\n  if (audioConfig) {\n    audioInputDeviceId &&\n      console.warn(\n        'botframework-webchat: \"audioConfig\" and \"audioInputDeviceId\" cannot be set at the same time; ignoring \"audioInputDeviceId\".'\n      );\n\n    audioContext &&\n      console.warn(\n        'botframework-webchat: \"audioConfig\" and \"audioContext\" cannot be set at the same time; ignoring \"audioContext\" for speech recognition.'\n      );\n  } else {\n    ({ audioConfig, audioContext } = createMicrophoneAudioConfigAndAudioContext({\n      audioContext,\n      audioInputDeviceId,\n      enableTelemetry\n    }));\n  }\n\n  return ({ referenceGrammarID } = {}) => {\n    const { SpeechGrammarList, SpeechRecognition, speechSynthesis, SpeechSynthesisUtterance } =\n      createSpeechServicesPonyfill({\n        audioConfig,\n        audioContext,\n        credentials: removeBearerInAuthorizationToken(credentials),\n        enableTelemetry,\n        initialSilenceTimeout,\n        referenceGrammars: referenceGrammarID ? [`luis/${referenceGrammarID}-PRODUCTION`] : [],\n        speechRecognitionEndpointId,\n        speechSynthesisDeploymentId,\n        speechSynthesisOutputFormat,\n        textNormalization\n      });\n\n    return {\n      resumeAudioContext: () => audioContext && audioContext.state === 'suspended' && audioContext.resume(),\n      SpeechGrammarList,\n      SpeechRecognition,\n      speechSynthesis,\n      SpeechSynthesisUtterance\n    };\n  };\n}\n","import { createAdapters } from 'botframework-directlinespeech-sdk';\nimport { WebSpeechPonyfill } from 'botframework-webchat-api';\nimport type { DirectLineJSBotConnection } from 'botframework-webchat-core';\nimport { AudioConfig } from 'microsoft-cognitiveservices-speech-sdk';\n\nimport createMicrophoneAudioConfigAndAudioContext from './speech/createMicrophoneAudioConfigAndAudioContext';\nimport CognitiveServicesAudioOutputFormat from './types/CognitiveServicesAudioOutputFormat';\nimport CognitiveServicesCredentials from './types/CognitiveServicesCredentials';\nimport CognitiveServicesTextNormalization from './types/CognitiveServicesTextNormalization';\n\nconst DEFAULT_LANGUAGE = 'en-US';\n\n// TODO: When using DLSpeech via bundle, we will add our own MicrophoneAudioConfig.\nexport default function createDirectLineSpeechAdapters({\n  audioConfig,\n  audioContext,\n  audioInputDeviceId,\n  enableInternalHTTPSupport,\n  enableTelemetry,\n  fetchCredentials,\n  speechRecognitionEndpointId,\n  speechRecognitionLanguage = window?.navigator?.language || DEFAULT_LANGUAGE,\n  speechSynthesisDeploymentId,\n  speechSynthesisOutputFormat,\n  textNormalization,\n  userID,\n  username\n}: {\n  audioConfig?: AudioConfig;\n  audioContext?: AudioContext;\n  audioInputDeviceId?: string;\n  enableInternalHTTPSupport?: true;\n  enableTelemetry?: true;\n  fetchCredentials: CognitiveServicesCredentials;\n  speechRecognitionEndpointId?: string;\n  speechRecognitionLanguage?: string;\n  speechSynthesisDeploymentId?: string;\n  speechSynthesisOutputFormat?: CognitiveServicesAudioOutputFormat;\n  textNormalization?: CognitiveServicesTextNormalization;\n  userID?: string;\n  username?: string;\n}): Promise<{\n  directLine: DirectLineJSBotConnection;\n  webSpeechPonyfill: WebSpeechPonyfill;\n}> {\n  if (audioConfig) {\n    audioInputDeviceId &&\n      console.warn(\n        'botframework-webchat: \"audioConfig\" and \"audioInputDeviceId\" cannot be set at the same time; ignoring \"audioInputDeviceId\".'\n      );\n\n    audioContext &&\n      console.warn(\n        'botframework-webchat: \"audioConfig\" and \"audioContext\" cannot be set at the same time; ignoring \"audioContext\" for speech recognition.'\n      );\n  } else if (!window.navigator.mediaDevices) {\n    // If the browser does not support or allow microphone access, we will continue to create Direct Line Speech adapter without custom \"audioConfig\" and \"audioContext\".\n    // In Direct Line Speech SDK, it will disable speech functionality, only leaving text chat available via the protocol.\n    console.warn(\n      'botframework-webchat: Your browser does not support or allow microphone access or the page is not loaded via HTTPS or localhost. Speech is disabled for Direct Line Speech. However, you may pass a custom \"audioConfig\" to enable speech in this environment.'\n    );\n  } else {\n    ({ audioConfig, audioContext } = createMicrophoneAudioConfigAndAudioContext({\n      audioContext,\n      audioInputDeviceId,\n      enableTelemetry\n    }));\n  }\n\n  return createAdapters({\n    audioConfig,\n    audioContext,\n    audioInputDeviceId: undefined,\n    enableInternalHTTPSupport,\n    enableTelemetry,\n    fetchCredentials,\n    speechRecognitionEndpointId,\n    speechRecognitionLanguage,\n    speechSynthesisDeploymentId,\n    speechSynthesisOutputFormat,\n    textNormalization,\n    userID,\n    username\n    // TODO: [P1] Need to port Direct Line Speech SDK to TypeScript to remove this any.\n  }) as any;\n}\n","export * from './minimal';\n\n// #region Build info\nimport buildInfo from '../../buildInfo';\n\nbuildInfo.set('variant', 'full');\n\nconst { version } = buildInfo;\n// #endregion\n\n// #region Overrides\nexport { default as createStyleSet } from '../../createFullStyleSet';\nexport { ReactWebChat } from './component/full';\nexport { renderWebChat } from './renderWebChat/full';\nexport { type StrictStyleOptions, type StyleOptions } from './styleOptions/full';\nexport { version };\n// #endregion\n\n// #region Adds\nexport { default as createAdaptiveCardsAttachmentForScreenReaderMiddleware } from '../../adaptiveCards/createAdaptiveCardsAttachmentForScreenReaderMiddleware';\nexport { default as createAdaptiveCardsAttachmentMiddleware } from '../../adaptiveCards/createAdaptiveCardsAttachmentMiddleware';\nexport { default as createCognitiveServicesSpeechServicesPonyfillFactory } from '../../createCognitiveServicesSpeechServicesPonyfillFactory';\nexport { default as createDirectLineSpeechAdapters } from '../../createDirectLineSpeechAdapters';\nexport { default as renderMarkdown } from '../../markdown/renderMarkdown';\nexport { type AdaptiveCardsPackage } from '../../types/AdaptiveCardsPackage';\n// #endregion\n","export * from './minimal';\n\n// #region Overrides\nexport * from '../actual/full';\nexport {\n  createStyleSet,\n  ReactWebChat as default,\n  ReactWebChat,\n  renderWebChat,\n  version,\n  type StrictStyleOptions,\n  type StyleOptions\n} from '../actual/full';\n// #endregion\n\n// #region Overrides for backward compatibility\nimport { deprecateObject } from '@msinternal/botframework-webchat-base/utils';\n\nimport * as hooks from '../actual/hook/full';\n\nconst deprecatedHooks = deprecateObject(\n  hooks,\n  \"`import { hooks } from 'botframework-webchat'` has been deprecated, use `import { %s } from 'botframework-webchat/hook.js'` instead.\"\n) as typeof hooks; // Need explicit type casting.\n\nexport { deprecatedHooks as hooks };\n\nimport * as Components from '../actual/component/full';\n\nconst deprecatedComponents = deprecateObject(\n  Components,\n  \"`import { Components } from 'botframework-webchat'` has been deprecated, use `import { %s } from 'botframework-webchat/component.js'` instead.\"\n) as typeof Components; // Need explicit type casting.\n\nexport { deprecatedComponents as Components };\n// #endregion\n"],"mappings":"+TAAA,IAAAA,GAAAC,EAAAC,IAAA,cAEA,OAAO,eAAeA,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A,eAAe,MACf,EACA,IACA,IACA,EACA,EACAa,EACAA,EACA,EAAK,EACb,IAAK,+BACD,OAAO,IAAIX,EACPF,EAAA,eAAe,MACf,EACA,KACA,IACA,GACA,EACAa,EACA,gCACA,EAAI,EACZ,IAAK,gCACD,OAAO,IAAIX,EACPF,EAAA,eAAe,MACf,EACA,KACA,IACA,GACA,EACAa,EACAA,EACA,EAAK,EACb,IAAK,kCACD,OAAO,IAAIX,EACPF,EAAA,eAAe,IACf,EACA,KACA,KACA,EACA,GACAa,EACAA,EACA,EAAK,EACb,IAAK,mCACD,OAAO,IAAIX,EACPF,EAAA,eAAe,IACf,EACA,KACA,MACA,EACA,GACAa,EACAA,EACA,EAAK,EACb,IAAK,kCACD,OAAO,IAAIX,EACPF,EAAA,eAAe,IACf,EACA,KACA,KACA,EACA,GACAa,EACAA,EACA,EAAK,EACb,IAAK,kCACD,OAAO,IAAIX,EACPF,EAAA,eAAe,IACf,EACA,KACA,KACA,EACA,GACAa,EACAA,EACA,EAAK,EACb,IAAK,kCACD,OAAO,IAAIX,EACPF,EAAA,eAAe,IACf,EACA,KACA,MACA,EACA,GACAa,EACAA,EACA,EAAK,EACb,IAAK,mCACD,OAAO,IAAIX,EACPF,EAAA,eAAe,IACf,EACA,KACA,MACA,EACA,GACAa,EACAA,EACA,EAAK,EACb,IAAK,gCACD,OAAO,IAAIX,EACPF,EAAA,eAAe,UACf,EACA,KACA,KACA,EACA,GACAa,EACAA,EACA,EAAK,EAEb,IAAK,2BACD,OAAO,IAAIX,EACPF,EAAA,eAAe,IACf,EACA,IACA,KACA,EACA,GACAa,EACA,0BACA,EAAI,EACZ,IAAK,4BACD,OAAO,IAAIX,EACPF,EAAA,eAAe,IACf,EACA,KACA,KACA,EACA,GACAa,EACA,2BACA,EAAI,EACZ,IAAK,4BACD,OAAO,IAAIX,EACPF,EAAA,eAAe,MACf,EACA,IACA,IACA,EACA,EACAa,EACA,2BACA,EAAI,EACZ,IAAK,2BACD,OAAO,IAAIX,EACPF,EAAA,eAAe,IACf,EACA,KACA,KACA,EACA,GACAa,EACA,2BACA,EAAK,EACb,IAAK,2BACD,OAAO,IAAIX,EACPF,EAAA,eAAe,IACf,EACA,KACA,KACA,EACA,GACAa,EACA,2BACA,EAAK,EACb,IAAK,0BACD,OAAO,IAAIX,EACPF,EAAA,eAAe,IACf,EACA,IACA,KACA,EACA,GACAa,EACA,0BACA,EAAK,EACb,IAAK,4BACD,OAAO,IAAIX,EACPF,EAAA,eAAe,SACf,EACA,KACA,KACA,EACA,GACAa,EACAA,EACA,EAAK,EACb,IAAK,4BACD,OAAO,IAAIX,EACPF,EAAA,eAAe,SACf,EACA,KACA,KACA,EACA,GACAa,EACAA,EACA,EAAK,EACb,IAAK,2BACD,OAAO,IAAIX,EACPF,EAAA,eAAe,IACf,EACA,KACA,KACA,EACA,GACAa,EACA,2BACA,EAAK,EACb,IAAK,4BACD,OAAO,IAAIX,EACPF,EAAA,eAAe,IACf,EACA,KACA,KACA,EACA,GACAa,EACA,2BACA,EAAI,EACZ,IAAK,kCACD,OAAO,IAAIX,EACPF,EAAA,eAAe,IACf,EACA,KACA,MACA,EACA,GACAa,EACAA,EACA,EAAK,EACb,IAAK,mCACD,OAAO,IAAIX,EACPF,EAAA,eAAe,IACf,EACA,KACA,MACA,EACA,GACAa,EACAA,EACA,EAAK,EACb,IAAK,4BACD,OAAO,IAAIX,EACPF,EAAA,eAAe,SACf,EACA,KACA,KACA,EACA,GACAa,EACAA,EACA,EAAK,EACb,IAAK,6BACD,OAAO,IAAIX,EACPF,EAAA,eAAe,UACf,EACA,KACA,IACA,EACA,GACAa,EACAA,EACA,EAAK,EACb,IAAK,6BACD,OAAO,IAAIX,EACPF,EAAA,eAAe,UACf,EACA,KACA,IACA,EACA,GACAa,EACAA,EACA,EAAK,EACb,IAAK,oCACD,OAAO,IAAIX,EACPF,EAAA,eAAe,UACf,EACA,KACA,IACA,EACA,GACAa,EACAA,EACA,EAAK,EACb,IAAK,qCACD,OAAO,IAAIX,EACPF,EAAA,eAAe,KACf,EACA,KACA,IACA,EACA,GACAa,EACAA,EACA,EAAK,EACb,IAAK,qCACD,OAAO,IAAIX,EACPF,EAAA,eAAe,KACf,EACA,KACA,IACA,EACA,GACAa,EACAA,EACA,EAAK,EACb,IAAK,qCACD,OAAO,IAAIX,EACPF,EAAA,eAAe,KACf,EACA,KACA,IACA,EACA,GACAa,EACAA,EACA,EAAK,EACb,IAAK,8BACD,OAAO,IAAIX,EACPF,EAAA,eAAe,KACf,EACA,KACA,KACA,EACA,GACAa,EACAA,EACA,EAAK,EACb,IAAK,8BACD,OAAO,IAAIX,EACPF,EAAA,eAAe,KACf,EACA,KACA,IACA,EACA,GACAa,EACAA,EACA,EAAK,EACb,IAAK,gCACD,OAAO,IAAIX,EACPF,EAAA,eAAe,UACf,EACA,KACA,KACA,EACA,GACAa,EACAA,EACA,EAAK,EACb,IAAK,0BACD,OAAO,IAAIX,EACPF,EAAA,eAAe,KACf,EACA,IACA,IACA,EACA,EACAa,EACAA,EACA,EAAK,EACb,IAAK,2BACD,OAAO,IAAIX,EACPF,EAAA,eAAe,KACf,EACA,IACA,IACA,EACA,EACAa,EACA,0BACA,EAAI,EACZ,IAAK,6BACD,OAAO,IAAIX,EACPF,EAAA,eAAe,IACf,EACA,MACA,MACA,EACA,GACAa,EACAA,EACA,EAAK,EACb,IAAK,8BACD,OAAO,IAAIX,EACPF,EAAA,eAAe,IACf,EACA,MACA,MACA,EACA,GACAa,EACA,6BACA,EAAI,EACZ,IAAK,6BACD,OAAO,IAAIX,EACPF,EAAA,eAAe,IACf,EACA,MACA,MACA,EACA,GACAa,EACAA,EACA,EAAK,EACb,IAAK,8BACD,OAAO,IAAIX,EACPF,EAAA,eAAe,IACf,EACA,MACA,MACA,EACA,GACAa,EACA,6BACA,EAAI,EACZ,IAAK,gBACD,OAAO,IAAIX,EACPF,EAAA,eAAe,OACf,EACA,KACA,KACA,EACA,GACAa,EACAA,EACA,EAAK,EACb,IAAK,oBACD,O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AAC,EACA,4BAAAC,EACA,0BAAAC,EACA,4BAAAC,EACA,4BAAAC,EACA,kBAAAC,EACA,OAAAC,EACA,SAAAC,CAEF,CAAC,CACH,CChFAG,GAAU,IAAI,UAAW,MAAM,EAE/B,GAAM,CAAE,QAAAC,EAAQ,EAAID,GCapB,IAAME,GAAkBC,GACtBC,GACA,sIACF,EAMA,IAAMC,GAAuBC,GAC3BC,GACA,gJACF","names":["require_rng","__commonJSMin","exports","rng","getRandomValues","rnds8","require_regex","__commonJSMin","exports","_default","require_validate","__commonJSMin","exports","_regex","_interopRequireDefault","obj","validate","uuid","_default","require_stringify","__commonJSMin","exports","unsafeStringify","_validate","_interopRequireDefault","obj","byteToHex","i","arr","offset","stringify","uuid","_default","require_v1","__commonJSMin","exports","_rng","_interopRequireDefault","_stringify","obj","_nodeId","_clockseq","_lastMSecs","_lastNSecs","v1","options","buf","offset","b","node","clockseq","seedBytes","msecs","nsecs","dt","tl","tmh","n","_default","require_parse","__commonJSMin","exports","_validate","_interopRequireDefault","obj","parse","uuid","v","arr","_default","require_v35","__commonJSMin","exports","v35","_stringify","_parse","_interopRequireDefault","obj","stringToBytes","str","bytes","i","DNS","URL","name","version","hashfunc","generateUUID","value","namespace","buf","offset","_namespace","require_md5","__commonJSMin","exports","md5","bytes","msg","i","md5ToHexEncodedArray","wordsToMd5","bytesToWords","input","output","length32","hexTab","x","hex","getOutputLength","inputLength8","len","a","b","c","d","olda","oldb","oldc","oldd","md5ff","md5gg","md5hh","md5ii","safeAdd","length8","y","lsw","bitRotateLeft","num","cnt","md5cmn","q","s","t","_default","require_v3","__commonJSMin","exports","_v","_interopRequireDefault","_md","obj","v3","_default","require_native","__commonJSMin","exports","randomUUID","_default","require_v4","__commonJSMin","exports","_native","_interopRequireDefault","_rng","_stringify","obj","v4","options","buf","offset","rnds","i","_default","require_sha1","__commonJSMin","exports","f","s","x","y","z","ROTL","n","sha1","bytes","K","H","msg","i","l","N","M","arr","j","W","t","a","b","c","d","e","T","_default","require_v5","__commonJSMin","exports","_v","_interopRequireDefault","_sha","obj","v5","_default","require_nil","__commonJSMin","exports","_default","require_version","__commonJSMin","exports","_validate","_interopRequireDefault","obj","version","uuid","_default","require_commonjs_browser","__commonJSMin","exports","_nil","_parse","_stringify","_v","_v2","_v3","_v4","_validate","_version","_interopRequireDefault","obj","uuid_1","createGuid","exports","createNoDashGuid","Guid_js_1","EventType","exports","PlatformEvent","eventName","eventType","PlatformEvent_js_1","AudioSourceEvent","eventName","audioSourceId","eventType","exports","AudioSourceInitializingEvent","AudioSourceReadyEvent","AudioSourceOffEvent","AudioSourceErrorEvent","error","AudioStreamNodeEvent","audioNodeId","AudioStreamNodeAttachingEvent","AudioStreamNodeAttachedEvent","AudioStreamNodeDetachedEvent","AudioStreamNodeErrorEvent","PlatformEvent_js_1","ServiceEvent","eventName","jsonstring","eventType","exports","ConnectionEvent","connectionId","ConnectionStartEvent","uri","headers","ConnectionEstablishedEvent","ConnectionClosedEvent","statusCode","reason","ConnectionErrorEvent","message","type","ConnectionEstablishErrorEvent","statuscode","ConnectionMessageReceivedEvent","networkReceivedTimeISO","ConnectionMessageSentEvent","networkSentTimeISO","ConnectionRedirectEvent","redirectUrl","originalUrl","context","ArgumentNullError","argumentName","exports","InvalidOperationError","error","ObjectDisposedError","objectName","Error_js_1","Guid_js_1","MessageType","exports","ConnectionMessage","messageType","body","headers","id","ConnectionOpenResponse","statusCode","reason","exports","DeferralMap","id","deferral","result","error","exports","PlatformEvent_js_1","DialogEvent","eventName","eventType","exports","SendingAgentContextMessageEvent","agentConfig","Error_js_1","Guid_js_1","EventSource","metadata","event","paramName","eventId","onEventCallback","id","listener","e","exports","Error_js_1","EventSource_js_1","Events","_Events","eventSource","exports","ConnectionState","exports","require_IErrorMessages","__commonJSMin","exports","Error_js_1","List","_List","list","item","itemIndex","index","count","removedElements","addedCallback","subscriptionId","removedCallback","disposedCallback","seperator","cloneCopy","val","callback","i","selectList","filteredList","compareFn","orderedArray","a","b","array","reason","subscriptions","exports","PromiseState","exports","PromiseResult","promiseResultEventSource","result","error","PromiseResultEventSource","onSetResult","onSetError","Deferred","resolve","reject","Sink","i","errorHandler","successCallback","errorCallback","e","marshalPromiseToCallbacks","promise","cb","err","val","typedError","Error_js_1","List_js_1","Promise_js_1","SubscriberType","Queue","list","item","resolve","promise","val","deferredSubscriber","pendingItemProcessor","reason","subs","detachable","promiseArray","wrapper","lists","subscriber","dequeuedItem","exports","ConnectionMessage_js_1","Error_js_1","Guid_js_1","RawWebsocketMessage","messageType","payload","id","exports","RiffPcmEncoder","actualSampleRate","desiredSampleRate","actualAudioFrame","audioFrame","audioLength","buffer","view","offset","str","i","input","srcFrame","srcRate","dstRate","ratio","dstLength","dstFrame","srcOffset","dstOffset","nextSrcOffset","accum","count","exports","Error_js_1","Guid_js_1","Queue_js_1","Stream","streamId","streamChunk","exports","TranslationStatus","exports","Exports_js_1","ChunkedArrayBufferStream","targetChunkSize","streamId","chunk","bytesCopiedFromBuffer","bytesToCopy","targetView","sourceView","exports","Timeout","_Timeout","scheduledTimeoutFunctions","unhandledRequests","workerUrl","worker","data","timerId","idOrFunc","unhandledTimerId","id","message","func","delay","exports","PlatformEvent_js_1","OCSPEvent","eventName","eventType","signature","exports","OCSPMemoryCacheHitEvent","OCSPCacheMissEvent","OCSPDiskCacheHitEvent","OCSPCacheUpdateNeededEvent","OCSPMemoryCacheStoreEvent","OCSPDiskCacheStoreEvent","OCSPCacheUpdateCompleteEvent","OCSPStapleReceivedEvent","OCSPWSUpgradeStartedEvent","serialNumber","OCSPCacheEntryExpiredEvent","expireTime","OCSPCacheEntryNeedsRefreshEvent","startTime","OCSPCacheHitEvent","OCSPVerificationFailedEvent","error","OCSPCacheFetchErrorEvent","OCSPResponseRetrievedEvent","OCSPCacheUpdateErrorEvent","Exports_js_1","BackgroundEvent","error","exports","__exportStar","exports","TranslationStatus_js_1","HeaderNames","exports","AuthInfo","headerName","token","exports","Exports_js_1","HeaderNames_js_1","IAuthentication_js_1","CognitiveSubscriptionKeyAuthentication","subscriptionKey","authFetchEventId","exports","Exports_js_1","IAuthentication_js_1","HeaderNames_js_1","CognitiveTokenAuthentication","_CognitiveTokenAuthentication","fetchCallback","fetchOnExpiryCallback","authFetchEventId","token","exports","Exports_js_1","SpeechRecognitionEvent","eventName","requestId","sessionId","eventType","exports","RecognitionTriggeredEvent","audioSourceId","audioNodeId","ListeningStartedEvent","ConnectingToServiceEvent","authFetchEventid","RecognitionStartedEvent","authFetchEventId","RecognitionCompletionStatus","RecognitionEndedEvent","serviceTag","status","error","Exports_js_1","exports","Contracts","_Contracts","param","name","maxLength","minLength","isDisposed","array","item","value","rangeStart","rangeEnd","exports","fs","__importStar","LogLevel_js_1","Contracts_js_1","ConsoleLoggingListener","logLevelFilter","path","enableOutput","event","log","logFragments","e","prop","value","valueToLog","exports","AudioFormatTag","exports","AudioStreamFormat","AudioStreamFormatImpl","samplesPerSecond","bitsPerSample","channels","format","_AudioStreamFormatImpl","samplesPerSec","isWavFormat","view","sampleRate","AudioContext","offset","str","i","Exports_js_1","Exports_js_2","AudioStreamFormat_js_1","exports","MicAudioSource","_MicAudioSource","privRecorder","deviceId","audioSourceId","mediaStream","error","typedError","nav","getUserMedia","constraints","successCallback","errorCallback","next","errorMsg","reason","audioNodeId","stream","streamId","label","name","value","defaultMicrophoneName","microphoneDeviceId","deferred","devices","device","event","hasClose","Exports_js_1","Exports_js_2","AudioStreamFormat_js_1","FileAudioSource","file","filename","audioSourceId","errorMsg","audioNodeId","stream","streamId","result","header","headerResult","processHeader","view","getWord","index","formatSize","channelCount","sampleRate","bitsPerSample","pos","reader","event","h","onerror","error","format","chunk","processFile","buff","ev","fileBuffer","c","e","exports","Exports_1","PcmRecorder","stopInputOnRelease","context","mediaStream","outputStream","waveStreamEncoder","micInput","attachScriptProcessor","scriptNode","bufferSize","audioSampleRate","event","inputFrame","waveFrame","skipAudioWorklet","workletScript","blob","workletNode","ev","err","track","url","exports","net","__importStar","tls","agent_base_1","__importDefault","https_proxy_agent_1","ws_1","HeaderNames_js_1","Exports_js_1","WebsocketMessageAdapter","_WebsocketMessageAdapter","uri","connectionId","messageFormatter","proxyInfo","headers","enableCompression","proxyConfiguredInNode","protocol","options","redirectUrl","event","reason","error","networkReceivedTime","deferred","rawMessage","connectionMessage","message","messageSendStatusDeferral","messageSendDeferral","sendItem","e","code","closeReason","pendingSendItem","sendError","agent","httpProxyOptions","request","socketPromise","baseAgent","resolve","reject","socket","exports","Exports_js_1","WebsocketMessageAdapter_js_1","WebsocketConnection","uri","queryParameters","headers","messageFormatter","proxyInfo","enableCompression","connectionId","queryParams","i","paramName","key","val","headerName","message","exports","ReplayableAudioNode","audioSource","bytesPerSecond","offsetToSeek","bytesToSeek","retVal","result","BufferEntry","offset","i","value","startOffset","endOffset","exports","chunk","serial","byteOffset","fs","__importStar","Contracts_js_1","AudioFileWriter","filename","format","headerOffset","buffer","exports","Exports_js_1","Exports_js_2","Guid_js_1","Exports_js_3","AudioStreamFormat_js_1","AudioInputStream","format","PushAudioInputStream","callback","PullAudioInputStream","exports","PushAudioInputStreamImpl","dataBuffer","audioNodeId","stream","event","arrayBuffer","buf","view","i","PullAudioInputStreamImpl","totalBytes","transmitBuff","readBuff","pulledBytes","SpeechSynthesisOutputFormat","exports","SpeechSynthesisOutputFormat_js_1","AudioStreamFormat_js_1","AudioOutputFormatImpl","_AudioOutputFormatImpl","formatTag","channels","samplesPerSec","avgBytesPerSec","blockAlign","bitsPerSample","audioFormatString","requestAudioFormatString","hasHeader","speechSynthesisOutputFormat","speechSynthesisOutputFormatString","audioLength","view","audio","tmp","exports","Exports_js_1","Contracts_js_1","AudioOutputFormat_js_1","AudioOutputStream","PullAudioOutputStream","exports","PullAudioOutputStreamImpl","format","dataBuffer","intView","totalBytes","chunk","tmpBuffer","PushAudioOutputStream","callback","PushAudioOutputStreamImpl","buffer","Exports_js_1","Contracts_js_1","Exports_js_2","AudioFileWriter_js_1","AudioInputStream_js_1","AudioOutputStream_js_1","AudioConfig","_AudioConfig","pcmRecorder","AudioConfigImpl","deviceId","file","name","audioStream","AudioOutputConfigImpl","player","filename","exports","source","cb","err","error","audioNodeId","value","def","destination","format","buffer","CancellationReason","exports","PullAudioInputStreamCallback","exports","PushAudioOutputStreamCallback","exports","Contracts_js_1","KeywordRecognitionModel","fileName","file","exports","SessionEventArgs","sessionId","exports","Exports_js_1","RecognitionEventArgs","offset","sessionId","exports","OutputFormat","exports","RecognitionResult","resultId","reason","text","duration","offset","language","languageDetectionConfidence","errorDetails","json","properties","exports","Exports_js_1","SpeechRecognitionResult","resultId","reason","text","duration","offset","language","languageDetectionConfidence","speakerId","errorDetails","json","properties","exports","Exports_js_1","SpeechRecognitionEventArgs","result","offset","sessionId","exports","ConversationTranscriptionEventArgs","MeetingTranscriptionEventArgs","Exports_js_1","CancellationEventArgsBase","reason","errorDetails","errorCode","offset","sessionId","exports","CancellationEventArgsBase_js_1","SpeechRecognitionCanceledEventArgs","exports","Exports_js_1","TranslationRecognitionEventArgs","result","offset","sessionId","exports","Exports_js_1","TranslationSynthesisEventArgs","result","sessionId","exports","Exports_js_1","TranslationRecognitionResult","_TranslationRecognitionResult","translations","resultId","reason","text","duration","offset","language","languageDetectionConfidence","errorDetails","json","properties","result","exports","TranslationSynthesisResult","reason","audio","exports","ResultReason","exports","Exports_js_1","Contracts_js_1","Exports_js_2","SpeechConfig","subscriptionKey","region","speechImpl","SpeechConfigImpl","endpoint","auth","isValidString","isTokenCredential","isKeyCredential","hostName","authorizationToken","exports","_SpeechConfigImpl","tokenCredential","value","name","def","proxyHostName","proxyPort","proxyUserName","proxyPassword","currentProperties","profanity","ret","language","voice","format","Exports_js_1","Contracts_js_1","Exports_js_2","SpeechTranslationConfig","subscriptionKey","region","ret","SpeechTranslationConfigImpl","authorizationToken","hostName","speechImpl","endpoint","auth","isValidString","isTokenCredential","isKeyCredential","exports","tokenCredential","value","languages","proxyHostName","proxyPort","proxyUserName","proxyPassword","name","def","currentProperties","profanity","language","voice","format","Exports_js_1","PropertyCollection","_PropertyCollection","key","def","keyToUse","value","clonedMap","n","destinationCollection","exports","PropertyId","exports","Exports_js_1","Exports_js_2","Contracts_js_1","Exports_js_3","Recognizer","_Recognizer","audioConfig","properties","connectionFactory","tokenCredential","cb","errorCb","disposing","enabled","osPlatform","osName","osVersion","recognizerConfig","recognitionMode","ret","result","timeoutProperty","timeoutMs","error","promise","errorMessage","_","reject","subscriptionKey","err","authorizationToken","exports","RecognitionMode","exports","SpeechStartEventSensitivity","Exports_js_1","PhraseDetectionContext_js_1","Exports_js_2","Contracts_js_1","Exports_js_3","SpeechRecognizer","_SpeechRecognizer","speechConfig","audioConfig","speechConfigImpl","autoDetectSourceLanguageConfig","token","cb","err","model","errorCb","disposing","authentication","connectionFactory","recognizerConfig","configImpl","exports","HeaderNames_js_1","Exports_js_1","PropertyCollection_js_1","PropertyId_js_1","ConnectionMessage","exports","ConnectionMessageImpl","message","header","key","Exports_js_1","Exports_js_2","ConnectionMessage_js_1","Contracts_js_1","Exports_js_3","Connection","_Connection","recognizer","recoBase","ret","synthesizer","synthBase","cb","err","path","propertyName","propertyValue","context","payload","success","error","connectionEvent","exports","Exports_js_1","PhraseDetectionContext_js_1","Exports_js_2","Connection_js_1","Contracts_js_1","Exports_js_3","TranslationRecognizer","_TranslationRecognizer","speechConfig","audioConfig","connectionFactory","configImpl","speechTranslationConfig","autoDetectSourceLanguageConfig","speechTranslationConfigImpl","value","cb","err","lang","languages","index","errorCb","disposing","authentication","recognizerConfig","conn","voiceName","payload","languageToVoiceMap","exports","Exports_js_1","Translations","key","def","value","exports","NoMatchReason","exports","Exports_js_1","Exports_js_2","NoMatchDetails","_NoMatchDetails","reason","result","simpleSpeech","exports","TranslationRecognitionCanceledEventArgs","sessionid","cancellationReason","errorDetails","errorCode","result","exports","CancellationDetailsBase","reason","errorDetails","errorCode","exports","Exports_js_1","CancellationDetailsBase_js_1","Exports_js_2","CancellationDetails","_CancellationDetails","reason","errorDetails","errorCode","result","simpleSpeech","exports","CancellationErrorCode","exports","Exports_js_1","ConnectionEventArgs","exports","Exports_js_1","ServiceEventArgs","json","name","sessionId","exports","Contracts_js_1","PhraseListGrammar","_PhraseListGrammar","recogBase","recognizer","recoBase","phrase","phrases","weight","exports","Contracts_js_1","Exports_js_1","DialogServiceConfig","value","exports","DialogServiceConfigImpl","name","def","proxyHostName","proxyPort","proxyUserName","proxyPassword","channel","Contracts_js_1","DialogServiceConfig_js_1","Exports_js_1","BotFrameworkConfig","subscription","region","botId","botFrameworkConfig","authorizationToken","host","subscriptionKey","resolvedHost","endpoint","exports","Contracts_js_1","DialogServiceConfig_js_1","Exports_js_1","CustomCommandsConfig","applicationId","subscription","region","customCommandsConfig","authorizationToken","value","exports","QueryParameterNames","exports","Exports_js_1","Exports_js_2","Exports_js_3","QueryParameterNames_js_1","ConnectionFactoryBase","region","config","queryParams","endpoint","parameterName","propertyId","serviceProperties","value","propId","redirectUrl","redirectedUrlString","redirectResponse","redirectUrlString","exports","Exports_js_1","Exports_js_2","Exports_js_3","ConnectionFactoryBase_js_1","Exports_js_4","HeaderNames_js_1","QueryParameterNames_js_1","DialogConnectionFactory","_DialogConnectionFactory","config","authInfo","connectionId","applicationId","dialogType","region","language","requestTurnStatus","queryParams","resourceInfix","version","headers","endpoint","hostSuffix","host","enableCompression","exports","DialogConnectorFactory_js_1","Exports_js_1","PhraseDetectionContext_js_1","Exports_js_2","Contracts_js_1","Exports_js_3","PropertyId_js_1","DialogServiceConnector","dialogConfig","audioConfig","dialogServiceConfigImpl","agentConfig","cb","err","token","speechActivityTemplate","retPromise","ret","e","activity","errCb","disposing","speechConfig","authentication","connectionFactory","recognizerConfig","audioSource","exports","ActivityReceivedEventArgs","activity","audioStream","exports","TurnStatusResponsePayload","_TurnStatusResponsePayload","json","exports","TurnStatusPayload_js_1","TurnStatusReceivedEventArgs","turnStatus","exports","ServicePropertyChannel","exports","ProfanityOption","exports","Error_js_1","Exports_js_1","AudioStreamFormat_js_1","BaseAudioPlayer","audioFormat","newAudioData","cb","err","audioData","newSamplesData","e","error","timerPeriod","maxValue","float32Data","i","channelCount","bufferSource","frameCount","audioBuffer","channel","channelOffset","source","destination","newBuffer","exports","ConnectionMessageEventArgs","message","exports","LanguageIdMode","exports","Exports_js_1","Contracts_js_1","Exports_js_2","LanguageIdMode_js_1","AutoDetectSourceLanguageConfig","_AutoDetectSourceLanguageConfig","config","languages","configs","autoConfig","langs","customProperty","mode","exports","Contracts_js_1","AutoDetectSourceLanguageResult","_AutoDetectSourceLanguageResult","language","languageDetectionConfidence","result","exports","Contracts_js_1","SourceLanguageConfig","_SourceLanguageConfig","language","endpointId","exports","Exports_js_1","Exports_js_2","Contracts_js_1","Exports_js_3","Conversation","speechConfig","arg2","arg3","arg4","conversationImpl","cb","err","ConversationImpl","error","exports","id","e","r","updatedParticipant","p","newParticipant","ejectedParticipant","nickname","hostNickname","configImpl","convId","part","props","key","val","value","conversationTranslator","token","room","participant","conversationId","lang","userId","participantId","message","languages","recognizer","conversationInfo","dispose","typedError","includeHost","participants","isMuted","isLocked","ConversationCommon","audioConfig","cb","err","e","error","typedError","exports","Exports_js_1","ConversationExpirationEventArgs","expirationTime","sessionId","exports","Exports_js_1","ConversationParticipantsChangedEventArgs","reason","participants","sessionId","exports","CancellationEventArgsBase_js_1","ConversationTranslationCanceledEventArgs","exports","Exports_js_1","ConversationTranslationEventArgs","result","offset","sessionId","exports","TranslationRecognitionResult_js_1","ConversationTranslationResult","participantId","translations","originalLanguage","resultId","reason","text","duration","offset","errorDetails","json","properties","exports","StringUtils","format","replacements","formatted","key","appendToFormatted","str","appendToKey","appendFunc","i","c","next","exports","Exports_js_1","StringUtils_js_1","Contracts_js_1","Exports_js_2","HeaderNames_js_1","QueryParameterNames_js_1","ConnectionFactoryBase_js_1","Exports_js_3","ConversationTranslatorConnectionFactory","_ConversationTranslatorConnectionFactory","convGetter","config","authInfo","connectionId","isVirtMicArrayEndpoint","convInfo","region","replacementValues","endpointUrl","queryParams","headers","parsedUrl","val","key","connFactory","enableCompression","exports","Exports_js_1","ConversationTranslatorConnectionFactory_js_1","Exports_js_2","Contracts_js_1","Exports_js_3","Conversation_js_1","Exports_js_4","SpeechState","exports","ConversationTranslationRecognizer","speechConfig","audioConfig","translator","convGetter","tr","e","newState","token","error","cancelEvent","ConversationTranslator","name","value","currentProperties","conversation","nickname","param1","param2","param3","lang","propertyIdsToCopy","prop","key","result","cb","err","message","resolve","reject","reason","success","Exports_js_1","PhraseDetectionContext_js_1","Exports_js_2","Contracts_js_1","Exports_js_3","ConversationTranscriber","_ConversationTranscriber","speechConfig","audioConfig","speechConfigImpl","autoDetectSourceLanguageConfig","token","cb","err","errorCb","disposing","authentication","connectionFactory","recognizerConfig","configImpl","exports","Exports_js_1","User","userId","exports","Participant","_Participant","id","avatar","displayName","isHost","isMuted","isUsingTts","preferredLanguage","voice","language","ParticipantChangedReason","exports","Exports_js_1","Exports_js_2","Contracts_js_1","Exports_js_3","Meeting","speechConfig","meetingId","arg3","arg4","meetingImpl","MeetingImpl","exports","id","e","r","updatedParticipant","p","newParticipant","ejectedParticipant","nickname","configImpl","convId","part","props","key","val","value","cb","err","room","error","participant","lang","userId","participantId","message","languages","recognizer","meetingInfo","dispose","typedError","includeHost","participants","isMuted","isLocked","CancellationEventArgsBase_js_1","MeetingTranscriptionCanceledEventArgs","exports","Exports_js_1","Exports_js_2","Contracts_js_1","Exports_js_3","Exports_js_4","MeetingTranscriber","audioConfig","token","meeting","cb","err","meetingImpl","errorCb","disposing","exports","Exports_js_1","ConversationTranscriptionResult","resultId","reason","text","duration","offset","language","languageDetectionConfidence","speakerId","errorDetails","json","properties","exports","Conversation_js_1","exports","ConversationCommon_js_1","ConversationExpirationEventArgs_js_1","ConversationParticipantsChangedEventArgs_js_1","ConversationTranslationCanceledEventArgs_js_1","ConversationTranslationEventArgs_js_1","ConversationTranslationResult_js_1","ConversationTranslator_js_1","ConversationTranscriber_js_1","IParticipant_js_1","ParticipantChangedReason_js_1","Meeting_js_1","MeetingTranscriptionCanceledEventArgs_js_1","MeetingTranscriber_js_1","ConversationTranscriptionResult_js_1","Exports_js_1","Exports_js_2","Contracts_js_1","Exports_js_3","Synthesizer","_Synthesizer","speechConfig","speechConfigImpl","token","text","languageToDefaultVoice","language","voice","ssml","disposing","request","StreamingSynthesisRequest","osPlatform","osName","osVersion","synthesizerConfig","subscriptionKey","authentication","err","authorizationToken","exports","SynthesisRequest","requestId","isSSML","cb","dataStream","speechSynthesisRequest","Exports_js_1","Exports_js_2","AudioFileWriter_js_1","AudioOutputFormat_js_1","AudioOutputStream_js_1","Contracts_js_1","Exports_js_3","Synthesizer_js_1","SpeechSynthesizer","_SpeechSynthesizer","speechConfig","audioConfig","autoDetectSourceLanguageConfig","speechConfigImpl","text","cb","err","stream","ssml","request","requestId","audioDestination","onSuccess","onError","error","locale","authentication","connectionFactory","synthesizerConfig","IsSsml","dataStream","processNext","successCb","e","typedError","response","json","item","exports","SynthesisResult","resultId","reason","errorDetails","properties","exports","Exports_js_1","SpeechSynthesisResult","resultId","reason","audioData","errorDetails","properties","audioDuration","exports","SpeechSynthesisEventArgs","result","exports","SpeechSynthesisWordBoundaryEventArgs","audioOffset","duration","text","wordLength","textOffset","boundaryType","exports","SpeechSynthesisBookmarkEventArgs","audioOffset","text","exports","SpeechSynthesisVisemeEventArgs","audioOffset","visemeId","animation","exports","SpeechSynthesisBoundaryType","exports","SpeechSynthesisRequestInputType","exports","SpeechSynthesisRequestInputStream","parent","text","exports","Exports_js_1","SpeechSynthesisRequestInputType_js_1","SpeechSynthesisRequestInputStream_js_1","SpeechSynthesisRequestInputStream_js_2","exports","SpeechSynthesisRequest","inputType","value","text","callback","Exports_js_1","SynthesisVoicesResult","requestId","json","errorDetails","item","exports","SynthesisVoiceGender","exports","SynthesisVoiceType","GENDER_LOOKUP","VOICE_TYPE_LOOKUP","VoiceInfo","json","style","Exports_js_1","AudioOutputStream_js_1","AudioStreamFormat_js_1","MediaDurationPlaceholderSeconds","AudioFormatToMimeType","SpeakerAudioDestination","audioDestinationId","buffer","cb","err","error","receivedAudio","audioBlob","format","mimeType","reason","volume","binary","exports","CancellationEventArgsBase_js_1","ConversationTranscriptionCanceledEventArgs","exports","CancellationEventArgsBase_js_1","MeetingTranscriptionCanceledEventArgs","exports","PronunciationAssessmentGradingSystem","exports","PronunciationAssessmentGranularity","exports","Contracts_js_1","Exports_js_1","PronunciationAssessmentConfig","_PronunciationAssessmentConfig","referenceText","gradingSystem","granularity","enableMiscue","json","config","recognizer","recoBase","phonemeAlphabet","enableMiscueString","nbestPhonemeCount","enableProsodyAssessment","jsonString","paramsJson","exports","Contracts_js_1","Exports_js_1","PronunciationAssessmentResult","_PronunciationAssessmentResult","jsonString","j","result","json","exports","Contracts_js_1","Exports_js_1","AvatarConfig","character","style","videoFormat","value","exports","AvatarEventTypes","exports","AvatarEventArgs","audioOffset","description","AvatarSceneConfig","zoom","positionX","positionY","rotationX","rotationY","rotationZ","amplitude","exports","Exports_js_1","Exports_js_2","ConnectionFactoryBase_js_1","Exports_js_3","HeaderNames_js_1","QueryParameterNames_js_1","SpeechSynthesisConnectionFactory","config","authInfo","connectionId","endpoint","region","hostSuffix","endpointId","hostPrefix","host","queryParams","headers","endpointUrl","pathName","enableCompression","exports","SpeechSynthesisConnectionFactory_js_1","Exports_js_1","Exports_js_2","AudioOutputFormat_js_1","Exports_js_3","Contracts_js_1","Synthesizer_js_1","AvatarSynthesizer","speechConfig","avatarConfig","peerConnection","iceGatheringDone","event","sdp","result","sdpAnswerString","sdpAnswer","text","r","ssml","sceneConfig","sceneMessage","authentication","connectionFactory","synthesizerConfig","_authentication","_synthesizerConfig","config","isSSML","requestId","deferredResult","e","exports","Coordinate","x","y","exports","AvatarVideoFormat","codec","bitrate","width","height","topLeft","bottomRight","Exports_js_1","AvatarWebRTCConnectionResult","SDPAnswer","resultId","reason","errorDetails","properties","exports","Exports_js_1","Exports_js_2","Diagnostics","logLevel","path","callback","exports","AudioConfig_js_1","exports","AudioStreamFormat_js_1","AudioInputStream_js_1","AudioOutputStream_js_1","CancellationReason_js_1","PullAudioInputStreamCallback_js_1","PushAudioOutputStreamCallback_js_1","KeywordRecognitionModel_js_1","SessionEventArgs_js_1","RecognitionEventArgs_js_1","OutputFormat_js_1","RecognitionResult_js_1","SpeechRecognitionResult_js_1","SpeechRecognitionEventArgs_js_1","SpeechRecognitionCanceledEventArgs_js_1","TranslationRecognitionEventArgs_js_1","TranslationSynthesisEventArgs_js_1","TranslationRecognitionResult_js_1","TranslationSynthesisResult_js_1","ResultReason_js_1","SpeechConfig_js_1","SpeechTranslationConfig_js_1","PropertyCollection_js_1","PropertyId_js_1","Recognizer_js_1","SpeechRecognizer_js_1","TranslationRecognizer_js_1","Translations_js_1","NoMatchReason_js_1","NoMatchDetails_js_1","TranslationRecognitionCanceledEventArgs_js_1","CancellationDetailsBase_js_1","CancellationDetails_js_1","CancellationErrorCodes_js_1","ConnectionEventArgs_js_1","ServiceEventArgs_js_1","Connection_js_1","PhraseListGrammar_js_1","DialogServiceConfig_js_1","BotFrameworkConfig_js_1","CustomCommandsConfig_js_1","DialogServiceConnector_js_1","ActivityReceivedEventArgs_js_1","TurnStatusReceivedEventArgs_js_1","ServicePropertyChannel_js_1","ProfanityOption_js_1","BaseAudioPlayer_js_1","ConnectionMessageEventArgs_js_1","ConnectionMessage_js_1","AutoDetectSourceLanguageConfig_js_1","AutoDetectSourceLanguageResult_js_1","SourceLanguageConfig_js_1","Exports_js_1","Synthesizer_js_1","SpeechSynthesisOutputFormat_js_1","SpeechSynthesizer_js_1","SynthesisResult_js_1","SpeechSynthesisResult_js_1","SpeechSynthesisEventArgs_js_1","SpeechSynthesisWordBoundaryEventArgs_js_1","SpeechSynthesisBookmarkEventArgs_js_1","SpeechSynthesisVisemeEventArgs_js_1","SpeechSynthesisBoundaryType_js_1","SpeechSynthesisRequest_js_1","SpeechSynthesisRequestInputType_js_1","SynthesisVoicesResult_js_1","VoiceInfo_js_1","SpeakerAudioDestination_js_1","ConversationTranscriptionCanceledEventArgs_js_1","MeetingTranscriptionCanceledEventArgs_js_1","PronunciationAssessmentGradingSystem_js_1","PronunciationAssessmentGranularity_js_1","PronunciationAssessmentConfig_js_1","PronunciationAssessmentResult_js_1","LanguageIdMode_js_1","AvatarConfig_js_1","AvatarEventArgs_js_1","AvatarSceneConfig_js_1","AvatarSynthesizer_js_1","AvatarVideoFormat_js_1","AvatarWebRTCConnectionResult_js_1","Diagnostics_js_1","LogLevel_js_1","Exports_js_1","ProxyInfo","_ProxyInfo","proxyHostName","proxyPort","proxyUserName","proxyPassword","parameters","config","exports","require_core","__commonJSMin","exports","module","encodings","mkrequest","args","statusCodes","method","encoding","headers","baseurl","arg","msg","code","require_browser","__commonJSMin","exports","module","core","StatusError","_StatusError","res","params","buffer","key","value","mkrequest","statusCodes","method","encoding","headers","baseurl","_url","body","_headers","parsed","resp","bent_1","__importDefault","Exports_js_1","RestRequestType","exports","RestMessageAdapter","configParams","headerKey","headers","headerValue","arr","headerMap","line","parts","header","value","key","method","uri","queryParams","body","responseReceivedDeferral","requestCommand","handleRestResponse","data","j","d","send","postData","sendRequest","params","error","k","RestConfigBase","_RestConfigBase","exports","__exportStar","exports","Exports_js_1","HeaderNames_js_1","SpeechConnectionMessage","_SpeechConnectionMessage","messageType","path","requestId","contentType","body","streamId","additionalHeaders","id","headers","headerName","message","exports","SegmentationMode","exports","NextAction","exports","Mode","exports","LanguageIdDetectionMode","exports","LanguageIdDetectionPriority","NextAction","exports","OnUnknownAction","exports","ResultType","exports","PhraseResultOutputType","exports","NextAction","exports","InteractivePunctuationMode","exports","ConversationPunctuationMode","exports","DictationPunctuationMode","exports","DisfluencyMode","exports","Exports_js_1","Exports_js_2","Exports_js_3","Exports_js_4","SpeechConnectionMessage_Internal_js_1","Segmentation_js_1","PhraseDetectionContext_js_1","OnSuccess_js_1","InterimResults_js_1","LanguageIdContext_js_1","OnSuccess_js_2","OnUnknown_js_1","InterimResults_js_2","PhraseResults_js_1","OnSuccess_js_3","InteractiveEnrichmentOptions_js_1","ConversationEnrichmentOptions_js_1","DictationEnrichmentOptions_js_1","DisfluencyMode_js_1","ServiceRecognizerBase","_ServiceRecognizerBase","authentication","connectionFactory","audioSource","recognizerConfig","recognizer","connectionEvent","connectionClosedEvent","targetLanguages","languages","translationVoice","categoryId","action","languageToVoiceMap","lang","phraseDetection","speechSegmentationSilenceTimeoutMs","speechSegmentationMaximumTimeMs","speechSegmentationStrategy","segmentation","configuredSegment","segMode","segmentationSilenceTimeoutMs","segmentationMaximumTimeMs","sourceLanguages","speechContextLidMode","customModels","sensitivity","configuredSensitivity","postProcessingOption","token","auth","reason","recoMode","successCallback","errorCallBack","conPromise","audioNode","audioStreamNode","format","deviceInfo","error","sessionStartEventArgs","cb","err","e","message","path","payload","type","contentType","messagePayload","value","telemetryData","cancellationReason","errorCode","connection","connectionMessage","speechStartDetected","speechStartEventArgs","json","speechStopDetected","speechStopEventArgs","sessionStopEventArgs","bytesSent","audioOffsetMs","generateNewRequestId","speechContextJson","hasLanguageId","translationContext","requestSession","SpeechServiceConfigJson","replacement","audioFormat","nextSendTime","fastLaneSizeMs","maxSendUnthrottledBytes","startRecogNumber","readAndUploadCycle","audioStreamChunk","sendDelay","isUnAuthorized","sessionId","lastStatusCode","lastReason","event","response","delayMs","resolve","buffer","out","readView","i","exports","Exports_js_1","Exports_js_2","ConversationServiceRecognizer","authentication","connectionFactory","audioSource","recognizerConfig","recognizer","textBody","connectionMessage","result","offset","sessionId","duration","processed","requestId","cancellationReason","errorCode","error","simple","resultReason","resultProps","cancelReason","cancellationErrorCode","detailed","hypothesis","exports","Exports_js_1","Exports_js_2","PhraseDetectionContext_js_1","SpeechResultFormat","exports","RecognizerConfig","speechServiceConfig","parameters","value","version","models","modelsExist","language","customProperty","modelId","Exports_js_1","CRLF","WebsocketMessageFormatter","message","deferral","textMessage","headers","body","headerBodySplit","binaryMessage","dataView","headerLength","headersString","i","e","payload","content","headerBuffer","headerInt8Array","payloadInt8Array","bodyInt8Array","header","headerMatches","separatorIndex","headerName","headerValue","str","buffer","view","exports","Exports_js_1","Exports_js_2","Exports_js_3","ConnectionFactoryBase_js_1","Exports_js_4","HeaderNames_js_1","QueryParameterNames_js_1","PhraseDetectionContext_js_1","SpeechConnectionFactory","config","authInfo","connectionId","endpoint","region","hostSuffix","host","queryParams","endpointId","language","endpointUrl","pathName","headers","enableCompression","webSocketConnection","uri","exports","Exports_js_1","Exports_js_2","Exports_js_3","ConnectionFactoryBase_js_1","Exports_js_4","HeaderNames_js_1","QueryParameterNames_js_1","ConversationTranscriberConnectionFactory","config","authInfo","connectionId","endpoint","region","hostSuffix","host","queryParams","endpointId","language","endpointUrl","pathName","headers","enableCompression","webSocketConnection","uri","parameterName","propertyId","serviceProperties","value","exports","Exports_js_1","Exports_js_2","ConnectionFactoryBase_js_1","Exports_js_3","HeaderNames_js_1","QueryParameterNames_js_1","TranscriberConnectionFactory","config","authInfo","connectionId","endpoint","region","hostSuffix","hostDefault","host","queryParams","headers","enableCompression","endpointUrl","endpointId","language","wordLevelTimings","detailed","exports","Exports_js_1","StringUtils_js_1","Exports_js_2","ConnectionFactoryBase_js_1","Exports_js_3","HeaderNames_js_1","QueryParameterNames_js_1","PhraseDetectionContext_js_1","TranslationConnectionFactory","config","authInfo","connectionId","endpoint","queryParams","endpointUrl","pathName","headers","enableCompression","returnRegionPlaceholder","region","hostSuffix","translationVoice","exports","Exports_js_1","Exports_js_2","EnumTranslation","recognitionStatus","expectEndOfDictation","reason","cancellationErrorCode","errorDetails","exports","SynthesisStatus","exports","RecognitionStatus","Exports_js_1","TranslationSynthesisEnd","_TranslationSynthesisEnd","json","exports","Contracts_js_1","TranslationStatus_js_1","TranslationHypothesis","_TranslationHypothesis","hypothesis","baseOffset","json","translationHypothesis","jsonObj","status","exports","Contracts_js_1","Exports_js_1","TranslationStatus_js_1","TranslationPhrase","_TranslationPhrase","phrase","baseOffset","json","translationResponse","jsonObj","serializedObj","status","exports","Exports_js_1","Exports_js_2","Exports_js_3","TranslationServiceRecognizer","authentication","connectionFactory","audioSource","recognizerConfig","translationRecognizer","connectionEvent","connectionMessage","resultProps","processed","handleTranslationPhrase","translatedPhrase","phraseLatencyMs","result","e","reason","cancelReason","cancellationErrorCode","ev","handleTranslationHypothesis","hypothesis","hypothesisLatencyMs","phrase","synthEnd","retEvent","canceledResult","sessionId","requestId","cancellationReason","errorCode","error","properties","cancelEvent","offset","serviceResult","translations","translation","resultReason","confidence","language","audio","exports","SpeechDetected","_SpeechDetected","json","baseOffset","exports","SpeechHypothesis","_SpeechHypothesis","json","baseOffset","exports","SpeechKeyword","_SpeechKeyword","json","baseOffset","exports","Exports_js_1","Exports_js_2","SpeechServiceRecognizer","authentication","connectionFactory","audioSource","recognizerConfig","speechRecognizer","connectionMessage","result","resultProps","processed","hypothesis","hypothesisLatencyMs","ev","simple","resultReason","phraseLatencyMs","cancelReason","cancellationErrorCode","detailed","event","e","sessionId","requestId","cancellationReason","errorCode","error","properties","cancelEvent","exports","SpeakerDiarizationMode","exports","IdentityProvider","Exports_js_1","Exports_js_2","SpeakerDiarization_js_1","PhraseDetectionContext_js_1","ConversationTranscriptionServiceRecognizer","authentication","connectionFactory","audioSource","recognizerConfig","conversationTranscriber","phraseDetection","speakerDiarization","connectionMessage","result","resultProps","processed","hypothesis","hypothesisLatencyMs","ev","simple","resultReason","phraseLatencyMs","cancelReason","cancellationErrorCode","detailed","event","sessionId","requestId","cancellationReason","errorCode","error","cancelEvent","exports","Exports_js_1","Exports_js_2","Exports_js_3","SpeechConnectionMessage_Internal_js_1","TranscriptionServiceRecognizer","authentication","connectionFactory","audioSource","recognizerConfig","transcriber","connection","info","command","connectionMessage","result","offset","sessionId","event","e","duration","ev","requestId","cancellationReason","errorCode","error","properties","cancelEvent","payload","speechEventJson","eventDict","exports","Exports_js_1","DetailedSpeechPhrase","_DetailedSpeechPhrase","json","baseOffset","phrase","word","jsonObj","status","exports","Exports_js_1","SimpleSpeechPhrase","_SimpleSpeechPhrase","json","baseOffset","jsonObj","status","exports","Exports_js_1","RecognitionEvents_js_1","ServiceTelemetryListener","requestId","audioSourceId","audioNodeId","audioReceivedTime","metrics","telemetry","json","statusCode","exports","Exports_js_1","RecognitionEvents_js_1","ServiceTelemetryListener_Internal_js_1","RequestSession","audioSourceId","eventSource","audioNode","isError","authFetchEventId","connectionId","statusCode","reason","continuousRecognition","offset","audioReceivedTime","bytesSent","detachable","event","exports","PhraseOption","exports","PhraseExtension","OutputFormat","TentativePhraseResultsOption","PhraseDetectionContext_js_1","PhraseOutput_js_1","SpeechContext","dynamicGrammar","params","isSpeakerDiarizationEnabled","audioOffsetMs","dgi","exports","GroupType","exports","SubstringMatchType","Group_js_1","DynamicGrammarBuilder","phrase","grammar","weight","retObj","retPhrases","value","exports","ActivityPayloadResponse","_ActivityPayloadResponse","json","exports","MessageDataStreamType","AudioOutputFormat_js_1","AudioOutputStream_js_1","ActivityResponsePayload_js_1","DialogServiceTurnState","manager","requestId","payload","audioFormat","exports","Error_js_1","DialogServiceTurnState_js_1","DialogServiceTurnStateManager","id","turnState","exports","InvocationSource","exports","KeywordDetectionType","exports","OnRejectAction","Exports_js_1","DialogEvents_js_1","Exports_js_2","AudioOutputFormat_js_1","Exports_js_3","DialogServiceTurnStateManager_js_1","Exports_js_4","ActivityResponsePayload_js_1","InvocationSource_js_1","KeywordDetection_js_1","SpeechConnectionMessage_Internal_js_1","DialogServiceAdapter","authentication","connectionFactory","audioSource","recognizerConfig","dialogServiceConnector","recoMode","successCallback","errorCallback","connection","connectionEvent","message","interactionGuid","requestId","agentMessage","agentMessageJson","connectionMessage","resultProps","result","processed","speechPhrase","args","hypothesis","ev","keyword","event","audioRequestId","turn","defferal","sessionId","cancellationReason","errorCode","error","properties","cancelEvent","conPromise","preAudioPromise","node","format","deviceInfo","audioNode","sessionStartEventArgs","communicationCustodian","loop","isDisposed","terminateMessageLoop","turnRequestId","audioSessionReqId","speechStartDetected","speechStartEventArgs","json","speechStopDetected","speechStopEventArgs","turnEndRequestId","sessionStopEventArgs","e","reason","config","agentConfigJson","guid","speechActivityTemplate","agentContextJson","serviceResult","resultReason","responseMessage","responsePayload","responseRequestId","activityPayload","updateAgentConfig","pullAudioOutputStream","activity","keywordPropertyValue","keywordOffsetPropertyValue","keywordDurationPropertyValue","keywords","keywordOffsets","keywordDurations","keywordDefinitionArray","i","definition","exports","AgentConfig","value","exports","RestConfigBase_js_1","ConversationConnectionConfig","_ConversationConnectionConfig","exports","Exports_js_1","Contracts_js_1","Exports_js_2","ConversationConnectionConfig_js_1","ConversationManager","args","conversationCode","cb","err","languageCode","nickname","endpointHost","correlationId","subscriptionKey","subscriptionRegion","authToken","queryParams","headers","config","endpoint","response","requestId","errorMessage","errMessageRaw","conversation","e","error","typedError","sessionToken","resolve","reject","exports","Exports_js_1","ConversationConnectionMessage","messageType","body","headers","id","json","exports","Exports_js_1","ConversationConnectionMessage_js_1","ConversationWebsocketMessageFormatter","message","deferral","incomingMessage","e","payload","exports","Exports_js_1","Exports_js_2","Contracts_js_1","Exports_js_3","ConnectionFactoryBase_js_1","ConversationConnectionConfig_js_1","ConversationWebsocketMessageFormatter_js_1","ConversationConnectionFactory","config","authInfo","connectionId","endpointHost","correlationId","endpoint","token","queryParams","enableCompression","exports","Exports_js_1","ConversationRequestSession","sessionId","authFetchEventId","connectionId","isError","statusCode","continuousRecognition","detachable","exports","Exports_js_1","MuteAllEventArgs","isMuted","sessionId","exports","LockRoomEventArgs","isLocked","ParticipantEventArgs","participant","ParticipantAttributeEventArgs","participantId","key","value","ParticipantsListEventArgs","conversationId","token","translateTo","profanityFilter","roomProfanityFilter","isRoomLocked","isMuteAll","participants","ConversationReceivedTranslationEventArgs","command","payload","InternalParticipants","participants","meId","value","exists","id","p","exports","parseCommandResponse","json","CommandResponsePayload","_CommandResponsePayload","exports","parseListResponse","json","parseParticipantResponse","ParticipantsListPayloadResponse","_ParticipantsListPayloadResponse","exports","ParticipantPayloadResponse","_ParticipantPayloadResponse","parseSpeechResponse","json","parseTextResponse","SpeechResponsePayload","_SpeechResponsePayload","exports","TextResponsePayload","_TextResponsePayload","CommandResponsePayload_js_1","exports","ParticipantResponsePayload_js_1","TranslationResponsePayload_js_1","Exports_js_1","Exports_js_2","Exports_js_3","ConversationConnectionMessage_js_1","ConversationRequestSession_js_1","ConversationTranslatorEventArgs_js_1","ConversationTranslatorInterfaces_js_1","Exports_js_4","ConversationServiceAdapter","authentication","connectionFactory","audioSource","recognizerConfig","conversationServiceConnector","connection","reason","message","sessionId","requestId","cancellationReason","errorCode","error","cancelEvent","communicationCustodian","conversationMessageType","sendFinal","commandPayload","participantsPayload","participantsResult","p","joinParticipantPayload","joiningParticipant","leavingParticipant","disconnectParticipant","token","authorizationToken","speechPayload","conversationResultReason","speechResult","textPayload","textResult","messageRetrievalPromise","serviceResultTranslations","translations","translation","exports","Exports_js_1","Exports_js_2","Contracts_js_1","Exports_js_3","ConversationConnectionFactory_js_1","ConversationServiceAdapter_js_1","ConversationRecognizerFactory","conversation","speechConfig","audioConfig","ConversationTranslatorRecognizer","exports","serviceConfigImpl","conversationImpl","cb","token","err","error","typedError","reason","command","disposing","authentication","connectionFactory","recognizerConfig","audioSource","msg","withAsync","promise","e","Exports_js_1","Contracts_js_1","Exports_js_2","Exports_js_3","PhraseDetectionContext_js_1","TranscriberRecognizer","speechTranslationConfig","audioConfig","speechTranslationConfigImpl","audioConfigImpl","token","c","m","cb","err","conversationInfo","command","reco","meetingInfo","channels","transcriber","s","e","disposing","speechConfig","authentication","connectionFactory","recognizerConfig","configImpl","exports","ConversationManager_js_1","exports","ConversationConnectionConfig_js_1","ConversationTranslatorRecognizer_js_1","TranscriberRecognizer_js_1","ConversationTranslatorEventArgs_js_1","ConversationTranslatorInterfaces_js_1","MetadataType","exports","SynthesisAudioMetadata","_SynthesisAudioMetadata","json","Exports_js_1","SpeechSynthesisEvent","eventName","requestId","eventType","exports","SynthesisTriggeredEvent","sessionAudioDestinationId","turnAudioDestinationId","ConnectingToSynthesisServiceEvent","authFetchEventId","SynthesisStartedEvent","Exports_js_1","AudioOutputStream_js_1","Exports_js_2","SynthesisAudioMetadata_js_1","SynthesisEvents_js_1","SynthesisTurn","_SynthesisTurn","value","format","properties","audio","requestId","rawText","isSSML","audioDestination","authFetchEventId","isError","statusCode","responseJson","response","data","metadata","finishLatency","audioBuffer","animation","event","text","type","idx","exports","Exports_js_1","Exports_js_2","Exports_js_3","SpeechConnectionMessage_Internal_js_1","SynthesisAdapterBase","authentication","connectionFactory","synthesizerConfig","audioDestination","connectionEvent","connectionClosedEvent","messagePayload","format","reason","path","payload","type","contentType","text","isSSML","requestId","successCallback","errorCallBack","ssml","connection","e","request","_cancellationReason","errorCode","error","properties","result","cancellationReason","_connectionMessage","message","connectionMessage","metadataList","metadata","wordBoundaryEventArgs","bookmarkEventArgs","visemeEventArgs","synthesisContextJson","isUnAuthorized","authPromise","event","response","SpeechServiceConfigJson","inputSection","voiceName","language","pitch","rate","volume","style","temperature","customLexiconUrl","preferLocales","existingSynthesis","_metadata","_requestId","_audio","_result","_wordBoundaryEventArgs","_visemeEventArgs","_bookmarkEventArgs","exports","Exports_js_1","Exports_js_2","AvatarSynthesisAdapter","authentication","connectionFactory","synthesizerConfig","avatarSynthesizer","avatarConfig","talkingAvatarConfig","metadata","avatarEventArgs","exports","Exports_js_1","Exports_js_2","SpeechSynthesisAdapter","authentication","connectionFactory","synthesizerConfig","speechSynthesizer","audioDestination","requestId","synthesisStartEventArgs","audio","audioWithHeader","ev","result","cancelEvent","wordBoundaryEventArgs","visemeEventArgs","bookmarkEventArgs","exports","Exports_js_1","Exports_js_2","ConnectionFactoryBase_js_1","HeaderNames_js_1","SynthesisRestAdapter","config","authentication","endpoint","region","hostSuffix","options","connectionId","authInfo","exports","Exports_js_1","SynthesisServiceType","exports","SynthesizerConfig","speechServiceConfig","parameters","value","contextJson","context","Exports_js_1","SynthesisContext","sectionName","value","format","speechSynthesizer","synthesisSection","exports","SpeechServiceConfig","context","key","value","replacement","k","exports","Context","os","System","SPEECHSDK_CLIENTSDK_VERSION","OS","platform","name","version","Device","manufacturer","model","connectivity","type","__exportStar","exports","AvatarSynthesisAdapter_js_1","SpeechSynthesisAdapter_js_1","Exports_js_1","__exportStar","exports","buildInfo","_u","buildInfo_default","concatMiddleware","createStyleSet","testIds","withEmoji","Constants","createStore","createStoreWithDevTools","createStoreWithOptions","createBrowserWebSpeechPonyfillFactory","DirectLine","createDirectLine","botAgent","conversationId","conversationStartProperties","domain","fetch","pollingInterval","secret","streaming","streamUrl","token","watermark","webSocket","attachments","formData","contentType","data","filename","name","getBotAgent","buildInfo","createDirectLine","options","getBotAgent","buildInfo_default","DirectLineStreaming","createDirectLineAppServiceExtension","botAgent","conversationId","domain","token","createDirectLineAppServiceExtension","options","getBotAgent","buildInfo_default","React","ReactDOM","renderWebChat","ReactWebChat","props","element","renderWebChat","ReactWebChat","buildInfo_default","buildInfoObject","version","createStyleSet","createFullStyleSet","options","createStyleSet","createAdaptiveCardsStyleSet","renderWebChat","FullReactWebChat_default","import_microsoft_cognitiveservices_speech_sdk","import_AudioSourceEvents","parse","intersect","object","optional","pipe","readonly","string","undefined_","union","boolean","maxValue","minValue","number","array","transform","enum_","function_","assertType","condition","message","args","format","i","anyToString","x","currentErrorHandler","reportError","maybeError","error","anyToString","currentErrorHandler","Global","currentWarnHandler","Warning","code","message","args","currentWarnHandler","stack","_a","InitEventWasCalledWhileDispatching","FalsyWasAssignedToCancelBubble","TruthyWasAssignedToReturnValue","NonCancelableEventWasCanceled","CanceledInPassiveListener","EventListenerWasDuplicated","OptionWasIgnored","InvalidEventListener","InvalidAttributeHandler","Event","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","type","eventInitDict","opts","internalDataMap","$","currentTarget","value","data","setCancelFlag","bubbles","cancelable","event","name","retv","assertType","keys","i","Global","createInvalidStateError","DOMException","msg","defineErrorCodeProperties","ErrorCodeMap","obj","key","EventWrapper","getWrapperClassOf","defineRedirectDescriptor","original","wrapperClassCache","originalEvent","prototype","wrapper","defineWrapper","BaseEventWrapper","originalPrototype","CustomEventWrapper","d","createListener","callback","capture","passive","once","signal","signalListener","setRemoved","listener","isCapture","isPassive","isOnce","isRemoved","invokeCallback","target","thrownError","reportError","findIndexOfListener","listeners","addListener","list","removeListener","index","removeListenerAt","disableCow","_","createListenerListMap","ensureListenerList","listenerMap","EventTarget","type0","callback0","options0","normalizeAddOptions","warnDuplicate","normalizeOptions","eventData","getEventInternalData","cow","options","assertCallback","format","getEventAttributeValue","_b","getEventTargetInternalData","setEventAttributeValue","upsertEventAttributeListener","removeEventAttributeListener","defineEventAttributeCallback","isPromise","value","onErrorResumeNext","fn","context","resolve","result","isPromise","safeIsNaN","value","isEqual","first","second","areInputsEqual","newInputs","lastInputs","i","memoizeOne","resultFn","cache","memoized","newArgs","_i","lastResult","withResolvers","resolvers","resolve","reject","EventAsPromise","#eventListener","event","deferred","#orderedResolvers","#upcomingResolvers","chars","lookup","i","decode","base64","bufferLength","len","p","encoded1","encoded2","encoded3","encoded4","arraybuffer","bytes","lookup","isFunction","value","resolveFunctionOrReturnValue","fnOrValue","SpeechSDK","SpeechSDK_default","credentialsSchema","pipe","intersect","union","object","string","optional","undefined_","readonly","credentialsSchema_default","enableTelemetrySchema","boolean","enableTelemetrySchema_default","initialSilenceTimeoutSchema","number","minValue","maxValue","initialSilenceTimeoutSchema_default","looseEventsSchema","looseEventsSchema_default","referenceGrammarsSchema","array","transform","referenceGrammarsSchema_default","speechRecognitionEndpointIdSchema","speechRecognitionEndpointIdSchema_default","textNormalizationSchema","enum_","textNormalizationSchema_default","AudioConfig","shouldWarnOnSubscriptionKey","patchOptions","init","audioConfig","credentials","enableTelemetry","initialSilenceTimeout","looseEvent","referenceGrammars","speechRecognitionEndpointId","textNormalization","looseEvents","parse","parsedCredentials","pDefer","deferred","resolve","reject","createPromiseQueue","shiftDeferred","queue","SpeechRecognitionAlternative","confidence","transcript","#confidence","#transcript","FakeArray","#array","key","SpeechRecognitionResult","#isFinal","RecognizingSpeech","RecognizedSpeech","cognitiveServiceEventResultToWebSpeechRecognitionResult","result","maxAlternatives","json","display","itn","lexical","maskedITN","cognitiveServicesAsyncToPromise","fn","context","args","EventListenerMap","eventTarget","#eventTarget","#propertyMap","name","existing","averageAmplitude","arrayBuffer","amplitude","prepareAudioConfig","audioConfigImpl","originalAttach","boundOriginalAttach","firstChunk","muted","reader","chunk","serializeRecognitionResult","duration","errorDetails","offset","properties","reason","resultId","text","SpeechGrammarList","#phrases","SpeechRecognitionErrorEvent","type","error","message","#error","#message","SpeechRecognitionResultList","SpeechRecognitionEvent","data","resultIndex","results","#data","#resultIndex","#results","ResultReason","SpeechRecognizer","createSpeechRecognitionPonyfillFromRecognizer","createRecognizer","function_","SpeechRecognition","#continuous","#eventListenerMap","#grammars","#interimResults","#lang","#maxAlternatives","event","err","recognizer","pause","unprepare","soundStarted","speechStarted","stopping","detachAudioConfigEvent","_","sessionId","phrases","dynamicGrammar","audioStarted","finalEvent","finalizedResults","loop","abort","audioSourceOff","audioSourceReady","canceled","firstAudibleChunk","recognized","recognizing","stop","errorMessage","recognizable","OutputFormat","SpeechConfig","createSpeechRecognitionPonyfill","options","fetchCredentials","lang","speechConfig","host","AudioContextConsumer","audioContext","utterance","AudioContextQueue","ponyfill","memoizeOne","SpeechSynthesisEvent","Event","relativePercentage","relative","buildSSML","pitch","rate","voice","volume","SPEAK_TAG_PATTERN","XML_PROLOG_PATTERN","isSSML","DEFAULT_LANGUAGE","DEFAULT_OUTPUT_FORMAT","DEFAULT_VOICE","EMPTY_MP3_BASE64","fetchSpeechData","deploymentId","outputFormat","decode","authorizationToken","region","speechSynthesisHostname","subscriptionKey","ssml","hostname","search","url","res","subscribeEvent","target","handler","asyncDecodeAudioData","promise","playDecoded","audioBuffer","source","audioContextClosed","EventAsPromise","sourceEnded","unsubscribe","state","SpeechSynthesisUtterance","EventTarget","getEventAttributeValue","setEventAttributeValue","SpeechSynthesisUtterance_default","SpeechSynthesisVoice","gender","voiceURI","fetchCustomVoices_","customVoiceHostname","fetchCustomVoices","models","x","y","fetchVoices","EMPTY_ARRAY","speechSynthesisDeploymentId","speechSynthesisOutputFormat","SpeechSynthesis","handleError","errorCode","onErrorResumeNext","voices","createSpeechSynthesisPonyfill_default","TextToSpeech_default","createSpeechServicesPonyfill","options","createSpeechRecognitionPonyfill","TextToSpeech_default","meta","SpeechServices_default","import_Exports","bytesPerSample","settings","import_microsoft_cognitiveservices_speech_sdk","import_microsoft_cognitiveservices_speech_sdk","import_Exports","import_AudioStreamFormat","isForbiddenPropertyName","withResolvers","byteToHex","i","unsafeStringify","arr","offset","rnds8","rng","v4","options","buf","offset","_v4","rnds","rng","i","unsafeStringify","v4_default","SYMBOL_DEVICE_INFO_DEFERRED","SYMBOL_EVENTS","SYMBOL_FORMAT_DEFERRED","SYMBOL_OPTIONS","CustomAudioInputStream","options","normalizedOptions","v4_default","withResolvers","event","error","audioNodeId","message","args","audioStreamNode","deviceInfo","format","connectivity","manufacturer","model","type","bitsPerSample","channels","samplesPerSec","isForbiddenPropertyName","Connectivity","Type","CustomAudioInputStream_default","SYMBOL_ATTACH","SYMBOL_TURN_OFF","CreateAudioConfigAudioInputStream","CustomAudioInputStream_default","attach","debug","turnOff","audioNodeId","createAudioConfig","options","createAudioContext","getUserMedia","constraints","navigator","resolve","reject","DEFAULT_BUFFER_DURATION_IN_MS","PCM_RECORDER_HARDCODED_SETTINGS","PCM_RECORDER_HARDCODED_FORMAT","createMicrophoneAudioConfig","options","audioConstraints","audioContext","debug","enableTelemetry","pcmRecorderWorkletUrl","bufferDurationInMS","pcmRecorder","createAudioConfig","audioNodeId","mediaStream","getUserMedia","firstAudioTrack","outputStream","bytesPerSample","track","createMicrophoneAudioConfigAndAudioContext","audioInputDeviceId","createAudioContext","isPromiseLike","promiseLike","BEARER_PREFIX_LOWERCASE","warnBearerPrefix","Or","removeBearerInAuthorizationTokenForResolved","credentials","removeBearerInAuthorizationTokenForPromiseOrResolved","isPromiseLike","removeBearerInAuthorizationToken","removeBearerInAuthorizationToken_default","createCognitiveServicesSpeechServicesPonyfillFactory","audioConfig","audioContext","audioInputDeviceId","credentials","enableTelemetry","initialSilenceTimeout","speechRecognitionEndpointId","speechSynthesisDeploymentId","speechSynthesisOutputFormat","textNormalization","createMicrophoneAudioConfigAndAudioContext","referenceGrammarID","SpeechGrammarList","SpeechRecognition","speechSynthesis","SpeechSynthesisUtterance","SpeechServices_default","removeBearerInAuthorizationToken_default","createAdapters","DEFAULT_LANGUAGE","createDirectLineSpeechAdapters","audioConfig","audioContext","audioInputDeviceId","enableInternalHTTPSupport","enableTelemetry","fetchCredentials","speechRecognitionEndpointId","speechRecognitionLanguage","speechSynthesisDeploymentId","speechSynthesisOutputFormat","textNormalization","userID","username","createMicrophoneAudioConfigAndAudioContext","createAdapters","buildInfo_default","version","deprecatedHooks","ht","full_exports","deprecatedComponents","ht","full_exports"]}