From e596197da5f3462f959a795bc101d95a43d20cf5 Mon Sep 17 00:00:00 2001 From: ctwomblyamzn <58004580+ctwomblyamzn@users.noreply.github.com> Date: Mon, 3 Aug 2020 13:14:32 -0400 Subject: [PATCH] Add Contact.clear(), Agent.getAvailabilityState(), and updated docs (#289) --- Documentation.md | 26 ++- README.md | 7 + package-lock.json | 98 +++++++---- package.json | 5 +- release/connect-streams-min.js | 2 +- release/connect-streams.js | 311 ++++++++++++++++++++------------- src/api.js | 30 ++++ src/aws-client.js | 273 ++++++++++++++++------------- src/client.js | 3 +- src/core.js | 5 +- src/index.d.ts | 28 +++ 11 files changed, 500 insertions(+), 288 deletions(-) diff --git a/Documentation.md b/Documentation.md index 23dbdf0b..22f32bc8 100644 --- a/Documentation.md +++ b/Documentation.md @@ -1,6 +1,13 @@ # Amazon Connect Streams Documentation (c) 2018-2020 Amazon.com, Inc. All rights reserved. +# Important Announcements +1. July 2020 -- We recently changed the new, omnichannel, CCP's behavior when it encounters three voice-only agent states: `FailedConnectAgent`, `FailedConnectCustomer`, and `AfterCallWork`. + * `FailedConnectAgent` -- Previously, we required the agent to click the "Clear Contact" button to clear this state. When the agent clicked the "Clear Contact" button, the previous behavior took the agent back to the `Available` state without fail. Now the `FailedConnectAgent` state will be "auto-cleared", much like `FailedConnectCustomer` always has been. + * `FailedConnectAgent` and `FailedConnectCustomer` -- We are now using the `contact.clear()` API to auto-clear these states. As a result, the agent will be returned to their previous visible agent state (e.g. `Available`). Previously, the agent had always been set to `Available` as a result of this "auto-clearing" behavior. Note that even custom CCPs will behave differently with this update for `FailedConnectAgent` and `FailedConnectCustomer`. + * `AfterCallWork` -- As part of the new `contact.clear()` behavior, clicking "Clear Contact" while in `AfterCallWork` will return the agent to their previous visible agent state (e.g. `Available`, etc.). Note that custom CCPs that implement their own After Call Work behavior will not be affected by this change. + * We are putting `contact.complete()` on a deprecation path. Therefore, you should start using `contact.clear()` in its place. If you want to emulate CCP's After Call Work behavior in your customer CCP, then make sure you use `contact.clear()` when clearing voice contacts. + ## Overview The Amazon Connect Streams API (Streams) gives you the power to integrate your existing web applications with Amazon Connect. Streams lets you @@ -834,15 +841,28 @@ be disconnected from the call. Otherwise, the agent and customer are disconnecte Optional success and failure callbacks can be provided to determine if the operation was successful. -### `contact.complete()` +### `contact.clear()` +```js +contact.clear({ + success: function() { /* ... */ }, + failure: function(err) { /* ... */ } +}); +``` +This is a more generic form of `contact.complete()`. Use this for voice and chat contacts to clear the contact +when the contact is no longer actively being worked on (i.e. it's one of ERROR, ACW, MISSED, REJECTED). +It works for both monitoring and non-monitoring connections. + +Optional success and failure callbacks can be provided to determine if the operation was successful. + +### `contact.complete()` (TO BE DEPRECATED) ```js contact.complete({ success: function() { /* ... */ }, failure: function(err) { /* ... */ } }); ``` -This is an API that completes this contact entirely. That means that this should only be -used for non-monitoring agent connections. +This API will soon be deprecated and should be replaced with `contact.clear()`. It completes the contact entirely. +That means it should only be used for non-monitoring agent connections. Optional success and failure callbacks can be provided to determine if the operation was successful. diff --git a/README.md b/README.md index 663dcc48..712d84f2 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,13 @@ into your application or host it in an Amazon S3 bucket behind Amazon Cloudfront $ make ``` +# Important Announcements +1. July 2020 -- We recently changed the new, omnichannel, CCP's behavior when it encounters three voice-only agent states: `FailedConnectAgent`, `FailedConnectCustomer`, and `AfterCallWork`. + * `FailedConnectAgent` -- Previously, we required the agent to click the "Clear Contact" button to clear this state. When the agent clicked the "Clear Contact" button, the previous behavior took the agent back to the `Available` state without fail. Now the `FailedConnectAgent` state will be "auto-cleared", much like `FailedConnectCustomer` always has been. + * `FailedConnectAgent` and `FailedConnectCustomer` -- We are now using the `contact.clear()` API to auto-clear these states. As a result, the agent will be returned to their previous visible agent state (e.g. `Available`). Previously, the agent had always been set to `Available` as a result of this "auto-clearing" behavior. Note that even custom CCPs will behave differently with this update for `FailedConnectAgent` and `FailedConnectCustomer`. + * `AfterCallWork` -- As part of the new `contact.clear()` behavior, clicking "Clear Contact" while in `AfterCallWork` will return the agent to their previous visible agent state (e.g. `Available`, etc.). Note that custom CCPs that implement their own After Call Work behavior will not be affected by this change. + * We are putting `contact.complete()` on a deprecation path. Therefore, you should start using `contact.clear()` in its place. If you want to emulate CCP's After Call Work behavior in your customer CCP, then make sure you use `contact.clear()` when clearing voice contacts. + ## Getting Started ### Upgrading to the OmniChannel CCP (AKA CCPv2)? diff --git a/package-lock.json b/package-lock.json index 3e8d0ed7..fa296752 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,13 +1,13 @@ { "name": "amazon-connect-streams", - "version": "1.4.8", + "version": "1.4.9", "lockfileVersion": 1, "requires": true, "dependencies": { "@sinonjs/commons": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.0.tgz", - "integrity": "sha512-wEj54PfsZ5jGSwMX68G8ZXFawcSglQSXqCftWX3ec8MDUzQdHgcKvw97awHbY0efQEL5iKUOAmmVtoYgmrSG4Q==", + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.1.tgz", + "integrity": "sha512-892K+kWUUi3cl+LlqEWIDrhvLgdL79tECi8JZUyq6IviKy/DNhuzCRlbHUjxK89f4ypPMMaFnFuR9Ie6DoIMsw==", "dev": true, "requires": { "type-detect": "4.0.8" @@ -127,6 +127,17 @@ "requires": { "micromatch": "^3.1.4", "normalize-path": "^2.1.1" + }, + "dependencies": { + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + } } }, "append-buffer": { @@ -558,14 +569,6 @@ "path-is-absolute": "^1.0.0", "readdirp": "^2.2.1", "upath": "^1.1.1" - }, - "dependencies": { - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true - } } }, "class-utils": { @@ -1697,9 +1700,9 @@ } }, "glob-watcher": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/glob-watcher/-/glob-watcher-5.0.3.tgz", - "integrity": "sha512-8tWsULNEPHKQ2MR4zXuzSmqbdyV5PtwwCaWSGQ1WwHsJ07ilNeN1JB8ntxhckbnpSHaf9dXFUHzIWvm1I13dsg==", + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/glob-watcher/-/glob-watcher-5.0.5.tgz", + "integrity": "sha512-zOZgGGEHPklZNjZQaZ9f41i7F2YwE+tS5ZHrDhbBCk3stwahn5vQxnFmBJZHoYdusR6R1bLSXeGUy/BhctwKzw==", "dev": true, "requires": { "anymatch": "^2.0.0", @@ -1707,6 +1710,7 @@ "chokidar": "^2.0.0", "is-negated-glob": "^1.0.0", "just-debounce": "^1.0.0", + "normalize-path": "^3.0.0", "object.defaults": "^1.1.0" } }, @@ -1873,11 +1877,12 @@ } }, "through2": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.1.tgz", - "integrity": "sha512-M96dvTalPT3YbYLaKaCuwu+j06D/8Jfib0o/PxbVt6Amhv3dUAtW6rTV1jPgJSBG83I/e04Y6xkVdVhSRhi0ww==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz", + "integrity": "sha512-enaDQ4MUyP2W6ZyT6EsMzqBPZaM/avg8iuo+l2d3QCs0J+6RaqkHV/2/lOwDTueBHeJ/2LG9lrLW3d5rWPucuQ==", "dev": true, "requires": { + "inherits": "^2.0.4", "readable-stream": "2 || 3" } } @@ -2076,6 +2081,15 @@ "regex-cache": "^0.4.2" } }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + }, "plugin-error": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-1.0.1.tgz", @@ -2678,16 +2692,16 @@ } }, "jshint": { - "version": "2.11.1", - "resolved": "https://registry.npmjs.org/jshint/-/jshint-2.11.1.tgz", - "integrity": "sha512-WXWePB8ssAH3DlD05IoqolsY6arhbll/1+i2JkRPpihQAuiNaR/gSt8VKIcxpV5m6XChP0hCwESQUqpuQMA8Tg==", + "version": "2.11.2", + "resolved": "https://registry.npmjs.org/jshint/-/jshint-2.11.2.tgz", + "integrity": "sha512-3JfkI/3igmLYKVTEjglsaeUktOqZfgRM+nLL0AItmX5CV+PUOcVGmLBhhDjJ7pLPXsKYIkzMqFkN7avABmrj3g==", "dev": true, "requires": { "cli": "~1.0.0", "console-browserify": "1.1.x", "exit": "0.1.x", "htmlparser2": "3.8.x", - "lodash": "~4.17.11", + "lodash": "~4.17.19", "minimatch": "~3.0.2", "shelljs": "0.3.x", "strip-json-comments": "1.0.x" @@ -2820,9 +2834,9 @@ } }, "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "version": "4.17.19", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", "dev": true }, "lodash.assign": { @@ -3296,9 +3310,9 @@ } }, "neo-async": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz", - "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==", + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", "dev": true }, "next-tick": { @@ -3308,9 +3322,9 @@ "dev": true }, "nise": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/nise/-/nise-4.0.3.tgz", - "integrity": "sha512-EGlhjm7/4KvmmE6B/UFsKh7eHykRl9VH+au8dduHLCyWUO/hr7+N+WtTvDUwc9zHuM1IaIJs/0lQ6Ag1jDkQSg==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/nise/-/nise-4.0.4.tgz", + "integrity": "sha512-bTTRUNlemx6deJa+ZyoCUTRvH3liK5+N6VQZ4NIw90AgDXY6iPnsqplNFf6STcj+ePk0H/xqxnP75Lr0J0Fq3A==", "dev": true, "requires": { "@sinonjs/commons": "^1.7.0", @@ -3352,13 +3366,10 @@ } }, "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "dev": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true }, "now-and-later": { "version": "2.0.1", @@ -4948,6 +4959,17 @@ "now-and-later": "^2.0.0", "remove-bom-buffer": "^3.0.0", "vinyl": "^2.0.0" + }, + "dependencies": { + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + } } }, "vinyl-sourcemaps-apply": { diff --git a/package.json b/package.json index dc06db03..079dff24 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "amazon-connect-streams", - "version": "1.4.9", + "version": "1.5.0", "description": "Amazon Connect Streams Library", "engines": { "node": ">=12.0.0" @@ -54,8 +54,5 @@ "pump": "^3.0.0", "sinon": "^9.0.0", "typescript": "3.0.1" - }, - "npm-pretty-much": { - "runRelease": "always" } } diff --git a/release/connect-streams-min.js b/release/connect-streams-min.js index 99163a63..cd78b595 100644 --- a/release/connect-streams-min.js +++ b/release/connect-streams-min.js @@ -1 +1 @@ -!function i(s,a,c){function u(t,e){if(!a[t]){if(!s[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(l)return l(t,!0);var r=new Error("Cannot find module '"+t+"'");throw r.code="MODULE_NOT_FOUND",r}var o=a[t]={exports:{}};s[t][0].call(o.exports,function(e){return u(s[t][1][e]||e)},o,o.exports,i,s,a,c)}return a[t].exports}for(var l="function"==typeof require&&require,e=0;ee.BLOCK_SIZE&&((r=new e).update(n),n=r.digest())}var o=new Uint8Array(e.BLOCK_SIZE);return o.set(n),o}(e,t),r=new Uint8Array(e.BLOCK_SIZE);r.set(n);for(var o=0;o>>32-o)+n&4294967295}function s(e,t,n,r,o,i,s){return c(t&n|~t&r,e,t,o,i,s)}function u(e,t,n,r,o,i,s){return c(t&r|n&~r,e,t,o,i,s)}function l(e,t,n,r,o,i,s){return c(t^n^r,e,t,o,i,s)}function p(e,t,n,r,o,i,s){return c(n^(t|~r),e,t,o,i,s)}(t.exports=r).BLOCK_SIZE=64,r.prototype.update=function(e){if(o.isEmptyData(e))return this;if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=o.convertToBuffer(e),n=0,r=t.byteLength;for(this.bytesHashed+=r;0>>0,!0),t.setUint32(60,Math.floor(r/4294967296),!0),this.hashBuffer(),this.finished=!0}for(var i=new DataView(new ArrayBuffer(16)),o=0;o<4;o++)i.setUint32(4*o,this.state[o],!0);var s=new a(i.buffer,i.byteOffset,i.byteLength);return e?s.toString(e):s},r.prototype.hashBuffer=function(){var e=this.buffer,t=this.state,n=s(n=t[0],i=t[1],o=t[2],r=t[3],e.getUint32(0,!0),7,3614090360),r=s(r,n,i,o,e.getUint32(4,!0),12,3905402710),o=s(o,r,n,i,e.getUint32(8,!0),17,606105819),i=s(i,o,r,n,e.getUint32(12,!0),22,3250441966);n=s(n,i,o,r,e.getUint32(16,!0),7,4118548399),r=s(r,n,i,o,e.getUint32(20,!0),12,1200080426),o=s(o,r,n,i,e.getUint32(24,!0),17,2821735955),i=s(i,o,r,n,e.getUint32(28,!0),22,4249261313),n=s(n,i,o,r,e.getUint32(32,!0),7,1770035416),r=s(r,n,i,o,e.getUint32(36,!0),12,2336552879),o=s(o,r,n,i,e.getUint32(40,!0),17,4294925233),i=s(i,o,r,n,e.getUint32(44,!0),22,2304563134),n=s(n,i,o,r,e.getUint32(48,!0),7,1804603682),r=s(r,n,i,o,e.getUint32(52,!0),12,4254626195),o=s(o,r,n,i,e.getUint32(56,!0),17,2792965006),n=u(n,i=s(i,o,r,n,e.getUint32(60,!0),22,1236535329),o,r,e.getUint32(4,!0),5,4129170786),r=u(r,n,i,o,e.getUint32(24,!0),9,3225465664),o=u(o,r,n,i,e.getUint32(44,!0),14,643717713),i=u(i,o,r,n,e.getUint32(0,!0),20,3921069994),n=u(n,i,o,r,e.getUint32(20,!0),5,3593408605),r=u(r,n,i,o,e.getUint32(40,!0),9,38016083),o=u(o,r,n,i,e.getUint32(60,!0),14,3634488961),i=u(i,o,r,n,e.getUint32(16,!0),20,3889429448),n=u(n,i,o,r,e.getUint32(36,!0),5,568446438),r=u(r,n,i,o,e.getUint32(56,!0),9,3275163606),o=u(o,r,n,i,e.getUint32(12,!0),14,4107603335),i=u(i,o,r,n,e.getUint32(32,!0),20,1163531501),n=u(n,i,o,r,e.getUint32(52,!0),5,2850285829),r=u(r,n,i,o,e.getUint32(8,!0),9,4243563512),o=u(o,r,n,i,e.getUint32(28,!0),14,1735328473),n=l(n,i=u(i,o,r,n,e.getUint32(48,!0),20,2368359562),o,r,e.getUint32(20,!0),4,4294588738),r=l(r,n,i,o,e.getUint32(32,!0),11,2272392833),o=l(o,r,n,i,e.getUint32(44,!0),16,1839030562),i=l(i,o,r,n,e.getUint32(56,!0),23,4259657740),n=l(n,i,o,r,e.getUint32(4,!0),4,2763975236),r=l(r,n,i,o,e.getUint32(16,!0),11,1272893353),o=l(o,r,n,i,e.getUint32(28,!0),16,4139469664),i=l(i,o,r,n,e.getUint32(40,!0),23,3200236656),n=l(n,i,o,r,e.getUint32(52,!0),4,681279174),r=l(r,n,i,o,e.getUint32(0,!0),11,3936430074),o=l(o,r,n,i,e.getUint32(12,!0),16,3572445317),i=l(i,o,r,n,e.getUint32(24,!0),23,76029189),n=l(n,i,o,r,e.getUint32(36,!0),4,3654602809),r=l(r,n,i,o,e.getUint32(48,!0),11,3873151461),o=l(o,r,n,i,e.getUint32(60,!0),16,530742520),n=p(n,i=l(i,o,r,n,e.getUint32(8,!0),23,3299628645),o,r,e.getUint32(0,!0),6,4096336452),r=p(r,n,i,o,e.getUint32(28,!0),10,1126891415),o=p(o,r,n,i,e.getUint32(56,!0),15,2878612391),i=p(i,o,r,n,e.getUint32(20,!0),21,4237533241),n=p(n,i,o,r,e.getUint32(48,!0),6,1700485571),r=p(r,n,i,o,e.getUint32(12,!0),10,2399980690),o=p(o,r,n,i,e.getUint32(40,!0),15,4293915773),i=p(i,o,r,n,e.getUint32(4,!0),21,2240044497),n=p(n,i,o,r,e.getUint32(32,!0),6,1873313359),r=p(r,n,i,o,e.getUint32(60,!0),10,4264355552),o=p(o,r,n,i,e.getUint32(24,!0),15,2734768916),i=p(i,o,r,n,e.getUint32(52,!0),21,1309151649),n=p(n,i,o,r,e.getUint32(16,!0),6,4149444226),r=p(r,n,i,o,e.getUint32(44,!0),10,3174756917),o=p(o,r,n,i,e.getUint32(8,!0),15,718787259),i=p(i,o,r,n,e.getUint32(36,!0),21,3951481745),t[0]=n+t[0]&4294967295,t[1]=i+t[1]&4294967295,t[2]=o+t[2]&4294967295,t[3]=r+t[3]&4294967295}},{"./browserHashUtils":11,"buffer/":83}],14:[function(e,t,n){var o=e("buffer/").Buffer,r=e("./browserHashUtils");new Uint32Array([1518500249,1859775393,-1894007588,-899497514]),Math.pow(2,53);function i(){this.h0=1732584193,this.h1=4023233417,this.h2=2562383102,this.h3=271733878,this.h4=3285377520,this.block=new Uint32Array(80),this.offset=0,this.shift=24,this.totalLength=0}(t.exports=i).BLOCK_SIZE=64,i.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");if(r.isEmptyData(e))return this;var t=(e=r.convertToBuffer(e)).length;this.totalLength+=8*t;for(var n=0;n>t);var n=new o(20),r=new DataView(n.buffer);return r.setUint32(0,this.h0,!1),r.setUint32(4,this.h1,!1),r.setUint32(8,this.h2,!1),r.setUint32(12,this.h3,!1),r.setUint32(16,this.h4,!1),e?n.toString(e):n},i.prototype.processBlock=function(){for(var e=16;e<80;e++){var t=this.block[e-3]^this.block[e-8]^this.block[e-14]^this.block[e-16];this.block[e]=t<<1|t>>>31}for(var n,r,o=this.h0,i=this.h1,s=this.h2,a=this.h3,c=this.h4,e=0;e<80;e++){r=e<20?(n=a^i&(s^a),1518500249):e<40?(n=i^s^a,1859775393):e<60?(n=i&s|a&(i|s),2400959708):(n=i^s^a,3395469782);var u=(o<<5|o>>>27)+n+c+r+(0|this.block[e]),c=a,a=s,s=i<<30|i>>>2,i=o,o=u}for(this.h0=this.h0+o|0,this.h1=this.h1+i|0,this.h2=this.h2+s|0,this.h3=this.h3+a|0,this.h4=this.h4+c|0,e=this.offset=0;e<16;e++)this.block[e]=0}},{"./browserHashUtils":11,"buffer/":83}],15:[function(e,t,n){var s=e("buffer/").Buffer,r=e("./browserHashUtils"),m=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]),o=Math.pow(2,53)-1;function i(){this.state=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}(t.exports=i).BLOCK_SIZE=64,i.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");if(r.isEmptyData(e))return this;var t=0,n=(e=r.convertToBuffer(e)).byteLength;if(this.bytesHashed+=n,8*this.bytesHashed>o)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;0>>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 e?i.toString(e):i},i.prototype.hashBuffer=function(){for(var e,t,n,r=this.buffer,o=this.state,i=o[0],s=o[1],a=o[2],c=o[3],u=o[4],l=o[5],p=o[6],h=o[7],f=0;f<64;f++){f<16?this.temp[f]=(255&r[4*f])<<24|(255&r[4*f+1])<<16|(255&r[4*f+2])<<8|255&r[4*f+3]:(e=((t=this.temp[f-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10,n=((t=this.temp[f-15])>>>7|t<<25)^(t>>>18|t<<14)^t>>>3,this.temp[f]=(e+this.temp[f-7]|0)+(n+this.temp[f-16]|0));var d=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&l^~u&p)|0)+(h+(m[f]+this.temp[f]|0)|0)|0,g=((i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10))+(i&s^i&a^s&a)|0,h=p,p=l,l=u,u=c+d|0,c=a,a=s,s=i,i=d+g|0}o[0]+=i,o[1]+=s,o[2]+=a,o[3]+=c,o[4]+=u,o[5]+=l,o[6]+=p,o[7]+=h}},{"./browserHashUtils":11,"buffer/":83}],16:[function(r,o,e){(function(e){var t=r("./util");t.crypto.lib=r("./browserCryptoLib"),t.Buffer=r("buffer/").Buffer,t.url=r("url/"),t.querystring=r("querystring/"),t.realClock=r("./realclock/browserClock"),t.environment="js",t.createEventStream=r("./event-stream/buffered-create-event-stream").createEventStream,t.isBrowser=function(){return!0},t.isNode=function(){return!1};var n=r("./core");o.exports=n,r("./credentials"),r("./credentials/credential_provider_chain"),r("./credentials/temporary_credentials"),r("./credentials/chainable_temporary_credentials"),r("./credentials/web_identity_credentials"),r("./credentials/cognito_identity_credentials"),r("./credentials/saml_credentials"),n.XML.Parser=r("./xml/browser_parser"),r("./http/xhr"),void 0===e&&(e={browser:!0})}).call(this,r("_process"))},{"./browserCryptoLib":10,"./core":18,"./credentials":19,"./credentials/chainable_temporary_credentials":20,"./credentials/cognito_identity_credentials":21,"./credentials/credential_provider_chain":22,"./credentials/saml_credentials":23,"./credentials/temporary_credentials":24,"./credentials/web_identity_credentials":25,"./event-stream/buffered-create-event-stream":27,"./http/xhr":35,"./realclock/browserClock":52,"./util":71,"./xml/browser_parser":72,_process:87,"buffer/":83,"querystring/":94,"url/":96}],17:[function(e,t,n){var r,i=e("./core");e("./credentials"),e("./credentials/credential_provider_chain"),i.Config=i.util.inherit({constructor:function(n){void 0===n&&(n={}),n=this.extractCredentials(n),i.util.each.call(this,this.keys,function(e,t){this.set(e,n[e],t)})},getCredentials:function(t){var e,n=this;function r(e){t(e,e?null:n.credentials)}function o(e,t){return new i.util.error(t||new Error,{code:"CredentialsError",message:e,name:"CredentialsError"})}n.credentials?"function"==typeof n.credentials.get?n.credentials.get(function(e){r(e=e&&o("Could not load credentials from "+n.credentials.constructor.name,e))}):(e=null,n.credentials.accessKeyId&&n.credentials.secretAccessKey||(e=o("Missing credentials")),r(e)):n.credentialProvider?n.credentialProvider.resolve(function(e,t){e=e&&o("Could not load credentials from any providers",e),n.credentials=t,r(e)}):r(o("No credentials to load"))},update:function(e,n){n=n||!1,e=this.extractCredentials(e),i.util.each.call(this,e,function(e,t){(n||Object.prototype.hasOwnProperty.call(this.keys,e)||i.Service.hasService(e))&&this.set(e,t)})},loadFromPath:function(e){this.clear();var n=JSON.parse(i.util.readFileSync(e)),t=new i.FileSystemCredentials(e),r=new i.CredentialProviderChain;return r.providers.unshift(t),r.resolve(function(e,t){if(e)throw e;n.credentials=t}),this.constructor(n),this},clear:function(){i.util.each.call(this,this.keys,function(e){delete this[e]}),this.set("credentials",void 0),this.set("credentialProvider",void 0)},set:function(e,t,n){void 0===t?(void 0===n&&(n=this.keys[e]),this[e]="function"==typeof n?n.call(this):n):"httpOptions"===e&&this[e]?this[e]=i.util.merge(this[e],t):this[e]=t},keys:{credentials:null,credentialProvider:null,region:null,logger:null,apiVersions:{},apiVersion:null,endpoint:void 0,httpOptions:{timeout:12e4},maxRetries:void 0,maxRedirects:10,paramValidation:!0,sslEnabled:!0,s3ForcePathStyle:!1,s3BucketEndpoint:!1,s3DisableBodySigning:!0,computeChecksums:!0,convertResponseTypes:!0,correctClockSkew:!1,customUserAgent:null,dynamoDbCrc32:!0,systemClockOffset:0,signatureVersion:null,signatureCache:!0,retryDelayOptions:{},useAccelerateEndpoint:!1,clientSideMonitoring:!1,endpointDiscoveryEnabled:!1,endpointCacheSize:1e3,hostPrefixEnabled:!0,stsRegionalEndpoints:null},extractCredentials:function(e){return e.accessKeyId&&e.secretAccessKey&&((e=i.util.copy(e)).credentials=new i.Credentials(e)),e},setPromisesDependency:function(e){null===(r=e)&&"function"==typeof Promise&&(r=Promise);var t=[i.Request,i.Credentials,i.CredentialProviderChain];i.S3&&(t.push(i.S3),i.S3.ManagedUpload&&t.push(i.S3.ManagedUpload)),i.util.addPromises(t,r)},getPromisesDependency:function(){return r}}),i.config=new i.Config},{"./core":18,"./credentials":19,"./credentials/credential_provider_chain":22}],18:[function(e,t,n){var r={util:e("./util")};({}).toString(),(t.exports=r).util.update(r,{VERSION:"2.553.0",Signers:{},Protocol:{Json:e("./protocol/json"),Query:e("./protocol/query"),Rest:e("./protocol/rest"),RestJson:e("./protocol/rest_json"),RestXml:e("./protocol/rest_xml")},XML:{Builder:e("./xml/builder"),Parser:null},JSON:{Builder:e("./json/builder"),Parser:e("./json/parser")},Model:{Api:e("./model/api"),Operation:e("./model/operation"),Shape:e("./model/shape"),Paginator:e("./model/paginator"),ResourceWaiter:e("./model/resource_waiter")},apiLoader:e("./api_loader"),EndpointCache:e("../vendor/endpoint-cache").EndpointCache}),e("./sequential_executor"),e("./service"),e("./config"),e("./http"),e("./event_listeners"),e("./request"),e("./response"),e("./resource_waiter"),e("./signers/request_signer"),e("./param_validator"),r.events=new r.SequentialExecutor,r.util.memoizedProperty(r,"endpointCache",function(){return new r.EndpointCache(r.config.endpointCacheSize)},!0)},{"../vendor/endpoint-cache":105,"./api_loader":9,"./config":17,"./event_listeners":33,"./http":34,"./json/builder":36,"./json/parser":37,"./model/api":38,"./model/operation":40,"./model/paginator":41,"./model/resource_waiter":42,"./model/shape":43,"./param_validator":44,"./protocol/json":46,"./protocol/query":47,"./protocol/rest":48,"./protocol/rest_json":49,"./protocol/rest_xml":50,"./request":55,"./resource_waiter":56,"./response":57,"./sequential_executor":58,"./service":59,"./signers/request_signer":63,"./util":71,"./xml/builder":73}],19:[function(e,t,n){var o=e("./core");o.Credentials=o.util.inherit({constructor:function(e,t,n){var r;o.util.hideProperties(this,["secretAccessKey"]),this.expired=!1,this.expireTime=null,this.refreshCallbacks=[],1===arguments.length&&"object"==typeof e?(r=e.credentials||e,this.accessKeyId=r.accessKeyId,this.secretAccessKey=r.secretAccessKey,this.sessionToken=r.sessionToken):(this.accessKeyId=e,this.secretAccessKey=t,this.sessionToken=n)},expiryWindow:15,needsRefresh:function(){var e=o.util.date.getDate().getTime(),t=new Date(e+1e3*this.expiryWindow);return!!(this.expireTime&&t>this.expireTime)||(this.expired||!this.accessKeyId||!this.secretAccessKey)},get:function(t){var n=this;this.needsRefresh()?this.refresh(function(e){e||(n.expired=!1),t&&t(e)}):t&&t()},refresh:function(e){this.expired=!1,e()},coalesceRefresh:function(e,n){var r=this;1===r.refreshCallbacks.push(e)&&r.load(function(t){o.util.arrayEach(r.refreshCallbacks,function(e){n?e(t):o.util.defer(function(){e(t)})}),r.refreshCallbacks.length=0})},load:function(e){e()}}),o.Credentials.addPromisesToClass=function(e){this.prototype.getPromise=o.util.promisifyMethod("get",e),this.prototype.refreshPromise=o.util.promisifyMethod("refresh",e)},o.Credentials.deletePromisesFromClass=function(){delete this.prototype.getPromise,delete this.prototype.refreshPromise},o.util.addPromises(o.Credentials)},{"./core":18}],20:[function(e,t,n){var i=e("../core"),r=e("../../clients/sts");i.ChainableTemporaryCredentials=i.util.inherit(i.Credentials,{constructor:function(e){i.Credentials.call(this),e=e||{},this.errorCode="ChainableTemporaryCredentialsProviderFailure",this.expired=!0,this.tokenCodeFn=null;var t=i.util.copy(e.params)||{};if(t.RoleArn&&(t.RoleSessionName=t.RoleSessionName||"temporary-credentials"),t.SerialNumber){if(!e.tokenCodeFn||"function"!=typeof e.tokenCodeFn)throw new i.util.error(new Error("tokenCodeFn must be a function when params.SerialNumber is given"),{code:this.errorCode});this.tokenCodeFn=e.tokenCodeFn}var n=i.util.merge({params:t,credentials:e.masterCredentials||i.config.credentials},e.stsConfig||{});this.service=new r(n)},refresh:function(e){this.coalesceRefresh(e||i.util.fn.callback)},load:function(r){var o=this,i=o.service.config.params.RoleArn?"assumeRole":"getSessionToken";this.getTokenCode(function(e,t){var n={};e?r(e):(t&&(n.TokenCode=t),o.service[i](n,function(e,t){e||o.service.credentialsFrom(t,o),r(e)}))})},getTokenCode:function(r){var o=this;this.tokenCodeFn?this.tokenCodeFn(this.service.config.params.SerialNumber,function(e,t){if(e){var n=e;return e instanceof Error&&(n=e.message),void r(i.util.error(new Error("Error fetching MFA token: "+n),{code:o.errorCode}))}r(null,t)}):r(null)}})},{"../../clients/sts":8,"../core":18}],21:[function(e,t,n){var r=e("../core"),o=e("../../clients/cognitoidentity"),i=e("../../clients/sts");r.CognitoIdentityCredentials=r.util.inherit(r.Credentials,{localStorageKey:{id:"aws.cognito.identity-id.",providers:"aws.cognito.identity-providers."},constructor:function(e,t){r.Credentials.call(this),this.expired=!0,this.params=e,this.data=null,this._identityId=null,this._clientConfig=r.util.copy(t||{}),this.loadCachedId();var n=this;Object.defineProperty(this,"identityId",{get:function(){return n.loadCachedId(),n._identityId||n.params.IdentityId},set:function(e){n._identityId=e}})},refresh:function(e){this.coalesceRefresh(e||r.util.fn.callback)},load:function(t){var n=this;n.createClients(),n.data=null,n._identityId=null,n.getId(function(e){e?(n.clearIdOnNotAuthorized(e),t(e)):n.params.RoleArn?n.getCredentialsFromSTS(t):n.getCredentialsForIdentity(t)})},clearCachedId:function(){this._identityId=null,delete this.params.IdentityId;var e=this.params.IdentityPoolId,t=this.params.LoginId||"";delete this.storage[this.localStorageKey.id+e+t],delete this.storage[this.localStorageKey.providers+e+t]},clearIdOnNotAuthorized:function(e){"NotAuthorizedException"==e.code&&this.clearCachedId()},getId:function(n){var r=this;if("string"==typeof r.params.IdentityId)return n(null,r.params.IdentityId);r.cognito.getId(function(e,t){!e&&t.IdentityId?(r.params.IdentityId=t.IdentityId,n(null,t.IdentityId)):n(e)})},loadCredentials:function(e,t){e&&t&&(t.expired=!1,t.accessKeyId=e.Credentials.AccessKeyId,t.secretAccessKey=e.Credentials.SecretKey,t.sessionToken=e.Credentials.SessionToken,t.expireTime=e.Credentials.Expiration)},getCredentialsForIdentity:function(n){var r=this;r.cognito.getCredentialsForIdentity(function(e,t){e?r.clearIdOnNotAuthorized(e):(r.cacheId(t),r.data=t,r.loadCredentials(r.data,r)),n(e)})},getCredentialsFromSTS:function(n){var r=this;r.cognito.getOpenIdToken(function(e,t){e?(r.clearIdOnNotAuthorized(e),n(e)):(r.cacheId(t),r.params.WebIdentityToken=t.Token,r.webIdentityCredentials.refresh(function(e){e||(r.data=r.webIdentityCredentials.data,r.sts.credentialsFrom(r.data,r)),n(e)}))})},loadCachedId:function(){var e,t,n=this;r.util.isBrowser()&&!n.params.IdentityId&&((e=n.getStorage("id"))&&n.params.Logins?(t=Object.keys(n.params.Logins),0!==(n.getStorage("providers")||"").split(",").filter(function(e){return-1!==t.indexOf(e)}).length&&(n.params.IdentityId=e)):e&&(n.params.IdentityId=e))},createClients:function(){var e,t=this._clientConfig;this.webIdentityCredentials=this.webIdentityCredentials||new r.WebIdentityCredentials(this.params,t),this.cognito||((e=r.util.merge({},t)).params=this.params,this.cognito=new o(e)),this.sts=this.sts||new i(t)},cacheId:function(e){this._identityId=e.IdentityId,this.params.IdentityId=this._identityId,r.util.isBrowser()&&(this.setStorage("id",e.IdentityId),this.params.Logins&&this.setStorage("providers",Object.keys(this.params.Logins).join(",")))},getStorage:function(e){return this.storage[this.localStorageKey[e]+this.params.IdentityPoolId+(this.params.LoginId||"")]},setStorage:function(e,t){try{this.storage[this.localStorageKey[e]+this.params.IdentityPoolId+(this.params.LoginId||"")]=t}catch(e){}},storage:function(){try{var e=r.util.isBrowser()&&null!==window.localStorage&&"object"==typeof window.localStorage?window.localStorage:{};return e["aws.test-storage"]="foobar",delete e["aws.test-storage"],e}catch(e){return{}}}()})},{"../../clients/cognitoidentity":7,"../../clients/sts":8,"../core":18}],22:[function(e,t,n){var a=e("../core");a.CredentialProviderChain=a.util.inherit(a.Credentials,{constructor:function(e){this.providers=e||a.CredentialProviderChain.defaultProviders.slice(0),this.resolveCallbacks=[]},resolve:function(e){var o,i,s=this;if(0===s.providers.length)return e(new Error("No providers")),s;return 1===s.resolveCallbacks.push(e)&&(o=0,i=s.providers.slice(0),function t(n,r){if(!n&&r||o===i.length)return a.util.arrayEach(s.resolveCallbacks,function(e){e(n,r)}),void(s.resolveCallbacks.length=0);var e=i[o++];(r="function"==typeof e?e.call():e).get?r.get(function(e){t(e,e?null:r)}):t(null,r)}()),s}}),a.CredentialProviderChain.defaultProviders=[],a.CredentialProviderChain.addPromisesToClass=function(e){this.prototype.resolvePromise=a.util.promisifyMethod("resolve",e)},a.CredentialProviderChain.deletePromisesFromClass=function(){delete this.prototype.resolvePromise},a.util.addPromises(a.CredentialProviderChain)},{"../core":18}],23:[function(e,t,n){var r=e("../core"),o=e("../../clients/sts");r.SAMLCredentials=r.util.inherit(r.Credentials,{constructor:function(e){r.Credentials.call(this),this.expired=!0,this.params=e},refresh:function(e){this.coalesceRefresh(e||r.util.fn.callback)},load:function(n){var r=this;r.createClients(),r.service.assumeRoleWithSAML(function(e,t){e||r.service.credentialsFrom(t,r),n(e)})},createClients:function(){this.service=this.service||new o({params:this.params})}})},{"../../clients/sts":8,"../core":18}],24:[function(e,t,n){var r=e("../core"),o=e("../../clients/sts");r.TemporaryCredentials=r.util.inherit(r.Credentials,{constructor:function(e,t){r.Credentials.call(this),this.loadMasterCredentials(t),this.expired=!0,this.params=e||{},this.params.RoleArn&&(this.params.RoleSessionName=this.params.RoleSessionName||"temporary-credentials")},refresh:function(e){this.coalesceRefresh(e||r.util.fn.callback)},load:function(n){var r=this;r.createClients(),r.masterCredentials.get(function(){r.service.config.credentials=r.masterCredentials,(r.params.RoleArn?r.service.assumeRole:r.service.getSessionToken).call(r.service,function(e,t){e||r.service.credentialsFrom(t,r),n(e)})})},loadMasterCredentials:function(e){for(this.masterCredentials=e||r.config.credentials;this.masterCredentials.masterCredentials;)this.masterCredentials=this.masterCredentials.masterCredentials;"function"!=typeof this.masterCredentials.get&&(this.masterCredentials=new r.Credentials(this.masterCredentials))},createClients:function(){this.service=this.service||new o({params:this.params})}})},{"../../clients/sts":8,"../core":18}],25:[function(e,t,n){var r=e("../core"),o=e("../../clients/sts");r.WebIdentityCredentials=r.util.inherit(r.Credentials,{constructor:function(e,t){r.Credentials.call(this),this.expired=!0,this.params=e,this.params.RoleSessionName=this.params.RoleSessionName||"web-identity",this.data=null,this._clientConfig=r.util.copy(t||{})},refresh:function(e){this.coalesceRefresh(e||r.util.fn.callback)},load:function(n){var r=this;r.createClients(),r.service.assumeRoleWithWebIdentity(function(e,t){r.data=null,e||(r.data=t,r.service.credentialsFrom(t,r)),n(e)})},createClients:function(){var e;this.service||((e=r.util.merge({},this._clientConfig)).params=this.params,this.service=new o(e))}})},{"../../clients/sts":8,"../core":18}],26:[function(e,t,n){(function(i){var p=e("./core"),h=e("./util"),s=["AWS_ENABLE_ENDPOINT_DISCOVERY","AWS_ENDPOINT_DISCOVERY_ENABLED"];function f(e){var t=e.service,n=t.api||{},r={};return t.config.region&&(r.region=t.config.region),n.serviceId&&(r.serviceId=n.serviceId),t.config.credentials.accessKeyId&&(r.accessKeyId=t.config.credentials.accessKeyId),r}function d(e,t){var n={};return function r(o,i,s){s&&null!=i&&"structure"===s.type&&s.required&&0=this.HEADERS_RECEIVED&&!u&&(s.statusCode=c.status,s.headers=o.parseHeaders(c.getAllResponseHeaders()),s.emit("headers",s.statusCode,s.headers,c.statusText),u=!0),this.readyState===this.DONE&&o.finishRequest(c,s)},!1),c.upload.addEventListener("progress",function(e){s.emit("sendProgress",e)}),c.addEventListener("progress",function(e){s.emit("receiveProgress",e)},!1),c.addEventListener("timeout",function(){r(l.util.error(new Error("Timeout"),{code:"TimeoutError"}))},!1),c.addEventListener("error",function(){r(l.util.error(new Error("Network Failure"),{code:"NetworkingError"}))},!1),c.addEventListener("abort",function(){r(l.util.error(new Error("Request aborted"),{code:"RequestAbortedError"}))},!1),n(s),c.open(t.method,a,!1!==e.xhrAsync),l.util.each(t.headers,function(e,t){"Content-Length"!==e&&"User-Agent"!==e&&"Host"!==e&&c.setRequestHeader(e,t)}),e.timeout&&!1!==e.xhrAsync&&(c.timeout=e.timeout),e.xhrWithCredentials&&(c.withCredentials=!0);try{c.responseType="arraybuffer"}catch(e){}try{t.body?c.send(t.body):c.send()}catch(e){if(!t.body||"object"!=typeof t.body.buffer)throw e;c.send(t.body.buffer)}return s},parseHeaders:function(e){var r={};return l.util.arrayEach(e.split(/\r?\n/),function(e){var t=e.split(":",1)[0],n=e.substring(t.length+2);0= 1, but found "'+t+'" for '+n)},validatePattern:function(e,t,n){this.validation.pattern&&void 0!==e.pattern&&(new RegExp(e.pattern).test(t)||this.fail("PatternMatchError",'Provided value "'+t+'" does not match regex pattern /'+e.pattern+"/ for "+n))},validateRange:function(e,t,n,r){this.validation.min&&void 0!==e.min&&t= "+e.min+", but found "+t+" for "+n),this.validation.max&&void 0!==e.max&&t>e.max&&this.fail("MaxRangeError","Expected "+r+" <= "+e.max+", but found "+t+" for "+n)},validateEnum:function(e,t,n){this.validation.enum&&void 0!==e.enum&&-1===e.enum.indexOf(t)&&this.fail("EnumError","Found string value of "+t+", but expected "+e.enum.join("|")+" for "+n)},validateType:function(e,t,n,r){if(null==e)return!1;for(var o=!1,i=0;i=t.maxRetries&&(n.MaxRetriesExceeded=1),u.emit("apiCall",[n]))})},setupRequestListeners:function(){},getSignerClass:function(e){var t,n=null,r="";return e&&(r=(n=(e.service.api.operations||{})[e.operation]||null)?n.authtype:""),t=this.config.signatureVersion?this.config.signatureVersion:"v4"===r||"v4-unsigned-body"===r?"v4":this.api.signatureVersion,l.Signers.RequestSigner.getVersion(t)},serviceInterface:function(){switch(this.api.protocol){case"ec2":case"query":return l.EventListeners.Query;case"json":return l.EventListeners.Json;case"rest-json":return l.EventListeners.RestJson;case"rest-xml":return l.EventListeners.RestXml}if(this.api.protocol)throw new Error("Invalid service `protocol' "+this.api.protocol+" in API config")},successfulResponse:function(e){return e.httpResponse.statusCode<300},numRetries:function(){return void 0!==this.config.maxRetries?this.config.maxRetries:this.defaultRetryCount},retryDelays:function(e){return l.util.calculateRetryDelay(e,this.config.retryDelayOptions)},retryableError:function(e){return!!this.timeoutError(e)||(!!this.networkingError(e)||(!!this.expiredCredentialsError(e)||(!!this.throttledError(e)||500<=e.statusCode)))},networkingError:function(e){return"NetworkingError"===e.code},timeoutError:function(e){return"TimeoutError"===e.code},expiredCredentialsError:function(e){return"ExpiredTokenException"===e.code},clockSkewError:function(e){switch(e.code){case"RequestTimeTooSkewed":case"RequestExpired":case"InvalidSignatureException":case"SignatureDoesNotMatch":case"AuthFailure":case"RequestInTheFuture":return!0;default:return!1}},getSkewCorrectedDate:function(){return new Date(Date.now()+this.config.systemClockOffset)},applyClockOffset:function(e){e&&(this.config.systemClockOffset=e-Date.now())},isClockSkewed:function(e){if(e)return 3e4<=Math.abs(this.getSkewCorrectedDate().getTime()-e)},throttledError:function(e){if(429===e.statusCode)return!0;switch(e.code){case"ProvisionedThroughputExceededException":case"Throttling":case"ThrottlingException":case"RequestLimitExceeded":case"RequestThrottled":case"RequestThrottledException":case"TooManyRequestsException":case"TransactionInProgressException":return!0;default:return!1}},endpointFromTemplate:function(e){if("string"!=typeof e)return e;var t=e;return t=(t=(t=t.replace(/\{service\}/g,this.api.endpointPrefix)).replace(/\{region\}/g,this.config.region)).replace(/\{scheme\}/g,this.config.sslEnabled?"https":"http")},setEndpoint:function(e){this.endpoint=new l.Endpoint(e,this.config)},paginationConfig:function(e,t){var n=this.api.operations[e].paginator;if(n)return n;if(t){var r=new Error;throw l.util.error(r,"No pagination configuration for "+e)}return null}}),l.util.update(l.Service,{defineMethods:function(e){l.util.each(e.prototype.api.operations,function(n){e.prototype[n]||("none"===e.prototype.api.operations[n].authtype?e.prototype[n]=function(e,t){return this.makeUnauthenticatedRequest(n,e,t)}:e.prototype[n]=function(e,t){return this.makeRequest(n,e,t)})})},defineService:function(e,t,n){l.Service._serviceMap[e]=!0,Array.isArray(t)||(n=t,t=[]);var r,o,i,s=a(l.Service,n||{});return"string"==typeof e?(l.Service.addVersions(s,t),r=s.serviceIdentifier||e,s.serviceIdentifier=r):(s.prototype.api=e,l.Service.defineMethods(s)),l.SequentialExecutor.call(this.prototype),!this.prototype.publisher&&l.util.clientSideMonitoring&&(o=l.util.clientSideMonitoring.Publisher,i=(0,l.util.clientSideMonitoring.configProvider)(),this.prototype.publisher=new o(i),i.enabled&&(l.Service._clientSideMonitoring=!0)),l.SequentialExecutor.call(s.prototype),l.Service.addDefaultMonitoringListeners(s.prototype),s},addVersions:function(e,t){Array.isArray(t)||(t=[t]),e.services=e.services||{};for(var n=0;n=n.length)return r.push(null);var t=o+e;t>n.length&&(t=n.length),r.push(n.slice(o,t)),o=t},r},concat:function(e){for(var t,n=0,r=0,o=0;o>>8^t[255&(n^e.readUInt8(r))];return(-1^n)>>>0},hmac:function(e,t,n,r){return"buffer"===(n=n||"binary")&&(n=void 0),r=r||"sha256","string"==typeof t&&(t=l.buffer.toBuffer(t)),l.crypto.lib.createHmac(r,e).update(t).digest(n)},md5:function(e,t,n){return l.crypto.hash("md5",e,t,n)},sha256:function(e,t,n){return l.crypto.hash("sha256",e,t,n)},hash:function(e,t,n,r){var o=l.crypto.createHash(e);"buffer"===(n=n||"binary")&&(n=void 0),"string"==typeof t&&(t=l.buffer.toBuffer(t));var i=l.arraySliceFn(t),s=l.Buffer.isBuffer(t);if(l.isBrowser()&&"undefined"!=typeof ArrayBuffer&&t&&t.buffer instanceof ArrayBuffer&&(s=!0),r&&"object"==typeof t&&"function"==typeof t.on&&!s)t.on("data",function(e){o.update(e)}),t.on("error",function(e){r(e)}),t.on("end",function(){r(null,o.digest(n))});else{if(!r||!i||s||"undefined"==typeof FileReader){l.isBrowser()&&"object"==typeof t&&!s&&(t=new l.Buffer(new Uint8Array(t)));var a=o.update(t).digest(n);return r&&r(null,a),a}var c=0,u=new FileReader;u.onerror=function(){r(new Error("Failed to read data."))},u.onload=function(){var e=new l.Buffer(new Uint8Array(u.result));o.update(e),c+=e.length,u._continueReading()},u._continueReading=function(){var e;c>=t.size?r(null,o.digest(n)):((e=c+524288)>t.size&&(e=t.size),u.readAsArrayBuffer(i.call(t,c,e)))},u._continueReading()}},toHex:function(e){for(var t=[],n=0;n/g,">").replace(/"/g,""")}}},{}],75:[function(e,t,n){t.exports={escapeElement:function(e){return e.replace(/&/g,"&").replace(//g,">")}}},{}],76:[function(e,t,n){var a=e("./escape-attribute").escapeAttribute;function r(e,t){void 0===t&&(t=[]),this.name=e,this.children=t,this.attributes={}}r.prototype.addAttribute=function(e,t){return this.attributes[e]=t,this},r.prototype.addChildNode=function(e){return this.children.push(e),this},r.prototype.removeAttribute=function(e){return delete this.attributes[e],this},r.prototype.toString=function(){for(var e=Boolean(this.children.length),t="<"+this.name,n=this.attributes,r=0,o=Object.keys(n);r"+this.children.map(function(e){return e.toString()}).join("")+"":"/>")},t.exports={XmlNode:r}},{"./escape-attribute":74}],77:[function(e,t,n){var r=e("./escape-element").escapeElement;function o(e){this.value=e}o.prototype.toString=function(){return r(""+this.value)},t.exports={XmlText:o}},{"./escape-element":75}],78:[function(e,t,n){"use strict";n.byteLength=function(e){var t=p(e),n=t[0],r=t[1];return 3*(n+r)/4-r},n.toByteArray=function(e){var t,n,r=p(e),o=r[0],i=r[1],s=new l(function(e,t){return 3*(e+t)/4-t}(o,i)),a=0,c=0>16&255,s[a++]=t>>8&255,s[a++]=255&t;2===i&&(t=u[e.charCodeAt(n)]<<2|u[e.charCodeAt(n+1)]>>4,s[a++]=255&t);1===i&&(t=u[e.charCodeAt(n)]<<10|u[e.charCodeAt(n+1)]<<4|u[e.charCodeAt(n+2)]>>2,s[a++]=t>>8&255,s[a++]=255&t);return s},n.fromByteArray=function(e){for(var t,n=e.length,r=n%3,o=[],i=0,s=n-r;i>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(r));return o.join("")}(e,i,s>2]+a[t<<4&63]+"==")):2==r&&(t=(e[n-2]<<8)+e[n-1],o.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return o.join("")};for(var a=[],u=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,i=r.length;o=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|e}function f(e,t){if(p.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return k(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return N(e).length;default:if(r)return k(e).length;t=(""+t).toLowerCase(),r=!0}}function t(e,t,n){var r,o,i,s=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":return function(e,t,n){var r=e.length;(!t||t<0)&&(t=0);(!n||n<0||r=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=p.from(t,r)),p.isBuffer(t))return 0===t.length?-1:m(e,t,n,r,o);if("number"==typeof t)return t&=255,p.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):m(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function m(e,t,n,r,o){var i=1,s=e.length,a=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s/=i=2,a/=2,n/=2}function c(e,t){return 1===i?e[t]:e.readUInt16BE(t*i)}if(o)for(var u=-1,l=n;l>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function b(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o>>10&1023|55296),l=56320|1023&l),r.push(l),o+=p}return function(e){var t=e.length;if(t<=E)return String.fromCharCode.apply(String,e);var n="",r=0;for(;rt&&(e+=" ... ")),""},p.prototype.compare=function(e,t,n,r,o){if(!p.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(o<=r&&n<=t)return 0;if(o<=r)return-1;if(n<=t)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(i,s),c=this.slice(r,o),u=e.slice(t,n),l=0;lthis.length)throw new RangeError("Attempt to write outside buffer bounds");r=r||"utf8";for(var i,s,a,c,u,l,p=!1;;)switch(r){case"hex":return function(e,t,n,r){n=Number(n)||0;var o=e.length-n;(!r||o<(r=Number(r)))&&(r=o);var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");i/2e.length)throw new RangeError("Index out of range")}function T(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function w(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function _(e,t,n,r){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function A(e,t,n,r,o){return o||_(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function I(e,t,n,r,o){return o||_(e,0,n,8),i.write(e,t,n,r,52,8),n+8}p.prototype.slice=function(e,t){var n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):n>>8):T(this,e,t,!0),t+2},p.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):T(this,e,t,!1),t+2},p.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):w(this,e,t,!0),t+4},p.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):w(this,e,t,!1),t+4},p.prototype.writeIntLE=function(e,t,n,r){var o;e=+e,t|=0,r||C(this,e,t,n,(o=Math.pow(2,8*n-1))-1,-o);var i=0,s=1,a=0;for(this[t]=255&e;++i>0)-a&255;return t+n},p.prototype.writeIntBE=function(e,t,n,r){var o;e=+e,t|=0,r||C(this,e,t,n,(o=Math.pow(2,8*n-1))-1,-o);var i=n-1,s=1,a=0;for(this[t+i]=255&e;0<=--i&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s>>0)-a&255;return t+n},p.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,1,127,-128),p.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},p.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):T(this,e,t,!0),t+2},p.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):T(this,e,t,!1),t+2},p.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,4,2147483647,-2147483648),p.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):w(this,e,t,!0),t+4},p.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):w(this,e,t,!1),t+4},p.prototype.writeFloatLE=function(e,t,n){return A(this,e,t,!0,n)},p.prototype.writeFloatBE=function(e,t,n){return A(this,e,t,!1,n)},p.prototype.writeDoubleLE=function(e,t,n){return I(this,e,t,!0,n)},p.prototype.writeDoubleBE=function(e,t,n){return I(this,e,t,!1,n)},p.prototype.copy=function(e,t,n,r){if(n=n||0,r||0===r||(r=this.length),t>=e.length&&(t=e.length),t=t||0,0=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,"number"==typeof(e=e||0))for(a=t;a>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function N(e){return a.toByteArray(function(e){var t;if((e=((t=e).trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(R,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function x(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},O("buffer").Buffer)},{"base64-js":78,buffer:80,ieee754:82,isarray:85}],81:[function(e,t,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function c(e){return"function"==typeof e}function u(e){return"object"==typeof e&&null!==e}function l(e){return void 0===e}((t.exports=r).EventEmitter=r).prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,n,r,o,i,s;if(this._events||(this._events={}),"error"===e&&(!this._events.error||u(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var a=new Error('Uncaught, unspecified "error" event. ('+t+")");throw a.context=t,a}if(l(n=this._events[e]))return!1;if(c(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),n.apply(this,o)}else if(u(n))for(o=Array.prototype.slice.call(arguments,1),r=(s=n.slice()).length,i=0;in&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.once=function(e,t){if(!c(t))throw TypeError("listener must be a function");var n=!1;function r(){this.removeListener(e,r),n||(n=!0,t.apply(this,arguments))}return r.listener=t,this.on(e,r),this},r.prototype.removeListener=function(e,t){var n,r,o,i;if(!c(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(o=(n=this._events[e]).length,r=-1,n===t||c(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(u(n)){for(i=o;0>1,l=-7,p=n?o-1:0,h=n?-1:1,f=e[t+p];for(p+=h,i=f&(1<<-l)-1,f>>=-l,l+=a;0>=-l,l+=r;0>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:i-1,d=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),2<=(t+=1<=s+p?h/c:h*Math.pow(2,1-p))*c&&(s++,c/=2),l<=s+p?(a=0,s=l):1<=s+p?(a=(t*c-1)*Math.pow(2,o),s+=p):(a=t*Math.pow(2,p-1)*Math.pow(2,o),s=0));8<=o;e[n+f]=255&a,f+=d,a/=256,o-=8);for(s=s<":!0,"=":!0,"!":!0},F={" ":!0,"\t":!0,"\n":!0};function j(e){return"0"<=e&&e<="9"||"-"===e}function r(){}r.prototype={tokenize:function(e){var t,n,r,o,i=[];for(this._current=0;this._current"===n?"="===e[this._current]?(this._current++,{type:P,value:">=",start:t}):{type:"GT",value:">",start:t}:"="===n&&"="===e[this._current]?(this._current++,{type:"EQ",value:"==",start:t}):void 0},_consumeLiteral:function(e){this._current++;for(var t=this._current,n=e.length;"`"!==e[this._current]&&this._current= 0x80 (not a basic code point)","invalid-input":"Invalid input"},h=v-b,w=Math.floor,_=String.fromCharCode;function A(e){throw new RangeError(p[e])}function f(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function d(e,t){var n=e.split("@"),r="";return 1>>10&1023|55296),e=56320|1023&e),t+=_(e)}).join("")}function k(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function N(e,t,n){var r=0;for(e=n?w(e/a):e>>1,e+=w(e/t);h*E>>1w((y-f)/i))&&A("overflow"),f+=a*i,!(a<(c=s<=g?b:g+E<=s?E:s-g));s+=v)i>w(y/(u=v-c))&&A("overflow"),i*=u;g=N(f-o,t=p.length+1,0==o),w(f/t)>y-d&&A("overflow"),d+=w(f/t),f%=t,p.splice(f++,0,d)}return R(p)}function m(e){for(var t,n,r,o,i,s,a,c,u,l,p,h=[],f=(e=I(e)).length,d=C,g=S,m=t=0;mw((y-t)/(u=n+1))&&A("overflow"),t+=(o-d)*u,d=o,m=0;my&&A("overflow"),c==d){for(i=t,s=v;!(i<(a=s<=g?b:g+E<=s?E:s-g));s+=v)p=i-a,l=v-a,h.push(_(k(a+p%l,0))),i=w(p/l);h.push(_(k(i,0))),g=N(t,u,n==r),t=0,++n}++t,++d}return h.join("")}if(o={version:"1.4.1",ucs2:{decode:I,encode:R},decode:g,encode:m,toASCII:function(e){return d(e,function(e){return u.test(e)?"xn--"+m(e):e})},toUnicode:function(e){return d(e,function(e){return c.test(e)?g(e.slice(4).toLowerCase()):e})}},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return o});else if(t&&n)if(O.exports==t)n.exports=o;else for(i in o)o.hasOwnProperty(i)&&(t[i]=o[i]);else e.punycode=o}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],89:[function(e,t,n){"use strict";t.exports=function(e,t,n,r){t=t||"&",n=n||"=";var o={};if("string"!=typeof e||0===e.length)return o;var i=/\+/g;e=e.split(t);var s=1e3;r&&"number"==typeof r.maxKeys&&(s=r.maxKeys);var a=e.length;0",'"',"`"," ","\r","\n","\t"]),L=["'"].concat(o),P=["%","/","?",";","#"].concat(L),M=["/","?","#"],D=/^[a-z0-9A-Z_-]{0,63}$/,U=/^([a-z0-9A-Z_-]{0,63})(.*)$/,q={javascript:!0,"javascript:":!0},F={javascript:!0,"javascript:":!0},j={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},B=e("querystring");function i(e,t,n){if(e&&a(e)&&e instanceof v)return e;var r=new v;return r.parse(e,t,n),r}function H(e){return"string"==typeof e}function a(e){return"object"==typeof e&&null!==e}function b(e){return null===e}v.prototype.parse=function(e,t,n){if(!H(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var r,o,i=(i=e).trim(),s=O.exec(i);if(s&&(r=(s=s[0]).toLowerCase(),this.protocol=r,i=i.substr(s.length)),(n||s||i.match(/^\/\/[^@\/]+@[^@\/]+/))&&(!(o="//"===i.substr(0,2))||s&&F[s]||(i=i.substr(2),this.slashes=!0)),!F[s]&&(o||s&&!j[s])){for(var a,c,u=-1,l=0;l>>((3&t)<<3)&255;return o})},{}],103:[function(e,t,n){var d,g,m=e("./lib/rng"),y=e("./lib/bytesToUuid"),v=0,b=0;t.exports=function(e,t,n){var r,o=t&&n||0,i=t||[],s=(e=e||{}).node||d,a=void 0!==e.clockseq?e.clockseq:g;null!=s&&null!=a||(r=m(),null==s&&(s=d=[1|r[0],r[1],r[2],r[3],r[4],r[5]]),null==a&&(a=g=16383&(r[6]<<8|r[7])));var c=void 0!==e.msecs?e.msecs:(new Date).getTime(),u=void 0!==e.nsecs?e.nsecs:b+1,l=c-v+(u-b)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||v>>24&255,i[o++]=p>>>16&255,i[o++]=p>>>8&255,i[o++]=255&p;var h=c/4294967296*1e4&268435455;i[o++]=h>>>8&255,i[o++]=255&h,i[o++]=h>>>24&15|16,i[o++]=h>>>16&255,i[o++]=a>>>8|128,i[o++]=255&a;for(var f=0;f<6;++f)i[o+f]=s[f];return t||y(i)}},{"./lib/bytesToUuid":101,"./lib/rng":102}],104:[function(e,t,n){var s=e("./lib/rng"),a=e("./lib/bytesToUuid");t.exports=function(e,t,n){var r=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||s)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var i=0;i<16;++i)t[r+i]=o[i];return t||a(o)}},{"./lib/bytesToUuid":101,"./lib/rng":102}],105:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("./utils/LRU"),o=(Object.defineProperty(i.prototype,"size",{get:function(){return this.cache.length},enumerable:!0,configurable:!0}),i.prototype.put=function(e,t){var n="string"!=typeof e?i.getKeyString(e):e,r=this.populateValue(t);this.cache.put(n,r)},i.prototype.get=function(e){var t="string"!=typeof e?i.getKeyString(e):e,n=Date.now(),r=this.cache.get(t);if(r)for(var o=0;o>>=0;break;case"x":r=r.toString(16);break;case"X":r=r.toString(16).toUpperCase()}r=/[def]/.test(i[8])&&i[3]&&0<=r?"+"+r:r,a=i[4]?"0"==i[4]?"0":i[4].charAt(1):" ",c=i[6]-String(r).length,s=i[6]?function(e,t){for(var n=[];0=this._logLevel&&(c[e.level]>=this._echoLevel&&r[e.getLevel()](e.toString()),e.line=this._lineCount++)},u.prototype.clearObjects=function(){for(var e=0;e=r._logLevel}));var i=new a.Blob([JSON.stringify(o,void 0,4)],["text/plain"]),s=document.createElement("a"),t=t||"agent-log";s.href=a.URL.createObjectURL(i),s.download=t+".txt",document.body.appendChild(s),s.click(),document.body.removeChild(s)},u.prototype.scheduleUpstreamLogPush=function(e){connect.upstreamLogPushScheduled||(connect.upstreamLogPushScheduled=!0,a.setInterval(connect.hitch(this,this.reportMasterLogsUpStream,e),5e3))},u.prototype.reportMasterLogsUpStream=function(e){var t=this._logsToPush.slice();this._logsToPush=[],connect.ifMaster(connect.MasterTopics.SEND_LOGS,function(){0=connect.HTTP_STATUS_CODES.INTERNAL_SERVER_ERROR||e.status===connect.HTTP_STATUS_CODES.TOO_MANY_REQUESTS)?setTimeout(function(){t(--n)},s):o(e)}).catch(function(e){o(e)})}(t)})},connect.backoff=function(r,o,i,s){connect.assertTrue(connect.isFunction(r),"func must be a Function");var a=this;r({success:function(e){s&&s.success&&s.success(e)},failure:function(e,t){var n;0>",e)},u.prototype.getSubscriptions=function(e){return this.subMap.getSubscriptions(e)},u.prototype.trigger=function(t,n){connect.assertNotNull(t,"eventName");var r=this,e=this.subMap.getSubscriptions("<>"),o=this.subMap.getSubscriptions(t);this.logEvents&&t!==connect.EventType.LOG&&t!==connect.EventType.MASTER_RESPONSE&&t!==connect.EventType.API_METRIC&&connect.getLog().trace("Publishing event: %s",t),e.concat(o).forEach(function(e){try{e.f(n||null,t,r)}catch(e){connect.getLog().error("'%s' event handler failed.",t).withException(e)}})},u.prototype.bridge=function(){var n=this;return function(e,t){n.trigger(t,e)}},u.prototype.unsubscribeAll=function(){this.subMap.getAllSubscriptions().forEach(function(e){e.unsubscribe()})},connect.EventBus=u,connect.EventFactory=e,connect.EventType=t,connect.AgentEvents=r,connect.ConnnectionEvents=s,connect.ContactEvents=i,connect.WebSocketEvents=o,connect.MasterTopics=n}(),function(){connect=this.connect||{},this.connect=connect,this.lily=connect;function r(){}r.prototype.send=function(e){throw new connect.NotImplementedError},r.prototype.onMessage=function(e){throw new connect.NotImplementedError};function o(){r.call(this)}((o.prototype=Object.create(r.prototype)).constructor=o).prototype.onMessage=function(e){},o.prototype.send=function(e){};function e(e,t){r.call(this),this.window=e,this.domain=t||"*"}((e.prototype=Object.create(r.prototype)).constructor=e).prototype.send=function(e){this.window.postMessage(e,this.domain)},e.prototype.onMessage=function(e){this.window.addEventListener("message",e)};function i(e,t,n){r.call(this),this.input=e,this.output=t,this.domain=n||"*"}((i.prototype=Object.create(r.prototype)).constructor=i).prototype.send=function(e){this.output.postMessage(e,this.domain)},i.prototype.onMessage=function(e){this.input.addEventListener("message",e)};function t(e){r.call(this),this.port=e,this.id=connect.randomId()}((t.prototype=Object.create(r.prototype)).constructor=t).prototype.send=function(e){this.port.postMessage(e)},t.prototype.onMessage=function(e){this.port.addEventListener("message",e)},t.prototype.getId=function(){return this.id};function n(e){r.call(this),this.streamMap=e?connect.index(e,function(e){return e.getId()}):{},this.messageListeners=[]}((n.prototype=Object.create(r.prototype)).constructor=n).prototype.send=function(t){this.getStreams().forEach(function(e){try{e.send(t)}catch(e){}})},n.prototype.onMessage=function(t){this.messageListeners.push(t),this.getStreams().forEach(function(e){e.onMessage(t)})},n.prototype.addStream=function(t){this.streamMap[t.getId()]=t,this.messageListeners.forEach(function(e){t.onMessage(e)})},n.prototype.removeStream=function(e){delete this.streamMap[e.getId()]},n.prototype.getStreams=function(e){return connect.values(this.streamMap)},n.prototype.getStreamForPort=function(t){return connect.find(this.getStreams(),function(e){return e.port===t})};function s(e,t,n){this.name=e,this.upstream=t||new o,this.downstream=n||new o,this.downstreamBus=new connect.EventBus,this.upstreamBus=new connect.EventBus,this.upstream.onMessage(connect.hitch(this,this._dispatchEvent,this.upstreamBus)),this.downstream.onMessage(connect.hitch(this,this._dispatchEvent,this.downstreamBus))}s.prototype.onUpstream=function(e,t){return connect.assertNotNull(e,"eventName"),connect.assertNotNull(t,"f"),connect.assertTrue(connect.isFunction(t),"f must be a function"),this.upstreamBus.subscribe(e,t)},s.prototype.onAllUpstream=function(e){return connect.assertNotNull(e,"f"),connect.assertTrue(connect.isFunction(e),"f must be a function"),this.upstreamBus.subscribeAll(e)},s.prototype.onDownstream=function(e,t){return connect.assertNotNull(e,"eventName"),connect.assertNotNull(t,"f"),connect.assertTrue(connect.isFunction(t),"f must be a function"),this.downstreamBus.subscribe(e,t)},s.prototype.onAllDownstream=function(e){return connect.assertNotNull(e,"f"),connect.assertTrue(connect.isFunction(e),"f must be a function"),this.downstreamBus.subscribeAll(e)},s.prototype.sendUpstream=function(e,t){connect.assertNotNull(e,"eventName"),this.upstream.send({event:e,data:t})},s.prototype.sendDownstream=function(e,t){connect.assertNotNull(e,"eventName"),this.downstream.send({event:e,data:t})},s.prototype._dispatchEvent=function(e,t){var n=t.data;n.event&&e.trigger(n.event,n.data)},s.prototype.passUpstream=function(){var n=this;return function(e,t){n.upstream.send({event:t,data:e})}},s.prototype.passDownstream=function(){var n=this;return function(e,t){n.downstream.send({event:t,data:e})}},s.prototype.shutdown=function(){this.upstreamBus.unsubscribeAll(),this.downstreamBus.unsubscribeAll()};function a(e,t,n,r){s.call(this,e,new i(t,n.contentWindow,r||"*"),null)}(a.prototype=Object.create(s.prototype)).constructor=a,connect.Stream=r,connect.NullStream=o,connect.WindowStream=e,connect.WindowIOStream=i,connect.PortStream=t,connect.StreamMultiplexer=n,connect.Conduit=s,connect.IFrameConduit=a}(),function(){connect=this.connect||{},this.connect=connect,this.lily=connect,connect.ClientMethods=connect.makeEnum(["getAgentSnapshot","putAgentState","getAgentStates","getDialableCountryCodes","getRoutingProfileQueues","getAgentPermissions","getAgentConfiguration","updateAgentConfiguration","acceptContact","createOutboundContact","completeContact","destroyContact","notifyContactIssue","updateContactAttributes","createAdditionalConnection","destroyConnection","holdConnection","resumeConnection","toggleActiveConnections","conferenceConnections","sendClientLogs","sendDigits","sendSoftphoneCallReport","sendSoftphoneCallMetrics","getEndpoints","getNewAuthToken","createTransport"]),connect.MasterMethods=connect.makeEnum(["becomeMaster","checkMaster"]);function i(){}i.EMPTY_CALLBACKS={success:function(){},failure:function(){}},i.prototype.call=function(e,t,n){connect.assertNotNull(e,"method");var r=t||{},o=n||i.EMPTY_CALLBACKS;this._callImpl(e,r,o)},i.prototype._callImpl=function(e,t,n){throw new connect.NotImplementedError};function e(){i.call(this)}((e.prototype=Object.create(i.prototype)).constructor=e).prototype._callImpl=function(e,t,n){var r;n&&n.failure&&(r=connect.sprintf("No such method exists on NULL client: %s",e),n.failure(new connect.ValueError(r),{message:r}))};function t(e,t,n){i.call(this),this.conduit=e,this.requestEvent=t,this.responseEvent=n,this._requestIdCallbacksMap={},this.conduit.onUpstream(n,connect.hitch(this,this._handleResponse))}((t.prototype=Object.create(i.prototype)).constructor=t).prototype._callImpl=function(e,t,n){var r=connect.EventFactory.createRequest(this.requestEvent,e,t);this._requestIdCallbacksMap[r.requestId]=n,this.conduit.sendUpstream(r.event,r)},t.prototype._getCallbacksForRequest=function(e){var t=this._requestIdCallbacksMap[e]||null;return null!=t&&delete this._requestIdCallbacksMap[e],t},t.prototype._handleResponse=function(e){var t=this._getCallbacksForRequest(e.requestId);null!=t&&(e.err&&t.failure?t.failure(e.err,e.data):t.success&&t.success(e.data))};function n(e){t.call(this,e,connect.EventType.API_REQUEST,connect.EventType.API_RESPONSE)}(n.prototype=Object.create(t.prototype)).constructor=n;function r(e){t.call(this,e,connect.EventType.MASTER_REQUEST,connect.EventType.MASTER_RESPONSE)}(r.prototype=Object.create(t.prototype)).constructor=r;function o(e,t,n){connect.assertNotNull(e,"authToken"),connect.assertNotNull(t,"region"),i.call(this),AWS.config.credentials=new AWS.Credentials({}),AWS.config.region=t,this.authToken=e;var r=n||connect.getBaseUrl()+"/connect/api",o=new AWS.Endpoint(r);this.client=new AWS.Connect({endpoint:o})}((o.prototype=Object.create(i.prototype)).constructor=o).prototype._callImpl=function(r,e,o){var t,n=this,i=connect.getLog();connect.contains(this.client,r)?(e=this._translateParams(r,e),i.trace("AWSClient: --\x3e Calling operation '%s'",r),this.client[r](e).on("build",function(e){e.httpRequest.headers["X-Amz-Bearer"]=n.authToken}).send(function(e,t){try{var n;e?(e.code===connect.CTIExceptions.UNAUTHORIZED_EXCEPTION?o.authFailure():!o.accessDenied||e.code!==connect.CTIExceptions.ACCESS_DENIED_EXCEPTION&&403!==e.statusCode?((n={}).type=e.code,n.message=e.message,n.stack=e.stack?e.stack.split("\n"):[],o.failure(n,t)):o.accessDenied(),i.trace("AWSClient: <-- Operation '%s' failed: %s",r,JSON.stringify(e))):(i.trace("AWSClient: <-- Operation '%s' succeeded.",r).withObject(t),o.success(t))}catch(e){connect.getLog().error("Failed to handle AWS API request for method %s",r).withException(e)}})):(t=connect.sprintf("No such method exists on AWS client: %s",r),o.failure(new connect.ValueError(t),{message:t}))},o.prototype._requiresAuthenticationParam=function(e){return e!==connect.ClientMethods.COMPLETE_CONTACT},o.prototype._translateParams=function(e,t){switch(e){case connect.ClientMethods.UPDATE_AGENT_CONFIGURATION:t.configuration=this._translateAgentConfiguration(t.configuration);break;case connect.ClientMethods.SEND_SOFTPHONE_CALL_METRICS:t.softphoneStreamStatistics=this._translateSoftphoneStreamStatistics(t.softphoneStreamStatistics);break;case connect.ClientMethods.SEND_SOFTPHONE_CALL_REPORT:t.report=this._translateSoftphoneCallReport(t.report)}return this._requiresAuthenticationParam(e)&&(t.authentication={authToken:this.authToken}),t},o.prototype._translateAgentConfiguration=function(e){return{name:e.name,softphoneEnabled:e.softphoneEnabled,softphoneAutoAccept:e.softphoneAutoAccept,extension:e.extension,routingProfile:this._translateRoutingProfile(e.routingProfile),agentPreferences:e.agentPreferences}},o.prototype._translateRoutingProfile=function(e){return{name:e.name,routingProfileARN:e.routingProfileARN,defaultOutboundQueue:this._translateQueue(e.defaultOutboundQueue)}},o.prototype._translateQueue=function(e){return{queueARN:e.queueARN,name:e.name}},o.prototype._translateSoftphoneStreamStatistics=function(e){return e.forEach(function(e){"packetsCount"in e&&(e.packetCount=e.packetsCount,delete e.packetsCount)}),e},o.prototype._translateSoftphoneCallReport=function(e){return"handshakingTimeMillis"in e&&(e.handshakeTimeMillis=e.handshakingTimeMillis,delete e.handshakingTimeMillis),"preTalkingTimeMillis"in e&&(e.preTalkTimeMillis=e.preTalkingTimeMillis,delete e.preTalkingTimeMillis),"handshakingFailure"in e&&(e.handshakeFailure=e.handshakingFailure,delete e.handshakingFailure),"talkingTimeMillis"in e&&(e.talkTimeMillis=e.talkingTimeMillis,delete e.talkingTimeMillis),e.softphoneStreamStatistics=this._translateSoftphoneStreamStatistics(e.softphoneStreamStatistics),e},connect.ClientBase=i,connect.NullClient=e,connect.UpstreamConduitClient=n,connect.UpstreamConduitMasterClient=r,connect.AWSClient=o}(),function(){connect=this.connect||{},this.connect=connect,this.lily=connect;function r(e,t){connect.assertNotNull(e,"fromState"),connect.assertNotNull(t,"toState"),this.fromState=e,this.toState=t}r.prototype.getAssociations=function(e){throw connect.NotImplementedError()},r.prototype.getFromState=function(){return this.fromState},r.prototype.getToState=function(){return this.toState};function e(e,t,n){connect.assertNotNull(e,"fromState"),connect.assertNotNull(t,"toState"),connect.assertNotNull(n,"associations"),r.call(this,e,t),this.associations=n}((e.prototype=Object.create(r.prototype)).constructor=e).prototype.getAssociations=function(e){return this.associations};function i(e,t,n){connect.assertNotNull(e,"fromState"),connect.assertNotNull(t,"toState"),connect.assertNotNull(n,"closure"),connect.assertTrue(connect.isFunction(n),"closure must be a function"),r.call(this,e,t),this.closure=n}((i.prototype=Object.create(r.prototype)).constructor=i).prototype.getAssociations=function(e){return this.closure(e,this.getFromState(),this.getToState())};function s(){this.fromMap={}}s.ANY="<>",s.prototype.assoc=function(t,n,r){var o=this;if(!t)throw new Error("fromStateObj is not defined.");if(!n)throw new Error("toStateObj is not defined.");if(!r)throw new Error("assocObj is not defined.");return t instanceof Array?t.forEach(function(e){o.assoc(e,n,r)}):n instanceof Array?n.forEach(function(e){o.assoc(t,e,r)}):"function"==typeof r?this._addAssociation(new i(t,n,r)):r instanceof Array?this._addAssociation(new e(t,n,r)):this._addAssociation(new e(t,n,[r])),this},s.prototype.getAssociations=function(e,t,n){connect.assertNotNull(t,"fromState"),connect.assertNotNull(n,"toState");var r=[],o=this.fromMap[s.ANY]||{},i=this.fromMap[t]||{};return r=(r=r.concat(this._getAssociationsFromMap(o,e,t,n))).concat(this._getAssociationsFromMap(i,e,t,n))},s.prototype._addAssociation=function(e){var t=this.fromMap[e.getFromState()];((t=t||(this.fromMap[e.getFromState()]={}))[e.getToState()]||(t[e.getToState()]=[])).push(e)},s.prototype._getAssociationsFromMap=function(e,n,t,r){return(e[s.ANY]||[]).concat(e[r]||[]).reduce(function(e,t){return e.concat(t.getAssociations(n))},[])},connect.EventGraph=s}(),function(){var n=this;connect=n.connect||{},n.connect=connect,n.lily=connect,connect.AgentStateType=connect.makeEnum(["init","routable","not_routable","offline"]),connect.AgentStatusType=connect.AgentStateType,connect.AgentAvailStates=connect.makeEnum(["Init","Busy","AfterCallWork","CallingCustomer","Dialing","Joining","PendingAvailable","PendingBusy"]),connect.AgentErrorStates=connect.makeEnum(["Error","AgentHungUp","BadAddressAgent","BadAddressCustomer","Default","FailedConnectAgent","FailedConnectCustomer","LineEngagedAgent","LineEngagedCustomer","MissedCallAgent","MissedCallCustomer","MultipleCcpWindows","RealtimeCommunicationError"]),connect.EndpointType=connect.makeEnum(["phone_number","agent","queue"]),connect.AddressType=connect.EndpointType,connect.ConnectionType=connect.makeEnum(["agent","inbound","outbound","monitoring"]),connect.ConnectionStateType=connect.makeEnum(["init","connecting","connected","hold","disconnected"]),connect.ConnectionStatusType=connect.ConnectionStateType,connect.CONNECTION_ACTIVE_STATES=connect.set([connect.ConnectionStateType.CONNECTING,connect.ConnectionStateType.CONNECTED,connect.ConnectionStateType.HOLD]),connect.ContactStateType=connect.makeEnum(["init","incoming","pending","connecting","connected","missed","error","ended"]),connect.ContactStatusType=connect.ContactStateType,connect.CONTACT_ACTIVE_STATES=connect.makeEnum(["incoming","pending","connecting","connected"]),connect.ContactType=connect.makeEnum(["voice","queue_callback","chat"]),connect.ChannelType=connect.makeEnum(["VOICE","CHAT"]),connect.MediaType=connect.makeEnum(["softphone","chat"]),connect.SoftphoneCallType=connect.makeEnum(["audio_video","video_only","audio_only","none"]),connect.SoftphoneErrorTypes=connect.makeEnum(["unsupported_browser","microphone_not_shared","signalling_handshake_failure","signalling_connection_failure","ice_collection_timeout","user_busy_error","webrtc_error","realtime_communication_error","other"]),connect.CTIExceptions=connect.makeEnum(["AccessDeniedException","InvalidStateException","BadEndpointException","InvalidAgentARNException","InvalidConfigurationException","InvalidContactTypeException","PaginationException","RefreshTokenExpiredException","SendDataFailedException","UnauthorizedException"]);function e(){if(!connect.agent.initialized)throw new connect.StateError("The agent is not yet initialized!")}e.prototype._getData=function(){return connect.core.getAgentDataProvider().getAgentData()},e.prototype._createContactAPI=function(e){return new connect.Contact(e.contactId)},e.prototype.onContactPending=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.CONTACT_PENDING,e)},e.prototype.onRefresh=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.REFRESH,e)},e.prototype.onRoutable=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.ROUTABLE,e)},e.prototype.onNotRoutable=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.NOT_ROUTABLE,e)},e.prototype.onOffline=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.OFFLINE,e)},e.prototype.onError=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.ERROR,e)},e.prototype.onSoftphoneError=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.SOFTPHONE_ERROR,e)},e.prototype.onWebSocketConnectionLost=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.WEBSOCKET_CONNECTION_LOST,e)},e.prototype.onWebSocketConnectionGained=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.WEBSOCKET_CONNECTION_GAINED,e)},e.prototype.onAfterCallWork=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.ACW,e)},e.prototype.onStateChange=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.STATE_CHANGE,e)},e.prototype.onMuteToggle=function(e){connect.core.getUpstream().onUpstream(connect.AgentEvents.MUTE_TOGGLE,e)},e.prototype.mute=function(){connect.core.getUpstream().sendUpstream(connect.EventType.BROADCAST,{event:connect.EventType.MUTE,data:{mute:!0}})},e.prototype.unmute=function(){connect.core.getUpstream().sendUpstream(connect.EventType.BROADCAST,{event:connect.EventType.MUTE,data:{mute:!1}})},e.prototype.getStatus=e.prototype.getState=function(){return this._getData().snapshot.state},e.prototype.getStatusDuration=e.prototype.getStateDuration=function(){return connect.now()-this._getData().snapshot.state.startTimestamp.getTime()+connect.core.getSkew()},e.prototype.getPermissions=function(){return this.getConfiguration().permissions},e.prototype.getContacts=function(t){var n=this;return this._getData().snapshot.contacts.map(function(e){return n._createContactAPI(e)}).filter(function(e){return!t||e.getType()===t})},e.prototype.getConfiguration=function(){return this._getData().configuration},e.prototype.getAgentStates=function(){return this.getConfiguration().agentStates},e.prototype.getRoutingProfile=function(){return this.getConfiguration().routingProfile},e.prototype.getChannelConcurrency=function(e){var t=(t=this.getRoutingProfile().channelConcurrencyMap)||Object.keys(connect.ChannelType).reduce(function(e,t){return e[connect.ChannelType[t]]=1,e},{});return e?t[e]||0:t},e.prototype.getName=function(){return this.getConfiguration().name},e.prototype.getExtension=function(){return this.getConfiguration().extension},e.prototype.getDialableCountries=function(){return this.getConfiguration().dialableCountries},e.prototype.isSoftphoneEnabled=function(){return this.getConfiguration().softphoneEnabled},e.prototype.setConfiguration=function(e,t){connect.core.getClient().call(connect.ClientMethods.UPDATE_AGENT_CONFIGURATION,{configuration:connect.assertNotNull(e,"configuration")},{success:function(e){connect.core.getUpstream().sendUpstream(connect.EventType.RELOAD_AGENT_CONFIGURATION),t.success&&t.success(e)},failure:t&&t.failure})},e.prototype.setStatus=e.prototype.setState=function(e,t){connect.core.getClient().call(connect.ClientMethods.PUT_AGENT_STATE,{state:connect.assertNotNull(e,"state")},t)},e.prototype.connect=function(e,t){var n=connect.core.getClient(),r=new connect.Endpoint(e);delete r.endpointId,n.call(connect.ClientMethods.CREATE_OUTBOUND_CONTACT,{endpoint:connect.assertNotNull(r,"endpoint"),queueARN:t&&(t.queueARN||t.queueId)||this.getRoutingProfile().defaultOutboundQueue.queueARN},t&&{success:t.success,failure:t.failure})},e.prototype.getAllQueueARNs=function(){return this.getConfiguration().routingProfile.queues.map(function(e){return e.queueARN})},e.prototype.getAddresses=e.prototype.getEndpoints=function(n,r,e){var o=this,t=connect.core.getClient();connect.assertNotNull(r,"callbacks"),connect.assertNotNull(r.success,"callbacks.success");var i=e||{};i.endpoints=i.endpoints||[],i.maxResults=i.maxResults||connect.DEFAULT_BATCH_SIZE,connect.isArray(n)||(n=[n]),t.call(connect.ClientMethods.GET_ENDPOINTS,{queueARNs:n,nextToken:i.nextToken||null,maxResults:i.maxResults},{success:function(e){var t;e.nextToken?o.getEndpoints(n,r,{nextToken:e.nextToken,maxResults:i.maxResults,endpoints:i.endpoints.concat(e.endpoints)}):(i.endpoints=i.endpoints.concat(e.endpoints),t=i.endpoints.map(function(e){return new connect.Endpoint(e)}),r.success({endpoints:t,addresses:t}))},failure:r.failure})},e.prototype.toSnapshot=function(){return new connect.AgentSnapshot(this._getData())};function t(e){connect.Agent.call(this),this.agentData=e}((t.prototype=Object.create(e.prototype)).constructor=t).prototype._getData=function(){return this.agentData},t.prototype._createContactAPI=function(e){return new connect.ContactSnapshot(e)};function r(e){this.contactId=e}r.prototype._getData=function(){return connect.core.getAgentDataProvider().getContactData(this.getContactId())},r.prototype._createConnectionAPI=function(e){return this.getType()===connect.ContactType.CHAT?new connect.ChatConnection(this.contactId,e.connectionId):new connect.VoiceConnection(this.contactId,e.connectionId)},r.prototype.getEventName=function(e){return connect.core.getContactEventName(e,this.getContactId())},r.prototype.onRefresh=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.REFRESH),e)},r.prototype.onIncoming=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.INCOMING),e)},r.prototype.onConnecting=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.CONNECTING),e)},r.prototype.onPending=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.PENDING),e)},r.prototype.onAccepted=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.ACCEPTED),e)},r.prototype.onMissed=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.MISSED),e)},r.prototype.onEnded=function(e){var t=connect.core.getEventBus();t.subscribe(this.getEventName(connect.ContactEvents.ENDED),e),t.subscribe(this.getEventName(connect.ContactEvents.DESTROYED),e)},r.prototype.onDestroy=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.DESTROYED),e)},r.prototype.onACW=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.ACW),e)},r.prototype.onConnected=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.CONNECTED),e)},r.prototype.getContactId=function(){return this.contactId},r.prototype.getInitialContactId=r.prototype.getOriginalContactId=function(){return this._getData().initialContactId},r.prototype.getType=function(){return this._getData().type},r.prototype.getContactDuration=function(){return this._getData().contactDuration},r.prototype.getStatus=r.prototype.getState=function(){return this._getData().state},r.prototype.getStatusDuration=r.prototype.getStateDuration=function(){return connect.now()-this._getData().state.timestamp.getTime()+connect.core.getSkew()},r.prototype.getQueue=function(){return this._getData().queue},r.prototype.getQueueTimestamp=function(){return this._getData().queueTimestamp},r.prototype.getConnections=function(){var t=this;return this._getData().connections.map(function(e){return t.getType()===connect.ContactType.CHAT?new connect.ChatConnection(t.contactId,e.connectionId):new connect.VoiceConnection(t.contactId,e.connectionId)})},r.prototype.getInitialConnection=function(){return connect.find(this.getConnections(),function(e){return e.isInitialConnection()})||null},r.prototype.getActiveInitialConnection=function(){var e=this.getInitialConnection();return null!=e&&e.isActive()?e:null},r.prototype.getThirdPartyConnections=function(){return this.getConnections().filter(function(e){return!e.isInitialConnection()&&e.getType()!==connect.ConnectionType.AGENT})},r.prototype.getSingleActiveThirdPartyConnection=function(){return this.getThirdPartyConnections().filter(function(e){return e.isActive()})[0]||null},r.prototype.getAgentConnection=function(){return connect.find(this.getConnections(),function(e){var t=e.getType();return t===connect.ConnectionType.AGENT||t===connect.ConnectionType.MONITORING})},r.prototype.getAttributes=function(){return this._getData().attributes},r.prototype.isSoftphoneCall=function(){return null!=connect.find(this.getConnections(),function(e){return null!=e.getSoftphoneMediaInfo()})},r.prototype.isInbound=function(){var e=this.getInitialConnection();return!!e&&e.getType()===connect.ConnectionType.INBOUND},r.prototype.isConnected=function(){return this.getStatus().type===connect.ContactStateType.CONNECTED},r.prototype.accept=function(n){var e=connect.core.getClient(),r=this,o=this.getContactId();e.call(connect.ClientMethods.ACCEPT_CONTACT,{contactId:o},{success:function(e){var t=connect.core.getUpstream();t.sendUpstream(connect.EventType.BROADCAST,{event:connect.ContactEvents.ACCEPTED,data:new connect.Contact(o)}),t.sendUpstream(connect.EventType.BROADCAST,{event:connect.core.getContactEventName(connect.ContactEvents.ACCEPTED,r.getContactId()),data:new connect.Contact(o)}),n&&n.success&&n.success(e)},failure:n?n.failure:null})},r.prototype.destroy=function(e){connect.core.getClient().call(connect.ClientMethods.DESTROY_CONTACT,{contactId:this.getContactId()},e)},r.prototype.complete=function(e){connect.core.getClient().call(connect.ClientMethods.COMPLETE_CONTACT,{contactId:this.getContactId()},e)},r.prototype.notifyIssue=function(e,t,n){connect.core.getClient().call(connect.ClientMethods.NOTIFY_CONTACT_ISSUE,{contactId:this.getContactId(),issueCode:e,description:t},n)},r.prototype.addConnection=function(e,t){var n=connect.core.getClient(),r=new connect.Endpoint(e);delete r.endpointId,n.call(connect.ClientMethods.CREATE_ADDITIONAL_CONNECTION,{contactId:this.getContactId(),endpoint:r},t)},r.prototype.toggleActiveConnections=function(e){var t,n=connect.core.getClient(),r=null,o=connect.find(this.getConnections(),function(e){return e.getStatus().type===connect.ConnectionStateType.HOLD});null!=o?r=o.getConnectionId():0<(t=this.getConnections().filter(function(e){return e.isActive()})).length&&(r=t[0].getConnectionId()),n.call(connect.ClientMethods.TOGGLE_ACTIVE_CONNECTIONS,{contactId:this.getContactId(),connectionId:r},e)},r.prototype.sendSoftphoneMetrics=function(e,t){connect.core.getClient().call(connect.ClientMethods.SEND_SOFTPHONE_CALL_METRICS,{contactId:this.getContactId(),ccpVersion:n.ccpVersion,softphoneStreamStatistics:e},t)},r.prototype.sendSoftphoneReport=function(e,t){connect.core.getClient().call(connect.ClientMethods.SEND_SOFTPHONE_CALL_REPORT,{contactId:this.getContactId(),ccpVersion:n.ccpVersion,report:e},t)},r.prototype.conferenceConnections=function(e){connect.core.getClient().call(connect.ClientMethods.CONFERENCE_CONNECTIONS,{contactId:this.getContactId()},e)},r.prototype.toSnapshot=function(){return new connect.ContactSnapshot(this._getData())};function o(e){connect.Contact.call(this,e.contactId),this.contactData=e}((o.prototype=Object.create(r.prototype)).constructor=o).prototype._getData=function(){return this.contactData},o.prototype._createConnectionAPI=function(e){return new connect.ConnectionSnapshot(e)};function i(e,t){this.contactId=e,this.connectionId=t,this._initMediaController()}i.prototype._getData=function(){return connect.core.getAgentDataProvider().getConnectionData(this.getContactId(),this.getConnectionId())},i.prototype.getContactId=function(){return this.contactId},i.prototype.getConnectionId=function(){return this.connectionId},i.prototype.getAddress=i.prototype.getEndpoint=function(){return new connect.Endpoint(this._getData().endpoint)},i.prototype.getStatus=i.prototype.getState=function(){return this._getData().state},i.prototype.getStatusDuration=i.prototype.getStateDuration=function(){return connect.now()-this._getData().state.timestamp.getTime()+connect.core.getSkew()},i.prototype.getType=function(){return this._getData().type},i.prototype.isInitialConnection=function(){return this._getData().initial},i.prototype.isActive=function(){return connect.contains(connect.CONNECTION_ACTIVE_STATES,this.getStatus().type)},i.prototype.isConnected=function(){return this.getStatus().type===connect.ConnectionStateType.CONNECTED},i.prototype.isConnecting=function(){return this.getStatus().type===connect.ConnectionStateType.CONNECTING},i.prototype.isOnHold=function(){return this.getStatus().type===connect.ConnectionStateType.HOLD},i.prototype.getSoftphoneMediaInfo=function(){return this._getData().softphoneMediaInfo},i.prototype.getMonitorInfo=function(){return this._getData().monitoringInfo},i.prototype.destroy=function(e){connect.core.getClient().call(connect.ClientMethods.DESTROY_CONNECTION,{contactId:this.getContactId(),connectionId:this.getConnectionId()},e)},i.prototype.sendDigits=function(e,t){connect.core.getClient().call(connect.ClientMethods.SEND_DIGITS,{contactId:this.getContactId(),connectionId:this.getConnectionId(),digits:e},t)},i.prototype.hold=function(e){connect.core.getClient().call(connect.ClientMethods.HOLD_CONNECTION,{contactId:this.getContactId(),connectionId:this.getConnectionId()},e)},i.prototype.resume=function(e){connect.core.getClient().call(connect.ClientMethods.RESUME_CONNECTION,{contactId:this.getContactId(),connectionId:this.getConnectionId()},e)},i.prototype.toSnapshot=function(){return new connect.ConnectionSnapshot(this._getData())},i.prototype._initMediaController=function(){this.getMediaInfo()&&connect.core.mediaFactory.get(this).catch(function(){})},i.prototype._isAgentConnectionType=function(){var e=this.getType();return e===connect.ConnectionType.AGENT||e===connect.ConnectionType.MONITORING};function s(e,t){i.call(this,e,t)}((s.prototype=Object.create(i.prototype)).constructor=s).prototype.getSoftphoneMediaInfo=function(){return this._getData().softphoneMediaInfo},s.prototype.getMediaInfo=function(){return this._getData().softphoneMediaInfo},s.prototype.getMediaType=function(){return connect.MediaType.SOFTPHONE},s.prototype.getMediaController=function(){return connect.core.mediaFactory.get(this)};function a(e,t){i.call(this,e,t)}((a.prototype=Object.create(i.prototype)).constructor=a).prototype.getMediaInfo=function(){var t=this._getData().chatMediaInfo;if(t){var e=connect.core.getAgentDataProvider().getContactData(this.contactId),n={contactId:this.contactId,initialContactId:e.initialContactId||this.contactId,participantId:this.connectionId,getConnectionToken:connect.hitch(this,this.getConnectionToken)};if(t.connectionData)try{n.participantToken=JSON.parse(t.connectionData).ConnectionAuthenticationToken}catch(e){connect.getLog().error(connect.LogComponent.CHAT,"Connection data is invalid").withObject(t).withException(e),n.participantToken=null}return n.participantToken=n.participantToken||null,n.originalInfo=this._getData().chatMediaInfo,n}return null},a.prototype.getConnectionToken=function(){client=connect.core.getClient();var e=connect.core.getAgentDataProvider().getContactData(this.contactId),r={transportType:connect.TRANSPORT_TYPES.CHAT_TOKEN,participantId:this.connectionId,contactId:e.initialContactId||this.contactId};return new Promise(function(t,n){client.call(connect.ClientMethods.CREATE_TRANSPORT,r,{success:function(e){connect.getLog().info("getConnectionToken succeeded"),t(e)},failure:function(e,t){connect.getLog().error("getConnectionToken failed").withObject({err:e,data:t}),n(Error("getConnectionToken failed"))}})})},a.prototype.getMediaType=function(){return connect.MediaType.CHAT},a.prototype.getMediaController=function(){return connect.core.mediaFactory.get(this)},a.prototype._initMediaController=function(){this._isAgentConnectionType()&&connect.core.mediaFactory.get(this).catch(function(){})};function c(e){connect.Connection.call(this,e.contactId,e.connectionId),this.connectionData=e}((c.prototype=Object.create(i.prototype)).constructor=c).prototype._getData=function(){return this.connectionData},c.prototype._initMediaController=function(){};function u(e){var t=e||{};this.endpointARN=t.endpointId||t.endpointARN||null,this.endpointId=this.endpointARN,this.type=t.type||null,this.name=t.name||null,this.phoneNumber=t.phoneNumber||null,this.agentLogin=t.agentLogin||null,this.queue=t.queue||null}u.prototype.stripPhoneNumber=function(){return this.phoneNumber?this.phoneNumber.replace(/sip:([^@]*)@.*/,"$1"):""},u.byPhoneNumber=function(e,t){return new u({type:connect.EndpointType.PHONE_NUMBER,phoneNumber:e,name:t||null})};function l(e,t,n){this.errorType=e,this.errorMessage=t,this.endPointUrl=n}l.prototype.getErrorType=function(){return this.errorType},l.prototype.getErrorMessage=function(){return this.errorMessage},l.prototype.getEndPointUrl=function(){return this.endPointUrl},connect.agent=function(e){var t=connect.core.getEventBus().subscribe(connect.AgentEvents.INIT,e);return connect.agent.initialized&&e(new connect.Agent),t},connect.agent.initialized=!1,connect.contact=function(e){return connect.core.getEventBus().subscribe(connect.ContactEvents.INIT,e)},connect.onWebsocketInitFailure=function(e){var t=connect.core.getEventBus().subscribe(connect.WebSocketEvents.INIT_FAILURE,e);return connect.webSocketInitFailed&&e(),t},connect.ifMaster=function(e,t,n){if(connect.assertNotNull(e,"A topic must be provided."),connect.assertNotNull(t,"A true callback must be provided."),!connect.core.masterClient)return connect.getLog().warn("We can't be the master for topic '%s' because there is no master client!",e),void(n&&n());connect.core.getMasterClient().call(connect.MasterMethods.CHECK_MASTER,{topic:e},{success:function(e){e.isMaster?t():n&&n()}})},connect.becomeMaster=function(e){connect.assertNotNull(e,"A topic must be provided."),connect.core.getMasterClient().call(connect.MasterMethods.BECOME_MASTER,{topic:e})},connect.Agent=e,connect.AgentSnapshot=t,connect.Contact=r,connect.ContactSnapshot=o,connect.Connection=s,connect.BaseConnection=i,connect.VoiceConnection=s,connect.ChatConnection=a,connect.ConnectionSnapshot=c,connect.Endpoint=u,connect.Address=u,connect.SoftphoneError=l}(),function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=2)}([function(e,t,n){"use strict";var r=n(1);function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i={assertTrue:function(e,t){if(!e)throw new Error(t)},assertNotNull:function(e,t){return i.assertTrue(null!==e&&void 0!==o(e),Object(r.sprintf)("%s must be provided",t||"A value")),e},isNonEmptyString:function(e){return"string"==typeof e&&0=this._level}},{key:"hasClientLogger",value:function(){return null!==this._clientLogger}},{key:"getLogger",value:function(e){var t=e.prefix||"";return"DEBUG"===this._logsDestination?this.consoleLoggerWrapper:new y(t)}},{key:"updateLoggerConfig",value:function(e){var t=e||{};this._level=t.level||d.DEBUG,this._clientLogger=t.logger||null,this._logsDestination="NULL",t.debug&&(this._logsDestination="DEBUG"),t.logger&&(this._logsDestination="CLIENT_LOGGER")}}]),S),m=(h(E,[{key:"debug",value:function(){}},{key:"info",value:function(){}},{key:"warn",value:function(){}},{key:"error",value:function(){}}]),E),y=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}(b,m),h(b,[{key:"debug",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n>>0).toString(8);break;case"s":n=String(n),n=o.precision?n.substring(0,o.precision):n;break;case"t":n=String(!!n),n=o.precision?n.substring(0,o.precision):n;break;case"T":n=Object.prototype.toString.call(n).slice(8,-1).toLowerCase(),n=o.precision?n.substring(0,o.precision):n;break;case"u":n=parseInt(n,10)>>>0;break;case"v":n=n.valueOf(),n=o.precision?n.substring(0,o.precision):n;break;case"x":n=(parseInt(n,10)>>>0).toString(16);break;case"X":n=(parseInt(n,10)>>>0).toString(16).toUpperCase()}d.json.test(o.type)?h+=n:(!d.number.test(o.type)||c&&!o.sign?u="":(u=c?"+":"-",n=n.toString().replace(d.sign,"")),s=o.pad_char?"0"===o.pad_char?"0":o.pad_char.charAt(1):" ",a=o.width-(u+n).length,i=o.width&&0t.packetsLost?e.packetsLost-t.packetsLost:0,o=e.packetsCount>t.packetsCount?e.packetsCount-t.packetsCount:0;return new O(e.timestamp,r,o,n,e.audioLevel,e.jbMilliseconds,e.rttMilliseconds)}return new O(e.timestamp,e.packetsLost,e.packetsCount,n,e.audioLevel,e.jbMilliseconds,e.rttMilliseconds)},x=function(e,t){u=r(u),l=r(l),function(e,t,n,r){t.streamStats=[L(n,i),L(r,s)];var o={callStartTime:t.sessionStartTime,callEndTime:t.sessionEndTime,gumTimeMillis:t.gumTimeMillis,initializationTimeMillis:t.initializationTimeMillis,iceCollectionTimeMillis:t.iceCollectionTimeMillis,signallingConnectTimeMillis:t.signallingConnectTimeMillis,handshakingTimeMillis:t.handshakingTimeMillis,preTalkingTimeMillis:t.preTalkingTimeMillis,talkingTimeMillis:t.talkingTimeMillis,cleanupTimeMillis:t.cleanupTimeMillis,iceCollectionFailure:t.iceCollectionFailure,signallingConnectionFailure:t.signallingConnectionFailure,handshakingFailure:t.handshakingFailure,gumOtherFailure:t.gumOtherFailure,gumTimeoutFailure:t.gumTimeoutFailure,createOfferFailure:t.createOfferFailure,setLocalDescriptionFailure:t.setLocalDescriptionFailure,userBusyFailure:t.userBusyFailure,invalidRemoteSDPFailure:t.invalidRemoteSDPFailure,noRemoteIceCandidateFailure:t.noRemoteIceCandidateFailure,setRemoteDescriptionFailure:t.setRemoteDescriptionFailure,softphoneStreamStatistics:t.streamStats};e.sendSoftphoneReport(o,{success:function(){h.info("sendSoftphoneReport success"+JSON.stringify(o))},failure:function(e){h.error("sendSoftphoneReport failed.").withObject(e)}})}(e,t,L(a,i),L(c,s)),n(e)},O=function(e,t,n,r,o,i,s){this.softphoneStreamType=r,this.timestamp=e,this.packetsLost=t,this.packetsCount=n,this.audioLevel=o,this.jitterBufferMillis=i,this.roundTripTimeMillis=s},L=function(e,t){return new O((e=e||{}).timestamp,e.packetsLost,e.packetsCount,t,e.audioLevel)},P=function(e){this._originalLogger=e;var r=this;this._tee=function(e,n){return function(){var e=Array.prototype.slice.call(arguments[0]),t="";e.forEach(function(){t+=" %s"}),n.apply(r._originalLogger,[connect.LogComponent.SOFTPHONE,t].concat(e))}}};P.prototype.debug=function(){this._tee(1,this._originalLogger.debug)(arguments)},P.prototype.info=function(){this._tee(2,this._originalLogger.info)(arguments)},P.prototype.log=function(){this._tee(3,this._originalLogger.log)(arguments)},P.prototype.warn=function(){this._tee(4,this._originalLogger.warn)(arguments)},P.prototype.error=function(){this._tee(5,this._originalLogger.error)(arguments)},connect.SoftphoneManager=function(e){var a;h=new P(connect.getLog()),connect.RtcPeerConnectionFactory&&(a=new connect.RtcPeerConnectionFactory(h,connect.core.getWebSocketManager(),g,connect.hitch(this,t,{transportType:"softphone",softphoneClientId:g}),connect.hitch(this,C))),A()||C(f.UNSUPPORTED_BROWSER,"Connect does not support this browser. Some functionality may not work. ","");S({success:function(e){connect.isFirefoxBrowser()&&connect.core.setSoftphoneUserMediaStream(e)},failure:function(e){C(e,"Your microphone is not enabled in your browser. ","")}});y(),this.ringtoneEngine=null;var c="true"===e.cleanMultipleSessions,u={},l={};this.getSession=function(e){return u[e]};function p(n){var r;u.hasOwnProperty(n)&&(r=u[n],new Promise(function(e,t){delete u[n],delete l[n],r.hangup()}).catch(function(e){lily.getLog().warn("Clean up the session locally "+n,e.message)}))}function n(n,r){var e,t,o,i,s;!u[r]||(e=n).getStatus().type!==connect.ContactStatusType.ENDED&&e.getStatus().type!==connect.ContactStatusType.ERROR&&e.getStatus().type!==connect.ContactStatusType.MISSED||p(r),!n.isSoftphoneCall()||l[r]||n.getStatus().type!==connect.ContactStatusType.CONNECTING&&n.getStatus().type!==connect.ContactStatusType.INCOMING||(l[r]=!0,h.info("Softphone call detected:","contactId "+n.getContactId(),"agent connectionId "+r),function(e){if(0e.BLOCK_SIZE&&((r=new e).update(n),n=r.digest())}var o=new Uint8Array(e.BLOCK_SIZE);return o.set(n),o}(e,t),r=new Uint8Array(e.BLOCK_SIZE);r.set(n);for(var o=0;o>>32-o)+n&4294967295}function s(e,t,n,r,o,i,s){return c(t&n|~t&r,e,t,o,i,s)}function u(e,t,n,r,o,i,s){return c(t&r|n&~r,e,t,o,i,s)}function l(e,t,n,r,o,i,s){return c(t^n^r,e,t,o,i,s)}function p(e,t,n,r,o,i,s){return c(n^(t|~r),e,t,o,i,s)}(t.exports=r).BLOCK_SIZE=64,r.prototype.update=function(e){if(o.isEmptyData(e))return this;if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=o.convertToBuffer(e),n=0,r=t.byteLength;for(this.bytesHashed+=r;0>>0,!0),t.setUint32(60,Math.floor(r/4294967296),!0),this.hashBuffer(),this.finished=!0}for(var i=new DataView(new ArrayBuffer(16)),o=0;o<4;o++)i.setUint32(4*o,this.state[o],!0);var s=new a(i.buffer,i.byteOffset,i.byteLength);return e?s.toString(e):s},r.prototype.hashBuffer=function(){var e=this.buffer,t=this.state,n=s(n=t[0],i=t[1],o=t[2],r=t[3],e.getUint32(0,!0),7,3614090360),r=s(r,n,i,o,e.getUint32(4,!0),12,3905402710),o=s(o,r,n,i,e.getUint32(8,!0),17,606105819),i=s(i,o,r,n,e.getUint32(12,!0),22,3250441966);n=s(n,i,o,r,e.getUint32(16,!0),7,4118548399),r=s(r,n,i,o,e.getUint32(20,!0),12,1200080426),o=s(o,r,n,i,e.getUint32(24,!0),17,2821735955),i=s(i,o,r,n,e.getUint32(28,!0),22,4249261313),n=s(n,i,o,r,e.getUint32(32,!0),7,1770035416),r=s(r,n,i,o,e.getUint32(36,!0),12,2336552879),o=s(o,r,n,i,e.getUint32(40,!0),17,4294925233),i=s(i,o,r,n,e.getUint32(44,!0),22,2304563134),n=s(n,i,o,r,e.getUint32(48,!0),7,1804603682),r=s(r,n,i,o,e.getUint32(52,!0),12,4254626195),o=s(o,r,n,i,e.getUint32(56,!0),17,2792965006),n=u(n,i=s(i,o,r,n,e.getUint32(60,!0),22,1236535329),o,r,e.getUint32(4,!0),5,4129170786),r=u(r,n,i,o,e.getUint32(24,!0),9,3225465664),o=u(o,r,n,i,e.getUint32(44,!0),14,643717713),i=u(i,o,r,n,e.getUint32(0,!0),20,3921069994),n=u(n,i,o,r,e.getUint32(20,!0),5,3593408605),r=u(r,n,i,o,e.getUint32(40,!0),9,38016083),o=u(o,r,n,i,e.getUint32(60,!0),14,3634488961),i=u(i,o,r,n,e.getUint32(16,!0),20,3889429448),n=u(n,i,o,r,e.getUint32(36,!0),5,568446438),r=u(r,n,i,o,e.getUint32(56,!0),9,3275163606),o=u(o,r,n,i,e.getUint32(12,!0),14,4107603335),i=u(i,o,r,n,e.getUint32(32,!0),20,1163531501),n=u(n,i,o,r,e.getUint32(52,!0),5,2850285829),r=u(r,n,i,o,e.getUint32(8,!0),9,4243563512),o=u(o,r,n,i,e.getUint32(28,!0),14,1735328473),n=l(n,i=u(i,o,r,n,e.getUint32(48,!0),20,2368359562),o,r,e.getUint32(20,!0),4,4294588738),r=l(r,n,i,o,e.getUint32(32,!0),11,2272392833),o=l(o,r,n,i,e.getUint32(44,!0),16,1839030562),i=l(i,o,r,n,e.getUint32(56,!0),23,4259657740),n=l(n,i,o,r,e.getUint32(4,!0),4,2763975236),r=l(r,n,i,o,e.getUint32(16,!0),11,1272893353),o=l(o,r,n,i,e.getUint32(28,!0),16,4139469664),i=l(i,o,r,n,e.getUint32(40,!0),23,3200236656),n=l(n,i,o,r,e.getUint32(52,!0),4,681279174),r=l(r,n,i,o,e.getUint32(0,!0),11,3936430074),o=l(o,r,n,i,e.getUint32(12,!0),16,3572445317),i=l(i,o,r,n,e.getUint32(24,!0),23,76029189),n=l(n,i,o,r,e.getUint32(36,!0),4,3654602809),r=l(r,n,i,o,e.getUint32(48,!0),11,3873151461),o=l(o,r,n,i,e.getUint32(60,!0),16,530742520),n=p(n,i=l(i,o,r,n,e.getUint32(8,!0),23,3299628645),o,r,e.getUint32(0,!0),6,4096336452),r=p(r,n,i,o,e.getUint32(28,!0),10,1126891415),o=p(o,r,n,i,e.getUint32(56,!0),15,2878612391),i=p(i,o,r,n,e.getUint32(20,!0),21,4237533241),n=p(n,i,o,r,e.getUint32(48,!0),6,1700485571),r=p(r,n,i,o,e.getUint32(12,!0),10,2399980690),o=p(o,r,n,i,e.getUint32(40,!0),15,4293915773),i=p(i,o,r,n,e.getUint32(4,!0),21,2240044497),n=p(n,i,o,r,e.getUint32(32,!0),6,1873313359),r=p(r,n,i,o,e.getUint32(60,!0),10,4264355552),o=p(o,r,n,i,e.getUint32(24,!0),15,2734768916),i=p(i,o,r,n,e.getUint32(52,!0),21,1309151649),n=p(n,i,o,r,e.getUint32(16,!0),6,4149444226),r=p(r,n,i,o,e.getUint32(44,!0),10,3174756917),o=p(o,r,n,i,e.getUint32(8,!0),15,718787259),i=p(i,o,r,n,e.getUint32(36,!0),21,3951481745),t[0]=n+t[0]&4294967295,t[1]=i+t[1]&4294967295,t[2]=o+t[2]&4294967295,t[3]=r+t[3]&4294967295}},{"./browserHashUtils":11,"buffer/":80}],14:[function(e,t,n){var o=e("buffer/").Buffer,r=e("./browserHashUtils");new Uint32Array([1518500249,1859775393,-1894007588,-899497514]),Math.pow(2,53);function i(){this.h0=1732584193,this.h1=4023233417,this.h2=2562383102,this.h3=271733878,this.h4=3285377520,this.block=new Uint32Array(80),this.offset=0,this.shift=24,this.totalLength=0}(t.exports=i).BLOCK_SIZE=64,i.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");if(r.isEmptyData(e))return this;var t=(e=r.convertToBuffer(e)).length;this.totalLength+=8*t;for(var n=0;n>t);var n=new o(20),r=new DataView(n.buffer);return r.setUint32(0,this.h0,!1),r.setUint32(4,this.h1,!1),r.setUint32(8,this.h2,!1),r.setUint32(12,this.h3,!1),r.setUint32(16,this.h4,!1),e?n.toString(e):n},i.prototype.processBlock=function(){for(var e=16;e<80;e++){var t=this.block[e-3]^this.block[e-8]^this.block[e-14]^this.block[e-16];this.block[e]=t<<1|t>>>31}for(var n,r,o=this.h0,i=this.h1,s=this.h2,a=this.h3,c=this.h4,e=0;e<80;e++){r=e<20?(n=a^i&(s^a),1518500249):e<40?(n=i^s^a,1859775393):e<60?(n=i&s|a&(i|s),2400959708):(n=i^s^a,3395469782);var u=(o<<5|o>>>27)+n+c+r+(0|this.block[e]),c=a,a=s,s=i<<30|i>>>2,i=o,o=u}for(this.h0=this.h0+o|0,this.h1=this.h1+i|0,this.h2=this.h2+s|0,this.h3=this.h3+a|0,this.h4=this.h4+c|0,e=this.offset=0;e<16;e++)this.block[e]=0}},{"./browserHashUtils":11,"buffer/":80}],15:[function(e,t,n){var s=e("buffer/").Buffer,r=e("./browserHashUtils"),m=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]),o=Math.pow(2,53)-1;function i(){this.state=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}(t.exports=i).BLOCK_SIZE=64,i.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");if(r.isEmptyData(e))return this;var t=0,n=(e=r.convertToBuffer(e)).byteLength;if(this.bytesHashed+=n,8*this.bytesHashed>o)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;0>>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 e?i.toString(e):i},i.prototype.hashBuffer=function(){for(var e,t,n,r=this.buffer,o=this.state,i=o[0],s=o[1],a=o[2],c=o[3],u=o[4],l=o[5],p=o[6],h=o[7],f=0;f<64;f++){f<16?this.temp[f]=(255&r[4*f])<<24|(255&r[4*f+1])<<16|(255&r[4*f+2])<<8|255&r[4*f+3]:(e=((t=this.temp[f-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10,n=((t=this.temp[f-15])>>>7|t<<25)^(t>>>18|t<<14)^t>>>3,this.temp[f]=(e+this.temp[f-7]|0)+(n+this.temp[f-16]|0));var d=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&l^~u&p)|0)+(h+(m[f]+this.temp[f]|0)|0)|0,g=((i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10))+(i&s^i&a^s&a)|0,h=p,p=l,l=u,u=c+d|0,c=a,a=s,s=i,i=d+g|0}o[0]+=i,o[1]+=s,o[2]+=a,o[3]+=c,o[4]+=u,o[5]+=l,o[6]+=p,o[7]+=h}},{"./browserHashUtils":11,"buffer/":80}],16:[function(r,o,e){(function(e){var t=r("./util");t.crypto.lib=r("./browserCryptoLib"),t.Buffer=r("buffer/").Buffer,t.url=r("url/"),t.querystring=r("querystring/"),t.realClock=r("./realclock/browserClock"),t.environment="js",t.createEventStream=r("./event-stream/buffered-create-event-stream").createEventStream,t.isBrowser=function(){return!0},t.isNode=function(){return!1};var n=r("./core");o.exports=n,r("./credentials"),r("./credentials/credential_provider_chain"),r("./credentials/temporary_credentials"),r("./credentials/chainable_temporary_credentials"),r("./credentials/web_identity_credentials"),r("./credentials/cognito_identity_credentials"),r("./credentials/saml_credentials"),n.XML.Parser=r("./xml/browser_parser"),r("./http/xhr"),void 0===e&&(e={browser:!0})}).call(this,r("_process"))},{"./browserCryptoLib":10,"./core":18,"./credentials":19,"./credentials/chainable_temporary_credentials":20,"./credentials/cognito_identity_credentials":21,"./credentials/credential_provider_chain":22,"./credentials/saml_credentials":23,"./credentials/temporary_credentials":24,"./credentials/web_identity_credentials":25,"./event-stream/buffered-create-event-stream":27,"./http/xhr":35,"./realclock/browserClock":52,"./util":71,"./xml/browser_parser":72,_process:85,"buffer/":80,"querystring/":92,"url/":94}],17:[function(e,t,n){var r,i=e("./core");e("./credentials"),e("./credentials/credential_provider_chain"),i.Config=i.util.inherit({constructor:function(n){void 0===n&&(n={}),n=this.extractCredentials(n),i.util.each.call(this,this.keys,function(e,t){this.set(e,n[e],t)})},getCredentials:function(t){var e,n=this;function r(e){t(e,e?null:n.credentials)}function o(e,t){return new i.util.error(t||new Error,{code:"CredentialsError",message:e,name:"CredentialsError"})}n.credentials?"function"==typeof n.credentials.get?n.credentials.get(function(e){r(e=e&&o("Could not load credentials from "+n.credentials.constructor.name,e))}):(e=null,n.credentials.accessKeyId&&n.credentials.secretAccessKey||(e=o("Missing credentials")),r(e)):n.credentialProvider?n.credentialProvider.resolve(function(e,t){e=e&&o("Could not load credentials from any providers",e),n.credentials=t,r(e)}):r(o("No credentials to load"))},update:function(e,n){n=n||!1,e=this.extractCredentials(e),i.util.each.call(this,e,function(e,t){(n||Object.prototype.hasOwnProperty.call(this.keys,e)||i.Service.hasService(e))&&this.set(e,t)})},loadFromPath:function(e){this.clear();var n=JSON.parse(i.util.readFileSync(e)),t=new i.FileSystemCredentials(e),r=new i.CredentialProviderChain;return r.providers.unshift(t),r.resolve(function(e,t){if(e)throw e;n.credentials=t}),this.constructor(n),this},clear:function(){i.util.each.call(this,this.keys,function(e){delete this[e]}),this.set("credentials",void 0),this.set("credentialProvider",void 0)},set:function(e,t,n){void 0===t?(void 0===n&&(n=this.keys[e]),this[e]="function"==typeof n?n.call(this):n):"httpOptions"===e&&this[e]?this[e]=i.util.merge(this[e],t):this[e]=t},keys:{credentials:null,credentialProvider:null,region:null,logger:null,apiVersions:{},apiVersion:null,endpoint:void 0,httpOptions:{timeout:12e4},maxRetries:void 0,maxRedirects:10,paramValidation:!0,sslEnabled:!0,s3ForcePathStyle:!1,s3BucketEndpoint:!1,s3DisableBodySigning:!0,computeChecksums:!0,convertResponseTypes:!0,correctClockSkew:!1,customUserAgent:null,dynamoDbCrc32:!0,systemClockOffset:0,signatureVersion:null,signatureCache:!0,retryDelayOptions:{},useAccelerateEndpoint:!1,clientSideMonitoring:!1,endpointDiscoveryEnabled:!1,endpointCacheSize:1e3,hostPrefixEnabled:!0,stsRegionalEndpoints:null},extractCredentials:function(e){return e.accessKeyId&&e.secretAccessKey&&((e=i.util.copy(e)).credentials=new i.Credentials(e)),e},setPromisesDependency:function(e){null===(r=e)&&"function"==typeof Promise&&(r=Promise);var t=[i.Request,i.Credentials,i.CredentialProviderChain];i.S3&&(t.push(i.S3),i.S3.ManagedUpload&&t.push(i.S3.ManagedUpload)),i.util.addPromises(t,r)},getPromisesDependency:function(){return r}}),i.config=new i.Config},{"./core":18,"./credentials":19,"./credentials/credential_provider_chain":22}],18:[function(e,t,n){var r={util:e("./util")};({}).toString(),(t.exports=r).util.update(r,{VERSION:"2.553.0",Signers:{},Protocol:{Json:e("./protocol/json"),Query:e("./protocol/query"),Rest:e("./protocol/rest"),RestJson:e("./protocol/rest_json"),RestXml:e("./protocol/rest_xml")},XML:{Builder:e("./xml/builder"),Parser:null},JSON:{Builder:e("./json/builder"),Parser:e("./json/parser")},Model:{Api:e("./model/api"),Operation:e("./model/operation"),Shape:e("./model/shape"),Paginator:e("./model/paginator"),ResourceWaiter:e("./model/resource_waiter")},apiLoader:e("./api_loader"),EndpointCache:e("../vendor/endpoint-cache").EndpointCache}),e("./sequential_executor"),e("./service"),e("./config"),e("./http"),e("./event_listeners"),e("./request"),e("./response"),e("./resource_waiter"),e("./signers/request_signer"),e("./param_validator"),r.events=new r.SequentialExecutor,r.util.memoizedProperty(r,"endpointCache",function(){return new r.EndpointCache(r.config.endpointCacheSize)},!0)},{"../vendor/endpoint-cache":103,"./api_loader":9,"./config":17,"./event_listeners":33,"./http":34,"./json/builder":36,"./json/parser":37,"./model/api":38,"./model/operation":40,"./model/paginator":41,"./model/resource_waiter":42,"./model/shape":43,"./param_validator":44,"./protocol/json":46,"./protocol/query":47,"./protocol/rest":48,"./protocol/rest_json":49,"./protocol/rest_xml":50,"./request":55,"./resource_waiter":56,"./response":57,"./sequential_executor":58,"./service":59,"./signers/request_signer":63,"./util":71,"./xml/builder":73}],19:[function(e,t,n){var o=e("./core");o.Credentials=o.util.inherit({constructor:function(e,t,n){var r;o.util.hideProperties(this,["secretAccessKey"]),this.expired=!1,this.expireTime=null,this.refreshCallbacks=[],1===arguments.length&&"object"==typeof e?(r=e.credentials||e,this.accessKeyId=r.accessKeyId,this.secretAccessKey=r.secretAccessKey,this.sessionToken=r.sessionToken):(this.accessKeyId=e,this.secretAccessKey=t,this.sessionToken=n)},expiryWindow:15,needsRefresh:function(){var e=o.util.date.getDate().getTime(),t=new Date(e+1e3*this.expiryWindow);return!!(this.expireTime&&t>this.expireTime)||(this.expired||!this.accessKeyId||!this.secretAccessKey)},get:function(t){var n=this;this.needsRefresh()?this.refresh(function(e){e||(n.expired=!1),t&&t(e)}):t&&t()},refresh:function(e){this.expired=!1,e()},coalesceRefresh:function(e,n){var r=this;1===r.refreshCallbacks.push(e)&&r.load(function(t){o.util.arrayEach(r.refreshCallbacks,function(e){n?e(t):o.util.defer(function(){e(t)})}),r.refreshCallbacks.length=0})},load:function(e){e()}}),o.Credentials.addPromisesToClass=function(e){this.prototype.getPromise=o.util.promisifyMethod("get",e),this.prototype.refreshPromise=o.util.promisifyMethod("refresh",e)},o.Credentials.deletePromisesFromClass=function(){delete this.prototype.getPromise,delete this.prototype.refreshPromise},o.util.addPromises(o.Credentials)},{"./core":18}],20:[function(e,t,n){var i=e("../core"),r=e("../../clients/sts");i.ChainableTemporaryCredentials=i.util.inherit(i.Credentials,{constructor:function(e){i.Credentials.call(this),e=e||{},this.errorCode="ChainableTemporaryCredentialsProviderFailure",this.expired=!0,this.tokenCodeFn=null;var t=i.util.copy(e.params)||{};if(t.RoleArn&&(t.RoleSessionName=t.RoleSessionName||"temporary-credentials"),t.SerialNumber){if(!e.tokenCodeFn||"function"!=typeof e.tokenCodeFn)throw new i.util.error(new Error("tokenCodeFn must be a function when params.SerialNumber is given"),{code:this.errorCode});this.tokenCodeFn=e.tokenCodeFn}var n=i.util.merge({params:t,credentials:e.masterCredentials||i.config.credentials},e.stsConfig||{});this.service=new r(n)},refresh:function(e){this.coalesceRefresh(e||i.util.fn.callback)},load:function(r){var o=this,i=o.service.config.params.RoleArn?"assumeRole":"getSessionToken";this.getTokenCode(function(e,t){var n={};e?r(e):(t&&(n.TokenCode=t),o.service[i](n,function(e,t){e||o.service.credentialsFrom(t,o),r(e)}))})},getTokenCode:function(r){var o=this;this.tokenCodeFn?this.tokenCodeFn(this.service.config.params.SerialNumber,function(e,t){if(e){var n=e;return e instanceof Error&&(n=e.message),void r(i.util.error(new Error("Error fetching MFA token: "+n),{code:o.errorCode}))}r(null,t)}):r(null)}})},{"../../clients/sts":8,"../core":18}],21:[function(e,t,n){var r=e("../core"),o=e("../../clients/cognitoidentity"),i=e("../../clients/sts");r.CognitoIdentityCredentials=r.util.inherit(r.Credentials,{localStorageKey:{id:"aws.cognito.identity-id.",providers:"aws.cognito.identity-providers."},constructor:function(e,t){r.Credentials.call(this),this.expired=!0,this.params=e,this.data=null,this._identityId=null,this._clientConfig=r.util.copy(t||{}),this.loadCachedId();var n=this;Object.defineProperty(this,"identityId",{get:function(){return n.loadCachedId(),n._identityId||n.params.IdentityId},set:function(e){n._identityId=e}})},refresh:function(e){this.coalesceRefresh(e||r.util.fn.callback)},load:function(t){var n=this;n.createClients(),n.data=null,n._identityId=null,n.getId(function(e){e?(n.clearIdOnNotAuthorized(e),t(e)):n.params.RoleArn?n.getCredentialsFromSTS(t):n.getCredentialsForIdentity(t)})},clearCachedId:function(){this._identityId=null,delete this.params.IdentityId;var e=this.params.IdentityPoolId,t=this.params.LoginId||"";delete this.storage[this.localStorageKey.id+e+t],delete this.storage[this.localStorageKey.providers+e+t]},clearIdOnNotAuthorized:function(e){"NotAuthorizedException"==e.code&&this.clearCachedId()},getId:function(n){var r=this;if("string"==typeof r.params.IdentityId)return n(null,r.params.IdentityId);r.cognito.getId(function(e,t){!e&&t.IdentityId?(r.params.IdentityId=t.IdentityId,n(null,t.IdentityId)):n(e)})},loadCredentials:function(e,t){e&&t&&(t.expired=!1,t.accessKeyId=e.Credentials.AccessKeyId,t.secretAccessKey=e.Credentials.SecretKey,t.sessionToken=e.Credentials.SessionToken,t.expireTime=e.Credentials.Expiration)},getCredentialsForIdentity:function(n){var r=this;r.cognito.getCredentialsForIdentity(function(e,t){e?r.clearIdOnNotAuthorized(e):(r.cacheId(t),r.data=t,r.loadCredentials(r.data,r)),n(e)})},getCredentialsFromSTS:function(n){var r=this;r.cognito.getOpenIdToken(function(e,t){e?(r.clearIdOnNotAuthorized(e),n(e)):(r.cacheId(t),r.params.WebIdentityToken=t.Token,r.webIdentityCredentials.refresh(function(e){e||(r.data=r.webIdentityCredentials.data,r.sts.credentialsFrom(r.data,r)),n(e)}))})},loadCachedId:function(){var e,t,n=this;r.util.isBrowser()&&!n.params.IdentityId&&((e=n.getStorage("id"))&&n.params.Logins?(t=Object.keys(n.params.Logins),0!==(n.getStorage("providers")||"").split(",").filter(function(e){return-1!==t.indexOf(e)}).length&&(n.params.IdentityId=e)):e&&(n.params.IdentityId=e))},createClients:function(){var e,t=this._clientConfig;this.webIdentityCredentials=this.webIdentityCredentials||new r.WebIdentityCredentials(this.params,t),this.cognito||((e=r.util.merge({},t)).params=this.params,this.cognito=new o(e)),this.sts=this.sts||new i(t)},cacheId:function(e){this._identityId=e.IdentityId,this.params.IdentityId=this._identityId,r.util.isBrowser()&&(this.setStorage("id",e.IdentityId),this.params.Logins&&this.setStorage("providers",Object.keys(this.params.Logins).join(",")))},getStorage:function(e){return this.storage[this.localStorageKey[e]+this.params.IdentityPoolId+(this.params.LoginId||"")]},setStorage:function(e,t){try{this.storage[this.localStorageKey[e]+this.params.IdentityPoolId+(this.params.LoginId||"")]=t}catch(e){}},storage:function(){try{var e=r.util.isBrowser()&&null!==window.localStorage&&"object"==typeof window.localStorage?window.localStorage:{};return e["aws.test-storage"]="foobar",delete e["aws.test-storage"],e}catch(e){return{}}}()})},{"../../clients/cognitoidentity":7,"../../clients/sts":8,"../core":18}],22:[function(e,t,n){var a=e("../core");a.CredentialProviderChain=a.util.inherit(a.Credentials,{constructor:function(e){this.providers=e||a.CredentialProviderChain.defaultProviders.slice(0),this.resolveCallbacks=[]},resolve:function(e){var o,i,s=this;if(0===s.providers.length)return e(new Error("No providers")),s;return 1===s.resolveCallbacks.push(e)&&(o=0,i=s.providers.slice(0),function t(n,r){if(!n&&r||o===i.length)return a.util.arrayEach(s.resolveCallbacks,function(e){e(n,r)}),void(s.resolveCallbacks.length=0);var e=i[o++];(r="function"==typeof e?e.call():e).get?r.get(function(e){t(e,e?null:r)}):t(null,r)}()),s}}),a.CredentialProviderChain.defaultProviders=[],a.CredentialProviderChain.addPromisesToClass=function(e){this.prototype.resolvePromise=a.util.promisifyMethod("resolve",e)},a.CredentialProviderChain.deletePromisesFromClass=function(){delete this.prototype.resolvePromise},a.util.addPromises(a.CredentialProviderChain)},{"../core":18}],23:[function(e,t,n){var r=e("../core"),o=e("../../clients/sts");r.SAMLCredentials=r.util.inherit(r.Credentials,{constructor:function(e){r.Credentials.call(this),this.expired=!0,this.params=e},refresh:function(e){this.coalesceRefresh(e||r.util.fn.callback)},load:function(n){var r=this;r.createClients(),r.service.assumeRoleWithSAML(function(e,t){e||r.service.credentialsFrom(t,r),n(e)})},createClients:function(){this.service=this.service||new o({params:this.params})}})},{"../../clients/sts":8,"../core":18}],24:[function(e,t,n){var r=e("../core"),o=e("../../clients/sts");r.TemporaryCredentials=r.util.inherit(r.Credentials,{constructor:function(e,t){r.Credentials.call(this),this.loadMasterCredentials(t),this.expired=!0,this.params=e||{},this.params.RoleArn&&(this.params.RoleSessionName=this.params.RoleSessionName||"temporary-credentials")},refresh:function(e){this.coalesceRefresh(e||r.util.fn.callback)},load:function(n){var r=this;r.createClients(),r.masterCredentials.get(function(){r.service.config.credentials=r.masterCredentials,(r.params.RoleArn?r.service.assumeRole:r.service.getSessionToken).call(r.service,function(e,t){e||r.service.credentialsFrom(t,r),n(e)})})},loadMasterCredentials:function(e){for(this.masterCredentials=e||r.config.credentials;this.masterCredentials.masterCredentials;)this.masterCredentials=this.masterCredentials.masterCredentials;"function"!=typeof this.masterCredentials.get&&(this.masterCredentials=new r.Credentials(this.masterCredentials))},createClients:function(){this.service=this.service||new o({params:this.params})}})},{"../../clients/sts":8,"../core":18}],25:[function(e,t,n){var r=e("../core"),o=e("../../clients/sts");r.WebIdentityCredentials=r.util.inherit(r.Credentials,{constructor:function(e,t){r.Credentials.call(this),this.expired=!0,this.params=e,this.params.RoleSessionName=this.params.RoleSessionName||"web-identity",this.data=null,this._clientConfig=r.util.copy(t||{})},refresh:function(e){this.coalesceRefresh(e||r.util.fn.callback)},load:function(n){var r=this;r.createClients(),r.service.assumeRoleWithWebIdentity(function(e,t){r.data=null,e||(r.data=t,r.service.credentialsFrom(t,r)),n(e)})},createClients:function(){var e;this.service||((e=r.util.merge({},this._clientConfig)).params=this.params,this.service=new o(e))}})},{"../../clients/sts":8,"../core":18}],26:[function(e,t,n){(function(i){var p=e("./core"),h=e("./util"),s=["AWS_ENABLE_ENDPOINT_DISCOVERY","AWS_ENDPOINT_DISCOVERY_ENABLED"];function f(e){var t=e.service,n=t.api||{},r={};return t.config.region&&(r.region=t.config.region),n.serviceId&&(r.serviceId=n.serviceId),t.config.credentials.accessKeyId&&(r.accessKeyId=t.config.credentials.accessKeyId),r}function d(e,t){var n={};return function r(o,i,s){s&&null!=i&&"structure"===s.type&&s.required&&0=this.HEADERS_RECEIVED&&!u&&(s.statusCode=c.status,s.headers=o.parseHeaders(c.getAllResponseHeaders()),s.emit("headers",s.statusCode,s.headers,c.statusText),u=!0),this.readyState===this.DONE&&o.finishRequest(c,s)},!1),c.upload.addEventListener("progress",function(e){s.emit("sendProgress",e)}),c.addEventListener("progress",function(e){s.emit("receiveProgress",e)},!1),c.addEventListener("timeout",function(){r(l.util.error(new Error("Timeout"),{code:"TimeoutError"}))},!1),c.addEventListener("error",function(){r(l.util.error(new Error("Network Failure"),{code:"NetworkingError"}))},!1),c.addEventListener("abort",function(){r(l.util.error(new Error("Request aborted"),{code:"RequestAbortedError"}))},!1),n(s),c.open(t.method,a,!1!==e.xhrAsync),l.util.each(t.headers,function(e,t){"Content-Length"!==e&&"User-Agent"!==e&&"Host"!==e&&c.setRequestHeader(e,t)}),e.timeout&&!1!==e.xhrAsync&&(c.timeout=e.timeout),e.xhrWithCredentials&&(c.withCredentials=!0);try{c.responseType="arraybuffer"}catch(e){}try{t.body?c.send(t.body):c.send()}catch(e){if(!t.body||"object"!=typeof t.body.buffer)throw e;c.send(t.body.buffer)}return s},parseHeaders:function(e){var r={};return l.util.arrayEach(e.split(/\r?\n/),function(e){var t=e.split(":",1)[0],n=e.substring(t.length+2);0= 1, but found "'+t+'" for '+n)},validatePattern:function(e,t,n){this.validation.pattern&&void 0!==e.pattern&&(new RegExp(e.pattern).test(t)||this.fail("PatternMatchError",'Provided value "'+t+'" does not match regex pattern /'+e.pattern+"/ for "+n))},validateRange:function(e,t,n,r){this.validation.min&&void 0!==e.min&&t= "+e.min+", but found "+t+" for "+n),this.validation.max&&void 0!==e.max&&t>e.max&&this.fail("MaxRangeError","Expected "+r+" <= "+e.max+", but found "+t+" for "+n)},validateEnum:function(e,t,n){this.validation.enum&&void 0!==e.enum&&-1===e.enum.indexOf(t)&&this.fail("EnumError","Found string value of "+t+", but expected "+e.enum.join("|")+" for "+n)},validateType:function(e,t,n,r){if(null==e)return!1;for(var o=!1,i=0;i=t.maxRetries&&(n.MaxRetriesExceeded=1),u.emit("apiCall",[n]))})},setupRequestListeners:function(){},getSignerClass:function(e){var t,n=null,r="";return e&&(r=(n=(e.service.api.operations||{})[e.operation]||null)?n.authtype:""),t=this.config.signatureVersion?this.config.signatureVersion:"v4"===r||"v4-unsigned-body"===r?"v4":this.api.signatureVersion,l.Signers.RequestSigner.getVersion(t)},serviceInterface:function(){switch(this.api.protocol){case"ec2":case"query":return l.EventListeners.Query;case"json":return l.EventListeners.Json;case"rest-json":return l.EventListeners.RestJson;case"rest-xml":return l.EventListeners.RestXml}if(this.api.protocol)throw new Error("Invalid service `protocol' "+this.api.protocol+" in API config")},successfulResponse:function(e){return e.httpResponse.statusCode<300},numRetries:function(){return void 0!==this.config.maxRetries?this.config.maxRetries:this.defaultRetryCount},retryDelays:function(e){return l.util.calculateRetryDelay(e,this.config.retryDelayOptions)},retryableError:function(e){return!!this.timeoutError(e)||(!!this.networkingError(e)||(!!this.expiredCredentialsError(e)||(!!this.throttledError(e)||500<=e.statusCode)))},networkingError:function(e){return"NetworkingError"===e.code},timeoutError:function(e){return"TimeoutError"===e.code},expiredCredentialsError:function(e){return"ExpiredTokenException"===e.code},clockSkewError:function(e){switch(e.code){case"RequestTimeTooSkewed":case"RequestExpired":case"InvalidSignatureException":case"SignatureDoesNotMatch":case"AuthFailure":case"RequestInTheFuture":return!0;default:return!1}},getSkewCorrectedDate:function(){return new Date(Date.now()+this.config.systemClockOffset)},applyClockOffset:function(e){e&&(this.config.systemClockOffset=e-Date.now())},isClockSkewed:function(e){if(e)return 3e4<=Math.abs(this.getSkewCorrectedDate().getTime()-e)},throttledError:function(e){if(429===e.statusCode)return!0;switch(e.code){case"ProvisionedThroughputExceededException":case"Throttling":case"ThrottlingException":case"RequestLimitExceeded":case"RequestThrottled":case"RequestThrottledException":case"TooManyRequestsException":case"TransactionInProgressException":return!0;default:return!1}},endpointFromTemplate:function(e){if("string"!=typeof e)return e;var t=e;return t=(t=(t=t.replace(/\{service\}/g,this.api.endpointPrefix)).replace(/\{region\}/g,this.config.region)).replace(/\{scheme\}/g,this.config.sslEnabled?"https":"http")},setEndpoint:function(e){this.endpoint=new l.Endpoint(e,this.config)},paginationConfig:function(e,t){var n=this.api.operations[e].paginator;if(n)return n;if(t){var r=new Error;throw l.util.error(r,"No pagination configuration for "+e)}return null}}),l.util.update(l.Service,{defineMethods:function(e){l.util.each(e.prototype.api.operations,function(n){e.prototype[n]||("none"===e.prototype.api.operations[n].authtype?e.prototype[n]=function(e,t){return this.makeUnauthenticatedRequest(n,e,t)}:e.prototype[n]=function(e,t){return this.makeRequest(n,e,t)})})},defineService:function(e,t,n){l.Service._serviceMap[e]=!0,Array.isArray(t)||(n=t,t=[]);var r,o,i,s=a(l.Service,n||{});return"string"==typeof e?(l.Service.addVersions(s,t),r=s.serviceIdentifier||e,s.serviceIdentifier=r):(s.prototype.api=e,l.Service.defineMethods(s)),l.SequentialExecutor.call(this.prototype),!this.prototype.publisher&&l.util.clientSideMonitoring&&(o=l.util.clientSideMonitoring.Publisher,i=(0,l.util.clientSideMonitoring.configProvider)(),this.prototype.publisher=new o(i),i.enabled&&(l.Service._clientSideMonitoring=!0)),l.SequentialExecutor.call(s.prototype),l.Service.addDefaultMonitoringListeners(s.prototype),s},addVersions:function(e,t){Array.isArray(t)||(t=[t]),e.services=e.services||{};for(var n=0;n=n.length)return r.push(null);var t=o+e;t>n.length&&(t=n.length),r.push(n.slice(o,t)),o=t},r},concat:function(e){for(var t,n=0,r=0,o=0;o>>8^t[255&(n^e.readUInt8(r))];return(-1^n)>>>0},hmac:function(e,t,n,r){return"buffer"===(n=n||"binary")&&(n=void 0),r=r||"sha256","string"==typeof t&&(t=l.buffer.toBuffer(t)),l.crypto.lib.createHmac(r,e).update(t).digest(n)},md5:function(e,t,n){return l.crypto.hash("md5",e,t,n)},sha256:function(e,t,n){return l.crypto.hash("sha256",e,t,n)},hash:function(e,t,n,r){var o=l.crypto.createHash(e);"buffer"===(n=n||"binary")&&(n=void 0),"string"==typeof t&&(t=l.buffer.toBuffer(t));var i=l.arraySliceFn(t),s=l.Buffer.isBuffer(t);if(l.isBrowser()&&"undefined"!=typeof ArrayBuffer&&t&&t.buffer instanceof ArrayBuffer&&(s=!0),r&&"object"==typeof t&&"function"==typeof t.on&&!s)t.on("data",function(e){o.update(e)}),t.on("error",function(e){r(e)}),t.on("end",function(){r(null,o.digest(n))});else{if(!r||!i||s||"undefined"==typeof FileReader){l.isBrowser()&&"object"==typeof t&&!s&&(t=new l.Buffer(new Uint8Array(t)));var a=o.update(t).digest(n);return r&&r(null,a),a}var c=0,u=new FileReader;u.onerror=function(){r(new Error("Failed to read data."))},u.onload=function(){var e=new l.Buffer(new Uint8Array(u.result));o.update(e),c+=e.length,u._continueReading()},u._continueReading=function(){var e;c>=t.size?r(null,o.digest(n)):((e=c+524288)>t.size&&(e=t.size),u.readAsArrayBuffer(i.call(t,c,e)))},u._continueReading()}},toHex:function(e){for(var t=[],n=0;n/g,">").replace(/"/g,""")}}},{}],75:[function(e,t,n){t.exports={escapeElement:function(e){return e.replace(/&/g,"&").replace(//g,">")}}},{}],76:[function(e,t,n){var a=e("./escape-attribute").escapeAttribute;function r(e,t){void 0===t&&(t=[]),this.name=e,this.children=t,this.attributes={}}r.prototype.addAttribute=function(e,t){return this.attributes[e]=t,this},r.prototype.addChildNode=function(e){return this.children.push(e),this},r.prototype.removeAttribute=function(e){return delete this.attributes[e],this},r.prototype.toString=function(){for(var e=Boolean(this.children.length),t="<"+this.name,n=this.attributes,r=0,o=Object.keys(n);r"+this.children.map(function(e){return e.toString()}).join("")+"":"/>")},t.exports={XmlNode:r}},{"./escape-attribute":74}],77:[function(e,t,n){var r=e("./escape-element").escapeElement;function o(e){this.value=e}o.prototype.toString=function(){return r(""+this.value)},t.exports={XmlText:o}},{"./escape-element":75}],78:[function(e,t,n){"use strict";n.byteLength=function(e){var t=p(e),n=t[0],r=t[1];return 3*(n+r)/4-r},n.toByteArray=function(e){var t,n,r=p(e),o=r[0],i=r[1],s=new l(function(e,t){return 3*(e+t)/4-t}(o,i)),a=0,c=0>16&255,s[a++]=t>>8&255,s[a++]=255&t;2===i&&(t=u[e.charCodeAt(n)]<<2|u[e.charCodeAt(n+1)]>>4,s[a++]=255&t);1===i&&(t=u[e.charCodeAt(n)]<<10|u[e.charCodeAt(n+1)]<<4|u[e.charCodeAt(n+2)]>>2,s[a++]=t>>8&255,s[a++]=255&t);return s},n.fromByteArray=function(e){for(var t,n=e.length,r=n%3,o=[],i=0,s=n-r;i>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(r));return o.join("")}(e,i,s>2]+a[t<<4&63]+"==")):2==r&&(t=(e[n-2]<<8)+e[n-1],o.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return o.join("")};for(var a=[],u=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,i=r.length;o=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|e}function f(e,t){if(p.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return k(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return N(e).length;default:if(r)return k(e).length;t=(""+t).toLowerCase(),r=!0}}function t(e,t,n){var r,o,i,s=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":return function(e,t,n){var r=e.length;(!t||t<0)&&(t=0);(!n||n<0||r=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=p.from(t,r)),p.isBuffer(t))return 0===t.length?-1:m(e,t,n,r,o);if("number"==typeof t)return t&=255,p.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):m(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function m(e,t,n,r,o){var i=1,s=e.length,a=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s/=i=2,a/=2,n/=2}function c(e,t){return 1===i?e[t]:e.readUInt16BE(t*i)}if(o)for(var u=-1,l=n;l>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function b(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o>>10&1023|55296),l=56320|1023&l),r.push(l),o+=p}return function(e){var t=e.length;if(t<=E)return String.fromCharCode.apply(String,e);var n="",r=0;for(;rt&&(e+=" ... ")),""},p.prototype.compare=function(e,t,n,r,o){if(!p.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(o<=r&&n<=t)return 0;if(o<=r)return-1;if(n<=t)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(i,s),c=this.slice(r,o),u=e.slice(t,n),l=0;lthis.length)throw new RangeError("Attempt to write outside buffer bounds");r=r||"utf8";for(var i,s,a,c,u,l,p=!1;;)switch(r){case"hex":return function(e,t,n,r){n=Number(n)||0;var o=e.length-n;(!r||o<(r=Number(r)))&&(r=o);var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");i/2e.length)throw new RangeError("Index out of range")}function T(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function w(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function _(e,t,n,r){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function A(e,t,n,r,o){return o||_(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function I(e,t,n,r,o){return o||_(e,0,n,8),i.write(e,t,n,r,52,8),n+8}p.prototype.slice=function(e,t){var n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):n>>8):T(this,e,t,!0),t+2},p.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):T(this,e,t,!1),t+2},p.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):w(this,e,t,!0),t+4},p.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):w(this,e,t,!1),t+4},p.prototype.writeIntLE=function(e,t,n,r){var o;e=+e,t|=0,r||C(this,e,t,n,(o=Math.pow(2,8*n-1))-1,-o);var i=0,s=1,a=0;for(this[t]=255&e;++i>0)-a&255;return t+n},p.prototype.writeIntBE=function(e,t,n,r){var o;e=+e,t|=0,r||C(this,e,t,n,(o=Math.pow(2,8*n-1))-1,-o);var i=n-1,s=1,a=0;for(this[t+i]=255&e;0<=--i&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s>>0)-a&255;return t+n},p.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,1,127,-128),p.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},p.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):T(this,e,t,!0),t+2},p.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):T(this,e,t,!1),t+2},p.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,4,2147483647,-2147483648),p.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):w(this,e,t,!0),t+4},p.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):w(this,e,t,!1),t+4},p.prototype.writeFloatLE=function(e,t,n){return A(this,e,t,!0,n)},p.prototype.writeFloatBE=function(e,t,n){return A(this,e,t,!1,n)},p.prototype.writeDoubleLE=function(e,t,n){return I(this,e,t,!0,n)},p.prototype.writeDoubleBE=function(e,t,n){return I(this,e,t,!1,n)},p.prototype.copy=function(e,t,n,r){if(n=n||0,r||0===r||(r=this.length),t>=e.length&&(t=e.length),t=t||0,0=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,"number"==typeof(e=e||0))for(a=t;a>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function N(e){return a.toByteArray(function(e){var t;if((e=((t=e).trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(R,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function x(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},O("buffer").Buffer)},{"base64-js":78,buffer:80,ieee754:82,isarray:83}],81:[function(e,t,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function c(e){return"function"==typeof e}function u(e){return"object"==typeof e&&null!==e}function l(e){return void 0===e}((t.exports=r).EventEmitter=r).prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,n,r,o,i,s;if(this._events||(this._events={}),"error"===e&&(!this._events.error||u(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var a=new Error('Uncaught, unspecified "error" event. ('+t+")");throw a.context=t,a}if(l(n=this._events[e]))return!1;if(c(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),n.apply(this,o)}else if(u(n))for(o=Array.prototype.slice.call(arguments,1),r=(s=n.slice()).length,i=0;in&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.once=function(e,t){if(!c(t))throw TypeError("listener must be a function");var n=!1;function r(){this.removeListener(e,r),n||(n=!0,t.apply(this,arguments))}return r.listener=t,this.on(e,r),this},r.prototype.removeListener=function(e,t){var n,r,o,i;if(!c(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(o=(n=this._events[e]).length,r=-1,n===t||c(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(u(n)){for(i=o;0>1,l=-7,p=n?o-1:0,h=n?-1:1,f=e[t+p];for(p+=h,i=f&(1<<-l)-1,f>>=-l,l+=a;0>=-l,l+=r;0>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:i-1,d=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),2<=(t+=1<=s+p?h/c:h*Math.pow(2,1-p))*c&&(s++,c/=2),l<=s+p?(a=0,s=l):1<=s+p?(a=(t*c-1)*Math.pow(2,o),s+=p):(a=t*Math.pow(2,p-1)*Math.pow(2,o),s=0));8<=o;e[n+f]=255&a,f+=d,a/=256,o-=8);for(s=s<":!0,"=":!0,"!":!0},F={" ":!0,"\t":!0,"\n":!0};function j(e){return"0"<=e&&e<="9"||"-"===e}function r(){}r.prototype={tokenize:function(e){var t,n,r,o,i=[];for(this._current=0;this._current"===n?"="===e[this._current]?(this._current++,{type:P,value:">=",start:t}):{type:"GT",value:">",start:t}:"="===n&&"="===e[this._current]?(this._current++,{type:"EQ",value:"==",start:t}):void 0},_consumeLiteral:function(e){this._current++;for(var t=this._current,n=e.length;"`"!==e[this._current]&&this._current= 0x80 (not a basic code point)","invalid-input":"Invalid input"},h=v-b,w=Math.floor,_=String.fromCharCode;function A(e){throw RangeError(p[e])}function f(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function d(e,t){var n=e.split("@"),r="";return 1>>10&1023|55296),e=56320|1023&e),t+=_(e)}).join("")}function k(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function N(e,t,n){var r=0;for(e=n?w(e/a):e>>1,e+=w(e/t);h*E>>1w((y-f)/i))&&A("overflow"),f+=a*i,!(a<(c=s<=g?b:g+E<=s?E:s-g));s+=v)i>w(y/(u=v-c))&&A("overflow"),i*=u;g=N(f-o,t=p.length+1,0==o),w(f/t)>y-d&&A("overflow"),d+=w(f/t),f%=t,p.splice(f++,0,d)}return R(p)}function m(e){for(var t,n,r,o,i,s,a,c,u,l,p,h=[],f=(e=I(e)).length,d=C,g=S,m=t=0;mw((y-t)/(u=n+1))&&A("overflow"),t+=(o-d)*u,d=o,m=0;my&&A("overflow"),c==d){for(i=t,s=v;!(i<(a=s<=g?b:g+E<=s?E:s-g));s+=v)p=i-a,l=v-a,h.push(_(k(a+p%l,0))),i=w(p/l);h.push(_(k(i,0))),g=N(t,u,n==r),t=0,++n}++t,++d}return h.join("")}if(o={version:"1.3.2",ucs2:{decode:I,encode:R},decode:g,encode:m,toASCII:function(e){return d(e,function(e){return u.test(e)?"xn--"+m(e):e})},toUnicode:function(e){return d(e,function(e){return c.test(e)?g(e.slice(4).toLowerCase()):e})}},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return o});else if(t&&n)if(O.exports==t)n.exports=o;else for(i in o)o.hasOwnProperty(i)&&(t[i]=o[i]);else e.punycode=o}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],87:[function(e,t,n){"use strict";t.exports=function(e,t,n,r){t=t||"&",n=n||"=";var o={};if("string"!=typeof e||0===e.length)return o;var i=/\+/g;e=e.split(t);var s=1e3;r&&"number"==typeof r.maxKeys&&(s=r.maxKeys);var a=e.length;0",'"',"`"," ","\r","\n","\t"]),L=["'"].concat(o),P=["%","/","?",";","#"].concat(L),M=["/","?","#"],D=/^[a-z0-9A-Z_-]{0,63}$/,U=/^([a-z0-9A-Z_-]{0,63})(.*)$/,q={javascript:!0,"javascript:":!0},F={javascript:!0,"javascript:":!0},j={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},B=e("querystring");function i(e,t,n){if(e&&a(e)&&e instanceof v)return e;var r=new v;return r.parse(e,t,n),r}function H(e){return"string"==typeof e}function a(e){return"object"==typeof e&&null!==e}function b(e){return null===e}v.prototype.parse=function(e,t,n){if(!H(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var r,o,i=(i=e).trim(),s=O.exec(i);if(s&&(r=(s=s[0]).toLowerCase(),this.protocol=r,i=i.substr(s.length)),(n||s||i.match(/^\/\/[^@\/]+@[^@\/]+/))&&(!(o="//"===i.substr(0,2))||s&&F[s]||(i=i.substr(2),this.slashes=!0)),!F[s]&&(o||s&&!j[s])){for(var a,c,u=-1,l=0;l>>((3&t)<<3)&255;return o})},{}],101:[function(e,t,n){var d,g,m=e("./lib/rng"),y=e("./lib/bytesToUuid"),v=0,b=0;t.exports=function(e,t,n){var r,o=t&&n||0,i=t||[],s=(e=e||{}).node||d,a=void 0!==e.clockseq?e.clockseq:g;null!=s&&null!=a||(r=m(),null==s&&(s=d=[1|r[0],r[1],r[2],r[3],r[4],r[5]]),null==a&&(a=g=16383&(r[6]<<8|r[7])));var c=void 0!==e.msecs?e.msecs:(new Date).getTime(),u=void 0!==e.nsecs?e.nsecs:b+1,l=c-v+(u-b)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||v>>24&255,i[o++]=p>>>16&255,i[o++]=p>>>8&255,i[o++]=255&p;var h=c/4294967296*1e4&268435455;i[o++]=h>>>8&255,i[o++]=255&h,i[o++]=h>>>24&15|16,i[o++]=h>>>16&255,i[o++]=a>>>8|128,i[o++]=255&a;for(var f=0;f<6;++f)i[o+f]=s[f];return t||y(i)}},{"./lib/bytesToUuid":99,"./lib/rng":100}],102:[function(e,t,n){var s=e("./lib/rng"),a=e("./lib/bytesToUuid");t.exports=function(e,t,n){var r=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||s)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var i=0;i<16;++i)t[r+i]=o[i];return t||a(o)}},{"./lib/bytesToUuid":99,"./lib/rng":100}],103:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("./utils/LRU"),o=(Object.defineProperty(i.prototype,"size",{get:function(){return this.cache.length},enumerable:!0,configurable:!0}),i.prototype.put=function(e,t){var n="string"!=typeof e?i.getKeyString(e):e,r=this.populateValue(t);this.cache.put(n,r)},i.prototype.get=function(e){var t="string"!=typeof e?i.getKeyString(e):e,n=Date.now(),r=this.cache.get(t);if(r)for(var o=0;o>>=0;break;case"x":r=r.toString(16);break;case"X":r=r.toString(16).toUpperCase()}r=/[def]/.test(i[8])&&i[3]&&0<=r?"+"+r:r,a=i[4]?"0"==i[4]?"0":i[4].charAt(1):" ",c=i[6]-String(r).length,s=i[6]?function(e,t){for(var n=[];0=this._logLevel&&(c[e.level]>=this._echoLevel&&r[e.getLevel()](e.toString()),e.line=this._lineCount++)},u.prototype.clearObjects=function(){for(var e=0;e=r._logLevel}));var i=new a.Blob([JSON.stringify(o,void 0,4)],["text/plain"]),s=document.createElement("a"),t=t||"agent-log";s.href=a.URL.createObjectURL(i),s.download=t+".txt",document.body.appendChild(s),s.click(),document.body.removeChild(s)},u.prototype.scheduleUpstreamLogPush=function(e){connect.upstreamLogPushScheduled||(connect.upstreamLogPushScheduled=!0,a.setInterval(connect.hitch(this,this.reportMasterLogsUpStream,e),5e3))},u.prototype.reportMasterLogsUpStream=function(e){var t=this._logsToPush.slice();this._logsToPush=[],connect.ifMaster(connect.MasterTopics.SEND_LOGS,function(){0=connect.HTTP_STATUS_CODES.INTERNAL_SERVER_ERROR||e.status===connect.HTTP_STATUS_CODES.TOO_MANY_REQUESTS)?setTimeout(function(){t(--n)},s):o(e)}).catch(function(e){o(e)})}(t)})},connect.backoff=function(r,o,i,s){connect.assertTrue(connect.isFunction(r),"func must be a Function");var a=this;r({success:function(e){s&&s.success&&s.success(e)},failure:function(e,t){var n;0>",e)},u.prototype.getSubscriptions=function(e){return this.subMap.getSubscriptions(e)},u.prototype.trigger=function(t,n){connect.assertNotNull(t,"eventName");var r=this,e=this.subMap.getSubscriptions("<>"),o=this.subMap.getSubscriptions(t);this.logEvents&&t!==connect.EventType.LOG&&t!==connect.EventType.MASTER_RESPONSE&&t!==connect.EventType.API_METRIC&&connect.getLog().trace("Publishing event: %s",t),e.concat(o).forEach(function(e){try{e.f(n||null,t,r)}catch(e){connect.getLog().error("'%s' event handler failed.",t).withException(e)}})},u.prototype.bridge=function(){var n=this;return function(e,t){n.trigger(t,e)}},u.prototype.unsubscribeAll=function(){this.subMap.getAllSubscriptions().forEach(function(e){e.unsubscribe()})},connect.EventBus=u,connect.EventFactory=e,connect.EventType=t,connect.AgentEvents=r,connect.ConnnectionEvents=s,connect.ContactEvents=i,connect.WebSocketEvents=o,connect.MasterTopics=n}(),function(){connect=this.connect||{},this.connect=connect,this.lily=connect;function r(){}r.prototype.send=function(e){throw new connect.NotImplementedError},r.prototype.onMessage=function(e){throw new connect.NotImplementedError};function o(){r.call(this)}((o.prototype=Object.create(r.prototype)).constructor=o).prototype.onMessage=function(e){},o.prototype.send=function(e){};function e(e,t){r.call(this),this.window=e,this.domain=t||"*"}((e.prototype=Object.create(r.prototype)).constructor=e).prototype.send=function(e){this.window.postMessage(e,this.domain)},e.prototype.onMessage=function(e){this.window.addEventListener("message",e)};function i(e,t,n){r.call(this),this.input=e,this.output=t,this.domain=n||"*"}((i.prototype=Object.create(r.prototype)).constructor=i).prototype.send=function(e){this.output.postMessage(e,this.domain)},i.prototype.onMessage=function(e){this.input.addEventListener("message",e)};function t(e){r.call(this),this.port=e,this.id=connect.randomId()}((t.prototype=Object.create(r.prototype)).constructor=t).prototype.send=function(e){this.port.postMessage(e)},t.prototype.onMessage=function(e){this.port.addEventListener("message",e)},t.prototype.getId=function(){return this.id};function n(e){r.call(this),this.streamMap=e?connect.index(e,function(e){return e.getId()}):{},this.messageListeners=[]}((n.prototype=Object.create(r.prototype)).constructor=n).prototype.send=function(t){this.getStreams().forEach(function(e){try{e.send(t)}catch(e){}})},n.prototype.onMessage=function(t){this.messageListeners.push(t),this.getStreams().forEach(function(e){e.onMessage(t)})},n.prototype.addStream=function(t){this.streamMap[t.getId()]=t,this.messageListeners.forEach(function(e){t.onMessage(e)})},n.prototype.removeStream=function(e){delete this.streamMap[e.getId()]},n.prototype.getStreams=function(e){return connect.values(this.streamMap)},n.prototype.getStreamForPort=function(t){return connect.find(this.getStreams(),function(e){return e.port===t})};function s(e,t,n){this.name=e,this.upstream=t||new o,this.downstream=n||new o,this.downstreamBus=new connect.EventBus,this.upstreamBus=new connect.EventBus,this.upstream.onMessage(connect.hitch(this,this._dispatchEvent,this.upstreamBus)),this.downstream.onMessage(connect.hitch(this,this._dispatchEvent,this.downstreamBus))}s.prototype.onUpstream=function(e,t){return connect.assertNotNull(e,"eventName"),connect.assertNotNull(t,"f"),connect.assertTrue(connect.isFunction(t),"f must be a function"),this.upstreamBus.subscribe(e,t)},s.prototype.onAllUpstream=function(e){return connect.assertNotNull(e,"f"),connect.assertTrue(connect.isFunction(e),"f must be a function"),this.upstreamBus.subscribeAll(e)},s.prototype.onDownstream=function(e,t){return connect.assertNotNull(e,"eventName"),connect.assertNotNull(t,"f"),connect.assertTrue(connect.isFunction(t),"f must be a function"),this.downstreamBus.subscribe(e,t)},s.prototype.onAllDownstream=function(e){return connect.assertNotNull(e,"f"),connect.assertTrue(connect.isFunction(e),"f must be a function"),this.downstreamBus.subscribeAll(e)},s.prototype.sendUpstream=function(e,t){connect.assertNotNull(e,"eventName"),this.upstream.send({event:e,data:t})},s.prototype.sendDownstream=function(e,t){connect.assertNotNull(e,"eventName"),this.downstream.send({event:e,data:t})},s.prototype._dispatchEvent=function(e,t){var n=t.data;n.event&&e.trigger(n.event,n.data)},s.prototype.passUpstream=function(){var n=this;return function(e,t){n.upstream.send({event:t,data:e})}},s.prototype.passDownstream=function(){var n=this;return function(e,t){n.downstream.send({event:t,data:e})}},s.prototype.shutdown=function(){this.upstreamBus.unsubscribeAll(),this.downstreamBus.unsubscribeAll()};function a(e,t,n,r){s.call(this,e,new i(t,n.contentWindow,r||"*"),null)}(a.prototype=Object.create(s.prototype)).constructor=a,connect.Stream=r,connect.NullStream=o,connect.WindowStream=e,connect.WindowIOStream=i,connect.PortStream=t,connect.StreamMultiplexer=n,connect.Conduit=s,connect.IFrameConduit=a}(),function(){connect=this.connect||{},this.connect=connect,this.lily=connect,connect.ClientMethods=connect.makeEnum(["getAgentSnapshot","putAgentState","getAgentStates","getDialableCountryCodes","getRoutingProfileQueues","getAgentPermissions","getAgentConfiguration","updateAgentConfiguration","acceptContact","createOutboundContact","clearContact","completeContact","destroyContact","notifyContactIssue","updateContactAttributes","createAdditionalConnection","destroyConnection","holdConnection","resumeConnection","toggleActiveConnections","conferenceConnections","sendClientLogs","sendDigits","sendSoftphoneCallReport","sendSoftphoneCallMetrics","getEndpoints","getNewAuthToken","createTransport"]),connect.MasterMethods=connect.makeEnum(["becomeMaster","checkMaster"]);function i(){}i.EMPTY_CALLBACKS={success:function(){},failure:function(){}},i.prototype.call=function(e,t,n){connect.assertNotNull(e,"method");var r=t||{},o=n||i.EMPTY_CALLBACKS;this._callImpl(e,r,o)},i.prototype._callImpl=function(e,t,n){throw new connect.NotImplementedError};function e(){i.call(this)}((e.prototype=Object.create(i.prototype)).constructor=e).prototype._callImpl=function(e,t,n){var r;n&&n.failure&&(r=connect.sprintf("No such method exists on NULL client: %s",e),n.failure(new connect.ValueError(r),{message:r}))};function t(e,t,n){i.call(this),this.conduit=e,this.requestEvent=t,this.responseEvent=n,this._requestIdCallbacksMap={},this.conduit.onUpstream(n,connect.hitch(this,this._handleResponse))}((t.prototype=Object.create(i.prototype)).constructor=t).prototype._callImpl=function(e,t,n){var r=connect.EventFactory.createRequest(this.requestEvent,e,t);this._requestIdCallbacksMap[r.requestId]=n,this.conduit.sendUpstream(r.event,r)},t.prototype._getCallbacksForRequest=function(e){var t=this._requestIdCallbacksMap[e]||null;return null!=t&&delete this._requestIdCallbacksMap[e],t},t.prototype._handleResponse=function(e){var t=this._getCallbacksForRequest(e.requestId);null!=t&&(e.err&&t.failure?t.failure(e.err,e.data):t.success&&t.success(e.data))};function n(e){t.call(this,e,connect.EventType.API_REQUEST,connect.EventType.API_RESPONSE)}(n.prototype=Object.create(t.prototype)).constructor=n;function r(e){t.call(this,e,connect.EventType.MASTER_REQUEST,connect.EventType.MASTER_RESPONSE)}(r.prototype=Object.create(t.prototype)).constructor=r;function o(e,t,n){connect.assertNotNull(e,"authToken"),connect.assertNotNull(t,"region"),i.call(this),AWS.config.credentials=new AWS.Credentials({}),AWS.config.region=t,this.authToken=e;var r=n||connect.getBaseUrl()+"/connect/api",o=new AWS.Endpoint(r);this.client=new AWS.Connect({endpoint:o})}((o.prototype=Object.create(i.prototype)).constructor=o).prototype._callImpl=function(r,e,o){var t,n=this,i=connect.getLog();connect.contains(this.client,r)?(e=this._translateParams(r,e),i.trace("AWSClient: --\x3e Calling operation '%s'",r),this.client[r](e).on("build",function(e){e.httpRequest.headers["X-Amz-Bearer"]=n.authToken}).send(function(e,t){try{var n;e?(e.code===connect.CTIExceptions.UNAUTHORIZED_EXCEPTION?o.authFailure():!o.accessDenied||e.code!==connect.CTIExceptions.ACCESS_DENIED_EXCEPTION&&403!==e.statusCode?((n={}).type=e.code,n.message=e.message,n.stack=e.stack?e.stack.split("\n"):[],o.failure(n,t)):o.accessDenied(),i.trace("AWSClient: <-- Operation '%s' failed: %s",r,JSON.stringify(e))):(i.trace("AWSClient: <-- Operation '%s' succeeded.",r).withObject(t),o.success(t))}catch(e){connect.getLog().error("Failed to handle AWS API request for method %s",r).withException(e)}})):(t=connect.sprintf("No such method exists on AWS client: %s",r),o.failure(new connect.ValueError(t),{message:t}))},o.prototype._requiresAuthenticationParam=function(e){return e!==connect.ClientMethods.COMPLETE_CONTACT&&e!==connect.ClientMethods.CLEAR_CONTACT},o.prototype._translateParams=function(e,t){switch(e){case connect.ClientMethods.UPDATE_AGENT_CONFIGURATION:t.configuration=this._translateAgentConfiguration(t.configuration);break;case connect.ClientMethods.SEND_SOFTPHONE_CALL_METRICS:t.softphoneStreamStatistics=this._translateSoftphoneStreamStatistics(t.softphoneStreamStatistics);break;case connect.ClientMethods.SEND_SOFTPHONE_CALL_REPORT:t.report=this._translateSoftphoneCallReport(t.report)}return this._requiresAuthenticationParam(e)&&(t.authentication={authToken:this.authToken}),t},o.prototype._translateAgentConfiguration=function(e){return{name:e.name,softphoneEnabled:e.softphoneEnabled,softphoneAutoAccept:e.softphoneAutoAccept,extension:e.extension,routingProfile:this._translateRoutingProfile(e.routingProfile),agentPreferences:e.agentPreferences}},o.prototype._translateRoutingProfile=function(e){return{name:e.name,routingProfileARN:e.routingProfileARN,defaultOutboundQueue:this._translateQueue(e.defaultOutboundQueue)}},o.prototype._translateQueue=function(e){return{queueARN:e.queueARN,name:e.name}},o.prototype._translateSoftphoneStreamStatistics=function(e){return e.forEach(function(e){"packetsCount"in e&&(e.packetCount=e.packetsCount,delete e.packetsCount)}),e},o.prototype._translateSoftphoneCallReport=function(e){return"handshakingTimeMillis"in e&&(e.handshakeTimeMillis=e.handshakingTimeMillis,delete e.handshakingTimeMillis),"preTalkingTimeMillis"in e&&(e.preTalkTimeMillis=e.preTalkingTimeMillis,delete e.preTalkingTimeMillis),"handshakingFailure"in e&&(e.handshakeFailure=e.handshakingFailure,delete e.handshakingFailure),"talkingTimeMillis"in e&&(e.talkTimeMillis=e.talkingTimeMillis,delete e.talkingTimeMillis),e.softphoneStreamStatistics=this._translateSoftphoneStreamStatistics(e.softphoneStreamStatistics),e},connect.ClientBase=i,connect.NullClient=e,connect.UpstreamConduitClient=n,connect.UpstreamConduitMasterClient=r,connect.AWSClient=o}(),function(){connect=this.connect||{},this.connect=connect,this.lily=connect;function r(e,t){connect.assertNotNull(e,"fromState"),connect.assertNotNull(t,"toState"),this.fromState=e,this.toState=t}r.prototype.getAssociations=function(e){throw connect.NotImplementedError()},r.prototype.getFromState=function(){return this.fromState},r.prototype.getToState=function(){return this.toState};function e(e,t,n){connect.assertNotNull(e,"fromState"),connect.assertNotNull(t,"toState"),connect.assertNotNull(n,"associations"),r.call(this,e,t),this.associations=n}((e.prototype=Object.create(r.prototype)).constructor=e).prototype.getAssociations=function(e){return this.associations};function i(e,t,n){connect.assertNotNull(e,"fromState"),connect.assertNotNull(t,"toState"),connect.assertNotNull(n,"closure"),connect.assertTrue(connect.isFunction(n),"closure must be a function"),r.call(this,e,t),this.closure=n}((i.prototype=Object.create(r.prototype)).constructor=i).prototype.getAssociations=function(e){return this.closure(e,this.getFromState(),this.getToState())};function s(){this.fromMap={}}s.ANY="<>",s.prototype.assoc=function(t,n,r){var o=this;if(!t)throw new Error("fromStateObj is not defined.");if(!n)throw new Error("toStateObj is not defined.");if(!r)throw new Error("assocObj is not defined.");return t instanceof Array?t.forEach(function(e){o.assoc(e,n,r)}):n instanceof Array?n.forEach(function(e){o.assoc(t,e,r)}):"function"==typeof r?this._addAssociation(new i(t,n,r)):r instanceof Array?this._addAssociation(new e(t,n,r)):this._addAssociation(new e(t,n,[r])),this},s.prototype.getAssociations=function(e,t,n){connect.assertNotNull(t,"fromState"),connect.assertNotNull(n,"toState");var r=[],o=this.fromMap[s.ANY]||{},i=this.fromMap[t]||{};return r=(r=r.concat(this._getAssociationsFromMap(o,e,t,n))).concat(this._getAssociationsFromMap(i,e,t,n))},s.prototype._addAssociation=function(e){var t=this.fromMap[e.getFromState()];((t=t||(this.fromMap[e.getFromState()]={}))[e.getToState()]||(t[e.getToState()]=[])).push(e)},s.prototype._getAssociationsFromMap=function(e,n,t,r){return(e[s.ANY]||[]).concat(e[r]||[]).reduce(function(e,t){return e.concat(t.getAssociations(n))},[])},connect.EventGraph=s}(),function(){var n=this;connect=n.connect||{},n.connect=connect,n.lily=connect,connect.AgentStateType=connect.makeEnum(["init","routable","not_routable","offline"]),connect.AgentStatusType=connect.AgentStateType,connect.AgentAvailStates=connect.makeEnum(["Init","Busy","AfterCallWork","CallingCustomer","Dialing","Joining","PendingAvailable","PendingBusy"]),connect.AgentErrorStates=connect.makeEnum(["Error","AgentHungUp","BadAddressAgent","BadAddressCustomer","Default","FailedConnectAgent","FailedConnectCustomer","LineEngagedAgent","LineEngagedCustomer","MissedCallAgent","MissedCallCustomer","MultipleCcpWindows","RealtimeCommunicationError"]),connect.EndpointType=connect.makeEnum(["phone_number","agent","queue"]),connect.AddressType=connect.EndpointType,connect.ConnectionType=connect.makeEnum(["agent","inbound","outbound","monitoring"]),connect.ConnectionStateType=connect.makeEnum(["init","connecting","connected","hold","disconnected"]),connect.ConnectionStatusType=connect.ConnectionStateType,connect.CONNECTION_ACTIVE_STATES=connect.set([connect.ConnectionStateType.CONNECTING,connect.ConnectionStateType.CONNECTED,connect.ConnectionStateType.HOLD]),connect.ContactStateType=connect.makeEnum(["init","incoming","pending","connecting","connected","missed","error","ended"]),connect.ContactStatusType=connect.ContactStateType,connect.CONTACT_ACTIVE_STATES=connect.makeEnum(["incoming","pending","connecting","connected"]),connect.ContactType=connect.makeEnum(["voice","queue_callback","chat"]),connect.ChannelType=connect.makeEnum(["VOICE","CHAT"]),connect.MediaType=connect.makeEnum(["softphone","chat"]),connect.SoftphoneCallType=connect.makeEnum(["audio_video","video_only","audio_only","none"]),connect.SoftphoneErrorTypes=connect.makeEnum(["unsupported_browser","microphone_not_shared","signalling_handshake_failure","signalling_connection_failure","ice_collection_timeout","user_busy_error","webrtc_error","realtime_communication_error","other"]),connect.CTIExceptions=connect.makeEnum(["AccessDeniedException","InvalidStateException","BadEndpointException","InvalidAgentARNException","InvalidConfigurationException","InvalidContactTypeException","PaginationException","RefreshTokenExpiredException","SendDataFailedException","UnauthorizedException"]);function e(){if(!connect.agent.initialized)throw new connect.StateError("The agent is not yet initialized!")}e.prototype._getData=function(){return connect.core.getAgentDataProvider().getAgentData()},e.prototype._createContactAPI=function(e){return new connect.Contact(e.contactId)},e.prototype.onContactPending=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.CONTACT_PENDING,e)},e.prototype.onRefresh=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.REFRESH,e)},e.prototype.onRoutable=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.ROUTABLE,e)},e.prototype.onNotRoutable=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.NOT_ROUTABLE,e)},e.prototype.onOffline=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.OFFLINE,e)},e.prototype.onError=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.ERROR,e)},e.prototype.onSoftphoneError=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.SOFTPHONE_ERROR,e)},e.prototype.onWebSocketConnectionLost=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.WEBSOCKET_CONNECTION_LOST,e)},e.prototype.onWebSocketConnectionGained=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.WEBSOCKET_CONNECTION_GAINED,e)},e.prototype.onAfterCallWork=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.ACW,e)},e.prototype.onStateChange=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.STATE_CHANGE,e)},e.prototype.onMuteToggle=function(e){connect.core.getUpstream().onUpstream(connect.AgentEvents.MUTE_TOGGLE,e)},e.prototype.mute=function(){connect.core.getUpstream().sendUpstream(connect.EventType.BROADCAST,{event:connect.EventType.MUTE,data:{mute:!0}})},e.prototype.unmute=function(){connect.core.getUpstream().sendUpstream(connect.EventType.BROADCAST,{event:connect.EventType.MUTE,data:{mute:!1}})},e.prototype.getState=function(){return this._getData().snapshot.state},e.prototype.getAvailabilityState=function(){return this._getData().snapshot.agentAvailabilityState},e.prototype.getStatus=e.prototype.getState,e.prototype.getStatusDuration=e.prototype.getStateDuration=function(){return connect.now()-this._getData().snapshot.state.startTimestamp.getTime()+connect.core.getSkew()},e.prototype.getPermissions=function(){return this.getConfiguration().permissions},e.prototype.getContacts=function(t){var n=this;return this._getData().snapshot.contacts.map(function(e){return n._createContactAPI(e)}).filter(function(e){return!t||e.getType()===t})},e.prototype.getConfiguration=function(){return this._getData().configuration},e.prototype.getAgentStates=function(){return this.getConfiguration().agentStates},e.prototype.getRoutingProfile=function(){return this.getConfiguration().routingProfile},e.prototype.getChannelConcurrency=function(e){var t=(t=this.getRoutingProfile().channelConcurrencyMap)||Object.keys(connect.ChannelType).reduce(function(e,t){return e[connect.ChannelType[t]]=1,e},{});return e?t[e]||0:t},e.prototype.getName=function(){return this.getConfiguration().name},e.prototype.getExtension=function(){return this.getConfiguration().extension},e.prototype.getDialableCountries=function(){return this.getConfiguration().dialableCountries},e.prototype.isSoftphoneEnabled=function(){return this.getConfiguration().softphoneEnabled},e.prototype.setConfiguration=function(e,t){connect.core.getClient().call(connect.ClientMethods.UPDATE_AGENT_CONFIGURATION,{configuration:connect.assertNotNull(e,"configuration")},{success:function(e){connect.core.getUpstream().sendUpstream(connect.EventType.RELOAD_AGENT_CONFIGURATION),t.success&&t.success(e)},failure:t&&t.failure})},e.prototype.setStatus=e.prototype.setState=function(e,t){connect.core.getClient().call(connect.ClientMethods.PUT_AGENT_STATE,{state:connect.assertNotNull(e,"state")},t)},e.prototype.connect=function(e,t){var n=connect.core.getClient(),r=new connect.Endpoint(e);delete r.endpointId,n.call(connect.ClientMethods.CREATE_OUTBOUND_CONTACT,{endpoint:connect.assertNotNull(r,"endpoint"),queueARN:t&&(t.queueARN||t.queueId)||this.getRoutingProfile().defaultOutboundQueue.queueARN},t&&{success:t.success,failure:t.failure})},e.prototype.getAllQueueARNs=function(){return this.getConfiguration().routingProfile.queues.map(function(e){return e.queueARN})},e.prototype.getAddresses=e.prototype.getEndpoints=function(n,r,e){var o=this,t=connect.core.getClient();connect.assertNotNull(r,"callbacks"),connect.assertNotNull(r.success,"callbacks.success");var i=e||{};i.endpoints=i.endpoints||[],i.maxResults=i.maxResults||connect.DEFAULT_BATCH_SIZE,connect.isArray(n)||(n=[n]),t.call(connect.ClientMethods.GET_ENDPOINTS,{queueARNs:n,nextToken:i.nextToken||null,maxResults:i.maxResults},{success:function(e){var t;e.nextToken?o.getEndpoints(n,r,{nextToken:e.nextToken,maxResults:i.maxResults,endpoints:i.endpoints.concat(e.endpoints)}):(i.endpoints=i.endpoints.concat(e.endpoints),t=i.endpoints.map(function(e){return new connect.Endpoint(e)}),r.success({endpoints:t,addresses:t}))},failure:r.failure})},e.prototype.toSnapshot=function(){return new connect.AgentSnapshot(this._getData())};function t(e){connect.Agent.call(this),this.agentData=e}((t.prototype=Object.create(e.prototype)).constructor=t).prototype._getData=function(){return this.agentData},t.prototype._createContactAPI=function(e){return new connect.ContactSnapshot(e)};function r(e){this.contactId=e}r.prototype._getData=function(){return connect.core.getAgentDataProvider().getContactData(this.getContactId())},r.prototype._createConnectionAPI=function(e){return this.getType()===connect.ContactType.CHAT?new connect.ChatConnection(this.contactId,e.connectionId):new connect.VoiceConnection(this.contactId,e.connectionId)},r.prototype.getEventName=function(e){return connect.core.getContactEventName(e,this.getContactId())},r.prototype.onRefresh=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.REFRESH),e)},r.prototype.onIncoming=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.INCOMING),e)},r.prototype.onConnecting=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.CONNECTING),e)},r.prototype.onPending=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.PENDING),e)},r.prototype.onAccepted=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.ACCEPTED),e)},r.prototype.onMissed=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.MISSED),e)},r.prototype.onEnded=function(e){var t=connect.core.getEventBus();t.subscribe(this.getEventName(connect.ContactEvents.ENDED),e),t.subscribe(this.getEventName(connect.ContactEvents.DESTROYED),e)},r.prototype.onDestroy=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.DESTROYED),e)},r.prototype.onACW=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.ACW),e)},r.prototype.onConnected=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.CONNECTED),e)},r.prototype.getContactId=function(){return this.contactId},r.prototype.getInitialContactId=r.prototype.getOriginalContactId=function(){return this._getData().initialContactId},r.prototype.getType=function(){return this._getData().type},r.prototype.getContactDuration=function(){return this._getData().contactDuration},r.prototype.getStatus=r.prototype.getState=function(){return this._getData().state},r.prototype.getStatusDuration=r.prototype.getStateDuration=function(){return connect.now()-this._getData().state.timestamp.getTime()+connect.core.getSkew()},r.prototype.getQueue=function(){return this._getData().queue},r.prototype.getQueueTimestamp=function(){return this._getData().queueTimestamp},r.prototype.getConnections=function(){var t=this;return this._getData().connections.map(function(e){return t.getType()===connect.ContactType.CHAT?new connect.ChatConnection(t.contactId,e.connectionId):new connect.VoiceConnection(t.contactId,e.connectionId)})},r.prototype.getInitialConnection=function(){return connect.find(this.getConnections(),function(e){return e.isInitialConnection()})||null},r.prototype.getActiveInitialConnection=function(){var e=this.getInitialConnection();return null!=e&&e.isActive()?e:null},r.prototype.getThirdPartyConnections=function(){return this.getConnections().filter(function(e){return!e.isInitialConnection()&&e.getType()!==connect.ConnectionType.AGENT})},r.prototype.getSingleActiveThirdPartyConnection=function(){return this.getThirdPartyConnections().filter(function(e){return e.isActive()})[0]||null},r.prototype.getAgentConnection=function(){return connect.find(this.getConnections(),function(e){var t=e.getType();return t===connect.ConnectionType.AGENT||t===connect.ConnectionType.MONITORING})},r.prototype.getAttributes=function(){return this._getData().attributes},r.prototype.isSoftphoneCall=function(){return null!=connect.find(this.getConnections(),function(e){return null!=e.getSoftphoneMediaInfo()})},r.prototype.isInbound=function(){var e=this.getInitialConnection();return!!e&&e.getType()===connect.ConnectionType.INBOUND},r.prototype.isConnected=function(){return this.getStatus().type===connect.ContactStateType.CONNECTED},r.prototype.accept=function(n){var e=connect.core.getClient(),r=this,o=this.getContactId();e.call(connect.ClientMethods.ACCEPT_CONTACT,{contactId:o},{success:function(e){var t=connect.core.getUpstream();t.sendUpstream(connect.EventType.BROADCAST,{event:connect.ContactEvents.ACCEPTED,data:new connect.Contact(o)}),t.sendUpstream(connect.EventType.BROADCAST,{event:connect.core.getContactEventName(connect.ContactEvents.ACCEPTED,r.getContactId()),data:new connect.Contact(o)}),n&&n.success&&n.success(e)},failure:n?n.failure:null})},r.prototype.destroy=function(e){connect.core.getClient().call(connect.ClientMethods.DESTROY_CONTACT,{contactId:this.getContactId()},e)},r.prototype.complete=function(e){connect.core.getClient().call(connect.ClientMethods.COMPLETE_CONTACT,{contactId:this.getContactId()},e)},r.prototype.clear=function(e){connect.core.getClient().call(connect.ClientMethods.CLEAR_CONTACT,{contactId:this.getContactId()},e)},r.prototype.notifyIssue=function(e,t,n){connect.core.getClient().call(connect.ClientMethods.NOTIFY_CONTACT_ISSUE,{contactId:this.getContactId(),issueCode:e,description:t},n)},r.prototype.addConnection=function(e,t){var n=connect.core.getClient(),r=new connect.Endpoint(e);delete r.endpointId,n.call(connect.ClientMethods.CREATE_ADDITIONAL_CONNECTION,{contactId:this.getContactId(),endpoint:r},t)},r.prototype.toggleActiveConnections=function(e){var t,n=connect.core.getClient(),r=null,o=connect.find(this.getConnections(),function(e){return e.getStatus().type===connect.ConnectionStateType.HOLD});null!=o?r=o.getConnectionId():0<(t=this.getConnections().filter(function(e){return e.isActive()})).length&&(r=t[0].getConnectionId()),n.call(connect.ClientMethods.TOGGLE_ACTIVE_CONNECTIONS,{contactId:this.getContactId(),connectionId:r},e)},r.prototype.sendSoftphoneMetrics=function(e,t){connect.core.getClient().call(connect.ClientMethods.SEND_SOFTPHONE_CALL_METRICS,{contactId:this.getContactId(),ccpVersion:n.ccpVersion,softphoneStreamStatistics:e},t)},r.prototype.sendSoftphoneReport=function(e,t){connect.core.getClient().call(connect.ClientMethods.SEND_SOFTPHONE_CALL_REPORT,{contactId:this.getContactId(),ccpVersion:n.ccpVersion,report:e},t)},r.prototype.conferenceConnections=function(e){connect.core.getClient().call(connect.ClientMethods.CONFERENCE_CONNECTIONS,{contactId:this.getContactId()},e)},r.prototype.toSnapshot=function(){return new connect.ContactSnapshot(this._getData())};function o(e){connect.Contact.call(this,e.contactId),this.contactData=e}((o.prototype=Object.create(r.prototype)).constructor=o).prototype._getData=function(){return this.contactData},o.prototype._createConnectionAPI=function(e){return new connect.ConnectionSnapshot(e)};function i(e,t){this.contactId=e,this.connectionId=t,this._initMediaController()}i.prototype._getData=function(){return connect.core.getAgentDataProvider().getConnectionData(this.getContactId(),this.getConnectionId())},i.prototype.getContactId=function(){return this.contactId},i.prototype.getConnectionId=function(){return this.connectionId},i.prototype.getAddress=i.prototype.getEndpoint=function(){return new connect.Endpoint(this._getData().endpoint)},i.prototype.getStatus=i.prototype.getState=function(){return this._getData().state},i.prototype.getStatusDuration=i.prototype.getStateDuration=function(){return connect.now()-this._getData().state.timestamp.getTime()+connect.core.getSkew()},i.prototype.getType=function(){return this._getData().type},i.prototype.isInitialConnection=function(){return this._getData().initial},i.prototype.isActive=function(){return connect.contains(connect.CONNECTION_ACTIVE_STATES,this.getStatus().type)},i.prototype.isConnected=function(){return this.getStatus().type===connect.ConnectionStateType.CONNECTED},i.prototype.isConnecting=function(){return this.getStatus().type===connect.ConnectionStateType.CONNECTING},i.prototype.isOnHold=function(){return this.getStatus().type===connect.ConnectionStateType.HOLD},i.prototype.getSoftphoneMediaInfo=function(){return this._getData().softphoneMediaInfo},i.prototype.getMonitorInfo=function(){return this._getData().monitoringInfo},i.prototype.destroy=function(e){connect.core.getClient().call(connect.ClientMethods.DESTROY_CONNECTION,{contactId:this.getContactId(),connectionId:this.getConnectionId()},e)},i.prototype.sendDigits=function(e,t){connect.core.getClient().call(connect.ClientMethods.SEND_DIGITS,{contactId:this.getContactId(),connectionId:this.getConnectionId(),digits:e},t)},i.prototype.hold=function(e){connect.core.getClient().call(connect.ClientMethods.HOLD_CONNECTION,{contactId:this.getContactId(),connectionId:this.getConnectionId()},e)},i.prototype.resume=function(e){connect.core.getClient().call(connect.ClientMethods.RESUME_CONNECTION,{contactId:this.getContactId(),connectionId:this.getConnectionId()},e)},i.prototype.toSnapshot=function(){return new connect.ConnectionSnapshot(this._getData())},i.prototype._initMediaController=function(){this.getMediaInfo()&&connect.core.mediaFactory.get(this).catch(function(){})},i.prototype._isAgentConnectionType=function(){var e=this.getType();return e===connect.ConnectionType.AGENT||e===connect.ConnectionType.MONITORING},i.prototype._isAgentConnectionType=function(){var e=this.getType();return e===connect.ConnectionType.AGENT||e===connect.ConnectionType.MONITORING},i.prototype._isAgentConnectionType=function(){var e=this.getType();return e===connect.ConnectionType.AGENT||e===connect.ConnectionType.MONITORING};function s(e,t){i.call(this,e,t)}((s.prototype=Object.create(i.prototype)).constructor=s).prototype.getSoftphoneMediaInfo=function(){return this._getData().softphoneMediaInfo},s.prototype.getMediaInfo=function(){return this._getData().softphoneMediaInfo},s.prototype.getMediaType=function(){return connect.MediaType.SOFTPHONE},s.prototype.getMediaController=function(){return connect.core.mediaFactory.get(this)};function a(e,t){i.call(this,e,t)}((a.prototype=Object.create(i.prototype)).constructor=a).prototype.getMediaInfo=function(){var t=this._getData().chatMediaInfo;if(t){var e=connect.core.getAgentDataProvider().getContactData(this.contactId),n={contactId:this.contactId,initialContactId:e.initialContactId||this.contactId,participantId:this.connectionId,getConnectionToken:connect.hitch(this,this.getConnectionToken)};if(t.connectionData)try{n.participantToken=JSON.parse(t.connectionData).ConnectionAuthenticationToken}catch(e){connect.getLog().error(connect.LogComponent.CHAT,"Connection data is invalid").withObject(t).withException(e),n.participantToken=null}return n.participantToken=n.participantToken||null,n.originalInfo=this._getData().chatMediaInfo,n}return null},a.prototype.getConnectionToken=function(){client=connect.core.getClient();var e=connect.core.getAgentDataProvider().getContactData(this.contactId),r={transportType:connect.TRANSPORT_TYPES.CHAT_TOKEN,participantId:this.connectionId,contactId:e.initialContactId||this.contactId};return new Promise(function(t,n){client.call(connect.ClientMethods.CREATE_TRANSPORT,r,{success:function(e){connect.getLog().info("getConnectionToken succeeded"),t(e)},failure:function(e,t){connect.getLog().error("getConnectionToken failed").withObject({err:e,data:t}),n(Error("getConnectionToken failed"))}})})},a.prototype.getMediaType=function(){return connect.MediaType.CHAT},a.prototype.getMediaController=function(){return connect.core.mediaFactory.get(this)},a.prototype._initMediaController=function(){this._isAgentConnectionType()&&connect.core.mediaFactory.get(this).catch(function(){})};function c(e){connect.Connection.call(this,e.contactId,e.connectionId),this.connectionData=e}((c.prototype=Object.create(i.prototype)).constructor=c).prototype._getData=function(){return this.connectionData},c.prototype._initMediaController=function(){};function u(e){var t=e||{};this.endpointARN=t.endpointId||t.endpointARN||null,this.endpointId=this.endpointARN,this.type=t.type||null,this.name=t.name||null,this.phoneNumber=t.phoneNumber||null,this.agentLogin=t.agentLogin||null,this.queue=t.queue||null}u.prototype.stripPhoneNumber=function(){return this.phoneNumber?this.phoneNumber.replace(/sip:([^@]*)@.*/,"$1"):""},u.byPhoneNumber=function(e,t){return new u({type:connect.EndpointType.PHONE_NUMBER,phoneNumber:e,name:t||null})};function l(e,t,n){this.errorType=e,this.errorMessage=t,this.endPointUrl=n}l.prototype.getErrorType=function(){return this.errorType},l.prototype.getErrorMessage=function(){return this.errorMessage},l.prototype.getEndPointUrl=function(){return this.endPointUrl},connect.agent=function(e){var t=connect.core.getEventBus().subscribe(connect.AgentEvents.INIT,e);return connect.agent.initialized&&e(new connect.Agent),t},connect.agent.initialized=!1,connect.contact=function(e){return connect.core.getEventBus().subscribe(connect.ContactEvents.INIT,e)},connect.onWebsocketInitFailure=function(e){var t=connect.core.getEventBus().subscribe(connect.WebSocketEvents.INIT_FAILURE,e);return connect.webSocketInitFailed&&e(),t},connect.ifMaster=function(e,t,n){if(connect.assertNotNull(e,"A topic must be provided."),connect.assertNotNull(t,"A true callback must be provided."),!connect.core.masterClient)return connect.getLog().warn("We can't be the master for topic '%s' because there is no master client!",e),void(n&&n());connect.core.getMasterClient().call(connect.MasterMethods.CHECK_MASTER,{topic:e},{success:function(e){e.isMaster?t():n&&n()}})},connect.becomeMaster=function(e){connect.assertNotNull(e,"A topic must be provided."),connect.core.getMasterClient().call(connect.MasterMethods.BECOME_MASTER,{topic:e})},connect.Agent=e,connect.AgentSnapshot=t,connect.Contact=r,connect.ContactSnapshot=o,connect.Connection=s,connect.BaseConnection=i,connect.VoiceConnection=s,connect.ChatConnection=a,connect.ConnectionSnapshot=c,connect.Endpoint=u,connect.Address=u,connect.SoftphoneError=l}(),function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=2)}([function(e,t,n){"use strict";var r=n(1);function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i={assertTrue:function(e,t){if(!e)throw new Error(t)},assertNotNull:function(e,t){return i.assertTrue(null!==e&&void 0!==o(e),Object(r.sprintf)("%s must be provided",t||"A value")),e},isNonEmptyString:function(e){return"string"==typeof e&&0=this._level}},{key:"hasClientLogger",value:function(){return null!==this._clientLogger}},{key:"getLogger",value:function(e){var t=e.prefix||"";return"DEBUG"===this._logsDestination?this.consoleLoggerWrapper:new y(t)}},{key:"updateLoggerConfig",value:function(e){var t=e||{};this._level=t.level||d.DEBUG,this._clientLogger=t.logger||null,this._logsDestination="NULL",t.debug&&(this._logsDestination="DEBUG"),t.logger&&(this._logsDestination="CLIENT_LOGGER")}}]),S),m=(h(E,[{key:"debug",value:function(){}},{key:"info",value:function(){}},{key:"warn",value:function(){}},{key:"error",value:function(){}}]),E),y=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}(b,m),h(b,[{key:"debug",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n>>0).toString(8);break;case"s":n=String(n),n=o.precision?n.substring(0,o.precision):n;break;case"t":n=String(!!n),n=o.precision?n.substring(0,o.precision):n;break;case"T":n=Object.prototype.toString.call(n).slice(8,-1).toLowerCase(),n=o.precision?n.substring(0,o.precision):n;break;case"u":n=parseInt(n,10)>>>0;break;case"v":n=n.valueOf(),n=o.precision?n.substring(0,o.precision):n;break;case"x":n=(parseInt(n,10)>>>0).toString(16);break;case"X":n=(parseInt(n,10)>>>0).toString(16).toUpperCase()}d.json.test(o.type)?h+=n:(!d.number.test(o.type)||c&&!o.sign?u="":(u=c?"+":"-",n=n.toString().replace(d.sign,"")),s=o.pad_char?"0"===o.pad_char?"0":o.pad_char.charAt(1):" ",a=o.width-(u+n).length,i=o.width&&0t.packetsLost?e.packetsLost-t.packetsLost:0,o=e.packetsCount>t.packetsCount?e.packetsCount-t.packetsCount:0;return new O(e.timestamp,r,o,n,e.audioLevel,e.jbMilliseconds,e.rttMilliseconds)}return new O(e.timestamp,e.packetsLost,e.packetsCount,n,e.audioLevel,e.jbMilliseconds,e.rttMilliseconds)},x=function(e,t){u=r(u),l=r(l),function(e,t,n,r){t.streamStats=[L(n,i),L(r,s)];var o={callStartTime:t.sessionStartTime,callEndTime:t.sessionEndTime,gumTimeMillis:t.gumTimeMillis,initializationTimeMillis:t.initializationTimeMillis,iceCollectionTimeMillis:t.iceCollectionTimeMillis,signallingConnectTimeMillis:t.signallingConnectTimeMillis,handshakingTimeMillis:t.handshakingTimeMillis,preTalkingTimeMillis:t.preTalkingTimeMillis,talkingTimeMillis:t.talkingTimeMillis,cleanupTimeMillis:t.cleanupTimeMillis,iceCollectionFailure:t.iceCollectionFailure,signallingConnectionFailure:t.signallingConnectionFailure,handshakingFailure:t.handshakingFailure,gumOtherFailure:t.gumOtherFailure,gumTimeoutFailure:t.gumTimeoutFailure,createOfferFailure:t.createOfferFailure,setLocalDescriptionFailure:t.setLocalDescriptionFailure,userBusyFailure:t.userBusyFailure,invalidRemoteSDPFailure:t.invalidRemoteSDPFailure,noRemoteIceCandidateFailure:t.noRemoteIceCandidateFailure,setRemoteDescriptionFailure:t.setRemoteDescriptionFailure,softphoneStreamStatistics:t.streamStats};e.sendSoftphoneReport(o,{success:function(){h.info("sendSoftphoneReport success"+JSON.stringify(o))},failure:function(e){h.error("sendSoftphoneReport failed.").withObject(e)}})}(e,t,L(a,i),L(c,s)),n(e)},O=function(e,t,n,r,o,i,s){this.softphoneStreamType=r,this.timestamp=e,this.packetsLost=t,this.packetsCount=n,this.audioLevel=o,this.jitterBufferMillis=i,this.roundTripTimeMillis=s},L=function(e,t){return new O((e=e||{}).timestamp,e.packetsLost,e.packetsCount,t,e.audioLevel)},P=function(e){this._originalLogger=e;var r=this;this._tee=function(e,n){return function(){var e=Array.prototype.slice.call(arguments[0]),t="";e.forEach(function(){t+=" %s"}),n.apply(r._originalLogger,[connect.LogComponent.SOFTPHONE,t].concat(e))}}};P.prototype.debug=function(){this._tee(1,this._originalLogger.debug)(arguments)},P.prototype.info=function(){this._tee(2,this._originalLogger.info)(arguments)},P.prototype.log=function(){this._tee(3,this._originalLogger.log)(arguments)},P.prototype.warn=function(){this._tee(4,this._originalLogger.warn)(arguments)},P.prototype.error=function(){this._tee(5,this._originalLogger.error)(arguments)},connect.SoftphoneManager=function(e){var a;h=new P(connect.getLog()),connect.RtcPeerConnectionFactory&&(a=new connect.RtcPeerConnectionFactory(h,connect.core.getWebSocketManager(),g,connect.hitch(this,t,{transportType:"softphone",softphoneClientId:g}),connect.hitch(this,C))),A()||C(f.UNSUPPORTED_BROWSER,"Connect does not support this browser. Some functionality may not work. ","");S({success:function(e){connect.isFirefoxBrowser()&&connect.core.setSoftphoneUserMediaStream(e)},failure:function(e){C(e,"Your microphone is not enabled in your browser. ","")}});y(),this.ringtoneEngine=null;var c="true"===e.cleanMultipleSessions,u={},l={};this.getSession=function(e){return u[e]};function p(n){var r;u.hasOwnProperty(n)&&(r=u[n],new Promise(function(e,t){delete u[n],delete l[n],r.hangup()}).catch(function(e){lily.getLog().warn("Clean up the session locally "+n,e.message)}))}function n(n,r){var e,t,o,i,s;!u[r]||(e=n).getStatus().type!==connect.ContactStatusType.ENDED&&e.getStatus().type!==connect.ContactStatusType.ERROR&&e.getStatus().type!==connect.ContactStatusType.MISSED||p(r),!n.isSoftphoneCall()||l[r]||n.getStatus().type!==connect.ContactStatusType.CONNECTING&&n.getStatus().type!==connect.ContactStatusType.INCOMING||(l[r]=!0,h.info("Softphone call detected:","contactId "+n.getContactId(),"agent connectionId "+r),function(e){if(0 | 3 clause BSD license */ @@ -22828,6 +22863,7 @@ 'updateAgentConfiguration', 'acceptContact', 'createOutboundContact', + 'clearContact', 'completeContact', 'destroyContact', 'notifyContactIssue', @@ -23022,7 +23058,7 @@ }; AWSClient.prototype._requiresAuthenticationParam = function(method) { - return method !== connect.ClientMethods.COMPLETE_CONTACT + return method !== connect.ClientMethods.COMPLETE_CONTACT && method !== connect.ClientMethods.CLEAR_CONTACT; }; AWSClient.prototype._translateParams = function(method, params) { @@ -23568,6 +23604,10 @@ return this._getData().snapshot.state; }; + Agent.prototype.getAvailabilityState = function () { + return this._getData().snapshot.agentAvailabilityState; + }; + Agent.prototype.getStatus = Agent.prototype.getState; Agent.prototype.getStateDuration = function () { @@ -23963,6 +24003,13 @@ }, callbacks); }; + Contact.prototype.clear = function (callbacks) { + var client = connect.core.getClient(); + client.call(connect.ClientMethods.CLEAR_CONTACT, { + contactId: this.getContactId() + }, callbacks); + }; + Contact.prototype.notifyIssue = function (issueCode, description, callbacks) { var client = connect.core.getClient(); client.call(connect.ClientMethods.NOTIFY_CONTACT_ISSUE, { @@ -24176,6 +24223,25 @@ } } + // Method for checking whether this connection is an agent-side connection + // (type AGENT or MONITORING) + Connection.prototype._isAgentConnectionType = function () { + var connectionType = this.getType(); + return connectionType === connect.ConnectionType.AGENT + || connectionType === connect.ConnectionType.MONITORING; + } + + /** + * Utility method for checking whether this connection is an agent-side connection + * (type AGENT or MONITORING) + * @return {boolean} True if this connection is an agent-side connection. False otherwise. + */ + Connection.prototype._isAgentConnectionType = function () { + var connectionType = this.getType(); + return connectionType === connect.ConnectionType.AGENT + || connectionType === connect.ConnectionType.MONITORING; + } + /** * Utility method for checking whether this connection is an agent-side connection * (type AGENT or MONITORING) @@ -25473,7 +25539,10 @@ connect.ContactEvents.ACW) .assoc(connect.values(connect.CONTACT_ACTIVE_STATES), connect.values(connect.relativeComplement(connect.CONTACT_ACTIVE_STATES, connect.ContactStateType)), - connect.ContactEvents.ENDED); + connect.ContactEvents.ENDED) + .assoc(connect.EventGraph.ANY, + connect.values(connect.AgentErrorStates), + connect.ContactEvents.ERROR); /**-----------------------------------------------------------------------*/ connect.core.getClient = function () { diff --git a/src/api.js b/src/api.js index f25d3025..3ac96d2b 100644 --- a/src/api.js +++ b/src/api.js @@ -274,6 +274,10 @@ return this._getData().snapshot.state; }; + Agent.prototype.getAvailabilityState = function () { + return this._getData().snapshot.agentAvailabilityState; + }; + Agent.prototype.getStatus = Agent.prototype.getState; Agent.prototype.getStateDuration = function () { @@ -669,6 +673,13 @@ }, callbacks); }; + Contact.prototype.clear = function (callbacks) { + var client = connect.core.getClient(); + client.call(connect.ClientMethods.CLEAR_CONTACT, { + contactId: this.getContactId() + }, callbacks); + }; + Contact.prototype.notifyIssue = function (issueCode, description, callbacks) { var client = connect.core.getClient(); client.call(connect.ClientMethods.NOTIFY_CONTACT_ISSUE, { @@ -882,6 +893,25 @@ } } + // Method for checking whether this connection is an agent-side connection + // (type AGENT or MONITORING) + Connection.prototype._isAgentConnectionType = function () { + var connectionType = this.getType(); + return connectionType === connect.ConnectionType.AGENT + || connectionType === connect.ConnectionType.MONITORING; + } + + /** + * Utility method for checking whether this connection is an agent-side connection + * (type AGENT or MONITORING) + * @return {boolean} True if this connection is an agent-side connection. False otherwise. + */ + Connection.prototype._isAgentConnectionType = function () { + var connectionType = this.getType(); + return connectionType === connect.ConnectionType.AGENT + || connectionType === connect.ConnectionType.MONITORING; + } + /** * Utility method for checking whether this connection is an agent-side connection * (type AGENT or MONITORING) diff --git a/src/aws-client.js b/src/aws-client.js index df9ed23e..42aa2f5d 100644 --- a/src/aws-client.js +++ b/src/aws-client.js @@ -647,6 +647,21 @@ "members": {} } }, + "ClearContact": { + "input": { + "type": "structure", + "required": [ + "contactId" + ], + "members": { + "contactId": {} + } + }, + "output": { + "type": "structure", + "members": {} + } + }, "CompleteContact": { "input": { "type": "structure", @@ -695,7 +710,7 @@ }, "contactId": {}, "endpoint": { - "shape": "Sc" + "shape": "Se" } } }, @@ -716,7 +731,7 @@ "shape": "S2" }, "endpoint": { - "shape": "Sc" + "shape": "Se" }, "queueARN": {} } @@ -841,7 +856,7 @@ ], "members": { "configuration": { - "shape": "S19" + "shape": "S1b" } } } @@ -908,7 +923,16 @@ ], "members": { "state": { - "shape": "S1s" + "shape": "S1u" + }, + "agentAvailabilityState": { + "type": "structure", + "members": { + "state": {}, + "timeStamp": { + "type": "timestamp" + } + } }, "contacts": { "type": "list", @@ -918,7 +942,6 @@ "contactId", "type", "state", - "queueTimestamp", "connections", "attributes" ], @@ -940,7 +963,7 @@ } }, "queue": { - "shape": "Si" + "shape": "Sk" }, "queueTimestamp": { "type": "timestamp" @@ -958,7 +981,7 @@ "members": { "connectionId": {}, "endpoint": { - "shape": "Sc" + "shape": "Se" }, "state": { "type": "structure", @@ -1017,9 +1040,51 @@ } }, "attributes": { - "shape": "S2c" + "type": "map", + "key": {}, + "value": { + "type": "structure", + "required": [ + "name" + ], + "members": { + "name": {}, + "value": {} + } + } }, - "contactDuration": {} + "contactDuration": {}, + "name": {}, + "description": {}, + "references": { + "type": "map", + "key": {}, + "value": { + "type": "structure", + "required": [ + "value" + ], + "members": { + "value": {} + } + } + }, + "contactMetadata": { + "type": "structure", + "required": [ + "name" + ], + "members": { + "name": {}, + "references": { + "type": "map", + "key": {}, + "value": {} + }, + "description": {} + } + }, + "initiationMethod": {} } } }, @@ -1057,7 +1122,7 @@ "states": { "type": "list", "member": { - "shape": "S1s" + "shape": "S1u" } }, "nextToken": {} @@ -1121,7 +1186,7 @@ "endpoints": { "type": "list", "member": { - "shape": "Sc" + "shape": "Se" } }, "nextToken": {} @@ -1179,7 +1244,7 @@ "queues": { "type": "list", "member": { - "shape": "Si" + "shape": "Sk" } }, "nextToken": {} @@ -1241,7 +1306,7 @@ "shape": "S2" }, "state": { - "shape": "S1s" + "shape": "S1u" } } }, @@ -1250,6 +1315,21 @@ "members": {} } }, + "RejectContact": { + "input": { + "type": "structure", + "required": [ + "contactId" + ], + "members": { + "contactId": {} + } + }, + "output": { + "type": "structure", + "members": {} + } + }, "ResumeConnection": { "input": { "type": "structure", @@ -1338,8 +1418,9 @@ "shape": "S2" }, "contactId": {}, + "ccpVersion": {}, "softphoneStreamStatistics": { - "shape": "S3b" + "shape": "S3n" } } }, @@ -1361,6 +1442,7 @@ "shape": "S2" }, "contactId": {}, + "ccpVersion": {}, "report": { "type": "structure", "members": { @@ -1371,7 +1453,7 @@ "type": "timestamp" }, "softphoneStreamStatistics": { - "shape": "S3b" + "shape": "S3n" }, "gumTimeMillis": { "type": "long" @@ -1472,30 +1554,7 @@ "shape": "S2" }, "configuration": { - "shape": "S19" - } - } - }, - "output": { - "type": "structure", - "members": {} - } - }, - "UpdateContactAttributes": { - "input": { - "type": "structure", - "required": [ - "authentication", - "contactId", - "attributes" - ], - "members": { - "authentication": { - "shape": "S2" - }, - "contactId": {}, - "attributes": { - "shape": "S2c" + "shape": "S1b" } } }, @@ -1513,7 +1572,7 @@ "authToken": {} } }, - "Sc": { + "Se": { "type": "structure", "required": [ "type" @@ -1525,18 +1584,18 @@ "phoneNumber": {}, "agentLogin": {}, "queue": { - "shape": "Si" + "shape": "Sk" } } }, - "Si": { + "Sk": { "type": "structure", "members": { "queueARN": {}, "name": {} } }, - "S19": { + "S1b": { "type": "structure", "required": [ "name", @@ -1561,7 +1620,7 @@ "name": {}, "routingProfileARN": {}, "defaultOutboundQueue": { - "shape": "Si" + "shape": "Sk" }, "channelConcurrencyMap": { "type": "map", @@ -1579,7 +1638,7 @@ } } }, - "S1s": { + "S1u": { "type": "structure", "required": [ "type", @@ -1594,21 +1653,7 @@ } } }, - "S2c": { - "type": "map", - "key": {}, - "value": { - "type": "structure", - "required": [ - "name" - ], - "members": { - "name": {}, - "value": {} - } - } - }, - "S3b": { + "S3n": { "type": "list", "member": { "type": "structure", @@ -1768,10 +1813,6 @@ "name": "ConfigService", "cors": true }, - "connect": { - "name": "Connect", - "cors": true - }, "cur": { "name": "CUR", "cors": true @@ -2209,7 +2250,8 @@ "name": "TranscribeService" }, "connect": { - "name": "Connect" + "name": "Connect", + "cors": true }, "acmpca": { "prefix": "acm-pca", @@ -2224,7 +2266,7 @@ }, "iotanalytics": { "name": "IoTAnalytics", - "cors": true + "cors": true }, "iot1clickdevicesservice": { "prefix": "iot1click-devices", @@ -2877,7 +2919,7 @@ convertToBuffer: convertToBuffer, }; - },{"buffer/":83}],12:[function(require,module,exports){ + },{"buffer/":80}],12:[function(require,module,exports){ var hashUtils = require('./browserHashUtils'); /** @@ -3128,7 +3170,7 @@ return cmn(c ^ (b | (~d)), a, b, x, s, t); } - },{"./browserHashUtils":11,"buffer/":83}],14:[function(require,module,exports){ + },{"./browserHashUtils":11,"buffer/":80}],14:[function(require,module,exports){ var Buffer = require('buffer/').Buffer; var hashUtils = require('./browserHashUtils'); @@ -3296,7 +3338,7 @@ } }; - },{"./browserHashUtils":11,"buffer/":83}],15:[function(require,module,exports){ + },{"./browserHashUtils":11,"buffer/":80}],15:[function(require,module,exports){ var Buffer = require('buffer/').Buffer; var hashUtils = require('./browserHashUtils'); @@ -3537,7 +3579,7 @@ state[7] += state7; }; - },{"./browserHashUtils":11,"buffer/":83}],16:[function(require,module,exports){ + },{"./browserHashUtils":11,"buffer/":80}],16:[function(require,module,exports){ (function (process){ var util = require('./util'); @@ -3580,7 +3622,7 @@ } }).call(this,require('_process')) - },{"./browserCryptoLib":10,"./core":18,"./credentials":19,"./credentials/chainable_temporary_credentials":20,"./credentials/cognito_identity_credentials":21,"./credentials/credential_provider_chain":22,"./credentials/saml_credentials":23,"./credentials/temporary_credentials":24,"./credentials/web_identity_credentials":25,"./event-stream/buffered-create-event-stream":27,"./http/xhr":35,"./realclock/browserClock":52,"./util":71,"./xml/browser_parser":72,"_process":87,"buffer/":83,"querystring/":94,"url/":96}],17:[function(require,module,exports){ + },{"./browserCryptoLib":10,"./core":18,"./credentials":19,"./credentials/chainable_temporary_credentials":20,"./credentials/cognito_identity_credentials":21,"./credentials/credential_provider_chain":22,"./credentials/saml_credentials":23,"./credentials/temporary_credentials":24,"./credentials/web_identity_credentials":25,"./event-stream/buffered-create-event-stream":27,"./http/xhr":35,"./realclock/browserClock":52,"./util":71,"./xml/browser_parser":72,"_process":85,"buffer/":80,"querystring/":92,"url/":94}],17:[function(require,module,exports){ var AWS = require('./core'); require('./credentials'); require('./credentials/credential_provider_chain'); @@ -4280,7 +4322,7 @@ return new AWS.EndpointCache(AWS.config.endpointCacheSize); }, true); - },{"../vendor/endpoint-cache":105,"./api_loader":9,"./config":17,"./event_listeners":33,"./http":34,"./json/builder":36,"./json/parser":37,"./model/api":38,"./model/operation":40,"./model/paginator":41,"./model/resource_waiter":42,"./model/shape":43,"./param_validator":44,"./protocol/json":46,"./protocol/query":47,"./protocol/rest":48,"./protocol/rest_json":49,"./protocol/rest_xml":50,"./request":55,"./resource_waiter":56,"./response":57,"./sequential_executor":58,"./service":59,"./signers/request_signer":63,"./util":71,"./xml/builder":73}],19:[function(require,module,exports){ + },{"../vendor/endpoint-cache":103,"./api_loader":9,"./config":17,"./event_listeners":33,"./http":34,"./json/builder":36,"./json/parser":37,"./model/api":38,"./model/operation":40,"./model/paginator":41,"./model/resource_waiter":42,"./model/shape":43,"./param_validator":44,"./protocol/json":46,"./protocol/query":47,"./protocol/rest":48,"./protocol/rest_json":49,"./protocol/rest_xml":50,"./request":55,"./resource_waiter":56,"./response":57,"./sequential_executor":58,"./service":59,"./signers/request_signer":63,"./util":71,"./xml/builder":73}],19:[function(require,module,exports){ var AWS = require('./core'); /** @@ -6005,7 +6047,7 @@ }; }).call(this,require('_process')) - },{"./core":18,"./util":71,"_process":87}],27:[function(require,module,exports){ + },{"./core":18,"./util":71,"_process":85}],27:[function(require,module,exports){ var eventMessageChunker = require('../event-stream/event-message-chunker').eventMessageChunker; var parseEvent = require('./parse-event').parseEvent; @@ -7049,7 +7091,7 @@ }) }; - },{"./core":18,"./discover_endpoint":26,"./protocol/json":46,"./protocol/query":47,"./protocol/rest":48,"./protocol/rest_json":49,"./protocol/rest_xml":50,"./sequential_executor":58,"util":99}],34:[function(require,module,exports){ + },{"./core":18,"./discover_endpoint":26,"./protocol/json":46,"./protocol/query":47,"./protocol/rest":48,"./protocol/rest_json":49,"./protocol/rest_xml":50,"./sequential_executor":58,"util":97}],34:[function(require,module,exports){ var AWS = require('./core'); var inherit = AWS.util.inherit; @@ -10187,7 +10229,7 @@ AWS.util.mixin(AWS.Request, AWS.SequentialExecutor); }).call(this,require('_process')) - },{"./core":18,"./state_machine":70,"_process":87,"jmespath":86}],56:[function(require,module,exports){ + },{"./core":18,"./state_machine":70,"_process":85,"jmespath":84}],56:[function(require,module,exports){ /** * Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved. * @@ -10393,7 +10435,7 @@ } }); - },{"./core":18,"jmespath":86}],57:[function(require,module,exports){ + },{"./core":18,"jmespath":84}],57:[function(require,module,exports){ var AWS = require('./core'); var inherit = AWS.util.inherit; var jmespath = require('jmespath'); @@ -10596,7 +10638,7 @@ }); - },{"./core":18,"jmespath":86}],58:[function(require,module,exports){ + },{"./core":18,"jmespath":84}],58:[function(require,module,exports){ var AWS = require('./core'); /** @@ -11657,7 +11699,7 @@ module.exports = AWS.Service; }).call(this,require('_process')) - },{"./core":18,"./model/api":38,"./region_config":53,"_process":87}],60:[function(require,module,exports){ + },{"./core":18,"./model/api":38,"./region_config":53,"_process":85}],60:[function(require,module,exports){ var AWS = require('../core'); AWS.util.update(AWS.CognitoIdentity.prototype, { @@ -11805,7 +11847,7 @@ }); }).call(this,require('_process')) - },{"../core":18,"../region_config":53,"_process":87}],62:[function(require,module,exports){ + },{"../core":18,"../region_config":53,"_process":85}],62:[function(require,module,exports){ var AWS = require('../core'); var inherit = AWS.util.inherit; @@ -13674,7 +13716,7 @@ module.exports = util; }).call(this,require('_process'),require("timers").setImmediate) - },{"../apis/metadata.json":4,"./core":18,"_process":87,"fs":79,"timers":95,"uuid":100}],72:[function(require,module,exports){ + },{"../apis/metadata.json":4,"./core":18,"_process":85,"fs":79,"timers":93,"uuid":98}],72:[function(require,module,exports){ var util = require('../util'); var Shape = require('../model/shape'); @@ -16026,7 +16068,7 @@ } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) - },{"base64-js":78,"buffer":80,"ieee754":82,"isarray":85}],81:[function(require,module,exports){ + },{"base64-js":78,"buffer":80,"ieee754":82,"isarray":83}],81:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -16417,17 +16459,13 @@ } },{}],83:[function(require,module,exports){ - arguments[4][80][0].apply(exports,arguments) - },{"base64-js":78,"buffer":80,"dup":80,"ieee754":84,"isarray":85}],84:[function(require,module,exports){ - arguments[4][82][0].apply(exports,arguments) - },{"dup":82}],85:[function(require,module,exports){ var toString = {}.toString; module.exports = Array.isArray || function (arr) { return toString.call(arr) == '[object Array]'; }; - },{}],86:[function(require,module,exports){ + },{}],84:[function(require,module,exports){ (function(exports) { "use strict"; @@ -18096,7 +18134,7 @@ exports.strictDeepEqual = strictDeepEqual; })(typeof exports === "undefined" ? this.jmespath = {} : exports); - },{}],87:[function(require,module,exports){ + },{}],85:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -18282,9 +18320,9 @@ }; process.umask = function() { return 0; }; - },{}],88:[function(require,module,exports){ + },{}],86:[function(require,module,exports){ (function (global){ - /*! https://mths.be/punycode v1.4.1 by @mathias */ + /*! https://mths.be/punycode v1.3.2 by @mathias */ ;(function(root) { /** Detect free variables */ @@ -18350,7 +18388,7 @@ * @returns {Error} Throws a `RangeError` with the applicable error message. */ function error(type) { - throw new RangeError(errors[type]); + throw RangeError(errors[type]); } /** @@ -18497,7 +18535,7 @@ /** * Bias adaptation function as per section 3.4 of RFC 3492. - * https://tools.ietf.org/html/rfc3492#section-3.4 + * http://tools.ietf.org/html/rfc3492#section-3.4 * @private */ function adapt(delta, numPoints, firstTime) { @@ -18772,7 +18810,7 @@ * @memberOf punycode * @type String */ - 'version': '1.4.1', + 'version': '1.3.2', /** * An object of methods to convert from JavaScript's internal character * representation (UCS-2) to Unicode code points, and back. @@ -18802,24 +18840,21 @@ return punycode; }); } else if (freeExports && freeModule) { - if (module.exports == freeExports) { - // in Node.js, io.js, or RingoJS v0.8.0+ + if (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+ freeModule.exports = punycode; - } else { - // in Narwhal or RingoJS v0.7.0- + } else { // in Narwhal or RingoJS v0.7.0- for (key in punycode) { punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); } } - } else { - // in Rhino or a web browser + } else { // in Rhino or a web browser root.punycode = punycode; } }(this)); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) - },{}],89:[function(require,module,exports){ + },{}],87:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -18905,7 +18940,7 @@ return Object.prototype.toString.call(xs) === '[object Array]'; }; - },{}],90:[function(require,module,exports){ + },{}],88:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -18992,13 +19027,13 @@ return res; }; - },{}],91:[function(require,module,exports){ + },{}],89:[function(require,module,exports){ 'use strict'; exports.decode = exports.parse = require('./decode'); exports.encode = exports.stringify = require('./encode'); - },{"./decode":89,"./encode":90}],92:[function(require,module,exports){ + },{"./decode":87,"./encode":88}],90:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -19080,7 +19115,7 @@ return obj; }; - },{}],93:[function(require,module,exports){ + },{}],91:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -19146,9 +19181,9 @@ encodeURIComponent(stringifyPrimitive(obj)); }; - },{}],94:[function(require,module,exports){ - arguments[4][91][0].apply(exports,arguments) - },{"./decode":92,"./encode":93,"dup":91}],95:[function(require,module,exports){ + },{}],92:[function(require,module,exports){ + arguments[4][89][0].apply(exports,arguments) + },{"./decode":90,"./encode":91,"dup":89}],93:[function(require,module,exports){ (function (setImmediate,clearImmediate){ var nextTick = require('process/browser.js').nextTick; var apply = Function.prototype.apply; @@ -19227,7 +19262,7 @@ delete immediateIds[id]; }; }).call(this,require("timers").setImmediate,require("timers").clearImmediate) - },{"process/browser.js":87,"timers":95}],96:[function(require,module,exports){ + },{"process/browser.js":85,"timers":93}],94:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -19936,7 +19971,7 @@ return arg == null; } - },{"punycode":88,"querystring":91}],97:[function(require,module,exports){ + },{"punycode":86,"querystring":89}],95:[function(require,module,exports){ if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { @@ -19961,14 +19996,14 @@ } } - },{}],98:[function(require,module,exports){ + },{}],96:[function(require,module,exports){ module.exports = function isBuffer(arg) { return arg && typeof arg === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.readUInt8 === 'function'; } - },{}],99:[function(require,module,exports){ + },{}],97:[function(require,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -20558,7 +20593,7 @@ } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) - },{"./support/isBuffer":98,"_process":87,"inherits":97}],100:[function(require,module,exports){ + },{"./support/isBuffer":96,"_process":85,"inherits":95}],98:[function(require,module,exports){ var v1 = require('./v1'); var v4 = require('./v4'); @@ -20568,7 +20603,7 @@ module.exports = uuid; - },{"./v1":103,"./v4":104}],101:[function(require,module,exports){ + },{"./v1":101,"./v4":102}],99:[function(require,module,exports){ /** * Convert array of 16 byte values to UUID string format of the form: * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX @@ -20594,7 +20629,7 @@ module.exports = bytesToUuid; - },{}],102:[function(require,module,exports){ + },{}],100:[function(require,module,exports){ // Unique ID creation requires a high quality random # generator. In the // browser this is a little complicated due to unknown quality of Math.random() // and inconsistent support for the `crypto` API. We do the best we can via @@ -20630,7 +20665,7 @@ }; } - },{}],103:[function(require,module,exports){ + },{}],101:[function(require,module,exports){ var rng = require('./lib/rng'); var bytesToUuid = require('./lib/bytesToUuid'); @@ -20741,7 +20776,7 @@ module.exports = v1; - },{"./lib/bytesToUuid":101,"./lib/rng":102}],104:[function(require,module,exports){ + },{"./lib/bytesToUuid":99,"./lib/rng":100}],102:[function(require,module,exports){ var rng = require('./lib/rng'); var bytesToUuid = require('./lib/bytesToUuid'); @@ -20772,7 +20807,7 @@ module.exports = v4; - },{"./lib/bytesToUuid":101,"./lib/rng":102}],105:[function(require,module,exports){ + },{"./lib/bytesToUuid":99,"./lib/rng":100}],103:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var LRU_1 = require("./utils/LRU"); @@ -20842,7 +20877,7 @@ return EndpointCache; }()); exports.EndpointCache = EndpointCache; - },{"./utils/LRU":106}],106:[function(require,module,exports){ + },{"./utils/LRU":104}],104:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var LinkedListNode = /** @class */ (function () { @@ -20950,7 +20985,7 @@ return LRUCache; }()); exports.LRUCache = LRUCache; - },{}],107:[function(require,module,exports){ + },{}],105:[function(require,module,exports){ // AWS SDK for JavaScript v2.553.0 // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // License at https://sdk.amazonaws.com/js/BUNDLE_LICENSE.txt @@ -20985,6 +21020,6 @@ AWS.apiLoader.services['sts']['2011-06-15'] = require('../apis/sts-2011-06-15.min'); - },{"../apis/connect-2017-02-15.min":3,"../apis/sts-2011-06-15.min":5,"./browser_loader":16,"./core":18,"./services/sts":61}]},{},[107]); + },{"../apis/connect-2017-02-15.min":3,"../apis/sts-2011-06-15.min":5,"./browser_loader":16,"./core":18,"./services/sts":61}]},{},[105]); \ No newline at end of file diff --git a/src/client.js b/src/client.js index b03f8ae6..c6d0e84f 100644 --- a/src/client.js +++ b/src/client.js @@ -23,6 +23,7 @@ 'updateAgentConfiguration', 'acceptContact', 'createOutboundContact', + 'clearContact', 'completeContact', 'destroyContact', 'notifyContactIssue', @@ -217,7 +218,7 @@ }; AWSClient.prototype._requiresAuthenticationParam = function(method) { - return method !== connect.ClientMethods.COMPLETE_CONTACT; + return method !== connect.ClientMethods.COMPLETE_CONTACT && method !== connect.ClientMethods.CLEAR_CONTACT; }; AWSClient.prototype._translateParams = function(method, params) { diff --git a/src/core.js b/src/core.js index b2131b53..fd04a565 100644 --- a/src/core.js +++ b/src/core.js @@ -1005,7 +1005,10 @@ connect.ContactEvents.ACW) .assoc(connect.values(connect.CONTACT_ACTIVE_STATES), connect.values(connect.relativeComplement(connect.CONTACT_ACTIVE_STATES, connect.ContactStateType)), - connect.ContactEvents.ENDED); + connect.ContactEvents.ENDED) + .assoc(connect.EventGraph.ANY, + connect.values(connect.AgentErrorStates), + connect.ContactEvents.ERROR); /**-----------------------------------------------------------------------*/ connect.core.getClient = function () { diff --git a/src/index.d.ts b/src/index.d.ts index e7702ada..c36b758b 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -486,6 +486,9 @@ declare namespace connect { */ onAfterCallWork(callback: AgentCallback): void; + /** Get the agent's current 'AgentAvailabilityState' object indicating their actual state type. */ + getAvailabilityState(): AgentAvailabilityState; + /** Get the agent's current `AgentState` object indicating their availability state type. */ getState(): AgentState; @@ -649,6 +652,16 @@ declare namespace connect { readonly name: string; } + /** + * An object containing the current Agent state + */ + interface AgentAvailabilityState { + /** The name of the agent's actual state. */ + readonly state: string; + /** Date indicating when the agent went into the current state. */ + readonly timeStamp: Date; + } + /** An object containing the current Agent state. */ interface AgentState { /** The agent's current state ARN. */ @@ -816,6 +829,14 @@ declare namespace connect { */ onACW(callback: ContactCallback): void; + /** + * Subscribe a method to be invoked whenever the contact is missed. + * This is an event which is fired when a contact is put in state "missed" by the backend, which happens when the agent does not answer for a certain amount of time, when the agent rejects the call, or when the other participant hangs up before the agent can accept. + * + * @param callback A callback to receive the `Contact` API object instance. + */ + onMissed(callback: ContactCallback): void; + /** * Subscribe a method to be invoked when the contact is connected. * @@ -926,6 +947,13 @@ declare namespace connect { */ destroy(callbacks?: SuccessFailOptions): void; + /** + * Clear the contact. + * + * @param callbacks Success and failure callbacks to determine whether the operation was successful. + */ + clear(callbacks: SuccessFailOptions): void; + /** * This is an API that completes this contact entirely. * That means that this should only be used for non-monitoring agent connections.