UNPKG

95.4 kBJavaScriptView Raw
1!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@aws-amplify/core")):"function"==typeof define&&define.amd?define("aws_amplify_interactions",["@aws-amplify/core"],t):"object"==typeof exports?exports.aws_amplify_interactions=t(require("@aws-amplify/core")):e.aws_amplify_interactions=t(e["@aws-amplify/core"])}(this,(function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=28)}([function(e,t,n){"use strict";n.r(t),n.d(t,"__extends",(function(){return o})),n.d(t,"__assign",(function(){return i})),n.d(t,"__rest",(function(){return a})),n.d(t,"__decorate",(function(){return s})),n.d(t,"__param",(function(){return u})),n.d(t,"__metadata",(function(){return c})),n.d(t,"__awaiter",(function(){return l})),n.d(t,"__generator",(function(){return d})),n.d(t,"__createBinding",(function(){return f})),n.d(t,"__exportStar",(function(){return p})),n.d(t,"__values",(function(){return h})),n.d(t,"__read",(function(){return v})),n.d(t,"__spread",(function(){return m})),n.d(t,"__spreadArrays",(function(){return g})),n.d(t,"__await",(function(){return y})),n.d(t,"__asyncGenerator",(function(){return b})),n.d(t,"__asyncDelegator",(function(){return w})),n.d(t,"__asyncValues",(function(){return _})),n.d(t,"__makeTemplateObject",(function(){return S})),n.d(t,"__importStar",(function(){return x})),n.d(t,"__importDefault",(function(){return O})),n.d(t,"__classPrivateFieldGet",(function(){return A})),n.d(t,"__classPrivateFieldSet",(function(){return E}));
2/*! *****************************************************************************
3Copyright (c) Microsoft Corporation.
4
5Permission to use, copy, modify, and/or distribute this software for any
6purpose with or without fee is hereby granted.
7
8THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14PERFORMANCE OF THIS SOFTWARE.
15***************************************************************************** */
16var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function o(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i=function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function s(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function u(e,t){return function(n,r){t(n,r,e)}}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function d(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function f(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}function p(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||(t[n]=e[n])}function h(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function m(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(v(arguments[t]));return e}function g(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r}function y(e){return this instanceof y?(this.v=e,this):new y(e)}function b(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=n.apply(e,t||[]),i=[];return r={},a("next"),a("throw"),a("return"),r[Symbol.asyncIterator]=function(){return this},r;function a(e){o[e]&&(r[e]=function(t){return new Promise((function(n,r){i.push([e,t,n,r])>1||s(e,t)}))})}function s(e,t){try{(n=o[e](t)).value instanceof y?Promise.resolve(n.value.v).then(u,c):l(i[0][2],n)}catch(e){l(i[0][3],e)}var n}function u(e){s("next",e)}function c(e){s("throw",e)}function l(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function w(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,o){t[r]=e[r]?function(t){return(n=!n)?{value:y(e[r](t)),done:"return"===r}:o?o(t):t}:o}}function _(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=h(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,o,(t=e[n](t)).done,t.value)}))}}}function S(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function x(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function O(e){return e&&e.__esModule?e:{default:e}}function A(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function E(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}},function(t,n){t.exports=e},function(e,t,n){"use strict";n.r(t),n.d(t,"locateWindow",(function(){return o}));var r={};function o(){return"undefined"!=typeof window?window:"undefined"!=typeof self?self:r}},function(e){e.exports=JSON.parse('{"name":"@aws-sdk/client-lex-runtime-service","description":"AWS SDK for JavaScript Lex Runtime Service Client for Node.js, Browser and React Native","version":"1.0.0-rc.4","scripts":{"clean":"npm run remove-definitions && npm run remove-dist","build-documentation":"npm run clean && typedoc ./","prepublishOnly":"yarn build","pretest":"yarn build:cjs","remove-definitions":"rimraf ./types","remove-dist":"rimraf ./dist","remove-documentation":"rimraf ./docs","test:unit":"mocha **/cjs/**/*.spec.js","test":"yarn test:unit","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig.es.json","build":"yarn build:cjs && yarn build:es"},"main":"./dist/cjs/index.js","types":"./types/index.d.ts","module":"./dist/es/index.js","browser":{"./runtimeConfig":"./runtimeConfig.browser"},"react-native":{"./runtimeConfig":"./runtimeConfig.native"},"sideEffects":false,"dependencies":{"@aws-crypto/sha256-browser":"^1.0.0","@aws-crypto/sha256-js":"^1.0.0","@aws-sdk/config-resolver":"1.0.0-rc.3","@aws-sdk/credential-provider-node":"1.0.0-rc.3","@aws-sdk/fetch-http-handler":"1.0.0-rc.3","@aws-sdk/hash-node":"1.0.0-rc.3","@aws-sdk/invalid-dependency":"1.0.0-rc.3","@aws-sdk/middleware-content-length":"1.0.0-rc.3","@aws-sdk/middleware-host-header":"1.0.0-rc.3","@aws-sdk/middleware-logger":"1.0.0-rc.4","@aws-sdk/middleware-retry":"1.0.0-rc.4","@aws-sdk/middleware-serde":"1.0.0-rc.3","@aws-sdk/middleware-signing":"1.0.0-rc.3","@aws-sdk/middleware-stack":"1.0.0-rc.4","@aws-sdk/middleware-user-agent":"1.0.0-rc.3","@aws-sdk/node-config-provider":"1.0.0-rc.3","@aws-sdk/node-http-handler":"1.0.0-rc.3","@aws-sdk/protocol-http":"1.0.0-rc.3","@aws-sdk/smithy-client":"1.0.0-rc.4","@aws-sdk/types":"1.0.0-rc.3","@aws-sdk/url-parser-browser":"1.0.0-rc.3","@aws-sdk/url-parser-node":"1.0.0-rc.3","@aws-sdk/util-base64-browser":"1.0.0-rc.3","@aws-sdk/util-base64-node":"1.0.0-rc.3","@aws-sdk/util-body-length-browser":"1.0.0-rc.3","@aws-sdk/util-body-length-node":"1.0.0-rc.3","@aws-sdk/util-user-agent-browser":"1.0.0-rc.3","@aws-sdk/util-user-agent-node":"1.0.0-rc.3","@aws-sdk/util-utf8-browser":"1.0.0-rc.3","@aws-sdk/util-utf8-node":"1.0.0-rc.3","tslib":"^2.0.0"},"devDependencies":{"@aws-sdk/client-documentation-generator":"1.0.0-rc.3","@types/chai":"^4.2.11","@types/mocha":"^7.0.2","@types/node":"^12.7.5","jest":"^26.1.0","rimraf":"^3.0.0","typedoc":"^0.17.8","typescript":"~4.0.2"},"engines":{"node":">=10.0.0"},"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","homepage":"https://github.com/aws/aws-sdk-js-v3/tree/master/clients/client-lex-runtime-service","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"clients/client-lex-runtime-service"}}')},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var o=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),o[t]=e>>>((3&t)<<3)&255;return o}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,o=n;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]]].join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(7),o=n(8),i=n(11),a=n(2),s=function(){function e(e){e?(this.operation=function(e){return new Promise((function(t,n){var r=a.locateWindow().msCrypto.subtle.importKey("raw",u(e),o.SHA_256_HMAC_ALGO,!1,["sign"]);r.oncomplete=function(){r.result&&t(r.result),n("ImportKey completed without importing key.")},r.onerror=function(){n("ImportKey failed to import key.")}}))}(e).then((function(e){return a.locateWindow().msCrypto.subtle.sign(o.SHA_256_HMAC_ALGO,e)})),this.operation.catch((function(){}))):this.operation=Promise.resolve(a.locateWindow().msCrypto.subtle.digest("SHA-256"))}return e.prototype.update=function(e){var t=this;r.isEmptyData(e)||(this.operation=this.operation.then((function(n){return n.onerror=function(){t.operation=Promise.reject(new Error("Error encountered updating hash"))},n.process(u(e)),n})),this.operation.catch((function(){})))},e.prototype.digest=function(){return this.operation.then((function(e){return new Promise((function(t,n){e.onerror=function(){n("Error encountered finalizing hash")},e.oncomplete=function(){e.result&&t(new Uint8Array(e.result)),n("Error encountered finalizing hash")},e.finish()}))}))},e}();function u(e){return"string"==typeof e?i.fromUtf8(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.Sha256=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyData=void 0,t.isEmptyData=function(e){return"string"==typeof e?0===e.length:0===e.byteLength}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EMPTY_DATA_SHA_256=t.SHA_256_HMAC_ALGO=t.SHA_256_HASH=void 0,t.SHA_256_HASH={name:"SHA-256"},t.SHA_256_HMAC_ALGO={name:"HMAC",hash:t.SHA_256_HASH},t.EMPTY_DATA_SHA_256=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(11),o=n(7),i=n(8),a=n(2),s=function(){function e(e){this.toHash=new Uint8Array(0),void 0!==e&&(this.key=new Promise((function(t,n){a.locateWindow().crypto.subtle.importKey("raw",u(e),i.SHA_256_HMAC_ALGO,!1,["sign"]).then(t,n)})),this.key.catch((function(){})))}return e.prototype.update=function(e){if(!o.isEmptyData(e)){var t=u(e),n=new Uint8Array(this.toHash.byteLength+t.byteLength);n.set(this.toHash,0),n.set(t,this.toHash.byteLength),this.toHash=n}},e.prototype.digest=function(){var e=this;return this.key?this.key.then((function(t){return a.locateWindow().crypto.subtle.sign(i.SHA_256_HMAC_ALGO,t,e.toHash).then((function(e){return new Uint8Array(e)}))})):o.isEmptyData(this.toHash)?Promise.resolve(i.EMPTY_DATA_SHA_256):Promise.resolve().then((function(){return a.locateWindow().crypto.subtle.digest(i.SHA_256_HASH,e.toHash)})).then((function(e){return Promise.resolve(new Uint8Array(e))}))},e}();function u(e){return"string"==typeof e?r.fromUtf8(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.Sha256=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MAX_HASHABLE_LENGTH=t.INIT=t.KEY=t.DIGEST_LENGTH=t.BLOCK_SIZE=void 0,t.BLOCK_SIZE=64,t.DIGEST_LENGTH=32,t.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),t.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1},function(e,t,n){"use strict";n.r(t),n.d(t,"fromUtf8",(function(){return r})),n.d(t,"toUtf8",(function(){return o}));var r=function(e){return"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e.charCodeAt(n);if(o<128)t.push(o);else if(o<2048)t.push(o>>6|192,63&o|128);else if(n+1<e.length&&55296==(64512&o)&&56320==(64512&e.charCodeAt(n+1))){var i=65536+((1023&o)<<10)+(1023&e.charCodeAt(++n));t.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}else t.push(o>>12|224,o>>6&63|128,63&o|128)}return Uint8Array.from(t)}(e)},o=function(e){return"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):function(e){for(var t="",n=0,r=e.length;n<r;n++){var o=e[n];if(o<128)t+=String.fromCharCode(o);else if(192<=o&&o<224){var i=e[++n];t+=String.fromCharCode((31&o)<<6|63&i)}else if(240<=o&&o<365){var a="%"+[o,e[++n],e[++n],e[++n]].map((function(e){return e.toString(16)})).join("%");t+=decodeURIComponent(a)}else t+=String.fromCharCode((15&o)<<12|(63&e[++n])<<6|63&e[++n])}return t}(e)}},function(e,t,n){var r=n(14),o=n(15),i=o;i.v1=r,i.v4=o,e.exports=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(0).__exportStar(n(16),t);var r=n(6);Object.defineProperty(t,"Ie11Sha256",{enumerable:!0,get:function(){return r.Sha256}});var o=n(9);Object.defineProperty(t,"WebCryptoSha256",{enumerable:!0,get:function(){return o.Sha256}})},function(e,t,n){var r,o,i=n(4),a=n(5),s=0,u=0;e.exports=function(e,t,n){var c=t&&n||0,l=t||[],d=(e=e||{}).node||r,f=void 0!==e.clockseq?e.clockseq:o;if(null==d||null==f){var p=i();null==d&&(d=r=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==f&&(f=o=16383&(p[6]<<8|p[7]))}var h=void 0!==e.msecs?e.msecs:(new Date).getTime(),v=void 0!==e.nsecs?e.nsecs:u+1,m=h-s+(v-u)/1e4;if(m<0&&void 0===e.clockseq&&(f=f+1&16383),(m<0||h>s)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");s=h,u=v,o=f;var g=(1e4*(268435455&(h+=122192928e5))+v)%4294967296;l[c++]=g>>>24&255,l[c++]=g>>>16&255,l[c++]=g>>>8&255,l[c++]=255&g;var y=h/4294967296*1e4&268435455;l[c++]=y>>>8&255,l[c++]=255&y,l[c++]=y>>>24&15|16,l[c++]=y>>>16&255,l[c++]=f>>>8|128,l[c++]=255&f;for(var b=0;b<6;++b)l[c+b]=d[b];return t||a(l)}},function(e,t,n){var r=n(4),o=n(5);e.exports=function(e,t,n){var i=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var a=(e=e||{}).random||(e.rng||r)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t)for(var s=0;s<16;++s)t[i+s]=a[s];return t||o(a)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(6),o=n(9),i=n(17),a=n(20),s=n(22),u=n(2),c=function(){function e(e){a.supportsWebCrypto(u.locateWindow())?this.hash=new o.Sha256(e):s.isMsWindow(u.locateWindow())?this.hash=new r.Sha256(e):this.hash=new i.Sha256(e)}return e.prototype.update=function(e,t){this.hash.update(e,t)},e.prototype.digest=function(){return this.hash.digest()},e}();t.Sha256=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(0).__exportStar(n(18),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(0),o=n(10),i=n(19),a=n(29),s=function(){function e(e){if(this.hash=new i.RawSha256,e){this.outer=new i.RawSha256;var t=function(e){var t=u(e);if(t.byteLength>o.BLOCK_SIZE){var n=new i.RawSha256;n.update(t),t=n.digest()}var r=new Uint8Array(o.BLOCK_SIZE);return r.set(t),r}(e),n=new Uint8Array(o.BLOCK_SIZE);n.set(t);for(var r=0;r<o.BLOCK_SIZE;r++)t[r]^=54,n[r]^=92;this.hash.update(t),this.outer.update(n);for(r=0;r<t.byteLength;r++)t[r]=0}}return e.prototype.update=function(e){if(!function(e){if("string"==typeof e)return 0===e.length;return 0===e.byteLength}(e)&&!this.error)try{this.hash.update(u(e))}catch(e){this.error=e}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.digestSync()]}))}))},e}();function u(e){return"string"==typeof e?a.fromUtf8(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.Sha256=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RawSha256=void 0;var r=n(10),o=function(){function e(){this.state=Int32Array.from(r.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,n=e.byteLength;if(this.bytesHashed+=n,8*this.bytesHashed>r.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[t++],n--,this.bufferLength===r.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(t.setUint8(this.bufferLength++,128),n%r.BLOCK_SIZE>=r.BLOCK_SIZE-8){for(var o=this.bufferLength;o<r.BLOCK_SIZE;o++)t.setUint8(o,0);this.hashBuffer(),this.bufferLength=0}for(o=this.bufferLength;o<r.BLOCK_SIZE-8;o++)t.setUint8(o,0);t.setUint32(r.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),t.setUint32(r.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}var i=new Uint8Array(r.DIGEST_LENGTH);for(o=0;o<8;o++)i[4*o]=this.state[o]>>>24&255,i[4*o+1]=this.state[o]>>>16&255,i[4*o+2]=this.state[o]>>>8&255,i[4*o+3]=this.state[o]>>>0&255;return i},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,n=t[0],o=t[1],i=t[2],a=t[3],s=t[4],u=t[5],c=t[6],l=t[7],d=0;d<r.BLOCK_SIZE;d++){if(d<16)this.temp[d]=(255&e[4*d])<<24|(255&e[4*d+1])<<16|(255&e[4*d+2])<<8|255&e[4*d+3];else{var f=this.temp[d-2],p=(f>>>17|f<<15)^(f>>>19|f<<13)^f>>>10,h=((f=this.temp[d-15])>>>7|f<<25)^(f>>>18|f<<14)^f>>>3;this.temp[d]=(p+this.temp[d-7]|0)+(h+this.temp[d-16]|0)}var v=(((s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7))+(s&u^~s&c)|0)+(l+(r.KEY[d]+this.temp[d]|0)|0)|0,m=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&o^n&i^o&i)|0;l=c,c=u,u=s,s=a+v|0,a=i,i=o,o=n,n=v+m|0}t[0]+=n,t[1]+=o,t[2]+=i,t[3]+=a,t[4]+=s,t[5]+=u,t[6]+=c,t[7]+=l},e}();t.RawSha256=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(0).__exportStar(n(21),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.supportsZeroByteGCM=t.supportsSubtleCrypto=t.supportsSecureRandom=t.supportsWebCrypto=void 0;var r=n(0),o=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function i(e){return"object"==typeof e&&"object"==typeof e.crypto&&"function"==typeof e.crypto.getRandomValues}function a(e){return e&&o.every((function(t){return"function"==typeof e[t]}))}t.supportsWebCrypto=function(e){return!(!i(e)||"object"!=typeof e.crypto.subtle)&&a(e.crypto.subtle)},t.supportsSecureRandom=i,t.supportsSubtleCrypto=a,t.supportsZeroByteGCM=function(e){return r.__awaiter(this,void 0,void 0,(function(){var t;return r.__generator(this,(function(n){switch(n.label){case 0:if(!a(e))return[2,!1];n.label=1;case 1:return n.trys.push([1,4,,5]),[4,e.generateKey({name:"AES-GCM",length:128},!1,["encrypt"])];case 2:return t=n.sent(),[4,e.encrypt({name:"AES-GCM",iv:new Uint8Array(Array(12)),additionalData:new Uint8Array(Array(16)),tagLength:128},t,new Uint8Array(0))];case 3:return[2,16===n.sent().byteLength];case 4:return n.sent(),[2,!1];case 5:return[2]}}))}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0);r.__exportStar(n(23),t),r.__exportStar(n(24),t),r.__exportStar(n(25),t),r.__exportStar(n(26),t),r.__exportStar(n(27),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isMsWindow=void 0;var r=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];t.isMsWindow=function(e){if(function(e){return"MSInputMethodContext"in e&&"msCrypto"in e}(e)&&void 0!==e.msCrypto.subtle){var t=e.msCrypto,n=t.getRandomValues,o=t.subtle;return r.map((function(e){return o[e]})).concat(n).every((function(e){return"function"==typeof e}))}return!1}},function(e,t,n){"use strict";n.r(t),n.d(t,"AWSLexProvider",(function(){return mn})),n.d(t,"Interactions",(function(){return _n}));var r=n(1),o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},i=new r.ConsoleLogger("AbstractInteractionsProvider"),a=function(){function e(e){void 0===e&&(e={}),this._config=e}return e.prototype.configure=function(e){return void 0===e&&(e={}),this._config=o(o({},this._config),e),i.debug("configure "+this.getProviderName(),this._config),this.options},e.prototype.getCategory=function(){return"Interactions"},Object.defineProperty(e.prototype,"options",{get:function(){return o({},this._config)},enumerable:!0,configurable:!0}),e}(),s=function(e,t){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function u(e,t){function n(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var c=function(){return(c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function l(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function d(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}Object.create;function f(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}Object.create;var p=n(3),h=n(13),v=n(0),m=function(){function e(e){this.statusCode=e.statusCode,this.headers=e.headers||{},this.body=e.body}return e.isInstance=function(e){if(!e)return!1;var t=e;return"number"==typeof t.statusCode&&"object"==typeof t.headers},e}(),g=function(){function e(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?":"!==e.protocol.substr(-1)?e.protocol+":":e.protocol:"https:",this.path=e.path?"/"!==e.path.charAt(0)?"/"+e.path:e.path:"/"}return e.isInstance=function(e){if(!e)return!1;var t=e;return"method"in t&&"protocol"in t&&"hostname"in t&&"path"in t&&"object"==typeof t.query&&"object"==typeof t.headers},e.prototype.clone=function(){var t,n=new e(Object(v.__assign)(Object(v.__assign)({},this),{headers:Object(v.__assign)({},this.headers)}));return n.query&&(n.query=(t=n.query,Object.keys(t).reduce((function(e,n){var r,o=t[n];return Object(v.__assign)(Object(v.__assign)({},e),((r={})[n]=Array.isArray(o)?Object(v.__spread)(o):o,r))}),{}))),n},e}();var y=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,b)},b=function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()};for(var w=function(){function e(e){void 0===e&&(e={}),this.httpOptions=e}return e.prototype.destroy=function(){},e.prototype.handle=function(e,t){var n=null==t?void 0:t.abortSignal,r=this.httpOptions.requestTimeout;if(null==n?void 0:n.aborted){var o=new Error("Request aborted");return o.name="AbortError",Promise.reject(o)}var i=e.path;if(e.query){var a=function(e){var t,n,r=[];try{for(var o=Object(v.__values)(Object.keys(e).sort()),i=o.next();!i.done;i=o.next()){var a=i.value,s=e[a];if(a=y(a),Array.isArray(s))for(var u=0,c=s.length;u<c;u++)r.push(a+"="+y(s[u]));else{var l=a;(s||"string"==typeof s)&&(l+="="+y(s)),r.push(l)}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return r.join("&")}(e.query);a&&(i+="?"+a)}var s=e.port,u=e.protocol+"//"+e.hostname+(s?":"+s:"")+i,c={body:e.body,headers:new Headers(e.headers),method:e.method};"undefined"!=typeof AbortController&&(c.signal=n);var l,d=new Request(u,c),f=[fetch(d).then((function(e){var t,n,r=e.headers,o={};try{for(var i=Object(v.__values)(r.entries()),a=i.next();!a.done;a=i.next()){var s=a.value;o[s[0]]=s[1]}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return void 0!==e.body?{response:new m({headers:o,statusCode:e.status,body:e.body})}:e.blob().then((function(t){return{response:new m({headers:o,statusCode:e.status,body:t})}}))})),(l=r,void 0===l&&(l=0),new Promise((function(e,t){l&&setTimeout((function(){var e=new Error("Request did not complete within "+l+" ms");e.name="TimeoutError",t(e)}),l)})))];return n&&f.push(new Promise((function(e,t){n.onabort=function(){var e=new Error("Request aborted");e.name="AbortError",t(e)}}))),Promise.race(f)},e}(),_={},S=new Array(64),x=0,O="A".charCodeAt(0),A="Z".charCodeAt(0);x+O<=A;x++){var E=String.fromCharCode(x+O);_[E]=x,S[x]=E}for(x=0,O="a".charCodeAt(0),A="z".charCodeAt(0);x+O<=A;x++){E=String.fromCharCode(x+O);var j=x+26;_[E]=j,S[j]=E}for(x=0;x<10;x++){_[x.toString(10)]=x+52;E=x.toString(10),j=x+52;_[E]=j,S[j]=E}_["+"]=62,S[62]="+",_["/"]=63,S[63]="/";function C(e){var t=e.length/4*3;"=="===e.substr(-2)?t-=2:"="===e.substr(-1)&&t--;for(var n=new ArrayBuffer(t),r=new DataView(n),o=0;o<e.length;o+=4){for(var i=0,a=0,s=o,u=o+3;s<=u;s++)"="!==e[s]?(i|=_[e[s]]<<6*(u-s),a+=6):i>>=6;var c=o/4*3;i>>=a%8;for(var l=Math.floor(a/8),d=0;d<l;d++){var f=8*(l-d-1);r.setUint8(c+d,(i&255<<f)>>f)}}return new Uint8Array(n)}function T(e){return new Promise((function(t,n){var r=new FileReader;r.onloadend=function(){var e;if(2!==r.readyState)return n(new Error("Reader aborted too early"));var o=null!==(e=r.result)&&void 0!==e?e:"",i=o.indexOf(","),a=i>-1?i+1:o.length;t(o.substring(a))},r.onabort=function(){return n(new Error("Read aborted"))},r.onerror=function(){return n(r.error)},r.readAsDataURL(e)}))}var L=function(e){return function(){throw new Error(e)}},P={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high"},I=function(e){return{applyToStack:function(t){t.add(function(e){return function(t){return function(n){return Object(v.__awaiter)(void 0,void 0,void 0,(function(){return Object(v.__generator)(this,(function(r){return[2,e.retryStrategy.retry(t,n)]}))}))}}}(e),P)}}},k=["AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch"],R=["Throttling","ThrottlingException","ThrottledException","RequestThrottledException","TooManyRequestsException","ProvisionedThroughputExceededException","TransactionInProgressException","RequestLimitExceeded","BandwidthLimitExceeded","LimitExceededException","RequestThrottled","SlowDown","PriorRequestNotComplete","EC2ThrottledException"],N=["AbortError","TimeoutError","RequestTimeout","RequestTimeoutException"],M=[500,502,503,504],z=function(e){var t;return R.includes(e.name)||1==(null===(t=e.$retryable)||void 0===t?void 0:t.throttling)},D=n(12),q=function(e,t){return Math.floor(Math.min(2e4,Math.random()*Math.pow(2,t)*e))},H=function(e){return!!e&&(function(e){return void 0!==e.$retryable}(e)||function(e){return k.includes(e.name)}(e)||z(e)||function(e){var t;return N.includes(e.name)||M.includes((null===(t=e.$metadata)||void 0===t?void 0:t.httpStatusCode)||0)}(e))},U=function(){function e(e,t){var n,r,o,i,a,s,u,c;this.maxAttemptsProvider=e,this.retryDecider=null!==(n=null==t?void 0:t.retryDecider)&&void 0!==n?n:H,this.delayDecider=null!==(r=null==t?void 0:t.delayDecider)&&void 0!==r?r:q,this.retryQuota=null!==(o=null==t?void 0:t.retryQuota)&&void 0!==o?o:(a=i=500,s=i,u=function(e){return"TimeoutError"===e.name?10:5},c=function(e){return u(e)<=s},Object.freeze({hasRetryTokens:c,retrieveRetryTokens:function(e){if(!c(e))throw new Error("No retry token available");var t=u(e);return s-=t,t},releaseRetryTokens:function(e){s+=null!=e?e:1,s=Math.min(s,a)}}))}return e.prototype.shouldRetry=function(e,t,n){return t<n&&this.retryDecider(e)&&this.retryQuota.hasRetryTokens(e)},e.prototype.getMaxAttempts=function(){return Object(v.__awaiter)(this,void 0,void 0,(function(){var e;return Object(v.__generator)(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.maxAttemptsProvider()];case 1:return e=t.sent(),[3,3];case 2:return t.sent(),e=3,[3,3];case 3:return[2,e]}}))}))},e.prototype.retry=function(e,t){return Object(v.__awaiter)(this,void 0,void 0,(function(){var n,r,o,i,a,s,u,c;return Object(v.__generator)(this,(function(l){switch(l.label){case 0:return r=0,o=0,[4,this.getMaxAttempts()];case 1:i=l.sent(),a=t.request,g.isInstance(a)&&(a.headers["amz-sdk-invocation-id"]=Object(D.v4)()),s=function(){var s,c,l,d,f;return Object(v.__generator)(this,(function(p){switch(p.label){case 0:return p.trys.push([0,2,,5]),g.isInstance(a)&&(a.headers["amz-sdk-request"]="attempt="+(r+1)+"; max="+i),[4,e(t)];case 1:return s=p.sent(),c=s.response,l=s.output,u.retryQuota.releaseRetryTokens(n),l.$metadata.attempts=r+1,l.$metadata.totalRetryDelay=o,[2,{value:{response:c,output:l}}];case 2:return d=p.sent(),r++,u.shouldRetry(d,r,i)?(n=u.retryQuota.retrieveRetryTokens(d),f=u.delayDecider(z(d)?500:100,r),o+=f,[4,new Promise((function(e){return setTimeout(e,f)}))]):[3,4];case 3:return p.sent(),[2,"continue"];case 4:throw d.$metadata||(d.$metadata={}),d.$metadata.attempts=r,d.$metadata.totalRetryDelay=o,d;case 5:return[2]}}))},u=this,l.label=2;case 2:return[5,s()];case 3:return"object"==typeof(c=l.sent())?[2,c.value]:[3,2];case 4:return[2]}}))}))},e}(),B=function(e){if(void 0===e&&(e=3),"number"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};var F,$,G=new Set(["ap-east-1","ap-northeast-1","ap-northeast-2","ap-south-1","ap-southeast-1","ap-southeast-2","ca-central-1","eu-central-1","eu-north-1","eu-west-1","eu-west-2","eu-west-3","me-south-1","sa-east-1","us-east-1","us-east-2","us-west-1","us-west-2"]),K=new Set(["cn-north-1","cn-northwest-1"]),W=new Set(["us-iso-east-1"]),V=new Set(["us-isob-east-1"]),Z=new Set(["us-gov-east-1","us-gov-west-1"]),Y=c(c({},{apiVersion:"2016-11-28",disableHostPrefix:!1,logger:{},regionInfoProvider:function(e,t){var n=void 0;switch(e){case"eu-west-1":n={hostname:"runtime.lex.eu-west-1.amazonaws.com",partition:"aws",signingService:"lex"};break;case"us-east-1":n={hostname:"runtime.lex.us-east-1.amazonaws.com",partition:"aws",signingService:"lex"};break;case"us-west-2":n={hostname:"runtime.lex.us-west-2.amazonaws.com",partition:"aws",signingService:"lex"};break;default:G.has(e)&&(n={hostname:"runtime.lex.{region}.amazonaws.com".replace("{region}",e),partition:"aws",signingService:"lex"}),K.has(e)&&(n={hostname:"runtime.lex.{region}.amazonaws.com.cn".replace("{region}",e),partition:"aws-cn"}),W.has(e)&&(n={hostname:"runtime.lex.{region}.c2s.ic.gov".replace("{region}",e),partition:"aws-iso"}),V.has(e)&&(n={hostname:"runtime.lex.{region}.sc2s.sgov.gov".replace("{region}",e),partition:"aws-iso-b"}),Z.has(e)&&(n={hostname:"runtime.lex.{region}.amazonaws.com".replace("{region}",e),partition:"aws-us-gov"}),void 0===n&&(n={hostname:"runtime.lex.{region}.amazonaws.com".replace("{region}",e),partition:"aws",signingService:"lex"})}return Promise.resolve(n)},signingName:"lex"}),{runtime:"browser",base64Decoder:C,base64Encoder:function(e){for(var t="",n=0;n<e.length;n+=3){for(var r=0,o=0,i=n,a=Math.min(n+3,e.length);i<a;i++)r|=e[i]<<8*(a-i-1),o+=8;var s=Math.ceil(o/6);r<<=6*s-o;for(var u=1;u<=s;u++){var c=6*(s-u);t+=S[(r&63<<c)>>c]}t+="==".slice(0,4-s)}return t},bodyLengthChecker:function(e){if("string"==typeof e){for(var t=e.length,n=t-1;n>=0;n--){var r=e.charCodeAt(n);r>127&&r<=2047?t++:r>2047&&r<=65535&&(t+=2)}return t}return"number"==typeof e.byteLength?e.byteLength:"number"==typeof e.size?e.size:void 0},credentialDefaultProvider:L("Credential is missing"),defaultUserAgent:(F=p.name,$=p.version,"aws-sdk-js-v3-"+F+"/"+$+" "+("undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:"")),maxAttempts:3,region:L("Region is missing"),requestHandler:new w,sha256:h.Sha256,streamCollector:function(e){return"function"==typeof Blob&&e instanceof Blob?function(e){return Object(v.__awaiter)(this,void 0,void 0,(function(){var t,n;return Object(v.__generator)(this,(function(r){switch(r.label){case 0:return[4,T(e)];case 1:return t=r.sent(),n=C(t),[2,new Uint8Array(n)]}}))}))}(e):function(e){return Object(v.__awaiter)(this,void 0,void 0,(function(){var t,n,r,o,i,a,s;return Object(v.__generator)(this,(function(u){switch(u.label){case 0:t=new Uint8Array(0),n=e.getReader(),r=!1,u.label=1;case 1:return r?[3,3]:[4,n.read()];case 2:return o=u.sent(),i=o.done,(a=o.value)&&(s=t,(t=new Uint8Array(s.length+a.length)).set(s),t.set(a,s.length)),r=i,[3,1];case 3:return[2,t]}}))}))}(e)},urlParser:function(e){var t,n=new URL(e),r=n.hostname,o=n.pathname,i=n.port,a=n.protocol,s=n.search;return s&&(t=function(e){var t,n,r={};if(e=e.replace(/^\?/,""))try{for(var o=Object(v.__values)(e.split("&")),i=o.next();!i.done;i=o.next()){var a=i.value,s=Object(v.__read)(a.split("="),2),u=s[0],c=s[1],l=void 0===c?null:c;u=decodeURIComponent(u),l&&(l=decodeURIComponent(l)),u in r?Array.isArray(r[u])?r[u].push(l):r[u]=[r[u],l]:r[u]=l}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return r}(s)),{hostname:r,port:i?parseInt(i):void 0,protocol:a,path:o,query:t}},utf8Decoder:function(e){return"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e.charCodeAt(n);if(o<128)t.push(o);else if(o<2048)t.push(o>>6|192,63&o|128);else if(n+1<e.length&&55296==(64512&o)&&56320==(64512&e.charCodeAt(n+1))){var i=65536+((1023&o)<<10)+(1023&e.charCodeAt(++n));t.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}else t.push(o>>12|224,o>>6&63|128,63&o|128)}return Uint8Array.from(t)}(e)},utf8Encoder:function(e){return"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):function(e){for(var t="",n=0,r=e.length;n<r;n++){var o=e[n];if(o<128)t+=String.fromCharCode(o);else if(192<=o&&o<224){var i=e[++n];t+=String.fromCharCode((31&o)<<6|63&i)}else if(240<=o&&o<365){var a="%"+[o,e[++n],e[++n],e[++n]].map((function(e){return e.toString(16)})).join("%");t+=decodeURIComponent(a)}else t+=String.fromCharCode((15&o)<<12|(63&e[++n])<<6|63&e[++n])}return t}(e)}}),X=function(e){var t=e.endpoint,n=e.urlParser;if("string"==typeof t){var r=Promise.resolve(n(t));return function(){return r}}if("object"==typeof t){var o=Promise.resolve(t);return function(){return o}}return t},J=function(e){return Object(v.__awaiter)(void 0,void 0,void 0,(function(){var t,n,r,o,i;return Object(v.__generator)(this,(function(a){switch(a.label){case 0:return t=e.tls,n=void 0===t||t,[4,e.region()];case 1:if(r=a.sent(),!new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/).test(r))throw new Error("Invalid region in client config");return[4,e.regionInfoProvider(r)];case 2:if(!(o=(null!==(i=a.sent())&&void 0!==i?i:{}).hostname))throw new Error("Cannot resolve hostname from client config");return[2,e.urlParser((n?"https:":"http:")+"//"+o)]}}))}))},Q=function(e){if("string"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};var ee={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware"},te=function(e){return{applyToStack:function(t){t.add(function(e){var t=this;return function(n){return function(r){return Object(v.__awaiter)(t,void 0,void 0,(function(){var t,o,i,a,s;return Object(v.__generator)(this,(function(u){return t=r.request,g.isInstance(t)&&(o=t.body,i=t.headers,o&&-1===Object.keys(i).map((function(e){return e.toLowerCase()})).indexOf("content-length")&&void 0!==(a=e(o))&&(t.headers=Object(v.__assign)(Object(v.__assign)({},t.headers),((s={})["content-length"]=String(a),s)))),[2,n(Object(v.__assign)(Object(v.__assign)({},r),{request:t}))]}))}))}}}(e.bodyLengthChecker),ee)}}};var ne={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"]},re=function(e){return{applyToStack:function(t){t.add(function(e){return function(t){return function(n){return Object(v.__awaiter)(void 0,void 0,void 0,(function(){var r,o;return Object(v.__generator)(this,(function(i){return g.isInstance(n.request)?(r=n.request,o=(e.requestHandler.metadata||{}).handlerProtocol,(void 0===o?"":o).indexOf("h2")>=0&&!r.headers[":authority"]?(delete r.headers.host,r.headers[":authority"]=""):r.headers.host||(r.headers.host=r.hostname),[2,t(n)]):[2,t(n)]}))}))}}}(e),ne)}}},oe={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize"},ie=function(e){return{applyToStack:function(e){e.add((function(e,t){return function(n){return Object(v.__awaiter)(void 0,void 0,void 0,(function(){var r,o,i,a;return Object(v.__generator)(this,(function(s){switch(s.label){case 0:return r=t.logger,[4,e(n)];case 1:return o=s.sent(),r?(i=o.response,"function"==typeof r.info&&r.info({metadata:{statusCode:i.statusCode,requestId:null!==(a=i.headers["x-amzn-requestid"])&&void 0!==a?a:i.headers["x-amzn-request-id"],extendedRequestId:i.headers["x-amz-id-2"],cfId:i.headers["x-amz-cf-id"]}}),[2,o]):[2,o]}}))}))}}),oe)}}},ae="X-Amz-Date".toLowerCase(),se=["authorization",ae,"date"],ue="X-Amz-Signature".toLowerCase(),ce="X-Amz-Security-Token".toLowerCase(),le={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},de=/^proxy-/,fe=/^sec-/,pe="AWS4-HMAC-SHA256-PAYLOAD",he={},ve=[];function me(e,t,n){return e+"/"+t+"/"+n+"/aws4_request"}for(var ge={},ye={},be=0;be<256;be++){var we=be.toString(16).toLowerCase();1===we.length&&(we="0"+we),ge[be]=we,ye[we]=be}function _e(e){for(var t="",n=0;n<e.byteLength;n++)t+=ge[e[n]];return t}function Se(e,t,n){var r,o,i=e.headers,a={};try{for(var s=Object(v.__values)(Object.keys(i).sort()),u=s.next();!u.done;u=s.next()){var c=u.value,l=c.toLowerCase();(l in le||(null==t?void 0:t.has(l))||de.test(l)||fe.test(l))&&(!n||n&&!n.has(l))||(a[l]=i[c].trim().replace(/\s+/g," "))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}return a}function xe(e,t){var n=e.headers,r=e.body;return Object(v.__awaiter)(this,void 0,void 0,(function(){var e,o,i,a,s,u,c;return Object(v.__generator)(this,(function(l){switch(l.label){case 0:try{for(e=Object(v.__values)(Object.keys(n)),o=e.next();!o.done;o=e.next())if("x-amz-content-sha256"===(i=o.value).toLowerCase())return[2,n[i]]}catch(e){u={error:e}}finally{try{o&&!o.done&&(c=e.return)&&c.call(e)}finally{if(u)throw u.error}}return null!=r?[3,1]:[2,"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"];case 1:return"string"==typeof r||ArrayBuffer.isView(r)||(d=r,"function"==typeof ArrayBuffer&&d instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(d))?((a=new t).update(r),s=_e,[4,a.digest()]):[3,3];case 2:return[2,s.apply(void 0,[l.sent()])];case 3:return[2,"UNSIGNED-PAYLOAD"]}var d}))}))}function Oe(e){var t=e.headers,n=e.query,r=Object(v.__rest)(e,["headers","query"]);return Object(v.__assign)(Object(v.__assign)({},r),{headers:Object(v.__assign)({},t),query:n?Ae(n):void 0})}function Ae(e){return Object.keys(e).reduce((function(t,n){var r,o=e[n];return Object(v.__assign)(Object(v.__assign)({},t),((r={})[n]=Array.isArray(o)?Object(v.__spread)(o):o,r))}),{})}function Ee(e){var t,n;e="function"==typeof e.clone?e.clone():Oe(e);try{for(var r=Object(v.__values)(Object.keys(e.headers)),o=r.next();!o.done;o=r.next()){var i=o.value;se.indexOf(i.toLowerCase())>-1&&delete e.headers[i]}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}return e}function je(e){return function(e){if("number"==typeof e)return new Date(1e3*e);if("string"==typeof e)return Number(e)?new Date(1e3*Number(e)):new Date(e);return e}(e).toISOString().replace(/\.\d{3}Z$/,"Z")}var Ce=function(){function e(e){var t=e.applyChecksum,n=e.credentials,r=e.region,o=e.service,i=e.sha256,a=e.uriEscapePath,s=void 0===a||a;this.service=o,this.sha256=i,this.uriEscapePath=s,this.applyChecksum="boolean"!=typeof t||t,this.regionProvider=Pe(r),this.credentialProvider=Ie(n)}return e.prototype.presign=function(e,t){return void 0===t&&(t={}),Object(v.__awaiter)(this,void 0,void 0,(function(){var n,r,o,i,a,s,u,c,l,d,f,p,h,m,g,y,b,w,_,S,x,O,A;return Object(v.__generator)(this,(function(E){switch(E.label){case 0:return n=t.signingDate,r=void 0===n?new Date:n,o=t.expiresIn,i=void 0===o?3600:o,a=t.unsignableHeaders,s=t.signableHeaders,u=t.signingRegion,c=t.signingService,[4,this.credentialProvider()];case 1:return l=E.sent(),null==u?[3,2]:(f=u,[3,4]);case 2:return[4,this.regionProvider()];case 3:f=E.sent(),E.label=4;case 4:return d=f,p=Te(r),h=p.longDate,m=p.shortDate,i>604800?[2,Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future")]:(g=me(m,d,null!=c?c:this.service),y=function(e){var t,n,r="function"==typeof e.clone?e.clone():Oe(e),o=r.headers,i=r.query,a=void 0===i?{}:i;try{for(var s=Object(v.__values)(Object.keys(o)),u=s.next();!u.done;u=s.next()){var c=u.value;"x-amz-"===c.toLowerCase().substr(0,6)&&(a[c]=o[c],delete o[c])}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return Object(v.__assign)(Object(v.__assign)({},e),{headers:o,query:a})}(Ee(e)),l.sessionToken&&(y.query["X-Amz-Security-Token"]=l.sessionToken),y.query["X-Amz-Algorithm"]="AWS4-HMAC-SHA256",y.query["X-Amz-Credential"]=l.accessKeyId+"/"+g,y.query["X-Amz-Date"]=h,y.query["X-Amz-Expires"]=i.toString(10),b=Se(y,a,s),y.query["X-Amz-SignedHeaders"]=Le(b),w=y.query,_="X-Amz-Signature",S=this.getSignature,x=[h,g,this.getSigningKey(l,d,m,c)],O=this.createCanonicalRequest,A=[y,b],[4,xe(e,this.sha256)]);case 5:return[4,S.apply(this,x.concat([O.apply(this,A.concat([E.sent()]))]))];case 6:return w[_]=E.sent(),[2,y]}}))}))},e.prototype.sign=function(e,t){return Object(v.__awaiter)(this,void 0,void 0,(function(){return Object(v.__generator)(this,(function(n){return"string"==typeof e?[2,this.signString(e,t)]:e.headers&&e.payload?[2,this.signEvent(e,t)]:[2,this.signRequest(e,t)]}))}))},e.prototype.signEvent=function(e,t){var n=e.headers,r=e.payload,o=t.signingDate,i=void 0===o?new Date:o,a=t.priorSignature,s=t.signingRegion,u=t.signingService;return Object(v.__awaiter)(this,void 0,void 0,(function(){var e,t,o,c,l,d,f,p,h,m,g;return Object(v.__generator)(this,(function(v){switch(v.label){case 0:return null==s?[3,1]:(t=s,[3,3]);case 1:return[4,this.regionProvider()];case 2:t=v.sent(),v.label=3;case 3:return e=t,o=Te(i),c=o.shortDate,l=o.longDate,d=me(c,e,null!=u?u:this.service),[4,xe({headers:{},body:r},this.sha256)];case 4:return f=v.sent(),(p=new this.sha256).update(n),m=_e,[4,p.digest()];case 5:return h=m.apply(void 0,[v.sent()]),g=[pe,l,d,a,h,f].join("\n"),[2,this.signString(g,{signingDate:i,signingRegion:e,signingService:u})]}}))}))},e.prototype.signString=function(e,t){var n=void 0===t?{}:t,r=n.signingDate,o=void 0===r?new Date:r,i=n.signingRegion,a=n.signingService;return Object(v.__awaiter)(this,void 0,void 0,(function(){var t,n,r,s,u,c,l,d;return Object(v.__generator)(this,(function(f){switch(f.label){case 0:return[4,this.credentialProvider()];case 1:return t=f.sent(),null==i?[3,2]:(r=i,[3,4]);case 2:return[4,this.regionProvider()];case 3:r=f.sent(),f.label=4;case 4:return n=r,s=Te(o).shortDate,l=(c=this.sha256).bind,[4,this.getSigningKey(t,n,s,a)];case 5:return(u=new(l.apply(c,[void 0,f.sent()]))).update(e),d=_e,[4,u.digest()];case 6:return[2,d.apply(void 0,[f.sent()])]}}))}))},e.prototype.signRequest=function(e,t){var n=void 0===t?{}:t,r=n.signingDate,o=void 0===r?new Date:r,i=n.signableHeaders,a=n.unsignableHeaders,s=n.signingRegion,u=n.signingService;return Object(v.__awaiter)(this,void 0,void 0,(function(){var t,n,r,c,l,d,f,p,h,m,g;return Object(v.__generator)(this,(function(y){switch(y.label){case 0:return[4,this.credentialProvider()];case 1:return t=y.sent(),null==s?[3,2]:(r=s,[3,4]);case 2:return[4,this.regionProvider()];case 3:r=y.sent(),y.label=4;case 4:return n=r,c=Ee(e),l=Te(o),d=l.longDate,f=l.shortDate,p=me(f,n,null!=u?u:this.service),c.headers[ae]=d,t.sessionToken&&(c.headers[ce]=t.sessionToken),[4,xe(c,this.sha256)];case 5:return h=y.sent(),!function(e,t){var n,r;e=e.toLowerCase();try{for(var o=Object(v.__values)(Object.keys(t)),i=o.next();!i.done;i=o.next()){if(e===i.value.toLowerCase())return!0}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1}("x-amz-content-sha256",c.headers)&&this.applyChecksum&&(c.headers["x-amz-content-sha256"]=h),m=Se(c,a,i),[4,this.getSignature(d,p,this.getSigningKey(t,n,f,u),this.createCanonicalRequest(c,m,h))];case 6:return g=y.sent(),c.headers.authorization="AWS4-HMAC-SHA256 Credential="+t.accessKeyId+"/"+p+", SignedHeaders="+Le(m)+", Signature="+g,[2,c]}}))}))},e.prototype.createCanonicalRequest=function(e,t,n){var r=Object.keys(t).sort();return e.method+"\n"+this.getCanonicalPath(e)+"\n"+function(e){var t,n,r=e.query,o=void 0===r?{}:r,i=[],a={},s=function(e){if(e.toLowerCase()===ue)return"continue";i.push(e);var t=o[e];"string"==typeof t?a[e]=y(e)+"="+y(t):Array.isArray(t)&&(a[e]=t.slice(0).sort().reduce((function(t,n){return t.concat([y(e)+"="+y(n)])}),[]).join("&"))};try{for(var u=Object(v.__values)(Object.keys(o).sort()),c=u.next();!c.done;c=u.next()){s(c.value)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}return i.map((function(e){return a[e]})).filter((function(e){return e})).join("&")}(e)+"\n"+r.map((function(e){return e+":"+t[e]})).join("\n")+"\n\n"+r.join(";")+"\n"+n},e.prototype.createStringToSign=function(e,t,n){return Object(v.__awaiter)(this,void 0,void 0,(function(){var r,o;return Object(v.__generator)(this,(function(i){switch(i.label){case 0:return(r=new this.sha256).update(n),[4,r.digest()];case 1:return o=i.sent(),[2,"AWS4-HMAC-SHA256\n"+e+"\n"+t+"\n"+_e(o)]}}))}))},e.prototype.getCanonicalPath=function(e){var t=e.path;return this.uriEscapePath?"/"+encodeURIComponent(t.replace(/^\//,"")).replace(/%2F/g,"/"):t},e.prototype.getSignature=function(e,t,n,r){return Object(v.__awaiter)(this,void 0,void 0,(function(){var o,i,a,s,u;return Object(v.__generator)(this,(function(c){switch(c.label){case 0:return[4,this.createStringToSign(e,t,r)];case 1:return o=c.sent(),s=(a=this.sha256).bind,[4,n];case 2:return(i=new(s.apply(a,[void 0,c.sent()]))).update(o),u=_e,[4,i.digest()];case 3:return[2,u.apply(void 0,[c.sent()])]}}))}))},e.prototype.getSigningKey=function(e,t,n,r){return function(e,t,n,r,o){var i=n+":"+r+":"+o+":"+t.accessKeyId+":"+t.sessionToken;if(i in he)return he[i];for(ve.push(i);ve.length>50;)delete he[ve.shift()];return he[i]=new Promise((function(a,s){var u,c,l=Promise.resolve("AWS4"+t.secretAccessKey),d=function(t){(l=l.then((function(n){return r=t,(o=new e(n)).update(r),o.digest();var r,o}))).catch((function(){}))};try{for(var f=Object(v.__values)([n,r,o,"aws4_request"]),p=f.next();!p.done;p=f.next()){d(p.value)}}catch(e){u={error:e}}finally{try{p&&!p.done&&(c=f.return)&&c.call(f)}finally{if(u)throw u.error}}l.then(a,(function(e){delete he[i],s(e)}))}))}(this.sha256,e,n,t,r||this.service)},e}(),Te=function(e){var t=je(e).replace(/[\-:]/g,"");return{longDate:t,shortDate:t.substr(0,8)}},Le=function(e){return Object.keys(e).sort().join(";")},Pe=function(e){if("string"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e},Ie=function(e){if("object"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};function ke(e){if("object"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e}var Re=function(e){return new Date(Date.now()+e)};function Ne(e){return function(t,n){return function(r){return Object(v.__awaiter)(this,void 0,void 0,(function(){var o,i,a,s,u,c,l,d,f;return Object(v.__generator)(this,(function(p){switch(p.label){case 0:return g.isInstance(r.request)?"function"!=typeof e.signer?[3,2]:[4,e.signer()]:[2,t(r)];case 1:return i=p.sent(),[3,3];case 2:i=e.signer,p.label=3;case 3:return o=i,s=t,u=[Object(v.__assign)({},r)],f={},[4,o.sign(r.request,{signingDate:new Date(Date.now()+e.systemClockOffset),signingRegion:n.signing_region,signingService:n.signing_service})];case 4:return[4,s.apply(void 0,[v.__assign.apply(void 0,u.concat([(f.request=p.sent(),f)]))])];case 5:return a=p.sent(),c=a.response.headers,(l=c&&(c.date||c.Date))&&(d=Date.parse(l),h=d,m=e.systemClockOffset,Math.abs(Re(m).getTime()-h)>=3e5&&(e.systemClockOffset=d-Date.now())),[2,a]}var h,m}))}))}}}var Me={name:"awsAuthMiddleware",tags:["SIGNATURE","AWSAUTH"],relation:"after",toMiddleware:"retryMiddleware"};var ze={name:"getUserAgentMiddleware",step:"build",tags:["SET_USER_AGENT","USER_AGENT"]},De=function(e){return{applyToStack:function(t){var n;t.add((n=e,function(e){return function(t){var r=t.request;if(!g.isInstance(r))return e(t);var o=r.headers,i="node"===n.runtime?"user-agent":"x-amz-user-agent";return o[i]?o[i]+=" "+n.defaultUserAgent:o[i]=""+n.defaultUserAgent,n.customUserAgent&&(o[i]+=" "+n.customUserAgent),e(Object(v.__assign)(Object(v.__assign)({},t),{request:r}))}}),ze)}}},qe=function(){var e=[],t=[],n=new Set,r=function(n){return e.forEach((function(e){n.add(e.middleware,Object(v.__assign)({},e))})),t.forEach((function(e){n.addRelativeTo(e.middleware,Object(v.__assign)({},e))})),n},o=function(e){var t=[];return e.before.forEach((function(e){0===e.before.length&&0===e.after.length?t.push(e):t.push.apply(t,Object(v.__spread)(o(e)))})),t.push(e),e.after.reverse().forEach((function(e){0===e.before.length&&0===e.after.length?t.push(e):t.push.apply(t,Object(v.__spread)(o(e)))})),t},i=function(){var n,r=[],i=[],a={};return e.forEach((function(e){var t=Object(v.__assign)(Object(v.__assign)({},e),{before:[],after:[]});t.name&&(a[t.name]=t),r.push(t)})),t.forEach((function(e){var t=Object(v.__assign)(Object(v.__assign)({},e),{before:[],after:[]});t.name&&(a[t.name]=t),i.push(t)})),i.forEach((function(e){if(e.toMiddleware){var t=a[e.toMiddleware];if(void 0===t)throw new Error(e.toMiddleware+" is not found when adding "+(e.name||"anonymous")+" middleware "+e.relation+" "+e.toMiddleware);"after"===e.relation&&t.after.push(e),"before"===e.relation&&t.before.push(e)}})),(n=r,n.sort((function(e,t){return He[t.step]-He[e.step]||Ue[t.priority||"normal"]-Ue[e.priority||"normal"]}))).map(o).reduce((function(e,t){return e.push.apply(e,Object(v.__spread)(t)),e}),[]).map((function(e){return e.middleware}))},a={add:function(t,r){void 0===r&&(r={});var o=r.name,i=Object(v.__assign)({step:"initialize",priority:"normal",middleware:t},r);if(o){if(n.has(o))throw new Error("Duplicate middleware name '"+o+"'");n.add(o)}e.push(i)},addRelativeTo:function(e,r){var o=r.name,i=Object(v.__assign)({middleware:e},r);if(o){if(n.has(o))throw new Error("Duplicated middleware name '"+o+"'");n.add(o)}t.push(i)},clone:function(){return r(qe())},use:function(e){e.applyToStack(a)},remove:function(r){return"string"==typeof r?function(r){var o=!1,i=function(e){return!e.name||e.name!==r||(o=!0,n.delete(r),!1)};return e=e.filter(i),t=t.filter(i),o}(r):function(r){var o=!1,i=function(e){return e.middleware!==r||(o=!0,e.name&&n.delete(e.name),!1)};return e=e.filter(i),t=t.filter(i),o}(r)},removeByTag:function(r){var o=!1,i=function(e){var t=e.tags,i=e.name;return!t||!t.includes(r)||(i&&n.delete(i),o=!0,!1)};return e=e.filter(i),t=t.filter(i),o},concat:function(e){var t=r(qe());return t.use(e),t},applyToStack:r,resolve:function(e,t){var n,r;try{for(var o=Object(v.__values)(i().reverse()),a=o.next();!a.done;a=o.next()){e=(0,a.value)(e,t)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return e}};return a},He={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},Ue={high:3,normal:2,low:1},Be=function(){function e(e){this.middlewareStack=qe(),this.config=e}return e.prototype.send=function(e,t,n){var r="function"!=typeof t?t:void 0,o="function"==typeof t?t:n,i=e.resolveMiddleware(this.middlewareStack,this.config,r);if(!o)return i(e).then((function(e){return e.output}));i(e).then((function(e){return o(null,e.output)}),(function(e){return o(e)})).catch((function(){}))},e.prototype.destroy=function(){this.config.requestHandler.destroy&&this.config.requestHandler.destroy()},e}(),Fe=function(){this.middlewareStack=qe()};function $e(e){return encodeURIComponent(e).replace(/[!'()*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16)}))}var Ge=function(){var e=Object.getPrototypeOf(this).constructor,t=Function.bind.apply(String,Object(v.__spread)([null],arguments)),n=new t;return Object.setPrototypeOf(n,e.prototype),n};Ge.prototype=Object.create(String.prototype,{constructor:{value:Ge,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf(Ge,String);var Ke=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(v.__extends)(t,e),t.prototype.deserializeJSON=function(){return JSON.parse(e.prototype.toString.call(this))},t.prototype.toJSON=function(){return e.prototype.toString.call(this)},t.fromObject=function(e){return e instanceof t?e:new t(e instanceof String||"string"==typeof e?e:JSON.stringify(e))},t}(Ge);var We,Ve,Ze,Ye,Xe,Je,Qe,et,tt,nt,rt,ot,it,at,st,ut,ct,lt,dt,ft,pt,ht,vt,mt,gt,yt,bt,wt,_t,St,xt,Ot,At,Et,jt,Ct="***SensitiveInformation***",Tt=function(e){function t(t){var n,r,o,i=this,a=function(e){if(!e.region)throw new Error("Region is missing");return Object(v.__assign)(Object(v.__assign)({},e),{region:Q(e.region)})}(c(c({},Y),t)),s=function(e){var t=B(e.maxAttempts);return Object(v.__assign)(Object(v.__assign)({},e),{maxAttempts:t,retryStrategy:e.retryStrategy||new U(t)})}(function(e){var t,n=this,r=ke(e.credentials||e.credentialDefaultProvider(e)),o=e.signingEscapePath,i=void 0===o||o,a=e.systemClockOffset,s=void 0===a?e.systemClockOffset||0:a,u=e.sha256;return t=e.signer?ke(e.signer):function(){return ke(e.region)().then((function(t){return Object(v.__awaiter)(n,void 0,void 0,(function(){return Object(v.__generator)(this,(function(n){switch(n.label){case 0:return[4,e.regionInfoProvider(t)];case 1:return[2,[n.sent()||{},t]]}}))}))})).then((function(t){var n=Object(v.__read)(t,2),o=n[0],a=n[1],s=o.signingRegion,c=void 0===s?e.signingRegion:s,l=o.signingService,d=void 0===l?e.signingName:l;return e.signingRegion=e.signingRegion||c||a,e.signingName=e.signingName||d,new Ce({credentials:r,region:e.signingRegion,service:e.signingName,sha256:u,uriEscapePath:i})}))},Object(v.__assign)(Object(v.__assign)({},e),{systemClockOffset:s,signingEscapePath:i,credentials:r,signer:t})}((n=a,Object(v.__assign)(Object(v.__assign)({},n),{tls:null===(r=n.tls)||void 0===r||r,endpoint:n.endpoint?X(n):function(){return J(n)},isCustomEndpoint:!!n.endpoint}))));return(i=e.call(this,s)||this).config=s,i.middlewareStack.use((o=i.config,{applyToStack:function(e){e.addRelativeTo(Ne(o),Me)}})),i.middlewareStack.use(I(i.config)),i.middlewareStack.use(De(i.config)),i.middlewareStack.use(te(i.config)),i.middlewareStack.use(re(i.config)),i.middlewareStack.use(ie(i.config)),i}return u(t,e),t.prototype.destroy=function(){e.prototype.destroy.call(this)},t}(Be);(We||(We={})).filterSensitiveLog=function(e){return c({},e)},(Ve||(Ve={})).filterSensitiveLog=function(e){return c({},e)},(Ze||(Ze={})).filterSensitiveLog=function(e){return c({},e)},(Ye||(Ye={})).filterSensitiveLog=function(e){return c({},e)},(Xe||(Xe={})).filterSensitiveLog=function(e){return c({},e)},(Je||(Je={})).filterSensitiveLog=function(e){return c({},e)},(Qe||(Qe={})).filterSensitiveLog=function(e){return c({},e)},(et||(et={})).filterSensitiveLog=function(e){return c({},e)},function(e){e.FAILED="Failed",e.FULFILLED="Fulfilled",e.READY_FOR_FULFILLMENT="ReadyForFulfillment"}(tt||(tt={})),function(e){e.COMPOSITE="Composite",e.CUSTOM_PAYLOAD="CustomPayload",e.PLAIN_TEXT="PlainText",e.SSML="SSML"}(nt||(nt={})),function(e){e.CLOSE="Close",e.CONFIRM_INTENT="ConfirmIntent",e.DELEGATE="Delegate",e.ELICIT_INTENT="ElicitIntent",e.ELICIT_SLOT="ElicitSlot"}(rt||(rt={})),(ot||(ot={})).filterSensitiveLog=function(e){return c(c(c({},e),e.slots&&{slots:Ct}),e.message&&{message:Ct})},function(e){e.CONFIRMED="Confirmed",e.DENIED="Denied",e.NONE="None"}(it||(it={})),(at||(at={})).filterSensitiveLog=function(e){return c(c({},e),e.slots&&{slots:Ct})},(st||(st={})).filterSensitiveLog=function(e){return c(c(c(c({},e),e.dialogAction&&{dialogAction:ot.filterSensitiveLog(e.dialogAction)}),e.recentIntentSummaryView&&{recentIntentSummaryView:e.recentIntentSummaryView.map((function(e){return at.filterSensitiveLog(e)}))}),e.sessionAttributes&&{sessionAttributes:Ct})},(ut||(ut={})).filterSensitiveLog=function(e){return c({},e)},(ct||(ct={})).filterSensitiveLog=function(e){return c({},e)},(lt||(lt={})).filterSensitiveLog=function(e){return c({},e)},(dt||(dt={})).filterSensitiveLog=function(e){return c({},e)},(ft||(ft={})).filterSensitiveLog=function(e){return c(c(c({},e),e.requestAttributes&&{requestAttributes:Ct}),e.sessionAttributes&&{sessionAttributes:Ct})},function(e){e.CONFIRM_INTENT="ConfirmIntent",e.ELICIT_INTENT="ElicitIntent",e.ELICIT_SLOT="ElicitSlot",e.FAILED="Failed",e.FULFILLED="Fulfilled",e.READY_FOR_FULFILLMENT="ReadyForFulfillment"}(pt||(pt={})),(ht||(ht={})).filterSensitiveLog=function(e){return c(c({},e),e.message&&{message:Ct})},(vt||(vt={})).filterSensitiveLog=function(e){return c({},e)},(mt||(mt={})).filterSensitiveLog=function(e){return c({},e)},(gt||(gt={})).filterSensitiveLog=function(e){return c(c(c(c({},e),e.requestAttributes&&{requestAttributes:Ct}),e.inputText&&{inputText:Ct}),e.sessionAttributes&&{sessionAttributes:Ct})},(yt||(yt={})).filterSensitiveLog=function(e){return c({},e)},(bt||(bt={})).filterSensitiveLog=function(e){return c(c({},e),e.slots&&{slots:Ct})},function(e){e.GENERIC="application/vnd.amazonaws.card.generic"}(wt||(wt={})),(_t||(_t={})).filterSensitiveLog=function(e){return c({},e)},(St||(St={})).filterSensitiveLog=function(e){return c({},e)},(xt||(xt={})).filterSensitiveLog=function(e){return c({},e)},(Ot||(Ot={})).filterSensitiveLog=function(e){return c({},e)},(At||(At={})).filterSensitiveLog=function(e){return c(c(c(c(c({},e),e.alternativeIntents&&{alternativeIntents:e.alternativeIntents.map((function(e){return bt.filterSensitiveLog(e)}))}),e.message&&{message:Ct}),e.sessionAttributes&&{sessionAttributes:Ct}),e.slots&&{slots:Ct})},(Et||(Et={})).filterSensitiveLog=function(e){return c(c(c(c({},e),e.dialogAction&&{dialogAction:ot.filterSensitiveLog(e.dialogAction)}),e.recentIntentSummaryView&&{recentIntentSummaryView:e.recentIntentSummaryView.map((function(e){return at.filterSensitiveLog(e)}))}),e.sessionAttributes&&{sessionAttributes:Ct})},(jt||(jt={})).filterSensitiveLog=function(e){return c(c({},e),e.message&&{message:Ct})};var Lt=function(e,t){return l(void 0,void 0,void 0,(function(){var n,r,o,i,a,s,u,l,f,p,h,v,m,g,y,b,w,_;return d(this,(function(d){switch(d.label){case 0:return r=[c({},e)],_={},[4,tn(e.body,t)];case 1:switch(n=c.apply(void 0,r.concat([(_.body=d.sent(),_)])),i="UnknownError",i=nn(e,n.body),i){case"BadGatewayException":case"com.amazonaws.lexruntimeservice#BadGatewayException":return[3,2];case"BadRequestException":case"com.amazonaws.lexruntimeservice#BadRequestException":return[3,4];case"ConflictException":case"com.amazonaws.lexruntimeservice#ConflictException":return[3,6];case"DependencyFailedException":case"com.amazonaws.lexruntimeservice#DependencyFailedException":return[3,8];case"InternalFailureException":case"com.amazonaws.lexruntimeservice#InternalFailureException":return[3,10];case"LimitExceededException":case"com.amazonaws.lexruntimeservice#LimitExceededException":return[3,12];case"LoopDetectedException":case"com.amazonaws.lexruntimeservice#LoopDetectedException":return[3,14];case"NotAcceptableException":case"com.amazonaws.lexruntimeservice#NotAcceptableException":return[3,16];case"NotFoundException":case"com.amazonaws.lexruntimeservice#NotFoundException":return[3,18];case"RequestTimeoutException":case"com.amazonaws.lexruntimeservice#RequestTimeoutException":return[3,20];case"UnsupportedMediaTypeException":case"com.amazonaws.lexruntimeservice#UnsupportedMediaTypeException":return[3,22]}return[3,24];case 2:return a=[{}],[4,It(n,t)];case 3:return o=c.apply(void 0,[c.apply(void 0,a.concat([d.sent()])),{name:i,$metadata:Jt(e)}]),[3,25];case 4:return s=[{}],[4,kt(n,t)];case 5:return o=c.apply(void 0,[c.apply(void 0,s.concat([d.sent()])),{name:i,$metadata:Jt(e)}]),[3,25];case 6:return u=[{}],[4,Rt(n,t)];case 7:return o=c.apply(void 0,[c.apply(void 0,u.concat([d.sent()])),{name:i,$metadata:Jt(e)}]),[3,25];case 8:return l=[{}],[4,Nt(n,t)];case 9:return o=c.apply(void 0,[c.apply(void 0,l.concat([d.sent()])),{name:i,$metadata:Jt(e)}]),[3,25];case 10:return f=[{}],[4,Mt(n,t)];case 11:return o=c.apply(void 0,[c.apply(void 0,f.concat([d.sent()])),{name:i,$metadata:Jt(e)}]),[3,25];case 12:return p=[{}],[4,zt(n,t)];case 13:return o=c.apply(void 0,[c.apply(void 0,p.concat([d.sent()])),{name:i,$metadata:Jt(e)}]),[3,25];case 14:return h=[{}],[4,Dt(n,t)];case 15:return o=c.apply(void 0,[c.apply(void 0,h.concat([d.sent()])),{name:i,$metadata:Jt(e)}]),[3,25];case 16:return v=[{}],[4,qt(n,t)];case 17:return o=c.apply(void 0,[c.apply(void 0,v.concat([d.sent()])),{name:i,$metadata:Jt(e)}]),[3,25];case 18:return m=[{}],[4,Ht(n,t)];case 19:return o=c.apply(void 0,[c.apply(void 0,m.concat([d.sent()])),{name:i,$metadata:Jt(e)}]),[3,25];case 20:return g=[{}],[4,Ut(n,t)];case 21:return o=c.apply(void 0,[c.apply(void 0,g.concat([d.sent()])),{name:i,$metadata:Jt(e)}]),[3,25];case 22:return y=[{}],[4,Bt(n,t)];case 23:return o=c.apply(void 0,[c.apply(void 0,y.concat([d.sent()])),{name:i,$metadata:Jt(e)}]),[3,25];case 24:b=n.body,i=b.code||b.Code||i,o=c(c({},b),{name:""+i,message:b.message||b.Message||i,$fault:"client",$metadata:Jt(e)}),d.label=25;case 25:return w=o.message||o.Message||i,o.message=w,delete o.Message,[2,Promise.reject(Object.assign(new Error(w),o))]}}))}))},Pt=function(e,t){return l(void 0,void 0,void 0,(function(){var n,r,o,i,a,s,u,l,f,p,h,v,m,g,y;return d(this,(function(d){switch(d.label){case 0:return r=[c({},e)],y={},[4,tn(e.body,t)];case 1:switch(n=c.apply(void 0,r.concat([(y.body=d.sent(),y)])),i="UnknownError",i=nn(e,n.body),i){case"BadGatewayException":case"com.amazonaws.lexruntimeservice#BadGatewayException":return[3,2];case"BadRequestException":case"com.amazonaws.lexruntimeservice#BadRequestException":return[3,4];case"ConflictException":case"com.amazonaws.lexruntimeservice#ConflictException":return[3,6];case"DependencyFailedException":case"com.amazonaws.lexruntimeservice#DependencyFailedException":return[3,8];case"InternalFailureException":case"com.amazonaws.lexruntimeservice#InternalFailureException":return[3,10];case"LimitExceededException":case"com.amazonaws.lexruntimeservice#LimitExceededException":return[3,12];case"LoopDetectedException":case"com.amazonaws.lexruntimeservice#LoopDetectedException":return[3,14];case"NotFoundException":case"com.amazonaws.lexruntimeservice#NotFoundException":return[3,16]}return[3,18];case 2:return a=[{}],[4,It(n,t)];case 3:return o=c.apply(void 0,[c.apply(void 0,a.concat([d.sent()])),{name:i,$metadata:Jt(e)}]),[3,19];case 4:return s=[{}],[4,kt(n,t)];case 5:return o=c.apply(void 0,[c.apply(void 0,s.concat([d.sent()])),{name:i,$metadata:Jt(e)}]),[3,19];case 6:return u=[{}],[4,Rt(n,t)];case 7:return o=c.apply(void 0,[c.apply(void 0,u.concat([d.sent()])),{name:i,$metadata:Jt(e)}]),[3,19];case 8:return l=[{}],[4,Nt(n,t)];case 9:return o=c.apply(void 0,[c.apply(void 0,l.concat([d.sent()])),{name:i,$metadata:Jt(e)}]),[3,19];case 10:return f=[{}],[4,Mt(n,t)];case 11:return o=c.apply(void 0,[c.apply(void 0,f.concat([d.sent()])),{name:i,$metadata:Jt(e)}]),[3,19];case 12:return p=[{}],[4,zt(n,t)];case 13:return o=c.apply(void 0,[c.apply(void 0,p.concat([d.sent()])),{name:i,$metadata:Jt(e)}]),[3,19];case 14:return h=[{}],[4,Dt(n,t)];case 15:return o=c.apply(void 0,[c.apply(void 0,h.concat([d.sent()])),{name:i,$metadata:Jt(e)}]),[3,19];case 16:return v=[{}],[4,Ht(n,t)];case 17:return o=c.apply(void 0,[c.apply(void 0,v.concat([d.sent()])),{name:i,$metadata:Jt(e)}]),[3,19];case 18:m=n.body,i=m.code||m.Code||i,o=c(c({},m),{name:""+i,message:m.message||m.Message||i,$fault:"client",$metadata:Jt(e)}),d.label=19;case 19:return g=o.message||o.Message||i,o.message=g,delete o.Message,[2,Promise.reject(Object.assign(new Error(g),o))]}}))}))},It=function(e,t){return l(void 0,void 0,void 0,(function(){var t,n;return d(this,(function(r){return t={name:"BadGatewayException",$fault:"server",$metadata:Jt(e),Message:void 0},void 0!==(n=e.body).Message&&null!==n.Message&&(t.Message=n.Message),[2,t]}))}))},kt=function(e,t){return l(void 0,void 0,void 0,(function(){var t,n;return d(this,(function(r){return t={name:"BadRequestException",$fault:"client",$metadata:Jt(e),message:void 0},void 0!==(n=e.body).message&&null!==n.message&&(t.message=n.message),[2,t]}))}))},Rt=function(e,t){return l(void 0,void 0,void 0,(function(){var t,n;return d(this,(function(r){return t={name:"ConflictException",$fault:"client",$metadata:Jt(e),message:void 0},void 0!==(n=e.body).message&&null!==n.message&&(t.message=n.message),[2,t]}))}))},Nt=function(e,t){return l(void 0,void 0,void 0,(function(){var t,n;return d(this,(function(r){return t={name:"DependencyFailedException",$fault:"client",$metadata:Jt(e),Message:void 0},void 0!==(n=e.body).Message&&null!==n.Message&&(t.Message=n.Message),[2,t]}))}))},Mt=function(e,t){return l(void 0,void 0,void 0,(function(){var t,n;return d(this,(function(r){return t={name:"InternalFailureException",$fault:"server",$metadata:Jt(e),message:void 0},void 0!==(n=e.body).message&&null!==n.message&&(t.message=n.message),[2,t]}))}))},zt=function(e,t){return l(void 0,void 0,void 0,(function(){var t,n;return d(this,(function(r){return t={name:"LimitExceededException",$fault:"client",$metadata:Jt(e),message:void 0,retryAfterSeconds:void 0},void 0!==e.headers["retry-after"]&&(t.retryAfterSeconds=e.headers["retry-after"]),void 0!==(n=e.body).message&&null!==n.message&&(t.message=n.message),[2,t]}))}))},Dt=function(e,t){return l(void 0,void 0,void 0,(function(){var t,n;return d(this,(function(r){return t={name:"LoopDetectedException",$fault:"server",$metadata:Jt(e),Message:void 0},void 0!==(n=e.body).Message&&null!==n.Message&&(t.Message=n.Message),[2,t]}))}))},qt=function(e,t){return l(void 0,void 0,void 0,(function(){var t,n;return d(this,(function(r){return t={name:"NotAcceptableException",$fault:"client",$metadata:Jt(e),message:void 0},void 0!==(n=e.body).message&&null!==n.message&&(t.message=n.message),[2,t]}))}))},Ht=function(e,t){return l(void 0,void 0,void 0,(function(){var t,n;return d(this,(function(r){return t={name:"NotFoundException",$fault:"client",$metadata:Jt(e),message:void 0},void 0!==(n=e.body).message&&null!==n.message&&(t.message=n.message),[2,t]}))}))},Ut=function(e,t){return l(void 0,void 0,void 0,(function(){var t,n;return d(this,(function(r){return t={name:"RequestTimeoutException",$fault:"client",$metadata:Jt(e),message:void 0},void 0!==(n=e.body).message&&null!==n.message&&(t.message=n.message),[2,t]}))}))},Bt=function(e,t){return l(void 0,void 0,void 0,(function(){var t,n;return d(this,(function(r){return t={name:"UnsupportedMediaTypeException",$fault:"client",$metadata:Jt(e),message:void 0},void 0!==(n=e.body).message&&null!==n.message&&(t.message=n.message),[2,t]}))}))},Ft=function(e,t){return Object.entries(e).reduce((function(e,t){var n,r=f(t,2),o=r[0],i=r[1];return c(c({},e),((n={})[o]=i,n))}),{})},$t=function(e,t){return(e||[]).map((function(e){return function(e,t){return{attachmentLinkUrl:void 0!==e.attachmentLinkUrl&&null!==e.attachmentLinkUrl?e.attachmentLinkUrl:void 0,buttons:void 0!==e.buttons&&null!==e.buttons?Wt(e.buttons,t):void 0,imageUrl:void 0!==e.imageUrl&&null!==e.imageUrl?e.imageUrl:void 0,subTitle:void 0!==e.subTitle&&null!==e.subTitle?e.subTitle:void 0,title:void 0!==e.title&&null!==e.title?e.title:void 0}}(e,t)}))},Gt=function(e,t){return{score:void 0!==e.score&&null!==e.score?e.score:void 0}},Kt=function(e,t){return(e||[]).map((function(e){return Vt(e,t)}))},Wt=function(e,t){return(e||[]).map((function(e){return function(e,t){return{text:void 0!==e.text&&null!==e.text?e.text:void 0,value:void 0!==e.value&&null!==e.value?e.value:void 0}}(e)}))},Vt=function(e,t){return{intentName:void 0!==e.intentName&&null!==e.intentName?e.intentName:void 0,nluIntentConfidence:void 0!==e.nluIntentConfidence&&null!==e.nluIntentConfidence?Gt(e.nluIntentConfidence,t):void 0,slots:void 0!==e.slots&&null!==e.slots?Xt(e.slots,t):void 0}},Zt=function(e,t){return{contentType:void 0!==e.contentType&&null!==e.contentType?e.contentType:void 0,genericAttachments:void 0!==e.genericAttachments&&null!==e.genericAttachments?$t(e.genericAttachments,t):void 0,version:void 0!==e.version&&null!==e.version?e.version:void 0}},Yt=function(e,t){return{sentimentLabel:void 0!==e.sentimentLabel&&null!==e.sentimentLabel?e.sentimentLabel:void 0,sentimentScore:void 0!==e.sentimentScore&&null!==e.sentimentScore?e.sentimentScore:void 0}},Xt=function(e,t){return Object.entries(e).reduce((function(e,t){var n,r=f(t,2),o=r[0],i=r[1];return c(c({},e),((n={})[o]=i,n))}),{})},Jt=function(e){return{httpStatusCode:e.statusCode,httpHeaders:e.headers,requestId:e.headers["x-amzn-requestid"]}},Qt=function(e,t){return function(e,t){return void 0===e&&(e=new Uint8Array),e instanceof Uint8Array?Promise.resolve(e):t.streamCollector(e)||Promise.resolve(new Uint8Array)}(e,t).then((function(e){return t.utf8Encoder(e)}))},en=function(e){return!(void 0===e||""===e||Object.getOwnPropertyNames(e).includes("length")&&0==e.length||Object.getOwnPropertyNames(e).includes("size")&&0==e.size)},tn=function(e,t){return Qt(e,t).then((function(e){return e.length?JSON.parse(e):{}}))},nn=function(e,t){var n,r,o=function(e){var t=e;return t.indexOf(":")>=0&&(t=t.split(":")[0]),t.indexOf("#")>=0&&(t=t.split("#")[1]),t},i=(n=e.headers,r="x-amzn-errortype",Object.keys(n).find((function(e){return e.toLowerCase()===r.toLowerCase()})));return void 0!==i?o(e.headers[i]):void 0!==t.code?o(t.code):void 0!==t.__type?o(t.__type):""},rn={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"]},on={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"]};function an(e,t,n){return{applyToStack:function(r){r.add(function(e,t){return function(n,r){return function(o){return Object(v.__awaiter)(void 0,void 0,void 0,(function(){var i,a,s,u,c;return Object(v.__generator)(this,(function(l){switch(l.label){case 0:return i=r.logger,a=r.outputFilterSensitiveLog,[4,n(o)];case 1:return s=l.sent().response,"function"==typeof(null==i?void 0:i.debug)&&i.debug({httpResponse:s}),[4,t(s,e)];case 2:return u=l.sent(),u.$metadata,c=Object(v.__rest)(u,["$metadata"]),"function"==typeof(null==i?void 0:i.info)&&i.info({output:a(c)}),[2,{response:s,output:u}]}}))}))}}}(e,n),rn),r.add(function(e,t){return function(n,r){return function(o){return Object(v.__awaiter)(void 0,void 0,void 0,(function(){var i,a,s;return Object(v.__generator)(this,(function(u){switch(u.label){case 0:return i=r.logger,a=r.inputFilterSensitiveLog,"function"==typeof(null==i?void 0:i.info)&&i.info({input:a(o.input)}),[4,t(o.input,e)];case 1:return s=u.sent(),"function"==typeof(null==i?void 0:i.debug)&&i.debug({httpRequest:s}),[2,n(Object(v.__assign)(Object(v.__assign)({},o),{request:s}))]}}))}))}}}(e,t),on)}}}var sn,un=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return u(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(an(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),o=t.logger,i={logger:o,clientName:"LexRuntimeServiceClient",commandName:"PostTextCommand",inputFilterSensitiveLog:gt.filterSensitiveLog,outputFilterSensitiveLog:At.filterSensitiveLog};"function"==typeof o.info&&o.info({clientName:"LexRuntimeServiceClient",commandName:"PostTextCommand"});var a=t.requestHandler;return r.resolve((function(e){return a.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return l(void 0,void 0,void 0,(function(){var n,r,o,i,a,s,u,l,f;return d(this,(function(d){switch(d.label){case 0:if(n={"Content-Type":"application/json"},r="/bot/{botName}/alias/{botAlias}/user/{userId}/text",void 0===e.userId)throw new Error("No value provided for input HTTP label: userId.");if((o=e.userId).length<=0)throw new Error("Empty value provided for input HTTP label: userId.");if(r=r.replace("{userId}",$e(o)),void 0===e.botAlias)throw new Error("No value provided for input HTTP label: botAlias.");if((o=e.botAlias).length<=0)throw new Error("Empty value provided for input HTTP label: botAlias.");if(r=r.replace("{botAlias}",$e(o)),void 0===e.botName)throw new Error("No value provided for input HTTP label: botName.");if((o=e.botName).length<=0)throw new Error("Empty value provided for input HTTP label: botName.");return r=r.replace("{botName}",$e(o)),i=JSON.stringify(c(c(c({},void 0!==e.inputText&&{inputText:e.inputText}),void 0!==e.requestAttributes&&{requestAttributes:Ft(e.requestAttributes,t)}),void 0!==e.sessionAttributes&&{sessionAttributes:Ft(e.sessionAttributes,t)})),[4,t.endpoint()];case 1:return a=d.sent(),s=a.hostname,u=a.protocol,l=void 0===u?"https":u,f=a.port,[2,new g({protocol:l,hostname:s,port:f,method:"POST",headers:n,path:r,body:i})]}}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return l(void 0,void 0,void 0,(function(){var n,r;return d(this,(function(o){switch(o.label){case 0:return 200!==e.statusCode&&e.statusCode>=300?[2,Pt(e,t)]:(n={$metadata:Jt(e),alternativeIntents:void 0,botVersion:void 0,dialogState:void 0,intentName:void 0,message:void 0,messageFormat:void 0,nluIntentConfidence:void 0,responseCard:void 0,sentimentResponse:void 0,sessionAttributes:void 0,sessionId:void 0,slotToElicit:void 0,slots:void 0},[4,tn(e.body,t)]);case 1:return void 0!==(r=o.sent()).alternativeIntents&&null!==r.alternativeIntents&&(n.alternativeIntents=Kt(r.alternativeIntents,t)),void 0!==r.botVersion&&null!==r.botVersion&&(n.botVersion=r.botVersion),void 0!==r.dialogState&&null!==r.dialogState&&(n.dialogState=r.dialogState),void 0!==r.intentName&&null!==r.intentName&&(n.intentName=r.intentName),void 0!==r.message&&null!==r.message&&(n.message=r.message),void 0!==r.messageFormat&&null!==r.messageFormat&&(n.messageFormat=r.messageFormat),void 0!==r.nluIntentConfidence&&null!==r.nluIntentConfidence&&(n.nluIntentConfidence=Gt(r.nluIntentConfidence,t)),void 0!==r.responseCard&&null!==r.responseCard&&(n.responseCard=Zt(r.responseCard,t)),void 0!==r.sentimentResponse&&null!==r.sentimentResponse&&(n.sentimentResponse=Yt(r.sentimentResponse,t)),void 0!==r.sessionAttributes&&null!==r.sessionAttributes&&(n.sessionAttributes=Xt(r.sessionAttributes,t)),void 0!==r.sessionId&&null!==r.sessionId&&(n.sessionId=r.sessionId),void 0!==r.slotToElicit&&null!==r.slotToElicit&&(n.slotToElicit=r.slotToElicit),void 0!==r.slots&&null!==r.slots&&(n.slots=Xt(r.slots,t)),[2,Promise.resolve(n)]}}))}))}(e,t)},t}(Fe),cn=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return u(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(an(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),o=t.logger,i={logger:o,clientName:"LexRuntimeServiceClient",commandName:"PostContentCommand",inputFilterSensitiveLog:ft.filterSensitiveLog,outputFilterSensitiveLog:ht.filterSensitiveLog};"function"==typeof o.info&&o.info({clientName:"LexRuntimeServiceClient",commandName:"PostContentCommand"});var a=t.requestHandler;return r.resolve((function(e){return a.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return l(void 0,void 0,void 0,(function(){var n,r,o,i,a,s,u,l,f;return d(this,(function(d){switch(d.label){case 0:if(n=c(c(c(c({"Content-Type":"application/octet-stream","x-amz-content-sha256":"UNSIGNED-PAYLOAD"},en(e.requestAttributes)&&{"x-amz-lex-request-attributes":Ke.fromObject(e.requestAttributes)}),en(e.sessionAttributes)&&{"x-amz-lex-session-attributes":Ke.fromObject(e.sessionAttributes)}),en(e.contentType)&&{"Content-Type":e.contentType}),en(e.accept)&&{Accept:e.accept}),r="/bot/{botName}/alias/{botAlias}/user/{userId}/content",void 0===e.botAlias)throw new Error("No value provided for input HTTP label: botAlias.");if((o=e.botAlias).length<=0)throw new Error("Empty value provided for input HTTP label: botAlias.");if(r=r.replace("{botAlias}",$e(o)),void 0===e.botName)throw new Error("No value provided for input HTTP label: botName.");if((o=e.botName).length<=0)throw new Error("Empty value provided for input HTTP label: botName.");if(r=r.replace("{botName}",$e(o)),void 0===e.userId)throw new Error("No value provided for input HTTP label: userId.");if((o=e.userId).length<=0)throw new Error("Empty value provided for input HTTP label: userId.");return r=r.replace("{userId}",$e(o)),void 0!==e.inputStream&&(i=e.inputStream),[4,t.endpoint()];case 1:return a=d.sent(),s=a.hostname,u=a.protocol,l=void 0===u?"https":u,f=a.port,[2,new g({protocol:l,hostname:s,port:f,method:"POST",headers:n,path:r,body:i})]}}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return l(void 0,void 0,void 0,(function(){var n,r;return d(this,(function(o){return 200!==e.statusCode&&e.statusCode>=300?[2,Lt(e,t)]:(n={$metadata:Jt(e),alternativeIntents:void 0,audioStream:void 0,botVersion:void 0,contentType:void 0,dialogState:void 0,inputTranscript:void 0,intentName:void 0,message:void 0,messageFormat:void 0,nluIntentConfidence:void 0,sentimentResponse:void 0,sessionAttributes:void 0,sessionId:void 0,slotToElicit:void 0,slots:void 0},void 0!==e.headers["x-amz-lex-alternative-intents"]&&(n.alternativeIntents=new Ke(e.headers["x-amz-lex-alternative-intents"])),void 0!==e.headers["x-amz-lex-message-format"]&&(n.messageFormat=e.headers["x-amz-lex-message-format"]),void 0!==e.headers["content-type"]&&(n.contentType=e.headers["content-type"]),void 0!==e.headers["x-amz-lex-message"]&&(n.message=e.headers["x-amz-lex-message"]),void 0!==e.headers["x-amz-lex-bot-version"]&&(n.botVersion=e.headers["x-amz-lex-bot-version"]),void 0!==e.headers["x-amz-lex-sentiment"]&&(n.sentimentResponse=e.headers["x-amz-lex-sentiment"]),void 0!==e.headers["x-amz-lex-slots"]&&(n.slots=new Ke(e.headers["x-amz-lex-slots"])),void 0!==e.headers["x-amz-lex-input-transcript"]&&(n.inputTranscript=e.headers["x-amz-lex-input-transcript"]),void 0!==e.headers["x-amz-lex-slot-to-elicit"]&&(n.slotToElicit=e.headers["x-amz-lex-slot-to-elicit"]),void 0!==e.headers["x-amz-lex-session-attributes"]&&(n.sessionAttributes=new Ke(e.headers["x-amz-lex-session-attributes"])),void 0!==e.headers["x-amz-lex-session-id"]&&(n.sessionId=e.headers["x-amz-lex-session-id"]),void 0!==e.headers["x-amz-lex-dialog-state"]&&(n.dialogState=e.headers["x-amz-lex-dialog-state"]),void 0!==e.headers["x-amz-lex-intent-name"]&&(n.intentName=e.headers["x-amz-lex-intent-name"]),void 0!==e.headers["x-amz-lex-nlu-intent-confidence"]&&(n.nluIntentConfidence=new Ke(e.headers["x-amz-lex-nlu-intent-confidence"])),r=e.body,n.audioStream=r,[2,Promise.resolve(n)])}))}))}(e,t)},t}(Fe),ln=function(e){if(e instanceof Blob||e instanceof ReadableStream)return new Response(e).arrayBuffer().then((function(e){return new Uint8Array(e)}));throw new Error("Readable is not supported.")},dn=(sn=function(e,t){return(sn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}sn(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),fn=function(){return(fn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},pn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},hn=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},vn=new r.ConsoleLogger("AWSLexProvider"),mn=function(e){function t(t){void 0===t&&(t={});var n=e.call(this,t)||this;return n._botsCompleteCallback={},n}return dn(t,e),t.prototype.getProviderName=function(){return"AWSLexProvider"},t.prototype.reportBotStatus=function(e,t){var n=this;vn.debug("postContent state",e.dialogState),"ReadyForFulfillment"!==e.dialogState&&"Fulfilled"!==e.dialogState||("function"==typeof this._botsCompleteCallback[t]&&setTimeout((function(){return n._botsCompleteCallback[t](null,{slots:e.slots})}),0),this._config&&"function"==typeof this._config[t].onComplete&&setTimeout((function(){return n._config[t].onComplete(null,{slots:e.slots})}),0)),"Failed"===e.dialogState&&("function"==typeof this._botsCompleteCallback[t]&&setTimeout((function(){return n._botsCompleteCallback[t]("Bot conversation failed")}),0),this._config&&"function"==typeof this._config[t].onComplete&&setTimeout((function(){return n._config[t].onComplete("Bot conversation failed")}),0))},t.prototype.sendMessage=function(e,t){return pn(this,void 0,void 0,(function(){var n,o,i,a,s,u,c,l,d,f;return hn(this,(function(p){switch(p.label){case 0:return this._config[e]?[4,r.Credentials.get()]:[2,Promise.reject("Bot "+e+" does not exist")];case 1:if(!(n=p.sent()))return[2,Promise.reject("No credentials")];if(this.lexRuntimeServiceClient=new Tt({region:this._config[e].region,credentials:n,customUserAgent:Object(r.getAmplifyUserAgent)()}),"string"!=typeof t)return[3,6];o={botAlias:this._config[e].alias,botName:e,inputText:t,userId:n.identityId},vn.debug("postText to lex",t),p.label=2;case 2:return p.trys.push([2,4,,5]),i=new un(o),[4,this.lexRuntimeServiceClient.send(i)];case 3:return l=p.sent(),this.reportBotStatus(l,e),[2,l];case 4:return a=p.sent(),[2,Promise.reject(a)];case 5:return[3,11];case 6:s=t.content,u=t.options.messageType,o="voice"===u?{botAlias:this._config[e].alias,botName:e,contentType:"audio/x-l16; sample-rate=16000",inputStream:s,userId:n.identityId,accept:"audio/mpeg"}:{botAlias:this._config[e].alias,botName:e,contentType:"text/plain; charset=utf-8",inputStream:s,userId:n.identityId,accept:"audio/mpeg"},vn.debug("postContent to lex",t),p.label=7;case 7:return p.trys.push([7,10,,11]),c=new cn(o),[4,this.lexRuntimeServiceClient.send(c)];case 8:return l=p.sent(),[4,ln(l.audioStream)];case 9:return d=p.sent(),this.reportBotStatus(l,e),[2,fn(fn({},l),{audioStream:d})];case 10:return f=p.sent(),[2,Promise.reject(f)];case 11:return[2]}}))}))},t.prototype.onComplete=function(e,t){if(!this._config[e])throw new ErrorEvent("Bot "+e+" does not exist");this._botsCompleteCallback[e]=t},t}(a),gn=function(){return(gn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},yn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},bn=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},wn=new r.ConsoleLogger("Interactions"),_n=new(function(){function e(e){this._options=e,wn.debug("Interactions Options",this._options),this._pluggables={}}return e.prototype.getModuleName=function(){return"Interactions"},e.prototype.configure=function(e){var t=this,n=e?e.Interactions||e:{};wn.debug("configure Interactions",{opt:n}),this._options=gn(gn({bots:{}},n),n.Interactions);var r=this._options.aws_bots_config,o=this._options.bots;return!Object.keys(o).length&&r&&Array.isArray(r)&&r.forEach((function(e){t._options.bots[e.name]=e})),!this._pluggables.AWSLexProvider&&o&&Object.keys(o).map((function(e){return o[e]})).find((function(e){return!e.providerName||"AWSLexProvider"===e.providerName}))&&(this._pluggables.AWSLexProvider=new mn),Object.keys(this._pluggables).map((function(e){t._pluggables[e].configure(t._options.bots)})),this._options},e.prototype.addPluggable=function(e){if(e&&"Interactions"===e.getCategory()){if(this._pluggables[e.getProviderName()])throw new Error("Bot "+e.getProviderName()+" already plugged");return e.configure(this._options.bots),void(this._pluggables[e.getProviderName()]=e)}},e.prototype.send=function(e,t){return yn(this,void 0,void 0,(function(){var n;return bn(this,(function(r){switch(r.label){case 0:if(!this._options.bots||!this._options.bots[e])throw new Error("Bot "+e+" does not exist");if(n=this._options.bots[e].providerName||"AWSLexProvider",!this._pluggables[n])throw new Error("Bot "+n+" does not have valid pluggin did you try addPluggable first?");return[4,this._pluggables[n].sendMessage(e,t)];case 1:return[2,r.sent()]}}))}))},e.prototype.onComplete=function(e,t){if(!this._options.bots||!this._options.bots[e])throw new Error("Bot "+e+" does not exist");var n=this._options.bots[e].providerName||"AWSLexProvider";if(!this._pluggables[n])throw new Error("Bot "+n+" does not have valid pluggin did you try addPluggable first?");this._pluggables[n].onComplete(e,t)},e}())(null);r.Amplify.register(_n);t.default=_n},function(e,t,n){"use strict";n.r(t),n.d(t,"fromUtf8",(function(){return r})),n.d(t,"toUtf8",(function(){return o}));var r=function(e){return"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e.charCodeAt(n);if(o<128)t.push(o);else if(o<2048)t.push(o>>6|192,63&o|128);else if(n+1<e.length&&55296==(64512&o)&&56320==(64512&e.charCodeAt(n+1))){var i=65536+((1023&o)<<10)+(1023&e.charCodeAt(++n));t.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}else t.push(o>>12|224,o>>6&63|128,63&o|128)}return Uint8Array.from(t)}(e)},o=function(e){return"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):function(e){for(var t="",n=0,r=e.length;n<r;n++){var o=e[n];if(o<128)t+=String.fromCharCode(o);else if(192<=o&&o<224){var i=e[++n];t+=String.fromCharCode((31&o)<<6|63&i)}else if(240<=o&&o<365){var a="%"+[o,e[++n],e[++n],e[++n]].map((function(e){return e.toString(16)})).join("%");t+=decodeURIComponent(a)}else t+=String.fromCharCode((15&o)<<12|(63&e[++n])<<6|63&e[++n])}return t}(e)}}])}));
17//# sourceMappingURL=aws-amplify-interactions.min.js.map
\No newline at end of file