text: (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-576c85ba"],{"0881":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":"3.6.1","scripts":{"clean":"yarn remove-definitions && yarn remove-dist && yarn remove-documentation","build-documentation":"yarn remove-documentation && 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","postbuild":"downlevel-dts types types/ts3.4"},"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":"3.6.1","@aws-sdk/credential-provider-node":"3.6.1","@aws-sdk/fetch-http-handler":"3.6.1","@aws-sdk/hash-node":"3.6.1","@aws-sdk/invalid-dependency":"3.6.1","@aws-sdk/middleware-content-length":"3.6.1","@aws-sdk/middleware-host-header":"3.6.1","@aws-sdk/middleware-logger":"3.6.1","@aws-sdk/middleware-retry":"3.6.1","@aws-sdk/middleware-serde":"3.6.1","@aws-sdk/middleware-signing":"3.6.1","@aws-sdk/middleware-stack":"3.6.1","@aws-sdk/middleware-user-agent":"3.6.1","@aws-sdk/node-config-provider":"3.6.1","@aws-sdk/node-http-handler":"3.6.1","@aws-sdk/protocol-http":"3.6.1","@aws-sdk/smithy-client":"3.6.1","@aws-sdk/types":"3.6.1","@aws-sdk/url-parser":"3.6.1","@aws-sdk/url-parser-native":"3.6.1","@aws-sdk/util-base64-browser":"3.6.1","@aws-sdk/util-base64-node":"3.6.1","@aws-sdk/util-body-length-browser":"3.6.1","@aws-sdk/util-body-length-node":"3.6.1","@aws-sdk/util-user-agent-browser":"3.6.1","@aws-sdk/util-user-agent-node":"3.6.1","@aws-sdk/util-utf8-browser":"3.6.1","@aws-sdk/util-utf8-node":"3.6.1","tslib":"^2.0.0"},"devDependencies":{"@aws-sdk/client-documentation-generator":"3.6.1","@types/chai":"^4.2.11","@types/mocha":"^8.0.4","@types/node":"^12.7.5","downlevel-dts":"0.7.0","jest":"^26.1.0","rimraf":"^3.0.0","typedoc":"^0.19.2","typescript":"~4.1.2"},"engines":{"node":">=10.0.0"},"typesVersions":{"<4.0":{"types/*":["types/ts3.4/*"]}},"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/main/clients/client-lex-runtime-service","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"clients/client-lex-runtime-service"}}')},"9b2c":function(e,t,n){"use strict";n.r(t),n.d(t,"amplify_chatbot",(function(){return N}));var i,o,r,a=n("6260"),s=n("36de"),c=n("1f3a"),u=n("2482"),l=n("71b8"),d=n("1e35"),f=n("b597"),p=function(e,t,n,i){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function a(e){try{c(i.next(e))}catch(t){r(t)}}function s(e){try{c(i["throw"](e))}catch(t){r(t)}}function c(e){e.done?n(e.value):o(e.value).then(a,s)}c((i=i.apply(e,t||[])).next())}))},m=function(e,t){var n,i,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"===typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(e){return function(t){return c([e,t])}}function c(r){if(n)throw new TypeError("Generator is already executing.");while(a)try{if(n=1,i&&(o=2&r[0]?i["return"]:r[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,r[1])).done)return o;switch(i=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,i=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(o=a.trys,!(o=o.length>0&&o[o.length-1])&&(6===r[0]||2===r[0])){a=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){a.label=r[1];break}if(6===r[0]&&a.label<o[1]){a.label=o[1],o=r;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(r);break}o[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(s){r=[6,s],i=0}finally{n=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}},v=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),o=0;for(t=0;t<n;t++)for(var r=arguments[t],a=0,s=r.length;a<s;a++,o++)i[o]=r[a];return i},b="application/octet-stream",h=16e3,g=2048,y=-10,w=-90,x=.85,O=function(e,t){for(var n=new Float32Array(t),i=0,o=0;o<e.length;o++)n.set(e[o],i),i+=e[o].length;return n},S=function(e,t,n){if(n===t)return e;var i=t/n,o=Math.round(e.length/i),r=new Float32Array(o),a=0,s=0;while(a<r.length){for(var c=Math.round((a+1)*i),u=0,l=0,d=s;d<c&&d<e.length;d++)u+=e[d],l++;r[a]=u/l,a++,s=c}return r},j=function(e,t,n){for(var i=t,o=0;o<n.length;o++,i+=2){var r=Math.max(-1,Math.min(1,n[o]));e.setInt16(i,r<0?32768*r:32767*r,!0)}},E=function(e,t,n){for(var i=0;i<n.length;i++)e.setUint8(t+i,n.charCodeAt(i))},T=function(e,t){var n=2*e.length,i=24,o=8+n,r=12+i+o,a=new ArrayBuffer(r),s=new DataView(a);return E(s,0,"RIFF"),s.setUint32(4,i+o,!0),E(s,8,"WAVE"),E(s,12,"fmt "),s.setUint32(16,i-8,!0),s.setUint16(20,1,!0),s.setUint16(22,1,!0),s.setUint32(24,t,!0),s.setUint32(28,2*t,!0),s.setUint16(32,2,!0),s.setUint16(34,16,!0),E(s,36,"data"),s.setUint32(40,n,!0),j(s,44,e),s},C=function(e,t,n,i){var o=O(e,t),r=S(o,n,i),a=T(r,i),s=new Blob([a],{type:b});return s},L=new s["a"]("AudioRecorder"),I=function(){function e(e){this.streamBuffer=[],this.streamBufferLength=0,this.recording=!1,this.options=e}return e.prototype.init=function(){return p(this,void 0,void 0,(function(){var e=this;return m(this,(function(t){switch(t.label){case 0:return Object(c["b"])().isBrowser?(window.AudioContext=window.AudioContext||window.webkitAudioContext,this.audioContext=new AudioContext,[4,navigator.mediaDevices.getUserMedia({audio:!0}).then((function(t){e.audioSupported=!0,e.setupAudioNodes(t)})).catch((function(){return e.audioSupported=!1,Promise.reject("Audio is not supported")}))]):[3,2];case 1:return t.sent(),[3,3];case 2:return this.audioSupported=!1,[2,Promise.reject("Audio is not supported")];case 3:return[2]}}))}))},e.prototype.setupAudioNodes=function(e){return p(this,void 0,void 0,(function(){var t,n,i,o,r=this;return m(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.audioContext.resume()];case 1:return a.sent(),[3,3];case 2:return t=a.sent(),L.error(t),[3,3];case 3:return n=this.audioContext.createMediaStreamSource(e),i=this.audioContext.createScriptProcessor(4096,1,1),i.onaudioprocess=function(e){if(r.recording){var t=e.inputBuffer.getChannelData(0);r.streamBuffer.push(new Float32Array(t)),r.streamBufferLength+=t.length,r.analyse()}},o=this.audioContext.createAnalyser(),o.minDecibels=w,o.maxDecibels=y,o.smoothingTimeConstant=x,n.connect(o),o.connect(i),i.connect(n.context.destination),this.analyserNode=o,[2]}}))}))},e.prototype.startRecording=function(e,t){return p(this,void 0,void 0,(function(){var n,i;return m(this,(function(o){switch(o.label){case 0:if(this.recording||!this.audioSupported)return[2];this.onSilence=e||function(){},this.visualizer=t||function(){},n=this.audioContext,o.label=1;case 1:return o.trys.push([1,3,,4]),[4,n.resume()];case 2:return o.sent(),[3,4];case 3:return i=o.sent(),L.error(i),[3,4];case 4:return this.start=Date.now(),this.recording=!0,[2]}}))}))},e.prototype.stopRecording=function(){this.audioSupported&&(this.recording=!1)},e.prototype.clear=function(){this.stopRecording(),this.streamBufferLength=0,this.streamBuffer=[]},e.prototype.play=function(e){var t=this;if(e&&this.audioSupported){var n=new Blob([e]);return new Promise((function(e,i){var o=new FileReader;o.onload=function(){t.playbackSource&&t.playbackSource.disconnect(),t.playbackSource=t.audioContext.createBufferSource();var n=function(n){t.playbackSource.buffer=n,t.playbackSource.connect(t.audioContext.destination),t.playbackSource.onended=function(){return e()},t.playbackSource.start(0)},r=function(e){return i(e)};t.audioContext.decodeAudioData(o.result,n,r)},o.onerror=function(){return i()},o.readAsArrayBuffer(n)}))}},e.prototype.stop=function(){this.playbackSource&&this.playbackSource.stop()},e.prototype.analyse=function(){if(this.audioSupported){var e=this.analyserNode;e.fftSize=g;var t=e.fftSize,n=new Uint8Array(t),i=this.options.amplitude,o=this.options.time;e.getByteTimeDomainData(n),this.visualizer(n,t);for(var r=0;r<t;r++){var a=n[r]/128-1;(a>i||a<-1*i)&&(this.start=Date.now())}var s=Date.now(),c=s-this.start;c>o&&this.onSilence()}},e.prototype.exportWAV=function(e){return void 0===e&&(e=h),p(this,void 0,void 0,(function(){var t,n;return m(this,(function(i){return this.audioSupported?(t=this.audioContext.sampleRate,n=C(this.streamBuffer,this.streamBufferLength,t,e),this.clear(),[2,n]):[2]}))}))},e}(),k=function(e,t,n){if(n){if(!Object(c["b"])().isBrowser)throw new Error("Visualization is not supported on non-browsers.");var i=n.getBoundingClientRect(),o=i.width,r=i.height;n.width=o,n.height=r;var a=n.getContext("2d");a.fillStyle="white",a.clearRect(0,0,o,r);var s=function(){a.fillRect(0,0,o,r),a.lineWidth=1;var i=getComputedStyle(document.documentElement).getPropertyValue("--amplify-primary-color");a.strokeStyle=i&&""!==i?i:"#ff9900",a.beginPath();for(var s=1*o/t,c=0,u=0;u<t||u%3===0;u++){var l=e[u]/128,d=l*r/2;0===u?a.moveTo(c,d):a.lineTo(c,d),c+=s}a.lineTo(n.width,n.height/2),a.stroke()};requestAnimationFrame(s)}},A=".bot .dot{background-color:var(--bot-dot-color)}.user .dot{background-color:var(--user-dot-color)}.dot-flashing{width:2.625rem}.dot-flashing .dot{display:inline-block;width:0.625rem;height:0.625rem;border-radius:10rem;opacity:0.65}.dot-flashing .left{-webkit-animation:dot-flashing 1s infinite alternate;animation:dot-flashing 1s infinite alternate;-webkit-animation-delay:0s;animation-delay:0s}.dot-flashing .middle{margin-left:0.375rem;margin-right:0.375rem;-webkit-animation:dot-flashing 1s infinite linear alternate;animation:dot-flashing 1s infinite linear alternate;-webkit-animation-delay:0.5s;animation-delay:0.5s}.dot-flashing .right{-webkit-animation:dot-flashing 1s infinite alternate;animation:dot-flashing 1s infinite alternate;-webkit-animation-delay:1s;animation-delay:1s}@-webkit-keyframes dot-flashing{0%{opacity:0.65}50%,100%{opacity:0.1}}@keyframes dot-flashing{0%{opacity:0.65}50%,100%{opacity:0.1}}:host{--width:28.75rem;--height:37.5rem;--header-color:var(--amplify-secondary-color);--header-size:var(--amplify-text-lg);--bot-background-color:rgb(230, 230, 230);--bot-text-color:black;--bot-dot-color:var(--bot-text-color);--user-background-color:var(--amplify-blue);--user-text-color:var(--amplify-white);--user-dot-color:var(--user-text-color)}.amplify-chatbot{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column;background-color:var(--background-color);border-radius:0.375rem;-webkit-box-shadow:0.0625rem 0rem 0.25rem 0 rgba(0, 0, 0, 0.15);box-shadow:0.0625rem 0rem 0.25rem 0 rgba(0, 0, 0, 0.15);-webkit-box-sizing:border-box;box-sizing:border-box;font-family:var(--amplify-font-family);margin-bottom:1rem;width:100%;height:var(--height);max-width:var(--width)}@media (min-width: 672px){.amplify-chatbot{width:var(--width)}}.header{padding:1.25rem 0.375rem 1.25rem 0.375rem;color:var(--header-color);font-size:var(--header-size);font-weight:bold;text-align:center;word-wrap:break-word}.body{border-top:0.0625rem solid rgba(0, 0, 0, 0.05);padding:1.5rem 1rem 0 1rem;display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-ms-flex-direction:column;flex-direction:column;overflow:auto}.bubble{max-width:100%;padding:0.8em 1.4em;text-align:left;word-wrap:break-word;margin-bottom:0.625rem}.bot{margin-right:auto;background-color:var(--bot-background-color);color:var(--bot-text-color);border-radius:1.5rem 1.5rem 1.5rem 0}.user{margin-left:auto;background-color:var(--user-background-color);color:var(--user-text-color);border-radius:1.5rem 1.5rem 0 1.5rem}.footer{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-top:0.062rem solid rgba(0, 0, 0, 0.05);padding-right:0.625rem;min-height:3.125rem}.footer amplify-input{--border:none;--margin:0;-ms-flex-positive:1;flex-grow:1}canvas{margin-left:0.625rem;margin-right:0.625rem;-ms-flex-positive:1;flex-grow:1;height:3.125rem}.icon-button{--icon-height:1.25rem;--icon-fill:var(--amplify-primary-color);--padding:0.625rem;--width:auto}";(function(e){e[e["Initial"]=0]="Initial",e[e["Listening"]=1]="Listening",e[e["SendingText"]=2]="SendingText",e[e["SendingVoice"]=3]="SendingVoice",e[e["Error"]=4]="Error"})(i||(i={})),function(e){e["Bot"]="bot",e["User"]="user"}(o||(o={})),function(e){e[e["Recoverable"]=0]="Recoverable",e[e["Unrecoverable"]=1]="Unrecoverable"}(r||(r={}));var N=function(){function e(e){var t=this;Object(a["k"])(this,e),this.clearOnComplete=!1,this.conversationModeOn=!1,this.botTitle=l["a"].CHATBOT_TITLE,this.voiceEnabled=!1,this.textEnabled=!0,this.silenceTime=1500,this.silenceThreshold=.2,this.messages=[],this.text="",this.chatState=i.Initial,this.messageJSX=function(e){var n=e.map((function(e){return Object(a["i"])("div",{class:"bubble "+e.from},e.content)}));if(t.chatState===i.SendingText||t.chatState===i.SendingVoice){var r=t.chatState===i.SendingText?o.Bot:o.User;n.push(Object(a["i"])("div",{class:"bubble "+r},Object(a["i"])("div",{class:"dot-flashing "+r},Object(a["i"])("span",{class:"dot left"}),Object(a["i"])("span",{class:"dot middle"}),Object(a["i"])("span",{class:"dot right"}))))}return n},this.chatCompleted=Object(a["f"])(this,"chatCompleted",7)}return e.prototype.submitHandler=function(e){this.sendTextMessage()},e.prototype.componentWillLoad=function(){if(!f["a"]||"function"!==typeof f["a"].onComplete)throw new Error(d["j"]);this.validateProps()},e.prototype.componentDidRender=function(){var e=this.element.shadowRoot.querySelector(".body");e.scrollTop=e.scrollHeight},e.prototype.validateProps=function(){var e=this;if(this.voiceEnabled||this.textEnabled)if(this.botName){this.welcomeMessage&&this.appendToChat(this.welcomeMessage,o.Bot),this.voiceEnabled&&(this.audioRecorder=new I({time:this.silenceTime,amplitude:this.silenceThreshold}),this.audioRecorder.init().catch((function(t){e.setError(t,r.Recoverable)})));var t=function(t,n){e.chatCompleted.emit({data:n,err:t}),e.clearOnComplete?e.reset():e.chatState=i.Initial};try{f["a"].onComplete(this.botName,t)}catch(n){this.setError(n,r.Unrecoverable)}}else this.setError(l["a"].NO_BOT_NAME_ERROR,r.Unrecoverable);else this.setError(l["a"].CHAT_DISABLED_ERROR,r.Unrecoverable)},e.prototype.handleSubmit=function(e){e.preventDefault(),this.sendTextMessage()},e.prototype.handleMicButton=function(){var e=this;this.chatState===i.Initial&&(this.audioRecorder.stop(),this.chatState=i.Listening,this.audioRecorder.startRecording((function(){return e.handleSilence()}),(function(t,n){return e.visualizer(t,n)})))},e.prototype.handleSilence=function(){var e=this;this.chatState=i.SendingVoice,this.audioRecorder.stopRecording(),this.audioRecorder.exportWAV().then((function(t){e.sendVoiceMessage(t)}))},e.prototype.handleTextChange=function(e){var t=e.target;this.text=t.value},e.prototype.handleCancelButton=function(){this.audioRecorder.clear(),this.chatState=i.Initial},e.prototype.handleToastClose=function(e){this.error=void 0,e===r.Recoverable&&(this.chatState=i.Initial)},e.prototype.visualizer=function(e,t){var n=this.element.shadowRoot.querySelector("canvas");k(e,t,n)},e.prototype.sendTextMessage=function(){return p(this,void 0,void 0,(function(){var e,t,n;return m(this,(function(a){switch(a.label){case 0:if(0===this.text.length||this.chatState!==i.Initial)return[2];e=this.text,this.text="",this.appendToChat(e,o.User),this.chatState=i.SendingText,a.label=1;case 1:return a.trys.push([1,3,,4]),[4,f["a"].send(this.botName,e)];case 2:return t=a.sent(),[3,4];case 3:return n=a.sent(),this.setError(n,r.Recoverable),[2];case 4:return t.message&&this.appendToChat(t.message,o.Bot),this.chatState=i.Initial,[2]}}))}))},e.prototype.sendVoiceMessage=function(e){return p(this,void 0,void 0,(function(){var t,n,a,s,c=this;return m(this,(function(u){switch(u.label){case 0:t={content:e,options:{messageType:"voice"}},u.label=1;case 1:return u.trys.push([1,3,,4]),[4,f["a"].send(this.botName,t)];case 2:return n=u.sent(),[3,4];case 3:return a=u.sent(),this.setError(a,r.Recoverable),[2];case 4:return this.chatState=i.Initial,s=n.dialogState,n.inputTranscript&&this.appendToChat(n.inputTranscript,o.User),this.appendToChat(n.message,o.Bot),[4,this.audioRecorder.play(n.audioStream).then((function(){c.conversationModeOn&&"Fulfilled"!==s&&"Failed"!==s&&c.chatState===i.Initial&&c.handleMicButton()})).catch((function(e){return c.setError(e,r.Recoverable)}))];case 5:return u.sent(),[2]}}))}))},e.prototype.appendToChat=function(e,t){this.messages=v(this.messages,[{content:e,from:t}])},e.prototype.setError=function(e,t){var n="string"===typeof e?e:e.message;this.chatState=i.Error,this.error={message:n,errorType:t}},e.prototype.reset=function(){this.chatState=i.Initial,this.text="",this.error=void 0,this.messages=[],this.welcomeMessage&&this.appendToChat(this.welcomeMessage,o.Bot),this.audioRecorder&&this.audioRecorder.clear()},e.prototype.listeningFooterJSX=function(){var e=this,t=Object(a["i"])("canvas",{height:"50"}),n=Object(a["i"])("amplify-button",{"data-test":"chatbot-cancel-button",handleButtonClick:function(){return e.handleCancelButton()},class:"icon-button",variant:"icon",icon:"ban"});return[t,n]},e.prototype.footerJSX=function(){var e=this;if(this.chatState===i.Listening)return this.listeningFooterJSX();var t=this.textEnabled?l["a"].TEXT_INPUT_PLACEHOLDER:l["a"].VOICE_INPUT_PLACEHOLDER,n=Object(a["i"])("amplify-input",{placeholder:u["a"].get(t),description:"text",handleInputChange:function(t){return e.handleTextChange(t)},value:this.text,disabled:this.chatState===i.Error||!this.textEnabled}),o=this.voiceEnabled&&Object(a["i"])("amplify-button",{"data-test":"chatbot-mic-button",handleButtonClick:function(){return e.handleMicButton()},class:"icon-button",variant:"icon",icon:"microphone",disabled:this.chatState===i.Error||this.chatState!==i.Initial}),r=this.textEnabled&&Object(a["i"])("amplify-button",{"data-test":"chatbot-send-button",class:"icon-button",variant:"icon",icon:"send",handleButtonClick:function(){return e.sendTextMessage()},disabled:this.chatState===i.Error||this.chatState!==i.Initial});return[n,o,r]},e.prototype.errorToast=function(){var e=this;if(this.error){var t=this.error,n=t.message,i=t.errorType;return Object(a["i"])("amplify-toast",{message:u["a"].get(n),handleClose:function(){return e.handleToastClose(i)}})}},e.prototype.render=function(){var e=this;return Object(a["i"])(a["b"],null,Object(a["i"])("div",{class:"amplify-chatbot"},Object(a["i"])("slot",{name:"header"},Object(a["i"])("div",{class:"header","data-test":"chatbot-header"},u["a"].get(this.botTitle))),Object(a["i"])("div",{class:"body","data-test":"chatbot-body"},this.messageJSX(this.messages)),Object(a["i"])("form",{onSubmit:function(t){return e.handleSubmit(t)}},Object(a["i"])("div",{class:"footer","data-test":"chatbot-footer"},this.footerJSX())),this.errorToast()))},Object.defineProperty(e.prototype,"element",{get:function(){return Object(a["h"])(this)},enumerable:!1,configurable:!0}),e}();N.style=A},b597:function(e,t,n){"use strict";n.d(t,"a",(function(){return De}));var i,o,r,a,s,c,u,l,d,f,p,m,v,b,h,g,y,w,x,O,S,j,E,T,C,L,I,k,A,N,_,z,P,R,F,B,M,U=n("36de"),D=n("7d03"),$=function(){return $=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},$.apply(this,arguments)},q=new U["a"]("AbstractInteractionsProvider"),V=function(){function e(e){void 0===e&&(e={}),this._config=e}return e.prototype.configure=function(e){return void 0===e&&(e={}),this._config=$($({},this._config),e),q.debug("configure "+this.getProviderName(),this._config),this.options},e.prototype.getCategory=function(){return"Interactions"},Object.defineProperty(e.prototype,"options",{get:function(){return $({},this._config)},enumerable:!0,configurable:!0}),e}(),H=n("be27"),W=n("0881"),J=n("be23"),G=n("2d49"),X=n("2767"),Y=n("50c7"),K=n("4b75"),Q=n("37db"),Z=n("c14f"),ee=n("5d63"),te="runtime.lex.{region}.amazonaws.com",ne="runtime.lex.{region}.amazonaws.com.cn",ie="runtime.lex.{region}.c2s.ic.gov",oe="runtime.lex.{region}.sc2s.sgov.gov",re="runtime.lex.{region}.amazonaws.com",ae=new Set(["af-south-1","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-south-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"]),se=new Set(["cn-north-1","cn-northwest-1"]),ce=new Set(["us-iso-east-1"]),ue=new Set(["us-isob-east-1"]),le=new Set(["us-gov-east-1","us-gov-west-1"]),de=function(e,t){var n=void 0;switch(e){case"ap-northeast-1":n={hostname:"runtime.lex.ap-northeast-1.amazonaws.com",partition:"aws",signingService:"lex"};break;case"ap-southeast-1":n={hostname:"runtime.lex.ap-southeast-1.amazonaws.com",partition:"aws",signingService:"lex"};break;case"ap-southeast-2":n={hostname:"runtime.lex.ap-southeast-2.amazonaws.com",partition:"aws",signingService:"lex"};break;case"eu-central-1":n={hostname:"runtime.lex.eu-central-1.amazonaws.com",partition:"aws",signingService:"lex"};break;case"eu-west-1":n={hostname:"runtime.lex.eu-west-1.amazonaws.com",partition:"aws",signingService:"lex"};break;case"eu-west-2":n={hostname:"runtime.lex.eu-west-2.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:ae.has(e)&&(n={hostname:te.replace("{region}",e),partition:"aws",signingService:"lex"}),se.has(e)&&(n={hostname:ne.replace("{region}",e),partition:"aws-cn"}),ce.has(e)&&(n={hostname:ie.replace("{region}",e),partition:"aws-iso"}),ue.has(e)&&(n={hostname:oe.replace("{region}",e),partition:"aws-iso-b"}),le.has(e)&&(n={hostname:re.replace("{region}",e),partition:"aws-us-gov"}),void 0===n&&(n={hostname:te.replace("{region}",e),partition:"aws",signingService:"lex"})}return Promise.resolve(Object(H["a"])({signingService:"lex"},n))},fe=n("da3e"),pe={apiVersion:"2016-11-28",disableHostPrefix:!1,logger:{},regionInfoProvider:de,serviceId:"Lex Runtime Service",urlParser:fe["a"]},me=Object(H["a"])(Object(H["a"])({},pe),{runtime:"browser",base64Decoder:K["a"],base64Encoder:K["b"],bodyLengthChecker:Q["a"],credentialDefaultProvider:function(e){return function(){return Promise.reject(new Error("Credential is missing"))}},defaultUserAgentProvider:Object(Z["a"])({serviceId:pe.serviceId,clientVersion:W.version}),maxAttempts:Y["a"],region:Object(X["a"])("Region is missing"),requestHandler:new G["a"],sha256:J["Sha256"],streamCollector:G["b"],utf8Decoder:ee["fromUtf8"],utf8Encoder:ee["toUtf8"]}),ve=n("36d4"),be=n("9dac"),he=n("365f"),ge=n("fad4"),ye=n("a9cb"),we=n("f3b6"),xe=n("108d"),Oe=function(e){function t(t){var n=this,i=Object(H["a"])(Object(H["a"])({},me),t),o=Object(ve["b"])(i),r=Object(ve["a"])(o),a=Object(ye["b"])(r),s=Object(Y["c"])(a),c=Object(he["b"])(s),u=Object(we["b"])(c);return n=e.call(this,u)||this,n.config=u,n.middlewareStack.use(Object(ye["a"])(n.config)),n.middlewareStack.use(Object(Y["b"])(n.config)),n.middlewareStack.use(Object(be["a"])(n.config)),n.middlewareStack.use(Object(he["a"])(n.config)),n.middlewareStack.use(Object(ge["a"])(n.config)),n.middlewareStack.use(Object(we["a"])(n.config)),n}return Object(H["c"])(t,e),t.prototype.destroy=function(){e.prototype.destroy.call(this)},t}(xe["a"]);(function(e){e.filterSensitiveLog=function(e){return Object(H["a"])({},e)}})(i||(i={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])(Object(H["a"])({},e),e.parameters&&{parameters:xe["d"]})}}(o||(o={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])({},e)}}(r||(r={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])({},e)}}(a||(a={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])({},e)}}(s||(s={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])({},e)}}(c||(c={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])({},e)}}(u||(u={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])({},e)}}(l||(l={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])({},e)}}(d||(d={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])({},e)}}(f||(f={})),function(e){e["FAILED"]="Failed",e["FULFILLED"]="Fulfilled",e["READY_FOR_FULFILLMENT"]="ReadyForFulfillment"}(p||(p={})),function(e){e["COMPOSITE"]="Composite",e["CUSTOM_PAYLOAD"]="CustomPayload",e["PLAIN_TEXT"]="PlainText",e["SSML"]="SSML"}(m||(m={})),function(e){e["CLOSE"]="Close",e["CONFIRM_INTENT"]="ConfirmIntent",e["DELEGATE"]="Delegate",e["ELICIT_INTENT"]="ElicitIntent",e["ELICIT_SLOT"]="ElicitSlot"}(v||(v={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])(Object(H["a"])(Object(H["a"])({},e),e.slots&&{slots:xe["d"]}),e.message&&{message:xe["d"]})}}(b||(b={})),function(e){e["CONFIRMED"]="Confirmed",e["DENIED"]="Denied",e["NONE"]="None"}(h||(h={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])(Object(H["a"])({},e),e.slots&&{slots:xe["d"]})}}(g||(g={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])(Object(H["a"])(Object(H["a"])(Object(H["a"])(Object(H["a"])({},e),e.recentIntentSummaryView&&{recentIntentSummaryView:e.recentIntentSummaryView.map((function(e){return g.filterSensitiveLog(e)}))}),e.sessionAttributes&&{sessionAttributes:xe["d"]}),e.dialogAction&&{dialogAction:b.filterSensitiveLog(e.dialogAction)}),e.activeContexts&&{activeContexts:xe["d"]})}}(y||(y={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])({},e)}}(w||(w={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])({},e)}}(x||(x={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])({},e)}}(O||(O={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])({},e)}}(S||(S={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])(Object(H["a"])(Object(H["a"])(Object(H["a"])({},e),e.sessionAttributes&&{sessionAttributes:xe["d"]}),e.requestAttributes&&{requestAttributes:xe["d"]}),e.activeContexts&&{activeContexts:xe["d"]})}}(j||(j={})),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"}(E||(E={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])(Object(H["a"])(Object(H["a"])({},e),e.message&&{message:xe["d"]}),e.activeContexts&&{activeContexts:xe["d"]})}}(T||(T={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])({},e)}}(C||(C={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])({},e)}}(L||(L={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])(Object(H["a"])(Object(H["a"])(Object(H["a"])(Object(H["a"])({},e),e.sessionAttributes&&{sessionAttributes:xe["d"]}),e.requestAttributes&&{requestAttributes:xe["d"]}),e.inputText&&{inputText:xe["d"]}),e.activeContexts&&{activeContexts:xe["d"]})}}(I||(I={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])({},e)}}(k||(k={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])(Object(H["a"])({},e),e.slots&&{slots:xe["d"]})}}(A||(A={})),function(e){e["GENERIC"]="application/vnd.amazonaws.card.generic"}(N||(N={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])({},e)}}(_||(_={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])({},e)}}(z||(z={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])({},e)}}(P||(P={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])({},e)}}(R||(R={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])(Object(H["a"])(Object(H["a"])(Object(H["a"])(Object(H["a"])(Object(H["a"])({},e),e.alternativeIntents&&{alternativeIntents:e.alternativeIntents.map((function(e){return A.filterSensitiveLog(e)}))}),e.slots&&{slots:xe["d"]}),e.sessionAttributes&&{sessionAttributes:xe["d"]}),e.message&&{message:xe["d"]}),e.activeContexts&&{activeContexts:xe["d"]})}}(F||(F={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])(Object(H["a"])(Object(H["a"])(Object(H["a"])(Object(H["a"])({},e),e.sessionAttributes&&{sessionAttributes:xe["d"]}),e.dialogAction&&{dialogAction:b.filterSensitiveLog(e.dialogAction)}),e.recentIntentSummaryView&&{recentIntentSummaryView:e.recentIntentSummaryView.map((function(e){return g.filterSensitiveLog(e)}))}),e.activeContexts&&{activeContexts:xe["d"]})}}(B||(B={})),function(e){e.filterSensitiveLog=function(e){return Object(H["a"])(Object(H["a"])(Object(H["a"])({},e),e.message&&{message:xe["d"]}),e.activeContexts&&{activeContexts:xe["d"]})}}(M||(M={}));var Se=n("ddfb"),je=n("991b"),Ee=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return Object(H["c"])(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(Object(je["a"])(t,this.serialize,this.deserialize));var i=e.concat(this.middlewareStack),o=t.logger,r="LexRuntimeServiceClient",a="PostTextCommand",s={logger:o,clientName:r,commandName:a,inputFilterSensitiveLog:I.filterSensitiveLog,outputFilterSensitiveLog:F.filterSensitiveLog},c=t.requestHandler;return i.resolve((function(e){return c.handle(e.request,n||{})}),s)},t.prototype.serialize=function(e,t){return Object(Se["d"])(e,t)},t.prototype.deserialize=function(e,t){return Object(Se["b"])(e,t)},t}(xe["b"]),Te=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return Object(H["c"])(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(Object(je["a"])(t,this.serialize,this.deserialize));var i=e.concat(this.middlewareStack),o=t.logger,r="LexRuntimeServiceClient",a="PostContentCommand",s={logger:o,clientName:r,commandName:a,inputFilterSensitiveLog:j.filterSensitiveLog,outputFilterSensitiveLog:T.filterSensitiveLog},c=t.requestHandler;return i.resolve((function(e){return c.handle(e.request,n||{})}),s)},t.prototype.serialize=function(e,t){return Object(Se["c"])(e,t)},t.prototype.deserialize=function(e,t){return Object(Se["a"])(e,t)},t}(xe["b"]),Ce=n("475d"),Le=n("fab4"),Ie=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.")},ke=function(){var e=function(t,n){return e=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,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Ae=function(){return Ae=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ae.apply(this,arguments)},Ne=function(e,t,n,i){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function a(e){try{c(i.next(e))}catch(t){r(t)}}function s(e){try{c(i["throw"](e))}catch(t){r(t)}}function c(e){e.done?n(e.value):o(e.value).then(a,s)}c((i=i.apply(e,t||[])).next())}))},_e=function(e,t){var n,i,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"===typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(e){return function(t){return c([e,t])}}function c(r){if(n)throw new TypeError("Generator is already executing.");while(a)try{if(n=1,i&&(o=2&r[0]?i["return"]:r[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,r[1])).done)return o;switch(i=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,i=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(o=a.trys,!(o=o.length>0&&o[o.length-1])&&(6===r[0]||2===r[0])){a=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){a.label=r[1];break}if(6===r[0]&&a.label<o[1]){a.label=o[1],o=r;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(r);break}o[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(s){r=[6,s],i=0}finally{n=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}},ze=new U["a"]("AWSLexProvider"),Pe=function(e){function t(t){void 0===t&&(t={});var n=e.call(this,t)||this;return n._botsCompleteCallback={},n}return ke(t,e),t.prototype.getProviderName=function(){return"AWSLexProvider"},t.prototype.reportBotStatus=function(e,t){var n=this;ze.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 Ne(this,void 0,void 0,(function(){var n,i,o,r,a,s,c,u,l,d;return _e(this,(function(f){switch(f.label){case 0:return this._config[e]?[4,Ce["a"].get()]:[2,Promise.reject("Bot "+e+" does not exist")];case 1:if(n=f.sent(),!n)return[2,Promise.reject("No credentials")];if(this.lexRuntimeServiceClient=new Oe({region:this._config[e].region,credentials:n,customUserAgent:Object(Le["b"])()}),"string"!==typeof t)return[3,6];i={botAlias:this._config[e].alias,botName:e,inputText:t,userId:n.identityId},ze.debug("postText to lex",t),f.label=2;case 2:return f.trys.push([2,4,,5]),o=new Ee(i),[4,this.lexRuntimeServiceClient.send(o)];case 3:return u=f.sent(),this.reportBotStatus(u,e),[2,u];case 4:return r=f.sent(),[2,Promise.reject(r)];case 5:return[3,11];case 6:a=t.content,s=t.options.messageType,i="voice"===s?{botAlias:this._config[e].alias,botName:e,contentType:"audio/x-l16; sample-rate=16000",inputStream:a,userId:n.identityId,accept:"audio/mpeg"}:{botAlias:this._config[e].alias,botName:e,contentType:"text/plain; charset=utf-8",inputStream:a,userId:n.identityId,accept:"audio/mpeg"},ze.debug("postContent to lex",t),f.label=7;case 7:return f.trys.push([7,10,,11]),c=new Te(i),[4,this.lexRuntimeServiceClient.send(c)];case 8:return u=f.sent(),[4,Ie(u.audioStream)];case 9:return l=f.sent(),this.reportBotStatus(u,e),[2,Ae(Ae({},u),{audioStream:l})];case 10:return d=f.sent(),[2,Promise.reject(d)];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}(V),Re=function(){return Re=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Re.apply(this,arguments)},Fe=function(e,t,n,i){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function a(e){try{c(i.next(e))}catch(t){r(t)}}function s(e){try{c(i["throw"](e))}catch(t){r(t)}}function c(e){e.done?n(e.value):o(e.value).then(a,s)}c((i=i.apply(e,t||[])).next())}))},Be=function(e,t){var n,i,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"===typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(e){return function(t){return c([e,t])}}function c(r){if(n)throw new TypeError("Generator is already executing.");while(a)try{if(n=1,i&&(o=2&r[0]?i["return"]:r[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,r[1])).done)return o;switch(i=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,i=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(o=a.trys,!(o=o.length>0&&o[o.length-1])&&(6===r[0]||2===r[0])){a=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){a.label=r[1];break}if(6===r[0]&&a.label<o[1]){a.label=o[1],o=r;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(r);break}o[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(s){r=[6,s],i=0}finally{n=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}},Me=new U["a"]("Interactions"),Ue=function(){function e(e){this._options=e,Me.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:{};Me.debug("configure Interactions",{opt:n}),this._options=Re(Re({bots:{}},n),n.Interactions);var i=this._options.aws_bots_config,o=this._options.bots;return!Object.keys(o).length&&i&&Array.isArray(i)&&i.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 Pe),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 Fe(this,void 0,void 0,(function(){var n;return Be(this,(function(i){switch(i.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,i.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}(),De=new Ue(null);D["a"].register(De)},be27:function(e,t,n){"use strict";n.d(t,"c",(function(){return o})),n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return a})),n.d(t,"d",(function(){return s})),n.d(t,"e",(function(){return c}));
  /*! *****************************************************************************
  Copyright (c) Microsoft Corporation.
  
  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted.
  
  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  PERFORMANCE OF THIS SOFTWARE.
  ***************************************************************************** */
  var i=function(e,t){return i=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])},i(e,t)};function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var r=function(){return r=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)};function a(e,t,n,i){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function a(e){try{c(i.next(e))}catch(t){r(t)}}function s(e){try{c(i["throw"](e))}catch(t){r(t)}}function c(e){e.done?n(e.value):o(e.value).then(a,s)}c((i=i.apply(e,t||[])).next())}))}function s(e,t){var n,i,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"===typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(e){return function(t){return c([e,t])}}function c(r){if(n)throw new TypeError("Generator is already executing.");while(a)try{if(n=1,i&&(o=2&r[0]?i["return"]:r[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,r[1])).done)return o;switch(i=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,i=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(o=a.trys,!(o=o.length>0&&o[o.length-1])&&(6===r[0]||2===r[0])){a=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){a.label=r[1];break}if(6===r[0]&&a.label<o[1]){a.label=o[1],o=r;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(r);break}o[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(s){r=[6,s],i=0}finally{n=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}}Object.create;function c(e,t){var n="function"===typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{while((void 0===t||t-- >0)&&!(i=r.next()).done)a.push(i.value)}catch(s){o={error:s}}finally{try{i&&!i.done&&(n=r["return"])&&n.call(r)}finally{if(o)throw o.error}}return a}Object.create},ddfb:function(e,t,n){"use strict";(function(e){n.d(t,"c",(function(){return a})),n.d(t,"d",(function(){return s})),n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return l}));var i=n("be27"),o=n("1279"),r=n("108d"),a=function(t,n){return Object(i["b"])(void 0,void 0,void 0,(function(){var a,s,c,u,l,d,f,p,m;return Object(i["d"])(this,(function(v){switch(v.label){case 0:if(a=Object(i["a"])(Object(i["a"])(Object(i["a"])(Object(i["a"])(Object(i["a"])({"content-type":"application/octet-stream","x-amz-content-sha256":"UNSIGNED-PAYLOAD"},H(t.sessionAttributes)&&{"x-amz-lex-session-attributes":e.from(r["c"].fromObject(t.sessionAttributes)).toString("base64")}),H(t.requestAttributes)&&{"x-amz-lex-request-attributes":e.from(r["c"].fromObject(t.requestAttributes)).toString("base64")}),H(t.contentType)&&{"content-type":t.contentType}),H(t.accept)&&{accept:t.accept}),H(t.activeContexts)&&{"x-amz-lex-active-contexts":e.from(r["c"].fromObject(t.activeContexts)).toString("base64")}),s="/bot/{botName}/alias/{botAlias}/user/{userId}/content",void 0===t.botName)throw new Error("No value provided for input HTTP label: botName.");if(c=t.botName,c.length<=0)throw new Error("Empty value provided for input HTTP label: botName.");if(s=s.replace("{botName}",Object(r["f"])(c)),void 0===t.botAlias)throw new Error("No value provided for input HTTP label: botAlias.");if(c=t.botAlias,c.length<=0)throw new Error("Empty value provided for input HTTP label: botAlias.");if(s=s.replace("{botAlias}",Object(r["f"])(c)),void 0===t.userId)throw new Error("No value provided for input HTTP label: userId.");if(c=t.userId,c.length<=0)throw new Error("Empty value provided for input HTTP label: userId.");return s=s.replace("{userId}",Object(r["f"])(c)),void 0!==t.inputStream&&(u=t.inputStream),[4,n.endpoint()];case 1:return l=v.sent(),d=l.hostname,f=l.protocol,p=void 0===f?"https":f,m=l.port,[2,new o["a"]({protocol:p,hostname:d,port:m,method:"POST",headers:a,path:s,body:u})]}}))}))},s=function(e,t){return Object(i["b"])(void 0,void 0,void 0,(function(){var n,a,s,c,u,l,d,f,p;return Object(i["d"])(this,(function(m){switch(m.label){case 0:if(n={"content-type":"application/json"},a="/bot/{botName}/alias/{botAlias}/user/{userId}/text",void 0===e.botName)throw new Error("No value provided for input HTTP label: botName.");if(s=e.botName,s.length<=0)throw new Error("Empty value provided for input HTTP label: botName.");if(a=a.replace("{botName}",Object(r["f"])(s)),void 0===e.botAlias)throw new Error("No value provided for input HTTP label: botAlias.");if(s=e.botAlias,s.length<=0)throw new Error("Empty value provided for input HTTP label: botAlias.");if(a=a.replace("{botAlias}",Object(r["f"])(s)),void 0===e.userId)throw new Error("No value provided for input HTTP label: userId.");if(s=e.userId,s.length<=0)throw new Error("Empty value provided for input HTTP label: userId.");return a=a.replace("{userId}",Object(r["f"])(s)),c=JSON.stringify(Object(i["a"])(Object(i["a"])(Object(i["a"])(Object(i["a"])({},void 0!==e.activeContexts&&null!==e.activeContexts&&{activeContexts:E(e.activeContexts,t)}),void 0!==e.inputText&&null!==e.inputText&&{inputText:e.inputText}),void 0!==e.requestAttributes&&null!==e.requestAttributes&&{requestAttributes:C(e.requestAttributes,t)}),void 0!==e.sessionAttributes&&null!==e.sessionAttributes&&{sessionAttributes:C(e.sessionAttributes,t)})),[4,t.endpoint()];case 1:return u=m.sent(),l=u.hostname,d=u.protocol,f=void 0===d?"https":d,p=u.port,[2,new o["a"]({protocol:f,hostname:l,port:p,method:"POST",headers:n,path:a,body:c})]}}))}))},c=function(t,n){return Object(i["b"])(void 0,void 0,void 0,(function(){var o,a;return Object(i["d"])(this,(function(i){return 200!==t.statusCode&&t.statusCode>=300?[2,u(t,n)]:(o={$metadata:$(t),activeContexts:void 0,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!==t.headers["content-type"]&&(o.contentType=t.headers["content-type"]),void 0!==t.headers["x-amz-lex-intent-name"]&&(o.intentName=t.headers["x-amz-lex-intent-name"]),void 0!==t.headers["x-amz-lex-nlu-intent-confidence"]&&(o.nluIntentConfidence=new r["c"](e.from(t.headers["x-amz-lex-nlu-intent-confidence"],"base64").toString("ascii"))),void 0!==t.headers["x-amz-lex-alternative-intents"]&&(o.alternativeIntents=new r["c"](e.from(t.headers["x-amz-lex-alternative-intents"],"base64").toString("ascii"))),void 0!==t.headers["x-amz-lex-slots"]&&(o.slots=new r["c"](e.from(t.headers["x-amz-lex-slots"],"base64").toString("ascii"))),void 0!==t.headers["x-amz-lex-session-attributes"]&&(o.sessionAttributes=new r["c"](e.from(t.headers["x-amz-lex-session-attributes"],"base64").toString("ascii"))),void 0!==t.headers["x-amz-lex-sentiment"]&&(o.sentimentResponse=t.headers["x-amz-lex-sentiment"]),void 0!==t.headers["x-amz-lex-message"]&&(o.message=t.headers["x-amz-lex-message"]),void 0!==t.headers["x-amz-lex-message-format"]&&(o.messageFormat=t.headers["x-amz-lex-message-format"]),void 0!==t.headers["x-amz-lex-dialog-state"]&&(o.dialogState=t.headers["x-amz-lex-dialog-state"]),void 0!==t.headers["x-amz-lex-slot-to-elicit"]&&(o.slotToElicit=t.headers["x-amz-lex-slot-to-elicit"]),void 0!==t.headers["x-amz-lex-input-transcript"]&&(o.inputTranscript=t.headers["x-amz-lex-input-transcript"]),void 0!==t.headers["x-amz-lex-bot-version"]&&(o.botVersion=t.headers["x-amz-lex-bot-version"]),void 0!==t.headers["x-amz-lex-session-id"]&&(o.sessionId=t.headers["x-amz-lex-session-id"]),void 0!==t.headers["x-amz-lex-active-contexts"]&&(o.activeContexts=new r["c"](e.from(t.headers["x-amz-lex-active-contexts"],"base64").toString("ascii"))),a=t.body,o.audioStream=a,[2,Promise.resolve(o)])}))}))},u=function(e,t){return Object(i["b"])(void 0,void 0,void 0,(function(){var n,o,r,a,s,c,u,l,d,S,j,E,T,C,L,I,k,A,N;return Object(i["d"])(this,(function(_){switch(_.label){case 0:return o=[Object(i["a"])({},e)],N={},[4,W(e.body,t)];case 1:switch(n=i["a"].apply(void 0,o.concat([(N.body=_.sent(),N)])),a="UnknownError",a=J(e,n.body),s=a,s){case"BadGatewayException":return[3,2];case"com.amazonaws.lexruntimeservice#BadGatewayException":return[3,2];case"BadRequestException":return[3,4];case"com.amazonaws.lexruntimeservice#BadRequestException":return[3,4];case"ConflictException":return[3,6];case"com.amazonaws.lexruntimeservice#ConflictException":return[3,6];case"DependencyFailedException":return[3,8];case"com.amazonaws.lexruntimeservice#DependencyFailedException":return[3,8];case"InternalFailureException":return[3,10];case"com.amazonaws.lexruntimeservice#InternalFailureException":return[3,10];case"LimitExceededException":return[3,12];case"com.amazonaws.lexruntimeservice#LimitExceededException":return[3,12];case"LoopDetectedException":return[3,14];case"com.amazonaws.lexruntimeservice#LoopDetectedException":return[3,14];case"NotAcceptableException":return[3,16];case"com.amazonaws.lexruntimeservice#NotAcceptableException":return[3,16];case"NotFoundException":return[3,18];case"com.amazonaws.lexruntimeservice#NotFoundException":return[3,18];case"RequestTimeoutException":return[3,20];case"com.amazonaws.lexruntimeservice#RequestTimeoutException":return[3,20];case"UnsupportedMediaTypeException":return[3,22];case"com.amazonaws.lexruntimeservice#UnsupportedMediaTypeException":return[3,22]}return[3,24];case 2:return c=[{}],[4,f(n,t)];case 3:return r=i["a"].apply(void 0,[i["a"].apply(void 0,c.concat([_.sent()])),{name:a,$metadata:$(e)}]),[3,25];case 4:return u=[{}],[4,p(n,t)];case 5:return r=i["a"].apply(void 0,[i["a"].apply(void 0,u.concat([_.sent()])),{name:a,$metadata:$(e)}]),[3,25];case 6:return l=[{}],[4,m(n,t)];case 7:return r=i["a"].apply(void 0,[i["a"].apply(void 0,l.concat([_.sent()])),{name:a,$metadata:$(e)}]),[3,25];case 8:return d=[{}],[4,v(n,t)];case 9:return r=i["a"].apply(void 0,[i["a"].apply(void 0,d.concat([_.sent()])),{name:a,$metadata:$(e)}]),[3,25];case 10:return S=[{}],[4,b(n,t)];case 11:return r=i["a"].apply(void 0,[i["a"].apply(void 0,S.concat([_.sent()])),{name:a,$metadata:$(e)}]),[3,25];case 12:return j=[{}],[4,h(n,t)];case 13:return r=i["a"].apply(void 0,[i["a"].apply(void 0,j.concat([_.sent()])),{name:a,$metadata:$(e)}]),[3,25];case 14:return E=[{}],[4,g(n,t)];case 15:return r=i["a"].apply(void 0,[i["a"].apply(void 0,E.concat([_.sent()])),{name:a,$metadata:$(e)}]),[3,25];case 16:return T=[{}],[4,y(n,t)];case 17:return r=i["a"].apply(void 0,[i["a"].apply(void 0,T.concat([_.sent()])),{name:a,$metadata:$(e)}]),[3,25];case 18:return C=[{}],[4,w(n,t)];case 19:return r=i["a"].apply(void 0,[i["a"].apply(void 0,C.concat([_.sent()])),{name:a,$metadata:$(e)}]),[3,25];case 20:return L=[{}],[4,x(n,t)];case 21:return r=i["a"].apply(void 0,[i["a"].apply(void 0,L.concat([_.sent()])),{name:a,$metadata:$(e)}]),[3,25];case 22:return I=[{}],[4,O(n,t)];case 23:return r=i["a"].apply(void 0,[i["a"].apply(void 0,I.concat([_.sent()])),{name:a,$metadata:$(e)}]),[3,25];case 24:k=n.body,a=k.code||k.Code||a,r=Object(i["a"])(Object(i["a"])({},k),{name:""+a,message:k.message||k.Message||a,$fault:"client",$metadata:$(e)}),_.label=25;case 25:return A=r.message||r.Message||a,r.message=A,delete r.Message,[2,Promise.reject(Object.assign(new Error(A),r))]}}))}))},l=function(e,t){return Object(i["b"])(void 0,void 0,void 0,(function(){var n,o;return Object(i["d"])(this,(function(i){switch(i.label){case 0:return 200!==e.statusCode&&e.statusCode>=300?[2,d(e,t)]:(n={$metadata:$(e),activeContexts:void 0,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,W(e.body,t)]);case 1:return o=i.sent(),void 0!==o.activeContexts&&null!==o.activeContexts&&(n.activeContexts=k(o.activeContexts,t)),void 0!==o.alternativeIntents&&null!==o.alternativeIntents&&(n.alternativeIntents=R(o.alternativeIntents,t)),void 0!==o.botVersion&&null!==o.botVersion&&(n.botVersion=o.botVersion),void 0!==o.dialogState&&null!==o.dialogState&&(n.dialogState=o.dialogState),void 0!==o.intentName&&null!==o.intentName&&(n.intentName=o.intentName),void 0!==o.message&&null!==o.message&&(n.message=o.message),void 0!==o.messageFormat&&null!==o.messageFormat&&(n.messageFormat=o.messageFormat),void 0!==o.nluIntentConfidence&&null!==o.nluIntentConfidence&&(n.nluIntentConfidence=P(o.nluIntentConfidence,t)),void 0!==o.responseCard&&null!==o.responseCard&&(n.responseCard=M(o.responseCard,t)),void 0!==o.sentimentResponse&&null!==o.sentimentResponse&&(n.sentimentResponse=U(o.sentimentResponse,t)),void 0!==o.sessionAttributes&&null!==o.sessionAttributes&&(n.sessionAttributes=D(o.sessionAttributes,t)),void 0!==o.sessionId&&null!==o.sessionId&&(n.sessionId=o.sessionId),void 0!==o.slotToElicit&&null!==o.slotToElicit&&(n.slotToElicit=o.slotToElicit),void 0!==o.slots&&null!==o.slots&&(n.slots=D(o.slots,t)),[2,Promise.resolve(n)]}}))}))},d=function(e,t){return Object(i["b"])(void 0,void 0,void 0,(function(){var n,o,r,a,s,c,u,l,d,y,x,O,S,j,E,T;return Object(i["d"])(this,(function(C){switch(C.label){case 0:return o=[Object(i["a"])({},e)],T={},[4,W(e.body,t)];case 1:switch(n=i["a"].apply(void 0,o.concat([(T.body=C.sent(),T)])),a="UnknownError",a=J(e,n.body),s=a,s){case"BadGatewayException":return[3,2];case"com.amazonaws.lexruntimeservice#BadGatewayException":return[3,2];case"BadRequestException":return[3,4];case"com.amazonaws.lexruntimeservice#BadRequestException":return[3,4];case"ConflictException":return[3,6];case"com.amazonaws.lexruntimeservice#ConflictException":return[3,6];case"DependencyFailedException":return[3,8];case"com.amazonaws.lexruntimeservice#DependencyFailedException":return[3,8];case"InternalFailureException":return[3,10];case"com.amazonaws.lexruntimeservice#InternalFailureException":return[3,10];case"LimitExceededException":return[3,12];case"com.amazonaws.lexruntimeservice#LimitExceededException":return[3,12];case"LoopDetectedException":return[3,14];case"com.amazonaws.lexruntimeservice#LoopDetectedException":return[3,14];case"NotFoundException":return[3,16];case"com.amazonaws.lexruntimeservice#NotFoundException":return[3,16]}return[3,18];case 2:return c=[{}],[4,f(n,t)];case 3:return r=i["a"].apply(void 0,[i["a"].apply(void 0,c.concat([C.sent()])),{name:a,$metadata:$(e)}]),[3,19];case 4:return u=[{}],[4,p(n,t)];case 5:return r=i["a"].apply(void 0,[i["a"].apply(void 0,u.concat([C.sent()])),{name:a,$metadata:$(e)}]),[3,19];case 6:return l=[{}],[4,m(n,t)];case 7:return r=i["a"].apply(void 0,[i["a"].apply(void 0,l.concat([C.sent()])),{name:a,$metadata:$(e)}]),[3,19];case 8:return d=[{}],[4,v(n,t)];case 9:return r=i["a"].apply(void 0,[i["a"].apply(void 0,d.concat([C.sent()])),{name:a,$metadata:$(e)}]),[3,19];case 10:return y=[{}],[4,b(n,t)];case 11:return r=i["a"].apply(void 0,[i["a"].apply(void 0,y.concat([C.sent()])),{name:a,$metadata:$(e)}]),[3,19];case 12:return x=[{}],[4,h(n,t)];case 13:return r=i["a"].apply(void 0,[i["a"].apply(void 0,x.concat([C.sent()])),{name:a,$metadata:$(e)}]),[3,19];case 14:return O=[{}],[4,g(n,t)];case 15:return r=i["a"].apply(void 0,[i["a"].apply(void 0,O.concat([C.sent()])),{name:a,$metadata:$(e)}]),[3,19];case 16:return S=[{}],[4,w(n,t)];case 17:return r=i["a"].apply(void 0,[i["a"].apply(void 0,S.concat([C.sent()])),{name:a,$metadata:$(e)}]),[3,19];case 18:j=n.body,a=j.code||j.Code||a,r=Object(i["a"])(Object(i["a"])({},j),{name:""+a,message:j.message||j.Message||a,$fault:"client",$metadata:$(e)}),C.label=19;case 19:return E=r.message||r.Message||a,r.message=E,delete r.Message,[2,Promise.reject(Object.assign(new Error(E),r))]}}))}))},f=function(e,t){return Object(i["b"])(void 0,void 0,void 0,(function(){var t,n;return Object(i["d"])(this,(function(i){return t={name:"BadGatewayException",$fault:"server",$metadata:$(e),Message:void 0},n=e.body,void 0!==n.Message&&null!==n.Message&&(t.Message=n.Message),[2,t]}))}))},p=function(e,t){return Object(i["b"])(void 0,void 0,void 0,(function(){var t,n;return Object(i["d"])(this,(function(i){return t={name:"BadRequestException",$fault:"client",$metadata:$(e),message:void 0},n=e.body,void 0!==n.message&&null!==n.message&&(t.message=n.message),[2,t]}))}))},m=function(e,t){return Object(i["b"])(void 0,void 0,void 0,(function(){var t,n;return Object(i["d"])(this,(function(i){return t={name:"ConflictException",$fault:"client",$metadata:$(e),message:void 0},n=e.body,void 0!==n.message&&null!==n.message&&(t.message=n.message),[2,t]}))}))},v=function(e,t){return Object(i["b"])(void 0,void 0,void 0,(function(){var t,n;return Object(i["d"])(this,(function(i){return t={name:"DependencyFailedException",$fault:"client",$metadata:$(e),Message:void 0},n=e.body,void 0!==n.Message&&null!==n.Message&&(t.Message=n.Message),[2,t]}))}))},b=function(e,t){return Object(i["b"])(void 0,void 0,void 0,(function(){var t,n;return Object(i["d"])(this,(function(i){return t={name:"InternalFailureException",$fault:"server",$metadata:$(e),message:void 0},n=e.body,void 0!==n.message&&null!==n.message&&(t.message=n.message),[2,t]}))}))},h=function(e,t){return Object(i["b"])(void 0,void 0,void 0,(function(){var t,n;return Object(i["d"])(this,(function(i){return t={name:"LimitExceededException",$fault:"client",$metadata:$(e),message:void 0,retryAfterSeconds:void 0},void 0!==e.headers["retry-after"]&&(t.retryAfterSeconds=e.headers["retry-after"]),n=e.body,void 0!==n.message&&null!==n.message&&(t.message=n.message),[2,t]}))}))},g=function(e,t){return Object(i["b"])(void 0,void 0,void 0,(function(){var t,n;return Object(i["d"])(this,(function(i){return t={name:"LoopDetectedException",$fault:"server",$metadata:$(e),Message:void 0},n=e.body,void 0!==n.Message&&null!==n.Message&&(t.Message=n.Message),[2,t]}))}))},y=function(e,t){return Object(i["b"])(void 0,void 0,void 0,(function(){var t,n;return Object(i["d"])(this,(function(i){return t={name:"NotAcceptableException",$fault:"client",$metadata:$(e),message:void 0},n=e.body,void 0!==n.message&&null!==n.message&&(t.message=n.message),[2,t]}))}))},w=function(e,t){return Object(i["b"])(void 0,void 0,void 0,(function(){var t,n;return Object(i["d"])(this,(function(i){return t={name:"NotFoundException",$fault:"client",$metadata:$(e),message:void 0},n=e.body,void 0!==n.message&&null!==n.message&&(t.message=n.message),[2,t]}))}))},x=function(e,t){return Object(i["b"])(void 0,void 0,void 0,(function(){var t,n;return Object(i["d"])(this,(function(i){return t={name:"RequestTimeoutException",$fault:"client",$metadata:$(e),message:void 0},n=e.body,void 0!==n.message&&null!==n.message&&(t.message=n.message),[2,t]}))}))},O=function(e,t){return Object(i["b"])(void 0,void 0,void 0,(function(){var t,n;return Object(i["d"])(this,(function(i){return t={name:"UnsupportedMediaTypeException",$fault:"client",$metadata:$(e),message:void 0},n=e.body,void 0!==n.message&&null!==n.message&&(t.message=n.message),[2,t]}))}))},S=function(e,t){return Object(i["a"])(Object(i["a"])(Object(i["a"])({},void 0!==e.name&&null!==e.name&&{name:e.name}),void 0!==e.parameters&&null!==e.parameters&&{parameters:j(e.parameters,t)}),void 0!==e.timeToLive&&null!==e.timeToLive&&{timeToLive:T(e.timeToLive,t)})},j=function(e,t){return Object.entries(e).reduce((function(e,t){var n,o=Object(i["e"])(t,2),r=o[0],a=o[1];return null===a?e:Object(i["a"])(Object(i["a"])({},e),(n={},n[r]=a,n))}),{})},E=function(e,t){return e.filter((function(e){return null!=e})).map((function(e){return null===e?null:S(e,t)}))},T=function(e,t){return Object(i["a"])(Object(i["a"])({},void 0!==e.timeToLiveInSeconds&&null!==e.timeToLiveInSeconds&&{timeToLiveInSeconds:e.timeToLiveInSeconds}),void 0!==e.turnsToLive&&null!==e.turnsToLive&&{turnsToLive:e.turnsToLive})},C=function(e,t){return Object.entries(e).reduce((function(e,t){var n,o=Object(i["e"])(t,2),r=o[0],a=o[1];return null===a?e:Object(i["a"])(Object(i["a"])({},e),(n={},n[r]=a,n))}),{})},L=function(e,t){return{name:void 0!==e.name&&null!==e.name?e.name:void 0,parameters:void 0!==e.parameters&&null!==e.parameters?I(e.parameters,t):void 0,timeToLive:void 0!==e.timeToLive&&null!==e.timeToLive?A(e.timeToLive,t):void 0}},I=function(e,t){return Object.entries(e).reduce((function(e,t){var n,o=Object(i["e"])(t,2),r=o[0],a=o[1];return null===a?e:Object(i["a"])(Object(i["a"])({},e),(n={},n[r]=a,n))}),{})},k=function(e,t){return(e||[]).filter((function(e){return null!=e})).map((function(e){return null===e?null:L(e,t)}))},A=function(e,t){return{timeToLiveInSeconds:void 0!==e.timeToLiveInSeconds&&null!==e.timeToLiveInSeconds?e.timeToLiveInSeconds:void 0,turnsToLive:void 0!==e.turnsToLive&&null!==e.turnsToLive?e.turnsToLive:void 0}},N=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}},_=function(e,t){return{attachmentLinkUrl:void 0!==e.attachmentLinkUrl&&null!==e.attachmentLinkUrl?e.attachmentLinkUrl:void 0,buttons:void 0!==e.buttons&&null!==e.buttons?F(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}},z=function(e,t){return(e||[]).filter((function(e){return null!=e})).map((function(e){return null===e?null:_(e,t)}))},P=function(e,t){return{score:void 0!==e.score&&null!==e.score?e.score:void 0}},R=function(e,t){return(e||[]).filter((function(e){return null!=e})).map((function(e){return null===e?null:B(e,t)}))},F=function(e,t){return(e||[]).filter((function(e){return null!=e})).map((function(e){return null===e?null:N(e,t)}))},B=function(e,t){return{intentName:void 0!==e.intentName&&null!==e.intentName?e.intentName:void 0,nluIntentConfidence:void 0!==e.nluIntentConfidence&&null!==e.nluIntentConfidence?P(e.nluIntentConfidence,t):void 0,slots:void 0!==e.slots&&null!==e.slots?D(e.slots,t):void 0}},M=function(e,t){return{contentType:void 0!==e.contentType&&null!==e.contentType?e.contentType:void 0,genericAttachments:void 0!==e.genericAttachments&&null!==e.genericAttachments?z(e.genericAttachments,t):void 0,version:void 0!==e.version&&null!==e.version?e.version:void 0}},U=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}},D=function(e,t){return Object.entries(e).reduce((function(e,t){var n,o=Object(i["e"])(t,2),r=o[0],a=o[1];return null===a?e:Object(i["a"])(Object(i["a"])({},e),(n={},n[r]=a,n))}),{})},$=function(e){var t;return{httpStatusCode:e.statusCode,requestId:null!==(t=e.headers["x-amzn-requestid"])&&void 0!==t?t:e.headers["x-amzn-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}},q=function(e,t){return void 0===e&&(e=new Uint8Array),e instanceof Uint8Array?Promise.resolve(e):t.streamCollector(e)||Promise.resolve(new Uint8Array)},V=function(e,t){return q(e,t).then((function(e){return t.utf8Encoder(e)}))},H=function(e){return void 0!==e&&null!==e&&""!==e&&(!Object.getOwnPropertyNames(e).includes("length")||0!=e.length)&&(!Object.getOwnPropertyNames(e).includes("size")||0!=e.size)},W=function(e,t){return V(e,t).then((function(e){return e.length?JSON.parse(e):{}}))},J=function(e,t){var n=function(e,t){return Object.keys(e).find((function(e){return e.toLowerCase()===t.toLowerCase()}))},i=function(e){var t=e;return t.indexOf(":")>=0&&(t=t.split(":")[0]),t.indexOf("#")>=0&&(t=t.split("#")[1]),t},o=n(e.headers,"x-amzn-errortype");return void 0!==o?i(e.headers[o]):void 0!==t.code?i(t.code):void 0!==t["__type"]?i(t["__type"]):""}}).call(this,n("b639").Buffer)}}]);
  //# sourceMappingURL=chunk-576c85ba.ded3b6a0.js.map