{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./bundleApp.js","webpack:///microsoft.cognitiveservices.speech.sdk.ts","webpack:///src/common.browser/Exports.ts","webpack:///src/common.browser/ConsoleLoggingListener.ts","webpack:///src/common/Exports.ts","webpack:///src/common/AudioSourceEvents.ts","webpack:///src/common/PlatformEvent.ts","webpack:///src/common/Guid.ts","webpack:///src/common/ConnectionEvents.ts","webpack:///src/common/ConnectionMessage.ts","webpack:///src/common/Error.ts","webpack:///src/common/ConnectionOpenResponse.ts","webpack:///src/common/Events.ts","webpack:///src/common/EventSource.ts","webpack:///src/common/IConnection.ts","webpack:///src/common/List.ts","webpack:///src/common/Promise.ts","webpack:///src/common/Queue.ts","webpack:///src/common/RawWebsocketMessage.ts","webpack:///src/common/RiffPcmEncoder.ts","webpack:///src/common/Stream.ts","webpack:///src/common.speech/TranslationStatus.ts","webpack:///src/common/ChunkedArrayBufferStream.ts","webpack:///src/common.browser/MicAudioSource.ts","webpack:///src/sdk/Audio/AudioStreamFormat.ts","webpack:///src/common.speech/Exports.ts","webpack:///src/common.speech/CognitiveSubscriptionKeyAuthentication.ts","webpack:///src/common.speech/IAuthentication.ts","webpack:///src/common.speech/CognitiveTokenAuthentication.ts","webpack:///src/common.speech/IntentConnectionFactory.ts","webpack:///src/sdk/Exports.ts","webpack:///src/sdk/Audio/AudioConfig.ts","webpack:///src/sdk/Contracts.ts","webpack:///src/sdk/Audio/AudioInputStream.ts","webpack:///src/sdk/CancellationReason.ts","webpack:///src/sdk/Audio/PullAudioInputStreamCallback.ts","webpack:///src/sdk/KeywordRecognitionModel.ts","webpack:///src/sdk/SessionEventArgs.ts","webpack:///src/sdk/RecognitionEventArgs.ts","webpack:///src/sdk/OutputFormat.ts","webpack:///src/sdk/IntentRecognitionEventArgs.ts","webpack:///src/sdk/RecognitionResult.ts","webpack:///src/sdk/SpeechRecognitionResult.ts","webpack:///src/sdk/IntentRecognitionResult.ts","webpack:///src/sdk/LanguageUnderstandingModel.ts","webpack:///src/sdk/SpeechRecognitionEventArgs.ts","webpack:///src/sdk/SpeechRecognitionCanceledEventArgs.ts","webpack:///src/sdk/TranslationRecognitionEventArgs.ts","webpack:///src/sdk/TranslationSynthesisEventArgs.ts","webpack:///src/sdk/TranslationRecognitionResult.ts","webpack:///src/sdk/TranslationSynthesisResult.ts","webpack:///src/sdk/ResultReason.ts","webpack:///src/sdk/SpeechConfig.ts","webpack:///src/sdk/SpeechTranslationConfig.ts","webpack:///src/sdk/PropertyCollection.ts","webpack:///src/sdk/PropertyId.ts","webpack:///src/sdk/Recognizer.ts","webpack:///src/sdk/SpeechRecognizer.ts","webpack:///src/common.speech/SpeechConnectionFactory.ts","webpack:///src/common.speech/ConnectionFactoryBase.ts","webpack:///src/common.speech/QueryParameterNames.ts","webpack:///src/sdk/IntentRecognizer.ts","webpack:///src/sdk/TranslationRecognizer.ts","webpack:///src/sdk/Translations.ts","webpack:///src/sdk/NoMatchReason.ts","webpack:///src/sdk/NoMatchDetails.ts","webpack:///src/sdk/TranslationRecognitionCanceledEventArgs.ts","webpack:///src/sdk/IntentRecognitionCanceledEventArgs.ts","webpack:///src/sdk/CancellationDetails.ts","webpack:///src/sdk/CancellationErrorCodes.ts","webpack:///src/sdk/ConnectionEventArgs.ts","webpack:///src/sdk/Connection.ts","webpack:///src/sdk/PhraseListGrammar.ts","webpack:///src/sdk/ServicePropertyChannel.ts","webpack:///src/sdk/ProfanityOption.ts","webpack:///src/common.speech/RecognitionEvents.ts","webpack:///src/common.speech/ServiceRecognizerBase.ts","webpack:///src/common.speech/SpeechConnectionMessage.Internal.ts","webpack:///src/common.speech/RecognizerConfig.ts","webpack:///src/common.speech/WebsocketMessageFormatter.ts","webpack:///src/common.speech/TranslationConnectionFactory.ts","webpack:///src/common.speech/EnumTranslation.ts","webpack:///src/common.speech/ServiceMessages/Enums.ts","webpack:///src/common.speech/ServiceMessages/TranslationSynthesisEnd.ts","webpack:///src/common.speech/ServiceMessages/TranslationHypothesis.ts","webpack:///src/common.speech/ServiceMessages/TranslationPhrase.ts","webpack:///src/common.speech/TranslationServiceRecognizer.ts","webpack:///src/common.speech/ServiceMessages/SpeechDetected.ts","webpack:///src/common.speech/ServiceMessages/SpeechHypothesis.ts","webpack:///src/common.speech/SpeechServiceRecognizer.ts","webpack:///src/common.speech/ServiceMessages/DetailedSpeechPhrase.ts","webpack:///src/common.speech/ServiceMessages/SimpleSpeechPhrase.ts","webpack:///src/common.speech/AddedLmIntent.ts","webpack:///src/common.speech/IntentServiceRecognizer.ts","webpack:///src/common.speech/ServiceMessages/IntentResponse.ts","webpack:///src/common.speech/RequestSession.ts","webpack:///src/common.speech/ServiceTelemetryListener.Internal.ts","webpack:///src/common.speech/SpeechContext.ts","webpack:///src/common.speech/DynamicGrammarBuilder.ts","webpack:///src/common.browser/FileAudioSource.ts","webpack:///src/common.browser/PCMRecorder.ts","webpack:///src/common.browser/WebsocketConnection.ts","webpack:///src/common.browser/WebsocketMessageAdapter.ts","webpack:///./node_modules/buffer/index.js","webpack:///(webpack)/buildin/global.js","webpack:///./node_modules/base64-js/index.js","webpack:///./node_modules/ieee754/index.js","webpack:///./node_modules/isarray/index.js","webpack:///https-proxy-agent (ignored)","webpack:///ws (ignored)","webpack:///../../external/ocsp/ocsp (ignored)","webpack:///src/common.browser/ReplayableAudioNode.ts","webpack:///src/common.browser/ProxyInfo.ts"],"names":[],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAyC,iCAAiC;AAC1E,wHAAgH,mBAAmB,EAAE;AACrI;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C;QAChD,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;IACvB,CAAC;IAED,sBAAW,0CAAK;aAAhB;YACI,OAAO,IAAI,CAAC,mBAAmB,CAAC;QACpC,CAAC;;;OAAA;IAyMD,sBAAW,2CAAM;aAAjB;YACI,OAAO,IAAI,CAAC,oBAAoB,CAAC;QACrC,CAAC;;;OAAA;IArOa,yCAAiB,GAAY,KAAK,CAAC;IA+RrD,8BAAC;CAAA;AA9SY,0DAAuB;;;;;;;;;;ACvCpC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEY;;AAEZ,aAAa,mBAAO,CAAC,GAAW;AAChC,cAAc,mBAAO,CAAC,GAAS;AAC/B,cAAc,mBAAO,CAAC,GAAS;;AAE/B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,mDAAmD;AACxE;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,UAAU;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,uCAAuC,SAAS;AAChD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;;AAEA;AACA;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gDAAgD,EAAE;AAClD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,wBAAwB,eAAe;AACvC;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,wBAAwB,QAAQ;AAChC;AACA,qBAAqB,eAAe;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,mBAAmB,cAAc;AACjC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uDAAuD,OAAO;AAC9D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA,uDAAuD,OAAO;AAC9D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,qBAAqB,QAAQ;AAC7B;AACA;AACA,GAAG;AACH;AACA,eAAe,SAAS;AACxB;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,YAAY;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,iBAAiB,gBAAgB;AACjC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,gBAAgB;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;AC5vDA;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C;;;;;;;;ACnBY;;AAEZ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kCAAkC,SAAS;AAC3C;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,SAAS;AAC9B;AACA;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;QAC9B,CAAC;;;OAAA;IAED,sBAAW,+BAAQ;aAAnB;YACI,OAAO,IAAI,CAAC,iBAAiB,CAAC;QAClC,CAAC;;;OAAA;IAED,sBAAW,+BAAQ;aAAnB;YACI,OAAO,IAAI,CAAC,iBAAiB,CAAC;QAClC,CAAC;;;OAAA;IACL,gBAAC;AAAD,CAAC;AAnCY,8BAAS","file":"microsoft.cognitiveservices.speech.sdk.bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nwindow.SpeechSDK = require('./distrib/lib/microsoft.cognitiveservices.speech.sdk.js');\r\n\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\nimport { ConsoleLoggingListener } from \"./src/common.browser/Exports\";\r\nimport { Events } from \"./src/common/Exports\";\r\n\r\n// Common.Storage.SetLocalStorage(new Common.Browser.LocalStorage());\r\n// Common.Storage.SetSessionStorage(new Common.Browser.SessionStorage());\r\nEvents.instance.attachListener(new ConsoleLoggingListener());\r\n\r\n// Speech SDK API\r\nexport * from \"./src/sdk/Exports\";\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport * from \"./ConsoleLoggingListener\";\r\nexport * from \"./IRecorder\";\r\nexport * from \"./MicAudioSource\";\r\nexport * from \"./FileAudioSource\";\r\nexport * from \"./PCMRecorder\";\r\nexport * from \"./WebsocketConnection\";\r\nexport * from \"./WebsocketMessageAdapter\";\r\nexport * from \"./ReplayableAudioNode\";\r\nexport * from \"./ProxyInfo\";\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { EventType, IEventListener, PlatformEvent } from \"../common/Exports\";\r\n\r\nexport class ConsoleLoggingListener implements IEventListener {\r\n private privLogLevelFilter: EventType;\r\n\r\n public constructor(logLevelFilter: EventType = EventType.Warning) {\r\n this.privLogLevelFilter = logLevelFilter;\r\n }\r\n\r\n public onEvent = (event: PlatformEvent): void => {\r\n if (event.eventType >= this.privLogLevelFilter) {\r\n const log = this.toString(event);\r\n\r\n switch (event.eventType) {\r\n case EventType.Debug:\r\n // tslint:disable-next-line:no-console\r\n console.debug(log);\r\n break;\r\n case EventType.Info:\r\n // tslint:disable-next-line:no-console\r\n console.info(log);\r\n break;\r\n case EventType.Warning:\r\n // tslint:disable-next-line:no-console\r\n console.warn(log);\r\n break;\r\n case EventType.Error:\r\n // tslint:disable-next-line:no-console\r\n console.error(log);\r\n break;\r\n default:\r\n // tslint:disable-next-line:no-console\r\n console.log(log);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n private toString = (event: any): string => {\r\n const logFragments = [\r\n `${event.EventTime}`,\r\n `${event.Name}`,\r\n ];\r\n\r\n for (const prop in event) {\r\n if (prop && event.hasOwnProperty(prop) &&\r\n prop !== \"eventTime\" && prop !== \"eventType\" &&\r\n prop !== \"eventId\" && prop !== \"name\" &&\r\n prop !== \"constructor\") {\r\n const value = event[prop];\r\n let valueToLog = \"\";\r\n if (value !== undefined && value !== null) {\r\n if (typeof (value) === \"number\" || typeof (value) === \"string\") {\r\n valueToLog = value.toString();\r\n } else {\r\n valueToLog = JSON.stringify(value);\r\n }\r\n }\r\n\r\n logFragments.push(`${prop}: ${valueToLog}`);\r\n }\r\n\r\n }\r\n\r\n return logFragments.join(\" | \");\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport * from \"./AudioSourceEvents\";\r\nexport * from \"./ConnectionEvents\";\r\nexport * from \"./ConnectionMessage\";\r\nexport * from \"./ConnectionOpenResponse\";\r\nexport * from \"./Error\";\r\nexport * from \"./Events\";\r\nexport * from \"./EventSource\";\r\nexport * from \"./Guid\";\r\nexport * from \"./IAudioSource\";\r\nexport * from \"./IConnection\";\r\nexport * from \"./IDetachable\";\r\nexport * from \"./IDictionary\";\r\nexport * from \"./IDisposable\";\r\nexport * from \"./IEventSource\";\r\nexport * from \"./ITimer\";\r\nexport * from \"./IWebsocketMessageFormatter\";\r\nexport * from \"./List\";\r\nexport * from \"./PlatformEvent\";\r\nexport * from \"./Promise\";\r\nexport * from \"./Queue\";\r\nexport * from \"./RawWebsocketMessage\";\r\nexport * from \"./RiffPcmEncoder\";\r\nexport * from \"./Stream\";\r\nexport { TranslationStatus } from \"../common.speech/TranslationStatus\";\r\nexport * from \"./ChunkedArrayBufferStream\";\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { EventType, PlatformEvent } from \"./PlatformEvent\";\r\n\r\nexport class AudioSourceEvent extends PlatformEvent {\r\n private privAudioSourceId: string;\r\n\r\n constructor(eventName: string, audioSourceId: string, eventType: EventType = EventType.Info) {\r\n super(eventName, eventType);\r\n this.privAudioSourceId = audioSourceId;\r\n }\r\n\r\n public get audioSourceId(): string {\r\n return this.privAudioSourceId;\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class AudioSourceInitializingEvent extends AudioSourceEvent {\r\n constructor(audioSourceId: string) {\r\n super(\"AudioSourceInitializingEvent\", audioSourceId);\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class AudioSourceReadyEvent extends AudioSourceEvent {\r\n constructor(audioSourceId: string) {\r\n super(\"AudioSourceReadyEvent\", audioSourceId);\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class AudioSourceOffEvent extends AudioSourceEvent {\r\n constructor(audioSourceId: string) {\r\n super(\"AudioSourceOffEvent\", audioSourceId);\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class AudioSourceErrorEvent extends AudioSourceEvent {\r\n private privError: string;\r\n\r\n constructor(audioSourceId: string, error: string) {\r\n super(\"AudioSourceErrorEvent\", audioSourceId, EventType.Error);\r\n this.privError = error;\r\n }\r\n\r\n public get error(): string {\r\n return this.privError;\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class AudioStreamNodeEvent extends AudioSourceEvent {\r\n private privAudioNodeId: string;\r\n\r\n constructor(eventName: string, audioSourceId: string, audioNodeId: string) {\r\n super(eventName, audioSourceId);\r\n this.privAudioNodeId = audioNodeId;\r\n }\r\n\r\n public get audioNodeId(): string {\r\n return this.privAudioNodeId;\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class AudioStreamNodeAttachingEvent extends AudioStreamNodeEvent {\r\n constructor(audioSourceId: string, audioNodeId: string) {\r\n super(\"AudioStreamNodeAttachingEvent\", audioSourceId, audioNodeId);\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class AudioStreamNodeAttachedEvent extends AudioStreamNodeEvent {\r\n constructor(audioSourceId: string, audioNodeId: string) {\r\n super(\"AudioStreamNodeAttachedEvent\", audioSourceId, audioNodeId);\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class AudioStreamNodeDetachedEvent extends AudioStreamNodeEvent {\r\n constructor(audioSourceId: string, audioNodeId: string) {\r\n super(\"AudioStreamNodeDetachedEvent\", audioSourceId, audioNodeId);\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class AudioStreamNodeErrorEvent extends AudioStreamNodeEvent {\r\n private privError: string;\r\n\r\n constructor(audioSourceId: string, audioNodeId: string, error: string) {\r\n super(\"AudioStreamNodeErrorEvent\", audioSourceId, audioNodeId);\r\n this.privError = error;\r\n }\r\n\r\n public get error(): string {\r\n return this.privError;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { createNoDashGuid } from \"./Guid\";\r\nimport { IStringDictionary } from \"./IDictionary\";\r\n\r\nexport enum EventType {\r\n Debug,\r\n Info,\r\n Warning,\r\n Error,\r\n}\r\n\r\nexport class PlatformEvent {\r\n private privName: string;\r\n private privEventId: string;\r\n private privEventTime: string;\r\n private privEventType: EventType;\r\n private privMetadata: IStringDictionary;\r\n\r\n constructor(eventName: string, eventType: EventType) {\r\n this.privName = eventName;\r\n this.privEventId = createNoDashGuid();\r\n this.privEventTime = new Date().toISOString();\r\n this.privEventType = eventType;\r\n this.privMetadata = { };\r\n }\r\n\r\n public get name(): string {\r\n return this.privName;\r\n }\r\n\r\n public get eventId(): string {\r\n return this.privEventId;\r\n }\r\n\r\n public get eventTime(): string {\r\n return this.privEventTime;\r\n }\r\n\r\n public get eventType(): EventType {\r\n return this.privEventType;\r\n }\r\n\r\n public get metadata(): IStringDictionary {\r\n return this.privMetadata;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nconst createGuid: () => string = (): string => {\r\n let d = new Date().getTime();\r\n const guid = \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c: string) => {\r\n const r = (d + Math.random() * 16) % 16 | 0;\r\n d = Math.floor(d / 16);\r\n return (c === \"x\" ? r : (r & 0x3 | 0x8)).toString(16);\r\n });\r\n\r\n return guid;\r\n};\r\n\r\nconst createNoDashGuid: () => string = (): string => {\r\n return createGuid().replace(new RegExp(\"-\", \"g\"), \"\").toUpperCase();\r\n};\r\n\r\nexport { createGuid, createNoDashGuid };\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ConnectionMessage } from \"./ConnectionMessage\";\r\nimport { IStringDictionary } from \"./IDictionary\";\r\nimport { EventType, PlatformEvent } from \"./PlatformEvent\";\r\n\r\nexport class ConnectionEvent extends PlatformEvent {\r\n private privConnectionId: string;\r\n\r\n constructor(eventName: string, connectionId: string, eventType: EventType = EventType.Info) {\r\n super(eventName, eventType);\r\n this.privConnectionId = connectionId;\r\n }\r\n\r\n public get connectionId(): string {\r\n return this.privConnectionId;\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class ConnectionStartEvent extends ConnectionEvent {\r\n private privUri: string;\r\n private privHeaders: IStringDictionary;\r\n\r\n constructor(connectionId: string, uri: string, headers?: IStringDictionary) {\r\n super(\"ConnectionStartEvent\", connectionId);\r\n this.privUri = uri;\r\n this.privHeaders = headers;\r\n }\r\n\r\n public get uri(): string {\r\n return this.privUri;\r\n }\r\n\r\n public get headers(): IStringDictionary {\r\n return this.privHeaders;\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class ConnectionEstablishedEvent extends ConnectionEvent {\r\n constructor(connectionId: string, metadata?: IStringDictionary) {\r\n super(\"ConnectionEstablishedEvent\", connectionId);\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class ConnectionClosedEvent extends ConnectionEvent {\r\n private privRreason: string;\r\n private privStatusCode: number;\r\n\r\n constructor(connectionId: string, statusCode: number, reason: string) {\r\n super(\"ConnectionClosedEvent\", connectionId, EventType.Debug);\r\n this.privRreason = reason;\r\n this.privStatusCode = statusCode;\r\n }\r\n\r\n public get reason(): string {\r\n return this.privRreason;\r\n }\r\n\r\n public get statusCode(): number {\r\n return this.privStatusCode;\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class ConnectionEstablishErrorEvent extends ConnectionEvent {\r\n private privStatusCode: number;\r\n private privReason: string;\r\n\r\n constructor(connectionId: string, statuscode: number, reason: string) {\r\n super(\"ConnectionEstablishErrorEvent\", connectionId, EventType.Error);\r\n this.privStatusCode = statuscode;\r\n this.privReason = reason;\r\n }\r\n\r\n public get reason(): string {\r\n return this.privReason;\r\n }\r\n\r\n public get statusCode(): number {\r\n return this.privStatusCode;\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class ConnectionMessageReceivedEvent extends ConnectionEvent {\r\n private privNetworkReceivedTime: string;\r\n private privMessage: ConnectionMessage;\r\n\r\n constructor(connectionId: string, networkReceivedTimeISO: string, message: ConnectionMessage) {\r\n super(\"ConnectionMessageReceivedEvent\", connectionId);\r\n this.privNetworkReceivedTime = networkReceivedTimeISO;\r\n this.privMessage = message;\r\n }\r\n\r\n public get networkReceivedTime(): string {\r\n return this.privNetworkReceivedTime;\r\n }\r\n\r\n public get message(): ConnectionMessage {\r\n return this.privMessage;\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class ConnectionMessageSentEvent extends ConnectionEvent {\r\n private privNetworkSentTime: string;\r\n private privMessage: ConnectionMessage;\r\n\r\n constructor(connectionId: string, networkSentTimeISO: string, message: ConnectionMessage) {\r\n super(\"ConnectionMessageSentEvent\", connectionId);\r\n this.privNetworkSentTime = networkSentTimeISO;\r\n this.privMessage = message;\r\n }\r\n\r\n public get networkSentTime(): string {\r\n return this.privNetworkSentTime;\r\n }\r\n\r\n public get message(): ConnectionMessage {\r\n return this.privMessage;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { InvalidOperationError } from \"./Error\";\r\nimport { createNoDashGuid } from \"./Guid\";\r\nimport { IStringDictionary } from \"./IDictionary\";\r\n\r\nexport enum MessageType {\r\n Text,\r\n Binary,\r\n}\r\n\r\nexport class ConnectionMessage {\r\n\r\n private privMessageType: MessageType;\r\n private privHeaders: IStringDictionary;\r\n private privBody: any = null;\r\n\r\n private privId: string;\r\n\r\n public constructor(\r\n messageType: MessageType,\r\n body: any,\r\n headers?: IStringDictionary,\r\n id?: string) {\r\n\r\n if (messageType === MessageType.Text && body && !(typeof (body) === \"string\")) {\r\n throw new InvalidOperationError(\"Payload must be a string\");\r\n }\r\n\r\n if (messageType === MessageType.Binary && body && !(body instanceof ArrayBuffer)) {\r\n throw new InvalidOperationError(\"Payload must be ArrayBuffer\");\r\n }\r\n\r\n this.privMessageType = messageType;\r\n this.privBody = body;\r\n this.privHeaders = headers ? headers : {};\r\n this.privId = id ? id : createNoDashGuid();\r\n }\r\n\r\n public get messageType(): MessageType {\r\n return this.privMessageType;\r\n }\r\n\r\n public get headers(): any {\r\n return this.privHeaders;\r\n }\r\n\r\n public get body(): any {\r\n return this.privBody;\r\n }\r\n\r\n public get textBody(): string {\r\n if (this.privMessageType === MessageType.Binary) {\r\n throw new InvalidOperationError(\"Not supported for binary message\");\r\n }\r\n\r\n return this.privBody as string;\r\n }\r\n\r\n public get binaryBody(): ArrayBuffer {\r\n if (this.privMessageType === MessageType.Text) {\r\n throw new InvalidOperationError(\"Not supported for text message\");\r\n }\r\n\r\n return this.privBody;\r\n }\r\n\r\n public get id(): string {\r\n return this.privId;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * The error that is thrown when an argument passed in is null.\r\n *\r\n * @export\r\n * @class ArgumentNullError\r\n * @extends {Error}\r\n */\r\nexport class ArgumentNullError extends Error {\r\n\r\n /**\r\n * Creates an instance of ArgumentNullError.\r\n *\r\n * @param {string} argumentName - Name of the argument that is null\r\n *\r\n * @memberOf ArgumentNullError\r\n */\r\n public constructor(argumentName: string) {\r\n super(argumentName);\r\n this.name = \"ArgumentNull\";\r\n this.message = argumentName;\r\n }\r\n}\r\n\r\n/**\r\n * The error that is thrown when an invalid operation is performed in the code.\r\n *\r\n * @export\r\n * @class InvalidOperationError\r\n * @extends {Error}\r\n */\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class InvalidOperationError extends Error {\r\n\r\n /**\r\n * Creates an instance of InvalidOperationError.\r\n *\r\n * @param {string} error - The error\r\n *\r\n * @memberOf InvalidOperationError\r\n */\r\n public constructor(error: string) {\r\n super(error);\r\n this.name = \"InvalidOperation\";\r\n this.message = error;\r\n }\r\n}\r\n\r\n/**\r\n * The error that is thrown when an object is disposed.\r\n *\r\n * @export\r\n * @class ObjectDisposedError\r\n * @extends {Error}\r\n */\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class ObjectDisposedError extends Error {\r\n\r\n /**\r\n * Creates an instance of ObjectDisposedError.\r\n *\r\n * @param {string} objectName - The object that is disposed\r\n * @param {string} error - The error\r\n *\r\n * @memberOf ObjectDisposedError\r\n */\r\n public constructor(objectName: string, error?: string) {\r\n super(error);\r\n this.name = objectName + \"ObjectDisposed\";\r\n this.message = error;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport class ConnectionOpenResponse {\r\n private privStatusCode: number;\r\n private privReason: string;\r\n\r\n constructor(statusCode: number, reason: string) {\r\n this.privStatusCode = statusCode;\r\n this.privReason = reason;\r\n }\r\n\r\n public get statusCode(): number {\r\n return this.privStatusCode;\r\n }\r\n\r\n public get reason(): string {\r\n return this.privReason;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ArgumentNullError } from \"./Error\";\r\nimport { EventSource } from \"./EventSource\";\r\nimport { IEventSource } from \"./IEventSource\";\r\nimport { PlatformEvent } from \"./PlatformEvent\";\r\n\r\nexport class Events {\r\n private static privInstance: IEventSource = new EventSource();\r\n\r\n public static setEventSource = (eventSource: IEventSource): void => {\r\n if (!eventSource) {\r\n throw new ArgumentNullError(\"eventSource\");\r\n }\r\n\r\n Events.privInstance = eventSource;\r\n }\r\n\r\n public static get instance(): IEventSource {\r\n return Events.privInstance;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ObjectDisposedError } from \"./Error\";\r\nimport { createNoDashGuid } from \"./Guid\";\r\nimport { IDetachable } from \"./IDetachable\";\r\nimport { IStringDictionary } from \"./IDictionary\";\r\nimport { IEventListener, IEventSource } from \"./IEventSource\";\r\nimport { PlatformEvent } from \"./PlatformEvent\";\r\n\r\nexport class EventSource implements IEventSource {\r\n private privEventListeners: IStringDictionary<(event: TEvent) => void> = {};\r\n private privMetadata: IStringDictionary;\r\n private privIsDisposed: boolean = false;\r\n\r\n constructor(metadata?: IStringDictionary) {\r\n this.privMetadata = metadata;\r\n }\r\n\r\n public onEvent = (event: TEvent): void => {\r\n if (this.isDisposed()) {\r\n throw (new ObjectDisposedError(\"EventSource\"));\r\n }\r\n\r\n if (this.metadata) {\r\n for (const paramName in this.metadata) {\r\n if (paramName) {\r\n if (event.metadata) {\r\n if (!event.metadata[paramName]) {\r\n event.metadata[paramName] = this.metadata[paramName];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (const eventId in this.privEventListeners) {\r\n if (eventId && this.privEventListeners[eventId]) {\r\n this.privEventListeners[eventId](event);\r\n }\r\n }\r\n }\r\n\r\n public attach = (onEventCallback: (event: TEvent) => void): IDetachable => {\r\n const id = createNoDashGuid();\r\n this.privEventListeners[id] = onEventCallback;\r\n return {\r\n detach: () => {\r\n delete this.privEventListeners[id];\r\n },\r\n };\r\n }\r\n\r\n public attachListener = (listener: IEventListener): IDetachable => {\r\n return this.attach(listener.onEvent);\r\n }\r\n\r\n public isDisposed = (): boolean => {\r\n return this.privIsDisposed;\r\n }\r\n\r\n public dispose = (): void => {\r\n this.privEventListeners = null;\r\n this.privIsDisposed = true;\r\n }\r\n\r\n public get metadata(): IStringDictionary {\r\n return this.privMetadata;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ConnectionEvent } from \"./ConnectionEvents\";\r\nimport { ConnectionMessage } from \"./ConnectionMessage\";\r\nimport { ConnectionOpenResponse } from \"./ConnectionOpenResponse\";\r\nimport { EventSource } from \"./EventSource\";\r\nimport { IDisposable } from \"./IDisposable\";\r\nimport { Promise } from \"./Promise\";\r\n\r\nexport enum ConnectionState {\r\n None,\r\n Connected,\r\n Connecting,\r\n Disconnected,\r\n}\r\n\r\nexport interface IConnection extends IDisposable {\r\n id: string;\r\n state(): ConnectionState;\r\n open(): Promise;\r\n send(message: ConnectionMessage): Promise;\r\n read(): Promise;\r\n events: EventSource;\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ObjectDisposedError } from \"./Error\";\r\nimport { IDetachable } from \"./IDetachable\";\r\nimport { IStringDictionary } from \"./IDictionary\";\r\nimport { IDisposable } from \"./IDisposable\";\r\n\r\nexport interface IList extends IDisposable {\r\n get(itemIndex: number): TItem;\r\n first(): TItem;\r\n last(): TItem;\r\n\r\n add(item: TItem): void;\r\n insertAt(index: number, item: TItem): void;\r\n\r\n removeFirst(): TItem;\r\n removeLast(): TItem;\r\n removeAt(index: number): TItem;\r\n remove(index: number, count: number): TItem[];\r\n clear(): void;\r\n\r\n length(): number;\r\n\r\n onAdded(addedCallback: () => void): IDetachable;\r\n onRemoved(removedCallback: () => void): IDetachable;\r\n onDisposed(disposedCallback: () => void): IDetachable;\r\n\r\n join(seperator?: string): string;\r\n\r\n toArray(): TItem[];\r\n\r\n any(callback?: (item: TItem, index: number) => boolean): boolean;\r\n all(callback: (item: TItem) => boolean): boolean;\r\n forEach(callback: (item: TItem, index: number) => void): void;\r\n select(callback: (item: TItem, index: number) => T2): List;\r\n where(callback: (item: TItem, index: number) => boolean): List;\r\n orderBy(compareFn: (a: TItem, b: TItem) => number): List;\r\n orderByDesc(compareFn: (a: TItem, b: TItem) => number): List;\r\n clone(): List;\r\n concat(list: List): List;\r\n concatArray(array: TItem[]): List;\r\n}\r\n\r\nexport class List implements IList {\r\n private privList: TItem[];\r\n private privSubscriptionIdCounter: number = 0;\r\n private privAddSubscriptions: IStringDictionary<() => void> = {};\r\n private privRemoveSubscriptions: IStringDictionary<() => void> = {};\r\n private privDisposedSubscriptions: IStringDictionary<() => void> = {};\r\n private privDisposeReason: string = null;\r\n\r\n public constructor(list?: TItem[]) {\r\n this.privList = [];\r\n // copy the list rather than taking as is.\r\n if (list) {\r\n for (const item of list) {\r\n this.privList.push(item);\r\n }\r\n }\r\n }\r\n\r\n public get = (itemIndex: number): TItem => {\r\n this.throwIfDisposed();\r\n return this.privList[itemIndex];\r\n }\r\n\r\n public first = (): TItem => {\r\n return this.get(0);\r\n }\r\n\r\n public last = (): TItem => {\r\n return this.get(this.length() - 1);\r\n }\r\n\r\n public add = (item: TItem): void => {\r\n this.throwIfDisposed();\r\n this.insertAt(this.privList.length, item);\r\n }\r\n\r\n public insertAt = (index: number, item: TItem): void => {\r\n this.throwIfDisposed();\r\n if (index === 0) {\r\n this.privList.unshift(item);\r\n } else if (index === this.privList.length) {\r\n this.privList.push(item);\r\n } else {\r\n this.privList.splice(index, 0, item);\r\n }\r\n this.triggerSubscriptions(this.privAddSubscriptions);\r\n }\r\n\r\n public removeFirst = (): TItem => {\r\n this.throwIfDisposed();\r\n return this.removeAt(0);\r\n }\r\n\r\n public removeLast = (): TItem => {\r\n this.throwIfDisposed();\r\n return this.removeAt(this.length() - 1);\r\n }\r\n\r\n public removeAt = (index: number): TItem => {\r\n this.throwIfDisposed();\r\n return this.remove(index, 1)[0];\r\n }\r\n\r\n public remove = (index: number, count: number): TItem[] => {\r\n this.throwIfDisposed();\r\n const removedElements = this.privList.splice(index, count);\r\n this.triggerSubscriptions(this.privRemoveSubscriptions);\r\n return removedElements;\r\n }\r\n\r\n public clear = (): void => {\r\n this.throwIfDisposed();\r\n this.remove(0, this.length());\r\n }\r\n\r\n public length = (): number => {\r\n this.throwIfDisposed();\r\n return this.privList.length;\r\n }\r\n\r\n public onAdded = (addedCallback: () => void): IDetachable => {\r\n this.throwIfDisposed();\r\n const subscriptionId = this.privSubscriptionIdCounter++;\r\n\r\n this.privAddSubscriptions[subscriptionId] = addedCallback;\r\n\r\n return {\r\n detach: () => {\r\n delete this.privAddSubscriptions[subscriptionId];\r\n },\r\n };\r\n }\r\n\r\n public onRemoved = (removedCallback: () => void): IDetachable => {\r\n this.throwIfDisposed();\r\n const subscriptionId = this.privSubscriptionIdCounter++;\r\n\r\n this.privRemoveSubscriptions[subscriptionId] = removedCallback;\r\n\r\n return {\r\n detach: () => {\r\n delete this.privRemoveSubscriptions[subscriptionId];\r\n },\r\n };\r\n }\r\n\r\n public onDisposed = (disposedCallback: () => void): IDetachable => {\r\n this.throwIfDisposed();\r\n const subscriptionId = this.privSubscriptionIdCounter++;\r\n\r\n this.privDisposedSubscriptions[subscriptionId] = disposedCallback;\r\n\r\n return {\r\n detach: () => {\r\n delete this.privDisposedSubscriptions[subscriptionId];\r\n },\r\n };\r\n }\r\n\r\n public join = (seperator?: string): string => {\r\n this.throwIfDisposed();\r\n return this.privList.join(seperator);\r\n }\r\n\r\n public toArray = (): TItem[] => {\r\n const cloneCopy = Array();\r\n this.privList.forEach((val: TItem) => {\r\n cloneCopy.push(val);\r\n });\r\n return cloneCopy;\r\n }\r\n\r\n public any = (callback?: (item: TItem, index: number) => boolean): boolean => {\r\n this.throwIfDisposed();\r\n if (callback) {\r\n return this.where(callback).length() > 0;\r\n } else {\r\n return this.length() > 0;\r\n }\r\n }\r\n\r\n public all = (callback: (item: TItem) => boolean): boolean => {\r\n this.throwIfDisposed();\r\n return this.where(callback).length() === this.length();\r\n }\r\n\r\n public forEach = (callback: (item: TItem, index: number) => void): void => {\r\n this.throwIfDisposed();\r\n for (let i = 0; i < this.length(); i++) {\r\n callback(this.privList[i], i);\r\n }\r\n }\r\n\r\n public select = (callback: (item: TItem, index: number) => T2): List => {\r\n this.throwIfDisposed();\r\n const selectList: T2[] = [];\r\n for (let i = 0; i < this.privList.length; i++) {\r\n selectList.push(callback(this.privList[i], i));\r\n }\r\n\r\n return new List(selectList);\r\n }\r\n\r\n public where = (callback: (item: TItem, index: number) => boolean): List => {\r\n this.throwIfDisposed();\r\n const filteredList = new List();\r\n for (let i = 0; i < this.privList.length; i++) {\r\n if (callback(this.privList[i], i)) {\r\n filteredList.add(this.privList[i]);\r\n }\r\n }\r\n return filteredList;\r\n }\r\n\r\n public orderBy = (compareFn: (a: TItem, b: TItem) => number): List => {\r\n this.throwIfDisposed();\r\n const clonedArray = this.toArray();\r\n const orderedArray = clonedArray.sort(compareFn);\r\n return new List(orderedArray);\r\n }\r\n\r\n public orderByDesc = (compareFn: (a: TItem, b: TItem) => number): List => {\r\n this.throwIfDisposed();\r\n return this.orderBy((a: TItem, b: TItem) => compareFn(b, a));\r\n }\r\n\r\n public clone = (): List => {\r\n this.throwIfDisposed();\r\n return new List(this.toArray());\r\n }\r\n\r\n public concat = (list: List): List => {\r\n this.throwIfDisposed();\r\n return new List(this.privList.concat(list.toArray()));\r\n }\r\n\r\n public concatArray = (array: TItem[]): List => {\r\n this.throwIfDisposed();\r\n return new List(this.privList.concat(array));\r\n }\r\n\r\n public isDisposed = (): boolean => {\r\n return this.privList == null;\r\n }\r\n\r\n public dispose = (reason?: string): void => {\r\n if (!this.isDisposed()) {\r\n this.privDisposeReason = reason;\r\n this.privList = null;\r\n this.privAddSubscriptions = null;\r\n this.privRemoveSubscriptions = null;\r\n this.triggerSubscriptions(this.privDisposedSubscriptions);\r\n }\r\n }\r\n\r\n private throwIfDisposed = (): void => {\r\n if (this.isDisposed()) {\r\n throw new ObjectDisposedError(\"List\", this.privDisposeReason);\r\n }\r\n }\r\n\r\n private triggerSubscriptions = (subscriptions: IStringDictionary<() => void>): void => {\r\n if (subscriptions) {\r\n for (const subscriptionId in subscriptions) {\r\n if (subscriptionId) {\r\n subscriptions[subscriptionId]();\r\n }\r\n }\r\n }\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ArgumentNullError } from \"./Error\";\r\n\r\nexport enum PromiseState {\r\n None,\r\n Resolved,\r\n Rejected,\r\n}\r\n\r\nexport interface IPromise {\r\n result(): PromiseResult;\r\n\r\n continueWith(\r\n continuationCallback: (promiseResult: PromiseResult) => TContinuationResult): IPromise;\r\n\r\n continueWithPromise(\r\n continuationCallback: (promiseResult: PromiseResult) => IPromise): IPromise;\r\n\r\n onSuccessContinueWith(\r\n continuationCallback: (result: T) => TContinuationResult): IPromise;\r\n\r\n onSuccessContinueWithPromise(\r\n continuationCallback: (result: T) => IPromise): IPromise;\r\n\r\n on(successCallback: (result: T) => void, errorCallback: (error: string) => void): IPromise;\r\n\r\n finally(callback: () => void): IPromise;\r\n}\r\n\r\nexport interface IDeferred {\r\n state(): PromiseState;\r\n\r\n promise(): IPromise;\r\n\r\n resolve(result: T): IDeferred;\r\n\r\n reject(error: string): IDeferred;\r\n}\r\n\r\nexport class PromiseResult {\r\n protected privIsCompleted: boolean;\r\n protected privIsError: boolean;\r\n protected privError: string;\r\n protected privResult: T;\r\n\r\n public constructor(promiseResultEventSource: PromiseResultEventSource) {\r\n promiseResultEventSource.on((result: T) => {\r\n if (!this.privIsCompleted) {\r\n this.privIsCompleted = true;\r\n this.privIsError = false;\r\n this.privResult = result;\r\n }\r\n }, (error: string) => {\r\n if (!this.privIsCompleted) {\r\n this.privIsCompleted = true;\r\n this.privIsError = true;\r\n this.privError = error;\r\n }\r\n });\r\n }\r\n\r\n public get isCompleted(): boolean {\r\n return this.privIsCompleted;\r\n }\r\n\r\n public get isError(): boolean {\r\n return this.privIsError;\r\n }\r\n\r\n public get error(): string {\r\n return this.privError;\r\n }\r\n\r\n public get result(): T {\r\n return this.privResult;\r\n }\r\n\r\n public throwIfError = (): void => {\r\n if (this.isError) {\r\n throw this.error;\r\n }\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class PromiseResultEventSource {\r\n\r\n private privOnSetResult: (result: T) => void;\r\n private privOnSetError: (error: string) => void;\r\n\r\n public setResult = (result: T): void => {\r\n this.privOnSetResult(result);\r\n }\r\n\r\n public setError = (error: string): void => {\r\n this.privOnSetError(error);\r\n }\r\n\r\n public on = (onSetResult: (result: T) => void, onSetError: (error: string) => void): void => {\r\n this.privOnSetResult = onSetResult;\r\n this.privOnSetError = onSetError;\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class PromiseHelper {\r\n public static whenAll = (promises: Array>): Promise => {\r\n if (!promises || promises.length === 0) {\r\n throw new ArgumentNullError(\"promises\");\r\n }\r\n\r\n const deferred = new Deferred();\r\n const errors: string[] = [];\r\n let completedPromises: number = 0;\r\n\r\n const checkForCompletion = () => {\r\n completedPromises++;\r\n if (completedPromises === promises.length) {\r\n if (errors.length === 0) {\r\n deferred.resolve(true);\r\n } else {\r\n deferred.reject(errors.join(\", \"));\r\n }\r\n }\r\n };\r\n\r\n for (const promise of promises) {\r\n promise.on((r: any) => {\r\n checkForCompletion();\r\n }, (e: string) => {\r\n errors.push(e);\r\n checkForCompletion();\r\n });\r\n }\r\n\r\n return deferred.promise();\r\n }\r\n\r\n public static fromResult = (result: TResult): Promise => {\r\n const deferred = new Deferred();\r\n deferred.resolve(result);\r\n return deferred.promise();\r\n }\r\n\r\n public static fromError = (error: string): Promise => {\r\n const deferred = new Deferred();\r\n deferred.reject(error);\r\n return deferred.promise();\r\n }\r\n}\r\n\r\n// TODO: replace with ES6 promises\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class Promise implements IPromise {\r\n private privSink: Sink;\r\n\r\n public constructor(sink: Sink) {\r\n this.privSink = sink;\r\n }\r\n\r\n public result = (): PromiseResult => {\r\n return this.privSink.result;\r\n }\r\n\r\n public continueWith = (\r\n continuationCallback: (promiseResult: PromiseResult) => TContinuationResult): Promise => {\r\n\r\n if (!continuationCallback) {\r\n throw new ArgumentNullError(\"continuationCallback\");\r\n }\r\n\r\n const continuationDeferral = new Deferred();\r\n\r\n this.privSink.on(\r\n (r: T) => {\r\n try {\r\n const continuationResult: TContinuationResult = continuationCallback(this.privSink.result);\r\n continuationDeferral.resolve(continuationResult);\r\n } catch (e) {\r\n continuationDeferral.reject(e);\r\n }\r\n },\r\n (error: string) => {\r\n try {\r\n const continuationResult: TContinuationResult = continuationCallback(this.privSink.result);\r\n continuationDeferral.resolve(continuationResult);\r\n } catch (e) {\r\n continuationDeferral.reject(`'Error handler for error ${error} threw error ${e}'`);\r\n }\r\n },\r\n );\r\n\r\n return continuationDeferral.promise();\r\n }\r\n\r\n public onSuccessContinueWith = (\r\n continuationCallback: (result: T) => TContinuationResult): Promise => {\r\n\r\n if (!continuationCallback) {\r\n throw new ArgumentNullError(\"continuationCallback\");\r\n }\r\n\r\n const continuationDeferral = new Deferred();\r\n\r\n this.privSink.on(\r\n (r: T) => {\r\n try {\r\n const continuationResult: TContinuationResult = continuationCallback(r);\r\n continuationDeferral.resolve(continuationResult);\r\n } catch (e) {\r\n continuationDeferral.reject(e);\r\n }\r\n },\r\n (error: string) => {\r\n continuationDeferral.reject(error);\r\n },\r\n );\r\n\r\n return continuationDeferral.promise();\r\n }\r\n\r\n public continueWithPromise = (\r\n continuationCallback: (promiseResult: PromiseResult) => Promise): Promise => {\r\n\r\n if (!continuationCallback) {\r\n throw new ArgumentNullError(\"continuationCallback\");\r\n }\r\n\r\n const continuationDeferral = new Deferred();\r\n\r\n this.privSink.on(\r\n (r: T) => {\r\n try {\r\n const continuationPromise: Promise = continuationCallback(this.privSink.result);\r\n if (!continuationPromise) {\r\n throw new Error(\"'Continuation callback did not return promise'\");\r\n }\r\n continuationPromise.on((continuationResult: TContinuationResult) => {\r\n continuationDeferral.resolve(continuationResult);\r\n }, (e: string) => {\r\n continuationDeferral.reject(e);\r\n });\r\n } catch (e) {\r\n continuationDeferral.reject(e);\r\n }\r\n },\r\n (error: string) => {\r\n try {\r\n const continuationPromise: Promise = continuationCallback(this.privSink.result);\r\n if (!continuationPromise) {\r\n throw new Error(\"Continuation callback did not return promise\");\r\n }\r\n continuationPromise.on((continuationResult: TContinuationResult) => {\r\n continuationDeferral.resolve(continuationResult);\r\n }, (e: string) => {\r\n continuationDeferral.reject(e);\r\n });\r\n } catch (e) {\r\n continuationDeferral.reject(`'Error handler for error ${error} threw error ${e}'`);\r\n }\r\n },\r\n );\r\n\r\n return continuationDeferral.promise();\r\n }\r\n\r\n public onSuccessContinueWithPromise = (\r\n continuationCallback: (result: T) => Promise): Promise => {\r\n\r\n if (!continuationCallback) {\r\n throw new ArgumentNullError(\"continuationCallback\");\r\n }\r\n\r\n const continuationDeferral = new Deferred();\r\n\r\n this.privSink.on(\r\n (r: T) => {\r\n try {\r\n const continuationPromise: Promise = continuationCallback(r);\r\n if (!continuationPromise) {\r\n throw new Error(\"Continuation callback did not return promise\");\r\n }\r\n continuationPromise.on((continuationResult: TContinuationResult) => {\r\n continuationDeferral.resolve(continuationResult);\r\n }, (e: string) => {\r\n continuationDeferral.reject(e);\r\n });\r\n } catch (e) {\r\n continuationDeferral.reject(e);\r\n }\r\n },\r\n (error: string) => {\r\n continuationDeferral.reject(error);\r\n },\r\n );\r\n\r\n return continuationDeferral.promise();\r\n }\r\n\r\n public on = (\r\n successCallback: (result: T) => void,\r\n errorCallback: (error: string) => void): Promise => {\r\n if (!successCallback) {\r\n throw new ArgumentNullError(\"successCallback\");\r\n }\r\n\r\n if (!errorCallback) {\r\n throw new ArgumentNullError(\"errorCallback\");\r\n }\r\n\r\n this.privSink.on(successCallback, errorCallback);\r\n return this;\r\n }\r\n\r\n public finally = (callback: () => void): Promise => {\r\n if (!callback) {\r\n throw new ArgumentNullError(\"callback\");\r\n }\r\n\r\n const callbackWrapper = (_: any) => {\r\n callback();\r\n };\r\n\r\n return this.on(callbackWrapper, callbackWrapper);\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class Deferred implements IDeferred {\r\n private privPromise: Promise;\r\n private privSink: Sink;\r\n\r\n public constructor() {\r\n this.privSink = new Sink();\r\n this.privPromise = new Promise(this.privSink);\r\n }\r\n\r\n public state = (): PromiseState => {\r\n return this.privSink.state;\r\n }\r\n\r\n public promise = (): Promise => {\r\n return this.privPromise;\r\n }\r\n\r\n public resolve = (result: T): Deferred => {\r\n this.privSink.resolve(result);\r\n return this;\r\n }\r\n\r\n public reject = (error: string): Deferred => {\r\n this.privSink.reject(error);\r\n return this;\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class Sink {\r\n private privState: PromiseState = PromiseState.None;\r\n private privPromiseResult: PromiseResult = null;\r\n private privPromiseResultEvents: PromiseResultEventSource = null;\r\n\r\n private privSuccessHandlers: Array<((result: T) => void)> = [];\r\n private privErrorHandlers: Array<(e: string) => void> = [];\r\n\r\n public constructor() {\r\n this.privPromiseResultEvents = new PromiseResultEventSource();\r\n this.privPromiseResult = new PromiseResult(this.privPromiseResultEvents);\r\n }\r\n\r\n public get state(): PromiseState {\r\n return this.privState;\r\n }\r\n\r\n public get result(): PromiseResult {\r\n return this.privPromiseResult;\r\n }\r\n\r\n public resolve = (result: T): void => {\r\n if (this.privState !== PromiseState.None) {\r\n throw new Error(\"'Cannot resolve a completed promise'\");\r\n }\r\n\r\n this.privState = PromiseState.Resolved;\r\n this.privPromiseResultEvents.setResult(result);\r\n\r\n for (let i = 0; i < this.privSuccessHandlers.length; i++) {\r\n this.executeSuccessCallback(result, this.privSuccessHandlers[i], this.privErrorHandlers[i]);\r\n }\r\n\r\n this.detachHandlers();\r\n }\r\n\r\n public reject = (error: string): void => {\r\n if (this.privState !== PromiseState.None) {\r\n throw new Error(\"'Cannot reject a completed promise'\");\r\n }\r\n\r\n this.privState = PromiseState.Rejected;\r\n this.privPromiseResultEvents.setError(error);\r\n\r\n for (const errorHandler of this.privErrorHandlers) {\r\n this.executeErrorCallback(error, errorHandler);\r\n }\r\n\r\n this.detachHandlers();\r\n }\r\n\r\n public on = (\r\n successCallback: (result: T) => void,\r\n errorCallback: (error: string) => void): void => {\r\n\r\n if (successCallback == null) {\r\n successCallback = (r: T) => { return; };\r\n }\r\n\r\n if (this.privState === PromiseState.None) {\r\n this.privSuccessHandlers.push(successCallback);\r\n this.privErrorHandlers.push(errorCallback);\r\n } else {\r\n if (this.privState === PromiseState.Resolved) {\r\n this.executeSuccessCallback(this.privPromiseResult.result, successCallback, errorCallback);\r\n } else if (this.privState === PromiseState.Rejected) {\r\n this.executeErrorCallback(this.privPromiseResult.error, errorCallback);\r\n }\r\n\r\n this.detachHandlers();\r\n }\r\n }\r\n\r\n private executeSuccessCallback = (result: T, successCallback: (result: T) => void, errorCallback: (error: string) => void): void => {\r\n try {\r\n successCallback(result);\r\n } catch (e) {\r\n this.executeErrorCallback(`'Unhandled callback error: ${e}'`, errorCallback);\r\n }\r\n }\r\n\r\n private executeErrorCallback = (error: string, errorCallback: (error: string) => void): void => {\r\n if (errorCallback) {\r\n try {\r\n errorCallback(error);\r\n } catch (e) {\r\n throw new Error(`'Unhandled callback error: ${e}. InnerError: ${error}'`);\r\n }\r\n } else {\r\n throw new Error(`'Unhandled error: ${error}'`);\r\n }\r\n }\r\n\r\n private detachHandlers = (): void => {\r\n this.privErrorHandlers = [];\r\n this.privSuccessHandlers = [];\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { InvalidOperationError, ObjectDisposedError } from \"./Error\";\r\nimport { IDetachable } from \"./IDetachable\";\r\nimport { IDisposable } from \"./IDisposable\";\r\nimport { List } from \"./List\";\r\nimport { Deferred, Promise, PromiseHelper } from \"./Promise\";\r\n\r\nexport interface IQueue extends IDisposable {\r\n enqueue(item: TItem): void;\r\n enqueueFromPromise(promise: Promise): void;\r\n dequeue(): Promise;\r\n peek(): Promise;\r\n length(): number;\r\n}\r\n\r\nenum SubscriberType {\r\n Dequeue,\r\n Peek,\r\n}\r\n\r\nexport class Queue implements IQueue {\r\n private privPromiseStore: List> = new List>();\r\n private privList: List;\r\n private privDetachables: IDetachable[];\r\n private privSubscribers: List<{ type: SubscriberType, deferral: Deferred }>;\r\n private privIsDrainInProgress: boolean = false;\r\n private privIsDisposing: boolean = false;\r\n private privDisposeReason: string = null;\r\n\r\n public constructor(list?: List) {\r\n this.privList = list ? list : new List();\r\n this.privDetachables = [];\r\n this.privSubscribers = new List<{ type: SubscriberType, deferral: Deferred }>();\r\n this.privDetachables.push(this.privList.onAdded(this.drain));\r\n }\r\n\r\n public enqueue = (item: TItem): void => {\r\n this.throwIfDispose();\r\n this.enqueueFromPromise(PromiseHelper.fromResult(item));\r\n }\r\n\r\n public enqueueFromPromise = (promise: Promise): void => {\r\n this.throwIfDispose();\r\n this.privPromiseStore.add(promise);\r\n promise.finally(() => {\r\n while (this.privPromiseStore.length() > 0) {\r\n if (!this.privPromiseStore.first().result().isCompleted) {\r\n break;\r\n } else {\r\n const p = this.privPromiseStore.removeFirst();\r\n if (!p.result().isError) {\r\n this.privList.add(p.result().result);\r\n } else {\r\n // TODO: Log as warning.\r\n }\r\n }\r\n }\r\n });\r\n }\r\n\r\n public dequeue = (): Promise => {\r\n this.throwIfDispose();\r\n const deferredSubscriber = new Deferred();\r\n\r\n if (this.privSubscribers) {\r\n this.privSubscribers.add({ deferral: deferredSubscriber, type: SubscriberType.Dequeue });\r\n this.drain();\r\n }\r\n\r\n return deferredSubscriber.promise();\r\n }\r\n\r\n public peek = (): Promise => {\r\n this.throwIfDispose();\r\n const deferredSubscriber = new Deferred();\r\n\r\n const subs = this.privSubscribers;\r\n if (subs) {\r\n this.privSubscribers.add({ deferral: deferredSubscriber, type: SubscriberType.Peek });\r\n this.drain();\r\n }\r\n\r\n return deferredSubscriber.promise();\r\n }\r\n\r\n public length = (): number => {\r\n this.throwIfDispose();\r\n return this.privList.length();\r\n }\r\n\r\n public isDisposed = (): boolean => {\r\n return this.privSubscribers == null;\r\n }\r\n\r\n public drainAndDispose = (pendingItemProcessor: (pendingItemInQueue: TItem) => void, reason?: string): Promise => {\r\n if (!this.isDisposed() && !this.privIsDisposing) {\r\n this.privDisposeReason = reason;\r\n this.privIsDisposing = true;\r\n\r\n const subs = this.privSubscribers;\r\n if (subs) {\r\n while (subs.length() > 0) {\r\n const subscriber = subs.removeFirst();\r\n // TODO: this needs work (Resolve(null) instead?).\r\n subscriber.deferral.resolve(undefined);\r\n // subscriber.deferral.reject(\"Disposed\");\r\n }\r\n\r\n // note: this block assumes cooperative multitasking, i.e.,\r\n // between the if-statement and the assignment there are no\r\n // thread switches.\r\n // Reason is that between the initial const = this.; and this\r\n // point there is the derral.resolve() operation that might have\r\n // caused recursive calls to the Queue, especially, calling\r\n // Dispose() on the queue alredy (which would reset the var\r\n // here to null!).\r\n // That should generally hold true for javascript...\r\n if (this.privSubscribers === subs) {\r\n this.privSubscribers = subs;\r\n }\r\n }\r\n\r\n for (const detachable of this.privDetachables) {\r\n detachable.detach();\r\n }\r\n\r\n if (this.privPromiseStore.length() > 0 && pendingItemProcessor) {\r\n return PromiseHelper\r\n .whenAll(this.privPromiseStore.toArray())\r\n .continueWith(() => {\r\n this.privSubscribers = null;\r\n this.privList.forEach((item: TItem, index: number): void => {\r\n pendingItemProcessor(item);\r\n });\r\n this.privList = null;\r\n return true;\r\n });\r\n } else {\r\n this.privSubscribers = null;\r\n this.privList = null;\r\n }\r\n }\r\n\r\n return PromiseHelper.fromResult(true);\r\n }\r\n\r\n public dispose = (reason?: string): void => {\r\n this.drainAndDispose(null, reason);\r\n }\r\n\r\n private drain = (): void => {\r\n if (!this.privIsDrainInProgress && !this.privIsDisposing) {\r\n this.privIsDrainInProgress = true;\r\n\r\n const subs = this.privSubscribers;\r\n const lists = this.privList;\r\n if (subs && lists) {\r\n while (lists.length() > 0 && subs.length() > 0 && !this.privIsDisposing) {\r\n const subscriber = subs.removeFirst();\r\n if (subscriber.type === SubscriberType.Peek) {\r\n subscriber.deferral.resolve(lists.first());\r\n } else {\r\n const dequeuedItem = lists.removeFirst();\r\n subscriber.deferral.resolve(dequeuedItem);\r\n }\r\n }\r\n\r\n // note: this block assumes cooperative multitasking, i.e.,\r\n // between the if-statement and the assignment there are no\r\n // thread switches.\r\n // Reason is that between the initial const = this.; and this\r\n // point there is the derral.resolve() operation that might have\r\n // caused recursive calls to the Queue, especially, calling\r\n // Dispose() on the queue alredy (which would reset the var\r\n // here to null!).\r\n // That should generally hold true for javascript...\r\n if (this.privSubscribers === subs) {\r\n this.privSubscribers = subs;\r\n }\r\n\r\n // note: this block assumes cooperative multitasking, i.e.,\r\n // between the if-statement and the assignment there are no\r\n // thread switches.\r\n // Reason is that between the initial const = this.; and this\r\n // point there is the derral.resolve() operation that might have\r\n // caused recursive calls to the Queue, especially, calling\r\n // Dispose() on the queue alredy (which would reset the var\r\n // here to null!).\r\n // That should generally hold true for javascript...\r\n if (this.privList === lists) {\r\n this.privList = lists;\r\n }\r\n }\r\n\r\n this.privIsDrainInProgress = false;\r\n }\r\n }\r\n\r\n private throwIfDispose = (): void => {\r\n if (this.isDisposed()) {\r\n if (this.privDisposeReason) {\r\n throw new InvalidOperationError(this.privDisposeReason);\r\n }\r\n\r\n throw new ObjectDisposedError(\"Queue\");\r\n } else if (this.privIsDisposing) {\r\n throw new InvalidOperationError(\"Queue disposing\");\r\n }\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { MessageType } from \"./ConnectionMessage\";\r\nimport { ArgumentNullError, InvalidOperationError } from \"./Error\";\r\nimport { createNoDashGuid } from \"./Guid\";\r\n\r\nexport class RawWebsocketMessage {\r\n private privMessageType: MessageType;\r\n private privPayload: any = null;\r\n private privId: string;\r\n\r\n public constructor(messageType: MessageType, payload: any, id?: string) {\r\n if (!payload) {\r\n throw new ArgumentNullError(\"payload\");\r\n }\r\n\r\n if (messageType === MessageType.Binary && !(payload instanceof ArrayBuffer)) {\r\n throw new InvalidOperationError(\"Payload must be ArrayBuffer\");\r\n }\r\n\r\n if (messageType === MessageType.Text && !(typeof (payload) === \"string\")) {\r\n throw new InvalidOperationError(\"Payload must be a string\");\r\n }\r\n\r\n this.privMessageType = messageType;\r\n this.privPayload = payload;\r\n this.privId = id ? id : createNoDashGuid();\r\n }\r\n\r\n public get messageType(): MessageType {\r\n return this.privMessageType;\r\n }\r\n\r\n public get payload(): any {\r\n return this.privPayload;\r\n }\r\n\r\n public get textContent(): string {\r\n if (this.privMessageType === MessageType.Binary) {\r\n throw new InvalidOperationError(\"Not supported for binary message\");\r\n }\r\n\r\n return this.privPayload as string;\r\n }\r\n\r\n public get binaryContent(): ArrayBuffer {\r\n if (this.privMessageType === MessageType.Text) {\r\n throw new InvalidOperationError(\"Not supported for text message\");\r\n }\r\n\r\n return this.privPayload;\r\n }\r\n\r\n public get id(): string {\r\n return this.privId;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport class RiffPcmEncoder {\r\n\r\n private privActualSampleRate: number;\r\n private privDesiredSampleRate: number;\r\n private privChannelCount: number = 1;\r\n\r\n public constructor(actualSampleRate: number, desiredSampleRate: number) {\r\n this.privActualSampleRate = actualSampleRate;\r\n this.privDesiredSampleRate = desiredSampleRate;\r\n }\r\n\r\n public encode = (\r\n needHeader: boolean,\r\n actualAudioFrame: Float32Array): ArrayBuffer => {\r\n\r\n const audioFrame = this.downSampleAudioFrame(actualAudioFrame, this.privActualSampleRate, this.privDesiredSampleRate);\r\n\r\n if (!audioFrame) {\r\n return null;\r\n }\r\n\r\n const audioLength = audioFrame.length * 2;\r\n\r\n if (!needHeader) {\r\n const buffer = new ArrayBuffer(audioLength);\r\n const view = new DataView(buffer);\r\n this.floatTo16BitPCM(view, 0, audioFrame);\r\n\r\n return buffer;\r\n }\r\n\r\n const buffer = new ArrayBuffer(44 + audioLength);\r\n\r\n const bitsPerSample = 16;\r\n const bytesPerSample = bitsPerSample / 8;\r\n // We dont know ahead of time about the length of audio to stream. So set to 0.\r\n const fileLength = 0;\r\n\r\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView\r\n const view = new DataView(buffer);\r\n\r\n /* RIFF identifier */\r\n this.setString(view, 0, \"RIFF\");\r\n /* file length */\r\n view.setUint32(4, fileLength, true);\r\n /* RIFF type & Format */\r\n this.setString(view, 8, \"WAVEfmt \");\r\n /* format chunk length */\r\n view.setUint32(16, 16, true);\r\n /* sample format (raw) */\r\n view.setUint16(20, 1, true);\r\n /* channel count */\r\n view.setUint16(22, this.privChannelCount, true);\r\n /* sample rate */\r\n view.setUint32(24, this.privDesiredSampleRate, true);\r\n /* byte rate (sample rate * block align) */\r\n view.setUint32(28, this.privDesiredSampleRate * this.privChannelCount * bytesPerSample, true);\r\n /* block align (channel count * bytes per sample) */\r\n view.setUint16(32, this.privChannelCount * bytesPerSample, true);\r\n /* bits per sample */\r\n view.setUint16(34, bitsPerSample, true);\r\n /* data chunk identifier */\r\n this.setString(view, 36, \"data\");\r\n /* data chunk length */\r\n view.setUint32(40, fileLength, true);\r\n\r\n this.floatTo16BitPCM(view, 44, audioFrame);\r\n\r\n return buffer;\r\n }\r\n\r\n private setString = (view: DataView, offset: number, str: string): void => {\r\n for (let i = 0; i < str.length; i++) {\r\n view.setUint8(offset + i, str.charCodeAt(i));\r\n }\r\n }\r\n\r\n private floatTo16BitPCM = (view: DataView, offset: number, input: Float32Array): void => {\r\n for (let i = 0; i < input.length; i++ , offset += 2) {\r\n const s = Math.max(-1, Math.min(1, input[i]));\r\n view.setInt16(offset, s < 0 ? s * 0x8000 : s * 0x7FFF, true);\r\n }\r\n }\r\n\r\n private downSampleAudioFrame = (\r\n srcFrame: Float32Array,\r\n srcRate: number,\r\n dstRate: number): Float32Array => {\r\n\r\n if (dstRate === srcRate || dstRate > srcRate) {\r\n return srcFrame;\r\n }\r\n\r\n const ratio = srcRate / dstRate;\r\n const dstLength = Math.round(srcFrame.length / ratio);\r\n const dstFrame = new Float32Array(dstLength);\r\n let srcOffset = 0;\r\n let dstOffset = 0;\r\n while (dstOffset < dstLength) {\r\n const nextSrcOffset = Math.round((dstOffset + 1) * ratio);\r\n let accum = 0;\r\n let count = 0;\r\n while (srcOffset < nextSrcOffset && srcOffset < srcFrame.length) {\r\n accum += srcFrame[srcOffset++];\r\n count++;\r\n }\r\n dstFrame[dstOffset++] = accum / count;\r\n }\r\n\r\n return dstFrame;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { InvalidOperationError } from \"./Error\";\r\nimport { createNoDashGuid } from \"./Guid\";\r\nimport { IStringDictionary } from \"./IDictionary\";\r\nimport { Promise } from \"./Promise\";\r\nimport { Queue } from \"./Queue\";\r\nimport { IStreamChunk } from \"./Stream\";\r\n\r\nexport interface IStreamChunk {\r\n isEnd: boolean;\r\n buffer: TBuffer;\r\n timeReceived: number;\r\n}\r\n\r\nexport class Stream {\r\n private privId: string;\r\n private privReaderIdCounter: number = 1;\r\n private privStreambuffer: Array>;\r\n private privIsEnded: boolean = false;\r\n private privReaderQueues: IStringDictionary>>;\r\n\r\n public constructor(streamId?: string) {\r\n this.privId = streamId ? streamId : createNoDashGuid();\r\n this.privStreambuffer = [];\r\n this.privReaderQueues = {};\r\n }\r\n\r\n public get isClosed(): boolean {\r\n return this.privIsEnded;\r\n }\r\n\r\n public get id(): string {\r\n return this.privId;\r\n }\r\n\r\n public getReader = (): StreamReader => {\r\n const readerId = this.privReaderIdCounter;\r\n this.privReaderIdCounter++;\r\n const readerQueue = new Queue>();\r\n const currentLength = this.privStreambuffer.length;\r\n this.privReaderQueues[readerId] = readerQueue;\r\n for (let i = 0; i < currentLength; i++) {\r\n readerQueue.enqueue(this.privStreambuffer[i]);\r\n }\r\n return new StreamReader(\r\n this.privId,\r\n readerQueue,\r\n () => {\r\n delete this.privReaderQueues[readerId];\r\n });\r\n }\r\n\r\n public close(): void {\r\n if (!this.privIsEnded) {\r\n this.writeStreamChunk({\r\n buffer: null,\r\n isEnd: true,\r\n timeReceived: Date.now(),\r\n });\r\n this.privIsEnded = true;\r\n }\r\n }\r\n\r\n public writeStreamChunk(streamChunk: IStreamChunk): void {\r\n this.throwIfClosed();\r\n this.privStreambuffer.push(streamChunk);\r\n for (const readerId in this.privReaderQueues) {\r\n if (!this.privReaderQueues[readerId].isDisposed()) {\r\n try {\r\n this.privReaderQueues[readerId].enqueue(streamChunk);\r\n } catch (e) {\r\n // Do nothing\r\n }\r\n }\r\n }\r\n }\r\n\r\n private throwIfClosed = (): void => {\r\n if (this.privIsEnded) {\r\n throw new InvalidOperationError(\"Stream closed\");\r\n }\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class StreamReader {\r\n private privReaderQueue: Queue>;\r\n private privOnClose: () => void;\r\n private privIsClosed: boolean = false;\r\n private privStreamId: string;\r\n\r\n public constructor(streamId: string, readerQueue: Queue>, onClose: () => void) {\r\n this.privReaderQueue = readerQueue;\r\n this.privOnClose = onClose;\r\n this.privStreamId = streamId;\r\n }\r\n\r\n public get isClosed(): boolean {\r\n return this.privIsClosed;\r\n }\r\n\r\n public get streamId(): string {\r\n return this.privStreamId;\r\n }\r\n\r\n public read = (): Promise> => {\r\n if (this.isClosed) {\r\n throw new InvalidOperationError(\"StreamReader closed\");\r\n }\r\n\r\n return this.privReaderQueue\r\n .dequeue()\r\n .onSuccessContinueWith((streamChunk: IStreamChunk) => {\r\n if (streamChunk.isEnd) {\r\n this.privReaderQueue.dispose(\"End of stream reached\");\r\n }\r\n\r\n return streamChunk;\r\n });\r\n }\r\n\r\n public close = (): void => {\r\n if (!this.privIsClosed) {\r\n this.privIsClosed = true;\r\n this.privReaderQueue.dispose(\"StreamReader closed\");\r\n this.privOnClose();\r\n }\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines translation status.\r\n * @class TranslationStatus\r\n */\r\nexport enum TranslationStatus {\r\n /**\r\n * @member TranslationStatus.Success\r\n */\r\n Success = 0,\r\n\r\n /**\r\n * @member TranslationStatus.Error\r\n */\r\n Error,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { IStreamChunk, Stream } from \"./Exports\";\r\n\r\nexport class ChunkedArrayBufferStream extends Stream {\r\n private privTargetChunkSize: number;\r\n private privNextBufferToWrite: ArrayBuffer;\r\n private privNextBufferStartTime: number;\r\n private privNextBufferReadyBytes: number;\r\n\r\n constructor(targetChunkSize: number, streamId?: string) {\r\n super(streamId);\r\n this.privTargetChunkSize = targetChunkSize;\r\n this.privNextBufferReadyBytes = 0;\r\n }\r\n\r\n public writeStreamChunk(chunk: IStreamChunk): void {\r\n // No pending write, and the buffer is the right size so write it.\r\n if (chunk.isEnd ||\r\n (0 === this.privNextBufferReadyBytes && chunk.buffer.byteLength === this.privTargetChunkSize)) {\r\n super.writeStreamChunk(chunk);\r\n return;\r\n }\r\n\r\n let bytesCopiedFromBuffer: number = 0;\r\n\r\n while (bytesCopiedFromBuffer < chunk.buffer.byteLength) {\r\n // Fill the next buffer.\r\n if (undefined === this.privNextBufferToWrite) {\r\n this.privNextBufferToWrite = new ArrayBuffer(this.privTargetChunkSize);\r\n this.privNextBufferStartTime = chunk.timeReceived;\r\n }\r\n\r\n // Find out how many bytes we can copy into the read buffer.\r\n const bytesToCopy: number = Math.min(chunk.buffer.byteLength - bytesCopiedFromBuffer, this.privTargetChunkSize - this.privNextBufferReadyBytes);\r\n const targetView: Uint8Array = new Uint8Array(this.privNextBufferToWrite);\r\n const sourceView: Uint8Array = new Uint8Array(chunk.buffer.slice(bytesCopiedFromBuffer, bytesToCopy + bytesCopiedFromBuffer));\r\n\r\n targetView.set(sourceView, this.privNextBufferReadyBytes);\r\n this.privNextBufferReadyBytes += bytesToCopy;\r\n bytesCopiedFromBuffer += bytesToCopy;\r\n\r\n // Are we ready to write?\r\n if (this.privNextBufferReadyBytes === this.privTargetChunkSize) {\r\n super.writeStreamChunk({\r\n buffer: this.privNextBufferToWrite,\r\n isEnd: false,\r\n timeReceived: this.privNextBufferStartTime,\r\n });\r\n this.privNextBufferReadyBytes = 0;\r\n this.privNextBufferToWrite = undefined;\r\n }\r\n }\r\n }\r\n\r\n public close(): void {\r\n // Send whatever is pending, then close the base class.\r\n if (0 !== this.privNextBufferReadyBytes && !this.isClosed) {\r\n super.writeStreamChunk({\r\n buffer: this.privNextBufferToWrite.slice(0, this.privNextBufferReadyBytes),\r\n isEnd: false,\r\n timeReceived: this.privNextBufferStartTime,\r\n });\r\n }\r\n\r\n super.close();\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n AudioStreamFormat,\r\n AudioStreamFormatImpl,\r\n} from \"../../src/sdk/Audio/AudioStreamFormat\";\r\nimport {\r\n connectivity,\r\n ISpeechConfigAudioDevice,\r\n type\r\n} from \"../common.speech/Exports\";\r\nimport {\r\n AudioSourceErrorEvent,\r\n AudioSourceEvent,\r\n AudioSourceInitializingEvent,\r\n AudioSourceOffEvent,\r\n AudioSourceReadyEvent,\r\n AudioStreamNodeAttachedEvent,\r\n AudioStreamNodeAttachingEvent,\r\n AudioStreamNodeDetachedEvent,\r\n AudioStreamNodeErrorEvent,\r\n ChunkedArrayBufferStream,\r\n createNoDashGuid,\r\n Deferred,\r\n Events,\r\n EventSource,\r\n IAudioSource,\r\n IAudioStreamNode,\r\n IStringDictionary,\r\n Promise,\r\n PromiseHelper,\r\n Stream,\r\n StreamReader,\r\n} from \"../common/Exports\";\r\nimport { IRecorder } from \"./IRecorder\";\r\n\r\n// Extending the default definition with browser specific definitions for backward compatibility\r\ninterface INavigatorUserMedia extends NavigatorUserMedia {\r\n webkitGetUserMedia?: (constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback) => void;\r\n mozGetUserMedia?: (constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback) => void;\r\n msGetUserMedia?: (constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback) => void;\r\n}\r\n\r\nexport const AudioWorkletSourceURLPropertyName = \"MICROPHONE-WorkletSourceUrl\";\r\n\r\nexport class MicAudioSource implements IAudioSource {\r\n\r\n private static readonly AUDIOFORMAT: AudioStreamFormatImpl = AudioStreamFormat.getDefaultInputFormat() as AudioStreamFormatImpl;\r\n\r\n private privStreams: IStringDictionary> = {};\r\n\r\n private privId: string;\r\n\r\n private privEvents: EventSource;\r\n\r\n private privInitializeDeferral: Deferred;\r\n\r\n private privMediaStream: MediaStream;\r\n\r\n private privContext: AudioContext;\r\n\r\n private privMicrophoneLabel: string;\r\n\r\n private privOutputChunkSize: number;\r\n\r\n public constructor(\r\n private readonly privRecorder: IRecorder,\r\n outputChunkSize: number,\r\n audioSourceId?: string,\r\n private readonly deviceId?: string) {\r\n\r\n this.privOutputChunkSize = outputChunkSize;\r\n this.privId = audioSourceId ? audioSourceId : createNoDashGuid();\r\n this.privEvents = new EventSource();\r\n }\r\n\r\n public get format(): AudioStreamFormat {\r\n return MicAudioSource.AUDIOFORMAT;\r\n }\r\n\r\n public turnOn = (): Promise => {\r\n if (this.privInitializeDeferral) {\r\n return this.privInitializeDeferral.promise();\r\n }\r\n\r\n this.privInitializeDeferral = new Deferred();\r\n\r\n this.createAudioContext();\r\n\r\n const nav = window.navigator as INavigatorUserMedia;\r\n\r\n let getUserMedia = (\r\n nav.getUserMedia ||\r\n nav.webkitGetUserMedia ||\r\n nav.mozGetUserMedia ||\r\n nav.msGetUserMedia\r\n );\r\n\r\n if (!!nav.mediaDevices) {\r\n getUserMedia = (constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void => {\r\n nav.mediaDevices\r\n .getUserMedia(constraints)\r\n .then(successCallback)\r\n .catch(errorCallback);\r\n };\r\n }\r\n\r\n if (!getUserMedia) {\r\n const errorMsg = \"Browser does not support getUserMedia.\";\r\n this.privInitializeDeferral.reject(errorMsg);\r\n this.onEvent(new AudioSourceErrorEvent(errorMsg, \"\")); // mic initialized error - no streamid at this point\r\n } else {\r\n const next = () => {\r\n this.onEvent(new AudioSourceInitializingEvent(this.privId)); // no stream id\r\n getUserMedia(\r\n { audio: this.deviceId ? { deviceId: this.deviceId } : true, video: false },\r\n (mediaStream: MediaStream) => {\r\n this.privMediaStream = mediaStream;\r\n this.onEvent(new AudioSourceReadyEvent(this.privId));\r\n this.privInitializeDeferral.resolve(true);\r\n }, (error: MediaStreamError) => {\r\n const errorMsg = `Error occurred during microphone initialization: ${error}`;\r\n const tmp = this.privInitializeDeferral;\r\n // HACK: this should be handled through onError callbacks of all promises up the stack.\r\n // Unfortunately, the current implementation does not provide an easy way to reject promises\r\n // without a lot of code replication.\r\n // TODO: fix promise implementation, allow for a graceful reject chaining.\r\n this.privInitializeDeferral = null;\r\n tmp.reject(errorMsg); // this will bubble up through the whole chain of promises,\r\n // with each new level adding extra \"Unhandled callback error\" prefix to the error message.\r\n // The following line is not guaranteed to be executed.\r\n this.onEvent(new AudioSourceErrorEvent(this.privId, errorMsg));\r\n });\r\n };\r\n\r\n if (this.privContext.state === \"suspended\") {\r\n // NOTE: On iOS, the Web Audio API requires sounds to be triggered from an explicit user action.\r\n // https://github.com/WebAudio/web-audio-api/issues/790\r\n this.privContext.resume().then(next, (reason: any) => {\r\n this.privInitializeDeferral.reject(`Failed to initialize audio context: ${reason}`);\r\n });\r\n } else {\r\n next();\r\n }\r\n }\r\n\r\n return this.privInitializeDeferral.promise();\r\n }\r\n\r\n public id = (): string => {\r\n return this.privId;\r\n }\r\n\r\n public attach = (audioNodeId: string): Promise => {\r\n this.onEvent(new AudioStreamNodeAttachingEvent(this.privId, audioNodeId));\r\n\r\n return this.listen(audioNodeId).onSuccessContinueWith(\r\n (streamReader: StreamReader) => {\r\n this.onEvent(new AudioStreamNodeAttachedEvent(this.privId, audioNodeId));\r\n return {\r\n detach: () => {\r\n streamReader.close();\r\n delete this.privStreams[audioNodeId];\r\n this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\r\n this.turnOff();\r\n },\r\n id: () => {\r\n return audioNodeId;\r\n },\r\n read: () => {\r\n return streamReader.read();\r\n },\r\n };\r\n });\r\n }\r\n\r\n public detach = (audioNodeId: string): void => {\r\n if (audioNodeId && this.privStreams[audioNodeId]) {\r\n this.privStreams[audioNodeId].close();\r\n delete this.privStreams[audioNodeId];\r\n this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\r\n }\r\n }\r\n\r\n public turnOff = (): Promise => {\r\n for (const streamId in this.privStreams) {\r\n if (streamId) {\r\n const stream = this.privStreams[streamId];\r\n if (stream) {\r\n stream.close();\r\n }\r\n }\r\n }\r\n\r\n this.onEvent(new AudioSourceOffEvent(this.privId)); // no stream now\r\n this.privInitializeDeferral = null;\r\n\r\n this.destroyAudioContext();\r\n\r\n return PromiseHelper.fromResult(true);\r\n }\r\n\r\n public get events(): EventSource {\r\n return this.privEvents;\r\n }\r\n\r\n public get deviceInfo(): Promise {\r\n return this.getMicrophoneLabel().onSuccessContinueWith((label: string) => {\r\n return {\r\n bitspersample: MicAudioSource.AUDIOFORMAT.bitsPerSample,\r\n channelcount: MicAudioSource.AUDIOFORMAT.channels,\r\n connectivity: connectivity.Unknown,\r\n manufacturer: \"Speech SDK\",\r\n model: label,\r\n samplerate: MicAudioSource.AUDIOFORMAT.samplesPerSec,\r\n type: type.Microphones,\r\n };\r\n });\r\n }\r\n\r\n public setProperty(name: string, value: string): void {\r\n if (name === AudioWorkletSourceURLPropertyName) {\r\n this.privRecorder.setWorkletUrl(value);\r\n } else {\r\n throw new Error(\"Property '\" + name + \"' is not supported on Microphone.\");\r\n }\r\n }\r\n\r\n private getMicrophoneLabel(): Promise {\r\n const defaultMicrophoneName: string = \"microphone\";\r\n\r\n // If we did this already, return the value.\r\n if (this.privMicrophoneLabel !== undefined) {\r\n return PromiseHelper.fromResult(this.privMicrophoneLabel);\r\n }\r\n\r\n // If the stream isn't currently running, we can't query devices because security.\r\n if (this.privMediaStream === undefined || !this.privMediaStream.active) {\r\n return PromiseHelper.fromResult(defaultMicrophoneName);\r\n }\r\n\r\n // Setup a default\r\n this.privMicrophoneLabel = defaultMicrophoneName;\r\n\r\n // Get the id of the device running the audio track.\r\n const microphoneDeviceId: string = this.privMediaStream.getTracks()[0].getSettings().deviceId;\r\n\r\n // If the browser doesn't support getting the device ID, set a default and return.\r\n if (undefined === microphoneDeviceId) {\r\n return PromiseHelper.fromResult(this.privMicrophoneLabel);\r\n }\r\n\r\n const deferred: Deferred = new Deferred();\r\n\r\n // Enumerate the media devices.\r\n navigator.mediaDevices.enumerateDevices().then((devices: MediaDeviceInfo[]) => {\r\n for (const device of devices) {\r\n if (device.deviceId === microphoneDeviceId) {\r\n // Found the device\r\n this.privMicrophoneLabel = device.label;\r\n break;\r\n }\r\n }\r\n deferred.resolve(this.privMicrophoneLabel);\r\n }, () => deferred.resolve(this.privMicrophoneLabel));\r\n\r\n return deferred.promise();\r\n }\r\n\r\n private listen = (audioNodeId: string): Promise> => {\r\n return this.turnOn()\r\n .onSuccessContinueWith>((_: boolean) => {\r\n const stream = new ChunkedArrayBufferStream(this.privOutputChunkSize, audioNodeId);\r\n this.privStreams[audioNodeId] = stream;\r\n\r\n try {\r\n this.privRecorder.record(this.privContext, this.privMediaStream, stream);\r\n } catch (error) {\r\n this.onEvent(new AudioStreamNodeErrorEvent(this.privId, audioNodeId, error));\r\n throw error;\r\n }\r\n\r\n return stream.getReader();\r\n });\r\n }\r\n\r\n private onEvent = (event: AudioSourceEvent): void => {\r\n this.privEvents.onEvent(event);\r\n Events.instance.onEvent(event);\r\n }\r\n\r\n private createAudioContext = (): void => {\r\n if (!!this.privContext) {\r\n return;\r\n }\r\n\r\n // https://developer.mozilla.org/en-US/docs/Web/API/AudioContext\r\n const AudioContext = ((window as any).AudioContext)\r\n || ((window as any).webkitAudioContext)\r\n || false;\r\n\r\n if (!AudioContext) {\r\n throw new Error(\"Browser does not support Web Audio API (AudioContext is not available).\");\r\n }\r\n\r\n this.privContext = new AudioContext();\r\n }\r\n\r\n private destroyAudioContext = (): void => {\r\n if (!this.privContext) {\r\n return;\r\n }\r\n\r\n this.privRecorder.releaseMediaResources(this.privContext);\r\n\r\n // This pattern brought to you by a bug in the TypeScript compiler where it\r\n // confuses the (\"close\" in this.privContext) with this.privContext always being null as the alternate.\r\n // https://github.com/Microsoft/TypeScript/issues/11498\r\n let hasClose: boolean = false;\r\n if (\"close\" in this.privContext) {\r\n hasClose = true;\r\n }\r\n\r\n if (hasClose) {\r\n this.privContext.close();\r\n this.privContext = null;\r\n } else if (null !== this.privContext && this.privContext.state === \"running\") {\r\n // Suspend actually takes a callback, but analogous to the\r\n // resume method, it'll be only fired if suspend is called\r\n // in a direct response to a user action. The later is not always\r\n // the case, as TurnOff is also called, when we receive an\r\n // end-of-speech message from the service. So, doing a best effort\r\n // fire-and-forget here.\r\n this.privContext.suspend();\r\n }\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Represents audio stream format used for custom audio input configurations.\r\n * @class AudioStreamFormat\r\n */\r\nexport abstract class AudioStreamFormat {\r\n /**\r\n * Creates an audio stream format object representing the default audio stream\r\n * format (16KHz 16bit mono PCM).\r\n * @member AudioStreamFormat.getDefaultInputFormat\r\n * @function\r\n * @public\r\n * @returns {AudioStreamFormat} The audio stream format being created.\r\n */\r\n public static getDefaultInputFormat(): AudioStreamFormat {\r\n return AudioStreamFormatImpl.getDefaultInputFormat();\r\n }\r\n\r\n /**\r\n * Creates an audio stream format object with the specified pcm waveformat characteristics.\r\n * @member AudioStreamFormat.getWaveFormatPCM\r\n * @function\r\n * @public\r\n * @param {number} samplesPerSecond - Sample rate, in samples per second (Hertz).\r\n * @param {number} bitsPerSample - Bits per sample, typically 16.\r\n * @param {number} channels - Number of channels in the waveform-audio data. Monaural data\r\n * uses one channel and stereo data uses two channels.\r\n * @returns {AudioStreamFormat} The audio stream format being created.\r\n */\r\n public static getWaveFormatPCM(samplesPerSecond: number, bitsPerSample: number, channels: number): AudioStreamFormat {\r\n return new AudioStreamFormatImpl(samplesPerSecond, bitsPerSample, channels);\r\n }\r\n\r\n /**\r\n * Explicitly frees any external resource attached to the object\r\n * @member AudioStreamFormat.prototype.close\r\n * @function\r\n * @public\r\n */\r\n public abstract close(): void;\r\n}\r\n\r\n/**\r\n * @private\r\n * @class AudioStreamFormatImpl\r\n */\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class AudioStreamFormatImpl extends AudioStreamFormat {\r\n /**\r\n * Creates an instance with the given values.\r\n * @constructor\r\n * @param {number} samplesPerSec - Samples per second.\r\n * @param {number} bitsPerSample - Bits per sample.\r\n * @param {number} channels - Number of channels.\r\n */\r\n public constructor(samplesPerSec: number = 16000, bitsPerSample: number = 16, channels: number = 1) {\r\n super();\r\n this.formatTag = 1;\r\n this.bitsPerSample = bitsPerSample;\r\n this.samplesPerSec = samplesPerSec;\r\n this.channels = channels;\r\n this.avgBytesPerSec = this.samplesPerSec * this.channels * (this.bitsPerSample / 8);\r\n this.blockAlign = this.channels * Math.max(this.bitsPerSample, 8);\r\n }\r\n\r\n /**\r\n * Retrieves the default input format.\r\n * @member AudioStreamFormatImpl.getDefaultInputFormat\r\n * @function\r\n * @public\r\n * @returns {AudioStreamFormatImpl} The default input format.\r\n */\r\n public static getDefaultInputFormat(): AudioStreamFormatImpl {\r\n return new AudioStreamFormatImpl();\r\n }\r\n\r\n /**\r\n * Closes the configuration object.\r\n * @member AudioStreamFormatImpl.prototype.close\r\n * @function\r\n * @public\r\n */\r\n public close(): void { return; }\r\n\r\n /**\r\n * The format of the audio, valid values: 1 (PCM)\r\n * @member AudioStreamFormatImpl.prototype.formatTag\r\n * @function\r\n * @public\r\n */\r\n public formatTag: number;\r\n\r\n /**\r\n * The number of channels, valid values: 1 (Mono).\r\n * @member AudioStreamFormatImpl.prototype.channels\r\n * @function\r\n * @public\r\n */\r\n public channels: number;\r\n\r\n /**\r\n * The sample rate, valid values: 16000.\r\n * @member AudioStreamFormatImpl.prototype.samplesPerSec\r\n * @function\r\n * @public\r\n */\r\n public samplesPerSec: number;\r\n\r\n /**\r\n * The bits per sample, valid values: 16\r\n * @member AudioStreamFormatImpl.prototype.b\r\n * @function\r\n * @public\r\n */\r\n public bitsPerSample: number;\r\n\r\n /**\r\n * Average bytes per second, usually calculated as nSamplesPerSec * nChannels * ceil(wBitsPerSample, 8).\r\n * @member AudioStreamFormatImpl.prototype.avgBytesPerSec\r\n * @function\r\n * @public\r\n */\r\n public avgBytesPerSec: number;\r\n\r\n /**\r\n * The size of a single frame, valid values: nChannels * ceil(wBitsPerSample, 8).\r\n * @member AudioStreamFormatImpl.prototype.blockAlign\r\n * @function\r\n * @public\r\n */\r\n public blockAlign: number;\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n// Make sure not to export internal modules.\r\n//\r\nexport * from \"./CognitiveSubscriptionKeyAuthentication\";\r\nexport * from \"./CognitiveTokenAuthentication\";\r\nexport * from \"./IAuthentication\";\r\nexport * from \"./IConnectionFactory\";\r\nexport * from \"./IntentConnectionFactory\";\r\nexport * from \"./RecognitionEvents\";\r\nexport * from \"./ServiceRecognizerBase\";\r\nexport * from \"./RecognizerConfig\";\r\nexport * from \"./SpeechServiceInterfaces\";\r\nexport * from \"./WebsocketMessageFormatter\";\r\nexport * from \"./SpeechConnectionFactory\";\r\nexport * from \"./TranslationConnectionFactory\";\r\nexport * from \"./EnumTranslation\";\r\nexport * from \"./ServiceMessages/Enums\";\r\nexport * from \"./ServiceMessages/TranslationSynthesisEnd\";\r\nexport * from \"./ServiceMessages/TranslationHypothesis\";\r\nexport * from \"./ServiceMessages/TranslationPhrase\";\r\nexport * from \"./TranslationServiceRecognizer\";\r\nexport * from \"./ServiceMessages/SpeechDetected\";\r\nexport * from \"./ServiceMessages/SpeechHypothesis\";\r\nexport * from \"./SpeechServiceRecognizer\";\r\nexport * from \"./ServiceMessages/DetailedSpeechPhrase\";\r\nexport * from \"./ServiceMessages/SimpleSpeechPhrase\";\r\nexport * from \"./AddedLmIntent\";\r\nexport * from \"./IntentServiceRecognizer\";\r\nexport * from \"./ServiceMessages/IntentResponse\";\r\nexport * from \"./RequestSession\";\r\nexport * from \"./SpeechContext\";\r\nexport * from \"./DynamicGrammarBuilder\";\r\nexport * from \"./DynamicGrammarInterfaces\";\r\n\r\nexport const OutputFormatPropertyName: string = \"OutputFormat\";\r\nexport const CancellationErrorCodePropertyName: string = \"CancellationErrorCode\";\r\nexport const ServicePropertiesPropertyName: string = \"ServiceProperties\";\r\nexport const ForceDictationPropertyName: string = \"ForceDication\";\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ArgumentNullError, Promise, PromiseHelper } from \"../common/Exports\";\r\nimport { AuthInfo, IAuthentication } from \"./IAuthentication\";\r\n\r\nconst AuthHeader: string = \"Ocp-Apim-Subscription-Key\";\r\n\r\n/**\r\n * @class\r\n */\r\nexport class CognitiveSubscriptionKeyAuthentication implements IAuthentication {\r\n private privAuthInfo: AuthInfo;\r\n\r\n /**\r\n * Creates and initializes an instance of the CognitiveSubscriptionKeyAuthentication class.\r\n * @constructor\r\n * @param {string} subscriptionKey - The subscription key\r\n */\r\n constructor(subscriptionKey: string) {\r\n if (!subscriptionKey) {\r\n throw new ArgumentNullError(\"subscriptionKey\");\r\n }\r\n\r\n this.privAuthInfo = new AuthInfo(AuthHeader, subscriptionKey);\r\n }\r\n\r\n /**\r\n * Fetches the subscription key.\r\n * @member\r\n * @function\r\n * @public\r\n * @param {string} authFetchEventId - The id to fetch.\r\n */\r\n public fetch = (authFetchEventId: string): Promise => {\r\n return PromiseHelper.fromResult(this.privAuthInfo);\r\n }\r\n\r\n /**\r\n * Fetches the subscription key.\r\n * @member\r\n * @function\r\n * @public\r\n * @param {string} authFetchEventId - The id to fetch.\r\n */\r\n public fetchOnExpiry = (authFetchEventId: string): Promise => {\r\n return PromiseHelper.fromResult(this.privAuthInfo);\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Promise } from \"../common/Exports\";\r\n\r\nexport interface IAuthentication {\r\n fetch(authFetchEventId: string): Promise;\r\n fetchOnExpiry(authFetchEventId: string): Promise;\r\n}\r\n\r\nexport class AuthInfo {\r\n private privHeaderName: string;\r\n private privToken: string;\r\n\r\n public constructor(headerName: string, token: string) {\r\n this.privHeaderName = headerName;\r\n this.privToken = token;\r\n }\r\n\r\n public get headerName(): string {\r\n return this.privHeaderName;\r\n }\r\n\r\n public get token(): string {\r\n return this.privToken;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ArgumentNullError, Promise } from \"../common/Exports\";\r\nimport { AuthInfo, IAuthentication } from \"./IAuthentication\";\r\n\r\nconst AuthHeader: string = \"Authorization\";\r\n\r\nexport class CognitiveTokenAuthentication implements IAuthentication {\r\n private privFetchCallback: (authFetchEventId: string) => Promise;\r\n private privFetchOnExpiryCallback: (authFetchEventId: string) => Promise;\r\n\r\n constructor(fetchCallback: (authFetchEventId: string) => Promise, fetchOnExpiryCallback: (authFetchEventId: string) => Promise) {\r\n if (!fetchCallback) {\r\n throw new ArgumentNullError(\"fetchCallback\");\r\n }\r\n\r\n if (!fetchOnExpiryCallback) {\r\n throw new ArgumentNullError(\"fetchOnExpiryCallback\");\r\n }\r\n\r\n this.privFetchCallback = fetchCallback;\r\n this.privFetchOnExpiryCallback = fetchOnExpiryCallback;\r\n }\r\n\r\n public fetch = (authFetchEventId: string): Promise => {\r\n return this.privFetchCallback(authFetchEventId).onSuccessContinueWith((token: string) => new AuthInfo(AuthHeader, token));\r\n }\r\n\r\n public fetchOnExpiry = (authFetchEventId: string): Promise => {\r\n return this.privFetchOnExpiryCallback(authFetchEventId).onSuccessContinueWith((token: string) => new AuthInfo(AuthHeader, token));\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n ProxyInfo,\r\n WebsocketConnection,\r\n} from \"../common.browser/Exports\";\r\nimport {\r\n IConnection,\r\n IStringDictionary\r\n} from \"../common/Exports\";\r\nimport {\r\n PropertyId\r\n} from \"../sdk/Exports\";\r\nimport {\r\n ConnectionFactoryBase\r\n} from \"./ConnectionFactoryBase\";\r\nimport {\r\n AuthInfo,\r\n IConnectionFactory,\r\n RecognizerConfig,\r\n WebsocketMessageFormatter,\r\n} from \"./Exports\";\r\n\r\nconst TestHooksParamName: string = \"testhooks\";\r\nconst ConnectionIdHeader: string = \"X-ConnectionId\";\r\n\r\nexport class IntentConnectionFactory extends ConnectionFactoryBase {\r\n\r\n public create = (\r\n config: RecognizerConfig,\r\n authInfo: AuthInfo,\r\n connectionId?: string): IConnection => {\r\n\r\n let endpoint: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint);\r\n if (!endpoint) {\r\n const region: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_IntentRegion);\r\n\r\n endpoint = \"wss://speech.platform.bing.com/speech/\" + this.getSpeechRegionFromIntentRegion(region) + \"/recognition/interactive/cognitiveservices/v1\";\r\n }\r\n\r\n const queryParams: IStringDictionary = {\r\n format: \"simple\",\r\n language: config.parameters.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage),\r\n };\r\n\r\n this.setCommonUrlParams(config, queryParams, endpoint);\r\n\r\n const headers: IStringDictionary = {};\r\n headers[authInfo.headerName] = authInfo.token;\r\n headers[ConnectionIdHeader] = connectionId;\r\n\r\n return new WebsocketConnection(endpoint, queryParams, headers, new WebsocketMessageFormatter(), ProxyInfo.fromRecognizerConfig(config), connectionId);\r\n }\r\n\r\n private getSpeechRegionFromIntentRegion(intentRegion: string): string {\r\n switch (intentRegion) {\r\n case \"West US\":\r\n case \"US West\":\r\n case \"westus\":\r\n return \"uswest\";\r\n case \"West US 2\":\r\n case \"US West 2\":\r\n case \"westus2\":\r\n return \"uswest2\";\r\n case \"South Central US\":\r\n case \"US South Central\":\r\n case \"southcentralus\":\r\n return \"ussouthcentral\";\r\n case \"West Central US\":\r\n case \"US West Central\":\r\n case \"westcentralus\":\r\n return \"uswestcentral\";\r\n case \"East US\":\r\n case \"US East\":\r\n case \"eastus\":\r\n return \"useast\";\r\n case \"East US 2\":\r\n case \"US East 2\":\r\n case \"eastus2\":\r\n return \"useast2\";\r\n case \"West Europe\":\r\n case \"Europe West\":\r\n case \"westeurope\":\r\n return \"europewest\";\r\n case \"North Europe\":\r\n case \"Europe North\":\r\n case \"northeurope\":\r\n return \"europenorth\";\r\n case \"Brazil South\":\r\n case \"South Brazil\":\r\n case \"southbrazil\":\r\n return \"brazilsouth\";\r\n case \"Australia East\":\r\n case \"East Australia\":\r\n case \"eastaustralia\":\r\n return \"australiaeast\";\r\n case \"Southeast Asia\":\r\n case \"Asia Southeast\":\r\n case \"southeastasia\":\r\n return \"asiasoutheast\";\r\n case \"East Asia\":\r\n case \"Asia East\":\r\n case \"eastasia\":\r\n return \"asiaeast\";\r\n default:\r\n return intentRegion;\r\n }\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport { AudioConfig } from \"./Audio/AudioConfig\";\r\nexport { AudioStreamFormat } from \"./Audio/AudioStreamFormat\";\r\nexport { AudioInputStream, PullAudioInputStream, PushAudioInputStream } from \"./Audio/AudioInputStream\";\r\nexport { CancellationReason } from \"./CancellationReason\";\r\nexport { PullAudioInputStreamCallback } from \"./Audio/PullAudioInputStreamCallback\";\r\nexport { KeywordRecognitionModel } from \"./KeywordRecognitionModel\";\r\nexport { SessionEventArgs } from \"./SessionEventArgs\";\r\nexport { RecognitionEventArgs } from \"./RecognitionEventArgs\";\r\nexport { OutputFormat } from \"./OutputFormat\";\r\nexport { IntentRecognitionEventArgs } from \"./IntentRecognitionEventArgs\";\r\nexport { RecognitionResult } from \"./RecognitionResult\";\r\nexport { SpeechRecognitionResult } from \"./SpeechRecognitionResult\";\r\nexport { IntentRecognitionResult } from \"./IntentRecognitionResult\";\r\nexport { LanguageUnderstandingModel } from \"./LanguageUnderstandingModel\";\r\nexport { SpeechRecognitionEventArgs } from \"./SpeechRecognitionEventArgs\";\r\nexport { SpeechRecognitionCanceledEventArgs } from \"./SpeechRecognitionCanceledEventArgs\";\r\nexport { TranslationRecognitionEventArgs } from \"./TranslationRecognitionEventArgs\";\r\nexport { TranslationSynthesisEventArgs } from \"./TranslationSynthesisEventArgs\";\r\nexport { TranslationRecognitionResult } from \"./TranslationRecognitionResult\";\r\nexport { TranslationSynthesisResult } from \"./TranslationSynthesisResult\";\r\nexport { ResultReason } from \"./ResultReason\";\r\nexport { SpeechConfig } from \"./SpeechConfig\";\r\nexport { SpeechTranslationConfig } from \"./SpeechTranslationConfig\";\r\nexport { PropertyCollection } from \"./PropertyCollection\";\r\nexport { PropertyId } from \"./PropertyId\";\r\nexport { Recognizer } from \"./Recognizer\";\r\nexport { SpeechRecognizer } from \"./SpeechRecognizer\";\r\nexport { IntentRecognizer } from \"./IntentRecognizer\";\r\nexport { TranslationRecognizer } from \"./TranslationRecognizer\";\r\nexport { Translations } from \"./Translations\";\r\nexport { NoMatchReason } from \"./NoMatchReason\";\r\nexport { NoMatchDetails } from \"./NoMatchDetails\";\r\nexport { TranslationRecognitionCanceledEventArgs } from \"./TranslationRecognitionCanceledEventArgs\";\r\nexport { IntentRecognitionCanceledEventArgs } from \"./IntentRecognitionCanceledEventArgs\";\r\nexport { CancellationDetails } from \"./CancellationDetails\";\r\nexport { CancellationErrorCode } from \"./CancellationErrorCodes\";\r\nexport { ConnectionEventArgs } from \"./ConnectionEventArgs\";\r\nexport { Connection } from \"./Connection\";\r\nexport { PhraseListGrammar } from \"./PhraseListGrammar\";\r\nexport { ServicePropertyChannel } from \"./ServicePropertyChannel\";\r\nexport { ProfanityOption } from \"./ProfanityOption\";\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { AudioStreamFormat } from \"../../../src/sdk/Exports\";\r\nimport { FileAudioSource, MicAudioSource, PcmRecorder } from \"../../common.browser/Exports\";\r\nimport { ISpeechConfigAudioDevice } from \"../../common.speech/Exports\";\r\nimport { AudioSourceEvent, EventSource, IAudioSource, IAudioStreamNode, Promise } from \"../../common/Exports\";\r\nimport { Contracts } from \"../Contracts\";\r\nimport { AudioInputStream, PropertyCollection, PropertyId, PullAudioInputStreamCallback } from \"../Exports\";\r\nimport { bufferSize, PullAudioInputStreamImpl, PushAudioInputStreamImpl } from \"./AudioInputStream\";\r\n\r\n/**\r\n * Represents audio input configuration used for specifying what type of input to use (microphone, file, stream).\r\n * @class AudioConfig\r\n */\r\nexport abstract class AudioConfig {\r\n /**\r\n * Creates an AudioConfig object representing the default microphone on the system.\r\n * @member AudioConfig.fromDefaultMicrophoneInput\r\n * @function\r\n * @public\r\n * @returns {AudioConfig} The audio input configuration being created.\r\n */\r\n public static fromDefaultMicrophoneInput(): AudioConfig {\r\n const pcmRecorder = new PcmRecorder();\r\n return new AudioConfigImpl(new MicAudioSource(pcmRecorder, bufferSize));\r\n }\r\n\r\n /**\r\n * Creates an AudioConfig object representing a microphone with the specified device ID.\r\n * @member AudioConfig.fromMicrophoneInput\r\n * @function\r\n * @public\r\n * @param {string | undefined} deviceId - Specifies the device ID of the microphone to be used.\r\n * Default microphone is used the value is omitted.\r\n * @returns {AudioConfig} The audio input configuration being created.\r\n */\r\n public static fromMicrophoneInput(deviceId?: string): AudioConfig {\r\n const pcmRecorder = new PcmRecorder();\r\n return new AudioConfigImpl(new MicAudioSource(pcmRecorder, bufferSize, deviceId));\r\n }\r\n\r\n /**\r\n * Creates an AudioConfig object representing the specified file.\r\n * @member AudioConfig.fromWavFileInput\r\n * @function\r\n * @public\r\n * @param {File} fileName - Specifies the audio input file. Currently, only WAV / PCM with 16-bit\r\n * samples, 16 kHz sample rate, and a single channel (Mono) is supported.\r\n * @returns {AudioConfig} The audio input configuration being created.\r\n */\r\n public static fromWavFileInput(file: File): AudioConfig {\r\n return new AudioConfigImpl(new FileAudioSource(file));\r\n }\r\n\r\n /**\r\n * Creates an AudioConfig object representing the specified stream.\r\n * @member AudioConfig.fromStreamInput\r\n * @function\r\n * @public\r\n * @param {AudioInputStream | PullAudioInputStreamCallback} audioStream - Specifies the custom audio input\r\n * stream. Currently, only WAV / PCM with 16-bit samples, 16 kHz sample rate, and a single channel\r\n * (Mono) is supported.\r\n * @returns {AudioConfig} The audio input configuration being created.\r\n */\r\n public static fromStreamInput(audioStream: AudioInputStream | PullAudioInputStreamCallback): AudioConfig {\r\n if (audioStream instanceof PullAudioInputStreamCallback) {\r\n return new AudioConfigImpl(new PullAudioInputStreamImpl(audioStream as PullAudioInputStreamCallback));\r\n }\r\n\r\n if (audioStream instanceof AudioInputStream) {\r\n return new AudioConfigImpl(audioStream as PushAudioInputStreamImpl);\r\n }\r\n\r\n throw new Error(\"Not Supported Type\");\r\n }\r\n\r\n /**\r\n * Explicitly frees any external resource attached to the object\r\n * @member AudioConfig.prototype.close\r\n * @function\r\n * @public\r\n */\r\n public abstract close(): void;\r\n\r\n /**\r\n * Sets an arbitrary property.\r\n * @member SpeechConfig.prototype.setProperty\r\n * @function\r\n * @public\r\n * @param {string} name - The name of the property to set.\r\n * @param {string} value - The new value of the property.\r\n */\r\n public abstract setProperty(name: string, value: string): void;\r\n\r\n /**\r\n * Returns the current value of an arbitrary property.\r\n * @member SpeechConfig.prototype.getProperty\r\n * @function\r\n * @public\r\n * @param {string} name - The name of the property to query.\r\n * @param {string} def - The value to return in case the property is not known.\r\n * @returns {string} The current value, or provided default, of the given property.\r\n */\r\n public abstract getProperty(name: string, def?: string): string;\r\n\r\n}\r\n\r\n/**\r\n * Represents audio input stream used for custom audio input configurations.\r\n * @private\r\n * @class AudioConfigImpl\r\n */\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class AudioConfigImpl extends AudioConfig implements IAudioSource {\r\n private privSource: IAudioSource;\r\n\r\n /**\r\n * Creates and initializes an instance of this class.\r\n * @constructor\r\n * @param {IAudioSource} source - An audio source.\r\n */\r\n public constructor(source: IAudioSource) {\r\n super();\r\n this.privSource = source;\r\n }\r\n\r\n /**\r\n * Format information for the audio\r\n */\r\n public get format(): AudioStreamFormat {\r\n return this.privSource.format;\r\n }\r\n\r\n /**\r\n * @member AudioConfigImpl.prototype.close\r\n * @function\r\n * @public\r\n */\r\n public close(): void {\r\n this.privSource.turnOff();\r\n }\r\n\r\n /**\r\n * @member AudioConfigImpl.prototype.id\r\n * @function\r\n * @public\r\n */\r\n public id(): string {\r\n return this.privSource.id();\r\n }\r\n\r\n /**\r\n * @member AudioConfigImpl.prototype.turnOn\r\n * @function\r\n * @public\r\n * @returns {Promise} A promise.\r\n */\r\n public turnOn(): Promise {\r\n return this.privSource.turnOn();\r\n }\r\n\r\n /**\r\n * @member AudioConfigImpl.prototype.attach\r\n * @function\r\n * @public\r\n * @param {string} audioNodeId - The audio node id.\r\n * @returns {Promise} A promise.\r\n */\r\n public attach(audioNodeId: string): Promise {\r\n return this.privSource.attach(audioNodeId);\r\n }\r\n\r\n /**\r\n * @member AudioConfigImpl.prototype.detach\r\n * @function\r\n * @public\r\n * @param {string} audioNodeId - The audio node id.\r\n */\r\n public detach(audioNodeId: string): void {\r\n return this.detach(audioNodeId);\r\n }\r\n\r\n /**\r\n * @member AudioConfigImpl.prototype.turnOff\r\n * @function\r\n * @public\r\n * @returns {Promise} A promise.\r\n */\r\n public turnOff(): Promise {\r\n return this.privSource.turnOff();\r\n }\r\n\r\n /**\r\n * @member AudioConfigImpl.prototype.events\r\n * @function\r\n * @public\r\n * @returns {EventSource} An event source for audio events.\r\n */\r\n public get events(): EventSource {\r\n return this.privSource.events;\r\n }\r\n\r\n public setProperty(name: string, value: string): void {\r\n Contracts.throwIfNull(value, \"value\");\r\n\r\n if (undefined !== this.privSource.setProperty) {\r\n this.privSource.setProperty(name, value);\r\n } else {\r\n throw new Error(\"This AudioConfig instance does not support setting properties.\");\r\n }\r\n\r\n }\r\n\r\n public getProperty(name: string, def?: string): string {\r\n if (undefined !== this.privSource.getProperty) {\r\n return this.privSource.getProperty(name, def);\r\n } else {\r\n throw new Error(\"This AudioConfig instance does not support getting properties.\");\r\n }\r\n\r\n return def;\r\n }\r\n\r\n public get deviceInfo(): Promise {\r\n return this.privSource.deviceInfo;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * @class Contracts\r\n * @private\r\n */\r\nexport class Contracts {\r\n public static throwIfNullOrUndefined(param: any, name: string): void {\r\n if (param === undefined || param === null) {\r\n throw new Error(\"throwIfNullOrUndefined:\" + name);\r\n }\r\n }\r\n\r\n public static throwIfNull(param: any, name: string): void {\r\n if (param === null) {\r\n throw new Error(\"throwIfNull:\" + name);\r\n }\r\n }\r\n\r\n public static throwIfNullOrWhitespace(param: string, name: string): void {\r\n Contracts.throwIfNullOrUndefined(param, name);\r\n\r\n if ((\"\" + param).trim().length < 1) {\r\n throw new Error(\"throwIfNullOrWhitespace:\" + name);\r\n }\r\n }\r\n\r\n public static throwIfDisposed(isDisposed: boolean): void {\r\n if (isDisposed) {\r\n throw new Error(\"the object is already disposed\");\r\n }\r\n }\r\n\r\n public static throwIfArrayEmptyOrWhitespace(array: string[], name: string): void {\r\n Contracts.throwIfNullOrUndefined(array, name);\r\n\r\n if (array.length === 0) {\r\n throw new Error(\"throwIfArrayEmptyOrWhitespace:\" + name);\r\n }\r\n\r\n for (const item of array) {\r\n Contracts.throwIfNullOrWhitespace(item, name);\r\n }\r\n }\r\n\r\n public static throwIfFileDoesNotExist(param: any, name: string): void {\r\n Contracts.throwIfNullOrWhitespace(param, name);\r\n\r\n // TODO check for file existence.\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { createNoDashGuid } from \"../../../src/common/Guid\";\r\nimport {\r\n connectivity,\r\n ISpeechConfigAudioDevice,\r\n type,\r\n} from \"../../common.speech/Exports\";\r\nimport {\r\n AudioSourceEvent,\r\n AudioSourceInitializingEvent,\r\n AudioSourceReadyEvent,\r\n AudioStreamNodeAttachedEvent,\r\n AudioStreamNodeAttachingEvent,\r\n AudioStreamNodeDetachedEvent,\r\n ChunkedArrayBufferStream,\r\n Events,\r\n EventSource,\r\n IAudioSource,\r\n IAudioStreamNode,\r\n IStreamChunk,\r\n Promise,\r\n PromiseHelper,\r\n Stream,\r\n StreamReader,\r\n} from \"../../common/Exports\";\r\nimport { AudioStreamFormat, PullAudioInputStreamCallback } from \"../Exports\";\r\nimport { AudioStreamFormatImpl } from \"./AudioStreamFormat\";\r\n\r\nexport const bufferSize: number = 4096;\r\n\r\n/**\r\n * Represents audio input stream used for custom audio input configurations.\r\n * @class AudioInputStream\r\n */\r\nexport abstract class AudioInputStream {\r\n\r\n /**\r\n * Creates and initializes an instance.\r\n * @constructor\r\n */\r\n protected constructor() { }\r\n\r\n /**\r\n * Creates a memory backed PushAudioInputStream with the specified audio format.\r\n * @member AudioInputStream.createPushStream\r\n * @function\r\n * @public\r\n * @param {AudioStreamFormat} format - The audio data format in which audio will be\r\n * written to the push audio stream's write() method (currently only support 16 kHz 16bit mono PCM).\r\n * @returns {PushAudioInputStream} The audio input stream being created.\r\n */\r\n public static createPushStream(format?: AudioStreamFormat): PushAudioInputStream {\r\n return PushAudioInputStream.create(format);\r\n }\r\n\r\n /**\r\n * Creates a PullAudioInputStream that delegates to the specified callback interface for read()\r\n * and close() methods.\r\n * @member AudioInputStream.createPullStream\r\n * @function\r\n * @public\r\n * @param {PullAudioInputStreamCallback} callback - The custom audio input object, derived from\r\n * PullAudioInputStreamCallback\r\n * @param {AudioStreamFormat} format - The audio data format in which audio will be returned from\r\n * the callback's read() method (currently only support 16 kHz 16bit mono PCM).\r\n * @returns {PullAudioInputStream} The audio input stream being created.\r\n */\r\n public static createPullStream(callback: PullAudioInputStreamCallback, format?: AudioStreamFormat): PullAudioInputStream {\r\n return PullAudioInputStream.create(callback, format);\r\n // throw new Error(\"Oops\");\r\n }\r\n\r\n /**\r\n * Explicitly frees any external resource attached to the object\r\n * @member AudioInputStream.prototype.close\r\n * @function\r\n * @public\r\n */\r\n public abstract close(): void;\r\n}\r\n\r\n/**\r\n * Represents memory backed push audio input stream used for custom audio input configurations.\r\n * @class PushAudioInputStream\r\n */\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport abstract class PushAudioInputStream extends AudioInputStream {\r\n\r\n /**\r\n * Creates a memory backed PushAudioInputStream with the specified audio format.\r\n * @member PushAudioInputStream.create\r\n * @function\r\n * @public\r\n * @param {AudioStreamFormat} format - The audio data format in which audio will be written to the\r\n * push audio stream's write() method (currently only support 16 kHz 16bit mono PCM).\r\n * @returns {PushAudioInputStream} The push audio input stream being created.\r\n */\r\n public static create(format?: AudioStreamFormat): PushAudioInputStream {\r\n return new PushAudioInputStreamImpl(bufferSize, format);\r\n }\r\n\r\n /**\r\n * Writes the audio data specified by making an internal copy of the data.\r\n * @member PushAudioInputStream.prototype.write\r\n * @function\r\n * @public\r\n * @param {ArrayBuffer} dataBuffer - The audio buffer of which this function will make a copy.\r\n */\r\n public abstract write(dataBuffer: ArrayBuffer): void;\r\n\r\n /**\r\n * Closes the stream.\r\n * @member PushAudioInputStream.prototype.close\r\n * @function\r\n * @public\r\n */\r\n public abstract close(): void;\r\n}\r\n\r\n/**\r\n * Represents memory backed push audio input stream used for custom audio input configurations.\r\n * @private\r\n * @class PushAudioInputStreamImpl\r\n */\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class PushAudioInputStreamImpl extends PushAudioInputStream implements IAudioSource {\r\n\r\n private privFormat: AudioStreamFormatImpl;\r\n private privId: string;\r\n private privEvents: EventSource;\r\n private privStream: Stream;\r\n\r\n /**\r\n * Creates and initalizes an instance with the given values.\r\n * @constructor\r\n * @param {AudioStreamFormat} format - The audio stream format.\r\n */\r\n public constructor(chunkSize: number, format?: AudioStreamFormat) {\r\n super();\r\n if (format === undefined) {\r\n this.privFormat = AudioStreamFormatImpl.getDefaultInputFormat();\r\n } else {\r\n this.privFormat = format as AudioStreamFormatImpl;\r\n }\r\n this.privEvents = new EventSource();\r\n this.privId = createNoDashGuid();\r\n this.privStream = new ChunkedArrayBufferStream(chunkSize);\r\n }\r\n\r\n /**\r\n * Format information for the audio\r\n */\r\n public get format(): AudioStreamFormat {\r\n return this.privFormat;\r\n }\r\n\r\n /**\r\n * Writes the audio data specified by making an internal copy of the data.\r\n * @member PushAudioInputStreamImpl.prototype.write\r\n * @function\r\n * @public\r\n * @param {ArrayBuffer} dataBuffer - The audio buffer of which this function will make a copy.\r\n */\r\n public write(dataBuffer: ArrayBuffer): void {\r\n this.privStream.writeStreamChunk({\r\n buffer: dataBuffer,\r\n isEnd: false,\r\n timeReceived: Date.now()\r\n });\r\n }\r\n\r\n /**\r\n * Closes the stream.\r\n * @member PushAudioInputStreamImpl.prototype.close\r\n * @function\r\n * @public\r\n */\r\n public close(): void {\r\n this.privStream.close();\r\n }\r\n\r\n public id(): string {\r\n return this.privId;\r\n }\r\n\r\n public turnOn(): Promise {\r\n this.onEvent(new AudioSourceInitializingEvent(this.privId)); // no stream id\r\n this.onEvent(new AudioSourceReadyEvent(this.privId));\r\n return PromiseHelper.fromResult(true);\r\n }\r\n\r\n public attach(audioNodeId: string): Promise {\r\n this.onEvent(new AudioStreamNodeAttachingEvent(this.privId, audioNodeId));\r\n\r\n return this.turnOn()\r\n .onSuccessContinueWith>((_: boolean) => {\r\n // For now we support a single parallel reader of the pushed stream.\r\n // So we can simiply hand the stream to the recognizer and let it recognize.\r\n\r\n return this.privStream.getReader();\r\n })\r\n .onSuccessContinueWith((streamReader: StreamReader) => {\r\n this.onEvent(new AudioStreamNodeAttachedEvent(this.privId, audioNodeId));\r\n\r\n return {\r\n detach: () => {\r\n streamReader.close();\r\n this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\r\n this.turnOff();\r\n },\r\n id: () => {\r\n return audioNodeId;\r\n },\r\n read: () => {\r\n return streamReader.read();\r\n },\r\n };\r\n });\r\n }\r\n\r\n public detach(audioNodeId: string): void {\r\n this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\r\n }\r\n\r\n public turnOff(): Promise {\r\n return PromiseHelper.fromResult(false);\r\n }\r\n\r\n public get events(): EventSource {\r\n return this.privEvents;\r\n }\r\n\r\n public get deviceInfo(): Promise {\r\n return PromiseHelper.fromResult({\r\n bitspersample: this.privFormat.bitsPerSample,\r\n channelcount: this.privFormat.channels,\r\n connectivity: connectivity.Unknown,\r\n manufacturer: \"Speech SDK\",\r\n model: \"PushStream\",\r\n samplerate: this.privFormat.samplesPerSec,\r\n type: type.Stream,\r\n });\r\n }\r\n\r\n private onEvent = (event: AudioSourceEvent): void => {\r\n this.privEvents.onEvent(event);\r\n Events.instance.onEvent(event);\r\n }\r\n}\r\n\r\n/*\r\n * Represents audio input stream used for custom audio input configurations.\r\n * @class PullAudioInputStream\r\n */\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport abstract class PullAudioInputStream extends AudioInputStream {\r\n /**\r\n * Creates and initializes and instance.\r\n * @constructor\r\n */\r\n protected constructor() { super(); }\r\n\r\n /**\r\n * Creates a PullAudioInputStream that delegates to the specified callback interface for\r\n * read() and close() methods, using the default format (16 kHz 16bit mono PCM).\r\n * @member PullAudioInputStream.create\r\n * @function\r\n * @public\r\n * @param {PullAudioInputStreamCallback} callback - The custom audio input object,\r\n * derived from PullAudioInputStreamCustomCallback\r\n * @param {AudioStreamFormat} format - The audio data format in which audio will be\r\n * returned from the callback's read() method (currently only support 16 kHz 16bit mono PCM).\r\n * @returns {PullAudioInputStream} The push audio input stream being created.\r\n */\r\n public static create(callback: PullAudioInputStreamCallback, format?: AudioStreamFormat): PullAudioInputStream {\r\n return new PullAudioInputStreamImpl(callback, format as AudioStreamFormatImpl);\r\n }\r\n\r\n /**\r\n * Explicitly frees any external resource attached to the object\r\n * @member PullAudioInputStream.prototype.close\r\n * @function\r\n * @public\r\n */\r\n public abstract close(): void;\r\n\r\n}\r\n\r\n/**\r\n * Represents audio input stream used for custom audio input configurations.\r\n * @private\r\n * @class PullAudioInputStreamImpl\r\n */\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class PullAudioInputStreamImpl extends PullAudioInputStream implements IAudioSource {\r\n\r\n private privCallback: PullAudioInputStreamCallback;\r\n private privFormat: AudioStreamFormatImpl;\r\n private privId: string;\r\n private privEvents: EventSource;\r\n private privIsClosed: boolean;\r\n\r\n /**\r\n * Creates a PullAudioInputStream that delegates to the specified callback interface for\r\n * read() and close() methods, using the default format (16 kHz 16bit mono PCM).\r\n * @constructor\r\n * @param {PullAudioInputStreamCallback} callback - The custom audio input object,\r\n * derived from PullAudioInputStreamCustomCallback\r\n * @param {AudioStreamFormat} format - The audio data format in which audio will be\r\n * returned from the callback's read() method (currently only support 16 kHz 16bit mono PCM).\r\n */\r\n public constructor(callback: PullAudioInputStreamCallback, format?: AudioStreamFormatImpl) {\r\n super();\r\n if (undefined === format) {\r\n this.privFormat = AudioStreamFormat.getDefaultInputFormat() as AudioStreamFormatImpl;\r\n } else {\r\n this.privFormat = format;\r\n }\r\n this.privEvents = new EventSource();\r\n this.privId = createNoDashGuid();\r\n this.privCallback = callback;\r\n this.privIsClosed = false;\r\n }\r\n\r\n /**\r\n * Format information for the audio\r\n */\r\n public get format(): AudioStreamFormat {\r\n return this.privFormat;\r\n }\r\n\r\n /**\r\n * Closes the stream.\r\n * @member PullAudioInputStreamImpl.prototype.close\r\n * @function\r\n * @public\r\n */\r\n public close(): void {\r\n this.privIsClosed = true;\r\n this.privCallback.close();\r\n }\r\n\r\n public id(): string {\r\n return this.privId;\r\n }\r\n\r\n public turnOn(): Promise {\r\n this.onEvent(new AudioSourceInitializingEvent(this.privId)); // no stream id\r\n this.onEvent(new AudioSourceReadyEvent(this.privId));\r\n return PromiseHelper.fromResult(true);\r\n }\r\n\r\n public attach(audioNodeId: string): Promise {\r\n this.onEvent(new AudioStreamNodeAttachingEvent(this.privId, audioNodeId));\r\n\r\n return this.turnOn()\r\n .onSuccessContinueWith((result: boolean) => {\r\n this.onEvent(new AudioStreamNodeAttachedEvent(this.privId, audioNodeId));\r\n\r\n return {\r\n detach: () => {\r\n this.privCallback.close();\r\n this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\r\n this.turnOff();\r\n },\r\n id: () => {\r\n return audioNodeId;\r\n },\r\n read: (): Promise> => {\r\n let totalBytes: number = 0;\r\n let transmitBuff: ArrayBuffer;\r\n\r\n // Until we have the minimum number of bytes to send in a transmission, keep asking for more.\r\n while (totalBytes < bufferSize) {\r\n // Sizing the read buffer to the delta between the perfect size and what's left means we won't ever get too much\r\n // data back.\r\n const readBuff: ArrayBuffer = new ArrayBuffer(bufferSize - totalBytes);\r\n const pulledBytes: number = this.privCallback.read(readBuff);\r\n\r\n // If there is no return buffer yet defined, set the return buffer to the that was just populated.\r\n // This was, if we have enough data there's no copy penalty, but if we don't we have a buffer that's the\r\n // preferred size allocated.\r\n if (undefined === transmitBuff) {\r\n transmitBuff = readBuff;\r\n } else {\r\n // Not the first bite at the apple, so fill the return buffer with the data we got back.\r\n const intView: Int8Array = new Int8Array(transmitBuff);\r\n intView.set(new Int8Array(readBuff), totalBytes);\r\n }\r\n\r\n // If there are no bytes to read, just break out and be done.\r\n if (0 === pulledBytes) {\r\n break;\r\n }\r\n\r\n totalBytes += pulledBytes;\r\n }\r\n\r\n return PromiseHelper.fromResult>({\r\n buffer: transmitBuff.slice(0, totalBytes),\r\n isEnd: this.privIsClosed || totalBytes === 0,\r\n timeReceived: Date.now(),\r\n });\r\n },\r\n };\r\n });\r\n }\r\n\r\n public detach(audioNodeId: string): void {\r\n this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\r\n }\r\n\r\n public turnOff(): Promise {\r\n return PromiseHelper.fromResult(false);\r\n }\r\n\r\n public get events(): EventSource {\r\n return this.privEvents;\r\n }\r\n\r\n public get deviceInfo(): Promise {\r\n return PromiseHelper.fromResult({\r\n bitspersample: this.privFormat.bitsPerSample,\r\n channelcount: this.privFormat.channels,\r\n connectivity: connectivity.Unknown,\r\n manufacturer: \"Speech SDK\",\r\n model: \"PullStream\",\r\n samplerate: this.privFormat.samplesPerSec,\r\n type: type.Stream,\r\n });\r\n }\r\n\r\n private onEvent = (event: AudioSourceEvent): void => {\r\n this.privEvents.onEvent(event);\r\n Events.instance.onEvent(event);\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines the possible reasons a recognition result might be canceled.\r\n * @class CancellationReason\r\n */\r\nexport enum CancellationReason {\r\n /**\r\n * Indicates that an error occurred during speech recognition.\r\n * @member CancellationReason.Error\r\n */\r\n Error,\r\n\r\n /**\r\n * Indicates that the end of the audio stream was reached.\r\n * @member CancellationReason.EndOfStream\r\n */\r\n EndOfStream,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n /**\r\n * An abstract base class that defines callback methods (read() and close()) for\r\n * custom audio input streams).\r\n * @class PullAudioInputStreamCallback\r\n */\r\nexport abstract class PullAudioInputStreamCallback {\r\n\r\n /**\r\n * Reads data from audio input stream into the data buffer. The maximal number of bytes\r\n * to be read is determined by the size of dataBuffer.\r\n * @member PullAudioInputStreamCallback.prototype.read\r\n * @function\r\n * @public\r\n * @param {ArrayBuffer} dataBuffer - The byte array to store the read data.\r\n * @returns {number} the number of bytes have been read.\r\n */\r\n public abstract read(dataBuffer: ArrayBuffer): number;\r\n\r\n /**\r\n * Closes the audio input stream.\r\n * @member PullAudioInputStreamCallback.prototype.close\r\n * @function\r\n * @public\r\n */\r\n public abstract close(): void;\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Contracts } from \"./Contracts\";\r\n\r\n/**\r\n * Represents a keyword recognition model for recognizing when\r\n * the user says a keyword to initiate further speech recognition.\r\n * @class KeywordRecognitionModel\r\n */\r\nexport class KeywordRecognitionModel {\r\n private privDisposed: boolean = false;\r\n\r\n /**\r\n * Create and initializes a new instance.\r\n * @constructor\r\n */\r\n private constructor() {\r\n }\r\n\r\n /**\r\n * Creates a keyword recognition model using the specified filename.\r\n * @member KeywordRecognitionModel.fromFile\r\n * @function\r\n * @public\r\n * @param {string} fileName - A string that represents file name for the keyword recognition model.\r\n * Note, the file can point to a zip file in which case the model\r\n * will be extracted from the zip.\r\n * @returns {KeywordRecognitionModel} The keyword recognition model being created.\r\n */\r\n public static fromFile(fileName: string): KeywordRecognitionModel {\r\n Contracts.throwIfFileDoesNotExist(fileName, \"fileName\");\r\n\r\n throw new Error(\"Not yet implemented.\");\r\n }\r\n\r\n /**\r\n * Creates a keyword recognition model using the specified filename.\r\n * @member KeywordRecognitionModel.fromStream\r\n * @function\r\n * @public\r\n * @param {string} file - A File that represents file for the keyword recognition model.\r\n * Note, the file can point to a zip file in which case the model will be extracted from the zip.\r\n * @returns {KeywordRecognitionModel} The keyword recognition model being created.\r\n */\r\n public static fromStream(file: File): KeywordRecognitionModel {\r\n Contracts.throwIfNull(file, \"file\");\r\n\r\n throw new Error(\"Not yet implemented.\");\r\n }\r\n\r\n /**\r\n * Dispose of associated resources.\r\n * @member KeywordRecognitionModel.prototype.close\r\n * @function\r\n * @public\r\n */\r\n public close(): void {\r\n if (this.privDisposed) {\r\n return;\r\n }\r\n\r\n this.privDisposed = true;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines content for session events like SessionStarted/Stopped, SoundStarted/Stopped.\r\n * @class SessionEventArgs\r\n */\r\nexport class SessionEventArgs {\r\n private privSessionId: string;\r\n\r\n /**\r\n * Creates and initializes an instance of this class.\r\n * @constructor\r\n * @param {string} sessionId - The session id.\r\n */\r\n public constructor(sessionId: string) {\r\n this.privSessionId = sessionId;\r\n }\r\n\r\n /**\r\n * Represents the session identifier.\r\n * @member SessionEventArgs.prototype.sessionId\r\n * @function\r\n * @public\r\n * @returns {string} Represents the session identifier.\r\n */\r\n public get sessionId(): string {\r\n return this.privSessionId;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { SessionEventArgs } from \"./Exports\";\r\n\r\n/**\r\n * Defines payload for session events like Speech Start/End Detected\r\n * @class\r\n */\r\nexport class RecognitionEventArgs extends SessionEventArgs {\r\n private privOffset: number;\r\n\r\n /**\r\n * Creates and initializes an instance of this class.\r\n * @constructor\r\n * @param {number} offset - The offset.\r\n * @param {string} sessionId - The session id.\r\n */\r\n public constructor(offset: number, sessionId?: string) {\r\n super(sessionId);\r\n\r\n this.privOffset = offset;\r\n }\r\n\r\n /**\r\n * Represents the message offset\r\n * @member RecognitionEventArgs.prototype.offset\r\n * @function\r\n * @public\r\n */\r\n public get offset(): number {\r\n return this.privOffset;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Define Speech Recognizer output formats.\r\n * @class OutputFormat\r\n */\r\nexport enum OutputFormat {\r\n /**\r\n * @member OutputFormat.Simple\r\n */\r\n Simple = 0,\r\n\r\n /**\r\n * @member OutputFormat.Detailed\r\n */\r\n Detailed,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { IntentRecognitionResult, RecognitionEventArgs } from \"./Exports\";\r\n\r\n/**\r\n * Intent recognition result event arguments.\r\n * @class\r\n */\r\nexport class IntentRecognitionEventArgs extends RecognitionEventArgs {\r\n private privResult: IntentRecognitionResult;\r\n\r\n /**\r\n * Creates and initializes an instance of this class.\r\n * @constructor\r\n * @param result - The result of the intent recognition.\r\n * @param offset - The offset.\r\n * @param sessionId - The session id.\r\n */\r\n public constructor(result: IntentRecognitionResult, offset?: number, sessionId?: string) {\r\n super(offset, sessionId);\r\n\r\n this.privResult = result;\r\n }\r\n\r\n /**\r\n * Represents the intent recognition result.\r\n * @member IntentRecognitionEventArgs.prototype.result\r\n * @function\r\n * @public\r\n * @returns {IntentRecognitionResult} Represents the intent recognition result.\r\n */\r\n public get result(): IntentRecognitionResult {\r\n return this.privResult;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyCollection, ResultReason } from \"./Exports\";\r\n\r\n/**\r\n * Defines result of speech recognition.\r\n * @class RecognitionResult\r\n */\r\nexport class RecognitionResult {\r\n private privResultId: string;\r\n private privReason: ResultReason;\r\n private privText: string;\r\n private privDuration: number;\r\n private privOffset: number;\r\n private privErrorDetails: string;\r\n private privJson: string;\r\n private privProperties: PropertyCollection;\r\n\r\n /**\r\n * Creates and initializes an instance of this class.\r\n * @constructor\r\n * @param {string} resultId - The result id.\r\n * @param {ResultReason} reason - The reason.\r\n * @param {string} text - The recognized text.\r\n * @param {number} duration - The duration.\r\n * @param {number} offset - The offset into the stream.\r\n * @param {string} errorDetails - Error details, if provided.\r\n * @param {string} json - Additional Json, if provided.\r\n * @param {PropertyCollection} properties - Additional properties, if provided.\r\n */\r\n constructor(resultId?: string, reason?: ResultReason, text?: string, duration?: number,\r\n offset?: number, errorDetails?: string, json?: string, properties?: PropertyCollection) {\r\n this.privResultId = resultId;\r\n this.privReason = reason;\r\n this.privText = text;\r\n this.privDuration = duration;\r\n this.privOffset = offset;\r\n this.privErrorDetails = errorDetails;\r\n this.privJson = json;\r\n this.privProperties = properties;\r\n }\r\n\r\n /**\r\n * Specifies the result identifier.\r\n * @member RecognitionResult.prototype.resultId\r\n * @function\r\n * @public\r\n * @returns {string} Specifies the result identifier.\r\n */\r\n public get resultId(): string {\r\n return this.privResultId;\r\n }\r\n\r\n /**\r\n * Specifies status of the result.\r\n * @member RecognitionResult.prototype.reason\r\n * @function\r\n * @public\r\n * @returns {ResultReason} Specifies status of the result.\r\n */\r\n public get reason(): ResultReason {\r\n return this.privReason;\r\n }\r\n\r\n /**\r\n * Presents the recognized text in the result.\r\n * @member RecognitionResult.prototype.text\r\n * @function\r\n * @public\r\n * @returns {string} Presents the recognized text in the result.\r\n */\r\n public get text(): string {\r\n return this.privText;\r\n }\r\n\r\n /**\r\n * Duration of recognized speech in 100 nano second incements.\r\n * @member RecognitionResult.prototype.duration\r\n * @function\r\n * @public\r\n * @returns {number} Duration of recognized speech in 100 nano second incements.\r\n */\r\n public get duration(): number {\r\n return this.privDuration;\r\n }\r\n\r\n /**\r\n * Offset of recognized speech in 100 nano second incements.\r\n * @member RecognitionResult.prototype.offset\r\n * @function\r\n * @public\r\n * @returns {number} Offset of recognized speech in 100 nano second incements.\r\n */\r\n public get offset(): number {\r\n return this.privOffset;\r\n }\r\n\r\n /**\r\n * In case of an unsuccessful recognition, provides details of the occurred error.\r\n * @member RecognitionResult.prototype.errorDetails\r\n * @function\r\n * @public\r\n * @returns {string} a brief description of an error.\r\n */\r\n public get errorDetails(): string {\r\n return this.privErrorDetails;\r\n }\r\n\r\n /**\r\n * A string containing Json serialized recognition result as it was received from the service.\r\n * @member RecognitionResult.prototype.json\r\n * @function\r\n * @private\r\n * @returns {string} Json serialized representation of the result.\r\n */\r\n public get json(): string {\r\n return this.privJson;\r\n }\r\n\r\n /**\r\n * The set of properties exposed in the result.\r\n * @member RecognitionResult.prototype.properties\r\n * @function\r\n * @public\r\n * @returns {PropertyCollection} The set of properties exposed in the result.\r\n */\r\n public get properties(): PropertyCollection {\r\n return this.privProperties;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyCollection, RecognitionResult, ResultReason } from \"./Exports\";\r\n\r\n/**\r\n * Defines result of speech recognition.\r\n * @class SpeechRecognitionResult\r\n */\r\nexport class SpeechRecognitionResult extends RecognitionResult {\r\n /**\r\n * Creates and initializes an instance of this class.\r\n * @constructor\r\n * @public\r\n * @param {string} resultId - The result id.\r\n * @param {ResultReason} reason - The reason.\r\n * @param {string} text - The recognized text.\r\n * @param {number} duration - The duration.\r\n * @param {number} offset - The offset into the stream.\r\n * @param {string} errorDetails - Error details, if provided.\r\n * @param {string} json - Additional Json, if provided.\r\n * @param {PropertyCollection} properties - Additional properties, if provided.\r\n */\r\n public constructor(resultId?: string, reason?: ResultReason, text?: string,\r\n duration?: number, offset?: number, errorDetails?: string,\r\n json?: string, properties?: PropertyCollection) {\r\n super(resultId, reason, text, duration, offset, errorDetails, json, properties);\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyCollection, ResultReason, SpeechRecognitionResult } from \"./Exports\";\r\n\r\n/**\r\n * Intent recognition result.\r\n * @class\r\n */\r\nexport class IntentRecognitionResult extends SpeechRecognitionResult {\r\n private privIntentId: string;\r\n\r\n /**\r\n * Creates and initializes an instance of this class.\r\n * @constructor\r\n * @param intentId - The intent id.\r\n * @param resultId - The result id.\r\n * @param reason - The reason.\r\n * @param text - The recognized text.\r\n * @param duration - The duration.\r\n * @param offset - The offset into the stream.\r\n * @param errorDetails - Error details, if provided.\r\n * @param json - Additional Json, if provided.\r\n * @param properties - Additional properties, if provided.\r\n */\r\n constructor(intentId?: string, resultId?: string, reason?: ResultReason, text?: string,\r\n duration?: number, offset?: number, errorDetails?: string, json?: string,\r\n properties?: PropertyCollection) {\r\n super(resultId, reason, text, duration, offset, errorDetails, json, properties);\r\n\r\n this.privIntentId = intentId;\r\n }\r\n\r\n /**\r\n * A String that represents the intent identifier being recognized.\r\n * @member IntentRecognitionResult.prototype.intentId\r\n * @function\r\n * @public\r\n * @returns {string} A String that represents the intent identifier being recognized.\r\n */\r\n public get intentId(): string {\r\n return this.privIntentId;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Contracts } from \"./Contracts\";\r\n\r\n/**\r\n * Language understanding model\r\n * @class LanguageUnderstandingModel\r\n */\r\nexport class LanguageUnderstandingModel {\r\n /**\r\n * Creates and initializes a new instance\r\n * @constructor\r\n */\r\n protected constructor() {\r\n }\r\n\r\n /**\r\n * Creates an language understanding model using the specified endpoint.\r\n * @member LanguageUnderstandingModel.fromEndpoint\r\n * @function\r\n * @public\r\n * @param {URL} uri - A String that represents the endpoint of the language understanding model.\r\n * @returns {LanguageUnderstandingModel} The language understanding model being created.\r\n */\r\n public static fromEndpoint(uri: URL): LanguageUnderstandingModel {\r\n Contracts.throwIfNull(uri, \"uri\");\r\n Contracts.throwIfNullOrWhitespace(uri.hostname, \"uri\");\r\n\r\n const langModelImp: LanguageUnderstandingModelImpl = new LanguageUnderstandingModelImpl();\r\n // Need to extract the app ID from the URL.\r\n // URL is in the format: https://.api.cognitive.microsoft.com/luis/v2.0/apps/?subscription-key=&timezoneOffset=-360\r\n\r\n // Start tearing the string apart.\r\n\r\n // region can be extracted from the host name.\r\n const firstDot: number = uri.host.indexOf(\".\");\r\n if (-1 === firstDot) {\r\n throw new Error(\"Could not determine region from endpoint\");\r\n }\r\n langModelImp.region = uri.host.substr(0, firstDot);\r\n\r\n // Now the app ID.\r\n\r\n const lastSegment: number = uri.pathname.lastIndexOf(\"/\") + 1;\r\n if (-1 === lastSegment) {\r\n throw new Error(\"Could not determine appId from endpoint\");\r\n }\r\n\r\n langModelImp.appId = uri.pathname.substr(lastSegment);\r\n\r\n // And finally the key.\r\n langModelImp.subscriptionKey = uri.searchParams.get(\"subscription-key\");\r\n if (undefined === langModelImp.subscriptionKey) {\r\n throw new Error(\"Could not determine subscription key from endpoint\");\r\n }\r\n\r\n return langModelImp;\r\n }\r\n\r\n /**\r\n * Creates an language understanding model using the application id of Language Understanding service.\r\n * @member LanguageUnderstandingModel.fromAppId\r\n * @function\r\n * @public\r\n * @param {string} appId - A String that represents the application id of Language Understanding service.\r\n * @returns {LanguageUnderstandingModel} The language understanding model being created.\r\n */\r\n public static fromAppId(appId: string): LanguageUnderstandingModel {\r\n Contracts.throwIfNullOrWhitespace(appId, \"appId\");\r\n\r\n const langModelImp: LanguageUnderstandingModelImpl = new LanguageUnderstandingModelImpl();\r\n langModelImp.appId = appId;\r\n return langModelImp;\r\n }\r\n\r\n /**\r\n * Creates a language understanding model using hostname, subscription key and application\r\n * id of Language Understanding service.\r\n * @member LanguageUnderstandingModel.fromSubscription\r\n * @function\r\n * @public\r\n * @param {string} subscriptionKey - A String that represents the subscription key of\r\n * Language Understanding service.\r\n * @param {string} appId - A String that represents the application id of Language\r\n * Understanding service.\r\n * @param {LanguageUnderstandingModel} region - A String that represents the region\r\n * of the Language Understanding service (see the region page).\r\n * @returns {LanguageUnderstandingModel} The language understanding model being created.\r\n */\r\n public static fromSubscription(subscriptionKey: string, appId: string, region: string): LanguageUnderstandingModel {\r\n Contracts.throwIfNullOrWhitespace(subscriptionKey, \"subscriptionKey\");\r\n Contracts.throwIfNullOrWhitespace(appId, \"appId\");\r\n Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n const langModelImp: LanguageUnderstandingModelImpl = new LanguageUnderstandingModelImpl();\r\n langModelImp.appId = appId;\r\n langModelImp.region = region;\r\n langModelImp.subscriptionKey = subscriptionKey;\r\n return langModelImp;\r\n }\r\n}\r\n\r\n/**\r\n * @private\r\n * @class LanguageUnderstandingModelImpl\r\n */\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class LanguageUnderstandingModelImpl extends LanguageUnderstandingModel {\r\n public appId: string;\r\n public region: string;\r\n public subscriptionKey: string;\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { RecognitionEventArgs, SpeechRecognitionResult } from \"./Exports\";\r\n\r\n/**\r\n * Defines contents of speech recognizing/recognized event.\r\n * @class SpeechRecognitionEventArgs\r\n */\r\nexport class SpeechRecognitionEventArgs extends RecognitionEventArgs {\r\n private privResult: SpeechRecognitionResult;\r\n\r\n /**\r\n * Creates and initializes an instance of this class.\r\n * @constructor\r\n * @param {SpeechRecognitionResult} result - The speech recognition result.\r\n * @param {number} offset - The offset.\r\n * @param {string} sessionId - The session id.\r\n */\r\n public constructor(result: SpeechRecognitionResult, offset?: number, sessionId?: string) {\r\n super(offset, sessionId);\r\n\r\n this.privResult = result;\r\n }\r\n\r\n /**\r\n * Specifies the recognition result.\r\n * @member SpeechRecognitionEventArgs.prototype.result\r\n * @function\r\n * @public\r\n * @returns {SpeechRecognitionResult} the recognition result.\r\n */\r\n public get result(): SpeechRecognitionResult {\r\n return this.privResult;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { CancellationErrorCode, CancellationReason, RecognitionEventArgs } from \"./Exports\";\r\n\r\n/**\r\n * Defines content of a RecognitionErrorEvent.\r\n * @class SpeechRecognitionCanceledEventArgs\r\n */\r\nexport class SpeechRecognitionCanceledEventArgs extends RecognitionEventArgs {\r\n private privReason: CancellationReason;\r\n private privErrorDetails: string;\r\n private privErrorCode: CancellationErrorCode;\r\n\r\n /**\r\n * Creates and initializes an instance of this class.\r\n * @constructor\r\n * @param {CancellationReason} reason - The cancellation reason.\r\n * @param {string} errorDetails - Error details, if provided.\r\n * @param {number} offset - The offset.\r\n * @param {string} sessionId - The session id.\r\n */\r\n public constructor(reason: CancellationReason, errorDetails: string,\r\n errorCode: CancellationErrorCode, offset?: number, sessionId?: string) {\r\n super(offset, sessionId);\r\n\r\n this.privReason = reason;\r\n this.privErrorDetails = errorDetails;\r\n this.privErrorCode = errorCode;\r\n }\r\n\r\n /**\r\n * The reason the recognition was canceled.\r\n * @member SpeechRecognitionCanceledEventArgs.prototype.reason\r\n * @function\r\n * @public\r\n * @returns {CancellationReason} Specifies the reason canceled.\r\n */\r\n public get reason(): CancellationReason {\r\n return this.privReason;\r\n }\r\n\r\n /**\r\n * The error code in case of an unsuccessful recognition.\r\n * Added in version 1.1.0.\r\n * @return An error code that represents the error reason.\r\n */\r\n public get errorCode(): CancellationErrorCode {\r\n return this.privErrorCode;\r\n }\r\n\r\n /**\r\n * In case of an unsuccessful recognition, provides details of the occurred error.\r\n * @member SpeechRecognitionCanceledEventArgs.prototype.errorDetails\r\n * @function\r\n * @public\r\n * @returns {string} A String that represents the error details.\r\n */\r\n public get errorDetails(): string {\r\n return this.privErrorDetails;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { RecognitionEventArgs, TranslationRecognitionResult } from \"./Exports\";\r\n\r\n/**\r\n * Translation text result event arguments.\r\n * @class TranslationRecognitionEventArgs\r\n */\r\nexport class TranslationRecognitionEventArgs extends RecognitionEventArgs {\r\n private privResult: TranslationRecognitionResult;\r\n\r\n /**\r\n * Creates and initializes an instance of this class.\r\n * @constructor\r\n * @param {TranslationRecognitionResult} result - The translation recognition result.\r\n * @param {number} offset - The offset.\r\n * @param {string} sessionId - The session id.\r\n */\r\n public constructor(result: TranslationRecognitionResult, offset?: number, sessionId?: string) {\r\n super(offset, sessionId);\r\n\r\n this.privResult = result;\r\n }\r\n\r\n /**\r\n * Specifies the recognition result.\r\n * @member TranslationRecognitionEventArgs.prototype.result\r\n * @function\r\n * @public\r\n * @returns {TranslationRecognitionResult} the recognition result.\r\n */\r\n public get result(): TranslationRecognitionResult {\r\n return this.privResult;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { SessionEventArgs, TranslationSynthesisResult } from \"./Exports\";\r\n\r\n/**\r\n * Translation Synthesis event arguments\r\n * @class TranslationSynthesisEventArgs\r\n */\r\nexport class TranslationSynthesisEventArgs extends SessionEventArgs {\r\n private privResult: TranslationSynthesisResult;\r\n\r\n /**\r\n * Creates and initializes an instance of this class.\r\n * @constructor\r\n * @param {TranslationSynthesisResult} result - The translation synthesis result.\r\n * @param {string} sessionId - The session id.\r\n */\r\n public constructor(result: TranslationSynthesisResult, sessionId?: string) {\r\n super(sessionId);\r\n\r\n this.privResult = result;\r\n }\r\n\r\n /**\r\n * Specifies the translation synthesis result.\r\n * @member TranslationSynthesisEventArgs.prototype.result\r\n * @function\r\n * @public\r\n * @returns {TranslationSynthesisResult} Specifies the translation synthesis result.\r\n */\r\n public get result(): TranslationSynthesisResult {\r\n return this.privResult;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyCollection, ResultReason, SpeechRecognitionResult, Translations } from \"./Exports\";\r\n\r\n/**\r\n * Translation text result.\r\n * @class TranslationRecognitionResult\r\n */\r\nexport class TranslationRecognitionResult extends SpeechRecognitionResult {\r\n private privTranslations: Translations;\r\n\r\n /**\r\n * Creates and initializes an instance of this class.\r\n * @constructor\r\n * @param {Translations} translations - The translations.\r\n * @param {string} resultId - The result id.\r\n * @param {ResultReason} reason - The reason.\r\n * @param {string} text - The recognized text.\r\n * @param {number} duration - The duration.\r\n * @param {number} offset - The offset into the stream.\r\n * @param {string} errorDetails - Error details, if provided.\r\n * @param {string} json - Additional Json, if provided.\r\n * @param {PropertyCollection} properties - Additional properties, if provided.\r\n */\r\n public constructor(translations: Translations, resultId?: string, reason?: ResultReason,\r\n text?: string, duration?: number, offset?: number, errorDetails?: string,\r\n json?: string, properties?: PropertyCollection) {\r\n super(resultId, reason, text, duration, offset, errorDetails, json, properties);\r\n\r\n this.privTranslations = translations;\r\n }\r\n\r\n /**\r\n * Presents the translation results. Each item in the dictionary represents\r\n * a translation result in one of target languages, where the key is the name\r\n * of the target language, in BCP-47 format, and the value is the translation\r\n * text in the specified language.\r\n * @member TranslationRecognitionResult.prototype.translations\r\n * @function\r\n * @public\r\n * @returns {Translations} the current translation map that holds all translations requested.\r\n */\r\n public get translations(): Translations {\r\n return this.privTranslations;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ResultReason } from \"./ResultReason\";\r\n\r\n/**\r\n * Defines translation synthesis result, i.e. the voice output of the translated\r\n * text in the target language.\r\n * @class TranslationSynthesisResult\r\n */\r\nexport class TranslationSynthesisResult {\r\n private privReason: ResultReason;\r\n private privAudio: ArrayBuffer;\r\n\r\n /**\r\n * Creates and initializes an instance of this class.\r\n * @constructor\r\n * @param {ResultReason} reason - The synthesis reason.\r\n * @param {ArrayBuffer} audio - The audio data.\r\n */\r\n constructor(reason: ResultReason, audio: ArrayBuffer) {\r\n this.privReason = reason;\r\n this.privAudio = audio;\r\n }\r\n\r\n /**\r\n * Translated text in the target language.\r\n * @member TranslationSynthesisResult.prototype.audio\r\n * @function\r\n * @public\r\n * @returns {ArrayBuffer} Translated audio in the target language.\r\n */\r\n public get audio(): ArrayBuffer {\r\n return this.privAudio;\r\n }\r\n\r\n /**\r\n * The synthesis status.\r\n * @member TranslationSynthesisResult.prototype.reason\r\n * @function\r\n * @public\r\n * @returns {ResultReason} The synthesis status.\r\n */\r\n public get reason(): ResultReason {\r\n return this.privReason;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines the possible reasons a recognition result might be generated.\r\n * @class ResultReason\r\n */\r\nexport enum ResultReason {\r\n /**\r\n * Indicates speech could not be recognized. More details\r\n * can be found in the NoMatchDetails object.\r\n * @member ResultReason.NoMatch\r\n */\r\n NoMatch,\r\n\r\n /**\r\n * Indicates that the recognition was canceled. More details\r\n * can be found using the CancellationDetails object.\r\n * @member ResultReason.Canceled\r\n */\r\n Canceled,\r\n\r\n /**\r\n * Indicates the speech result contains hypothesis text.\r\n * @member ResultReason.RecognizedSpeech\r\n */\r\n RecognizingSpeech,\r\n\r\n /**\r\n * Indicates the speech result contains final text that has been recognized.\r\n * Speech Recognition is now complete for this phrase.\r\n * @member ResultReason.RecognizedSpeech\r\n */\r\n RecognizedSpeech,\r\n\r\n /**\r\n * Indicates the intent result contains hypothesis text and intent.\r\n * @member ResultReason.RecognizingIntent\r\n */\r\n RecognizingIntent,\r\n\r\n /**\r\n * Indicates the intent result contains final text and intent.\r\n * Speech Recognition and Intent determination are now complete for this phrase.\r\n * @member ResultReason.RecognizedIntent\r\n */\r\n RecognizedIntent,\r\n\r\n /**\r\n * Indicates the translation result contains hypothesis text and its translation(s).\r\n * @member ResultReason.TranslatingSpeech\r\n */\r\n TranslatingSpeech,\r\n\r\n /**\r\n * Indicates the translation result contains final text and corresponding translation(s).\r\n * Speech Recognition and Translation are now complete for this phrase.\r\n * @member ResultReason.TranslatedSpeech\r\n */\r\n TranslatedSpeech,\r\n\r\n /**\r\n * Indicates the synthesized audio result contains a non-zero amount of audio data\r\n * @member ResultReason.SynthesizingAudio\r\n */\r\n SynthesizingAudio,\r\n\r\n /**\r\n * Indicates the synthesized audio is now complete for this phrase.\r\n * @member ResultReason.SynthesizingAudioCompleted\r\n */\r\n SynthesizingAudioCompleted,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n ForceDictationPropertyName,\r\n OutputFormatPropertyName,\r\n ServicePropertiesPropertyName\r\n} from \"../common.speech/Exports\";\r\nimport { IStringDictionary } from \"../common/Exports\";\r\nimport { Contracts } from \"./Contracts\";\r\nimport {\r\n OutputFormat,\r\n ProfanityOption,\r\n PropertyCollection,\r\n PropertyId,\r\n ServicePropertyChannel\r\n} from \"./Exports\";\r\n\r\n/**\r\n * Speech configuration.\r\n * @class SpeechConfig\r\n */\r\nexport abstract class SpeechConfig {\r\n /**\r\n * Creates and initializes an instance.\r\n * @constructor\r\n */\r\n protected constructor() { }\r\n\r\n /**\r\n * Static instance of SpeechConfig returned by passing subscriptionKey and service region.\r\n * Note: Please use your LanguageUnderstanding subscription key in case you want to use the Intent recognizer.\r\n * @member SpeechConfig.fromSubscription\r\n * @function\r\n * @public\r\n * @param {string} subscriptionKey - The subscription key.\r\n * @param {string} region - The region name (see the region page).\r\n * @returns {SpeechConfig} The speech factory\r\n */\r\n public static fromSubscription(subscriptionKey: string, region: string): SpeechConfig {\r\n Contracts.throwIfNullOrWhitespace(subscriptionKey, \"subscriptionKey\");\r\n Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n const speechImpl: SpeechConfigImpl = new SpeechConfigImpl();\r\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_IntentRegion, region);\r\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\r\n\r\n return speechImpl;\r\n }\r\n\r\n /**\r\n * Creates an instance of the speech config with specified endpoint and subscription key.\r\n * This method is intended only for users who use a non-standard service endpoint or parameters.\r\n * Note: Please use your LanguageUnderstanding subscription key in case you want to use the Intent recognizer.\r\n * Note: The query parameters specified in the endpoint URL are not changed, even if they are set by any other APIs.\r\n * For example, if language is defined in the uri as query parameter \"language=de-DE\", and also set by\r\n * SpeechConfig.speechRecognitionLanguage = \"en-US\", the language setting in uri takes precedence,\r\n * and the effective language is \"de-DE\". Only the parameters that are not specified in the\r\n * endpoint URL can be set by other APIs.\r\n * Note: To use authorization token with fromEndpoint, pass an empty string to the subscriptionKey in the\r\n * fromEndpoint method, and then set authorizationToken=\"token\" on the created SpeechConfig instance to\r\n * use the authorization token.\r\n * @member SpeechConfig.fromEndpoint\r\n * @function\r\n * @public\r\n * @param {URL} endpoint - The service endpoint to connect to.\r\n * @param {string} subscriptionKey - The subscription key. If a subscription key is not specified, an authorization token must be set.\r\n * @returns {SpeechConfig} A speech factory instance.\r\n */\r\n public static fromEndpoint(endpoint: URL, subscriptionKey?: string): SpeechConfig {\r\n Contracts.throwIfNull(endpoint, \"endpoint\");\r\n\r\n const speechImpl: SpeechConfigImpl = new SpeechConfigImpl();\r\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_Endpoint, endpoint.href);\r\n\r\n if (undefined !== subscriptionKey) {\r\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\r\n }\r\n return speechImpl;\r\n }\r\n\r\n /**\r\n * Creates an instance of the speech factory with specified initial authorization token and region.\r\n * Note: The caller needs to ensure that the authorization token is valid. Before the authorization token\r\n * expires, the caller needs to refresh it by calling this setter with a new valid token.\r\n * Note: Please use a token derived from your LanguageUnderstanding subscription key in case you want\r\n * to use the Intent recognizer. As configuration values are copied when creating a new recognizer,\r\n * the new token value will not apply to recognizers that have already been created. For recognizers\r\n * that have been created before, you need to set authorization token of the corresponding recognizer\r\n * to refresh the token. Otherwise, the recognizers will encounter errors during recognition.\r\n * @member SpeechConfig.fromAuthorizationToken\r\n * @function\r\n * @public\r\n * @param {string} authorizationToken - The initial authorization token.\r\n * @param {string} region - The region name (see the region page).\r\n * @returns {SpeechConfig} A speech factory instance.\r\n */\r\n public static fromAuthorizationToken(authorizationToken: string, region: string): SpeechConfig {\r\n Contracts.throwIfNull(authorizationToken, \"authorizationToken\");\r\n Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n const speechImpl: SpeechConfigImpl = new SpeechConfigImpl();\r\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_IntentRegion, region);\r\n speechImpl.authorizationToken = authorizationToken;\r\n return speechImpl;\r\n }\r\n\r\n /**\r\n * Sets the proxy configuration.\r\n * Only relevant in Node.js environments.\r\n * Added in version 1.4.0.\r\n * @param proxyHostName The host name of the proxy server.\r\n * @param proxyPort The port number of the proxy server.\r\n */\r\n public abstract setProxy(proxyHostName: string, proxyPort: number): void;\r\n\r\n /**\r\n * Sets the proxy configuration.\r\n * Only relevant in Node.js environments.\r\n * Added in version 1.4.0.\r\n * @param proxyHostName The host name of the proxy server, without the protocol scheme (http://)\r\n * @param porxyPort The port number of the proxy server.\r\n * @param proxyUserName The user name of the proxy server.\r\n * @param proxyPassword The password of the proxy server.\r\n */\r\n public abstract setProxy(proxyHostName: string, proxyPort: number, proxyUserName: string, proxyPassword: string): void;\r\n\r\n /**\r\n * Gets the authorization token.\r\n * @member SpeechConfig.prototype.authorizationToken\r\n * @function\r\n * @public\r\n */\r\n public abstract get authorizationToken(): string;\r\n\r\n /**\r\n * Gets/Sets the authorization token.\r\n * Note: The caller needs to ensure that the authorization token is valid. Before the authorization token\r\n * expires, the caller needs to refresh it by calling this setter with a new valid token.\r\n * @member SpeechConfig.prototype.authorizationToken\r\n * @function\r\n * @public\r\n * @param {string} value - The authorization token.\r\n */\r\n public abstract set authorizationToken(value: string);\r\n\r\n /**\r\n * Returns the configured language.\r\n * @member SpeechConfig.prototype.speechRecognitionLanguage\r\n * @function\r\n * @public\r\n */\r\n public abstract get speechRecognitionLanguage(): string;\r\n\r\n /**\r\n * Gets/Sets the input language.\r\n * @member SpeechConfig.prototype.speechRecognitionLanguage\r\n * @function\r\n * @public\r\n * @param {string} value - The authorization token.\r\n */\r\n public abstract set speechRecognitionLanguage(value: string);\r\n\r\n /**\r\n * Sets an arbitrary property.\r\n * @member SpeechConfig.prototype.setProperty\r\n * @function\r\n * @public\r\n * @param {string} name - The name of the property to set.\r\n * @param {string} value - The new value of the property.\r\n */\r\n public abstract setProperty(name: string, value: string): void;\r\n\r\n /**\r\n * Returns the current value of an arbitrary property.\r\n * @member SpeechConfig.prototype.getProperty\r\n * @function\r\n * @public\r\n * @param {string} name - The name of the property to query.\r\n * @param {string} def - The value to return in case the property is not known.\r\n * @returns {string} The current value, or provided default, of the given property.\r\n */\r\n public abstract getProperty(name: string, def?: string): string;\r\n\r\n /**\r\n * Gets output format.\r\n * @member SpeechConfig.prototype.outputFormat\r\n * @function\r\n * @public\r\n * @returns {OutputFormat} Returns the output format.\r\n */\r\n public abstract get outputFormat(): OutputFormat;\r\n\r\n /**\r\n * Gets/Sets the output format.\r\n * @member SpeechConfig.prototype.outputFormat\r\n * @function\r\n * @public\r\n */\r\n public abstract set outputFormat(format: OutputFormat);\r\n\r\n /**\r\n * Gets the endpoint ID of a customized speech model that is used for speech recognition.\r\n * @member SpeechConfig.prototype.endpointId\r\n * @function\r\n * @public\r\n * @return {string} The endpoint ID\r\n */\r\n public abstract get endpointId(): string;\r\n\r\n /**\r\n * Gets/Sets the endpoint ID of a customized speech model that is used for speech recognition.\r\n * @member SpeechConfig.prototype.endpointId\r\n * @function\r\n * @public\r\n * @param {string} value - The endpoint ID\r\n */\r\n public abstract set endpointId(value: string);\r\n\r\n /**\r\n * Closes the configuration.\r\n * @member SpeechConfig.prototype.close\r\n * @function\r\n * @public\r\n */\r\n /* tslint:disable:no-empty */\r\n public close(): void { }\r\n\r\n /**\r\n * @member SpeechConfig.prototype.subscriptionKey\r\n * @function\r\n * @public\r\n * @return {SubscriptionKey} The subscription key set on the config.\r\n */\r\n public abstract get subscriptionKey(): string;\r\n\r\n /**\r\n * @member SpeechConfig.prototype.region\r\n * @function\r\n * @public\r\n * @return {region} The region set on the config.\r\n */\r\n public abstract get region(): string;\r\n\r\n /**\r\n * @member SpeechConfig.prototype.setServiceProperty\r\n * @function\r\n * @public\r\n * @param {name} The name of the property.\r\n * @param {value} Value to set.\r\n * @param {channel} The channel used to pass the specified property to service.\r\n * @summary Sets a property value that will be passed to service using the specified channel.\r\n * Added in version 1.7.0.\r\n */\r\n public abstract setServiceProperty(name: string, value: string, channel: ServicePropertyChannel): void;\r\n\r\n /**\r\n * @member SpeechConfig.prototype.setProfanity\r\n * @function\r\n * @public\r\n * @param {profanity} Profanity option to set.\r\n * @summary Sets profanity option.\r\n * Added in version 1.7.0.\r\n */\r\n public abstract setProfanity(profanity: ProfanityOption): void;\r\n\r\n /**\r\n * @member SpeechConfig.prototype.enableAudioLogging\r\n * @function\r\n * @public\r\n * @summary Enable audio logging in service.\r\n * Added in version 1.7.0.\r\n */\r\n public abstract enableAudioLogging(): void;\r\n\r\n /**\r\n * @member SpeechConfig.prototype.requestWordLevelTimestamps\r\n * @function\r\n * @public\r\n * @summary Includes word-level timestamps.\r\n * Added in version 1.7.0.\r\n */\r\n public abstract requestWordLevelTimestamps(): void;\r\n\r\n /**\r\n * @member SpeechConfig.prototype.enableDictation\r\n * @function\r\n * @public\r\n * @summary Enable dictation. Only supported in speech continuous recognition.\r\n * Added in version 1.7.0.\r\n */\r\n public abstract enableDictation(): void;\r\n}\r\n\r\n/**\r\n * @private\r\n * @class SpeechConfigImpl\r\n */\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class SpeechConfigImpl extends SpeechConfig {\r\n\r\n private privProperties: PropertyCollection;\r\n\r\n public constructor() {\r\n super();\r\n this.privProperties = new PropertyCollection();\r\n this.speechRecognitionLanguage = \"en-US\"; // Should we have a default?\r\n this.outputFormat = OutputFormat.Simple;\r\n }\r\n\r\n public get properties(): PropertyCollection {\r\n return this.privProperties;\r\n }\r\n\r\n public get endPoint(): URL {\r\n return new URL(this.privProperties.getProperty(PropertyId.SpeechServiceConnection_Endpoint));\r\n }\r\n\r\n public get subscriptionKey(): string {\r\n return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_Key);\r\n }\r\n\r\n public get region(): string {\r\n return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_Region);\r\n }\r\n\r\n public get authorizationToken(): string {\r\n return this.privProperties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n }\r\n\r\n public set authorizationToken(value: string) {\r\n this.privProperties.setProperty(PropertyId.SpeechServiceAuthorization_Token, value);\r\n }\r\n\r\n public get speechRecognitionLanguage(): string {\r\n return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage);\r\n }\r\n\r\n public set speechRecognitionLanguage(value: string) {\r\n this.privProperties.setProperty(PropertyId.SpeechServiceConnection_RecoLanguage, value);\r\n }\r\n\r\n public get outputFormat(): OutputFormat {\r\n return (OutputFormat as any)[this.privProperties.getProperty(OutputFormatPropertyName, undefined)];\r\n }\r\n\r\n public set outputFormat(value: OutputFormat) {\r\n this.privProperties.setProperty(OutputFormatPropertyName, OutputFormat[value]);\r\n }\r\n\r\n public get endpointId(): string {\r\n return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_EndpointId);\r\n }\r\n\r\n public set endpointId(value: string) {\r\n this.privProperties.setProperty(PropertyId.SpeechServiceConnection_EndpointId, value);\r\n }\r\n\r\n public setProperty(name: string | PropertyId, value: string): void {\r\n Contracts.throwIfNull(value, \"value\");\r\n\r\n this.privProperties.setProperty(name, value);\r\n }\r\n\r\n public getProperty(name: string | PropertyId, def?: string): string {\r\n\r\n return this.privProperties.getProperty(name, def);\r\n }\r\n\r\n public setProxy(proxyHostName: string, proxyPort: number): void;\r\n public setProxy(proxyHostName: string, proxyPort: number, proxyUserName: string, proxyPassword: string): void;\r\n public setProxy(proxyHostName: any, proxyPort: any, proxyUserName?: any, proxyPassword?: any): void {\r\n this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyHostName], proxyHostName);\r\n this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyPort], proxyPort);\r\n this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyUserName], proxyUserName);\r\n this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyPassword], proxyPassword);\r\n }\r\n\r\n public setServiceProperty(name: string, value: string, channel: ServicePropertyChannel): void {\r\n const currentProperties: IStringDictionary = JSON.parse( this.privProperties.getProperty(ServicePropertiesPropertyName, \"{}\"));\r\n\r\n currentProperties[name] = value;\r\n\r\n this.privProperties.setProperty(ServicePropertiesPropertyName, JSON.stringify(currentProperties));\r\n }\r\n\r\n public setProfanity(profanity: ProfanityOption): void {\r\n this.privProperties.setProperty(PropertyId.SpeechServiceResponse_ProfanityOption, ProfanityOption[profanity]);\r\n }\r\n\r\n public enableAudioLogging(): void {\r\n this.privProperties.setProperty(PropertyId.SpeechServiceConnection_EnableAudioLogging, \"true\");\r\n }\r\n public requestWordLevelTimestamps(): void {\r\n this.privProperties.setProperty(PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps, \"true\");\r\n }\r\n public enableDictation(): void {\r\n this.privProperties.setProperty(ForceDictationPropertyName, \"true\");\r\n }\r\n\r\n public clone(): SpeechConfigImpl {\r\n const ret: SpeechConfigImpl = new SpeechConfigImpl();\r\n ret.privProperties = this.privProperties.clone();\r\n return ret;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n ForceDictationPropertyName,\r\n OutputFormatPropertyName,\r\n ServicePropertiesPropertyName\r\n} from \"../common.speech/Exports\";\r\nimport { IStringDictionary } from \"../common/Exports\";\r\nimport { Contracts } from \"./Contracts\";\r\nimport {\r\n OutputFormat,\r\n ProfanityOption,\r\n PropertyCollection,\r\n PropertyId,\r\n ServicePropertyChannel,\r\n SpeechConfig,\r\n} from \"./Exports\";\r\n\r\n/**\r\n * Speech translation configuration.\r\n * @class SpeechTranslationConfig\r\n */\r\nexport abstract class SpeechTranslationConfig extends SpeechConfig {\r\n\r\n /**\r\n * Creates an instance of recognizer config.\r\n */\r\n protected constructor() {\r\n super();\r\n }\r\n\r\n /**\r\n * Static instance of SpeechTranslationConfig returned by passing a subscription key and service region.\r\n * @member SpeechTranslationConfig.fromSubscription\r\n * @function\r\n * @public\r\n * @param {string} subscriptionKey - The subscription key.\r\n * @param {string} region - The region name (see the region page).\r\n * @returns {SpeechTranslationConfig} The speech translation config.\r\n */\r\n public static fromSubscription(subscriptionKey: string, region: string): SpeechTranslationConfig {\r\n Contracts.throwIfNullOrWhitespace(subscriptionKey, \"subscriptionKey\");\r\n Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n const ret: SpeechTranslationConfigImpl = new SpeechTranslationConfigImpl();\r\n ret.properties.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\r\n ret.properties.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n return ret;\r\n }\r\n\r\n /**\r\n * Static instance of SpeechTranslationConfig returned by passing authorization token and service region.\r\n * Note: The caller needs to ensure that the authorization token is valid. Before the authorization token\r\n * expires, the caller needs to refresh it by setting the property authorizationToken with a new\r\n * valid token. Otherwise, all the recognizers created by this SpeechTranslationConfig instance\r\n * will encounter errors during recognition.\r\n * As configuration values are copied when creating a new recognizer, the new token value will not apply\r\n * to recognizers that have already been created.\r\n * For recognizers that have been created before, you need to set authorization token of the corresponding recognizer\r\n * to refresh the token. Otherwise, the recognizers will encounter errors during recognition.\r\n * @member SpeechTranslationConfig.fromAuthorizationToken\r\n * @function\r\n * @public\r\n * @param {string} authorizationToken - The authorization token.\r\n * @param {string} region - The region name (see the region page).\r\n * @returns {SpeechTranslationConfig} The speech translation config.\r\n */\r\n public static fromAuthorizationToken(authorizationToken: string, region: string): SpeechTranslationConfig {\r\n Contracts.throwIfNullOrWhitespace(authorizationToken, \"authorizationToken\");\r\n Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n const ret: SpeechTranslationConfigImpl = new SpeechTranslationConfigImpl();\r\n ret.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, authorizationToken);\r\n ret.properties.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n return ret;\r\n }\r\n\r\n /**\r\n * Creates an instance of the speech translation config with specified endpoint and subscription key.\r\n * This method is intended only for users who use a non-standard service endpoint or paramters.\r\n * Note: The query properties specified in the endpoint URL are not changed, even if they are\r\n * set by any other APIs. For example, if language is defined in the uri as query parameter\r\n * \"language=de-DE\", and also set by the speechRecognitionLanguage property, the language\r\n * setting in uri takes precedence, and the effective language is \"de-DE\".\r\n * Only the properties that are not specified in the endpoint URL can be set by other APIs.\r\n * Note: To use authorization token with fromEndpoint, pass an empty string to the subscriptionKey in the\r\n * fromEndpoint method, and then set authorizationToken=\"token\" on the created SpeechConfig instance to\r\n * use the authorization token.\r\n * @member SpeechTranslationConfig.fromEndpoint\r\n * @function\r\n * @public\r\n * @param {URL} endpoint - The service endpoint to connect to.\r\n * @param {string} subscriptionKey - The subscription key.\r\n * @returns {SpeechTranslationConfig} A speech config instance.\r\n */\r\n public static fromEndpoint(endpoint: URL, subscriptionKey: string): SpeechTranslationConfig {\r\n Contracts.throwIfNull(endpoint, \"endpoint\");\r\n Contracts.throwIfNull(subscriptionKey, \"subscriptionKey\");\r\n\r\n const ret: SpeechTranslationConfigImpl = new SpeechTranslationConfigImpl();\r\n ret.properties.setProperty(PropertyId.SpeechServiceConnection_Endpoint, endpoint.href);\r\n ret.properties.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\r\n return ret;\r\n }\r\n\r\n /**\r\n * Gets/Sets the authorization token.\r\n * Note: The caller needs to ensure that the authorization token is valid. Before the authorization token\r\n * expires, the caller needs to refresh it by calling this setter with a new valid token.\r\n * @member SpeechTranslationConfig.prototype.authorizationToken\r\n * @function\r\n * @public\r\n * @param {string} value - The authorization token.\r\n */\r\n public abstract set authorizationToken(value: string);\r\n\r\n /**\r\n * Gets/Sets the speech recognition language.\r\n * @member SpeechTranslationConfig.prototype.speechRecognitionLanguage\r\n * @function\r\n * @public\r\n * @param {string} value - The authorization token.\r\n */\r\n public abstract set speechRecognitionLanguage(value: string);\r\n\r\n /**\r\n * Add a (text) target language to translate into.\r\n * @member SpeechTranslationConfig.prototype.addTargetLanguage\r\n * @function\r\n * @public\r\n * @param {string} value - The language such as de-DE\r\n */\r\n public abstract addTargetLanguage(value: string): void;\r\n\r\n /**\r\n * Gets the (text) target language to translate into.\r\n * @member SpeechTranslationConfig.prototype.targetLanguages\r\n * @function\r\n * @public\r\n * @param {string} value - The language such as de-DE\r\n */\r\n public abstract get targetLanguages(): string[];\r\n\r\n /**\r\n * Gets the selected voice name.\r\n * @member SpeechTranslationConfig.prototype.voiceName\r\n * @function\r\n * @public\r\n * @returns {string} The voice name.\r\n */\r\n public abstract get voiceName(): string;\r\n\r\n /**\r\n * Gets/Sets voice of the translated language, enable voice synthesis output.\r\n * @member SpeechTranslationConfig.prototype.voiceName\r\n * @function\r\n * @public\r\n * @param {string} value - The name of the voice.\r\n */\r\n public abstract set voiceName(value: string);\r\n\r\n /**\r\n * Sets a named property as value\r\n * @member SpeechTranslationConfig.prototype.setProperty\r\n * @function\r\n * @public\r\n * @param {string} name - The name of the property.\r\n * @param {string} value - The value.\r\n */\r\n public abstract setProperty(name: string, value: string): void;\r\n\r\n /**\r\n * Dispose of associated resources.\r\n * @member SpeechTranslationConfig.prototype.close\r\n * @function\r\n * @public\r\n */\r\n public abstract close(): void;\r\n}\r\n\r\n/**\r\n * @private\r\n * @class SpeechTranslationConfigImpl\r\n */\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class SpeechTranslationConfigImpl extends SpeechTranslationConfig {\r\n\r\n private privSpeechProperties: PropertyCollection;\r\n\r\n public constructor() {\r\n super();\r\n this.privSpeechProperties = new PropertyCollection();\r\n this.outputFormat = OutputFormat.Simple;\r\n }\r\n /**\r\n * Gets/Sets the authorization token.\r\n * If this is set, subscription key is ignored.\r\n * User needs to make sure the provided authorization token is valid and not expired.\r\n * @member SpeechTranslationConfigImpl.prototype.authorizationToken\r\n * @function\r\n * @public\r\n * @param {string} value - The authorization token.\r\n */\r\n public set authorizationToken(value: string) {\r\n Contracts.throwIfNullOrWhitespace(value, \"value\");\r\n\r\n this.privSpeechProperties.setProperty(PropertyId.SpeechServiceAuthorization_Token, value);\r\n }\r\n\r\n /**\r\n * Gets/Sets the speech recognition language.\r\n * @member SpeechTranslationConfigImpl.prototype.speechRecognitionLanguage\r\n * @function\r\n * @public\r\n * @param {string} value - The authorization token.\r\n */\r\n public set speechRecognitionLanguage(value: string) {\r\n Contracts.throwIfNullOrWhitespace(value, \"value\");\r\n this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_RecoLanguage, value);\r\n }\r\n\r\n /**\r\n * @member SpeechTranslationConfigImpl.prototype.subscriptionKey\r\n * @function\r\n * @public\r\n */\r\n public get subscriptionKey(): string {\r\n return this.privSpeechProperties.getProperty(PropertyId[PropertyId.SpeechServiceConnection_Key]);\r\n }\r\n\r\n /**\r\n * Gets the output format\r\n * @member SpeechTranslationConfigImpl.prototype.outputFormat\r\n * @function\r\n * @public\r\n */\r\n public get outputFormat(): OutputFormat {\r\n return (OutputFormat as any)[this.privSpeechProperties.getProperty(OutputFormatPropertyName, undefined)];\r\n }\r\n\r\n /**\r\n * Gets/Sets the output format\r\n * @member SpeechTranslationConfigImpl.prototype.outputFormat\r\n * @function\r\n * @public\r\n */\r\n public set outputFormat(value: OutputFormat) {\r\n this.privSpeechProperties.setProperty(OutputFormatPropertyName, OutputFormat[value]);\r\n }\r\n\r\n /**\r\n * Gets the endpoint id.\r\n * @member SpeechTranslationConfigImpl.prototype.endpointId\r\n * @function\r\n * @public\r\n */\r\n public get endpointId(): string {\r\n return this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_EndpointId);\r\n }\r\n\r\n /**\r\n * Gets/Sets the endpoint id.\r\n * @member SpeechTranslationConfigImpl.prototype.endpointId\r\n * @function\r\n * @public\r\n */\r\n public set endpointId(value: string) {\r\n this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_Endpoint, value);\r\n }\r\n\r\n /**\r\n * Add a (text) target language to translate into.\r\n * @member SpeechTranslationConfigImpl.prototype.addTargetLanguage\r\n * @function\r\n * @public\r\n * @param {string} value - The language such as de-DE\r\n */\r\n public addTargetLanguage(value: string): void {\r\n Contracts.throwIfNullOrWhitespace(value, \"value\");\r\n\r\n const languages: string[] = this.targetLanguages;\r\n languages.push(value);\r\n this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages, languages.join(\",\"));\r\n }\r\n\r\n /**\r\n * Gets the (text) target language to translate into.\r\n * @member SpeechTranslationConfigImpl.prototype.targetLanguages\r\n * @function\r\n * @public\r\n * @param {string} value - The language such as de-DE\r\n */\r\n public get targetLanguages(): string[] {\r\n\r\n if (this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages, undefined) !== undefined) {\r\n return this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages).split(\",\");\r\n } else {\r\n return [];\r\n }\r\n\r\n }\r\n\r\n /**\r\n * Gets the voice name.\r\n * @member SpeechTranslationConfigImpl.prototype.voiceName\r\n * @function\r\n * @public\r\n */\r\n public get voiceName(): string {\r\n return this.getProperty(PropertyId[PropertyId.SpeechServiceConnection_TranslationVoice]);\r\n }\r\n\r\n /**\r\n * Gets/Sets the voice of the translated language, enable voice synthesis output.\r\n * @member SpeechTranslationConfigImpl.prototype.voiceName\r\n * @function\r\n * @public\r\n * @param {string} value - The name of the voice.\r\n */\r\n public set voiceName(value: string) {\r\n Contracts.throwIfNullOrWhitespace(value, \"value\");\r\n\r\n this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_TranslationVoice, value);\r\n }\r\n\r\n /**\r\n * Provides the region.\r\n * @member SpeechTranslationConfigImpl.prototype.region\r\n * @function\r\n * @public\r\n * @returns {string} The region.\r\n */\r\n public get region(): string {\r\n return this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_Region);\r\n }\r\n\r\n public setProxy(proxyHostName: string, proxyPort: number): void;\r\n public setProxy(proxyHostName: string, proxyPort: number, proxyUserName: string, proxyPassword: string): void;\r\n public setProxy(proxyHostName: any, proxyPort: any, proxyUserName?: any, proxyPassword?: any): void {\r\n this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyHostName], proxyHostName);\r\n this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyPort], proxyPort);\r\n this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyUserName], proxyUserName);\r\n this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyPassword], proxyPassword);\r\n }\r\n\r\n /**\r\n * Gets an arbitrary property value.\r\n * @member SpeechTranslationConfigImpl.prototype.getProperty\r\n * @function\r\n * @public\r\n * @param {string} name - The name of the property.\r\n * @param {string} def - The default value of the property in case it is not set.\r\n * @returns {string} The value of the property.\r\n */\r\n public getProperty(name: string, def?: string): string {\r\n return this.privSpeechProperties.getProperty(name, def);\r\n }\r\n\r\n /**\r\n * Gets/Sets an arbitrary property value.\r\n * @member SpeechTranslationConfigImpl.prototype.setProperty\r\n * @function\r\n * @public\r\n * @param {string} name - The name of the property.\r\n * @param {string} value - The value of the property.\r\n */\r\n public setProperty(name: string, value: string): void {\r\n this.privSpeechProperties.setProperty(name, value);\r\n }\r\n\r\n /**\r\n * Provides access to custom properties.\r\n * @member SpeechTranslationConfigImpl.prototype.properties\r\n * @function\r\n * @public\r\n * @returns {PropertyCollection} The properties.\r\n */\r\n public get properties(): PropertyCollection {\r\n return this.privSpeechProperties;\r\n }\r\n\r\n /**\r\n * Dispose of associated resources.\r\n * @member SpeechTranslationConfigImpl.prototype.close\r\n * @function\r\n * @public\r\n */\r\n public close(): void {\r\n return;\r\n }\r\n\r\n public setServiceProperty(name: string, value: string, channel: ServicePropertyChannel): void {\r\n const currentProperties: IStringDictionary = JSON.parse(this.privSpeechProperties.getProperty(ServicePropertiesPropertyName, \"{}\"));\r\n\r\n currentProperties[name] = value;\r\n\r\n this.privSpeechProperties.setProperty(ServicePropertiesPropertyName, JSON.stringify(currentProperties));\r\n }\r\n\r\n public setProfanity(profanity: ProfanityOption): void {\r\n this.privSpeechProperties.setProperty(PropertyId.SpeechServiceResponse_ProfanityOption, ProfanityOption[profanity]);\r\n }\r\n\r\n public enableAudioLogging(): void {\r\n this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_EnableAudioLogging, \"true\");\r\n }\r\n public requestWordLevelTimestamps(): void {\r\n this.privSpeechProperties.setProperty(PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps, \"true\");\r\n }\r\n public enableDictation(): void {\r\n this.privSpeechProperties.setProperty(ForceDictationPropertyName, \"true\");\r\n }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyId } from \"./Exports\";\r\n\r\n/**\r\n * Represents collection of properties and their values.\r\n * @class PropertyCollection\r\n */\r\nexport class PropertyCollection {\r\n private privKeys: string[] = [] as string[];\r\n private privValues: string[] = [] as string[];\r\n\r\n /**\r\n * Returns the property value in type String. The parameter must have the same type as String.\r\n * Currently only String, int and bool are allowed.\r\n * If the name is not available, the specified defaultValue is returned.\r\n * @member PropertyCollection.prototype.getProperty\r\n * @function\r\n * @public\r\n * @param {string} key - The parameter name.\r\n * @param {string} def - The default value which is returned if the parameter\r\n * is not available in the collection.\r\n * @returns {string} value of the parameter.\r\n */\r\n public getProperty(key: PropertyId | string, def?: string): string {\r\n let keyToUse: string;\r\n\r\n if (typeof key === \"string\") {\r\n keyToUse = key;\r\n } else {\r\n keyToUse = PropertyId[key];\r\n }\r\n\r\n for (let n = 0; n < this.privKeys.length; n++) {\r\n if (this.privKeys[n] === keyToUse) {\r\n return this.privValues[n];\r\n }\r\n }\r\n\r\n return def;\r\n }\r\n\r\n /**\r\n * Sets the String value of the parameter specified by name.\r\n * @member PropertyCollection.prototype.setProperty\r\n * @function\r\n * @public\r\n * @param {string} key - The parameter name.\r\n * @param {string} value - The value of the parameter.\r\n */\r\n public setProperty(key: string | PropertyId, value: string): void {\r\n let keyToUse: string;\r\n\r\n if (typeof key === \"string\") {\r\n keyToUse = key;\r\n } else {\r\n keyToUse = PropertyId[key];\r\n }\r\n\r\n for (let n = 0; n < this.privKeys.length; n++) {\r\n if (this.privKeys[n] === keyToUse) {\r\n this.privValues[n] = value;\r\n return;\r\n }\r\n }\r\n\r\n this.privKeys.push(keyToUse);\r\n this.privValues.push(value);\r\n }\r\n\r\n /**\r\n * Clones the collection.\r\n * @member PropertyCollection.prototype.clone\r\n * @function\r\n * @public\r\n * @returns {PropertyCollection} A copy of the collection.\r\n */\r\n public clone(): PropertyCollection {\r\n const clonedMap = new PropertyCollection();\r\n\r\n for (let n = 0; n < this.privKeys.length; n++) {\r\n clonedMap.privKeys.push(this.privKeys[n]);\r\n clonedMap.privValues.push(this.privValues[n]);\r\n }\r\n\r\n return clonedMap;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines speech property ids.\r\n * @class PropertyId\r\n */\r\nexport enum PropertyId {\r\n\r\n /**\r\n * The Cognitive Services Speech Service subscription Key. If you are using an intent recognizer, you need to specify\r\n * to specify the LUIS endpoint key for your particular LUIS app. Under normal circumstances, you shouldn't\r\n * have to use this property directly.\r\n * Instead, use [[SpeechConfig.fromSubscription]].\r\n * @member PropertyId.SpeechServiceConnection_Key\r\n */\r\n SpeechServiceConnection_Key = 0,\r\n\r\n /**\r\n * The Cognitive Services Speech Service endpoint (url). Under normal circumstances, you shouldn't\r\n * have to use this property directly.\r\n * Instead, use [[SpeechConfig.fromEndpoint]].\r\n * NOTE: This endpoint is not the same as the endpoint used to obtain an access token.\r\n * @member PropertyId.SpeechServiceConnection_Endpoint\r\n */\r\n SpeechServiceConnection_Endpoint,\r\n\r\n /**\r\n * The Cognitive Services Speech Service region. Under normal circumstances, you shouldn't have to\r\n * use this property directly.\r\n * Instead, use [[SpeechConfig.fromSubscription]], [[SpeechConfig.fromEndpoint]], [[SpeechConfig.fromAuthorizationToken]].\r\n * @member PropertyId.SpeechServiceConnection_Region\r\n */\r\n SpeechServiceConnection_Region,\r\n\r\n /**\r\n * The Cognitive Services Speech Service authorization token (aka access token). Under normal circumstances,\r\n * you shouldn't have to use this property directly.\r\n * Instead, use [[SpeechConfig.fromAuthorizationToken]],\r\n * [[SpeechRecognizer.authorizationToken]], [[IntentRecognizer.authorizationToken]], [[TranslationRecognizer.authorizationToken]].\r\n * @member PropertyId.SpeechServiceAuthorization_Token\r\n */\r\n SpeechServiceAuthorization_Token,\r\n\r\n /**\r\n * The Cognitive Services Speech Service authorization type. Currently unused.\r\n * @member PropertyId.SpeechServiceAuthorization_Type\r\n */\r\n SpeechServiceAuthorization_Type,\r\n\r\n /**\r\n * The Cognitive Services Speech Service endpoint id. Under normal circumstances, you shouldn't\r\n * have to use this property directly.\r\n * Instead, use [[SpeechConfig.endpointId]].\r\n * NOTE: The endpoint id is available in the Speech Portal, listed under Endpoint Details.\r\n * @member PropertyId.SpeechServiceConnection_EndpointId\r\n */\r\n SpeechServiceConnection_EndpointId,\r\n\r\n /**\r\n * The list of comma separated languages (BCP-47 format) used as target translation languages. Under normal circumstances,\r\n * you shouldn't have to use this property directly.\r\n * Instead use [[SpeechTranslationConfig.addTargetLanguage]],\r\n * [[SpeechTranslationConfig.targetLanguages]], [[TranslationRecognizer.targetLanguages]].\r\n * @member PropertyId.SpeechServiceConnection_TranslationToLanguages\r\n */\r\n SpeechServiceConnection_TranslationToLanguages,\r\n\r\n /**\r\n * The name of the Cognitive Service Text to Speech Service Voice. Under normal circumstances, you shouldn't have to use this\r\n * property directly.\r\n * Instead, use [[SpeechTranslationConfig.voiceName]].\r\n * NOTE: Valid voice names can be found here.\r\n * @member PropertyId.SpeechServiceConnection_TranslationVoice\r\n */\r\n SpeechServiceConnection_TranslationVoice,\r\n\r\n /**\r\n * Translation features.\r\n * @member PropertyId.SpeechServiceConnection_TranslationFeatures\r\n */\r\n SpeechServiceConnection_TranslationFeatures,\r\n\r\n /**\r\n * The Language Understanding Service Region. Under normal circumstances, you shouldn't have to use this property directly.\r\n * Instead, use [[LanguageUnderstandingModel]].\r\n * @member PropertyId.SpeechServiceConnection_IntentRegion\r\n */\r\n SpeechServiceConnection_IntentRegion,\r\n\r\n /**\r\n * The host name of the proxy server used to connect to the Cognitive Services Speech Service. Only relevant in Node.js environments.\r\n * You shouldn't have to use this property directly.\r\n * Instead use .\r\n * Added in version 1.4.0.\r\n */\r\n SpeechServiceConnection_ProxyHostName,\r\n\r\n /**\r\n * The port of the proxy server used to connect to the Cognitive Services Speech Service. Only relevant in Node.js environments.\r\n * You shouldn't have to use this property directly.\r\n * Instead use .\r\n * Added in version 1.4.0.\r\n */\r\n SpeechServiceConnection_ProxyPort,\r\n\r\n /**\r\n * The user name of the proxy server used to connect to the Cognitive Services Speech Service. Only relevant in Node.js environments.\r\n * You shouldn't have to use this property directly.\r\n * Instead use .\r\n * Added in version 1.4.0.\r\n */\r\n SpeechServiceConnection_ProxyUserName,\r\n\r\n /**\r\n * The password of the proxy server used to connect to the Cognitive Services Speech Service. Only relevant in Node.js environments.\r\n * You shouldn't have to use this property directly.\r\n * Instead use .\r\n * Added in version 1.4.0.\r\n */\r\n SpeechServiceConnection_ProxyPassword,\r\n\r\n /**\r\n * The Cognitive Services Speech Service recognition Mode. Can be \"INTERACTIVE\", \"CONVERSATION\", \"DICTATION\".\r\n * This property is intended to be read-only. The SDK is using it internally.\r\n * @member PropertyId.SpeechServiceConnection_RecoMode\r\n */\r\n SpeechServiceConnection_RecoMode,\r\n\r\n /**\r\n * The spoken language to be recognized (in BCP-47 format). Under normal circumstances, you shouldn't have to use this property\r\n * directly.\r\n * Instead, use [[SpeechConfig.speechRecognitionLanguage]].\r\n * @member PropertyId.SpeechServiceConnection_RecoLanguage\r\n */\r\n SpeechServiceConnection_RecoLanguage,\r\n\r\n /**\r\n * The session id. This id is a universally unique identifier (aka UUID) representing a specific binding of an audio input stream\r\n * and the underlying speech recognition instance to which it is bound. Under normal circumstances, you shouldn't have to use this\r\n * property directly.\r\n * Instead use [[SessionEventArgs.sessionId]].\r\n * @member PropertyId.Speech_SessionId\r\n */\r\n Speech_SessionId,\r\n\r\n /**\r\n * The requested Cognitive Services Speech Service response output format (simple or detailed). Under normal circumstances, you shouldn't have\r\n * to use this property directly.\r\n * Instead use [[SpeechConfig.outputFormat]].\r\n * @member PropertyId.SpeechServiceResponse_RequestDetailedResultTrueFalse\r\n */\r\n SpeechServiceResponse_RequestDetailedResultTrueFalse,\r\n\r\n /**\r\n * The requested Cognitive Services Speech Service response output profanity level. Currently unused.\r\n * @member PropertyId.SpeechServiceResponse_RequestProfanityFilterTrueFalse\r\n */\r\n SpeechServiceResponse_RequestProfanityFilterTrueFalse,\r\n\r\n /**\r\n * The Cognitive Services Speech Service response output (in JSON format). This property is available on recognition result objects only.\r\n * @member PropertyId.SpeechServiceResponse_JsonResult\r\n */\r\n SpeechServiceResponse_JsonResult,\r\n\r\n /**\r\n * The Cognitive Services Speech Service error details (in JSON format). Under normal circumstances, you shouldn't have to\r\n * use this property directly. Instead use [[CancellationDetails.errorDetails]].\r\n * @member PropertyId.SpeechServiceResponse_JsonErrorDetails\r\n */\r\n SpeechServiceResponse_JsonErrorDetails,\r\n\r\n /**\r\n * The cancellation reason. Currently unused.\r\n * @member PropertyId.CancellationDetails_Reason\r\n */\r\n CancellationDetails_Reason,\r\n\r\n /**\r\n * The cancellation text. Currently unused.\r\n * @member PropertyId.CancellationDetails_ReasonText\r\n */\r\n CancellationDetails_ReasonText,\r\n\r\n /**\r\n * The Cancellation detailed text. Currently unused.\r\n * @member PropertyId.CancellationDetails_ReasonDetailedText\r\n */\r\n CancellationDetails_ReasonDetailedText,\r\n\r\n /**\r\n * The Language Understanding Service response output (in JSON format). Available via [[IntentRecognitionResult]]\r\n * @member PropertyId.LanguageUnderstandingServiceResponse_JsonResult\r\n */\r\n LanguageUnderstandingServiceResponse_JsonResult,\r\n\r\n /**\r\n * The URL string built from speech configuration.\r\n * This property is intended to be read-only. The SDK is using it internally.\r\n * NOTE: Added in version 1.7.0.\r\n */\r\n SpeechServiceConnection_Url,\r\n\r\n /**\r\n * The initial silence timeout value (in milliseconds) used by the service.\r\n * Added in version 1.7.0\r\n */\r\n SpeechServiceConnection_InitialSilenceTimeoutMs,\r\n\r\n /**\r\n * The end silence timeout value (in milliseconds) used by the service.\r\n * Added in version 1.7.0\r\n */\r\n SpeechServiceConnection_EndSilenceTimeoutMs,\r\n\r\n /**\r\n * A boolean value specifying whether audio logging is enabled in the service or not.\r\n * Added in version 1.7.0\r\n */\r\n SpeechServiceConnection_EnableAudioLogging,\r\n\r\n /**\r\n * The requested Cognitive Services Speech Service response output profanity setting.\r\n * Allowed values are \"masked\", \"removed\", and \"raw\".\r\n * Added in version 1.7.0.\r\n */\r\n SpeechServiceResponse_ProfanityOption,\r\n\r\n /**\r\n * A string value specifying which post processing option should be used by service.\r\n * Allowed values are \"TrueText\".\r\n * Added in version 1.7.0\r\n */\r\n SpeechServiceResponse_PostProcessingOption,\r\n\r\n /**\r\n * A boolean value specifying whether to include word-level timestamps in the response result.\r\n * Added in version 1.7.0\r\n */\r\n SpeechServiceResponse_RequestWordLevelTimestamps,\r\n\r\n /**\r\n * The number of times a word has to be in partial results to be returned.\r\n * Added in version 1.7.0\r\n */\r\n SpeechServiceResponse_StablePartialResultThreshold,\r\n\r\n /**\r\n * A string value specifying the output format option in the response result. Internal use only.\r\n * Added in version 1.7.0.\r\n */\r\n SpeechServiceResponse_OutputFormatOption,\r\n\r\n /**\r\n * A boolean value to request for stabilizing translation partial results by omitting words in the end.\r\n * Added in version 1.7.0.\r\n */\r\n SpeechServiceResponse_TranslationRequestStablePartialResult,\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n CognitiveSubscriptionKeyAuthentication,\r\n CognitiveTokenAuthentication,\r\n Context,\r\n IAuthentication,\r\n IConnectionFactory,\r\n OS,\r\n RecognitionMode,\r\n RecognizerConfig,\r\n ServiceRecognizerBase,\r\n SpeechServiceConfig,\r\n} from \"../common.speech/Exports\";\r\nimport { Promise, PromiseHelper } from \"../common/Exports\";\r\nimport { Contracts } from \"./Contracts\";\r\nimport {\r\n AudioConfig,\r\n Connection,\r\n PropertyCollection,\r\n PropertyId,\r\n RecognitionEventArgs,\r\n SessionEventArgs,\r\n SpeechRecognitionResult,\r\n} from \"./Exports\";\r\n\r\n/**\r\n * Defines the base class Recognizer which mainly contains common event handlers.\r\n * @class Recognizer\r\n */\r\nexport abstract class Recognizer {\r\n private privDisposed: boolean;\r\n protected audioConfig: AudioConfig;\r\n protected privReco: ServiceRecognizerBase;\r\n protected privProperties: PropertyCollection;\r\n private privConnectionFactory: IConnectionFactory;\r\n\r\n /**\r\n * Creates and initializes an instance of a Recognizer\r\n * @constructor\r\n * @param {AudioConfig} audioInput - An optional audio input stream associated with the recognizer\r\n */\r\n protected constructor(audioConfig: AudioConfig, properties: PropertyCollection, connectionFactory: IConnectionFactory) {\r\n this.audioConfig = (audioConfig !== undefined) ? audioConfig : AudioConfig.fromDefaultMicrophoneInput();\r\n this.privDisposed = false;\r\n this.privProperties = properties.clone();\r\n this.privConnectionFactory = connectionFactory;\r\n this.implCommonRecognizerSetup();\r\n }\r\n\r\n /**\r\n * Defines event handler for session started events.\r\n * @member Recognizer.prototype.sessionStarted\r\n * @function\r\n * @public\r\n */\r\n public sessionStarted: (sender: Recognizer, event: SessionEventArgs) => void;\r\n\r\n /**\r\n * Defines event handler for session stopped events.\r\n * @member Recognizer.prototype.sessionStopped\r\n * @function\r\n * @public\r\n */\r\n public sessionStopped: (sender: Recognizer, event: SessionEventArgs) => void;\r\n\r\n /**\r\n * Defines event handler for speech started events.\r\n * @member Recognizer.prototype.speechStartDetected\r\n * @function\r\n * @public\r\n */\r\n public speechStartDetected: (sender: Recognizer, event: RecognitionEventArgs) => void;\r\n\r\n /**\r\n * Defines event handler for speech stopped events.\r\n * @member Recognizer.prototype.speechEndDetected\r\n * @function\r\n * @public\r\n */\r\n public speechEndDetected: (sender: Recognizer, event: RecognitionEventArgs) => void;\r\n\r\n /**\r\n * Dispose of associated resources.\r\n * @member Recognizer.prototype.close\r\n * @function\r\n * @public\r\n */\r\n public close(): void {\r\n Contracts.throwIfDisposed(this.privDisposed);\r\n\r\n this.dispose(true);\r\n }\r\n\r\n /**\r\n * @Internal\r\n * Internal data member to support fromRecognizer* pattern methods on other classes.\r\n * Do not use externally, object returned will change without warning or notive.\r\n */\r\n public get internalData(): object {\r\n return this.privReco;\r\n }\r\n\r\n /**\r\n * This method performs cleanup of resources.\r\n * The Boolean parameter disposing indicates whether the method is called\r\n * from Dispose (if disposing is true) or from the finalizer (if disposing is false).\r\n * Derived classes should override this method to dispose resource if needed.\r\n * @member Recognizer.prototype.dispose\r\n * @function\r\n * @public\r\n * @param {boolean} disposing - Flag to request disposal.\r\n */\r\n protected dispose(disposing: boolean): void {\r\n if (this.privDisposed) {\r\n return;\r\n }\r\n\r\n if (disposing) {\r\n if (this.privReco) {\r\n this.privReco.audioSource.turnOff();\r\n this.privReco.dispose();\r\n }\r\n }\r\n\r\n this.privDisposed = true;\r\n }\r\n\r\n /**\r\n * This method returns the current state of the telemetry setting.\r\n * @member Recognizer.prototype.telemetryEnabled\r\n * @function\r\n * @public\r\n * @returns true if the telemetry is enabled, false otherwise.\r\n */\r\n public static get telemetryEnabled(): boolean {\r\n return ServiceRecognizerBase.telemetryDataEnabled;\r\n }\r\n\r\n /**\r\n * This method globally enables or disables telemetry.\r\n * @member Recognizer.prototype.enableTelemetry\r\n * @function\r\n * @public\r\n * @param enabled - Global setting for telemetry collection.\r\n * If set to true, telemetry information like microphone errors,\r\n * recognition errors are collected and sent to Microsoft.\r\n * If set to false, no telemetry is sent to Microsoft.\r\n */\r\n /* tslint:disable:member-ordering */\r\n public static enableTelemetry(enabled: boolean): void {\r\n ServiceRecognizerBase.telemetryDataEnabled = enabled;\r\n }\r\n\r\n //\r\n // ################################################################################################################\r\n // IMPLEMENTATION.\r\n // Move to independent class\r\n // ################################################################################################################\r\n //\r\n protected abstract createRecognizerConfig(speecgConfig: SpeechServiceConfig): RecognizerConfig;\r\n\r\n // Creates the correct service recognizer for the type\r\n protected abstract createServiceRecognizer(\r\n authentication: IAuthentication,\r\n connectionFactory: IConnectionFactory,\r\n audioConfig: AudioConfig,\r\n recognizerConfig: RecognizerConfig): ServiceRecognizerBase;\r\n\r\n // Does the generic recognizer setup that is common accross all recognizer types.\r\n protected implCommonRecognizerSetup(): void {\r\n\r\n let osPlatform = (typeof window !== \"undefined\") ? \"Browser\" : \"Node\";\r\n let osName = \"unknown\";\r\n let osVersion = \"unknown\";\r\n\r\n if (typeof navigator !== \"undefined\") {\r\n osPlatform = osPlatform + \"/\" + navigator.platform;\r\n osName = navigator.userAgent;\r\n osVersion = navigator.appVersion;\r\n }\r\n\r\n const recognizerConfig = this.createRecognizerConfig(\r\n new SpeechServiceConfig(\r\n new Context(new OS(osPlatform, osName, osVersion))));\r\n\r\n const subscriptionKey = this.privProperties.getProperty(PropertyId.SpeechServiceConnection_Key, undefined);\r\n const authentication = (subscriptionKey && subscriptionKey !== \"\") ?\r\n new CognitiveSubscriptionKeyAuthentication(subscriptionKey) :\r\n new CognitiveTokenAuthentication(\r\n (authFetchEventId: string): Promise => {\r\n const authorizationToken = this.privProperties.getProperty(PropertyId.SpeechServiceAuthorization_Token, undefined);\r\n return PromiseHelper.fromResult(authorizationToken);\r\n },\r\n (authFetchEventId: string): Promise => {\r\n const authorizationToken = this.privProperties.getProperty(PropertyId.SpeechServiceAuthorization_Token, undefined);\r\n return PromiseHelper.fromResult(authorizationToken);\r\n });\r\n\r\n this.privReco = this.createServiceRecognizer(\r\n authentication,\r\n this.privConnectionFactory,\r\n this.audioConfig,\r\n recognizerConfig);\r\n }\r\n\r\n // Start the recognition\r\n protected implRecognizerStart(\r\n recognitionMode: RecognitionMode,\r\n successCallback: (e: SpeechRecognitionResult) => void,\r\n errorCallback: (e: string) => void): void {\r\n this.privReco.recognize(recognitionMode, successCallback, errorCallback).on(\r\n /* tslint:disable:no-empty */\r\n (result: boolean): void => { },\r\n (error: string): void => {\r\n if (!!errorCallback) {\r\n // Internal error with service communication.\r\n errorCallback(\"Runtime error: \" + error);\r\n }\r\n });\r\n }\r\n\r\n protected implRecognizerStop(): void {\r\n if (this.privReco) {\r\n this.privReco.stopRecognizing();\r\n }\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n IAuthentication,\r\n IConnectionFactory,\r\n OutputFormatPropertyName,\r\n RecognitionMode,\r\n RecognizerConfig,\r\n ServiceRecognizerBase,\r\n SpeechServiceConfig,\r\n SpeechServiceRecognizer,\r\n} from \"../common.speech/Exports\";\r\nimport { SpeechConnectionFactory } from \"../common.speech/SpeechConnectionFactory\";\r\nimport { AudioConfigImpl } from \"./Audio/AudioConfig\";\r\nimport { Contracts } from \"./Contracts\";\r\nimport {\r\n AudioConfig,\r\n KeywordRecognitionModel,\r\n OutputFormat,\r\n PropertyCollection,\r\n PropertyId,\r\n Recognizer,\r\n SpeechRecognitionCanceledEventArgs,\r\n SpeechRecognitionEventArgs,\r\n SpeechRecognitionResult,\r\n} from \"./Exports\";\r\nimport { SpeechConfig, SpeechConfigImpl } from \"./SpeechConfig\";\r\n\r\n/**\r\n * Performs speech recognition from microphone, file, or other audio input streams, and gets transcribed text as result.\r\n * @class SpeechRecognizer\r\n */\r\nexport class SpeechRecognizer extends Recognizer {\r\n private privDisposedSpeechRecognizer: boolean;\r\n\r\n /**\r\n * SpeechRecognizer constructor.\r\n * @constructor\r\n * @param {SpeechConfig} speechConfig - An set of initial properties for this recognizer\r\n * @param {AudioConfig} audioConfig - An optional audio configuration associated with the recognizer\r\n */\r\n public constructor(speechConfig: SpeechConfig, audioConfig?: AudioConfig) {\r\n const speechConfigImpl: SpeechConfigImpl = speechConfig as SpeechConfigImpl;\r\n Contracts.throwIfNull(speechConfigImpl, \"speechConfig\");\r\n\r\n Contracts.throwIfNullOrWhitespace(\r\n speechConfigImpl.properties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage),\r\n PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage]);\r\n\r\n super(audioConfig, speechConfigImpl.properties, new SpeechConnectionFactory());\r\n this.privDisposedSpeechRecognizer = false;\r\n }\r\n\r\n /**\r\n * The event recognizing signals that an intermediate recognition result is received.\r\n * @member SpeechRecognizer.prototype.recognizing\r\n * @function\r\n * @public\r\n */\r\n public recognizing: (sender: Recognizer, event: SpeechRecognitionEventArgs) => void;\r\n\r\n /**\r\n * The event recognized signals that a final recognition result is received.\r\n * @member SpeechRecognizer.prototype.recognized\r\n * @function\r\n * @public\r\n */\r\n public recognized: (sender: Recognizer, event: SpeechRecognitionEventArgs) => void;\r\n\r\n /**\r\n * The event canceled signals that an error occurred during recognition.\r\n * @member SpeechRecognizer.prototype.canceled\r\n * @function\r\n * @public\r\n */\r\n public canceled: (sender: Recognizer, event: SpeechRecognitionCanceledEventArgs) => void;\r\n\r\n /**\r\n * Gets the endpoint id of a customized speech model that is used for speech recognition.\r\n * @member SpeechRecognizer.prototype.endpointId\r\n * @function\r\n * @public\r\n * @returns {string} the endpoint id of a customized speech model that is used for speech recognition.\r\n */\r\n public get endpointId(): string {\r\n Contracts.throwIfDisposed(this.privDisposedSpeechRecognizer);\r\n\r\n return this.properties.getProperty(PropertyId.SpeechServiceConnection_EndpointId, \"00000000-0000-0000-0000-000000000000\");\r\n }\r\n\r\n /**\r\n * Gets the authorization token used to communicate with the service.\r\n * @member SpeechRecognizer.prototype.authorizationToken\r\n * @function\r\n * @public\r\n * @returns {string} Authorization token.\r\n */\r\n public get authorizationToken(): string {\r\n return this.properties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n }\r\n\r\n /**\r\n * Gets/Sets the authorization token used to communicate with the service.\r\n * @member SpeechRecognizer.prototype.authorizationToken\r\n * @function\r\n * @public\r\n * @param {string} token - Authorization token.\r\n */\r\n public set authorizationToken(token: string) {\r\n Contracts.throwIfNullOrWhitespace(token, \"token\");\r\n this.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, token);\r\n }\r\n\r\n /**\r\n * Gets the spoken language of recognition.\r\n * @member SpeechRecognizer.prototype.speechRecognitionLanguage\r\n * @function\r\n * @public\r\n * @returns {string} The spoken language of recognition.\r\n */\r\n public get speechRecognitionLanguage(): string {\r\n Contracts.throwIfDisposed(this.privDisposedSpeechRecognizer);\r\n\r\n return this.properties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage);\r\n }\r\n\r\n /**\r\n * Gets the output format of recognition.\r\n * @member SpeechRecognizer.prototype.outputFormat\r\n * @function\r\n * @public\r\n * @returns {OutputFormat} The output format of recognition.\r\n */\r\n public get outputFormat(): OutputFormat {\r\n Contracts.throwIfDisposed(this.privDisposedSpeechRecognizer);\r\n\r\n if (this.properties.getProperty(OutputFormatPropertyName, OutputFormat[OutputFormat.Simple]) === OutputFormat[OutputFormat.Simple]) {\r\n return OutputFormat.Simple;\r\n } else {\r\n return OutputFormat.Detailed;\r\n }\r\n }\r\n\r\n /**\r\n * The collection of properties and their values defined for this SpeechRecognizer.\r\n * @member SpeechRecognizer.prototype.properties\r\n * @function\r\n * @public\r\n * @returns {PropertyCollection} The collection of properties and their values defined for this SpeechRecognizer.\r\n */\r\n public get properties(): PropertyCollection {\r\n return this.privProperties;\r\n }\r\n\r\n /**\r\n * Starts speech recognition, and stops after the first utterance is recognized.\r\n * The task returns the recognition text as result.\r\n * Note: RecognizeOnceAsync() returns when the first utterance has been recognized,\r\n * so it is suitable only for single shot recognition\r\n * like command or query. For long-running recognition, use StartContinuousRecognitionAsync() instead.\r\n * @member SpeechRecognizer.prototype.recognizeOnceAsync\r\n * @function\r\n * @public\r\n * @param cb - Callback that received the SpeechRecognitionResult.\r\n * @param err - Callback invoked in case of an error.\r\n */\r\n public recognizeOnceAsync(cb?: (e: SpeechRecognitionResult) => void, err?: (e: string) => void): void {\r\n try {\r\n Contracts.throwIfDisposed(this.privDisposedSpeechRecognizer);\r\n\r\n this.implRecognizerStop();\r\n\r\n this.implRecognizerStart(RecognitionMode.Interactive, (e: SpeechRecognitionResult) => {\r\n this.implRecognizerStop();\r\n if (!!cb) {\r\n cb(e);\r\n }\r\n }, (e: string) => {\r\n this.implRecognizerStop();\r\n if (!!err) {\r\n err(e);\r\n }\r\n });\r\n } catch (error) {\r\n if (!!err) {\r\n if (error instanceof Error) {\r\n const typedError: Error = error as Error;\r\n err(typedError.name + \": \" + typedError.message);\r\n } else {\r\n err(error);\r\n }\r\n }\r\n\r\n // Destroy the recognizer.\r\n this.dispose(true);\r\n }\r\n }\r\n\r\n /**\r\n * Starts speech recognition, until stopContinuousRecognitionAsync() is called.\r\n * User must subscribe to events to receive recognition results.\r\n * @member SpeechRecognizer.prototype.startContinuousRecognitionAsync\r\n * @function\r\n * @public\r\n * @param cb - Callback invoked once the recognition has started.\r\n * @param err - Callback invoked in case of an error.\r\n */\r\n public startContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void): void {\r\n try {\r\n Contracts.throwIfDisposed(this.privDisposedSpeechRecognizer);\r\n\r\n this.implRecognizerStop();\r\n\r\n this.implRecognizerStart(RecognitionMode.Conversation, undefined, undefined);\r\n\r\n // report result to promise.\r\n if (!!cb) {\r\n try {\r\n cb();\r\n } catch (e) {\r\n if (!!err) {\r\n err(e);\r\n }\r\n }\r\n cb = undefined;\r\n }\r\n } catch (error) {\r\n if (!!err) {\r\n if (error instanceof Error) {\r\n const typedError: Error = error as Error;\r\n err(typedError.name + \": \" + typedError.message);\r\n } else {\r\n err(error);\r\n }\r\n }\r\n\r\n // Destroy the recognizer.\r\n this.dispose(true);\r\n }\r\n }\r\n\r\n /**\r\n * Stops continuous speech recognition.\r\n * @member SpeechRecognizer.prototype.stopContinuousRecognitionAsync\r\n * @function\r\n * @public\r\n * @param cb - Callback invoked once the recognition has stopped.\r\n * @param err - Callback invoked in case of an error.\r\n */\r\n public stopContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void): void {\r\n try {\r\n Contracts.throwIfDisposed(this.privDisposedSpeechRecognizer);\r\n\r\n this.implRecognizerStop();\r\n\r\n if (!!cb) {\r\n try {\r\n cb();\r\n } catch (e) {\r\n if (!!err) {\r\n err(e);\r\n }\r\n }\r\n }\r\n } catch (error) {\r\n if (!!err) {\r\n if (error instanceof Error) {\r\n const typedError: Error = error as Error;\r\n err(typedError.name + \": \" + typedError.message);\r\n } else {\r\n err(error);\r\n }\r\n }\r\n\r\n // Destroy the recognizer.\r\n this.dispose(true);\r\n }\r\n }\r\n\r\n /**\r\n * Starts speech recognition with keyword spotting, until\r\n * stopKeywordRecognitionAsync() is called.\r\n * User must subscribe to events to receive recognition results.\r\n * Note: Key word spotting functionality is only available on the\r\n * Speech Devices SDK. This functionality is currently not included in the SDK itself.\r\n * @member SpeechRecognizer.prototype.startKeywordRecognitionAsync\r\n * @function\r\n * @public\r\n * @param {KeywordRecognitionModel} model The keyword recognition model that\r\n * specifies the keyword to be recognized.\r\n * @param cb - Callback invoked once the recognition has started.\r\n * @param err - Callback invoked in case of an error.\r\n */\r\n public startKeywordRecognitionAsync(model: KeywordRecognitionModel, cb?: () => void, err?: (e: string) => void): void {\r\n Contracts.throwIfNull(model, \"model\");\r\n\r\n if (!!err) {\r\n err(\"Not yet implemented.\");\r\n }\r\n }\r\n\r\n /**\r\n * Stops continuous speech recognition.\r\n * Note: Key word spotting functionality is only available on the\r\n * Speech Devices SDK. This functionality is currently not included in the SDK itself.\r\n * @member SpeechRecognizer.prototype.stopKeywordRecognitionAsync\r\n * @function\r\n * @public\r\n * @param cb - Callback invoked once the recognition has stopped.\r\n * @param err - Callback invoked in case of an error.\r\n */\r\n public stopKeywordRecognitionAsync(cb?: () => void, err?: (e: string) => void): void {\r\n if (!!cb) {\r\n cb();\r\n }\r\n }\r\n\r\n /**\r\n * closes all external resources held by an instance of this class.\r\n * @member SpeechRecognizer.prototype.close\r\n * @function\r\n * @public\r\n */\r\n public close(): void {\r\n Contracts.throwIfDisposed(this.privDisposedSpeechRecognizer);\r\n\r\n this.dispose(true);\r\n }\r\n\r\n /**\r\n * Disposes any resources held by the object.\r\n * @member SpeechRecognizer.prototype.dispose\r\n * @function\r\n * @public\r\n * @param {boolean} disposing - true if disposing the object.\r\n */\r\n protected dispose(disposing: boolean): void {\r\n if (this.privDisposedSpeechRecognizer) {\r\n return;\r\n }\r\n\r\n if (disposing) {\r\n this.implRecognizerStop();\r\n this.privDisposedSpeechRecognizer = true;\r\n }\r\n\r\n super.dispose(disposing);\r\n }\r\n\r\n protected createRecognizerConfig(speechConfig: SpeechServiceConfig): RecognizerConfig {\r\n return new RecognizerConfig(\r\n speechConfig,\r\n this.properties);\r\n }\r\n\r\n protected createServiceRecognizer(\r\n authentication: IAuthentication,\r\n connectionFactory: IConnectionFactory,\r\n audioConfig: AudioConfig,\r\n recognizerConfig: RecognizerConfig): ServiceRecognizerBase {\r\n const configImpl: AudioConfigImpl = audioConfig as AudioConfigImpl;\r\n return new SpeechServiceRecognizer(authentication, connectionFactory, configImpl, recognizerConfig, this);\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n ProxyInfo,\r\n WebsocketConnection,\r\n} from \"../common.browser/Exports\";\r\nimport {\r\n ForceDictationPropertyName,\r\n OutputFormatPropertyName,\r\n} from \"../common.speech/Exports\";\r\nimport {\r\n IConnection,\r\n IStringDictionary\r\n} from \"../common/Exports\";\r\nimport {\r\n OutputFormat,\r\n PropertyId\r\n} from \"../sdk/Exports\";\r\nimport {\r\n ConnectionFactoryBase\r\n} from \"./ConnectionFactoryBase\";\r\nimport {\r\n AuthInfo,\r\n RecognitionMode,\r\n RecognizerConfig,\r\n WebsocketMessageFormatter\r\n} from \"./Exports\";\r\nimport {\r\n QueryParameterNames\r\n} from \"./QueryParameterNames\";\r\n\r\nexport class SpeechConnectionFactory extends ConnectionFactoryBase {\r\n\r\n private readonly interactiveRelativeUri: string = \"/speech/recognition/interactive/cognitiveservices/v1\";\r\n private readonly conversationRelativeUri: string = \"/speech/recognition/conversation/cognitiveservices/v1\";\r\n private readonly dictationRelativeUri: string = \"/speech/recognition/dictation/cognitiveservices/v1\";\r\n\r\n public create = (\r\n config: RecognizerConfig,\r\n authInfo: AuthInfo,\r\n connectionId?: string): IConnection => {\r\n\r\n let endpoint: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint, undefined);\r\n\r\n const queryParams: IStringDictionary = {};\r\n\r\n const endpointId: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_EndpointId, undefined);\r\n const language: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage, undefined);\r\n\r\n if (endpointId) {\r\n if (!endpoint || endpoint.search(QueryParameterNames.DeploymentIdParamName) === -1) {\r\n queryParams[QueryParameterNames.DeploymentIdParamName] = endpointId;\r\n }\r\n } else if (language) {\r\n if (!endpoint || endpoint.search(QueryParameterNames.LanguageParamName) === -1) {\r\n queryParams[QueryParameterNames.LanguageParamName] = language;\r\n }\r\n }\r\n\r\n if (!endpoint || endpoint.search(QueryParameterNames.FormatParamName) === -1) {\r\n queryParams[QueryParameterNames.FormatParamName] = config.parameters.getProperty(OutputFormatPropertyName, OutputFormat[OutputFormat.Simple]).toLowerCase();\r\n }\r\n\r\n this.setCommonUrlParams(config, queryParams, endpoint);\r\n\r\n if (!endpoint) {\r\n const region: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Region, undefined);\r\n\r\n const host: string = \"wss://\" + region + \".stt.speech.microsoft.com\";\r\n\r\n switch (config.recognitionMode) {\r\n case RecognitionMode.Conversation:\r\n if (config.parameters.getProperty(ForceDictationPropertyName, \"false\") === \"true\") {\r\n endpoint = host + this.dictationRelativeUri;\r\n } else {\r\n endpoint = host + this.conversationRelativeUri;\r\n }\r\n break;\r\n case RecognitionMode.Dictation:\r\n endpoint = host + this.dictationRelativeUri;\r\n break;\r\n default:\r\n endpoint = host + this.interactiveRelativeUri; // default is interactive\r\n break;\r\n }\r\n }\r\n\r\n const headers: IStringDictionary = {};\r\n headers[authInfo.headerName] = authInfo.token;\r\n headers[QueryParameterNames.ConnectionIdHeader] = connectionId;\r\n\r\n return new WebsocketConnection(endpoint, queryParams, headers, new WebsocketMessageFormatter(), ProxyInfo.fromRecognizerConfig(config), connectionId);\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n ServicePropertiesPropertyName,\r\n} from \"../common.speech/Exports\";\r\nimport { IConnection, IStringDictionary } from \"../common/Exports\";\r\nimport { OutputFormat, PropertyId } from \"../sdk/Exports\";\r\nimport { AuthInfo, IConnectionFactory, RecognitionMode, RecognizerConfig, WebsocketMessageFormatter } from \"./Exports\";\r\nimport { QueryParameterNames } from \"./QueryParameterNames\";\r\n\r\nexport abstract class ConnectionFactoryBase implements IConnectionFactory {\r\n public abstract create(\r\n config: RecognizerConfig,\r\n authInfo: AuthInfo,\r\n connectionId?: string): IConnection;\r\n\r\n protected setCommonUrlParams(\r\n config: RecognizerConfig,\r\n queryParams: IStringDictionary,\r\n endpoint: string): void {\r\n\r\n this.setUrlParameter(PropertyId.SpeechServiceConnection_EnableAudioLogging,\r\n QueryParameterNames.EnableAudioLogging,\r\n config,\r\n queryParams,\r\n endpoint);\r\n\r\n this.setUrlParameter(PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps,\r\n QueryParameterNames.EnableWordLevelTimestamps,\r\n config,\r\n queryParams,\r\n endpoint);\r\n\r\n this.setUrlParameter(PropertyId.SpeechServiceResponse_ProfanityOption,\r\n QueryParameterNames.Profanify,\r\n config,\r\n queryParams,\r\n endpoint);\r\n\r\n this.setUrlParameter(PropertyId.SpeechServiceConnection_InitialSilenceTimeoutMs,\r\n QueryParameterNames.InitialSilenceTimeoutMs,\r\n config,\r\n queryParams,\r\n endpoint);\r\n\r\n this.setUrlParameter(PropertyId.SpeechServiceConnection_EndSilenceTimeoutMs,\r\n QueryParameterNames.EndSilenceTimeoutMs,\r\n config,\r\n queryParams,\r\n endpoint);\r\n\r\n this.setUrlParameter(PropertyId.SpeechServiceResponse_StablePartialResultThreshold,\r\n QueryParameterNames.StableIntermediateThreshold,\r\n config,\r\n queryParams,\r\n endpoint);\r\n\r\n const serviceProperties: IStringDictionary = JSON.parse(config.parameters.getProperty(ServicePropertiesPropertyName, \"{}\"));\r\n\r\n Object.keys(serviceProperties).forEach((value: string, num: number, array: string[]) => {\r\n queryParams[value] = serviceProperties[value];\r\n });\r\n }\r\n\r\n protected setUrlParameter(\r\n propId: PropertyId,\r\n parameterName: string,\r\n config: RecognizerConfig,\r\n queryParams: IStringDictionary,\r\n endpoint: string): void {\r\n\r\n const value: string = config.parameters.getProperty(propId, undefined);\r\n\r\n if (value && (!endpoint || endpoint.search(parameterName) === -1)) {\r\n queryParams[parameterName] = value.toLocaleLowerCase();\r\n }\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport class QueryParameterNames {\r\n public static get TestHooksParamName(): string {\r\n return \"testhooks\";\r\n }\r\n public static get ConnectionIdHeader(): string {\r\n return \"X-ConnectionId\";\r\n }\r\n public static get DeploymentIdParamName(): string {\r\n return \"cid\";\r\n }\r\n public static get FormatParamName(): string {\r\n return \"format\";\r\n }\r\n public static get LanguageParamName(): string {\r\n return \"language\";\r\n }\r\n public static get TranslationFromParamName(): string {\r\n return \"from\";\r\n }\r\n public static get TranslationToParamName(): string {\r\n return \"to\";\r\n }\r\n public static get Profanify(): string {\r\n return \"profanity\";\r\n }\r\n public static get EnableAudioLogging(): string {\r\n return \"storeAudio\";\r\n }\r\n public static get EnableWordLevelTimestamps(): string {\r\n return \"wordLevelTimestamps\";\r\n }\r\n public static get InitialSilenceTimeoutMs(): string {\r\n return \"initialSilenceTimeoutMs\";\r\n }\r\n public static get EndSilenceTimeoutMs(): string {\r\n return \"endSilenceTimeoutMs\";\r\n }\r\n public static get StableIntermediateThreshold(): string {\r\n return \"stableIntermediateThreshold\";\r\n }\r\n public static get StableTranslation(): string {\r\n return \"stableTranslation\";\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n AddedLmIntent,\r\n IAuthentication,\r\n IConnectionFactory,\r\n IntentConnectionFactory,\r\n IntentServiceRecognizer,\r\n RecognitionMode,\r\n RecognizerConfig,\r\n ServiceRecognizerBase,\r\n SpeechServiceConfig,\r\n} from \"../common.speech/Exports\";\r\nimport { AudioConfigImpl } from \"./Audio/AudioConfig\";\r\nimport { Contracts } from \"./Contracts\";\r\nimport {\r\n AudioConfig,\r\n IntentRecognitionCanceledEventArgs,\r\n IntentRecognitionEventArgs,\r\n IntentRecognitionResult,\r\n KeywordRecognitionModel,\r\n LanguageUnderstandingModel,\r\n PropertyCollection,\r\n PropertyId,\r\n Recognizer,\r\n SpeechConfig,\r\n} from \"./Exports\";\r\nimport { LanguageUnderstandingModelImpl } from \"./LanguageUnderstandingModel\";\r\nimport { SpeechConfigImpl } from \"./SpeechConfig\";\r\n\r\n/**\r\n * Intent recognizer.\r\n * @class\r\n */\r\nexport class IntentRecognizer extends Recognizer {\r\n private privDisposedIntentRecognizer: boolean;\r\n private privAddedIntents: string[][];\r\n private privAddedLmIntents: { [id: string]: AddedLmIntent; };\r\n private privUmbrellaIntent: AddedLmIntent;\r\n\r\n /**\r\n * Initializes an instance of the IntentRecognizer.\r\n * @constructor\r\n * @param {SpeechConfig} speechConfig - The set of configuration properties.\r\n * @param {AudioConfig} audioConfig - An optional audio input config associated with the recognizer\r\n */\r\n public constructor(speechConfig: SpeechConfig, audioConfig?: AudioConfig) {\r\n Contracts.throwIfNullOrUndefined(speechConfig, \"speechConfig\");\r\n const configImpl: SpeechConfigImpl = speechConfig as SpeechConfigImpl;\r\n Contracts.throwIfNullOrUndefined(configImpl, \"speechConfig\");\r\n\r\n super(audioConfig, configImpl.properties, new IntentConnectionFactory());\r\n this.privAddedIntents = [];\r\n this.privAddedLmIntents = {};\r\n\r\n this.privDisposedIntentRecognizer = false;\r\n this.privProperties = configImpl.properties;\r\n\r\n Contracts.throwIfNullOrWhitespace(this.properties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage), PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage]);\r\n }\r\n\r\n /**\r\n * The event recognizing signals that an intermediate recognition result is received.\r\n * @member IntentRecognizer.prototype.recognizing\r\n * @function\r\n * @public\r\n */\r\n public recognizing: (sender: IntentRecognizer, event: IntentRecognitionEventArgs) => void;\r\n\r\n /**\r\n * The event recognized signals that a final recognition result is received.\r\n * @member IntentRecognizer.prototype.recognized\r\n * @function\r\n * @public\r\n */\r\n public recognized: (sender: IntentRecognizer, event: IntentRecognitionEventArgs) => void;\r\n\r\n /**\r\n * The event canceled signals that an error occurred during recognition.\r\n * @member IntentRecognizer.prototype.canceled\r\n * @function\r\n * @public\r\n */\r\n public canceled: (sender: IntentRecognizer, event: IntentRecognitionCanceledEventArgs) => void;\r\n\r\n /**\r\n * Gets the spoken language of recognition.\r\n * @member IntentRecognizer.prototype.speechRecognitionLanguage\r\n * @function\r\n * @public\r\n * @returns {string} the spoken language of recognition.\r\n */\r\n public get speechRecognitionLanguage(): string {\r\n Contracts.throwIfDisposed(this.privDisposedIntentRecognizer);\r\n\r\n return this.properties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage);\r\n }\r\n\r\n /**\r\n * Gets the authorization token used to communicate with the service.\r\n * @member IntentRecognizer.prototype.authorizationToken\r\n * @function\r\n * @public\r\n * @returns {string} Authorization token.\r\n */\r\n public get authorizationToken(): string {\r\n return this.properties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n }\r\n\r\n /**\r\n * Gets/Sets the authorization token used to communicate with the service.\r\n * Note: Please use a token derived from your LanguageUnderstanding subscription key for the Intent recognizer.\r\n * @member IntentRecognizer.prototype.authorizationToken\r\n * @function\r\n * @public\r\n * @param {string} value - Authorization token.\r\n */\r\n public set authorizationToken(value: string) {\r\n this.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, value);\r\n }\r\n\r\n /**\r\n * The collection of properties and their values defined for this IntentRecognizer.\r\n * @member IntentRecognizer.prototype.properties\r\n * @function\r\n * @public\r\n * @returns {PropertyCollection} The collection of properties and their\r\n * values defined for this IntentRecognizer.\r\n */\r\n public get properties(): PropertyCollection {\r\n return this.privProperties;\r\n }\r\n\r\n /**\r\n * Starts intent recognition, and stops after the first utterance is recognized.\r\n * The task returns the recognition text and intent as result.\r\n * Note: RecognizeOnceAsync() returns when the first utterance has been recognized,\r\n * so it is suitable only for single shot recognition like command or query.\r\n * For long-running recognition, use StartContinuousRecognitionAsync() instead.\r\n * @member IntentRecognizer.prototype.recognizeOnceAsync\r\n * @function\r\n * @public\r\n * @param cb - Callback that received the recognition has finished with an IntentRecognitionResult.\r\n * @param err - Callback invoked in case of an error.\r\n */\r\n public recognizeOnceAsync(cb?: (e: IntentRecognitionResult) => void, err?: (e: string) => void): void {\r\n try {\r\n Contracts.throwIfDisposed(this.privDisposedIntentRecognizer);\r\n\r\n this.implRecognizerStop();\r\n\r\n if (Object.keys(this.privAddedLmIntents).length !== 0 || undefined !== this.privUmbrellaIntent) {\r\n const context: IIntentContext = this.buildSpeechContext();\r\n\r\n this.privReco.speechContext.setSection(\"intent\", context.Intent);\r\n this.privReco.dynamicGrammar.addReferenceGrammar(context.ReferenceGrammars);\r\n\r\n const intentReco: IntentServiceRecognizer = this.privReco as IntentServiceRecognizer;\r\n intentReco.setIntents(this.privAddedLmIntents, this.privUmbrellaIntent);\r\n }\r\n\r\n this.implRecognizerStart(RecognitionMode.Interactive, (e: IntentRecognitionResult) => {\r\n this.implRecognizerStop();\r\n if (!!cb) {\r\n cb(e);\r\n }\r\n }, (e: string) => {\r\n this.implRecognizerStop();\r\n if (!!err) {\r\n err(e);\r\n }\r\n });\r\n\r\n } catch (error) {\r\n if (!!err) {\r\n if (error instanceof Error) {\r\n const typedError: Error = error as Error;\r\n err(typedError.name + \": \" + typedError.message);\r\n } else {\r\n err(error);\r\n }\r\n }\r\n\r\n // Destroy the recognizer.\r\n this.dispose(true);\r\n }\r\n }\r\n\r\n /**\r\n * Starts speech recognition, until stopContinuousRecognitionAsync() is called.\r\n * User must subscribe to events to receive recognition results.\r\n * @member IntentRecognizer.prototype.startContinuousRecognitionAsync\r\n * @function\r\n * @public\r\n * @param cb - Callback invoked once the recognition has started.\r\n * @param err - Callback invoked in case of an error.\r\n */\r\n public startContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void): void {\r\n try {\r\n Contracts.throwIfDisposed(this.privDisposedIntentRecognizer);\r\n\r\n this.implRecognizerStop();\r\n\r\n if (Object.keys(this.privAddedLmIntents).length !== 0) {\r\n const context: IIntentContext = this.buildSpeechContext();\r\n\r\n this.privReco.speechContext.setSection(\"intent\", context.Intent);\r\n this.privReco.dynamicGrammar.addReferenceGrammar(context.ReferenceGrammars);\r\n\r\n const intentReco: IntentServiceRecognizer = this.privReco as IntentServiceRecognizer;\r\n intentReco.setIntents(this.privAddedLmIntents, this.privUmbrellaIntent);\r\n }\r\n\r\n this.implRecognizerStart(RecognitionMode.Conversation, undefined, undefined);\r\n\r\n // report result to promise.\r\n if (!!cb) {\r\n try {\r\n cb();\r\n } catch (e) {\r\n if (!!err) {\r\n err(e);\r\n }\r\n }\r\n cb = undefined;\r\n }\r\n } catch (error) {\r\n if (!!err) {\r\n if (error instanceof Error) {\r\n const typedError: Error = error as Error;\r\n err(typedError.name + \": \" + typedError.message);\r\n } else {\r\n err(error);\r\n }\r\n }\r\n\r\n // Destroy the recognizer.\r\n this.dispose(true);\r\n }\r\n }\r\n\r\n /**\r\n * Stops continuous intent recognition.\r\n * @member IntentRecognizer.prototype.stopContinuousRecognitionAsync\r\n * @function\r\n * @public\r\n * @param cb - Callback invoked once the recognition has stopped.\r\n * @param err - Callback invoked in case of an error.\r\n */\r\n public stopContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void): void {\r\n try {\r\n Contracts.throwIfDisposed(this.privDisposedIntentRecognizer);\r\n\r\n this.implRecognizerStop();\r\n\r\n if (!!cb) {\r\n try {\r\n cb();\r\n } catch (e) {\r\n if (!!err) {\r\n err(e);\r\n }\r\n }\r\n }\r\n } catch (error) {\r\n if (!!err) {\r\n if (error instanceof Error) {\r\n const typedError: Error = error as Error;\r\n err(typedError.name + \": \" + typedError.message);\r\n } else {\r\n err(error);\r\n }\r\n }\r\n\r\n // Destroy the recognizer.\r\n this.dispose(true);\r\n }\r\n }\r\n\r\n /**\r\n * Starts speech recognition with keyword spotting, until stopKeywordRecognitionAsync() is called.\r\n * User must subscribe to events to receive recognition results.\r\n * Note: Key word spotting functionality is only available on the Speech Devices SDK.\r\n * This functionality is currently not included in the SDK itself.\r\n * @member IntentRecognizer.prototype.startKeywordRecognitionAsync\r\n * @function\r\n * @public\r\n * @param {KeywordRecognitionModel} model - The keyword recognition model that specifies the keyword to be recognized.\r\n * @param cb - Callback invoked once the recognition has started.\r\n * @param err - Callback invoked in case of an error.\r\n */\r\n public startKeywordRecognitionAsync(model: KeywordRecognitionModel, cb?: () => void, err?: (e: string) => void): void {\r\n Contracts.throwIfNull(model, \"model\");\r\n\r\n if (!!err) {\r\n err(\"Not yet implemented.\");\r\n }\r\n }\r\n\r\n /**\r\n * Stops continuous speech recognition.\r\n * Note: Key word spotting functionality is only available on the Speech Devices SDK.\r\n * This functionality is currently not included in the SDK itself.\r\n * @member IntentRecognizer.prototype.stopKeywordRecognitionAsync\r\n * @function\r\n * @public\r\n * @param cb - Callback invoked once the recognition has stopped.\r\n * @param err - Callback invoked in case of an error.\r\n */\r\n public stopKeywordRecognitionAsync(cb?: () => void, err?: (e: string) => void): void {\r\n if (!!cb) {\r\n cb();\r\n }\r\n }\r\n\r\n /**\r\n * Adds a phrase that should be recognized as intent.\r\n * @member IntentRecognizer.prototype.addIntent\r\n * @function\r\n * @public\r\n * @param {string} intentId - A String that represents the identifier of the intent to be recognized.\r\n * @param {string} phrase - A String that specifies the phrase representing the intent.\r\n */\r\n public addIntent(simplePhrase: string, intentId?: string): void {\r\n Contracts.throwIfDisposed(this.privDisposedIntentRecognizer);\r\n Contracts.throwIfNullOrWhitespace(intentId, \"intentId\");\r\n Contracts.throwIfNullOrWhitespace(simplePhrase, \"simplePhrase\");\r\n\r\n this.privAddedIntents.push([intentId, simplePhrase]);\r\n }\r\n\r\n /**\r\n * Adds an intent from Language Understanding service for recognition.\r\n * @member IntentRecognizer.prototype.addIntentWithLanguageModel\r\n * @function\r\n * @public\r\n * @param {string} intentId - A String that represents the identifier of the intent\r\n * to be recognized. Ignored if intentName is empty.\r\n * @param {string} model - The intent model from Language Understanding service.\r\n * @param {string} intentName - The intent name defined in the intent model. If it\r\n * is empty, all intent names defined in the model will be added.\r\n */\r\n public addIntentWithLanguageModel(intentId: string, model: LanguageUnderstandingModel, intentName?: string): void {\r\n Contracts.throwIfDisposed(this.privDisposedIntentRecognizer);\r\n Contracts.throwIfNullOrWhitespace(intentId, \"intentId\");\r\n Contracts.throwIfNull(model, \"model\");\r\n\r\n const modelImpl: LanguageUnderstandingModelImpl = model as LanguageUnderstandingModelImpl;\r\n Contracts.throwIfNullOrWhitespace(modelImpl.appId, \"model.appId\");\r\n\r\n this.privAddedLmIntents[intentId] = new AddedLmIntent(modelImpl, intentName);\r\n }\r\n\r\n /**\r\n * @summary Adds all intents from the specified Language Understanding Model.\r\n * @member IntentRecognizer.prototype.addAllIntents\r\n * @function\r\n * @public\r\n * @function\r\n * @public\r\n * @param {LanguageUnderstandingModel} model - The language understanding model containing the intents.\r\n * @param {string} intentId - A custom id String to be returned in the IntentRecognitionResult's getIntentId() method.\r\n */\r\n public addAllIntents(model: LanguageUnderstandingModel, intentId?: string): void {\r\n Contracts.throwIfNull(model, \"model\");\r\n\r\n const modelImpl: LanguageUnderstandingModelImpl = model as LanguageUnderstandingModelImpl;\r\n Contracts.throwIfNullOrWhitespace(modelImpl.appId, \"model.appId\");\r\n\r\n this.privUmbrellaIntent = new AddedLmIntent(modelImpl, intentId);\r\n }\r\n\r\n /**\r\n * closes all external resources held by an instance of this class.\r\n * @member IntentRecognizer.prototype.close\r\n * @function\r\n * @public\r\n */\r\n public close(): void {\r\n Contracts.throwIfDisposed(this.privDisposedIntentRecognizer);\r\n\r\n this.dispose(true);\r\n }\r\n\r\n protected createRecognizerConfig(speechConfig: SpeechServiceConfig): RecognizerConfig {\r\n return new RecognizerConfig(speechConfig, this.properties);\r\n }\r\n\r\n protected createServiceRecognizer(authentication: IAuthentication, connectionFactory: IConnectionFactory, audioConfig: AudioConfig, recognizerConfig: RecognizerConfig): ServiceRecognizerBase {\r\n const audioImpl: AudioConfigImpl = audioConfig as AudioConfigImpl;\r\n return new IntentServiceRecognizer(authentication, connectionFactory, audioImpl, recognizerConfig, this);\r\n }\r\n\r\n protected dispose(disposing: boolean): void {\r\n if (this.privDisposedIntentRecognizer) {\r\n return;\r\n }\r\n\r\n if (disposing) {\r\n this.privDisposedIntentRecognizer = true;\r\n super.dispose(disposing);\r\n }\r\n }\r\n\r\n private buildSpeechContext(): IIntentContext {\r\n let appId: string;\r\n let region: string;\r\n let subscriptionKey: string;\r\n const refGrammers: string[] = [];\r\n\r\n if (undefined !== this.privUmbrellaIntent) {\r\n appId = this.privUmbrellaIntent.modelImpl.appId;\r\n region = this.privUmbrellaIntent.modelImpl.region;\r\n subscriptionKey = this.privUmbrellaIntent.modelImpl.subscriptionKey;\r\n }\r\n\r\n // Build the reference grammer array.\r\n for (const intentId of Object.keys(this.privAddedLmIntents)) {\r\n const addedLmIntent: AddedLmIntent = this.privAddedLmIntents[intentId];\r\n\r\n // validate all the same model, region, and key...\r\n if (appId === undefined) {\r\n appId = addedLmIntent.modelImpl.appId;\r\n } else {\r\n if (appId !== addedLmIntent.modelImpl.appId) {\r\n throw new Error(\"Intents must all be from the same LUIS model\");\r\n }\r\n }\r\n\r\n if (region === undefined) {\r\n region = addedLmIntent.modelImpl.region;\r\n } else {\r\n if (region !== addedLmIntent.modelImpl.region) {\r\n throw new Error(\"Intents must all be from the same LUIS model in a single region\");\r\n }\r\n }\r\n\r\n if (subscriptionKey === undefined) {\r\n subscriptionKey = addedLmIntent.modelImpl.subscriptionKey;\r\n } else {\r\n if (subscriptionKey !== addedLmIntent.modelImpl.subscriptionKey) {\r\n throw new Error(\"Intents must all use the same subscription key\");\r\n }\r\n }\r\n\r\n const grammer: string = \"luis/\" + appId + \"-PRODUCTION#\" + intentId;\r\n refGrammers.push(grammer);\r\n }\r\n\r\n return {\r\n Intent: {\r\n id: appId,\r\n key: (subscriptionKey === undefined) ? this.privProperties.getProperty(PropertyId[PropertyId.SpeechServiceConnection_Key]) : subscriptionKey,\r\n provider: \"LUIS\",\r\n },\r\n ReferenceGrammars: (undefined === this.privUmbrellaIntent) ? refGrammers : [\"luis/\" + appId + \"-PRODUCTION\"],\r\n };\r\n }\r\n}\r\n\r\ninterface IIntentContext {\r\n Intent: {\r\n id: string,\r\n key: string,\r\n provider: string,\r\n };\r\n ReferenceGrammars: string[];\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n IAuthentication,\r\n IConnectionFactory,\r\n RecognitionMode,\r\n RecognizerConfig,\r\n ServiceRecognizerBase,\r\n SpeechServiceConfig,\r\n TranslationConnectionFactory,\r\n TranslationServiceRecognizer,\r\n} from \"../common.speech/Exports\";\r\nimport { AudioConfigImpl } from \"./Audio/AudioConfig\";\r\nimport { Contracts } from \"./Contracts\";\r\nimport {\r\n AudioConfig,\r\n PropertyCollection,\r\n PropertyId,\r\n Recognizer,\r\n TranslationRecognitionCanceledEventArgs,\r\n TranslationRecognitionEventArgs,\r\n TranslationRecognitionResult,\r\n TranslationSynthesisEventArgs,\r\n} from \"./Exports\";\r\nimport { SpeechTranslationConfig, SpeechTranslationConfigImpl } from \"./SpeechTranslationConfig\";\r\n\r\n/**\r\n * Translation recognizer\r\n * @class TranslationRecognizer\r\n */\r\nexport class TranslationRecognizer extends Recognizer {\r\n private privDisposedTranslationRecognizer: boolean;\r\n\r\n /**\r\n * Initializes an instance of the TranslationRecognizer.\r\n * @constructor\r\n * @param {SpeechTranslationConfig} speechConfig - Set of properties to configure this recognizer.\r\n * @param {AudioConfig} audioConfig - An optional audio config associated with the recognizer\r\n */\r\n public constructor(speechConfig: SpeechTranslationConfig, audioConfig?: AudioConfig) {\r\n const configImpl = speechConfig as SpeechTranslationConfigImpl;\r\n Contracts.throwIfNull(configImpl, \"speechConfig\");\r\n\r\n super(audioConfig, configImpl.properties, new TranslationConnectionFactory());\r\n\r\n this.privDisposedTranslationRecognizer = false;\r\n this.privProperties = configImpl.properties.clone();\r\n\r\n if (this.properties.getProperty(PropertyId.SpeechServiceConnection_TranslationVoice, undefined) !== undefined) {\r\n Contracts.throwIfNullOrWhitespace(\r\n this.properties.getProperty(PropertyId.SpeechServiceConnection_TranslationVoice),\r\n PropertyId[PropertyId.SpeechServiceConnection_TranslationVoice]);\r\n }\r\n\r\n Contracts.throwIfNullOrWhitespace(\r\n this.properties.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages),\r\n PropertyId[PropertyId.SpeechServiceConnection_TranslationToLanguages]);\r\n\r\n Contracts.throwIfNullOrWhitespace(this.properties.getProperty(\r\n PropertyId.SpeechServiceConnection_RecoLanguage),\r\n PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage]);\r\n }\r\n\r\n /**\r\n * The event recognizing signals that an intermediate recognition result is received.\r\n * @member TranslationRecognizer.prototype.recognizing\r\n * @function\r\n * @public\r\n */\r\n public recognizing: (sender: TranslationRecognizer, event: TranslationRecognitionEventArgs) => void;\r\n\r\n /**\r\n * The event recognized signals that a final recognition result is received.\r\n * @member TranslationRecognizer.prototype.recognized\r\n * @function\r\n * @public\r\n */\r\n public recognized: (sender: TranslationRecognizer, event: TranslationRecognitionEventArgs) => void;\r\n\r\n /**\r\n * The event canceled signals that an error occurred during recognition.\r\n * @member TranslationRecognizer.prototype.canceled\r\n * @function\r\n * @public\r\n */\r\n public canceled: (sender: TranslationRecognizer, event: TranslationRecognitionCanceledEventArgs) => void;\r\n\r\n /**\r\n * The event synthesizing signals that a translation synthesis result is received.\r\n * @member TranslationRecognizer.prototype.synthesizing\r\n * @function\r\n * @public\r\n */\r\n public synthesizing: (sender: TranslationRecognizer, event: TranslationSynthesisEventArgs) => void;\r\n\r\n /**\r\n * Gets the language name that was set when the recognizer was created.\r\n * @member TranslationRecognizer.prototype.speechRecognitionLanguage\r\n * @function\r\n * @public\r\n * @returns {string} Gets the language name that was set when the recognizer was created.\r\n */\r\n public get speechRecognitionLanguage(): string {\r\n Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer);\r\n\r\n return this.properties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage);\r\n }\r\n\r\n /**\r\n * Gets target languages for translation that were set when the recognizer was created.\r\n * The language is specified in BCP-47 format. The translation will provide translated text for each of language.\r\n * @member TranslationRecognizer.prototype.targetLanguages\r\n * @function\r\n * @public\r\n * @returns {string[]} Gets target languages for translation that were set when the recognizer was created.\r\n */\r\n public get targetLanguages(): string[] {\r\n Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer);\r\n\r\n return this.properties.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages).split(\",\");\r\n }\r\n\r\n /**\r\n * Gets the name of output voice.\r\n * @member TranslationRecognizer.prototype.voiceName\r\n * @function\r\n * @public\r\n * @returns {string} the name of output voice.\r\n */\r\n public get voiceName(): string {\r\n Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer);\r\n\r\n return this.properties.getProperty(PropertyId.SpeechServiceConnection_TranslationVoice, undefined);\r\n }\r\n\r\n /**\r\n * Gets the authorization token used to communicate with the service.\r\n * @member TranslationRecognizer.prototype.authorizationToken\r\n * @function\r\n * @public\r\n * @returns {string} Authorization token.\r\n */\r\n public get authorizationToken(): string {\r\n return this.properties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n }\r\n\r\n /**\r\n * Gets/Sets the authorization token used to communicate with the service.\r\n * @member TranslationRecognizer.prototype.authorizationToken\r\n * @function\r\n * @public\r\n * @param {string} value - Authorization token.\r\n */\r\n public set authorizationToken(value: string) {\r\n this.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, value);\r\n }\r\n\r\n /**\r\n * The collection of properties and their values defined for this TranslationRecognizer.\r\n * @member TranslationRecognizer.prototype.properties\r\n * @function\r\n * @public\r\n * @returns {PropertyCollection} The collection of properties and their values defined for this TranslationRecognizer.\r\n */\r\n public get properties(): PropertyCollection {\r\n return this.privProperties;\r\n }\r\n\r\n /**\r\n * Starts recognition and translation, and stops after the first utterance is recognized.\r\n * The task returns the translation text as result.\r\n * Note: recognizeOnceAsync returns when the first utterance has been recognized, so it is suitableonly\r\n * for single shot recognition like command or query. For long-running recognition,\r\n * use startContinuousRecognitionAsync() instead.\r\n * @member TranslationRecognizer.prototype.recognizeOnceAsync\r\n * @function\r\n * @public\r\n * @param cb - Callback that received the result when the translation has completed.\r\n * @param err - Callback invoked in case of an error.\r\n */\r\n public recognizeOnceAsync(cb?: (e: TranslationRecognitionResult) => void, err?: (e: string) => void): void {\r\n try {\r\n Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer);\r\n\r\n this.implRecognizerStop();\r\n\r\n this.implRecognizerStart(\r\n RecognitionMode.Conversation,\r\n (e: TranslationRecognitionResult) => {\r\n this.implRecognizerStop();\r\n\r\n if (!!cb) {\r\n cb(e);\r\n }\r\n }, (e: string) => {\r\n this.implRecognizerStop();\r\n if (!!err) {\r\n err(e);\r\n }\r\n });\r\n } catch (error) {\r\n if (!!err) {\r\n if (error instanceof Error) {\r\n const typedError: Error = error as Error;\r\n err(typedError.name + \": \" + typedError.message);\r\n } else {\r\n err(error);\r\n }\r\n }\r\n\r\n // Destroy the recognizer.\r\n this.dispose(true);\r\n }\r\n }\r\n\r\n /**\r\n * Starts recognition and translation, until stopContinuousRecognitionAsync() is called.\r\n * User must subscribe to events to receive translation results.\r\n * @member TranslationRecognizer.prototype.startContinuousRecognitionAsync\r\n * @function\r\n * @public\r\n * @param cb - Callback that received the translation has started.\r\n * @param err - Callback invoked in case of an error.\r\n */\r\n public startContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void): void {\r\n try {\r\n Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer);\r\n\r\n this.implRecognizerStop();\r\n\r\n this.implRecognizerStart(RecognitionMode.Conversation, undefined, undefined);\r\n\r\n // report result to promise.\r\n if (!!cb) {\r\n try {\r\n cb();\r\n } catch (e) {\r\n if (!!err) {\r\n err(e);\r\n }\r\n }\r\n cb = undefined;\r\n }\r\n } catch (error) {\r\n if (!!err) {\r\n if (error instanceof Error) {\r\n const typedError: Error = error as Error;\r\n err(typedError.name + \": \" + typedError.message);\r\n\r\n } else {\r\n err(error);\r\n }\r\n }\r\n\r\n // Destroy the recognizer.\r\n this.dispose(true);\r\n }\r\n }\r\n\r\n /**\r\n * Stops continuous recognition and translation.\r\n * @member TranslationRecognizer.prototype.stopContinuousRecognitionAsync\r\n * @function\r\n * @public\r\n * @param cb - Callback that received the translation has stopped.\r\n * @param err - Callback invoked in case of an error.\r\n */\r\n public stopContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void): void {\r\n try {\r\n Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer);\r\n\r\n this.implRecognizerStop();\r\n\r\n if (!!cb) {\r\n try {\r\n cb();\r\n } catch (e) {\r\n if (!!err) {\r\n err(e);\r\n }\r\n }\r\n }\r\n } catch (error) {\r\n if (!!err) {\r\n if (error instanceof Error) {\r\n const typedError: Error = error as Error;\r\n err(typedError.name + \": \" + typedError.message);\r\n } else {\r\n err(error);\r\n }\r\n }\r\n\r\n // Destroy the recognizer.\r\n this.dispose(true);\r\n\r\n }\r\n }\r\n\r\n /**\r\n * closes all external resources held by an instance of this class.\r\n * @member TranslationRecognizer.prototype.close\r\n * @function\r\n * @public\r\n */\r\n public close(): void {\r\n Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer);\r\n\r\n this.dispose(true);\r\n }\r\n\r\n protected dispose(disposing: boolean): boolean {\r\n if (this.privDisposedTranslationRecognizer) {\r\n return;\r\n }\r\n\r\n if (disposing) {\r\n this.implRecognizerStop();\r\n this.privDisposedTranslationRecognizer = true;\r\n super.dispose(disposing);\r\n }\r\n }\r\n\r\n protected createRecognizerConfig(speechConfig: SpeechServiceConfig): RecognizerConfig {\r\n return new RecognizerConfig(speechConfig, this.properties);\r\n }\r\n\r\n protected createServiceRecognizer(\r\n authentication: IAuthentication,\r\n connectionFactory: IConnectionFactory,\r\n audioConfig: AudioConfig,\r\n recognizerConfig: RecognizerConfig): ServiceRecognizerBase {\r\n\r\n const configImpl: AudioConfigImpl = audioConfig as AudioConfigImpl;\r\n\r\n return new TranslationServiceRecognizer(authentication, connectionFactory, configImpl, recognizerConfig, this);\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyCollection } from \"./Exports\";\r\n\r\n/**\r\n * Represents collection of parameters and their values.\r\n * @class Translation\r\n */\r\nexport class Translations {\r\n // Use an PropertyCollection internally, just wrapping it to hide the | enum syntax it has.\r\n private privMap: PropertyCollection = new PropertyCollection();\r\n\r\n /**\r\n * Returns the parameter value in type String. The parameter must have the same type as String.\r\n * Currently only String, int and bool are allowed.\r\n * If the name is not available, the specified defaultValue is returned.\r\n * @member Translation.prototype.get\r\n * @function\r\n * @public\r\n * @param {string} key - The parameter name.\r\n * @param {string} def - The default value which is returned if the parameter is not available in the collection.\r\n * @returns {string} value of the parameter.\r\n */\r\n public get(key: string, def?: string): string {\r\n return this.privMap.getProperty(key, def);\r\n }\r\n\r\n /**\r\n * Sets the String value of the parameter specified by name.\r\n * @member Translation.prototype.set\r\n * @function\r\n * @public\r\n * @param {string} key - The parameter name.\r\n * @param {string} value - The value of the parameter.\r\n */\r\n public set(key: string, value: string): void {\r\n this.privMap.setProperty(key, value);\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines the possible reasons a recognition result might not be recognized.\r\n * @class NoMatchReason\r\n */\r\nexport enum NoMatchReason {\r\n\r\n /**\r\n * Indicates that speech was detected, but not recognized.\r\n * @member NoMatchReason.NotRecognized\r\n */\r\n NotRecognized,\r\n\r\n /**\r\n * Indicates that the start of the audio stream contained only silence,\r\n * and the service timed out waiting for speech.\r\n * @member NoMatchReason.InitialSilenceTimeout\r\n */\r\n InitialSilenceTimeout,\r\n\r\n /**\r\n * Indicates that the start of the audio stream contained only noise,\r\n * and the service timed out waiting for speech.\r\n * @member NoMatchReason.InitialBabbleTimeout\r\n */\r\n InitialBabbleTimeout,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { RecognitionStatus, SimpleSpeechPhrase } from \"../../src/common.speech/Exports\";\r\nimport { IntentRecognitionResult, NoMatchReason, SpeechRecognitionResult, TranslationRecognitionResult } from \"./Exports\";\r\n\r\n/**\r\n * Contains detailed information for NoMatch recognition results.\r\n * @class NoMatchDetails\r\n */\r\nexport class NoMatchDetails {\r\n private privReason: NoMatchReason;\r\n\r\n /**\r\n * Creates and initializes an instance of this class.\r\n * @constructor\r\n * @param {NoMatchReason} reason - The no-match reason.\r\n */\r\n private constructor(reason: NoMatchReason) {\r\n this.privReason = reason;\r\n }\r\n\r\n /**\r\n * Creates an instance of NoMatchDetails object for the NoMatch SpeechRecognitionResults.\r\n * @member NoMatchDetails.fromResult\r\n * @function\r\n * @public\r\n * @param {SpeechRecognitionResult | IntentRecognitionResult | TranslationRecognitionResult}\r\n * result - The recognition result that was not recognized.\r\n * @returns {NoMatchDetails} The no match details object being created.\r\n */\r\n public static fromResult(result: SpeechRecognitionResult | IntentRecognitionResult | TranslationRecognitionResult): NoMatchDetails {\r\n const simpleSpeech: SimpleSpeechPhrase = SimpleSpeechPhrase.fromJSON(result.json);\r\n\r\n let reason: NoMatchReason = NoMatchReason.NotRecognized;\r\n\r\n switch (simpleSpeech.RecognitionStatus) {\r\n case RecognitionStatus.BabbleTimeout:\r\n reason = NoMatchReason.InitialBabbleTimeout;\r\n break;\r\n case RecognitionStatus.InitialSilenceTimeout:\r\n reason = NoMatchReason.InitialSilenceTimeout;\r\n break;\r\n default:\r\n reason = NoMatchReason.NotRecognized;\r\n break;\r\n }\r\n\r\n return new NoMatchDetails(reason);\r\n }\r\n\r\n /**\r\n * The reason the recognition was canceled.\r\n * @member NoMatchDetails.prototype.reason\r\n * @function\r\n * @public\r\n * @returns {NoMatchReason} Specifies the reason canceled.\r\n */\r\n public get reason(): NoMatchReason {\r\n return this.privReason;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { CancellationErrorCode, CancellationReason, TranslationRecognitionResult } from \"./Exports\";\r\n\r\n/**\r\n * Define payload of speech recognition canceled result events.\r\n * @class TranslationRecognitionCanceledEventArgs\r\n */\r\nexport class TranslationRecognitionCanceledEventArgs {\r\n private privResult: TranslationRecognitionResult;\r\n private privSessionId: string;\r\n private privCancelReason: CancellationReason;\r\n private privErrorDetails: string;\r\n private privErrorCode: CancellationErrorCode;\r\n\r\n /**\r\n * Creates and initializes an instance of this class.\r\n * @constructor\r\n * @param {string} sessionid - The session id.\r\n * @param {CancellationReason} cancellationReason - The cancellation reason.\r\n * @param {string} errorDetails - Error details, if provided.\r\n * @param {TranslationRecognitionResult} result - The result.\r\n */\r\n public constructor(\r\n sessionid: string,\r\n cancellationReason: CancellationReason,\r\n errorDetails: string,\r\n errorCode: CancellationErrorCode,\r\n result: TranslationRecognitionResult) {\r\n this.privCancelReason = cancellationReason;\r\n this.privErrorDetails = errorDetails;\r\n this.privResult = result;\r\n this.privSessionId = sessionid;\r\n this.privErrorCode = errorCode;\r\n }\r\n\r\n /**\r\n * Specifies the recognition result.\r\n * @member TranslationRecognitionCanceledEventArgs.prototype.result\r\n * @function\r\n * @public\r\n * @returns {TranslationRecognitionResult} the recognition result.\r\n */\r\n public get result(): TranslationRecognitionResult {\r\n return this.privResult;\r\n }\r\n\r\n /**\r\n * Specifies the session identifier.\r\n * @member TranslationRecognitionCanceledEventArgs.prototype.sessionId\r\n * @function\r\n * @public\r\n * @returns {string} the session identifier.\r\n */\r\n public get sessionId(): string {\r\n return this.privSessionId;\r\n }\r\n\r\n /**\r\n * The reason the recognition was canceled.\r\n * @member TranslationRecognitionCanceledEventArgs.prototype.reason\r\n * @function\r\n * @public\r\n * @returns {CancellationReason} Specifies the reason canceled.\r\n */\r\n public get reason(): CancellationReason {\r\n return this.privCancelReason;\r\n }\r\n\r\n /**\r\n * The error code in case of an unsuccessful recognition.\r\n * Added in version 1.1.0.\r\n * @return An error code that represents the error reason.\r\n */\r\n public get errorCode(): CancellationErrorCode {\r\n return this.privErrorCode;\r\n }\r\n\r\n /**\r\n * In case of an unsuccessful recognition, provides details of the occurred error.\r\n * @member TranslationRecognitionCanceledEventArgs.prototype.errorDetails\r\n * @function\r\n * @public\r\n * @returns {string} A String that represents the error details.\r\n */\r\n public get errorDetails(): string {\r\n return this.privErrorDetails;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { CancellationErrorCode, CancellationReason, IntentRecognitionEventArgs, IntentRecognitionResult } from \"./Exports\";\r\n\r\n/**\r\n * Define payload of intent recognition canceled result events.\r\n * @class IntentRecognitionCanceledEventArgs\r\n */\r\nexport class IntentRecognitionCanceledEventArgs extends IntentRecognitionEventArgs {\r\n private privReason: CancellationReason;\r\n private privErrorDetails: string;\r\n private privErrorCode: CancellationErrorCode;\r\n\r\n /**\r\n * Creates and initializes an instance of this class.\r\n * @constructor\r\n * @param {CancellationReason} result - The result of the intent recognition.\r\n * @param {string} offset - The offset.\r\n * @param {IntentRecognitionResult} sessionId - The session id.\r\n */\r\n public constructor(\r\n reason: CancellationReason,\r\n errorDetails: string,\r\n errorCode: CancellationErrorCode,\r\n result?: IntentRecognitionResult,\r\n offset?: number,\r\n sessionId?: string) {\r\n super(result, offset, sessionId);\r\n\r\n this.privReason = reason;\r\n this.privErrorDetails = errorDetails;\r\n this.privErrorCode = errorCode;\r\n }\r\n\r\n /**\r\n * The reason the recognition was canceled.\r\n * @member IntentRecognitionCanceledEventArgs.prototype.reason\r\n * @function\r\n * @public\r\n * @returns {CancellationReason} Specifies the reason canceled.\r\n */\r\n public get reason(): CancellationReason {\r\n return this.privReason;\r\n }\r\n\r\n /**\r\n * The error code in case of an unsuccessful recognition.\r\n * Added in version 1.1.0.\r\n * @return An error code that represents the error reason.\r\n */\r\n public get errorCode(): CancellationErrorCode {\r\n return this.privErrorCode;\r\n }\r\n\r\n /**\r\n * In case of an unsuccessful recognition, provides details of the occurred error.\r\n * @member IntentRecognitionCanceledEventArgs.prototype.errorDetails\r\n * @function\r\n * @public\r\n * @returns {string} A String that represents the error details.\r\n */\r\n public get errorDetails(): string {\r\n return this.privErrorDetails;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { CancellationErrorCodePropertyName, EnumTranslation, SimpleSpeechPhrase } from \"../common.speech/Exports\";\r\nimport { CancellationErrorCode, CancellationReason, RecognitionResult } from \"./Exports\";\r\n\r\n/**\r\n * Contains detailed information about why a result was canceled.\r\n * @class CancellationDetails\r\n */\r\nexport class CancellationDetails {\r\n private privReason: CancellationReason;\r\n private privErrorDetails: string;\r\n private privErrorCode: CancellationErrorCode;\r\n\r\n /**\r\n * Creates and initializes an instance of this class.\r\n * @constructor\r\n * @param {CancellationReason} reason - The cancellation reason.\r\n * @param {string} errorDetails - The error details, if provided.\r\n */\r\n private constructor(reason: CancellationReason, errorDetails: string, errorCode: CancellationErrorCode) {\r\n this.privReason = reason;\r\n this.privErrorDetails = errorDetails;\r\n this.privErrorCode = errorCode;\r\n }\r\n\r\n /**\r\n * Creates an instance of CancellationDetails object for the canceled RecognitionResult.\r\n * @member CancellationDetails.fromResult\r\n * @function\r\n * @public\r\n * @param {RecognitionResult} result - The result that was canceled.\r\n * @returns {CancellationDetails} The cancellation details object being created.\r\n */\r\n public static fromResult(result: RecognitionResult): CancellationDetails {\r\n let reason = CancellationReason.Error;\r\n let errorCode: CancellationErrorCode = CancellationErrorCode.NoError;\r\n\r\n if (!!result.json) {\r\n const simpleSpeech: SimpleSpeechPhrase = SimpleSpeechPhrase.fromJSON(result.json);\r\n reason = EnumTranslation.implTranslateCancelResult(simpleSpeech.RecognitionStatus);\r\n }\r\n\r\n if (!!result.properties) {\r\n errorCode = (CancellationErrorCode as any)[result.properties.getProperty(CancellationErrorCodePropertyName, CancellationErrorCode[CancellationErrorCode.NoError])];\r\n }\r\n\r\n return new CancellationDetails(reason, result.errorDetails, errorCode);\r\n\r\n }\r\n\r\n /**\r\n * The reason the recognition was canceled.\r\n * @member CancellationDetails.prototype.reason\r\n * @function\r\n * @public\r\n * @returns {CancellationReason} Specifies the reason canceled.\r\n */\r\n public get reason(): CancellationReason {\r\n return this.privReason;\r\n }\r\n\r\n /**\r\n * In case of an unsuccessful recognition, provides details of the occurred error.\r\n * @member CancellationDetails.prototype.errorDetails\r\n * @function\r\n * @public\r\n * @returns {string} A String that represents the error details.\r\n */\r\n public get errorDetails(): string {\r\n return this.privErrorDetails;\r\n }\r\n\r\n /**\r\n * The error code in case of an unsuccessful recognition.\r\n * Added in version 1.1.0.\r\n * @return An error code that represents the error reason.\r\n */\r\n public get ErrorCode(): CancellationErrorCode {\r\n return this.privErrorCode;\r\n }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines error code in case that CancellationReason is Error.\r\n * Added in version 1.1.0.\r\n */\r\nexport enum CancellationErrorCode {\r\n /**\r\n * Indicates that no error occurred during speech recognition.\r\n */\r\n NoError,\r\n\r\n /**\r\n * Indicates an authentication error.\r\n */\r\n AuthenticationFailure,\r\n\r\n /**\r\n * Indicates that one or more recognition parameters are invalid.\r\n */\r\n BadRequestParameters,\r\n\r\n /**\r\n * Indicates that the number of parallel requests exceeded the number of allowed\r\n * concurrent transcriptions for the subscription.\r\n */\r\n TooManyRequests,\r\n\r\n /**\r\n * Indicates a connection error.\r\n */\r\n ConnectionFailure,\r\n\r\n /**\r\n * Indicates a time-out error when waiting for response from service.\r\n */\r\n ServiceTimeout,\r\n\r\n /**\r\n * Indicates that an error is returned by the service.\r\n */\r\n ServiceError,\r\n\r\n /**\r\n * Indicates an unexpected runtime error.\r\n */\r\n RuntimeError,\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\nimport { SessionEventArgs } from \"./Exports\";\r\n\r\n/**\r\n * Defines payload for connection events like Connected/Disconnected.\r\n * Added in version 1.2.0\r\n */\r\nexport class ConnectionEventArgs extends SessionEventArgs {\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\nimport {\r\n ServiceRecognizerBase,\r\n} from \"../common.speech/Exports\";\r\nimport {\r\n ConnectionEvent,\r\n IDetachable,\r\n} from \"../common/Exports\";\r\nimport {\r\n ConnectionEventArgs,\r\n Recognizer,\r\n} from \"./Exports\";\r\n\r\n/**\r\n * Connection is a proxy class for managing connection to the speech service of the specified Recognizer.\r\n * By default, a Recognizer autonomously manages connection to service when needed.\r\n * The Connection class provides additional methods for users to explicitly open or close a connection and\r\n * to subscribe to connection status changes.\r\n * The use of Connection is optional, and mainly for scenarios where fine tuning of application\r\n * behavior based on connection status is needed. Users can optionally call Open() to manually set up a connection\r\n * in advance before starting recognition on the Recognizer associated with this Connection.\r\n * If the Recognizer needs to connect or disconnect to service, it will\r\n * setup or shutdown the connection independently. In this case the Connection will be notified by change of connection\r\n * status via Connected/Disconnected events.\r\n * Added in version 1.2.0.\r\n */\r\nexport class Connection {\r\n private privServiceRecognizer: ServiceRecognizerBase;\r\n private privEventListener: IDetachable;\r\n\r\n /**\r\n * Gets the Connection instance from the specified recognizer.\r\n * @param recognizer The recognizer associated with the connection.\r\n * @return The Connection instance of the recognizer.\r\n */\r\n public static fromRecognizer(recognizer: Recognizer): Connection {\r\n const recoBase: ServiceRecognizerBase = recognizer.internalData as ServiceRecognizerBase;\r\n\r\n const ret: Connection = new Connection();\r\n\r\n ret.privServiceRecognizer = recoBase;\r\n ret.privEventListener = ret.privServiceRecognizer.connectionEvents.attach((connectionEvent: ConnectionEvent): void => {\r\n if (connectionEvent.name === \"ConnectionEstablishedEvent\") {\r\n if (!!ret.connected) {\r\n ret.connected(new ConnectionEventArgs(connectionEvent.connectionId));\r\n }\r\n } else if (connectionEvent.name === \"ConnectionClosedEvent\") {\r\n if (!!ret.disconnected) {\r\n ret.disconnected(new ConnectionEventArgs(connectionEvent.connectionId));\r\n }\r\n }\r\n });\r\n\r\n return ret;\r\n }\r\n\r\n /**\r\n * Starts to set up connection to the service.\r\n * Users can optionally call openConnection() to manually set up a connection in advance before starting recognition on the\r\n * Recognizer associated with this Connection. After starting recognition, calling Open() will have no effect\r\n *\r\n * Note: On return, the connection might not be ready yet. Please subscribe to the Connected event to\r\n * be notfied when the connection is established.\r\n */\r\n public openConnection(): void {\r\n this.privServiceRecognizer.connect();\r\n }\r\n\r\n /**\r\n * Closes the connection the service.\r\n * Users can optionally call closeConnection() to manually shutdown the connection of the associated Recognizer.\r\n *\r\n * If closeConnection() is called during recognition, recognition will fail and cancel wtih an error.\r\n */\r\n public closeConnection(): void {\r\n this.privServiceRecognizer.disconnect();\r\n }\r\n\r\n /**\r\n * The Connected event to indicate that the recognizer is connected to service.\r\n */\r\n public connected: (args: ConnectionEventArgs) => void;\r\n\r\n /**\r\n * The Diconnected event to indicate that the recognizer is disconnected from service.\r\n */\r\n public disconnected: (args: ConnectionEventArgs) => void;\r\n\r\n /**\r\n * Dispose of associated resources.\r\n */\r\n public close(): void {\r\n /* tslint:disable:no-empty */\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n DynamicGrammarBuilder,\r\n ServiceRecognizerBase,\r\n} from \"../common.speech/Exports\";\r\nimport { Recognizer } from \"./Exports\";\r\n\r\n/**\r\n * Allows additions of new phrases to improve speech recognition.\r\n *\r\n * Phrases added to the recognizer are effective at the start of the next recognition, or the next time the SpeechSDK must reconnect\r\n * to the speech service.\r\n */\r\nexport class PhraseListGrammar {\r\n private privGrammerBuilder: DynamicGrammarBuilder;\r\n\r\n private constructor(recogBase: ServiceRecognizerBase) {\r\n this.privGrammerBuilder = recogBase.dynamicGrammar;\r\n }\r\n\r\n /**\r\n * Creates a PhraseListGrammar from a given speech recognizer. Will accept any recognizer that derives from @class Recognizer.\r\n * @param recognizer The recognizer to add phrase lists to.\r\n */\r\n public static fromRecognizer(recognizer: Recognizer): PhraseListGrammar {\r\n const recoBase: ServiceRecognizerBase = recognizer.internalData as ServiceRecognizerBase;\r\n\r\n return new PhraseListGrammar(recoBase);\r\n }\r\n\r\n /**\r\n * Adds a single phrase to the current recognizer.\r\n * @param phrase Phrase to add.\r\n */\r\n public addPhrase(phrase: string): void {\r\n this.privGrammerBuilder.addPhrase(phrase);\r\n }\r\n\r\n /**\r\n * Adds multiple phrases to the current recognizer.\r\n * @param phrases Array of phrases to add.\r\n */\r\n public addPhrases(phrases: string[]): void {\r\n this.privGrammerBuilder.addPhrase(phrases);\r\n }\r\n\r\n /**\r\n * Clears all phrases added to the current recognizer.\r\n */\r\n public clear(): void {\r\n this.privGrammerBuilder.clearPhrases();\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines channels used to pass property settings to service.\r\n * Added in version 1.7.0.\r\n */\r\nexport enum ServicePropertyChannel {\r\n /**\r\n * Uses URI query parameter to pass property settings to service.\r\n */\r\n UriQueryParameter = 0.\r\n}\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Profanity option.\r\n * Added in version 1.7.0.\r\n */\r\nexport enum ProfanityOption {\r\n Masked = 0,\r\n Removed = 1,\r\n Raw = 2\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { EventType, PlatformEvent } from \"../common/Exports\";\r\n\r\nexport class SpeechRecognitionEvent extends PlatformEvent {\r\n private privRequestId: string;\r\n private privSessionId: string;\r\n\r\n constructor(eventName: string, requestId: string, sessionId: string, eventType: EventType = EventType.Info) {\r\n super(eventName, eventType);\r\n\r\n this.privRequestId = requestId;\r\n this.privSessionId = sessionId;\r\n }\r\n\r\n public get requestId(): string {\r\n return this.privRequestId;\r\n }\r\n\r\n public get sessionId(): string {\r\n return this.privSessionId;\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class RecognitionTriggeredEvent extends SpeechRecognitionEvent {\r\n private privAudioSourceId: string;\r\n private privAudioNodeId: string;\r\n\r\n constructor(requestId: string, sessionId: string, audioSourceId: string, audioNodeId: string) {\r\n super(\"RecognitionTriggeredEvent\", requestId, sessionId);\r\n\r\n this.privAudioSourceId = audioSourceId;\r\n this.privAudioNodeId = audioNodeId;\r\n }\r\n\r\n public get audioSourceId(): string {\r\n return this.privAudioSourceId;\r\n }\r\n\r\n public get audioNodeId(): string {\r\n return this.privAudioNodeId;\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class ListeningStartedEvent extends SpeechRecognitionEvent {\r\n private privAudioSourceId: string;\r\n private privAudioNodeId: string;\r\n\r\n constructor(requestId: string, sessionId: string, audioSourceId: string, audioNodeId: string) {\r\n super(\"ListeningStartedEvent\", requestId, sessionId);\r\n this.privAudioSourceId = audioSourceId;\r\n this.privAudioNodeId = audioNodeId;\r\n }\r\n\r\n public get audioSourceId(): string {\r\n return this.privAudioSourceId;\r\n }\r\n\r\n public get audioNodeId(): string {\r\n return this.privAudioNodeId;\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class ConnectingToServiceEvent extends SpeechRecognitionEvent {\r\n private privAuthFetchEventid: string;\r\n\r\n constructor(requestId: string, authFetchEventid: string, sessionId: string) {\r\n super(\"ConnectingToServiceEvent\", requestId, sessionId);\r\n this.privAuthFetchEventid = authFetchEventid;\r\n }\r\n\r\n public get authFetchEventid(): string {\r\n return this.privAuthFetchEventid;\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class RecognitionStartedEvent extends SpeechRecognitionEvent {\r\n private privAudioSourceId: string;\r\n private privAudioNodeId: string;\r\n private privAuthFetchEventId: string;\r\n\r\n constructor(requestId: string, audioSourceId: string, audioNodeId: string, authFetchEventId: string, sessionId: string) {\r\n super(\"RecognitionStartedEvent\", requestId, sessionId);\r\n\r\n this.privAudioSourceId = audioSourceId;\r\n this.privAudioNodeId = audioNodeId;\r\n this.privAuthFetchEventId = authFetchEventId;\r\n }\r\n\r\n public get audioSourceId(): string {\r\n return this.privAudioSourceId;\r\n }\r\n\r\n public get audioNodeId(): string {\r\n return this.privAudioNodeId;\r\n }\r\n\r\n public get authFetchEventId(): string {\r\n return this.privAuthFetchEventId;\r\n }\r\n}\r\n\r\nexport enum RecognitionCompletionStatus {\r\n Success,\r\n AudioSourceError,\r\n AudioSourceTimeout,\r\n AuthTokenFetchError,\r\n AuthTokenFetchTimeout,\r\n UnAuthorized,\r\n ConnectTimeout,\r\n ConnectError,\r\n ClientRecognitionActivityTimeout,\r\n UnknownError,\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class RecognitionEndedEvent extends SpeechRecognitionEvent {\r\n private privAudioSourceId: string;\r\n private privAudioNodeId: string;\r\n private privAuthFetchEventId: string;\r\n private privServiceTag: string;\r\n private privStatus: RecognitionCompletionStatus;\r\n private privError: string;\r\n\r\n constructor(\r\n requestId: string,\r\n audioSourceId: string,\r\n audioNodeId: string,\r\n authFetchEventId: string,\r\n sessionId: string,\r\n serviceTag: string,\r\n status: RecognitionCompletionStatus,\r\n error: string) {\r\n\r\n super(\"RecognitionEndedEvent\", requestId, sessionId, status === RecognitionCompletionStatus.Success ? EventType.Info : EventType.Error);\r\n\r\n this.privAudioSourceId = audioSourceId;\r\n this.privAudioNodeId = audioNodeId;\r\n this.privAuthFetchEventId = authFetchEventId;\r\n this.privStatus = status;\r\n this.privError = error;\r\n this.privServiceTag = serviceTag;\r\n }\r\n\r\n public get audioSourceId(): string {\r\n return this.privAudioSourceId;\r\n }\r\n\r\n public get audioNodeId(): string {\r\n return this.privAudioNodeId;\r\n }\r\n\r\n public get authFetchEventId(): string {\r\n return this.privAuthFetchEventId;\r\n }\r\n\r\n public get serviceTag(): string {\r\n return this.privServiceTag;\r\n }\r\n\r\n public get status(): RecognitionCompletionStatus {\r\n return this.privStatus;\r\n }\r\n\r\n public get error(): string {\r\n return this.privError;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ReplayableAudioNode } from \"../common.browser/Exports\";\r\nimport {\r\n ArgumentNullError,\r\n ConnectionClosedEvent,\r\n ConnectionEvent,\r\n ConnectionMessage,\r\n ConnectionOpenResponse,\r\n ConnectionState,\r\n createNoDashGuid,\r\n Deferred,\r\n EventSource,\r\n IAudioSource,\r\n IAudioStreamNode,\r\n IConnection,\r\n IDisposable,\r\n IStreamChunk,\r\n MessageType,\r\n Promise,\r\n PromiseHelper,\r\n PromiseResult,\r\n} from \"../common/Exports\";\r\nimport { AudioStreamFormatImpl } from \"../sdk/Audio/AudioStreamFormat\";\r\nimport {\r\n CancellationErrorCode,\r\n CancellationReason,\r\n PropertyId,\r\n RecognitionEventArgs,\r\n Recognizer,\r\n SessionEventArgs,\r\n SpeechRecognitionResult,\r\n} from \"../sdk/Exports\";\r\nimport {\r\n DynamicGrammarBuilder,\r\n ISpeechConfigAudio,\r\n ISpeechConfigAudioDevice,\r\n RecognitionMode,\r\n RequestSession,\r\n SpeechContext,\r\n SpeechDetected,\r\n} from \"./Exports\";\r\nimport {\r\n AuthInfo,\r\n IAuthentication,\r\n} from \"./IAuthentication\";\r\nimport { IConnectionFactory } from \"./IConnectionFactory\";\r\nimport { RecognizerConfig } from \"./RecognizerConfig\";\r\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal\";\r\n\r\nexport abstract class ServiceRecognizerBase implements IDisposable {\r\n private privAuthentication: IAuthentication;\r\n private privConnectionFactory: IConnectionFactory;\r\n private privAudioSource: IAudioSource;\r\n private privSpeechServiceConfigConnectionId: string;\r\n\r\n // A promise for a configured connection.\r\n // Do not consume directly, call fethConnection instead.\r\n private privConnectionConfigurationPromise: Promise;\r\n\r\n // A promise for a connection, but one that has not had the speech context sent yet.\r\n // Do no consume directly, call fetchConnection insted.\r\n private privConnectionPromise: Promise;\r\n private privConnectionId: string;\r\n private privAuthFetchEventId: string;\r\n private privIsDisposed: boolean;\r\n private privRecognizer: Recognizer;\r\n private privMustReportEndOfStream: boolean;\r\n private privConnectionEvents: EventSource;\r\n private privSpeechContext: SpeechContext;\r\n private privDynamicGrammar: DynamicGrammarBuilder;\r\n protected privRequestSession: RequestSession;\r\n protected privRecognizerConfig: RecognizerConfig;\r\n\r\n public constructor(\r\n authentication: IAuthentication,\r\n connectionFactory: IConnectionFactory,\r\n audioSource: IAudioSource,\r\n recognizerConfig: RecognizerConfig,\r\n recognizer: Recognizer) {\r\n\r\n if (!authentication) {\r\n throw new ArgumentNullError(\"authentication\");\r\n }\r\n\r\n if (!connectionFactory) {\r\n throw new ArgumentNullError(\"connectionFactory\");\r\n }\r\n\r\n if (!audioSource) {\r\n throw new ArgumentNullError(\"audioSource\");\r\n }\r\n\r\n if (!recognizerConfig) {\r\n throw new ArgumentNullError(\"recognizerConfig\");\r\n }\r\n\r\n this.privMustReportEndOfStream = false;\r\n this.privAuthentication = authentication;\r\n this.privConnectionFactory = connectionFactory;\r\n this.privAudioSource = audioSource;\r\n this.privRecognizerConfig = recognizerConfig;\r\n this.privIsDisposed = false;\r\n this.privRecognizer = recognizer;\r\n this.privRequestSession = new RequestSession(this.privAudioSource.id());\r\n this.privConnectionEvents = new EventSource();\r\n this.privDynamicGrammar = new DynamicGrammarBuilder();\r\n this.privSpeechContext = new SpeechContext(this.privDynamicGrammar);\r\n }\r\n\r\n public get audioSource(): IAudioSource {\r\n return this.privAudioSource;\r\n }\r\n\r\n public get speechContext(): SpeechContext {\r\n return this.privSpeechContext;\r\n }\r\n\r\n public get dynamicGrammar(): DynamicGrammarBuilder {\r\n return this.privDynamicGrammar;\r\n }\r\n\r\n public isDisposed(): boolean {\r\n return this.privIsDisposed;\r\n }\r\n\r\n public dispose(reason?: string): void {\r\n this.privIsDisposed = true;\r\n if (this.privConnectionConfigurationPromise) {\r\n this.privConnectionConfigurationPromise.onSuccessContinueWith((connection: IConnection) => {\r\n connection.dispose(reason);\r\n });\r\n }\r\n }\r\n\r\n public get connectionEvents(): EventSource {\r\n return this.privConnectionEvents;\r\n }\r\n\r\n public get recognitionMode(): RecognitionMode {\r\n return this.privRecognizerConfig.recognitionMode;\r\n }\r\n\r\n public recognize(\r\n recoMode: RecognitionMode,\r\n successCallback: (e: SpeechRecognitionResult) => void,\r\n errorCallBack: (e: string) => void,\r\n ): Promise {\r\n\r\n // Clear the existing configuration promise to force a re-transmission of config and context.\r\n this.privConnectionConfigurationPromise = null;\r\n this.privRecognizerConfig.recognitionMode = recoMode;\r\n\r\n this.privRequestSession.startNewRecognition();\r\n this.privRequestSession.listenForServiceTelemetry(this.privAudioSource.events);\r\n\r\n // Start the connection to the service. The promise this will create is stored and will be used by configureConnection().\r\n this.connectImpl();\r\n\r\n return this.audioSource\r\n .attach(this.privRequestSession.audioNodeId)\r\n .continueWithPromise((result: PromiseResult) => {\r\n let audioNode: ReplayableAudioNode;\r\n\r\n if (result.isError) {\r\n this.cancelRecognitionLocal(CancellationReason.Error, CancellationErrorCode.ConnectionFailure, result.error, successCallback);\r\n return PromiseHelper.fromError(result.error);\r\n } else {\r\n audioNode = new ReplayableAudioNode(result.result, this.audioSource.format as AudioStreamFormatImpl);\r\n this.privRequestSession.onAudioSourceAttachCompleted(audioNode, false);\r\n }\r\n\r\n return this.audioSource.deviceInfo.onSuccessContinueWithPromise((deviceInfo: ISpeechConfigAudioDevice): Promise => {\r\n this.privRecognizerConfig.SpeechServiceConfig.Context.audio = { source: deviceInfo };\r\n\r\n return this.configureConnection()\r\n .on((_: IConnection) => {\r\n const sessionStartEventArgs: SessionEventArgs = new SessionEventArgs(this.privRequestSession.sessionId);\r\n\r\n if (!!this.privRecognizer.sessionStarted) {\r\n this.privRecognizer.sessionStarted(this.privRecognizer, sessionStartEventArgs);\r\n }\r\n\r\n const messageRetrievalPromise = this.receiveMessage(successCallback, errorCallBack);\r\n const audioSendPromise = this.sendAudio(audioNode);\r\n\r\n /* tslint:disable:no-empty */\r\n audioSendPromise.on((_: boolean) => { }, (error: string) => {\r\n this.cancelRecognitionLocal(CancellationReason.Error, CancellationErrorCode.RuntimeError, error, successCallback);\r\n });\r\n\r\n const completionPromise = PromiseHelper.whenAll([messageRetrievalPromise, audioSendPromise]);\r\n\r\n return completionPromise.on((r: boolean) => {\r\n return true;\r\n }, (error: string) => {\r\n this.cancelRecognitionLocal(CancellationReason.Error, CancellationErrorCode.RuntimeError, error, successCallback);\r\n });\r\n\r\n }, (error: string) => {\r\n this.cancelRecognitionLocal(CancellationReason.Error, CancellationErrorCode.ConnectionFailure, error, successCallback);\r\n }).continueWithPromise((result: PromiseResult): Promise => {\r\n if (result.isError) {\r\n return PromiseHelper.fromError(result.error);\r\n } else {\r\n return PromiseHelper.fromResult(true);\r\n }\r\n });\r\n });\r\n });\r\n }\r\n\r\n public stopRecognizing(): void {\r\n if (this.privRequestSession.isRecognizing) {\r\n this.privRequestSession.onStopRecognizing();\r\n this.sendTelemetryData();\r\n this.audioSource.turnOff();\r\n this.sendFinalAudio();\r\n this.privRequestSession.dispose();\r\n }\r\n }\r\n\r\n public connect(): void {\r\n this.connectImpl().result();\r\n }\r\n\r\n public disconnect(): void {\r\n this.cancelRecognitionLocal(CancellationReason.Error,\r\n CancellationErrorCode.NoError,\r\n \"Disconnecting\",\r\n undefined);\r\n\r\n if (this.privConnectionPromise.result().isCompleted) {\r\n if (!this.privConnectionPromise.result().isError) {\r\n this.privConnectionPromise.result().result.dispose();\r\n this.privConnectionPromise = null;\r\n }\r\n } else {\r\n this.privConnectionPromise.onSuccessContinueWith((connection: IConnection) => {\r\n connection.dispose();\r\n });\r\n }\r\n }\r\n\r\n // Called when telemetry data is sent to the service.\r\n // Used for testing Telemetry capture.\r\n public static telemetryData: (json: string) => void;\r\n public static telemetryDataEnabled: boolean = true;\r\n\r\n protected abstract processTypeSpecificMessages(\r\n connectionMessage: SpeechConnectionMessage,\r\n successCallback?: (e: SpeechRecognitionResult) => void,\r\n errorCallBack?: (e: string) => void): void;\r\n\r\n protected sendTelemetryData = () => {\r\n const telemetryData = this.privRequestSession.getTelemetry();\r\n // console.warn(\"Telem: \" + telemetryData);\r\n if (ServiceRecognizerBase.telemetryDataEnabled !== true ||\r\n this.privIsDisposed ||\r\n null === telemetryData) {\r\n return PromiseHelper.fromResult(true);\r\n }\r\n\r\n if (!!ServiceRecognizerBase.telemetryData) {\r\n try {\r\n ServiceRecognizerBase.telemetryData(telemetryData);\r\n /* tslint:disable:no-empty */\r\n } catch { }\r\n }\r\n\r\n return this.fetchConnection().onSuccessContinueWith((connection: IConnection): Promise => {\r\n return connection.send(new SpeechConnectionMessage(\r\n MessageType.Text,\r\n \"telemetry\",\r\n this.privRequestSession.requestId,\r\n \"application/json\",\r\n telemetryData));\r\n });\r\n }\r\n\r\n // Cancels recognition.\r\n protected abstract cancelRecognition(\r\n sessionId: string,\r\n requestId: string,\r\n cancellationReason: CancellationReason,\r\n errorCode: CancellationErrorCode,\r\n error: string,\r\n cancelRecoCallback: (r: SpeechRecognitionResult) => void): void;\r\n\r\n // Cancels recognition.\r\n protected cancelRecognitionLocal(\r\n cancellationReason: CancellationReason,\r\n errorCode: CancellationErrorCode,\r\n error: string,\r\n cancelRecoCallback: (r: SpeechRecognitionResult) => void): void {\r\n\r\n if (!!this.privRequestSession.isRecognizing) {\r\n this.privRequestSession.onStopRecognizing();\r\n this.sendTelemetryData();\r\n\r\n this.cancelRecognition(\r\n this.privRequestSession.sessionId,\r\n this.privRequestSession.requestId,\r\n cancellationReason,\r\n errorCode,\r\n error,\r\n cancelRecoCallback);\r\n }\r\n }\r\n\r\n private fetchConnection = (): Promise => {\r\n return this.configureConnection();\r\n }\r\n\r\n // Establishes a websocket connection to the end point.\r\n private connectImpl(isUnAuthorized: boolean = false): Promise {\r\n if (this.privConnectionPromise) {\r\n if (this.privConnectionPromise.result().isCompleted &&\r\n (this.privConnectionPromise.result().isError\r\n || this.privConnectionPromise.result().result.state() === ConnectionState.Disconnected)) {\r\n this.privConnectionId = null;\r\n this.privConnectionPromise = null;\r\n return this.connectImpl();\r\n } else {\r\n return this.privConnectionPromise;\r\n }\r\n }\r\n\r\n this.privAuthFetchEventId = createNoDashGuid();\r\n this.privConnectionId = createNoDashGuid();\r\n\r\n this.privRequestSession.onPreConnectionStart(this.privAuthFetchEventId, this.privConnectionId);\r\n\r\n const authPromise = isUnAuthorized ? this.privAuthentication.fetchOnExpiry(this.privAuthFetchEventId) : this.privAuthentication.fetch(this.privAuthFetchEventId);\r\n\r\n this.privConnectionPromise = authPromise\r\n .continueWithPromise((result: PromiseResult) => {\r\n if (result.isError) {\r\n this.privRequestSession.onAuthCompleted(true, result.error);\r\n throw new Error(result.error);\r\n } else {\r\n this.privRequestSession.onAuthCompleted(false);\r\n }\r\n\r\n const connection: IConnection = this.privConnectionFactory.create(this.privRecognizerConfig, result.result, this.privConnectionId);\r\n\r\n this.privRequestSession.listenForServiceTelemetry(connection.events);\r\n\r\n // Attach to the underlying event. No need to hold onto the detach pointers as in the event the connection goes away,\r\n // it'll stop sending events.\r\n connection.events.attach((event: ConnectionEvent) => {\r\n this.connectionEvents.onEvent(event);\r\n });\r\n\r\n return connection.open().onSuccessContinueWithPromise((response: ConnectionOpenResponse): Promise => {\r\n if (response.statusCode === 200) {\r\n this.privRequestSession.onPreConnectionStart(this.privAuthFetchEventId, this.privConnectionId);\r\n this.privRequestSession.onConnectionEstablishCompleted(response.statusCode);\r\n\r\n return PromiseHelper.fromResult(connection);\r\n } else if (response.statusCode === 403 && !isUnAuthorized) {\r\n return this.connectImpl(true);\r\n } else {\r\n this.privRequestSession.onConnectionEstablishCompleted(response.statusCode, response.reason);\r\n return PromiseHelper.fromError(`Unable to contact server. StatusCode: ${response.statusCode}, ${this.privRecognizerConfig.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint)} Reason: ${response.reason}`);\r\n }\r\n });\r\n });\r\n\r\n return this.privConnectionPromise;\r\n }\r\n\r\n // Takes an established websocket connection to the endpoint and sends speech configuration information.\r\n private configureConnection(): Promise {\r\n if (this.privConnectionConfigurationPromise) {\r\n if (this.privConnectionConfigurationPromise.result().isCompleted &&\r\n (this.privConnectionConfigurationPromise.result().isError\r\n || this.privConnectionConfigurationPromise.result().result.state() === ConnectionState.Disconnected)) {\r\n\r\n this.privConnectionConfigurationPromise = null;\r\n return this.configureConnection();\r\n } else {\r\n return this.privConnectionConfigurationPromise;\r\n }\r\n }\r\n\r\n this.privConnectionConfigurationPromise = this.connectImpl().onSuccessContinueWithPromise((connection: IConnection): Promise => {\r\n return this.sendSpeechServiceConfig(connection, this.privRequestSession, this.privRecognizerConfig.SpeechServiceConfig.serialize())\r\n .onSuccessContinueWithPromise((_: boolean) => {\r\n return this.sendSpeechContext(connection).onSuccessContinueWith((_: boolean) => {\r\n return connection;\r\n });\r\n });\r\n });\r\n\r\n return this.privConnectionConfigurationPromise;\r\n }\r\n\r\n private receiveMessage = (\r\n successCallback: (e: SpeechRecognitionResult) => void,\r\n errorCallBack: (e: string) => void,\r\n ): Promise => {\r\n return this.fetchConnection().on((connection: IConnection): Promise => {\r\n return connection.read()\r\n .onSuccessContinueWithPromise((message: ConnectionMessage) => {\r\n if (this.privIsDisposed || !this.privRequestSession.isRecognizing) {\r\n // We're done.\r\n return PromiseHelper.fromResult(undefined);\r\n }\r\n\r\n // indicates we are draining the queue and it came with no message;\r\n if (!message) {\r\n if (!this.privRequestSession.isRecognizing) {\r\n return PromiseHelper.fromResult(true);\r\n } else {\r\n return this.receiveMessage(successCallback, errorCallBack);\r\n }\r\n }\r\n\r\n const connectionMessage = SpeechConnectionMessage.fromConnectionMessage(message);\r\n\r\n if (connectionMessage.requestId.toLowerCase() === this.privRequestSession.requestId.toLowerCase()) {\r\n switch (connectionMessage.path.toLowerCase()) {\r\n case \"turn.start\":\r\n this.privMustReportEndOfStream = true;\r\n break;\r\n case \"speech.startdetected\":\r\n const speechStartDetected: SpeechDetected = SpeechDetected.fromJSON(connectionMessage.textBody);\r\n\r\n const speechStartEventArgs = new RecognitionEventArgs(speechStartDetected.Offset, this.privRequestSession.sessionId);\r\n\r\n if (!!this.privRecognizer.speechStartDetected) {\r\n this.privRecognizer.speechStartDetected(this.privRecognizer, speechStartEventArgs);\r\n }\r\n\r\n break;\r\n case \"speech.enddetected\":\r\n\r\n let json: string;\r\n\r\n if (connectionMessage.textBody.length > 0) {\r\n json = connectionMessage.textBody;\r\n } else {\r\n // If the request was empty, the JSON returned is empty.\r\n json = \"{ Offset: 0 }\";\r\n }\r\n\r\n const speechStopDetected: SpeechDetected = SpeechDetected.fromJSON(json);\r\n\r\n // Only shrink the buffers for continuous recognition.\r\n // For single shot, the speech.phrase message will come after the speech.end and it should own buffer shrink.\r\n if (this.privRecognizerConfig.isContinuousRecognition) {\r\n this.privRequestSession.onServiceRecognized(speechStopDetected.Offset + this.privRequestSession.currentTurnAudioOffset);\r\n }\r\n\r\n const speechStopEventArgs = new RecognitionEventArgs(speechStopDetected.Offset + this.privRequestSession.currentTurnAudioOffset, this.privRequestSession.sessionId);\r\n\r\n if (!!this.privRecognizer.speechEndDetected) {\r\n this.privRecognizer.speechEndDetected(this.privRecognizer, speechStopEventArgs);\r\n }\r\n break;\r\n case \"turn.end\":\r\n this.sendTelemetryData();\r\n\r\n if (this.privRequestSession.isSpeechEnded && this.privMustReportEndOfStream) {\r\n this.privMustReportEndOfStream = false;\r\n this.cancelRecognitionLocal(CancellationReason.EndOfStream, CancellationErrorCode.NoError, undefined, successCallback);\r\n }\r\n\r\n const sessionStopEventArgs: SessionEventArgs = new SessionEventArgs(this.privRequestSession.sessionId);\r\n this.privRequestSession.onServiceTurnEndResponse(this.privRecognizerConfig.isContinuousRecognition);\r\n\r\n if (!this.privRecognizerConfig.isContinuousRecognition || this.privRequestSession.isSpeechEnded) {\r\n if (!!this.privRecognizer.sessionStopped) {\r\n this.privRecognizer.sessionStopped(this.privRecognizer, sessionStopEventArgs);\r\n }\r\n\r\n return PromiseHelper.fromResult(true);\r\n } else {\r\n this.fetchConnection().onSuccessContinueWith((connection: IConnection) => {\r\n this.sendSpeechContext(connection);\r\n });\r\n }\r\n default:\r\n this.processTypeSpecificMessages(\r\n connectionMessage,\r\n successCallback,\r\n errorCallBack);\r\n }\r\n }\r\n\r\n return this.receiveMessage(successCallback, errorCallBack);\r\n });\r\n }, (error: string) => {\r\n });\r\n }\r\n\r\n private sendSpeechServiceConfig = (connection: IConnection, requestSession: RequestSession, SpeechServiceConfigJson: string): Promise => {\r\n // filter out anything that is not required for the service to work.\r\n if (ServiceRecognizerBase.telemetryDataEnabled !== true) {\r\n const withTelemetry = JSON.parse(SpeechServiceConfigJson);\r\n\r\n const replacement: any = {\r\n context: {\r\n system: withTelemetry.context.system,\r\n },\r\n };\r\n\r\n SpeechServiceConfigJson = JSON.stringify(replacement);\r\n }\r\n\r\n if (SpeechServiceConfigJson) { // && this.privConnectionId !== this.privSpeechServiceConfigConnectionId) {\r\n this.privSpeechServiceConfigConnectionId = this.privConnectionId;\r\n return connection.send(new SpeechConnectionMessage(\r\n MessageType.Text,\r\n \"speech.config\",\r\n requestSession.requestId,\r\n \"application/json\",\r\n SpeechServiceConfigJson));\r\n }\r\n\r\n return PromiseHelper.fromResult(true);\r\n }\r\n\r\n private sendSpeechContext = (connection: IConnection): Promise => {\r\n const speechContextJson = this.speechContext.toJSON();\r\n\r\n if (speechContextJson) {\r\n return connection.send(new SpeechConnectionMessage(\r\n MessageType.Text,\r\n \"speech.context\",\r\n this.privRequestSession.requestId,\r\n \"application/json\",\r\n speechContextJson));\r\n }\r\n return PromiseHelper.fromResult(true);\r\n }\r\n\r\n private sendFinalAudio(): Promise {\r\n const deferred = new Deferred();\r\n\r\n this.fetchConnection().on((connection: IConnection) => {\r\n connection.send(new SpeechConnectionMessage(MessageType.Binary, \"audio\", this.privRequestSession.requestId, null, null)).on((_: boolean) => {\r\n deferred.resolve(true);\r\n }, (error: string) => {\r\n deferred.reject(error);\r\n });\r\n }, (error: string) => {\r\n deferred.reject(error);\r\n });\r\n\r\n return deferred.promise();\r\n }\r\n\r\n private sendAudio = (\r\n audioStreamNode: IAudioStreamNode): Promise => {\r\n // NOTE: Home-baked promises crash ios safari during the invocation\r\n // of the error callback chain (looks like the recursion is way too deep, and\r\n // it blows up the stack). The following construct is a stop-gap that does not\r\n // bubble the error up the callback chain and hence circumvents this problem.\r\n // TODO: rewrite with ES6 promises.\r\n const deferred = new Deferred();\r\n\r\n // The time we last sent data to the service.\r\n let nextSendTime: number = Date.now();\r\n\r\n const audioFormat: AudioStreamFormatImpl = this.privAudioSource.format as AudioStreamFormatImpl;\r\n\r\n // Max amount to send before we start to throttle\r\n const fastLaneSizeMs: string = this.privRecognizerConfig.parameters.getProperty(\"SPEECH-TransmitLengthBeforThrottleMs\", \"5000\");\r\n const maxSendUnthrottledBytes: number = audioFormat.avgBytesPerSec / 1000 * parseInt(fastLaneSizeMs, 10);\r\n const startRecogNumber: number = this.privRequestSession.recogNumber;\r\n\r\n const readAndUploadCycle = () => {\r\n\r\n // If speech is done, stop sending audio.\r\n if (!this.privIsDisposed &&\r\n !this.privRequestSession.isSpeechEnded &&\r\n this.privRequestSession.isRecognizing &&\r\n this.privRequestSession.recogNumber === startRecogNumber) {\r\n this.fetchConnection().on((connection: IConnection) => {\r\n audioStreamNode.read().on(\r\n (audioStreamChunk: IStreamChunk) => {\r\n // we have a new audio chunk to upload.\r\n if (this.privRequestSession.isSpeechEnded) {\r\n // If service already recognized audio end then don't send any more audio\r\n deferred.resolve(true);\r\n return;\r\n }\r\n\r\n let payload: ArrayBuffer;\r\n let sendDelay: number;\r\n\r\n if (audioStreamChunk.isEnd) {\r\n payload = null;\r\n sendDelay = 0;\r\n } else {\r\n payload = audioStreamChunk.buffer;\r\n this.privRequestSession.onAudioSent(payload.byteLength);\r\n\r\n if (maxSendUnthrottledBytes >= this.privRequestSession.bytesSent) {\r\n sendDelay = 0;\r\n } else {\r\n sendDelay = Math.max(0, nextSendTime - Date.now());\r\n }\r\n }\r\n\r\n // Are we ready to send, or need we delay more?\r\n setTimeout(() => {\r\n if (payload !== null) {\r\n nextSendTime = Date.now() + (payload.byteLength * 1000 / (audioFormat.avgBytesPerSec * 2));\r\n }\r\n\r\n const uploaded: Promise = connection.send(\r\n new SpeechConnectionMessage(\r\n MessageType.Binary, \"audio\", this.privRequestSession.requestId, null, payload));\r\n\r\n if (!audioStreamChunk.isEnd) {\r\n uploaded.continueWith((_: PromiseResult) => {\r\n\r\n // Regardless of success or failure, schedule the next upload.\r\n // If the underlying connection was broken, the next cycle will\r\n // get a new connection and re-transmit missing audio automatically.\r\n readAndUploadCycle();\r\n });\r\n } else {\r\n // the audio stream has been closed, no need to schedule next\r\n // read-upload cycle.\r\n this.privRequestSession.onSpeechEnded();\r\n deferred.resolve(true);\r\n }\r\n }, sendDelay);\r\n },\r\n (error: string) => {\r\n if (this.privRequestSession.isSpeechEnded) {\r\n // For whatever reason, Reject is used to remove queue subscribers inside\r\n // the Queue.DrainAndDispose invoked from DetachAudioNode down below, which\r\n // means that sometimes things can be rejected in normal circumstances, without\r\n // any errors.\r\n deferred.resolve(true); // TODO: remove the argument, it's is completely meaningless.\r\n } else {\r\n // Only reject, if there was a proper error.\r\n deferred.reject(error);\r\n }\r\n });\r\n }, (error: string) => {\r\n deferred.reject(error);\r\n });\r\n }\r\n };\r\n\r\n readAndUploadCycle();\r\n\r\n return deferred.promise();\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ArgumentNullError, ConnectionMessage, IStringDictionary, MessageType } from \"../common/Exports\";\r\n\r\nconst PathHeaderName: string = \"path\";\r\nconst ContentTypeHeaderName: string = \"content-type\";\r\nconst RequestIdHeaderName: string = \"x-requestid\";\r\nconst RequestTimestampHeaderName: string = \"x-timestamp\";\r\n\r\nexport class SpeechConnectionMessage extends ConnectionMessage {\r\n\r\n private privPath: string;\r\n private privRequestId: string;\r\n private privContentType: string;\r\n private privAdditionalHeaders: IStringDictionary;\r\n\r\n public constructor(\r\n messageType: MessageType,\r\n path: string,\r\n requestId: string,\r\n contentType: string,\r\n body: any,\r\n additionalHeaders?: IStringDictionary,\r\n id?: string) {\r\n\r\n if (!path) {\r\n throw new ArgumentNullError(\"path\");\r\n }\r\n\r\n if (!requestId) {\r\n throw new ArgumentNullError(\"requestId\");\r\n }\r\n\r\n const headers: IStringDictionary = {};\r\n headers[PathHeaderName] = path;\r\n headers[RequestIdHeaderName] = requestId;\r\n headers[RequestTimestampHeaderName] = new Date().toISOString();\r\n if (contentType) {\r\n headers[ContentTypeHeaderName] = contentType;\r\n }\r\n\r\n if (additionalHeaders) {\r\n for (const headerName in additionalHeaders) {\r\n if (headerName) {\r\n headers[headerName] = additionalHeaders[headerName];\r\n }\r\n\r\n }\r\n }\r\n\r\n if (id) {\r\n super(messageType, body, headers, id);\r\n } else {\r\n super(messageType, body, headers);\r\n }\r\n\r\n this.privPath = path;\r\n this.privRequestId = requestId;\r\n this.privContentType = contentType;\r\n this.privAdditionalHeaders = additionalHeaders;\r\n }\r\n\r\n public get path(): string {\r\n return this.privPath;\r\n }\r\n\r\n public get requestId(): string {\r\n return this.privRequestId;\r\n }\r\n\r\n public get contentType(): string {\r\n return this.privContentType;\r\n }\r\n\r\n public get additionalHeaders(): IStringDictionary {\r\n return this.privAdditionalHeaders;\r\n }\r\n\r\n public static fromConnectionMessage = (message: ConnectionMessage): SpeechConnectionMessage => {\r\n let path = null;\r\n let requestId = null;\r\n let contentType = null;\r\n let requestTimestamp = null;\r\n const additionalHeaders: IStringDictionary = {};\r\n\r\n if (message.headers) {\r\n for (const headerName in message.headers) {\r\n if (headerName) {\r\n if (headerName.toLowerCase() === PathHeaderName.toLowerCase()) {\r\n path = message.headers[headerName];\r\n } else if (headerName.toLowerCase() === RequestIdHeaderName.toLowerCase()) {\r\n requestId = message.headers[headerName];\r\n } else if (headerName.toLowerCase() === RequestTimestampHeaderName.toLowerCase()) {\r\n requestTimestamp = message.headers[headerName];\r\n } else if (headerName.toLowerCase() === ContentTypeHeaderName.toLowerCase()) {\r\n contentType = message.headers[headerName];\r\n } else {\r\n additionalHeaders[headerName] = message.headers[headerName];\r\n }\r\n }\r\n }\r\n }\r\n\r\n return new SpeechConnectionMessage(\r\n message.messageType,\r\n path,\r\n requestId,\r\n contentType,\r\n message.body,\r\n additionalHeaders,\r\n message.id);\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyCollection } from \"../sdk/Exports\";\r\n\r\nexport enum RecognitionMode {\r\n Interactive,\r\n Conversation,\r\n Dictation,\r\n}\r\n\r\nexport enum SpeechResultFormat {\r\n Simple,\r\n Detailed,\r\n}\r\n\r\nexport class RecognizerConfig {\r\n private privRecognitionMode: RecognitionMode = RecognitionMode.Interactive;\r\n private privSpeechServiceConfig: SpeechServiceConfig;\r\n private privRecognitionActivityTimeout: number;\r\n private privParameters: PropertyCollection;\r\n\r\n constructor(\r\n speechServiceConfig: SpeechServiceConfig,\r\n parameters: PropertyCollection) {\r\n this.privSpeechServiceConfig = speechServiceConfig ? speechServiceConfig : new SpeechServiceConfig(new Context(null));\r\n this.privParameters = parameters;\r\n }\r\n\r\n public get parameters(): PropertyCollection {\r\n return this.privParameters;\r\n }\r\n\r\n public get recognitionMode(): RecognitionMode {\r\n return this.privRecognitionMode;\r\n }\r\n\r\n public set recognitionMode(value: RecognitionMode) {\r\n this.privRecognitionMode = value;\r\n this.privRecognitionActivityTimeout = value === RecognitionMode.Interactive ? 8000 : 25000;\r\n this.privSpeechServiceConfig.Recognition = RecognitionMode[value];\r\n }\r\n\r\n public get SpeechServiceConfig(): SpeechServiceConfig {\r\n return this.privSpeechServiceConfig;\r\n }\r\n\r\n public get recognitionActivityTimeout(): number {\r\n return this.privRecognitionActivityTimeout;\r\n }\r\n\r\n public get isContinuousRecognition(): boolean {\r\n return this.privRecognitionMode !== RecognitionMode.Interactive;\r\n }\r\n}\r\n\r\n// The config is serialized and sent as the Speech.Config\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class SpeechServiceConfig {\r\n private context: Context;\r\n private recognition: string;\r\n\r\n constructor(context: Context) {\r\n this.context = context;\r\n }\r\n\r\n public serialize = (): string => {\r\n return JSON.stringify(this, (key: any, value: any): any => {\r\n if (value && typeof value === \"object\") {\r\n const replacement: any = {};\r\n for (const k in value) {\r\n if (Object.hasOwnProperty.call(value, k)) {\r\n replacement[k && k.charAt(0).toLowerCase() + k.substring(1)] = value[k];\r\n }\r\n }\r\n return replacement;\r\n }\r\n return value;\r\n });\r\n }\r\n\r\n public get Context(): Context {\r\n return this.context;\r\n }\r\n\r\n public get Recognition(): string {\r\n return this.recognition;\r\n }\r\n\r\n public set Recognition(value: string) {\r\n this.recognition = value.toLowerCase();\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class Context {\r\n public system: System;\r\n public os: OS;\r\n public audio: ISpeechConfigAudio;\r\n\r\n constructor(os: OS) {\r\n this.system = new System();\r\n this.os = os;\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class System {\r\n public name: string;\r\n public version: string;\r\n public build: string;\r\n public lang: string;\r\n\r\n constructor() {\r\n // Note: below will be patched for official builds.\r\n const SPEECHSDK_CLIENTSDK_VERSION = \"1.7.0\";\r\n\r\n this.name = \"SpeechSDK\";\r\n this.version = SPEECHSDK_CLIENTSDK_VERSION;\r\n this.build = \"JavaScript\";\r\n this.lang = \"JavaScript\";\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class OS {\r\n public platform: string;\r\n public name: string;\r\n public version: string;\r\n\r\n constructor(platform: string, name: string, version: string) {\r\n this.platform = platform;\r\n this.name = name;\r\n this.version = version;\r\n }\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class Device {\r\n public manufacturer: string;\r\n public model: string;\r\n public version: string;\r\n\r\n constructor(manufacturer: string, model: string, version: string) {\r\n this.manufacturer = manufacturer;\r\n this.model = model;\r\n this.version = version;\r\n }\r\n}\r\n\r\nexport interface ISpeechConfigAudio {\r\n source?: ISpeechConfigAudioDevice;\r\n playback?: ISpeechConfigAudioDevice;\r\n}\r\n\r\nexport interface ISpeechConfigAudioDevice {\r\n manufacturer: string;\r\n model: string;\r\n connectivity: connectivity;\r\n type: type;\r\n samplerate: number;\r\n bitspersample: number;\r\n channelcount: number;\r\n}\r\n\r\nexport enum connectivity {\r\n Bluetooth = \"Bluetooth\",\r\n Wired = \"Wired\",\r\n WiFi = \"WiFi\",\r\n Cellular = \"Cellular\",\r\n InBuilt = \"InBuilt\",\r\n Unknown = \"Unknown\",\r\n}\r\n\r\nexport enum type {\r\n Phone = \"Phone\",\r\n Speaker = \"Speaker\",\r\n Car = \"Car\",\r\n Headset = \"Headset\",\r\n Thermostat = \"Thermostat\",\r\n Microphones = \"Microphones\",\r\n Deskphone = \"Deskphone\",\r\n RemoteControl = \"RemoteControl\",\r\n Unknown = \"Unknown\",\r\n File = \"File\",\r\n Stream = \"Stream\",\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n ConnectionMessage,\r\n Deferred,\r\n IStringDictionary,\r\n IWebsocketMessageFormatter,\r\n MessageType,\r\n Promise,\r\n RawWebsocketMessage,\r\n} from \"../common/Exports\";\r\n\r\nconst CRLF: string = \"\\r\\n\";\r\n\r\nexport class WebsocketMessageFormatter implements IWebsocketMessageFormatter {\r\n\r\n public toConnectionMessage = (message: RawWebsocketMessage): Promise => {\r\n const deferral = new Deferred();\r\n\r\n try {\r\n if (message.messageType === MessageType.Text) {\r\n const textMessage: string = message.textContent;\r\n let headers: IStringDictionary = {};\r\n let body: string = null;\r\n\r\n if (textMessage) {\r\n const headerBodySplit = textMessage.split(\"\\r\\n\\r\\n\");\r\n if (headerBodySplit && headerBodySplit.length > 0) {\r\n headers = this.parseHeaders(headerBodySplit[0]);\r\n if (headerBodySplit.length > 1) {\r\n body = headerBodySplit[1];\r\n }\r\n }\r\n }\r\n\r\n deferral.resolve(new ConnectionMessage(message.messageType, body, headers, message.id));\r\n } else if (message.messageType === MessageType.Binary) {\r\n const binaryMessage: ArrayBuffer = message.binaryContent;\r\n let headers: IStringDictionary = {};\r\n let body: ArrayBuffer = null;\r\n\r\n if (!binaryMessage || binaryMessage.byteLength < 2) {\r\n throw new Error(\"Invalid binary message format. Header length missing.\");\r\n }\r\n\r\n const dataView = new DataView(binaryMessage);\r\n const headerLength = dataView.getInt16(0);\r\n\r\n if (binaryMessage.byteLength < headerLength + 2) {\r\n throw new Error(\"Invalid binary message format. Header content missing.\");\r\n }\r\n\r\n let headersString = \"\";\r\n for (let i = 0; i < headerLength; i++) {\r\n headersString += String.fromCharCode((dataView).getInt8(i + 2));\r\n }\r\n\r\n headers = this.parseHeaders(headersString);\r\n\r\n if (binaryMessage.byteLength > headerLength + 2) {\r\n body = binaryMessage.slice(2 + headerLength);\r\n }\r\n\r\n deferral.resolve(new ConnectionMessage(message.messageType, body, headers, message.id));\r\n }\r\n } catch (e) {\r\n deferral.reject(`Error formatting the message. Error: ${e}`);\r\n }\r\n\r\n return deferral.promise();\r\n }\r\n\r\n public fromConnectionMessage = (message: ConnectionMessage): Promise => {\r\n const deferral = new Deferred();\r\n\r\n try {\r\n if (message.messageType === MessageType.Text) {\r\n const payload = `${this.makeHeaders(message)}${CRLF}${message.textBody ? message.textBody : \"\"}`;\r\n\r\n deferral.resolve(new RawWebsocketMessage(MessageType.Text, payload, message.id));\r\n\r\n } else if (message.messageType === MessageType.Binary) {\r\n const headersString = this.makeHeaders(message);\r\n const content = message.binaryBody;\r\n\r\n const headerInt8Array = new Int8Array(this.stringToArrayBuffer(headersString));\r\n\r\n const payload = new ArrayBuffer(2 + headerInt8Array.byteLength + (content ? content.byteLength : 0));\r\n const dataView = new DataView(payload);\r\n\r\n dataView.setInt16(0, headerInt8Array.length);\r\n\r\n for (let i = 0; i < headerInt8Array.byteLength; i++) {\r\n dataView.setInt8(2 + i, headerInt8Array[i]);\r\n }\r\n\r\n if (content) {\r\n const bodyInt8Array = new Int8Array(content);\r\n for (let i = 0; i < bodyInt8Array.byteLength; i++) {\r\n dataView.setInt8(2 + headerInt8Array.byteLength + i, bodyInt8Array[i]);\r\n }\r\n }\r\n\r\n deferral.resolve(new RawWebsocketMessage(MessageType.Binary, payload, message.id));\r\n }\r\n } catch (e) {\r\n deferral.reject(`Error formatting the message. ${e}`);\r\n }\r\n\r\n return deferral.promise();\r\n }\r\n\r\n private makeHeaders = (message: ConnectionMessage): string => {\r\n let headersString: string = \"\";\r\n\r\n if (message.headers) {\r\n for (const header in message.headers) {\r\n if (header) {\r\n headersString += `${header}: ${message.headers[header]}${CRLF}`;\r\n }\r\n }\r\n }\r\n\r\n return headersString;\r\n }\r\n\r\n private parseHeaders = (headersString: string): IStringDictionary => {\r\n const headers: IStringDictionary = {};\r\n\r\n if (headersString) {\r\n const headerMatches = headersString.match(/[^\\r\\n]+/g);\r\n if (headers) {\r\n for (const header of headerMatches) {\r\n if (header) {\r\n const separatorIndex = header.indexOf(\":\");\r\n const headerName = separatorIndex > 0 ? header.substr(0, separatorIndex).trim().toLowerCase() : header;\r\n const headerValue =\r\n separatorIndex > 0 && header.length > (separatorIndex + 1) ?\r\n header.substr(separatorIndex + 1).trim() :\r\n \"\";\r\n\r\n headers[headerName] = headerValue;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return headers;\r\n }\r\n\r\n private stringToArrayBuffer = (str: string): ArrayBuffer => {\r\n const buffer = new ArrayBuffer(str.length);\r\n const view = new DataView(buffer);\r\n for (let i = 0; i < str.length; i++) {\r\n view.setUint8(i, str.charCodeAt(i));\r\n }\r\n return buffer;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n ProxyInfo,\r\n WebsocketConnection,\r\n} from \"../common.browser/Exports\";\r\nimport {\r\n IConnection,\r\n IStringDictionary,\r\n} from \"../common/Exports\";\r\nimport {\r\n PropertyId\r\n} from \"../sdk/Exports\";\r\nimport {\r\n ConnectionFactoryBase\r\n} from \"./ConnectionFactoryBase\";\r\nimport {\r\n AuthInfo,\r\n IConnectionFactory,\r\n RecognizerConfig,\r\n WebsocketMessageFormatter,\r\n} from \"./Exports\";\r\nimport { QueryParameterNames } from \"./QueryParameterNames\";\r\n\r\nconst TestHooksParamName: string = \"testhooks\";\r\nconst ConnectionIdHeader: string = \"X-ConnectionId\";\r\n\r\nexport class TranslationConnectionFactory extends ConnectionFactoryBase {\r\n\r\n public create = (\r\n config: RecognizerConfig,\r\n authInfo: AuthInfo,\r\n connectionId?: string): IConnection => {\r\n\r\n let endpoint: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint, undefined);\r\n if (!endpoint) {\r\n const region: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Region, undefined);\r\n\r\n endpoint = \"wss://\" + region + \".s2s.speech.microsoft.com/speech/translation/cognitiveservices/v1\";\r\n }\r\n\r\n const queryParams: IStringDictionary = {\r\n from: config.parameters.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage),\r\n to: config.parameters.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages),\r\n };\r\n\r\n this.setCommonUrlParams(config, queryParams, endpoint);\r\n this.setUrlParameter(\r\n PropertyId.SpeechServiceResponse_TranslationRequestStablePartialResult,\r\n QueryParameterNames.StableTranslation,\r\n config,\r\n queryParams,\r\n endpoint\r\n );\r\n\r\n const voiceName: string = \"voice\";\r\n const featureName: string = \"features\";\r\n\r\n if (config.parameters.getProperty(PropertyId.SpeechServiceConnection_TranslationVoice, undefined) !== undefined) {\r\n queryParams[voiceName] = config.parameters.getProperty(PropertyId.SpeechServiceConnection_TranslationVoice);\r\n queryParams[featureName] = \"texttospeech\";\r\n }\r\n\r\n const headers: IStringDictionary = {};\r\n headers[authInfo.headerName] = authInfo.token;\r\n headers[ConnectionIdHeader] = connectionId;\r\n\r\n return new WebsocketConnection(endpoint, queryParams, headers, new WebsocketMessageFormatter(), ProxyInfo.fromRecognizerConfig(config), connectionId);\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n CancellationErrorCode,\r\n CancellationReason,\r\n ResultReason\r\n} from \"../sdk/Exports\";\r\nimport { RecognitionStatus } from \"./Exports\";\r\n\r\nexport class EnumTranslation {\r\n public static implTranslateRecognitionResult(recognitionStatus: RecognitionStatus): ResultReason {\r\n let reason = ResultReason.Canceled;\r\n switch (recognitionStatus) {\r\n case RecognitionStatus.Success:\r\n reason = ResultReason.RecognizedSpeech;\r\n break;\r\n case RecognitionStatus.NoMatch:\r\n case RecognitionStatus.InitialSilenceTimeout:\r\n case RecognitionStatus.BabbleTimeout:\r\n case RecognitionStatus.EndOfDictation:\r\n reason = ResultReason.NoMatch;\r\n break;\r\n case RecognitionStatus.Error:\r\n default:\r\n reason = ResultReason.Canceled;\r\n break;\r\n }\r\n return reason;\r\n }\r\n\r\n public static implTranslateCancelResult(recognitionStatus: RecognitionStatus): CancellationReason {\r\n let reason = CancellationReason.EndOfStream;\r\n switch (recognitionStatus) {\r\n case RecognitionStatus.Success:\r\n case RecognitionStatus.EndOfDictation:\r\n case RecognitionStatus.NoMatch:\r\n reason = CancellationReason.EndOfStream;\r\n break;\r\n case RecognitionStatus.InitialSilenceTimeout:\r\n case RecognitionStatus.BabbleTimeout:\r\n case RecognitionStatus.Error:\r\n default:\r\n reason = CancellationReason.Error;\r\n break;\r\n }\r\n return reason;\r\n }\r\n\r\n public static implTranslateCancelErrorCode(recognitionStatus: RecognitionStatus): CancellationErrorCode {\r\n let reason: CancellationErrorCode = CancellationErrorCode.NoError;\r\n switch (recognitionStatus) {\r\n case RecognitionStatus.Error:\r\n reason = CancellationErrorCode.ServiceError;\r\n break;\r\n case RecognitionStatus.TooManyRequests:\r\n reason = CancellationErrorCode.TooManyRequests;\r\n break;\r\n default:\r\n reason = CancellationErrorCode.NoError;\r\n break;\r\n }\r\n\r\n return reason;\r\n\r\n }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * @class SynthesisStatus\r\n * @private\r\n */\r\nexport enum SynthesisStatus {\r\n /**\r\n * The response contains valid audio data.\r\n * @member SynthesisStatus.Success\r\n */\r\n Success,\r\n\r\n /**\r\n * Indicates the end of audio data. No valid audio data is included in the message.\r\n * @member SynthesisStatus.SynthesisEnd\r\n */\r\n SynthesisEnd,\r\n\r\n /**\r\n * Indicates an error occurred during synthesis data processing.\r\n * @member SynthesisStatus.Error\r\n */\r\n Error,\r\n}\r\n\r\nexport enum RecognitionStatus {\r\n Success,\r\n NoMatch,\r\n InitialSilenceTimeout,\r\n BabbleTimeout,\r\n Error,\r\n EndOfDictation,\r\n TooManyRequests,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { SynthesisStatus } from \"../Exports\";\r\n\r\n// translation.synthesis.end\r\nexport interface ITranslationSynthesisEnd {\r\n SynthesisStatus: SynthesisStatus;\r\n FailureReason: string;\r\n}\r\n\r\nexport class TranslationSynthesisEnd implements ITranslationSynthesisEnd {\r\n private privSynthesisEnd: ITranslationSynthesisEnd;\r\n\r\n private constructor(json: string) {\r\n this.privSynthesisEnd = JSON.parse(json);\r\n this.privSynthesisEnd.SynthesisStatus = (SynthesisStatus as any)[this.privSynthesisEnd.SynthesisStatus];\r\n }\r\n\r\n public static fromJSON(json: string): TranslationSynthesisEnd {\r\n return new TranslationSynthesisEnd(json);\r\n }\r\n\r\n public get SynthesisStatus(): SynthesisStatus {\r\n return this.privSynthesisEnd.SynthesisStatus;\r\n }\r\n\r\n public get FailureReason(): string {\r\n return this.privSynthesisEnd.FailureReason;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ITranslations } from \"../Exports\";\r\nimport { TranslationStatus } from \"../TranslationStatus\";\r\n\r\n// translation.hypothesis\r\nexport interface ITranslationHypothesis {\r\n Duration: number;\r\n Offset: number;\r\n Text: string;\r\n Translation: ITranslations;\r\n}\r\n\r\nexport class TranslationHypothesis implements ITranslationHypothesis {\r\n private privTranslationHypothesis: ITranslationHypothesis;\r\n\r\n private constructor(json: string) {\r\n this.privTranslationHypothesis = JSON.parse(json);\r\n this.privTranslationHypothesis.Translation.TranslationStatus = (TranslationStatus as any)[this.privTranslationHypothesis.Translation.TranslationStatus];\r\n }\r\n\r\n public static fromJSON(json: string): TranslationHypothesis {\r\n return new TranslationHypothesis(json);\r\n }\r\n\r\n public get Duration(): number {\r\n return this.privTranslationHypothesis.Duration;\r\n }\r\n\r\n public get Offset(): number {\r\n return this.privTranslationHypothesis.Offset;\r\n }\r\n\r\n public get Text(): string {\r\n return this.privTranslationHypothesis.Text;\r\n }\r\n\r\n public get Translation(): ITranslations {\r\n return this.privTranslationHypothesis.Translation;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ITranslations, RecognitionStatus } from \"../Exports\";\r\nimport { TranslationStatus } from \"../TranslationStatus\";\r\n\r\n// translation.phrase\r\nexport interface ITranslationPhrase {\r\n RecognitionStatus: RecognitionStatus;\r\n Offset: number;\r\n Duration: number;\r\n Text: string;\r\n Translation: ITranslations;\r\n}\r\n\r\nexport class TranslationPhrase implements ITranslationPhrase {\r\n private privTranslationPhrase: ITranslationPhrase;\r\n\r\n private constructor(json: string) {\r\n this.privTranslationPhrase = JSON.parse(json);\r\n this.privTranslationPhrase.RecognitionStatus = (RecognitionStatus as any)[this.privTranslationPhrase.RecognitionStatus];\r\n if (this.privTranslationPhrase.Translation !== undefined) {\r\n this.privTranslationPhrase.Translation.TranslationStatus = (TranslationStatus as any)[this.privTranslationPhrase.Translation.TranslationStatus];\r\n }\r\n }\r\n\r\n public static fromJSON(json: string): TranslationPhrase {\r\n return new TranslationPhrase(json);\r\n }\r\n\r\n public get RecognitionStatus(): RecognitionStatus {\r\n return this.privTranslationPhrase.RecognitionStatus;\r\n }\r\n\r\n public get Offset(): number {\r\n return this.privTranslationPhrase.Offset;\r\n }\r\n\r\n public get Duration(): number {\r\n return this.privTranslationPhrase.Duration;\r\n }\r\n\r\n public get Text(): string {\r\n return this.privTranslationPhrase.Text;\r\n }\r\n\r\n public get Translation(): ITranslations {\r\n return this.privTranslationPhrase.Translation;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n IAudioSource,\r\n MessageType,\r\n TranslationStatus,\r\n} from \"../common/Exports\";\r\nimport {\r\n CancellationErrorCode,\r\n CancellationReason,\r\n PropertyCollection,\r\n PropertyId,\r\n ResultReason,\r\n SpeechRecognitionResult,\r\n TranslationRecognitionCanceledEventArgs,\r\n TranslationRecognitionEventArgs,\r\n TranslationRecognitionResult,\r\n TranslationRecognizer,\r\n Translations,\r\n TranslationSynthesisEventArgs,\r\n TranslationSynthesisResult,\r\n} from \"../sdk/Exports\";\r\nimport {\r\n CancellationErrorCodePropertyName,\r\n EnumTranslation,\r\n RecognitionStatus,\r\n ServiceRecognizerBase,\r\n SynthesisStatus,\r\n TranslationHypothesis,\r\n TranslationPhrase,\r\n TranslationSynthesisEnd,\r\n} from \"./Exports\";\r\nimport { IAuthentication } from \"./IAuthentication\";\r\nimport { IConnectionFactory } from \"./IConnectionFactory\";\r\nimport { RecognizerConfig } from \"./RecognizerConfig\";\r\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal\";\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class TranslationServiceRecognizer extends ServiceRecognizerBase {\r\n private privTranslationRecognizer: TranslationRecognizer;\r\n\r\n public constructor(\r\n authentication: IAuthentication,\r\n connectionFactory: IConnectionFactory,\r\n audioSource: IAudioSource,\r\n recognizerConfig: RecognizerConfig,\r\n translationRecognizer: TranslationRecognizer) {\r\n\r\n super(authentication, connectionFactory, audioSource, recognizerConfig, translationRecognizer);\r\n this.privTranslationRecognizer = translationRecognizer;\r\n\r\n }\r\n\r\n protected processTypeSpecificMessages(\r\n connectionMessage: SpeechConnectionMessage,\r\n successCallback?: (e: TranslationRecognitionResult) => void,\r\n errorCallBack?: (e: string) => void): void {\r\n\r\n const resultProps: PropertyCollection = new PropertyCollection();\r\n if (connectionMessage.messageType === MessageType.Text) {\r\n resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, connectionMessage.textBody);\r\n }\r\n\r\n switch (connectionMessage.path.toLowerCase()) {\r\n case \"translation.hypothesis\":\r\n\r\n const result: TranslationRecognitionEventArgs = this.fireEventForResult(TranslationHypothesis.fromJSON(connectionMessage.textBody), resultProps);\r\n this.privRequestSession.onHypothesis(this.privRequestSession.currentTurnAudioOffset + result.offset);\r\n\r\n if (!!this.privTranslationRecognizer.recognizing) {\r\n try {\r\n this.privTranslationRecognizer.recognizing(this.privTranslationRecognizer, result);\r\n /* tslint:disable:no-empty */\r\n } catch (error) {\r\n // Not going to let errors in the event handler\r\n // trip things up.\r\n }\r\n }\r\n\r\n break;\r\n case \"translation.phrase\":\r\n const translatedPhrase: TranslationPhrase = TranslationPhrase.fromJSON(connectionMessage.textBody);\r\n\r\n this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset + translatedPhrase.Offset + translatedPhrase.Duration);\r\n\r\n if (translatedPhrase.RecognitionStatus === RecognitionStatus.Success) {\r\n\r\n // OK, the recognition was successful. How'd the translation do?\r\n const result: TranslationRecognitionEventArgs = this.fireEventForResult(translatedPhrase, resultProps);\r\n if (!!this.privTranslationRecognizer.recognized) {\r\n try {\r\n this.privTranslationRecognizer.recognized(this.privTranslationRecognizer, result);\r\n /* tslint:disable:no-empty */\r\n } catch (error) {\r\n // Not going to let errors in the event handler\r\n // trip things up.\r\n }\r\n }\r\n\r\n // report result to promise.\r\n if (!!successCallback) {\r\n try {\r\n successCallback(result.result);\r\n } catch (e) {\r\n if (!!errorCallBack) {\r\n errorCallBack(e);\r\n }\r\n }\r\n // Only invoke the call back once.\r\n // and if it's successful don't invoke the\r\n // error after that.\r\n successCallback = undefined;\r\n errorCallBack = undefined;\r\n }\r\n\r\n break;\r\n } else {\r\n const reason: ResultReason = EnumTranslation.implTranslateRecognitionResult(translatedPhrase.RecognitionStatus);\r\n\r\n const result = new TranslationRecognitionResult(\r\n undefined,\r\n this.privRequestSession.requestId,\r\n reason,\r\n translatedPhrase.Text,\r\n translatedPhrase.Duration,\r\n this.privRequestSession.currentTurnAudioOffset + translatedPhrase.Offset,\r\n undefined,\r\n connectionMessage.textBody,\r\n resultProps);\r\n\r\n if (reason === ResultReason.Canceled) {\r\n const cancelReason: CancellationReason = EnumTranslation.implTranslateCancelResult(translatedPhrase.RecognitionStatus);\r\n\r\n this.cancelRecognitionLocal(\r\n cancelReason,\r\n EnumTranslation.implTranslateCancelErrorCode(translatedPhrase.RecognitionStatus),\r\n undefined,\r\n successCallback);\r\n } else {\r\n if (!(this.privRequestSession.isSpeechEnded && reason === ResultReason.NoMatch && translatedPhrase.RecognitionStatus !== RecognitionStatus.InitialSilenceTimeout)) {\r\n const ev = new TranslationRecognitionEventArgs(result, result.offset, this.privRequestSession.sessionId);\r\n\r\n if (!!this.privTranslationRecognizer.recognized) {\r\n try {\r\n this.privTranslationRecognizer.recognized(this.privTranslationRecognizer, ev);\r\n /* tslint:disable:no-empty */\r\n } catch (error) {\r\n // Not going to let errors in the event handler\r\n // trip things up.\r\n }\r\n }\r\n }\r\n\r\n // report result to promise.\r\n if (!!successCallback) {\r\n try {\r\n successCallback(result);\r\n } catch (e) {\r\n if (!!errorCallBack) {\r\n errorCallBack(e);\r\n }\r\n }\r\n // Only invoke the call back once.\r\n // and if it's successful don't invoke the\r\n // error after that.\r\n successCallback = undefined;\r\n errorCallBack = undefined;\r\n }\r\n }\r\n }\r\n break;\r\n\r\n case \"translation.synthesis\":\r\n this.sendSynthesisAudio(connectionMessage.binaryBody, this.privRequestSession.sessionId);\r\n break;\r\n\r\n case \"translation.synthesis.end\":\r\n const synthEnd: TranslationSynthesisEnd = TranslationSynthesisEnd.fromJSON(connectionMessage.textBody);\r\n\r\n switch (synthEnd.SynthesisStatus) {\r\n case SynthesisStatus.Error:\r\n if (!!this.privTranslationRecognizer.synthesizing) {\r\n const result = new TranslationSynthesisResult(ResultReason.Canceled, undefined);\r\n const retEvent: TranslationSynthesisEventArgs = new TranslationSynthesisEventArgs(result, this.privRequestSession.sessionId);\r\n\r\n try {\r\n this.privTranslationRecognizer.synthesizing(this.privTranslationRecognizer, retEvent);\r\n /* tslint:disable:no-empty */\r\n } catch (error) {\r\n // Not going to let errors in the event handler\r\n // trip things up.\r\n }\r\n }\r\n\r\n if (!!this.privTranslationRecognizer.canceled) {\r\n // And raise a canceled event to send the rich(er) error message back.\r\n const canceledResult: TranslationRecognitionCanceledEventArgs = new TranslationRecognitionCanceledEventArgs(\r\n this.privRequestSession.sessionId,\r\n CancellationReason.Error,\r\n synthEnd.FailureReason,\r\n CancellationErrorCode.ServiceError,\r\n null);\r\n\r\n try {\r\n this.privTranslationRecognizer.canceled(this.privTranslationRecognizer, canceledResult);\r\n /* tslint:disable:no-empty */\r\n } catch (error) {\r\n // Not going to let errors in the event handler\r\n // trip things up.\r\n }\r\n }\r\n break;\r\n case SynthesisStatus.Success:\r\n this.sendSynthesisAudio(undefined, this.privRequestSession.sessionId);\r\n break;\r\n default:\r\n break;\r\n }\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n\r\n // Cancels recognition.\r\n protected cancelRecognition(\r\n sessionId: string,\r\n requestId: string,\r\n cancellationReason: CancellationReason,\r\n errorCode: CancellationErrorCode,\r\n error: string,\r\n cancelRecoCallback: (e: SpeechRecognitionResult) => void): void {\r\n\r\n const properties: PropertyCollection = new PropertyCollection();\r\n properties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[errorCode]);\r\n\r\n if (!!this.privTranslationRecognizer.canceled) {\r\n\r\n const cancelEvent: TranslationRecognitionCanceledEventArgs = new TranslationRecognitionCanceledEventArgs(\r\n sessionId,\r\n cancellationReason,\r\n error,\r\n errorCode,\r\n undefined);\r\n\r\n try {\r\n this.privTranslationRecognizer.canceled(this.privTranslationRecognizer, cancelEvent);\r\n /* tslint:disable:no-empty */\r\n } catch { }\r\n }\r\n\r\n if (!!cancelRecoCallback) {\r\n const result: TranslationRecognitionResult = new TranslationRecognitionResult(\r\n undefined, // Translations\r\n requestId,\r\n ResultReason.Canceled,\r\n undefined, // Text\r\n undefined, // Druation\r\n undefined, // Offset\r\n error,\r\n undefined, // Json\r\n properties);\r\n try {\r\n cancelRecoCallback(result);\r\n /* tslint:disable:no-empty */\r\n } catch { }\r\n }\r\n }\r\n\r\n private fireEventForResult(serviceResult: TranslationHypothesis | TranslationPhrase, properties: PropertyCollection): TranslationRecognitionEventArgs {\r\n let translations: Translations;\r\n\r\n if (undefined !== serviceResult.Translation.Translations) {\r\n translations = new Translations();\r\n for (const translation of serviceResult.Translation.Translations) {\r\n translations.set(translation.Language, translation.Text);\r\n }\r\n }\r\n\r\n let resultReason: ResultReason;\r\n if (serviceResult instanceof TranslationPhrase) {\r\n if (serviceResult.Translation.TranslationStatus === TranslationStatus.Success) {\r\n resultReason = ResultReason.TranslatedSpeech;\r\n } else {\r\n resultReason = ResultReason.RecognizedSpeech;\r\n }\r\n } else {\r\n resultReason = ResultReason.TranslatingSpeech;\r\n }\r\n\r\n const offset: number = serviceResult.Offset + this.privRequestSession.currentTurnAudioOffset;\r\n\r\n const result = new TranslationRecognitionResult(\r\n translations,\r\n this.privRequestSession.requestId,\r\n resultReason,\r\n serviceResult.Text,\r\n serviceResult.Duration,\r\n offset,\r\n serviceResult.Translation.FailureReason,\r\n JSON.stringify(serviceResult),\r\n properties);\r\n\r\n const ev = new TranslationRecognitionEventArgs(result, offset, this.privRequestSession.sessionId);\r\n return ev;\r\n }\r\n\r\n private sendSynthesisAudio(audio: ArrayBuffer, sessionId: string): void {\r\n const reason = (undefined === audio) ? ResultReason.SynthesizingAudioCompleted : ResultReason.SynthesizingAudio;\r\n const result = new TranslationSynthesisResult(reason, audio);\r\n const retEvent: TranslationSynthesisEventArgs = new TranslationSynthesisEventArgs(result, sessionId);\r\n\r\n if (!!this.privTranslationRecognizer.synthesizing) {\r\n try {\r\n this.privTranslationRecognizer.synthesizing(this.privTranslationRecognizer, retEvent);\r\n /* tslint:disable:no-empty */\r\n } catch (error) {\r\n // Not going to let errors in the event handler\r\n // trip things up.\r\n }\r\n }\r\n\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n// speech.endDetected\r\nexport interface ISpeechDetected {\r\n Offset: number;\r\n}\r\n\r\nexport class SpeechDetected implements ISpeechDetected {\r\n private privSpeechStartDetected: ISpeechDetected;\r\n\r\n private constructor(json: string) {\r\n this.privSpeechStartDetected = JSON.parse(json);\r\n }\r\n\r\n public static fromJSON(json: string): SpeechDetected {\r\n return new SpeechDetected(json);\r\n }\r\n\r\n public get Offset(): number {\r\n return this.privSpeechStartDetected.Offset;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n// speech.hypothesis\r\nexport interface ISpeechHypothesis {\r\n Text: string;\r\n Offset: number;\r\n Duration: number;\r\n}\r\n\r\nexport class SpeechHypothesis implements ISpeechHypothesis {\r\n private privSpeechHypothesis: ISpeechHypothesis;\r\n\r\n private constructor(json: string) {\r\n this.privSpeechHypothesis = JSON.parse(json);\r\n }\r\n\r\n public static fromJSON(json: string): SpeechHypothesis {\r\n return new SpeechHypothesis(json);\r\n }\r\n\r\n public get Text(): string {\r\n return this.privSpeechHypothesis.Text;\r\n }\r\n\r\n public get Offset(): number {\r\n return this.privSpeechHypothesis.Offset;\r\n }\r\n\r\n public get Duration(): number {\r\n return this.privSpeechHypothesis.Duration;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { IAudioSource } from \"../common/Exports\";\r\nimport {\r\n CancellationErrorCode,\r\n CancellationReason,\r\n OutputFormat,\r\n PropertyCollection,\r\n PropertyId,\r\n ResultReason,\r\n SpeechRecognitionCanceledEventArgs,\r\n SpeechRecognitionEventArgs,\r\n SpeechRecognitionResult,\r\n SpeechRecognizer,\r\n} from \"../sdk/Exports\";\r\nimport {\r\n CancellationErrorCodePropertyName,\r\n DetailedSpeechPhrase,\r\n EnumTranslation,\r\n OutputFormatPropertyName,\r\n RecognitionStatus,\r\n RequestSession,\r\n ServiceRecognizerBase,\r\n SimpleSpeechPhrase,\r\n SpeechHypothesis,\r\n} from \"./Exports\";\r\nimport { IAuthentication } from \"./IAuthentication\";\r\nimport { IConnectionFactory } from \"./IConnectionFactory\";\r\nimport { RecognizerConfig } from \"./RecognizerConfig\";\r\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal\";\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class SpeechServiceRecognizer extends ServiceRecognizerBase {\r\n\r\n private privSpeechRecognizer: SpeechRecognizer;\r\n\r\n public constructor(\r\n authentication: IAuthentication,\r\n connectionFactory: IConnectionFactory,\r\n audioSource: IAudioSource,\r\n recognizerConfig: RecognizerConfig,\r\n speechRecognizer: SpeechRecognizer) {\r\n super(authentication, connectionFactory, audioSource, recognizerConfig, speechRecognizer);\r\n this.privSpeechRecognizer = speechRecognizer;\r\n }\r\n\r\n protected processTypeSpecificMessages(\r\n connectionMessage: SpeechConnectionMessage,\r\n successCallback?: (e: SpeechRecognitionResult) => void,\r\n errorCallBack?: (e: string) => void): void {\r\n\r\n let result: SpeechRecognitionResult;\r\n const resultProps: PropertyCollection = new PropertyCollection();\r\n resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, connectionMessage.textBody);\r\n\r\n switch (connectionMessage.path.toLowerCase()) {\r\n case \"speech.hypothesis\":\r\n case \"speech.fragment\":\r\n const hypothesis: SpeechHypothesis = SpeechHypothesis.fromJSON(connectionMessage.textBody);\r\n const offset: number = hypothesis.Offset + this.privRequestSession.currentTurnAudioOffset;\r\n\r\n result = new SpeechRecognitionResult(\r\n this.privRequestSession.requestId,\r\n ResultReason.RecognizingSpeech,\r\n hypothesis.Text,\r\n hypothesis.Duration,\r\n offset,\r\n undefined,\r\n connectionMessage.textBody,\r\n resultProps);\r\n\r\n this.privRequestSession.onHypothesis(offset);\r\n\r\n const ev = new SpeechRecognitionEventArgs(result, hypothesis.Duration, this.privRequestSession.sessionId);\r\n\r\n if (!!this.privSpeechRecognizer.recognizing) {\r\n try {\r\n this.privSpeechRecognizer.recognizing(this.privSpeechRecognizer, ev);\r\n /* tslint:disable:no-empty */\r\n } catch (error) {\r\n // Not going to let errors in the event handler\r\n // trip things up.\r\n }\r\n }\r\n break;\r\n case \"speech.phrase\":\r\n const simple: SimpleSpeechPhrase = SimpleSpeechPhrase.fromJSON(connectionMessage.textBody);\r\n const resultReason: ResultReason = EnumTranslation.implTranslateRecognitionResult(simple.RecognitionStatus);\r\n\r\n this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset + simple.Offset + simple.Duration);\r\n\r\n if (ResultReason.Canceled === resultReason) {\r\n const cancelReason: CancellationReason = EnumTranslation.implTranslateCancelResult(simple.RecognitionStatus);\r\n\r\n this.cancelRecognitionLocal(\r\n cancelReason,\r\n EnumTranslation.implTranslateCancelErrorCode(simple.RecognitionStatus),\r\n undefined,\r\n successCallback);\r\n\r\n } else {\r\n if (!(this.privRequestSession.isSpeechEnded && resultReason === ResultReason.NoMatch && simple.RecognitionStatus !== RecognitionStatus.InitialSilenceTimeout)) {\r\n if (this.privRecognizerConfig.parameters.getProperty(OutputFormatPropertyName) === OutputFormat[OutputFormat.Simple]) {\r\n result = new SpeechRecognitionResult(\r\n this.privRequestSession.requestId,\r\n resultReason,\r\n simple.DisplayText,\r\n simple.Duration,\r\n simple.Offset + this.privRequestSession.currentTurnAudioOffset,\r\n undefined,\r\n connectionMessage.textBody,\r\n resultProps);\r\n } else {\r\n const detailed: DetailedSpeechPhrase = DetailedSpeechPhrase.fromJSON(connectionMessage.textBody);\r\n\r\n result = new SpeechRecognitionResult(\r\n this.privRequestSession.requestId,\r\n resultReason,\r\n detailed.RecognitionStatus === RecognitionStatus.Success ? detailed.NBest[0].Display : undefined,\r\n detailed.Duration,\r\n detailed.Offset + this.privRequestSession.currentTurnAudioOffset,\r\n undefined,\r\n connectionMessage.textBody,\r\n resultProps);\r\n }\r\n\r\n const event: SpeechRecognitionEventArgs = new SpeechRecognitionEventArgs(result, result.offset, this.privRequestSession.sessionId);\r\n\r\n if (!!this.privSpeechRecognizer.recognized) {\r\n try {\r\n this.privSpeechRecognizer.recognized(this.privSpeechRecognizer, event);\r\n /* tslint:disable:no-empty */\r\n } catch (error) {\r\n // Not going to let errors in the event handler\r\n // trip things up.\r\n }\r\n }\r\n }\r\n // report result to promise.\r\n if (!!successCallback) {\r\n try {\r\n successCallback(result);\r\n } catch (e) {\r\n if (!!errorCallBack) {\r\n errorCallBack(e);\r\n }\r\n }\r\n // Only invoke the call back once.\r\n // and if it's successful don't invoke the\r\n // error after that.\r\n successCallback = undefined;\r\n errorCallBack = undefined;\r\n }\r\n }\r\n\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n\r\n // Cancels recognition.\r\n protected cancelRecognition(\r\n sessionId: string,\r\n requestId: string,\r\n cancellationReason: CancellationReason,\r\n errorCode: CancellationErrorCode,\r\n error: string,\r\n cancelRecoCallback: (e: SpeechRecognitionResult) => void): void {\r\n\r\n const properties: PropertyCollection = new PropertyCollection();\r\n properties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[errorCode]);\r\n\r\n if (!!this.privSpeechRecognizer.canceled) {\r\n const cancelEvent: SpeechRecognitionCanceledEventArgs = new SpeechRecognitionCanceledEventArgs(\r\n cancellationReason,\r\n error,\r\n errorCode,\r\n undefined,\r\n sessionId);\r\n try {\r\n this.privSpeechRecognizer.canceled(this.privSpeechRecognizer, cancelEvent);\r\n /* tslint:disable:no-empty */\r\n } catch { }\r\n }\r\n\r\n if (!!cancelRecoCallback) {\r\n const result: SpeechRecognitionResult = new SpeechRecognitionResult(\r\n requestId,\r\n ResultReason.Canceled,\r\n undefined, // Text\r\n undefined, // Druation\r\n undefined, // Offset\r\n error,\r\n undefined, // Json\r\n properties);\r\n try {\r\n cancelRecoCallback(result);\r\n /* tslint:disable:no-empty */\r\n } catch { }\r\n }\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { RecognitionStatus } from \"../Exports\";\r\n\r\n// speech.phrase for detailed\r\nexport interface IDetailedSpeechPhrase {\r\n RecognitionStatus: RecognitionStatus;\r\n NBest: IPhrase[];\r\n Duration?: number;\r\n Offset?: number;\r\n}\r\n\r\nexport interface IPhrase {\r\n Confidence?: number;\r\n Lexical: string;\r\n ITN: string;\r\n MaskedITN: string;\r\n Display: string;\r\n}\r\n\r\nexport class DetailedSpeechPhrase implements IDetailedSpeechPhrase {\r\n private privDetailedSpeechPhrase: IDetailedSpeechPhrase;\r\n\r\n private constructor(json: string) {\r\n this.privDetailedSpeechPhrase = JSON.parse(json);\r\n this.privDetailedSpeechPhrase.RecognitionStatus = (RecognitionStatus as any)[this.privDetailedSpeechPhrase.RecognitionStatus];\r\n }\r\n\r\n public static fromJSON(json: string): DetailedSpeechPhrase {\r\n return new DetailedSpeechPhrase(json);\r\n }\r\n\r\n public get RecognitionStatus(): RecognitionStatus {\r\n return this.privDetailedSpeechPhrase.RecognitionStatus;\r\n }\r\n public get NBest(): IPhrase[] {\r\n return this.privDetailedSpeechPhrase.NBest;\r\n }\r\n public get Duration(): number {\r\n return this.privDetailedSpeechPhrase.Duration;\r\n }\r\n public get Offset(): number {\r\n return this.privDetailedSpeechPhrase.Offset;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { RecognitionStatus } from \"../Exports\";\r\n\r\n// speech.phrase\r\nexport interface ISimpleSpeechPhrase {\r\n RecognitionStatus: RecognitionStatus;\r\n DisplayText: string;\r\n Offset?: number;\r\n Duration?: number;\r\n}\r\n\r\nexport class SimpleSpeechPhrase implements ISimpleSpeechPhrase {\r\n private privSimpleSpeechPhrase: ISimpleSpeechPhrase;\r\n\r\n private constructor(json: string) {\r\n this.privSimpleSpeechPhrase = JSON.parse(json);\r\n this.privSimpleSpeechPhrase.RecognitionStatus = (RecognitionStatus as any)[this.privSimpleSpeechPhrase.RecognitionStatus];\r\n }\r\n\r\n public static fromJSON(json: string): SimpleSpeechPhrase {\r\n return new SimpleSpeechPhrase(json);\r\n }\r\n\r\n public get RecognitionStatus(): RecognitionStatus {\r\n return this.privSimpleSpeechPhrase.RecognitionStatus;\r\n }\r\n\r\n public get DisplayText(): string {\r\n return this.privSimpleSpeechPhrase.DisplayText;\r\n }\r\n\r\n public get Offset(): number {\r\n return this.privSimpleSpeechPhrase.Offset;\r\n }\r\n\r\n public get Duration(): number {\r\n return this.privSimpleSpeechPhrase.Duration;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { LanguageUnderstandingModelImpl } from \"../sdk/LanguageUnderstandingModel\";\r\n\r\n/**\r\n * @class AddedLmIntent\r\n */\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class AddedLmIntent {\r\n public modelImpl: LanguageUnderstandingModelImpl;\r\n public intentName: string;\r\n\r\n /**\r\n * Creates and initializes an instance of this class.\r\n * @constructor\r\n * @param modelImpl - The model.\r\n * @param intentName - The intent name.\r\n */\r\n public constructor(modelImpl: LanguageUnderstandingModelImpl, intentName: string) {\r\n this.modelImpl = modelImpl;\r\n this.intentName = intentName;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n IAudioSource,\r\n MessageType,\r\n} from \"../common/Exports\";\r\nimport {\r\n CancellationErrorCode,\r\n CancellationReason,\r\n IntentRecognitionCanceledEventArgs,\r\n IntentRecognitionEventArgs,\r\n IntentRecognitionResult,\r\n IntentRecognizer,\r\n PropertyCollection,\r\n PropertyId,\r\n ResultReason,\r\n SpeechRecognitionResult,\r\n} from \"../sdk/Exports\";\r\nimport {\r\n AddedLmIntent,\r\n CancellationErrorCodePropertyName,\r\n EnumTranslation,\r\n IntentResponse,\r\n ServiceRecognizerBase,\r\n SimpleSpeechPhrase,\r\n SpeechHypothesis,\r\n} from \"./Exports\";\r\nimport { IAuthentication } from \"./IAuthentication\";\r\nimport { IConnectionFactory } from \"./IConnectionFactory\";\r\nimport { RecognizerConfig } from \"./RecognizerConfig\";\r\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal\";\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class IntentServiceRecognizer extends ServiceRecognizerBase {\r\n private privIntentRecognizer: IntentRecognizer;\r\n private privAddedLmIntents: { [id: string]: AddedLmIntent; };\r\n private privIntentDataSent: boolean;\r\n private privUmbrellaIntent: AddedLmIntent;\r\n private privPendingIntentArgs: IntentRecognitionEventArgs;\r\n\r\n public constructor(\r\n authentication: IAuthentication,\r\n connectionFactory: IConnectionFactory,\r\n audioSource: IAudioSource,\r\n recognizerConfig: RecognizerConfig,\r\n recognizer: IntentRecognizer) {\r\n super(authentication, connectionFactory, audioSource, recognizerConfig, recognizer);\r\n this.privIntentRecognizer = recognizer;\r\n this.privIntentDataSent = false;\r\n }\r\n\r\n public setIntents(addedIntents: { [id: string]: AddedLmIntent; }, umbrellaIntent: AddedLmIntent): void {\r\n this.privAddedLmIntents = addedIntents;\r\n this.privUmbrellaIntent = umbrellaIntent;\r\n this.privIntentDataSent = true;\r\n }\r\n\r\n protected processTypeSpecificMessages(\r\n connectionMessage: SpeechConnectionMessage,\r\n successCallback?: (e: IntentRecognitionResult) => void,\r\n errorCallBack?: (e: string) => void): void {\r\n\r\n let result: IntentRecognitionResult;\r\n let ev: IntentRecognitionEventArgs;\r\n\r\n const resultProps: PropertyCollection = new PropertyCollection();\r\n if (connectionMessage.messageType === MessageType.Text) {\r\n resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, connectionMessage.textBody);\r\n }\r\n\r\n switch (connectionMessage.path.toLowerCase()) {\r\n case \"speech.hypothesis\":\r\n const speechHypothesis: SpeechHypothesis = SpeechHypothesis.fromJSON(connectionMessage.textBody);\r\n\r\n result = new IntentRecognitionResult(\r\n undefined,\r\n this.privRequestSession.requestId,\r\n ResultReason.RecognizingIntent,\r\n speechHypothesis.Text,\r\n speechHypothesis.Duration,\r\n speechHypothesis.Offset + this.privRequestSession.currentTurnAudioOffset,\r\n undefined,\r\n connectionMessage.textBody,\r\n resultProps);\r\n\r\n this.privRequestSession.onHypothesis(result.offset);\r\n\r\n ev = new IntentRecognitionEventArgs(result, speechHypothesis.Offset + this.privRequestSession.currentTurnAudioOffset, this.privRequestSession.sessionId);\r\n\r\n if (!!this.privIntentRecognizer.recognizing) {\r\n try {\r\n this.privIntentRecognizer.recognizing(this.privIntentRecognizer, ev);\r\n /* tslint:disable:no-empty */\r\n } catch (error) {\r\n // Not going to let errors in the event handler\r\n // trip things up.\r\n }\r\n }\r\n\r\n break;\r\n case \"speech.phrase\":\r\n const simple: SimpleSpeechPhrase = SimpleSpeechPhrase.fromJSON(connectionMessage.textBody);\r\n result = new IntentRecognitionResult(\r\n undefined,\r\n this.privRequestSession.requestId,\r\n EnumTranslation.implTranslateRecognitionResult(simple.RecognitionStatus),\r\n simple.DisplayText,\r\n simple.Duration,\r\n simple.Offset + this.privRequestSession.currentTurnAudioOffset,\r\n undefined,\r\n connectionMessage.textBody,\r\n resultProps);\r\n\r\n ev = new IntentRecognitionEventArgs(result, result.offset, this.privRequestSession.sessionId);\r\n\r\n const sendEvent: () => void = () => {\r\n if (!!this.privIntentRecognizer.recognized) {\r\n try {\r\n this.privIntentRecognizer.recognized(this.privIntentRecognizer, ev);\r\n /* tslint:disable:no-empty */\r\n } catch (error) {\r\n // Not going to let errors in the event handler\r\n // trip things up.\r\n }\r\n }\r\n\r\n // report result to promise.\r\n if (!!successCallback) {\r\n try {\r\n successCallback(result);\r\n } catch (e) {\r\n if (!!errorCallBack) {\r\n errorCallBack(e);\r\n }\r\n }\r\n // Only invoke the call back once.\r\n // and if it's successful don't invoke the\r\n // error after that.\r\n successCallback = undefined;\r\n errorCallBack = undefined;\r\n }\r\n };\r\n\r\n // If intent data was sent, the terminal result for this recognizer is an intent being found.\r\n // If no intent data was sent, the terminal event is speech recognition being successful.\r\n if (false === this.privIntentDataSent || ResultReason.NoMatch === ev.result.reason) {\r\n // Advance the buffers.\r\n this.privRequestSession.onPhraseRecognized(ev.offset + ev.result.duration);\r\n sendEvent();\r\n } else {\r\n // Squirrel away the args, when the response event arrives it will build upon them\r\n // and then return\r\n this.privPendingIntentArgs = ev;\r\n }\r\n\r\n break;\r\n case \"response\":\r\n // Response from LUIS\r\n ev = this.privPendingIntentArgs;\r\n this.privPendingIntentArgs = undefined;\r\n\r\n if (undefined === ev) {\r\n if (\"\" === connectionMessage.textBody) {\r\n // This condition happens if there is nothing but silence in the\r\n // audio sent to the service.\r\n return;\r\n }\r\n\r\n // Odd... Not sure this can happen\r\n ev = new IntentRecognitionEventArgs(new IntentRecognitionResult(), 0 /*TODO*/, this.privRequestSession.sessionId);\r\n }\r\n\r\n const intentResponse: IntentResponse = IntentResponse.fromJSON(connectionMessage.textBody);\r\n\r\n // If LUIS didn't return anything, send the existing event, else\r\n // modify it to show the match.\r\n // See if the intent found is in the list of intents asked for.\r\n let addedIntent: AddedLmIntent = this.privAddedLmIntents[intentResponse.topScoringIntent.intent];\r\n\r\n if (this.privUmbrellaIntent !== undefined) {\r\n addedIntent = this.privUmbrellaIntent;\r\n }\r\n\r\n if (null !== intentResponse && addedIntent !== undefined) {\r\n const intentId = addedIntent.intentName === undefined ? intentResponse.topScoringIntent.intent : addedIntent.intentName;\r\n let reason = ev.result.reason;\r\n\r\n if (undefined !== intentId) {\r\n reason = ResultReason.RecognizedIntent;\r\n }\r\n\r\n // make sure, properties is set.\r\n const properties = (undefined !== ev.result.properties) ?\r\n ev.result.properties : new PropertyCollection();\r\n\r\n properties.setProperty(PropertyId.LanguageUnderstandingServiceResponse_JsonResult, connectionMessage.textBody);\r\n\r\n ev = new IntentRecognitionEventArgs(\r\n new IntentRecognitionResult(\r\n intentId,\r\n ev.result.resultId,\r\n reason,\r\n ev.result.text,\r\n ev.result.duration,\r\n ev.result.offset,\r\n ev.result.errorDetails,\r\n ev.result.json,\r\n properties),\r\n ev.offset,\r\n ev.sessionId);\r\n }\r\n this.privRequestSession.onPhraseRecognized(ev.offset + ev.result.duration);\r\n\r\n if (!!this.privIntentRecognizer.recognized) {\r\n try {\r\n this.privIntentRecognizer.recognized(this.privIntentRecognizer, ev);\r\n /* tslint:disable:no-empty */\r\n } catch (error) {\r\n // Not going to let errors in the event handler\r\n // trip things up.\r\n }\r\n }\r\n\r\n // report result to promise.\r\n if (!!successCallback) {\r\n try {\r\n successCallback(ev.result);\r\n } catch (e) {\r\n if (!!errorCallBack) {\r\n errorCallBack(e);\r\n }\r\n }\r\n // Only invoke the call back once.\r\n // and if it's successful don't invoke the\r\n // error after that.\r\n successCallback = undefined;\r\n errorCallBack = undefined;\r\n }\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n\r\n // Cancels recognition.\r\n protected cancelRecognition(\r\n sessionId: string,\r\n requestId: string,\r\n cancellationReason: CancellationReason,\r\n errorCode: CancellationErrorCode,\r\n error: string,\r\n cancelRecoCallback: (e: SpeechRecognitionResult) => void): void {\r\n\r\n const properties: PropertyCollection = new PropertyCollection();\r\n properties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[errorCode]);\r\n\r\n if (!!this.privIntentRecognizer.canceled) {\r\n\r\n const cancelEvent: IntentRecognitionCanceledEventArgs = new IntentRecognitionCanceledEventArgs(\r\n cancellationReason,\r\n error,\r\n errorCode,\r\n undefined,\r\n undefined,\r\n sessionId);\r\n try {\r\n this.privIntentRecognizer.canceled(this.privIntentRecognizer, cancelEvent);\r\n /* tslint:disable:no-empty */\r\n } catch { }\r\n }\r\n\r\n if (!!cancelRecoCallback) {\r\n const result: IntentRecognitionResult = new IntentRecognitionResult(\r\n undefined, // Intent Id\r\n requestId,\r\n ResultReason.Canceled,\r\n undefined, // Text\r\n undefined, // Druation\r\n undefined, // Offset\r\n error,\r\n undefined, // Json\r\n properties);\r\n try {\r\n cancelRecoCallback(result);\r\n /* tslint:disable:no-empty */\r\n } catch { }\r\n }\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// response\r\n\r\nexport interface IIntentResponse {\r\n query: string;\r\n topScoringIntent: ISingleIntent;\r\n entities: IIntentEntity[];\r\n}\r\n\r\nexport interface IIntentEntity {\r\n entity: string;\r\n type: string;\r\n startIndex: number;\r\n endIndex: number;\r\n score: number;\r\n}\r\n\r\nexport interface ISingleIntent {\r\n intent: string;\r\n score: number;\r\n}\r\n\r\nexport class IntentResponse implements IIntentResponse {\r\n private privIntentResponse: IIntentResponse;\r\n\r\n private constructor(json: string) {\r\n this.privIntentResponse = JSON.parse(json);\r\n }\r\n\r\n public static fromJSON(json: string): IntentResponse {\r\n return new IntentResponse(json);\r\n }\r\n\r\n public get query(): string {\r\n return this.privIntentResponse.query;\r\n }\r\n\r\n public get topScoringIntent(): ISingleIntent {\r\n return this.privIntentResponse.topScoringIntent;\r\n }\r\n\r\n public get entities(): IIntentEntity[] {\r\n return this.privIntentResponse.entities;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ReplayableAudioNode } from \"../common.browser/Exports\";\r\nimport {\r\n createNoDashGuid,\r\n Deferred,\r\n Events,\r\n IDetachable,\r\n IEventSource,\r\n PlatformEvent,\r\n Promise,\r\n} from \"../common/Exports\";\r\nimport {\r\n ConnectingToServiceEvent,\r\n ListeningStartedEvent,\r\n RecognitionStartedEvent,\r\n RecognitionTriggeredEvent,\r\n SpeechRecognitionEvent,\r\n} from \"./RecognitionEvents\";\r\nimport { ServiceTelemetryListener } from \"./ServiceTelemetryListener.Internal\";\r\n\r\nexport class RequestSession {\r\n private privIsDisposed: boolean = false;\r\n private privServiceTelemetryListener: ServiceTelemetryListener;\r\n private privDetachables: IDetachable[] = new Array();\r\n private privRequestId: string;\r\n private privAudioSourceId: string;\r\n private privAudioNodeId: string;\r\n private privAudioNode: ReplayableAudioNode;\r\n private privAuthFetchEventId: string;\r\n private privIsAudioNodeDetached: boolean = false;\r\n private privIsRecognizing: boolean = false;\r\n private privRequestCompletionDeferral: Deferred;\r\n private privIsSpeechEnded: boolean = false;\r\n private privTurnStartAudioOffset: number = 0;\r\n private privLastRecoOffset: number = 0;\r\n private privHypothesisReceived: boolean = false;\r\n private privBytesSent: number = 0;\r\n private privRecogNumber: number = 0;\r\n private privSessionId: string;\r\n\r\n constructor(audioSourceId: string) {\r\n this.privAudioSourceId = audioSourceId;\r\n this.privRequestId = createNoDashGuid();\r\n this.privAudioNodeId = createNoDashGuid();\r\n this.privRequestCompletionDeferral = new Deferred();\r\n }\r\n\r\n public get sessionId(): string {\r\n return this.privSessionId;\r\n }\r\n\r\n public get requestId(): string {\r\n return this.privRequestId;\r\n }\r\n\r\n public get audioNodeId(): string {\r\n return this.privAudioNodeId;\r\n }\r\n\r\n public get completionPromise(): Promise {\r\n return this.privRequestCompletionDeferral.promise();\r\n }\r\n\r\n public get isSpeechEnded(): boolean {\r\n return this.privIsSpeechEnded;\r\n }\r\n\r\n public get isRecognizing(): boolean {\r\n return this.privIsRecognizing;\r\n }\r\n\r\n public get currentTurnAudioOffset(): number {\r\n return this.privTurnStartAudioOffset;\r\n }\r\n\r\n public get recogNumber(): number {\r\n return this.privRecogNumber;\r\n }\r\n\r\n // The number of bytes sent for the current connection.\r\n // Counter is reset to 0 each time a connection is established.\r\n public get bytesSent(): number {\r\n return this.privBytesSent;\r\n }\r\n public listenForServiceTelemetry(eventSource: IEventSource): void {\r\n if (!!this.privServiceTelemetryListener) {\r\n this.privDetachables.push(eventSource.attachListener(this.privServiceTelemetryListener));\r\n }\r\n }\r\n\r\n public startNewRecognition(): void {\r\n this.privIsSpeechEnded = false;\r\n this.privIsRecognizing = true;\r\n this.privTurnStartAudioOffset = 0;\r\n this.privLastRecoOffset = 0;\r\n this.privRequestId = createNoDashGuid();\r\n this.privRecogNumber++;\r\n this.privServiceTelemetryListener = new ServiceTelemetryListener(this.privRequestId, this.privAudioSourceId, this.privAudioNodeId);\r\n this.onEvent(new RecognitionTriggeredEvent(this.requestId, this.privSessionId, this.privAudioSourceId, this.privAudioNodeId));\r\n }\r\n\r\n public onAudioSourceAttachCompleted = (audioNode: ReplayableAudioNode, isError: boolean, error?: string): void => {\r\n this.privAudioNode = audioNode;\r\n\r\n if (isError) {\r\n this.onComplete();\r\n } else {\r\n this.onEvent(new ListeningStartedEvent(this.privRequestId, this.privSessionId, this.privAudioSourceId, this.privAudioNodeId));\r\n }\r\n }\r\n\r\n public onPreConnectionStart = (authFetchEventId: string, connectionId: string): void => {\r\n this.privAuthFetchEventId = authFetchEventId;\r\n this.privSessionId = connectionId;\r\n this.onEvent(new ConnectingToServiceEvent(this.privRequestId, this.privAuthFetchEventId, this.privSessionId));\r\n }\r\n\r\n public onAuthCompleted = (isError: boolean, error?: string): void => {\r\n if (isError) {\r\n this.onComplete();\r\n }\r\n }\r\n\r\n public onConnectionEstablishCompleted = (statusCode: number, reason?: string): void => {\r\n if (statusCode === 200) {\r\n this.onEvent(new RecognitionStartedEvent(this.requestId, this.privAudioSourceId, this.privAudioNodeId, this.privAuthFetchEventId, this.privSessionId));\r\n if (!!this.privAudioNode) {\r\n this.privAudioNode.replay();\r\n }\r\n this.privTurnStartAudioOffset = this.privLastRecoOffset;\r\n this.privBytesSent = 0;\r\n return;\r\n } else if (statusCode === 403) {\r\n this.onComplete();\r\n }\r\n }\r\n\r\n public onServiceTurnEndResponse = (continuousRecognition: boolean): void => {\r\n if (!continuousRecognition || this.isSpeechEnded) {\r\n this.onComplete();\r\n } else {\r\n // Start a new request set.\r\n this.privTurnStartAudioOffset = this.privLastRecoOffset;\r\n this.privRequestId = createNoDashGuid();\r\n this.privAudioNode.replay();\r\n }\r\n }\r\n\r\n public onHypothesis(offset: number): void {\r\n if (!this.privHypothesisReceived) {\r\n this.privHypothesisReceived = true;\r\n this.privServiceTelemetryListener.hypothesisReceived(this.privAudioNode.findTimeAtOffset(offset));\r\n }\r\n }\r\n\r\n public onPhraseRecognized(offset: number): void {\r\n this.privServiceTelemetryListener.phraseReceived(this.privAudioNode.findTimeAtOffset(offset));\r\n this.onServiceRecognized(offset);\r\n }\r\n\r\n public onServiceRecognized(offset: number): void {\r\n this.privLastRecoOffset = offset;\r\n this.privHypothesisReceived = false;\r\n this.privAudioNode.shrinkBuffers(offset);\r\n }\r\n\r\n public onAudioSent(bytesSent: number): void {\r\n this.privBytesSent += bytesSent;\r\n }\r\n\r\n public dispose = (error?: string): void => {\r\n if (!this.privIsDisposed) {\r\n // we should have completed by now. If we did not its an unknown error.\r\n this.privIsDisposed = true;\r\n for (const detachable of this.privDetachables) {\r\n detachable.detach();\r\n }\r\n\r\n this.privServiceTelemetryListener.dispose();\r\n }\r\n }\r\n\r\n public getTelemetry = (): string => {\r\n if (this.privServiceTelemetryListener.hasTelemetry) {\r\n return this.privServiceTelemetryListener.getTelemetry();\r\n } else {\r\n return null;\r\n }\r\n }\r\n\r\n public onStopRecognizing(): void {\r\n this.onComplete();\r\n }\r\n\r\n // Should be called with the audioNode for this session has indicated that it is out of speech.\r\n public onSpeechEnded(): void {\r\n this.privIsSpeechEnded = true;\r\n }\r\n\r\n protected onEvent = (event: SpeechRecognitionEvent): void => {\r\n if (!!this.privServiceTelemetryListener) {\r\n this.privServiceTelemetryListener.onEvent(event);\r\n }\r\n Events.instance.onEvent(event);\r\n }\r\n\r\n private onComplete = (): void => {\r\n if (!!this.privIsRecognizing) {\r\n this.privIsRecognizing = false;\r\n this.detachAudioNode();\r\n }\r\n }\r\n\r\n private detachAudioNode = (): void => {\r\n if (!this.privIsAudioNodeDetached) {\r\n this.privIsAudioNodeDetached = true;\r\n if (this.privAudioNode) {\r\n this.privAudioNode.detach();\r\n }\r\n }\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n AudioSourceErrorEvent,\r\n AudioStreamNodeAttachedEvent,\r\n AudioStreamNodeAttachingEvent,\r\n AudioStreamNodeDetachedEvent,\r\n AudioStreamNodeErrorEvent,\r\n ConnectionEstablishedEvent,\r\n ConnectionEstablishErrorEvent,\r\n ConnectionMessageReceivedEvent,\r\n ConnectionStartEvent,\r\n IEventListener,\r\n IStringDictionary,\r\n PlatformEvent,\r\n} from \"../common/Exports\";\r\nimport { ConnectingToServiceEvent, RecognitionTriggeredEvent } from \"./RecognitionEvents\";\r\n\r\nexport interface ITelemetry {\r\n Metrics: IMetric[];\r\n ReceivedMessages: IStringDictionary;\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport interface IMetric {\r\n End?: string;\r\n Error?: string;\r\n Id?: string;\r\n Name?: string;\r\n Start?: string;\r\n PhraseLatencyMs?: number[];\r\n FirstHypothesisLatencyMs?: number[];\r\n}\r\n\r\n// tslint:disable-next-line:max-classes-per-file\r\nexport class ServiceTelemetryListener implements IEventListener {\r\n private privIsDisposed: boolean = false;\r\n\r\n private privRequestId: string;\r\n private privAudioSourceId: string;\r\n private privAudioNodeId: string;\r\n\r\n private privListeningTriggerMetric: IMetric = null;\r\n private privMicMetric: IMetric = null;\r\n private privConnectionEstablishMetric: IMetric = null;\r\n\r\n private privMicStartTime: string;\r\n\r\n private privConnectionId: string;\r\n private privConnectionStartTime: string;\r\n\r\n private privReceivedMessages: IStringDictionary;\r\n private privPhraseLatencies: number[];\r\n private privHypothesisLatencies: number[];\r\n\r\n constructor(requestId: string, audioSourceId: string, audioNodeId: string) {\r\n this.privRequestId = requestId;\r\n this.privAudioSourceId = audioSourceId;\r\n this.privAudioNodeId = audioNodeId;\r\n\r\n this.privReceivedMessages = {};\r\n this.privPhraseLatencies = [];\r\n this.privHypothesisLatencies = [];\r\n }\r\n\r\n public phraseReceived(audioReceivedTime: number): void {\r\n if (audioReceivedTime > 0) { // 0 indicates the time is unknown. Drop it.\r\n this.privPhraseLatencies.push(Date.now() - audioReceivedTime);\r\n }\r\n }\r\n\r\n public hypothesisReceived(audioReceivedTime: number): void {\r\n if (audioReceivedTime > 0) { // 0 indicates the time is unknown. Drop it.\r\n this.privHypothesisLatencies.push(Date.now() - audioReceivedTime);\r\n }\r\n }\r\n\r\n public onEvent = (e: PlatformEvent): void => {\r\n if (this.privIsDisposed) {\r\n return;\r\n }\r\n\r\n if (e instanceof RecognitionTriggeredEvent && e.requestId === this.privRequestId) {\r\n this.privListeningTriggerMetric = {\r\n End: e.eventTime,\r\n Name: \"ListeningTrigger\",\r\n Start: e.eventTime,\r\n };\r\n }\r\n\r\n if (e instanceof AudioStreamNodeAttachingEvent && e.audioSourceId === this.privAudioSourceId && e.audioNodeId === this.privAudioNodeId) {\r\n this.privMicStartTime = e.eventTime;\r\n }\r\n\r\n if (e instanceof AudioStreamNodeAttachedEvent && e.audioSourceId === this.privAudioSourceId && e.audioNodeId === this.privAudioNodeId) {\r\n this.privMicStartTime = e.eventTime;\r\n }\r\n\r\n if (e instanceof AudioSourceErrorEvent && e.audioSourceId === this.privAudioSourceId) {\r\n if (!this.privMicMetric) {\r\n this.privMicMetric = {\r\n End: e.eventTime,\r\n Error: e.error,\r\n Name: \"Microphone\",\r\n Start: this.privMicStartTime,\r\n };\r\n }\r\n }\r\n\r\n if (e instanceof AudioStreamNodeErrorEvent && e.audioSourceId === this.privAudioSourceId && e.audioNodeId === this.privAudioNodeId) {\r\n if (!this.privMicMetric) {\r\n this.privMicMetric = {\r\n End: e.eventTime,\r\n Error: e.error,\r\n Name: \"Microphone\",\r\n Start: this.privMicStartTime,\r\n };\r\n }\r\n }\r\n\r\n if (e instanceof AudioStreamNodeDetachedEvent && e.audioSourceId === this.privAudioSourceId && e.audioNodeId === this.privAudioNodeId) {\r\n if (!this.privMicMetric) {\r\n this.privMicMetric = {\r\n End: e.eventTime,\r\n Name: \"Microphone\",\r\n Start: this.privMicStartTime,\r\n };\r\n }\r\n }\r\n\r\n if (e instanceof ConnectingToServiceEvent && e.requestId === this.privRequestId) {\r\n this.privConnectionId = e.sessionId;\r\n }\r\n\r\n if (e instanceof ConnectionStartEvent && e.connectionId === this.privConnectionId) {\r\n this.privConnectionStartTime = e.eventTime;\r\n }\r\n\r\n if (e instanceof ConnectionEstablishedEvent && e.connectionId === this.privConnectionId) {\r\n if (!this.privConnectionEstablishMetric) {\r\n this.privConnectionEstablishMetric = {\r\n End: e.eventTime,\r\n Id: this.privConnectionId,\r\n Name: \"Connection\",\r\n Start: this.privConnectionStartTime,\r\n };\r\n }\r\n }\r\n\r\n if (e instanceof ConnectionEstablishErrorEvent && e.connectionId === this.privConnectionId) {\r\n if (!this.privConnectionEstablishMetric) {\r\n this.privConnectionEstablishMetric = {\r\n End: e.eventTime,\r\n Error: this.getConnectionError(e.statusCode),\r\n Id: this.privConnectionId,\r\n Name: \"Connection\",\r\n Start: this.privConnectionStartTime,\r\n };\r\n }\r\n }\r\n\r\n if (e instanceof ConnectionMessageReceivedEvent && e.connectionId === this.privConnectionId) {\r\n if (e.message && e.message.headers && e.message.headers.path) {\r\n if (!this.privReceivedMessages[e.message.headers.path]) {\r\n this.privReceivedMessages[e.message.headers.path] = new Array();\r\n }\r\n\r\n this.privReceivedMessages[e.message.headers.path].push(e.networkReceivedTime);\r\n }\r\n }\r\n }\r\n\r\n public getTelemetry = (): string => {\r\n const metrics = new Array();\r\n\r\n if (this.privListeningTriggerMetric) {\r\n metrics.push(this.privListeningTriggerMetric);\r\n }\r\n\r\n if (this.privMicMetric) {\r\n metrics.push(this.privMicMetric);\r\n }\r\n\r\n if (this.privConnectionEstablishMetric) {\r\n metrics.push(this.privConnectionEstablishMetric);\r\n }\r\n\r\n if (this.privPhraseLatencies.length > 0) {\r\n metrics.push({\r\n PhraseLatencyMs: this.privPhraseLatencies,\r\n });\r\n }\r\n\r\n if (this.privHypothesisLatencies.length > 0) {\r\n metrics.push({\r\n FirstHypothesisLatencyMs: this.privHypothesisLatencies,\r\n });\r\n }\r\n\r\n const telemetry: ITelemetry = {\r\n Metrics: metrics,\r\n ReceivedMessages: this.privReceivedMessages,\r\n };\r\n\r\n const json = JSON.stringify(telemetry);\r\n\r\n // We dont want to send the same telemetry again. So clean those out.\r\n this.privReceivedMessages = {};\r\n this.privListeningTriggerMetric = null;\r\n this.privMicMetric = null;\r\n this.privConnectionEstablishMetric = null;\r\n this.privPhraseLatencies = [];\r\n this.privHypothesisLatencies = [];\r\n return json;\r\n }\r\n\r\n // Determines if there are any telemetry events to send to the service.\r\n public get hasTelemetry(): boolean {\r\n return (Object.keys(this.privReceivedMessages).length !== 0 ||\r\n this.privListeningTriggerMetric !== null ||\r\n this.privMicMetric !== null ||\r\n this.privConnectionEstablishMetric !== null ||\r\n this.privPhraseLatencies.length !== 0 ||\r\n this.privHypothesisLatencies.length !== 0);\r\n }\r\n\r\n public dispose = (): void => {\r\n this.privIsDisposed = true;\r\n }\r\n\r\n private getConnectionError = (statusCode: number): string => {\r\n /*\r\n -- Websocket status codes --\r\n NormalClosure = 1000,\r\n EndpointUnavailable = 1001,\r\n ProtocolError = 1002,\r\n InvalidMessageType = 1003,\r\n Empty = 1005,\r\n InvalidPayloadData = 1007,\r\n PolicyViolation = 1008,\r\n MessageTooBig = 1009,\r\n MandatoryExtension = 1010,\r\n InternalServerError = 1011\r\n */\r\n\r\n switch (statusCode) {\r\n case 400:\r\n case 1002:\r\n case 1003:\r\n case 1005:\r\n case 1007:\r\n case 1008:\r\n case 1009: return \"BadRequest\";\r\n case 401: return \"Unauthorized\";\r\n case 403: return \"Forbidden\";\r\n case 503:\r\n case 1001: return \"ServerUnavailable\";\r\n case 500:\r\n case 1011: return \"ServerError\";\r\n case 408:\r\n case 504: return \"Timeout\";\r\n default: return \"statuscode:\" + statusCode.toString();\r\n }\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n DynamicGrammarBuilder,\r\n IDynamicGrammar,\r\n} from \"./Exports\";\r\n\r\n/**\r\n * Represents the JSON used in the speech.context message sent to the speech service.\r\n * The dynamic grammar is always refreshed from the encapsulated dynamic grammar object.\r\n */\r\nexport class SpeechContext {\r\n private privContext: { [section: string]: any } = {};\r\n private privDynamicGrammar: DynamicGrammarBuilder;\r\n\r\n constructor(dynamicGrammar: DynamicGrammarBuilder) {\r\n this.privDynamicGrammar = dynamicGrammar;\r\n }\r\n\r\n /**\r\n * Adds a section to the speech.context object.\r\n * @param sectionName Name of the section to add.\r\n * @param value JSON serializeable object that represents the value.\r\n */\r\n public setSection(sectionName: string, value: any): void {\r\n this.privContext[sectionName] = value;\r\n }\r\n\r\n public toJSON(): string {\r\n\r\n const dgi: IDynamicGrammar = this.privDynamicGrammar.generateGrammarObject();\r\n this.setSection(\"dgi\", dgi);\r\n\r\n const ret: string = JSON.stringify(this.privContext);\r\n return ret;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n IDynamicGrammar,\r\n IDynamicGrammarGeneric,\r\n} from \"./Exports\";\r\n\r\n/**\r\n * Responsible for building the object to be sent to the speech service to support dynamic grammars.\r\n * @class DynamicGrammarBuilder\r\n */\r\nexport class DynamicGrammarBuilder {\r\n\r\n private privPhrases: string[];\r\n private privGrammars: string[];\r\n\r\n // Adds one more reference phrases to the dynamic grammar to send.\r\n // All added phrases are generic phrases.\r\n public addPhrase(phrase: string | string[]): void {\r\n if (!this.privPhrases) {\r\n this.privPhrases = [];\r\n }\r\n\r\n if (phrase instanceof Array) {\r\n this.privPhrases = this.privPhrases.concat(phrase as string[]);\r\n } else {\r\n this.privPhrases.push(phrase as string);\r\n }\r\n }\r\n\r\n // Clears all phrases stored in the current object.\r\n public clearPhrases(): void {\r\n this.privPhrases = undefined;\r\n }\r\n\r\n // Adds one or more reference grammars to the current grammar.\r\n public addReferenceGrammar(grammar: string | string[]): void {\r\n if (!this.privGrammars) {\r\n this.privGrammars = [];\r\n }\r\n\r\n if (grammar instanceof Array) {\r\n this.privGrammars = this.privGrammars.concat(grammar as string[]);\r\n } else {\r\n this.privGrammars.push(grammar as string);\r\n }\r\n }\r\n\r\n // clears all grammars stored on the recognizer.\r\n public clearGrammars(): void {\r\n this.privGrammars = undefined;\r\n }\r\n\r\n // Generates an object that represents the dynamic grammar used by the Speech Service.\r\n // This is done by building an object with the correct layout based on the phrases and reference grammars added to this instance\r\n // of a DynamicGrammarBuilder\r\n public generateGrammarObject(): IDynamicGrammar {\r\n if (this.privGrammars === undefined && this.privPhrases === undefined) {\r\n return undefined;\r\n }\r\n\r\n const retObj: IDynamicGrammar = {};\r\n retObj.ReferenceGrammars = this.privGrammars;\r\n\r\n if (undefined !== this.privPhrases && 0 !== this.privPhrases.length) {\r\n const retPhrases: IDynamicGrammarGeneric[] = [];\r\n\r\n this.privPhrases.forEach((value: string, index: number, array: string[]): void => {\r\n retPhrases.push({\r\n Text: value,\r\n });\r\n });\r\n\r\n retObj.Groups = [{ Type: \"Generic\", Items: retPhrases }];\r\n }\r\n\r\n return retObj;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { AudioStreamFormat, AudioStreamFormatImpl } from \"../../src/sdk/Audio/AudioStreamFormat\";\r\nimport {\r\n connectivity,\r\n ISpeechConfigAudioDevice,\r\n type,\r\n} from \"../common.speech/Exports\";\r\nimport {\r\n AudioSourceErrorEvent,\r\n AudioSourceEvent,\r\n AudioSourceInitializingEvent,\r\n AudioSourceOffEvent,\r\n AudioSourceReadyEvent,\r\n AudioStreamNodeAttachedEvent,\r\n AudioStreamNodeAttachingEvent,\r\n AudioStreamNodeDetachedEvent,\r\n AudioStreamNodeErrorEvent,\r\n createNoDashGuid,\r\n Events,\r\n EventSource,\r\n IAudioSource,\r\n IAudioStreamNode,\r\n IStringDictionary,\r\n Promise,\r\n PromiseHelper,\r\n Stream,\r\n StreamReader,\r\n} from \"../common/Exports\";\r\n\r\nexport class FileAudioSource implements IAudioSource {\r\n\r\n // Recommended sample rate (bytes/second).\r\n private static readonly SAMPLE_RATE: number = 16000 * 2; // 16 kHz * 16 bits\r\n\r\n // We should stream audio at no faster than 2x real-time (i.e., send five chunks\r\n // per second, with the chunk size == sample rate in bytes per second * 2 / 5).\r\n private static readonly CHUNK_SIZE: number = FileAudioSource.SAMPLE_RATE * 2 / 5;\r\n\r\n // 10 seconds of audio in bytes =\r\n // sample rate (bytes/second) * 600 (seconds) + 44 (size of the wave header).\r\n private static readonly MAX_SIZE: number = FileAudioSource.SAMPLE_RATE * 600 + 44;\r\n\r\n private static readonly FILEFORMAT: AudioStreamFormatImpl = AudioStreamFormat.getWaveFormatPCM(16000, 16, 1) as AudioStreamFormatImpl;\r\n\r\n private privStreams: IStringDictionary> = {};\r\n\r\n private privId: string;\r\n\r\n private privEvents: EventSource;\r\n\r\n private privFile: File;\r\n\r\n public constructor(file: File, audioSourceId?: string) {\r\n this.privId = audioSourceId ? audioSourceId : createNoDashGuid();\r\n this.privEvents = new EventSource();\r\n this.privFile = file;\r\n }\r\n\r\n public get format(): AudioStreamFormat {\r\n return FileAudioSource.FILEFORMAT;\r\n }\r\n\r\n public turnOn = (): Promise => {\r\n if (typeof FileReader === \"undefined\") {\r\n const errorMsg = \"Browser does not support FileReader.\";\r\n this.onEvent(new AudioSourceErrorEvent(errorMsg, \"\")); // initialization error - no streamid at this point\r\n return PromiseHelper.fromError(errorMsg);\r\n } else if (this.privFile.name.lastIndexOf(\".wav\") !== this.privFile.name.length - 4) {\r\n const errorMsg = this.privFile.name + \" is not supported. Only WAVE files are allowed at the moment.\";\r\n this.onEvent(new AudioSourceErrorEvent(errorMsg, \"\"));\r\n return PromiseHelper.fromError(errorMsg);\r\n } else if (this.privFile.size > FileAudioSource.MAX_SIZE) {\r\n const errorMsg = this.privFile.name + \" exceeds the maximum allowed file size (\" + FileAudioSource.MAX_SIZE + \").\";\r\n this.onEvent(new AudioSourceErrorEvent(errorMsg, \"\"));\r\n return PromiseHelper.fromError(errorMsg);\r\n }\r\n\r\n this.onEvent(new AudioSourceInitializingEvent(this.privId)); // no stream id\r\n this.onEvent(new AudioSourceReadyEvent(this.privId));\r\n return PromiseHelper.fromResult(true);\r\n }\r\n\r\n public id = (): string => {\r\n return this.privId;\r\n }\r\n\r\n public attach = (audioNodeId: string): Promise => {\r\n this.onEvent(new AudioStreamNodeAttachingEvent(this.privId, audioNodeId));\r\n\r\n return this.upload(audioNodeId).onSuccessContinueWith(\r\n (streamReader: StreamReader) => {\r\n this.onEvent(new AudioStreamNodeAttachedEvent(this.privId, audioNodeId));\r\n return {\r\n detach: () => {\r\n streamReader.close();\r\n delete this.privStreams[audioNodeId];\r\n this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\r\n this.turnOff();\r\n },\r\n id: () => {\r\n return audioNodeId;\r\n },\r\n read: () => {\r\n return streamReader.read();\r\n },\r\n };\r\n });\r\n }\r\n\r\n public detach = (audioNodeId: string): void => {\r\n if (audioNodeId && this.privStreams[audioNodeId]) {\r\n this.privStreams[audioNodeId].close();\r\n delete this.privStreams[audioNodeId];\r\n this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\r\n }\r\n }\r\n\r\n public turnOff = (): Promise => {\r\n for (const streamId in this.privStreams) {\r\n if (streamId) {\r\n const stream = this.privStreams[streamId];\r\n if (stream && !stream.isClosed) {\r\n stream.close();\r\n }\r\n }\r\n }\r\n\r\n this.onEvent(new AudioSourceOffEvent(this.privId)); // no stream now\r\n return PromiseHelper.fromResult(true);\r\n }\r\n\r\n public get events(): EventSource {\r\n return this.privEvents;\r\n }\r\n\r\n public get deviceInfo(): Promise {\r\n return PromiseHelper.fromResult({\r\n bitspersample: FileAudioSource.FILEFORMAT.bitsPerSample,\r\n channelcount: FileAudioSource.FILEFORMAT.channels,\r\n connectivity: connectivity.Unknown,\r\n manufacturer: \"Speech SDK\",\r\n model: \"File\",\r\n samplerate: FileAudioSource.FILEFORMAT.samplesPerSec,\r\n type: type.File,\r\n });\r\n }\r\n\r\n private upload = (audioNodeId: string): Promise> => {\r\n return this.turnOn()\r\n .onSuccessContinueWith>((_: boolean) => {\r\n const stream = new Stream(audioNodeId);\r\n\r\n this.privStreams[audioNodeId] = stream;\r\n\r\n const reader: FileReader = new FileReader();\r\n\r\n let startOffset = 0;\r\n let endOffset = FileAudioSource.CHUNK_SIZE;\r\n\r\n const processNextChunk = (event: Event): void => {\r\n if (stream.isClosed) {\r\n return; // output stream was closed (somebody called TurnOff). We're done here.\r\n }\r\n\r\n stream.writeStreamChunk({\r\n buffer: reader.result as ArrayBuffer,\r\n isEnd: false,\r\n timeReceived: Date.now(),\r\n });\r\n\r\n if (endOffset < this.privFile.size) {\r\n startOffset = endOffset;\r\n endOffset = Math.min(endOffset + FileAudioSource.CHUNK_SIZE, this.privFile.size);\r\n const chunk = this.privFile.slice(startOffset, endOffset);\r\n reader.readAsArrayBuffer(chunk);\r\n } else {\r\n // we've written the entire file to the output stream, can close it now.\r\n stream.close();\r\n }\r\n };\r\n\r\n reader.onload = processNextChunk;\r\n\r\n reader.onerror = (event: ProgressEvent) => {\r\n const errorMsg = `Error occurred while processing '${this.privFile.name}'. ${event}`;\r\n this.onEvent(new AudioStreamNodeErrorEvent(this.privId, audioNodeId, errorMsg));\r\n throw new Error(errorMsg);\r\n };\r\n\r\n const chunk = this.privFile.slice(startOffset, endOffset);\r\n reader.readAsArrayBuffer(chunk);\r\n\r\n return stream.getReader();\r\n });\r\n }\r\n\r\n private onEvent = (event: AudioSourceEvent): void => {\r\n this.privEvents.onEvent(event);\r\n Events.instance.onEvent(event);\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { RiffPcmEncoder, Stream } from \"../common/Exports\";\r\nimport { IRecorder } from \"./IRecorder\";\r\n\r\nexport class PcmRecorder implements IRecorder {\r\n private privMediaResources: IMediaResources;\r\n private privSpeechProcessorScript: string; // speech-processor.js Url\r\n\r\n public record = (context: AudioContext, mediaStream: MediaStream, outputStream: Stream): void => {\r\n const desiredSampleRate = 16000;\r\n\r\n const scriptNode = (() => {\r\n let bufferSize = 0;\r\n try {\r\n return context.createScriptProcessor(bufferSize, 1, 1);\r\n } catch (error) {\r\n // Webkit (<= version 31) requires a valid bufferSize.\r\n bufferSize = 2048;\r\n let audioSampleRate = context.sampleRate;\r\n while (bufferSize < 16384 && audioSampleRate >= (2 * desiredSampleRate)) {\r\n bufferSize <<= 1;\r\n audioSampleRate >>= 1;\r\n }\r\n return context.createScriptProcessor(bufferSize, 1, 1);\r\n }\r\n })();\r\n\r\n const waveStreamEncoder = new RiffPcmEncoder(context.sampleRate, desiredSampleRate);\r\n let needHeader: boolean = true;\r\n const that = this;\r\n scriptNode.onaudioprocess = (event: AudioProcessingEvent) => {\r\n const inputFrame = event.inputBuffer.getChannelData(0);\r\n\r\n if (outputStream && !outputStream.isClosed) {\r\n const waveFrame = waveStreamEncoder.encode(needHeader, inputFrame);\r\n if (!!waveFrame) {\r\n outputStream.writeStreamChunk({\r\n buffer: waveFrame,\r\n isEnd: false,\r\n timeReceived: Date.now(),\r\n });\r\n needHeader = false;\r\n }\r\n }\r\n };\r\n\r\n const micInput = context.createMediaStreamSource(mediaStream);\r\n\r\n // https://webaudio.github.io/web-audio-api/#audioworklet\r\n // Using AudioWorklet to improve audio quality and avoid audio glitches due to blocking the UI thread\r\n\r\n if (!!this.privSpeechProcessorScript && !!context.audioWorklet) {\r\n context.audioWorklet\r\n .addModule(this.privSpeechProcessorScript)\r\n .then(() => {\r\n const workletNode = new AudioWorkletNode(context, \"speech-processor\");\r\n workletNode.port.onmessage = (ev: MessageEvent) => {\r\n const inputFrame: Float32Array = ev.data as Float32Array;\r\n\r\n if (outputStream && !outputStream.isClosed) {\r\n const waveFrame = waveStreamEncoder.encode(needHeader, inputFrame);\r\n if (!!waveFrame) {\r\n outputStream.writeStreamChunk({\r\n buffer: waveFrame,\r\n isEnd: false,\r\n timeReceived: Date.now(),\r\n });\r\n needHeader = false;\r\n }\r\n }\r\n };\r\n micInput.connect(workletNode);\r\n workletNode.connect(context.destination);\r\n this.privMediaResources = {\r\n scriptProcessorNode: workletNode,\r\n source: micInput,\r\n stream: mediaStream,\r\n };\r\n })\r\n .catch(() => {\r\n micInput.connect(scriptNode);\r\n scriptNode.connect(context.destination);\r\n this.privMediaResources = {\r\n scriptProcessorNode: scriptNode,\r\n source: micInput,\r\n stream: mediaStream,\r\n };\r\n });\r\n } else {\r\n micInput.connect(scriptNode);\r\n scriptNode.connect(context.destination);\r\n this.privMediaResources = {\r\n scriptProcessorNode: scriptNode,\r\n source: micInput,\r\n stream: mediaStream,\r\n };\r\n }\r\n }\r\n\r\n public releaseMediaResources = (context: AudioContext): void => {\r\n if (this.privMediaResources) {\r\n if (this.privMediaResources.scriptProcessorNode) {\r\n this.privMediaResources.scriptProcessorNode.disconnect(context.destination);\r\n this.privMediaResources.scriptProcessorNode = null;\r\n }\r\n if (this.privMediaResources.source) {\r\n this.privMediaResources.source.disconnect();\r\n this.privMediaResources.stream.getTracks().forEach((track: any) => track.stop());\r\n this.privMediaResources.source = null;\r\n }\r\n }\r\n }\r\n\r\n public setWorkletUrl(url: string): void {\r\n this.privSpeechProcessorScript = url;\r\n }\r\n}\r\n\r\ninterface IMediaResources {\r\n source: MediaStreamAudioSourceNode;\r\n scriptProcessorNode: ScriptProcessorNode | AudioWorkletNode;\r\n stream: MediaStream;\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n ArgumentNullError,\r\n ConnectionEvent,\r\n ConnectionMessage,\r\n ConnectionOpenResponse,\r\n ConnectionState,\r\n createNoDashGuid,\r\n EventSource,\r\n IConnection,\r\n IStringDictionary,\r\n IWebsocketMessageFormatter,\r\n Promise,\r\n} from \"../common/Exports\";\r\nimport { ProxyInfo } from \"./ProxyInfo\";\r\nimport { WebsocketMessageAdapter } from \"./WebsocketMessageAdapter\";\r\n\r\nexport class WebsocketConnection implements IConnection {\r\n\r\n private privUri: string;\r\n private privMessageFormatter: IWebsocketMessageFormatter;\r\n private privConnectionMessageAdapter: WebsocketMessageAdapter;\r\n private privId: string;\r\n private privIsDisposed: boolean = false;\r\n\r\n public constructor(\r\n uri: string,\r\n queryParameters: IStringDictionary,\r\n headers: IStringDictionary,\r\n messageFormatter: IWebsocketMessageFormatter,\r\n proxyInfo: ProxyInfo,\r\n connectionId?: string) {\r\n\r\n if (!uri) {\r\n throw new ArgumentNullError(\"uri\");\r\n }\r\n\r\n if (!messageFormatter) {\r\n throw new ArgumentNullError(\"messageFormatter\");\r\n }\r\n\r\n this.privMessageFormatter = messageFormatter;\r\n\r\n let queryParams = \"\";\r\n let i = 0;\r\n\r\n if (queryParameters) {\r\n for (const paramName in queryParameters) {\r\n if (paramName) {\r\n queryParams += ((i === 0) && (uri.indexOf(\"?\") === -1)) ? \"?\" : \"&\";\r\n const val = encodeURIComponent(queryParameters[paramName]);\r\n queryParams += `${paramName}=${val}`;\r\n i++;\r\n }\r\n }\r\n }\r\n\r\n if (headers) {\r\n for (const headerName in headers) {\r\n if (headerName) {\r\n queryParams += i === 0 ? \"?\" : \"&\";\r\n const val = encodeURIComponent(headers[headerName]);\r\n queryParams += `${headerName}=${val}`;\r\n i++;\r\n }\r\n }\r\n }\r\n\r\n this.privUri = uri + queryParams;\r\n this.privId = connectionId ? connectionId : createNoDashGuid();\r\n\r\n this.privConnectionMessageAdapter = new WebsocketMessageAdapter(\r\n this.privUri,\r\n this.id,\r\n this.privMessageFormatter,\r\n proxyInfo);\r\n }\r\n\r\n public dispose = (): void => {\r\n this.privIsDisposed = true;\r\n\r\n if (this.privConnectionMessageAdapter) {\r\n this.privConnectionMessageAdapter.close();\r\n }\r\n }\r\n\r\n public isDisposed = (): boolean => {\r\n return this.privIsDisposed;\r\n }\r\n\r\n public get id(): string {\r\n return this.privId;\r\n }\r\n\r\n public state = (): ConnectionState => {\r\n return this.privConnectionMessageAdapter.state;\r\n }\r\n\r\n public open = (): Promise => {\r\n return this.privConnectionMessageAdapter.open();\r\n }\r\n\r\n public send = (message: ConnectionMessage): Promise => {\r\n return this.privConnectionMessageAdapter.send(message);\r\n }\r\n\r\n public read = (): Promise => {\r\n return this.privConnectionMessageAdapter.read();\r\n }\r\n\r\n public get events(): EventSource {\r\n return this.privConnectionMessageAdapter.events;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n ArgumentNullError,\r\n ConnectionClosedEvent,\r\n ConnectionEstablishedEvent,\r\n ConnectionEvent,\r\n ConnectionMessage,\r\n ConnectionMessageReceivedEvent,\r\n ConnectionMessageSentEvent,\r\n ConnectionOpenResponse,\r\n ConnectionStartEvent,\r\n ConnectionState,\r\n Deferred,\r\n Events,\r\n EventSource,\r\n IWebsocketMessageFormatter,\r\n MessageType,\r\n Promise,\r\n PromiseHelper,\r\n Queue,\r\n RawWebsocketMessage,\r\n} from \"../common/Exports\";\r\nimport { ProxyInfo } from \"./ProxyInfo\";\r\n\r\n// Node.JS specific web socket / browser support.\r\nimport * as http from \"http\";\r\nimport * as HttpsProxyAgent from \"https-proxy-agent\";\r\nimport * as tls from \"tls\";\r\nimport * as ws from \"ws\";\r\nimport * as ocsp from \"../../external/ocsp/ocsp\";\r\n\r\ninterface ISendItem {\r\n Message: ConnectionMessage;\r\n RawWebsocketMessage: RawWebsocketMessage;\r\n sendStatusDeferral: Deferred;\r\n}\r\n\r\nexport class WebsocketMessageAdapter {\r\n private privConnectionState: ConnectionState;\r\n private privMessageFormatter: IWebsocketMessageFormatter;\r\n private privWebsocketClient: WebSocket | ws;\r\n\r\n private privSendMessageQueue: Queue;\r\n private privReceivingMessageQueue: Queue;\r\n private privConnectionEstablishDeferral: Deferred;\r\n private privCertificateValidatedDeferral: Deferred;\r\n private privDisconnectDeferral: Deferred;\r\n private privConnectionEvents: EventSource;\r\n private privConnectionId: string;\r\n private privUri: string;\r\n private proxyInfo: ProxyInfo;\r\n\r\n public static forceNpmWebSocket: boolean = false;\r\n\r\n public constructor(\r\n uri: string,\r\n connectionId: string,\r\n messageFormatter: IWebsocketMessageFormatter,\r\n proxyInfo: ProxyInfo) {\r\n\r\n if (!uri) {\r\n throw new ArgumentNullError(\"uri\");\r\n }\r\n\r\n if (!messageFormatter) {\r\n throw new ArgumentNullError(\"messageFormatter\");\r\n }\r\n\r\n this.proxyInfo = proxyInfo;\r\n this.privConnectionEvents = new EventSource();\r\n this.privConnectionId = connectionId;\r\n this.privMessageFormatter = messageFormatter;\r\n this.privConnectionState = ConnectionState.None;\r\n this.privUri = uri;\r\n }\r\n\r\n public get state(): ConnectionState {\r\n return this.privConnectionState;\r\n }\r\n\r\n public open = (): Promise => {\r\n if (this.privConnectionState === ConnectionState.Disconnected) {\r\n return PromiseHelper.fromError(`Cannot open a connection that is in ${this.privConnectionState} state`);\r\n }\r\n\r\n if (this.privConnectionEstablishDeferral) {\r\n return this.privConnectionEstablishDeferral.promise();\r\n }\r\n\r\n this.privConnectionEstablishDeferral = new Deferred();\r\n this.privCertificateValidatedDeferral = new Deferred();\r\n\r\n this.privConnectionState = ConnectionState.Connecting;\r\n\r\n try {\r\n if (typeof WebSocket !== \"undefined\" && !WebsocketMessageAdapter.forceNpmWebSocket) {\r\n // Browser handles cert checks.\r\n this.privCertificateValidatedDeferral.resolve(true);\r\n\r\n this.privWebsocketClient = new WebSocket(this.privUri);\r\n } else {\r\n if (this.proxyInfo !== undefined &&\r\n this.proxyInfo.HostName !== undefined &&\r\n this.proxyInfo.Port > 0) {\r\n const httpProxyOptions: HttpsProxyAgent.HttpsProxyAgentOptions = {\r\n host: this.proxyInfo.HostName,\r\n port: this.proxyInfo.Port,\r\n };\r\n\r\n if (undefined !== this.proxyInfo.UserName) {\r\n httpProxyOptions.headers = {\r\n \"Proxy-Authentication\": \"Basic \" + new Buffer(this.proxyInfo.UserName + \":\" + (this.proxyInfo.Password === undefined) ? \"\" : this.proxyInfo.Password).toString(\"base64\"),\r\n \"requestOCSP\": \"true\",\r\n };\r\n }\r\n\r\n const httpProxyAgent: HttpsProxyAgent = new HttpsProxyAgent(httpProxyOptions);\r\n const httpsOptions: http.RequestOptions = { agent: httpProxyAgent };\r\n\r\n this.privWebsocketClient = new ws(this.privUri, httpsOptions as ws.ClientOptions);\r\n\r\n // Register to be notified when WebSocket upgrade happens so we can check the validity of the\r\n // Certificate.\r\n this.privWebsocketClient.addListener(\"upgrade\", (e: http.IncomingMessage): void => {\r\n const tlsSocket: tls.TLSSocket = e.socket as tls.TLSSocket;\r\n const peer: tls.DetailedPeerCertificate = tlsSocket.getPeerCertificate(true);\r\n\r\n // Cork the socket until we know if the cert is good.\r\n tlsSocket.cork();\r\n\r\n ocsp.check({\r\n cert: peer.raw,\r\n httpOptions: httpsOptions,\r\n issuer: peer.issuerCertificate.raw,\r\n }, (error: Error, res: any): void => {\r\n if (error) {\r\n this.privCertificateValidatedDeferral.reject(error.message);\r\n tlsSocket.destroy(error);\r\n } else {\r\n this.privCertificateValidatedDeferral.resolve(true);\r\n tlsSocket.uncork();\r\n }\r\n });\r\n });\r\n\r\n } else {\r\n // The ocsp library will handle validation for us and fail the connection if needed.\r\n this.privCertificateValidatedDeferral.resolve(true);\r\n\r\n const ocspAgent: ocsp.Agent = new ocsp.Agent({});\r\n const options: ws.ClientOptions = { agent: ocspAgent };\r\n this.privWebsocketClient = new ws(this.privUri, options);\r\n }\r\n }\r\n\r\n this.privWebsocketClient.binaryType = \"arraybuffer\";\r\n this.privReceivingMessageQueue = new Queue();\r\n this.privDisconnectDeferral = new Deferred();\r\n this.privSendMessageQueue = new Queue();\r\n this.processSendQueue();\r\n } catch (error) {\r\n this.privConnectionEstablishDeferral.resolve(new ConnectionOpenResponse(500, error));\r\n return this.privConnectionEstablishDeferral.promise();\r\n }\r\n\r\n this.onEvent(new ConnectionStartEvent(this.privConnectionId, this.privUri));\r\n\r\n this.privWebsocketClient.onopen = (e: { target: WebSocket | ws }) => {\r\n this.privCertificateValidatedDeferral.promise().on((): void => {\r\n this.privConnectionState = ConnectionState.Connected;\r\n this.onEvent(new ConnectionEstablishedEvent(this.privConnectionId));\r\n this.privConnectionEstablishDeferral.resolve(new ConnectionOpenResponse(200, \"\"));\r\n }, (error: string): void => {\r\n this.privConnectionEstablishDeferral.reject(error);\r\n });\r\n };\r\n\r\n this.privWebsocketClient.onerror = (e: { error: any; message: string; type: string; target: WebSocket | ws }) => {\r\n // TODO: Understand what this is error is. Will we still get onClose ?\r\n if (this.privConnectionState !== ConnectionState.Connecting) {\r\n // TODO: Is this required ?\r\n // this.onEvent(new ConnectionErrorEvent(errorMsg, connectionId));\r\n }\r\n };\r\n\r\n this.privWebsocketClient.onclose = (e: { wasClean: boolean; code: number; reason: string; target: WebSocket | ws }) => {\r\n if (this.privConnectionState === ConnectionState.Connecting) {\r\n this.privConnectionState = ConnectionState.Disconnected;\r\n // this.onEvent(new ConnectionEstablishErrorEvent(this.connectionId, e.code, e.reason));\r\n this.privConnectionEstablishDeferral.resolve(new ConnectionOpenResponse(e.code, e.reason));\r\n } else {\r\n this.onEvent(new ConnectionClosedEvent(this.privConnectionId, e.code, e.reason));\r\n }\r\n\r\n this.onClose(e.code, e.reason);\r\n };\r\n\r\n this.privWebsocketClient.onmessage = (e: { data: ws.Data; type: string; target: WebSocket | ws }) => {\r\n const networkReceivedTime = new Date().toISOString();\r\n if (this.privConnectionState === ConnectionState.Connected) {\r\n const deferred = new Deferred();\r\n // let id = ++this.idCounter;\r\n this.privReceivingMessageQueue.enqueueFromPromise(deferred.promise());\r\n if (e.data instanceof ArrayBuffer) {\r\n const rawMessage = new RawWebsocketMessage(MessageType.Binary, e.data);\r\n this.privMessageFormatter\r\n .toConnectionMessage(rawMessage)\r\n .on((connectionMessage: ConnectionMessage) => {\r\n this.onEvent(new ConnectionMessageReceivedEvent(this.privConnectionId, networkReceivedTime, connectionMessage));\r\n deferred.resolve(connectionMessage);\r\n }, (error: string) => {\r\n // TODO: Events for these ?\r\n deferred.reject(`Invalid binary message format. Error: ${error}`);\r\n });\r\n } else {\r\n const rawMessage = new RawWebsocketMessage(MessageType.Text, e.data);\r\n this.privMessageFormatter\r\n .toConnectionMessage(rawMessage)\r\n .on((connectionMessage: ConnectionMessage) => {\r\n this.onEvent(new ConnectionMessageReceivedEvent(this.privConnectionId, networkReceivedTime, connectionMessage));\r\n deferred.resolve(connectionMessage);\r\n }, (error: string) => {\r\n // TODO: Events for these ?\r\n deferred.reject(`Invalid text message format. Error: ${error}`);\r\n });\r\n }\r\n }\r\n };\r\n\r\n return this.privConnectionEstablishDeferral.promise();\r\n }\r\n\r\n public send = (message: ConnectionMessage): Promise => {\r\n if (this.privConnectionState !== ConnectionState.Connected) {\r\n return PromiseHelper.fromError(`Cannot send on connection that is in ${this.privConnectionState} state`);\r\n }\r\n\r\n const messageSendStatusDeferral = new Deferred();\r\n const messageSendDeferral = new Deferred();\r\n\r\n this.privSendMessageQueue.enqueueFromPromise(messageSendDeferral.promise());\r\n\r\n this.privMessageFormatter\r\n .fromConnectionMessage(message)\r\n .on((rawMessage: RawWebsocketMessage) => {\r\n messageSendDeferral.resolve({\r\n Message: message,\r\n RawWebsocketMessage: rawMessage,\r\n sendStatusDeferral: messageSendStatusDeferral,\r\n });\r\n }, (error: string) => {\r\n messageSendDeferral.reject(`Error formatting the message. ${error}`);\r\n });\r\n\r\n return messageSendStatusDeferral.promise();\r\n }\r\n\r\n public read = (): Promise => {\r\n if (this.privConnectionState !== ConnectionState.Connected) {\r\n return PromiseHelper.fromError(`Cannot read on connection that is in ${this.privConnectionState} state`);\r\n }\r\n\r\n return this.privReceivingMessageQueue.dequeue();\r\n }\r\n\r\n public close = (reason?: string): Promise => {\r\n if (this.privWebsocketClient) {\r\n if (this.privConnectionState !== ConnectionState.Disconnected) {\r\n this.privWebsocketClient.close(1000, reason ? reason : \"Normal closure by client\");\r\n }\r\n } else {\r\n const deferral = new Deferred();\r\n deferral.resolve(true);\r\n return deferral.promise();\r\n }\r\n\r\n return this.privDisconnectDeferral.promise();\r\n }\r\n\r\n public get events(): EventSource {\r\n return this.privConnectionEvents;\r\n }\r\n\r\n private sendRawMessage = (sendItem: ISendItem): Promise => {\r\n try {\r\n // indicates we are draining the queue and it came with no message;\r\n if (!sendItem) {\r\n return PromiseHelper.fromResult(true);\r\n }\r\n\r\n this.onEvent(new ConnectionMessageSentEvent(this.privConnectionId, new Date().toISOString(), sendItem.Message));\r\n this.privWebsocketClient.send(sendItem.RawWebsocketMessage.payload);\r\n return PromiseHelper.fromResult(true);\r\n } catch (e) {\r\n return PromiseHelper.fromError(`websocket send error: ${e}`);\r\n }\r\n }\r\n\r\n private onClose = (code: number, reason: string): void => {\r\n const closeReason = `Connection closed. ${code}: ${reason}`;\r\n this.privConnectionState = ConnectionState.Disconnected;\r\n this.privDisconnectDeferral.resolve(true);\r\n this.privReceivingMessageQueue.dispose(reason);\r\n this.privReceivingMessageQueue.drainAndDispose((pendingReceiveItem: ConnectionMessage) => {\r\n // TODO: Events for these ?\r\n // Logger.instance.onEvent(new LoggingEvent(LogType.Warning, null, `Failed to process received message. Reason: ${closeReason}, Message: ${JSON.stringify(pendingReceiveItem)}`));\r\n }, closeReason);\r\n\r\n this.privSendMessageQueue.drainAndDispose((pendingSendItem: ISendItem) => {\r\n pendingSendItem.sendStatusDeferral.reject(closeReason);\r\n }, closeReason);\r\n }\r\n\r\n private processSendQueue = (): void => {\r\n this.privSendMessageQueue\r\n .dequeue()\r\n .on((sendItem: ISendItem) => {\r\n // indicates we are draining the queue and it came with no message;\r\n if (!sendItem) {\r\n return;\r\n }\r\n\r\n this.sendRawMessage(sendItem)\r\n .on((result: boolean) => {\r\n sendItem.sendStatusDeferral.resolve(result);\r\n this.processSendQueue();\r\n }, (sendError: string) => {\r\n sendItem.sendStatusDeferral.reject(sendError);\r\n this.processSendQueue();\r\n });\r\n }, (error: string) => {\r\n // do nothing\r\n });\r\n }\r\n\r\n private onEvent = (event: ConnectionEvent): void => {\r\n this.privConnectionEvents.onEvent(event);\r\n Events.instance.onEvent(event);\r\n }\r\n}\r\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n for (var i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(\n uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)\n ))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n","/* (ignored) */","/* (ignored) */","/* (ignored) */","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { AudioStreamFormatImpl } from \"../../src/sdk/Audio/AudioStreamFormat\";\r\nimport {\r\n IAudioStreamNode,\r\n IStreamChunk,\r\n Promise,\r\n PromiseHelper,\r\n} from \"../common/Exports\";\r\n\r\nexport class ReplayableAudioNode implements IAudioStreamNode {\r\n private privAudioNode: IAudioStreamNode;\r\n private privFormat: AudioStreamFormatImpl;\r\n private privBuffers: BufferEntry[] = [];\r\n private privReplayOffset: number = 0;\r\n private privLastShrinkOffset: number = 0;\r\n private privBufferStartOffset: number = 0;\r\n private privBufferSerial: number = 0;\r\n private privBufferedBytes: number = 0;\r\n private privReplay: boolean = false;\r\n private privLastChunkAcquiredTime: number = 0;\r\n\r\n public constructor(audioSource: IAudioStreamNode, format: AudioStreamFormatImpl) {\r\n this.privAudioNode = audioSource;\r\n this.privFormat = format;\r\n }\r\n\r\n public id = (): string => {\r\n return this.privAudioNode.id();\r\n }\r\n\r\n // Reads and returns the next chunk of audio buffer.\r\n // If replay of existing buffers are needed, read() will first seek and replay\r\n // existing content, and upoin completion it will read new content from the underlying\r\n // audio node, saving that content into the replayable buffers.\r\n public read(): Promise> {\r\n // if there is a replay request to honor.\r\n if (!!this.privReplay && this.privBuffers.length !== 0) {\r\n // Find the start point in the buffers.\r\n // Offsets are in 100ns increments.\r\n // So how many bytes do we need to seek to get the right offset?\r\n const offsetToSeek: number = this.privReplayOffset - this.privBufferStartOffset;\r\n\r\n let bytesToSeek: number = Math.round(offsetToSeek * this.privFormat.avgBytesPerSec * 1e-7);\r\n if (0 !== (bytesToSeek % 2)) {\r\n bytesToSeek++;\r\n }\r\n\r\n let i: number = 0;\r\n\r\n while (i < this.privBuffers.length && bytesToSeek >= this.privBuffers[i].chunk.buffer.byteLength) {\r\n bytesToSeek -= this.privBuffers[i++].chunk.buffer.byteLength;\r\n }\r\n\r\n const retVal: ArrayBuffer = this.privBuffers[i].chunk.buffer.slice(bytesToSeek);\r\n\r\n this.privReplayOffset += (retVal.byteLength / this.privFormat.avgBytesPerSec) * 1e+7;\r\n\r\n // If we've reached the end of the buffers, stop replaying.\r\n if (i === this.privBuffers.length - 1) {\r\n this.privReplay = false;\r\n }\r\n\r\n return PromiseHelper.fromResult>({\r\n buffer: retVal,\r\n isEnd: false,\r\n timeReceived: this.privBuffers[i].chunk.timeReceived,\r\n });\r\n }\r\n\r\n return this.privAudioNode.read()\r\n .onSuccessContinueWith((result: IStreamChunk) => {\r\n if (result.buffer) {\r\n this.privBuffers.push(new BufferEntry(result, this.privBufferSerial++, this.privBufferedBytes));\r\n this.privBufferedBytes += result.buffer.byteLength;\r\n }\r\n return result;\r\n });\r\n }\r\n\r\n public detach(): void {\r\n this.privAudioNode.detach();\r\n this.privBuffers = undefined;\r\n }\r\n\r\n public replay(): void {\r\n if (0 !== this.privBuffers.length) {\r\n this.privReplay = true;\r\n this.privReplayOffset = this.privLastShrinkOffset;\r\n }\r\n }\r\n\r\n // Shrinks the existing audio buffers to start at the new offset, or at the\r\n // beginning of the buffer closest to the requested offset.\r\n // A replay request will start from the last shrink point.\r\n public shrinkBuffers(offset: number): void {\r\n this.privLastShrinkOffset = offset;\r\n\r\n // Find the start point in the buffers.\r\n // Offsets are in 100ns increments.\r\n // So how many bytes do we need to seek to get the right offset?\r\n const offsetToSeek: number = offset - this.privBufferStartOffset;\r\n\r\n let bytesToSeek: number = Math.round(offsetToSeek * this.privFormat.avgBytesPerSec * 1e-7);\r\n\r\n let i: number = 0;\r\n\r\n while (i < this.privBuffers.length && bytesToSeek >= this.privBuffers[i].chunk.buffer.byteLength) {\r\n bytesToSeek -= this.privBuffers[i++].chunk.buffer.byteLength;\r\n }\r\n this.privBufferStartOffset = Math.round(offset - ((bytesToSeek / this.privFormat.avgBytesPerSec) * 1e+7));\r\n this.privBuffers = this.privBuffers.slice(i);\r\n }\r\n\r\n // Finds the time a buffer of audio was first seen by offset.\r\n public findTimeAtOffset(offset: number): number {\r\n if (offset < this.privBufferStartOffset) {\r\n return 0;\r\n }\r\n\r\n for (const value of this.privBuffers) {\r\n const startOffset: number = (value.byteOffset / this.privFormat.avgBytesPerSec) * 1e7;\r\n const endOffset: number = startOffset + ((value.chunk.buffer.byteLength / this.privFormat.avgBytesPerSec) * 1e7);\r\n\r\n if (offset >= startOffset && offset <= endOffset) {\r\n return value.chunk.timeReceived;\r\n }\r\n }\r\n\r\n return 0;\r\n }\r\n}\r\n\r\n// Primary use of this class is to help debugging problems with the replay\r\n// code. If the memory cost of alloc / dealloc gets too much, drop it and just use\r\n// the ArrayBuffer directly.\r\n// tslint:disable-next-line:max-classes-per-file\r\nclass BufferEntry {\r\n public chunk: IStreamChunk;\r\n public serial: number;\r\n public byteOffset: number;\r\n\r\n public constructor(chunk: IStreamChunk, serial: number, byteOffset: number) {\r\n this.chunk = chunk;\r\n this.serial = serial;\r\n this.byteOffset = byteOffset;\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { RecognizerConfig } from \"../common.speech/Exports\";\r\nimport { PropertyId } from \"../sdk/Exports\";\r\n\r\nexport class ProxyInfo {\r\n private privProxyHostName: string;\r\n private privProxyPort: number;\r\n private privProxyUserName: string;\r\n private privProxyPassword: string;\r\n\r\n private constructor(proxyHostName: string, proxyPort: number, proxyUserName: string, proxyPassword: string) {\r\n this.privProxyHostName = proxyHostName;\r\n this.privProxyPort = proxyPort;\r\n this.privProxyUserName = proxyUserName;\r\n this.privProxyPassword = proxyPassword;\r\n }\r\n\r\n public static fromRecognizerConfig(config: RecognizerConfig): ProxyInfo {\r\n return new ProxyInfo(config.parameters.getProperty(PropertyId.SpeechServiceConnection_ProxyHostName),\r\n parseInt(config.parameters.getProperty(PropertyId.SpeechServiceConnection_ProxyPort), 10),\r\n config.parameters.getProperty(PropertyId.SpeechServiceConnection_ProxyUserName),\r\n config.parameters.getProperty(PropertyId.SpeechServiceConnection_ProxyPassword));\r\n }\r\n\r\n public get HostName(): string {\r\n return this.privProxyHostName;\r\n }\r\n\r\n public get Port(): number {\r\n return this.privProxyPort;\r\n }\r\n\r\n public get UserName(): string {\r\n return this.privProxyUserName;\r\n }\r\n\r\n public get Password(): string {\r\n return this.privProxyPassword;\r\n }\r\n}\r\n"],"sourceRoot":""}