{"version":3,"sources":["src/sdk/CancellationDetails.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAGH,iBAAiB,EACjB,qBAAqB,EACxB,MAAM,WAAW,CAAC;AAEnB;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,uBAAuB;IAE5D,OAAO;IAIP;;;;;;;OAOG;WACW,UAAU,CAAC,MAAM,EAAE,iBAAiB,GAAG,qBAAqB,GAAG,mBAAmB;CAgBnG","file":"CancellationDetails.d.ts","sourcesContent":["// 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 { CancellationDetailsBase } from \"./CancellationDetailsBase\";\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    RecognitionResult,\r\n    SpeechSynthesisResult\r\n} 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 extends CancellationDetailsBase {\r\n\r\n    private constructor(reason: CancellationReason, errorDetails: string, errorCode: CancellationErrorCode) {\r\n        super(reason, errorDetails, errorCode);\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of CancellationDetails object for the canceled RecognitionResult.\r\n     * @member CancellationDetails.fromResult\r\n     * @function\r\n     * @public\r\n     * @param {RecognitionResult | SpeechSynthesisResult} result - The result that was canceled.\r\n     * @returns {CancellationDetails} The cancellation details object being created.\r\n     */\r\n    public static fromResult(result: RecognitionResult | SpeechSynthesisResult): CancellationDetails {\r\n        let reason = CancellationReason.Error;\r\n        let errorCode: CancellationErrorCode = CancellationErrorCode.NoError;\r\n\r\n        if (result instanceof RecognitionResult && !!result.json) {\r\n            const simpleSpeech: SimpleSpeechPhrase = SimpleSpeechPhrase.fromJSON(result.json);\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 || EnumTranslation.implTranslateErrorDetails(errorCode), errorCode);\r\n    }\r\n\r\n}\r\n"]}