From 1c26b7e736db2d92a30e04b6e0a7dbdec4fc5626 Mon Sep 17 00:00:00 2001 From: ctwomblyamzn <58004580+ctwomblyamzn@users.noreply.github.com> Date: Fri, 20 Dec 2019 16:26:17 -0500 Subject: [PATCH] Added completeContact, updated package.json to ready for publishing to NPM (#194) * Source import of AmazonConnectStreams@1.4. * Generated Config and other build logic, if any. * Importing streams 1.4 cr https://code.amazon.com/reviews/CR-15974105 * Use CompleteContact for ended/acw chat contacts cr https://code.amazon.com/reviews/CR-15432131 * Expose CompleteContact as its own API on Streams cr https://code.amazon.com/reviews/CR-16068716 * removed merge conflicts from documentation.md * updated release-watch command and .gitignore * fixed onMissed * merged with updated internal streams, updated package.json fields for publishing on npm * removed IMPORT_GUIDE.md * updated version in package.json * remove showcase file * new package-lock.json * Revert "Expose CompleteContact as its own API on Streams" This reverts commit 192fdecfca82d4eaac5eb50c44acfb86ac5d1db0. * Revert "Use CompleteContact for ended/acw chat contacts" This reverts commit e28cd20c4ef86365658827fcf35f1c40cf3397d7. * updated release files for completeContact revert Co-authored-by: baskruegamzn <58051318+baskruegamzn@users.noreply.github.com> --- .gitignore | 1 - package-lock.json | 171 ++++++++++++++++++--------------- package.json | 15 ++- release/connect-streams-min.js | 2 +- release/connect-streams.js | 4 + src/core.js | 3 + 6 files changed, 110 insertions(+), 86 deletions(-) diff --git a/.gitignore b/.gitignore index 379236dc..d08f1c46 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ # dependencies node_modules -release /.pnp .pnp.js diff --git a/package-lock.json b/package-lock.json index 34194d07..1be55e62 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,13 +1,13 @@ { "name": "amazon-connect-streams", - "version": "1.4.0", + "version": "1.4.3", "lockfileVersion": 1, "requires": true, "dependencies": { "@sinonjs/commons": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.6.0.tgz", - "integrity": "sha512-w4/WHG7C4WWFyE5geCieFJF6MZkbW4VAriol5KlmQXpAQdxvV0p26sqNZOW6Qyw6Y0l9K4g+cHvvczR2sEEpqg==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.7.0.tgz", + "integrity": "sha512-qbk9AP+cZUsKdW1GJsBpxPKFmCJ0T8swwzVje3qFd+AkQb74Q/tiuzrdfFg8AD2g5HH/XbE/I8Uc1KYHVYWfhg==", "dev": true, "requires": { "type-detect": "4.0.8" @@ -428,6 +428,16 @@ "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", "dev": true }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dev": true, + "optional": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, "body-parser": { "version": "1.8.4", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.8.4.tgz", @@ -1455,9 +1465,9 @@ } }, "ext": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/ext/-/ext-1.2.0.tgz", - "integrity": "sha512-0ccUQK/9e3NreLFg6K6np8aPyRgwycx+oFGtfx1dSp7Wj00Ozw9r05FgBRlzjf2XBM7LAzwgLyDscRrtSU91hA==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/ext/-/ext-1.4.0.tgz", + "integrity": "sha512-Key5NIsUxdqKg3vIsdw9dSuXpPCQ297y6wBjL30edxwPgt2E44WcWBZey/ZvUc6sERLTxKdyCu4gZFmUbk1Q7A==", "dev": true, "requires": { "type": "^2.0.0" @@ -1590,6 +1600,13 @@ "websocket-driver": ">=0.3.6" } }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "dev": true, + "optional": true + }, "filename-regex": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", @@ -1724,14 +1741,15 @@ "dev": true }, "fsevents": { - "version": "1.2.9", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.9.tgz", - "integrity": "sha512-oeyj2H3EjjonWcFjD5NvZNE9Rqe4UW+nQBU2HNeKw0koVLEFIhtyETyAakeAM3de7Z/SW5kcA+fZUait9EApnw==", + "version": "1.2.11", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.11.tgz", + "integrity": "sha512-+ux3lx6peh0BpvY0JebGyZoiR4D+oYzdPZMKJwkZ+sFkNJzpL7tXc/wehS49gUAxg3tmMHPHZkA8JU2rhhgDHw==", "dev": true, "optional": true, "requires": { + "bindings": "^1.5.0", "nan": "^2.12.1", - "node-pre-gyp": "^0.12.0" + "node-pre-gyp": "*" }, "dependencies": { "abbrev": { @@ -1743,8 +1761,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -1765,21 +1782,19 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "chownr": { - "version": "1.1.1", + "version": "1.1.3", "bundled": true, "dev": true, "optional": true @@ -1787,20 +1802,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -1809,7 +1821,7 @@ "optional": true }, "debug": { - "version": "4.1.1", + "version": "3.2.6", "bundled": true, "dev": true, "optional": true, @@ -1836,12 +1848,12 @@ "optional": true }, "fs-minipass": { - "version": "1.2.5", + "version": "1.2.7", "bundled": true, "dev": true, "optional": true, "requires": { - "minipass": "^2.2.1" + "minipass": "^2.6.0" } }, "fs.realpath": { @@ -1867,7 +1879,7 @@ } }, "glob": { - "version": "7.1.3", + "version": "7.1.6", "bundled": true, "dev": true, "optional": true, @@ -1896,7 +1908,7 @@ } }, "ignore-walk": { - "version": "3.0.1", + "version": "3.0.3", "bundled": true, "dev": true, "optional": true, @@ -1915,10 +1927,9 @@ } }, "inherits": { - "version": "2.0.3", + "version": "2.0.4", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -1930,7 +1941,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -1945,7 +1955,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -1953,56 +1962,53 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { - "version": "2.3.5", + "version": "2.9.0", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" } }, "minizlib": { - "version": "1.2.1", + "version": "1.3.3", "bundled": true, "dev": true, "optional": true, "requires": { - "minipass": "^2.2.1" + "minipass": "^2.9.0" } }, "mkdirp": { "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } }, "ms": { - "version": "2.1.1", + "version": "2.1.2", "bundled": true, "dev": true, "optional": true }, "needle": { - "version": "2.3.0", + "version": "2.4.0", "bundled": true, "dev": true, "optional": true, "requires": { - "debug": "^4.1.0", + "debug": "^3.2.6", "iconv-lite": "^0.4.4", "sax": "^1.2.4" } }, "node-pre-gyp": { - "version": "0.12.0", + "version": "0.14.0", "bundled": true, "dev": true, "optional": true, @@ -2016,7 +2022,7 @@ "rc": "^1.2.7", "rimraf": "^2.6.1", "semver": "^5.3.0", - "tar": "^4" + "tar": "^4.4.2" } }, "nopt": { @@ -2030,13 +2036,22 @@ } }, "npm-bundled": { - "version": "1.0.6", + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "npm-normalize-package-bin": "^1.0.1" + } + }, + "npm-normalize-package-bin": { + "version": "1.0.1", "bundled": true, "dev": true, "optional": true }, "npm-packlist": { - "version": "1.4.1", + "version": "1.4.7", "bundled": true, "dev": true, "optional": true, @@ -2060,8 +2075,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -2073,7 +2087,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -2107,7 +2120,7 @@ "optional": true }, "process-nextick-args": { - "version": "2.0.0", + "version": "2.0.1", "bundled": true, "dev": true, "optional": true @@ -2148,7 +2161,7 @@ } }, "rimraf": { - "version": "2.6.3", + "version": "2.7.1", "bundled": true, "dev": true, "optional": true, @@ -2159,8 +2172,7 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -2175,7 +2187,7 @@ "optional": true }, "semver": { - "version": "5.7.0", + "version": "5.7.1", "bundled": true, "dev": true, "optional": true @@ -2196,7 +2208,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -2216,7 +2227,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -2228,18 +2238,18 @@ "optional": true }, "tar": { - "version": "4.4.8", + "version": "4.4.13", "bundled": true, "dev": true, "optional": true, "requires": { "chownr": "^1.1.1", "fs-minipass": "^1.2.5", - "minipass": "^2.3.4", - "minizlib": "^1.1.1", + "minipass": "^2.8.6", + "minizlib": "^1.2.1", "mkdirp": "^0.5.0", "safe-buffer": "^5.1.2", - "yallist": "^3.0.2" + "yallist": "^3.0.3" } }, "util-deprecate": { @@ -2260,14 +2270,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { - "version": "3.0.3", + "version": "3.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, @@ -4512,15 +4520,15 @@ "dev": true }, "nise": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/nise/-/nise-1.5.2.tgz", - "integrity": "sha512-/6RhOUlicRCbE9s+94qCUsyE+pKlVJ5AhIv+jEE7ESKwnbXqulKZ1FYU+XAtHHWE9TinYvAxDUJAb912PwPoWA==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/nise/-/nise-1.5.3.tgz", + "integrity": "sha512-Ymbac/94xeIrMf59REBPOv0thr+CJVFMhrlAkW/gjCIE58BGQdCj0x7KRCb3yz+Ga2Rz3E9XXSvUyyxqqhjQAQ==", "dev": true, "requires": { "@sinonjs/formatio": "^3.2.1", "@sinonjs/text-encoding": "^0.7.1", "just-extend": "^4.0.2", - "lolex": "^4.1.0", + "lolex": "^5.0.1", "path-to-regexp": "^1.7.0" }, "dependencies": { @@ -4535,10 +4543,13 @@ } }, "lolex": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-4.2.0.tgz", - "integrity": "sha512-gKO5uExCXvSm6zbF562EvM+rd1kQDnB9AZBbiQVzf1ZmdDpxUSvpnAaVOP83N/31mRK8Ml8/VE8DMvsAZQ+7wg==", - "dev": true + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz", + "integrity": "sha512-h4hmjAvHTmd+25JSwrtTIuwbKdwg5NzZVRMLn9saij4SZaepCrTCxPr35H/3bjwfMJtN+t3CX8672UIkglz28A==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1.7.0" + } } } }, @@ -5336,9 +5347,9 @@ "dev": true }, "resolve": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz", - "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.14.1.tgz", + "integrity": "sha512-fn5Wobh4cxbLzuHaE+nphztHy43/b++4M6SsGFC2gB8uYwf0C8LcarfCz1un7UTW8OFQg9iNjZ4xpcFVGebDPg==", "dev": true, "requires": { "path-parse": "^1.0.6" @@ -6166,9 +6177,9 @@ "dev": true }, "uglify-js": { - "version": "3.6.9", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.9.tgz", - "integrity": "sha512-pcnnhaoG6RtrvHJ1dFncAe8Od6Nuy30oaJ82ts6//sGSXOP5UjBMEthiProjXmMNHOfd93sqlkztifFMcb+4yw==", + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.2.tgz", + "integrity": "sha512-uhRwZcANNWVLrxLfNFEdltoPNhECUR3lc+UdJoG9CBpMcSnKyWA94tc3eAujB1GcMY5Uwq8ZMp4qWpxWYDQmaA==", "dev": true, "requires": { "commander": "~2.20.3", diff --git a/package.json b/package.json index 839dfa1d..1e2e3b78 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,13 @@ { "name": "amazon-connect-streams", - "version": "1.4.0", + "version": "1.4.3", "description": "Amazon Connect Streams Library", + "engines": { + "node": ">=10.0.0 <12.0.0 || >=13.0.0" + }, + "directories": { + "lib": "./src" + }, "main": "release/connect-streams.js", "repository": { "type": "git", @@ -18,7 +24,8 @@ "release": "gulp script", "server": "gulp webserver", "watch": "gulp watch", - "clean": "rm -rf build/ node_modules build" + "clean": "rm -rf build/ node_modules build package-lock.json", + "release-watch": "npm run release && npm run watch" }, "author": "Amazon Web Services", "license": "Apache-2.0", @@ -38,9 +45,9 @@ "gulp-rev": "^8.1.1", "gulp-uglify": "^3.0.0", "gulp-watch": "^5.0.1", + "gulp-webserver": "^0.9.1", "jshint": "^2.9.7", "pump": "^3.0.0", - "sinon": "^4.5.0", - "gulp-webserver": "^0.9.1" + "sinon": "^4.5.0" } } diff --git a/release/connect-streams-min.js b/release/connect-streams-min.js index 67a58c1a..c3a02334 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){var r=new e;r.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,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}var i=new DataView(new ArrayBuffer(16));for(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=t[0],r=t[1],o=t[2],i=t[3];n=s(n,r,o,i,e.getUint32(0,!0),7,3614090360),i=s(i,n,r,o,e.getUint32(4,!0),12,3905402710),o=s(o,i,n,r,e.getUint32(8,!0),17,606105819),r=s(r,o,i,n,e.getUint32(12,!0),22,3250441966),n=s(n,r,o,i,e.getUint32(16,!0),7,4118548399),i=s(i,n,r,o,e.getUint32(20,!0),12,1200080426),o=s(o,i,n,r,e.getUint32(24,!0),17,2821735955),r=s(r,o,i,n,e.getUint32(28,!0),22,4249261313),n=s(n,r,o,i,e.getUint32(32,!0),7,1770035416),i=s(i,n,r,o,e.getUint32(36,!0),12,2336552879),o=s(o,i,n,r,e.getUint32(40,!0),17,4294925233),r=s(r,o,i,n,e.getUint32(44,!0),22,2304563134),n=s(n,r,o,i,e.getUint32(48,!0),7,1804603682),i=s(i,n,r,o,e.getUint32(52,!0),12,4254626195),o=s(o,i,n,r,e.getUint32(56,!0),17,2792965006),n=u(n,r=s(r,o,i,n,e.getUint32(60,!0),22,1236535329),o,i,e.getUint32(4,!0),5,4129170786),i=u(i,n,r,o,e.getUint32(24,!0),9,3225465664),o=u(o,i,n,r,e.getUint32(44,!0),14,643717713),r=u(r,o,i,n,e.getUint32(0,!0),20,3921069994),n=u(n,r,o,i,e.getUint32(20,!0),5,3593408605),i=u(i,n,r,o,e.getUint32(40,!0),9,38016083),o=u(o,i,n,r,e.getUint32(60,!0),14,3634488961),r=u(r,o,i,n,e.getUint32(16,!0),20,3889429448),n=u(n,r,o,i,e.getUint32(36,!0),5,568446438),i=u(i,n,r,o,e.getUint32(56,!0),9,3275163606),o=u(o,i,n,r,e.getUint32(12,!0),14,4107603335),r=u(r,o,i,n,e.getUint32(32,!0),20,1163531501),n=u(n,r,o,i,e.getUint32(52,!0),5,2850285829),i=u(i,n,r,o,e.getUint32(8,!0),9,4243563512),o=u(o,i,n,r,e.getUint32(28,!0),14,1735328473),n=l(n,r=u(r,o,i,n,e.getUint32(48,!0),20,2368359562),o,i,e.getUint32(20,!0),4,4294588738),i=l(i,n,r,o,e.getUint32(32,!0),11,2272392833),o=l(o,i,n,r,e.getUint32(44,!0),16,1839030562),r=l(r,o,i,n,e.getUint32(56,!0),23,4259657740),n=l(n,r,o,i,e.getUint32(4,!0),4,2763975236),i=l(i,n,r,o,e.getUint32(16,!0),11,1272893353),o=l(o,i,n,r,e.getUint32(28,!0),16,4139469664),r=l(r,o,i,n,e.getUint32(40,!0),23,3200236656),n=l(n,r,o,i,e.getUint32(52,!0),4,681279174),i=l(i,n,r,o,e.getUint32(0,!0),11,3936430074),o=l(o,i,n,r,e.getUint32(12,!0),16,3572445317),r=l(r,o,i,n,e.getUint32(24,!0),23,76029189),n=l(n,r,o,i,e.getUint32(36,!0),4,3654602809),i=l(i,n,r,o,e.getUint32(48,!0),11,3873151461),o=l(o,i,n,r,e.getUint32(60,!0),16,530742520),n=p(n,r=l(r,o,i,n,e.getUint32(8,!0),23,3299628645),o,i,e.getUint32(0,!0),6,4096336452),i=p(i,n,r,o,e.getUint32(28,!0),10,1126891415),o=p(o,i,n,r,e.getUint32(56,!0),15,2878612391),r=p(r,o,i,n,e.getUint32(20,!0),21,4237533241),n=p(n,r,o,i,e.getUint32(48,!0),6,1700485571),i=p(i,n,r,o,e.getUint32(12,!0),10,2399980690),o=p(o,i,n,r,e.getUint32(40,!0),15,4293915773),r=p(r,o,i,n,e.getUint32(4,!0),21,2240044497),n=p(n,r,o,i,e.getUint32(32,!0),6,1873313359),i=p(i,n,r,o,e.getUint32(60,!0),10,4264355552),o=p(o,i,n,r,e.getUint32(24,!0),15,2734768916),r=p(r,o,i,n,e.getUint32(52,!0),21,1309151649),n=p(n,r,o,i,e.getUint32(16,!0),6,4149444226),i=p(i,n,r,o,e.getUint32(44,!0),10,3174756917),o=p(o,i,n,r,e.getUint32(8,!0),15,718787259),r=p(r,o,i,n,e.getUint32(36,!0),21,3951481745),t[0]=n+t[0]&4294967295,t[1]=r+t[1]&4294967295,t[2]=o+t[2]&4294967295,t[3]=i+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,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}var n,r,o=this.h0,i=this.h1,s=this.h2,a=this.h3,c=this.h4;for(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,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=this.buffer,t=this.state,n=t[0],r=t[1],o=t[2],i=t[3],s=t[4],a=t[5],c=t[6],u=t[7],l=0;l<64;l++){if(l<16)this.temp[l]=(255&e[4*l])<<24|(255&e[4*l+1])<<16|(255&e[4*l+2])<<8|255&e[4*l+3];else{var p=this.temp[l-2],h=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,f=((p=this.temp[l-15])>>>7|p<<25)^(p>>>18|p<<14)^p>>>3;this.temp[l]=(h+this.temp[l-7]|0)+(f+this.temp[l-16]|0)}var d=(((s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7))+(s&a^~s&c)|0)+(u+(m[l]+this.temp[l]|0)|0)|0,g=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&r^n&o^r&o)|0;u=c,c=a,a=s,s=i+d|0,i=o,o=r,r=n,n=d+g|0}t[0]+=n,t[1]+=r,t[2]+=o,t[3]+=i,t[4]+=s,t[5]+=a,t[6]+=c,t[7]+=u}},{"./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");if(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){e=e&&o("Could not load credentials from "+n.credentials.constructor.name,e);r(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){if(o.util.hideProperties(this,["secretAccessKey"]),this.expired=!1,this.expireTime=null,this.refreshCallbacks=[],1===arguments.length&&"object"==typeof e){var r=e.credentials||e;this.accessKeyId=r.accessKeyId,this.secretAccessKey=r.secretAccessKey,this.sessionToken=r.sessionToken}else 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=this;if(r.util.isBrowser()&&!e.params.IdentityId){var t=e.getStorage("id");if(t&&e.params.Logins){var n=Object.keys(e.params.Logins);0!==(e.getStorage("providers")||"").split(",").filter(function(e){return-1!==n.indexOf(e)}).length&&(e.params.IdentityId=t)}else t&&(e.params.IdentityId=t)}},createClients:function(){var e=this._clientConfig;if(this.webIdentityCredentials=this.webIdentityCredentials||new r.WebIdentityCredentials(this.params,e),!this.cognito){var t=r.util.merge({},e);t.params=this.params,this.cognito=new o(t)}this.sts=this.sts||new i(e)},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=this;if(0===o.providers.length)return e(new Error("No providers")),o;if(1===o.resolveCallbacks.push(e)){var i=0,s=o.providers.slice(0);!function t(n,r){if(!n&&r||i===s.length)return a.util.arrayEach(o.resolveCallbacks,function(e){e(n,r)}),void(o.resolveCallbacks.length=0);var e=s[i++];(r="function"==typeof e?e.call():e).get?r.get(function(e){t(e,e?null:r)}):t(null,r)}()}return o}}),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(){if(!this.service){var e=r.util.merge({},this._clientConfig);e.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=n.maxRetries&&(e.MaxRetriesExceeded=1),u.emit("apiCall",[e])}})},setupRequestListeners:function(){},getSignerClass:function(e){var t,n=null,r="";e&&(r=(n=(e.service.api.operations||{})[e.operation]||null)?n.authtype:"");return 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=a(l.Service,n||{});if("string"==typeof e){l.Service.addVersions(r,t);var o=r.serviceIdentifier||e;r.serviceIdentifier=o}else r.prototype.api=e,l.Service.defineMethods(r);if(l.SequentialExecutor.call(this.prototype),!this.prototype.publisher&&l.util.clientSideMonitoring){var i=l.util.clientSideMonitoring.Publisher,s=(0,l.util.clientSideMonitoring.configProvider)();this.prototype.publisher=new i(s),s.enabled&&(l.Service._clientSideMonitoring=!0)}return l.SequentialExecutor.call(r.prototype),l.Service.addDefaultMonitoringListeners(r.prototype),r},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){var t,n,r=0,o=0;for(n=0;n>>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(){if(c>=t.size)r(null,o.digest(n));else{var e=c+524288;e>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,n){return 3*(t+n)/4-n}(0,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>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>18&63]+a[o>>12&63]+a[o>>6&63]+a[63&o]);return i.join("")}u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63},{}],79:[function(e,t,n){},{}],80:[function(F,e,j){(function(e,p){"use strict";var r=F("base64-js"),i=F("ieee754"),s=F("isarray");function n(){return p.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(n()=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 D(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return U(e).length;default:if(r)return D(e).length;t=(""+t).toLowerCase(),r=!0}}function d(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):2147483647=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,s=1,a=e.length,c=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;a/=s=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var l=-1;for(i=n;i>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function E(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function S(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<=C)return String.fromCharCode.apply(String,e);var n="",r=0;for(;rthis.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 _(this,t,n);case"utf8":case"utf-8":return S(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return w(this,t,n);case"base64":return E(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}.apply(this,arguments)},p.prototype.equals=function(e){if(!p.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===p.compare(this,e)},p.prototype.inspect=function(){var e="",t=j.INSPECT_MAX_BYTES;return 0t&&(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 y(this,e,t,n);case"utf8":case"utf-8":return u=t,l=n,q(D(e,(c=this).length-u),c,u,l);case"ascii":return v(this,e,t,n);case"latin1":case"binary":return v(this,e,t,n);case"base64":return i=this,s=t,a=n,q(U(e),i,s,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,e,t,n);default:if(p)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),p=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function T(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;oe.length)throw new RangeError("Index out of range")}function k(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 N(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 x(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 O(e,t,n,r,o){return o||x(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function L(e,t,n,r,o){return o||x(e,0,n,8),i.write(e,t,n,r,52,8),n+8}p.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):r>>8):k(this,e,t,!0),t+2},p.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):k(this,e,t,!1),t+2},p.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||R(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):N(this,e,t,!0),t+4},p.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||R(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):N(this,e,t,!1),t+4},p.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);R(this,e,t,n,o-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){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);R(this,e,t,n,o-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||R(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||R(this,e,t,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):k(this,e,t,!0),t+2},p.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):k(this,e,t,!1),t+2},p.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||R(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):N(this,e,t,!0),t+4},p.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||R(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):N(this,e,t,!1),t+4},p.prototype.writeFloatLE=function(e,t,n){return O(this,e,t,!0,n)},p.prototype.writeFloatBE=function(e,t,n){return O(this,e,t,!1,n)},p.prototype.writeDoubleLE=function(e,t,n){return L(this,e,t,!0,n)},p.prototype.writeDoubleBE=function(e,t,n){return L(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(i=t;i>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 U(e){return r.toByteArray(P(e))}function q(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:{},F("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(!function(e){return"number"==typeof e}(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,n=this._current,r=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-d)/s))&&A("overflow"),d+=c*s,!(c<(u=a<=m?b:m+E<=a?E:a-m));a+=v)s>w(y/(l=v-u))&&A("overflow"),s*=l;m=N(d-i,t=h.length+1,0==i),w(d/t)>y-g&&A("overflow"),g+=w(d/t),d%=t,h.splice(d++,0,g)}return R(h)}function m(e){var t,n,r,o,i,s,a,c,u,l,p,h,f,d,g,m=[];for(h=(e=I(e)).length,t=C,i=S,s=n=0;sw((y-n)/(f=r+1))&&A("overflow"),n+=(a-t)*f,t=a,s=0;sy&&A("overflow"),p==t){for(c=n,u=v;!(c<(l=u<=i?b:i+E<=u?E:u-i));u+=v)g=c-l,d=v-l,m.push(_(k(l+g%d,0))),c=w(g/d);m.push(_(k(c,0))),i=N(n,f,r==o),n=0,++r}++n,++t}return m.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,c,u=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=e;r=r.trim();var o=O.exec(r);if(o){var i=(o=o[0]).toLowerCase();this.protocol=i,r=r.substr(o.length)}if(n||o||r.match(/^\/\/[^@\/]+@[^@\/]+/)){var s="//"===r.substr(0,2);!s||o&&F[o]||(r=r.substr(2),this.slashes=!0)}if(!F[o]&&(s||o&&!j[o])){for(var a,c,u=-1,l=0;l>>((3&t)<<3)&255;return i}}},{}],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=t&&n||0,o=t||[],i=(e=e||{}).node||d,s=void 0!==e.clockseq?e.clockseq:g;if(null==i||null==s){var a=m();null==i&&(i=d=[1|a[0],a[1],a[2],a[3],a[4],a[5]]),null==s&&(s=g=16383&(a[6]<<8|a[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&&(s=s+1&16383),(l<0||v>>24&255,o[r++]=p>>>16&255,o[r++]=p>>>8&255,o[r++]=255&p;var h=c/4294967296*1e4&268435455;o[r++]=h>>>8&255,o[r++]=255&h,o[r++]=h>>>24&15|16,o[r++]=h>>>16&255,o[r++]=s>>>8|128,o[r++]=255&s;for(var f=0;f<6;++f)o[r+f]=i[f];return t||y(o)}},{"./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":n=n.toString(16);break;case"X":n=n.toString(16).toUpperCase()}n=/[def]/.test(i[8])&&i[3]&&0<=n?"+"+n:n,a=i[4]?"0"==i[4]?"0":i[4].charAt(1):" ",c=i[6]-String(n).length,s=i[6]?g(a,c):"",h.push(i[5]?n+s:s+n)}return h.join("")},f.cache={},f.parse=function(e){for(var t=e,n=[],r=[],o=0;t;){if(null!==(n=/^[^\x25]+/.exec(t)))r.push(n[0]);else if(null!==(n=/^\x25{2}/.exec(t)))r.push("%");else{if(null===(n=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(t)))throw"[sprintf] huh?";if(n[2]){o|=1;var i=[],s=n[2],a=[];if(null===(a=/^([a-z_][a-z_\d]*)/i.exec(s)))throw"[sprintf] huh?";for(i.push(a[1]);""!==(s=s.substring(a[0].length));)if(null!==(a=/^\.([a-z_][a-z_\d]*)/i.exec(s)))i.push(a[1]);else{if(null===(a=/^\[(\d+)\]/.exec(s)))throw"[sprintf] huh?";i.push(a[1])}n[2]=i}else o|=2;if(3===o)throw"[sprintf] mixing positional and named placeholders is not (yet) supported";r.push(n)}t=t.substring(n[0].length)}return r};function d(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function g(e,t){for(var n=[];0=this._logLevel&&(s[e.level]>=this._echoLevel&&a[e.getLevel()](e.toString()),e.line=this._lineCount++)},u.prototype.clearObjects=function(){for(var e=0;e=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){if(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","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){if(n&&n.failure){var 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=this,i=connect.getLog();if(e.authentication={authToken:this.authToken},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"]=t.authToken}).send(function(e,t){try{if(e){if(e.code===connect.CTIExceptions.UNAUTHORIZED_EXCEPTION)o.authFailure();else if(!o.accessDenied||e.code!==connect.CTIExceptions.ACCESS_DENIED_EXCEPTION&&403!==e.statusCode){var n={};n.type=e.code,n.message=e.message,n.stack=e.stack?e.stack.split("\n"):[],o.failure(n,t)}else o.accessDenied();i.trace("AWSClient: <-- Operation '%s' failed: %s",r,JSON.stringify(e))}else 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)}});else{var n=connect.sprintf("No such method exists on AWS client: %s",r);o.failure(new connect.ValueError(n),{message:n})}},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 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()],n=(t=t||(this.fromMap[e.getFromState()]={}))[e.getToState()];(n=n||(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(){connect=this.connect||{},this.connect=connect,this.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","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.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=this.getRoutingProfile().channelConcurrencyMap;return t=t||Object.keys(connect.ChannelType).reduce(function(e,t){return e[connect.ChannelType[t]]=1,e},{}),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.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.queueARN||t.queueId||this.getRoutingProfile().defaultOutboundQueue.queueARN},{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(),i=e||{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){if(e.nextToken)o.getEndpoints(n,r,{nextToken:e.nextToken,maxResults:i.maxResults,endpoints:i.endpoints.concat(e.endpoints)});else{i.endpoints=i.endpoints.concat(e.endpoints);var 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 n(e){this.contactId=e}n.prototype._getData=function(){return connect.core.getAgentDataProvider().getContactData(this.getContactId())},n.prototype._createConnectionAPI=function(e){return this.getType()===connect.ContactType.CHAT?new connect.ChatConnection(this.contactId,e.connectionId):new connect.VoiceConnection(this.contactId,e.connectionId)},n.prototype.getEventName=function(e){return connect.core.getContactEventName(e,this.getContactId())},n.prototype.onRefresh=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.REFRESH),e)},n.prototype.onIncoming=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.INCOMING),e)},n.prototype.onConnecting=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.CONNECTING),e)},n.prototype.onPending=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.PENDING),e)},n.prototype.onAccepted=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.ACCEPTED),e)},n.prototype.onMissed=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.MISSED),e)},n.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)},n.prototype.onDestroy=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.DESTROYED),e)},n.prototype.onACW=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.ACW),e)},n.prototype.onConnected=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.CONNECTED),e)},n.prototype.getContactId=function(){return this.contactId},n.prototype.getOriginalContactId=function(){return this._getData().initialContactId},n.prototype.getType=function(){return this._getData().type},n.prototype.getStatus=function(){return this._getData().state},n.prototype.getStatusDuration=function(){return connect.now()-this._getData().state.timestamp.getTime()+connect.core.getSkew()},n.prototype.getQueue=function(){return this._getData().queue},n.prototype.getQueueTimestamp=function(){return this._getData().queueTimestamp},n.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)})},n.prototype.getInitialConnection=function(){return connect.find(this.getConnections(),function(e){return e.isInitialConnection()})||null},n.prototype.getActiveInitialConnection=function(){var e=this.getInitialConnection();return null!=e&&e.isActive()?e:null},n.prototype.getThirdPartyConnections=function(){return this.getConnections().filter(function(e){return!e.isInitialConnection()&&e.getType()!==connect.ConnectionType.AGENT})},n.prototype.getSingleActiveThirdPartyConnection=function(){return this.getThirdPartyConnections().filter(function(e){return e.isActive()})[0]||null},n.prototype.getAgentConnection=function(){return connect.find(this.getConnections(),function(e){var t=e.getType();return t===connect.ConnectionType.AGENT||t===connect.ConnectionType.MONITORING})},n.prototype.getAttributes=function(){return this._getData().attributes},n.prototype.isSoftphoneCall=function(){return null!=connect.find(this.getConnections(),function(e){return null!=e.getSoftphoneMediaInfo()})},n.prototype.isInbound=function(){var e=this.getInitialConnection();return!!e&&e.getType()===connect.ConnectionType.INBOUND},n.prototype.isConnected=function(){return this.getStatus().type===connect.ContactStateType.CONNECTED},n.prototype.accept=function(n){var e=connect.core.getClient(),r=this;e.call(connect.ClientMethods.ACCEPT_CONTACT,{contactId:this.getContactId()},{success:function(e){var t=connect.core.getUpstream();t.sendUpstream(connect.EventType.BROADCAST,{event:connect.ContactEvents.ACCEPTED}),t.sendUpstream(connect.EventType.BROADCAST,{event:connect.core.getContactEventName(connect.ContactEvents.ACCEPTED,r.getContactId())}),n&&n.success&&n.success(e)},failure:n?n.failure:null})},n.prototype.destroy=function(e){connect.core.getClient().call(connect.ClientMethods.DESTROY_CONTACT,{contactId:this.getContactId()},e)},n.prototype.notifyIssue=function(e,t,n){connect.core.getClient().call(connect.ClientMethods.NOTIFY_CONTACT_ISSUE,{contactId:this.getContactId(),issueCode:e,description:t},n)},n.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)},n.prototype.toggleActiveConnections=function(e){var t=connect.core.getClient(),n=null,r=connect.find(this.getConnections(),function(e){return e.getStatus().type===connect.ConnectionStateType.HOLD});if(null!=r)n=r.getConnectionId();else{var o=this.getConnections().filter(function(e){return e.isActive()});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.INFO,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=i.precision?n.substring(0,i.precision):n;break;case"t":n=String(!!n),n=i.precision?n.substring(0,i.precision):n;break;case"T":n=Object.prototype.toString.call(n).slice(8,-1).toLowerCase(),n=i.precision?n.substring(0,i.precision):n;break;case"u":n=parseInt(n,10)>>>0;break;case"v":n=n.valueOf(),n=i.precision?n.substring(0,i.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(i.type)?f+=n:(!d.number.test(i.type)||u&&!i.sign?l="":(l=u?"+":"-",n=n.toString().replace(d.sign,"")),a=i.pad_char?"0"===i.pad_char?"0":i.pad_char.charAt(1):" ",c=i.width-(l+n).length,s=i.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(){p.info("sendSoftphoneReport success")},failure:function(e){p.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 s;p=new P(connect.getLog()),connect.RtcPeerConnectionFactory&&(s=new connect.RtcPeerConnectionFactory(p,connect.core.getWebSocketManager(),d,connect.hitch(this,t,{transportType:"softphone",softphoneClientId:d}),connect.hitch(this,C))),A()||C(h.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. ","")}});m(),this.ringtoneEngine=null;var a="true"===e.cleanMultipleSessions,c={},u={};this.getSession=function(e){return c[e]};function l(n){if(c.hasOwnProperty(n)){var r=c[n];new Promise(function(e,t){delete c[n],delete u[n],r.hangup()}).catch(function(e){lily.getLog().warn("Clean up the session locally "+n,e.message)})}}function n(n,r){if(c[r]&&function(e){return e.getStatus().type===connect.ContactStatusType.ENDED||e.getStatus().type===connect.ContactStatusType.ERROR||e.getStatus().type===connect.ContactStatusType.MISSED}(n)&&l(r),n.isSoftphoneCall()&&!u[r]&&(n.getStatus().type===connect.ContactStatusType.CONNECTING||n.getStatus().type===connect.ContactStatusType.INCOMING)){u[r]=!0,p.info("Softphone call detected:","contactId "+n.getContactId(),"agent connectionId "+r),function(e){if(0e.BLOCK_SIZE){var r=new e;r.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,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}var i=new DataView(new ArrayBuffer(16));for(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=t[0],r=t[1],o=t[2],i=t[3];n=s(n,r,o,i,e.getUint32(0,!0),7,3614090360),i=s(i,n,r,o,e.getUint32(4,!0),12,3905402710),o=s(o,i,n,r,e.getUint32(8,!0),17,606105819),r=s(r,o,i,n,e.getUint32(12,!0),22,3250441966),n=s(n,r,o,i,e.getUint32(16,!0),7,4118548399),i=s(i,n,r,o,e.getUint32(20,!0),12,1200080426),o=s(o,i,n,r,e.getUint32(24,!0),17,2821735955),r=s(r,o,i,n,e.getUint32(28,!0),22,4249261313),n=s(n,r,o,i,e.getUint32(32,!0),7,1770035416),i=s(i,n,r,o,e.getUint32(36,!0),12,2336552879),o=s(o,i,n,r,e.getUint32(40,!0),17,4294925233),r=s(r,o,i,n,e.getUint32(44,!0),22,2304563134),n=s(n,r,o,i,e.getUint32(48,!0),7,1804603682),i=s(i,n,r,o,e.getUint32(52,!0),12,4254626195),o=s(o,i,n,r,e.getUint32(56,!0),17,2792965006),n=u(n,r=s(r,o,i,n,e.getUint32(60,!0),22,1236535329),o,i,e.getUint32(4,!0),5,4129170786),i=u(i,n,r,o,e.getUint32(24,!0),9,3225465664),o=u(o,i,n,r,e.getUint32(44,!0),14,643717713),r=u(r,o,i,n,e.getUint32(0,!0),20,3921069994),n=u(n,r,o,i,e.getUint32(20,!0),5,3593408605),i=u(i,n,r,o,e.getUint32(40,!0),9,38016083),o=u(o,i,n,r,e.getUint32(60,!0),14,3634488961),r=u(r,o,i,n,e.getUint32(16,!0),20,3889429448),n=u(n,r,o,i,e.getUint32(36,!0),5,568446438),i=u(i,n,r,o,e.getUint32(56,!0),9,3275163606),o=u(o,i,n,r,e.getUint32(12,!0),14,4107603335),r=u(r,o,i,n,e.getUint32(32,!0),20,1163531501),n=u(n,r,o,i,e.getUint32(52,!0),5,2850285829),i=u(i,n,r,o,e.getUint32(8,!0),9,4243563512),o=u(o,i,n,r,e.getUint32(28,!0),14,1735328473),n=l(n,r=u(r,o,i,n,e.getUint32(48,!0),20,2368359562),o,i,e.getUint32(20,!0),4,4294588738),i=l(i,n,r,o,e.getUint32(32,!0),11,2272392833),o=l(o,i,n,r,e.getUint32(44,!0),16,1839030562),r=l(r,o,i,n,e.getUint32(56,!0),23,4259657740),n=l(n,r,o,i,e.getUint32(4,!0),4,2763975236),i=l(i,n,r,o,e.getUint32(16,!0),11,1272893353),o=l(o,i,n,r,e.getUint32(28,!0),16,4139469664),r=l(r,o,i,n,e.getUint32(40,!0),23,3200236656),n=l(n,r,o,i,e.getUint32(52,!0),4,681279174),i=l(i,n,r,o,e.getUint32(0,!0),11,3936430074),o=l(o,i,n,r,e.getUint32(12,!0),16,3572445317),r=l(r,o,i,n,e.getUint32(24,!0),23,76029189),n=l(n,r,o,i,e.getUint32(36,!0),4,3654602809),i=l(i,n,r,o,e.getUint32(48,!0),11,3873151461),o=l(o,i,n,r,e.getUint32(60,!0),16,530742520),n=p(n,r=l(r,o,i,n,e.getUint32(8,!0),23,3299628645),o,i,e.getUint32(0,!0),6,4096336452),i=p(i,n,r,o,e.getUint32(28,!0),10,1126891415),o=p(o,i,n,r,e.getUint32(56,!0),15,2878612391),r=p(r,o,i,n,e.getUint32(20,!0),21,4237533241),n=p(n,r,o,i,e.getUint32(48,!0),6,1700485571),i=p(i,n,r,o,e.getUint32(12,!0),10,2399980690),o=p(o,i,n,r,e.getUint32(40,!0),15,4293915773),r=p(r,o,i,n,e.getUint32(4,!0),21,2240044497),n=p(n,r,o,i,e.getUint32(32,!0),6,1873313359),i=p(i,n,r,o,e.getUint32(60,!0),10,4264355552),o=p(o,i,n,r,e.getUint32(24,!0),15,2734768916),r=p(r,o,i,n,e.getUint32(52,!0),21,1309151649),n=p(n,r,o,i,e.getUint32(16,!0),6,4149444226),i=p(i,n,r,o,e.getUint32(44,!0),10,3174756917),o=p(o,i,n,r,e.getUint32(8,!0),15,718787259),r=p(r,o,i,n,e.getUint32(36,!0),21,3951481745),t[0]=n+t[0]&4294967295,t[1]=r+t[1]&4294967295,t[2]=o+t[2]&4294967295,t[3]=i+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,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}var n,r,o=this.h0,i=this.h1,s=this.h2,a=this.h3,c=this.h4;for(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,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=this.buffer,t=this.state,n=t[0],r=t[1],o=t[2],i=t[3],s=t[4],a=t[5],c=t[6],u=t[7],l=0;l<64;l++){if(l<16)this.temp[l]=(255&e[4*l])<<24|(255&e[4*l+1])<<16|(255&e[4*l+2])<<8|255&e[4*l+3];else{var p=this.temp[l-2],h=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,f=((p=this.temp[l-15])>>>7|p<<25)^(p>>>18|p<<14)^p>>>3;this.temp[l]=(h+this.temp[l-7]|0)+(f+this.temp[l-16]|0)}var d=(((s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7))+(s&a^~s&c)|0)+(u+(m[l]+this.temp[l]|0)|0)|0,g=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&r^n&o^r&o)|0;u=c,c=a,a=s,s=i+d|0,i=o,o=r,r=n,n=d+g|0}t[0]+=n,t[1]+=r,t[2]+=o,t[3]+=i,t[4]+=s,t[5]+=a,t[6]+=c,t[7]+=u}},{"./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");if(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){e=e&&o("Could not load credentials from "+n.credentials.constructor.name,e);r(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){if(o.util.hideProperties(this,["secretAccessKey"]),this.expired=!1,this.expireTime=null,this.refreshCallbacks=[],1===arguments.length&&"object"==typeof e){var r=e.credentials||e;this.accessKeyId=r.accessKeyId,this.secretAccessKey=r.secretAccessKey,this.sessionToken=r.sessionToken}else 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=this;if(r.util.isBrowser()&&!e.params.IdentityId){var t=e.getStorage("id");if(t&&e.params.Logins){var n=Object.keys(e.params.Logins);0!==(e.getStorage("providers")||"").split(",").filter(function(e){return-1!==n.indexOf(e)}).length&&(e.params.IdentityId=t)}else t&&(e.params.IdentityId=t)}},createClients:function(){var e=this._clientConfig;if(this.webIdentityCredentials=this.webIdentityCredentials||new r.WebIdentityCredentials(this.params,e),!this.cognito){var t=r.util.merge({},e);t.params=this.params,this.cognito=new o(t)}this.sts=this.sts||new i(e)},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=this;if(0===o.providers.length)return e(new Error("No providers")),o;if(1===o.resolveCallbacks.push(e)){var i=0,s=o.providers.slice(0);!function t(n,r){if(!n&&r||i===s.length)return a.util.arrayEach(o.resolveCallbacks,function(e){e(n,r)}),void(o.resolveCallbacks.length=0);var e=s[i++];(r="function"==typeof e?e.call():e).get?r.get(function(e){t(e,e?null:r)}):t(null,r)}()}return o}}),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(){if(!this.service){var e=r.util.merge({},this._clientConfig);e.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=n.maxRetries&&(e.MaxRetriesExceeded=1),u.emit("apiCall",[e])}})},setupRequestListeners:function(){},getSignerClass:function(e){var t,n=null,r="";e&&(r=(n=(e.service.api.operations||{})[e.operation]||null)?n.authtype:"");return 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=a(l.Service,n||{});if("string"==typeof e){l.Service.addVersions(r,t);var o=r.serviceIdentifier||e;r.serviceIdentifier=o}else r.prototype.api=e,l.Service.defineMethods(r);if(l.SequentialExecutor.call(this.prototype),!this.prototype.publisher&&l.util.clientSideMonitoring){var i=l.util.clientSideMonitoring.Publisher,s=(0,l.util.clientSideMonitoring.configProvider)();this.prototype.publisher=new i(s),s.enabled&&(l.Service._clientSideMonitoring=!0)}return l.SequentialExecutor.call(r.prototype),l.Service.addDefaultMonitoringListeners(r.prototype),r},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){var t,n,r=0,o=0;for(n=0;n>>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(){if(c>=t.size)r(null,o.digest(n));else{var e=c+524288;e>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>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>18&63]+a[o>>12&63]+a[o>>6&63]+a[63&o]);return i.join("")}u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63},{}],79:[function(e,t,n){},{}],80:[function(t,e,F){(function(e,p){"use strict";var r=t("base64-js"),i=t("ieee754"),s=t("isarray");function n(){return p.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(n()=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 D(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return U(e).length;default:if(r)return D(e).length;t=(""+t).toLowerCase(),r=!0}}function d(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):2147483647=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,s=1,a=e.length,c=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;a/=s=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var l=-1;for(i=n;i>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function E(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function S(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<=C)return String.fromCharCode.apply(String,e);var n="",r=0;for(;rthis.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 _(this,t,n);case"utf8":case"utf-8":return S(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return w(this,t,n);case"base64":return E(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}.apply(this,arguments)},p.prototype.equals=function(e){if(!p.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===p.compare(this,e)},p.prototype.inspect=function(){var e="",t=F.INSPECT_MAX_BYTES;return 0t&&(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 y(this,e,t,n);case"utf8":case"utf-8":return u=t,l=n,q(D(e,(c=this).length-u),c,u,l);case"ascii":return v(this,e,t,n);case"latin1":case"binary":return v(this,e,t,n);case"base64":return i=this,s=t,a=n,q(U(e),i,s,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,e,t,n);default:if(p)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),p=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function T(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;oe.length)throw new RangeError("Index out of range")}function k(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 N(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 x(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 O(e,t,n,r,o){return o||x(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function L(e,t,n,r,o){return o||x(e,0,n,8),i.write(e,t,n,r,52,8),n+8}p.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):r>>8):k(this,e,t,!0),t+2},p.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):k(this,e,t,!1),t+2},p.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||R(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):N(this,e,t,!0),t+4},p.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||R(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):N(this,e,t,!1),t+4},p.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);R(this,e,t,n,o-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){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);R(this,e,t,n,o-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||R(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||R(this,e,t,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):k(this,e,t,!0),t+2},p.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):k(this,e,t,!1),t+2},p.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||R(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):N(this,e,t,!0),t+4},p.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||R(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):N(this,e,t,!1),t+4},p.prototype.writeFloatLE=function(e,t,n){return O(this,e,t,!0,n)},p.prototype.writeFloatBE=function(e,t,n){return O(this,e,t,!1,n)},p.prototype.writeDoubleLE=function(e,t,n){return L(this,e,t,!0,n)},p.prototype.writeDoubleBE=function(e,t,n){return L(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(i=t;i>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 U(e){return r.toByteArray(function(e){var t;if((e=((t=e).trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(P,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function q(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:{},t("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,n=this._current,r=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-d)/s))&&A("overflow"),d+=c*s,!(c<(u=a<=m?b:m+E<=a?E:a-m));a+=v)s>w(y/(l=v-u))&&A("overflow"),s*=l;m=N(d-i,t=h.length+1,0==i),w(d/t)>y-g&&A("overflow"),g+=w(d/t),d%=t,h.splice(d++,0,g)}return R(h)}function m(e){var t,n,r,o,i,s,a,c,u,l,p,h,f,d,g,m=[];for(h=(e=I(e)).length,t=C,i=S,s=n=0;sw((y-n)/(f=r+1))&&A("overflow"),n+=(a-t)*f,t=a,s=0;sy&&A("overflow"),p==t){for(c=n,u=v;!(c<(l=u<=i?b:i+E<=u?E:u-i));u+=v)g=c-l,d=v-l,m.push(_(k(l+g%d,0))),c=w(g/d);m.push(_(k(c,0))),i=N(n,f,r==o),n=0,++r}++n,++t}return m.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,c,u=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=e;r=r.trim();var o=O.exec(r);if(o){var i=(o=o[0]).toLowerCase();this.protocol=i,r=r.substr(o.length)}if(n||o||r.match(/^\/\/[^@\/]+@[^@\/]+/)){var s="//"===r.substr(0,2);!s||o&&F[o]||(r=r.substr(2),this.slashes=!0)}if(!F[o]&&(s||o&&!j[o])){for(var a,c,u=-1,l=0;l>>((3&t)<<3)&255;return i}}},{}],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=t&&n||0,o=t||[],i=(e=e||{}).node||d,s=void 0!==e.clockseq?e.clockseq:g;if(null==i||null==s){var a=m();null==i&&(i=d=[1|a[0],a[1],a[2],a[3],a[4],a[5]]),null==s&&(s=g=16383&(a[6]<<8|a[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&&(s=s+1&16383),(l<0||v>>24&255,o[r++]=p>>>16&255,o[r++]=p>>>8&255,o[r++]=255&p;var h=c/4294967296*1e4&268435455;o[r++]=h>>>8&255,o[r++]=255&h,o[r++]=h>>>24&15|16,o[r++]=h>>>16&255,o[r++]=s>>>8|128,o[r++]=255&s;for(var f=0;f<6;++f)o[r+f]=i[f];return t||y(o)}},{"./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":n=n.toString(16);break;case"X":n=n.toString(16).toUpperCase()}n=/[def]/.test(i[8])&&i[3]&&0<=n?"+"+n:n,a=i[4]?"0"==i[4]?"0":i[4].charAt(1):" ",c=i[6]-String(n).length,s=i[6]?g(a,c):"",h.push(i[5]?n+s:s+n)}return h.join("")},f.cache={},f.parse=function(e){for(var t=e,n=[],r=[],o=0;t;){if(null!==(n=/^[^\x25]+/.exec(t)))r.push(n[0]);else if(null!==(n=/^\x25{2}/.exec(t)))r.push("%");else{if(null===(n=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(t)))throw"[sprintf] huh?";if(n[2]){o|=1;var i=[],s=n[2],a=[];if(null===(a=/^([a-z_][a-z_\d]*)/i.exec(s)))throw"[sprintf] huh?";for(i.push(a[1]);""!==(s=s.substring(a[0].length));)if(null!==(a=/^\.([a-z_][a-z_\d]*)/i.exec(s)))i.push(a[1]);else{if(null===(a=/^\[(\d+)\]/.exec(s)))throw"[sprintf] huh?";i.push(a[1])}n[2]=i}else o|=2;if(3===o)throw"[sprintf] mixing positional and named placeholders is not (yet) supported";r.push(n)}t=t.substring(n[0].length)}return r};function d(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function g(e,t){for(var n=[];0=this._logLevel&&(i[e.level]>=this._echoLevel&&a[e.getLevel()](e.toString()),e.line=this._lineCount++)},u.prototype.clearObjects=function(){for(var e=0;e=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){if(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","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){if(n&&n.failure){var 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=this,i=connect.getLog();if(e.authentication={authToken:this.authToken},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"]=t.authToken}).send(function(e,t){try{if(e){if(e.code===connect.CTIExceptions.UNAUTHORIZED_EXCEPTION)o.authFailure();else if(!o.accessDenied||e.code!==connect.CTIExceptions.ACCESS_DENIED_EXCEPTION&&403!==e.statusCode){var n={};n.type=e.code,n.message=e.message,n.stack=e.stack?e.stack.split("\n"):[],o.failure(n,t)}else o.accessDenied();i.trace("AWSClient: <-- Operation '%s' failed: %s",r,JSON.stringify(e))}else 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)}});else{var n=connect.sprintf("No such method exists on AWS client: %s",r);o.failure(new connect.ValueError(n),{message:n})}},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 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()],n=(t=t||(this.fromMap[e.getFromState()]={}))[e.getToState()];(n=n||(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(){connect=this.connect||{},this.connect=connect,this.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","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.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=this.getRoutingProfile().channelConcurrencyMap;return t=t||Object.keys(connect.ChannelType).reduce(function(e,t){return e[connect.ChannelType[t]]=1,e},{}),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.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.queueARN||t.queueId||this.getRoutingProfile().defaultOutboundQueue.queueARN},{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(),i=e||{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){if(e.nextToken)o.getEndpoints(n,r,{nextToken:e.nextToken,maxResults:i.maxResults,endpoints:i.endpoints.concat(e.endpoints)});else{i.endpoints=i.endpoints.concat(e.endpoints);var 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 n(e){this.contactId=e}n.prototype._getData=function(){return connect.core.getAgentDataProvider().getContactData(this.getContactId())},n.prototype._createConnectionAPI=function(e){return this.getType()===connect.ContactType.CHAT?new connect.ChatConnection(this.contactId,e.connectionId):new connect.VoiceConnection(this.contactId,e.connectionId)},n.prototype.getEventName=function(e){return connect.core.getContactEventName(e,this.getContactId())},n.prototype.onRefresh=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.REFRESH),e)},n.prototype.onIncoming=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.INCOMING),e)},n.prototype.onConnecting=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.CONNECTING),e)},n.prototype.onPending=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.PENDING),e)},n.prototype.onAccepted=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.ACCEPTED),e)},n.prototype.onMissed=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.MISSED),e)},n.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)},n.prototype.onDestroy=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.DESTROYED),e)},n.prototype.onACW=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.ACW),e)},n.prototype.onConnected=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.CONNECTED),e)},n.prototype.getContactId=function(){return this.contactId},n.prototype.getOriginalContactId=function(){return this._getData().initialContactId},n.prototype.getType=function(){return this._getData().type},n.prototype.getStatus=function(){return this._getData().state},n.prototype.getStatusDuration=function(){return connect.now()-this._getData().state.timestamp.getTime()+connect.core.getSkew()},n.prototype.getQueue=function(){return this._getData().queue},n.prototype.getQueueTimestamp=function(){return this._getData().queueTimestamp},n.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)})},n.prototype.getInitialConnection=function(){return connect.find(this.getConnections(),function(e){return e.isInitialConnection()})||null},n.prototype.getActiveInitialConnection=function(){var e=this.getInitialConnection();return null!=e&&e.isActive()?e:null},n.prototype.getThirdPartyConnections=function(){return this.getConnections().filter(function(e){return!e.isInitialConnection()&&e.getType()!==connect.ConnectionType.AGENT})},n.prototype.getSingleActiveThirdPartyConnection=function(){return this.getThirdPartyConnections().filter(function(e){return e.isActive()})[0]||null},n.prototype.getAgentConnection=function(){return connect.find(this.getConnections(),function(e){var t=e.getType();return t===connect.ConnectionType.AGENT||t===connect.ConnectionType.MONITORING})},n.prototype.getAttributes=function(){return this._getData().attributes},n.prototype.isSoftphoneCall=function(){return null!=connect.find(this.getConnections(),function(e){return null!=e.getSoftphoneMediaInfo()})},n.prototype.isInbound=function(){var e=this.getInitialConnection();return!!e&&e.getType()===connect.ConnectionType.INBOUND},n.prototype.isConnected=function(){return this.getStatus().type===connect.ContactStateType.CONNECTED},n.prototype.accept=function(n){var e=connect.core.getClient(),r=this;e.call(connect.ClientMethods.ACCEPT_CONTACT,{contactId:this.getContactId()},{success:function(e){var t=connect.core.getUpstream();t.sendUpstream(connect.EventType.BROADCAST,{event:connect.ContactEvents.ACCEPTED}),t.sendUpstream(connect.EventType.BROADCAST,{event:connect.core.getContactEventName(connect.ContactEvents.ACCEPTED,r.getContactId())}),n&&n.success&&n.success(e)},failure:n?n.failure:null})},n.prototype.destroy=function(e){connect.core.getClient().call(connect.ClientMethods.DESTROY_CONTACT,{contactId:this.getContactId()},e)},n.prototype.notifyIssue=function(e,t,n){connect.core.getClient().call(connect.ClientMethods.NOTIFY_CONTACT_ISSUE,{contactId:this.getContactId(),issueCode:e,description:t},n)},n.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)},n.prototype.toggleActiveConnections=function(e){var t=connect.core.getClient(),n=null,r=connect.find(this.getConnections(),function(e){return e.getStatus().type===connect.ConnectionStateType.HOLD});if(null!=r)n=r.getConnectionId();else{var o=this.getConnections().filter(function(e){return e.isActive()});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.INFO,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=i.precision?n.substring(0,i.precision):n;break;case"t":n=String(!!n),n=i.precision?n.substring(0,i.precision):n;break;case"T":n=Object.prototype.toString.call(n).slice(8,-1).toLowerCase(),n=i.precision?n.substring(0,i.precision):n;break;case"u":n=parseInt(n,10)>>>0;break;case"v":n=n.valueOf(),n=i.precision?n.substring(0,i.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(i.type)?f+=n:(!d.number.test(i.type)||u&&!i.sign?l="":(l=u?"+":"-",n=n.toString().replace(d.sign,"")),a=i.pad_char?"0"===i.pad_char?"0":i.pad_char.charAt(1):" ",c=i.width-(l+n).length,s=i.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")},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){if(u.hasOwnProperty(n)){var 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;if(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=this._level}},{key:"hasClientLogger",value:function(){return null!==this._clientLogger}},{key:"getLogger",value:function(e){var n=e.prefix||"";return this._logsDestination===l?this.consoleLoggerWrapper:new C(n)}},{key:"updateLoggerConfig",value:function(e){var n=e||{};this._level=n.level||k.INFO,this._clientLogger=n.logger||null,this._logsDestination=s,n.debug&&(this._logsDestination=l),n.logger&&(this._logsDestination=u)}}]),e}(),T=function(){function e(){v(this,e)}return S(e,[{key:"debug",value:function(){}},{key:"info",value:function(){}},{key:"warn",value:function(){}},{key:"error",value:function(){}}]),e}(),C=function(e){function n(e){var t;return v(this,n),(t=b(this,y(n).call(this))).prefix=e||"",t}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),n&&m(e,n)}(n,T),S(n,[{key:"debug",value:function(){for(var e=arguments.length,n=new Array(e),t=0;t1)&&(e.info("Network online, Connecting to websocket"),O())},250),d=function(e,n){e.forEach(function(e){e(n)})},b=function(){if(r.pendingResponse)return e.warn("Heartbeat response not received"),clearInterval(r.intervalHandle),r.pendingResponse=!1,void k();e.debug("Sending heartbeat"),n.send(T(g)),r.pendingResponse=!0},y=function(){t.linearConnectAttempt=0,t.exponentialConnectAttempt=0,t.exponentialBackOffTime=1,r.pendingResponse=!1,t.reconnectWebSocket=!1,clearTimeout(t.lifeTimeTimeoutHandle),clearInterval(r.intervalHandle),clearTimeout(t.exponentialTimeoutHandle)},m=function(){try{if(e.info("WebSocket connection established!"),d(o.connectionGain),y(),a.subscribed.size>0||a.pending.size>0){var c=Array.from(a.subscribed.values());c=c.concat(Array.from(a.pending.values())),a.subscribed.clear(),n.send(T(f,{topics:c}))}b(),r.intervalHandle=setInterval(b,1e4),t.lifeTimeTimeoutHandle=setTimeout(function(){e.debug("Starting scheduled WebSocket manager reconnect"),k()},1e3*i.connConfig.webSocketTransport.transportLifeTimeInSeconds)}catch(n){e.error("Error after establishing web socket connection, error: ",n)}},v=function(n){t.linearConnectAttempt<=1&&d(o.connectionLost),e.info("Socket connection is closed. event: ",n),t.reconnectWebSocket&&E()},h=function(n){e.error("WebSocketManager Error, error_event: ",n),k()},S=function(n){e.debug("Message received from webSocket server",n.data);var t=JSON.parse(n.data);switch(t.topic){case f:"success"===t.content.status?(t.content.topics.forEach(function(e){a.subscribed.add(e),a.pending.delete(e)}),d(o.subscriptionUpdate,t)):d(o.subscriptionFailure,t);break;case g:e.debug("Heartbeat response received"),r.pendingResponse=!1;break;default:if(t.topic){if(0===o.allMessage.size&&0===o.topic.size)return void e.warn("No registered callback listener for Topic: ",t);d(o.allMessage,t),o.topic.has(t.topic)&&d(o.topic.get(t.topic),t)}else t.message?e.warn("WebSocketManager Message Error, error: ",t):e.warn("Invalid incoming message, error: ",t)}},w=function(e){return!(!n||n.readyState===WebSocket.CLOSED)&&(n.close(1e3,e),!0)},k=function(){u?(clearTimeout(t.lifeTimeTimeoutHandle),clearInterval(r.intervalHandle),t.linearConnectAttempt<3?(t.linearConnectAttempt++,e.debug("Starting Consecutive WebSocket reconnect, Attempt : "+t.linearConnectAttempt),t.reconnectWebSocket=!0,O()):t.exponentialConnectAttempt<5?(t.exponentialConnectAttempt++,t.exponentialBackOffTime*=2,e.debug("Starting Exponential WebSocket reconnect, Attempt : "+t.exponentialConnectAttempt+" with delay "+t.exponentialBackOffTime+" sec."),i.promiseCompleted=!1,i.connConfig=null,t.exponentialTimeoutHandle=setTimeout(function(){t.reconnectWebSocket=!0,O()},1e3*t.exponentialBackOffTime)):i.promiseCompleted&&(e.error("Could not connect to WebSocket after several attempts"),_())):w("Network Offline, Closing WebSocket Manager")},_=function(){y(),w("Terminating WebSocket Manager"),e.error("WebSocket Initialization failed"),t.websocketInitFailed=!0,clearInterval(l),d(o.initFailure)},T=function(e,n){return JSON.stringify({topic:e,content:n})},C=function(n){return!!(c.isObject(n)&&c.isObject(n.webSocketTransport)&&c.isString(n.webSocketTransport.url)&&c.validWSUrl(n.webSocketTransport.url)&&c.isNumber(n.webSocketTransport.transportLifeTimeInSeconds)&&n.webSocketTransport.transportLifeTimeInSeconds>=3600)||(e.error("Invalid WebSocket Connection Configuration",n),!1)},O=function(){t.websocketInitFailed||(i.connConfig=null,i.promiseCompleted=!1,i.promiseHandle=o.getWebSocketTransport(),i.promiseHandle.then(function(n){i.promiseCompleted=!0,e.debug("Successfully fetched webSocket connection configuration"),C(n)?(i.connConfig=n,u&&(w("Restarting WebSocket Manager")||E())):_()},function(n){i.promiseCompleted=!0,e.error("Failed to fetch webSocket connection configuration",n),k()}))},E=function(){if(!t.websocketInitFailed){e.debug("Initializing Websocket Manager");try{C(i.connConfig)?((n=new WebSocket(i.connConfig.webSocketTransport.url)).addEventListener("open",m),n.addEventListener("message",S),n.addEventListener("error",h),n.addEventListener("close",v)):i.promiseCompleted&&_()}catch(n){e.error("Error Initializing web-socket-manager",n),_()}}};this.init=function(n){c.assertTrue(c.isFunction(n),"transportHandle must be a function"),null===o.getWebSocketTransport?(o.getWebSocketTransport=n,O()):e.warn("Web Socket Manager was already initialized")},this.onInitFailure=function(e){return c.assertTrue(c.isFunction(e),"cb must be a function"),o.initFailure.add(e),t.websocketInitFailed&&e(),function(){return o.initFailure.delete(e)}},this.onConnectionGain=function(e){return c.assertTrue(c.isFunction(e),"cb must be a function"),o.connectionGain.add(e),n&&n.readyState===WebSocket.OPEN&&e(),function(){return o.connectionGain.delete(e)}},this.onConnectionLost=function(e){return c.assertTrue(c.isFunction(e),"cb must be a function"),o.connectionLost.add(e),n&&n.readyState===WebSocket.CLOSED&&e(),function(){return o.connectionLost.delete(e)}},this.onSubscriptionUpdate=function(e){return c.assertTrue(c.isFunction(e),"cb must be a function"),o.subscriptionUpdate.add(e),function(){return o.subscriptionUpdate.delete(e)}},this.onSubscriptionFailure=function(e){return c.assertTrue(c.isFunction(e),"cb must be a function"),o.subscriptionFailure.add(e),function(){return o.subscriptionFailure.delete(e)}},this.onMessage=function(e,n){return c.assertNotNull(e,"topicName"),c.assertTrue(c.isFunction(n),"cb must be a function"),o.topic.has(e)?o.topic.get(e).add(n):o.topic.set(e,new Set([n])),function(){return o.topic.get(e).delete(n)}},this.onAllMessage=function(e){return c.assertTrue(c.isFunction(e),"cb must be a function"),o.allMessage.add(e),function(){return o.allMessage.delete(e)}},this.subscribeTopics=function(e){c.assertNotNull(e,"topics"),c.assertIsList(e),e.forEach(function(e){a.pending.add(e)}),n&&n.readyState===WebSocket.OPEN&&n.send(T(f,{topics:e}))},this.sendMessage=function(t){if(c.assertIsObject(t,"payload"),void 0===t.topic||s.has(t.topic))e.warn("Cannot send message, Invalid topic",t);else{try{t=JSON.stringify(t)}catch(n){return void e.warn("Error stringify message",t)}n&&n.readyState===WebSocket.OPEN?(e.debug("WebSocketManager sending message",t),n.send(t)):e.warn("Cannot send message, web socket connection is not open")}},this.closeWebSocket=function(){y(),clearInterval(l),w("User request to close WebSocket")}},L={create:function(){return new E},setGlobalConfig:function(e){var n=e.loggerConfig;x.updateLoggerConfig(n)},LogLevel:k,Logger:w}},function(e,n,t){var r;!function(){"use strict";var o={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function i(e){return function(e,n){var t,r,a,c,s,u,l,f,p,g=1,d=e.length,b="";for(r=0;r=0),c.type){case"b":t=parseInt(t,10).toString(2);break;case"c":t=String.fromCharCode(parseInt(t,10));break;case"d":case"i":t=parseInt(t,10);break;case"j":t=JSON.stringify(t,null,c.width?parseInt(c.width):0);break;case"e":t=c.precision?parseFloat(t).toExponential(c.precision):parseFloat(t).toExponential();break;case"f":t=c.precision?parseFloat(t).toFixed(c.precision):parseFloat(t);break;case"g":t=c.precision?String(Number(t.toPrecision(c.precision))):parseFloat(t);break;case"o":t=(parseInt(t,10)>>>0).toString(8);break;case"s":t=String(t),t=c.precision?t.substring(0,c.precision):t;break;case"t":t=String(!!t),t=c.precision?t.substring(0,c.precision):t;break;case"T":t=Object.prototype.toString.call(t).slice(8,-1).toLowerCase(),t=c.precision?t.substring(0,c.precision):t;break;case"u":t=parseInt(t,10)>>>0;break;case"v":t=t.valueOf(),t=c.precision?t.substring(0,c.precision):t;break;case"x":t=(parseInt(t,10)>>>0).toString(16);break;case"X":t=(parseInt(t,10)>>>0).toString(16).toUpperCase()}o.json.test(c.type)?b+=t:(!o.number.test(c.type)||f&&!c.sign?p="":(p=f?"+":"-",t=t.toString().replace(o.sign,"")),u=c.pad_char?"0"===c.pad_char?"0":c.pad_char.charAt(1):" ",l=c.width-(p+t).length,s=c.width&&l>0?u.repeat(l):"",b+=c.align?p+t+s:"0"===u?p+s+t:s+p+t)}return b}(function(e){if(c[e])return c[e];var n,t=e,r=[],i=0;for(;t;){if(null!==(n=o.text.exec(t)))r.push(n[0]);else if(null!==(n=o.modulo.exec(t)))r.push("%");else{if(null===(n=o.placeholder.exec(t)))throw new SyntaxError("[sprintf] unexpected placeholder");if(n[2]){i|=1;var a=[],s=n[2],u=[];if(null===(u=o.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(a.push(u[1]);""!==(s=s.substring(u[0].length));)if(null!==(u=o.key_access.exec(s)))a.push(u[1]);else{if(null===(u=o.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");a.push(u[1])}n[2]=a}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");r.push({placeholder:n[0],param_no:n[1],keys:n[2],sign:n[3],pad_char:n[4],align:n[5],width:n[6],precision:n[7],type:n[8]})}t=t.substring(n[0].length)}return c[e]=r}(e),arguments)}function a(e,n){return i.apply(null,[e].concat(n||[]))}var c=Object.create(null);n.sprintf=i,n.vsprintf=a,"undefined"!=typeof window&&(window.sprintf=i,window.vsprintf=a,void 0===(r=function(){return{sprintf:i,vsprintf:a}}.call(n,t,n,e))||(e.exports=r))}()},function(e,n,t){"use strict";t.r(n),function(e){t.d(n,"WebSocketManager",function(){return o});var r=t(0);e.connect=e.connect||{},connect.WebSocketManager=r.a;var o=r.a}.call(this,t(3))},function(e,n){var t;t=function(){return this}();try{t=t||new Function("return this")()}catch(e){"object"==typeof window&&(t=window)}e.exports=t}]); //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAiLCJ3ZWJwYWNrOi8vLy4vc3JjL3V0aWxzLmpzIiwid2VicGFjazovLy8uL3NyYy9jb25zdGFudHMuanMiLCJ3ZWJwYWNrOi8vLy4vc3JjL2xvZy5qcyIsIndlYnBhY2s6Ly8vLi9zcmMvd2ViU29ja2V0TWFuYWdlci5qcyIsIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvc3ByaW50Zi1qcy9zcmMvc3ByaW50Zi5qcyIsIndlYnBhY2s6Ly8vLi9zcmMvaW5kZXguanMiLCJ3ZWJwYWNrOi8vLyh3ZWJwYWNrKS9idWlsZGluL2dsb2JhbC5qcyJdLCJuYW1lcyI6WyJpbnN0YWxsZWRNb2R1bGVzIiwiX193ZWJwYWNrX3JlcXVpcmVfXyIsIm1vZHVsZUlkIiwiZXhwb3J0cyIsIm1vZHVsZSIsImkiLCJsIiwibW9kdWxlcyIsImNhbGwiLCJtIiwiYyIsImQiLCJuYW1lIiwiZ2V0dGVyIiwibyIsIk9iamVjdCIsImRlZmluZVByb3BlcnR5IiwiZW51bWVyYWJsZSIsImdldCIsInIiLCJTeW1ib2wiLCJ0b1N0cmluZ1RhZyIsInZhbHVlIiwidCIsIm1vZGUiLCJfX2VzTW9kdWxlIiwibnMiLCJjcmVhdGUiLCJrZXkiLCJiaW5kIiwibiIsIm9iamVjdCIsInByb3BlcnR5IiwicHJvdG90eXBlIiwiaGFzT3duUHJvcGVydHkiLCJwIiwicyIsIlV0aWxzIiwicHJlbWlzZSIsIm1lc3NhZ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G4gICAgICAgICAgICAgICAgICAgIGludm9rZUNhbGxiYWNrcyhjYWxsYmFja3Muc3Vic2NyaXB0aW9uVXBkYXRlLCByZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgaW52b2tlQ2FsbGJhY2tzKGNhbGxiYWNrcy5zdWJzY3JpcHRpb25GYWlsdXJlLCByZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSBST1VURV9LRVkuSEVBUlRCRUFUOlxuICAgICAgICAgICAgICAgIGxvZ2dlci5kZWJ1ZyhcIkhlYXJ0YmVhdCByZXNwb25zZSByZWNlaXZlZFwiKTtcbiAgICAgICAgICAgICAgICBoZWFydGJlYXRDb25maWcucGVuZGluZ1Jlc3BvbnNlID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZS50b3BpYykge1xuICAgICAgICAgICAgICAgICAgICBpZiAoY2FsbGJhY2tzLmFsbE1lc3NhZ2Uuc2l6ZSA9PT0gMCAmJiBjYWxsYmFja3MudG9waWMuc2l6ZSA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLndhcm4oJ05vIHJlZ2lzdGVyZWQgY2FsbGJhY2sgbGlzdGVuZXIgZm9yIFRvcGljOiAnLCByZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgaW52b2tlQ2FsbGJhY2tzKGNhbGxiYWNrcy5hbGxNZXNzYWdlLCByZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChjYWxsYmFja3MudG9waWMuaGFzKHJlc3BvbnNlLnRvcGljKSkge1xuICAgICAgICAgICAgICAgICAgICA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XZWJTb2NrZXRUcmFuc3BvcnQoKTtcbiAgICAgICAgd2ViU29ja2V0Q29uZmlnLnByb21pc2VIYW5kbGVcbiAgICAgICAgICAgIC50aGVuKGZ1bmN0aW9uKHJlc3BvbnNlKSB7XG4gICAgICAgICAgICAgICAgICAgIHdlYlNvY2tldENvbmZpZy5wcm9taXNlQ29tcGxldGVkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmRlYnVnKFwiU3VjY2Vzc2Z1bGx5IGZldGNoZWQgd2ViU29ja2V0IGNvbm5lY3Rpb24gY29uZmlndXJhdGlvblwiKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCF2YWxpZFdlYlNvY2tldENvbm5Db25maWcocmVzcG9uc2UpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0ZXJtaW5hdGVXZWJTb2NrZXRNYW5hZ2VyKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgd2ViU29ja2V0Q29uZmlnLmNvbm5Db25maWcgPSByZXNwb25zZTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFvbmxpbmUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBpZiAoY2xvc2VXZWJTb2NrZXQoXCJSZXN0YXJ0aW5nIFdlYlNvY2tldCBNYW5hZ2VyXCIpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgaW5pdFdlYlNvY2tldCgpO1xuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgZnVuY3Rpb24ocmVhc29uKSB7XG4gICAgICAgICAgICAgICAgICAgIHdlYlNvY2tldENvbmZpZy5wcm9taXNlQ29tcGxldGVkID0gdHJ1ZT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V90cmVlLmxlbmd0aCwgYXJnLCBvdXRwdXQgPSAnJywgaSwgaywgcGgsIHBhZCwgcGFkX2NoYXJhY3RlciwgcGFkX2xlbmd0aCwgaXNfcG9zaXRpdmUsIHNpZ25cbiAgICAgICAgZm9yIChpID0gMDsgaSA8IHRyZWVfbGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgIGlmICh0eXBlb2YgcGFyc2VfdHJlZVtpXSA9PT0gJ3N0cmluZycpIHtcbiAgICAgICAgICAgICAgICBvdXRwdXQgKz0gcGFyc2VfdHJlZVtpXVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSBpZiAodHlwZW9mIHBhcnNlX3RyZWVbaV0gPT09ICdvYmplY3QnKSB7XG4gICAgICAgICAgICAgICAgcGggPSBwYXJzZV90cmVlW2ldIC8vIGNvbnZlbmllbmNlIHB1cnBvc2VzIG9ubHlcbiAgICAgICAgICAgICAgICBpZiAocGgua2V5cykgeyAvLyBrZXl3b3JkIGFyZ3VtZW50XG4gICAgICAgICAgICAgICAgICAgIGFyZyA9IGFyZ3ZbY3Vyc29yXVxuICAgICAgICAgICAgICAgICAgICBmb3IgKGsgPSAwOyBrIDwgcGgua2V5cy5sZW5ndGg7IGsrKykge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGFyZyA9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3Ioc3ByaW50ZignW3NwcmludGZdIENhbm5vdCBhY2Nlc3MgcHJvcGVydHkgXCIlc1wiIG9mIHVuZGVmaW5lZCB2YWx1ZSBcIiVzXCInLCBwaC5rZXlzW2tdLCBwaC5rZXlzW2stMV0pKVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgYXJnID0gYXJnW3BoLmtleXNba11dXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSBpZiAocGgucGFyYW1fbm8pIHsgLy8gcG9zaXRpb25hbCBhcmd1bWVudCAoZXhwbGljaXQpXG4gICAgICAgICAgICAgICAgICAgIGFyZyA9IGFyZ3ZbcGgucGFyYW1fbm9dXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2UgeyAvLyBwb3NpdGlvbmFsIGFyZ3VtZW50IChpbXBsaWNpdClcbiAgICAgICAgICAgICAgICAgICAgYXJnID0gYXJndltjdXJzb3IrK11cbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAocmUubm90X3R5cGUudGVzdChwaC50eXBlKSAmJiByZS5ub3RfcHJpbWl0aXZlLnRlc3QocGgudHlwZSkgJiYgYXJnIGluc3RhbmNlb2YgRnVuY3Rpb24pIHtcbiAgICAgICAgICAgICAgICAgICAgYXJnID0gYXJnKClcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAocmUubnVtZXJpY19hcmcudGVzdChwaC50eXBlKSAmJiAodHlwZW9mIGFyZyAhPT0gJ251bWJlcicgJiYgaXNOYU4oYXJnKSkpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcihzcHJpbnRmKCdbc3ByaW50Zl0gZXhwZWN0aW5nIG51bWJlciBidXQgZm91bmQgJVQnLCBhcmcpKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmIChyZS5udW1iZXIudGVzdChwaC50eXBlKSkge1xuICAgICAgICAgICAgICAgICAgICBpc19wb3NpdGl2ZSA9IGFyZyA+PSAwXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgc3dpdGNoIChwaC50eXBlKSB7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ2InOlxuICAgICAgICAgICAgICAgICAgICAgICAgYXJnID0gcGFyc2VJbnQoYXJnLCAxMCkudG9TdHJpbmcoMilcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ2MnOlxuICAgICAgICAgICAgICAgICAgICAgICAgYXJnID0gU3RyaW5nLmZyb21DaGFyQ29kZShwYXJzZUludChhcmcsIDEwKSlcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ2QnOlxuICAgICAgICAgICAgICAgICAgICBjYXNlICdpJzpcbiAgICAgICAgICAgICAgICAgICAgICAgIGFyZyA9IHBhcnNlSW50KGFyZywgMTApXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVha1xuICAgICAgICAgICAgICAgICAgICBjYXNlICdqJzpcbiAgICAgICAgICAgICAgICAgICAgICAgIGFyZyA9IEpTT04uc3RyaW5naWZ5KGFyZywgbnVsbCwgcGgud2lkdGggPyBwYXJzZUludChwaC53aWR0aCkgOiAwKVxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAnZSc6XG4gICAgICAgICAgICAgICAgICAgICAgICBhcmcgPSBwaC5wcmVjaXNpb24gPyBwYXJzZUZsb2F0KGFyZykudG9FeHBvbmVudGlhbChwaC5wcmVjaXNpb24pIDogcGFyc2VGbG9hdChhcmcpLnRvRXhwb25lbnRpYWwoKVxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAnZic6XG4gICAgICAgICAgICAgICAgICAgICAgICBhcmcgPSBwaC5wcmVjaXNpb24gPyBwYXJzZUZsb2F0KGFyZykudG9GaXhlZChwaC5wcmVjaXNpb24pIDogcGFyc2VGbG9hdChhcmcpXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVha1xuICAgICAgICAgICAgICAgICAgICBjYXNlICdnJzpcbiAgICAgICAgICAgICAgICAgICAgICAgIGFyZyA9IHBoLnByZWNpc2lvbiA/IFN0cmluZyhOdW1iZXIoYXJnLnRvUHJlY2lzaW9uKHBoLnByZWNpc2lvbikpKSA6IHBhcnNlRmxvYXQoYXJnKVxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAnbyc6XG4gICAgICAgICAgICAgICAgICAgICAgICBhcmcgPSAocGFyc2VJbnQoYXJnLCAxMCkgPj4+IDApLnRvU3RyaW5nKDgpXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVha1xuICAgICAgICAgICAgICAgICAgICBjYXNlICdzJzpcbiAgICAgICAgICAgICAgICAgICAgICAgIGFyZyA9IFN0cmluZyhhcmcpXG4gICAgICAgICAgICAgICAgICAgICAgICBhcmcgPSAocGgucHJlY2lzaW9uID8gYXJnLnN1YnN0cmluZygwLCBwaC5wcmVjaXNpb24pIDogYXJnKVxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAndCc6XG4gICAgICAgICAgICAgICAgICAgICAgICBhcmcgPSBTdHJpbmcoISFhcmcpXG4gICAgICAgICAgICAgICAgICAgICAgICBhcmcgPSAocGgucHJlY2lzaW9uID8gYXJnLnN1YnN0cmluZygwLCBwaC5wcmVjaXNpb24pIDogYXJnKVxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAnVCc6XG4gICAgICAgICAgICAgICAgICAgICAgICBhcmcgPSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwoYXJnKS5zbGljZSg4LCAtMSkudG9Mb3dlckNhc2UoKVxuICAgICAgICAgICAgICAgICAgICAgICAgYXJnID0gKHBoLnByZWNpc2lvbiA/IGFyZy5zdWJzdHJpbmcoMCwgcGgucHJlY2lzaW9uKSA6IGFyZylcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3UnOlxuICAgICAgICAgICAgICAgICAgICAgICAgYXJnID0gcGFyc2VJbnQoYXJnLCAxMCkgPj4+IDBcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3YnOlxuICAgICAgICAgICAgICAgICAgICAgICAgYXJnID0gYXJnLnZhbHVlT2YoKVxuICAgICAgICAgICAgICAgICAgICAgICAgYXJnID0gKHBoLnByZWNpc2lvbiA/IGFyZy5zdWJzdHJpbmcoMCwgcGgucHJlY2lzaW9uKSA6IGFyZylcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3gnOlxuICAgICAgICAgICAgICAgICAgICAgICAgYXJnID0gKHBhcnNlSW50KGFyZywgMTApID4+PiAwKS50b1N0cmluZygxNilcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ1gnOlxuICAgICAgICAgICAgICAgICAgICAgICAgYXJnID0gKHBhcnNlSW50KGFyZywgMTApID4+PiAwKS50b1N0cmluZygxNikudG9VcHBlckNhc2UoKVxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHJlLmpzb24udGVzdChwaC50eXBlKSkge1xuICAgICAgICAgICAgICAgICAgICBvdXRwdXQgKz0gYXJnXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBpZiAocmUubnVtYmVyLnRlc3QocGgudHlwZSkgJiYgKCFpc19wb3NpdGl2ZSB8fCBwaC5zaWduKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgc2lnbiA9IGlzX3Bvc2l0aXZlID8gJysnIDogJy0nXG4gICAgICAgICAgICAgICAgICAgICAgICBhcmcgPSBhcmcudG9TdHJpbmcoKS5yZXBsYWNlKHJlLnNpZ24sICcnKVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgc2lnbiA9ICcnXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgcGFkX2NoYXJhY3RlciA9IHBoLnBhZF9jaGFyID8gcGgucGFkX2NoYXIgPT09ICcwJyA/ICcwJyA6IHBoLnBhZF9jaGFyLmNoYXJBdCgxKSA6ICcgJ1xuICAgICAgICAgICAgICAgICAgICBwYWRfbGVuZ3RoID0gcGgud2lkdGggLSAoc2lnbiArIGFyZykubGVuZ3RoXG4gICAgICAgICAgICAgICAgICAgIHBhZCA9IHBoLndpZHRoID8gKHBhZF9sZW5ndGggPiAwID8gcGFkX2NoYXJhY3Rlci5yZXBlYXQocGFkX2xlbmd0aCkgOiAnJykgOiAnJ1xuICAgICAgICAgICAgICAgICAgICBvdXRwdXQgKz0gcGguYWxpZ24gPyBzaWduICsgYXJnICsgcGFkIDogKHBhZF9jaGFyYWN0ZXIgPT09ICcwJyA/IHNpZ24gKyBwYWQgKyBhcmcgOiBwYWQgKyBzaWduICsgYXJnKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gb3V0cHV0XG4gICAgfVxuXG4gICAgdmFyIHNwcmludGZfY2FjaGUgPSBPYmplY3QuY3JlYXRlKG51bGwpXG5cbiAgICBmdW5jdGlvbiBzcHJpbnRmX3BhcnNlKGZtdCkge1xuICAgICAgICBpZiAoc3ByaW50Zl9jYWNoZVtmbXRdKSB7XG4gICAgICAgICAgICByZXR1cm4gc3ByaW50Zl9jYWNoZVtmbXRdXG4gICAgICAgIH1cblxuICAgICAgICB2YXIgX2ZtdCA9IGZtdCwgbWF0Y2gsIHBhcnNlX3RyZWUgPSBbXSwgYXJnX25hbWVzID0gMFxuICAgICAgICB3aGlsZSAoX2ZtdCkge1xuICAgICAgICAgICAgaWYgKChtYXRjaCA9IHJlLnRleHQuZXhlYyhfZm10KSkgIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICBwYXJzZV90cmVlLnB1c2gobWF0Y2hbMF0pXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIGlmICgobWF0Y2ggPSByZS5tb2R1bG8uZXhlYyhfZm10KSkgIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICBwYXJzZV90cmVlLnB1c2goJyUnKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSBpZiAoKG1hdGNoID0gcmUucGxhY2Vob2xkZXIuZXhlYyhfZm10KSkgIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICBpZiAobWF0Y2hbMl0pIHtcbiAgICAgICAgICAgICAgICAgICAgYXJnX25hbWVzIHw9IDFcbiAgICAgICAgICAgICAgICAgICAgdmFyIGZpZWxkX2xpc3QgPSBbXSwgcmVwbGFjZW1lbnRfZmllbGQgPSBtYXRjaFsyXSwgZmllbGRfbWF0Y2ggPSBbXVxuICAgICAgICAgICAgICAgICAgICBpZiAoKGZpZWxkX21hdGNoID0gcmUua2V5LmV4ZWMocmVwbGFjZW1lbnRfZmllbGQpKSAhPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgZmllbGRfbGlzdC5wdXNoKGZpZWxkX21hdGNoWzFdKVxuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKChyZXBsYWNlbWVudF9maWVsZCA9IHJlcGxhY2VtZW50X2ZpZWxkLnN1YnN0cmluZyhmaWVsZF9tYXRjaFswXS5sZW5ndGgpKSAhPT0gJycpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKGZpZWxkX21hdGNoID0gcmUua2V5X2FjY2Vzcy5leGVjKHJlcGxhY2VtZW50X2ZpZWxkKSkgIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmllbGRfbGlzdC5wdXNoKGZpZWxkX21hdGNoWzFdKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICgoZmllbGRfbWF0Y2ggPSByZS5pbmRleF9hY2Nlc3MuZXhlYyhyZXBsYWNlbWVudF9maWVsZCkpICE9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpZWxkX2xpc3QucHVzaChmaWVsZF9tYXRjaFsxXSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBTeW50YXhFcnJvcignW3NwcmludGZdIGZhaWxlZCB0byBwYXJzZSBuYW1lZCBhcmd1bWVudCBrZXknKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBTeW50YXhFcnJvcignW3NwcmludGZdIGZhaWxlZCB0byBwYXJzZSBuYW1lZCBhcmd1bWVudCBrZXknKVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIG1hdGNoWzJdID0gZmllbGRfbGlzdFxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgYXJnX25hbWVzIHw9IDJcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKGFyZ19uYW1lcyA9PT0gMykge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1tzcHJpbnRmXSBtaXhpbmcgcG9zaXRpb25hbCBhbmQgbmFtZWQgcGxhY2Vob2xkZXJzIGlzIG5vdCAoeWV0KSBzdXBwb3J0ZWQnKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHBhcnNlX3RyZWUucHVzaChcbiAgICAgICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICAgICAgcGxhY2Vob2xkZXI6IG1hdGNoWzBdLFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1fbm86ICAgIG1hdGNoWzFdLFxuICAgICAgICAgICAgICAgICAgICAgICAga2V5czogICAgICAgIG1hdGNoWzJdLFxuICAgICAgICAgICAgICAgICAgICAgICAgc2lnbjogICAgICAgIG1hdGNoWzNdLFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFkX2NoYXI6ICAgIG1hdGNoWzRdLFxuICAgICAgICAgICAgICAgICAgICAgICAgYWxpZ246ICAgICAgIG1hdGNoWzVdLFxuICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6ICAgICAgIG1hdGNoWzZdLFxuICAgICAgICAgICAgICAgICAgICAgICAgcHJlY2lzaW9uOiAgIG1hdGNoWzddLFxuICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogICAgICAgIG1hdGNoWzhdXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgU3ludGF4RXJyb3IoJ1tzcHJpbnRmXSB1bmV4cGVjdGVkIHBsYWNlaG9sZGVyJylcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIF9mbXQgPSBfZm10LnN1YnN0cmluZyhtYXRjaFswXS5sZW5ndGgpXG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHNwcmludGZfY2FjaGVbZm10XSA9IHBhcnNlX3RyZWVcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBleHBvcnQgdG8gZWl0aGVyIGJyb3dzZXIgb3Igbm9kZS5qc1xuICAgICAqL1xuICAgIC8qIGVzbGludC1kaXNhYmxlIHF1b3RlLXByb3BzICovXG4gICAgaWYgKHR5cGVvZiBleHBvcnRzICE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1zdHJpY3QgbW9kZVxuZyA9IChmdW5jdGlvbigpIHtcblx0cmV0dXJuIHRoaXM7XG59KSgpO1xuXG50cnkge1xuXHQvLyBUaGlzIHdvcmtzIGlmIGV2YWwgaXMgYWxsb3dlZCAoc2VlIENTUClcblx0ZyA9IGcgfHwgbmV3IEZ1bmN0aW9uKFwicmV0dXJuIHRoaXNcIikoKTtcbn0gY2F0Y2ggKGUpIHtcblx0Ly8gVGhpcyB3b3JrcyBpZiB0aGUgd2luZG93IHJlZmVyZW5jZSBpcyBhdmFpbGFibGVcblx0aWYgKHR5cGVvZiB3aW5kb3cgPT09IFwib2JqZWN0XCIpIGcgPSB3aW5kb3c7XG59XG5cbi8vIGcgY2FuIHN0aWxsIGJlIHVuZGVmaW5lZCwgYnV0IG5vdGhpbmcgdG8gZG8gYWJvdXQgaXQuLi5cbi8vIFdlIHJldHVybiB1bmRlZmluZWQsIGluc3RlYWQgb2Ygbm90aGluZyBoZXJlLCBzbyBpdCdzXG4vLyBlYXNpZXIgdG8gaGFuZGxlIHRoaXMgY2FzZS4gaWYoIWdsb2JhbCkgeyAuLi59XG5cbm1vZHVsZS5leHBvcnRzID0gZztcbiJdLCJzb3VyY2VSb290IjoiIn0= + /* * Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. * @@ -25341,6 +25342,9 @@ AWS.apiLoader.services['sts']['2011-06-15'] = require('../apis/sts-2011-06-15.mi .assoc(connect.EventGraph.ANY, connect.ContactStateType.CONNECTED, connect.ContactEvents.CONNECTED) + .assoc(connect.ContactStateType.CONNECTING, + connect.ContactStateType.ERROR, + connect.ContactEvents.MISSED) .assoc(connect.ContactStateType.INCOMING, connect.ContactStateType.ERROR, connect.ContactEvents.MISSED) diff --git a/src/core.js b/src/core.js index 801d2a15..83adb596 100644 --- a/src/core.js +++ b/src/core.js @@ -959,6 +959,9 @@ .assoc(connect.EventGraph.ANY, connect.ContactStateType.CONNECTED, connect.ContactEvents.CONNECTED) + .assoc(connect.ContactStateType.CONNECTING, + connect.ContactStateType.ERROR, + connect.ContactEvents.MISSED) .assoc(connect.ContactStateType.INCOMING, connect.ContactStateType.ERROR, connect.ContactEvents.MISSED)