{"version":3,"sources":["webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/ServiceMessages/SimpleSpeechPhrase.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/RecognitionEvents.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/ServiceTelemetryListener.Internal.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/RequestSession.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/Transcription/ConversationUtils.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/ServiceMessages/IntentResponse.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/ServiceMessages/TranslationHypothesis.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/TranslationStatus.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/SpeechContext.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/Transcription/ConversationManager.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/TranscriberConnectionFactory.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/SynthesizerConfig.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/SpeechSynthesisConnectionFactory.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/ServiceMessages/TranslationSynthesisEnd.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/Transcription/ConversationConnectionMessage.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/Transcription/ConversationWebsocketMessageFormatter.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/Transcription/ConversationConnectionFactory.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/Transcription/ConversationRequestSession.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/Transcription/ConversationTranslatorEventArgs.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/Transcription/ServiceMessages/CommandResponsePayload.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/Transcription/ServiceMessages/ParticipantResponsePayload.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/Transcription/ServiceMessages/TranslationResponsePayload.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/Transcription/ConversationServiceAdapter.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/Transcription/ConversationTranslatorRecognizer.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/TranscriptionServiceRecognizer.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/ServiceMessages/SpeechHypothesis.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/Transcription/TranscriberRecognizer.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/ServiceMessages/ActivityResponsePayload.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/TranslationConnectionFactory.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/SpeechConnectionFactory.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/WebsocketMessageFormatter.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/SpeechConnectionMessage.Internal.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/SpeakerRecognitionConfig.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/RecognizerConfig.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/ServiceMessages/DetailedSpeechPhrase.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/ServiceMessages/SpeechDetected.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/SynthesisEvents.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/SynthesisTurn.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/SpeakerIdMessageAdapter.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/TranslationServiceRecognizer.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/Transcription/ConversationConnectionConfig.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/ServiceMessages/SynthesisAudioMetadata.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/SpeechServiceRecognizer.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/ServiceRecognizerBase.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/ServiceMessages/TranslationPhrase.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/SynthesisContext.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/SynthesisAdapterBase.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/ServiceMessages/Enums.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/Transcription/ConversationTranslatorInterfaces.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.speech/ServiceMessages/TurnStatusPayload.js"],"names":["SimpleSpeechPhrase","json","this","privSimpleSpeechPhrase","JSON","parse","RecognitionStatus","DisplayText","Offset","Duration","undefined","PrimaryLanguage","Language","Confidence","SpeakerId","RecognitionCompletionStatus","SpeechRecognitionEvent","eventName","requestId","sessionId","eventType","Info","super","privRequestId","privSessionId","RecognitionTriggeredEvent","audioSourceId","audioNodeId","privAudioSourceId","privAudioNodeId","ListeningStartedEvent","ConnectingToServiceEvent","authFetchEventid","privAuthFetchEventid","RecognitionStartedEvent","authFetchEventId","privAuthFetchEventId","privIsDisposed","privListeningTriggerMetric","privMicMetric","privConnectionEstablishMetric","onEvent","e","End","eventTime","Name","Start","privMicStartTime","Error","error","privConnectionId","connectionId","privConnectionStartTime","Id","getConnectionError","statusCode","message","headers","path","privReceivedMessages","Array","push","networkReceivedTime","getTelemetry","metrics","privPhraseLatencies","length","PhraseLatencyMs","privHypothesisLatencies","FirstHypothesisLatencyMs","telemetry","Metrics","ReceivedMessages","stringify","dispose","toString","audioReceivedTime","Date","now","Object","keys","__awaiter","thisArg","_arguments","P","generator","adopt","value","resolve","Promise","reject","fulfilled","step","next","rejected","result","done","then","apply","privDetachables","privIsAudioNodeDetached","privIsRecognizing","privIsSpeechEnded","privTurnStartAudioOffset","privLastRecoOffset","privHypothesisReceived","privBytesSent","privRecogNumber","privInTurn","onPreConnectionStart","onServiceTurnStartResponse","privTurnDeferral","privServiceTelemetryListener","hasTelemetry","event","Events","instance","promise","eventSource","attachListener","audioNode","isError","privAudioNode","onComplete","reason","replay","continuousRecognition","isSpeechEnded","offset","hypothesisReceived","findTimeAtOffset","phraseReceived","onServiceRecognized","shrinkBuffers","bytesSent","detachable","detach","detachAudioNode","queryParams","params","map","k","encodeURIComponent","join","withQuery","url","queryString","indexOf","parseXHRResult","xhr","data","responseText","getAllResponseHeaders","ok","status","statusText","errorResponse","extractHeaderValue","headerKey","headerValue","arr","trim","split","headerMap","forEach","line","parts","header","shift","toLowerCase","request","method","body","options","callback","defaultRequestOptions","requestOptions","ignoreCache","timeout","window","XMLHttpRequest","open","key","setRequestHeader","onload","evt","onerror","ontimeout","send","PromiseToEmptyCallback","cb","err","IntentResponse","privIntentResponse","query","topScoringIntent","entities","TranslationHypothesis","privTranslationHypothesis","Translation","TranslationStatus","Text","SpeechContext","dynamicGrammar","privContext","privDynamicGrammar","sectionName","phraseDetection","enrichment","pronunciationAssessment","phraseOutput","detailed","format","dgi","generateGrammarObject","setSection","ret","ConversationManager","privRequestParams","configParams","privErrors","restErrors","privHost","host","privApiVersion","apiVersion","privRestPath","restPath","args","conversationCode","throwIfNullOrUndefined","languageCode","getProperty","SpeechServiceConnection_RecoLanguage","defaultLanguageCode","nickname","ConversationTranslator_Name","endpointHost","ConversationTranslator_Host","correlationId","ConversationTranslator_CorrelationId","subscriptionKey","SpeechServiceConnection_Key","subscriptionRegion","SpeechServiceConnection_Region","authToken","SpeechServiceAuthorization_Token","throwIfNullOrWhitespace","clientAppId","roomId","authInvalidSubscriptionRegion","authorization","authInvalidSubscriptionKey","config","endpoint","response","errMessageRaw","errorMessage","invalidCreateJoinConversationResponse","replace","code","conversation","typedError","name","sessionToken","invalidArgs","TranscriberConnectionFactory","arguments","multiaudioRelativeUri","create","authInfo","parameters","SpeechServiceConnection_Endpoint","region","hostSuffix","startsWith","hostDefault","SpeechServiceConnection_Host","endpointId","SpeechServiceConnection_EndpointId","language","search","CustomSpeechDeploymentId","setCommonUrlParams","token","headerName","ConnectionId","setProperty","SpeechServiceConnection_Url","enableCompression","fromRecognizerConfig","SynthesisServiceType","SynthesizerConfig","speechServiceConfig","privSynthesisServiceType","Standard","privSpeechServiceConfig","privParameters","SpeechSynthesisConnectionFactory","synthesisUri","hostPrefix","CustomVoiceDeploymentId","fromParameters","TranslationSynthesisEnd","privSynthesisEnd","SynthesisStatus","FailureReason","ConnectionMessage","messageType","id","textBody","type","privConversationMessageType","toConnectionMessage","deferral","incomingMessage","textContent","Binary","binaryContent","fromConnectionMessage","payload","RawWebsocketMessage","ConnectionFactoryBase","PropertyId","ConversationConnectionConfig","webSocketPath","ConversationTranslator_Token","Contracts","WebsocketConnection","ProxyInfo","onAuthCompleted","onConnectionEstablishCompleted","onServiceTurnEndResponse","privRequestCompletionDeferral","SessionEventArgs","isMuted","privIsMuted","isLocked","privIsLocked","participant","privParticipant","participantId","privKey","privValue","privParticipantId","conversationId","translateTo","profanityFilter","roomProfanityFilter","isRoomLocked","isMuteAll","participants","privRoomId","privSessionToken","privTranslateTo","privProfanityFilter","privRoomProfanityFilter","privIsRoomLocked","privParticipants","privIsMuteAll","ConversationReceivedTranslationEventArgs","command","privPayload","privCommand","CommandResponsePayload","privCommandResponse","roomid","ParticipantsListPayloadResponse","privParticipantsPayloadResponse","roomLocked","muteAll","ParticipantPayloadResponse","privParticipantPayloadResponse","locale","usetts","ismuted","ishost","avatar","SpeechResponsePayload","privSpeechResponse","recognition","translations","timestamp","TextResponsePayload","privTextResponse","originalText","ServiceRecognizerBase","authentication","connectionFactory","audioSource","recognizerConfig","conversationServiceConnector","privLastPartialUtteranceId","noOp","privConversationServiceConnector","privConversationAuthentication","receiveMessageOverride","receiveConversationMessageOverride","recognizeOverride","postConnectImplOverride","conversationConnectImpl","configConnectionOverride","configConnection","disconnectOverride","privDisconnect","privConversationRequestSession","privConversationConnectionFactory","privConversationIsDisposed","privConnectionConfigPromise","connection","fetchConnection","terminateMessageLoop","cancelRecognition","CancellationReason","NoError","connectionMessage","successCallback","errorCallBack","cancellationReason","errorCode","cancelEvent","ConversationTranslationCanceledEventArgs","canceled","_a","privConnectionLoop","startMessageLoop","communicationCustodian","isDisposed","read","sendFinal","conversationMessageType","commandPayload","fromJSON","participantsPayload","participantsResult","p","displayName","isHost","isUsingTts","preferredLanguage","participantsListReceived","participantUpdateCommandReceived","setTranslateToLanguages","setProfanityFiltering","setMute","muteAllCommandReceived","conversationExpiration","ConversationExpirationEventArgs","setUseTTS","lockRoomCommandReceived","changeNickname","joinParticipantPayload","joiningParticipant","participantJoinCommandReceived","leavingParticipant","participantLeaveCommandReceived","speechPayload","speechResult","ConversationTranslationResult","getTranslations","isFinal","text","translationReceived","final","partial","textPayload","textResult","instantMessage","messageRetrievalPromise","r","privRequestSession","RuntimeError","state","Disconnected","connectImpl","serviceResultTranslations","Translations","translation","set","lang","ConversationRecognizerFactory","speechConfig","audioConfig","Recognizer","serviceConfigImpl","throwIfNull","properties","privProperties","clone","privConnection","Connection","fromRecognizer","connected","disconnected","privSpeechRecognitionLanguage","throwIfDisposed","privReco","conversationTranslatorToken","connectAsync","disconnect","catch","sendMessage","_b","closeConnection","close","disposing","_super","get","call","RecognizerConfig","msg","withAsync","sendMessageAsync","TranscriptionServiceRecognizer","transcriber","sendSpeechEvent","speechEventJson","privTranscriberRecognizer","sendPrePayloadJSONOverride","sendTranscriptionStartJSON","info","isRecognizing","createSpeechEventPayload","resultProps","SpeechServiceResponse_JsonResult","processed","hypothesis","currentTurnAudioOffset","RecognizingSpeech","LanguageDetectionConfidence","onHypothesis","ev","recognizing","simple","resultReason","implTranslateRecognitionResult","onPhraseRecognized","Canceled","cancelReason","implTranslateCancelResult","cancelRecognitionLocal","implTranslateCancelErrorCode","NoMatch","InitialSilenceTimeout","privRecognizerConfig","Simple","Success","NBest","Display","recognized","privSuccessCallback","privErrorCallback","sendSpeechContext","getConversationInfo","sendWaveHeader","meeting","eventDict","conversationProperties","idString","attendees","record","audiorecording","SpeechHypothesis","privSpeechHypothesis","TranscriberRecognizer","speechTranslationConfig","speechTranslationConfigImpl","speechRecognitionLanguage","privDisposedRecognizer","privConversation","conversationInfo","c","startContinuousRecognitionAsyncImpl","Conversation","stopContinuousRecognitionAsyncImpl","reco","sendSpeechEventAsync","s","transcribing","transcribed","sessionStarted","sessionStopped","implRecognizerStop","configImpl","ActivityPayloadResponse","privActivityResponse","messageDataStreamType","messagePayload","version","MessageDataStreamType","TranslationConnectionFactory","from","to","SpeechServiceConnection_TranslationToLanguages","setUrlParameter","SpeechServiceResponse_TranslationRequestStablePartialResult","StableTranslation","voiceName","featureName","SpeechServiceConnection_TranslationVoice","SpeechConnectionFactory","interactiveRelativeUri","conversationRelativeUri","dictationRelativeUri","Format","autoDetectSourceLanguages","EnableLanguageId","recognitionMode","Dictation","CRLF","WebsocketMessageFormatter","textMessage","headerBodySplit","parseHeaders","binaryMessage","byteLength","dataView","DataView","headerLength","getInt16","headersString","i","String","fromCharCode","getInt8","slice","makeHeaders","content","binaryBody","headerBuffer","stringToArrayBuffer","headerInt8Array","Int8Array","payloadInt8Array","bodyInt8Array","buffer","headerMatches","match","separatorIndex","substr","str","ArrayBuffer","view","setUint8","charCodeAt","SpeechConnectionMessage","contentType","streamId","additionalHeaders","Path","RequestId","RequestTimestamp","toISOString","ContentType","RequestStreamId","privPath","privContentType","privStreamId","privAdditionalHeaders","requestTimestamp","SpeakerRecognitionConfig","context","RecognitionMode","SpeechResultFormat","connectivity","privRecognitionMode","Interactive","SpeechServiceConfig","Context","privRecognitionActivityTimeout","Recognition","SpeechServiceConnection_AutoDetectSourceLanguages","serialize","replacement","hasOwnProperty","charAt","substring","os","system","System","SPEECHSDK_CLIENTSDK_VERSION","build","OS","platform","DetailedSpeechPhrase","privDetailedSpeechPhrase","SpeechDetected","privSpeechStartDetected","PlatformEvent","SynthesisTriggeredEvent","sessionAudioDestinationId","turnAudioDestinationId","privSessionAudioDestinationId","privTurnAudioDestinationId","ConnectingToSynthesisServiceEvent","SynthesisStartedEvent","privIsSynthesizing","privIsSynthesisEnded","privBytesReceived","privTextOffset","privNextSearchTextIndex","onServiceResponseMessage","responseJson","audio","privAudioOutputStream","privTurnAudioDestination","privAudioOutputFormat","privReceivedAudio","readAllAudioFromStream","privReceivedAudioWithHeader","audioOutputFormat","hasHeader","getAllReceivedAudio","SynthesisAdapterBase","addHeader","rawText","isSSML","audioDestination","privRawText","privIsSSML","isSynthesizing","write","updateTextOffset","bytesReceived","SpeakerIdMessageAdapter","privUri","privRestAdapter","profileType","uri","getOperationUri","setHeaders","contentTypeKey","Post","profile","profileId","blob","File","ignoreMinLength","model","voiceProfile","TextIndependentIdentification","profileIds","voiceProfileIds","Delete","mode","dependency","TextDependentVerification","TranslationServiceRecognizer","translationRecognizer","privTranslationRecognizer","fireEventForResult","translatedPhrase","sendSynthesisAudio","synthEnd","synthesizing","retEvent","canceledResult","ServiceError","serviceResult","TranslatedSpeech","RecognizedSpeech","TranslatingSpeech","SynthesizingAudioCompleted","SynthesizingAudio","privClientAppId","privDefaultLanguageCode","privWebSocketPath","privSpeechHost","privSpeechPath","privTranscriptionEventKeys","SynthesisAudioMetadata","privSynthesisAudioMetadata","Metadata","SpeechServiceRecognizer","speechRecognizer","privSpeechRecognizer","sourceLanguages","privSpeechContext","languages","onSuccess","action","onUnknown","interimResults","resultType","phraseResults","recognizer","privSetTimeout","setTimeout","speechContextJson","speechContext","toJSON","sendSpeechServiceConfig","requestSession","SpeechServiceConfigJson","telemetryDataEnabled","withTelemetry","privMustReportEndOfStream","privAuthentication","privConnectionFactory","privAudioSource","privRecognizer","privConnectionEvents","privServiceEvents","privAgentConfig","connectionEvents","attach","connectionEvent","connectionClosedEvent","BadRequestParameters","ConnectionFailure","auth","privConnectionConfigurationPromise","recoMode","startNewRecognition","listenForServiceTelemetry","events","conPromise","audioStreamNode","deviceInfo","avgBytesPerSec","onAudioSourceAttachCompleted","source","sessionStartEventArgs","receiveMessage","audioSendPromise","sendAudio","turnOff","sendFinalAudio","onStopRecognizing","turnCompletionPromise","privConnectionPromise","privActivityTemplate","telemetryData","privServiceHasSentMessage","speechStartDetected","speechStartEventArgs","speechStopDetected","isContinuousRecognition","speechStopEventArgs","speechEndDetected","sendTelemetryData","EndOfStream","sessionStopEventArgs","sendPrePayloadJSON","processTypeSpecificMessages","serviceEvents","isUnAuthorized","Speech_SessionId","authPromise","fetchOnExpiry","fetch","configureConnection","audioFormat","nextSendTime","fastLaneSizeMs","maxSendUnthrottledBytes","parseInt","startRecogNumber","recogNumber","readAndUploadCycle","audioStreamChunk","sendDelay","isEnd","onAudioSent","Math","max","delay","onSpeechEnded","delayMs","out","readView","Uint8Array","padStart","console","TranslationPhrase","privTranslationPhrase","SynthesisContext","speechSynthesizer","privSpeechSynthesizer","synthesisSection","buildSynthesisContext","metadataOptions","sentenceBoundaryEnabled","wordBoundaryEnabled","wordBoundary","outputFormat","requestAudioFormatString","autoDetection","autoDetectSourceLanguage","synthesizerConfig","speakOverride","connectImplOverride","sendSynthesisContext","synthesisContextJson","synthesisContext","privSynthesisTurn","sendSsmlMessage","ssml","privSynthesizerConfig","privSessionAudioDestination","privSynthesisContext","cancelSynthesisLocal","updateHeader","tmp","buildSsml","startNewSynthesis","synthesisStartEventArgs","SynthesizingAudioStarted","synthesisStarted","SynthesisCanceled","onStopSynthesizing","cancelSynthesis","onAudioChunkReceived","audioWithHeader","metadataList","metadata","Type","onWordBoundaryEvent","Data","Length","currentTextOffset","audioBuffer","getAllReceivedAudioWithHeader","synthesisCompleted","InternalParticipants","meId","exists","getParticipantIndex","splice","getParticipant","findIndex","find","filter","ConversationTranslatorMessageTypes","participantCommand","translatedMessage","ConversationTranslatorCommandTypes","disconnectSession","ejectParticipant","instant_message","joinSession","leaveSession","participantList","roomExpirationWarning","setLockState","setMuteAll","TurnStatusResponsePayload","privMessageStatusResponse","interactionId"],"mappings":"wPAAA,kDAGO,MAAMA,EACT,YAAYC,GACRC,KAAKC,uBAAyBC,KAAKC,MAAMJ,GACzCC,KAAKC,uBAAuBG,kBAAoB,OAAkBJ,KAAKC,uBAAuBG,mBAElG,gBAAgBL,GACZ,OAAO,IAAID,EAAmBC,GAElC,wBACI,OAAOC,KAAKC,uBAAuBG,kBAEvC,kBACI,OAAOJ,KAAKC,uBAAuBI,YAEvC,aACI,OAAOL,KAAKC,uBAAuBK,OAEvC,eACI,OAAON,KAAKC,uBAAuBM,SAEvC,eACI,Y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GpBrF,KAAK+5B,eAAe10B,EAAM8N,IAMrC,oBAAoBA,GAChB,OAAOnT,KAAK6V,aAAamkB,UAAW/e,GAAMA,EAAE9H,KAAOA,GAMvD,eAAeA,GACX,OAAOnT,KAAK6V,aAAaokB,KAAMhf,GAAMA,EAAE9H,KAAOA,GAKlD,kBAAkBA,GACdnT,KAAK6V,aAAe7V,KAAK6V,aAAaqkB,OAAQjf,GAAMA,EAAE9H,KAAOA,GAKjE,WACI,OAAOnT,KAAK6V,aAAaokB,KAAMhf,IAAmB,IAAbA,EAAEE,QAK3C,SACI,OAAOnb,KAAK+5B,eAAe/5B,KAAK25B,OAMjC,MAAMQ,EAAqC,CAC9C5jB,QAAS,UACTsG,MAAO,QACPyD,KAAM,OACNrD,eAAgB,kBAChBH,QAAS,UACTsd,mBAAoB,sBACpBC,kBAAmB,sBAKVC,EAAqC,CAC9Cte,eAAgB,iBAChBue,kBAAmB,oBACnBC,iBAAkB,mBAClBC,gBAAiB,kBACjBC,YAAa,cACbC,aAAc,eACdC,gBAAiB,kBACjBC,sBAAuB,wBACvBC,aAAc,eACdpf,QAAS,UACTqf,WAAY,aACZtf,sBAAuB,wBACvBD,wBAAyB,0BACzBM,UAAW,c,mCCxFf,kCAEO,MAAMkf,EACT,YAAYj7B,GACRC,KAAKi7B,0BAA4B/6B,KAAKC,MAAMJ,GAEhD,gBAAgBA,GACZ,OAAO,IAAIi7B,EAA0Bj7B,GAEzC,oBACI,OAAOC,KAAKi7B,0BAA0BC,cAE1C,qBACI,OAAOl7B,KAAKi7B,0BAA0B1lB,eAE1C,iBAGI,OAAQvV,KAAKi7B,0BAA0B53B,YACnC,IAAK,UACD,OAAO,IACX,IAAK,SACD,OAAO,IACX,IAAK,WACD,OAAO,IACX,QACI,OAAOrD,KAAKi7B,0BAA0B53B","file":"js/MockTestView~9c63c360.cda96cab.js","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { RecognitionStatus } from \"../Exports\";\nexport class SimpleSpeechPhrase {\n constructor(json) {\n this.privSimpleSpeechPhrase = JSON.parse(json);\n this.privSimpleSpeechPhrase.RecognitionStatus = RecognitionStatus[this.privSimpleSpeechPhrase.RecognitionStatus];\n }\n static fromJSON(json) {\n return new SimpleSpeechPhrase(json);\n }\n get RecognitionStatus() {\n return this.privSimpleSpeechPhrase.RecognitionStatus;\n }\n get DisplayText() {\n return this.privSimpleSpeechPhrase.DisplayText;\n }\n get Offset() {\n return this.privSimpleSpeechPhrase.Offset;\n }\n get Duration() {\n return this.privSimpleSpeechPhrase.Duration;\n }\n get Language() {\n return this.privSimpleSpeechPhrase.PrimaryLanguage === undefined ? undefined : this.privSimpleSpeechPhrase.PrimaryLanguage.Language;\n }\n get LanguageDetectionConfidence() {\n return this.privSimpleSpeechPhrase.PrimaryLanguage === undefined ? undefined : this.privSimpleSpeechPhrase.PrimaryLanguage.Confidence;\n }\n get SpeakerId() {\n return this.privSimpleSpeechPhrase.SpeakerId;\n }\n}\n\n//# sourceMappingURL=SimpleSpeechPhrase.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n// tslint:disable:max-classes-per-file\nimport { EventType, PlatformEvent } from \"../common/Exports\";\nexport class SpeechRecognitionEvent extends PlatformEvent {\n constructor(eventName, requestId, sessionId, eventType = EventType.Info) {\n super(eventName, eventType);\n this.privRequestId = requestId;\n this.privSessionId = sessionId;\n }\n get requestId() {\n return this.privRequestId;\n }\n get sessionId() {\n return this.privSessionId;\n }\n}\nexport class RecognitionTriggeredEvent extends SpeechRecognitionEvent {\n constructor(requestId, sessionId, audioSourceId, audioNodeId) {\n super(\"RecognitionTriggeredEvent\", requestId, sessionId);\n this.privAudioSourceId = audioSourceId;\n this.privAudioNodeId = audioNodeId;\n }\n get audioSourceId() {\n return this.privAudioSourceId;\n }\n get audioNodeId() {\n return this.privAudioNodeId;\n }\n}\nexport class ListeningStartedEvent extends SpeechRecognitionEvent {\n constructor(requestId, sessionId, audioSourceId, audioNodeId) {\n super(\"ListeningStartedEvent\", requestId, sessionId);\n this.privAudioSourceId = audioSourceId;\n this.privAudioNodeId = audioNodeId;\n }\n get audioSourceId() {\n return this.privAudioSourceId;\n }\n get audioNodeId() {\n return this.privAudioNodeId;\n }\n}\nexport class ConnectingToServiceEvent extends SpeechRecognitionEvent {\n constructor(requestId, authFetchEventid, sessionId) {\n super(\"ConnectingToServiceEvent\", requestId, sessionId);\n this.privAuthFetchEventid = authFetchEventid;\n }\n get authFetchEventid() {\n return this.privAuthFetchEventid;\n }\n}\nexport class RecognitionStartedEvent extends SpeechRecognitionEvent {\n constructor(requestId, audioSourceId, audioNodeId, authFetchEventId, sessionId) {\n super(\"RecognitionStartedEvent\", requestId, sessionId);\n this.privAudioSourceId = audioSourceId;\n this.privAudioNodeId = audioNodeId;\n this.privAuthFetchEventId = authFetchEventId;\n }\n get audioSourceId() {\n return this.privAudioSourceId;\n }\n get audioNodeId() {\n return this.privAudioNodeId;\n }\n get authFetchEventId() {\n return this.privAuthFetchEventId;\n }\n}\nexport var RecognitionCompletionStatus;\n(function (RecognitionCompletionStatus) {\n RecognitionCompletionStatus[RecognitionCompletionStatus[\"Success\"] = 0] = \"Success\";\n RecognitionCompletionStatus[RecognitionCompletionStatus[\"AudioSourceError\"] = 1] = \"AudioSourceError\";\n RecognitionCompletionStatus[RecognitionCompletionStatus[\"AudioSourceTimeout\"] = 2] = \"AudioSourceTimeout\";\n RecognitionCompletionStatus[RecognitionCompletionStatus[\"AuthTokenFetchError\"] = 3] = \"AuthTokenFetchError\";\n RecognitionCompletionStatus[RecognitionCompletionStatus[\"AuthTokenFetchTimeout\"] = 4] = \"AuthTokenFetchTimeout\";\n RecognitionCompletionStatus[RecognitionCompletionStatus[\"UnAuthorized\"] = 5] = \"UnAuthorized\";\n RecognitionCompletionStatus[RecognitionCompletionStatus[\"ConnectTimeout\"] = 6] = \"ConnectTimeout\";\n RecognitionCompletionStatus[RecognitionCompletionStatus[\"ConnectError\"] = 7] = \"ConnectError\";\n RecognitionCompletionStatus[RecognitionCompletionStatus[\"ClientRecognitionActivityTimeout\"] = 8] = \"ClientRecognitionActivityTimeout\";\n RecognitionCompletionStatus[RecognitionCompletionStatus[\"UnknownError\"] = 9] = \"UnknownError\";\n})(RecognitionCompletionStatus || (RecognitionCompletionStatus = {}));\nexport class RecognitionEndedEvent extends SpeechRecognitionEvent {\n constructor(requestId, audioSourceId, audioNodeId, authFetchEventId, sessionId, serviceTag, status, error) {\n super(\"RecognitionEndedEvent\", requestId, sessionId, status === RecognitionCompletionStatus.Success ? EventType.Info : EventType.Error);\n this.privAudioSourceId = audioSourceId;\n this.privAudioNodeId = audioNodeId;\n this.privAuthFetchEventId = authFetchEventId;\n this.privStatus = status;\n this.privError = error;\n this.privServiceTag = serviceTag;\n }\n get audioSourceId() {\n return this.privAudioSourceId;\n }\n get audioNodeId() {\n return this.privAudioNodeId;\n }\n get authFetchEventId() {\n return this.privAuthFetchEventId;\n }\n get serviceTag() {\n return this.privServiceTag;\n }\n get status() {\n return this.privStatus;\n }\n get error() {\n return this.privError;\n }\n}\n\n//# sourceMappingURL=RecognitionEvents.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n// tslint:disable:max-classes-per-file\nimport { AudioSourceErrorEvent, AudioStreamNodeAttachedEvent, AudioStreamNodeAttachingEvent, AudioStreamNodeDetachedEvent, AudioStreamNodeErrorEvent, ConnectionEstablishedEvent, ConnectionEstablishErrorEvent, ConnectionMessageReceivedEvent, ConnectionStartEvent, } from \"../common/Exports\";\nimport { ConnectingToServiceEvent, RecognitionTriggeredEvent } from \"./RecognitionEvents\";\nexport class ServiceTelemetryListener {\n constructor(requestId, audioSourceId, audioNodeId) {\n this.privIsDisposed = false;\n this.privListeningTriggerMetric = null;\n this.privMicMetric = null;\n this.privConnectionEstablishMetric = null;\n this.onEvent = (e) => {\n if (this.privIsDisposed) {\n return;\n }\n if (e instanceof RecognitionTriggeredEvent && e.requestId === this.privRequestId) {\n this.privListeningTriggerMetric = {\n End: e.eventTime,\n Name: \"ListeningTrigger\",\n Start: e.eventTime,\n };\n }\n if (e instanceof AudioStreamNodeAttachingEvent && e.audioSourceId === this.privAudioSourceId && e.audioNodeId === this.privAudioNodeId) {\n this.privMicStartTime = e.eventTime;\n }\n if (e instanceof AudioStreamNodeAttachedEvent && e.audioSourceId === this.privAudioSourceId && e.audioNodeId === this.privAudioNodeId) {\n this.privMicStartTime = e.eventTime;\n }\n if (e instanceof AudioSourceErrorEvent && e.audioSourceId === this.privAudioSourceId) {\n if (!this.privMicMetric) {\n this.privMicMetric = {\n End: e.eventTime,\n Error: e.error,\n Name: \"Microphone\",\n Start: this.privMicStartTime,\n };\n }\n }\n if (e instanceof AudioStreamNodeErrorEvent && e.audioSourceId === this.privAudioSourceId && e.audioNodeId === this.privAudioNodeId) {\n if (!this.privMicMetric) {\n this.privMicMetric = {\n End: e.eventTime,\n Error: e.error,\n Name: \"Microphone\",\n Start: this.privMicStartTime,\n };\n }\n }\n if (e instanceof AudioStreamNodeDetachedEvent && e.audioSourceId === this.privAudioSourceId && e.audioNodeId === this.privAudioNodeId) {\n if (!this.privMicMetric) {\n this.privMicMetric = {\n End: e.eventTime,\n Name: \"Microphone\",\n Start: this.privMicStartTime,\n };\n }\n }\n if (e instanceof ConnectingToServiceEvent && e.requestId === this.privRequestId) {\n this.privConnectionId = e.sessionId;\n }\n if (e instanceof ConnectionStartEvent && e.connectionId === this.privConnectionId) {\n this.privConnectionStartTime = e.eventTime;\n }\n if (e instanceof ConnectionEstablishedEvent && e.connectionId === this.privConnectionId) {\n if (!this.privConnectionEstablishMetric) {\n this.privConnectionEstablishMetric = {\n End: e.eventTime,\n Id: this.privConnectionId,\n Name: \"Connection\",\n Start: this.privConnectionStartTime,\n };\n }\n }\n if (e instanceof ConnectionEstablishErrorEvent && e.connectionId === this.privConnectionId) {\n if (!this.privConnectionEstablishMetric) {\n this.privConnectionEstablishMetric = {\n End: e.eventTime,\n Error: this.getConnectionError(e.statusCode),\n Id: this.privConnectionId,\n Name: \"Connection\",\n Start: this.privConnectionStartTime,\n };\n }\n }\n if (e instanceof ConnectionMessageReceivedEvent && e.connectionId === this.privConnectionId) {\n if (e.message && e.message.headers && e.message.headers.path) {\n if (!this.privReceivedMessages[e.message.headers.path]) {\n this.privReceivedMessages[e.message.headers.path] = new Array();\n }\n this.privReceivedMessages[e.message.headers.path].push(e.networkReceivedTime);\n }\n }\n };\n this.getTelemetry = () => {\n const metrics = new Array();\n if (this.privListeningTriggerMetric) {\n metrics.push(this.privListeningTriggerMetric);\n }\n if (this.privMicMetric) {\n metrics.push(this.privMicMetric);\n }\n if (this.privConnectionEstablishMetric) {\n metrics.push(this.privConnectionEstablishMetric);\n }\n if (this.privPhraseLatencies.length > 0) {\n metrics.push({\n PhraseLatencyMs: this.privPhraseLatencies,\n });\n }\n if (this.privHypothesisLatencies.length > 0) {\n metrics.push({\n FirstHypothesisLatencyMs: this.privHypothesisLatencies,\n });\n }\n const telemetry = {\n Metrics: metrics,\n ReceivedMessages: this.privReceivedMessages,\n };\n const json = JSON.stringify(telemetry);\n // We dont want to send the same telemetry again. So clean those out.\n this.privReceivedMessages = {};\n this.privListeningTriggerMetric = null;\n this.privMicMetric = null;\n this.privConnectionEstablishMetric = null;\n this.privPhraseLatencies = [];\n this.privHypothesisLatencies = [];\n return json;\n };\n this.dispose = () => {\n this.privIsDisposed = true;\n };\n this.getConnectionError = (statusCode) => {\n /*\n -- Websocket status codes --\n NormalClosure = 1000,\n EndpointUnavailable = 1001,\n ProtocolError = 1002,\n InvalidMessageType = 1003,\n Empty = 1005,\n InvalidPayloadData = 1007,\n PolicyViolation = 1008,\n MessageTooBig = 1009,\n MandatoryExtension = 1010,\n InternalServerError = 1011\n */\n switch (statusCode) {\n case 400:\n case 1002:\n case 1003:\n case 1005:\n case 1007:\n case 1008:\n case 1009: return \"BadRequest\";\n case 401: return \"Unauthorized\";\n case 403: return \"Forbidden\";\n case 503:\n case 1001: return \"ServerUnavailable\";\n case 500:\n case 1011: return \"ServerError\";\n case 408:\n case 504: return \"Timeout\";\n default: return \"statuscode:\" + statusCode.toString();\n }\n };\n this.privRequestId = requestId;\n this.privAudioSourceId = audioSourceId;\n this.privAudioNodeId = audioNodeId;\n this.privReceivedMessages = {};\n this.privPhraseLatencies = [];\n this.privHypothesisLatencies = [];\n }\n phraseReceived(audioReceivedTime) {\n if (audioReceivedTime > 0) { // 0 indicates the time is unknown. Drop it.\n this.privPhraseLatencies.push(Date.now() - audioReceivedTime);\n }\n }\n hypothesisReceived(audioReceivedTime) {\n if (audioReceivedTime > 0) { // 0 indicates the time is unknown. Drop it.\n this.privHypothesisLatencies.push(Date.now() - audioReceivedTime);\n }\n }\n // Determines if there are any telemetry events to send to the service.\n get hasTelemetry() {\n return (Object.keys(this.privReceivedMessages).length !== 0 ||\n this.privListeningTriggerMetric !== null ||\n this.privMicMetric !== null ||\n this.privConnectionEstablishMetric !== null ||\n this.privPhraseLatencies.length !== 0 ||\n this.privHypothesisLatencies.length !== 0);\n }\n}\n\n//# sourceMappingURL=ServiceTelemetryListener.Internal.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { createNoDashGuid, Deferred, Events } from \"../common/Exports\";\nimport { ConnectingToServiceEvent, ListeningStartedEvent, RecognitionStartedEvent, RecognitionTriggeredEvent, } from \"./RecognitionEvents\";\nimport { ServiceTelemetryListener } from \"./ServiceTelemetryListener.Internal\";\nexport class RequestSession {\n constructor(audioSourceId) {\n this.privIsDisposed = false;\n this.privDetachables = new Array();\n this.privIsAudioNodeDetached = false;\n this.privIsRecognizing = false;\n this.privIsSpeechEnded = false;\n this.privTurnStartAudioOffset = 0;\n this.privLastRecoOffset = 0;\n this.privHypothesisReceived = false;\n this.privBytesSent = 0;\n this.privRecogNumber = 0;\n this.privInTurn = false;\n this.onPreConnectionStart = (authFetchEventId, connectionId) => {\n this.privAuthFetchEventId = authFetchEventId;\n this.privSessionId = connectionId;\n this.onEvent(new ConnectingToServiceEvent(this.privRequestId, this.privAuthFetchEventId, this.privSessionId));\n };\n this.onServiceTurnStartResponse = () => {\n if (!!this.privTurnDeferral && !!this.privInTurn) {\n // What? How are we starting a turn with another not done?\n this.privTurnDeferral.reject(\"Another turn started before current completed.\");\n }\n this.privInTurn = true;\n this.privTurnDeferral = new Deferred();\n };\n this.getTelemetry = () => {\n if (this.privServiceTelemetryListener.hasTelemetry) {\n return this.privServiceTelemetryListener.getTelemetry();\n }\n else {\n return null;\n }\n };\n this.onEvent = (event) => {\n if (!!this.privServiceTelemetryListener) {\n this.privServiceTelemetryListener.onEvent(event);\n }\n Events.instance.onEvent(event);\n };\n this.privAudioSourceId = audioSourceId;\n this.privRequestId = createNoDashGuid();\n this.privAudioNodeId = createNoDashGuid();\n this.privTurnDeferral = new Deferred();\n // We're not in a turn, so resolve.\n this.privTurnDeferral.resolve();\n }\n get sessionId() {\n return this.privSessionId;\n }\n get requestId() {\n return this.privRequestId;\n }\n get audioNodeId() {\n return this.privAudioNodeId;\n }\n get turnCompletionPromise() {\n return this.privTurnDeferral.promise;\n }\n get isSpeechEnded() {\n return this.privIsSpeechEnded;\n }\n get isRecognizing() {\n return this.privIsRecognizing;\n }\n get currentTurnAudioOffset() {\n return this.privTurnStartAudioOffset;\n }\n get recogNumber() {\n return this.privRecogNumber;\n }\n // The number of bytes sent for the current connection.\n // Counter is reset to 0 each time a connection is established.\n get bytesSent() {\n return this.privBytesSent;\n }\n listenForServiceTelemetry(eventSource) {\n if (!!this.privServiceTelemetryListener) {\n this.privDetachables.push(eventSource.attachListener(this.privServiceTelemetryListener));\n }\n }\n startNewRecognition() {\n this.privIsSpeechEnded = false;\n this.privIsRecognizing = true;\n this.privTurnStartAudioOffset = 0;\n this.privLastRecoOffset = 0;\n this.privRequestId = createNoDashGuid();\n this.privRecogNumber++;\n this.privServiceTelemetryListener = new ServiceTelemetryListener(this.privRequestId, this.privAudioSourceId, this.privAudioNodeId);\n this.onEvent(new RecognitionTriggeredEvent(this.requestId, this.privSessionId, this.privAudioSourceId, this.privAudioNodeId));\n }\n onAudioSourceAttachCompleted(audioNode, isError, error) {\n return __awaiter(this, void 0, void 0, function* () {\n this.privAudioNode = audioNode;\n this.privIsAudioNodeDetached = false;\n if (isError) {\n yield this.onComplete();\n }\n else {\n this.onEvent(new ListeningStartedEvent(this.privRequestId, this.privSessionId, this.privAudioSourceId, this.privAudioNodeId));\n }\n });\n }\n onAuthCompleted(isError, error) {\n return __awaiter(this, void 0, void 0, function* () {\n if (isError) {\n yield this.onComplete();\n }\n });\n }\n onConnectionEstablishCompleted(statusCode, reason) {\n return __awaiter(this, void 0, void 0, function* () {\n if (statusCode === 200) {\n this.onEvent(new RecognitionStartedEvent(this.requestId, this.privAudioSourceId, this.privAudioNodeId, this.privAuthFetchEventId, this.privSessionId));\n if (!!this.privAudioNode) {\n this.privAudioNode.replay();\n }\n this.privTurnStartAudioOffset = this.privLastRecoOffset;\n this.privBytesSent = 0;\n return;\n }\n else if (statusCode === 403) {\n yield this.onComplete();\n }\n });\n }\n onServiceTurnEndResponse(continuousRecognition) {\n return __awaiter(this, void 0, void 0, function* () {\n this.privTurnDeferral.resolve();\n if (!continuousRecognition || this.isSpeechEnded) {\n yield this.onComplete();\n this.privInTurn = false;\n }\n else {\n // Start a new request set.\n this.privTurnStartAudioOffset = this.privLastRecoOffset;\n this.privRequestId = createNoDashGuid();\n this.privAudioNode.replay();\n }\n });\n }\n onHypothesis(offset) {\n if (!this.privHypothesisReceived) {\n this.privHypothesisReceived = true;\n this.privServiceTelemetryListener.hypothesisReceived(this.privAudioNode.findTimeAtOffset(offset));\n }\n }\n onPhraseRecognized(offset) {\n this.privServiceTelemetryListener.phraseReceived(this.privAudioNode.findTimeAtOffset(offset));\n this.onServiceRecognized(offset);\n }\n onServiceRecognized(offset) {\n this.privLastRecoOffset = offset;\n this.privHypothesisReceived = false;\n this.privAudioNode.shrinkBuffers(offset);\n }\n onAudioSent(bytesSent) {\n this.privBytesSent += bytesSent;\n }\n dispose(error) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!this.privIsDisposed) {\n // we should have completed by now. If we did not its an unknown error.\n this.privIsDisposed = true;\n for (const detachable of this.privDetachables) {\n yield detachable.detach();\n }\n this.privServiceTelemetryListener.dispose();\n this.privIsRecognizing = false;\n }\n });\n }\n onStopRecognizing() {\n return __awaiter(this, void 0, void 0, function* () {\n yield this.onComplete();\n });\n }\n // Should be called with the audioNode for this session has indicated that it is out of speech.\n onSpeechEnded() {\n this.privIsSpeechEnded = true;\n }\n onComplete() {\n return __awaiter(this, void 0, void 0, function* () {\n if (!!this.privIsRecognizing) {\n this.privIsRecognizing = false;\n yield this.detachAudioNode();\n }\n });\n }\n detachAudioNode() {\n return __awaiter(this, void 0, void 0, function* () {\n if (!this.privIsAudioNodeDetached) {\n this.privIsAudioNodeDetached = true;\n if (this.privAudioNode) {\n yield this.privAudioNode.detach();\n }\n }\n });\n }\n}\n\n//# sourceMappingURL=RequestSession.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { RestConfigBase } from \"../../common.browser/RestConfigBase\";\n// Node.JS specific xmlhttprequest / browser support.\nimport * as XHR from \"xmlhttprequest-ts\";\n/**\n * Config settings for Conversation Translator\n */\n/**\n * Helpers for sending / receiving HTTPS requests / responses.\n * @param params\n */\nfunction queryParams(params = {}) {\n return Object.keys(params)\n .map((k) => encodeURIComponent(k) + \"=\" + encodeURIComponent(params[k]))\n .join(\"&\");\n}\nfunction withQuery(url, params = {}) {\n const queryString = queryParams(params);\n return queryString ? url + (url.indexOf(\"?\") === -1 ? \"?\" : \"&\") + queryString : url;\n}\nfunction parseXHRResult(xhr) {\n return {\n data: xhr.responseText,\n headers: xhr.getAllResponseHeaders(),\n json: () => JSON.parse(xhr.responseText),\n ok: xhr.status >= 200 && xhr.status < 300,\n status: xhr.status,\n statusText: xhr.statusText,\n };\n}\nfunction errorResponse(xhr, message = null) {\n return {\n data: message || xhr.statusText,\n headers: xhr.getAllResponseHeaders(),\n json: () => JSON.parse(message || (\"\\\"\" + xhr.statusText + \"\\\"\")),\n ok: false,\n status: xhr.status,\n statusText: xhr.statusText,\n };\n}\nexport function extractHeaderValue(headerKey, headers) {\n let headerValue = \"\";\n try {\n const arr = headers.trim().split(/[\\r\\n]+/);\n const headerMap = {};\n arr.forEach((line) => {\n const parts = line.split(\": \");\n const header = parts.shift().toLowerCase();\n const value = parts.join(\": \");\n headerMap[header] = value;\n });\n headerValue = headerMap[headerKey.toLowerCase()];\n }\n catch (e) {\n // ignore the error\n }\n return headerValue;\n}\nexport function request(method, url, queryParams = {}, body = null, options = {}, callback) {\n const defaultRequestOptions = RestConfigBase.requestOptions;\n const ignoreCache = options.ignoreCache || defaultRequestOptions.ignoreCache;\n const headers = options.headers || defaultRequestOptions.headers;\n const timeout = options.timeout || defaultRequestOptions.timeout;\n let xhr;\n if (typeof window === \"undefined\") { // Node\n xhr = new XHR.XMLHttpRequest();\n }\n else {\n xhr = new XMLHttpRequest();\n }\n xhr.open(method, withQuery(url, queryParams), true);\n if (headers) {\n Object.keys(headers).forEach((key) => xhr.setRequestHeader(key, headers[key]));\n }\n if (ignoreCache) {\n xhr.setRequestHeader(\"Cache-Control\", \"no-cache\");\n }\n xhr.timeout = timeout;\n xhr.onload = (evt) => {\n callback(parseXHRResult(xhr));\n };\n xhr.onerror = (evt) => {\n callback(errorResponse(xhr, \"Failed to make request.\"));\n };\n xhr.ontimeout = (evt) => {\n callback(errorResponse(xhr, \"Request took longer than expected.\"));\n };\n if (method === \"post\" && body) {\n xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n xhr.send(JSON.stringify(body));\n }\n else {\n xhr.send();\n }\n}\nexport function PromiseToEmptyCallback(promise, cb, err) {\n if (!!promise) {\n promise.then((result) => {\n try {\n if (!!cb) {\n cb();\n }\n }\n catch (e) {\n if (!!err) {\n err(`'Unhandled error on promise callback: ${e}'`);\n }\n }\n }, (reason) => {\n try {\n if (!!err) {\n err(reason);\n }\n /* tslint:disable:no-empty */\n }\n catch (error) {\n }\n });\n }\n else {\n if (!!err) {\n err(\"Null promise\");\n }\n }\n}\n\n//# sourceMappingURL=ConversationUtils.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n// response\nexport class IntentResponse {\n constructor(json) {\n this.privIntentResponse = JSON.parse(json);\n }\n static fromJSON(json) {\n return new IntentResponse(json);\n }\n get query() {\n return this.privIntentResponse.query;\n }\n get topScoringIntent() {\n return this.privIntentResponse.topScoringIntent;\n }\n get entities() {\n return this.privIntentResponse.entities;\n }\n}\n\n//# sourceMappingURL=IntentResponse.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { TranslationStatus } from \"../TranslationStatus\";\nexport class TranslationHypothesis {\n constructor(json) {\n this.privTranslationHypothesis = JSON.parse(json);\n this.privTranslationHypothesis.Translation.TranslationStatus = TranslationStatus[this.privTranslationHypothesis.Translation.TranslationStatus];\n }\n static fromJSON(json) {\n return new TranslationHypothesis(json);\n }\n get Duration() {\n return this.privTranslationHypothesis.Duration;\n }\n get Offset() {\n return this.privTranslationHypothesis.Offset;\n }\n get Text() {\n return this.privTranslationHypothesis.Text;\n }\n get Translation() {\n return this.privTranslationHypothesis.Translation;\n }\n}\n\n//# sourceMappingURL=TranslationHypothesis.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n/**\n * Defines translation status.\n * @class TranslationStatus\n */\nexport var TranslationStatus;\n(function (TranslationStatus) {\n /**\n * @member TranslationStatus.Success\n */\n TranslationStatus[TranslationStatus[\"Success\"] = 0] = \"Success\";\n /**\n * @member TranslationStatus.Error\n */\n TranslationStatus[TranslationStatus[\"Error\"] = 1] = \"Error\";\n})(TranslationStatus || (TranslationStatus = {}));\n\n//# sourceMappingURL=TranslationStatus.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n/**\n * Represents the JSON used in the speech.context message sent to the speech service.\n * The dynamic grammar is always refreshed from the encapsulated dynamic grammar object.\n */\nexport class SpeechContext {\n constructor(dynamicGrammar) {\n this.privContext = {};\n this.privDynamicGrammar = dynamicGrammar;\n }\n /**\n * Adds a section to the speech.context object.\n * @param sectionName Name of the section to add.\n * @param value JSON serializable object that represents the value.\n */\n setSection(sectionName, value) {\n this.privContext[sectionName] = value;\n }\n /**\n * @Internal\n * This is only used by pronunciation assessment config.\n * Do not use externally, object returned will change without warning or notice.\n */\n setPronunciationAssessmentParams(params) {\n if (this.privContext.phraseDetection === undefined) {\n this.privContext.phraseDetection = {\n enrichment: {\n pronunciationAssessment: {}\n }\n };\n }\n this.privContext.phraseDetection.enrichment.pronunciationAssessment = JSON.parse(params);\n if (this.privContext.phraseOutput === undefined) {\n this.privContext.phraseOutput = {\n detailed: {\n options: []\n },\n format: {}\n };\n }\n this.privContext.phraseOutput.format = \"Detailed\";\n this.privContext.phraseOutput.detailed.options.push(\"PronunciationAssessment\");\n if (this.privContext.phraseOutput.detailed.options.indexOf(\"WordTimings\") === -1) {\n this.privContext.phraseOutput.detailed.options.push(\"WordTimings\");\n }\n }\n toJSON() {\n const dgi = this.privDynamicGrammar.generateGrammarObject();\n this.setSection(\"dgi\", dgi);\n const ret = JSON.stringify(this.privContext);\n return ret;\n }\n}\n\n//# sourceMappingURL=SpeechContext.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { Contracts } from \"../../sdk/Contracts\";\nimport { PropertyId } from \"../../sdk/Exports\";\nimport { ConversationConnectionConfig } from \"./ConversationConnectionConfig\";\nimport { extractHeaderValue, request } from \"./ConversationUtils\";\nexport class ConversationManager {\n constructor() {\n //\n this.privRequestParams = ConversationConnectionConfig.configParams;\n this.privErrors = ConversationConnectionConfig.restErrors;\n this.privHost = ConversationConnectionConfig.host;\n this.privApiVersion = ConversationConnectionConfig.apiVersion;\n this.privRestPath = ConversationConnectionConfig.restPath;\n }\n /**\n * Make a POST request to the Conversation Manager service endpoint to create or join a conversation.\n * @param args\n * @param conversationCode\n * @param callback\n * @param errorCallback\n */\n createOrJoin(args, conversationCode, cb, err) {\n try {\n Contracts.throwIfNullOrUndefined(args, \"args\");\n const languageCode = args.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage, ConversationConnectionConfig.defaultLanguageCode);\n const nickname = args.getProperty(PropertyId.ConversationTranslator_Name);\n const endpointHost = args.getProperty(PropertyId.ConversationTranslator_Host, this.privHost);\n const correlationId = args.getProperty(PropertyId.ConversationTranslator_CorrelationId);\n const subscriptionKey = args.getProperty(PropertyId.SpeechServiceConnection_Key);\n const subscriptionRegion = args.getProperty(PropertyId.SpeechServiceConnection_Region);\n const authToken = args.getProperty(PropertyId.SpeechServiceAuthorization_Token);\n Contracts.throwIfNullOrWhitespace(languageCode, \"languageCode\");\n Contracts.throwIfNullOrWhitespace(nickname, \"nickname\");\n Contracts.throwIfNullOrWhitespace(endpointHost, \"endpointHost\");\n const queryParams = {};\n queryParams[this.privRequestParams.apiVersion] = this.privApiVersion;\n queryParams[this.privRequestParams.languageCode] = languageCode;\n queryParams[this.privRequestParams.nickname] = nickname;\n const headers = {};\n if (correlationId) {\n headers[this.privRequestParams.correlationId] = correlationId;\n }\n headers[this.privRequestParams.clientAppId] = ConversationConnectionConfig.clientAppId;\n if (conversationCode !== undefined) {\n queryParams[this.privRequestParams.roomId] = conversationCode;\n }\n else {\n Contracts.throwIfNullOrUndefined(subscriptionRegion, this.privErrors.authInvalidSubscriptionRegion);\n headers[this.privRequestParams.subscriptionRegion] = subscriptionRegion;\n if (subscriptionKey) {\n headers[this.privRequestParams.subscriptionKey] = subscriptionKey;\n }\n else if (authToken) {\n headers[this.privRequestParams.authorization] = `Bearer ${authToken}`;\n }\n else {\n Contracts.throwIfNullOrUndefined(subscriptionKey, this.privErrors.authInvalidSubscriptionKey);\n }\n }\n const config = {};\n config.headers = headers;\n const endpoint = `https://${endpointHost}${this.privRestPath}`;\n // TODO: support a proxy and certificate validation\n request(\"post\", endpoint, queryParams, null, config, (response) => {\n const requestId = extractHeaderValue(this.privRequestParams.requestId, response.headers);\n if (!response.ok) {\n if (!!err) {\n // get the error\n let errorMessage = this.privErrors.invalidCreateJoinConversationResponse.replace(\"{status}\", response.status.toString());\n let errMessageRaw;\n try {\n errMessageRaw = JSON.parse(response.data);\n errorMessage += ` [${errMessageRaw.error.code}: ${errMessageRaw.error.message}]`;\n }\n catch (e) {\n errorMessage += ` [${response.data}]`;\n }\n if (requestId) {\n errorMessage += ` ${requestId}`;\n }\n err(errorMessage);\n }\n return;\n }\n const conversation = JSON.parse(response.data);\n if (conversation) {\n conversation.requestId = requestId;\n }\n if (!!cb) {\n try {\n cb(conversation);\n }\n catch (e) {\n if (!!err) {\n err(e);\n }\n }\n cb = undefined;\n }\n });\n }\n catch (error) {\n if (!!err) {\n if (error instanceof Error) {\n const typedError = error;\n err(typedError.name + \": \" + typedError.message);\n }\n else {\n err(error);\n }\n }\n }\n }\n /**\n * Make a DELETE request to the Conversation Manager service endpoint to leave the conversation.\n * @param args\n * @param sessionToken\n * @param callback\n */\n leave(args, sessionToken) {\n return new Promise((resolve, reject) => {\n try {\n Contracts.throwIfNullOrUndefined(args, this.privErrors.invalidArgs.replace(\"{arg}\", \"config\"));\n Contracts.throwIfNullOrWhitespace(sessionToken, this.privErrors.invalidArgs.replace(\"{arg}\", \"token\"));\n const endpointHost = args.getProperty(PropertyId.ConversationTranslator_Host, this.privHost);\n const correlationId = args.getProperty(PropertyId.ConversationTranslator_CorrelationId);\n const queryParams = {};\n queryParams[this.privRequestParams.apiVersion] = this.privApiVersion;\n queryParams[this.privRequestParams.sessionToken] = sessionToken;\n const headers = {};\n if (correlationId) {\n headers[this.privRequestParams.correlationId] = correlationId;\n }\n const config = {};\n config.headers = headers;\n const endpoint = `https://${endpointHost}${this.privRestPath}`;\n // TODO: support a proxy and certificate validation\n request(\"delete\", endpoint, queryParams, null, config, (response) => {\n if (!response.ok) {\n // ignore errors on delete\n }\n resolve();\n });\n }\n catch (error) {\n if (error instanceof Error) {\n const typedError = error;\n reject(typedError.name + \": \" + typedError.message);\n }\n else {\n reject(error);\n }\n }\n });\n }\n}\n\n//# sourceMappingURL=ConversationManager.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { ProxyInfo, WebsocketConnection, } from \"../common.browser/Exports\";\nimport { PropertyId } from \"../sdk/Exports\";\nimport { ConnectionFactoryBase } from \"./ConnectionFactoryBase\";\nimport { WebsocketMessageFormatter } from \"./Exports\";\nimport { HeaderNames } from \"./HeaderNames\";\nimport { QueryParameterNames } from \"./QueryParameterNames\";\nexport class TranscriberConnectionFactory extends ConnectionFactoryBase {\n constructor() {\n super(...arguments);\n this.multiaudioRelativeUri = \"/speech/recognition/multiaudio\";\n this.create = (config, authInfo, connectionId) => {\n let endpoint = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint, undefined);\n const region = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Region, \"centralus\");\n const hostSuffix = (region && region.toLowerCase().startsWith(\"china\")) ? \".azure.cn\" : \".microsoft.com\";\n const hostDefault = \"wss://transcribe.\" + region + \".cts.speech\" + hostSuffix + this.multiaudioRelativeUri;\n const host = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Host, hostDefault);\n const queryParams = {};\n const endpointId = config.parameters.getProperty(PropertyId.SpeechServiceConnection_EndpointId, undefined);\n const language = config.parameters.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage, undefined);\n if (endpointId) {\n if (!endpoint || endpoint.search(QueryParameterNames.CustomSpeechDeploymentId) === -1) {\n queryParams[QueryParameterNames.CustomSpeechDeploymentId] = endpointId;\n }\n }\n else if (language) {\n if (!endpoint || endpoint.search(QueryParameterNames.Language) === -1) {\n queryParams[QueryParameterNames.Language] = language;\n }\n }\n this.setCommonUrlParams(config, queryParams, endpoint);\n if (!endpoint) {\n endpoint = host;\n }\n const headers = {};\n if (authInfo.token !== undefined && authInfo.token !== \"\") {\n headers[authInfo.headerName] = authInfo.token;\n }\n headers[HeaderNames.ConnectionId] = connectionId;\n config.parameters.setProperty(PropertyId.SpeechServiceConnection_Url, endpoint);\n const enableCompression = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\n return new WebsocketConnection(endpoint, queryParams, headers, new WebsocketMessageFormatter(), ProxyInfo.fromRecognizerConfig(config), enableCompression, connectionId);\n };\n }\n}\n\n//# sourceMappingURL=TranscriberConnectionFactory.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { Context, SpeechServiceConfig } from \"./Exports\";\nexport var SynthesisServiceType;\n(function (SynthesisServiceType) {\n SynthesisServiceType[SynthesisServiceType[\"Standard\"] = 0] = \"Standard\";\n SynthesisServiceType[SynthesisServiceType[\"Custom\"] = 1] = \"Custom\";\n})(SynthesisServiceType || (SynthesisServiceType = {}));\nexport class SynthesizerConfig {\n constructor(speechServiceConfig, parameters) {\n this.privSynthesisServiceType = SynthesisServiceType.Standard;\n this.privSpeechServiceConfig = speechServiceConfig ? speechServiceConfig : new SpeechServiceConfig(new Context(null));\n this.privParameters = parameters;\n }\n get parameters() {\n return this.privParameters;\n }\n get synthesisServiceType() {\n return this.privSynthesisServiceType;\n }\n set synthesisServiceType(value) {\n this.privSynthesisServiceType = value;\n }\n get SpeechServiceConfig() {\n return this.privSpeechServiceConfig;\n }\n}\n\n//# sourceMappingURL=SynthesizerConfig.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { ProxyInfo, WebsocketConnection, } from \"../common.browser/Exports\";\nimport { PropertyId } from \"../sdk/Exports\";\nimport { WebsocketMessageFormatter } from \"./Exports\";\nimport { HeaderNames } from \"./HeaderNames\";\nimport { QueryParameterNames } from \"./QueryParameterNames\";\nexport class SpeechSynthesisConnectionFactory {\n constructor() {\n this.synthesisUri = \"/cognitiveservices/websocket/v1\";\n this.create = (config, authInfo, connectionId) => {\n let endpoint = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint, undefined);\n const region = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Region, undefined);\n const hostSuffix = (region && region.toLowerCase().startsWith(\"china\")) ? \".azure.cn\" : \".microsoft.com\";\n const endpointId = config.parameters.getProperty(PropertyId.SpeechServiceConnection_EndpointId, undefined);\n const hostPrefix = (endpointId === undefined) ? \"tts\" : \"voice\";\n const host = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Host, \"wss://\" + region + \".\" + hostPrefix + \".speech\" + hostSuffix);\n const queryParams = {};\n if (!endpoint) {\n endpoint = host + this.synthesisUri;\n }\n const headers = {};\n if (authInfo.token !== undefined && authInfo.token !== \"\") {\n headers[authInfo.headerName] = authInfo.token;\n }\n headers[HeaderNames.ConnectionId] = connectionId;\n if (endpointId !== undefined) {\n headers[QueryParameterNames.CustomVoiceDeploymentId] = endpointId;\n }\n config.parameters.setProperty(PropertyId.SpeechServiceConnection_Url, endpoint);\n const enableCompression = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\n return new WebsocketConnection(endpoint, queryParams, headers, new WebsocketMessageFormatter(), ProxyInfo.fromParameters(config.parameters), enableCompression, connectionId);\n };\n }\n}\n\n//# sourceMappingURL=SpeechSynthesisConnectionFactory.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { SynthesisStatus } from \"../Exports\";\nexport class TranslationSynthesisEnd {\n constructor(json) {\n this.privSynthesisEnd = JSON.parse(json);\n this.privSynthesisEnd.SynthesisStatus = SynthesisStatus[this.privSynthesisEnd.SynthesisStatus];\n }\n static fromJSON(json) {\n return new TranslationSynthesisEnd(json);\n }\n get SynthesisStatus() {\n return this.privSynthesisEnd.SynthesisStatus;\n }\n get FailureReason() {\n return this.privSynthesisEnd.FailureReason;\n }\n}\n\n//# sourceMappingURL=TranslationSynthesisEnd.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { ConnectionMessage } from \"../../common/Exports\";\nexport class ConversationConnectionMessage extends ConnectionMessage {\n constructor(messageType, body, headers, id) {\n super(messageType, body, headers, id);\n const json = JSON.parse(this.textBody);\n if (json.type !== undefined) {\n this.privConversationMessageType = json.type;\n }\n }\n get conversationMessageType() {\n return this.privConversationMessageType;\n }\n}\n\n//# sourceMappingURL=ConversationConnectionMessage.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { Deferred, MessageType, RawWebsocketMessage, } from \"../../common/Exports\";\nimport { ConversationConnectionMessage } from \"./ConversationConnectionMessage\";\n/**\n * Based off WebsocketMessageFormatter. The messages for Conversation Translator have some variations from the Speech messages.\n */\nexport class ConversationWebsocketMessageFormatter {\n constructor() {\n /**\n * Format incoming messages: text (speech partial/final, IM) or binary (tts)\n */\n this.toConnectionMessage = (message) => {\n const deferral = new Deferred();\n try {\n if (message.messageType === MessageType.Text) {\n const incomingMessage = new ConversationConnectionMessage(message.messageType, message.textContent, {}, message.id);\n deferral.resolve(incomingMessage);\n }\n else if (message.messageType === MessageType.Binary) {\n deferral.resolve(new ConversationConnectionMessage(message.messageType, message.binaryContent, undefined, message.id));\n }\n }\n catch (e) {\n deferral.reject(`Error formatting the message. Error: ${e}`);\n }\n return deferral.promise;\n };\n /**\n * Format outgoing messages: text (commands or IM)\n */\n this.fromConnectionMessage = (message) => {\n const deferral = new Deferred();\n try {\n if (message.messageType === MessageType.Text) {\n const payload = `${message.textBody ? message.textBody : \"\"}`;\n deferral.resolve(new RawWebsocketMessage(MessageType.Text, payload, message.id));\n }\n }\n catch (e) {\n deferral.reject(`Error formatting the message. ${e}`);\n }\n return deferral.promise;\n };\n }\n}\n\n//# sourceMappingURL=ConversationWebsocketMessageFormatter.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { ProxyInfo, WebsocketConnection } from \"../../common.browser/Exports\";\nimport { createGuid } from \"../../common/Exports\";\nimport { Contracts } from \"../../sdk/Contracts\";\nimport { PropertyId } from \"../../sdk/Exports\";\nimport { ConnectionFactoryBase } from \"../ConnectionFactoryBase\";\nimport { ConversationConnectionConfig } from \"./ConversationConnectionConfig\";\nimport { ConversationWebsocketMessageFormatter } from \"./ConversationWebsocketMessageFormatter\";\n/**\n * Create a connection to the Conversation Translator websocket for sending instant messages and commands, and for receiving translated messages.\n * The conversation must already have been started or joined.\n */\nexport class ConversationConnectionFactory extends ConnectionFactoryBase {\n create(config, authInfo, connectionId) {\n const endpointHost = config.parameters.getProperty(PropertyId.ConversationTranslator_Host, ConversationConnectionConfig.host);\n const correlationId = config.parameters.getProperty(PropertyId.ConversationTranslator_CorrelationId, createGuid());\n const endpoint = `wss://${endpointHost}${ConversationConnectionConfig.webSocketPath}`;\n const token = config.parameters.getProperty(PropertyId.ConversationTranslator_Token, undefined);\n Contracts.throwIfNullOrUndefined(token, \"token\");\n const queryParams = {};\n queryParams[ConversationConnectionConfig.configParams.apiVersion] = ConversationConnectionConfig.apiVersion;\n queryParams[ConversationConnectionConfig.configParams.token] = token;\n queryParams[ConversationConnectionConfig.configParams.correlationId] = correlationId;\n const enableCompression = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\n return new WebsocketConnection(endpoint, queryParams, {}, new ConversationWebsocketMessageFormatter(), ProxyInfo.fromRecognizerConfig(config), enableCompression, connectionId);\n }\n}\n\n//# sourceMappingURL=ConversationConnectionFactory.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { createNoDashGuid, Deferred, } from \"../../common/Exports\";\n/**\n * Placeholder class for the Conversation Request Session. Based off RequestSession.\n * TODO: define what telemetry is required.\n */\nexport class ConversationRequestSession {\n constructor(sessionId) {\n this.privIsDisposed = false;\n this.privDetachables = new Array();\n this.onPreConnectionStart = (authFetchEventId, connectionId) => {\n this.privSessionId = connectionId;\n };\n this.onAuthCompleted = (isError, error) => {\n if (isError) {\n this.onComplete();\n }\n };\n this.onConnectionEstablishCompleted = (statusCode, reason) => {\n if (statusCode === 200) {\n return;\n }\n else if (statusCode === 403) {\n this.onComplete();\n }\n };\n this.onServiceTurnEndResponse = (continuousRecognition) => {\n if (!continuousRecognition) {\n this.onComplete();\n }\n else {\n this.privRequestId = createNoDashGuid();\n }\n };\n this.onComplete = () => {\n //\n };\n this.privSessionId = sessionId;\n this.privRequestId = createNoDashGuid();\n this.privRequestCompletionDeferral = new Deferred();\n }\n get sessionId() {\n return this.privSessionId;\n }\n get requestId() {\n return this.privRequestId;\n }\n get completionPromise() {\n return this.privRequestCompletionDeferral.promise;\n }\n dispose(error) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!this.privIsDisposed) {\n // we should have completed by now. If we did not its an unknown error.\n this.privIsDisposed = true;\n for (const detachable of this.privDetachables) {\n yield detachable.detach();\n }\n }\n });\n }\n}\n\n//# sourceMappingURL=ConversationRequestSession.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { SessionEventArgs } from \"../../sdk/Exports\";\nexport class MuteAllEventArgs extends SessionEventArgs {\n constructor(isMuted, sessionId) {\n super(sessionId);\n this.privIsMuted = isMuted;\n }\n get isMuted() {\n return this.privIsMuted;\n }\n}\n// tslint:disable-next-line: max-classes-per-file\nexport class LockRoomEventArgs extends SessionEventArgs {\n constructor(isLocked, sessionId) {\n super(sessionId);\n this.privIsLocked = isLocked;\n }\n get isMuted() {\n return this.privIsLocked;\n }\n}\n// tslint:disable-next-line: max-classes-per-file\nexport class ParticipantEventArgs extends SessionEventArgs {\n constructor(participant, sessionId) {\n super(sessionId);\n this.privParticipant = participant;\n }\n get participant() {\n return this.privParticipant;\n }\n}\n// tslint:disable-next-line: max-classes-per-file\nexport class ParticipantAttributeEventArgs extends SessionEventArgs {\n constructor(participantId, key, value, sessionId) {\n super(sessionId);\n this.privKey = key;\n this.privValue = value;\n this.privParticipantId = participantId;\n }\n get value() {\n return this.privValue;\n }\n get key() {\n return this.privKey;\n }\n get id() {\n return this.privParticipantId;\n }\n}\n// tslint:disable-next-line: max-classes-per-file\nexport class ParticipantsListEventArgs extends SessionEventArgs {\n constructor(conversationId, token, translateTo, profanityFilter, roomProfanityFilter, isRoomLocked, isMuteAll, participants, sessionId) {\n super(sessionId);\n this.privRoomId = conversationId;\n this.privSessionToken = token;\n this.privTranslateTo = translateTo;\n this.privProfanityFilter = profanityFilter;\n this.privRoomProfanityFilter = roomProfanityFilter;\n this.privIsRoomLocked = isRoomLocked;\n this.privIsRoomLocked = isMuteAll;\n this.privParticipants = participants;\n }\n get sessionToken() {\n return this.privSessionToken;\n }\n get conversationId() {\n return this.privRoomId;\n }\n get translateTo() {\n return this.privTranslateTo;\n }\n get profanityFilter() {\n return this.privProfanityFilter;\n }\n get roomProfanityFilter() {\n return this.privRoomProfanityFilter;\n }\n get isRoomLocked() {\n return this.privIsRoomLocked;\n }\n get isMuteAll() {\n return this.privIsMuteAll;\n }\n get participants() {\n return this.privParticipants;\n }\n}\n// tslint:disable-next-line: max-classes-per-file\nexport class ConversationReceivedTranslationEventArgs {\n constructor(command, payload, sessionId) {\n this.privPayload = payload;\n this.privCommand = command;\n this.privSessionId = sessionId;\n }\n get payload() {\n return this.privPayload;\n }\n get command() {\n return this.privCommand;\n }\n get sessionId() {\n return this.privSessionId;\n }\n}\n\n//# sourceMappingURL=ConversationTranslatorEventArgs.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nexport class CommandResponsePayload {\n constructor(json) {\n this.privCommandResponse = JSON.parse(json);\n }\n static fromJSON(json) {\n return new CommandResponsePayload(json);\n }\n get type() {\n return this.privCommandResponse.type;\n }\n get command() {\n return this.privCommandResponse.command;\n }\n get id() {\n return this.privCommandResponse.id;\n }\n get nickname() {\n return this.privCommandResponse.nickname;\n }\n get participantId() {\n return this.privCommandResponse.participantId;\n }\n get roomid() {\n return this.privCommandResponse.roomid;\n }\n get value() {\n return this.privCommandResponse.value;\n }\n}\n\n//# sourceMappingURL=CommandResponsePayload.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nexport class ParticipantsListPayloadResponse {\n constructor(json) {\n this.privParticipantsPayloadResponse = JSON.parse(json);\n }\n static fromJSON(json) {\n return new ParticipantsListPayloadResponse(json);\n }\n get roomid() {\n return this.privParticipantsPayloadResponse.roomid;\n }\n get id() {\n return this.privParticipantsPayloadResponse.id;\n }\n get command() {\n return this.privParticipantsPayloadResponse.command;\n }\n get participants() {\n return this.privParticipantsPayloadResponse.participants;\n }\n get token() {\n return this.privParticipantsPayloadResponse.token;\n }\n get translateTo() {\n return this.privParticipantsPayloadResponse.translateTo;\n }\n get profanityFilter() {\n return this.privParticipantsPayloadResponse.profanityFilter;\n }\n get roomProfanityFilter() {\n return this.privParticipantsPayloadResponse.roomProfanityFilter;\n }\n get roomLocked() {\n return this.privParticipantsPayloadResponse.roomLocked;\n }\n get muteAll() {\n return this.privParticipantsPayloadResponse.muteAll;\n }\n get type() {\n return this.privParticipantsPayloadResponse.type;\n }\n}\n// tslint:disable-next-line: max-classes-per-file\nexport class ParticipantPayloadResponse {\n constructor(json) {\n this.privParticipantPayloadResponse = JSON.parse(json);\n }\n static fromJSON(json) {\n return new ParticipantPayloadResponse(json);\n }\n get nickname() {\n return this.privParticipantPayloadResponse.nickname;\n }\n get locale() {\n return this.privParticipantPayloadResponse.locale;\n }\n get usetts() {\n return this.privParticipantPayloadResponse.usetts;\n }\n get ismuted() {\n return this.privParticipantPayloadResponse.ismuted;\n }\n get ishost() {\n return this.privParticipantPayloadResponse.ishost;\n }\n get participantId() {\n return this.privParticipantPayloadResponse.participantId;\n }\n get avatar() {\n return this.privParticipantPayloadResponse.avatar;\n }\n}\n\n//# sourceMappingURL=ParticipantResponsePayload.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nexport class SpeechResponsePayload {\n constructor(json) {\n this.privSpeechResponse = JSON.parse(json);\n }\n static fromJSON(json) {\n return new SpeechResponsePayload(json);\n }\n get recognition() {\n return this.privSpeechResponse.recognition;\n }\n get translations() {\n return this.privSpeechResponse.translations;\n }\n get id() {\n return this.privSpeechResponse.id;\n }\n get language() {\n return this.privSpeechResponse.language;\n }\n get nickname() {\n return this.privSpeechResponse.nickname;\n }\n get participantId() {\n return this.privSpeechResponse.participantId;\n }\n get roomid() {\n return this.privSpeechResponse.roomid;\n }\n get timestamp() {\n return this.privSpeechResponse.timestamp;\n }\n get type() {\n return this.privSpeechResponse.type;\n }\n get isFinal() {\n return this.privSpeechResponse.type === \"final\";\n }\n}\n// tslint:disable-next-line: max-classes-per-file\nexport class TextResponsePayload {\n constructor(json) {\n this.privTextResponse = JSON.parse(json);\n }\n static fromJSON(json) {\n return new TextResponsePayload(json);\n }\n get originalText() {\n return this.privTextResponse.originalText;\n }\n get translations() {\n return this.privTextResponse.translations;\n }\n get id() {\n return this.privTextResponse.id;\n }\n get language() {\n return this.privTextResponse.language;\n }\n get nickname() {\n return this.privTextResponse.nickname;\n }\n get participantId() {\n return this.privTextResponse.participantId;\n }\n get roomid() {\n return this.privTextResponse.roomid;\n }\n get timestamp() {\n return this.privTextResponse.timestamp;\n }\n get type() {\n return this.privTextResponse.type;\n }\n}\n\n//# sourceMappingURL=TranslationResponsePayload.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { ConnectionState, createNoDashGuid, Deferred, MessageType, } from \"../../common/Exports\";\nimport { CancellationErrorCode, CancellationReason, ConversationExpirationEventArgs, ConversationTranslationCanceledEventArgs, ConversationTranslationResult, Translations } from \"../../sdk/Exports\";\nimport { ServiceRecognizerBase } from \"../Exports\";\nimport { ConversationConnectionMessage } from \"./ConversationConnectionMessage\";\nimport { ConversationRequestSession } from \"./ConversationRequestSession\";\nimport { ConversationReceivedTranslationEventArgs, LockRoomEventArgs, MuteAllEventArgs, ParticipantAttributeEventArgs, ParticipantEventArgs, ParticipantsListEventArgs } from \"./ConversationTranslatorEventArgs\";\nimport { ConversationTranslatorCommandTypes, ConversationTranslatorMessageTypes } from \"./ConversationTranslatorInterfaces\";\nimport { CommandResponsePayload, ParticipantPayloadResponse, ParticipantsListPayloadResponse, SpeechResponsePayload, TextResponsePayload } from \"./ServiceMessages/Exports\";\n/***\n * The service adapter handles sending and receiving messages to the Conversation Translator websocket.\n */\nexport class ConversationServiceAdapter extends ServiceRecognizerBase {\n constructor(authentication, connectionFactory, audioSource, recognizerConfig, conversationServiceConnector) {\n super(authentication, connectionFactory, audioSource, recognizerConfig, conversationServiceConnector);\n this.privLastPartialUtteranceId = \"\";\n this.noOp = () => {\n // operation not supported\n };\n this.privConversationServiceConnector = conversationServiceConnector;\n this.privConversationAuthentication = authentication;\n this.receiveMessageOverride = this.receiveConversationMessageOverride;\n this.recognizeOverride = this.noOp;\n this.postConnectImplOverride = this.conversationConnectImpl;\n this.configConnectionOverride = this.configConnection;\n this.disconnectOverride = this.privDisconnect;\n this.privConversationRequestSession = new ConversationRequestSession(createNoDashGuid());\n this.privConversationConnectionFactory = connectionFactory;\n this.privConversationIsDisposed = false;\n }\n isDisposed() {\n return this.privConversationIsDisposed;\n }\n dispose(reason) {\n return __awaiter(this, void 0, void 0, function* () {\n this.privConversationIsDisposed = true;\n if (this.privConnectionConfigPromise) {\n const connection = yield this.privConnectionConfigPromise;\n yield connection.dispose(reason);\n }\n });\n }\n sendMessage(message) {\n return __awaiter(this, void 0, void 0, function* () {\n const connection = yield this.fetchConnection();\n return connection.send(new ConversationConnectionMessage(MessageType.Text, message));\n });\n }\n sendMessageAsync(message) {\n return __awaiter(this, void 0, void 0, function* () {\n const sink = new Deferred();\n const connection = yield this.fetchConnection();\n yield connection.send(new ConversationConnectionMessage(MessageType.Text, message));\n });\n }\n privDisconnect() {\n if (this.terminateMessageLoop) {\n return;\n }\n this.cancelRecognition(this.privConversationRequestSession.sessionId, this.privConversationRequestSession.requestId, CancellationReason.Error, CancellationErrorCode.NoError, \"Disconnecting\");\n this.terminateMessageLoop = true;\n return Promise.resolve();\n }\n processTypeSpecificMessages(connectionMessage, successCallback, errorCallBack) {\n return __awaiter(this, void 0, void 0, function* () {\n return true;\n });\n }\n // Cancels recognition.\n cancelRecognition(sessionId, requestId, cancellationReason, errorCode, error) {\n this.terminateMessageLoop = true;\n const cancelEvent = new ConversationTranslationCanceledEventArgs(cancellationReason, error, errorCode, undefined, sessionId);\n try {\n if (!!this.privConversationServiceConnector.canceled) {\n this.privConversationServiceConnector.canceled(this.privConversationServiceConnector, cancelEvent);\n }\n }\n catch (_a) {\n // continue on error\n }\n }\n /**\n * Establishes a websocket connection to the end point.\n * @param isUnAuthorized\n */\n conversationConnectImpl(connection) {\n return __awaiter(this, void 0, void 0, function* () {\n this.privConnectionLoop = this.startMessageLoop();\n return connection;\n });\n }\n /**\n * Process incoming websocket messages\n */\n receiveConversationMessageOverride() {\n // we won't rely on the cascading promises of the connection since we want to continually be available to receive messages\n const communicationCustodian = new Deferred();\n this.fetchConnection().then((connection) => __awaiter(this, void 0, void 0, function* () {\n const isDisposed = this.isDisposed();\n const terminateMessageLoop = (!this.isDisposed() && this.terminateMessageLoop);\n if (isDisposed || terminateMessageLoop) {\n // We're done.\n communicationCustodian.resolve();\n return Promise.resolve();\n }\n const message = yield connection.read();\n const sessionId = this.privConversationRequestSession.sessionId;\n let sendFinal = false;\n if (!message) {\n return this.receiveConversationMessageOverride();\n }\n try {\n switch (message.conversationMessageType.toLowerCase()) {\n case \"info\":\n case \"participant_command\":\n case \"command\":\n const commandPayload = CommandResponsePayload.fromJSON(message.textBody);\n switch (commandPayload.command.toLowerCase()) {\n /**\n * 'ParticpantList' is the first message sent to the user after the websocket connection has opened.\n * The consuming client must wait for this message to arrive\n * before starting to send their own data.\n */\n case \"participantlist\":\n const participantsPayload = ParticipantsListPayloadResponse.fromJSON(message.textBody);\n const participantsResult = participantsPayload.participants.map((p) => {\n const participant = {\n avatar: p.avatar,\n displayName: p.nickname,\n id: p.participantId,\n isHost: p.ishost,\n isMuted: p.ismuted,\n isUsingTts: p.usetts,\n preferredLanguage: p.locale\n };\n return participant;\n });\n if (!!this.privConversationServiceConnector.participantsListReceived) {\n this.privConversationServiceConnector.participantsListReceived(this.privConversationServiceConnector, new ParticipantsListEventArgs(participantsPayload.roomid, participantsPayload.token, participantsPayload.translateTo, participantsPayload.profanityFilter, participantsPayload.roomProfanityFilter, participantsPayload.roomLocked, participantsPayload.muteAll, participantsResult, sessionId));\n }\n break;\n /**\n * 'SetTranslateToLanguages' represents the list of languages being used in the Conversation by all users(?).\n * This is sent at the start of the Conversation\n */\n case \"settranslatetolanguages\":\n if (!!this.privConversationServiceConnector.participantUpdateCommandReceived) {\n this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector, new ParticipantAttributeEventArgs(commandPayload.participantId, ConversationTranslatorCommandTypes.setTranslateToLanguages, commandPayload.value, sessionId));\n }\n break;\n /**\n * 'SetProfanityFiltering' lets the client set the level of profanity filtering.\n * If sent by the participant the setting will effect only their own profanity level.\n * If sent by the host, the setting will effect all participants including the host.\n * Note: the profanity filters differ from Speech Service (?): 'marked', 'raw', 'removed', 'tagged'\n */\n case \"setprofanityfiltering\":\n if (!!this.privConversationServiceConnector.participantUpdateCommandReceived) {\n this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector, new ParticipantAttributeEventArgs(commandPayload.participantId, ConversationTranslatorCommandTypes.setProfanityFiltering, commandPayload.value, sessionId));\n }\n break;\n /**\n * 'SetMute' is sent if the participant has been muted by the host.\n * Check the 'participantId' to determine if the current user has been muted.\n */\n case \"setmute\":\n if (!!this.privConversationServiceConnector.participantUpdateCommandReceived) {\n this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector, new ParticipantAttributeEventArgs(commandPayload.participantId, ConversationTranslatorCommandTypes.setMute, commandPayload.value, sessionId));\n }\n break;\n /**\n * 'SetMuteAll' is sent if the Conversation has been muted by the host.\n */\n case \"setmuteall\":\n if (!!this.privConversationServiceConnector.muteAllCommandReceived) {\n this.privConversationServiceConnector.muteAllCommandReceived(this.privConversationServiceConnector, new MuteAllEventArgs(commandPayload.value, sessionId));\n }\n break;\n /**\n * 'RoomExpirationWarning' is sent towards the end of the Conversation session to give a timeout warning.\n */\n case \"roomexpirationwarning\":\n if (!!this.privConversationServiceConnector.conversationExpiration) {\n this.privConversationServiceConnector.conversationExpiration(this.privConversationServiceConnector, new ConversationExpirationEventArgs(commandPayload.value, this.privConversationRequestSession.sessionId));\n }\n break;\n /**\n * 'SetUseTts' is sent as a confirmation if the user requests TTS to be turned on or off.\n */\n case \"setusetts\":\n if (!!this.privConversationServiceConnector.participantUpdateCommandReceived) {\n this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector, new ParticipantAttributeEventArgs(commandPayload.participantId, ConversationTranslatorCommandTypes.setUseTTS, commandPayload.value, sessionId));\n }\n break;\n /**\n * 'SetLockState' is set if the host has locked or unlocked the Conversation.\n */\n case \"setlockstate\":\n if (!!this.privConversationServiceConnector.lockRoomCommandReceived) {\n this.privConversationServiceConnector.lockRoomCommandReceived(this.privConversationServiceConnector, new LockRoomEventArgs(commandPayload.value, sessionId));\n }\n break;\n /**\n * 'ChangeNickname' is received if a user changes their display name.\n * Any cached particpiants list should be updated to reflect the display name.\n */\n case \"changenickname\":\n if (!!this.privConversationServiceConnector.participantUpdateCommandReceived) {\n this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector, new ParticipantAttributeEventArgs(commandPayload.participantId, ConversationTranslatorCommandTypes.changeNickname, commandPayload.nickname, sessionId));\n }\n break;\n /**\n * 'JoinSession' is sent when a user joins the Conversation.\n */\n case \"joinsession\":\n const joinParticipantPayload = ParticipantPayloadResponse.fromJSON(message.textBody);\n const joiningParticipant = {\n avatar: joinParticipantPayload.avatar,\n displayName: joinParticipantPayload.nickname,\n id: joinParticipantPayload.participantId,\n isHost: joinParticipantPayload.ishost,\n isMuted: joinParticipantPayload.ismuted,\n isUsingTts: joinParticipantPayload.usetts,\n preferredLanguage: joinParticipantPayload.locale,\n };\n if (!!this.privConversationServiceConnector.participantJoinCommandReceived) {\n this.privConversationServiceConnector.participantJoinCommandReceived(this.privConversationServiceConnector, new ParticipantEventArgs(joiningParticipant, sessionId));\n }\n break;\n /**\n * 'LeaveSession' is sent when a user leaves the Conversation'.\n */\n case \"leavesession\":\n const leavingParticipant = {\n id: commandPayload.participantId\n };\n if (!!this.privConversationServiceConnector.participantLeaveCommandReceived) {\n this.privConversationServiceConnector.participantLeaveCommandReceived(this.privConversationServiceConnector, new ParticipantEventArgs(leavingParticipant, sessionId));\n }\n break;\n /**\n * 'DisconnectSession' is sent when a user is disconnected from the session (e.g. network problem).\n * Check the 'ParticipantId' to check whether the message is for the current user.\n */\n case \"disconnectsession\":\n const disconnectParticipant = {\n id: commandPayload.participantId\n };\n break;\n /**\n * Message not recognized.\n */\n default:\n break;\n }\n break;\n /**\n * 'partial' (or 'hypothesis') represents a unfinalized speech message.\n */\n case \"partial\":\n /**\n * 'final' (or 'phrase') represents a finalized speech message.\n */\n case \"final\":\n const speechPayload = SpeechResponsePayload.fromJSON(message.textBody);\n const speechResult = new ConversationTranslationResult(speechPayload.participantId, this.getTranslations(speechPayload.translations), speechPayload.language, undefined, undefined, speechPayload.recognition, undefined, undefined, message.textBody, undefined);\n if (speechPayload.isFinal) {\n // check the length, sometimes empty finals are returned\n if (speechResult.text !== undefined && speechResult.text.length > 0) {\n sendFinal = true;\n }\n else if (speechPayload.id === this.privLastPartialUtteranceId) {\n // send final as normal. We had a non-empty partial for this same utterance\n // so sending the empty final is important\n sendFinal = true;\n }\n else {\n // suppress unneeded final\n }\n if (sendFinal) {\n if (!!this.privConversationServiceConnector.translationReceived) {\n this.privConversationServiceConnector.translationReceived(this.privConversationServiceConnector, new ConversationReceivedTranslationEventArgs(ConversationTranslatorMessageTypes.final, speechResult, sessionId));\n }\n }\n }\n else if (speechResult.text !== undefined) {\n this.privLastPartialUtteranceId = speechPayload.id;\n if (!!this.privConversationServiceConnector.translationReceived) {\n this.privConversationServiceConnector.translationReceived(this.privConversationServiceConnector, new ConversationReceivedTranslationEventArgs(ConversationTranslatorMessageTypes.partial, speechResult, sessionId));\n }\n }\n break;\n /**\n * \"translated_message\" is a text message or instant message (IM).\n */\n case \"translated_message\":\n const textPayload = TextResponsePayload.fromJSON(message.textBody);\n const textResult = new ConversationTranslationResult(textPayload.participantId, this.getTranslations(textPayload.translations), textPayload.language, undefined, undefined, textPayload.originalText, undefined, undefined, undefined, message.textBody, undefined);\n if (!!this.privConversationServiceConnector.translationReceived) {\n this.privConversationServiceConnector.translationReceived(this.privConversationServiceConnector, new ConversationReceivedTranslationEventArgs(ConversationTranslatorMessageTypes.instantMessage, textResult, sessionId));\n }\n break;\n default:\n // ignore any unsupported message types\n break;\n }\n }\n catch (e) {\n // continue\n }\n return this.receiveConversationMessageOverride();\n }), (error) => {\n this.terminateMessageLoop = true;\n });\n return communicationCustodian.promise;\n }\n startMessageLoop() {\n return __awaiter(this, void 0, void 0, function* () {\n this.terminateMessageLoop = false;\n const messageRetrievalPromise = this.receiveConversationMessageOverride();\n try {\n const r = yield messageRetrievalPromise;\n return r;\n }\n catch (error) {\n this.cancelRecognition(this.privRequestSession ? this.privRequestSession.sessionId : \"\", this.privRequestSession ? this.privRequestSession.requestId : \"\", CancellationReason.Error, CancellationErrorCode.RuntimeError, error);\n return null;\n }\n });\n }\n // Takes an established websocket connection to the endpoint\n configConnection() {\n if (this.privConnectionConfigPromise) {\n return this.privConnectionConfigPromise.then((connection) => {\n if (connection.state() === ConnectionState.Disconnected) {\n this.privConnectionId = null;\n this.privConnectionConfigPromise = null;\n return this.configConnection();\n }\n return this.privConnectionConfigPromise;\n }, (error) => {\n this.privConnectionId = null;\n this.privConnectionConfigPromise = null;\n return this.configConnection();\n });\n }\n if (this.terminateMessageLoop) {\n return Promise.resolve(undefined);\n }\n this.privConnectionConfigPromise = this.connectImpl().then((connection) => {\n return connection;\n });\n return this.privConnectionConfigPromise;\n }\n getTranslations(serviceResultTranslations) {\n let translations;\n if (undefined !== serviceResultTranslations) {\n translations = new Translations();\n for (const translation of serviceResultTranslations) {\n translations.set(translation.lang, translation.translation);\n }\n }\n return translations;\n }\n}\n\n//# sourceMappingURL=ConversationServiceAdapter.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { RecognizerConfig } from \"../../common.speech/Exports\";\nimport { BackgroundEvent, Events } from \"../../common/Exports\";\nimport { Contracts } from \"../../sdk/Contracts\";\nimport { Connection, Recognizer } from \"../../sdk/Exports\";\nimport { ConversationConnectionFactory } from \"./ConversationConnectionFactory\";\nimport { ConversationServiceAdapter } from \"./ConversationServiceAdapter\";\nimport { PromiseToEmptyCallback } from \"./ConversationUtils\";\nexport class ConversationRecognizerFactory {\n static fromConfig(speechConfig, audioConfig) {\n return new ConversationTranslatorRecognizer(speechConfig, audioConfig);\n }\n}\n/**\n * Sends messages to the Conversation Translator websocket and listens for incoming events containing websocket messages.\n * Based off the recognizers in the SDK folder.\n */\n// tslint:disable-next-line:max-classes-per-file\nexport class ConversationTranslatorRecognizer extends Recognizer {\n constructor(speechConfig, audioConfig) {\n const serviceConfigImpl = speechConfig;\n Contracts.throwIfNull(serviceConfigImpl, \"speechConfig\");\n super(audioConfig, serviceConfigImpl.properties, new ConversationConnectionFactory());\n this.privIsDisposed = false;\n this.privProperties = serviceConfigImpl.properties.clone();\n this.privConnection = Connection.fromRecognizer(this);\n }\n set connected(cb) {\n this.privConnection.connected = cb;\n }\n set disconnected(cb) {\n this.privConnection.disconnected = cb;\n }\n /**\n * Return the speech language used by the recognizer\n */\n get speechRecognitionLanguage() {\n return this.privSpeechRecognitionLanguage;\n }\n /**\n * Return the properties for the recognizer\n */\n get properties() {\n return this.privProperties;\n }\n isDisposed() {\n return this.privIsDisposed;\n }\n /**\n * Connect to the recognizer\n * @param token\n */\n connect(token, cb, err) {\n try {\n Contracts.throwIfDisposed(this.privIsDisposed);\n Contracts.throwIfNullOrWhitespace(token, \"token\");\n this.privReco.conversationTranslatorToken = token;\n this.privReco.connectAsync(cb, err);\n }\n catch (error) {\n if (!!err) {\n if (error instanceof Error) {\n const typedError = error;\n err(typedError.name + \": \" + typedError.message);\n }\n else {\n err(error);\n }\n }\n }\n }\n /**\n * Disconnect from the recognizer\n */\n disconnect(cb, err) {\n try {\n Contracts.throwIfDisposed(this.privIsDisposed);\n this.privReco.disconnect().then(() => {\n if (!!cb) {\n cb();\n }\n }, (error) => {\n if (!!err) {\n err(error);\n }\n });\n }\n catch (error) {\n if (!!err) {\n if (error instanceof Error) {\n const typedError = error;\n err(typedError.name + \": \" + typedError.message);\n }\n else {\n err(error);\n }\n }\n // Destroy the recognizer.\n this.dispose(true).catch((reason) => {\n Events.instance.onEvent(new BackgroundEvent(reason));\n });\n }\n }\n /**\n * Send the mute all participants command to the websocket\n * @param conversationId\n * @param participantId\n * @param isMuted\n */\n sendRequest(command, cb, err) {\n try {\n Contracts.throwIfDisposed(this.privIsDisposed);\n this.sendMessage(command, cb, err);\n }\n catch (error) {\n if (!!err) {\n if (error instanceof Error) {\n const typedError = error;\n err(typedError.name + \": \" + typedError.message);\n }\n else {\n err(error);\n }\n }\n // Destroy the recognizer.\n this.dispose(true).catch((reason) => {\n Events.instance.onEvent(new BackgroundEvent(reason));\n });\n }\n }\n /**\n * Close and dispose the recognizer\n */\n close() {\n var _a, _b;\n return __awaiter(this, void 0, void 0, function* () {\n Contracts.throwIfDisposed(this.privIsDisposed);\n (_a = this.privConnection) === null || _a === void 0 ? void 0 : _a.closeConnection();\n (_b = this.privConnection) === null || _b === void 0 ? void 0 : _b.close();\n this.privConnection = undefined;\n yield this.dispose(true);\n });\n }\n /**\n * Dispose the recognizer\n * @param disposing\n */\n dispose(disposing) {\n const _super = Object.create(null, {\n dispose: { get: () => super.dispose }\n });\n return __awaiter(this, void 0, void 0, function* () {\n if (this.privIsDisposed) {\n return;\n }\n if (disposing) {\n this.privIsDisposed = true;\n if (!!this.privConnection) {\n this.privConnection.closeConnection();\n this.privConnection.close();\n this.privConnection = undefined;\n }\n yield _super.dispose.call(this, disposing);\n }\n });\n }\n /**\n * Create the config for the recognizer\n * @param speechConfig\n */\n createRecognizerConfig(speechConfig) {\n return new RecognizerConfig(speechConfig, this.privProperties);\n }\n /**\n * Create the service recognizer.\n * The audio source is redundnant here but is required by the implementation.\n * @param authentication\n * @param connectionFactory\n * @param audioConfig\n * @param recognizerConfig\n */\n createServiceRecognizer(authentication, connectionFactory, audioConfig, recognizerConfig) {\n const audioSource = audioConfig;\n return new ConversationServiceAdapter(authentication, connectionFactory, audioSource, recognizerConfig, this);\n }\n sendMessage(msg, cb, err) {\n const withAsync = this.privReco;\n PromiseToEmptyCallback(withAsync.sendMessageAsync(msg), cb, err);\n }\n}\n\n//# sourceMappingURL=ConversationTranslatorRecognizer.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { MessageType } from \"../common/Exports\";\nimport { CancellationErrorCode, ConversationTranscriptionCanceledEventArgs, OutputFormat, PropertyCollection, PropertyId, ResultReason, SpeechRecognitionEventArgs, SpeechRecognitionResult, } from \"../sdk/Exports\";\nimport { CancellationErrorCodePropertyName, DetailedSpeechPhrase, EnumTranslation, OutputFormatPropertyName, RecognitionStatus, ServiceRecognizerBase, SimpleSpeechPhrase, SpeechHypothesis } from \"./Exports\";\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal\";\n// tslint:disable-next-line:max-classes-per-file\nexport class TranscriptionServiceRecognizer extends ServiceRecognizerBase {\n constructor(authentication, connectionFactory, audioSource, recognizerConfig, transcriber) {\n super(authentication, connectionFactory, audioSource, recognizerConfig, transcriber);\n this.sendSpeechEvent = (connection, payload) => {\n const speechEventJson = JSON.stringify(payload);\n if (speechEventJson) {\n return connection.send(new SpeechConnectionMessage(MessageType.Text, \"speech.event\", this.privRequestSession.requestId, \"application/json\", speechEventJson));\n }\n return;\n };\n this.privTranscriberRecognizer = transcriber;\n this.sendPrePayloadJSONOverride = this.sendTranscriptionStartJSON;\n }\n sendSpeechEventAsync(info, command) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!!this.privRequestSession.isRecognizing) {\n const connection = yield this.fetchConnection();\n yield this.sendSpeechEvent(connection, this.createSpeechEventPayload(info, command));\n }\n });\n }\n processTypeSpecificMessages(connectionMessage) {\n return __awaiter(this, void 0, void 0, function* () {\n let result;\n const resultProps = new PropertyCollection();\n resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, connectionMessage.textBody);\n let processed = false;\n switch (connectionMessage.path.toLowerCase()) {\n case \"speech.hypothesis\":\n case \"speech.fragment\":\n const hypothesis = SpeechHypothesis.fromJSON(connectionMessage.textBody);\n const offset = hypothesis.Offset + this.privRequestSession.currentTurnAudioOffset;\n result = new SpeechRecognitionResult(this.privRequestSession.requestId, ResultReason.RecognizingSpeech, hypothesis.Text, hypothesis.Duration, offset, hypothesis.Language, hypothesis.LanguageDetectionConfidence, hypothesis.SpeakerId, undefined, connectionMessage.textBody, resultProps);\n this.privRequestSession.onHypothesis(offset);\n const ev = new SpeechRecognitionEventArgs(result, hypothesis.Duration, this.privRequestSession.sessionId);\n if (!!this.privTranscriberRecognizer.recognizing) {\n try {\n this.privTranscriberRecognizer.recognizing(this.privTranscriberRecognizer, ev);\n /* tslint:disable:no-empty */\n }\n catch (error) {\n // Not going to let errors in the event handler\n // trip things up.\n }\n }\n processed = true;\n break;\n case \"speech.phrase\":\n const simple = SimpleSpeechPhrase.fromJSON(connectionMessage.textBody);\n const resultReason = EnumTranslation.implTranslateRecognitionResult(simple.RecognitionStatus);\n this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset + simple.Offset + simple.Duration);\n if (ResultReason.Canceled === resultReason) {\n const cancelReason = EnumTranslation.implTranslateCancelResult(simple.RecognitionStatus);\n yield this.cancelRecognitionLocal(cancelReason, EnumTranslation.implTranslateCancelErrorCode(simple.RecognitionStatus), undefined);\n }\n else {\n if (!(this.privRequestSession.isSpeechEnded && resultReason === ResultReason.NoMatch && simple.RecognitionStatus !== RecognitionStatus.InitialSilenceTimeout)) {\n if (this.privRecognizerConfig.parameters.getProperty(OutputFormatPropertyName) === OutputFormat[OutputFormat.Simple]) {\n result = new SpeechRecognitionResult(this.privRequestSession.requestId, resultReason, simple.DisplayText, simple.Duration, simple.Offset + this.privRequestSession.currentTurnAudioOffset, simple.Language, simple.LanguageDetectionConfidence, simple.SpeakerId, undefined, connectionMessage.textBody, resultProps);\n }\n else {\n const detailed = DetailedSpeechPhrase.fromJSON(connectionMessage.textBody);\n result = new SpeechRecognitionResult(this.privRequestSession.requestId, resultReason, detailed.RecognitionStatus === RecognitionStatus.Success ? detailed.NBest[0].Display : undefined, detailed.Duration, detailed.Offset + this.privRequestSession.currentTurnAudioOffset, detailed.Language, detailed.LanguageDetectionConfidence, undefined, undefined, connectionMessage.textBody, resultProps);\n }\n const event = new SpeechRecognitionEventArgs(result, result.offset, this.privRequestSession.sessionId);\n if (!!this.privTranscriberRecognizer.recognized) {\n try {\n this.privTranscriberRecognizer.recognized(this.privTranscriberRecognizer, event);\n /* tslint:disable:no-empty */\n }\n catch (error) {\n // Not going to let errors in the event handler\n // trip things up.\n }\n }\n }\n if (!!this.privSuccessCallback) {\n try {\n this.privSuccessCallback(result);\n }\n catch (e) {\n if (!!this.privErrorCallback) {\n this.privErrorCallback(e);\n }\n }\n // Only invoke the call back once.\n // and if it's successful don't invoke the\n // error after that.\n this.privSuccessCallback = undefined;\n this.privErrorCallback = undefined;\n }\n }\n processed = true;\n break;\n default:\n break;\n }\n return processed;\n });\n }\n // Cancels recognition.\n cancelRecognition(sessionId, requestId, cancellationReason, errorCode, error) {\n const properties = new PropertyCollection();\n properties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[errorCode]);\n if (!!this.privTranscriberRecognizer.canceled) {\n const cancelEvent = new ConversationTranscriptionCanceledEventArgs(cancellationReason, error, errorCode, undefined, sessionId);\n try {\n this.privTranscriberRecognizer.canceled(this.privTranscriberRecognizer, cancelEvent);\n /* tslint:disable:no-empty */\n }\n catch (_a) { }\n }\n if (!!this.privSuccessCallback) {\n const result = new SpeechRecognitionResult(requestId, ResultReason.Canceled, undefined, // Text\n undefined, // Duration\n undefined, // Offset\n undefined, // Language\n undefined, // Language Detection Confidence\n undefined, // Speaker Id\n error, undefined, // Json\n properties);\n try {\n this.privSuccessCallback(result);\n this.privSuccessCallback = undefined;\n /* tslint:disable:no-empty */\n }\n catch (_b) { }\n }\n }\n // Encapsulated for derived service recognizers that need to send additional JSON\n sendTranscriptionStartJSON(connection) {\n return __awaiter(this, void 0, void 0, function* () {\n yield this.sendSpeechContext(connection);\n const info = this.privTranscriberRecognizer.getConversationInfo();\n const payload = this.createSpeechEventPayload(info, \"start\");\n yield this.sendSpeechEvent(connection, payload);\n yield this.sendWaveHeader(connection);\n return;\n });\n }\n createSpeechEventPayload(info, command) {\n const meeting = \"meeting\";\n const eventDict = { id: meeting, name: command, meeting: info.conversationProperties };\n const idString = \"id\";\n const attendees = \"attendees\";\n const record = \"record\";\n eventDict[meeting][idString] = info.id;\n eventDict[meeting][attendees] = info.participants;\n eventDict[meeting][record] = info.conversationProperties.audiorecording === \"on\" ? \"true\" : \"false\";\n return eventDict;\n }\n}\n\n//# sourceMappingURL=TranscriptionServiceRecognizer.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nexport class SpeechHypothesis {\n constructor(json) {\n this.privSpeechHypothesis = JSON.parse(json);\n }\n static fromJSON(json) {\n return new SpeechHypothesis(json);\n }\n get Text() {\n return this.privSpeechHypothesis.Text;\n }\n get Offset() {\n return this.privSpeechHypothesis.Offset;\n }\n get Duration() {\n return this.privSpeechHypothesis.Duration;\n }\n get Language() {\n return this.privSpeechHypothesis.PrimaryLanguage === undefined ? undefined : this.privSpeechHypothesis.PrimaryLanguage.Language;\n }\n get LanguageDetectionConfidence() {\n return this.privSpeechHypothesis.PrimaryLanguage === undefined ? undefined : this.privSpeechHypothesis.PrimaryLanguage.Confidence;\n }\n get SpeakerId() {\n return this.privSpeechHypothesis.SpeakerId;\n }\n}\n\n//# sourceMappingURL=SpeechHypothesis.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { marshalPromiseToCallbacks } from \"../../common/Exports\";\nimport { Contracts } from \"../../sdk/Contracts\";\nimport { PropertyId, Recognizer, } from \"../../sdk/Exports\";\nimport { RecognitionMode, RecognizerConfig, TranscriberConnectionFactory, TranscriptionServiceRecognizer, } from \"../Exports\";\nexport class TranscriberRecognizer extends Recognizer {\n /**\n * TranscriberRecognizer constructor.\n * @constructor\n * @param {AudioConfig} audioConfig - An optional audio configuration associated with the recognizer\n */\n constructor(speechTranslationConfig, audioConfig) {\n const speechTranslationConfigImpl = speechTranslationConfig;\n Contracts.throwIfNull(speechTranslationConfigImpl, \"speechTranslationConfig\");\n Contracts.throwIfNullOrWhitespace(speechTranslationConfigImpl.speechRecognitionLanguage, PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage]);\n super(audioConfig, speechTranslationConfigImpl.properties, new TranscriberConnectionFactory());\n this.privDisposedRecognizer = false;\n }\n getConversationInfo() {\n Contracts.throwIfNullOrUndefined(this.privConversation, \"Conversation\");\n return this.privConversation.conversationInfo;\n }\n get authorizationToken() {\n return this.properties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\n }\n set authorizationToken(token) {\n Contracts.throwIfNullOrWhitespace(token, \"token\");\n this.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, token);\n }\n set conversation(c) {\n Contracts.throwIfNullOrUndefined(c, \"Conversation\");\n this.privConversation = c;\n }\n get speechRecognitionLanguage() {\n Contracts.throwIfDisposed(this.privDisposedRecognizer);\n return this.properties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage);\n }\n get properties() {\n return this.privProperties;\n }\n startContinuousRecognitionAsync(cb, err) {\n marshalPromiseToCallbacks(this.startContinuousRecognitionAsyncImpl(RecognitionMode.Conversation), cb, err);\n }\n stopContinuousRecognitionAsync(cb, err) {\n marshalPromiseToCallbacks(this.stopContinuousRecognitionAsyncImpl(), cb, err);\n }\n close() {\n return __awaiter(this, void 0, void 0, function* () {\n Contracts.throwIfDisposed(this.privDisposedRecognizer);\n yield this.dispose(true);\n });\n }\n // Push async join/leave conversation message via serviceRecognizer\n pushConversationEvent(conversationInfo, command) {\n return __awaiter(this, void 0, void 0, function* () {\n const reco = (this.privReco);\n Contracts.throwIfNullOrUndefined(reco, \"serviceRecognizer\");\n yield reco.sendSpeechEventAsync(conversationInfo, command);\n });\n }\n connectCallbacks(transcriber) {\n this.canceled = (s, e) => {\n if (!!transcriber.canceled) {\n transcriber.canceled(transcriber, e);\n }\n };\n this.recognizing = (s, e) => {\n if (!!transcriber.transcribing) {\n transcriber.transcribing(transcriber, e);\n }\n };\n this.recognized = (s, e) => {\n if (!!transcriber.transcribed) {\n transcriber.transcribed(transcriber, e);\n }\n };\n this.sessionStarted = (s, e) => {\n if (!!transcriber.sessionStarted) {\n transcriber.sessionStarted(transcriber, e);\n }\n };\n this.sessionStopped = (s, e) => {\n if (!!transcriber.sessionStopped) {\n transcriber.sessionStopped(transcriber, e);\n }\n };\n }\n disconnectCallbacks() {\n this.canceled = undefined;\n this.recognizing = undefined;\n this.recognized = undefined;\n this.sessionStarted = undefined;\n this.sessionStopped = undefined;\n }\n /**\n * Disposes any resources held by the object.\n * @member ConversationTranscriber.prototype.dispose\n * @function\n * @public\n * @param {boolean} disposing - true if disposing the object.\n */\n dispose(disposing) {\n const _super = Object.create(null, {\n dispose: { get: () => super.dispose }\n });\n return __awaiter(this, void 0, void 0, function* () {\n if (this.privDisposedRecognizer) {\n return;\n }\n if (disposing) {\n this.privDisposedRecognizer = true;\n yield this.implRecognizerStop();\n }\n yield _super.dispose.call(this, disposing);\n });\n }\n createRecognizerConfig(speechConfig) {\n return new RecognizerConfig(speechConfig, this.properties);\n }\n createServiceRecognizer(authentication, connectionFactory, audioConfig, recognizerConfig) {\n const configImpl = audioConfig;\n return new TranscriptionServiceRecognizer(authentication, connectionFactory, configImpl, recognizerConfig, this);\n }\n}\n\n//# sourceMappingURL=TranscriberRecognizer.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n// response\nexport class ActivityPayloadResponse {\n constructor(json) {\n this.privActivityResponse = JSON.parse(json);\n }\n static fromJSON(json) {\n return new ActivityPayloadResponse(json);\n }\n get conversationId() {\n return this.privActivityResponse.conversationId;\n }\n get messageDataStreamType() {\n return this.privActivityResponse.messageDataStreamType;\n }\n get messagePayload() {\n return this.privActivityResponse.messagePayload;\n }\n get version() {\n return this.privActivityResponse.version;\n }\n}\nexport var MessageDataStreamType;\n(function (MessageDataStreamType) {\n MessageDataStreamType[MessageDataStreamType[\"None\"] = 0] = \"None\";\n MessageDataStreamType[MessageDataStreamType[\"TextToSpeechAudio\"] = 1] = \"TextToSpeechAudio\";\n})(MessageDataStreamType || (MessageDataStreamType = {}));\n\n//# sourceMappingURL=ActivityResponsePayload.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { ProxyInfo, WebsocketConnection, } from \"../common.browser/Exports\";\nimport { PropertyId } from \"../sdk/Exports\";\nimport { ConnectionFactoryBase } from \"./ConnectionFactoryBase\";\nimport { WebsocketMessageFormatter, } from \"./Exports\";\nimport { HeaderNames } from \"./HeaderNames\";\nimport { QueryParameterNames } from \"./QueryParameterNames\";\nexport class TranslationConnectionFactory extends ConnectionFactoryBase {\n constructor() {\n super(...arguments);\n this.create = (config, authInfo, connectionId) => {\n let endpoint = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint, undefined);\n if (!endpoint) {\n const region = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Region, undefined);\n const hostSuffix = (region && region.toLowerCase().startsWith(\"china\")) ? \".azure.cn\" : \".microsoft.com\";\n const host = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Host, \"wss://\" + region + \".s2s.speech\" + hostSuffix);\n endpoint = host + \"/speech/translation/cognitiveservices/v1\";\n }\n const queryParams = {\n from: config.parameters.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage),\n to: config.parameters.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages),\n };\n this.setCommonUrlParams(config, queryParams, endpoint);\n this.setUrlParameter(PropertyId.SpeechServiceResponse_TranslationRequestStablePartialResult, QueryParameterNames.StableTranslation, config, queryParams, endpoint);\n const voiceName = \"voice\";\n const featureName = \"features\";\n if (config.parameters.getProperty(PropertyId.SpeechServiceConnection_TranslationVoice, undefined) !== undefined) {\n queryParams[voiceName] = config.parameters.getProperty(PropertyId.SpeechServiceConnection_TranslationVoice);\n queryParams[featureName] = \"texttospeech\";\n }\n const headers = {};\n if (authInfo.token !== undefined && authInfo.token !== \"\") {\n headers[authInfo.headerName] = authInfo.token;\n }\n headers[HeaderNames.ConnectionId] = connectionId;\n config.parameters.setProperty(PropertyId.SpeechServiceConnection_Url, endpoint);\n const enableCompression = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\n return new WebsocketConnection(endpoint, queryParams, headers, new WebsocketMessageFormatter(), ProxyInfo.fromRecognizerConfig(config), enableCompression, connectionId);\n };\n }\n}\n\n//# sourceMappingURL=TranslationConnectionFactory.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { ProxyInfo, WebsocketConnection, } from \"../common.browser/Exports\";\nimport { ForceDictationPropertyName, OutputFormatPropertyName, } from \"../common.speech/Exports\";\nimport { OutputFormat, PropertyId } from \"../sdk/Exports\";\nimport { ConnectionFactoryBase } from \"./ConnectionFactoryBase\";\nimport { RecognitionMode, WebsocketMessageFormatter } from \"./Exports\";\nimport { HeaderNames } from \"./HeaderNames\";\nimport { QueryParameterNames } from \"./QueryParameterNames\";\nexport class SpeechConnectionFactory extends ConnectionFactoryBase {\n constructor() {\n super(...arguments);\n this.interactiveRelativeUri = \"/speech/recognition/interactive/cognitiveservices/v1\";\n this.conversationRelativeUri = \"/speech/recognition/conversation/cognitiveservices/v1\";\n this.dictationRelativeUri = \"/speech/recognition/dictation/cognitiveservices/v1\";\n this.create = (config, authInfo, connectionId) => {\n let endpoint = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint, undefined);\n const region = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Region, undefined);\n const hostSuffix = (region && region.toLowerCase().startsWith(\"china\")) ? \".azure.cn\" : \".microsoft.com\";\n const host = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Host, \"wss://\" + region + \".stt.speech\" + hostSuffix);\n const queryParams = {};\n const endpointId = config.parameters.getProperty(PropertyId.SpeechServiceConnection_EndpointId, undefined);\n const language = config.parameters.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage, undefined);\n if (endpointId) {\n if (!endpoint || endpoint.search(QueryParameterNames.CustomSpeechDeploymentId) === -1) {\n queryParams[QueryParameterNames.CustomSpeechDeploymentId] = endpointId;\n }\n }\n else if (language) {\n if (!endpoint || endpoint.search(QueryParameterNames.Language) === -1) {\n queryParams[QueryParameterNames.Language] = language;\n }\n }\n if (!endpoint || endpoint.search(QueryParameterNames.Format) === -1) {\n queryParams[QueryParameterNames.Format] = config.parameters.getProperty(OutputFormatPropertyName, OutputFormat[OutputFormat.Simple]).toLowerCase();\n }\n if (config.autoDetectSourceLanguages !== undefined) {\n queryParams[QueryParameterNames.EnableLanguageId] = \"true\";\n }\n this.setCommonUrlParams(config, queryParams, endpoint);\n if (!endpoint) {\n switch (config.recognitionMode) {\n case RecognitionMode.Conversation:\n if (config.parameters.getProperty(ForceDictationPropertyName, \"false\") === \"true\") {\n endpoint = host + this.dictationRelativeUri;\n }\n else {\n endpoint = host + this.conversationRelativeUri;\n }\n break;\n case RecognitionMode.Dictation:\n endpoint = host + this.dictationRelativeUri;\n break;\n default:\n endpoint = host + this.interactiveRelativeUri; // default is interactive\n break;\n }\n }\n const headers = {};\n if (authInfo.token !== undefined && authInfo.token !== \"\") {\n headers[authInfo.headerName] = authInfo.token;\n }\n headers[HeaderNames.ConnectionId] = connectionId;\n config.parameters.setProperty(PropertyId.SpeechServiceConnection_Url, endpoint);\n const enableCompression = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\n return new WebsocketConnection(endpoint, queryParams, headers, new WebsocketMessageFormatter(), ProxyInfo.fromRecognizerConfig(config), enableCompression, connectionId);\n };\n }\n}\n\n//# sourceMappingURL=SpeechConnectionFactory.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { ConnectionMessage, Deferred, MessageType, RawWebsocketMessage, } from \"../common/Exports\";\nconst CRLF = \"\\r\\n\";\nexport class WebsocketMessageFormatter {\n constructor() {\n this.toConnectionMessage = (message) => {\n const deferral = new Deferred();\n try {\n if (message.messageType === MessageType.Text) {\n const textMessage = message.textContent;\n let headers = {};\n let body = null;\n if (textMessage) {\n const headerBodySplit = textMessage.split(\"\\r\\n\\r\\n\");\n if (headerBodySplit && headerBodySplit.length > 0) {\n headers = this.parseHeaders(headerBodySplit[0]);\n if (headerBodySplit.length > 1) {\n body = headerBodySplit[1];\n }\n }\n }\n deferral.resolve(new ConnectionMessage(message.messageType, body, headers, message.id));\n }\n else if (message.messageType === MessageType.Binary) {\n const binaryMessage = message.binaryContent;\n let headers = {};\n let body = null;\n if (!binaryMessage || binaryMessage.byteLength < 2) {\n throw new Error(\"Invalid binary message format. Header length missing.\");\n }\n const dataView = new DataView(binaryMessage);\n const headerLength = dataView.getInt16(0);\n if (binaryMessage.byteLength < headerLength + 2) {\n throw new Error(\"Invalid binary message format. Header content missing.\");\n }\n let headersString = \"\";\n for (let i = 0; i < headerLength; i++) {\n headersString += String.fromCharCode((dataView).getInt8(i + 2));\n }\n headers = this.parseHeaders(headersString);\n if (binaryMessage.byteLength > headerLength + 2) {\n body = binaryMessage.slice(2 + headerLength);\n }\n deferral.resolve(new ConnectionMessage(message.messageType, body, headers, message.id));\n }\n }\n catch (e) {\n deferral.reject(`Error formatting the message. Error: ${e}`);\n }\n return deferral.promise;\n };\n this.fromConnectionMessage = (message) => {\n const deferral = new Deferred();\n try {\n if (message.messageType === MessageType.Text) {\n const payload = `${this.makeHeaders(message)}${CRLF}${message.textBody ? message.textBody : \"\"}`;\n deferral.resolve(new RawWebsocketMessage(MessageType.Text, payload, message.id));\n }\n else if (message.messageType === MessageType.Binary) {\n const headersString = this.makeHeaders(message);\n const content = message.binaryBody;\n const headerBuffer = this.stringToArrayBuffer(headersString);\n const headerInt8Array = new Int8Array(headerBuffer);\n const headerLength = headerInt8Array.byteLength;\n const payloadInt8Array = new Int8Array(2 + headerLength + (content ? content.byteLength : 0));\n payloadInt8Array[0] = ((headerLength >> 8) & 0xff);\n payloadInt8Array[1] = headerLength & 0xff;\n payloadInt8Array.set(headerInt8Array, 2);\n if (content) {\n const bodyInt8Array = new Int8Array(content);\n payloadInt8Array.set(bodyInt8Array, 2 + headerLength);\n }\n const payload = payloadInt8Array.buffer;\n deferral.resolve(new RawWebsocketMessage(MessageType.Binary, payload, message.id));\n }\n }\n catch (e) {\n deferral.reject(`Error formatting the message. ${e}`);\n }\n return deferral.promise;\n };\n this.makeHeaders = (message) => {\n let headersString = \"\";\n if (message.headers) {\n for (const header in message.headers) {\n if (header) {\n headersString += `${header}: ${message.headers[header]}${CRLF}`;\n }\n }\n }\n return headersString;\n };\n this.parseHeaders = (headersString) => {\n const headers = {};\n if (headersString) {\n const headerMatches = headersString.match(/[^\\r\\n]+/g);\n if (headers) {\n for (const header of headerMatches) {\n if (header) {\n const separatorIndex = header.indexOf(\":\");\n const headerName = separatorIndex > 0 ? header.substr(0, separatorIndex).trim().toLowerCase() : header;\n const headerValue = separatorIndex > 0 && header.length > (separatorIndex + 1) ?\n header.substr(separatorIndex + 1).trim() :\n \"\";\n headers[headerName] = headerValue;\n }\n }\n }\n }\n return headers;\n };\n this.stringToArrayBuffer = (str) => {\n const buffer = new ArrayBuffer(str.length);\n const view = new DataView(buffer);\n for (let i = 0; i < str.length; i++) {\n view.setUint8(i, str.charCodeAt(i));\n }\n return buffer;\n };\n }\n}\n\n//# sourceMappingURL=WebsocketMessageFormatter.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { ArgumentNullError, ConnectionMessage } from \"../common/Exports\";\nimport { HeaderNames } from \"./HeaderNames\";\nexport class SpeechConnectionMessage extends ConnectionMessage {\n constructor(messageType, path, requestId, contentType, body, streamId, additionalHeaders, id) {\n if (!path) {\n throw new ArgumentNullError(\"path\");\n }\n if (!requestId) {\n throw new ArgumentNullError(\"requestId\");\n }\n const headers = {};\n headers[HeaderNames.Path] = path;\n headers[HeaderNames.RequestId] = requestId;\n headers[HeaderNames.RequestTimestamp] = new Date().toISOString();\n if (contentType) {\n headers[HeaderNames.ContentType] = contentType;\n }\n if (streamId) {\n headers[HeaderNames.RequestStreamId] = streamId;\n }\n if (additionalHeaders) {\n for (const headerName in additionalHeaders) {\n if (headerName) {\n headers[headerName] = additionalHeaders[headerName];\n }\n }\n }\n if (id) {\n super(messageType, body, headers, id);\n }\n else {\n super(messageType, body, headers);\n }\n this.privPath = path;\n this.privRequestId = requestId;\n this.privContentType = contentType;\n this.privStreamId = streamId;\n this.privAdditionalHeaders = additionalHeaders;\n }\n get path() {\n return this.privPath;\n }\n get requestId() {\n return this.privRequestId;\n }\n get contentType() {\n return this.privContentType;\n }\n get streamId() {\n return this.privStreamId;\n }\n get additionalHeaders() {\n return this.privAdditionalHeaders;\n }\n}\nSpeechConnectionMessage.fromConnectionMessage = (message) => {\n let path = null;\n let requestId = null;\n let contentType = null;\n let requestTimestamp = null;\n let streamId = null;\n const additionalHeaders = {};\n if (message.headers) {\n for (const headerName in message.headers) {\n if (headerName) {\n if (headerName.toLowerCase() === HeaderNames.Path.toLowerCase()) {\n path = message.headers[headerName];\n }\n else if (headerName.toLowerCase() === HeaderNames.RequestId.toLowerCase()) {\n requestId = message.headers[headerName];\n }\n else if (headerName.toLowerCase() === HeaderNames.RequestTimestamp.toLowerCase()) {\n requestTimestamp = message.headers[headerName];\n }\n else if (headerName.toLowerCase() === HeaderNames.ContentType.toLowerCase()) {\n contentType = message.headers[headerName];\n }\n else if (headerName.toLowerCase() === HeaderNames.RequestStreamId.toLowerCase()) {\n streamId = message.headers[headerName];\n }\n else {\n additionalHeaders[headerName] = message.headers[headerName];\n }\n }\n }\n }\n return new SpeechConnectionMessage(message.messageType, path, requestId, contentType, message.body, streamId, additionalHeaders, message.id);\n};\n\n//# sourceMappingURL=SpeechConnectionMessage.Internal.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { Context } from \"./Exports\";\nexport class SpeakerRecognitionConfig {\n constructor(context, parameters) {\n this.privContext = context ? context : new Context(null);\n this.privParameters = parameters;\n }\n get parameters() {\n return this.privParameters;\n }\n get Context() {\n return this.privContext;\n }\n}\n\n//# sourceMappingURL=SpeakerRecognitionConfig.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n// tslint:disable:max-classes-per-file\nimport { PropertyId } from \"../sdk/Exports\";\nexport var RecognitionMode;\n(function (RecognitionMode) {\n RecognitionMode[RecognitionMode[\"Interactive\"] = 0] = \"Interactive\";\n RecognitionMode[RecognitionMode[\"Conversation\"] = 1] = \"Conversation\";\n RecognitionMode[RecognitionMode[\"Dictation\"] = 2] = \"Dictation\";\n})(RecognitionMode || (RecognitionMode = {}));\nexport var SpeechResultFormat;\n(function (SpeechResultFormat) {\n SpeechResultFormat[SpeechResultFormat[\"Simple\"] = 0] = \"Simple\";\n SpeechResultFormat[SpeechResultFormat[\"Detailed\"] = 1] = \"Detailed\";\n})(SpeechResultFormat || (SpeechResultFormat = {}));\nexport class RecognizerConfig {\n constructor(speechServiceConfig, parameters) {\n this.privRecognitionMode = RecognitionMode.Interactive;\n this.privSpeechServiceConfig = speechServiceConfig ? speechServiceConfig : new SpeechServiceConfig(new Context(null));\n this.privParameters = parameters;\n }\n get parameters() {\n return this.privParameters;\n }\n get recognitionMode() {\n return this.privRecognitionMode;\n }\n set recognitionMode(value) {\n this.privRecognitionMode = value;\n this.privRecognitionActivityTimeout = value === RecognitionMode.Interactive ? 8000 : 25000;\n this.privSpeechServiceConfig.Recognition = RecognitionMode[value];\n }\n get SpeechServiceConfig() {\n return this.privSpeechServiceConfig;\n }\n get recognitionActivityTimeout() {\n return this.privRecognitionActivityTimeout;\n }\n get isContinuousRecognition() {\n return this.privRecognitionMode !== RecognitionMode.Interactive;\n }\n get autoDetectSourceLanguages() {\n return this.parameters.getProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, undefined);\n }\n}\n// The config is serialized and sent as the Speech.Config\nexport class SpeechServiceConfig {\n constructor(context) {\n this.serialize = () => {\n return JSON.stringify(this, (key, value) => {\n if (value && typeof value === \"object\") {\n const replacement = {};\n for (const k in value) {\n if (Object.hasOwnProperty.call(value, k)) {\n replacement[k && k.charAt(0).toLowerCase() + k.substring(1)] = value[k];\n }\n }\n return replacement;\n }\n return value;\n });\n };\n this.context = context;\n }\n get Context() {\n return this.context;\n }\n get Recognition() {\n return this.recognition;\n }\n set Recognition(value) {\n this.recognition = value.toLowerCase();\n }\n}\nexport class Context {\n constructor(os) {\n this.system = new System();\n this.os = os;\n }\n}\nexport class System {\n constructor() {\n // Note: below will be patched for official builds.\n const SPEECHSDK_CLIENTSDK_VERSION = \"1.15.1\";\n this.name = \"SpeechSDK\";\n this.version = SPEECHSDK_CLIENTSDK_VERSION;\n this.build = \"JavaScript\";\n this.lang = \"JavaScript\";\n }\n}\nexport class OS {\n constructor(platform, name, version) {\n this.platform = platform;\n this.name = name;\n this.version = version;\n }\n}\nexport class Device {\n constructor(manufacturer, model, version) {\n this.manufacturer = manufacturer;\n this.model = model;\n this.version = version;\n }\n}\nexport var connectivity;\n(function (connectivity) {\n connectivity[\"Bluetooth\"] = \"Bluetooth\";\n connectivity[\"Wired\"] = \"Wired\";\n connectivity[\"WiFi\"] = \"WiFi\";\n connectivity[\"Cellular\"] = \"Cellular\";\n connectivity[\"InBuilt\"] = \"InBuilt\";\n connectivity[\"Unknown\"] = \"Unknown\";\n})(connectivity || (connectivity = {}));\nexport var type;\n(function (type) {\n type[\"Phone\"] = \"Phone\";\n type[\"Speaker\"] = \"Speaker\";\n type[\"Car\"] = \"Car\";\n type[\"Headset\"] = \"Headset\";\n type[\"Thermostat\"] = \"Thermostat\";\n type[\"Microphones\"] = \"Microphones\";\n type[\"Deskphone\"] = \"Deskphone\";\n type[\"RemoteControl\"] = \"RemoteControl\";\n type[\"Unknown\"] = \"Unknown\";\n type[\"File\"] = \"File\";\n type[\"Stream\"] = \"Stream\";\n})(type || (type = {}));\n\n//# sourceMappingURL=RecognizerConfig.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { RecognitionStatus } from \"../Exports\";\nexport class DetailedSpeechPhrase {\n constructor(json) {\n this.privDetailedSpeechPhrase = JSON.parse(json);\n this.privDetailedSpeechPhrase.RecognitionStatus = RecognitionStatus[this.privDetailedSpeechPhrase.RecognitionStatus];\n }\n static fromJSON(json) {\n return new DetailedSpeechPhrase(json);\n }\n get RecognitionStatus() {\n return this.privDetailedSpeechPhrase.RecognitionStatus;\n }\n get NBest() {\n return this.privDetailedSpeechPhrase.NBest;\n }\n get Duration() {\n return this.privDetailedSpeechPhrase.Duration;\n }\n get Offset() {\n return this.privDetailedSpeechPhrase.Offset;\n }\n get Language() {\n return this.privDetailedSpeechPhrase.PrimaryLanguage === undefined ? undefined : this.privDetailedSpeechPhrase.PrimaryLanguage.Language;\n }\n get LanguageDetectionConfidence() {\n return this.privDetailedSpeechPhrase.PrimaryLanguage === undefined ? undefined : this.privDetailedSpeechPhrase.PrimaryLanguage.Confidence;\n }\n}\n\n//# sourceMappingURL=DetailedSpeechPhrase.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nexport class SpeechDetected {\n constructor(json) {\n this.privSpeechStartDetected = JSON.parse(json);\n }\n static fromJSON(json) {\n return new SpeechDetected(json);\n }\n get Offset() {\n return this.privSpeechStartDetected.Offset;\n }\n}\n\n//# sourceMappingURL=SpeechDetected.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n// tslint:disable:max-classes-per-file\nimport { EventType, PlatformEvent } from \"../common/Exports\";\nexport class SpeechSynthesisEvent extends PlatformEvent {\n constructor(eventName, requestId, eventType = EventType.Info) {\n super(eventName, eventType);\n this.privRequestId = requestId;\n }\n get requestId() {\n return this.privRequestId;\n }\n}\nexport class SynthesisTriggeredEvent extends SpeechSynthesisEvent {\n constructor(requestId, sessionAudioDestinationId, turnAudioDestinationId) {\n super(\"SynthesisTriggeredEvent\", requestId);\n this.privSessionAudioDestinationId = sessionAudioDestinationId;\n this.privTurnAudioDestinationId = turnAudioDestinationId;\n }\n get audioSessionDestinationId() {\n return this.privSessionAudioDestinationId;\n }\n get audioTurnDestinationId() {\n return this.privTurnAudioDestinationId;\n }\n}\nexport class ConnectingToSynthesisServiceEvent extends SpeechSynthesisEvent {\n constructor(requestId, authFetchEventId) {\n super(\"ConnectingToSynthesisServiceEvent\", requestId);\n this.privAuthFetchEventId = authFetchEventId;\n }\n get authFetchEventId() {\n return this.privAuthFetchEventId;\n }\n}\nexport class SynthesisStartedEvent extends SpeechSynthesisEvent {\n constructor(requestId, authFetchEventId) {\n super(\"SynthesisStartedEvent\", requestId);\n this.privAuthFetchEventId = authFetchEventId;\n }\n get authFetchEventId() {\n return this.privAuthFetchEventId;\n }\n}\n\n//# sourceMappingURL=SynthesisEvents.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { createNoDashGuid, Deferred, Events } from \"../common/Exports\";\nimport { PullAudioOutputStreamImpl } from \"../sdk/Audio/AudioOutputStream\";\nimport { SynthesisAdapterBase } from \"./SynthesisAdapterBase\";\nimport { ConnectingToSynthesisServiceEvent, SynthesisStartedEvent, SynthesisTriggeredEvent, } from \"./SynthesisEvents\";\nexport class SynthesisTurn {\n constructor() {\n this.privIsDisposed = false;\n this.privIsSynthesizing = false;\n this.privIsSynthesisEnded = false;\n this.privBytesReceived = 0;\n this.privInTurn = false;\n this.privTextOffset = 0;\n this.privNextSearchTextIndex = 0;\n this.onPreConnectionStart = (authFetchEventId, connectionId) => {\n this.privAuthFetchEventId = authFetchEventId;\n this.onEvent(new ConnectingToSynthesisServiceEvent(this.privRequestId, this.privAuthFetchEventId));\n };\n this.onAuthCompleted = (isError, error) => {\n if (isError) {\n this.onComplete();\n }\n };\n this.onConnectionEstablishCompleted = (statusCode, reason) => {\n if (statusCode === 200) {\n this.onEvent(new SynthesisStartedEvent(this.requestId, this.privAuthFetchEventId));\n this.privBytesReceived = 0;\n return;\n }\n else if (statusCode === 403) {\n this.onComplete();\n }\n };\n this.onServiceResponseMessage = (responseJson) => {\n const response = JSON.parse(responseJson);\n this.streamId = response.audio.streamId;\n };\n this.onServiceTurnEndResponse = () => {\n this.privInTurn = false;\n this.privTurnDeferral.resolve();\n this.onComplete();\n };\n this.onServiceTurnStartResponse = () => {\n if (!!this.privTurnDeferral && !!this.privInTurn) {\n // What? How are we starting a turn with another not done?\n this.privTurnDeferral.reject(\"Another turn started before current completed.\");\n }\n this.privInTurn = true;\n this.privTurnDeferral = new Deferred();\n };\n this.dispose = (error) => {\n if (!this.privIsDisposed) {\n // we should have completed by now. If we did not its an unknown error.\n this.privIsDisposed = true;\n }\n };\n this.onEvent = (event) => {\n Events.instance.onEvent(event);\n };\n this.onComplete = () => {\n if (this.privIsSynthesizing) {\n this.privIsSynthesizing = false;\n this.privIsSynthesisEnded = true;\n this.privAudioOutputStream.close();\n this.privInTurn = false;\n if (this.privTurnAudioDestination !== undefined) {\n this.privTurnAudioDestination.close();\n this.privTurnAudioDestination = undefined;\n }\n }\n };\n this.privRequestId = createNoDashGuid();\n this.privTurnDeferral = new Deferred();\n // We're not in a turn, so resolve.\n this.privTurnDeferral.resolve();\n }\n get requestId() {\n return this.privRequestId;\n }\n get streamId() {\n return this.privStreamId;\n }\n set streamId(value) {\n this.privStreamId = value;\n }\n get audioOutputFormat() {\n return this.privAudioOutputFormat;\n }\n set audioOutputFormat(format) {\n this.privAudioOutputFormat = format;\n }\n get turnCompletionPromise() {\n return this.privTurnDeferral.promise;\n }\n get isSynthesisEnded() {\n return this.privIsSynthesisEnded;\n }\n get isSynthesizing() {\n return this.privIsSynthesizing;\n }\n get currentTextOffset() {\n return this.privTextOffset;\n }\n // The number of bytes received for current turn\n get bytesReceived() {\n return this.privBytesReceived;\n }\n getAllReceivedAudio() {\n return __awaiter(this, void 0, void 0, function* () {\n if (!!this.privReceivedAudio) {\n return Promise.resolve(this.privReceivedAudio);\n }\n if (!this.privIsSynthesisEnded) {\n return null;\n }\n yield this.readAllAudioFromStream();\n return Promise.resolve(this.privReceivedAudio);\n });\n }\n getAllReceivedAudioWithHeader() {\n return __awaiter(this, void 0, void 0, function* () {\n if (!!this.privReceivedAudioWithHeader) {\n return this.privReceivedAudioWithHeader;\n }\n if (!this.privIsSynthesisEnded) {\n return null;\n }\n if (this.audioOutputFormat.hasHeader) {\n const audio = yield this.getAllReceivedAudio();\n this.privReceivedAudioWithHeader = SynthesisAdapterBase.addHeader(audio, this.audioOutputFormat);\n return this.privReceivedAudioWithHeader;\n }\n else {\n return this.getAllReceivedAudio();\n }\n });\n }\n startNewSynthesis(requestId, rawText, isSSML, audioDestination) {\n this.privIsSynthesisEnded = false;\n this.privIsSynthesizing = true;\n this.privRequestId = requestId;\n this.privRawText = rawText;\n this.privIsSSML = isSSML;\n this.privAudioOutputStream = new PullAudioOutputStreamImpl();\n this.privAudioOutputStream.format = this.privAudioOutputFormat;\n this.privReceivedAudio = null;\n this.privReceivedAudioWithHeader = null;\n this.privBytesReceived = 0;\n this.privTextOffset = 0;\n this.privNextSearchTextIndex = 0;\n if (audioDestination !== undefined) {\n this.privTurnAudioDestination = audioDestination;\n this.privTurnAudioDestination.format = this.privAudioOutputFormat;\n }\n this.onEvent(new SynthesisTriggeredEvent(this.requestId, undefined, audioDestination === undefined ? undefined : audioDestination.id()));\n }\n onAudioChunkReceived(data) {\n if (this.isSynthesizing) {\n this.privAudioOutputStream.write(data);\n this.privBytesReceived += data.byteLength;\n if (this.privTurnAudioDestination !== undefined) {\n this.privTurnAudioDestination.write(data);\n }\n }\n }\n onWordBoundaryEvent(text) {\n this.updateTextOffset(text);\n }\n onStopSynthesizing() {\n this.onComplete();\n }\n updateTextOffset(text) {\n if (this.privTextOffset >= 0) {\n this.privTextOffset = this.privRawText.indexOf(text, this.privNextSearchTextIndex);\n if (this.privTextOffset >= 0) {\n this.privNextSearchTextIndex = this.privTextOffset + text.length;\n }\n if (this.privIsSSML) {\n if (this.privRawText.indexOf(\"<\", this.privTextOffset + 1) > this.privRawText.indexOf(\">\", this.privTextOffset + 1)) {\n this.updateTextOffset(text);\n }\n }\n }\n }\n readAllAudioFromStream() {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.privIsSynthesisEnded) {\n this.privReceivedAudio = new ArrayBuffer(this.bytesReceived);\n try {\n yield this.privAudioOutputStream.read(this.privReceivedAudio);\n }\n catch (e) {\n this.privReceivedAudio = new ArrayBuffer(0);\n }\n }\n });\n }\n}\n\n//# sourceMappingURL=SynthesisTurn.js.map\n","var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { RestConfigBase, RestMessageAdapter, RestRequestType, } from \"../common.browser/Exports\";\nimport { PropertyId, VoiceProfileType, } from \"../sdk/Exports\";\n/**\n * Implements methods for speaker recognition classes, sending requests to endpoint\n * and parsing response into expected format\n * @class SpeakerIdMessageAdapter\n */\nexport class SpeakerIdMessageAdapter {\n constructor(config) {\n let endpoint = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint, undefined);\n if (!endpoint) {\n const region = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Region, \"westus\");\n const hostSuffix = (region && region.toLowerCase().startsWith(\"china\")) ? \".azure.cn\" : \".microsoft.com\";\n const host = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Host, \"https://\" + region + \".api.cognitive\" + hostSuffix + \"/speaker/{mode}/v2.0/{dependency}\");\n endpoint = host + \"/profiles\";\n }\n this.privUri = endpoint;\n const options = RestConfigBase.requestOptions;\n options.headers[RestConfigBase.configParams.subscriptionKey] = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Key, undefined);\n this.privRestAdapter = new RestMessageAdapter(options);\n }\n /**\n * Sends create profile request to endpoint.\n * @function\n * @param {VoiceProfileType} profileType - type of voice profile to create.\n * @param {string} lang - language/locale of voice profile\n * @public\n * @returns {Promise} promised rest response containing id of created profile.\n */\n createProfile(profileType, lang) {\n const uri = this.getOperationUri(profileType);\n this.privRestAdapter.setHeaders(RestConfigBase.configParams.contentTypeKey, \"application/json\");\n return this.privRestAdapter.request(RestRequestType.Post, uri, {}, { locale: lang });\n }\n /**\n * Sends create enrollment request to endpoint.\n * @function\n * @param {VoiceProfile} profileType - voice profile for which to create new enrollment.\n * @param {IAudioSource} audioSource - audioSource from which to pull data to send\n * @public\n * @returns {Promise} rest response to enrollment request.\n */\n createEnrollment(profile, audioSource) {\n this.privRestAdapter.setHeaders(RestConfigBase.configParams.contentTypeKey, \"multipart/form-data\");\n const uri = this.getOperationUri(profile.profileType) + \"/\" + profile.profileId + \"/enrollments\";\n return audioSource.blob.then((result) => {\n return this.privRestAdapter.request(RestRequestType.File, uri, { ignoreMinLength: \"true\" }, null, result);\n });\n }\n /**\n * Sends verification request to endpoint.\n * @function\n * @param {SpeakerVerificationModel} model - voice model to verify against.\n * @param {IAudioSource} audioSource - audioSource from which to pull data to send\n * @public\n * @returns {Promise} rest response to enrollment request.\n */\n verifySpeaker(model, audioSource) {\n return __awaiter(this, void 0, void 0, function* () {\n this.privRestAdapter.setHeaders(RestConfigBase.configParams.contentTypeKey, \"multipart/form-data\");\n const uri = this.getOperationUri(model.voiceProfile.profileType) + \"/\" + model.voiceProfile.profileId + \"/verify\";\n try {\n const result = yield audioSource.blob;\n return this.privRestAdapter.request(RestRequestType.File, uri, { ignoreMinLength: \"true\" }, null, result);\n }\n catch (e) {\n return Promise.resolve({ data: e });\n }\n });\n }\n /**\n * Sends identification request to endpoint.\n * @function\n * @param {SpeakerIdentificationModel} model - voice profiles against which to identify.\n * @param {IAudioSource} audioSource - audioSource from which to pull data to send\n * @public\n * @returns {Promise} rest response to enrollment request.\n */\n identifySpeaker(model, audioSource) {\n return __awaiter(this, void 0, void 0, function* () {\n this.privRestAdapter.setHeaders(RestConfigBase.configParams.contentTypeKey, \"multipart/form-data\");\n const uri = this.getOperationUri(VoiceProfileType.TextIndependentIdentification) + \"/identifySingleSpeaker\";\n try {\n const result = yield audioSource.blob;\n return this.privRestAdapter.request(RestRequestType.File, uri, { profileIds: model.voiceProfileIds, ignoreMinLength: \"true\" }, null, result);\n }\n catch (e) {\n return Promise.resolve({ data: e });\n }\n });\n }\n /**\n * Sends delete profile request to endpoint.\n * @function\n * @param {VoiceProfile} profile - voice profile to delete.\n * @public\n * @returns {Promise} rest response to deletion request\n */\n deleteProfile(profile) {\n const uri = this.getOperationUri(profile.profileType) + \"/\" + profile.profileId;\n return this.privRestAdapter.request(RestRequestType.Delete, uri, {});\n }\n /**\n * Sends reset profile request to endpoint.\n * @function\n * @param {VoiceProfile} profile - voice profile to reset enrollments for.\n * @public\n * @returns {Promise} rest response to reset request\n */\n resetProfile(profile) {\n const uri = this.getOperationUri(profile.profileType) + \"/\" + profile.profileId + \"/reset\";\n return this.privRestAdapter.request(RestRequestType.Post, uri, {});\n }\n getOperationUri(profileType) {\n const mode = profileType === VoiceProfileType.TextIndependentIdentification ? \"identification\" : \"verification\";\n const dependency = profileType === VoiceProfileType.TextDependentVerification ? \"text-dependent\" : \"text-independent\";\n return this.privUri.replace(\"{mode}\", mode).replace(\"{dependency}\", dependency);\n }\n}\n\n//# sourceMappingURL=SpeakerIdMessageAdapter.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { MessageType, TranslationStatus, } from \"../common/Exports\";\nimport { CancellationErrorCode, CancellationReason, PropertyCollection, PropertyId, ResultReason, TranslationRecognitionCanceledEventArgs, TranslationRecognitionEventArgs, TranslationRecognitionResult, Translations, TranslationSynthesisEventArgs, TranslationSynthesisResult, } from \"../sdk/Exports\";\nimport { CancellationErrorCodePropertyName, EnumTranslation, RecognitionStatus, ServiceRecognizerBase, SynthesisStatus, TranslationHypothesis, TranslationPhrase, TranslationSynthesisEnd, } from \"./Exports\";\n// tslint:disable-next-line:max-classes-per-file\nexport class TranslationServiceRecognizer extends ServiceRecognizerBase {\n constructor(authentication, connectionFactory, audioSource, recognizerConfig, translationRecognizer) {\n super(authentication, connectionFactory, audioSource, recognizerConfig, translationRecognizer);\n this.privTranslationRecognizer = translationRecognizer;\n }\n processTypeSpecificMessages(connectionMessage) {\n return __awaiter(this, void 0, void 0, function* () {\n const resultProps = new PropertyCollection();\n let processed = false;\n if (connectionMessage.messageType === MessageType.Text) {\n resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, connectionMessage.textBody);\n }\n switch (connectionMessage.path.toLowerCase()) {\n case \"translation.hypothesis\":\n const result = this.fireEventForResult(TranslationHypothesis.fromJSON(connectionMessage.textBody), resultProps);\n this.privRequestSession.onHypothesis(this.privRequestSession.currentTurnAudioOffset + result.offset);\n if (!!this.privTranslationRecognizer.recognizing) {\n try {\n this.privTranslationRecognizer.recognizing(this.privTranslationRecognizer, result);\n /* tslint:disable:no-empty */\n }\n catch (error) {\n // Not going to let errors in the event handler\n // trip things up.\n }\n }\n processed = true;\n break;\n case \"translation.phrase\":\n const translatedPhrase = TranslationPhrase.fromJSON(connectionMessage.textBody);\n this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset + translatedPhrase.Offset + translatedPhrase.Duration);\n if (translatedPhrase.RecognitionStatus === RecognitionStatus.Success) {\n // OK, the recognition was successful. How'd the translation do?\n const result = this.fireEventForResult(translatedPhrase, resultProps);\n if (!!this.privTranslationRecognizer.recognized) {\n try {\n this.privTranslationRecognizer.recognized(this.privTranslationRecognizer, result);\n /* tslint:disable:no-empty */\n }\n catch (error) {\n // Not going to let errors in the event handler\n // trip things up.\n }\n }\n // report result to promise.\n if (!!this.privSuccessCallback) {\n try {\n this.privSuccessCallback(result.result);\n }\n catch (e) {\n if (!!this.privErrorCallback) {\n this.privErrorCallback(e);\n }\n }\n // Only invoke the call back once.\n // and if it's successful don't invoke the\n // error after that.\n this.privSuccessCallback = undefined;\n this.privErrorCallback = undefined;\n }\n break;\n }\n else {\n const reason = EnumTranslation.implTranslateRecognitionResult(translatedPhrase.RecognitionStatus);\n const result = new TranslationRecognitionResult(undefined, this.privRequestSession.requestId, reason, translatedPhrase.Text, translatedPhrase.Duration, this.privRequestSession.currentTurnAudioOffset + translatedPhrase.Offset, undefined, connectionMessage.textBody, resultProps);\n if (reason === ResultReason.Canceled) {\n const cancelReason = EnumTranslation.implTranslateCancelResult(translatedPhrase.RecognitionStatus);\n yield this.cancelRecognitionLocal(cancelReason, EnumTranslation.implTranslateCancelErrorCode(translatedPhrase.RecognitionStatus), undefined);\n }\n else {\n if (!(this.privRequestSession.isSpeechEnded && reason === ResultReason.NoMatch && translatedPhrase.RecognitionStatus !== RecognitionStatus.InitialSilenceTimeout)) {\n const ev = new TranslationRecognitionEventArgs(result, result.offset, this.privRequestSession.sessionId);\n if (!!this.privTranslationRecognizer.recognized) {\n try {\n this.privTranslationRecognizer.recognized(this.privTranslationRecognizer, ev);\n /* tslint:disable:no-empty */\n }\n catch (error) {\n // Not going to let errors in the event handler\n // trip things up.\n }\n }\n }\n // report result to promise.\n if (!!this.privSuccessCallback) {\n try {\n this.privSuccessCallback(result);\n }\n catch (e) {\n if (!!this.privErrorCallback) {\n this.privErrorCallback(e);\n }\n }\n // Only invoke the call back once.\n // and if it's successful don't invoke the\n // error after that.\n this.privSuccessCallback = undefined;\n this.privErrorCallback = undefined;\n }\n }\n }\n processed = true;\n break;\n case \"translation.synthesis\":\n this.sendSynthesisAudio(connectionMessage.binaryBody, this.privRequestSession.sessionId);\n processed = true;\n break;\n case \"translation.synthesis.end\":\n const synthEnd = TranslationSynthesisEnd.fromJSON(connectionMessage.textBody);\n switch (synthEnd.SynthesisStatus) {\n case SynthesisStatus.Error:\n if (!!this.privTranslationRecognizer.synthesizing) {\n const result = new TranslationSynthesisResult(ResultReason.Canceled, undefined);\n const retEvent = new TranslationSynthesisEventArgs(result, this.privRequestSession.sessionId);\n try {\n this.privTranslationRecognizer.synthesizing(this.privTranslationRecognizer, retEvent);\n /* tslint:disable:no-empty */\n }\n catch (error) {\n // Not going to let errors in the event handler\n // trip things up.\n }\n }\n if (!!this.privTranslationRecognizer.canceled) {\n // And raise a canceled event to send the rich(er) error message back.\n const canceledResult = new TranslationRecognitionCanceledEventArgs(this.privRequestSession.sessionId, CancellationReason.Error, synthEnd.FailureReason, CancellationErrorCode.ServiceError, null);\n try {\n this.privTranslationRecognizer.canceled(this.privTranslationRecognizer, canceledResult);\n /* tslint:disable:no-empty */\n }\n catch (error) {\n // Not going to let errors in the event handler\n // trip things up.\n }\n }\n break;\n case SynthesisStatus.Success:\n this.sendSynthesisAudio(undefined, this.privRequestSession.sessionId);\n break;\n default:\n break;\n }\n processed = true;\n break;\n default:\n break;\n }\n return processed;\n });\n }\n // Cancels recognition.\n cancelRecognition(sessionId, requestId, cancellationReason, errorCode, error) {\n const properties = new PropertyCollection();\n properties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[errorCode]);\n if (!!this.privTranslationRecognizer.canceled) {\n const cancelEvent = new TranslationRecognitionCanceledEventArgs(sessionId, cancellationReason, error, errorCode, undefined);\n try {\n this.privTranslationRecognizer.canceled(this.privTranslationRecognizer, cancelEvent);\n /* tslint:disable:no-empty */\n }\n catch (_a) { }\n }\n if (!!this.privSuccessCallback) {\n const result = new TranslationRecognitionResult(undefined, // Translations\n requestId, ResultReason.Canceled, undefined, // Text\n undefined, // Druation\n undefined, // Offset\n error, undefined, // Json\n properties);\n try {\n this.privSuccessCallback(result);\n /* tslint:disable:no-empty */\n this.privSuccessCallback = undefined;\n }\n catch (_b) { }\n }\n }\n fireEventForResult(serviceResult, properties) {\n let translations;\n if (undefined !== serviceResult.Translation.Translations) {\n translations = new Translations();\n for (const translation of serviceResult.Translation.Translations) {\n translations.set(translation.Language, translation.Text);\n }\n }\n let resultReason;\n if (serviceResult instanceof TranslationPhrase) {\n if (serviceResult.Translation.TranslationStatus === TranslationStatus.Success) {\n resultReason = ResultReason.TranslatedSpeech;\n }\n else {\n resultReason = ResultReason.RecognizedSpeech;\n }\n }\n else {\n resultReason = ResultReason.TranslatingSpeech;\n }\n const offset = serviceResult.Offset + this.privRequestSession.currentTurnAudioOffset;\n const result = new TranslationRecognitionResult(translations, this.privRequestSession.requestId, resultReason, serviceResult.Text, serviceResult.Duration, offset, serviceResult.Translation.FailureReason, JSON.stringify(serviceResult), properties);\n const ev = new TranslationRecognitionEventArgs(result, offset, this.privRequestSession.sessionId);\n return ev;\n }\n sendSynthesisAudio(audio, sessionId) {\n const reason = (undefined === audio) ? ResultReason.SynthesizingAudioCompleted : ResultReason.SynthesizingAudio;\n const result = new TranslationSynthesisResult(reason, audio);\n const retEvent = new TranslationSynthesisEventArgs(result, sessionId);\n if (!!this.privTranslationRecognizer.synthesizing) {\n try {\n this.privTranslationRecognizer.synthesizing(this.privTranslationRecognizer, retEvent);\n /* tslint:disable:no-empty */\n }\n catch (error) {\n // Not going to let errors in the event handler\n // trip things up.\n }\n }\n }\n}\n\n//# sourceMappingURL=TranslationServiceRecognizer.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { RestConfigBase } from \"../../common.browser/RestConfigBase\";\nexport class ConversationConnectionConfig extends RestConfigBase {\n static get host() {\n return ConversationConnectionConfig.privHost;\n }\n static get apiVersion() {\n return ConversationConnectionConfig.privApiVersion;\n }\n static get clientAppId() {\n return ConversationConnectionConfig.privClientAppId;\n }\n static get defaultLanguageCode() {\n return ConversationConnectionConfig.privDefaultLanguageCode;\n }\n static get restPath() {\n return ConversationConnectionConfig.privRestPath;\n }\n static get webSocketPath() {\n return ConversationConnectionConfig.privWebSocketPath;\n }\n static get speechHost() {\n return ConversationConnectionConfig.privSpeechHost;\n }\n static get speechPath() {\n return ConversationConnectionConfig.privSpeechPath;\n }\n static get transcriptionEventKeys() {\n return ConversationConnectionConfig.privTranscriptionEventKeys;\n }\n}\nConversationConnectionConfig.privHost = \"dev.microsofttranslator.com\";\nConversationConnectionConfig.privRestPath = \"/capito/room\";\nConversationConnectionConfig.privApiVersion = \"2.0\";\nConversationConnectionConfig.privDefaultLanguageCode = \"en-US\";\nConversationConnectionConfig.privClientAppId = \"FC539C22-1767-4F1F-84BC-B4D811114F15\";\nConversationConnectionConfig.privWebSocketPath = \"/capito/translate\";\nConversationConnectionConfig.privSpeechHost = \"{region}.s2s.speech.microsoft.com\";\nConversationConnectionConfig.privSpeechPath = \"/speech/translation/cognitiveservices/v1\";\nConversationConnectionConfig.privTranscriptionEventKeys = [\"iCalUid\", \"callId\", \"organizer\", \"FLAC\", \"MTUri\", \"DifferenciateGuestSpeakers\", \"audiorecording\", \"Threadid\", \"OrganizerMri\", \"OrganizerTenantId\", \"UserToken\"];\n\n//# sourceMappingURL=ConversationConnectionConfig.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nexport class SynthesisAudioMetadata {\n constructor(json) {\n this.privSynthesisAudioMetadata = JSON.parse(json);\n }\n static fromJSON(json) {\n return new SynthesisAudioMetadata(json);\n }\n get Metadata() {\n return this.privSynthesisAudioMetadata.Metadata;\n }\n}\n\n//# sourceMappingURL=SynthesisAudioMetadata.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { CancellationErrorCode, OutputFormat, PropertyCollection, PropertyId, ResultReason, SpeechRecognitionCanceledEventArgs, SpeechRecognitionEventArgs, SpeechRecognitionResult, } from \"../sdk/Exports\";\nimport { CancellationErrorCodePropertyName, DetailedSpeechPhrase, EnumTranslation, OutputFormatPropertyName, RecognitionStatus, ServiceRecognizerBase, SimpleSpeechPhrase, SpeechHypothesis, } from \"./Exports\";\n// tslint:disable-next-line:max-classes-per-file\nexport class SpeechServiceRecognizer extends ServiceRecognizerBase {\n constructor(authentication, connectionFactory, audioSource, recognizerConfig, speechRecognizer) {\n super(authentication, connectionFactory, audioSource, recognizerConfig, speechRecognizer);\n this.privSpeechRecognizer = speechRecognizer;\n if (recognizerConfig.autoDetectSourceLanguages !== undefined) {\n const sourceLanguages = recognizerConfig.autoDetectSourceLanguages.split(\",\");\n this.privSpeechContext.setSection(\"languageId\", {\n languages: sourceLanguages,\n onSuccess: { action: \"Recognize\" },\n onUnknown: { action: \"None\" }\n });\n this.privSpeechContext.setSection(\"phraseOutput\", {\n interimResults: {\n resultType: \"Auto\"\n },\n phraseResults: {\n resultType: \"Always\"\n }\n });\n }\n }\n processTypeSpecificMessages(connectionMessage) {\n return __awaiter(this, void 0, void 0, function* () {\n let result;\n const resultProps = new PropertyCollection();\n resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, connectionMessage.textBody);\n let processed = false;\n switch (connectionMessage.path.toLowerCase()) {\n case \"speech.hypothesis\":\n case \"speech.fragment\":\n const hypothesis = SpeechHypothesis.fromJSON(connectionMessage.textBody);\n const offset = hypothesis.Offset + this.privRequestSession.currentTurnAudioOffset;\n result = new SpeechRecognitionResult(this.privRequestSession.requestId, ResultReason.RecognizingSpeech, hypothesis.Text, hypothesis.Duration, offset, hypothesis.Language, hypothesis.LanguageDetectionConfidence, undefined, // Speaker Id\n undefined, connectionMessage.textBody, resultProps);\n this.privRequestSession.onHypothesis(offset);\n const ev = new SpeechRecognitionEventArgs(result, hypothesis.Duration, this.privRequestSession.sessionId);\n if (!!this.privSpeechRecognizer.recognizing) {\n try {\n this.privSpeechRecognizer.recognizing(this.privSpeechRecognizer, ev);\n /* tslint:disable:no-empty */\n }\n catch (error) {\n // Not going to let errors in the event handler\n // trip things up.\n }\n }\n processed = true;\n break;\n case \"speech.phrase\":\n const simple = SimpleSpeechPhrase.fromJSON(connectionMessage.textBody);\n const resultReason = EnumTranslation.implTranslateRecognitionResult(simple.RecognitionStatus);\n this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset + simple.Offset + simple.Duration);\n if (ResultReason.Canceled === resultReason) {\n const cancelReason = EnumTranslation.implTranslateCancelResult(simple.RecognitionStatus);\n yield this.cancelRecognitionLocal(cancelReason, EnumTranslation.implTranslateCancelErrorCode(simple.RecognitionStatus), undefined);\n }\n else {\n if (!(this.privRequestSession.isSpeechEnded && resultReason === ResultReason.NoMatch && simple.RecognitionStatus !== RecognitionStatus.InitialSilenceTimeout)) {\n if (this.privRecognizerConfig.parameters.getProperty(OutputFormatPropertyName) === OutputFormat[OutputFormat.Simple]) {\n result = new SpeechRecognitionResult(this.privRequestSession.requestId, resultReason, simple.DisplayText, simple.Duration, simple.Offset + this.privRequestSession.currentTurnAudioOffset, simple.Language, simple.LanguageDetectionConfidence, undefined, // Speaker Id\n undefined, connectionMessage.textBody, resultProps);\n }\n else {\n const detailed = DetailedSpeechPhrase.fromJSON(connectionMessage.textBody);\n result = new SpeechRecognitionResult(this.privRequestSession.requestId, resultReason, detailed.RecognitionStatus === RecognitionStatus.Success ? detailed.NBest[0].Display : undefined, detailed.Duration, detailed.Offset + this.privRequestSession.currentTurnAudioOffset, detailed.Language, detailed.LanguageDetectionConfidence, undefined, // Speaker Id\n undefined, connectionMessage.textBody, resultProps);\n }\n const event = new SpeechRecognitionEventArgs(result, result.offset, this.privRequestSession.sessionId);\n if (!!this.privSpeechRecognizer.recognized) {\n try {\n this.privSpeechRecognizer.recognized(this.privSpeechRecognizer, event);\n /* tslint:disable:no-empty */\n }\n catch (error) {\n // Not going to let errors in the event handler\n // trip things up.\n }\n }\n }\n if (!!this.privSuccessCallback) {\n try {\n this.privSuccessCallback(result);\n }\n catch (e) {\n if (!!this.privErrorCallback) {\n this.privErrorCallback(e);\n }\n }\n // Only invoke the call back once.\n // and if it's successful don't invoke the\n // error after that.\n this.privSuccessCallback = undefined;\n this.privErrorCallback = undefined;\n }\n }\n processed = true;\n break;\n default:\n break;\n }\n return processed;\n });\n }\n // Cancels recognition.\n cancelRecognition(sessionId, requestId, cancellationReason, errorCode, error) {\n const properties = new PropertyCollection();\n properties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[errorCode]);\n if (!!this.privSpeechRecognizer.canceled) {\n const cancelEvent = new SpeechRecognitionCanceledEventArgs(cancellationReason, error, errorCode, undefined, sessionId);\n try {\n this.privSpeechRecognizer.canceled(this.privSpeechRecognizer, cancelEvent);\n /* tslint:disable:no-empty */\n }\n catch (_a) { }\n }\n if (!!this.privSuccessCallback) {\n const result = new SpeechRecognitionResult(requestId, ResultReason.Canceled, undefined, // Text\n undefined, // Duration\n undefined, // Offset\n undefined, // Language\n undefined, // Language Detection Confidence\n undefined, // Speaker Id\n error, undefined, // Json\n properties);\n try {\n this.privSuccessCallback(result);\n this.privSuccessCallback = undefined;\n /* tslint:disable:no-empty */\n }\n catch (_b) { }\n }\n }\n}\n\n//# sourceMappingURL=SpeechServiceRecognizer.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { ReplayableAudioNode } from \"../common.browser/Exports\";\nimport { ArgumentNullError, ConnectionState, createNoDashGuid, EventSource, MessageType, ServiceEvent, Timeout } from \"../common/Exports\";\nimport { CancellationErrorCode, CancellationReason, PropertyId, RecognitionEventArgs, SessionEventArgs, } from \"../sdk/Exports\";\nimport { AgentConfig, DynamicGrammarBuilder, RequestSession, SpeechContext, SpeechDetected, } from \"./Exports\";\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal\";\nexport class ServiceRecognizerBase {\n constructor(authentication, connectionFactory, audioSource, recognizerConfig, recognizer) {\n this.privSetTimeout = setTimeout;\n this.recognizeOverride = undefined;\n this.disconnectOverride = undefined;\n this.receiveMessageOverride = undefined;\n this.sendSpeechContext = (connection) => {\n const speechContextJson = this.speechContext.toJSON();\n if (speechContextJson) {\n return connection.send(new SpeechConnectionMessage(MessageType.Text, \"speech.context\", this.privRequestSession.requestId, \"application/json\", speechContextJson));\n }\n return;\n };\n this.sendPrePayloadJSONOverride = undefined;\n this.postConnectImplOverride = undefined;\n this.configConnectionOverride = undefined;\n this.sendSpeechServiceConfig = (connection, requestSession, SpeechServiceConfigJson) => {\n // filter out anything that is not required for the service to work.\n if (ServiceRecognizerBase.telemetryDataEnabled !== true) {\n const withTelemetry = JSON.parse(SpeechServiceConfigJson);\n const replacement = {\n context: {\n system: withTelemetry.context.system,\n },\n };\n SpeechServiceConfigJson = JSON.stringify(replacement);\n }\n if (SpeechServiceConfigJson) {\n return connection.send(new SpeechConnectionMessage(MessageType.Text, \"speech.config\", requestSession.requestId, \"application/json\", SpeechServiceConfigJson));\n }\n return;\n };\n if (!authentication) {\n throw new ArgumentNullError(\"authentication\");\n }\n if (!connectionFactory) {\n throw new ArgumentNullError(\"connectionFactory\");\n }\n if (!audioSource) {\n throw new ArgumentNullError(\"audioSource\");\n }\n if (!recognizerConfig) {\n throw new ArgumentNullError(\"recognizerConfig\");\n }\n this.privMustReportEndOfStream = false;\n this.privAuthentication = authentication;\n this.privConnectionFactory = connectionFactory;\n this.privAudioSource = audioSource;\n this.privRecognizerConfig = recognizerConfig;\n this.privIsDisposed = false;\n this.privRecognizer = recognizer;\n this.privRequestSession = new RequestSession(this.privAudioSource.id());\n this.privConnectionEvents = new EventSource();\n this.privServiceEvents = new EventSource();\n this.privDynamicGrammar = new DynamicGrammarBuilder();\n this.privSpeechContext = new SpeechContext(this.privDynamicGrammar);\n this.privAgentConfig = new AgentConfig();\n if (typeof (Blob) !== \"undefined\" && typeof (Worker) !== \"undefined\") {\n this.privSetTimeout = Timeout.setTimeout;\n }\n this.connectionEvents.attach((connectionEvent) => __awaiter(this, void 0, void 0, function* () {\n if (connectionEvent.name === \"ConnectionClosedEvent\") {\n const connectionClosedEvent = connectionEvent;\n if (connectionClosedEvent.statusCode !== 1000) {\n yield this.cancelRecognitionLocal(CancellationReason.Error, connectionClosedEvent.statusCode === 1007 ? CancellationErrorCode.BadRequestParameters : CancellationErrorCode.ConnectionFailure, connectionClosedEvent.reason + \" websocket error code: \" + connectionClosedEvent.statusCode);\n }\n }\n }));\n }\n get audioSource() {\n return this.privAudioSource;\n }\n get speechContext() {\n return this.privSpeechContext;\n }\n get dynamicGrammar() {\n return this.privDynamicGrammar;\n }\n get agentConfig() {\n return this.privAgentConfig;\n }\n set conversationTranslatorToken(token) {\n this.privRecognizerConfig.parameters.setProperty(PropertyId.ConversationTranslator_Token, token);\n }\n set authentication(auth) {\n this.privAuthentication = this.authentication;\n }\n isDisposed() {\n return this.privIsDisposed;\n }\n dispose(reason) {\n return __awaiter(this, void 0, void 0, function* () {\n this.privIsDisposed = true;\n if (this.privConnectionConfigurationPromise) {\n try {\n const connection = yield this.privConnectionConfigurationPromise;\n yield connection.dispose(reason);\n }\n catch (error) {\n // The connection is in a bad state. But we're trying to kill it, so...\n return;\n }\n }\n });\n }\n get connectionEvents() {\n return this.privConnectionEvents;\n }\n get serviceEvents() {\n return this.privServiceEvents;\n }\n get recognitionMode() {\n return this.privRecognizerConfig.recognitionMode;\n }\n recognize(recoMode, successCallback, errorCallBack) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.recognizeOverride !== undefined) {\n return this.recognizeOverride(recoMode, successCallback, errorCallBack);\n }\n // Clear the existing configuration promise to force a re-transmission of config and context.\n this.privConnectionConfigurationPromise = null;\n this.privRecognizerConfig.recognitionMode = recoMode;\n this.privSuccessCallback = successCallback;\n this.privErrorCallback = errorCallBack;\n this.privRequestSession.startNewRecognition();\n this.privRequestSession.listenForServiceTelemetry(this.privAudioSource.events);\n // Start the connection to the service. The promise this will create is stored and will be used by configureConnection().\n const conPromise = this.connectImpl();\n const audioStreamNode = yield this.audioSource.attach(this.privRequestSession.audioNodeId);\n const format = yield this.audioSource.format;\n const deviceInfo = yield this.audioSource.deviceInfo;\n const audioNode = new ReplayableAudioNode(audioStreamNode, format.avgBytesPerSec);\n yield this.privRequestSession.onAudioSourceAttachCompleted(audioNode, false);\n this.privRecognizerConfig.SpeechServiceConfig.Context.audio = { source: deviceInfo };\n try {\n yield conPromise;\n }\n catch (error) {\n yield this.cancelRecognitionLocal(CancellationReason.Error, CancellationErrorCode.ConnectionFailure, error);\n return;\n }\n const sessionStartEventArgs = new SessionEventArgs(this.privRequestSession.sessionId);\n if (!!this.privRecognizer.sessionStarted) {\n this.privRecognizer.sessionStarted(this.privRecognizer, sessionStartEventArgs);\n }\n const messageRetrievalPromise = this.receiveMessage();\n const audioSendPromise = this.sendAudio(audioNode);\n audioSendPromise.catch((error) => __awaiter(this, void 0, void 0, function* () {\n yield this.cancelRecognitionLocal(CancellationReason.Error, CancellationErrorCode.RuntimeError, error);\n }));\n return;\n });\n }\n stopRecognizing() {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.privRequestSession.isRecognizing) {\n yield this.audioSource.turnOff();\n yield this.sendFinalAudio();\n yield this.privRequestSession.onStopRecognizing();\n yield this.privRequestSession.turnCompletionPromise;\n yield this.privRequestSession.dispose();\n }\n return;\n });\n }\n connect() {\n return __awaiter(this, void 0, void 0, function* () {\n yield this.connectImpl();\n return Promise.resolve();\n });\n }\n connectAsync(cb, err) {\n this.connectImpl().then((connection) => {\n try {\n if (!!cb) {\n cb();\n }\n }\n catch (e) {\n if (!!err) {\n err(e);\n }\n }\n }, (reason) => {\n try {\n if (!!err) {\n err(reason);\n }\n /* tslint:disable:no-empty */\n }\n catch (error) {\n }\n });\n }\n disconnect() {\n return __awaiter(this, void 0, void 0, function* () {\n yield this.cancelRecognitionLocal(CancellationReason.Error, CancellationErrorCode.NoError, \"Disconnecting\");\n if (this.disconnectOverride !== undefined) {\n yield this.disconnectOverride();\n }\n try {\n yield (yield this.privConnectionPromise).dispose();\n }\n catch (error) {\n }\n this.privConnectionPromise = null;\n });\n }\n sendMessage(message) { }\n sendNetworkMessage(path, payload) {\n return __awaiter(this, void 0, void 0, function* () {\n const type = typeof payload === \"string\" ? MessageType.Text : MessageType.Binary;\n const contentType = typeof payload === \"string\" ? \"application/json\" : \"\";\n const connection = yield this.fetchConnection();\n return connection.send(new SpeechConnectionMessage(type, path, this.privRequestSession.requestId, contentType, payload));\n });\n }\n set activityTemplate(messagePayload) { this.privActivityTemplate = messagePayload; }\n get activityTemplate() { return this.privActivityTemplate; }\n sendTelemetryData() {\n return __awaiter(this, void 0, void 0, function* () {\n const telemetryData = this.privRequestSession.getTelemetry();\n if (ServiceRecognizerBase.telemetryDataEnabled !== true ||\n this.privIsDisposed ||\n null === telemetryData) {\n return;\n }\n if (!!ServiceRecognizerBase.telemetryData) {\n try {\n ServiceRecognizerBase.telemetryData(telemetryData);\n /* tslint:disable:no-empty */\n }\n catch (_a) { }\n }\n const connection = yield this.fetchConnection();\n yield connection.send(new SpeechConnectionMessage(MessageType.Text, \"telemetry\", this.privRequestSession.requestId, \"application/json\", telemetryData));\n });\n }\n // Cancels recognition.\n cancelRecognitionLocal(cancellationReason, errorCode, error) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!!this.privRequestSession.isRecognizing) {\n yield this.privRequestSession.onStopRecognizing();\n this.cancelRecognition(this.privRequestSession.sessionId, this.privRequestSession.requestId, cancellationReason, errorCode, error);\n }\n });\n }\n receiveMessage() {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n if (this.privIsDisposed) {\n // We're done.\n return;\n }\n let connection = yield this.fetchConnection();\n const message = yield connection.read();\n if (this.receiveMessageOverride !== undefined) {\n return this.receiveMessageOverride();\n }\n // indicates we are draining the queue and it came with no message;\n if (!message) {\n if (!this.privRequestSession.isRecognizing) {\n return;\n }\n else {\n return this.receiveMessage();\n }\n }\n this.privServiceHasSentMessage = true;\n const connectionMessage = SpeechConnectionMessage.fromConnectionMessage(message);\n if (connectionMessage.requestId.toLowerCase() === this.privRequestSession.requestId.toLowerCase()) {\n switch (connectionMessage.path.toLowerCase()) {\n case \"turn.start\":\n this.privMustReportEndOfStream = true;\n this.privRequestSession.onServiceTurnStartResponse();\n break;\n case \"speech.startdetected\":\n const speechStartDetected = SpeechDetected.fromJSON(connectionMessage.textBody);\n const speechStartEventArgs = new RecognitionEventArgs(speechStartDetected.Offset, this.privRequestSession.sessionId);\n if (!!this.privRecognizer.speechStartDetected) {\n this.privRecognizer.speechStartDetected(this.privRecognizer, speechStartEventArgs);\n }\n break;\n case \"speech.enddetected\":\n let json;\n if (connectionMessage.textBody.length > 0) {\n json = connectionMessage.textBody;\n }\n else {\n // If the request was empty, the JSON returned is empty.\n json = \"{ Offset: 0 }\";\n }\n const speechStopDetected = SpeechDetected.fromJSON(json);\n // Only shrink the buffers for continuous recognition.\n // For single shot, the speech.phrase message will come after the speech.end and it should own buffer shrink.\n if (this.privRecognizerConfig.isContinuousRecognition) {\n this.privRequestSession.onServiceRecognized(speechStopDetected.Offset + this.privRequestSession.currentTurnAudioOffset);\n }\n const speechStopEventArgs = new RecognitionEventArgs(speechStopDetected.Offset + this.privRequestSession.currentTurnAudioOffset, this.privRequestSession.sessionId);\n if (!!this.privRecognizer.speechEndDetected) {\n this.privRecognizer.speechEndDetected(this.privRecognizer, speechStopEventArgs);\n }\n break;\n case \"turn.end\":\n yield this.sendTelemetryData();\n if (this.privRequestSession.isSpeechEnded && this.privMustReportEndOfStream) {\n this.privMustReportEndOfStream = false;\n yield this.cancelRecognitionLocal(CancellationReason.EndOfStream, CancellationErrorCode.NoError, undefined);\n }\n const sessionStopEventArgs = new SessionEventArgs(this.privRequestSession.sessionId);\n yield this.privRequestSession.onServiceTurnEndResponse(this.privRecognizerConfig.isContinuousRecognition);\n if (!this.privRecognizerConfig.isContinuousRecognition || this.privRequestSession.isSpeechEnded || !this.privRequestSession.isRecognizing) {\n if (!!this.privRecognizer.sessionStopped) {\n this.privRecognizer.sessionStopped(this.privRecognizer, sessionStopEventArgs);\n }\n return;\n }\n else {\n connection = yield this.fetchConnection();\n yield this.sendPrePayloadJSON(connection);\n }\n break;\n default:\n if (!(yield this.processTypeSpecificMessages(connectionMessage))) {\n // here are some messages that the derived class has not processed, dispatch them to connect class\n if (!!this.privServiceEvents) {\n this.serviceEvents.onEvent(new ServiceEvent(connectionMessage.path.toLowerCase(), connectionMessage.textBody));\n }\n }\n }\n }\n return this.receiveMessage();\n }\n catch (error) {\n return null;\n }\n });\n }\n // Encapsulated for derived service recognizers that need to send additional JSON\n sendPrePayloadJSON(connection) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.sendPrePayloadJSONOverride !== undefined) {\n return this.sendPrePayloadJSONOverride(connection);\n }\n yield this.sendSpeechContext(connection);\n yield this.sendWaveHeader(connection);\n return;\n });\n }\n sendWaveHeader(connection) {\n return __awaiter(this, void 0, void 0, function* () {\n const format = yield this.audioSource.format;\n // this.writeBufferToConsole(format.header);\n return connection.send(new SpeechConnectionMessage(MessageType.Binary, \"audio\", this.privRequestSession.requestId, \"audio/x-wav\", format.header));\n });\n }\n // Establishes a websocket connection to the end point.\n connectImpl(isUnAuthorized = false) {\n if (this.privConnectionPromise) {\n return this.privConnectionPromise.then((connection) => {\n if (connection.state() === ConnectionState.Disconnected) {\n this.privConnectionId = null;\n this.privConnectionPromise = null;\n this.privServiceHasSentMessage = false;\n return this.connectImpl();\n }\n return this.privConnectionPromise;\n }, (error) => {\n this.privConnectionId = null;\n this.privConnectionPromise = null;\n this.privServiceHasSentMessage = false;\n return this.connectImpl();\n });\n }\n this.privAuthFetchEventId = createNoDashGuid();\n const sessionId = this.privRecognizerConfig.parameters.getProperty(PropertyId.Speech_SessionId, undefined);\n this.privConnectionId = (sessionId !== undefined) ? sessionId : createNoDashGuid();\n this.privRequestSession.onPreConnectionStart(this.privAuthFetchEventId, this.privConnectionId);\n const authPromise = isUnAuthorized ? this.privAuthentication.fetchOnExpiry(this.privAuthFetchEventId) : this.privAuthentication.fetch(this.privAuthFetchEventId);\n this.privConnectionPromise = authPromise.then((result) => __awaiter(this, void 0, void 0, function* () {\n yield this.privRequestSession.onAuthCompleted(false);\n const connection = this.privConnectionFactory.create(this.privRecognizerConfig, result, this.privConnectionId);\n this.privRequestSession.listenForServiceTelemetry(connection.events);\n // Attach to the underlying event. No need to hold onto the detach pointers as in the event the connection goes away,\n // it'll stop sending events.\n connection.events.attach((event) => {\n this.connectionEvents.onEvent(event);\n });\n const response = yield connection.open();\n if (response.statusCode === 200) {\n yield this.privRequestSession.onConnectionEstablishCompleted(response.statusCode);\n return Promise.resolve(connection);\n }\n else if (response.statusCode === 403 && !isUnAuthorized) {\n return this.connectImpl(true);\n }\n else {\n yield this.privRequestSession.onConnectionEstablishCompleted(response.statusCode, response.reason);\n return Promise.reject(`Unable to contact server. StatusCode: ${response.statusCode}, ${this.privRecognizerConfig.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint)} Reason: ${response.reason}`);\n }\n }), (error) => __awaiter(this, void 0, void 0, function* () {\n yield this.privRequestSession.onAuthCompleted(true, error);\n throw new Error(error);\n }));\n // Attach an empty handler to allow the promise to run in the background while\n // other startup events happen. It'll eventually be awaited on.\n this.privConnectionPromise.catch(() => { });\n if (this.postConnectImplOverride !== undefined) {\n return this.postConnectImplOverride(this.privConnectionPromise);\n }\n return this.privConnectionPromise;\n }\n fetchConnection() {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.privConnectionConfigurationPromise) {\n return this.privConnectionConfigurationPromise.then((connection) => {\n if (connection.state() === ConnectionState.Disconnected) {\n this.privConnectionId = null;\n this.privConnectionConfigurationPromise = null;\n this.privServiceHasSentMessage = false;\n return this.fetchConnection();\n }\n return this.privConnectionConfigurationPromise;\n }, (error) => {\n this.privConnectionId = null;\n this.privConnectionConfigurationPromise = null;\n this.privServiceHasSentMessage = false;\n return this.fetchConnection();\n });\n }\n this.privConnectionConfigurationPromise = this.configureConnection();\n return yield this.privConnectionConfigurationPromise;\n });\n }\n sendAudio(audioStreamNode) {\n return __awaiter(this, void 0, void 0, function* () {\n const audioFormat = yield this.audioSource.format;\n // The time we last sent data to the service.\n let nextSendTime = Date.now();\n // Max amount to send before we start to throttle\n const fastLaneSizeMs = this.privRecognizerConfig.parameters.getProperty(\"SPEECH-TransmitLengthBeforThrottleMs\", \"5000\");\n const maxSendUnthrottledBytes = audioFormat.avgBytesPerSec / 1000 * parseInt(fastLaneSizeMs, 10);\n const startRecogNumber = this.privRequestSession.recogNumber;\n const readAndUploadCycle = () => __awaiter(this, void 0, void 0, function* () {\n // If speech is done, stop sending audio.\n if (!this.privIsDisposed &&\n !this.privRequestSession.isSpeechEnded &&\n this.privRequestSession.isRecognizing &&\n this.privRequestSession.recogNumber === startRecogNumber) {\n const connection = yield this.fetchConnection();\n const audioStreamChunk = yield audioStreamNode.read();\n // we have a new audio chunk to upload.\n if (this.privRequestSession.isSpeechEnded) {\n // If service already recognized audio end then don't send any more audio\n return;\n }\n let payload;\n let sendDelay;\n if (!audioStreamChunk || audioStreamChunk.isEnd) {\n payload = null;\n sendDelay = 0;\n }\n else {\n payload = audioStreamChunk.buffer;\n this.privRequestSession.onAudioSent(payload.byteLength);\n if (maxSendUnthrottledBytes >= this.privRequestSession.bytesSent) {\n sendDelay = 0;\n }\n else {\n sendDelay = Math.max(0, nextSendTime - Date.now());\n }\n }\n if (0 !== sendDelay) {\n yield this.delay(sendDelay);\n }\n if (payload !== null) {\n nextSendTime = Date.now() + (payload.byteLength * 1000 / (audioFormat.avgBytesPerSec * 2));\n }\n // Are we still alive?\n if (!this.privIsDisposed &&\n !this.privRequestSession.isSpeechEnded &&\n this.privRequestSession.isRecognizing &&\n this.privRequestSession.recogNumber === startRecogNumber) {\n connection.send(new SpeechConnectionMessage(MessageType.Binary, \"audio\", this.privRequestSession.requestId, null, payload)).catch(() => {\n this.privRequestSession.onServiceTurnEndResponse(this.privRecognizerConfig.isContinuousRecognition).catch(() => { });\n });\n if (!(audioStreamChunk === null || audioStreamChunk === void 0 ? void 0 : audioStreamChunk.isEnd)) {\n // this.writeBufferToConsole(payload);\n // Regardless of success or failure, schedule the next upload.\n // If the underlying connection was broken, the next cycle will\n // get a new connection and re-transmit missing audio automatically.\n return readAndUploadCycle();\n }\n else {\n // the audio stream has been closed, no need to schedule next\n // read-upload cycle.\n this.privRequestSession.onSpeechEnded();\n }\n }\n }\n });\n return readAndUploadCycle();\n });\n }\n delay(delayMs) {\n return new Promise((resolve, reject) => {\n this.privSetTimeout(resolve, delayMs);\n });\n }\n writeBufferToConsole(buffer) {\n let out = \"Buffer Size: \";\n if (null === buffer) {\n out += \"null\";\n }\n else {\n const readView = new Uint8Array(buffer);\n out += buffer.byteLength + \"\\r\\n\";\n for (let i = 0; i < buffer.byteLength; i++) {\n out += readView[i].toString(16).padStart(2, \"0\") + \" \";\n }\n }\n // tslint:disable-next-line:no-console\n console.info(out);\n }\n sendFinalAudio() {\n return __awaiter(this, void 0, void 0, function* () {\n const connection = yield this.fetchConnection();\n yield connection.send(new SpeechConnectionMessage(MessageType.Binary, \"audio\", this.privRequestSession.requestId, null, null));\n return;\n });\n }\n // Takes an established websocket connection to the endpoint and sends speech configuration information.\n configureConnection() {\n return __awaiter(this, void 0, void 0, function* () {\n const connection = yield this.connectImpl();\n if (this.configConnectionOverride !== undefined) {\n return this.configConnectionOverride(connection);\n }\n yield this.sendSpeechServiceConfig(connection, this.privRequestSession, this.privRecognizerConfig.SpeechServiceConfig.serialize());\n yield this.sendPrePayloadJSON(connection);\n return connection;\n });\n }\n}\nServiceRecognizerBase.telemetryDataEnabled = true;\n\n//# sourceMappingURL=ServiceRecognizerBase.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { RecognitionStatus } from \"../Exports\";\nimport { TranslationStatus } from \"../TranslationStatus\";\nexport class TranslationPhrase {\n constructor(json) {\n this.privTranslationPhrase = JSON.parse(json);\n this.privTranslationPhrase.RecognitionStatus = RecognitionStatus[this.privTranslationPhrase.RecognitionStatus];\n if (this.privTranslationPhrase.Translation !== undefined) {\n this.privTranslationPhrase.Translation.TranslationStatus = TranslationStatus[this.privTranslationPhrase.Translation.TranslationStatus];\n }\n }\n static fromJSON(json) {\n return new TranslationPhrase(json);\n }\n get RecognitionStatus() {\n return this.privTranslationPhrase.RecognitionStatus;\n }\n get Offset() {\n return this.privTranslationPhrase.Offset;\n }\n get Duration() {\n return this.privTranslationPhrase.Duration;\n }\n get Text() {\n return this.privTranslationPhrase.Text;\n }\n get Translation() {\n return this.privTranslationPhrase.Translation;\n }\n}\n\n//# sourceMappingURL=TranslationPhrase.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n/**\n * Represents the JSON used in the synthesis.context message sent to the speech service.\n * The dynamic grammar is always refreshed from the encapsulated dynamic grammar object.\n */\nexport class SynthesisContext {\n constructor(speechSynthesizer) {\n this.privContext = {};\n this.privSpeechSynthesizer = speechSynthesizer;\n }\n /**\n * Adds a section to the synthesis.context object.\n * @param sectionName Name of the section to add.\n * @param value JSON serializable object that represents the value.\n */\n setSection(sectionName, value) {\n this.privContext[sectionName] = value;\n }\n /**\n * Sets the audio output format for synthesis context generation.\n * @param format {AudioOutputFormatImpl} the output format\n */\n set audioOutputFormat(format) {\n this.privAudioOutputFormat = format;\n }\n toJSON() {\n const synthesisSection = this.buildSynthesisContext();\n this.setSection(\"synthesis\", synthesisSection);\n return JSON.stringify(this.privContext);\n }\n buildSynthesisContext() {\n return {\n audio: {\n metadataOptions: {\n sentenceBoundaryEnabled: false,\n wordBoundaryEnabled: (!!this.privSpeechSynthesizer.wordBoundary),\n },\n outputFormat: this.privAudioOutputFormat.requestAudioFormatString,\n },\n language: {\n autoDetection: this.privSpeechSynthesizer.autoDetectSourceLanguage\n }\n };\n }\n}\n\n//# sourceMappingURL=SynthesisContext.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { ArgumentNullError, ConnectionState, createNoDashGuid, EventSource, MessageType, ServiceEvent, } from \"../common/Exports\";\nimport { CancellationErrorCode, CancellationReason, PropertyCollection, PropertyId, ResultReason, SpeechSynthesisEventArgs, SpeechSynthesisResult, SpeechSynthesisWordBoundaryEventArgs, } from \"../sdk/Exports\";\nimport { AgentConfig, CancellationErrorCodePropertyName, SynthesisAudioMetadata, SynthesisContext, SynthesisTurn } from \"./Exports\";\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal\";\nexport class SynthesisAdapterBase {\n constructor(authentication, connectionFactory, synthesizerConfig, speechSynthesizer, audioDestination) {\n this.speakOverride = undefined;\n this.receiveMessageOverride = undefined;\n this.connectImplOverride = undefined;\n this.configConnectionOverride = undefined;\n this.sendSynthesisContext = (connection) => {\n const synthesisContextJson = this.synthesisContext.toJSON();\n if (synthesisContextJson) {\n return connection.send(new SpeechConnectionMessage(MessageType.Text, \"synthesis.context\", this.privSynthesisTurn.requestId, \"application/json\", synthesisContextJson));\n }\n return;\n };\n this.sendSpeechServiceConfig = (connection, SpeechServiceConfigJson) => {\n if (SpeechServiceConfigJson) {\n return connection.send(new SpeechConnectionMessage(MessageType.Text, \"speech.config\", this.privSynthesisTurn.requestId, \"application/json\", SpeechServiceConfigJson));\n }\n };\n this.sendSsmlMessage = (connection, ssml, requestId) => {\n return connection.send(new SpeechConnectionMessage(MessageType.Text, \"ssml\", requestId, \"application/ssml+xml\", ssml));\n };\n if (!authentication) {\n throw new ArgumentNullError(\"authentication\");\n }\n if (!connectionFactory) {\n throw new ArgumentNullError(\"connectionFactory\");\n }\n if (!synthesizerConfig) {\n throw new ArgumentNullError(\"synthesizerConfig\");\n }\n this.privAuthentication = authentication;\n this.privConnectionFactory = connectionFactory;\n this.privSynthesizerConfig = synthesizerConfig;\n this.privIsDisposed = false;\n this.privSpeechSynthesizer = speechSynthesizer;\n this.privSessionAudioDestination = audioDestination;\n this.privSynthesisTurn = new SynthesisTurn();\n this.privConnectionEvents = new EventSource();\n this.privServiceEvents = new EventSource();\n this.privSynthesisContext = new SynthesisContext(this.privSpeechSynthesizer);\n this.privAgentConfig = new AgentConfig();\n this.connectionEvents.attach((connectionEvent) => {\n if (connectionEvent.name === \"ConnectionClosedEvent\") {\n const connectionClosedEvent = connectionEvent;\n if (connectionClosedEvent.statusCode !== 1000) {\n this.cancelSynthesisLocal(CancellationReason.Error, connectionClosedEvent.statusCode === 1007 ? CancellationErrorCode.BadRequestParameters : CancellationErrorCode.ConnectionFailure, connectionClosedEvent.reason + \" websocket error code: \" + connectionClosedEvent.statusCode);\n }\n }\n });\n }\n get synthesisContext() {\n return this.privSynthesisContext;\n }\n get agentConfig() {\n return this.privAgentConfig;\n }\n get connectionEvents() {\n return this.privConnectionEvents;\n }\n get serviceEvents() {\n return this.privServiceEvents;\n }\n set activityTemplate(messagePayload) { this.privActivityTemplate = messagePayload; }\n get activityTemplate() { return this.privActivityTemplate; }\n set audioOutputFormat(format) {\n this.privAudioOutputFormat = format;\n this.privSynthesisTurn.audioOutputFormat = format;\n if (this.privSessionAudioDestination !== undefined) {\n this.privSessionAudioDestination.format = format;\n }\n if (this.synthesisContext !== undefined) {\n this.synthesisContext.audioOutputFormat = format;\n }\n }\n static addHeader(audio, format) {\n if (!format.hasHeader) {\n return audio;\n }\n format.updateHeader(audio.byteLength);\n const tmp = new Uint8Array(audio.byteLength + format.header.byteLength);\n tmp.set(new Uint8Array(format.header), 0);\n tmp.set(new Uint8Array(audio), format.header.byteLength);\n return tmp.buffer;\n }\n isDisposed() {\n return this.privIsDisposed;\n }\n dispose(reason) {\n return __awaiter(this, void 0, void 0, function* () {\n this.privIsDisposed = true;\n if (this.privSessionAudioDestination !== undefined) {\n this.privSessionAudioDestination.close();\n }\n if (this.privConnectionConfigurationPromise) {\n const connection = yield this.privConnectionConfigurationPromise;\n yield connection.dispose(reason);\n }\n });\n }\n connect() {\n return __awaiter(this, void 0, void 0, function* () {\n yield this.connectImpl();\n });\n }\n sendNetworkMessage(path, payload) {\n return __awaiter(this, void 0, void 0, function* () {\n const type = typeof payload === \"string\" ? MessageType.Text : MessageType.Binary;\n const contentType = typeof payload === \"string\" ? \"application/json\" : \"\";\n const connection = yield this.fetchConnection();\n return connection.send(new SpeechConnectionMessage(type, path, this.privSynthesisTurn.requestId, contentType, payload));\n });\n }\n Speak(text, isSSML, requestId, successCallback, errorCallBack, audioDestination) {\n return __awaiter(this, void 0, void 0, function* () {\n let ssml;\n if (isSSML) {\n ssml = text;\n }\n else {\n ssml = this.privSpeechSynthesizer.buildSsml(text);\n }\n if (this.speakOverride !== undefined) {\n return this.speakOverride(ssml, requestId, successCallback, errorCallBack);\n }\n this.privSuccessCallback = successCallback;\n this.privErrorCallback = errorCallBack;\n this.privSynthesisTurn.startNewSynthesis(requestId, text, isSSML, audioDestination);\n try {\n yield this.connectImpl();\n const connection = yield this.fetchConnection();\n yield this.sendSynthesisContext(connection);\n yield this.sendSsmlMessage(connection, ssml, requestId);\n const synthesisStartEventArgs = new SpeechSynthesisEventArgs(new SpeechSynthesisResult(requestId, ResultReason.SynthesizingAudioStarted));\n if (!!this.privSpeechSynthesizer.synthesisStarted) {\n this.privSpeechSynthesizer.synthesisStarted(this.privSpeechSynthesizer, synthesisStartEventArgs);\n }\n const messageRetrievalPromise = this.receiveMessage();\n }\n catch (e) {\n this.cancelSynthesisLocal(CancellationReason.Error, CancellationErrorCode.ConnectionFailure, e);\n return Promise.reject(e);\n }\n });\n }\n // Cancels synthesis.\n cancelSynthesis(requestId, cancellationReason, errorCode, error) {\n const properties = new PropertyCollection();\n properties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[errorCode]);\n const result = new SpeechSynthesisResult(requestId, ResultReason.Canceled, undefined, error, properties);\n if (!!this.privSpeechSynthesizer.SynthesisCanceled) {\n const cancelEvent = new SpeechSynthesisEventArgs(result);\n try {\n this.privSpeechSynthesizer.SynthesisCanceled(this.privSpeechSynthesizer, cancelEvent);\n /* tslint:disable:no-empty */\n }\n catch (_a) { }\n }\n if (!!this.privSuccessCallback) {\n try {\n this.privSuccessCallback(result);\n /* tslint:disable:no-empty */\n }\n catch (_b) { }\n }\n }\n // Cancels synthesis.\n cancelSynthesisLocal(cancellationReason, errorCode, error) {\n if (!!this.privSynthesisTurn.isSynthesizing) {\n this.privSynthesisTurn.onStopSynthesizing();\n this.cancelSynthesis(this.privSynthesisTurn.requestId, cancellationReason, errorCode, error);\n }\n }\n processTypeSpecificMessages(connectionMessage, successCallback, errorCallBack) {\n return true;\n }\n receiveMessage() {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n const connection = yield this.fetchConnection();\n const message = yield connection.read();\n if (this.receiveMessageOverride !== undefined) {\n return this.receiveMessageOverride();\n }\n if (this.privIsDisposed) {\n // We're done.\n return;\n }\n // indicates we are draining the queue and it came with no message;\n if (!message) {\n if (!this.privSynthesisTurn.isSynthesizing) {\n return;\n }\n else {\n return this.receiveMessage();\n }\n }\n this.privServiceHasSentMessage = true;\n const connectionMessage = SpeechConnectionMessage.fromConnectionMessage(message);\n if (connectionMessage.requestId.toLowerCase() === this.privSynthesisTurn.requestId.toLowerCase()) {\n switch (connectionMessage.path.toLowerCase()) {\n case \"turn.start\":\n this.privSynthesisTurn.onServiceTurnStartResponse();\n break;\n case \"response\":\n this.privSynthesisTurn.onServiceResponseMessage(connectionMessage.textBody);\n break;\n case \"audio\":\n if (this.privSynthesisTurn.streamId.toLowerCase() === connectionMessage.streamId.toLowerCase()\n && !!connectionMessage.binaryBody) {\n this.privSynthesisTurn.onAudioChunkReceived(connectionMessage.binaryBody);\n if (!!this.privSpeechSynthesizer.synthesizing) {\n try {\n const audioWithHeader = SynthesisAdapterBase.addHeader(connectionMessage.binaryBody, this.privSynthesisTurn.audioOutputFormat);\n const ev = new SpeechSynthesisEventArgs(new SpeechSynthesisResult(this.privSynthesisTurn.requestId, ResultReason.SynthesizingAudio, audioWithHeader));\n this.privSpeechSynthesizer.synthesizing(this.privSpeechSynthesizer, ev);\n }\n catch (error) {\n // Not going to let errors in the event handler\n // trip things up.\n }\n }\n if (this.privSessionAudioDestination !== undefined) {\n this.privSessionAudioDestination.write(connectionMessage.binaryBody);\n }\n }\n break;\n case \"audio.metadata\":\n const metadataList = SynthesisAudioMetadata.fromJSON(connectionMessage.textBody).Metadata;\n for (const metadata of metadataList) {\n if (metadata.Type.toLowerCase() === \"WordBoundary\".toLowerCase()) {\n this.privSynthesisTurn.onWordBoundaryEvent(metadata.Data.text.Text);\n const ev = new SpeechSynthesisWordBoundaryEventArgs(metadata.Data.Offset, metadata.Data.text.Text, metadata.Data.text.Length, this.privSynthesisTurn.currentTextOffset);\n if (!!this.privSpeechSynthesizer.wordBoundary) {\n try {\n this.privSpeechSynthesizer.wordBoundary(this.privSpeechSynthesizer, ev);\n }\n catch (error) {\n // Not going to let errors in the event handler\n // trip things up.\n }\n }\n }\n }\n break;\n case \"turn.end\":\n this.privSynthesisTurn.onServiceTurnEndResponse();\n let result;\n try {\n const audioBuffer = yield this.privSynthesisTurn.getAllReceivedAudioWithHeader();\n result = new SpeechSynthesisResult(this.privSynthesisTurn.requestId, ResultReason.SynthesizingAudioCompleted, audioBuffer);\n if (!!this.privSuccessCallback) {\n this.privSuccessCallback(result);\n }\n }\n catch (error) {\n if (!!this.privErrorCallback) {\n this.privErrorCallback(error);\n }\n }\n if (this.privSpeechSynthesizer.synthesisCompleted) {\n try {\n this.privSpeechSynthesizer.synthesisCompleted(this.privSpeechSynthesizer, new SpeechSynthesisEventArgs(result));\n }\n catch (e) {\n // Not going to let errors in the event handler\n // trip things up.\n }\n }\n break;\n default:\n if (!this.processTypeSpecificMessages(connectionMessage)) {\n // here are some messages that the derived class has not processed, dispatch them to connect class\n if (!!this.privServiceEvents) {\n this.serviceEvents.onEvent(new ServiceEvent(connectionMessage.path.toLowerCase(), connectionMessage.textBody));\n }\n }\n }\n }\n return this.receiveMessage();\n }\n catch (e) {\n // TODO: What goes here?\n }\n });\n }\n connectImpl(isUnAuthorized = false) {\n if (this.privConnectionPromise) {\n return this.privConnectionPromise.then((connection) => {\n if (connection.state() === ConnectionState.Disconnected) {\n this.privConnectionId = null;\n this.privConnectionPromise = null;\n this.privServiceHasSentMessage = false;\n return this.connectImpl();\n }\n return this.privConnectionPromise;\n }, (error) => {\n this.privConnectionId = null;\n this.privConnectionPromise = null;\n this.privServiceHasSentMessage = false;\n return this.connectImpl();\n });\n }\n this.privAuthFetchEventId = createNoDashGuid();\n this.privConnectionId = createNoDashGuid();\n this.privSynthesisTurn.onPreConnectionStart(this.privAuthFetchEventId, this.privConnectionId);\n const authPromise = isUnAuthorized ? this.privAuthentication.fetchOnExpiry(this.privAuthFetchEventId) : this.privAuthentication.fetch(this.privAuthFetchEventId);\n this.privConnectionPromise = authPromise.then((result) => __awaiter(this, void 0, void 0, function* () {\n yield this.privSynthesisTurn.onAuthCompleted(false);\n const connection = this.privConnectionFactory.create(this.privSynthesizerConfig, result, this.privConnectionId);\n // Attach to the underlying event. No need to hold onto the detach pointers as in the event the connection goes away,\n // it'll stop sending events.\n connection.events.attach((event) => {\n this.connectionEvents.onEvent(event);\n });\n const response = yield connection.open();\n if (response.statusCode === 200) {\n yield this.privSynthesisTurn.onConnectionEstablishCompleted(response.statusCode);\n return Promise.resolve(connection);\n }\n else if (response.statusCode === 403 && !isUnAuthorized) {\n return this.connectImpl(true);\n }\n else {\n yield this.privSynthesisTurn.onConnectionEstablishCompleted(response.statusCode, response.reason);\n return Promise.reject(`Unable to contact server. StatusCode: ${response.statusCode}, ${this.privSynthesizerConfig.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint)} Reason: ${response.reason}`);\n }\n }), (error) => __awaiter(this, void 0, void 0, function* () {\n yield this.privSynthesisTurn.onAuthCompleted(true, error);\n throw new Error(error);\n }));\n // Attach an empty handler to allow the promise to run in the background while\n // other startup events happen. It'll eventually be awaited on.\n this.privConnectionPromise.catch(() => { });\n return this.privConnectionPromise;\n }\n fetchConnection() {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.privConnectionConfigurationPromise) {\n return this.privConnectionConfigurationPromise.then((connection) => {\n if (connection.state() === ConnectionState.Disconnected) {\n this.privConnectionId = null;\n this.privConnectionConfigurationPromise = null;\n this.privServiceHasSentMessage = false;\n return this.fetchConnection();\n }\n return this.privConnectionConfigurationPromise;\n }, (error) => {\n this.privConnectionId = null;\n this.privConnectionConfigurationPromise = null;\n this.privServiceHasSentMessage = false;\n return this.fetchConnection();\n });\n }\n this.privConnectionConfigurationPromise = this.configureConnection();\n return yield this.privConnectionConfigurationPromise;\n });\n }\n // Takes an established websocket connection to the endpoint and sends speech configuration information.\n configureConnection() {\n return __awaiter(this, void 0, void 0, function* () {\n const connection = yield this.connectImpl();\n if (this.configConnectionOverride !== undefined) {\n return this.configConnectionOverride(connection);\n }\n yield this.sendSpeechServiceConfig(connection, this.privSynthesizerConfig.SpeechServiceConfig.serialize());\n return connection;\n });\n }\n}\nSynthesisAdapterBase.telemetryDataEnabled = true;\n\n//# sourceMappingURL=SynthesisAdapterBase.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n/**\n * @class SynthesisStatus\n * @private\n */\nexport var SynthesisStatus;\n(function (SynthesisStatus) {\n /**\n * The response contains valid audio data.\n * @member SynthesisStatus.Success\n */\n SynthesisStatus[SynthesisStatus[\"Success\"] = 0] = \"Success\";\n /**\n * Indicates the end of audio data. No valid audio data is included in the message.\n * @member SynthesisStatus.SynthesisEnd\n */\n SynthesisStatus[SynthesisStatus[\"SynthesisEnd\"] = 1] = \"SynthesisEnd\";\n /**\n * Indicates an error occurred during synthesis data processing.\n * @member SynthesisStatus.Error\n */\n SynthesisStatus[SynthesisStatus[\"Error\"] = 2] = \"Error\";\n})(SynthesisStatus || (SynthesisStatus = {}));\nexport var RecognitionStatus;\n(function (RecognitionStatus) {\n RecognitionStatus[RecognitionStatus[\"Success\"] = 0] = \"Success\";\n RecognitionStatus[RecognitionStatus[\"NoMatch\"] = 1] = \"NoMatch\";\n RecognitionStatus[RecognitionStatus[\"InitialSilenceTimeout\"] = 2] = \"InitialSilenceTimeout\";\n RecognitionStatus[RecognitionStatus[\"BabbleTimeout\"] = 3] = \"BabbleTimeout\";\n RecognitionStatus[RecognitionStatus[\"Error\"] = 4] = \"Error\";\n RecognitionStatus[RecognitionStatus[\"EndOfDictation\"] = 5] = \"EndOfDictation\";\n RecognitionStatus[RecognitionStatus[\"TooManyRequests\"] = 6] = \"TooManyRequests\";\n})(RecognitionStatus || (RecognitionStatus = {}));\n\n//# sourceMappingURL=Enums.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n/** Users participating in the conversation */\nexport class InternalParticipants {\n constructor(participants = [], meId) {\n this.participants = participants;\n this.meId = meId;\n }\n /**\n * Add or update a participant\n * @param value\n */\n addOrUpdateParticipant(value) {\n if (value === undefined) {\n return;\n }\n const exists = this.getParticipantIndex(value.id);\n if (exists > -1) {\n this.participants.splice(exists, 1, value);\n }\n else {\n this.participants.push(value);\n }\n // ensure it was added ok\n return this.getParticipant(value.id);\n }\n /**\n * Find the participant's position in the participants list.\n * @param id\n */\n getParticipantIndex(id) {\n return this.participants.findIndex((p) => p.id === id);\n }\n /**\n * Find the participant by id.\n * @param id\n */\n getParticipant(id) {\n return this.participants.find((p) => p.id === id);\n }\n /***\n * Remove a participant from the participants list.\n */\n deleteParticipant(id) {\n this.participants = this.participants.filter((p) => p.id !== id);\n }\n /***\n * Helper to return the conversation host.\n */\n get host() {\n return this.participants.find((p) => p.isHost === true);\n }\n /**\n * Helper to return the current user.\n */\n get me() {\n return this.getParticipant(this.meId);\n }\n}\n/**\n * List of command message types\n */\nexport const ConversationTranslatorMessageTypes = {\n command: \"command\",\n final: \"final\",\n info: \"info\",\n instantMessage: \"instant_message\",\n partial: \"partial\",\n participantCommand: \"participant_command\",\n translatedMessage: \"translated_message\"\n};\n/**\n * List of command types\n */\nexport const ConversationTranslatorCommandTypes = {\n changeNickname: \"ChangeNickname\",\n disconnectSession: \"DisconnectSession\",\n ejectParticipant: \"EjectParticipant\",\n instant_message: \"instant_message\",\n joinSession: \"JoinSession\",\n leaveSession: \"LeaveSession\",\n participantList: \"ParticipantList\",\n roomExpirationWarning: \"RoomExpirationWarning\",\n setLockState: \"SetLockState\",\n setMute: \"SetMute\",\n setMuteAll: \"SetMuteAll\",\n setProfanityFiltering: \"SetProfanityFiltering\",\n setTranslateToLanguages: \"SetTranslateToLanguages\",\n setUseTTS: \"SetUseTTS\"\n};\n\n//# sourceMappingURL=ConversationTranslatorInterfaces.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nexport class TurnStatusResponsePayload {\n constructor(json) {\n this.privMessageStatusResponse = JSON.parse(json);\n }\n static fromJSON(json) {\n return new TurnStatusResponsePayload(json);\n }\n get interactionId() {\n return this.privMessageStatusResponse.interactionId;\n }\n get conversationId() {\n return this.privMessageStatusResponse.conversationId;\n }\n get statusCode() {\n // Payloads may contain a limited set of textual representations or a numeric status\n // code. The textual values are here converted into numeric ones.\n switch (this.privMessageStatusResponse.statusCode) {\n case \"Success\":\n return 200;\n case \"Failed\":\n return 400;\n case \"TimedOut\":\n return 429;\n default:\n return this.privMessageStatusResponse.statusCode;\n }\n }\n}\n\n//# sourceMappingURL=TurnStatusPayload.js.map\n"],"sourceRoot":""}