@aws-amplify/datastore 3.12.6-size-improvement.21 → 3.12.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/aws-amplify-datastore.js +9841 -1490
  3. package/dist/aws-amplify-datastore.js.map +1 -1
  4. package/dist/aws-amplify-datastore.min.js +11 -11
  5. package/dist/aws-amplify-datastore.min.js.map +1 -1
  6. package/lib-esm/authModeStrategies/multiAuthStrategy.js +56 -1
  7. package/lib-esm/authModeStrategies/multiAuthStrategy.js.map +1 -1
  8. package/lib-esm/datastore/datastore.js +89 -1
  9. package/lib-esm/datastore/datastore.js.map +1 -1
  10. package/lib-esm/storage/adapter/AsyncStorageAdapter.js +54 -1
  11. package/lib-esm/storage/adapter/AsyncStorageAdapter.js.map +1 -1
  12. package/lib-esm/storage/adapter/AsyncStorageDatabase.js +63 -1
  13. package/lib-esm/storage/adapter/AsyncStorageDatabase.js.map +1 -1
  14. package/lib-esm/storage/adapter/InMemoryStore.js +52 -1
  15. package/lib-esm/storage/adapter/InMemoryStore.js.map +1 -1
  16. package/lib-esm/storage/adapter/IndexedDBAdapter.js +74 -1
  17. package/lib-esm/storage/adapter/IndexedDBAdapter.js.map +1 -1
  18. package/lib-esm/storage/storage.js +85 -1
  19. package/lib-esm/storage/storage.js.map +1 -1
  20. package/lib-esm/sync/datastoreConnectivity.js +11 -1
  21. package/lib-esm/sync/datastoreConnectivity.js.map +1 -1
  22. package/lib-esm/sync/index.js +67 -1
  23. package/lib-esm/sync/index.js.map +1 -1
  24. package/lib-esm/sync/merger.js +67 -1
  25. package/lib-esm/sync/merger.js.map +1 -1
  26. package/lib-esm/sync/outbox.js +74 -1
  27. package/lib-esm/sync/outbox.js.map +1 -1
  28. package/lib-esm/sync/processors/errorMaps.js +31 -1
  29. package/lib-esm/sync/processors/errorMaps.js.map +1 -1
  30. package/lib-esm/sync/processors/mutation.js +85 -1
  31. package/lib-esm/sync/processors/mutation.js.map +1 -1
  32. package/lib-esm/sync/processors/subscription.js +67 -1
  33. package/lib-esm/sync/processors/subscription.js.map +1 -1
  34. package/lib-esm/sync/processors/sync.js +74 -1
  35. package/lib-esm/sync/processors/sync.js.map +1 -1
  36. package/lib-esm/sync/utils.js +47 -1
  37. package/lib-esm/sync/utils.js.map +1 -1
  38. package/lib-esm/types.js +36 -1
  39. package/lib-esm/types.js.map +1 -1
  40. package/lib-esm/util.js +67 -1
  41. package/lib-esm/util.js.map +1 -1
  42. package/package.json +7 -7
@@ -1,4 +1,4 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("aws_amplify_pubsub")):"function"==typeof define&&define.amd?define("aws_amplify_datastore",["aws_amplify_pubsub"],t):"object"==typeof exports?exports.aws_amplify_datastore=t(require("aws_amplify_pubsub")):e.aws_amplify_datastore=t(e.aws_amplify_pubsub)}(window,(function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=124)}([function(e,t,n){"use strict";n.r(t),n.d(t,"__extends",(function(){return i})),n.d(t,"__assign",(function(){return o})),n.d(t,"__rest",(function(){return s})),n.d(t,"__decorate",(function(){return a})),n.d(t,"__param",(function(){return u})),n.d(t,"__metadata",(function(){return c})),n.d(t,"__awaiter",(function(){return l})),n.d(t,"__generator",(function(){return f})),n.d(t,"__createBinding",(function(){return d})),n.d(t,"__exportStar",(function(){return h})),n.d(t,"__values",(function(){return p})),n.d(t,"__read",(function(){return v})),n.d(t,"__spread",(function(){return g})),n.d(t,"__spreadArrays",(function(){return y})),n.d(t,"__await",(function(){return m})),n.d(t,"__asyncGenerator",(function(){return b})),n.d(t,"__asyncDelegator",(function(){return _})),n.d(t,"__asyncValues",(function(){return w})),n.d(t,"__makeTemplateObject",(function(){return S})),n.d(t,"__importStar",(function(){return O})),n.d(t,"__importDefault",(function(){return E})),n.d(t,"__classPrivateFieldGet",(function(){return A})),n.d(t,"__classPrivateFieldSet",(function(){return I}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("aws_amplify_pubsub")):"function"==typeof define&&define.amd?define("aws_amplify_datastore",["aws_amplify_pubsub"],t):"object"==typeof exports?exports.aws_amplify_datastore=t(require("aws_amplify_pubsub")):e.aws_amplify_datastore=t(e.aws_amplify_pubsub)}(window,(function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=139)}([function(e,t,n){"use strict";n.r(t),n.d(t,"__extends",(function(){return i})),n.d(t,"__assign",(function(){return o})),n.d(t,"__rest",(function(){return s})),n.d(t,"__decorate",(function(){return a})),n.d(t,"__param",(function(){return u})),n.d(t,"__metadata",(function(){return c})),n.d(t,"__awaiter",(function(){return l})),n.d(t,"__generator",(function(){return f})),n.d(t,"__createBinding",(function(){return d})),n.d(t,"__exportStar",(function(){return h})),n.d(t,"__values",(function(){return p})),n.d(t,"__read",(function(){return v})),n.d(t,"__spread",(function(){return y})),n.d(t,"__spreadArrays",(function(){return g})),n.d(t,"__await",(function(){return m})),n.d(t,"__asyncGenerator",(function(){return b})),n.d(t,"__asyncDelegator",(function(){return w})),n.d(t,"__asyncValues",(function(){return S})),n.d(t,"__makeTemplateObject",(function(){return _})),n.d(t,"__importStar",(function(){return E})),n.d(t,"__importDefault",(function(){return A})),n.d(t,"__classPrivateFieldGet",(function(){return O})),n.d(t,"__classPrivateFieldSet",(function(){return I}));
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -13,41 +13,41 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
15
  ***************************************************************************** */
16
- var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function i(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function s(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function a(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function u(e,t){return function(n,r){t(n,r,e)}}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function f(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function d(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}function h(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||(t[n]=e[n])}function p(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function g(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(v(arguments[t]));return e}function y(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}function m(e){return this instanceof m?(this.v=e,this):new m(e)}function b(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{(n=i[e](t)).value instanceof m?Promise.resolve(n.value.v).then(u,c):l(o[0][2],n)}catch(e){l(o[0][3],e)}var n}function u(e){a("next",e)}function c(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function _(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:m(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function w(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=p(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}function S(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function O(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function E(e){return e&&e.__esModule?e:{default:e}}function A(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function I(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}},function(e,t,n){"use strict";n.d(t,"w",(function(){return p})),n.d(t,"l",(function(){return v})),n.d(t,"x",(function(){return g})),n.d(t,"o",(function(){return y})),n.d(t,"q",(function(){return m})),n.d(t,"r",(function(){return b})),n.d(t,"p",(function(){return _})),n.d(t,"e",(function(){return r})),n.d(t,"f",(function(){return i})),n.d(t,"c",(function(){return o})),n.d(t,"n",(function(){return w})),n.d(t,"s",(function(){return S})),n.d(t,"t",(function(){return O})),n.d(t,"m",(function(){return E})),n.d(t,"h",(function(){return s})),n.d(t,"v",(function(){return A})),n.d(t,"u",(function(){return I})),n.d(t,"j",(function(){return a})),n.d(t,"k",(function(){return u})),n.d(t,"a",(function(){return c})),n.d(t,"g",(function(){return l})),n.d(t,"y",(function(){return T})),n.d(t,"i",(function(){return f})),n.d(t,"b",(function(){return j})),n.d(t,"d",(function(){return C}));var r,i,o,s,a,u,c,l,f,d=n(0),h=n(2);function p(e){return e&&void 0!==e.pluralName}function v(e){return e&&e.associatedWith}function g(e){return e&&e.targetName}function y(e){return"auth"===e.type&&e.properties&&e.properties.rules&&e.properties.rules.length>0}function m(e){return"key"===e.type&&e.properties&&e.properties.fields&&e.properties.fields.length>0}function b(e){return m(e)&&void 0===e.properties.name}function _(e){return m(e)&&void 0!==e.properties.name&&e.properties.fields.length>2}function w(e){return e&&void 0!==o[e]}function S(e){return!(!e||!e.model)}function O(e){return!(!e||!e.nonModel)}function E(e){return!(!e||!e.enum)}function A(e){return e&&void 0!==e.field}function I(e){return e&&void 0!==e.type}function T(e,t){return Object(d.__awaiter)(this,void 0,void 0,(function(){return Object(d.__generator)(this,(function(n){return[2,{modelConstructor:e,conditionProducer:t}]}))}))}!function(e){e.CUSTOM="custom",e.OWNER="owner",e.GROUPS="groups",e.PRIVATE="private",e.PUBLIC="public"}(r||(r={})),function(e){e.FUNCTION="function",e.USER_POOLS="userPools",e.OIDC="oidc",e.IAM="iam",e.API_KEY="apiKey"}(i||(i={})),function(e){e[e.ID=0]="ID",e[e.String=1]="String",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Boolean=4]="Boolean",e[e.AWSDate=5]="AWSDate",e[e.AWSTime=6]="AWSTime",e[e.AWSDateTime=7]="AWSDateTime",e[e.AWSTimestamp=8]="AWSTimestamp",e[e.AWSEmail=9]="AWSEmail",e[e.AWSJSON=10]="AWSJSON",e[e.AWSURL=11]="AWSURL",e[e.AWSPhone=12]="AWSPhone",e[e.AWSIPAddress=13]="AWSIPAddress"}(o||(o={})),function(e){e.getJSType=function(e){switch(e){case"Boolean":return"boolean";case"ID":case"String":case"AWSDate":case"AWSTime":case"AWSDateTime":case"AWSEmail":case"AWSURL":case"AWSPhone":case"AWSIPAddress":return"string";case"Int":case"Float":case"AWSTimestamp":return"number";case"AWSJSON":return"object";default:Object(h.h)(e)}},e.getValidationFunction=function(e){switch(e){case"AWSDate":return h.l;case"AWSTime":return h.r;case"AWSDateTime":return h.m;case"AWSTimestamp":return h.s;case"AWSEmail":return h.n;case"AWSJSON":return h.p;case"AWSURL":return h.t;case"AWSPhone":return h.q;case"AWSIPAddress":return h.o;default:return}}}(o||(o={})),function(e){e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"}(s||(s={})),function(e){e[e.FIRST=0]="FIRST",e[e.LAST=1]="LAST"}(a||(a={})),function(e){e.ASCENDING="ASCENDING",e.DESCENDING="DESCENDING"}(u||(u={})),function(e){e.DEFAULT="DEFAULT",e.MULTI_AUTH="MULTI_AUTH"}(c||(c={})),function(e){e.CREATE="CREATE",e.READ="READ",e.UPDATE="UPDATE",e.DELETE="DELETE"}(l||(l={})),function(e){e.sync="sync",e.mutate="mutate",e.subscribe="subscribe"}(f||(f={}));var C,j=Symbol("DISCARD");!function(e){e.LIMIT="LIMIT",e.TIMER="TIMER"}(C||(C={}))},function(e,t,n){"use strict";n.d(t,"e",(function(){return O})),n.d(t,"d",(function(){return E})),n.d(t,"c",(function(){return A})),n.d(t,"a",(function(){return S})),n.d(t,"f",(function(){return I})),n.d(t,"h",(function(){return T})),n.d(t,"w",(function(){return C})),n.d(t,"D",(function(){return j})),n.d(t,"u",(function(){return x})),n.d(t,"A",(function(){return k})),n.d(t,"v",(function(){return R})),n.d(t,"g",(function(){return D})),n.d(t,"C",(function(){return F})),n.d(t,"i",(function(){return L})),n.d(t,"j",(function(){return B})),n.d(t,"x",(function(){return q})),n.d(t,"z",(function(){return V})),n.d(t,"k",(function(){return K})),n.d(t,"B",(function(){return G})),n.d(t,"E",(function(){return H})),n.d(t,"l",(function(){return W})),n.d(t,"r",(function(){return Y})),n.d(t,"m",(function(){return J})),n.d(t,"s",(function(){return $})),n.d(t,"n",(function(){return Q})),n.d(t,"p",(function(){return Z})),n.d(t,"t",(function(){return X})),n.d(t,"q",(function(){return ee})),n.d(t,"o",(function(){return te})),n.d(t,"b",(function(){return re})),n.d(t,"y",(function(){return ie}));var r=n(0),i=n(6);function o(e){var t=new Error(e);return t.source="ulid",t}var s="0123456789ABCDEFGHJKMNPQRSTVWXYZ",a=s.length,u=Math.pow(2,48)-1;function c(e,t,n){return t>e.length-1?e:e.substr(0,t)+n+e.substr(t+1)}function l(e){var t=Math.floor(e()*a);return t===a&&(t=a-1),s.charAt(t)}function f(e,t){if(isNaN(e))throw new Error(e+" must be a number");if(e>u)throw o("cannot encode time greater than "+u);if(e<0)throw o("time must be positive");if(!1===Number.isInteger(e))throw o("time must be an integer");for(var n=void 0,r="";t>0;t--)r=s.charAt(n=e%a)+r,e=(e-n)/a;return r}function d(e,t){for(var n="";e>0;e--)n=l(t)+n;return n}function h(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments[1];t||(t="undefined"!=typeof window?window:null);var r=t&&(t.crypto||t.msCrypto);if(r)return function(){var e=new Uint8Array(1);return r.getRandomValues(e),e[0]/255};try{var i=n(78);return function(){return i.randomBytes(1).readUInt8()/255}}catch(e){}if(e){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch(e){}return function(){return Math.random()}}throw o("secure crypto unusable, insecure Math.random not allowed")}function p(e){e||(e=h());var t=0,n=void 0;return function(r){if(isNaN(r)&&(r=Date.now()),r<=t){var i=n=function(e){for(var t=void 0,n=e.length,r=void 0,i=void 0,u=a-1;!t&&n-- >=0;){if(r=e[n],-1===(i=s.indexOf(r)))throw o("incorrectly encoded string");i!==u?t=c(e,n,s[i+1]):e=c(e,n,s[0])}if("string"==typeof t)return t;throw o("cannot increment this string")}(n);return f(t,10)+i}t=r;var u=n=d(16,e);return f(r,10)+u}}v||(v=h());var v,g,y=n(29),m=n(15),b=n(1),_=n(8);function w(e){return(w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e){e.DATASTORE="datastore",e.USER="user",e.SYNC="sync",e.STORAGE="storage"}(g||(g={}));var S=g.DATASTORE,O=g.USER,E=g.SYNC,A=g.STORAGE,I="/DataStore",T=function(e,t){if(void 0===t&&(t=!0),t)throw new Error("Invalid "+e)},C=function(e){return void 0===e||null==e},j=function e(t,n,r){var i,o=!1;if(0===r.length)return!0;switch(n){case"not":i="every",o=!0;break;case"and":i="every";break;case"or":i="some";break;default:T(n)}var s=r[i]((function(n){if(Object(b.v)(n)){var r=n.field,i=n.operator,o=n.operand,s=t[r];return P(s,i,o)}if(Object(b.u)(n)){var a=n.type,u=n.predicates;return e(t,a,u)}throw new Error("Not a predicate or group")}));return o?!s:s},P=function(e,t,n){switch(t){case"ne":return e!==n;case"eq":return e===n;case"le":return e<=n;case"lt":return e<n;case"ge":return e>=n;case"gt":return e>n;case"between":var i=Object(r.__read)(n,2),o=i[0],s=i[1];return e>=o&&e<=s;case"beginsWith":return!C(e)&&e.startsWith(n);case"contains":return!C(e)&&e.indexOf(n)>-1;case"notContains":return C(e)||-1===e.indexOf(n);default:return T(t,!1),!1}},x=function(e){return e&&"function"==typeof e.copyOf},N=new WeakSet;function k(e){N.add(e)}var M,R=function(e){return N.has(e)},D=function(e){var t={},n={};return Object.keys(e.models).forEach((function(i){var o,s,a,u;t[i]={indexes:[],relationTypes:[]},n[i]={};var c,l,f,d=e.models[i];if(Object.keys(d.fields).forEach((function(e){var n=d.fields[e];if("object"===w(n.type)&&"model"in n.type){var r=n.association.connectionType;t[i].relationTypes.push({fieldName:n.name,modelName:n.type.model,relationType:r,targetName:n.association.targetName,associatedWith:n.association.associatedWith}),"BELONGS_TO"===r&&t[i].indexes.push(n.association.targetName)}})),d.attributes){n[i].compositeKeys=(c=d.attributes,f=(l=function(e){return e.reduce((function(e,t){var n=new Set(t);if(0===e.length)return e.push(n),e;var i=e.findIndex((function(e){return Object(r.__spread)(e).some((function(e){return n.has(e)}))}));if(i>-1){var o=new Set(Object(r.__spread)(e[i],n));e[i]=o}else e.push(n);return e}),[])})(c.filter(b.p).map((function(e){return Object(r.__read)(e.properties.fields).slice(1)}))),l(f));try{for(var h=Object(r.__values)(d.attributes),p=h.next();!p.done;p=h.next()){var v=p.value;if(Object(b.q)(v)){Object(b.r)(v)&&(n[i].primaryKey=v.properties.fields);var g=v.properties.fields;try{for(var y=(a=void 0,Object(r.__values)(g)),m=y.next();!m.done;m=y.next()){var _=m.value;t[i].indexes.includes(_)||t[i].indexes.push(_)}}catch(e){a={error:e}}finally{try{m&&!m.done&&(u=y.return)&&u.call(y)}finally{if(a)throw a.error}}}}}catch(e){o={error:e}}finally{try{p&&!p.done&&(s=h.return)&&s.call(h)}finally{if(o)throw o.error}}}})),[t,n]},U=new WeakMap,F=function(e,t,n,r,i){var o=n.relationships,s=i(n.name,e),a=o[e],u=[],c=s.copyOf(t,(function(e){a.relationTypes.forEach((function(o){var s=i(n.name,o.modelName);switch(o.relationType){case"HAS_ONE":if(t[o.fieldName]){var a=void 0;try{a=r(s,t[o.fieldName])}catch(e){console.log(e)}u.push({modelName:o.modelName,item:t[o.fieldName],instance:a}),o.targetName?(e[o.targetName]=e[o.fieldName].id,delete e[o.fieldName]):e[o.fieldName]=e[o.fieldName].id}break;case"BELONGS_TO":if(t[o.fieldName]){a=void 0;try{a=r(s,t[o.fieldName])}catch(e){}e[o.fieldName]._deleted||u.push({modelName:o.modelName,item:t[o.fieldName],instance:a})}e[o.fieldName]&&(e[o.targetName]=e[o.fieldName].id,delete e[o.fieldName]);break;case"HAS_MANY":break;default:T(o.relationType)}}))}));u.unshift({modelName:e,item:c,instance:c}),U.has(n)||U.set(n,Array.from(n.modelTopologicalOrdering.keys()));var l=U.get(n);return u.sort((function(e,t){return l.indexOf(e.modelName)-l.indexOf(t.modelName)})),u},L=function(e,t){var n="";return e.some((function(e){e.modelName===t&&(n=e.targetName)})),n},B=function(e,t){return e.find((function(e){return e===t}))},q=function(){return new Promise((function(e){var t,n=Object(y.v4)(),i=function(){M=!1,e(!0)},o=function(){return Object(r.__awaiter)(void 0,void 0,void 0,(function(){return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return t&&t.result&&"function"==typeof t.result.close?[4,t.result.close()]:[3,2];case 1:r.sent(),r.label=2;case 2:return[4,indexedDB.deleteDatabase(n)];case 3:return r.sent(),M=!0,[2,e(!1)]}}))}))};return!0===M?o():!1===M||null===indexedDB?i():((t=indexedDB.open(n)).onerror=i,void(t.onsuccess=o))}))},z=function(){return(e=1,i.Buffer.from((new _.j).random(e).toString(),"hex")).readUInt8(0)/255;var e};function V(e){var t=p(z);return function(){return t(e)}}function K(){return"undefined"!=typeof performance&&performance&&"function"==typeof performance.now?0|performance.now():Date.now()}function G(e){return function(t,n){var i,o;try{for(var s=Object(r.__values)(e),a=s.next();!a.done;a=s.next()){var u=a.value,c=u.field,l=u.sortDirection===b.k.ASCENDING?1:-1;if(t[c]<n[c])return-1*l;if(t[c]>n[c])return 1*l}}catch(e){i={error:e}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}return 0}}function H(e,t,n){var i,o;void 0===n&&(n=!1);var s,a,u=e,c=t;if(u instanceof Object&&!(c instanceof Object)||!(u instanceof Object)&&c instanceof Object)return!1;if(!(u instanceof Object))return!(!n||(s=u,a=c,null!=s||null!=a))||u===c;if(Array.isArray(u)&&!Array.isArray(c)||Array.isArray(c)&&!Array.isArray(u))return!1;u instanceof Set&&c instanceof Set&&(u=Object(r.__spread)(u),c=Object(r.__spread)(c)),u instanceof Map&&c instanceof Map&&(u=Object.fromEntries(u),c=Object.fromEntries(c));var l=Object.keys(u),f=Object.keys(c);if(l.length!==f.length&&(!n||Array.isArray(u)))return!1;var d=l.length>=f.length?l:f;try{for(var h=Object(r.__values)(d),p=h.next();!p.done;p=h.next()){var v=p.value;if(!H(u[v],c[v],n))return!1}}catch(e){i={error:e}}finally{try{p&&!p.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}return!0}var W=function(e){return!!/^\d{4}-\d{2}-\d{2}(Z|[+-]\d{2}:\d{2}($|:\d{2}))?$/.exec(e)},Y=function(e){return!!/^\d{2}:\d{2}(:\d{2}(.\d+)?)?(Z|[+-]\d{2}:\d{2}($|:\d{2}))?$/.exec(e)},J=function(e){return!!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(.\d+)?)?(Z|[+-]\d{2}:\d{2}($|:\d{2}))?$/.exec(e)},$=function(e){return!!/^\d+$/.exec(String(e))},Q=function(e){return!!/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.exec(e)},Z=function(e){try{return JSON.parse(e),!0}catch(e){return!1}},X=function(e){try{return!!new URL(e)}catch(e){return!1}},ee=function(e){return!!/^\+?\d[\d\s-]+$/.exec(e)},te=function(e){return!!/((^((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))$)|(^((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?$))$/.exec(e)},ne=function(){var e=this;this.promise=new Promise((function(t,n){e.resolve=t,e.reject=n}))},re=function(){function e(e){this.limitPromise=new ne,this.raceInFlight=!1,this.callback=function(){},this.defaultErrorHandler=function(e){throw void 0===e&&(e="DeferredCallbackResolver error"),new Error(e)},this.callback=e.callback,this.errorHandler=e.errorHandler||this.defaultErrorHandler,this.maxInterval=e.maxInterval||2e3}return e.prototype.startTimer=function(){var e=this;this.timerPromise=new Promise((function(t,n){e.timer=setTimeout((function(){t(b.d.TIMER)}),e.maxInterval)}))},e.prototype.racePromises=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){var e,t;return Object(r.__generator)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,3,4]),this.raceInFlight=!0,this.startTimer(),[4,Promise.race([this.timerPromise,this.limitPromise.promise])];case 1:return e=n.sent(),this.callback(),[3,4];case 2:return t=n.sent(),this.errorHandler(t),[3,4];case 3:return this.clear(),this.raceInFlight=!1,this.limitPromise=new ne,[2,e];case 4:return[2]}}))}))},e.prototype.start=function(){this.raceInFlight||this.racePromises()},e.prototype.clear=function(){clearTimeout(this.timer)},e.prototype.resolve=function(){this.limitPromise.resolve(b.d.LIMIT)},e}();function ie(e,t,n){var r,i=t.concat(n);return Object(m.d)(e,(function(e){Object(m.a)(e,i)}),(function(e){r=e})),r}},function(e,t,n){"use strict";var r,i,o;function s(e){return e&&!!["provider"].find((function(t){return e.hasOwnProperty(t)}))}function a(e){return e&&!!["customProvider"].find((function(t){return e.hasOwnProperty(t)}))}function u(e){return e&&!!["customState"].find((function(t){return e.hasOwnProperty(t)}))}function c(e){return void 0!==e.redirectSignIn}function l(e){return!!e.username}n.d(t,"b",(function(){return r})),n.d(t,"f",(function(){return s})),n.d(t,"g",(function(){return a})),n.d(t,"d",(function(){return u})),n.d(t,"e",(function(){return c})),n.d(t,"a",(function(){return i})),n.d(t,"h",(function(){return l})),n.d(t,"c",(function(){return o})),function(e){e.Cognito="COGNITO",e.Google="Google",e.Facebook="Facebook",e.Amazon="LoginWithAmazon",e.Apple="SignInWithApple"}(r||(r={})),function(e){e.NoConfig="noConfig",e.MissingAuthConfig="missingAuthConfig",e.EmptyUsername="emptyUsername",e.InvalidUsername="invalidUsername",e.EmptyPassword="emptyPassword",e.EmptyCode="emptyCode",e.SignUpError="signUpError",e.NoMFA="noMFA",e.InvalidMFA="invalidMFA",e.EmptyChallengeResponse="emptyChallengeResponse",e.NoUserSession="noUserSession",e.Default="default",e.DeviceConfig="deviceConfig",e.NetworkError="networkError",e.AutoSignInError="autoSignInError"}(i||(i={})),function(e){e.API_KEY="API_KEY",e.AWS_IAM="AWS_IAM",e.OPENID_CONNECT="OPENID_CONNECT",e.AMAZON_COGNITO_USER_POOLS="AMAZON_COGNITO_USER_POOLS",e.AWS_LAMBDA="AWS_LAMBDA"}(o||(o={}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return f})),n.d(t,"e",(function(){return y})),n.d(t,"c",(function(){return m})),n.d(t,"b",(function(){return b})),n.d(t,"d",(function(){return _})),n.d(t,"k",(function(){return w})),n.d(t,"l",(function(){return S})),n.d(t,"j",(function(){return O})),n.d(t,"h",(function(){return E})),n.d(t,"g",(function(){return A})),n.d(t,"f",(function(){return I})),n.d(t,"i",(function(){return T}));var r=n(0),i=n(3),o=n(20),s=n(21),a=n(1),u=n(2);function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var l,f,d=new s.a("DataStore");!function(e){e.LIST="query",e.CREATE="mutation",e.UPDATE="mutation",e.DELETE="mutation",e.GET="query"}(l||(l={})),function(e){e.CREATE="Create",e.UPDATE="Update",e.DELETE="Delete",e.GET="Get"}(f||(f={}));var h={_version:void 0,_lastChangedAt:void 0,_deleted:void 0},p=Object.keys(h);function v(e,t){var n=g(t),r=function(e,t){var n=[];return Object.values(t.fields).forEach((function(t){var r=t.name,i=t.type;if(Object(a.t)(i)){var o=e.nonModels[i.nonModel],s=Object.values(g(o)).map((function(e){return e.name})),u=[];Object.values(o.fields).forEach((function(t){var n=t.type,r=t.name;if(Object(a.t)(n)){var i=e.nonModels[n.nonModel];u.push(r+" { "+v(e,i)+" }")}})),n.push(r+" { "+s.join(" ")+" "+u.join(" ")+" }")}})),n}(e,t),i=function(e,t){var n=function(e){var t=[];Object(a.w)(e)&&e.attributes&&e.attributes.forEach((function(e){if(e.properties&&e.properties.rules){var n=e.properties.rules.find((function(e){return"owner"===e.allow}));n&&n.ownerField&&t.push(n.ownerField)}}));return t}(e);if(!t.owner&&n.includes("owner"))return["owner"];return[]}(t,n),o=Object.values(n).map((function(e){return e.name})).concat(i).concat(r);return Object(a.w)(t)&&(o=o.concat(p).concat(function(e){var t=[];return Object.values(e.fields).filter((function(e){var t=e.association;return t&&Object.keys(t).length})).forEach((function(e){var n=e.name,r=e.association,i=r.connectionType;switch(i){case"HAS_ONE":case"HAS_MANY":break;case"BELONGS_TO":Object(a.x)(r)&&t.push(n+" { id _deleted }");break;default:Object(u.h)(i)}})),t}(t))),o.join("\n")}function g(e){var t=e.fields;return Object.values(t).filter((function(e){return!(!Object(a.n)(e.type)&&!Object(a.m)(e.type))})).reduce((function(e,t){return e[t.name]=t,e}),{})}function y(e){var t=([].concat(e.attributes).find((function(e){return e&&"auth"===e.type}))||{}).properties,n=(void 0===t?{}:t).rules,r=[];return(void 0===n?[]:n).forEach((function(t){var n=t.identityClaim,i=void 0===n?"cognito:username":n,o=t.ownerField,s=void 0===o?"owner":o,a=t.operations,u=void 0===a?["create","update","delete","read"]:a,c=t.provider,l=void 0===c?"userPools":c,f=t.groupClaim,d=void 0===f?"cognito:groups":f,h=t.allow,p=void 0===h?"iam":h,v=t.groups,g=void 0===v?[]:v,y="owner"===p;if(u.includes("read")||y){var m={identityClaim:i,ownerField:s,provider:l,groupClaim:d,authStrategy:p,groups:g,areSubscriptionsPublic:!1};if(y){var b=([].concat(e.attributes).find((function(e){return e&&"model"===e.type}))||{}).properties,_=(void 0===b?{}:b).subscriptions,w=(void 0===_?{}:_).level,S=void 0===w?"on":w;m.areSubscriptionsPublic=!u.includes("read")||"public"===S}y?r.push(m):r.unshift(m)}})),r}function m(e,t,n,r,i){var o=v(e,t),s=t.name,a=(t.pluralName,"on"+n+s),u="",c="";return r&&(u="($"+i+": String!)",c="("+i+": $"+i+")"),[n,a,"subscription operation"+u+"{\n\t\t\t"+a+c+"{\n\t\t\t\t"+o+"\n\t\t\t}\n\t\t}"]}function b(e,t,n){var r,i,o=v(e,t),s=t.name,a=t.pluralName,c=" ",d=" ";switch(n){case"LIST":r="sync"+a,c="($limit: Int, $nextToken: String, $lastSync: AWSTimestamp, $filter: Model"+s+"FilterInput)",d="(limit: $limit, nextToken: $nextToken, lastSync: $lastSync, filter: $filter)",o="items {\n\t\t\t\t\t\t\t"+o+"\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnextToken\n\t\t\t\t\t\tstartedAt";break;case"CREATE":r="create"+s,c="($input: Create"+s+"Input!)",d="(input: $input)",i=f.CREATE;break;case"UPDATE":r="update"+s,c="($input: Update"+s+"Input!, $condition: Model"+s+"ConditionInput)",d="(input: $input, condition: $condition)",i=f.UPDATE;break;case"DELETE":r="delete"+s,c="($input: Delete"+s+"Input!, $condition: Model"+s+"ConditionInput)",d="(input: $input, condition: $condition)",i=f.DELETE;break;case"GET":r="get"+s,c="($id: ID!)",d="(id: $id)",i=f.GET;break;default:Object(u.h)(n)}return[[i,r,l[n]+" operation"+c+"{\n\t\t"+r+d+"{\n\t\t\t"+o+"\n\t\t}\n\t}"]]}function _(e,t,n,i,o,s,l,d,h){var p;switch(n){case a.h.INSERT:p=f.CREATE;break;case a.h.UPDATE:p=f.UPDATE;break;case a.h.DELETE:p=f.DELETE;break;default:Object(u.h)(n)}return d(l,Object(r.__assign)(Object(r.__assign)({},h?{id:h}:{}),{data:JSON.stringify(o,(function(e,n){return e&&null!==n&&"object"===c(n)&&t.fields[e]&&"AWSJSON"===t.fields[e].type?JSON.stringify(n):n})),modelId:o.id,model:i.name,operation:p,condition:JSON.stringify(s)}))}function w(e){var t={};return e&&Array.isArray(e.predicates)?(e.predicates.forEach((function(e){var n;if(Object(a.v)(e)){var r=e.field,i=e.operator,o=e.operand;if("id"===r)return;t[r]=((n={})[i]=o,n)}else t[e.type]=w(e)})),t):t}function S(e){var t={};if(!e||!Array.isArray(e.predicates))return t;var n=e.type,r=e.predicates,i="and"===n||"or"===n;t[n]=i?[]:{};var o=function(e){return i?t[n].push(e):t[n]=e};return r.forEach((function(e){var t,n;if(Object(a.v)(e)){var r=e.field,i=e.operator,s=e.operand,u=((t={})[r]=((n={})[i]=s,n),t);o(u)}else o(S(e))})),t}function O(e,t){var n=e[t.groupClaim]||[];if("string"==typeof n){var r=void 0;try{r=JSON.parse(n)}catch(e){r=n}n=[].concat(r)}return n}function E(e){var t=e.authModeStrategy,n=e.defaultAuthMode,i=e.modelName,o=e.schema;return Object(r.__awaiter)(this,void 0,void 0,(function(){var e,s,u,c=this;return Object(r.__generator)(this,(function(l){switch(l.label){case 0:e=Object.values(a.g),s={CREATE:[],READ:[],UPDATE:[],DELETE:[]},l.label=1;case 1:return l.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e){return Object(r.__awaiter)(c,void 0,void 0,(function(){var a;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return[4,t({schema:o,modelName:i,operation:e})];case 1:return"string"==typeof(a=r.sent())?s[e]=[a]:Array.isArray(a)&&a.length?s[e]=a:s[e]=[n],[2]}}))}))})))];case 2:return l.sent(),[3,4];case 3:return u=l.sent(),d.debug("Error getting auth modes for model: "+i,u),[3,4];case 4:return[2,s]}}))}))}function A(e){var t,n=["Request failed with status code 401","Request failed with status code 403"];return e&&e.errors?t=e.errors.find((function(e){return n.includes(e.message)})):e&&e.message&&(t=e),t?t.message:null}function I(e){var t=Object.values(o.a);return e&&e.message&&t.find((function(t){return e.message.includes(t)}))||null}function T(e,t){return void 0===t&&(t={}),Object(r.__awaiter)(this,void 0,void 0,(function(){var n,o,s;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:if(e!==i.c.AWS_LAMBDA)return[3,6];if(n=t.authProviders,!(o=(void 0===n?{functionAuthProvider:null}:n).functionAuthProvider)||"function"!=typeof o)return[3,5];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,o()];case 2:return[2,r.sent().token];case 3:throw s=r.sent(),new Error("Error retrieving token from `functionAuthProvider`: "+s);case 4:return[3,6];case 5:throw new Error("You must provide a `functionAuthProvider` function to `DataStore.configure` when using "+i.c.AWS_LAMBDA);case 6:return[2]}}))}))}},function(e,t,n){"use strict";n.d(t,"c",(function(){return o})),n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return a}));var r=n(2),i=new WeakSet;function o(e){return i.has(e)}Symbol("A predicate that matches all records");var s=function(){function e(){}return Object.defineProperty(e,"ALL",{get:function(){var e=function(e){return e};return i.add(e),e},enumerable:!0,configurable:!0}),e}(),a=function(){function e(){}return e.createPredicateBuilder=function(t){var n,i=t.name,o=new Set(Object.keys(t.fields)),s=new Proxy({},n={get:function(t,s,a){var u=s;switch(u){case"and":case"or":case"not":return function(t){var r={type:u,predicates:[]},i=new Proxy({},n);return e.predicateGroupsMap.set(i,r),t(i),e.predicateGroupsMap.get(a).predicates.push(r),a};default:Object(r.h)(u,!1)}var c=s;if(!o.has(c))throw new Error("Invalid field for model. field: "+c+", model: "+i);return function(t,n){return e.predicateGroupsMap.get(a).predicates.push({field:c,operator:t,operand:n}),a}}});return e.predicateGroupsMap.set(s,{type:"and",predicates:[]}),s},e.isValidPredicate=function(t){return e.predicateGroupsMap.has(t)},e.getPredicates=function(t,n){if(void 0===n&&(n=!0),n&&!e.isValidPredicate(t))throw new Error("The predicate is not valid");return e.predicateGroupsMap.get(t)},e.createFromExisting=function(t,n){if(n&&t)return n(e.createPredicateBuilder(t))},e.createForId=function(t,n){return e.createPredicateBuilder(t).id("eq",n)},e.predicateGroupsMap=new WeakMap,e}()},function(e,t,n){"use strict";(function(e){
16
+ var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function i(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function s(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function a(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function u(e,t){return function(n,r){t(n,r,e)}}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function f(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function d(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}function h(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||(t[n]=e[n])}function p(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function y(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(v(arguments[t]));return e}function g(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}function m(e){return this instanceof m?(this.v=e,this):new m(e)}function b(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{(n=i[e](t)).value instanceof m?Promise.resolve(n.value.v).then(u,c):l(o[0][2],n)}catch(e){l(o[0][3],e)}var n}function u(e){a("next",e)}function c(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function w(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:m(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function S(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=p(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}function _(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function E(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function A(e){return e&&e.__esModule?e:{default:e}}function O(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function I(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}},function(e,t,n){"use strict";n.d(t,"w",(function(){return v})),n.d(t,"l",(function(){return y})),n.d(t,"x",(function(){return g})),n.d(t,"o",(function(){return m})),n.d(t,"q",(function(){return b})),n.d(t,"r",(function(){return w})),n.d(t,"p",(function(){return S})),n.d(t,"e",(function(){return r})),n.d(t,"f",(function(){return i})),n.d(t,"c",(function(){return o})),n.d(t,"n",(function(){return _})),n.d(t,"s",(function(){return E})),n.d(t,"t",(function(){return A})),n.d(t,"m",(function(){return O})),n.d(t,"h",(function(){return s})),n.d(t,"v",(function(){return I})),n.d(t,"u",(function(){return T})),n.d(t,"j",(function(){return a})),n.d(t,"k",(function(){return u})),n.d(t,"a",(function(){return c})),n.d(t,"g",(function(){return l})),n.d(t,"y",(function(){return C})),n.d(t,"i",(function(){return f})),n.d(t,"b",(function(){return P})),n.d(t,"d",(function(){return x}));var r,i,o,s,a,u,c,l,f,d=n(2),h=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},p=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};function v(e){return e&&void 0!==e.pluralName}function y(e){return e&&e.associatedWith}function g(e){return e&&e.targetName}function m(e){return"auth"===e.type&&e.properties&&e.properties.rules&&e.properties.rules.length>0}function b(e){return"key"===e.type&&e.properties&&e.properties.fields&&e.properties.fields.length>0}function w(e){return b(e)&&void 0===e.properties.name}function S(e){return b(e)&&void 0!==e.properties.name&&e.properties.fields.length>2}function _(e){return e&&void 0!==o[e]}function E(e){return!(!e||!e.model)}function A(e){return!(!e||!e.nonModel)}function O(e){return!(!e||!e.enum)}function I(e){return e&&void 0!==e.field}function T(e){return e&&void 0!==e.type}function C(e,t){return h(this,void 0,void 0,(function(){return p(this,(function(n){return[2,{modelConstructor:e,conditionProducer:t}]}))}))}!function(e){e.CUSTOM="custom",e.OWNER="owner",e.GROUPS="groups",e.PRIVATE="private",e.PUBLIC="public"}(r||(r={})),function(e){e.FUNCTION="function",e.USER_POOLS="userPools",e.OIDC="oidc",e.IAM="iam",e.API_KEY="apiKey"}(i||(i={})),function(e){e[e.ID=0]="ID",e[e.String=1]="String",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Boolean=4]="Boolean",e[e.AWSDate=5]="AWSDate",e[e.AWSTime=6]="AWSTime",e[e.AWSDateTime=7]="AWSDateTime",e[e.AWSTimestamp=8]="AWSTimestamp",e[e.AWSEmail=9]="AWSEmail",e[e.AWSJSON=10]="AWSJSON",e[e.AWSURL=11]="AWSURL",e[e.AWSPhone=12]="AWSPhone",e[e.AWSIPAddress=13]="AWSIPAddress"}(o||(o={})),function(e){e.getJSType=function(e){switch(e){case"Boolean":return"boolean";case"ID":case"String":case"AWSDate":case"AWSTime":case"AWSDateTime":case"AWSEmail":case"AWSURL":case"AWSPhone":case"AWSIPAddress":return"string";case"Int":case"Float":case"AWSTimestamp":return"number";case"AWSJSON":return"object";default:Object(d.h)(e)}},e.getValidationFunction=function(e){switch(e){case"AWSDate":return d.l;case"AWSTime":return d.r;case"AWSDateTime":return d.m;case"AWSTimestamp":return d.s;case"AWSEmail":return d.n;case"AWSJSON":return d.p;case"AWSURL":return d.t;case"AWSPhone":return d.q;case"AWSIPAddress":return d.o;default:return}}}(o||(o={})),function(e){e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"}(s||(s={})),function(e){e[e.FIRST=0]="FIRST",e[e.LAST=1]="LAST"}(a||(a={})),function(e){e.ASCENDING="ASCENDING",e.DESCENDING="DESCENDING"}(u||(u={})),function(e){e.DEFAULT="DEFAULT",e.MULTI_AUTH="MULTI_AUTH"}(c||(c={})),function(e){e.CREATE="CREATE",e.READ="READ",e.UPDATE="UPDATE",e.DELETE="DELETE"}(l||(l={})),function(e){e.sync="sync",e.mutate="mutate",e.subscribe="subscribe"}(f||(f={}));var x,P=Symbol("DISCARD");!function(e){e.LIMIT="LIMIT",e.TIMER="TIMER"}(x||(x={}))},function(e,t,n){"use strict";n.d(t,"e",(function(){return T})),n.d(t,"d",(function(){return C})),n.d(t,"c",(function(){return x})),n.d(t,"a",(function(){return I})),n.d(t,"f",(function(){return P})),n.d(t,"h",(function(){return k})),n.d(t,"w",(function(){return N})),n.d(t,"D",(function(){return M})),n.d(t,"u",(function(){return R})),n.d(t,"A",(function(){return U})),n.d(t,"v",(function(){return L})),n.d(t,"g",(function(){return B})),n.d(t,"C",(function(){return z})),n.d(t,"i",(function(){return K})),n.d(t,"j",(function(){return H})),n.d(t,"x",(function(){return V})),n.d(t,"z",(function(){return W})),n.d(t,"k",(function(){return Y})),n.d(t,"B",(function(){return J})),n.d(t,"E",(function(){return $})),n.d(t,"l",(function(){return Z})),n.d(t,"r",(function(){return Q})),n.d(t,"m",(function(){return X})),n.d(t,"s",(function(){return ee})),n.d(t,"n",(function(){return te})),n.d(t,"p",(function(){return ne})),n.d(t,"t",(function(){return re})),n.d(t,"q",(function(){return ie})),n.d(t,"o",(function(){return oe})),n.d(t,"b",(function(){return ae})),n.d(t,"y",(function(){return ue}));var r=n(6);function i(e){var t=new Error(e);return t.source="ulid",t}var o="0123456789ABCDEFGHJKMNPQRSTVWXYZ",s=o.length,a=Math.pow(2,48)-1;function u(e,t,n){return t>e.length-1?e:e.substr(0,t)+n+e.substr(t+1)}function c(e){var t=Math.floor(e()*s);return t===s&&(t=s-1),o.charAt(t)}function l(e,t){if(isNaN(e))throw new Error(e+" must be a number");if(e>a)throw i("cannot encode time greater than "+a);if(e<0)throw i("time must be positive");if(!1===Number.isInteger(e))throw i("time must be an integer");for(var n=void 0,r="";t>0;t--)r=o.charAt(n=e%s)+r,e=(e-n)/s;return r}function f(e,t){for(var n="";e>0;e--)n=c(t)+n;return n}function d(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments[1];t||(t="undefined"!=typeof window?window:null);var r=t&&(t.crypto||t.msCrypto);if(r)return function(){var e=new Uint8Array(1);return r.getRandomValues(e),e[0]/255};try{var o=n(87);return function(){return o.randomBytes(1).readUInt8()/255}}catch(e){}if(e){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch(e){}return function(){return Math.random()}}throw i("secure crypto unusable, insecure Math.random not allowed")}function h(e){e||(e=d());var t=0,n=void 0;return function(r){if(isNaN(r)&&(r=Date.now()),r<=t){var a=n=function(e){for(var t=void 0,n=e.length,r=void 0,a=void 0,c=s-1;!t&&n-- >=0;){if(r=e[n],-1===(a=o.indexOf(r)))throw i("incorrectly encoded string");a!==c?t=u(e,n,o[a+1]):e=u(e,n,o[0])}if("string"==typeof t)return t;throw i("cannot increment this string")}(n);return l(t,10)+a}t=r;var c=n=f(16,e);return l(r,10)+c}}p||(p=d());var p,v=n(31),y=n(15),g=n(1),m=n(8);function b(e){return(b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var w,S=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},_=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},E=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},A=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(E(arguments[t]));return e},O=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};!function(e){e.DATASTORE="datastore",e.USER="user",e.SYNC="sync",e.STORAGE="storage"}(w||(w={}));var I=w.DATASTORE,T=w.USER,C=w.SYNC,x=w.STORAGE,P="/DataStore",k=function(e,t){if(void 0===t&&(t=!0),t)throw new Error("Invalid "+e)},N=function(e){return void 0===e||null==e},M=function e(t,n,r){var i,o=!1;if(0===r.length)return!0;switch(n){case"not":i="every",o=!0;break;case"and":i="every";break;case"or":i="some";break;default:k(n)}var s=r[i]((function(n){if(Object(g.v)(n)){var r=n.field,i=n.operator,o=n.operand,s=t[r];return j(s,i,o)}if(Object(g.u)(n)){var a=n.type,u=n.predicates;return e(t,a,u)}throw new Error("Not a predicate or group")}));return o?!s:s},j=function(e,t,n){switch(t){case"ne":return e!==n;case"eq":return e===n;case"le":return e<=n;case"lt":return e<n;case"ge":return e>=n;case"gt":return e>n;case"between":var r=E(n,2),i=r[0],o=r[1];return e>=i&&e<=o;case"beginsWith":return!N(e)&&e.startsWith(n);case"contains":return!N(e)&&e.indexOf(n)>-1;case"notContains":return N(e)||-1===e.indexOf(n);default:return k(t,!1),!1}},R=function(e){return e&&"function"==typeof e.copyOf},D=new WeakSet;function U(e){D.add(e)}var F,L=function(e){return D.has(e)},B=function(e){var t={},n={};return Object.keys(e.models).forEach((function(r){var i,o,s,a;t[r]={indexes:[],relationTypes:[]},n[r]={};var u,c,l,f=e.models[r];if(Object.keys(f.fields).forEach((function(e){var n=f.fields[e];if("object"===b(n.type)&&"model"in n.type){var i=n.association.connectionType;t[r].relationTypes.push({fieldName:n.name,modelName:n.type.model,relationType:i,targetName:n.association.targetName,associatedWith:n.association.associatedWith}),"BELONGS_TO"===i&&t[r].indexes.push(n.association.targetName)}})),f.attributes){n[r].compositeKeys=(u=f.attributes,l=(c=function(e){return e.reduce((function(e,t){var n=new Set(t);if(0===e.length)return e.push(n),e;var r=e.findIndex((function(e){return A(e).some((function(e){return n.has(e)}))}));if(r>-1){var i=new Set(A(e[r],n));e[r]=i}else e.push(n);return e}),[])})(u.filter(g.p).map((function(e){return E(e.properties.fields).slice(1)}))),c(l));try{for(var d=O(f.attributes),h=d.next();!h.done;h=d.next()){var p=h.value;if(Object(g.q)(p)){Object(g.r)(p)&&(n[r].primaryKey=p.properties.fields);var v=p.properties.fields;try{for(var y=(s=void 0,O(v)),m=y.next();!m.done;m=y.next()){var w=m.value;t[r].indexes.includes(w)||t[r].indexes.push(w)}}catch(e){s={error:e}}finally{try{m&&!m.done&&(a=y.return)&&a.call(y)}finally{if(s)throw s.error}}}}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}}})),[t,n]},q=new WeakMap,z=function(e,t,n,r,i){var o=n.relationships,s=i(n.name,e),a=o[e],u=[],c=s.copyOf(t,(function(e){a.relationTypes.forEach((function(o){var s=i(n.name,o.modelName);switch(o.relationType){case"HAS_ONE":if(t[o.fieldName]){var a=void 0;try{a=r(s,t[o.fieldName])}catch(e){console.log(e)}u.push({modelName:o.modelName,item:t[o.fieldName],instance:a}),o.targetName?(e[o.targetName]=e[o.fieldName].id,delete e[o.fieldName]):e[o.fieldName]=e[o.fieldName].id}break;case"BELONGS_TO":if(t[o.fieldName]){a=void 0;try{a=r(s,t[o.fieldName])}catch(e){}e[o.fieldName]._deleted||u.push({modelName:o.modelName,item:t[o.fieldName],instance:a})}e[o.fieldName]&&(e[o.targetName]=e[o.fieldName].id,delete e[o.fieldName]);break;case"HAS_MANY":break;default:k(o.relationType)}}))}));u.unshift({modelName:e,item:c,instance:c}),q.has(n)||q.set(n,Array.from(n.modelTopologicalOrdering.keys()));var l=q.get(n);return u.sort((function(e,t){return l.indexOf(e.modelName)-l.indexOf(t.modelName)})),u},K=function(e,t){var n="";return e.some((function(e){e.modelName===t&&(n=e.targetName)})),n},H=function(e,t){return e.find((function(e){return e===t}))},V=function(){return new Promise((function(e){var t,n=Object(v.v4)(),r=function(){F=!1,e(!0)},i=function(){return S(void 0,void 0,void 0,(function(){return _(this,(function(r){switch(r.label){case 0:return t&&t.result&&"function"==typeof t.result.close?[4,t.result.close()]:[3,2];case 1:r.sent(),r.label=2;case 2:return[4,indexedDB.deleteDatabase(n)];case 3:return r.sent(),F=!0,[2,e(!1)]}}))}))};return!0===F?i():!1===F||null===indexedDB?r():((t=indexedDB.open(n)).onerror=r,void(t.onsuccess=i))}))},G=function(){return(e=1,r.Buffer.from((new m.j).random(e).toString(),"hex")).readUInt8(0)/255;var e};function W(e){var t=h(G);return function(){return t(e)}}function Y(){return"undefined"!=typeof performance&&performance&&"function"==typeof performance.now?0|performance.now():Date.now()}function J(e){return function(t,n){var r,i;try{for(var o=O(e),s=o.next();!s.done;s=o.next()){var a=s.value,u=a.field,c=a.sortDirection===g.k.ASCENDING?1:-1;if(t[u]<n[u])return-1*c;if(t[u]>n[u])return 1*c}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return 0}}function $(e,t,n){var r,i;void 0===n&&(n=!1);var o,s,a=e,u=t;if(a instanceof Object&&!(u instanceof Object)||!(a instanceof Object)&&u instanceof Object)return!1;if(!(a instanceof Object))return!(!n||(o=a,s=u,null!=o||null!=s))||a===u;if(Array.isArray(a)&&!Array.isArray(u)||Array.isArray(u)&&!Array.isArray(a))return!1;a instanceof Set&&u instanceof Set&&(a=A(a),u=A(u)),a instanceof Map&&u instanceof Map&&(a=Object.fromEntries(a),u=Object.fromEntries(u));var c=Object.keys(a),l=Object.keys(u);if(c.length!==l.length&&(!n||Array.isArray(a)))return!1;var f=c.length>=l.length?c:l;try{for(var d=O(f),h=d.next();!h.done;h=d.next()){var p=h.value;if(!$(a[p],u[p],n))return!1}}catch(e){r={error:e}}finally{try{h&&!h.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}return!0}var Z=function(e){return!!/^\d{4}-\d{2}-\d{2}(Z|[+-]\d{2}:\d{2}($|:\d{2}))?$/.exec(e)},Q=function(e){return!!/^\d{2}:\d{2}(:\d{2}(.\d+)?)?(Z|[+-]\d{2}:\d{2}($|:\d{2}))?$/.exec(e)},X=function(e){return!!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(.\d+)?)?(Z|[+-]\d{2}:\d{2}($|:\d{2}))?$/.exec(e)},ee=function(e){return!!/^\d+$/.exec(String(e))},te=function(e){return!!/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.exec(e)},ne=function(e){try{return JSON.parse(e),!0}catch(e){return!1}},re=function(e){try{return!!new URL(e)}catch(e){return!1}},ie=function(e){return!!/^\+?\d[\d\s-]+$/.exec(e)},oe=function(e){return!!/((^((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))$)|(^((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?$))$/.exec(e)},se=function(){var e=this;this.promise=new Promise((function(t,n){e.resolve=t,e.reject=n}))},ae=function(){function e(e){this.limitPromise=new se,this.raceInFlight=!1,this.callback=function(){},this.defaultErrorHandler=function(e){throw void 0===e&&(e="DeferredCallbackResolver error"),new Error(e)},this.callback=e.callback,this.errorHandler=e.errorHandler||this.defaultErrorHandler,this.maxInterval=e.maxInterval||2e3}return e.prototype.startTimer=function(){var e=this;this.timerPromise=new Promise((function(t,n){e.timer=setTimeout((function(){t(g.d.TIMER)}),e.maxInterval)}))},e.prototype.racePromises=function(){return S(this,void 0,void 0,(function(){var e,t;return _(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,3,4]),this.raceInFlight=!0,this.startTimer(),[4,Promise.race([this.timerPromise,this.limitPromise.promise])];case 1:return e=n.sent(),this.callback(),[3,4];case 2:return t=n.sent(),this.errorHandler(t),[3,4];case 3:return this.clear(),this.raceInFlight=!1,this.limitPromise=new se,[2,e];case 4:return[2]}}))}))},e.prototype.start=function(){this.raceInFlight||this.racePromises()},e.prototype.clear=function(){clearTimeout(this.timer)},e.prototype.resolve=function(){this.limitPromise.resolve(g.d.LIMIT)},e}();function ue(e,t,n){var r,i=t.concat(n);return Object(y.d)(e,(function(e){Object(y.a)(e,i)}),(function(e){r=e})),r}},function(e,t,n){"use strict";var r,i,o;function s(e){return e&&!!["provider"].find((function(t){return e.hasOwnProperty(t)}))}function a(e){return e&&!!["customProvider"].find((function(t){return e.hasOwnProperty(t)}))}function u(e){return e&&!!["customState"].find((function(t){return e.hasOwnProperty(t)}))}function c(e){return void 0!==e.redirectSignIn}function l(e){return!!e.username}n.d(t,"b",(function(){return r})),n.d(t,"f",(function(){return s})),n.d(t,"g",(function(){return a})),n.d(t,"d",(function(){return u})),n.d(t,"e",(function(){return c})),n.d(t,"a",(function(){return i})),n.d(t,"h",(function(){return l})),n.d(t,"c",(function(){return o})),function(e){e.Cognito="COGNITO",e.Google="Google",e.Facebook="Facebook",e.Amazon="LoginWithAmazon",e.Apple="SignInWithApple"}(r||(r={})),function(e){e.NoConfig="noConfig",e.MissingAuthConfig="missingAuthConfig",e.EmptyUsername="emptyUsername",e.InvalidUsername="invalidUsername",e.EmptyPassword="emptyPassword",e.EmptyCode="emptyCode",e.SignUpError="signUpError",e.NoMFA="noMFA",e.InvalidMFA="invalidMFA",e.EmptyChallengeResponse="emptyChallengeResponse",e.NoUserSession="noUserSession",e.Default="default",e.DeviceConfig="deviceConfig",e.NetworkError="networkError",e.AutoSignInError="autoSignInError"}(i||(i={})),function(e){e.API_KEY="API_KEY",e.AWS_IAM="AWS_IAM",e.OPENID_CONNECT="OPENID_CONNECT",e.AMAZON_COGNITO_USER_POOLS="AMAZON_COGNITO_USER_POOLS",e.AWS_LAMBDA="AWS_LAMBDA"}(o||(o={}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return l})),n.d(t,"e",(function(){return b})),n.d(t,"c",(function(){return w})),n.d(t,"b",(function(){return S})),n.d(t,"d",(function(){return _})),n.d(t,"k",(function(){return E})),n.d(t,"l",(function(){return A})),n.d(t,"j",(function(){return O})),n.d(t,"h",(function(){return I})),n.d(t,"g",(function(){return T})),n.d(t,"f",(function(){return C})),n.d(t,"i",(function(){return x}));var r=n(3),i=n(20),o=n(21),s=n(1),a=n(2);function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var c,l,f=function(){return(f=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},d=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},h=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},p=new o.a("DataStore");!function(e){e.LIST="query",e.CREATE="mutation",e.UPDATE="mutation",e.DELETE="mutation",e.GET="query"}(c||(c={})),function(e){e.CREATE="Create",e.UPDATE="Update",e.DELETE="Delete",e.GET="Get"}(l||(l={}));var v={_version:void 0,_lastChangedAt:void 0,_deleted:void 0},y=Object.keys(v);function g(e,t){var n=m(t),r=function(e,t){var n=[];return Object.values(t.fields).forEach((function(t){var r=t.name,i=t.type;if(Object(s.t)(i)){var o=e.nonModels[i.nonModel],a=Object.values(m(o)).map((function(e){return e.name})),u=[];Object.values(o.fields).forEach((function(t){var n=t.type,r=t.name;if(Object(s.t)(n)){var i=e.nonModels[n.nonModel];u.push(r+" { "+g(e,i)+" }")}})),n.push(r+" { "+a.join(" ")+" "+u.join(" ")+" }")}})),n}(e,t),i=function(e,t){var n=function(e){var t=[];Object(s.w)(e)&&e.attributes&&e.attributes.forEach((function(e){if(e.properties&&e.properties.rules){var n=e.properties.rules.find((function(e){return"owner"===e.allow}));n&&n.ownerField&&t.push(n.ownerField)}}));return t}(e);if(!t.owner&&n.includes("owner"))return["owner"];return[]}(t,n),o=Object.values(n).map((function(e){return e.name})).concat(i).concat(r);return Object(s.w)(t)&&(o=o.concat(y).concat(function(e){var t=[];return Object.values(e.fields).filter((function(e){var t=e.association;return t&&Object.keys(t).length})).forEach((function(e){var n=e.name,r=e.association,i=r.connectionType;switch(i){case"HAS_ONE":case"HAS_MANY":break;case"BELONGS_TO":Object(s.x)(r)&&t.push(n+" { id _deleted }");break;default:Object(a.h)(i)}})),t}(t))),o.join("\n")}function m(e){var t=e.fields;return Object.values(t).filter((function(e){return!(!Object(s.n)(e.type)&&!Object(s.m)(e.type))})).reduce((function(e,t){return e[t.name]=t,e}),{})}function b(e){var t=([].concat(e.attributes).find((function(e){return e&&"auth"===e.type}))||{}).properties,n=(void 0===t?{}:t).rules,r=[];return(void 0===n?[]:n).forEach((function(t){var n=t.identityClaim,i=void 0===n?"cognito:username":n,o=t.ownerField,s=void 0===o?"owner":o,a=t.operations,u=void 0===a?["create","update","delete","read"]:a,c=t.provider,l=void 0===c?"userPools":c,f=t.groupClaim,d=void 0===f?"cognito:groups":f,h=t.allow,p=void 0===h?"iam":h,v=t.groups,y=void 0===v?[]:v,g="owner"===p;if(u.includes("read")||g){var m={identityClaim:i,ownerField:s,provider:l,groupClaim:d,authStrategy:p,groups:y,areSubscriptionsPublic:!1};if(g){var b=([].concat(e.attributes).find((function(e){return e&&"model"===e.type}))||{}).properties,w=(void 0===b?{}:b).subscriptions,S=(void 0===w?{}:w).level,_=void 0===S?"on":S;m.areSubscriptionsPublic=!u.includes("read")||"public"===_}g?r.push(m):r.unshift(m)}})),r}function w(e,t,n,r,i){var o=g(e,t),s=t.name,a=(t.pluralName,"on"+n+s),u="",c="";return r&&(u="($"+i+": String!)",c="("+i+": $"+i+")"),[n,a,"subscription operation"+u+"{\n\t\t\t"+a+c+"{\n\t\t\t\t"+o+"\n\t\t\t}\n\t\t}"]}function S(e,t,n){var r,i,o=g(e,t),s=t.name,u=t.pluralName,f=" ",d=" ";switch(n){case"LIST":r="sync"+u,f="($limit: Int, $nextToken: String, $lastSync: AWSTimestamp, $filter: Model"+s+"FilterInput)",d="(limit: $limit, nextToken: $nextToken, lastSync: $lastSync, filter: $filter)",o="items {\n\t\t\t\t\t\t\t"+o+"\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnextToken\n\t\t\t\t\t\tstartedAt";break;case"CREATE":r="create"+s,f="($input: Create"+s+"Input!)",d="(input: $input)",i=l.CREATE;break;case"UPDATE":r="update"+s,f="($input: Update"+s+"Input!, $condition: Model"+s+"ConditionInput)",d="(input: $input, condition: $condition)",i=l.UPDATE;break;case"DELETE":r="delete"+s,f="($input: Delete"+s+"Input!, $condition: Model"+s+"ConditionInput)",d="(input: $input, condition: $condition)",i=l.DELETE;break;case"GET":r="get"+s,f="($id: ID!)",d="(id: $id)",i=l.GET;break;default:Object(a.h)(n)}return[[i,r,c[n]+" operation"+f+"{\n\t\t"+r+d+"{\n\t\t\t"+o+"\n\t\t}\n\t}"]]}function _(e,t,n,r,i,o,c,d,h){var p;switch(n){case s.h.INSERT:p=l.CREATE;break;case s.h.UPDATE:p=l.UPDATE;break;case s.h.DELETE:p=l.DELETE;break;default:Object(a.h)(n)}return d(c,f(f({},h?{id:h}:{}),{data:JSON.stringify(i,(function(e,n){return e&&null!==n&&"object"===u(n)&&t.fields[e]&&"AWSJSON"===t.fields[e].type?JSON.stringify(n):n})),modelId:i.id,model:r.name,operation:p,condition:JSON.stringify(o)}))}function E(e){var t={};return e&&Array.isArray(e.predicates)?(e.predicates.forEach((function(e){var n;if(Object(s.v)(e)){var r=e.field,i=e.operator,o=e.operand;if("id"===r)return;t[r]=((n={})[i]=o,n)}else t[e.type]=E(e)})),t):t}function A(e){var t={};if(!e||!Array.isArray(e.predicates))return t;var n=e.type,r=e.predicates,i="and"===n||"or"===n;t[n]=i?[]:{};var o=function(e){return i?t[n].push(e):t[n]=e};return r.forEach((function(e){var t,n;if(Object(s.v)(e)){var r=e.field,i=e.operator,a=e.operand,u=((t={})[r]=((n={})[i]=a,n),t);o(u)}else o(A(e))})),t}function O(e,t){var n=e[t.groupClaim]||[];if("string"==typeof n){var r=void 0;try{r=JSON.parse(n)}catch(e){r=n}n=[].concat(r)}return n}function I(e){var t=e.authModeStrategy,n=e.defaultAuthMode,r=e.modelName,i=e.schema;return d(this,void 0,void 0,(function(){var e,o,a,u=this;return h(this,(function(c){switch(c.label){case 0:e=Object.values(s.g),o={CREATE:[],READ:[],UPDATE:[],DELETE:[]},c.label=1;case 1:return c.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e){return d(u,void 0,void 0,(function(){var s;return h(this,(function(a){switch(a.label){case 0:return[4,t({schema:i,modelName:r,operation:e})];case 1:return"string"==typeof(s=a.sent())?o[e]=[s]:Array.isArray(s)&&s.length?o[e]=s:o[e]=[n],[2]}}))}))})))];case 2:return c.sent(),[3,4];case 3:return a=c.sent(),p.debug("Error getting auth modes for model: "+r,a),[3,4];case 4:return[2,o]}}))}))}function T(e){var t,n=["Request failed with status code 401","Request failed with status code 403"];return e&&e.errors?t=e.errors.find((function(e){return n.includes(e.message)})):e&&e.message&&(t=e),t?t.message:null}function C(e){var t=Object.values(i.a);return e&&e.message&&t.find((function(t){return e.message.includes(t)}))||null}function x(e,t){return void 0===t&&(t={}),d(this,void 0,void 0,(function(){var n,i,o;return h(this,(function(s){switch(s.label){case 0:if(e!==r.c.AWS_LAMBDA)return[3,6];if(n=t.authProviders,!(i=(void 0===n?{functionAuthProvider:null}:n).functionAuthProvider)||"function"!=typeof i)return[3,5];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,i()];case 2:return[2,s.sent().token];case 3:throw o=s.sent(),new Error("Error retrieving token from `functionAuthProvider`: "+o);case 4:return[3,6];case 5:throw new Error("You must provide a `functionAuthProvider` function to `DataStore.configure` when using "+r.c.AWS_LAMBDA);case 6:return[2]}}))}))}},function(e,t,n){"use strict";n.d(t,"c",(function(){return o})),n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return a}));var r=n(2),i=new WeakSet;function o(e){return i.has(e)}Symbol("A predicate that matches all records");var s=function(){function e(){}return Object.defineProperty(e,"ALL",{get:function(){var e=function(e){return e};return i.add(e),e},enumerable:!0,configurable:!0}),e}(),a=function(){function e(){}return e.createPredicateBuilder=function(t){var n,i=t.name,o=new Set(Object.keys(t.fields)),s=new Proxy({},n={get:function(t,s,a){var u=s;switch(u){case"and":case"or":case"not":return function(t){var r={type:u,predicates:[]},i=new Proxy({},n);return e.predicateGroupsMap.set(i,r),t(i),e.predicateGroupsMap.get(a).predicates.push(r),a};default:Object(r.h)(u,!1)}var c=s;if(!o.has(c))throw new Error("Invalid field for model. field: "+c+", model: "+i);return function(t,n){return e.predicateGroupsMap.get(a).predicates.push({field:c,operator:t,operand:n}),a}}});return e.predicateGroupsMap.set(s,{type:"and",predicates:[]}),s},e.isValidPredicate=function(t){return e.predicateGroupsMap.has(t)},e.getPredicates=function(t,n){if(void 0===n&&(n=!0),n&&!e.isValidPredicate(t))throw new Error("The predicate is not valid");return e.predicateGroupsMap.get(t)},e.createFromExisting=function(t,n){if(n&&t)return n(e.createPredicateBuilder(t))},e.createForId=function(t,n){return e.createPredicateBuilder(t).id("eq",n)},e.predicateGroupsMap=new WeakMap,e}()},function(e,t,n){"use strict";(function(e){
17
17
  /*!
18
18
  * The buffer module from node.js, for the browser.
19
19
  *
20
20
  * @author Feross Aboukhadijeh <http://feross.org>
21
21
  * @license MIT
22
22
  */
23
- var r=n(75),i=n(76),o=n(77);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,n){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return f(this,e)}return c(this,e,t,n)}function c(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=d(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!u.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|p(t,n),i=(e=a(e,r)).write(t,n);i!==r&&(e=e.slice(0,i));return e}(e,t,n):function(e,t){if(u.isBuffer(t)){var n=0|h(t.length);return 0===(e=a(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?a(e,0):d(e,t);if("Buffer"===t.type&&o(t.data))return d(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function f(e,t){if(l(t),e=a(e,t<0?0:0|h(t)),!u.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function d(e,t){var n=t.length<0?0:0|h(t.length);e=a(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function h(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function p(e,t){if(u.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 B(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(e).length;default:if(r)return B(e).length;t=(""+t).toLowerCase(),r=!0}}function v(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return j(this,t,n);case"utf8":case"utf-8":return I(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return C(this,t,n);case"base64":return A(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=u.from(t,r)),u.isBuffer(t))return 0===t.length?-1:m(e,t,n,r,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):m(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,n,r,i){var o,s=1,a=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=n;o<a;o++)if(c(e,o)===c(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(n+u>a&&(n=a-u),o=n;o>=0;o--){for(var f=!0,d=0;d<u;d++)if(c(e,o+d)!==c(t,d)){f=!1;break}if(f)return o}return-1}function b(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[n+s]=a}return s}function _(e,t,n,r){return z(B(t,e.length-n),e,n,r)}function w(e,t,n,r){return z(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function S(e,t,n,r){return w(e,t,n,r)}function O(e,t,n,r){return z(q(t),e,n,r)}function E(e,t,n,r){return z(function(e,t){for(var n,r,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function A(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function I(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,s,a,u,c=e[i],l=null,f=c>239?4:c>223?3:c>191?2:1;if(i+f<=n)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=4096));return n}(r)}t.Buffer=u,t.SlowBuffer=function(e){+e!=e&&(e=0);return u.alloc(+e)},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=s(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,n){return c(null,e,t,n)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,n){return function(e,t,n,r){return l(t),t<=0?a(e,t):void 0!==n?"string"==typeof r?a(e,t).fill(n,r):a(e,t).fill(n):a(e,t)}(null,e,t,n)},u.allocUnsafe=function(e){return f(null,e)},u.allocUnsafeSlow=function(e){return f(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!o(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=u.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var s=e[n];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,i),i+=s.length}return r},u.byteLength=p,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?I(this,0,e):v.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},u.prototype.compare=function(e,t,n,r,i){if(!u.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===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),c=this.slice(r,i),l=e.slice(t,n),f=0;f<a;++f)if(c[f]!==l[f]){o=c[f],s=l[f];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},u.prototype.indexOf=function(e,t,n){return y(this,e,t,n,!0)},u.prototype.lastIndexOf=function(e,t,n){return y(this,e,t,n,!1)},u.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return _(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return S(this,e,t,n);case"base64":return O(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function C(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function j(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=L(e[o]);return i}function P(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function x(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function k(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function M(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function R(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,o){return o||R(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,o){return o||R(e,0,n,8),i.write(e,t,n,r,52,8),n+8}u.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),u.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=u.prototype;else{var i=t-e;n=new u(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},u.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||x(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},u.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||x(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},u.prototype.readUInt8=function(e,t){return t||x(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||x(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||x(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||x(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||x(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||x(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},u.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||x(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return t||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||x(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(e,t){t||x(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(e,t){return t||x(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||x(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||x(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||x(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||x(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||x(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||N(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},u.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||N(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},u.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):k(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):k(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):M(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<n&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},u.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):k(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):k(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):M(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},u.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},u.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),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=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<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},u.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var s=u.isBuffer(e)?e:B(new u(e,r).toString()),a=s.length;for(o=0;o<n-t;++o)this[o+t]=s[o%a]}return this};var F=/[^+\/0-9A-Za-z-_]/g;function L(e){return e<16?"0"+e.toString(16):e.toString(16)}function B(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],s=0;s<r;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.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;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function q(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(F,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(35))},,function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return I})),n.d(t,"c",(function(){return C})),n.d(t,"d",(function(){return j})),n.d(t,"e",(function(){return L})),n.d(t,"f",(function(){return M})),n.d(t,"g",(function(){return Z})),n.d(t,"h",(function(){return P})),n.d(t,"i",(function(){return ee})),n.d(t,"j",(function(){return a}));
23
+ var r=n(84),i=n(85),o=n(86);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,n){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return f(this,e)}return c(this,e,t,n)}function c(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=d(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!u.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|p(t,n),i=(e=a(e,r)).write(t,n);i!==r&&(e=e.slice(0,i));return e}(e,t,n):function(e,t){if(u.isBuffer(t)){var n=0|h(t.length);return 0===(e=a(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?a(e,0):d(e,t);if("Buffer"===t.type&&o(t.data))return d(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function f(e,t){if(l(t),e=a(e,t<0?0:0|h(t)),!u.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function d(e,t){var n=t.length<0?0:0|h(t.length);e=a(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function h(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function p(e,t){if(u.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 B(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(e).length;default:if(r)return B(e).length;t=(""+t).toLowerCase(),r=!0}}function v(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,n);case"utf8":case"utf-8":return I(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return C(this,t,n);case"base64":return O(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=u.from(t,r)),u.isBuffer(t))return 0===t.length?-1:m(e,t,n,r,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):m(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,n,r,i){var o,s=1,a=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=n;o<a;o++)if(c(e,o)===c(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(n+u>a&&(n=a-u),o=n;o>=0;o--){for(var f=!0,d=0;d<u;d++)if(c(e,o+d)!==c(t,d)){f=!1;break}if(f)return o}return-1}function b(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[n+s]=a}return s}function w(e,t,n,r){return z(B(t,e.length-n),e,n,r)}function S(e,t,n,r){return z(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function _(e,t,n,r){return S(e,t,n,r)}function E(e,t,n,r){return z(q(t),e,n,r)}function A(e,t,n,r){return z(function(e,t){for(var n,r,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function O(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function I(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,s,a,u,c=e[i],l=null,f=c>239?4:c>223?3:c>191?2:1;if(i+f<=n)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=4096));return n}(r)}t.Buffer=u,t.SlowBuffer=function(e){+e!=e&&(e=0);return u.alloc(+e)},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=s(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,n){return c(null,e,t,n)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,n){return function(e,t,n,r){return l(t),t<=0?a(e,t):void 0!==n?"string"==typeof r?a(e,t).fill(n,r):a(e,t).fill(n):a(e,t)}(null,e,t,n)},u.allocUnsafe=function(e){return f(null,e)},u.allocUnsafeSlow=function(e){return f(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!o(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=u.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var s=e[n];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,i),i+=s.length}return r},u.byteLength=p,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)y(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?I(this,0,e):v.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},u.prototype.compare=function(e,t,n,r,i){if(!u.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===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),c=this.slice(r,i),l=e.slice(t,n),f=0;f<a;++f)if(c[f]!==l[f]){o=c[f],s=l[f];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},u.prototype.indexOf=function(e,t,n){return g(this,e,t,n,!0)},u.prototype.lastIndexOf=function(e,t,n){return g(this,e,t,n,!1)},u.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":return S(this,e,t,n);case"latin1":case"binary":return _(this,e,t,n);case"base64":return E(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function C(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function x(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=L(e[o]);return i}function P(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function k(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function M(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function j(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function R(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,o){return o||R(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,o){return o||R(e,0,n,8),i.write(e,t,n,r,52,8),n+8}u.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),u.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=u.prototype;else{var i=t-e;n=new u(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},u.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||k(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},u.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||k(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},u.prototype.readUInt8=function(e,t){return t||k(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||k(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||k(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||k(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||k(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||k(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},u.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||k(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return t||k(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||k(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(e,t){t||k(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(e,t){return t||k(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||k(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||k(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||k(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||k(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||k(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||N(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},u.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||N(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},u.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):j(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):j(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<n&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},u.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):j(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):j(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},u.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},u.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),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=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<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},u.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var s=u.isBuffer(e)?e:B(new u(e,r).toString()),a=s.length;for(o=0;o<n-t;++o)this[o+t]=s[o%a]}return this};var F=/[^+\/0-9A-Za-z-_]/g;function L(e){return e<16?"0"+e.toString(16):e.toString(16)}function B(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],s=0;s<r;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.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;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function q(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(F,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(27))},,function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return k})),n.d(t,"c",(function(){return M})),n.d(t,"d",(function(){return j})),n.d(t,"e",(function(){return G})),n.d(t,"f",(function(){return q})),n.d(t,"g",(function(){return oe})),n.d(t,"h",(function(){return U})),n.d(t,"i",(function(){return ae})),n.d(t,"j",(function(){return h}));
24
24
  /*!
25
25
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
26
26
  * SPDX-License-Identifier: Apache-2.0
27
27
  */
28
- var r=function(){function e(e){var t=e||{},n=t.ValidationData,r=t.Username,i=t.Password,o=t.AuthParameters,s=t.ClientMetadata;this.validationData=n||{},this.authParameters=o||{},this.clientMetadata=s||{},this.username=r,this.password=i}var t=e.prototype;return t.getUsername=function(){return this.username},t.getPassword=function(){return this.password},t.getValidationData=function(){return this.validationData},t.getAuthParameters=function(){return this.authParameters},t.getClientMetadata=function(){return this.clientMetadata},e}(),i=n(6),o=n(61);var s,a=function(){function e(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length}var t=e.prototype;return t.random=function(t){for(var n=[],r=0;r<t;r+=4)n.push(Object(o.a)());return new e(n,t)},t.toString=function(){return function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")}(this)},e}(),u=n(13),c=l;function l(e,t){null!=e&&this.fromString(e,t)}function f(){return new l(null)}var d="undefined"!=typeof navigator;d&&"Microsoft Internet Explorer"==navigator.appName?(l.prototype.am=function(e,t,n,r,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var u=32767&this[e],c=this[e++]>>15,l=a*u+c*s;i=((u=s*u+((32767&l)<<15)+n[r]+(1073741823&i))>>>30)+(l>>>15)+a*c+(i>>>30),n[r++]=1073741823&u}return i},s=30):d&&"Netscape"!=navigator.appName?(l.prototype.am=function(e,t,n,r,i,o){for(;--o>=0;){var s=t*this[e++]+n[r]+i;i=Math.floor(s/67108864),n[r++]=67108863&s}return i},s=26):(l.prototype.am=function(e,t,n,r,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var u=16383&this[e],c=this[e++]>>14,l=a*u+c*s;i=((u=s*u+((16383&l)<<14)+n[r]+i)>>28)+(l>>14)+a*c,n[r++]=268435455&u}return i},s=28),l.prototype.DB=s,l.prototype.DM=(1<<s)-1,l.prototype.DV=1<<s;l.prototype.FV=Math.pow(2,52),l.prototype.F1=52-s,l.prototype.F2=2*s-52;var h,p,v=new Array;for(h="0".charCodeAt(0),p=0;p<=9;++p)v[h++]=p;for(h="a".charCodeAt(0),p=10;p<36;++p)v[h++]=p;for(h="A".charCodeAt(0),p=10;p<36;++p)v[h++]=p;function g(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function y(e,t){var n=v[e.charCodeAt(t)];return null==n?-1:n}function m(e){var t=f();return t.fromInt(e),t}function b(e){var t,n=1;return 0!=(t=e>>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}function _(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}
28
+ var r=function(){function e(e){var t=e||{},n=t.ValidationData,r=t.Username,i=t.Password,o=t.AuthParameters,s=t.ClientMetadata;this.validationData=n||{},this.authParameters=o||{},this.clientMetadata=s||{},this.username=r,this.password=i}var t=e.prototype;return t.getUsername=function(){return this.username},t.getPassword=function(){return this.password},t.getValidationData=function(){return this.validationData},t.getAuthParameters=function(){return this.authParameters},t.getClientMetadata=function(){return this.clientMetadata},e}(),i=n(6),o=n(12),s=n.n(o),a=(n(45),n(38)),u=n.n(a),c=n(24),l=n.n(c),f=n(68);var d,h=function(){function e(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length}var t=e.prototype;return t.random=function(t){for(var n=[],r=0;r<t;r+=4)n.push(Object(f.a)());return new e(n,t)},t.toString=function(){return function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")}(this)},e}(),p=v;function v(e,t){null!=e&&this.fromString(e,t)}function y(){return new v(null)}var g="undefined"!=typeof navigator;g&&"Microsoft Internet Explorer"==navigator.appName?(v.prototype.am=function(e,t,n,r,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var u=32767&this[e],c=this[e++]>>15,l=a*u+c*s;i=((u=s*u+((32767&l)<<15)+n[r]+(1073741823&i))>>>30)+(l>>>15)+a*c+(i>>>30),n[r++]=1073741823&u}return i},d=30):g&&"Netscape"!=navigator.appName?(v.prototype.am=function(e,t,n,r,i,o){for(;--o>=0;){var s=t*this[e++]+n[r]+i;i=Math.floor(s/67108864),n[r++]=67108863&s}return i},d=26):(v.prototype.am=function(e,t,n,r,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var u=16383&this[e],c=this[e++]>>14,l=a*u+c*s;i=((u=s*u+((16383&l)<<14)+n[r]+i)>>28)+(l>>14)+a*c,n[r++]=268435455&u}return i},d=28),v.prototype.DB=d,v.prototype.DM=(1<<d)-1,v.prototype.DV=1<<d;v.prototype.FV=Math.pow(2,52),v.prototype.F1=52-d,v.prototype.F2=2*d-52;var m,b,w=new Array;for(m="0".charCodeAt(0),b=0;b<=9;++b)w[m++]=b;for(m="a".charCodeAt(0),b=10;b<36;++b)w[m++]=b;for(m="A".charCodeAt(0),b=10;b<36;++b)w[m++]=b;function S(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function _(e,t){var n=w[e.charCodeAt(t)];return null==n?-1:n}function E(e){var t=y();return t.fromInt(e),t}function A(e){var t,n=1;return 0!=(t=e>>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}function O(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}
29
29
  /*!
30
30
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
31
31
  * SPDX-License-Identifier: Apache-2.0
32
32
  */
33
- function w(e){return i.Buffer.from((new a).random(e).toString(),"hex")}_.prototype.convert=function(e){var t=f();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(l.ZERO)>0&&this.m.subTo(t,t),t},_.prototype.revert=function(e){var t=f();return e.copyTo(t),this.reduce(t),t},_.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=32767&e[t],r=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[n=t+this.m.t]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},_.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},_.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},l.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},l.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},l.prototype.fromString=function(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)throw new Error("Only radix 2, 4, 8, 16, 32 are supported");n=2}this.t=0,this.s=0;for(var r=e.length,i=!1,o=0;--r>=0;){var s=y(e,r);s<0?"-"==e.charAt(r)&&(i=!0):(i=!1,0==o?this[this.t++]=s:o+n>this.DB?(this[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this[this.t++]=s>>this.DB-o):this[this.t-1]|=s<<o,(o+=n)>=this.DB&&(o-=this.DB))}this.clamp(),i&&l.ZERO.subTo(this,this)},l.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},l.prototype.dlShiftTo=function(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s},l.prototype.drShiftTo=function(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s},l.prototype.lShiftTo=function(e,t){var n,r=e%this.DB,i=this.DB-r,o=(1<<i)-1,s=Math.floor(e/this.DB),a=this.s<<r&this.DM;for(n=this.t-1;n>=0;--n)t[n+s+1]=this[n]>>i|a,a=(this[n]&o)<<r;for(n=s-1;n>=0;--n)t[n]=0;t[s]=a,t.t=this.t+s+1,t.s=this.s,t.clamp()},l.prototype.rShiftTo=function(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,i=this.DB-r,o=(1<<r)-1;t[0]=this[n]>>r;for(var s=n+1;s<this.t;++s)t[s-n-1]|=(this[s]&o)<<i,t[s-n]=this[s]>>r;r>0&&(t[this.t-n-1]|=(this.s&o)<<i),t.t=this.t-n,t.clamp()}},l.prototype.subTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]-e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r-=e[n],t[n++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()},l.prototype.multiplyTo=function(e,t){var n=this.abs(),r=e.abs(),i=n.t;for(t.t=i+r.t;--i>=0;)t[i]=0;for(i=0;i<r.t;++i)t[i+n.t]=n.am(0,r[i],t,i,0,n.t);t.s=0,t.clamp(),this.s!=e.s&&l.ZERO.subTo(t,t)},l.prototype.squareTo=function(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var r=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,r,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()},l.prototype.divRemTo=function(e,t,n){var r=e.abs();if(!(r.t<=0)){var i=this.abs();if(i.t<r.t)return null!=t&&t.fromInt(0),void(null!=n&&this.copyTo(n));null==n&&(n=f());var o=f(),s=this.s,a=e.s,u=this.DB-b(r[r.t-1]);u>0?(r.lShiftTo(u,o),i.lShiftTo(u,n)):(r.copyTo(o),i.copyTo(n));var c=o.t,d=o[c-1];if(0!=d){var h=d*(1<<this.F1)+(c>1?o[c-2]>>this.F2:0),p=this.FV/h,v=(1<<this.F1)/h,g=1<<this.F2,y=n.t,m=y-c,_=null==t?f():t;for(o.dlShiftTo(m,_),n.compareTo(_)>=0&&(n[n.t++]=1,n.subTo(_,n)),l.ONE.dlShiftTo(c,_),_.subTo(o,o);o.t<c;)o[o.t++]=0;for(;--m>=0;){var w=n[--y]==d?this.DM:Math.floor(n[y]*p+(n[y-1]+g)*v);if((n[y]+=o.am(0,w,n,m,0,c))<w)for(o.dlShiftTo(m,_),n.subTo(_,n);n[y]<--w;)n.subTo(_,n)}null!=t&&(n.drShiftTo(c,t),s!=a&&l.ZERO.subTo(t,t)),n.t=c,n.clamp(),u>0&&n.rShiftTo(u,n),s<0&&l.ZERO.subTo(n,n)}}},l.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},l.prototype.addTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]+e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r+=e[n],t[n++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[n++]=r:r<-1&&(t[n++]=this.DV+r),t.t=n,t.clamp()},l.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)throw new Error("Only radix 2, 4, 8, 16, 32 are supported");t=2}var n,r=(1<<t)-1,i=!1,o="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(n=this[s]>>a)>0&&(i=!0,o=g(n));s>=0;)a<t?(n=(this[s]&(1<<a)-1)<<t-a,n|=this[--s]>>(a+=this.DB-t)):(n=this[s]>>(a-=t)&r,a<=0&&(a+=this.DB,--s)),n>0&&(i=!0),i&&(o+=g(n));return i?o:"0"},l.prototype.negate=function(){var e=f();return l.ZERO.subTo(this,e),e},l.prototype.abs=function(){return this.s<0?this.negate():this},l.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(0!=(t=n-e.t))return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0},l.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+b(this[this.t-1]^this.s&this.DM)},l.prototype.mod=function(e){var t=f();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(l.ZERO)>0&&e.subTo(t,t),t},l.prototype.equals=function(e){return 0==this.compareTo(e)},l.prototype.add=function(e){var t=f();return this.addTo(e,t),t},l.prototype.subtract=function(e){var t=f();return this.subTo(e,t),t},l.prototype.multiply=function(e){var t=f();return this.multiplyTo(e,t),t},l.prototype.divide=function(e){var t=f();return this.divRemTo(e,t,null),t},l.prototype.modPow=function(e,t,n){var r,i=e.bitLength(),o=m(1),s=new _(t);if(i<=0)return o;r=i<18?1:i<48?3:i<144?4:i<768?5:6;var a=new Array,u=3,c=r-1,l=(1<<r)-1;if(a[1]=s.convert(this),r>1){var d=f();for(s.sqrTo(a[1],d);u<=l;)a[u]=f(),s.mulTo(d,a[u-2],a[u]),u+=2}var h,p,v=e.t-1,g=!0,y=f();for(i=b(e[v])-1;v>=0;){for(i>=c?h=e[v]>>i-c&l:(h=(e[v]&(1<<i+1)-1)<<c-i,v>0&&(h|=e[v-1]>>this.DB+i-c)),u=r;0==(1&h);)h>>=1,--u;if((i-=u)<0&&(i+=this.DB,--v),g)a[h].copyTo(o),g=!1;else{for(;u>1;)s.sqrTo(o,y),s.sqrTo(y,o),u-=2;u>0?s.sqrTo(o,y):(p=o,o=y,y=p),s.mulTo(y,a[h],o)}for(;v>=0&&0==(e[v]&1<<i);)s.sqrTo(o,y),p=o,o=y,y=p,--i<0&&(i=this.DB-1,--v)}var w=s.revert(o);return n(null,w),w},l.ZERO=m(0),l.ONE=m(1);var S=/^[89a-f]/i,O=function(){function e(e){this.N=new c("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF",16),this.g=new c("2",16),this.k=new c(this.hexHash(""+this.padHex(this.N)+this.padHex(this.g)),16),this.smallAValue=this.generateRandomSmallA(),this.getLargeAValue((function(){})),this.infoBits=i.Buffer.from("Caldera Derived Key","utf8"),this.poolName=e}var t=e.prototype;return t.getSmallAValue=function(){return this.smallAValue},t.getLargeAValue=function(e){var t=this;this.largeAValue?e(null,this.largeAValue):this.calculateA(this.smallAValue,(function(n,r){n&&e(n,null),t.largeAValue=r,e(null,t.largeAValue)}))},t.generateRandomSmallA=function(){var e=w(128).toString("hex");return new c(e,16)},t.generateRandomString=function(){return w(40).toString("base64")},t.getRandomPassword=function(){return this.randomPassword},t.getSaltDevices=function(){return this.SaltToHashDevices},t.getVerifierDevices=function(){return this.verifierDevices},t.generateHashDevice=function(e,t,n){var r=this;this.randomPassword=this.generateRandomString();var i=""+e+t+":"+this.randomPassword,o=this.hash(i),s=w(16).toString("hex");this.SaltToHashDevices=this.padHex(new c(s,16)),this.g.modPow(new c(this.hexHash(this.SaltToHashDevices+o),16),this.N,(function(e,t){e&&n(e,null),r.verifierDevices=r.padHex(t),n(null,null)}))},t.calculateA=function(e,t){var n=this;this.g.modPow(e,this.N,(function(e,r){e&&t(e,null),r.mod(n.N).equals(c.ZERO)&&t(new Error("Illegal paramater. A mod N cannot be 0."),null),t(null,r)}))},t.calculateU=function(e,t){return this.UHexHash=this.hexHash(this.padHex(e)+this.padHex(t)),new c(this.UHexHash,16)},t.hash=function(e){var t=new u.Sha256;t.update(e);var n=t.digestSync(),r=i.Buffer.from(n).toString("hex");return new Array(64-r.length).join("0")+r},t.hexHash=function(e){return this.hash(i.Buffer.from(e,"hex"))},t.computehkdf=function(e,t){var n=i.Buffer.concat([this.infoBits,i.Buffer.from(String.fromCharCode(1),"utf8")]),r=new u.Sha256(t);r.update(e);var o=r.digestSync(),s=new u.Sha256(o);return s.update(n),s.digestSync().slice(0,16)},t.getPasswordAuthenticationKey=function(e,t,n,r,o){var s=this;if(n.mod(this.N).equals(c.ZERO))throw new Error("B cannot be zero.");if(this.UValue=this.calculateU(this.largeAValue,n),this.UValue.equals(c.ZERO))throw new Error("U cannot be zero.");var a=""+this.poolName+e+":"+t,u=this.hash(a),l=new c(this.hexHash(this.padHex(r)+u),16);this.calculateS(l,n,(function(e,t){e&&o(e,null);var n=s.computehkdf(i.Buffer.from(s.padHex(t),"hex"),i.Buffer.from(s.padHex(s.UValue),"hex"));o(null,n)}))},t.calculateS=function(e,t,n){var r=this;this.g.modPow(e,this.N,(function(i,o){i&&n(i,null),t.subtract(r.k.multiply(o)).modPow(r.smallAValue.add(r.UValue.multiply(e)),r.N,(function(e,t){e&&n(e,null),n(null,t.mod(r.N))}))}))},t.getNewPasswordRequiredChallengeUserAttributePrefix=function(){return"userAttributes."},t.padHex=function(e){if(!(e instanceof c))throw new Error("Not a BigInteger");var t=e.compareTo(c.ZERO)<0,n=e.abs().toString(16);if(n=n.length%2!=0?"0"+n:n,n=S.test(n)?"00"+n:n,t){var r=n.split("").map((function(e){var t=15&~parseInt(e,16);return"0123456789ABCDEF".charAt(t)})).join("");(n=new c(r,16).add(c.ONE).toString(16)).toUpperCase().startsWith("FF8")&&(n=n.substring(2))}return n},e}(),E=function(){function e(e){this.jwtToken=e||"",this.payload=this.decodePayload()}var t=e.prototype;return t.getJwtToken=function(){return this.jwtToken},t.getExpiration=function(){return this.payload.exp},t.getIssuedAt=function(){return this.payload.iat},t.decodePayload=function(){var e=this.jwtToken.split(".")[1];try{return JSON.parse(i.Buffer.from(e,"base64").toString("utf8"))}catch(e){return{}}},e}();function A(e,t){return(A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}
33
+ function I(e){return i.Buffer.from((new h).random(e).toString(),"hex")}O.prototype.convert=function(e){var t=y();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(v.ZERO)>0&&this.m.subTo(t,t),t},O.prototype.revert=function(e){var t=y();return e.copyTo(t),this.reduce(t),t},O.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=32767&e[t],r=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[n=t+this.m.t]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},O.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},O.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},v.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},v.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},v.prototype.fromString=function(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)throw new Error("Only radix 2, 4, 8, 16, 32 are supported");n=2}this.t=0,this.s=0;for(var r=e.length,i=!1,o=0;--r>=0;){var s=_(e,r);s<0?"-"==e.charAt(r)&&(i=!0):(i=!1,0==o?this[this.t++]=s:o+n>this.DB?(this[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this[this.t++]=s>>this.DB-o):this[this.t-1]|=s<<o,(o+=n)>=this.DB&&(o-=this.DB))}this.clamp(),i&&v.ZERO.subTo(this,this)},v.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},v.prototype.dlShiftTo=function(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s},v.prototype.drShiftTo=function(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s},v.prototype.lShiftTo=function(e,t){var n,r=e%this.DB,i=this.DB-r,o=(1<<i)-1,s=Math.floor(e/this.DB),a=this.s<<r&this.DM;for(n=this.t-1;n>=0;--n)t[n+s+1]=this[n]>>i|a,a=(this[n]&o)<<r;for(n=s-1;n>=0;--n)t[n]=0;t[s]=a,t.t=this.t+s+1,t.s=this.s,t.clamp()},v.prototype.rShiftTo=function(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,i=this.DB-r,o=(1<<r)-1;t[0]=this[n]>>r;for(var s=n+1;s<this.t;++s)t[s-n-1]|=(this[s]&o)<<i,t[s-n]=this[s]>>r;r>0&&(t[this.t-n-1]|=(this.s&o)<<i),t.t=this.t-n,t.clamp()}},v.prototype.subTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]-e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r-=e[n],t[n++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()},v.prototype.multiplyTo=function(e,t){var n=this.abs(),r=e.abs(),i=n.t;for(t.t=i+r.t;--i>=0;)t[i]=0;for(i=0;i<r.t;++i)t[i+n.t]=n.am(0,r[i],t,i,0,n.t);t.s=0,t.clamp(),this.s!=e.s&&v.ZERO.subTo(t,t)},v.prototype.squareTo=function(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var r=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,r,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()},v.prototype.divRemTo=function(e,t,n){var r=e.abs();if(!(r.t<=0)){var i=this.abs();if(i.t<r.t)return null!=t&&t.fromInt(0),void(null!=n&&this.copyTo(n));null==n&&(n=y());var o=y(),s=this.s,a=e.s,u=this.DB-A(r[r.t-1]);u>0?(r.lShiftTo(u,o),i.lShiftTo(u,n)):(r.copyTo(o),i.copyTo(n));var c=o.t,l=o[c-1];if(0!=l){var f=l*(1<<this.F1)+(c>1?o[c-2]>>this.F2:0),d=this.FV/f,h=(1<<this.F1)/f,p=1<<this.F2,g=n.t,m=g-c,b=null==t?y():t;for(o.dlShiftTo(m,b),n.compareTo(b)>=0&&(n[n.t++]=1,n.subTo(b,n)),v.ONE.dlShiftTo(c,b),b.subTo(o,o);o.t<c;)o[o.t++]=0;for(;--m>=0;){var w=n[--g]==l?this.DM:Math.floor(n[g]*d+(n[g-1]+p)*h);if((n[g]+=o.am(0,w,n,m,0,c))<w)for(o.dlShiftTo(m,b),n.subTo(b,n);n[g]<--w;)n.subTo(b,n)}null!=t&&(n.drShiftTo(c,t),s!=a&&v.ZERO.subTo(t,t)),n.t=c,n.clamp(),u>0&&n.rShiftTo(u,n),s<0&&v.ZERO.subTo(n,n)}}},v.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},v.prototype.addTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]+e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r+=e[n],t[n++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[n++]=r:r<-1&&(t[n++]=this.DV+r),t.t=n,t.clamp()},v.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)throw new Error("Only radix 2, 4, 8, 16, 32 are supported");t=2}var n,r=(1<<t)-1,i=!1,o="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(n=this[s]>>a)>0&&(i=!0,o=S(n));s>=0;)a<t?(n=(this[s]&(1<<a)-1)<<t-a,n|=this[--s]>>(a+=this.DB-t)):(n=this[s]>>(a-=t)&r,a<=0&&(a+=this.DB,--s)),n>0&&(i=!0),i&&(o+=S(n));return i?o:"0"},v.prototype.negate=function(){var e=y();return v.ZERO.subTo(this,e),e},v.prototype.abs=function(){return this.s<0?this.negate():this},v.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(0!=(t=n-e.t))return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0},v.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+A(this[this.t-1]^this.s&this.DM)},v.prototype.mod=function(e){var t=y();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(v.ZERO)>0&&e.subTo(t,t),t},v.prototype.equals=function(e){return 0==this.compareTo(e)},v.prototype.add=function(e){var t=y();return this.addTo(e,t),t},v.prototype.subtract=function(e){var t=y();return this.subTo(e,t),t},v.prototype.multiply=function(e){var t=y();return this.multiplyTo(e,t),t},v.prototype.divide=function(e){var t=y();return this.divRemTo(e,t,null),t},v.prototype.modPow=function(e,t,n){var r,i=e.bitLength(),o=E(1),s=new O(t);if(i<=0)return o;r=i<18?1:i<48?3:i<144?4:i<768?5:6;var a=new Array,u=3,c=r-1,l=(1<<r)-1;if(a[1]=s.convert(this),r>1){var f=y();for(s.sqrTo(a[1],f);u<=l;)a[u]=y(),s.mulTo(f,a[u-2],a[u]),u+=2}var d,h,p=e.t-1,v=!0,g=y();for(i=A(e[p])-1;p>=0;){for(i>=c?d=e[p]>>i-c&l:(d=(e[p]&(1<<i+1)-1)<<c-i,p>0&&(d|=e[p-1]>>this.DB+i-c)),u=r;0==(1&d);)d>>=1,--u;if((i-=u)<0&&(i+=this.DB,--p),v)a[d].copyTo(o),v=!1;else{for(;u>1;)s.sqrTo(o,g),s.sqrTo(g,o),u-=2;u>0?s.sqrTo(o,g):(h=o,o=g,g=h),s.mulTo(g,a[d],o)}for(;p>=0&&0==(e[p]&1<<i);)s.sqrTo(o,g),h=o,o=g,g=h,--i<0&&(i=this.DB-1,--p)}var m=s.revert(o);return n(null,m),m},v.ZERO=E(0),v.ONE=E(1);var T=/^[89a-f]/i,C=function(){function e(e){this.N=new p("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF",16),this.g=new p("2",16),this.k=new p(this.hexHash(""+this.padHex(this.N)+this.padHex(this.g)),16),this.smallAValue=this.generateRandomSmallA(),this.getLargeAValue((function(){})),this.infoBits=i.Buffer.from("Caldera Derived Key","utf8"),this.poolName=e}var t=e.prototype;return t.getSmallAValue=function(){return this.smallAValue},t.getLargeAValue=function(e){var t=this;this.largeAValue?e(null,this.largeAValue):this.calculateA(this.smallAValue,(function(n,r){n&&e(n,null),t.largeAValue=r,e(null,t.largeAValue)}))},t.generateRandomSmallA=function(){var e=I(128).toString("hex");return new p(e,16)},t.generateRandomString=function(){return I(40).toString("base64")},t.getRandomPassword=function(){return this.randomPassword},t.getSaltDevices=function(){return this.SaltToHashDevices},t.getVerifierDevices=function(){return this.verifierDevices},t.generateHashDevice=function(e,t,n){var r=this;this.randomPassword=this.generateRandomString();var i=""+e+t+":"+this.randomPassword,o=this.hash(i),s=I(16).toString("hex");this.SaltToHashDevices=this.padHex(new p(s,16)),this.g.modPow(new p(this.hexHash(this.SaltToHashDevices+o),16),this.N,(function(e,t){e&&n(e,null),r.verifierDevices=r.padHex(t),n(null,null)}))},t.calculateA=function(e,t){var n=this;this.g.modPow(e,this.N,(function(e,r){e&&t(e,null),r.mod(n.N).equals(p.ZERO)&&t(new Error("Illegal paramater. A mod N cannot be 0."),null),t(null,r)}))},t.calculateU=function(e,t){return this.UHexHash=this.hexHash(this.padHex(e)+this.padHex(t)),new p(this.UHexHash,16)},t.hash=function(e){var t=e instanceof i.Buffer?s.a.lib.WordArray.create(e):e,n=u()(t).toString();return new Array(64-n.length).join("0")+n},t.hexHash=function(e){return this.hash(i.Buffer.from(e,"hex"))},t.computehkdf=function(e,t){var n=s.a.lib.WordArray.create(i.Buffer.concat([this.infoBits,i.Buffer.from(String.fromCharCode(1),"utf8")])),r=e instanceof i.Buffer?s.a.lib.WordArray.create(e):e,o=t instanceof i.Buffer?s.a.lib.WordArray.create(t):t,a=l()(r,o),u=l()(n,a);return i.Buffer.from(u.toString(),"hex").slice(0,16)},t.getPasswordAuthenticationKey=function(e,t,n,r,o){var s=this;if(n.mod(this.N).equals(p.ZERO))throw new Error("B cannot be zero.");if(this.UValue=this.calculateU(this.largeAValue,n),this.UValue.equals(p.ZERO))throw new Error("U cannot be zero.");var a=""+this.poolName+e+":"+t,u=this.hash(a),c=new p(this.hexHash(this.padHex(r)+u),16);this.calculateS(c,n,(function(e,t){e&&o(e,null);var n=s.computehkdf(i.Buffer.from(s.padHex(t),"hex"),i.Buffer.from(s.padHex(s.UValue),"hex"));o(null,n)}))},t.calculateS=function(e,t,n){var r=this;this.g.modPow(e,this.N,(function(i,o){i&&n(i,null),t.subtract(r.k.multiply(o)).modPow(r.smallAValue.add(r.UValue.multiply(e)),r.N,(function(e,t){e&&n(e,null),n(null,t.mod(r.N))}))}))},t.getNewPasswordRequiredChallengeUserAttributePrefix=function(){return"userAttributes."},t.padHex=function(e){if(!(e instanceof p))throw new Error("Not a BigInteger");var t=e.compareTo(p.ZERO)<0,n=e.abs().toString(16);if(n=n.length%2!=0?"0"+n:n,n=T.test(n)?"00"+n:n,t){var r=n.split("").map((function(e){var t=15&~parseInt(e,16);return"0123456789ABCDEF".charAt(t)})).join("");(n=new p(r,16).add(p.ONE).toString(16)).toUpperCase().startsWith("FF8")&&(n=n.substring(2))}return n},e}(),x=function(){function e(e){this.jwtToken=e||"",this.payload=this.decodePayload()}var t=e.prototype;return t.getJwtToken=function(){return this.jwtToken},t.getExpiration=function(){return this.payload.exp},t.getIssuedAt=function(){return this.payload.iat},t.decodePayload=function(){var e=this.jwtToken.split(".")[1];try{return JSON.parse(i.Buffer.from(e,"base64").toString("utf8"))}catch(e){return{}}},e}();function P(e,t){return(P=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}
34
34
  /*!
35
35
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
36
36
  * SPDX-License-Identifier: Apache-2.0
37
- */var I=function(e){var t,n;function r(t){var n=(void 0===t?{}:t).AccessToken;return e.call(this,n||"")||this}return n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,A(t,n),r}(E);function T(e,t){return(T=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}
37
+ */var k=function(e){var t,n;function r(t){var n=(void 0===t?{}:t).AccessToken;return e.call(this,n||"")||this}return n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,P(t,n),r}(x);function N(e,t){return(N=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}
38
38
  /*!
39
39
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
40
40
  * SPDX-License-Identifier: Apache-2.0
41
- */var C=function(e){var t,n;function r(t){var n=(void 0===t?{}:t).IdToken;return e.call(this,n||"")||this}return n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,T(t,n),r}(E),j=function(){function e(e){var t=(void 0===e?{}:e).RefreshToken;this.token=t||""}return e.prototype.getToken=function(){return this.token},e}(),P=function(){function e(e){var t=void 0===e?{}:e,n=t.IdToken,r=t.RefreshToken,i=t.AccessToken,o=t.ClockDrift;if(null==i||null==n)throw new Error("Id token and Access Token must be present.");this.idToken=n,this.refreshToken=r,this.accessToken=i,this.clockDrift=void 0===o?this.calculateClockDrift():o}var t=e.prototype;return t.getIdToken=function(){return this.idToken},t.getRefreshToken=function(){return this.refreshToken},t.getAccessToken=function(){return this.accessToken},t.getClockDrift=function(){return this.clockDrift},t.calculateClockDrift=function(){return Math.floor(new Date/1e3)-Math.min(this.accessToken.getIssuedAt(),this.idToken.getIssuedAt())},t.isValid=function(){var e=Math.floor(new Date/1e3)-this.clockDrift;return e<this.accessToken.getExpiration()&&e<this.idToken.getExpiration()},e}(),x=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],N=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],k=function(){function e(){}return e.prototype.getNowString=function(){var e=new Date,t=N[e.getUTCDay()],n=x[e.getUTCMonth()],r=e.getUTCDate(),i=e.getUTCHours();i<10&&(i="0"+i);var o=e.getUTCMinutes();o<10&&(o="0"+o);var s=e.getUTCSeconds();return s<10&&(s="0"+s),t+" "+n+" "+r+" "+i+":"+o+":"+s+" UTC "+e.getUTCFullYear()},e}(),M=function(){function e(e){var t=void 0===e?{}:e,n=t.Name,r=t.Value;this.Name=n||"",this.Value=r||""}var t=e.prototype;return t.getValue=function(){return this.Value},t.setValue=function(e){return this.Value=e,this},t.getName=function(){return this.Name},t.setName=function(e){return this.Name=e,this},t.toString=function(){return JSON.stringify(this)},t.toJSON=function(){return{Name:this.Name,Value:this.Value}},e}(),R={},D=function(){function e(){}return e.setItem=function(e,t){return R[e]=t,R[e]},e.getItem=function(e){return Object.prototype.hasOwnProperty.call(R,e)?R[e]:void 0},e.removeItem=function(e){return delete R[e]},e.clear=function(){return R={}},e}(),U=function(){function e(){try{this.storageWindow=window.localStorage,this.storageWindow.setItem("aws.cognito.test-ls",1),this.storageWindow.removeItem("aws.cognito.test-ls")}catch(e){this.storageWindow=D}}return e.prototype.getStorage=function(){return this.storageWindow},e}(),F="undefined"!=typeof navigator?navigator.userAgent:"nodejs",L=function(){function e(e){if(null==e||null==e.Username||null==e.Pool)throw new Error("Username and Pool information are required.");this.username=e.Username||"",this.pool=e.Pool,this.Session=null,this.client=e.Pool.client,this.signInUserSession=null,this.authenticationFlowType="USER_SRP_AUTH",this.storage=e.Storage||(new U).getStorage(),this.keyPrefix="CognitoIdentityServiceProvider."+this.pool.getClientId(),this.userDataKey=this.keyPrefix+"."+this.username+".userData"}var t=e.prototype;return t.setSignInUserSession=function(e){this.clearCachedUserData(),this.signInUserSession=e,this.cacheTokens()},t.getSignInUserSession=function(){return this.signInUserSession},t.getUsername=function(){return this.username},t.getAuthenticationFlowType=function(){return this.authenticationFlowType},t.setAuthenticationFlowType=function(e){this.authenticationFlowType=e},t.initiateAuth=function(e,t){var n=this,r=e.getAuthParameters();r.USERNAME=this.username;var i=0!==Object.keys(e.getValidationData()).length?e.getValidationData():e.getClientMetadata(),o={AuthFlow:"CUSTOM_AUTH",ClientId:this.pool.getClientId(),AuthParameters:r,ClientMetadata:i};this.getUserContextData()&&(o.UserContextData=this.getUserContextData()),this.client.request("InitiateAuth",o,(function(e,r){if(e)return t.onFailure(e);var i=r.ChallengeName,o=r.ChallengeParameters;return"CUSTOM_CHALLENGE"===i?(n.Session=r.Session,t.customChallenge(o)):(n.signInUserSession=n.getCognitoUserSession(r.AuthenticationResult),n.cacheTokens(),t.onSuccess(n.signInUserSession))}))},t.authenticateUser=function(e,t){return"USER_PASSWORD_AUTH"===this.authenticationFlowType?this.authenticateUserPlainUsernamePassword(e,t):"USER_SRP_AUTH"===this.authenticationFlowType||"CUSTOM_AUTH"===this.authenticationFlowType?this.authenticateUserDefaultAuth(e,t):t.onFailure(new Error("Authentication flow type is invalid."))},t.authenticateUserDefaultAuth=function(e,t){var n,r,o=this,s=new O(this.pool.getUserPoolId().split("_")[1]),a=new k,l={};null!=this.deviceKey&&(l.DEVICE_KEY=this.deviceKey),l.USERNAME=this.username,s.getLargeAValue((function(f,d){f&&t.onFailure(f),l.SRP_A=d.toString(16),"CUSTOM_AUTH"===o.authenticationFlowType&&(l.CHALLENGE_NAME="SRP_A");var h=0!==Object.keys(e.getValidationData()).length?e.getValidationData():e.getClientMetadata(),p={AuthFlow:o.authenticationFlowType,ClientId:o.pool.getClientId(),AuthParameters:l,ClientMetadata:h};o.getUserContextData(o.username)&&(p.UserContextData=o.getUserContextData(o.username)),o.client.request("InitiateAuth",p,(function(l,f){if(l)return t.onFailure(l);var d=f.ChallengeParameters;o.username=d.USER_ID_FOR_SRP,o.userDataKey=o.keyPrefix+"."+o.username+".userData",n=new c(d.SRP_B,16),r=new c(d.SALT,16),o.getCachedDeviceKeyAndPassword(),s.getPasswordAuthenticationKey(o.username,e.getPassword(),n,r,(function(e,n){e&&t.onFailure(e);var r=a.getNowString(),c=o.pool.getUserPoolId().split("_")[1],l=i.Buffer.concat([i.Buffer.from(c,"utf8"),i.Buffer.from(o.username,"utf8"),i.Buffer.from(d.SECRET_BLOCK,"base64"),i.Buffer.from(r,"utf8")]),p=new u.Sha256(n);p.update(l);var v=p.digestSync(),g=i.Buffer.from(v).toString("base64"),y={};y.USERNAME=o.username,y.PASSWORD_CLAIM_SECRET_BLOCK=d.SECRET_BLOCK,y.TIMESTAMP=r,y.PASSWORD_CLAIM_SIGNATURE=g,null!=o.deviceKey&&(y.DEVICE_KEY=o.deviceKey);var m={ChallengeName:"PASSWORD_VERIFIER",ClientId:o.pool.getClientId(),ChallengeResponses:y,Session:f.Session,ClientMetadata:h};o.getUserContextData()&&(m.UserContextData=o.getUserContextData()),function e(t,n){return o.client.request("RespondToAuthChallenge",t,(function(r,i){return r&&"ResourceNotFoundException"===r.code&&-1!==r.message.toLowerCase().indexOf("device")?(y.DEVICE_KEY=null,o.deviceKey=null,o.randomPassword=null,o.deviceGroupKey=null,o.clearCachedDeviceKeyAndPassword(),e(t,n)):n(r,i)}))}(m,(function(e,n){return e?t.onFailure(e):o.authenticateUserInternal(n,s,t)}))}))}))}))},t.authenticateUserPlainUsernamePassword=function(e,t){var n=this,r={};if(r.USERNAME=this.username,r.PASSWORD=e.getPassword(),r.PASSWORD){var i=new O(this.pool.getUserPoolId().split("_")[1]);this.getCachedDeviceKeyAndPassword(),null!=this.deviceKey&&(r.DEVICE_KEY=this.deviceKey);var o=0!==Object.keys(e.getValidationData()).length?e.getValidationData():e.getClientMetadata(),s={AuthFlow:"USER_PASSWORD_AUTH",ClientId:this.pool.getClientId(),AuthParameters:r,ClientMetadata:o};this.getUserContextData(this.username)&&(s.UserContextData=this.getUserContextData(this.username)),this.client.request("InitiateAuth",s,(function(e,r){return e?t.onFailure(e):n.authenticateUserInternal(r,i,t)}))}else t.onFailure(new Error("PASSWORD parameter is required"))},t.authenticateUserInternal=function(e,t,n){var r=this,o=e.ChallengeName,s=e.ChallengeParameters;if("SMS_MFA"===o)return this.Session=e.Session,n.mfaRequired(o,s);if("SELECT_MFA_TYPE"===o)return this.Session=e.Session,n.selectMFAType(o,s);if("MFA_SETUP"===o)return this.Session=e.Session,n.mfaSetup(o,s);if("SOFTWARE_TOKEN_MFA"===o)return this.Session=e.Session,n.totpRequired(o,s);if("CUSTOM_CHALLENGE"===o)return this.Session=e.Session,n.customChallenge(s);if("NEW_PASSWORD_REQUIRED"===o){this.Session=e.Session;var a=null,u=null,c=[],l=t.getNewPasswordRequiredChallengeUserAttributePrefix();if(s&&(a=JSON.parse(e.ChallengeParameters.userAttributes),u=JSON.parse(e.ChallengeParameters.requiredAttributes)),u)for(var f=0;f<u.length;f++)c[f]=u[f].substr(l.length);return n.newPasswordRequired(a,c)}if("DEVICE_SRP_AUTH"===o)return this.Session=e.Session,void this.getDeviceResponse(n);this.signInUserSession=this.getCognitoUserSession(e.AuthenticationResult),this.challengeName=o,this.cacheTokens();var d=e.AuthenticationResult.NewDeviceMetadata;if(null==d)return n.onSuccess(this.signInUserSession);t.generateHashDevice(e.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey,e.AuthenticationResult.NewDeviceMetadata.DeviceKey,(function(o){if(o)return n.onFailure(o);var s={Salt:i.Buffer.from(t.getSaltDevices(),"hex").toString("base64"),PasswordVerifier:i.Buffer.from(t.getVerifierDevices(),"hex").toString("base64")};r.verifierDevices=s.PasswordVerifier,r.deviceGroupKey=d.DeviceGroupKey,r.randomPassword=t.getRandomPassword(),r.client.request("ConfirmDevice",{DeviceKey:d.DeviceKey,AccessToken:r.signInUserSession.getAccessToken().getJwtToken(),DeviceSecretVerifierConfig:s,DeviceName:F},(function(t,i){return t?n.onFailure(t):(r.deviceKey=e.AuthenticationResult.NewDeviceMetadata.DeviceKey,r.cacheDeviceKeyAndPassword(),!0===i.UserConfirmationNecessary?n.onSuccess(r.signInUserSession,i.UserConfirmationNecessary):n.onSuccess(r.signInUserSession))}))}))},t.completeNewPasswordChallenge=function(e,t,n,r){var i=this;if(!e)return n.onFailure(new Error("New password is required."));var o=new O(this.pool.getUserPoolId().split("_")[1]),s=o.getNewPasswordRequiredChallengeUserAttributePrefix(),a={};t&&Object.keys(t).forEach((function(e){a[s+e]=t[e]})),a.NEW_PASSWORD=e,a.USERNAME=this.username;var u={ChallengeName:"NEW_PASSWORD_REQUIRED",ClientId:this.pool.getClientId(),ChallengeResponses:a,Session:this.Session,ClientMetadata:r};this.getUserContextData()&&(u.UserContextData=this.getUserContextData()),this.client.request("RespondToAuthChallenge",u,(function(e,t){return e?n.onFailure(e):i.authenticateUserInternal(t,o,n)}))},t.getDeviceResponse=function(e,t){var n=this,r=new O(this.deviceGroupKey),o=new k,s={};s.USERNAME=this.username,s.DEVICE_KEY=this.deviceKey,r.getLargeAValue((function(a,l){a&&e.onFailure(a),s.SRP_A=l.toString(16);var f={ChallengeName:"DEVICE_SRP_AUTH",ClientId:n.pool.getClientId(),ChallengeResponses:s,ClientMetadata:t,Session:n.Session};n.getUserContextData()&&(f.UserContextData=n.getUserContextData()),n.client.request("RespondToAuthChallenge",f,(function(t,s){if(t)return e.onFailure(t);var a=s.ChallengeParameters,l=new c(a.SRP_B,16),f=new c(a.SALT,16);r.getPasswordAuthenticationKey(n.deviceKey,n.randomPassword,l,f,(function(t,r){if(t)return e.onFailure(t);var c=o.getNowString(),l=i.Buffer.concat([i.Buffer.from(n.deviceGroupKey,"utf8"),i.Buffer.from(n.deviceKey,"utf8"),i.Buffer.from(a.SECRET_BLOCK,"base64"),i.Buffer.from(c,"utf8")]),f=new u.Sha256(r);f.update(l);var d=f.digestSync(),h=i.Buffer.from(d).toString("base64"),p={};p.USERNAME=n.username,p.PASSWORD_CLAIM_SECRET_BLOCK=a.SECRET_BLOCK,p.TIMESTAMP=c,p.PASSWORD_CLAIM_SIGNATURE=h,p.DEVICE_KEY=n.deviceKey;var v={ChallengeName:"DEVICE_PASSWORD_VERIFIER",ClientId:n.pool.getClientId(),ChallengeResponses:p,Session:s.Session};n.getUserContextData()&&(v.UserContextData=n.getUserContextData()),n.client.request("RespondToAuthChallenge",v,(function(t,r){return t?e.onFailure(t):(n.signInUserSession=n.getCognitoUserSession(r.AuthenticationResult),n.cacheTokens(),e.onSuccess(n.signInUserSession))}))}))}))}))},t.confirmRegistration=function(e,t,n,r){var i={ClientId:this.pool.getClientId(),ConfirmationCode:e,Username:this.username,ForceAliasCreation:t,ClientMetadata:r};this.getUserContextData()&&(i.UserContextData=this.getUserContextData()),this.client.request("ConfirmSignUp",i,(function(e){return e?n(e,null):n(null,"SUCCESS")}))},t.sendCustomChallengeAnswer=function(e,t,n){var r=this,i={};i.USERNAME=this.username,i.ANSWER=e;var o=new O(this.pool.getUserPoolId().split("_")[1]);this.getCachedDeviceKeyAndPassword(),null!=this.deviceKey&&(i.DEVICE_KEY=this.deviceKey);var s={ChallengeName:"CUSTOM_CHALLENGE",ChallengeResponses:i,ClientId:this.pool.getClientId(),Session:this.Session,ClientMetadata:n};this.getUserContextData()&&(s.UserContextData=this.getUserContextData()),this.client.request("RespondToAuthChallenge",s,(function(e,n){return e?t.onFailure(e):r.authenticateUserInternal(n,o,t)}))},t.sendMFACode=function(e,t,n,r){var o=this,s={};s.USERNAME=this.username,s.SMS_MFA_CODE=e;var a=n||"SMS_MFA";"SOFTWARE_TOKEN_MFA"===a&&(s.SOFTWARE_TOKEN_MFA_CODE=e),null!=this.deviceKey&&(s.DEVICE_KEY=this.deviceKey);var u={ChallengeName:a,ChallengeResponses:s,ClientId:this.pool.getClientId(),Session:this.Session,ClientMetadata:r};this.getUserContextData()&&(u.UserContextData=this.getUserContextData()),this.client.request("RespondToAuthChallenge",u,(function(e,n){if(e)return t.onFailure(e);if("DEVICE_SRP_AUTH"!==n.ChallengeName){if(o.signInUserSession=o.getCognitoUserSession(n.AuthenticationResult),o.cacheTokens(),null==n.AuthenticationResult.NewDeviceMetadata)return t.onSuccess(o.signInUserSession);var r=new O(o.pool.getUserPoolId().split("_")[1]);r.generateHashDevice(n.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey,n.AuthenticationResult.NewDeviceMetadata.DeviceKey,(function(e){if(e)return t.onFailure(e);var s={Salt:i.Buffer.from(r.getSaltDevices(),"hex").toString("base64"),PasswordVerifier:i.Buffer.from(r.getVerifierDevices(),"hex").toString("base64")};o.verifierDevices=s.PasswordVerifier,o.deviceGroupKey=n.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey,o.randomPassword=r.getRandomPassword(),o.client.request("ConfirmDevice",{DeviceKey:n.AuthenticationResult.NewDeviceMetadata.DeviceKey,AccessToken:o.signInUserSession.getAccessToken().getJwtToken(),DeviceSecretVerifierConfig:s,DeviceName:F},(function(e,r){return e?t.onFailure(e):(o.deviceKey=n.AuthenticationResult.NewDeviceMetadata.DeviceKey,o.cacheDeviceKeyAndPassword(),!0===r.UserConfirmationNecessary?t.onSuccess(o.signInUserSession,r.UserConfirmationNecessary):t.onSuccess(o.signInUserSession))}))}))}else o.getDeviceResponse(t)}))},t.changePassword=function(e,t,n,r){if(null==this.signInUserSession||!this.signInUserSession.isValid())return n(new Error("User is not authenticated"),null);this.client.request("ChangePassword",{PreviousPassword:e,ProposedPassword:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),ClientMetadata:r},(function(e){return e?n(e,null):n(null,"SUCCESS")}))},t.enableMFA=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e(new Error("User is not authenticated"),null);var t=[];t.push({DeliveryMedium:"SMS",AttributeName:"phone_number"}),this.client.request("SetUserSettings",{MFAOptions:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(t){return t?e(t,null):e(null,"SUCCESS")}))},t.setUserMfaPreference=function(e,t,n){if(null==this.signInUserSession||!this.signInUserSession.isValid())return n(new Error("User is not authenticated"),null);this.client.request("SetUserMFAPreference",{SMSMfaSettings:e,SoftwareTokenMfaSettings:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(e){return e?n(e,null):n(null,"SUCCESS")}))},t.disableMFA=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e(new Error("User is not authenticated"),null);this.client.request("SetUserSettings",{MFAOptions:[],AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(t){return t?e(t,null):e(null,"SUCCESS")}))},t.deleteUser=function(e,t){var n=this;if(null==this.signInUserSession||!this.signInUserSession.isValid())return e(new Error("User is not authenticated"),null);this.client.request("DeleteUser",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),ClientMetadata:t},(function(t){return t?e(t,null):(n.clearCachedUser(),e(null,"SUCCESS"))}))},t.updateAttributes=function(e,t,n){var r=this;if(null==this.signInUserSession||!this.signInUserSession.isValid())return t(new Error("User is not authenticated"),null);this.client.request("UpdateUserAttributes",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),UserAttributes:e,ClientMetadata:n},(function(e){return e?t(e,null):r.getUserData((function(){return t(null,"SUCCESS")}),{bypassCache:!0})}))},t.getUserAttributes=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e(new Error("User is not authenticated"),null);this.client.request("GetUser",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(t,n){if(t)return e(t,null);for(var r=[],i=0;i<n.UserAttributes.length;i++){var o={Name:n.UserAttributes[i].Name,Value:n.UserAttributes[i].Value},s=new M(o);r.push(s)}return e(null,r)}))},t.getMFAOptions=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e(new Error("User is not authenticated"),null);this.client.request("GetUser",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(t,n){return t?e(t,null):e(null,n.MFAOptions)}))},t.createGetUserRequest=function(){return this.client.promisifyRequest("GetUser",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()})},t.refreshSessionIfPossible=function(e){var t=this;return void 0===e&&(e={}),new Promise((function(n){var r=t.signInUserSession.getRefreshToken();r&&r.getToken()?t.refreshSession(r,n,e.clientMetadata):n()}))},t.getUserData=function(e,t){var n=this;if(null==this.signInUserSession||!this.signInUserSession.isValid())return this.clearCachedUserData(),e(new Error("User is not authenticated"),null);var r=this.getUserDataFromCache();if(r)if(this.isFetchUserDataAndTokenRequired(t))this.fetchUserData().then((function(e){return n.refreshSessionIfPossible(t).then((function(){return e}))})).then((function(t){return e(null,t)})).catch(e);else try{return void e(null,JSON.parse(r))}catch(t){return this.clearCachedUserData(),void e(t,null)}else this.fetchUserData().then((function(t){e(null,t)})).catch(e)},t.getUserDataFromCache=function(){return this.storage.getItem(this.userDataKey)},t.isFetchUserDataAndTokenRequired=function(e){var t=(e||{}).bypassCache;return void 0!==t&&t},t.fetchUserData=function(){var e=this;return this.createGetUserRequest().then((function(t){return e.cacheUserData(t),t}))},t.deleteAttributes=function(e,t){var n=this;if(null==this.signInUserSession||!this.signInUserSession.isValid())return t(new Error("User is not authenticated"),null);this.client.request("DeleteUserAttributes",{UserAttributeNames:e,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(e){return e?t(e,null):n.getUserData((function(){return t(null,"SUCCESS")}),{bypassCache:!0})}))},t.resendConfirmationCode=function(e,t){var n={ClientId:this.pool.getClientId(),Username:this.username,ClientMetadata:t};this.client.request("ResendConfirmationCode",n,(function(t,n){return t?e(t,null):e(null,n)}))},t.getSession=function(e,t){if(void 0===t&&(t={}),null==this.username)return e(new Error("Username is null. Cannot retrieve a new session"),null);if(null!=this.signInUserSession&&this.signInUserSession.isValid())return e(null,this.signInUserSession);var n="CognitoIdentityServiceProvider."+this.pool.getClientId()+"."+this.username,r=n+".idToken",i=n+".accessToken",o=n+".refreshToken",s=n+".clockDrift";if(this.storage.getItem(r)){var a=new C({IdToken:this.storage.getItem(r)}),u=new I({AccessToken:this.storage.getItem(i)}),c=new j({RefreshToken:this.storage.getItem(o)}),l=parseInt(this.storage.getItem(s),0)||0,f=new P({IdToken:a,AccessToken:u,RefreshToken:c,ClockDrift:l});if(f.isValid())return this.signInUserSession=f,e(null,this.signInUserSession);if(!c.getToken())return e(new Error("Cannot retrieve a new session. Please authenticate."),null);this.refreshSession(c,e,t.clientMetadata)}else e(new Error("Local storage is missing an ID Token, Please authenticate"),null)},t.refreshSession=function(e,t,n){var r=this,i=this.pool.wrapRefreshSessionCallback?this.pool.wrapRefreshSessionCallback(t):t,o={};o.REFRESH_TOKEN=e.getToken();var s="CognitoIdentityServiceProvider."+this.pool.getClientId(),a=s+".LastAuthUser";if(this.storage.getItem(a)){this.username=this.storage.getItem(a);var u=s+"."+this.username+".deviceKey";this.deviceKey=this.storage.getItem(u),o.DEVICE_KEY=this.deviceKey}var c={ClientId:this.pool.getClientId(),AuthFlow:"REFRESH_TOKEN_AUTH",AuthParameters:o,ClientMetadata:n};this.getUserContextData()&&(c.UserContextData=this.getUserContextData()),this.client.request("InitiateAuth",c,(function(t,n){if(t)return"NotAuthorizedException"===t.code&&r.clearCachedUser(),i(t,null);if(n){var o=n.AuthenticationResult;return Object.prototype.hasOwnProperty.call(o,"RefreshToken")||(o.RefreshToken=e.getToken()),r.signInUserSession=r.getCognitoUserSession(o),r.cacheTokens(),i(null,r.signInUserSession)}}))},t.cacheTokens=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId(),t=e+"."+this.username+".idToken",n=e+"."+this.username+".accessToken",r=e+"."+this.username+".refreshToken",i=e+"."+this.username+".clockDrift",o=e+".LastAuthUser";this.storage.setItem(t,this.signInUserSession.getIdToken().getJwtToken()),this.storage.setItem(n,this.signInUserSession.getAccessToken().getJwtToken()),this.storage.setItem(r,this.signInUserSession.getRefreshToken().getToken()),this.storage.setItem(i,""+this.signInUserSession.getClockDrift()),this.storage.setItem(o,this.username)},t.cacheUserData=function(e){this.storage.setItem(this.userDataKey,JSON.stringify(e))},t.clearCachedUserData=function(){this.storage.removeItem(this.userDataKey)},t.clearCachedUser=function(){this.clearCachedTokens(),this.clearCachedUserData()},t.cacheDeviceKeyAndPassword=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId()+"."+this.username,t=e+".deviceKey",n=e+".randomPasswordKey",r=e+".deviceGroupKey";this.storage.setItem(t,this.deviceKey),this.storage.setItem(n,this.randomPassword),this.storage.setItem(r,this.deviceGroupKey)},t.getCachedDeviceKeyAndPassword=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId()+"."+this.username,t=e+".deviceKey",n=e+".randomPasswordKey",r=e+".deviceGroupKey";this.storage.getItem(t)&&(this.deviceKey=this.storage.getItem(t),this.randomPassword=this.storage.getItem(n),this.deviceGroupKey=this.storage.getItem(r))},t.clearCachedDeviceKeyAndPassword=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId()+"."+this.username,t=e+".deviceKey",n=e+".randomPasswordKey",r=e+".deviceGroupKey";this.storage.removeItem(t),this.storage.removeItem(n),this.storage.removeItem(r)},t.clearCachedTokens=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId(),t=e+"."+this.username+".idToken",n=e+"."+this.username+".accessToken",r=e+"."+this.username+".refreshToken",i=e+".LastAuthUser",o=e+"."+this.username+".clockDrift";this.storage.removeItem(t),this.storage.removeItem(n),this.storage.removeItem(r),this.storage.removeItem(i),this.storage.removeItem(o)},t.getCognitoUserSession=function(e){var t=new C(e),n=new I(e),r=new j(e);return new P({IdToken:t,AccessToken:n,RefreshToken:r})},t.forgotPassword=function(e,t){var n={ClientId:this.pool.getClientId(),Username:this.username,ClientMetadata:t};this.getUserContextData()&&(n.UserContextData=this.getUserContextData()),this.client.request("ForgotPassword",n,(function(t,n){return t?e.onFailure(t):"function"==typeof e.inputVerificationCode?e.inputVerificationCode(n):e.onSuccess(n)}))},t.confirmPassword=function(e,t,n,r){var i={ClientId:this.pool.getClientId(),Username:this.username,ConfirmationCode:e,Password:t,ClientMetadata:r};this.getUserContextData()&&(i.UserContextData=this.getUserContextData()),this.client.request("ConfirmForgotPassword",i,(function(e){return e?n.onFailure(e):n.onSuccess("SUCCESS")}))},t.getAttributeVerificationCode=function(e,t,n){if(null==this.signInUserSession||!this.signInUserSession.isValid())return t.onFailure(new Error("User is not authenticated"));this.client.request("GetUserAttributeVerificationCode",{AttributeName:e,AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),ClientMetadata:n},(function(e,n){return e?t.onFailure(e):"function"==typeof t.inputVerificationCode?t.inputVerificationCode(n):t.onSuccess("SUCCESS")}))},t.verifyAttribute=function(e,t,n){if(null==this.signInUserSession||!this.signInUserSession.isValid())return n.onFailure(new Error("User is not authenticated"));this.client.request("VerifyUserAttribute",{AttributeName:e,Code:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(e){return e?n.onFailure(e):n.onSuccess("SUCCESS")}))},t.getDevice=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e.onFailure(new Error("User is not authenticated"));this.client.request("GetDevice",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),DeviceKey:this.deviceKey},(function(t,n){return t?e.onFailure(t):e.onSuccess(n)}))},t.forgetSpecificDevice=function(e,t){if(null==this.signInUserSession||!this.signInUserSession.isValid())return t.onFailure(new Error("User is not authenticated"));this.client.request("ForgetDevice",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),DeviceKey:e},(function(e){return e?t.onFailure(e):t.onSuccess("SUCCESS")}))},t.forgetDevice=function(e){var t=this;this.forgetSpecificDevice(this.deviceKey,{onFailure:e.onFailure,onSuccess:function(n){return t.deviceKey=null,t.deviceGroupKey=null,t.randomPassword=null,t.clearCachedDeviceKeyAndPassword(),e.onSuccess(n)}})},t.setDeviceStatusRemembered=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e.onFailure(new Error("User is not authenticated"));this.client.request("UpdateDeviceStatus",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),DeviceKey:this.deviceKey,DeviceRememberedStatus:"remembered"},(function(t){return t?e.onFailure(t):e.onSuccess("SUCCESS")}))},t.setDeviceStatusNotRemembered=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e.onFailure(new Error("User is not authenticated"));this.client.request("UpdateDeviceStatus",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),DeviceKey:this.deviceKey,DeviceRememberedStatus:"not_remembered"},(function(t){return t?e.onFailure(t):e.onSuccess("SUCCESS")}))},t.listDevices=function(e,t,n){if(null==this.signInUserSession||!this.signInUserSession.isValid())return n.onFailure(new Error("User is not authenticated"));var r={AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),Limit:e};t&&(r.PaginationToken=t),this.client.request("ListDevices",r,(function(e,t){return e?n.onFailure(e):n.onSuccess(t)}))},t.globalSignOut=function(e){var t=this;if(null==this.signInUserSession||!this.signInUserSession.isValid())return e.onFailure(new Error("User is not authenticated"));this.client.request("GlobalSignOut",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(n){return n?e.onFailure(n):(t.clearCachedUser(),e.onSuccess("SUCCESS"))}))},t.signOut=function(e){var t=this;e&&"function"==typeof e?this.getSession((function(n,r){if(n)return e(n);t.revokeTokens((function(n){t.cleanClientData(),e(n)}))})):this.cleanClientData()},t.revokeTokens=function(e){if(void 0===e&&(e=function(){}),"function"!=typeof e)throw new Error("Invalid revokeTokenCallback. It should be a function.");if(!this.signInUserSession)return e(new Error("User is not authenticated"));if(!this.signInUserSession.getAccessToken())return e(new Error("No Access token available"));var t=this.signInUserSession.getRefreshToken().getToken(),n=this.signInUserSession.getAccessToken();if(this.isSessionRevocable(n)&&t)return this.revokeToken({token:t,callback:e});e()},t.isSessionRevocable=function(e){if(e&&"function"==typeof e.decodePayload)try{return!!e.decodePayload().origin_jti}catch(e){}return!1},t.cleanClientData=function(){this.signInUserSession=null,this.clearCachedUser()},t.revokeToken=function(e){var t=e.token,n=e.callback;this.client.requestWithRetry("RevokeToken",{Token:t,ClientId:this.pool.getClientId()},(function(e){if(e)return n(e);n()}))},t.sendMFASelectionAnswer=function(e,t){var n=this,r={};r.USERNAME=this.username,r.ANSWER=e;var i={ChallengeName:"SELECT_MFA_TYPE",ChallengeResponses:r,ClientId:this.pool.getClientId(),Session:this.Session};this.getUserContextData()&&(i.UserContextData=this.getUserContextData()),this.client.request("RespondToAuthChallenge",i,(function(r,i){return r?t.onFailure(r):(n.Session=i.Session,"SMS_MFA"===e?t.mfaRequired(i.ChallengeName,i.ChallengeParameters):"SOFTWARE_TOKEN_MFA"===e?t.totpRequired(i.ChallengeName,i.ChallengeParameters):void 0)}))},t.getUserContextData=function(){return this.pool.getUserContextData(this.username)},t.associateSoftwareToken=function(e){var t=this;null!=this.signInUserSession&&this.signInUserSession.isValid()?this.client.request("AssociateSoftwareToken",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(t,n){return t?e.onFailure(t):e.associateSecretCode(n.SecretCode)})):this.client.request("AssociateSoftwareToken",{Session:this.Session},(function(n,r){return n?e.onFailure(n):(t.Session=r.Session,e.associateSecretCode(r.SecretCode))}))},t.verifySoftwareToken=function(e,t,n){var r=this;null!=this.signInUserSession&&this.signInUserSession.isValid()?this.client.request("VerifySoftwareToken",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),UserCode:e,FriendlyDeviceName:t},(function(e,t){return e?n.onFailure(e):n.onSuccess(t)})):this.client.request("VerifySoftwareToken",{Session:this.Session,UserCode:e,FriendlyDeviceName:t},(function(e,t){if(e)return n.onFailure(e);r.Session=t.Session;var i={};i.USERNAME=r.username;var o={ChallengeName:"MFA_SETUP",ClientId:r.pool.getClientId(),ChallengeResponses:i,Session:r.Session};r.getUserContextData()&&(o.UserContextData=r.getUserContextData()),r.client.request("RespondToAuthChallenge",o,(function(e,t){return e?n.onFailure(e):(r.signInUserSession=r.getCognitoUserSession(t.AuthenticationResult),r.cacheTokens(),n.onSuccess(r.signInUserSession))}))}))},e}(),B=(n(86),{userAgent:"aws-amplify/5.0.4 js",product:"",navigator:null,isReactNative:!1});
41
+ */var M=function(e){var t,n;function r(t){var n=(void 0===t?{}:t).IdToken;return e.call(this,n||"")||this}return n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,N(t,n),r}(x),j=function(){function e(e){var t=(void 0===e?{}:e).RefreshToken;this.token=t||""}return e.prototype.getToken=function(){return this.token},e}(),R=n(40),D=n.n(R),U=function(){function e(e){var t=void 0===e?{}:e,n=t.IdToken,r=t.RefreshToken,i=t.AccessToken,o=t.ClockDrift;if(null==i||null==n)throw new Error("Id token and Access Token must be present.");this.idToken=n,this.refreshToken=r,this.accessToken=i,this.clockDrift=void 0===o?this.calculateClockDrift():o}var t=e.prototype;return t.getIdToken=function(){return this.idToken},t.getRefreshToken=function(){return this.refreshToken},t.getAccessToken=function(){return this.accessToken},t.getClockDrift=function(){return this.clockDrift},t.calculateClockDrift=function(){return Math.floor(new Date/1e3)-Math.min(this.accessToken.getIssuedAt(),this.idToken.getIssuedAt())},t.isValid=function(){var e=Math.floor(new Date/1e3)-this.clockDrift;return e<this.accessToken.getExpiration()&&e<this.idToken.getExpiration()},e}(),F=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],L=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],B=function(){function e(){}return e.prototype.getNowString=function(){var e=new Date,t=L[e.getUTCDay()],n=F[e.getUTCMonth()],r=e.getUTCDate(),i=e.getUTCHours();i<10&&(i="0"+i);var o=e.getUTCMinutes();o<10&&(o="0"+o);var s=e.getUTCSeconds();return s<10&&(s="0"+s),t+" "+n+" "+r+" "+i+":"+o+":"+s+" UTC "+e.getUTCFullYear()},e}(),q=function(){function e(e){var t=void 0===e?{}:e,n=t.Name,r=t.Value;this.Name=n||"",this.Value=r||""}var t=e.prototype;return t.getValue=function(){return this.Value},t.setValue=function(e){return this.Value=e,this},t.getName=function(){return this.Name},t.setName=function(e){return this.Name=e,this},t.toString=function(){return JSON.stringify(this)},t.toJSON=function(){return{Name:this.Name,Value:this.Value}},e}(),z={},K=function(){function e(){}return e.setItem=function(e,t){return z[e]=t,z[e]},e.getItem=function(e){return Object.prototype.hasOwnProperty.call(z,e)?z[e]:void 0},e.removeItem=function(e){return delete z[e]},e.clear=function(){return z={}},e}(),H=function(){function e(){try{this.storageWindow=window.localStorage,this.storageWindow.setItem("aws.cognito.test-ls",1),this.storageWindow.removeItem("aws.cognito.test-ls")}catch(e){this.storageWindow=K}}return e.prototype.getStorage=function(){return this.storageWindow},e}(),V="undefined"!=typeof navigator?navigator.userAgent:"nodejs",G=function(){function e(e){if(null==e||null==e.Username||null==e.Pool)throw new Error("Username and Pool information are required.");this.username=e.Username||"",this.pool=e.Pool,this.Session=null,this.client=e.Pool.client,this.signInUserSession=null,this.authenticationFlowType="USER_SRP_AUTH",this.storage=e.Storage||(new H).getStorage(),this.keyPrefix="CognitoIdentityServiceProvider."+this.pool.getClientId(),this.userDataKey=this.keyPrefix+"."+this.username+".userData"}var t=e.prototype;return t.setSignInUserSession=function(e){this.clearCachedUserData(),this.signInUserSession=e,this.cacheTokens()},t.getSignInUserSession=function(){return this.signInUserSession},t.getUsername=function(){return this.username},t.getAuthenticationFlowType=function(){return this.authenticationFlowType},t.setAuthenticationFlowType=function(e){this.authenticationFlowType=e},t.initiateAuth=function(e,t){var n=this,r=e.getAuthParameters();r.USERNAME=this.username;var i=0!==Object.keys(e.getValidationData()).length?e.getValidationData():e.getClientMetadata(),o={AuthFlow:"CUSTOM_AUTH",ClientId:this.pool.getClientId(),AuthParameters:r,ClientMetadata:i};this.getUserContextData()&&(o.UserContextData=this.getUserContextData()),this.client.request("InitiateAuth",o,(function(e,r){if(e)return t.onFailure(e);var i=r.ChallengeName,o=r.ChallengeParameters;return"CUSTOM_CHALLENGE"===i?(n.Session=r.Session,t.customChallenge(o)):(n.signInUserSession=n.getCognitoUserSession(r.AuthenticationResult),n.cacheTokens(),t.onSuccess(n.signInUserSession))}))},t.authenticateUser=function(e,t){return"USER_PASSWORD_AUTH"===this.authenticationFlowType?this.authenticateUserPlainUsernamePassword(e,t):"USER_SRP_AUTH"===this.authenticationFlowType||"CUSTOM_AUTH"===this.authenticationFlowType?this.authenticateUserDefaultAuth(e,t):t.onFailure(new Error("Authentication flow type is invalid."))},t.authenticateUserDefaultAuth=function(e,t){var n,r,o=this,a=new C(this.pool.getUserPoolId().split("_")[1]),u=new B,c={};null!=this.deviceKey&&(c.DEVICE_KEY=this.deviceKey),c.USERNAME=this.username,a.getLargeAValue((function(f,d){f&&t.onFailure(f),c.SRP_A=d.toString(16),"CUSTOM_AUTH"===o.authenticationFlowType&&(c.CHALLENGE_NAME="SRP_A");var h=0!==Object.keys(e.getValidationData()).length?e.getValidationData():e.getClientMetadata(),v={AuthFlow:o.authenticationFlowType,ClientId:o.pool.getClientId(),AuthParameters:c,ClientMetadata:h};o.getUserContextData(o.username)&&(v.UserContextData=o.getUserContextData(o.username)),o.client.request("InitiateAuth",v,(function(c,f){if(c)return t.onFailure(c);var d=f.ChallengeParameters;o.username=d.USER_ID_FOR_SRP,o.userDataKey=o.keyPrefix+"."+o.username+".userData",n=new p(d.SRP_B,16),r=new p(d.SALT,16),o.getCachedDeviceKeyAndPassword(),a.getPasswordAuthenticationKey(o.username,e.getPassword(),n,r,(function(e,n){e&&t.onFailure(e);var r=u.getNowString(),c=s.a.lib.WordArray.create(i.Buffer.concat([i.Buffer.from(o.pool.getUserPoolId().split("_")[1],"utf8"),i.Buffer.from(o.username,"utf8"),i.Buffer.from(d.SECRET_BLOCK,"base64"),i.Buffer.from(r,"utf8")])),p=s.a.lib.WordArray.create(n),v=D.a.stringify(l()(c,p)),y={};y.USERNAME=o.username,y.PASSWORD_CLAIM_SECRET_BLOCK=d.SECRET_BLOCK,y.TIMESTAMP=r,y.PASSWORD_CLAIM_SIGNATURE=v,null!=o.deviceKey&&(y.DEVICE_KEY=o.deviceKey);var g={ChallengeName:"PASSWORD_VERIFIER",ClientId:o.pool.getClientId(),ChallengeResponses:y,Session:f.Session,ClientMetadata:h};o.getUserContextData()&&(g.UserContextData=o.getUserContextData()),function e(t,n){return o.client.request("RespondToAuthChallenge",t,(function(r,i){return r&&"ResourceNotFoundException"===r.code&&-1!==r.message.toLowerCase().indexOf("device")?(y.DEVICE_KEY=null,o.deviceKey=null,o.randomPassword=null,o.deviceGroupKey=null,o.clearCachedDeviceKeyAndPassword(),e(t,n)):n(r,i)}))}(g,(function(e,n){return e?t.onFailure(e):o.authenticateUserInternal(n,a,t)}))}))}))}))},t.authenticateUserPlainUsernamePassword=function(e,t){var n=this,r={};if(r.USERNAME=this.username,r.PASSWORD=e.getPassword(),r.PASSWORD){var i=new C(this.pool.getUserPoolId().split("_")[1]);this.getCachedDeviceKeyAndPassword(),null!=this.deviceKey&&(r.DEVICE_KEY=this.deviceKey);var o=0!==Object.keys(e.getValidationData()).length?e.getValidationData():e.getClientMetadata(),s={AuthFlow:"USER_PASSWORD_AUTH",ClientId:this.pool.getClientId(),AuthParameters:r,ClientMetadata:o};this.getUserContextData(this.username)&&(s.UserContextData=this.getUserContextData(this.username)),this.client.request("InitiateAuth",s,(function(e,r){return e?t.onFailure(e):n.authenticateUserInternal(r,i,t)}))}else t.onFailure(new Error("PASSWORD parameter is required"))},t.authenticateUserInternal=function(e,t,n){var r=this,o=e.ChallengeName,s=e.ChallengeParameters;if("SMS_MFA"===o)return this.Session=e.Session,n.mfaRequired(o,s);if("SELECT_MFA_TYPE"===o)return this.Session=e.Session,n.selectMFAType(o,s);if("MFA_SETUP"===o)return this.Session=e.Session,n.mfaSetup(o,s);if("SOFTWARE_TOKEN_MFA"===o)return this.Session=e.Session,n.totpRequired(o,s);if("CUSTOM_CHALLENGE"===o)return this.Session=e.Session,n.customChallenge(s);if("NEW_PASSWORD_REQUIRED"===o){this.Session=e.Session;var a=null,u=null,c=[],l=t.getNewPasswordRequiredChallengeUserAttributePrefix();if(s&&(a=JSON.parse(e.ChallengeParameters.userAttributes),u=JSON.parse(e.ChallengeParameters.requiredAttributes)),u)for(var f=0;f<u.length;f++)c[f]=u[f].substr(l.length);return n.newPasswordRequired(a,c)}if("DEVICE_SRP_AUTH"===o)return this.Session=e.Session,void this.getDeviceResponse(n);this.signInUserSession=this.getCognitoUserSession(e.AuthenticationResult),this.challengeName=o,this.cacheTokens();var d=e.AuthenticationResult.NewDeviceMetadata;if(null==d)return n.onSuccess(this.signInUserSession);t.generateHashDevice(e.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey,e.AuthenticationResult.NewDeviceMetadata.DeviceKey,(function(o){if(o)return n.onFailure(o);var s={Salt:i.Buffer.from(t.getSaltDevices(),"hex").toString("base64"),PasswordVerifier:i.Buffer.from(t.getVerifierDevices(),"hex").toString("base64")};r.verifierDevices=s.PasswordVerifier,r.deviceGroupKey=d.DeviceGroupKey,r.randomPassword=t.getRandomPassword(),r.client.request("ConfirmDevice",{DeviceKey:d.DeviceKey,AccessToken:r.signInUserSession.getAccessToken().getJwtToken(),DeviceSecretVerifierConfig:s,DeviceName:V},(function(t,i){return t?n.onFailure(t):(r.deviceKey=e.AuthenticationResult.NewDeviceMetadata.DeviceKey,r.cacheDeviceKeyAndPassword(),!0===i.UserConfirmationNecessary?n.onSuccess(r.signInUserSession,i.UserConfirmationNecessary):n.onSuccess(r.signInUserSession))}))}))},t.completeNewPasswordChallenge=function(e,t,n,r){var i=this;if(!e)return n.onFailure(new Error("New password is required."));var o=new C(this.pool.getUserPoolId().split("_")[1]),s=o.getNewPasswordRequiredChallengeUserAttributePrefix(),a={};t&&Object.keys(t).forEach((function(e){a[s+e]=t[e]})),a.NEW_PASSWORD=e,a.USERNAME=this.username;var u={ChallengeName:"NEW_PASSWORD_REQUIRED",ClientId:this.pool.getClientId(),ChallengeResponses:a,Session:this.Session,ClientMetadata:r};this.getUserContextData()&&(u.UserContextData=this.getUserContextData()),this.client.request("RespondToAuthChallenge",u,(function(e,t){return e?n.onFailure(e):i.authenticateUserInternal(t,o,n)}))},t.getDeviceResponse=function(e,t){var n=this,r=new C(this.deviceGroupKey),o=new B,a={};a.USERNAME=this.username,a.DEVICE_KEY=this.deviceKey,r.getLargeAValue((function(u,c){u&&e.onFailure(u),a.SRP_A=c.toString(16);var f={ChallengeName:"DEVICE_SRP_AUTH",ClientId:n.pool.getClientId(),ChallengeResponses:a,ClientMetadata:t,Session:n.Session};n.getUserContextData()&&(f.UserContextData=n.getUserContextData()),n.client.request("RespondToAuthChallenge",f,(function(t,a){if(t)return e.onFailure(t);var u=a.ChallengeParameters,c=new p(u.SRP_B,16),f=new p(u.SALT,16);r.getPasswordAuthenticationKey(n.deviceKey,n.randomPassword,c,f,(function(t,r){if(t)return e.onFailure(t);var c=o.getNowString(),f=s.a.lib.WordArray.create(i.Buffer.concat([i.Buffer.from(n.deviceGroupKey,"utf8"),i.Buffer.from(n.deviceKey,"utf8"),i.Buffer.from(u.SECRET_BLOCK,"base64"),i.Buffer.from(c,"utf8")])),d=s.a.lib.WordArray.create(r),h=D.a.stringify(l()(f,d)),p={};p.USERNAME=n.username,p.PASSWORD_CLAIM_SECRET_BLOCK=u.SECRET_BLOCK,p.TIMESTAMP=c,p.PASSWORD_CLAIM_SIGNATURE=h,p.DEVICE_KEY=n.deviceKey;var v={ChallengeName:"DEVICE_PASSWORD_VERIFIER",ClientId:n.pool.getClientId(),ChallengeResponses:p,Session:a.Session};n.getUserContextData()&&(v.UserContextData=n.getUserContextData()),n.client.request("RespondToAuthChallenge",v,(function(t,r){return t?e.onFailure(t):(n.signInUserSession=n.getCognitoUserSession(r.AuthenticationResult),n.cacheTokens(),e.onSuccess(n.signInUserSession))}))}))}))}))},t.confirmRegistration=function(e,t,n,r){var i={ClientId:this.pool.getClientId(),ConfirmationCode:e,Username:this.username,ForceAliasCreation:t,ClientMetadata:r};this.getUserContextData()&&(i.UserContextData=this.getUserContextData()),this.client.request("ConfirmSignUp",i,(function(e){return e?n(e,null):n(null,"SUCCESS")}))},t.sendCustomChallengeAnswer=function(e,t,n){var r=this,i={};i.USERNAME=this.username,i.ANSWER=e;var o=new C(this.pool.getUserPoolId().split("_")[1]);this.getCachedDeviceKeyAndPassword(),null!=this.deviceKey&&(i.DEVICE_KEY=this.deviceKey);var s={ChallengeName:"CUSTOM_CHALLENGE",ChallengeResponses:i,ClientId:this.pool.getClientId(),Session:this.Session,ClientMetadata:n};this.getUserContextData()&&(s.UserContextData=this.getUserContextData()),this.client.request("RespondToAuthChallenge",s,(function(e,n){return e?t.onFailure(e):r.authenticateUserInternal(n,o,t)}))},t.sendMFACode=function(e,t,n,r){var o=this,s={};s.USERNAME=this.username,s.SMS_MFA_CODE=e;var a=n||"SMS_MFA";"SOFTWARE_TOKEN_MFA"===a&&(s.SOFTWARE_TOKEN_MFA_CODE=e),null!=this.deviceKey&&(s.DEVICE_KEY=this.deviceKey);var u={ChallengeName:a,ChallengeResponses:s,ClientId:this.pool.getClientId(),Session:this.Session,ClientMetadata:r};this.getUserContextData()&&(u.UserContextData=this.getUserContextData()),this.client.request("RespondToAuthChallenge",u,(function(e,n){if(e)return t.onFailure(e);if("DEVICE_SRP_AUTH"!==n.ChallengeName){if(o.signInUserSession=o.getCognitoUserSession(n.AuthenticationResult),o.cacheTokens(),null==n.AuthenticationResult.NewDeviceMetadata)return t.onSuccess(o.signInUserSession);var r=new C(o.pool.getUserPoolId().split("_")[1]);r.generateHashDevice(n.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey,n.AuthenticationResult.NewDeviceMetadata.DeviceKey,(function(e){if(e)return t.onFailure(e);var s={Salt:i.Buffer.from(r.getSaltDevices(),"hex").toString("base64"),PasswordVerifier:i.Buffer.from(r.getVerifierDevices(),"hex").toString("base64")};o.verifierDevices=s.PasswordVerifier,o.deviceGroupKey=n.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey,o.randomPassword=r.getRandomPassword(),o.client.request("ConfirmDevice",{DeviceKey:n.AuthenticationResult.NewDeviceMetadata.DeviceKey,AccessToken:o.signInUserSession.getAccessToken().getJwtToken(),DeviceSecretVerifierConfig:s,DeviceName:V},(function(e,r){return e?t.onFailure(e):(o.deviceKey=n.AuthenticationResult.NewDeviceMetadata.DeviceKey,o.cacheDeviceKeyAndPassword(),!0===r.UserConfirmationNecessary?t.onSuccess(o.signInUserSession,r.UserConfirmationNecessary):t.onSuccess(o.signInUserSession))}))}))}else o.getDeviceResponse(t)}))},t.changePassword=function(e,t,n,r){if(null==this.signInUserSession||!this.signInUserSession.isValid())return n(new Error("User is not authenticated"),null);this.client.request("ChangePassword",{PreviousPassword:e,ProposedPassword:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),ClientMetadata:r},(function(e){return e?n(e,null):n(null,"SUCCESS")}))},t.enableMFA=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e(new Error("User is not authenticated"),null);var t=[];t.push({DeliveryMedium:"SMS",AttributeName:"phone_number"}),this.client.request("SetUserSettings",{MFAOptions:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(t){return t?e(t,null):e(null,"SUCCESS")}))},t.setUserMfaPreference=function(e,t,n){if(null==this.signInUserSession||!this.signInUserSession.isValid())return n(new Error("User is not authenticated"),null);this.client.request("SetUserMFAPreference",{SMSMfaSettings:e,SoftwareTokenMfaSettings:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(e){return e?n(e,null):n(null,"SUCCESS")}))},t.disableMFA=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e(new Error("User is not authenticated"),null);this.client.request("SetUserSettings",{MFAOptions:[],AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(t){return t?e(t,null):e(null,"SUCCESS")}))},t.deleteUser=function(e,t){var n=this;if(null==this.signInUserSession||!this.signInUserSession.isValid())return e(new Error("User is not authenticated"),null);this.client.request("DeleteUser",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),ClientMetadata:t},(function(t){return t?e(t,null):(n.clearCachedUser(),e(null,"SUCCESS"))}))},t.updateAttributes=function(e,t,n){var r=this;if(null==this.signInUserSession||!this.signInUserSession.isValid())return t(new Error("User is not authenticated"),null);this.client.request("UpdateUserAttributes",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),UserAttributes:e,ClientMetadata:n},(function(e){return e?t(e,null):r.getUserData((function(){return t(null,"SUCCESS")}),{bypassCache:!0})}))},t.getUserAttributes=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e(new Error("User is not authenticated"),null);this.client.request("GetUser",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(t,n){if(t)return e(t,null);for(var r=[],i=0;i<n.UserAttributes.length;i++){var o={Name:n.UserAttributes[i].Name,Value:n.UserAttributes[i].Value},s=new q(o);r.push(s)}return e(null,r)}))},t.getMFAOptions=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e(new Error("User is not authenticated"),null);this.client.request("GetUser",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(t,n){return t?e(t,null):e(null,n.MFAOptions)}))},t.createGetUserRequest=function(){return this.client.promisifyRequest("GetUser",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()})},t.refreshSessionIfPossible=function(e){var t=this;return void 0===e&&(e={}),new Promise((function(n){var r=t.signInUserSession.getRefreshToken();r&&r.getToken()?t.refreshSession(r,n,e.clientMetadata):n()}))},t.getUserData=function(e,t){var n=this;if(null==this.signInUserSession||!this.signInUserSession.isValid())return this.clearCachedUserData(),e(new Error("User is not authenticated"),null);var r=this.getUserDataFromCache();if(r)if(this.isFetchUserDataAndTokenRequired(t))this.fetchUserData().then((function(e){return n.refreshSessionIfPossible(t).then((function(){return e}))})).then((function(t){return e(null,t)})).catch(e);else try{return void e(null,JSON.parse(r))}catch(t){return this.clearCachedUserData(),void e(t,null)}else this.fetchUserData().then((function(t){e(null,t)})).catch(e)},t.getUserDataFromCache=function(){return this.storage.getItem(this.userDataKey)},t.isFetchUserDataAndTokenRequired=function(e){var t=(e||{}).bypassCache;return void 0!==t&&t},t.fetchUserData=function(){var e=this;return this.createGetUserRequest().then((function(t){return e.cacheUserData(t),t}))},t.deleteAttributes=function(e,t){var n=this;if(null==this.signInUserSession||!this.signInUserSession.isValid())return t(new Error("User is not authenticated"),null);this.client.request("DeleteUserAttributes",{UserAttributeNames:e,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(e){return e?t(e,null):n.getUserData((function(){return t(null,"SUCCESS")}),{bypassCache:!0})}))},t.resendConfirmationCode=function(e,t){var n={ClientId:this.pool.getClientId(),Username:this.username,ClientMetadata:t};this.client.request("ResendConfirmationCode",n,(function(t,n){return t?e(t,null):e(null,n)}))},t.getSession=function(e,t){if(void 0===t&&(t={}),null==this.username)return e(new Error("Username is null. Cannot retrieve a new session"),null);if(null!=this.signInUserSession&&this.signInUserSession.isValid())return e(null,this.signInUserSession);var n="CognitoIdentityServiceProvider."+this.pool.getClientId()+"."+this.username,r=n+".idToken",i=n+".accessToken",o=n+".refreshToken",s=n+".clockDrift";if(this.storage.getItem(r)){var a=new M({IdToken:this.storage.getItem(r)}),u=new k({AccessToken:this.storage.getItem(i)}),c=new j({RefreshToken:this.storage.getItem(o)}),l=parseInt(this.storage.getItem(s),0)||0,f=new U({IdToken:a,AccessToken:u,RefreshToken:c,ClockDrift:l});if(f.isValid())return this.signInUserSession=f,e(null,this.signInUserSession);if(!c.getToken())return e(new Error("Cannot retrieve a new session. Please authenticate."),null);this.refreshSession(c,e,t.clientMetadata)}else e(new Error("Local storage is missing an ID Token, Please authenticate"),null)},t.refreshSession=function(e,t,n){var r=this,i=this.pool.wrapRefreshSessionCallback?this.pool.wrapRefreshSessionCallback(t):t,o={};o.REFRESH_TOKEN=e.getToken();var s="CognitoIdentityServiceProvider."+this.pool.getClientId(),a=s+".LastAuthUser";if(this.storage.getItem(a)){this.username=this.storage.getItem(a);var u=s+"."+this.username+".deviceKey";this.deviceKey=this.storage.getItem(u),o.DEVICE_KEY=this.deviceKey}var c={ClientId:this.pool.getClientId(),AuthFlow:"REFRESH_TOKEN_AUTH",AuthParameters:o,ClientMetadata:n};this.getUserContextData()&&(c.UserContextData=this.getUserContextData()),this.client.request("InitiateAuth",c,(function(t,n){if(t)return"NotAuthorizedException"===t.code&&r.clearCachedUser(),i(t,null);if(n){var o=n.AuthenticationResult;return Object.prototype.hasOwnProperty.call(o,"RefreshToken")||(o.RefreshToken=e.getToken()),r.signInUserSession=r.getCognitoUserSession(o),r.cacheTokens(),i(null,r.signInUserSession)}}))},t.cacheTokens=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId(),t=e+"."+this.username+".idToken",n=e+"."+this.username+".accessToken",r=e+"."+this.username+".refreshToken",i=e+"."+this.username+".clockDrift",o=e+".LastAuthUser";this.storage.setItem(t,this.signInUserSession.getIdToken().getJwtToken()),this.storage.setItem(n,this.signInUserSession.getAccessToken().getJwtToken()),this.storage.setItem(r,this.signInUserSession.getRefreshToken().getToken()),this.storage.setItem(i,""+this.signInUserSession.getClockDrift()),this.storage.setItem(o,this.username)},t.cacheUserData=function(e){this.storage.setItem(this.userDataKey,JSON.stringify(e))},t.clearCachedUserData=function(){this.storage.removeItem(this.userDataKey)},t.clearCachedUser=function(){this.clearCachedTokens(),this.clearCachedUserData()},t.cacheDeviceKeyAndPassword=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId()+"."+this.username,t=e+".deviceKey",n=e+".randomPasswordKey",r=e+".deviceGroupKey";this.storage.setItem(t,this.deviceKey),this.storage.setItem(n,this.randomPassword),this.storage.setItem(r,this.deviceGroupKey)},t.getCachedDeviceKeyAndPassword=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId()+"."+this.username,t=e+".deviceKey",n=e+".randomPasswordKey",r=e+".deviceGroupKey";this.storage.getItem(t)&&(this.deviceKey=this.storage.getItem(t),this.randomPassword=this.storage.getItem(n),this.deviceGroupKey=this.storage.getItem(r))},t.clearCachedDeviceKeyAndPassword=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId()+"."+this.username,t=e+".deviceKey",n=e+".randomPasswordKey",r=e+".deviceGroupKey";this.storage.removeItem(t),this.storage.removeItem(n),this.storage.removeItem(r)},t.clearCachedTokens=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId(),t=e+"."+this.username+".idToken",n=e+"."+this.username+".accessToken",r=e+"."+this.username+".refreshToken",i=e+".LastAuthUser",o=e+"."+this.username+".clockDrift";this.storage.removeItem(t),this.storage.removeItem(n),this.storage.removeItem(r),this.storage.removeItem(i),this.storage.removeItem(o)},t.getCognitoUserSession=function(e){var t=new M(e),n=new k(e),r=new j(e);return new U({IdToken:t,AccessToken:n,RefreshToken:r})},t.forgotPassword=function(e,t){var n={ClientId:this.pool.getClientId(),Username:this.username,ClientMetadata:t};this.getUserContextData()&&(n.UserContextData=this.getUserContextData()),this.client.request("ForgotPassword",n,(function(t,n){return t?e.onFailure(t):"function"==typeof e.inputVerificationCode?e.inputVerificationCode(n):e.onSuccess(n)}))},t.confirmPassword=function(e,t,n,r){var i={ClientId:this.pool.getClientId(),Username:this.username,ConfirmationCode:e,Password:t,ClientMetadata:r};this.getUserContextData()&&(i.UserContextData=this.getUserContextData()),this.client.request("ConfirmForgotPassword",i,(function(e){return e?n.onFailure(e):n.onSuccess("SUCCESS")}))},t.getAttributeVerificationCode=function(e,t,n){if(null==this.signInUserSession||!this.signInUserSession.isValid())return t.onFailure(new Error("User is not authenticated"));this.client.request("GetUserAttributeVerificationCode",{AttributeName:e,AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),ClientMetadata:n},(function(e,n){return e?t.onFailure(e):"function"==typeof t.inputVerificationCode?t.inputVerificationCode(n):t.onSuccess("SUCCESS")}))},t.verifyAttribute=function(e,t,n){if(null==this.signInUserSession||!this.signInUserSession.isValid())return n.onFailure(new Error("User is not authenticated"));this.client.request("VerifyUserAttribute",{AttributeName:e,Code:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(e){return e?n.onFailure(e):n.onSuccess("SUCCESS")}))},t.getDevice=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e.onFailure(new Error("User is not authenticated"));this.client.request("GetDevice",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),DeviceKey:this.deviceKey},(function(t,n){return t?e.onFailure(t):e.onSuccess(n)}))},t.forgetSpecificDevice=function(e,t){if(null==this.signInUserSession||!this.signInUserSession.isValid())return t.onFailure(new Error("User is not authenticated"));this.client.request("ForgetDevice",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),DeviceKey:e},(function(e){return e?t.onFailure(e):t.onSuccess("SUCCESS")}))},t.forgetDevice=function(e){var t=this;this.forgetSpecificDevice(this.deviceKey,{onFailure:e.onFailure,onSuccess:function(n){return t.deviceKey=null,t.deviceGroupKey=null,t.randomPassword=null,t.clearCachedDeviceKeyAndPassword(),e.onSuccess(n)}})},t.setDeviceStatusRemembered=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e.onFailure(new Error("User is not authenticated"));this.client.request("UpdateDeviceStatus",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),DeviceKey:this.deviceKey,DeviceRememberedStatus:"remembered"},(function(t){return t?e.onFailure(t):e.onSuccess("SUCCESS")}))},t.setDeviceStatusNotRemembered=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e.onFailure(new Error("User is not authenticated"));this.client.request("UpdateDeviceStatus",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),DeviceKey:this.deviceKey,DeviceRememberedStatus:"not_remembered"},(function(t){return t?e.onFailure(t):e.onSuccess("SUCCESS")}))},t.listDevices=function(e,t,n){if(null==this.signInUserSession||!this.signInUserSession.isValid())return n.onFailure(new Error("User is not authenticated"));var r={AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),Limit:e};t&&(r.PaginationToken=t),this.client.request("ListDevices",r,(function(e,t){return e?n.onFailure(e):n.onSuccess(t)}))},t.globalSignOut=function(e){var t=this;if(null==this.signInUserSession||!this.signInUserSession.isValid())return e.onFailure(new Error("User is not authenticated"));this.client.request("GlobalSignOut",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(n){return n?e.onFailure(n):(t.clearCachedUser(),e.onSuccess("SUCCESS"))}))},t.signOut=function(e){var t=this;e&&"function"==typeof e?this.getSession((function(n,r){if(n)return e(n);t.revokeTokens((function(n){t.cleanClientData(),e(n)}))})):this.cleanClientData()},t.revokeTokens=function(e){if(void 0===e&&(e=function(){}),"function"!=typeof e)throw new Error("Invalid revokeTokenCallback. It should be a function.");if(!this.signInUserSession)return e(new Error("User is not authenticated"));if(!this.signInUserSession.getAccessToken())return e(new Error("No Access token available"));var t=this.signInUserSession.getRefreshToken().getToken(),n=this.signInUserSession.getAccessToken();if(this.isSessionRevocable(n)&&t)return this.revokeToken({token:t,callback:e});e()},t.isSessionRevocable=function(e){if(e&&"function"==typeof e.decodePayload)try{return!!e.decodePayload().origin_jti}catch(e){}return!1},t.cleanClientData=function(){this.signInUserSession=null,this.clearCachedUser()},t.revokeToken=function(e){var t=e.token,n=e.callback;this.client.requestWithRetry("RevokeToken",{Token:t,ClientId:this.pool.getClientId()},(function(e){if(e)return n(e);n()}))},t.sendMFASelectionAnswer=function(e,t){var n=this,r={};r.USERNAME=this.username,r.ANSWER=e;var i={ChallengeName:"SELECT_MFA_TYPE",ChallengeResponses:r,ClientId:this.pool.getClientId(),Session:this.Session};this.getUserContextData()&&(i.UserContextData=this.getUserContextData()),this.client.request("RespondToAuthChallenge",i,(function(r,i){return r?t.onFailure(r):(n.Session=i.Session,"SMS_MFA"===e?t.mfaRequired(i.ChallengeName,i.ChallengeParameters):"SOFTWARE_TOKEN_MFA"===e?t.totpRequired(i.ChallengeName,i.ChallengeParameters):void 0)}))},t.getUserContextData=function(){return this.pool.getUserContextData(this.username)},t.associateSoftwareToken=function(e){var t=this;null!=this.signInUserSession&&this.signInUserSession.isValid()?this.client.request("AssociateSoftwareToken",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},(function(t,n){return t?e.onFailure(t):e.associateSecretCode(n.SecretCode)})):this.client.request("AssociateSoftwareToken",{Session:this.Session},(function(n,r){return n?e.onFailure(n):(t.Session=r.Session,e.associateSecretCode(r.SecretCode))}))},t.verifySoftwareToken=function(e,t,n){var r=this;null!=this.signInUserSession&&this.signInUserSession.isValid()?this.client.request("VerifySoftwareToken",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),UserCode:e,FriendlyDeviceName:t},(function(e,t){return e?n.onFailure(e):n.onSuccess(t)})):this.client.request("VerifySoftwareToken",{Session:this.Session,UserCode:e,FriendlyDeviceName:t},(function(e,t){if(e)return n.onFailure(e);r.Session=t.Session;var i={};i.USERNAME=r.username;var o={ChallengeName:"MFA_SETUP",ClientId:r.pool.getClientId(),ChallengeResponses:i,Session:r.Session};r.getUserContextData()&&(o.UserContextData=r.getUserContextData()),r.client.request("RespondToAuthChallenge",o,(function(e,t){return e?n.onFailure(e):(r.signInUserSession=r.getCognitoUserSession(t.AuthenticationResult),r.cacheTokens(),n.onSuccess(r.signInUserSession))}))}))},e}(),W=(n(91),{userAgent:"aws-amplify/5.0.4 js",product:"",navigator:null,isReactNative:!1});
42
42
  /*!
43
43
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
44
44
  * SPDX-License-Identifier: Apache-2.0
45
- */if("undefined"!=typeof navigator&&navigator.product)switch(B.product=navigator.product||"",B.navigator=navigator||null,navigator.product){case"ReactNative":B.userAgent="aws-amplify/5.0.4 react-native",B.isReactNative=!0;break;default:B.userAgent="aws-amplify/5.0.4 js",B.isReactNative=!1}function q(){}q.prototype.userAgent=B.userAgent;var z=q;function V(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,W(e,t)}function K(e){var t="function"==typeof Map?new Map:void 0;return(K=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return G(e,arguments,Y(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),W(r,e)})(e)}function G(e,t,n){return(G=H()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&W(i,n.prototype),i}).apply(null,arguments)}function H(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function W(e,t){return(W=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Y(e){return(Y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var J=function(e){function t(t,n,r,i){var o;return(o=e.call(this,t)||this).code=n,o.name=r,o.statusCode=i,o}return V(t,e),t}(K(Error)),$=function(){function e(e,t,n){this.endpoint=t||"https://cognito-idp."+e+".amazonaws.com/";var r=(n||{}).credentials;this.fetchOptions=r?{credentials:r}:{}}var t=e.prototype;return t.promisifyRequest=function(e,t){var n=this;return new Promise((function(r,i){n.request(e,t,(function(e,t){e?i(new J(e.message,e.code,e.name,e.statusCode)):r(t)}))}))},t.requestWithRetry=function(e,t,n){var r=this;(function(e,t,n){void 0===n&&(n=3e5);return function e(t,n,r,i){void 0===i&&(i=1);if("function"!=typeof t)throw Error("functionToRetry must be a function");return Q(t.name+" attempt #"+i+" with args: "+JSON.stringify(n)),t.apply(void 0,n).catch((function(o){if(Q("error on "+t.name,o),(s=o)&&s.nonRetryable)throw Q(t.name+" non retryable error",o),o;var s,a=r(i,n,o);if(Q(t.name+" retrying in "+a+" ms"),!1!==a)return new Promise((function(e){return setTimeout(e,a)})).then((function(){return e(t,n,r,i+1)}));throw o}))}(e,t,function(e){return function(t){var n=100*Math.pow(2,t)+100*Math.random();return!(n>e)&&n}}(n))})((function(t){return new Promise((function(n,i){r.request(e,t,(function(e,t){e?i(e):n(t)}))}))}),[t],5e3).then((function(e){return n(null,e)})).catch((function(e){return n(e)}))},t.request=function(e,t,n){var r,i={"Content-Type":"application/x-amz-json-1.1","X-Amz-Target":"AWSCognitoIdentityProviderService."+e,"X-Amz-User-Agent":z.prototype.userAgent},o=Object.assign({},this.fetchOptions,{headers:i,method:"POST",mode:"cors",cache:"no-cache",body:JSON.stringify(t)});fetch(this.endpoint,o).then((function(e){return r=e,e}),(function(e){if(e instanceof TypeError)throw new Error("Network error");throw e})).then((function(e){return e.json().catch((function(){return{}}))})).then((function(e){if(r.ok)return n(null,e);e;var t=(e.__type||e.code).split("#").pop(),i=new Error(e.message||e.Message||null);return i.name=t,i.code=t,n(i)})).catch((function(e){if(r&&r.headers&&r.headers.get("x-amzn-errortype"))try{var t=r.headers.get("x-amzn-errortype").split(":")[0],i=new Error(r.status?r.status.toString():null);return i.code=t,i.name=t,i.statusCode=r.status,n(i)}catch(t){return n(e)}else e instanceof Error&&"Network error"===e.message&&(e.code="NetworkError");return n(e)}))},e}(),Q=function(){};Error;
45
+ */if("undefined"!=typeof navigator&&navigator.product)switch(W.product=navigator.product||"",W.navigator=navigator||null,navigator.product){case"ReactNative":W.userAgent="aws-amplify/5.0.4 react-native",W.isReactNative=!0;break;default:W.userAgent="aws-amplify/5.0.4 js",W.isReactNative=!1}function Y(){}Y.prototype.userAgent=W.userAgent;var J=Y;function $(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ee(e,t)}function Z(e){var t="function"==typeof Map?new Map:void 0;return(Z=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return Q(e,arguments,te(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),ee(r,e)})(e)}function Q(e,t,n){return(Q=X()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&ee(i,n.prototype),i}).apply(null,arguments)}function X(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function ee(e,t){return(ee=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function te(e){return(te=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ne=function(e){function t(t,n,r,i){var o;return(o=e.call(this,t)||this).code=n,o.name=r,o.statusCode=i,o}return $(t,e),t}(Z(Error)),re=function(){function e(e,t,n){this.endpoint=t||"https://cognito-idp."+e+".amazonaws.com/";var r=(n||{}).credentials;this.fetchOptions=r?{credentials:r}:{}}var t=e.prototype;return t.promisifyRequest=function(e,t){var n=this;return new Promise((function(r,i){n.request(e,t,(function(e,t){e?i(new ne(e.message,e.code,e.name,e.statusCode)):r(t)}))}))},t.requestWithRetry=function(e,t,n){var r=this;(function(e,t,n){void 0===n&&(n=3e5);return function e(t,n,r,i){void 0===i&&(i=1);if("function"!=typeof t)throw Error("functionToRetry must be a function");return ie(t.name+" attempt #"+i+" with args: "+JSON.stringify(n)),t.apply(void 0,n).catch((function(o){if(ie("error on "+t.name,o),(s=o)&&s.nonRetryable)throw ie(t.name+" non retryable error",o),o;var s,a=r(i,n,o);if(ie(t.name+" retrying in "+a+" ms"),!1!==a)return new Promise((function(e){return setTimeout(e,a)})).then((function(){return e(t,n,r,i+1)}));throw o}))}(e,t,function(e){return function(t){var n=100*Math.pow(2,t)+100*Math.random();return!(n>e)&&n}}(n))})((function(t){return new Promise((function(n,i){r.request(e,t,(function(e,t){e?i(e):n(t)}))}))}),[t],5e3).then((function(e){return n(null,e)})).catch((function(e){return n(e)}))},t.request=function(e,t,n){var r,i={"Content-Type":"application/x-amz-json-1.1","X-Amz-Target":"AWSCognitoIdentityProviderService."+e,"X-Amz-User-Agent":J.prototype.userAgent},o=Object.assign({},this.fetchOptions,{headers:i,method:"POST",mode:"cors",cache:"no-cache",body:JSON.stringify(t)});fetch(this.endpoint,o).then((function(e){return r=e,e}),(function(e){if(e instanceof TypeError)throw new Error("Network error");throw e})).then((function(e){return e.json().catch((function(){return{}}))})).then((function(e){if(r.ok)return n(null,e);e;var t=(e.__type||e.code).split("#").pop(),i=new Error(e.message||e.Message||null);return i.name=t,i.code=t,n(i)})).catch((function(e){if(r&&r.headers&&r.headers.get("x-amzn-errortype"))try{var t=r.headers.get("x-amzn-errortype").split(":")[0],i=new Error(r.status?r.status.toString():null);return i.code=t,i.name=t,i.statusCode=r.status,n(i)}catch(t){return n(e)}else e instanceof Error&&"Network error"===e.message&&(e.code="NetworkError");return n(e)}))},e}(),ie=function(){};Error;
46
46
  /*!
47
47
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
48
48
  * SPDX-License-Identifier: Apache-2.0
49
49
  */
50
- var Z=function(){function e(e,t){var n=e||{},r=n.UserPoolId,i=n.ClientId,o=n.endpoint,s=n.fetchOptions,a=n.AdvancedSecurityDataCollectionFlag;if(!r||!i)throw new Error("Both UserPoolId and ClientId are required.");if(r.length>55||!/^[\w-]+_[0-9a-zA-Z]+$/.test(r))throw new Error("Invalid UserPoolId format.");var u=r.split("_")[0];this.userPoolId=r,this.clientId=i,this.client=new $(u,o,s),this.advancedSecurityDataCollectionFlag=!1!==a,this.storage=e.Storage||(new U).getStorage(),t&&(this.wrapRefreshSessionCallback=t)}var t=e.prototype;return t.getUserPoolId=function(){return this.userPoolId},t.getClientId=function(){return this.clientId},t.signUp=function(e,t,n,r,i,o){var s=this,a={ClientId:this.clientId,Username:e,Password:t,UserAttributes:n,ValidationData:r,ClientMetadata:o};this.getUserContextData(e)&&(a.UserContextData=this.getUserContextData(e)),this.client.request("SignUp",a,(function(t,n){if(t)return i(t,null);var r={Username:e,Pool:s,Storage:s.storage},o={user:new L(r),userConfirmed:n.UserConfirmed,userSub:n.UserSub,codeDeliveryDetails:n.CodeDeliveryDetails};return i(null,o)}))},t.getCurrentUser=function(){var e="CognitoIdentityServiceProvider."+this.clientId+".LastAuthUser",t=this.storage.getItem(e);if(t){var n={Username:t,Pool:this,Storage:this.storage};return new L(n)}return null},t.getUserContextData=function(e){if("undefined"!=typeof AmazonCognitoAdvancedSecurityData){var t=AmazonCognitoAdvancedSecurityData;if(this.advancedSecurityDataCollectionFlag){var n=t.getData(e,this.userPoolId,this.clientId);if(n)return{EncodedData:n}}return{}}},e}(),X=n(25),ee=function(){function e(e){if(!e.domain)throw new Error("The domain of cookieStorage can not be undefined.");if(this.domain=e.domain,e.path?this.path=e.path:this.path="/",Object.prototype.hasOwnProperty.call(e,"expires")?this.expires=e.expires:this.expires=365,Object.prototype.hasOwnProperty.call(e,"secure")?this.secure=e.secure:this.secure=!0,Object.prototype.hasOwnProperty.call(e,"sameSite")){if(!["strict","lax","none"].includes(e.sameSite))throw new Error('The sameSite value of cookieStorage must be "lax", "strict" or "none".');if("none"===e.sameSite&&!this.secure)throw new Error("sameSite = None requires the Secure attribute in latest browser versions.");this.sameSite=e.sameSite}else this.sameSite=null}var t=e.prototype;return t.setItem=function(e,t){var n={path:this.path,expires:this.expires,domain:this.domain,secure:this.secure};return this.sameSite&&(n.sameSite=this.sameSite),X.set(e,t,n),X.get(e)},t.getItem=function(e){return X.get(e)},t.removeItem=function(e){var t={path:this.path,expires:this.expires,domain:this.domain,secure:this.secure};return this.sameSite&&(t.sameSite=this.sameSite),X.remove(e,t)},t.clear=function(){for(var e=X.get(),t=Object.keys(e).length,n=0;n<t;++n)this.removeItem(Object.keys(e)[n]);return{}},e}()},function(e,t,n){"use strict";var r=n(89),i=n(90);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){i.isString(e)&&(e=b(e));return e instanceof o?e.format():o.prototype.format.call(e)},t.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),f=["%","/","?",";","#"].concat(l),d=["/","?","#"],h=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,v={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},y={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},m=n(91);function b(e,t,n){if(e&&i.isObject(e)&&e instanceof o)return e;var r=new o;return r.parse(e,t,n),r}o.prototype.parse=function(e,t,n){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=-1!==o&&o<e.indexOf("#")?"?":"#",c=e.split(a);c[0]=c[0].replace(/\\/g,"/");var b=e=c.join(a);if(b=b.trim(),!n&&1===e.split("#").length){var _=u.exec(b);if(_)return this.path=b,this.href=b,this.pathname=_[1],_[2]?(this.search=_[2],this.query=t?m.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var w=s.exec(b);if(w){var S=(w=w[0]).toLowerCase();this.protocol=S,b=b.substr(w.length)}if(n||w||b.match(/^\/\/[^@\/]+@[^@\/]+/)){var O="//"===b.substr(0,2);!O||w&&g[w]||(b=b.substr(2),this.slashes=!0)}if(!g[w]&&(O||w&&!y[w])){for(var E,A,I=-1,T=0;T<d.length;T++){-1!==(C=b.indexOf(d[T]))&&(-1===I||C<I)&&(I=C)}-1!==(A=-1===I?b.lastIndexOf("@"):b.lastIndexOf("@",I))&&(E=b.slice(0,A),b=b.slice(A+1),this.auth=decodeURIComponent(E)),I=-1;for(T=0;T<f.length;T++){var C;-1!==(C=b.indexOf(f[T]))&&(-1===I||C<I)&&(I=C)}-1===I&&(I=b.length),this.host=b.slice(0,I),b=b.slice(I),this.parseHost(),this.hostname=this.hostname||"";var j="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!j)for(var P=this.hostname.split(/\./),x=(T=0,P.length);T<x;T++){var N=P[T];if(N&&!N.match(h)){for(var k="",M=0,R=N.length;M<R;M++)N.charCodeAt(M)>127?k+="x":k+=N[M];if(!k.match(h)){var D=P.slice(0,T),U=P.slice(T+1),F=N.match(p);F&&(D.push(F[1]),U.unshift(F[2])),U.length&&(b="/"+U.join(".")+b),this.hostname=D.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),j||(this.hostname=r.toASCII(this.hostname));var L=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+L,this.href+=this.host,j&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!v[S])for(T=0,x=l.length;T<x;T++){var q=l[T];if(-1!==b.indexOf(q)){var z=encodeURIComponent(q);z===q&&(z=escape(q)),b=b.split(q).join(z)}}var V=b.indexOf("#");-1!==V&&(this.hash=b.substr(V),b=b.slice(0,V));var K=b.indexOf("?");if(-1!==K?(this.search=b.substr(K),this.query=b.substr(K+1),t&&(this.query=m.parse(this.query)),b=b.slice(0,K)):t&&(this.search="",this.query={}),b&&(this.pathname=b),y[S]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){L=this.pathname||"";var G=this.search||"";this.path=L+G}return this.href=this.format(),this},o.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",n=this.pathname||"",r=this.hash||"",o=!1,s="";this.host?o=e+this.host:this.hostname&&(o=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(s=m.stringify(this.query));var a=this.search||s&&"?"+s||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||y[t])&&!1!==o?(o="//"+(o||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):o||(o=""),r&&"#"!==r.charAt(0)&&(r="#"+r),a&&"?"!==a.charAt(0)&&(a="?"+a),t+o+(n=n.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(a=a.replace("#","%23"))+r},o.prototype.resolve=function(e){return this.resolveObject(b(e,!1,!0)).format()},o.prototype.resolveObject=function(e){if(i.isString(e)){var t=new o;t.parse(e,!1,!0),e=t}for(var n=new o,r=Object.keys(this),s=0;s<r.length;s++){var a=r[s];n[a]=this[a]}if(n.hash=e.hash,""===e.href)return n.href=n.format(),n;if(e.slashes&&!e.protocol){for(var u=Object.keys(e),c=0;c<u.length;c++){var l=u[c];"protocol"!==l&&(n[l]=e[l])}return y[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(e.protocol&&e.protocol!==n.protocol){if(!y[e.protocol]){for(var f=Object.keys(e),d=0;d<f.length;d++){var h=f[d];n[h]=e[h]}return n.href=n.format(),n}if(n.protocol=e.protocol,e.host||g[e.protocol])n.pathname=e.pathname;else{for(var p=(e.pathname||"").split("/");p.length&&!(e.host=p.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==p[0]&&p.unshift(""),p.length<2&&p.unshift(""),n.pathname=p.join("/")}if(n.search=e.search,n.query=e.query,n.host=e.host||"",n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,n.pathname||n.search){var v=n.pathname||"",m=n.search||"";n.path=v+m}return n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var b=n.pathname&&"/"===n.pathname.charAt(0),_=e.host||e.pathname&&"/"===e.pathname.charAt(0),w=_||b||n.host&&e.pathname,S=w,O=n.pathname&&n.pathname.split("/")||[],E=(p=e.pathname&&e.pathname.split("/")||[],n.protocol&&!y[n.protocol]);if(E&&(n.hostname="",n.port=null,n.host&&(""===O[0]?O[0]=n.host:O.unshift(n.host)),n.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===p[0]?p[0]=e.host:p.unshift(e.host)),e.host=null),w=w&&(""===p[0]||""===O[0])),_)n.host=e.host||""===e.host?e.host:n.host,n.hostname=e.hostname||""===e.hostname?e.hostname:n.hostname,n.search=e.search,n.query=e.query,O=p;else if(p.length)O||(O=[]),O.pop(),O=O.concat(p),n.search=e.search,n.query=e.query;else if(!i.isNullOrUndefined(e.search)){if(E)n.hostname=n.host=O.shift(),(j=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=j.shift(),n.host=n.hostname=j.shift());return n.search=e.search,n.query=e.query,i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!O.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var A=O.slice(-1)[0],I=(n.host||e.host||O.length>1)&&("."===A||".."===A)||""===A,T=0,C=O.length;C>=0;C--)"."===(A=O[C])?O.splice(C,1):".."===A?(O.splice(C,1),T++):T&&(O.splice(C,1),T--);if(!w&&!S)for(;T--;T)O.unshift("..");!w||""===O[0]||O[0]&&"/"===O[0].charAt(0)||O.unshift(""),I&&"/"!==O.join("/").substr(-1)&&O.push("");var j,P=""===O[0]||O[0]&&"/"===O[0].charAt(0);E&&(n.hostname=n.host=P?"":O.length?O.shift():"",(j=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=j.shift(),n.host=n.hostname=j.shift()));return(w=w||n.host&&O.length)&&!P&&O.unshift(""),O.length?n.pathname=O.join("/"):(n.pathname=null,n.path=null),i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){"use strict";var r=n(67),i=n.n(r).a;t.a=i},function(e,t,n){"use strict";var r;n.d(t,"a",(function(){return r})),function(e){e.DEFAULT_MSG="Authentication Error",e.EMPTY_EMAIL="Email cannot be empty",e.EMPTY_PHONE="Phone number cannot be empty",e.EMPTY_USERNAME="Username cannot be empty",e.INVALID_USERNAME="The username should either be a string or one of the sign in types",e.EMPTY_PASSWORD="Password cannot be empty",e.EMPTY_CODE="Confirmation code cannot be empty",e.SIGN_UP_ERROR="Error creating account",e.NO_MFA="No valid MFA method provided",e.INVALID_MFA="Invalid MFA type",e.EMPTY_CHALLENGE="Challenge response cannot be empty",e.NO_USER_SESSION="Failed to get the session because the user is empty",e.NETWORK_ERROR="Network Error",e.DEVICE_CONFIG="Device tracking has not been configured in this User Pool",e.AUTOSIGNIN_ERROR="Please use your credentials to sign in"}(r||(r={}))},function(e,t,n){"use strict";var r=n(52),i=Object.prototype.toString;function o(e){return Array.isArray(e)}function s(e){return void 0===e}function a(e){return"[object ArrayBuffer]"===i.call(e)}function u(e){return null!==e&&"object"==typeof e}function c(e){if("[object Object]"!==i.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function l(e){return"[object Function]"===i.call(e)}function f(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),o(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}e.exports={isArray:o,isArrayBuffer:a,isBuffer:function(e){return null!==e&&!s(e)&&null!==e.constructor&&!s(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"[object FormData]"===i.call(e)},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&a(e.buffer)},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:u,isPlainObject:c,isUndefined:s,isDate:function(e){return"[object Date]"===i.call(e)},isFile:function(e){return"[object File]"===i.call(e)},isBlob:function(e){return"[object Blob]"===i.call(e)},isFunction:l,isStream:function(e){return u(e)&&l(e.pipe)},isURLSearchParams:function(e){return"[object URLSearchParams]"===i.call(e)},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:f,merge:function e(){var t={};function n(n,r){c(t[r])&&c(n)?t[r]=e(t[r],n):c(n)?t[r]=e({},n):o(n)?t[r]=n.slice():t[r]=n}for(var r=0,i=arguments.length;r<i;r++)f(arguments[r],n);return t},extend:function(e,t,n){return f(t,(function(t,i){e[i]=n&&"function"==typeof t?r(t,n):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),(0,n(0).__exportStar)(n(80),t)},function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function i(e){return!!e&&!!e[W]}function o(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===Y}(e)||Array.isArray(e)||!!e[H]||!!e.constructor[H]||d(e)||h(e))}function s(e,t,n){void 0===n&&(n=!1),0===a(e)?(n?Object.keys:J)(e).forEach((function(r){n&&"symbol"==typeof r||t(r,e[r],e)})):e.forEach((function(n,r){return t(r,n,e)}))}function a(e){var t=e[W];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:d(e)?2:h(e)?3:0}function u(e,t){return 2===a(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function c(e,t){return 2===a(e)?e.get(t):e[t]}function l(e,t,n){var r=a(e);2===r?e.set(t,n):3===r?(e.delete(t),e.add(n)):e[t]=n}function f(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function d(e){return z&&e instanceof Map}function h(e){return V&&e instanceof Set}function p(e){return e.o||e.t}function v(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=$(e);delete t[W];for(var n=J(t),r=0;r<n.length;r++){var i=n[r],o=t[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(t[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function g(e,t){return void 0===t&&(t=!1),m(e)||i(e)||!o(e)||(a(e)>1&&(e.set=e.add=e.clear=e.delete=y),Object.freeze(e),t&&s(e,(function(e,t){return g(t,!0)}),!0)),e}function y(){r(2)}function m(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function b(e){var t=Q[e];return t||r(18,e),t}function _(e,t){Q[e]||(Q[e]=t)}function w(){return B}function S(e,t){t&&(b("Patches"),e.u=[],e.s=[],e.v=t)}function O(e){E(e),e.p.forEach(I),e.p=null}function E(e){e===B&&(B=e.l)}function A(e){return B={p:[],l:B,h:e,m:!0,_:0}}function I(e){var t=e[W];0===t.i||1===t.i?t.j():t.O=!0}function T(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||b("ES5").S(t,e,i),i?(n[W].P&&(O(t),r(4)),o(e)&&(e=C(t,e),t.l||P(t,e)),t.u&&b("Patches").M(n[W],e,t.u,t.s)):e=C(t,n,[]),O(t),t.u&&t.v(t.u,t.s),e!==G?e:void 0}function C(e,t,n){if(m(t))return t;var r=t[W];if(!r)return s(t,(function(i,o){return j(e,r,t,i,o,n)}),!0),t;if(r.A!==e)return t;if(!r.P)return P(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=4===r.i||5===r.i?r.o=v(r.k):r.o;s(3===r.i?new Set(i):i,(function(t,o){return j(e,r,i,t,o,n)})),P(e,i,!1),n&&e.u&&b("Patches").R(r,n,e.u,e.s)}return r.o}function j(e,t,n,r,s,a){if(i(s)){var c=C(e,s,a&&t&&3!==t.i&&!u(t.D,r)?a.concat(r):void 0);if(l(n,r,c),!i(c))return;e.m=!1}if(o(s)&&!m(s)){if(!e.h.F&&e._<1)return;C(e,s),t&&t.A.l||P(e,s)}}function P(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&g(t,n)}function x(e,t){var n=e[W];return(n?p(n):e)[t]}function N(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function k(e){e.P||(e.P=!0,e.l&&k(e.l))}function M(e){e.o||(e.o=v(e.t))}function R(e,t,n){var r=d(t)?b("MapSet").N(t,n):h(t)?b("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:w(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=r,o=Z;n&&(i=[r],o=X);var s=Proxy.revocable(i,o),a=s.revoke,u=s.proxy;return r.k=u,r.j=a,u}(t,n):b("ES5").J(t,n);return(n?n.A:w()).p.push(r),r}function D(e){return i(e)||r(22,e),function e(t){if(!o(t))return t;var n,r=t[W],i=a(t);if(r){if(!r.P&&(r.i<4||!b("ES5").K(r)))return r.t;r.I=!0,n=U(t,i),r.I=!1}else n=U(t,i);return s(n,(function(t,i){r&&c(r.t,t)===i||l(n,t,e(i))})),3===i?new Set(n):n}(e)}function U(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return v(e)}function F(){function e(t){if(!o(t))return t;if(Array.isArray(t))return t.map(e);if(d(t))return new Map(Array.from(t.entries()).map((function(t){return[t[0],e(t[1])]})));if(h(t))return new Set(Array.from(t).map(e));var n=Object.create(Object.getPrototypeOf(t));for(var r in t)n[r]=e(t[r]);return u(t,H)&&(n[H]=t[H]),n}function t(t){return i(t)?e(t):t}var n="add";_("Patches",{$:function(t,i){return i.forEach((function(i){for(var o=i.path,s=i.op,u=t,l=0;l<o.length-1;l++){var f=a(u),d=""+o[l];0!==f&&1!==f||"__proto__"!==d&&"constructor"!==d||r(24),"function"==typeof u&&"prototype"===d&&r(24),"object"!=typeof(u=c(u,d))&&r(15,o.join("/"))}var h=a(u),p=e(i.value),v=o[o.length-1];switch(s){case"replace":switch(h){case 2:return u.set(v,p);case 3:r(16);default:return u[v]=p}case n:switch(h){case 1:return u.splice(v,0,p);case 2:return u.set(v,p);case 3:return u.add(p);default:return u[v]=p}case"remove":switch(h){case 1:return u.splice(v,1);case 2:return u.delete(v);case 3:return u.delete(i.value);default:return delete u[v]}default:r(17,s)}})),t},R:function(e,r,i,o){switch(e.i){case 0:case 4:case 2:return function(e,r,i,o){var a=e.t,l=e.o;s(e.D,(function(e,s){var f=c(a,e),d=c(l,e),h=s?u(a,e)?"replace":n:"remove";if(f!==d||"replace"!==h){var p=r.concat(e);i.push("remove"===h?{op:h,path:p}:{op:h,path:p,value:d}),o.push(h===n?{op:"remove",path:p}:"remove"===h?{op:n,path:p,value:t(f)}:{op:"replace",path:p,value:t(f)})}}))}(e,r,i,o);case 5:case 1:return function(e,r,i,o){var s=e.t,a=e.D,u=e.o;if(u.length<s.length){var c=[u,s];s=c[0],u=c[1];var l=[o,i];i=l[0],o=l[1]}for(var f=0;f<s.length;f++)if(a[f]&&u[f]!==s[f]){var d=r.concat([f]);i.push({op:"replace",path:d,value:t(u[f])}),o.push({op:"replace",path:d,value:t(s[f])})}for(var h=s.length;h<u.length;h++){var p=r.concat([h]);i.push({op:n,path:p,value:t(u[h])})}s.length<u.length&&o.push({op:"replace",path:r.concat(["length"]),value:s.length})}(e,r,i,o);case 3:return function(e,t,r,i){var o=e.t,s=e.o,a=0;o.forEach((function(e){if(!s.has(e)){var o=t.concat([a]);r.push({op:"remove",path:o,value:e}),i.unshift({op:n,path:o,value:e})}a++})),a=0,s.forEach((function(e){if(!o.has(e)){var s=t.concat([a]);r.push({op:n,path:s,value:e}),i.unshift({op:"remove",path:s,value:e})}a++}))}(e,r,i,o)}},M:function(e,t,n,r){n.push({op:"replace",path:[],value:t===G?void 0:t}),r.push({op:"replace",path:[],value:e.t})}})}n.d(t,"a",(function(){return re})),n.d(t,"b",(function(){return F})),n.d(t,"c",(function(){return H})),n.d(t,"d",(function(){return te})),n.d(t,"e",(function(){return ne}));var L,B,q="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),z="undefined"!=typeof Map,V="undefined"!=typeof Set,K="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,G=q?Symbol.for("immer-nothing"):((L={})["immer-nothing"]=!0,L),H=q?Symbol.for("immer-draftable"):"__$immer_draftable",W=q?Symbol.for("immer-state"):"__$immer_state",Y=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),J="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,$=Object.getOwnPropertyDescriptors||function(e){var t={};return J(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Q={},Z={get:function(e,t){if(t===W)return e;var n=p(e);if(!u(n,t))return function(e,t,n){var r,i=N(t,n);return i?"value"in i?i.value:null===(r=i.get)||void 0===r?void 0:r.call(e.k):void 0}(e,n,t);var r=n[t];return e.I||!o(r)?r:r===x(e.t,t)?(M(e),e.o[t]=R(e.A.h,r,e)):r},has:function(e,t){return t in p(e)},ownKeys:function(e){return Reflect.ownKeys(p(e))},set:function(e,t,n){var r=N(p(e),t);if(null==r?void 0:r.set)return r.set.call(e.k,n),!0;if(!e.P){var i=x(p(e),t),o=null==i?void 0:i[W];if(o&&o.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(f(n,i)&&(void 0!==n||u(e.t,t)))return!0;M(e),k(e)}return e.o[t]===n&&"number"!=typeof n&&(void 0!==n||t in e.o)||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==x(e.t,t)||t in e.t?(e.D[t]=!1,M(e),k(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=p(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty:function(){r(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){r(12)}},X={};s(Z,(function(e,t){X[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),X.deleteProperty=function(e,t){return Z.deleteProperty.call(this,e[0],t)},X.set=function(e,t,n){return Z.set.call(this,e[0],t,n,e[0])};var ee=new(function(){function e(e){var t=this;this.g=K,this.F=!0,this.produce=function(e,n,i){if("function"==typeof e&&"function"!=typeof n){var s=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=s);for(var r=arguments.length,i=Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return a.produce(e,(function(e){var r;return(r=n).call.apply(r,[t,e].concat(i))}))}}var u;if("function"!=typeof n&&r(6),void 0!==i&&"function"!=typeof i&&r(7),o(e)){var c=A(t),l=R(t,e,void 0),f=!0;try{u=n(l),f=!1}finally{f?O(c):E(c)}return"undefined"!=typeof Promise&&u instanceof Promise?u.then((function(e){return S(c,i),T(e,c)}),(function(e){throw O(c),e})):(S(c,i),T(u,c))}if(!e||"object"!=typeof e){if((u=n(e))===G)return;return void 0===u&&(u=e),t.F&&g(u,!0),u}r(21,e)},this.produceWithPatches=function(e,n){return"function"==typeof e?function(n){for(var r=arguments.length,i=Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(i))}))}:[t.produce(e,n,(function(e,t){r=e,i=t})),r,i];var r,i},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){o(e)||r(8),i(e)&&(e=D(e));var t=A(this),n=R(this,e,void 0);return n[W].C=!0,E(t),n},t.finishDraft=function(e,t){var n=(e&&e[W]).A;return S(n,t),T(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!K&&r(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}var o=b("Patches").$;return i(e)?o(e,t):this.produce(e,(function(e){return o(e,t.slice(n+1))}))},e}()),te=ee.produce,ne=(ee.produceWithPatches.bind(ee),ee.setAutoFreeze.bind(ee)),re=(ee.setUseProxies.bind(ee),ee.applyPatches.bind(ee));ee.createDraft.bind(ee),ee.finishDraft.bind(ee)},function(e,t,n){"use strict";(function(e){n.d(t,"d",(function(){return l})),n.d(t,"c",(function(){return f})),n.d(t,"b",(function(){return d})),n.d(t,"a",(function(){return g}));var r=[{type:"text/plain",ext:"txt"},{type:"text/html",ext:"html"},{type:"text/javascript",ext:"js"},{type:"text/css",ext:"css"},{type:"text/csv",ext:"csv"},{type:"text/yaml",ext:"yml"},{type:"text/yaml",ext:"yaml"},{type:"text/calendar",ext:"ics"},{type:"text/calendar",ext:"ical"},{type:"image/apng",ext:"apng"},{type:"image/bmp",ext:"bmp"},{type:"image/gif",ext:"gif"},{type:"image/x-icon",ext:"ico"},{type:"image/x-icon",ext:"cur"},{type:"image/jpeg",ext:"jpg"},{type:"image/jpeg",ext:"jpeg"},{type:"image/jpeg",ext:"jfif"},{type:"image/jpeg",ext:"pjp"},{type:"image/jpeg",ext:"pjpeg"},{type:"image/png",ext:"png"},{type:"image/svg+xml",ext:"svg"},{type:"image/tiff",ext:"tif"},{type:"image/tiff",ext:"tiff"},{type:"image/webp",ext:"webp"},{type:"application/json",ext:"json"},{type:"application/xml",ext:"xml"},{type:"application/x-sh",ext:"sh"},{type:"application/zip",ext:"zip"},{type:"application/x-rar-compressed",ext:"rar"},{type:"application/x-tar",ext:"tar"},{type:"application/x-bzip",ext:"bz"},{type:"application/x-bzip2",ext:"bz2"},{type:"application/pdf",ext:"pdf"},{type:"application/java-archive",ext:"jar"},{type:"application/msword",ext:"doc"},{type:"application/vnd.ms-excel",ext:"xls"},{type:"application/vnd.ms-excel",ext:"xlsx"},{type:"message/rfc822",ext:"eml"}],i=function(e){return void 0===e&&(e={}),0===Object.keys(e).length},o=function(e,t,n){if(!e||!e.sort)return!1;var r=n&&"desc"===n?-1:1;return e.sort((function(e,n){var i=e[t],o=n[t];return void 0===o?void 0===i?0:1*r:void 0===i||i<o?-1*r:i>o?1*r:0})),!0},s=function(e,t){var n=Object.assign({},e);return t&&("string"==typeof t?delete n[t]:t.forEach((function(e){delete n[e]}))),n},a=function(e,t){void 0===t&&(t="application/octet-stream");var n=e.toLowerCase(),i=r.filter((function(e){return n.endsWith("."+e.ext)}));return i.length>0?i[0].type:t},u=function(e){var t=e.toLowerCase();return!!t.startsWith("text/")||("application/json"===t||"application/xml"===t||"application/sh"===t)},c=function(){for(var e="",t="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n=32;n>0;n-=1)e+=t[Math.floor(Math.random()*t.length)];return e},l=function(e){if(e.isResolved)return e;var t=!0,n=!1,r=!1,i=e.then((function(e){return r=!0,t=!1,e}),(function(e){throw n=!0,t=!1,e}));return i.isFullfilled=function(){return r},i.isPending=function(){return t},i.isRejected=function(){return n},i},f=function(){if("undefined"==typeof self)return!1;var e=self;return void 0!==e.WorkerGlobalScope&&self instanceof e.WorkerGlobalScope},d=function(){return{isBrowser:"undefined"!=typeof window&&void 0!==window.document,isNode:void 0!==e&&null!=e.versions&&null!=e.versions.node}},h=function e(t,n,r){if(void 0===n&&(n=[]),void 0===r&&(r=[]),!v(t))return t;var i={};for(var o in t){if(t.hasOwnProperty(o))i[n.includes(o)?o:o[0].toLowerCase()+o.slice(1)]=r.includes(o)?t[o]:e(t[o],n,r)}return i},p=function e(t,n,r){if(void 0===n&&(n=[]),void 0===r&&(r=[]),!v(t))return t;var i={};for(var o in t){if(t.hasOwnProperty(o))i[n.includes(o)?o:o[0].toUpperCase()+o.slice(1)]=r.includes(o)?t[o]:e(t[o],n,r)}return i},v=function(e){return!(!(e instanceof Object)||e instanceof Array||e instanceof Function||e instanceof Number||e instanceof String||e instanceof Boolean)},g=function(){function e(){}return e.isEmpty=i,e.sortByField=o,e.objectLessAttributes=s,e.filenameToContentType=a,e.isTextFile=u,e.generateRandomString=c,e.makeQuerablePromise=l,e.isWebWorker=f,e.browserOrNode=d,e.transferKeyToLowerCase=h,e.transferKeyToUpperCase=p,e.isStrictObject=v,e}()}).call(this,n(44))},function(e,t,n){"use strict";var r=n(30);n(8);t.a=r.a},function(e,t,n){"use strict";for(var r=n(0),i=n(30),o=n(19),s=n(21),a=n(132),u=n(32),c={clockOffset:0,getDateWithClockOffset:function(){return c.clockOffset?new Date((new Date).getTime()+c.clockOffset):new Date},getClockOffset:function(){return c.clockOffset},getHeaderStringFromDate:function(e){return void 0===e&&(e=c.getDateWithClockOffset()),e.toISOString().replace(/[:\-]|\.\d{3}/g,"")},getDateFromHeaderString:function(e){var t=Object(r.__read)(e.match(/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2}).+/),7),n=t[1],i=t[2],o=t[3],s=t[4],a=t[5],u=t[6];return new Date(Date.UTC(Number(n),Number(i)-1,Number(o),Number(s),Number(a),Number(u)))},isClockSkewed:function(e){return Math.abs(e.getTime()-c.getDateWithClockOffset().getTime())>=3e5},isClockSkewError:function(e){if(!e.response||!e.response.headers)return!1;var t=e.response.headers;return Boolean(["BadRequestException","InvalidSignatureException"].includes(t["x-amzn-errortype"])&&(t.date||t.Date))},setClockOffset:function(e){c.clockOffset=e}},l=n(13),f={},d={},h=0;h<256;h++){var p=h.toString(16).toLowerCase();1===p.length&&(p="0"+p),f[h]=p,d[p]=h}function v(e){for(var t="",n=0;n<e.byteLength;n++)t+=f[e[n]];return t}var g=n(9);function y(e){return(y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var m=new s.a("Signer"),b=function(e,t){var n=new l.Sha256(e);return n.update(t),n.digestSync()},_=function(e){var t=e||"",n=new l.Sha256;return n.update(t),v(n.digestSync())},w=function(e){return Object.keys(e).map((function(e){return e.toLowerCase()})).sort().join(";")},S=function(e){var t,n,r=Object(g.parse)(e.url);return[e.method||"/",encodeURIComponent(r.pathname).replace(/%2F/gi,"/"),(n=r.query,n&&0!==n.length?n.split("&").map((function(e){var t=e.split("=");if(1===t.length)return e;var n=t[1].replace(/[!'()*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}));return t[0]+"="+n})).sort((function(e,t){var n=e.split("=")[0],r=t.split("=")[0];return n===r?e<t?-1:1:n<r?-1:1})).join("&"):""),(t=e.headers,t&&0!==Object.keys(t).length?Object.keys(t).map((function(e){return{key:e.toLowerCase(),value:t[e]?t[e].trim().replace(/\s+/g," "):""}})).sort((function(e,t){return e.key<t.key?-1:1})).map((function(e){return e.key+":"+e.value})).join("\n")+"\n":""),w(e.headers),_(e.data)].join("\n")},O=function(e){var t=(Object(g.parse)(e.url).host.match(/([^\.]+)\.(?:([^\.]*)\.)?amazonaws\.com$/)||[]).slice(1,3);return"es"===t[1]&&(t=t.reverse()),{service:e.service||t[0],region:e.region||t[1]}},E=function(e,t,n){return[e,t,n,"aws4_request"].join("/")},A=function(e,t,n,r){return[e,n,r,_(t)].join("\n")},I=function(e,t,n){m.debug(n);var r=b("AWS4"+e,t),i=b(r,n.region),o=b(i,n.service);return b(o,"aws4_request")},T=function(e,t){return v(b(e,t))},C=function(){function e(){}return e.sign=function(e,t,n){if(void 0===n&&(n=null),e.headers=e.headers||{},e.body&&!e.data)throw new Error('The attribute "body" was found on the request object. Please use the attribute "data" instead.');var r=c.getDateWithClockOffset().toISOString().replace(/[:\-]|\.\d{3}/g,""),i=r.substr(0,8),o=Object(g.parse)(e.url);e.headers.host=o.host,e.headers["x-amz-date"]=r,t.session_token&&(e.headers["X-Amz-Security-Token"]=t.session_token);var s=S(e);m.debug(s);var a=n||O(e),u=E(i,a.region,a.service),l=A("AWS4-HMAC-SHA256",s,r,u),f=I(t.secret_key,i,a),d=T(f,l),h=function(e,t,n,r,i){return[e+" Credential="+t+"/"+n,"SignedHeaders="+r,"Signature="+i].join(", ")}("AWS4-HMAC-SHA256",t.access_key,u,w(e.headers),d);return e.headers.Authorization=h,e},e.signUrl=function(e,t,n,i){var o="object"===y(e)?e.url:e,s="object"===y(e)?e.method:"GET",a="object"===y(e)?e.body:void 0,u=c.getDateWithClockOffset().toISOString().replace(/[:\-]|\.\d{3}/g,""),l=u.substr(0,8),f=Object(g.parse)(o,!0,!0),d=(f.search,Object(r.__rest)(f,["search"])),h={host:d.host},p=n||O({url:Object(g.format)(d)}),v=p.region,m=p.service,b=E(l,v,m),_=t.session_token&&"iotdevicegateway"!==m,w=Object(r.__assign)(Object(r.__assign)(Object(r.__assign)({"X-Amz-Algorithm":"AWS4-HMAC-SHA256","X-Amz-Credential":[t.access_key,b].join("/"),"X-Amz-Date":u.substr(0,16)},_?{"X-Amz-Security-Token":""+t.session_token}:{}),i?{"X-Amz-Expires":""+i}:{}),{"X-Amz-SignedHeaders":Object.keys(h).join(",")}),C=S({method:s,url:Object(g.format)(Object(r.__assign)(Object(r.__assign)({},d),{query:Object(r.__assign)(Object(r.__assign)({},d.query),w)})),headers:h,data:a}),j=A("AWS4-HMAC-SHA256",C,u,b),P=I(t.secret_key,l,{region:v,service:m}),x=T(P,j),N=Object(r.__assign)({"X-Amz-Signature":x},t.session_token&&{"X-Amz-Security-Token":t.session_token});return Object(g.format)({protocol:d.protocol,slashes:!0,hostname:d.hostname,port:d.port,pathname:d.pathname,query:Object(r.__assign)(Object(r.__assign)(Object(r.__assign)({},d.query),w),N)})},e}(),j=n(26),P=n.n(j),x=new s.a("RestClient"),N=function(){function e(e){this._region="us-east-1",this._service="execute-api",this._custom_header=void 0,this._cancelTokenMap=null,this.Credentials=a.a,this._options=e,x.debug("API Options",this._options),null==this._cancelTokenMap&&(this._cancelTokenMap=new WeakMap)}return e.prototype.ajax=function(e,t,n){return Object(r.__awaiter)(this,void 0,void 0,(function(){var i,o,s,a,l,f,d,h,p,v,y,m,b,_,w=this;return Object(r.__generator)(this,(function(S){switch(S.label){case 0:return x.debug(t,e),s="us-east-1",a="execute-api",l=void 0,"string"==typeof e?(i=this._parseUrl(e),o=e):(o=e.endpoint,l=e.custom_header,s=e.region,a=e.service,i=this._parseUrl(e.endpoint)),f={method:t,url:o,host:i.host,path:i.path,headers:{},data:null,responseType:"json",timeout:0,cancelToken:null},d={},u.a.isReactNative&&(h=u.a.userAgent||"aws-amplify/0.1.x",d={"User-Agent":h}),p=Object.assign({},n),v=p.response,p.body&&("function"==typeof FormData&&p.body instanceof FormData?(d["Content-Type"]="multipart/form-data",f.data=p.body):(d["Content-Type"]="application/json; charset=UTF-8",f.data=JSON.stringify(p.body))),p.responseType&&(f.responseType=p.responseType),p.withCredentials&&(f.withCredentials=p.withCredentials),p.timeout&&(f.timeout=p.timeout),p.cancellableToken&&(f.cancelToken=p.cancellableToken.token),f.signerServiceInfo=p.signerServiceInfo,"function"!=typeof l?[3,2]:[4,l()];case 1:return m=S.sent(),[3,3];case 2:m=void 0,S.label=3;case 3:return y=m,f.headers=Object(r.__assign)(Object(r.__assign)(Object(r.__assign)({},d),y),p.headers),b=Object(g.parse)(o,!0,!0),b.search,_=Object(r.__rest)(b,["search"]),f.url=Object(g.format)(Object(r.__assign)(Object(r.__assign)({},_),{query:Object(r.__assign)(Object(r.__assign)({},_.query),p.queryStringParameters||{})})),void 0!==f.headers.Authorization?(f.headers=Object.keys(f.headers).reduce((function(e,t){return f.headers[t]&&(e[t]=f.headers[t]),e}),{}),[2,this._request(f,v)]):[2,this.Credentials.get().then((function(i){return w._signed(Object(r.__assign)({},f),i,v,{region:s,service:a}).catch((function(r){if(c.isClockSkewError(r)){var i=r.response.headers,o=i&&(i.date||i.Date),s=new Date(o),a=c.getDateFromHeaderString(f.headers["x-amz-date"]);if(c.isClockSkewed(s))return c.setClockOffset(s.getTime()-a.getTime()),w.ajax(e,t,n)}throw r}))}),(function(e){return x.debug("No credentials available, the request will be unsigned"),w._request(f,v)}))]}}))}))},e.prototype.get=function(e,t){return this.ajax(e,"GET",t)},e.prototype.put=function(e,t){return this.ajax(e,"PUT",t)},e.prototype.patch=function(e,t){return this.ajax(e,"PATCH",t)},e.prototype.post=function(e,t){return this.ajax(e,"POST",t)},e.prototype.del=function(e,t){return this.ajax(e,"DELETE",t)},e.prototype.head=function(e,t){return this.ajax(e,"HEAD",t)},e.prototype.cancel=function(e,t){var n=this._cancelTokenMap.get(e);return!!n&&(n.cancel(t),!0)},e.prototype.hasCancelToken=function(e){return this._cancelTokenMap.has(e)},e.prototype.isCancel=function(e){return P.a.isCancel(e)},e.prototype.getCancellableToken=function(){return P.a.CancelToken.source()},e.prototype.updateRequestToBeCancellable=function(e,t){this._cancelTokenMap.set(e,t)},e.prototype.endpoint=function(e){var t=this,n=this._options.endpoints,r="";return Array.isArray(n)?(n.forEach((function(n){n.name===e&&(r=n.endpoint,"string"==typeof n.region?t._region=n.region:"string"==typeof t._options.region&&(t._region=t._options.region),"string"==typeof n.service?t._service=n.service||"execute-api":t._service="execute-api","function"==typeof n.custom_header?t._custom_header=n.custom_header:t._custom_header=void 0)})),r):r},e.prototype._signed=function(e,t,n,i){var o=i.service,s=i.region,a=e.signerServiceInfo,u=Object(r.__rest)(e,["signerServiceInfo"]),c=s||this._region||this._options.region,l=o||this._service||this._options.service,f={secret_key:t.secretAccessKey,access_key:t.accessKeyId,session_token:t.sessionToken},d={region:c,service:l},h=Object.assign(d,a),p=C.sign(u,f,h);return p.data&&(p.body=p.data),x.debug("Signed Request: ",p),delete p.headers.host,P()(p).then((function(e){return n?e:e.data})).catch((function(e){throw x.debug(e),e}))},e.prototype._request=function(e,t){return void 0===t&&(t=!1),P()(e).then((function(e){return t?e:e.data})).catch((function(e){throw x.debug(e),e}))},e.prototype._parseUrl=function(e){var t=e.split("/");return{host:t[2],path:"/"+t.slice(3).join("/")}},e}(),k=n(37),M=new s.a("RestAPI"),R=function(){function e(e){this._api=null,this.Credentials=a.a,this._options=e,M.debug("API Options",this._options)}return e.prototype.getModuleName=function(){return"RestAPI"},e.prototype.configure=function(e){var t=e||{},n=t.API,i=void 0===n?{}:n,o=Object(r.__rest)(t,["API"]),s=Object(r.__assign)(Object(r.__assign)({},o),i);if(M.debug("configure Rest API",{opt:s}),s.aws_project_region){if(s.aws_cloud_logic_custom){var a=s.aws_cloud_logic_custom;s.endpoints="string"==typeof a?JSON.parse(a):a}s=Object.assign({},s,{region:s.aws_project_region,header:{}})}return Array.isArray(s.endpoints)?s.endpoints.forEach((function(e){void 0!==e.custom_header&&"function"!=typeof e.custom_header&&(M.warn("Rest API "+e.name+", custom_header should be a function"),e.custom_header=void 0)})):this._options&&Array.isArray(this._options.endpoints)?s.endpoints=this._options.endpoints:s.endpoints=[],this._options=Object.assign({},this._options,s),this.createInstance(),this._options},e.prototype.createInstance=function(){return M.debug("create Rest API instance"),this._api=new N(this._options),this._api.Credentials=this.Credentials,!0},e.prototype.get=function(e,t,n){try{var r=this.getEndpointInfo(e,t),i=this._api.getCancellableToken(),o=Object.assign({},n);o.cancellableToken=i;var s=this._api.get(r,o);return this._api.updateRequestToBeCancellable(s,i),s}catch(e){return Promise.reject(e.message)}},e.prototype.post=function(e,t,n){try{var r=this.getEndpointInfo(e,t),i=this._api.getCancellableToken(),o=Object.assign({},n);o.cancellableToken=i;var s=this._api.post(r,o);return this._api.updateRequestToBeCancellable(s,i),s}catch(e){return Promise.reject(e.message)}},e.prototype.put=function(e,t,n){try{var r=this.getEndpointInfo(e,t),i=this._api.getCancellableToken(),o=Object.assign({},n);o.cancellableToken=i;var s=this._api.put(r,o);return this._api.updateRequestToBeCancellable(s,i),s}catch(e){return Promise.reject(e.message)}},e.prototype.patch=function(e,t,n){try{var r=this.getEndpointInfo(e,t),i=this._api.getCancellableToken(),o=Object.assign({},n);o.cancellableToken=i;var s=this._api.patch(r,o);return this._api.updateRequestToBeCancellable(s,i),s}catch(e){return Promise.reject(e.message)}},e.prototype.del=function(e,t,n){try{var r=this.getEndpointInfo(e,t),i=this._api.getCancellableToken(),o=Object.assign({},n);o.cancellableToken=i;var s=this._api.del(r,o);return this._api.updateRequestToBeCancellable(s,i),s}catch(e){return Promise.reject(e.message)}},e.prototype.head=function(e,t,n){try{var r=this.getEndpointInfo(e,t),i=this._api.getCancellableToken(),o=Object.assign({},n);o.cancellableToken=i;var s=this._api.head(r,o);return this._api.updateRequestToBeCancellable(s,i),s}catch(e){return Promise.reject(e.message)}},e.prototype.isCancel=function(e){return this._api.isCancel(e)},e.prototype.cancel=function(e,t){return this._api.cancel(e,t)},e.prototype.hasCancelToken=function(e){return this._api.hasCancelToken(e)},e.prototype.endpoint=function(e){return Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(t){return[2,this._api.endpoint(e)]}))}))},e.prototype.getEndpointInfo=function(e,t){var n=this._options.endpoints;if(!Array.isArray(n))throw new Error("API category not configured");var r=n.find((function(t){return t.name===e}));if(!r)throw new Error("API "+e+" does not exist");var i={endpoint:r.endpoint+t};return"string"==typeof r.region?i.region=r.region:"string"==typeof this._options.region&&(i.region=this._options.region),"string"==typeof r.service?i.service=r.service||"execute-api":i.service="execute-api","function"==typeof r.custom_header?i.custom_header=r.custom_header:i.custom_header=void 0,i},e}(),D=new R(null);function U(e){return(U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}k.a.register(D);"function"==typeof Symbol&&null!=Symbol.iterator&&Symbol.iterator,"function"==typeof Symbol&&null!=Symbol.asyncIterator&&Symbol.asyncIterator;var F="function"==typeof Symbol&&null!=Symbol.toStringTag?Symbol.toStringTag:"@@toStringTag";function L(e,t){for(var n,r=/\r\n|[\n\r]/g,i=1,o=t+1;(n=r.exec(e.body))&&n.index<t;)i+=1,o=t+1-(n.index+n[0].length);return{line:i,column:o}}function B(e){return q(e.source,L(e.source,e.start))}function q(e,t){var n=e.locationOffset.column-1,r=V(n)+e.body,i=t.line-1,o=e.locationOffset.line-1,s=t.line+o,a=1===t.line?n:0,u=t.column+a,c="".concat(e.name,":").concat(s,":").concat(u,"\n"),l=r.split(/\r\n|[\n\r]/g),f=l[i];if(f.length>120){for(var d=Math.floor(u/80),h=u%80,p=[],v=0;v<f.length;v+=80)p.push(f.slice(v,v+80));return c+z([["".concat(s),p[0]]].concat(p.slice(1,d+1).map((function(e){return["",e]})),[[" ",V(h-1)+"^"],["",p[d+1]]]))}return c+z([["".concat(s-1),l[i-1]],["".concat(s),f],["",V(u-1)+"^"],["".concat(s+1),l[i+1]]])}function z(e){var t=e.filter((function(e){e[0];return void 0!==e[1]})),n=Math.max.apply(Math,t.map((function(e){return e[0].length})));return t.map((function(e){var t,r=e[0],i=e[1];return V(n-(t=r).length)+t+(i?" | "+i:" |")})).join("\n")}function V(e){return Array(e+1).join(" ")}function K(e){return(K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function G(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function H(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function W(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Y(e,t){return!t||"object"!==K(t)&&"function"!=typeof t?J(e):t}function J(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $(e){var t="function"==typeof Map?new Map:void 0;return($=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return Q(e,arguments,ee(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),X(r,e)})(e)}function Q(e,t,n){return(Q=Z()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&X(i,n.prototype),i}).apply(null,arguments)}function Z(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function X(e,t){return(X=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ee(e){return(ee=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var te=function(e){!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&&X(e,t)}(a,e);var t,n,r,i,o,s=(t=a,n=Z(),function(){var e,r=ee(t);if(n){var i=ee(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return Y(this,e)});function a(e,t,n,r,i,o,u){var c,l,f,d;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),(d=s.call(this,e)).name="GraphQLError",d.originalError=null!=o?o:void 0,d.nodes=ne(Array.isArray(t)?t:t?[t]:void 0);for(var h=[],p=0,v=null!==(g=d.nodes)&&void 0!==g?g:[];p<v.length;p++){var g,y=v[p].loc;null!=y&&h.push(y)}h=ne(h),d.source=null!=n?n:null===(c=h)||void 0===c?void 0:c[0].source,d.positions=null!=r?r:null===(l=h)||void 0===l?void 0:l.map((function(e){return e.start})),d.locations=r&&n?r.map((function(e){return L(n,e)})):null===(f=h)||void 0===f?void 0:f.map((function(e){return L(e.source,e.start)})),d.path=null!=i?i:void 0;var m,b=null==o?void 0:o.extensions;return null==u&&("object"==U(m=b)&&null!==m)?d.extensions=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?G(Object(n),!0).forEach((function(t){H(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):G(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},b):d.extensions=null!=u?u:{},Object.defineProperties(J(d),{message:{enumerable:!0},locations:{enumerable:null!=d.locations},path:{enumerable:null!=d.path},extensions:{enumerable:null!=d.extensions&&Object.keys(d.extensions).length>0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=o&&o.stack?(Object.defineProperty(J(d),"stack",{value:o.stack,writable:!0,configurable:!0}),Y(d)):(Error.captureStackTrace?Error.captureStackTrace(J(d),a):Object.defineProperty(J(d),"stack",{value:Error().stack,writable:!0,configurable:!0}),d)}return r=a,(i=[{key:"toString",value:function(){return function(e){var t=e.message;if(e.nodes)for(var n=0,r=e.nodes;n<r.length;n++){var i=r[n];i.loc&&(t+="\n\n"+B(i.loc))}else if(e.source&&e.locations)for(var o=0,s=e.locations;o<s.length;o++){var a=s[o];t+="\n\n"+q(e.source,a)}return t}(this)}},{key:F,get:function(){return"Object"}}])&&W(r.prototype,i),o&&W(r,o),a}($(Error));function ne(e){return void 0===e||0===e.length?void 0:e}function re(e,t,n){return new te("Syntax Error: ".concat(n),void 0,e,[t])}var ie=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});var oe="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):void 0;function se(e){var t=e.prototype.toJSON;"function"==typeof t||function(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}(0),e.prototype.inspect=t,oe&&(e.prototype[oe]=t)}var ae=function(){function e(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}return e.prototype.toJSON=function(){return{start:this.start,end:this.end}},e}();se(ae);var ue=function(){function e(e,t,n,r,i,o,s){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=i,this.value=s,this.prev=o,this.next=null}return e.prototype.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},e}();function ce(e){return null!=e&&"string"==typeof e.kind}se(ue);var le=Object.freeze({SOF:"<SOF>",EOF:"<EOF>",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"});function fe(e){return(fe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function de(e){return he(e,[])}function he(e,t){switch(fe(e)){case"string":return JSON.stringify(e);case"function":return e.name?"[function ".concat(e.name,"]"):"[function]";case"object":return null===e?"null":function(e,t){if(-1!==t.indexOf(e))return"[Circular]";var n=[].concat(t,[e]),r=function(e){var t=e[String(oe)];if("function"==typeof t)return t;if("function"==typeof e.inspect)return e.inspect}(e);if(void 0!==r){var i=r.call(e);if(i!==e)return"string"==typeof i?i:he(i,n)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>2)return"[Array]";for(var n=Math.min(10,e.length),r=e.length-n,i=[],o=0;o<n;++o)i.push(he(e[o],t));1===r?i.push("... 1 more item"):r>1&&i.push("... ".concat(r," more items"));return"["+i.join(", ")+"]"}(e,n);return function(e,t){var n=Object.keys(e);if(0===n.length)return"{}";if(t.length>2)return"["+function(e){var t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){var n=e.constructor.name;if("string"==typeof n&&""!==n)return n}return t}(e)+"]";return"{ "+n.map((function(n){return n+": "+he(e[n],t)})).join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}function pe(e,t){if(!Boolean(e))throw new Error(t)}var ve=function(e,t){return e instanceof t};function ge(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var ye=function(){function e(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GraphQL request",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{line:1,column:1};"string"==typeof e||pe(0,"Body must be a string. Received: ".concat(de(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||pe(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||pe(0,"column in locationOffset is 1-indexed and must be positive.")}var t,n,r;return t=e,(n=[{key:F,get:function(){return"Source"}}])&&ge(t.prototype,n),r&&ge(t,r),e}();var me=Object.freeze({QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION"});function be(e){var t=e.split(/\r\n|[\n\r]/g),n=function(e){for(var t,n=!0,r=!0,i=0,o=null,s=0;s<e.length;++s)switch(e.charCodeAt(s)){case 13:10===e.charCodeAt(s+1)&&++s;case 10:n=!1,r=!0,i=0;break;case 9:case 32:++i;break;default:r&&!n&&(null===o||i<o)&&(o=i),r=!1}return null!==(t=o)&&void 0!==t?t:0}(e);if(0!==n)for(var r=1;r<t.length;r++)t[r]=t[r].slice(n);for(var i=0;i<t.length&&_e(t[i]);)++i;for(var o=t.length;o>i&&_e(t[o-1]);)--o;return t.slice(i,o).join("\n")}function _e(e){for(var t=0;t<e.length;++t)if(" "!==e[t]&&"\t"!==e[t])return!1;return!0}var we=function(){function e(e){var t=new ue(le.SOF,0,0,0,0,null);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}var t=e.prototype;return t.advance=function(){return this.lastToken=this.token,this.token=this.lookahead()},t.lookahead=function(){var e=this.token;if(e.kind!==le.EOF)do{var t;e=null!==(t=e.next)&&void 0!==t?t:e.next=Oe(this,e)}while(e.kind===le.COMMENT);return e},e}();function Se(e){return isNaN(e)?le.EOF:e<127?JSON.stringify(String.fromCharCode(e)):'"\\u'.concat(("00"+e.toString(16).toUpperCase()).slice(-4),'"')}function Oe(e,t){for(var n=e.source,r=n.body,i=r.length,o=t.end;o<i;){var s=r.charCodeAt(o),a=e.line,u=1+o-e.lineStart;switch(s){case 65279:case 9:case 32:case 44:++o;continue;case 10:++o,++e.line,e.lineStart=o;continue;case 13:10===r.charCodeAt(o+1)?o+=2:++o,++e.line,e.lineStart=o;continue;case 33:return new ue(le.BANG,o,o+1,a,u,t);case 35:return Ae(n,o,a,u,t);case 36:return new ue(le.DOLLAR,o,o+1,a,u,t);case 38:return new ue(le.AMP,o,o+1,a,u,t);case 40:return new ue(le.PAREN_L,o,o+1,a,u,t);case 41:return new ue(le.PAREN_R,o,o+1,a,u,t);case 46:if(46===r.charCodeAt(o+1)&&46===r.charCodeAt(o+2))return new ue(le.SPREAD,o,o+3,a,u,t);break;case 58:return new ue(le.COLON,o,o+1,a,u,t);case 61:return new ue(le.EQUALS,o,o+1,a,u,t);case 64:return new ue(le.AT,o,o+1,a,u,t);case 91:return new ue(le.BRACKET_L,o,o+1,a,u,t);case 93:return new ue(le.BRACKET_R,o,o+1,a,u,t);case 123:return new ue(le.BRACE_L,o,o+1,a,u,t);case 124:return new ue(le.PIPE,o,o+1,a,u,t);case 125:return new ue(le.BRACE_R,o,o+1,a,u,t);case 34:return 34===r.charCodeAt(o+1)&&34===r.charCodeAt(o+2)?je(n,o,a,u,t,e):Ce(n,o,a,u,t);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return Ie(n,o,s,a,u,t);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:return xe(n,o,a,u,t)}throw re(n,o,Ee(s))}var c=e.line,l=1+o-e.lineStart;return new ue(le.EOF,i,i,c,l,t)}function Ee(e){return e<32&&9!==e&&10!==e&&13!==e?"Cannot contain the invalid character ".concat(Se(e),"."):39===e?"Unexpected single quote character ('), did you mean to use a double quote (\")?":"Cannot parse the unexpected character ".concat(Se(e),".")}function Ae(e,t,n,r,i){var o,s=e.body,a=t;do{o=s.charCodeAt(++a)}while(!isNaN(o)&&(o>31||9===o));return new ue(le.COMMENT,t,a,n,r,i,s.slice(t+1,a))}function Ie(e,t,n,r,i,o){var s=e.body,a=n,u=t,c=!1;if(45===a&&(a=s.charCodeAt(++u)),48===a){if((a=s.charCodeAt(++u))>=48&&a<=57)throw re(e,u,"Invalid number, unexpected digit after 0: ".concat(Se(a),"."))}else u=Te(e,u,a),a=s.charCodeAt(u);if(46===a&&(c=!0,a=s.charCodeAt(++u),u=Te(e,u,a),a=s.charCodeAt(u)),69!==a&&101!==a||(c=!0,43!==(a=s.charCodeAt(++u))&&45!==a||(a=s.charCodeAt(++u)),u=Te(e,u,a),a=s.charCodeAt(u)),46===a||function(e){return 95===e||e>=65&&e<=90||e>=97&&e<=122}(a))throw re(e,u,"Invalid number, expected digit but got: ".concat(Se(a),"."));return new ue(c?le.FLOAT:le.INT,t,u,r,i,o,s.slice(t,u))}function Te(e,t,n){var r=e.body,i=t,o=n;if(o>=48&&o<=57){do{o=r.charCodeAt(++i)}while(o>=48&&o<=57);return i}throw re(e,i,"Invalid number, expected digit but got: ".concat(Se(o),"."))}function Ce(e,t,n,r,i){for(var o,s,a,u,c=e.body,l=t+1,f=l,d=0,h="";l<c.length&&!isNaN(d=c.charCodeAt(l))&&10!==d&&13!==d;){if(34===d)return h+=c.slice(f,l),new ue(le.STRING,t,l+1,n,r,i,h);if(d<32&&9!==d)throw re(e,l,"Invalid character within String: ".concat(Se(d),"."));if(++l,92===d){switch(h+=c.slice(f,l-1),d=c.charCodeAt(l)){case 34:h+='"';break;case 47:h+="/";break;case 92:h+="\\";break;case 98:h+="\b";break;case 102:h+="\f";break;case 110:h+="\n";break;case 114:h+="\r";break;case 116:h+="\t";break;case 117:var p=(o=c.charCodeAt(l+1),s=c.charCodeAt(l+2),a=c.charCodeAt(l+3),u=c.charCodeAt(l+4),Pe(o)<<12|Pe(s)<<8|Pe(a)<<4|Pe(u));if(p<0){var v=c.slice(l+1,l+5);throw re(e,l,"Invalid character escape sequence: \\u".concat(v,"."))}h+=String.fromCharCode(p),l+=4;break;default:throw re(e,l,"Invalid character escape sequence: \\".concat(String.fromCharCode(d),"."))}f=++l}}throw re(e,l,"Unterminated string.")}function je(e,t,n,r,i,o){for(var s=e.body,a=t+3,u=a,c=0,l="";a<s.length&&!isNaN(c=s.charCodeAt(a));){if(34===c&&34===s.charCodeAt(a+1)&&34===s.charCodeAt(a+2))return l+=s.slice(u,a),new ue(le.BLOCK_STRING,t,a+3,n,r,i,be(l));if(c<32&&9!==c&&10!==c&&13!==c)throw re(e,a,"Invalid character within String: ".concat(Se(c),"."));10===c?(++a,++o.line,o.lineStart=a):13===c?(10===s.charCodeAt(a+1)?a+=2:++a,++o.line,o.lineStart=a):92===c&&34===s.charCodeAt(a+1)&&34===s.charCodeAt(a+2)&&34===s.charCodeAt(a+3)?(l+=s.slice(u,a)+'"""',u=a+=4):++a}throw re(e,a,"Unterminated string.")}function Pe(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function xe(e,t,n,r,i){for(var o=e.body,s=o.length,a=t+1,u=0;a!==s&&!isNaN(u=o.charCodeAt(a))&&(95===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122);)++a;return new ue(le.NAME,t,a,n,r,i,o.slice(t,a))}function Ne(e,t){return new ke(e,t).parseDocument()}var ke=function(){function e(e,t){var n=function(e){return ve(e,ye)}(e)?e:new ye(e);this._lexer=new we(n),this._options=t}var t=e.prototype;return t.parseName=function(){var e=this.expectToken(le.NAME);return{kind:ie.NAME,value:e.value,loc:this.loc(e)}},t.parseDocument=function(){var e=this._lexer.token;return{kind:ie.DOCUMENT,definitions:this.many(le.SOF,this.parseDefinition,le.EOF),loc:this.loc(e)}},t.parseDefinition=function(){if(this.peek(le.NAME))switch(this._lexer.token.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return this.parseTypeSystemDefinition();case"extend":return this.parseTypeSystemExtension()}else{if(this.peek(le.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},t.parseOperationDefinition=function(){var e=this._lexer.token;if(this.peek(le.BRACE_L))return{kind:ie.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(e)};var t,n=this.parseOperationType();return this.peek(le.NAME)&&(t=this.parseName()),{kind:ie.OPERATION_DEFINITION,operation:n,name:t,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}},t.parseOperationType=function(){var e=this.expectToken(le.NAME);switch(e.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(e)},t.parseVariableDefinitions=function(){return this.optionalMany(le.PAREN_L,this.parseVariableDefinition,le.PAREN_R)},t.parseVariableDefinition=function(){var e=this._lexer.token;return{kind:ie.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(le.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(le.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(e)}},t.parseVariable=function(){var e=this._lexer.token;return this.expectToken(le.DOLLAR),{kind:ie.VARIABLE,name:this.parseName(),loc:this.loc(e)}},t.parseSelectionSet=function(){var e=this._lexer.token;return{kind:ie.SELECTION_SET,selections:this.many(le.BRACE_L,this.parseSelection,le.BRACE_R),loc:this.loc(e)}},t.parseSelection=function(){return this.peek(le.SPREAD)?this.parseFragment():this.parseField()},t.parseField=function(){var e,t,n=this._lexer.token,r=this.parseName();return this.expectOptionalToken(le.COLON)?(e=r,t=this.parseName()):t=r,{kind:ie.FIELD,alias:e,name:t,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(le.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},t.parseArguments=function(e){var t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(le.PAREN_L,t,le.PAREN_R)},t.parseArgument=function(){var e=this._lexer.token,t=this.parseName();return this.expectToken(le.COLON),{kind:ie.ARGUMENT,name:t,value:this.parseValueLiteral(!1),loc:this.loc(e)}},t.parseConstArgument=function(){var e=this._lexer.token;return{kind:ie.ARGUMENT,name:this.parseName(),value:(this.expectToken(le.COLON),this.parseValueLiteral(!0)),loc:this.loc(e)}},t.parseFragment=function(){var e=this._lexer.token;this.expectToken(le.SPREAD);var t=this.expectOptionalKeyword("on");return!t&&this.peek(le.NAME)?{kind:ie.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(e)}:{kind:ie.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}},t.parseFragmentDefinition=function(){var e,t=this._lexer.token;return this.expectKeyword("fragment"),!0===(null===(e=this._options)||void 0===e?void 0:e.experimentalFragmentVariables)?{kind:ie.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(t)}:{kind:ie.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(t)}},t.parseFragmentName=function(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()},t.parseValueLiteral=function(e){var t=this._lexer.token;switch(t.kind){case le.BRACKET_L:return this.parseList(e);case le.BRACE_L:return this.parseObject(e);case le.INT:return this._lexer.advance(),{kind:ie.INT,value:t.value,loc:this.loc(t)};case le.FLOAT:return this._lexer.advance(),{kind:ie.FLOAT,value:t.value,loc:this.loc(t)};case le.STRING:case le.BLOCK_STRING:return this.parseStringLiteral();case le.NAME:switch(this._lexer.advance(),t.value){case"true":return{kind:ie.BOOLEAN,value:!0,loc:this.loc(t)};case"false":return{kind:ie.BOOLEAN,value:!1,loc:this.loc(t)};case"null":return{kind:ie.NULL,loc:this.loc(t)};default:return{kind:ie.ENUM,value:t.value,loc:this.loc(t)}}case le.DOLLAR:if(!e)return this.parseVariable()}throw this.unexpected()},t.parseStringLiteral=function(){var e=this._lexer.token;return this._lexer.advance(),{kind:ie.STRING,value:e.value,block:e.kind===le.BLOCK_STRING,loc:this.loc(e)}},t.parseList=function(e){var t=this,n=this._lexer.token;return{kind:ie.LIST,values:this.any(le.BRACKET_L,(function(){return t.parseValueLiteral(e)}),le.BRACKET_R),loc:this.loc(n)}},t.parseObject=function(e){var t=this,n=this._lexer.token;return{kind:ie.OBJECT,fields:this.any(le.BRACE_L,(function(){return t.parseObjectField(e)}),le.BRACE_R),loc:this.loc(n)}},t.parseObjectField=function(e){var t=this._lexer.token,n=this.parseName();return this.expectToken(le.COLON),{kind:ie.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e),loc:this.loc(t)}},t.parseDirectives=function(e){for(var t=[];this.peek(le.AT);)t.push(this.parseDirective(e));return t},t.parseDirective=function(e){var t=this._lexer.token;return this.expectToken(le.AT),{kind:ie.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e),loc:this.loc(t)}},t.parseTypeReference=function(){var e,t=this._lexer.token;return this.expectOptionalToken(le.BRACKET_L)?(e=this.parseTypeReference(),this.expectToken(le.BRACKET_R),e={kind:ie.LIST_TYPE,type:e,loc:this.loc(t)}):e=this.parseNamedType(),this.expectOptionalToken(le.BANG)?{kind:ie.NON_NULL_TYPE,type:e,loc:this.loc(t)}:e},t.parseNamedType=function(){var e=this._lexer.token;return{kind:ie.NAMED_TYPE,name:this.parseName(),loc:this.loc(e)}},t.parseTypeSystemDefinition=function(){var e=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(e.kind===le.NAME)switch(e.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(e)},t.peekDescription=function(){return this.peek(le.STRING)||this.peek(le.BLOCK_STRING)},t.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},t.parseSchemaDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");var n=this.parseDirectives(!0),r=this.many(le.BRACE_L,this.parseOperationTypeDefinition,le.BRACE_R);return{kind:ie.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:r,loc:this.loc(e)}},t.parseOperationTypeDefinition=function(){var e=this._lexer.token,t=this.parseOperationType();this.expectToken(le.COLON);var n=this.parseNamedType();return{kind:ie.OPERATION_TYPE_DEFINITION,operation:t,type:n,loc:this.loc(e)}},t.parseScalarTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");var n=this.parseName(),r=this.parseDirectives(!0);return{kind:ie.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:r,loc:this.loc(e)}},t.parseObjectTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");var n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseDirectives(!0),o=this.parseFieldsDefinition();return{kind:ie.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:o,loc:this.loc(e)}},t.parseImplementsInterfaces=function(){var e;if(!this.expectOptionalKeyword("implements"))return[];if(!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacySDLImplementsInterfaces)){var t=[];this.expectOptionalToken(le.AMP);do{t.push(this.parseNamedType())}while(this.expectOptionalToken(le.AMP)||this.peek(le.NAME));return t}return this.delimitedMany(le.AMP,this.parseNamedType)},t.parseFieldsDefinition=function(){var e;return!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacySDLEmptyFields)&&this.peek(le.BRACE_L)&&this._lexer.lookahead().kind===le.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(le.BRACE_L,this.parseFieldDefinition,le.BRACE_R)},t.parseFieldDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(le.COLON);var i=this.parseTypeReference(),o=this.parseDirectives(!0);return{kind:ie.FIELD_DEFINITION,description:t,name:n,arguments:r,type:i,directives:o,loc:this.loc(e)}},t.parseArgumentDefs=function(){return this.optionalMany(le.PAREN_L,this.parseInputValueDef,le.PAREN_R)},t.parseInputValueDef=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(le.COLON);var r,i=this.parseTypeReference();this.expectOptionalToken(le.EQUALS)&&(r=this.parseValueLiteral(!0));var o=this.parseDirectives(!0);return{kind:ie.INPUT_VALUE_DEFINITION,description:t,name:n,type:i,defaultValue:r,directives:o,loc:this.loc(e)}},t.parseInterfaceTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");var n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseDirectives(!0),o=this.parseFieldsDefinition();return{kind:ie.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:o,loc:this.loc(e)}},t.parseUnionTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");var n=this.parseName(),r=this.parseDirectives(!0),i=this.parseUnionMemberTypes();return{kind:ie.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:i,loc:this.loc(e)}},t.parseUnionMemberTypes=function(){return this.expectOptionalToken(le.EQUALS)?this.delimitedMany(le.PIPE,this.parseNamedType):[]},t.parseEnumTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");var n=this.parseName(),r=this.parseDirectives(!0),i=this.parseEnumValuesDefinition();return{kind:ie.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:i,loc:this.loc(e)}},t.parseEnumValuesDefinition=function(){return this.optionalMany(le.BRACE_L,this.parseEnumValueDefinition,le.BRACE_R)},t.parseEnumValueDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseDirectives(!0);return{kind:ie.ENUM_VALUE_DEFINITION,description:t,name:n,directives:r,loc:this.loc(e)}},t.parseInputObjectTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");var n=this.parseName(),r=this.parseDirectives(!0),i=this.parseInputFieldsDefinition();return{kind:ie.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:i,loc:this.loc(e)}},t.parseInputFieldsDefinition=function(){return this.optionalMany(le.BRACE_L,this.parseInputValueDef,le.BRACE_R)},t.parseTypeSystemExtension=function(){var e=this._lexer.lookahead();if(e.kind===le.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)},t.parseSchemaExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var t=this.parseDirectives(!0),n=this.optionalMany(le.BRACE_L,this.parseOperationTypeDefinition,le.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return{kind:ie.SCHEMA_EXTENSION,directives:t,operationTypes:n,loc:this.loc(e)}},t.parseScalarTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var t=this.parseName(),n=this.parseDirectives(!0);if(0===n.length)throw this.unexpected();return{kind:ie.SCALAR_TYPE_EXTENSION,name:t,directives:n,loc:this.loc(e)}},t.parseObjectTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseDirectives(!0),i=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===i.length)throw this.unexpected();return{kind:ie.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i,loc:this.loc(e)}},t.parseInterfaceTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseDirectives(!0),i=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===i.length)throw this.unexpected();return{kind:ie.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i,loc:this.loc(e)}},t.parseUnionTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseUnionMemberTypes();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:ie.UNION_TYPE_EXTENSION,name:t,directives:n,types:r,loc:this.loc(e)}},t.parseEnumTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseEnumValuesDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:ie.ENUM_TYPE_EXTENSION,name:t,directives:n,values:r,loc:this.loc(e)}},t.parseInputObjectTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseInputFieldsDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:ie.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:r,loc:this.loc(e)}},t.parseDirectiveDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(le.AT);var n=this.parseName(),r=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var o=this.parseDirectiveLocations();return{kind:ie.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:i,locations:o,loc:this.loc(e)}},t.parseDirectiveLocations=function(){return this.delimitedMany(le.PIPE,this.parseDirectiveLocation)},t.parseDirectiveLocation=function(){var e=this._lexer.token,t=this.parseName();if(void 0!==me[t.value])return t;throw this.unexpected(e)},t.loc=function(e){var t;if(!0!==(null===(t=this._options)||void 0===t?void 0:t.noLocation))return new ae(e,this._lexer.lastToken,this._lexer.source)},t.peek=function(e){return this._lexer.token.kind===e},t.expectToken=function(e){var t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t;throw re(this._lexer.source,t.start,"Expected ".concat(Re(e),", found ").concat(Me(t),"."))},t.expectOptionalToken=function(e){var t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t},t.expectKeyword=function(e){var t=this._lexer.token;if(t.kind!==le.NAME||t.value!==e)throw re(this._lexer.source,t.start,'Expected "'.concat(e,'", found ').concat(Me(t),"."));this._lexer.advance()},t.expectOptionalKeyword=function(e){var t=this._lexer.token;return t.kind===le.NAME&&t.value===e&&(this._lexer.advance(),!0)},t.unexpected=function(e){var t=null!=e?e:this._lexer.token;return re(this._lexer.source,t.start,"Unexpected ".concat(Me(t),"."))},t.any=function(e,t,n){this.expectToken(e);for(var r=[];!this.expectOptionalToken(n);)r.push(t.call(this));return r},t.optionalMany=function(e,t,n){if(this.expectOptionalToken(e)){var r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r}return[]},t.many=function(e,t,n){this.expectToken(e);var r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r},t.delimitedMany=function(e,t){this.expectOptionalToken(e);var n=[];do{n.push(t.call(this))}while(this.expectOptionalToken(e));return n},e}();function Me(e){var t=e.value;return Re(e.kind)+(null!=t?' "'.concat(t,'"'):"")}function Re(e){return function(e){return e===le.BANG||e===le.DOLLAR||e===le.AMP||e===le.PAREN_L||e===le.PAREN_R||e===le.SPREAD||e===le.COLON||e===le.EQUALS||e===le.AT||e===le.BRACKET_L||e===le.BRACKET_R||e===le.BRACE_L||e===le.PIPE||e===le.BRACE_R}(e)?'"'.concat(e,'"'):e}var De={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},Ue=Object.freeze({});function Fe(e,t,n){var r=e[t];if(r){if(!n&&"function"==typeof r)return r;var i=n?r.leave:r.enter;if("function"==typeof i)return i}else{var o=n?e.leave:e.enter;if(o){if("function"==typeof o)return o;var s=o[t];if("function"==typeof s)return s}}}function Le(e){return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:De,r=void 0,i=Array.isArray(e),o=[e],s=-1,a=[],u=void 0,c=void 0,l=void 0,f=[],d=[],h=e;do{var p=++s===o.length,v=p&&0!==a.length;if(p){if(c=0===d.length?void 0:f[f.length-1],u=l,l=d.pop(),v){if(i)u=u.slice();else{for(var g={},y=0,m=Object.keys(u);y<m.length;y++){var b=m[y];g[b]=u[b]}u=g}for(var _=0,w=0;w<a.length;w++){var S=a[w][0],O=a[w][1];i&&(S-=_),i&&null===O?(u.splice(S,1),_++):u[S]=O}}s=r.index,o=r.keys,a=r.edits,i=r.inArray,r=r.prev}else{if(c=l?i?s:o[s]:void 0,null==(u=l?l[c]:h))continue;l&&f.push(c)}var E,A=void 0;if(!Array.isArray(u)){if(!ce(u))throw new Error("Invalid AST Node: ".concat(de(u),"."));var I=Fe(t,u.kind,p);if(I){if((A=I.call(t,u,c,l,f,d))===Ue)break;if(!1===A){if(!p){f.pop();continue}}else if(void 0!==A&&(a.push([c,A]),!p)){if(!ce(A)){f.pop();continue}u=A}}}if(void 0===A&&v&&a.push([c,u]),p)f.pop();else r={inArray:i,index:s,keys:o,edits:a,prev:r},o=(i=Array.isArray(u))?u:null!==(E=n[u.kind])&&void 0!==E?E:[],s=-1,a=[],l&&d.push(l),l=u}while(void 0!==r);return 0!==a.length&&(h=a[a.length-1][1]),h}(e,{leave:Be})}var Be={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return ze(e.definitions,"\n\n")+"\n"},OperationDefinition:function(e){var t=e.operation,n=e.name,r=Ke("(",ze(e.variableDefinitions,", "),")"),i=ze(e.directives," "),o=e.selectionSet;return n||i||r||"query"!==t?ze([t,ze([n,r]),i,o]," "):o},VariableDefinition:function(e){var t=e.variable,n=e.type,r=e.defaultValue,i=e.directives;return t+": "+n+Ke(" = ",r)+Ke(" ",ze(i," "))},SelectionSet:function(e){return Ve(e.selections)},Field:function(e){var t=e.alias,n=e.name,r=e.arguments,i=e.directives,o=e.selectionSet,s=Ke("",t,": ")+n,a=s+Ke("(",ze(r,", "),")");return a.length>80&&(a=s+Ke("(\n",Ge(ze(r,"\n")),"\n)")),ze([a,ze(i," "),o]," ")},Argument:function(e){return e.name+": "+e.value},FragmentSpread:function(e){return"..."+e.name+Ke(" ",ze(e.directives," "))},InlineFragment:function(e){var t=e.typeCondition,n=e.directives,r=e.selectionSet;return ze(["...",Ke("on ",t),ze(n," "),r]," ")},FragmentDefinition:function(e){var t=e.name,n=e.typeCondition,r=e.variableDefinitions,i=e.directives,o=e.selectionSet;return"fragment ".concat(t).concat(Ke("(",ze(r,", "),")")," ")+"on ".concat(n," ").concat(Ke("",ze(i," ")," "))+o},IntValue:function(e){return e.value},FloatValue:function(e){return e.value},StringValue:function(e,t){var n=e.value;return e.block?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=-1===e.indexOf("\n"),i=" "===e[0]||"\t"===e[0],o='"'===e[e.length-1],s="\\"===e[e.length-1],a=!r||o||s||n,u="";return!a||r&&i||(u+="\n"+t),u+=t?e.replace(/\n/g,"\n"+t):e,a&&(u+="\n"),'"""'+u.replace(/"""/g,'\\"""')+'"""'}(n,"description"===t?"":" "):JSON.stringify(n)},BooleanValue:function(e){return e.value?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){return e.value},ListValue:function(e){return"["+ze(e.values,", ")+"]"},ObjectValue:function(e){return"{"+ze(e.fields,", ")+"}"},ObjectField:function(e){return e.name+": "+e.value},Directive:function(e){return"@"+e.name+Ke("(",ze(e.arguments,", "),")")},NamedType:function(e){return e.name},ListType:function(e){return"["+e.type+"]"},NonNullType:function(e){return e.type+"!"},SchemaDefinition:qe((function(e){var t=e.directives,n=e.operationTypes;return ze(["schema",ze(t," "),Ve(n)]," ")})),OperationTypeDefinition:function(e){return e.operation+": "+e.type},ScalarTypeDefinition:qe((function(e){return ze(["scalar",e.name,ze(e.directives," ")]," ")})),ObjectTypeDefinition:qe((function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return ze(["type",t,Ke("implements ",ze(n," & ")),ze(r," "),Ve(i)]," ")})),FieldDefinition:qe((function(e){var t=e.name,n=e.arguments,r=e.type,i=e.directives;return t+(We(n)?Ke("(\n",Ge(ze(n,"\n")),"\n)"):Ke("(",ze(n,", "),")"))+": "+r+Ke(" ",ze(i," "))})),InputValueDefinition:qe((function(e){var t=e.name,n=e.type,r=e.defaultValue,i=e.directives;return ze([t+": "+n,Ke("= ",r),ze(i," ")]," ")})),InterfaceTypeDefinition:qe((function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return ze(["interface",t,Ke("implements ",ze(n," & ")),ze(r," "),Ve(i)]," ")})),UnionTypeDefinition:qe((function(e){var t=e.name,n=e.directives,r=e.types;return ze(["union",t,ze(n," "),r&&0!==r.length?"= "+ze(r," | "):""]," ")})),EnumTypeDefinition:qe((function(e){var t=e.name,n=e.directives,r=e.values;return ze(["enum",t,ze(n," "),Ve(r)]," ")})),EnumValueDefinition:qe((function(e){return ze([e.name,ze(e.directives," ")]," ")})),InputObjectTypeDefinition:qe((function(e){var t=e.name,n=e.directives,r=e.fields;return ze(["input",t,ze(n," "),Ve(r)]," ")})),DirectiveDefinition:qe((function(e){var t=e.name,n=e.arguments,r=e.repeatable,i=e.locations;return"directive @"+t+(We(n)?Ke("(\n",Ge(ze(n,"\n")),"\n)"):Ke("(",ze(n,", "),")"))+(r?" repeatable":"")+" on "+ze(i," | ")})),SchemaExtension:function(e){var t=e.directives,n=e.operationTypes;return ze(["extend schema",ze(t," "),Ve(n)]," ")},ScalarTypeExtension:function(e){return ze(["extend scalar",e.name,ze(e.directives," ")]," ")},ObjectTypeExtension:function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return ze(["extend type",t,Ke("implements ",ze(n," & ")),ze(r," "),Ve(i)]," ")},InterfaceTypeExtension:function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return ze(["extend interface",t,Ke("implements ",ze(n," & ")),ze(r," "),Ve(i)]," ")},UnionTypeExtension:function(e){var t=e.name,n=e.directives,r=e.types;return ze(["extend union",t,ze(n," "),r&&0!==r.length?"= "+ze(r," | "):""]," ")},EnumTypeExtension:function(e){var t=e.name,n=e.directives,r=e.values;return ze(["extend enum",t,ze(n," "),Ve(r)]," ")},InputObjectTypeExtension:function(e){var t=e.name,n=e.directives,r=e.fields;return ze(["extend input",t,ze(n," "),Ve(r)]," ")}};function qe(e){return function(t){return ze([t.description,e(t)],"\n")}}function ze(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return null!==(t=null==e?void 0:e.filter((function(e){return e})).join(n))&&void 0!==t?t:""}function Ve(e){return Ke("{\n",Ge(ze(e,"\n")),"\n}")}function Ke(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return null!=t&&""!==t?e+t+n:""}function Ge(e){return Ke(" ",e.replace(/\n/g,"\n "))}function He(e){return-1!==e.indexOf("\n")}function We(e){return null!=e&&e.some(He)}var Ye="undefined"!=typeof Symbol&&"function"==typeof Symbol.for,Je=(Ye&&Symbol.for("INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER"),Ye?Symbol.for("INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER"):"@@INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER"),$e=n(14),Qe=n.n($e),Ze=n(17),Xe=n(20),et=new s.a("GraphQLAPI"),tt=function(){function e(e){this._api=null,this.Auth=Ze.a,this.Cache=o.a,this.Credentials=a.a,this._options=e,et.debug("API Options",this._options)}return e.prototype.getModuleName=function(){return"GraphQLAPI"},e.prototype.configure=function(e){var t=e||{},n=t.API,i=void 0===n?{}:n,o=Object(r.__rest)(t,["API"]),s=Object(r.__assign)(Object(r.__assign)({},o),i);return et.debug("configure GraphQL API",{opt:s}),s.aws_project_region&&(s=Object.assign({},s,{region:s.aws_project_region,header:{}})),void 0!==s.graphql_headers&&"function"!=typeof s.graphql_headers&&(et.warn("graphql_headers should be a function"),s.graphql_headers=void 0),this._options=Object.assign({},this._options,s),this.createInstance(),this._options},e.prototype.createInstance=function(){return et.debug("create Rest instance"),this._options?(this._api=new N(this._options),this._api.Credentials=this.Credentials,!0):Promise.reject("API not configured")},e.prototype._headerBasedAuth=function(e,t){return void 0===t&&(t={}),Object(r.__awaiter)(this,void 0,void 0,(function(){var n,i,s,a,u,c,l,f;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:switch(n=this._options,i=n.aws_appsync_authenticationType,s=n.aws_appsync_apiKey,a={},e||i||"AWS_IAM"){case"API_KEY":return[3,1];case"AWS_IAM":return[3,2];case"OPENID_CONNECT":return[3,4];case"AMAZON_COGNITO_USER_POOLS":return[3,11];case"AWS_LAMBDA":return[3,15]}return[3,16];case 1:if(!s)throw new Error(Xe.a.NO_API_KEY);return a={Authorization:null,"X-Api-Key":s},[3,17];case 2:return[4,this._ensureCredentials()];case 3:if(!r.sent())throw new Error(Xe.a.NO_CREDENTIALS);return[3,17];case 4:return r.trys.push([4,9,,10]),u=void 0,[4,o.a.getItem("federatedInfo")];case 5:return(c=r.sent())?(u=c.token,[3,8]):[3,6];case 6:return[4,Ze.a.currentAuthenticatedUser()];case 7:(l=r.sent())&&(u=l.token),r.label=8;case 8:if(!u)throw new Error(Xe.a.NO_FEDERATED_JWT);return a={Authorization:u},[3,10];case 9:throw r.sent(),new Error(Xe.a.NO_CURRENT_USER);case 10:return[3,17];case 11:return r.trys.push([11,13,,14]),[4,this.Auth.currentSession()];case 12:return f=r.sent(),a={Authorization:f.getAccessToken().getJwtToken()},[3,14];case 13:throw r.sent(),new Error(Xe.a.NO_CURRENT_USER);case 14:return[3,17];case 15:if(!t.Authorization)throw new Error(Xe.a.NO_AUTH_TOKEN);return a={Authorization:t.Authorization},[3,17];case 16:return a={Authorization:null},[3,17];case 17:return[2,a]}}))}))},e.prototype.getGraphqlOperationType=function(e){var t=Ne(e).definitions;return Object(r.__read)(t,1)[0].operation},e.prototype.graphql=function(e,t){var n=e.query,i=e.variables,o=void 0===i?{}:i,s=e.authMode,a=e.authToken,u=e.userAgentSuffix,c=Ne("string"==typeof n?n:Le(n)),l=Object(r.__read)(c.definitions.filter((function(e){return"OperationDefinition"===e.kind})),1)[0],f=(void 0===l?{}:l).operation,d=t||{};switch(a&&(d.Authorization=a),f){case"query":case"mutation":var h=this._api.getCancellableToken(),p={cancellableToken:h},v=this._graphql({query:c,variables:o,authMode:s,userAgentSuffix:u},d,p);return this._api.updateRequestToBeCancellable(v,h),v;case"subscription":return this._graphqlSubscribe({query:c,variables:o,authMode:s},d);default:throw new Error("invalid operation type: "+f)}},e.prototype._graphql=function(e,t,n){var i=e.query,o=e.variables,s=e.authMode,a=e.userAgentSuffix;return void 0===t&&(t={}),void 0===n&&(n={}),Object(r.__awaiter)(this,void 0,void 0,(function(){var e,c,l,f,d,h,p,v,g,y,m,b,_,w,S,O,E,A,I,T,C;return Object(r.__generator)(this,(function(j){switch(j.label){case 0:return this._api?[3,2]:[4,this.createInstance()];case 1:j.sent(),j.label=2;case 2:return e=this._options,c=e.aws_appsync_region,l=e.aws_appsync_graphqlEndpoint,f=e.graphql_headers,d=void 0===f?function(){return{}}:f,h=e.graphql_endpoint,p=e.graphql_endpoint_iam_region,g=[{}],(y=!h)?[4,this._headerBasedAuth(s,t)]:[3,4];case 3:y=j.sent(),j.label=4;case 4:return m=[r.__assign.apply(void 0,g.concat([y]))],(b=h)?p?[4,this._headerBasedAuth(s,t)]:[3,6]:[3,8];case 5:return _=j.sent(),[3,7];case 6:_={Authorization:null},j.label=7;case 7:b=_,j.label=8;case 8:return w=[r.__assign.apply(void 0,m.concat([b]))],[4,d({query:i,variables:o})];case 9:if(v=r.__assign.apply(void 0,[r.__assign.apply(void 0,[r.__assign.apply(void 0,w.concat([j.sent()])),t]),!h&&(C={},C["x-amz-user-agent"]=Object(u.b)(a),C)]),S={query:Le(i),variables:o},O=Object.assign({headers:v,body:S,signerServiceInfo:{service:h?"execute-api":"appsync",region:h?p:c}},n),!(E=h||l))throw{data:{},errors:[new te("No graphql endpoint provided.")]};j.label=10;case 10:return j.trys.push([10,12,,13]),[4,this._api.post(E,O)];case 11:return A=j.sent(),[3,13];case 12:if(I=j.sent(),this._api.isCancel(I))throw I;return A={data:{},errors:[new te(I.message,null,null,null,null,I)]},[3,13];case 13:if((T=A.errors)&&T.length)throw A;return[2,A]}}))}))},e.prototype.isCancel=function(e){return this._api.isCancel(e)},e.prototype.cancel=function(e,t){return this._api.cancel(e,t)},e.prototype.hasCancelToken=function(e){return this._api.hasCancelToken(e)},e.prototype._graphqlSubscribe=function(e,t){var n=e.query,r=e.variables,i=e.authMode,o=e.authToken;void 0===t&&(t={});var s=this._options,a=s.aws_appsync_region,u=s.aws_appsync_graphqlEndpoint,c=s.aws_appsync_authenticationType,l=s.aws_appsync_apiKey,f=s.graphql_headers,d=void 0===f?function(){return{}}:f,h=i||c||"AWS_IAM";if(Qe.a&&"function"==typeof Qe.a.subscribe)return Qe.a.subscribe("",{provider:Je,appSyncGraphqlEndpoint:u,authenticationType:h,apiKey:l,query:Le(n),region:a,variables:r,graphql_headers:d,additionalHeaders:t,authToken:o});throw et.debug("No pubsub module applied for subscription"),new Error("No pubsub module applied for subscription")},e.prototype._ensureCredentials=function(){var e=this;return this.Credentials.get().then((function(t){if(!t)return!1;var n=e.Credentials.shear(t);return et.debug("set credentials for api",n),!0})).catch((function(e){return et.warn("ensure credentials error",e),!1}))},e}(),nt=new tt(null);k.a.register(nt);var rt=new s.a("API"),it=new(function(){function e(e){this.Auth=i.a,this.Cache=o.a,this.Credentials=a.a,this._options=e,this._restApi=new R(e),this._graphqlApi=new tt(e),rt.debug("API Options",this._options)}return e.prototype.getModuleName=function(){return"API"},e.prototype.configure=function(e){this._options=Object.assign({},this._options,e),this._restApi.Credentials=this.Credentials,this._graphqlApi.Auth=this.Auth,this._graphqlApi.Cache=this.Cache,this._graphqlApi.Credentials=this.Credentials;var t=this._restApi.configure(this._options),n=this._graphqlApi.configure(this._options);return Object(r.__assign)(Object(r.__assign)({},t),n)},e.prototype.get=function(e,t,n){return this._restApi.get(e,t,n)},e.prototype.post=function(e,t,n){return this._restApi.post(e,t,n)},e.prototype.put=function(e,t,n){return this._restApi.put(e,t,n)},e.prototype.patch=function(e,t,n){return this._restApi.patch(e,t,n)},e.prototype.del=function(e,t,n){return this._restApi.del(e,t,n)},e.prototype.head=function(e,t,n){return this._restApi.head(e,t,n)},e.prototype.isCancel=function(e){return this._restApi.isCancel(e)},e.prototype.cancel=function(e,t){return this._restApi.hasCancelToken(e)?this._restApi.cancel(e,t):!!this._graphqlApi.hasCancelToken(e)&&this._graphqlApi.cancel(e,t)},e.prototype.endpoint=function(e){return Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(t){return[2,this._restApi.endpoint(e)]}))}))},e.prototype.getGraphqlOperationType=function(e){return this._graphqlApi.getGraphqlOperationType(e)},e.prototype.graphql=function(e,t){return this._graphqlApi.graphql(e,t)},e}())(null);k.a.register(it);t.a=it},function(e,t,n){"use strict";var r=n(37),i=n(0),o={keyPrefix:"aws-amplify-cache",capacityInBytes:1048576,itemMaxSize:21e4,defaultTTL:2592e5,defaultPriority:5,warningThreshold:.8,storage:(new(n(60).a)).getStorage()};function s(e){var t=0;t=e.length;for(var n=e.length;n>=0;n-=1){var r=e.charCodeAt(n);r>127&&r<=2047?t+=1:r>2047&&r<=65535&&(t+=2),r>=56320&&r<=57343&&(n-=1)}return t}function a(){return(new Date).getTime()}function u(e){return Number.isInteger?Number.isInteger(e):function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}(e)}var c={},l=(function(){function e(){}e.clear=function(){c={}},e.getItem=function(e){return c[e]||null},e.setItem=function(e,t){c[e]=t},e.removeItem=function(e){delete c[e]}}(),n(21));function f(e){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var d=new l.a("StorageCache"),h=function(){function e(e){this.config=Object.assign({},e),this.cacheCurSizeKey=this.config.keyPrefix+"CurSize",this.checkConfig()}return e.prototype.getModuleName=function(){return"Cache"},e.prototype.checkConfig=function(){u(this.config.capacityInBytes)||(d.error("Invalid parameter: capacityInBytes. It should be an Integer. Setting back to default."),this.config.capacityInBytes=o.capacityInBytes),u(this.config.itemMaxSize)||(d.error("Invalid parameter: itemMaxSize. It should be an Integer. Setting back to default."),this.config.itemMaxSize=o.itemMaxSize),u(this.config.defaultTTL)||(d.error("Invalid parameter: defaultTTL. It should be an Integer. Setting back to default."),this.config.defaultTTL=o.defaultTTL),u(this.config.defaultPriority)||(d.error("Invalid parameter: defaultPriority. It should be an Integer. Setting back to default."),this.config.defaultPriority=o.defaultPriority),this.config.itemMaxSize>this.config.capacityInBytes&&(d.error("Invalid parameter: itemMaxSize. It should be smaller than capacityInBytes. Setting back to default."),this.config.itemMaxSize=o.itemMaxSize),(this.config.defaultPriority>5||this.config.defaultPriority<1)&&(d.error("Invalid parameter: defaultPriority. It should be between 1 and 5. Setting back to default."),this.config.defaultPriority=o.defaultPriority),(Number(this.config.warningThreshold)>1||Number(this.config.warningThreshold)<0)&&(d.error("Invalid parameter: warningThreshold. It should be between 0 and 1. Setting back to default."),this.config.warningThreshold=o.warningThreshold);this.config.capacityInBytes>5242880&&(d.error("Cache Capacity should be less than 5MB. Setting back to default. Setting back to default."),this.config.capacityInBytes=o.capacityInBytes)},e.prototype.fillCacheItem=function(e,t,n){var r={key:e,data:t,timestamp:a(),visitedTime:a(),priority:n.priority,expires:n.expires,type:f(t),byteSize:0};return r.byteSize=s(JSON.stringify(r)),r.byteSize=s(JSON.stringify(r)),r},e.prototype.configure=function(e){return e?(e.keyPrefix&&d.warn("Don't try to configure keyPrefix!"),this.config=Object.assign({},this.config,e,e.Cache),this.checkConfig(),this.config):this.config},e}(),p=new l.a("Cache"),v=new(function(e){function t(t){var n=this,r=t?Object.assign({},o,t):o;return(n=e.call(this,r)||this).config.storage=r.storage,n.getItem=n.getItem.bind(n),n.setItem=n.setItem.bind(n),n.removeItem=n.removeItem.bind(n),n}return Object(i.__extends)(t,e),t.prototype._decreaseCurSizeInBytes=function(e){var t=this.getCacheCurSize();this.config.storage.setItem(this.cacheCurSizeKey,(t-e).toString())},t.prototype._increaseCurSizeInBytes=function(e){var t=this.getCacheCurSize();this.config.storage.setItem(this.cacheCurSizeKey,(t+e).toString())},t.prototype._refreshItem=function(e,t){return e.visitedTime=a(),this.config.storage.setItem(t,JSON.stringify(e)),e},t.prototype._isExpired=function(e){var t=this.config.storage.getItem(e),n=JSON.parse(t);return a()>=n.expires},t.prototype._removeItem=function(e,t){var n=t||JSON.parse(this.config.storage.getItem(e)).byteSize;this._decreaseCurSizeInBytes(n),this.config.storage.removeItem(e)},t.prototype._setItem=function(e,t){this._increaseCurSizeInBytes(t.byteSize);try{this.config.storage.setItem(e,JSON.stringify(t))}catch(e){this._decreaseCurSizeInBytes(t.byteSize),p.error("Failed to set item "+e)}},t.prototype._sizeToPop=function(e){var t=this.getCacheCurSize()+e-this.config.capacityInBytes,n=(1-this.config.warningThreshold)*this.config.capacityInBytes;return t>n?t:n},t.prototype._isCacheFull=function(e){return e+this.getCacheCurSize()>this.config.capacityInBytes},t.prototype._findValidKeys=function(){for(var e=[],t=[],n=0;n<this.config.storage.length;n+=1)t.push(this.config.storage.key(n));for(n=0;n<t.length;n+=1){var r=t[n];0===r.indexOf(this.config.keyPrefix)&&r!==this.cacheCurSizeKey&&(this._isExpired(r)?this._removeItem(r):e.push(r))}return e},t.prototype._popOutItems=function(e,t){for(var n=[],r=t,i=0;i<e.length;i+=1){var o=this.config.storage.getItem(e[i]);if(null!=o){var s=JSON.parse(o);n.push(s)}}n.sort((function(e,t){return e.priority>t.priority?-1:e.priority<t.priority?1:e.visitedTime<t.visitedTime?-1:1}));for(i=0;i<n.length;i+=1)if(this._removeItem(n[i].key,n[i].byteSize),(r-=n[i].byteSize)<=0)return},t.prototype.setItem=function(e,t,n){p.log("Set item: key is "+e+", value is "+t+" with options: "+n);var r=this.config.keyPrefix+e;if(r!==this.config.keyPrefix&&r!==this.cacheCurSizeKey)if(void 0!==t){var i={priority:n&&void 0!==n.priority?n.priority:this.config.defaultPriority,expires:n&&void 0!==n.expires?n.expires:this.config.defaultTTL+a()};if(i.priority<1||i.priority>5)p.warn("Invalid parameter: priority due to out or range. It should be within 1 and 5.");else{var o=this.fillCacheItem(r,t,i);if(o.byteSize>this.config.itemMaxSize)p.warn("Item with key: "+e+" you are trying to put into is too big!");else try{var s=this.config.storage.getItem(r);if(s&&this._removeItem(r,JSON.parse(s).byteSize),this._isCacheFull(o.byteSize)){var u=this._findValidKeys();if(this._isCacheFull(o.byteSize)){var c=this._sizeToPop(o.byteSize);this._popOutItems(u,c)}}this._setItem(r,o)}catch(e){p.warn("setItem failed! "+e)}}}else p.warn("The value of item should not be undefined!");else p.warn("Invalid key: should not be empty or 'CurSize'")},t.prototype.getItem=function(e,t){p.log("Get item: key is "+e+" with options "+t);var n=null,r=this.config.keyPrefix+e;if(r===this.config.keyPrefix||r===this.cacheCurSizeKey)return p.warn("Invalid key: should not be empty or 'CurSize'"),null;try{if(null!=(n=this.config.storage.getItem(r))){if(!this._isExpired(r)){var i=JSON.parse(n);return(i=this._refreshItem(i,r)).data}this._removeItem(r,JSON.parse(n).byteSize),n=null}if(t&&void 0!==t.callback){var o=t.callback();return null!==o&&this.setItem(e,o,t),o}return null}catch(e){return p.warn("getItem failed! "+e),null}},t.prototype.removeItem=function(e){p.log("Remove item: key is "+e);var t=this.config.keyPrefix+e;if(t!==this.config.keyPrefix&&t!==this.cacheCurSizeKey)try{var n=this.config.storage.getItem(t);n&&this._removeItem(t,JSON.parse(n).byteSize)}catch(e){p.warn("removeItem failed! "+e)}},t.prototype.clear=function(){p.log("Clear Cache");for(var e=[],t=0;t<this.config.storage.length;t+=1){var n=this.config.storage.key(t);0===n.indexOf(this.config.keyPrefix)&&e.push(n)}try{for(t=0;t<e.length;t+=1)this.config.storage.removeItem(e[t])}catch(e){p.warn("clear failed! "+e)}},t.prototype.getAllKeys=function(){for(var e=[],t=0;t<this.config.storage.length;t+=1){var n=this.config.storage.key(t);0===n.indexOf(this.config.keyPrefix)&&n!==this.cacheCurSizeKey&&e.push(n.substring(this.config.keyPrefix.length))}return e},t.prototype.getCacheCurSize=function(){var e=this.config.storage.getItem(this.cacheCurSizeKey);return e||(this.config.storage.setItem(this.cacheCurSizeKey,"0"),e="0"),Number(e)},t.prototype.createInstance=function(e){return e.keyPrefix&&e.keyPrefix!==o.keyPrefix||(p.error("invalid keyPrefix, setting keyPrefix with timeStamp"),e.keyPrefix=a.toString()),new t(e)},t}(h));t.a=v;r.a.register(v)},function(e,t,n){"use strict";var r;n.d(t,"a",(function(){return r})),function(e){e.NO_API_KEY="No api-key configured",e.NO_CURRENT_USER="No current user",e.NO_CREDENTIALS="No credentials",e.NO_FEDERATED_JWT="No federated jwt",e.NO_AUTH_TOKEN="No auth token specified"}(r||(r={}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r,i=n(0),o={VERBOSE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5};!function(e){e.DEBUG="DEBUG",e.ERROR="ERROR",e.INFO="INFO",e.WARN="WARN",e.VERBOSE="VERBOSE"}(r||(r={}));var s=function(){function e(e,t){void 0===t&&(t=r.WARN),this.name=e,this.level=t,this._pluggables=[]}return e.prototype._padding=function(e){return e<10?"0"+e:""+e},e.prototype._ts=function(){var e=new Date;return[this._padding(e.getMinutes()),this._padding(e.getSeconds())].join(":")+"."+e.getMilliseconds()},e.prototype.configure=function(e){return e?(this._config=e,this._config):this._config},e.prototype._log=function(t){for(var n,s,a=[],u=1;u<arguments.length;u++)a[u-1]=arguments[u];var c=this.level;e.LOG_LEVEL&&(c=e.LOG_LEVEL),"undefined"!=typeof window&&window.LOG_LEVEL&&(c=window.LOG_LEVEL);var l=o[c],f=o[t];if(f>=l){var d=console.log.bind(console);t===r.ERROR&&console.error&&(d=console.error.bind(console)),t===r.WARN&&console.warn&&(d=console.warn.bind(console));var h="["+t+"] "+this._ts()+" "+this.name,p="";if(1===a.length&&"string"==typeof a[0])d(p=h+" - "+a[0]);else if(1===a.length)p=h+" "+a[0],d(h,a[0]);else if("string"==typeof a[0]){var v=a.slice(1);1===v.length&&(v=v[0]),p=h+" - "+a[0]+" "+v,d(h+" - "+a[0],v)}else p=h+" "+a,d(h,a);try{for(var g=Object(i.__values)(this._pluggables),y=g.next();!y.done;y=g.next()){var m=y.value,b={message:p,timestamp:Date.now()};m.pushLogs([b])}}catch(e){n={error:e}}finally{try{y&&!y.done&&(s=g.return)&&s.call(g)}finally{if(n)throw n.error}}}},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,Object(i.__spread)([r.INFO],e))},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,Object(i.__spread)([r.INFO],e))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,Object(i.__spread)([r.WARN],e))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,Object(i.__spread)([r.ERROR],e))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,Object(i.__spread)([r.DEBUG],e))},e.prototype.verbose=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,Object(i.__spread)([r.VERBOSE],e))},e.prototype.addPluggable=function(e){e&&"Logging"===e.getCategoryName()&&(this._pluggables.push(e),e.configure(this._config))},e.prototype.listPluggables=function(){return this._pluggables},e.LOG_LEVEL=null,e}()},,function(e,t,n){"use strict";n.d(t,"a",(function(){return l})),n.d(t,"b",(function(){return f})),n.d(t,"c",(function(){return d}));var r=n(0),i=function(e){return/^Connection failed: Connection Timeout/.test(e.message)},o=function(e){return/^Error: Request failed with status code 5\d\d/.test(e.message)},s={BadModel:function(){return!1},BadRecord:function(e){var t=e.message;return/^Cannot return \w+ for [\w-_]+ type/.test(t)||/^Variable '.+' has coerced Null value for NonNull type/.test(t)},ConfigError:function(){return!1},Transient:function(e){return i(e)||o(e)},Unauthorized:function(e){return/^Request failed with status code 401/.test(e.message)}},a={BadModel:function(){return!1},BadRecord:function(){return!1},ConfigError:function(){return!1},Transient:function(e){var t=c(e);return i(t)||o(t)},Unauthorized:function(e){var t=c(e);return/Connection failed.+Unauthorized/.test(t.message)}},u={BadModel:function(){return!1},BadRecord:function(e){return/^Cannot return \w+ for [\w-_]+ type/.test(e.message)},ConfigError:function(){return!1},Transient:function(e){return i(e)||o(e)},Unauthorized:function(){return!1}};function c(e){var t=e.error;return Object(r.__read)((void 0===t?{errors:[]}:t).errors,1)[0]}function l(e){return h(s,e)}function f(e){return h(a,e)}function d(e){return h(u,e)}function h(e,t){var n,i,o=Object(r.__spread)(Object.keys(e));try{for(var s=Object(r.__values)(o),a=s.next();!a.done;a=s.next()){var u=a.value;if((0,e[u])(t))return u}}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return"Unknown"}},function(e,t,n){"use strict";
50
+ var oe=function(){function e(e,t){var n=e||{},r=n.UserPoolId,i=n.ClientId,o=n.endpoint,s=n.fetchOptions,a=n.AdvancedSecurityDataCollectionFlag;if(!r||!i)throw new Error("Both UserPoolId and ClientId are required.");if(r.length>55||!/^[\w-]+_[0-9a-zA-Z]+$/.test(r))throw new Error("Invalid UserPoolId format.");var u=r.split("_")[0];this.userPoolId=r,this.clientId=i,this.client=new re(u,o,s),this.advancedSecurityDataCollectionFlag=!1!==a,this.storage=e.Storage||(new H).getStorage(),t&&(this.wrapRefreshSessionCallback=t)}var t=e.prototype;return t.getUserPoolId=function(){return this.userPoolId},t.getClientId=function(){return this.clientId},t.signUp=function(e,t,n,r,i,o){var s=this,a={ClientId:this.clientId,Username:e,Password:t,UserAttributes:n,ValidationData:r,ClientMetadata:o};this.getUserContextData(e)&&(a.UserContextData=this.getUserContextData(e)),this.client.request("SignUp",a,(function(t,n){if(t)return i(t,null);var r={Username:e,Pool:s,Storage:s.storage},o={user:new G(r),userConfirmed:n.UserConfirmed,userSub:n.UserSub,codeDeliveryDetails:n.CodeDeliveryDetails};return i(null,o)}))},t.getCurrentUser=function(){var e="CognitoIdentityServiceProvider."+this.clientId+".LastAuthUser",t=this.storage.getItem(e);if(t){var n={Username:t,Pool:this,Storage:this.storage};return new G(n)}return null},t.getUserContextData=function(e){if("undefined"!=typeof AmazonCognitoAdvancedSecurityData){var t=AmazonCognitoAdvancedSecurityData;if(this.advancedSecurityDataCollectionFlag){var n=t.getData(e,this.userPoolId,this.clientId);if(n)return{EncodedData:n}}return{}}},e}(),se=n(26),ae=function(){function e(e){if(!e.domain)throw new Error("The domain of cookieStorage can not be undefined.");if(this.domain=e.domain,e.path?this.path=e.path:this.path="/",Object.prototype.hasOwnProperty.call(e,"expires")?this.expires=e.expires:this.expires=365,Object.prototype.hasOwnProperty.call(e,"secure")?this.secure=e.secure:this.secure=!0,Object.prototype.hasOwnProperty.call(e,"sameSite")){if(!["strict","lax","none"].includes(e.sameSite))throw new Error('The sameSite value of cookieStorage must be "lax", "strict" or "none".');if("none"===e.sameSite&&!this.secure)throw new Error("sameSite = None requires the Secure attribute in latest browser versions.");this.sameSite=e.sameSite}else this.sameSite=null}var t=e.prototype;return t.setItem=function(e,t){var n={path:this.path,expires:this.expires,domain:this.domain,secure:this.secure};return this.sameSite&&(n.sameSite=this.sameSite),se.set(e,t,n),se.get(e)},t.getItem=function(e){return se.get(e)},t.removeItem=function(e){var t={path:this.path,expires:this.expires,domain:this.domain,secure:this.secure};return this.sameSite&&(t.sameSite=this.sameSite),se.remove(e,t)},t.clear=function(){for(var e=se.get(),t=Object.keys(e).length,n=0;n<t;++n)this.removeItem(Object.keys(e)[n]);return{}},e}()},function(e,t,n){"use strict";var r=n(94),i=n(95);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){i.isString(e)&&(e=b(e));return e instanceof o?e.format():o.prototype.format.call(e)},t.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),f=["%","/","?",";","#"].concat(l),d=["/","?","#"],h=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,v={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},m=n(96);function b(e,t,n){if(e&&i.isObject(e)&&e instanceof o)return e;var r=new o;return r.parse(e,t,n),r}o.prototype.parse=function(e,t,n){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=-1!==o&&o<e.indexOf("#")?"?":"#",c=e.split(a);c[0]=c[0].replace(/\\/g,"/");var b=e=c.join(a);if(b=b.trim(),!n&&1===e.split("#").length){var w=u.exec(b);if(w)return this.path=b,this.href=b,this.pathname=w[1],w[2]?(this.search=w[2],this.query=t?m.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var S=s.exec(b);if(S){var _=(S=S[0]).toLowerCase();this.protocol=_,b=b.substr(S.length)}if(n||S||b.match(/^\/\/[^@\/]+@[^@\/]+/)){var E="//"===b.substr(0,2);!E||S&&y[S]||(b=b.substr(2),this.slashes=!0)}if(!y[S]&&(E||S&&!g[S])){for(var A,O,I=-1,T=0;T<d.length;T++){-1!==(C=b.indexOf(d[T]))&&(-1===I||C<I)&&(I=C)}-1!==(O=-1===I?b.lastIndexOf("@"):b.lastIndexOf("@",I))&&(A=b.slice(0,O),b=b.slice(O+1),this.auth=decodeURIComponent(A)),I=-1;for(T=0;T<f.length;T++){var C;-1!==(C=b.indexOf(f[T]))&&(-1===I||C<I)&&(I=C)}-1===I&&(I=b.length),this.host=b.slice(0,I),b=b.slice(I),this.parseHost(),this.hostname=this.hostname||"";var x="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!x)for(var P=this.hostname.split(/\./),k=(T=0,P.length);T<k;T++){var N=P[T];if(N&&!N.match(h)){for(var M="",j=0,R=N.length;j<R;j++)N.charCodeAt(j)>127?M+="x":M+=N[j];if(!M.match(h)){var D=P.slice(0,T),U=P.slice(T+1),F=N.match(p);F&&(D.push(F[1]),U.unshift(F[2])),U.length&&(b="/"+U.join(".")+b),this.hostname=D.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),x||(this.hostname=r.toASCII(this.hostname));var L=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+L,this.href+=this.host,x&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!v[_])for(T=0,k=l.length;T<k;T++){var q=l[T];if(-1!==b.indexOf(q)){var z=encodeURIComponent(q);z===q&&(z=escape(q)),b=b.split(q).join(z)}}var K=b.indexOf("#");-1!==K&&(this.hash=b.substr(K),b=b.slice(0,K));var H=b.indexOf("?");if(-1!==H?(this.search=b.substr(H),this.query=b.substr(H+1),t&&(this.query=m.parse(this.query)),b=b.slice(0,H)):t&&(this.search="",this.query={}),b&&(this.pathname=b),g[_]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){L=this.pathname||"";var V=this.search||"";this.path=L+V}return this.href=this.format(),this},o.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",n=this.pathname||"",r=this.hash||"",o=!1,s="";this.host?o=e+this.host:this.hostname&&(o=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(s=m.stringify(this.query));var a=this.search||s&&"?"+s||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||g[t])&&!1!==o?(o="//"+(o||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):o||(o=""),r&&"#"!==r.charAt(0)&&(r="#"+r),a&&"?"!==a.charAt(0)&&(a="?"+a),t+o+(n=n.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(a=a.replace("#","%23"))+r},o.prototype.resolve=function(e){return this.resolveObject(b(e,!1,!0)).format()},o.prototype.resolveObject=function(e){if(i.isString(e)){var t=new o;t.parse(e,!1,!0),e=t}for(var n=new o,r=Object.keys(this),s=0;s<r.length;s++){var a=r[s];n[a]=this[a]}if(n.hash=e.hash,""===e.href)return n.href=n.format(),n;if(e.slashes&&!e.protocol){for(var u=Object.keys(e),c=0;c<u.length;c++){var l=u[c];"protocol"!==l&&(n[l]=e[l])}return g[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(e.protocol&&e.protocol!==n.protocol){if(!g[e.protocol]){for(var f=Object.keys(e),d=0;d<f.length;d++){var h=f[d];n[h]=e[h]}return n.href=n.format(),n}if(n.protocol=e.protocol,e.host||y[e.protocol])n.pathname=e.pathname;else{for(var p=(e.pathname||"").split("/");p.length&&!(e.host=p.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==p[0]&&p.unshift(""),p.length<2&&p.unshift(""),n.pathname=p.join("/")}if(n.search=e.search,n.query=e.query,n.host=e.host||"",n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,n.pathname||n.search){var v=n.pathname||"",m=n.search||"";n.path=v+m}return n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var b=n.pathname&&"/"===n.pathname.charAt(0),w=e.host||e.pathname&&"/"===e.pathname.charAt(0),S=w||b||n.host&&e.pathname,_=S,E=n.pathname&&n.pathname.split("/")||[],A=(p=e.pathname&&e.pathname.split("/")||[],n.protocol&&!g[n.protocol]);if(A&&(n.hostname="",n.port=null,n.host&&(""===E[0]?E[0]=n.host:E.unshift(n.host)),n.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===p[0]?p[0]=e.host:p.unshift(e.host)),e.host=null),S=S&&(""===p[0]||""===E[0])),w)n.host=e.host||""===e.host?e.host:n.host,n.hostname=e.hostname||""===e.hostname?e.hostname:n.hostname,n.search=e.search,n.query=e.query,E=p;else if(p.length)E||(E=[]),E.pop(),E=E.concat(p),n.search=e.search,n.query=e.query;else if(!i.isNullOrUndefined(e.search)){if(A)n.hostname=n.host=E.shift(),(x=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=x.shift(),n.host=n.hostname=x.shift());return n.search=e.search,n.query=e.query,i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!E.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var O=E.slice(-1)[0],I=(n.host||e.host||E.length>1)&&("."===O||".."===O)||""===O,T=0,C=E.length;C>=0;C--)"."===(O=E[C])?E.splice(C,1):".."===O?(E.splice(C,1),T++):T&&(E.splice(C,1),T--);if(!S&&!_)for(;T--;T)E.unshift("..");!S||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),I&&"/"!==E.join("/").substr(-1)&&E.push("");var x,P=""===E[0]||E[0]&&"/"===E[0].charAt(0);A&&(n.hostname=n.host=P?"":E.length?E.shift():"",(x=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=x.shift(),n.host=n.hostname=x.shift()));return(S=S||n.host&&E.length)&&!P&&E.unshift(""),E.length?n.pathname=E.join("/"):(n.pathname=null,n.path=null),i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){"use strict";var r=n(76),i=n.n(r).a;t.a=i},function(e,t,n){"use strict";var r;n.d(t,"a",(function(){return r})),function(e){e.DEFAULT_MSG="Authentication Error",e.EMPTY_EMAIL="Email cannot be empty",e.EMPTY_PHONE="Phone number cannot be empty",e.EMPTY_USERNAME="Username cannot be empty",e.INVALID_USERNAME="The username should either be a string or one of the sign in types",e.EMPTY_PASSWORD="Password cannot be empty",e.EMPTY_CODE="Confirmation code cannot be empty",e.SIGN_UP_ERROR="Error creating account",e.NO_MFA="No valid MFA method provided",e.INVALID_MFA="Invalid MFA type",e.EMPTY_CHALLENGE="Challenge response cannot be empty",e.NO_USER_SESSION="Failed to get the session because the user is empty",e.NETWORK_ERROR="Network Error",e.DEVICE_CONFIG="Device tracking has not been configured in this User Pool",e.AUTOSIGNIN_ERROR="Please use your credentials to sign in"}(r||(r={}))},function(e,t,n){(function(t){var r;e.exports=(r=r||function(e,r){var i;if("undefined"!=typeof window&&window.crypto&&(i=window.crypto),"undefined"!=typeof self&&self.crypto&&(i=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(i=globalThis.crypto),!i&&"undefined"!=typeof window&&window.msCrypto&&(i=window.msCrypto),!i&&void 0!==t&&t.crypto&&(i=t.crypto),!i)try{i=n(88)}catch(e){}var o=function(){if(i){if("function"==typeof i.getRandomValues)try{return i.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof i.randomBytes)try{return i.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),a={},u=a.lib={},c=u.Base={extend:function(e){var t=s(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},l=u.WordArray=c.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||d).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,i=e.sigBytes;if(this.clamp(),r%4)for(var o=0;o<i;o++){var s=n[o>>>2]>>>24-o%4*8&255;t[r+o>>>2]|=s<<24-(r+o)%4*8}else for(var a=0;a<i;a+=4)t[r+a>>>2]=n[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n<e;n+=4)t.push(o());return new l.init(t,e)}}),f=a.enc={},d=f.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new l.init(n,t/2)}},h=f.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new l.init(n,t)}},p=f.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},v=u.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,r=this._data,i=r.words,o=r.sigBytes,s=this.blockSize,a=o/(4*s),u=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,c=e.min(4*u,o);if(u){for(var f=0;f<u;f+=s)this._doProcessBlock(i,f);n=i.splice(0,u),r.sigBytes-=c}return new l.init(n,c)},clone:function(){var e=c.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),y=(u.Hasher=v.extend({cfg:c.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){v.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new y.HMAC.init(e,n).finalize(t)}}}),a.algo={});return a}(Math),r)}).call(this,n(27))},function(e,t,n){"use strict";var r=n(58),i=Object.prototype.toString;function o(e){return Array.isArray(e)}function s(e){return void 0===e}function a(e){return"[object ArrayBuffer]"===i.call(e)}function u(e){return null!==e&&"object"==typeof e}function c(e){if("[object Object]"!==i.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function l(e){return"[object Function]"===i.call(e)}function f(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),o(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}e.exports={isArray:o,isArrayBuffer:a,isBuffer:function(e){return null!==e&&!s(e)&&null!==e.constructor&&!s(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"[object FormData]"===i.call(e)},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&a(e.buffer)},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:u,isPlainObject:c,isUndefined:s,isDate:function(e){return"[object Date]"===i.call(e)},isFile:function(e){return"[object File]"===i.call(e)},isBlob:function(e){return"[object Blob]"===i.call(e)},isFunction:l,isStream:function(e){return u(e)&&l(e.pipe)},isURLSearchParams:function(e){return"[object URLSearchParams]"===i.call(e)},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:f,merge:function e(){var t={};function n(n,r){c(t[r])&&c(n)?t[r]=e(t[r],n):c(n)?t[r]=e({},n):o(n)?t[r]=n.slice():t[r]=n}for(var r=0,i=arguments.length;r<i;r++)f(arguments[r],n);return t},extend:function(e,t,n){return f(t,(function(t,i){e[i]=n&&"function"==typeof t?r(t,n):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function i(e){return!!e&&!!e[W]}function o(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===Y}(e)||Array.isArray(e)||!!e[G]||!!e.constructor[G]||d(e)||h(e))}function s(e,t,n){void 0===n&&(n=!1),0===a(e)?(n?Object.keys:J)(e).forEach((function(r){n&&"symbol"==typeof r||t(r,e[r],e)})):e.forEach((function(n,r){return t(r,n,e)}))}function a(e){var t=e[W];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:d(e)?2:h(e)?3:0}function u(e,t){return 2===a(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function c(e,t){return 2===a(e)?e.get(t):e[t]}function l(e,t,n){var r=a(e);2===r?e.set(t,n):3===r?(e.delete(t),e.add(n)):e[t]=n}function f(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function d(e){return z&&e instanceof Map}function h(e){return K&&e instanceof Set}function p(e){return e.o||e.t}function v(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=$(e);delete t[W];for(var n=J(t),r=0;r<n.length;r++){var i=n[r],o=t[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(t[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function y(e,t){return void 0===t&&(t=!1),m(e)||i(e)||!o(e)||(a(e)>1&&(e.set=e.add=e.clear=e.delete=g),Object.freeze(e),t&&s(e,(function(e,t){return y(t,!0)}),!0)),e}function g(){r(2)}function m(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function b(e){var t=Z[e];return t||r(18,e),t}function w(e,t){Z[e]||(Z[e]=t)}function S(){return B}function _(e,t){t&&(b("Patches"),e.u=[],e.s=[],e.v=t)}function E(e){A(e),e.p.forEach(I),e.p=null}function A(e){e===B&&(B=e.l)}function O(e){return B={p:[],l:B,h:e,m:!0,_:0}}function I(e){var t=e[W];0===t.i||1===t.i?t.j():t.O=!0}function T(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||b("ES5").S(t,e,i),i?(n[W].P&&(E(t),r(4)),o(e)&&(e=C(t,e),t.l||P(t,e)),t.u&&b("Patches").M(n[W],e,t.u,t.s)):e=C(t,n,[]),E(t),t.u&&t.v(t.u,t.s),e!==V?e:void 0}function C(e,t,n){if(m(t))return t;var r=t[W];if(!r)return s(t,(function(i,o){return x(e,r,t,i,o,n)}),!0),t;if(r.A!==e)return t;if(!r.P)return P(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=4===r.i||5===r.i?r.o=v(r.k):r.o;s(3===r.i?new Set(i):i,(function(t,o){return x(e,r,i,t,o,n)})),P(e,i,!1),n&&e.u&&b("Patches").R(r,n,e.u,e.s)}return r.o}function x(e,t,n,r,s,a){if(i(s)){var c=C(e,s,a&&t&&3!==t.i&&!u(t.D,r)?a.concat(r):void 0);if(l(n,r,c),!i(c))return;e.m=!1}if(o(s)&&!m(s)){if(!e.h.F&&e._<1)return;C(e,s),t&&t.A.l||P(e,s)}}function P(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&y(t,n)}function k(e,t){var n=e[W];return(n?p(n):e)[t]}function N(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function M(e){e.P||(e.P=!0,e.l&&M(e.l))}function j(e){e.o||(e.o=v(e.t))}function R(e,t,n){var r=d(t)?b("MapSet").N(t,n):h(t)?b("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:S(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=r,o=Q;n&&(i=[r],o=X);var s=Proxy.revocable(i,o),a=s.revoke,u=s.proxy;return r.k=u,r.j=a,u}(t,n):b("ES5").J(t,n);return(n?n.A:S()).p.push(r),r}function D(e){return i(e)||r(22,e),function e(t){if(!o(t))return t;var n,r=t[W],i=a(t);if(r){if(!r.P&&(r.i<4||!b("ES5").K(r)))return r.t;r.I=!0,n=U(t,i),r.I=!1}else n=U(t,i);return s(n,(function(t,i){r&&c(r.t,t)===i||l(n,t,e(i))})),3===i?new Set(n):n}(e)}function U(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return v(e)}function F(){function e(t){if(!o(t))return t;if(Array.isArray(t))return t.map(e);if(d(t))return new Map(Array.from(t.entries()).map((function(t){return[t[0],e(t[1])]})));if(h(t))return new Set(Array.from(t).map(e));var n=Object.create(Object.getPrototypeOf(t));for(var r in t)n[r]=e(t[r]);return u(t,G)&&(n[G]=t[G]),n}function t(t){return i(t)?e(t):t}var n="add";w("Patches",{$:function(t,i){return i.forEach((function(i){for(var o=i.path,s=i.op,u=t,l=0;l<o.length-1;l++){var f=a(u),d=""+o[l];0!==f&&1!==f||"__proto__"!==d&&"constructor"!==d||r(24),"function"==typeof u&&"prototype"===d&&r(24),"object"!=typeof(u=c(u,d))&&r(15,o.join("/"))}var h=a(u),p=e(i.value),v=o[o.length-1];switch(s){case"replace":switch(h){case 2:return u.set(v,p);case 3:r(16);default:return u[v]=p}case n:switch(h){case 1:return u.splice(v,0,p);case 2:return u.set(v,p);case 3:return u.add(p);default:return u[v]=p}case"remove":switch(h){case 1:return u.splice(v,1);case 2:return u.delete(v);case 3:return u.delete(i.value);default:return delete u[v]}default:r(17,s)}})),t},R:function(e,r,i,o){switch(e.i){case 0:case 4:case 2:return function(e,r,i,o){var a=e.t,l=e.o;s(e.D,(function(e,s){var f=c(a,e),d=c(l,e),h=s?u(a,e)?"replace":n:"remove";if(f!==d||"replace"!==h){var p=r.concat(e);i.push("remove"===h?{op:h,path:p}:{op:h,path:p,value:d}),o.push(h===n?{op:"remove",path:p}:"remove"===h?{op:n,path:p,value:t(f)}:{op:"replace",path:p,value:t(f)})}}))}(e,r,i,o);case 5:case 1:return function(e,r,i,o){var s=e.t,a=e.D,u=e.o;if(u.length<s.length){var c=[u,s];s=c[0],u=c[1];var l=[o,i];i=l[0],o=l[1]}for(var f=0;f<s.length;f++)if(a[f]&&u[f]!==s[f]){var d=r.concat([f]);i.push({op:"replace",path:d,value:t(u[f])}),o.push({op:"replace",path:d,value:t(s[f])})}for(var h=s.length;h<u.length;h++){var p=r.concat([h]);i.push({op:n,path:p,value:t(u[h])})}s.length<u.length&&o.push({op:"replace",path:r.concat(["length"]),value:s.length})}(e,r,i,o);case 3:return function(e,t,r,i){var o=e.t,s=e.o,a=0;o.forEach((function(e){if(!s.has(e)){var o=t.concat([a]);r.push({op:"remove",path:o,value:e}),i.unshift({op:n,path:o,value:e})}a++})),a=0,s.forEach((function(e){if(!o.has(e)){var s=t.concat([a]);r.push({op:n,path:s,value:e}),i.unshift({op:"remove",path:s,value:e})}a++}))}(e,r,i,o)}},M:function(e,t,n,r){n.push({op:"replace",path:[],value:t===V?void 0:t}),r.push({op:"replace",path:[],value:e.t})}})}n.d(t,"a",(function(){return re})),n.d(t,"b",(function(){return F})),n.d(t,"c",(function(){return G})),n.d(t,"d",(function(){return te})),n.d(t,"e",(function(){return ne}));var L,B,q="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),z="undefined"!=typeof Map,K="undefined"!=typeof Set,H="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,V=q?Symbol.for("immer-nothing"):((L={})["immer-nothing"]=!0,L),G=q?Symbol.for("immer-draftable"):"__$immer_draftable",W=q?Symbol.for("immer-state"):"__$immer_state",Y=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),J="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,$=Object.getOwnPropertyDescriptors||function(e){var t={};return J(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Z={},Q={get:function(e,t){if(t===W)return e;var n=p(e);if(!u(n,t))return function(e,t,n){var r,i=N(t,n);return i?"value"in i?i.value:null===(r=i.get)||void 0===r?void 0:r.call(e.k):void 0}(e,n,t);var r=n[t];return e.I||!o(r)?r:r===k(e.t,t)?(j(e),e.o[t]=R(e.A.h,r,e)):r},has:function(e,t){return t in p(e)},ownKeys:function(e){return Reflect.ownKeys(p(e))},set:function(e,t,n){var r=N(p(e),t);if(null==r?void 0:r.set)return r.set.call(e.k,n),!0;if(!e.P){var i=k(p(e),t),o=null==i?void 0:i[W];if(o&&o.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(f(n,i)&&(void 0!==n||u(e.t,t)))return!0;j(e),M(e)}return e.o[t]===n&&"number"!=typeof n&&(void 0!==n||t in e.o)||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==k(e.t,t)||t in e.t?(e.D[t]=!1,j(e),M(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=p(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty:function(){r(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){r(12)}},X={};s(Q,(function(e,t){X[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),X.deleteProperty=function(e,t){return Q.deleteProperty.call(this,e[0],t)},X.set=function(e,t,n){return Q.set.call(this,e[0],t,n,e[0])};var ee=new(function(){function e(e){var t=this;this.g=H,this.F=!0,this.produce=function(e,n,i){if("function"==typeof e&&"function"!=typeof n){var s=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=s);for(var r=arguments.length,i=Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return a.produce(e,(function(e){var r;return(r=n).call.apply(r,[t,e].concat(i))}))}}var u;if("function"!=typeof n&&r(6),void 0!==i&&"function"!=typeof i&&r(7),o(e)){var c=O(t),l=R(t,e,void 0),f=!0;try{u=n(l),f=!1}finally{f?E(c):A(c)}return"undefined"!=typeof Promise&&u instanceof Promise?u.then((function(e){return _(c,i),T(e,c)}),(function(e){throw E(c),e})):(_(c,i),T(u,c))}if(!e||"object"!=typeof e){if((u=n(e))===V)return;return void 0===u&&(u=e),t.F&&y(u,!0),u}r(21,e)},this.produceWithPatches=function(e,n){return"function"==typeof e?function(n){for(var r=arguments.length,i=Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(i))}))}:[t.produce(e,n,(function(e,t){r=e,i=t})),r,i];var r,i},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){o(e)||r(8),i(e)&&(e=D(e));var t=O(this),n=R(this,e,void 0);return n[W].C=!0,A(t),n},t.finishDraft=function(e,t){var n=(e&&e[W]).A;return _(n,t),T(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!H&&r(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}var o=b("Patches").$;return i(e)?o(e,t):this.produce(e,(function(e){return o(e,t.slice(n+1))}))},e}()),te=ee.produce,ne=(ee.produceWithPatches.bind(ee),ee.setAutoFreeze.bind(ee)),re=(ee.setUseProxies.bind(ee),ee.applyPatches.bind(ee));ee.createDraft.bind(ee),ee.finishDraft.bind(ee)},function(e,t,n){"use strict";(function(e){n.d(t,"d",(function(){return l})),n.d(t,"c",(function(){return f})),n.d(t,"b",(function(){return d})),n.d(t,"a",(function(){return y}));var r=[{type:"text/plain",ext:"txt"},{type:"text/html",ext:"html"},{type:"text/javascript",ext:"js"},{type:"text/css",ext:"css"},{type:"text/csv",ext:"csv"},{type:"text/yaml",ext:"yml"},{type:"text/yaml",ext:"yaml"},{type:"text/calendar",ext:"ics"},{type:"text/calendar",ext:"ical"},{type:"image/apng",ext:"apng"},{type:"image/bmp",ext:"bmp"},{type:"image/gif",ext:"gif"},{type:"image/x-icon",ext:"ico"},{type:"image/x-icon",ext:"cur"},{type:"image/jpeg",ext:"jpg"},{type:"image/jpeg",ext:"jpeg"},{type:"image/jpeg",ext:"jfif"},{type:"image/jpeg",ext:"pjp"},{type:"image/jpeg",ext:"pjpeg"},{type:"image/png",ext:"png"},{type:"image/svg+xml",ext:"svg"},{type:"image/tiff",ext:"tif"},{type:"image/tiff",ext:"tiff"},{type:"image/webp",ext:"webp"},{type:"application/json",ext:"json"},{type:"application/xml",ext:"xml"},{type:"application/x-sh",ext:"sh"},{type:"application/zip",ext:"zip"},{type:"application/x-rar-compressed",ext:"rar"},{type:"application/x-tar",ext:"tar"},{type:"application/x-bzip",ext:"bz"},{type:"application/x-bzip2",ext:"bz2"},{type:"application/pdf",ext:"pdf"},{type:"application/java-archive",ext:"jar"},{type:"application/msword",ext:"doc"},{type:"application/vnd.ms-excel",ext:"xls"},{type:"application/vnd.ms-excel",ext:"xlsx"},{type:"message/rfc822",ext:"eml"}],i=function(e){return void 0===e&&(e={}),0===Object.keys(e).length},o=function(e,t,n){if(!e||!e.sort)return!1;var r=n&&"desc"===n?-1:1;return e.sort((function(e,n){var i=e[t],o=n[t];return void 0===o?void 0===i?0:1*r:void 0===i||i<o?-1*r:i>o?1*r:0})),!0},s=function(e,t){var n=Object.assign({},e);return t&&("string"==typeof t?delete n[t]:t.forEach((function(e){delete n[e]}))),n},a=function(e,t){void 0===t&&(t="application/octet-stream");var n=e.toLowerCase(),i=r.filter((function(e){return n.endsWith("."+e.ext)}));return i.length>0?i[0].type:t},u=function(e){var t=e.toLowerCase();return!!t.startsWith("text/")||("application/json"===t||"application/xml"===t||"application/sh"===t)},c=function(){for(var e="",t="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n=32;n>0;n-=1)e+=t[Math.floor(Math.random()*t.length)];return e},l=function(e){if(e.isResolved)return e;var t=!0,n=!1,r=!1,i=e.then((function(e){return r=!0,t=!1,e}),(function(e){throw n=!0,t=!1,e}));return i.isFullfilled=function(){return r},i.isPending=function(){return t},i.isRejected=function(){return n},i},f=function(){if("undefined"==typeof self)return!1;var e=self;return void 0!==e.WorkerGlobalScope&&self instanceof e.WorkerGlobalScope},d=function(){return{isBrowser:"undefined"!=typeof window&&void 0!==window.document,isNode:void 0!==e&&null!=e.versions&&null!=e.versions.node}},h=function e(t,n,r){if(void 0===n&&(n=[]),void 0===r&&(r=[]),!v(t))return t;var i={};for(var o in t){if(t.hasOwnProperty(o))i[n.includes(o)?o:o[0].toLowerCase()+o.slice(1)]=r.includes(o)?t[o]:e(t[o],n,r)}return i},p=function e(t,n,r){if(void 0===n&&(n=[]),void 0===r&&(r=[]),!v(t))return t;var i={};for(var o in t){if(t.hasOwnProperty(o))i[n.includes(o)?o:o[0].toUpperCase()+o.slice(1)]=r.includes(o)?t[o]:e(t[o],n,r)}return i},v=function(e){return!(!(e instanceof Object)||e instanceof Array||e instanceof Function||e instanceof Number||e instanceof String||e instanceof Boolean)},y=function(){function e(){}return e.isEmpty=i,e.sortByField=o,e.objectLessAttributes=s,e.filenameToContentType=a,e.isTextFile=u,e.generateRandomString=c,e.makeQuerablePromise=l,e.isWebWorker=f,e.browserOrNode=d,e.transferKeyToLowerCase=h,e.transferKeyToUpperCase=p,e.isStrictObject=v,e}()}).call(this,n(47))},function(e,t,n){"use strict";var r=n(32);n(8);t.a=r.a},function(e,t,n){"use strict";for(var r=n(32),i=n(19),o=n(21),s=n(148),a=n(34),u=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},c={clockOffset:0,getDateWithClockOffset:function(){return c.clockOffset?new Date((new Date).getTime()+c.clockOffset):new Date},getClockOffset:function(){return c.clockOffset},getHeaderStringFromDate:function(e){return void 0===e&&(e=c.getDateWithClockOffset()),e.toISOString().replace(/[:\-]|\.\d{3}/g,"")},getDateFromHeaderString:function(e){var t=u(e.match(/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2}).+/),7),n=t[1],r=t[2],i=t[3],o=t[4],s=t[5],a=t[6];return new Date(Date.UTC(Number(n),Number(r)-1,Number(i),Number(o),Number(s),Number(a)))},isClockSkewed:function(e){return Math.abs(e.getTime()-c.getDateWithClockOffset().getTime())>=3e5},isClockSkewError:function(e){if(!e.response||!e.response.headers)return!1;var t=e.response.headers;return Boolean(["BadRequestException","InvalidSignatureException"].includes(t["x-amzn-errortype"])&&(t.date||t.Date))},setClockOffset:function(e){c.clockOffset=e}},l=n(41),f={},d={},h=0;h<256;h++){var p=h.toString(16).toLowerCase();1===p.length&&(p="0"+p),f[h]=p,d[p]=h}function v(e){for(var t="",n=0;n<e.byteLength;n++)t+=f[e[n]];return t}var y=n(9);function g(e){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var m=function(){return(m=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},b=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},w=new o.a("Signer"),S=function(e,t){var n=new l.Sha256(e);return n.update(t),n.digestSync()},_=function(e){var t=e||"",n=new l.Sha256;return n.update(t),v(n.digestSync())},E=function(e){return Object.keys(e).map((function(e){return e.toLowerCase()})).sort().join(";")},A=function(e){var t,n,r=Object(y.parse)(e.url);return[e.method||"/",encodeURIComponent(r.pathname).replace(/%2F/gi,"/"),(n=r.query,n&&0!==n.length?n.split("&").map((function(e){var t=e.split("=");if(1===t.length)return e;var n=t[1].replace(/[!'()*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}));return t[0]+"="+n})).sort((function(e,t){var n=e.split("=")[0],r=t.split("=")[0];return n===r?e<t?-1:1:n<r?-1:1})).join("&"):""),(t=e.headers,t&&0!==Object.keys(t).length?Object.keys(t).map((function(e){return{key:e.toLowerCase(),value:t[e]?t[e].trim().replace(/\s+/g," "):""}})).sort((function(e,t){return e.key<t.key?-1:1})).map((function(e){return e.key+":"+e.value})).join("\n")+"\n":""),E(e.headers),_(e.data)].join("\n")},O=function(e){var t=(Object(y.parse)(e.url).host.match(/([^\.]+)\.(?:([^\.]*)\.)?amazonaws\.com$/)||[]).slice(1,3);return"es"===t[1]&&(t=t.reverse()),{service:e.service||t[0],region:e.region||t[1]}},I=function(e,t,n){return[e,t,n,"aws4_request"].join("/")},T=function(e,t,n,r){return[e,n,r,_(t)].join("\n")},C=function(e,t,n){w.debug(n);var r=S("AWS4"+e,t),i=S(r,n.region),o=S(i,n.service);return S(o,"aws4_request")},x=function(e,t){return v(S(e,t))},P=function(){function e(){}return e.sign=function(e,t,n){if(void 0===n&&(n=null),e.headers=e.headers||{},e.body&&!e.data)throw new Error('The attribute "body" was found on the request object. Please use the attribute "data" instead.');var r=c.getDateWithClockOffset().toISOString().replace(/[:\-]|\.\d{3}/g,""),i=r.substr(0,8),o=Object(y.parse)(e.url);e.headers.host=o.host,e.headers["x-amz-date"]=r,t.session_token&&(e.headers["X-Amz-Security-Token"]=t.session_token);var s=A(e);w.debug(s);var a=n||O(e),u=I(i,a.region,a.service),l=T("AWS4-HMAC-SHA256",s,r,u),f=C(t.secret_key,i,a),d=x(f,l),h=function(e,t,n,r,i){return[e+" Credential="+t+"/"+n,"SignedHeaders="+r,"Signature="+i].join(", ")}("AWS4-HMAC-SHA256",t.access_key,u,E(e.headers),d);return e.headers.Authorization=h,e},e.signUrl=function(e,t,n,r){var i="object"===g(e)?e.url:e,o="object"===g(e)?e.method:"GET",s="object"===g(e)?e.body:void 0,a=c.getDateWithClockOffset().toISOString().replace(/[:\-]|\.\d{3}/g,""),u=a.substr(0,8),l=Object(y.parse)(i,!0,!0),f=(l.search,b(l,["search"])),d={host:f.host},h=n||O({url:Object(y.format)(f)}),p=h.region,v=h.service,w=I(u,p,v),S=t.session_token&&"iotdevicegateway"!==v,_=m(m(m({"X-Amz-Algorithm":"AWS4-HMAC-SHA256","X-Amz-Credential":[t.access_key,w].join("/"),"X-Amz-Date":a.substr(0,16)},S?{"X-Amz-Security-Token":""+t.session_token}:{}),r?{"X-Amz-Expires":""+r}:{}),{"X-Amz-SignedHeaders":Object.keys(d).join(",")}),E=A({method:o,url:Object(y.format)(m(m({},f),{query:m(m({},f.query),_)})),headers:d,data:s}),P=T("AWS4-HMAC-SHA256",E,a,w),k=C(t.secret_key,u,{region:p,service:v}),N=x(k,P),M=m({"X-Amz-Signature":N},t.session_token&&{"X-Amz-Security-Token":t.session_token});return Object(y.format)({protocol:f.protocol,slashes:!0,hostname:f.hostname,port:f.port,pathname:f.pathname,query:m(m(m({},f.query),_),M)})},e}(),k=n(28),N=n.n(k),M=function(){return(M=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},j=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},R=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},D=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},U=new o.a("RestClient"),F=function(){function e(e){this._region="us-east-1",this._service="execute-api",this._custom_header=void 0,this._cancelTokenMap=null,this.Credentials=s.a,this._options=e,U.debug("API Options",this._options),null==this._cancelTokenMap&&(this._cancelTokenMap=new WeakMap)}return e.prototype.ajax=function(e,t,n){return j(this,void 0,void 0,(function(){var r,i,o,s,u,l,f,d,h,p,v,g,m,b,w=this;return R(this,(function(S){switch(S.label){case 0:return U.debug(t,e),o="us-east-1",s="execute-api",u=void 0,"string"==typeof e?(r=this._parseUrl(e),i=e):(i=e.endpoint,u=e.custom_header,o=e.region,s=e.service,r=this._parseUrl(e.endpoint)),l={method:t,url:i,host:r.host,path:r.path,headers:{},data:null,responseType:"json",timeout:0,cancelToken:null},f={},a.a.isReactNative&&(d=a.a.userAgent||"aws-amplify/0.1.x",f={"User-Agent":d}),h=Object.assign({},n),p=h.response,h.body&&("function"==typeof FormData&&h.body instanceof FormData?(f["Content-Type"]="multipart/form-data",l.data=h.body):(f["Content-Type"]="application/json; charset=UTF-8",l.data=JSON.stringify(h.body))),h.responseType&&(l.responseType=h.responseType),h.withCredentials&&(l.withCredentials=h.withCredentials),h.timeout&&(l.timeout=h.timeout),h.cancellableToken&&(l.cancelToken=h.cancellableToken.token),l.signerServiceInfo=h.signerServiceInfo,"function"!=typeof u?[3,2]:[4,u()];case 1:return g=S.sent(),[3,3];case 2:g=void 0,S.label=3;case 3:return v=g,l.headers=M(M(M({},f),v),h.headers),m=Object(y.parse)(i,!0,!0),m.search,b=D(m,["search"]),l.url=Object(y.format)(M(M({},b),{query:M(M({},b.query),h.queryStringParameters||{})})),void 0!==l.headers.Authorization?(l.headers=Object.keys(l.headers).reduce((function(e,t){return l.headers[t]&&(e[t]=l.headers[t]),e}),{}),[2,this._request(l,p)]):[2,this.Credentials.get().then((function(r){return w._signed(M({},l),r,p,{region:o,service:s}).catch((function(r){if(c.isClockSkewError(r)){var i=r.response.headers,o=i&&(i.date||i.Date),s=new Date(o),a=c.getDateFromHeaderString(l.headers["x-amz-date"]);if(c.isClockSkewed(s))return c.setClockOffset(s.getTime()-a.getTime()),w.ajax(e,t,n)}throw r}))}),(function(e){return U.debug("No credentials available, the request will be unsigned"),w._request(l,p)}))]}}))}))},e.prototype.get=function(e,t){return this.ajax(e,"GET",t)},e.prototype.put=function(e,t){return this.ajax(e,"PUT",t)},e.prototype.patch=function(e,t){return this.ajax(e,"PATCH",t)},e.prototype.post=function(e,t){return this.ajax(e,"POST",t)},e.prototype.del=function(e,t){return this.ajax(e,"DELETE",t)},e.prototype.head=function(e,t){return this.ajax(e,"HEAD",t)},e.prototype.cancel=function(e,t){var n=this._cancelTokenMap.get(e);return!!n&&(n.cancel(t),!0)},e.prototype.hasCancelToken=function(e){return this._cancelTokenMap.has(e)},e.prototype.isCancel=function(e){return N.a.isCancel(e)},e.prototype.getCancellableToken=function(){return N.a.CancelToken.source()},e.prototype.updateRequestToBeCancellable=function(e,t){this._cancelTokenMap.set(e,t)},e.prototype.endpoint=function(e){var t=this,n=this._options.endpoints,r="";return Array.isArray(n)?(n.forEach((function(n){n.name===e&&(r=n.endpoint,"string"==typeof n.region?t._region=n.region:"string"==typeof t._options.region&&(t._region=t._options.region),"string"==typeof n.service?t._service=n.service||"execute-api":t._service="execute-api","function"==typeof n.custom_header?t._custom_header=n.custom_header:t._custom_header=void 0)})),r):r},e.prototype._signed=function(e,t,n,r){var i=r.service,o=r.region,s=e.signerServiceInfo,a=D(e,["signerServiceInfo"]),u=o||this._region||this._options.region,c=i||this._service||this._options.service,l={secret_key:t.secretAccessKey,access_key:t.accessKeyId,session_token:t.sessionToken},f={region:u,service:c},d=Object.assign(f,s),h=P.sign(a,l,d);return h.data&&(h.body=h.data),U.debug("Signed Request: ",h),delete h.headers.host,N()(h).then((function(e){return n?e:e.data})).catch((function(e){throw U.debug(e),e}))},e.prototype._request=function(e,t){return void 0===t&&(t=!1),N()(e).then((function(e){return t?e:e.data})).catch((function(e){throw U.debug(e),e}))},e.prototype._parseUrl=function(e){var t=e.split("/");return{host:t[2],path:"/"+t.slice(3).join("/")}},e}(),L=n(39),B=function(){return(B=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},q=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},z=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},K=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},H=new o.a("RestAPI"),V=function(){function e(e){this._api=null,this.Credentials=s.a,this._options=e,H.debug("API Options",this._options)}return e.prototype.getModuleName=function(){return"RestAPI"},e.prototype.configure=function(e){var t=e||{},n=t.API,r=void 0===n?{}:n,i=K(t,["API"]),o=B(B({},i),r);if(H.debug("configure Rest API",{opt:o}),o.aws_project_region){if(o.aws_cloud_logic_custom){var s=o.aws_cloud_logic_custom;o.endpoints="string"==typeof s?JSON.parse(s):s}o=Object.assign({},o,{region:o.aws_project_region,header:{}})}return Array.isArray(o.endpoints)?o.endpoints.forEach((function(e){void 0!==e.custom_header&&"function"!=typeof e.custom_header&&(H.warn("Rest API "+e.name+", custom_header should be a function"),e.custom_header=void 0)})):this._options&&Array.isArray(this._options.endpoints)?o.endpoints=this._options.endpoints:o.endpoints=[],this._options=Object.assign({},this._options,o),this.createInstance(),this._options},e.prototype.createInstance=function(){return H.debug("create Rest API instance"),this._api=new F(this._options),this._api.Credentials=this.Credentials,!0},e.prototype.get=function(e,t,n){try{var r=this.getEndpointInfo(e,t),i=this._api.getCancellableToken(),o=Object.assign({},n);o.cancellableToken=i;var s=this._api.get(r,o);return this._api.updateRequestToBeCancellable(s,i),s}catch(e){return Promise.reject(e.message)}},e.prototype.post=function(e,t,n){try{var r=this.getEndpointInfo(e,t),i=this._api.getCancellableToken(),o=Object.assign({},n);o.cancellableToken=i;var s=this._api.post(r,o);return this._api.updateRequestToBeCancellable(s,i),s}catch(e){return Promise.reject(e.message)}},e.prototype.put=function(e,t,n){try{var r=this.getEndpointInfo(e,t),i=this._api.getCancellableToken(),o=Object.assign({},n);o.cancellableToken=i;var s=this._api.put(r,o);return this._api.updateRequestToBeCancellable(s,i),s}catch(e){return Promise.reject(e.message)}},e.prototype.patch=function(e,t,n){try{var r=this.getEndpointInfo(e,t),i=this._api.getCancellableToken(),o=Object.assign({},n);o.cancellableToken=i;var s=this._api.patch(r,o);return this._api.updateRequestToBeCancellable(s,i),s}catch(e){return Promise.reject(e.message)}},e.prototype.del=function(e,t,n){try{var r=this.getEndpointInfo(e,t),i=this._api.getCancellableToken(),o=Object.assign({},n);o.cancellableToken=i;var s=this._api.del(r,o);return this._api.updateRequestToBeCancellable(s,i),s}catch(e){return Promise.reject(e.message)}},e.prototype.head=function(e,t,n){try{var r=this.getEndpointInfo(e,t),i=this._api.getCancellableToken(),o=Object.assign({},n);o.cancellableToken=i;var s=this._api.head(r,o);return this._api.updateRequestToBeCancellable(s,i),s}catch(e){return Promise.reject(e.message)}},e.prototype.isCancel=function(e){return this._api.isCancel(e)},e.prototype.cancel=function(e,t){return this._api.cancel(e,t)},e.prototype.hasCancelToken=function(e){return this._api.hasCancelToken(e)},e.prototype.endpoint=function(e){return q(this,void 0,void 0,(function(){return z(this,(function(t){return[2,this._api.endpoint(e)]}))}))},e.prototype.getEndpointInfo=function(e,t){var n=this._options.endpoints;if(!Array.isArray(n))throw new Error("API category not configured");var r=n.find((function(t){return t.name===e}));if(!r)throw new Error("API "+e+" does not exist");var i={endpoint:r.endpoint+t};return"string"==typeof r.region?i.region=r.region:"string"==typeof this._options.region&&(i.region=this._options.region),"string"==typeof r.service?i.service=r.service||"execute-api":i.service="execute-api","function"==typeof r.custom_header?i.custom_header=r.custom_header:i.custom_header=void 0,i},e}(),G=new V(null);function W(e){return(W="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}L.a.register(G);"function"==typeof Symbol&&null!=Symbol.iterator&&Symbol.iterator,"function"==typeof Symbol&&null!=Symbol.asyncIterator&&Symbol.asyncIterator;var Y="function"==typeof Symbol&&null!=Symbol.toStringTag?Symbol.toStringTag:"@@toStringTag";function J(e,t){for(var n,r=/\r\n|[\n\r]/g,i=1,o=t+1;(n=r.exec(e.body))&&n.index<t;)i+=1,o=t+1-(n.index+n[0].length);return{line:i,column:o}}function $(e){return Z(e.source,J(e.source,e.start))}function Z(e,t){var n=e.locationOffset.column-1,r=X(n)+e.body,i=t.line-1,o=e.locationOffset.line-1,s=t.line+o,a=1===t.line?n:0,u=t.column+a,c="".concat(e.name,":").concat(s,":").concat(u,"\n"),l=r.split(/\r\n|[\n\r]/g),f=l[i];if(f.length>120){for(var d=Math.floor(u/80),h=u%80,p=[],v=0;v<f.length;v+=80)p.push(f.slice(v,v+80));return c+Q([["".concat(s),p[0]]].concat(p.slice(1,d+1).map((function(e){return["",e]})),[[" ",X(h-1)+"^"],["",p[d+1]]]))}return c+Q([["".concat(s-1),l[i-1]],["".concat(s),f],["",X(u-1)+"^"],["".concat(s+1),l[i+1]]])}function Q(e){var t=e.filter((function(e){e[0];return void 0!==e[1]})),n=Math.max.apply(Math,t.map((function(e){return e[0].length})));return t.map((function(e){var t,r=e[0],i=e[1];return X(n-(t=r).length)+t+(i?" | "+i:" |")})).join("\n")}function X(e){return Array(e+1).join(" ")}function ee(e){return(ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function te(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ne(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function re(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ie(e,t){return!t||"object"!==ee(t)&&"function"!=typeof t?oe(e):t}function oe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function se(e){var t="function"==typeof Map?new Map:void 0;return(se=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return ae(e,arguments,le(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),ce(r,e)})(e)}function ae(e,t,n){return(ae=ue()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&ce(i,n.prototype),i}).apply(null,arguments)}function ue(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function ce(e,t){return(ce=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function le(e){return(le=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var fe=function(e){!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&&ce(e,t)}(a,e);var t,n,r,i,o,s=(t=a,n=ue(),function(){var e,r=le(t);if(n){var i=le(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return ie(this,e)});function a(e,t,n,r,i,o,u){var c,l,f,d;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),(d=s.call(this,e)).name="GraphQLError",d.originalError=null!=o?o:void 0,d.nodes=de(Array.isArray(t)?t:t?[t]:void 0);for(var h=[],p=0,v=null!==(y=d.nodes)&&void 0!==y?y:[];p<v.length;p++){var y,g=v[p].loc;null!=g&&h.push(g)}h=de(h),d.source=null!=n?n:null===(c=h)||void 0===c?void 0:c[0].source,d.positions=null!=r?r:null===(l=h)||void 0===l?void 0:l.map((function(e){return e.start})),d.locations=r&&n?r.map((function(e){return J(n,e)})):null===(f=h)||void 0===f?void 0:f.map((function(e){return J(e.source,e.start)})),d.path=null!=i?i:void 0;var m,b=null==o?void 0:o.extensions;return null==u&&("object"==W(m=b)&&null!==m)?d.extensions=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?te(Object(n),!0).forEach((function(t){ne(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},b):d.extensions=null!=u?u:{},Object.defineProperties(oe(d),{message:{enumerable:!0},locations:{enumerable:null!=d.locations},path:{enumerable:null!=d.path},extensions:{enumerable:null!=d.extensions&&Object.keys(d.extensions).length>0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=o&&o.stack?(Object.defineProperty(oe(d),"stack",{value:o.stack,writable:!0,configurable:!0}),ie(d)):(Error.captureStackTrace?Error.captureStackTrace(oe(d),a):Object.defineProperty(oe(d),"stack",{value:Error().stack,writable:!0,configurable:!0}),d)}return r=a,(i=[{key:"toString",value:function(){return function(e){var t=e.message;if(e.nodes)for(var n=0,r=e.nodes;n<r.length;n++){var i=r[n];i.loc&&(t+="\n\n"+$(i.loc))}else if(e.source&&e.locations)for(var o=0,s=e.locations;o<s.length;o++){var a=s[o];t+="\n\n"+Z(e.source,a)}return t}(this)}},{key:Y,get:function(){return"Object"}}])&&re(r.prototype,i),o&&re(r,o),a}(se(Error));function de(e){return void 0===e||0===e.length?void 0:e}function he(e,t,n){return new fe("Syntax Error: ".concat(n),void 0,e,[t])}var pe=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});var ve="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):void 0;function ye(e){var t=e.prototype.toJSON;"function"==typeof t||function(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}(0),e.prototype.inspect=t,ve&&(e.prototype[ve]=t)}var ge=function(){function e(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}return e.prototype.toJSON=function(){return{start:this.start,end:this.end}},e}();ye(ge);var me=function(){function e(e,t,n,r,i,o,s){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=i,this.value=s,this.prev=o,this.next=null}return e.prototype.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},e}();function be(e){return null!=e&&"string"==typeof e.kind}ye(me);var we=Object.freeze({SOF:"<SOF>",EOF:"<EOF>",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"});function Se(e){return(Se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _e(e){return Ee(e,[])}function Ee(e,t){switch(Se(e)){case"string":return JSON.stringify(e);case"function":return e.name?"[function ".concat(e.name,"]"):"[function]";case"object":return null===e?"null":function(e,t){if(-1!==t.indexOf(e))return"[Circular]";var n=[].concat(t,[e]),r=function(e){var t=e[String(ve)];if("function"==typeof t)return t;if("function"==typeof e.inspect)return e.inspect}(e);if(void 0!==r){var i=r.call(e);if(i!==e)return"string"==typeof i?i:Ee(i,n)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>2)return"[Array]";for(var n=Math.min(10,e.length),r=e.length-n,i=[],o=0;o<n;++o)i.push(Ee(e[o],t));1===r?i.push("... 1 more item"):r>1&&i.push("... ".concat(r," more items"));return"["+i.join(", ")+"]"}(e,n);return function(e,t){var n=Object.keys(e);if(0===n.length)return"{}";if(t.length>2)return"["+function(e){var t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){var n=e.constructor.name;if("string"==typeof n&&""!==n)return n}return t}(e)+"]";return"{ "+n.map((function(n){return n+": "+Ee(e[n],t)})).join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}function Ae(e,t){if(!Boolean(e))throw new Error(t)}var Oe=function(e,t){return e instanceof t};function Ie(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var Te=function(){function e(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GraphQL request",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{line:1,column:1};"string"==typeof e||Ae(0,"Body must be a string. Received: ".concat(_e(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||Ae(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Ae(0,"column in locationOffset is 1-indexed and must be positive.")}var t,n,r;return t=e,(n=[{key:Y,get:function(){return"Source"}}])&&Ie(t.prototype,n),r&&Ie(t,r),e}();var Ce=Object.freeze({QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION"});function xe(e){var t=e.split(/\r\n|[\n\r]/g),n=function(e){for(var t,n=!0,r=!0,i=0,o=null,s=0;s<e.length;++s)switch(e.charCodeAt(s)){case 13:10===e.charCodeAt(s+1)&&++s;case 10:n=!1,r=!0,i=0;break;case 9:case 32:++i;break;default:r&&!n&&(null===o||i<o)&&(o=i),r=!1}return null!==(t=o)&&void 0!==t?t:0}(e);if(0!==n)for(var r=1;r<t.length;r++)t[r]=t[r].slice(n);for(var i=0;i<t.length&&Pe(t[i]);)++i;for(var o=t.length;o>i&&Pe(t[o-1]);)--o;return t.slice(i,o).join("\n")}function Pe(e){for(var t=0;t<e.length;++t)if(" "!==e[t]&&"\t"!==e[t])return!1;return!0}var ke=function(){function e(e){var t=new me(we.SOF,0,0,0,0,null);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}var t=e.prototype;return t.advance=function(){return this.lastToken=this.token,this.token=this.lookahead()},t.lookahead=function(){var e=this.token;if(e.kind!==we.EOF)do{var t;e=null!==(t=e.next)&&void 0!==t?t:e.next=Me(this,e)}while(e.kind===we.COMMENT);return e},e}();function Ne(e){return isNaN(e)?we.EOF:e<127?JSON.stringify(String.fromCharCode(e)):'"\\u'.concat(("00"+e.toString(16).toUpperCase()).slice(-4),'"')}function Me(e,t){for(var n=e.source,r=n.body,i=r.length,o=t.end;o<i;){var s=r.charCodeAt(o),a=e.line,u=1+o-e.lineStart;switch(s){case 65279:case 9:case 32:case 44:++o;continue;case 10:++o,++e.line,e.lineStart=o;continue;case 13:10===r.charCodeAt(o+1)?o+=2:++o,++e.line,e.lineStart=o;continue;case 33:return new me(we.BANG,o,o+1,a,u,t);case 35:return Re(n,o,a,u,t);case 36:return new me(we.DOLLAR,o,o+1,a,u,t);case 38:return new me(we.AMP,o,o+1,a,u,t);case 40:return new me(we.PAREN_L,o,o+1,a,u,t);case 41:return new me(we.PAREN_R,o,o+1,a,u,t);case 46:if(46===r.charCodeAt(o+1)&&46===r.charCodeAt(o+2))return new me(we.SPREAD,o,o+3,a,u,t);break;case 58:return new me(we.COLON,o,o+1,a,u,t);case 61:return new me(we.EQUALS,o,o+1,a,u,t);case 64:return new me(we.AT,o,o+1,a,u,t);case 91:return new me(we.BRACKET_L,o,o+1,a,u,t);case 93:return new me(we.BRACKET_R,o,o+1,a,u,t);case 123:return new me(we.BRACE_L,o,o+1,a,u,t);case 124:return new me(we.PIPE,o,o+1,a,u,t);case 125:return new me(we.BRACE_R,o,o+1,a,u,t);case 34:return 34===r.charCodeAt(o+1)&&34===r.charCodeAt(o+2)?Le(n,o,a,u,t,e):Fe(n,o,a,u,t);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return De(n,o,s,a,u,t);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:return qe(n,o,a,u,t)}throw he(n,o,je(s))}var c=e.line,l=1+o-e.lineStart;return new me(we.EOF,i,i,c,l,t)}function je(e){return e<32&&9!==e&&10!==e&&13!==e?"Cannot contain the invalid character ".concat(Ne(e),"."):39===e?"Unexpected single quote character ('), did you mean to use a double quote (\")?":"Cannot parse the unexpected character ".concat(Ne(e),".")}function Re(e,t,n,r,i){var o,s=e.body,a=t;do{o=s.charCodeAt(++a)}while(!isNaN(o)&&(o>31||9===o));return new me(we.COMMENT,t,a,n,r,i,s.slice(t+1,a))}function De(e,t,n,r,i,o){var s=e.body,a=n,u=t,c=!1;if(45===a&&(a=s.charCodeAt(++u)),48===a){if((a=s.charCodeAt(++u))>=48&&a<=57)throw he(e,u,"Invalid number, unexpected digit after 0: ".concat(Ne(a),"."))}else u=Ue(e,u,a),a=s.charCodeAt(u);if(46===a&&(c=!0,a=s.charCodeAt(++u),u=Ue(e,u,a),a=s.charCodeAt(u)),69!==a&&101!==a||(c=!0,43!==(a=s.charCodeAt(++u))&&45!==a||(a=s.charCodeAt(++u)),u=Ue(e,u,a),a=s.charCodeAt(u)),46===a||function(e){return 95===e||e>=65&&e<=90||e>=97&&e<=122}(a))throw he(e,u,"Invalid number, expected digit but got: ".concat(Ne(a),"."));return new me(c?we.FLOAT:we.INT,t,u,r,i,o,s.slice(t,u))}function Ue(e,t,n){var r=e.body,i=t,o=n;if(o>=48&&o<=57){do{o=r.charCodeAt(++i)}while(o>=48&&o<=57);return i}throw he(e,i,"Invalid number, expected digit but got: ".concat(Ne(o),"."))}function Fe(e,t,n,r,i){for(var o,s,a,u,c=e.body,l=t+1,f=l,d=0,h="";l<c.length&&!isNaN(d=c.charCodeAt(l))&&10!==d&&13!==d;){if(34===d)return h+=c.slice(f,l),new me(we.STRING,t,l+1,n,r,i,h);if(d<32&&9!==d)throw he(e,l,"Invalid character within String: ".concat(Ne(d),"."));if(++l,92===d){switch(h+=c.slice(f,l-1),d=c.charCodeAt(l)){case 34:h+='"';break;case 47:h+="/";break;case 92:h+="\\";break;case 98:h+="\b";break;case 102:h+="\f";break;case 110:h+="\n";break;case 114:h+="\r";break;case 116:h+="\t";break;case 117:var p=(o=c.charCodeAt(l+1),s=c.charCodeAt(l+2),a=c.charCodeAt(l+3),u=c.charCodeAt(l+4),Be(o)<<12|Be(s)<<8|Be(a)<<4|Be(u));if(p<0){var v=c.slice(l+1,l+5);throw he(e,l,"Invalid character escape sequence: \\u".concat(v,"."))}h+=String.fromCharCode(p),l+=4;break;default:throw he(e,l,"Invalid character escape sequence: \\".concat(String.fromCharCode(d),"."))}f=++l}}throw he(e,l,"Unterminated string.")}function Le(e,t,n,r,i,o){for(var s=e.body,a=t+3,u=a,c=0,l="";a<s.length&&!isNaN(c=s.charCodeAt(a));){if(34===c&&34===s.charCodeAt(a+1)&&34===s.charCodeAt(a+2))return l+=s.slice(u,a),new me(we.BLOCK_STRING,t,a+3,n,r,i,xe(l));if(c<32&&9!==c&&10!==c&&13!==c)throw he(e,a,"Invalid character within String: ".concat(Ne(c),"."));10===c?(++a,++o.line,o.lineStart=a):13===c?(10===s.charCodeAt(a+1)?a+=2:++a,++o.line,o.lineStart=a):92===c&&34===s.charCodeAt(a+1)&&34===s.charCodeAt(a+2)&&34===s.charCodeAt(a+3)?(l+=s.slice(u,a)+'"""',u=a+=4):++a}throw he(e,a,"Unterminated string.")}function Be(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function qe(e,t,n,r,i){for(var o=e.body,s=o.length,a=t+1,u=0;a!==s&&!isNaN(u=o.charCodeAt(a))&&(95===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122);)++a;return new me(we.NAME,t,a,n,r,i,o.slice(t,a))}function ze(e,t){return new Ke(e,t).parseDocument()}var Ke=function(){function e(e,t){var n=function(e){return Oe(e,Te)}(e)?e:new Te(e);this._lexer=new ke(n),this._options=t}var t=e.prototype;return t.parseName=function(){var e=this.expectToken(we.NAME);return{kind:pe.NAME,value:e.value,loc:this.loc(e)}},t.parseDocument=function(){var e=this._lexer.token;return{kind:pe.DOCUMENT,definitions:this.many(we.SOF,this.parseDefinition,we.EOF),loc:this.loc(e)}},t.parseDefinition=function(){if(this.peek(we.NAME))switch(this._lexer.token.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return this.parseTypeSystemDefinition();case"extend":return this.parseTypeSystemExtension()}else{if(this.peek(we.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},t.parseOperationDefinition=function(){var e=this._lexer.token;if(this.peek(we.BRACE_L))return{kind:pe.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(e)};var t,n=this.parseOperationType();return this.peek(we.NAME)&&(t=this.parseName()),{kind:pe.OPERATION_DEFINITION,operation:n,name:t,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}},t.parseOperationType=function(){var e=this.expectToken(we.NAME);switch(e.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(e)},t.parseVariableDefinitions=function(){return this.optionalMany(we.PAREN_L,this.parseVariableDefinition,we.PAREN_R)},t.parseVariableDefinition=function(){var e=this._lexer.token;return{kind:pe.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(we.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(we.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(e)}},t.parseVariable=function(){var e=this._lexer.token;return this.expectToken(we.DOLLAR),{kind:pe.VARIABLE,name:this.parseName(),loc:this.loc(e)}},t.parseSelectionSet=function(){var e=this._lexer.token;return{kind:pe.SELECTION_SET,selections:this.many(we.BRACE_L,this.parseSelection,we.BRACE_R),loc:this.loc(e)}},t.parseSelection=function(){return this.peek(we.SPREAD)?this.parseFragment():this.parseField()},t.parseField=function(){var e,t,n=this._lexer.token,r=this.parseName();return this.expectOptionalToken(we.COLON)?(e=r,t=this.parseName()):t=r,{kind:pe.FIELD,alias:e,name:t,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(we.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},t.parseArguments=function(e){var t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(we.PAREN_L,t,we.PAREN_R)},t.parseArgument=function(){var e=this._lexer.token,t=this.parseName();return this.expectToken(we.COLON),{kind:pe.ARGUMENT,name:t,value:this.parseValueLiteral(!1),loc:this.loc(e)}},t.parseConstArgument=function(){var e=this._lexer.token;return{kind:pe.ARGUMENT,name:this.parseName(),value:(this.expectToken(we.COLON),this.parseValueLiteral(!0)),loc:this.loc(e)}},t.parseFragment=function(){var e=this._lexer.token;this.expectToken(we.SPREAD);var t=this.expectOptionalKeyword("on");return!t&&this.peek(we.NAME)?{kind:pe.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(e)}:{kind:pe.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}},t.parseFragmentDefinition=function(){var e,t=this._lexer.token;return this.expectKeyword("fragment"),!0===(null===(e=this._options)||void 0===e?void 0:e.experimentalFragmentVariables)?{kind:pe.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(t)}:{kind:pe.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(t)}},t.parseFragmentName=function(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()},t.parseValueLiteral=function(e){var t=this._lexer.token;switch(t.kind){case we.BRACKET_L:return this.parseList(e);case we.BRACE_L:return this.parseObject(e);case we.INT:return this._lexer.advance(),{kind:pe.INT,value:t.value,loc:this.loc(t)};case we.FLOAT:return this._lexer.advance(),{kind:pe.FLOAT,value:t.value,loc:this.loc(t)};case we.STRING:case we.BLOCK_STRING:return this.parseStringLiteral();case we.NAME:switch(this._lexer.advance(),t.value){case"true":return{kind:pe.BOOLEAN,value:!0,loc:this.loc(t)};case"false":return{kind:pe.BOOLEAN,value:!1,loc:this.loc(t)};case"null":return{kind:pe.NULL,loc:this.loc(t)};default:return{kind:pe.ENUM,value:t.value,loc:this.loc(t)}}case we.DOLLAR:if(!e)return this.parseVariable()}throw this.unexpected()},t.parseStringLiteral=function(){var e=this._lexer.token;return this._lexer.advance(),{kind:pe.STRING,value:e.value,block:e.kind===we.BLOCK_STRING,loc:this.loc(e)}},t.parseList=function(e){var t=this,n=this._lexer.token;return{kind:pe.LIST,values:this.any(we.BRACKET_L,(function(){return t.parseValueLiteral(e)}),we.BRACKET_R),loc:this.loc(n)}},t.parseObject=function(e){var t=this,n=this._lexer.token;return{kind:pe.OBJECT,fields:this.any(we.BRACE_L,(function(){return t.parseObjectField(e)}),we.BRACE_R),loc:this.loc(n)}},t.parseObjectField=function(e){var t=this._lexer.token,n=this.parseName();return this.expectToken(we.COLON),{kind:pe.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e),loc:this.loc(t)}},t.parseDirectives=function(e){for(var t=[];this.peek(we.AT);)t.push(this.parseDirective(e));return t},t.parseDirective=function(e){var t=this._lexer.token;return this.expectToken(we.AT),{kind:pe.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e),loc:this.loc(t)}},t.parseTypeReference=function(){var e,t=this._lexer.token;return this.expectOptionalToken(we.BRACKET_L)?(e=this.parseTypeReference(),this.expectToken(we.BRACKET_R),e={kind:pe.LIST_TYPE,type:e,loc:this.loc(t)}):e=this.parseNamedType(),this.expectOptionalToken(we.BANG)?{kind:pe.NON_NULL_TYPE,type:e,loc:this.loc(t)}:e},t.parseNamedType=function(){var e=this._lexer.token;return{kind:pe.NAMED_TYPE,name:this.parseName(),loc:this.loc(e)}},t.parseTypeSystemDefinition=function(){var e=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(e.kind===we.NAME)switch(e.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(e)},t.peekDescription=function(){return this.peek(we.STRING)||this.peek(we.BLOCK_STRING)},t.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},t.parseSchemaDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");var n=this.parseDirectives(!0),r=this.many(we.BRACE_L,this.parseOperationTypeDefinition,we.BRACE_R);return{kind:pe.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:r,loc:this.loc(e)}},t.parseOperationTypeDefinition=function(){var e=this._lexer.token,t=this.parseOperationType();this.expectToken(we.COLON);var n=this.parseNamedType();return{kind:pe.OPERATION_TYPE_DEFINITION,operation:t,type:n,loc:this.loc(e)}},t.parseScalarTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");var n=this.parseName(),r=this.parseDirectives(!0);return{kind:pe.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:r,loc:this.loc(e)}},t.parseObjectTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");var n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseDirectives(!0),o=this.parseFieldsDefinition();return{kind:pe.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:o,loc:this.loc(e)}},t.parseImplementsInterfaces=function(){var e;if(!this.expectOptionalKeyword("implements"))return[];if(!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacySDLImplementsInterfaces)){var t=[];this.expectOptionalToken(we.AMP);do{t.push(this.parseNamedType())}while(this.expectOptionalToken(we.AMP)||this.peek(we.NAME));return t}return this.delimitedMany(we.AMP,this.parseNamedType)},t.parseFieldsDefinition=function(){var e;return!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacySDLEmptyFields)&&this.peek(we.BRACE_L)&&this._lexer.lookahead().kind===we.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(we.BRACE_L,this.parseFieldDefinition,we.BRACE_R)},t.parseFieldDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(we.COLON);var i=this.parseTypeReference(),o=this.parseDirectives(!0);return{kind:pe.FIELD_DEFINITION,description:t,name:n,arguments:r,type:i,directives:o,loc:this.loc(e)}},t.parseArgumentDefs=function(){return this.optionalMany(we.PAREN_L,this.parseInputValueDef,we.PAREN_R)},t.parseInputValueDef=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(we.COLON);var r,i=this.parseTypeReference();this.expectOptionalToken(we.EQUALS)&&(r=this.parseValueLiteral(!0));var o=this.parseDirectives(!0);return{kind:pe.INPUT_VALUE_DEFINITION,description:t,name:n,type:i,defaultValue:r,directives:o,loc:this.loc(e)}},t.parseInterfaceTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");var n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseDirectives(!0),o=this.parseFieldsDefinition();return{kind:pe.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:o,loc:this.loc(e)}},t.parseUnionTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");var n=this.parseName(),r=this.parseDirectives(!0),i=this.parseUnionMemberTypes();return{kind:pe.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:i,loc:this.loc(e)}},t.parseUnionMemberTypes=function(){return this.expectOptionalToken(we.EQUALS)?this.delimitedMany(we.PIPE,this.parseNamedType):[]},t.parseEnumTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");var n=this.parseName(),r=this.parseDirectives(!0),i=this.parseEnumValuesDefinition();return{kind:pe.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:i,loc:this.loc(e)}},t.parseEnumValuesDefinition=function(){return this.optionalMany(we.BRACE_L,this.parseEnumValueDefinition,we.BRACE_R)},t.parseEnumValueDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseDirectives(!0);return{kind:pe.ENUM_VALUE_DEFINITION,description:t,name:n,directives:r,loc:this.loc(e)}},t.parseInputObjectTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");var n=this.parseName(),r=this.parseDirectives(!0),i=this.parseInputFieldsDefinition();return{kind:pe.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:i,loc:this.loc(e)}},t.parseInputFieldsDefinition=function(){return this.optionalMany(we.BRACE_L,this.parseInputValueDef,we.BRACE_R)},t.parseTypeSystemExtension=function(){var e=this._lexer.lookahead();if(e.kind===we.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)},t.parseSchemaExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var t=this.parseDirectives(!0),n=this.optionalMany(we.BRACE_L,this.parseOperationTypeDefinition,we.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return{kind:pe.SCHEMA_EXTENSION,directives:t,operationTypes:n,loc:this.loc(e)}},t.parseScalarTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var t=this.parseName(),n=this.parseDirectives(!0);if(0===n.length)throw this.unexpected();return{kind:pe.SCALAR_TYPE_EXTENSION,name:t,directives:n,loc:this.loc(e)}},t.parseObjectTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseDirectives(!0),i=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===i.length)throw this.unexpected();return{kind:pe.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i,loc:this.loc(e)}},t.parseInterfaceTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseDirectives(!0),i=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===i.length)throw this.unexpected();return{kind:pe.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i,loc:this.loc(e)}},t.parseUnionTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseUnionMemberTypes();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:pe.UNION_TYPE_EXTENSION,name:t,directives:n,types:r,loc:this.loc(e)}},t.parseEnumTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseEnumValuesDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:pe.ENUM_TYPE_EXTENSION,name:t,directives:n,values:r,loc:this.loc(e)}},t.parseInputObjectTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseInputFieldsDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:pe.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:r,loc:this.loc(e)}},t.parseDirectiveDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(we.AT);var n=this.parseName(),r=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var o=this.parseDirectiveLocations();return{kind:pe.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:i,locations:o,loc:this.loc(e)}},t.parseDirectiveLocations=function(){return this.delimitedMany(we.PIPE,this.parseDirectiveLocation)},t.parseDirectiveLocation=function(){var e=this._lexer.token,t=this.parseName();if(void 0!==Ce[t.value])return t;throw this.unexpected(e)},t.loc=function(e){var t;if(!0!==(null===(t=this._options)||void 0===t?void 0:t.noLocation))return new ge(e,this._lexer.lastToken,this._lexer.source)},t.peek=function(e){return this._lexer.token.kind===e},t.expectToken=function(e){var t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t;throw he(this._lexer.source,t.start,"Expected ".concat(Ve(e),", found ").concat(He(t),"."))},t.expectOptionalToken=function(e){var t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t},t.expectKeyword=function(e){var t=this._lexer.token;if(t.kind!==we.NAME||t.value!==e)throw he(this._lexer.source,t.start,'Expected "'.concat(e,'", found ').concat(He(t),"."));this._lexer.advance()},t.expectOptionalKeyword=function(e){var t=this._lexer.token;return t.kind===we.NAME&&t.value===e&&(this._lexer.advance(),!0)},t.unexpected=function(e){var t=null!=e?e:this._lexer.token;return he(this._lexer.source,t.start,"Unexpected ".concat(He(t),"."))},t.any=function(e,t,n){this.expectToken(e);for(var r=[];!this.expectOptionalToken(n);)r.push(t.call(this));return r},t.optionalMany=function(e,t,n){if(this.expectOptionalToken(e)){var r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r}return[]},t.many=function(e,t,n){this.expectToken(e);var r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r},t.delimitedMany=function(e,t){this.expectOptionalToken(e);var n=[];do{n.push(t.call(this))}while(this.expectOptionalToken(e));return n},e}();function He(e){var t=e.value;return Ve(e.kind)+(null!=t?' "'.concat(t,'"'):"")}function Ve(e){return function(e){return e===we.BANG||e===we.DOLLAR||e===we.AMP||e===we.PAREN_L||e===we.PAREN_R||e===we.SPREAD||e===we.COLON||e===we.EQUALS||e===we.AT||e===we.BRACKET_L||e===we.BRACKET_R||e===we.BRACE_L||e===we.PIPE||e===we.BRACE_R}(e)?'"'.concat(e,'"'):e}var Ge={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},We=Object.freeze({});function Ye(e,t,n){var r=e[t];if(r){if(!n&&"function"==typeof r)return r;var i=n?r.leave:r.enter;if("function"==typeof i)return i}else{var o=n?e.leave:e.enter;if(o){if("function"==typeof o)return o;var s=o[t];if("function"==typeof s)return s}}}function Je(e){return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ge,r=void 0,i=Array.isArray(e),o=[e],s=-1,a=[],u=void 0,c=void 0,l=void 0,f=[],d=[],h=e;do{var p=++s===o.length,v=p&&0!==a.length;if(p){if(c=0===d.length?void 0:f[f.length-1],u=l,l=d.pop(),v){if(i)u=u.slice();else{for(var y={},g=0,m=Object.keys(u);g<m.length;g++){var b=m[g];y[b]=u[b]}u=y}for(var w=0,S=0;S<a.length;S++){var _=a[S][0],E=a[S][1];i&&(_-=w),i&&null===E?(u.splice(_,1),w++):u[_]=E}}s=r.index,o=r.keys,a=r.edits,i=r.inArray,r=r.prev}else{if(c=l?i?s:o[s]:void 0,null==(u=l?l[c]:h))continue;l&&f.push(c)}var A,O=void 0;if(!Array.isArray(u)){if(!be(u))throw new Error("Invalid AST Node: ".concat(_e(u),"."));var I=Ye(t,u.kind,p);if(I){if((O=I.call(t,u,c,l,f,d))===We)break;if(!1===O){if(!p){f.pop();continue}}else if(void 0!==O&&(a.push([c,O]),!p)){if(!be(O)){f.pop();continue}u=O}}}if(void 0===O&&v&&a.push([c,u]),p)f.pop();else r={inArray:i,index:s,keys:o,edits:a,prev:r},o=(i=Array.isArray(u))?u:null!==(A=n[u.kind])&&void 0!==A?A:[],s=-1,a=[],l&&d.push(l),l=u}while(void 0!==r);return 0!==a.length&&(h=a[a.length-1][1]),h}(e,{leave:$e})}var $e={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return Qe(e.definitions,"\n\n")+"\n"},OperationDefinition:function(e){var t=e.operation,n=e.name,r=et("(",Qe(e.variableDefinitions,", "),")"),i=Qe(e.directives," "),o=e.selectionSet;return n||i||r||"query"!==t?Qe([t,Qe([n,r]),i,o]," "):o},VariableDefinition:function(e){var t=e.variable,n=e.type,r=e.defaultValue,i=e.directives;return t+": "+n+et(" = ",r)+et(" ",Qe(i," "))},SelectionSet:function(e){return Xe(e.selections)},Field:function(e){var t=e.alias,n=e.name,r=e.arguments,i=e.directives,o=e.selectionSet,s=et("",t,": ")+n,a=s+et("(",Qe(r,", "),")");return a.length>80&&(a=s+et("(\n",tt(Qe(r,"\n")),"\n)")),Qe([a,Qe(i," "),o]," ")},Argument:function(e){return e.name+": "+e.value},FragmentSpread:function(e){return"..."+e.name+et(" ",Qe(e.directives," "))},InlineFragment:function(e){var t=e.typeCondition,n=e.directives,r=e.selectionSet;return Qe(["...",et("on ",t),Qe(n," "),r]," ")},FragmentDefinition:function(e){var t=e.name,n=e.typeCondition,r=e.variableDefinitions,i=e.directives,o=e.selectionSet;return"fragment ".concat(t).concat(et("(",Qe(r,", "),")")," ")+"on ".concat(n," ").concat(et("",Qe(i," ")," "))+o},IntValue:function(e){return e.value},FloatValue:function(e){return e.value},StringValue:function(e,t){var n=e.value;return e.block?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=-1===e.indexOf("\n"),i=" "===e[0]||"\t"===e[0],o='"'===e[e.length-1],s="\\"===e[e.length-1],a=!r||o||s||n,u="";return!a||r&&i||(u+="\n"+t),u+=t?e.replace(/\n/g,"\n"+t):e,a&&(u+="\n"),'"""'+u.replace(/"""/g,'\\"""')+'"""'}(n,"description"===t?"":" "):JSON.stringify(n)},BooleanValue:function(e){return e.value?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){return e.value},ListValue:function(e){return"["+Qe(e.values,", ")+"]"},ObjectValue:function(e){return"{"+Qe(e.fields,", ")+"}"},ObjectField:function(e){return e.name+": "+e.value},Directive:function(e){return"@"+e.name+et("(",Qe(e.arguments,", "),")")},NamedType:function(e){return e.name},ListType:function(e){return"["+e.type+"]"},NonNullType:function(e){return e.type+"!"},SchemaDefinition:Ze((function(e){var t=e.directives,n=e.operationTypes;return Qe(["schema",Qe(t," "),Xe(n)]," ")})),OperationTypeDefinition:function(e){return e.operation+": "+e.type},ScalarTypeDefinition:Ze((function(e){return Qe(["scalar",e.name,Qe(e.directives," ")]," ")})),ObjectTypeDefinition:Ze((function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return Qe(["type",t,et("implements ",Qe(n," & ")),Qe(r," "),Xe(i)]," ")})),FieldDefinition:Ze((function(e){var t=e.name,n=e.arguments,r=e.type,i=e.directives;return t+(rt(n)?et("(\n",tt(Qe(n,"\n")),"\n)"):et("(",Qe(n,", "),")"))+": "+r+et(" ",Qe(i," "))})),InputValueDefinition:Ze((function(e){var t=e.name,n=e.type,r=e.defaultValue,i=e.directives;return Qe([t+": "+n,et("= ",r),Qe(i," ")]," ")})),InterfaceTypeDefinition:Ze((function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return Qe(["interface",t,et("implements ",Qe(n," & ")),Qe(r," "),Xe(i)]," ")})),UnionTypeDefinition:Ze((function(e){var t=e.name,n=e.directives,r=e.types;return Qe(["union",t,Qe(n," "),r&&0!==r.length?"= "+Qe(r," | "):""]," ")})),EnumTypeDefinition:Ze((function(e){var t=e.name,n=e.directives,r=e.values;return Qe(["enum",t,Qe(n," "),Xe(r)]," ")})),EnumValueDefinition:Ze((function(e){return Qe([e.name,Qe(e.directives," ")]," ")})),InputObjectTypeDefinition:Ze((function(e){var t=e.name,n=e.directives,r=e.fields;return Qe(["input",t,Qe(n," "),Xe(r)]," ")})),DirectiveDefinition:Ze((function(e){var t=e.name,n=e.arguments,r=e.repeatable,i=e.locations;return"directive @"+t+(rt(n)?et("(\n",tt(Qe(n,"\n")),"\n)"):et("(",Qe(n,", "),")"))+(r?" repeatable":"")+" on "+Qe(i," | ")})),SchemaExtension:function(e){var t=e.directives,n=e.operationTypes;return Qe(["extend schema",Qe(t," "),Xe(n)]," ")},ScalarTypeExtension:function(e){return Qe(["extend scalar",e.name,Qe(e.directives," ")]," ")},ObjectTypeExtension:function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return Qe(["extend type",t,et("implements ",Qe(n," & ")),Qe(r," "),Xe(i)]," ")},InterfaceTypeExtension:function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return Qe(["extend interface",t,et("implements ",Qe(n," & ")),Qe(r," "),Xe(i)]," ")},UnionTypeExtension:function(e){var t=e.name,n=e.directives,r=e.types;return Qe(["extend union",t,Qe(n," "),r&&0!==r.length?"= "+Qe(r," | "):""]," ")},EnumTypeExtension:function(e){var t=e.name,n=e.directives,r=e.values;return Qe(["extend enum",t,Qe(n," "),Xe(r)]," ")},InputObjectTypeExtension:function(e){var t=e.name,n=e.directives,r=e.fields;return Qe(["extend input",t,Qe(n," "),Xe(r)]," ")}};function Ze(e){return function(t){return Qe([t.description,e(t)],"\n")}}function Qe(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return null!==(t=null==e?void 0:e.filter((function(e){return e})).join(n))&&void 0!==t?t:""}function Xe(e){return et("{\n",tt(Qe(e,"\n")),"\n}")}function et(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return null!=t&&""!==t?e+t+n:""}function tt(e){return et(" ",e.replace(/\n/g,"\n "))}function nt(e){return-1!==e.indexOf("\n")}function rt(e){return null!=e&&e.some(nt)}var it="undefined"!=typeof Symbol&&"function"==typeof Symbol.for,ot=(it&&Symbol.for("INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER"),it?Symbol.for("INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER"):"@@INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER"),st=n(14),at=n.n(st),ut=n(17),ct=n(20),lt=function(){return(lt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},ft=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},dt=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},ht=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},pt=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},vt=new o.a("GraphQLAPI"),yt=function(){function e(e){this._api=null,this.Auth=ut.a,this.Cache=i.a,this.Credentials=s.a,this._options=e,vt.debug("API Options",this._options)}return e.prototype.getModuleName=function(){return"GraphQLAPI"},e.prototype.configure=function(e){var t=e||{},n=t.API,r=void 0===n?{}:n,i=ht(t,["API"]),o=lt(lt({},i),r);return vt.debug("configure GraphQL API",{opt:o}),o.aws_project_region&&(o=Object.assign({},o,{region:o.aws_project_region,header:{}})),void 0!==o.graphql_headers&&"function"!=typeof o.graphql_headers&&(vt.warn("graphql_headers should be a function"),o.graphql_headers=void 0),this._options=Object.assign({},this._options,o),this.createInstance(),this._options},e.prototype.createInstance=function(){return vt.debug("create Rest instance"),this._options?(this._api=new F(this._options),this._api.Credentials=this.Credentials,!0):Promise.reject("API not configured")},e.prototype._headerBasedAuth=function(e,t){return void 0===t&&(t={}),ft(this,void 0,void 0,(function(){var n,r,o,s,a,u,c,l;return dt(this,(function(f){switch(f.label){case 0:switch(n=this._options,r=n.aws_appsync_authenticationType,o=n.aws_appsync_apiKey,s={},e||r||"AWS_IAM"){case"API_KEY":return[3,1];case"AWS_IAM":return[3,2];case"OPENID_CONNECT":return[3,4];case"AMAZON_COGNITO_USER_POOLS":return[3,11];case"AWS_LAMBDA":return[3,15]}return[3,16];case 1:if(!o)throw new Error(ct.a.NO_API_KEY);return s={Authorization:null,"X-Api-Key":o},[3,17];case 2:return[4,this._ensureCredentials()];case 3:if(!f.sent())throw new Error(ct.a.NO_CREDENTIALS);return[3,17];case 4:return f.trys.push([4,9,,10]),a=void 0,[4,i.a.getItem("federatedInfo")];case 5:return(u=f.sent())?(a=u.token,[3,8]):[3,6];case 6:return[4,ut.a.currentAuthenticatedUser()];case 7:(c=f.sent())&&(a=c.token),f.label=8;case 8:if(!a)throw new Error(ct.a.NO_FEDERATED_JWT);return s={Authorization:a},[3,10];case 9:throw f.sent(),new Error(ct.a.NO_CURRENT_USER);case 10:return[3,17];case 11:return f.trys.push([11,13,,14]),[4,this.Auth.currentSession()];case 12:return l=f.sent(),s={Authorization:l.getAccessToken().getJwtToken()},[3,14];case 13:throw f.sent(),new Error(ct.a.NO_CURRENT_USER);case 14:return[3,17];case 15:if(!t.Authorization)throw new Error(ct.a.NO_AUTH_TOKEN);return s={Authorization:t.Authorization},[3,17];case 16:return s={Authorization:null},[3,17];case 17:return[2,s]}}))}))},e.prototype.getGraphqlOperationType=function(e){var t=ze(e).definitions;return pt(t,1)[0].operation},e.prototype.graphql=function(e,t){var n=e.query,r=e.variables,i=void 0===r?{}:r,o=e.authMode,s=e.authToken,a=e.userAgentSuffix,u=ze("string"==typeof n?n:Je(n)),c=pt(u.definitions.filter((function(e){return"OperationDefinition"===e.kind})),1)[0],l=(void 0===c?{}:c).operation,f=t||{};switch(s&&(f.Authorization=s),l){case"query":case"mutation":var d=this._api.getCancellableToken(),h={cancellableToken:d},p=this._graphql({query:u,variables:i,authMode:o,userAgentSuffix:a},f,h);return this._api.updateRequestToBeCancellable(p,d),p;case"subscription":return this._graphqlSubscribe({query:u,variables:i,authMode:o},f);default:throw new Error("invalid operation type: "+l)}},e.prototype._graphql=function(e,t,n){var r=e.query,i=e.variables,o=e.authMode,s=e.userAgentSuffix;return void 0===t&&(t={}),void 0===n&&(n={}),ft(this,void 0,void 0,(function(){var e,u,c,l,f,d,h,p,v,y,g,m,b,w,S,_,E,A,O,I,T;return dt(this,(function(C){switch(C.label){case 0:return this._api?[3,2]:[4,this.createInstance()];case 1:C.sent(),C.label=2;case 2:return e=this._options,u=e.aws_appsync_region,c=e.aws_appsync_graphqlEndpoint,l=e.graphql_headers,f=void 0===l?function(){return{}}:l,d=e.graphql_endpoint,h=e.graphql_endpoint_iam_region,v=[{}],(y=!d)?[4,this._headerBasedAuth(o,t)]:[3,4];case 3:y=C.sent(),C.label=4;case 4:return g=[lt.apply(void 0,v.concat([y]))],(m=d)?h?[4,this._headerBasedAuth(o,t)]:[3,6]:[3,8];case 5:return b=C.sent(),[3,7];case 6:b={Authorization:null},C.label=7;case 7:m=b,C.label=8;case 8:return w=[lt.apply(void 0,g.concat([m]))],[4,f({query:r,variables:i})];case 9:if(p=lt.apply(void 0,[lt.apply(void 0,[lt.apply(void 0,w.concat([C.sent()])),t]),!d&&(T={},T["x-amz-user-agent"]=Object(a.b)(s),T)]),S={query:Je(r),variables:i},_=Object.assign({headers:p,body:S,signerServiceInfo:{service:d?"execute-api":"appsync",region:d?h:u}},n),!(E=d||c))throw{data:{},errors:[new fe("No graphql endpoint provided.")]};C.label=10;case 10:return C.trys.push([10,12,,13]),[4,this._api.post(E,_)];case 11:return A=C.sent(),[3,13];case 12:if(O=C.sent(),this._api.isCancel(O))throw O;return A={data:{},errors:[new fe(O.message,null,null,null,null,O)]},[3,13];case 13:if((I=A.errors)&&I.length)throw A;return[2,A]}}))}))},e.prototype.isCancel=function(e){return this._api.isCancel(e)},e.prototype.cancel=function(e,t){return this._api.cancel(e,t)},e.prototype.hasCancelToken=function(e){return this._api.hasCancelToken(e)},e.prototype._graphqlSubscribe=function(e,t){var n=e.query,r=e.variables,i=e.authMode,o=e.authToken;void 0===t&&(t={});var s=this._options,a=s.aws_appsync_region,u=s.aws_appsync_graphqlEndpoint,c=s.aws_appsync_authenticationType,l=s.aws_appsync_apiKey,f=s.graphql_headers,d=void 0===f?function(){return{}}:f,h=i||c||"AWS_IAM";if(at.a&&"function"==typeof at.a.subscribe)return at.a.subscribe("",{provider:ot,appSyncGraphqlEndpoint:u,authenticationType:h,apiKey:l,query:Je(n),region:a,variables:r,graphql_headers:d,additionalHeaders:t,authToken:o});throw vt.debug("No pubsub module applied for subscription"),new Error("No pubsub module applied for subscription")},e.prototype._ensureCredentials=function(){var e=this;return this.Credentials.get().then((function(t){if(!t)return!1;var n=e.Credentials.shear(t);return vt.debug("set credentials for api",n),!0})).catch((function(e){return vt.warn("ensure credentials error",e),!1}))},e}(),gt=new yt(null);L.a.register(gt);var mt=function(){return(mt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},bt=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},wt=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},St=new o.a("API"),_t=new(function(){function e(e){this.Auth=r.a,this.Cache=i.a,this.Credentials=s.a,this._options=e,this._restApi=new V(e),this._graphqlApi=new yt(e),St.debug("API Options",this._options)}return e.prototype.getModuleName=function(){return"API"},e.prototype.configure=function(e){this._options=Object.assign({},this._options,e),this._restApi.Credentials=this.Credentials,this._graphqlApi.Auth=this.Auth,this._graphqlApi.Cache=this.Cache,this._graphqlApi.Credentials=this.Credentials;var t=this._restApi.configure(this._options),n=this._graphqlApi.configure(this._options);return mt(mt({},t),n)},e.prototype.get=function(e,t,n){return this._restApi.get(e,t,n)},e.prototype.post=function(e,t,n){return this._restApi.post(e,t,n)},e.prototype.put=function(e,t,n){return this._restApi.put(e,t,n)},e.prototype.patch=function(e,t,n){return this._restApi.patch(e,t,n)},e.prototype.del=function(e,t,n){return this._restApi.del(e,t,n)},e.prototype.head=function(e,t,n){return this._restApi.head(e,t,n)},e.prototype.isCancel=function(e){return this._restApi.isCancel(e)},e.prototype.cancel=function(e,t){return this._restApi.hasCancelToken(e)?this._restApi.cancel(e,t):!!this._graphqlApi.hasCancelToken(e)&&this._graphqlApi.cancel(e,t)},e.prototype.endpoint=function(e){return bt(this,void 0,void 0,(function(){return wt(this,(function(t){return[2,this._restApi.endpoint(e)]}))}))},e.prototype.getGraphqlOperationType=function(e){return this._graphqlApi.getGraphqlOperationType(e)},e.prototype.graphql=function(e,t){return this._graphqlApi.graphql(e,t)},e}())(null);L.a.register(_t);t.a=_t},function(e,t,n){"use strict";var r=n(39),i={keyPrefix:"aws-amplify-cache",capacityInBytes:1048576,itemMaxSize:21e4,defaultTTL:2592e5,defaultPriority:5,warningThreshold:.8,storage:(new(n(67).a)).getStorage()};function o(e){var t=0;t=e.length;for(var n=e.length;n>=0;n-=1){var r=e.charCodeAt(n);r>127&&r<=2047?t+=1:r>2047&&r<=65535&&(t+=2),r>=56320&&r<=57343&&(n-=1)}return t}function s(){return(new Date).getTime()}function a(e){return Number.isInteger?Number.isInteger(e):function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}(e)}var u={},c=(function(){function e(){}e.clear=function(){u={}},e.getItem=function(e){return u[e]||null},e.setItem=function(e,t){u[e]=t},e.removeItem=function(e){delete u[e]}}(),n(21));function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var f,d=new c.a("StorageCache"),h=function(){function e(e){this.config=Object.assign({},e),this.cacheCurSizeKey=this.config.keyPrefix+"CurSize",this.checkConfig()}return e.prototype.getModuleName=function(){return"Cache"},e.prototype.checkConfig=function(){a(this.config.capacityInBytes)||(d.error("Invalid parameter: capacityInBytes. It should be an Integer. Setting back to default."),this.config.capacityInBytes=i.capacityInBytes),a(this.config.itemMaxSize)||(d.error("Invalid parameter: itemMaxSize. It should be an Integer. Setting back to default."),this.config.itemMaxSize=i.itemMaxSize),a(this.config.defaultTTL)||(d.error("Invalid parameter: defaultTTL. It should be an Integer. Setting back to default."),this.config.defaultTTL=i.defaultTTL),a(this.config.defaultPriority)||(d.error("Invalid parameter: defaultPriority. It should be an Integer. Setting back to default."),this.config.defaultPriority=i.defaultPriority),this.config.itemMaxSize>this.config.capacityInBytes&&(d.error("Invalid parameter: itemMaxSize. It should be smaller than capacityInBytes. Setting back to default."),this.config.itemMaxSize=i.itemMaxSize),(this.config.defaultPriority>5||this.config.defaultPriority<1)&&(d.error("Invalid parameter: defaultPriority. It should be between 1 and 5. Setting back to default."),this.config.defaultPriority=i.defaultPriority),(Number(this.config.warningThreshold)>1||Number(this.config.warningThreshold)<0)&&(d.error("Invalid parameter: warningThreshold. It should be between 0 and 1. Setting back to default."),this.config.warningThreshold=i.warningThreshold);this.config.capacityInBytes>5242880&&(d.error("Cache Capacity should be less than 5MB. Setting back to default. Setting back to default."),this.config.capacityInBytes=i.capacityInBytes)},e.prototype.fillCacheItem=function(e,t,n){var r={key:e,data:t,timestamp:s(),visitedTime:s(),priority:n.priority,expires:n.expires,type:l(t),byteSize:0};return r.byteSize=o(JSON.stringify(r)),r.byteSize=o(JSON.stringify(r)),r},e.prototype.configure=function(e){return e?(e.keyPrefix&&d.warn("Don't try to configure keyPrefix!"),this.config=Object.assign({},this.config,e,e.Cache),this.checkConfig(),this.config):this.config},e}(),p=(f=function(e,t){return(f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}f(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),v=new c.a("Cache"),y=new(function(e){function t(t){var n=this,r=t?Object.assign({},i,t):i;return(n=e.call(this,r)||this).config.storage=r.storage,n.getItem=n.getItem.bind(n),n.setItem=n.setItem.bind(n),n.removeItem=n.removeItem.bind(n),n}return p(t,e),t.prototype._decreaseCurSizeInBytes=function(e){var t=this.getCacheCurSize();this.config.storage.setItem(this.cacheCurSizeKey,(t-e).toString())},t.prototype._increaseCurSizeInBytes=function(e){var t=this.getCacheCurSize();this.config.storage.setItem(this.cacheCurSizeKey,(t+e).toString())},t.prototype._refreshItem=function(e,t){return e.visitedTime=s(),this.config.storage.setItem(t,JSON.stringify(e)),e},t.prototype._isExpired=function(e){var t=this.config.storage.getItem(e),n=JSON.parse(t);return s()>=n.expires},t.prototype._removeItem=function(e,t){var n=t||JSON.parse(this.config.storage.getItem(e)).byteSize;this._decreaseCurSizeInBytes(n),this.config.storage.removeItem(e)},t.prototype._setItem=function(e,t){this._increaseCurSizeInBytes(t.byteSize);try{this.config.storage.setItem(e,JSON.stringify(t))}catch(e){this._decreaseCurSizeInBytes(t.byteSize),v.error("Failed to set item "+e)}},t.prototype._sizeToPop=function(e){var t=this.getCacheCurSize()+e-this.config.capacityInBytes,n=(1-this.config.warningThreshold)*this.config.capacityInBytes;return t>n?t:n},t.prototype._isCacheFull=function(e){return e+this.getCacheCurSize()>this.config.capacityInBytes},t.prototype._findValidKeys=function(){for(var e=[],t=[],n=0;n<this.config.storage.length;n+=1)t.push(this.config.storage.key(n));for(n=0;n<t.length;n+=1){var r=t[n];0===r.indexOf(this.config.keyPrefix)&&r!==this.cacheCurSizeKey&&(this._isExpired(r)?this._removeItem(r):e.push(r))}return e},t.prototype._popOutItems=function(e,t){for(var n=[],r=t,i=0;i<e.length;i+=1){var o=this.config.storage.getItem(e[i]);if(null!=o){var s=JSON.parse(o);n.push(s)}}n.sort((function(e,t){return e.priority>t.priority?-1:e.priority<t.priority?1:e.visitedTime<t.visitedTime?-1:1}));for(i=0;i<n.length;i+=1)if(this._removeItem(n[i].key,n[i].byteSize),(r-=n[i].byteSize)<=0)return},t.prototype.setItem=function(e,t,n){v.log("Set item: key is "+e+", value is "+t+" with options: "+n);var r=this.config.keyPrefix+e;if(r!==this.config.keyPrefix&&r!==this.cacheCurSizeKey)if(void 0!==t){var i={priority:n&&void 0!==n.priority?n.priority:this.config.defaultPriority,expires:n&&void 0!==n.expires?n.expires:this.config.defaultTTL+s()};if(i.priority<1||i.priority>5)v.warn("Invalid parameter: priority due to out or range. It should be within 1 and 5.");else{var o=this.fillCacheItem(r,t,i);if(o.byteSize>this.config.itemMaxSize)v.warn("Item with key: "+e+" you are trying to put into is too big!");else try{var a=this.config.storage.getItem(r);if(a&&this._removeItem(r,JSON.parse(a).byteSize),this._isCacheFull(o.byteSize)){var u=this._findValidKeys();if(this._isCacheFull(o.byteSize)){var c=this._sizeToPop(o.byteSize);this._popOutItems(u,c)}}this._setItem(r,o)}catch(e){v.warn("setItem failed! "+e)}}}else v.warn("The value of item should not be undefined!");else v.warn("Invalid key: should not be empty or 'CurSize'")},t.prototype.getItem=function(e,t){v.log("Get item: key is "+e+" with options "+t);var n=null,r=this.config.keyPrefix+e;if(r===this.config.keyPrefix||r===this.cacheCurSizeKey)return v.warn("Invalid key: should not be empty or 'CurSize'"),null;try{if(null!=(n=this.config.storage.getItem(r))){if(!this._isExpired(r)){var i=JSON.parse(n);return(i=this._refreshItem(i,r)).data}this._removeItem(r,JSON.parse(n).byteSize),n=null}if(t&&void 0!==t.callback){var o=t.callback();return null!==o&&this.setItem(e,o,t),o}return null}catch(e){return v.warn("getItem failed! "+e),null}},t.prototype.removeItem=function(e){v.log("Remove item: key is "+e);var t=this.config.keyPrefix+e;if(t!==this.config.keyPrefix&&t!==this.cacheCurSizeKey)try{var n=this.config.storage.getItem(t);n&&this._removeItem(t,JSON.parse(n).byteSize)}catch(e){v.warn("removeItem failed! "+e)}},t.prototype.clear=function(){v.log("Clear Cache");for(var e=[],t=0;t<this.config.storage.length;t+=1){var n=this.config.storage.key(t);0===n.indexOf(this.config.keyPrefix)&&e.push(n)}try{for(t=0;t<e.length;t+=1)this.config.storage.removeItem(e[t])}catch(e){v.warn("clear failed! "+e)}},t.prototype.getAllKeys=function(){for(var e=[],t=0;t<this.config.storage.length;t+=1){var n=this.config.storage.key(t);0===n.indexOf(this.config.keyPrefix)&&n!==this.cacheCurSizeKey&&e.push(n.substring(this.config.keyPrefix.length))}return e},t.prototype.getCacheCurSize=function(){var e=this.config.storage.getItem(this.cacheCurSizeKey);return e||(this.config.storage.setItem(this.cacheCurSizeKey,"0"),e="0"),Number(e)},t.prototype.createInstance=function(e){return e.keyPrefix&&e.keyPrefix!==i.keyPrefix||(v.error("invalid keyPrefix, setting keyPrefix with timeStamp"),e.keyPrefix=s.toString()),new t(e)},t}(h));t.a=y;r.a.register(y)},function(e,t,n){"use strict";var r;n.d(t,"a",(function(){return r})),function(e){e.NO_API_KEY="No api-key configured",e.NO_CURRENT_USER="No current user",e.NO_CREDENTIALS="No credentials",e.NO_FEDERATED_JWT="No federated jwt",e.NO_AUTH_TOKEN="No auth token specified"}(r||(r={}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var r,i=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},s=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(o(arguments[t]));return e},a={VERBOSE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5};!function(e){e.DEBUG="DEBUG",e.ERROR="ERROR",e.INFO="INFO",e.WARN="WARN",e.VERBOSE="VERBOSE"}(r||(r={}));var u=function(){function e(e,t){void 0===t&&(t=r.WARN),this.name=e,this.level=t,this._pluggables=[]}return e.prototype._padding=function(e){return e<10?"0"+e:""+e},e.prototype._ts=function(){var e=new Date;return[this._padding(e.getMinutes()),this._padding(e.getSeconds())].join(":")+"."+e.getMilliseconds()},e.prototype.configure=function(e){return e?(this._config=e,this._config):this._config},e.prototype._log=function(t){for(var n,o,s=[],u=1;u<arguments.length;u++)s[u-1]=arguments[u];var c=this.level;e.LOG_LEVEL&&(c=e.LOG_LEVEL),"undefined"!=typeof window&&window.LOG_LEVEL&&(c=window.LOG_LEVEL);var l=a[c],f=a[t];if(f>=l){var d=console.log.bind(console);t===r.ERROR&&console.error&&(d=console.error.bind(console)),t===r.WARN&&console.warn&&(d=console.warn.bind(console));var h="["+t+"] "+this._ts()+" "+this.name,p="";if(1===s.length&&"string"==typeof s[0])d(p=h+" - "+s[0]);else if(1===s.length)p=h+" "+s[0],d(h,s[0]);else if("string"==typeof s[0]){var v=s.slice(1);1===v.length&&(v=v[0]),p=h+" - "+s[0]+" "+v,d(h+" - "+s[0],v)}else p=h+" "+s,d(h,s);try{for(var y=i(this._pluggables),g=y.next();!g.done;g=y.next()){var m=g.value,b={message:p,timestamp:Date.now()};m.pushLogs([b])}}catch(e){n={error:e}}finally{try{g&&!g.done&&(o=y.return)&&o.call(y)}finally{if(n)throw n.error}}}},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,s([r.INFO],e))},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,s([r.INFO],e))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,s([r.WARN],e))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,s([r.ERROR],e))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,s([r.DEBUG],e))},e.prototype.verbose=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,s([r.VERBOSE],e))},e.prototype.addPluggable=function(e){e&&"Logging"===e.getCategoryName()&&(this._pluggables.push(e),e.configure(this._config))},e.prototype.listPluggables=function(){return this._pluggables},e.LOG_LEVEL=null,e}()},,function(e,t,n){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"b",(function(){return h})),n.d(t,"c",(function(){return p}));var r=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},i=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(r(arguments[t]));return e},o=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},s=function(e){return/^Connection failed: Connection Timeout/.test(e.message)},a=function(e){return/^Error: Request failed with status code 5\d\d/.test(e.message)},u={BadModel:function(){return!1},BadRecord:function(e){var t=e.message;return/^Cannot return \w+ for [\w-_]+ type/.test(t)||/^Variable '.+' has coerced Null value for NonNull type/.test(t)},ConfigError:function(){return!1},Transient:function(e){return s(e)||a(e)},Unauthorized:function(e){return/^Request failed with status code 401/.test(e.message)}},c={BadModel:function(){return!1},BadRecord:function(){return!1},ConfigError:function(){return!1},Transient:function(e){var t=f(e);return s(t)||a(t)},Unauthorized:function(e){var t=f(e);return/Connection failed.+Unauthorized/.test(t.message)}},l={BadModel:function(){return!1},BadRecord:function(e){return/^Cannot return \w+ for [\w-_]+ type/.test(e.message)},ConfigError:function(){return!1},Transient:function(e){return s(e)||a(e)},Unauthorized:function(){return!1}};function f(e){var t=e.error;return r((void 0===t?{errors:[]}:t).errors,1)[0]}function d(e){return v(u,e)}function h(e){return v(c,e)}function p(e){return v(l,e)}function v(e,t){var n,r,s=i(Object.keys(e));try{for(var a=o(s),u=a.next();!u.done;u=a.next()){var c=u.value;if((0,e[c])(t))return c}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return"Unknown"}},function(e,t,n){var r;e.exports=(r=n(12),n(38),n(89),r.HmacSHA256)},function(e,t,n){"use strict";
51
51
  /*!
52
52
  * cookie
53
53
  * Copyright(c) 2012-2014 Roman Shtylman
@@ -60,7 +60,7 @@ var Z=function(){function e(e,t){var n=e||{},r=n.UserPoolId,i=n.ClientId,o=n.end
60
60
  *
61
61
  * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
62
62
  * Released under the MIT license
63
- */!function(o){if(void 0===(i="function"==typeof(r=o)?r.call(t,n,t,e):r)||(e.exports=i),!0,e.exports=o(),!!0){var s=window.Cookies,a=window.Cookies=o();a.noConflict=function(){return window.Cookies=s,a}}}((function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function i(){}function o(t,n,o){if("undefined"!=typeof document){"number"==typeof(o=e({path:"/"},i.defaults,o)).expires&&(o.expires=new Date(1*new Date+864e5*o.expires)),o.expires=o.expires?o.expires.toUTCString():"";try{var s=JSON.stringify(n);/^[\{\[]/.test(s)&&(n=s)}catch(e){}n=r.write?r.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var a="";for(var u in o)o[u]&&(a+="; "+u,!0!==o[u]&&(a+="="+o[u].split(";")[0]));return document.cookie=t+"="+n+a}}function s(e,n){if("undefined"!=typeof document){for(var i={},o=document.cookie?document.cookie.split("; "):[],s=0;s<o.length;s++){var a=o[s].split("="),u=a.slice(1).join("=");n||'"'!==u.charAt(0)||(u=u.slice(1,-1));try{var c=t(a[0]);if(u=(r.read||r)(u,c)||t(u),n)try{u=JSON.parse(u)}catch(e){}if(i[c]=u,e===c)break}catch(e){}}return e?i[e]:i}}return i.set=o,i.get=function(e){return s(e,!1)},i.getJSON=function(e){return s(e,!0)},i.remove=function(t,n){o(t,"",e(n,{expires:-1}))},i.defaults={},i.withConverter=n,i}((function(){}))}))},function(e,t,n){e.exports=n(106)},function(e,t,n){"use strict";(function(t){var r=n(12),i=n(111),o=n(54),s={"Content-Type":"application/x-www-form-urlencoded"};function a(e,t){!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var u,c={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==t&&"[object process]"===Object.prototype.toString.call(t))&&(u=n(55)),u),transformRequest:[function(e,t){return i(t,"Accept"),i(t,"Content-Type"),r.isFormData(e)||r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e)?e:r.isArrayBufferView(e)?e.buffer:r.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):r.isObject(e)||t&&"application/json"===t["Content-Type"]?(a(t,"application/json"),function(e,t,n){if(r.isString(e))try{return(t||JSON.parse)(e),r.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||c.transitional,n=t&&t.silentJSONParsing,i=t&&t.forcedJSONParsing,s=!n&&"json"===this.responseType;if(s||i&&r.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(s){if("SyntaxError"===e.name)throw o(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],(function(e){c.headers[e]={}})),r.forEach(["post","put","patch"],(function(e){c.headers[e]=r.merge(s)})),e.exports=c}).call(this,n(44))},function(e,t,n){"use strict";function r(e){this.message=e}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,e.exports=r},function(e,t,n){var r=n(73),i=n(74),o=i;o.v1=r,o.v4=i,e.exports=o},function(e,t,n){"use strict";n.d(t,"a",(function(){return F}));var r=n(0),i=n(3),o=n(21),s=n(68),a=n(132),u=new o.a("Parser"),c=function(e){var t,n={};if(e.aws_mobile_analytics_app_id){var i={AWSPinpoint:{appId:e.aws_mobile_analytics_app_id,region:e.aws_mobile_analytics_app_region}};n.Analytics=i}return(e.aws_cognito_identity_pool_id||e.aws_user_pools_id)&&(n.Auth={userPoolId:e.aws_user_pools_id,userPoolWebClientId:e.aws_user_pools_web_client_id,region:e.aws_cognito_region,identityPoolId:e.aws_cognito_identity_pool_id,identityPoolRegion:e.aws_cognito_region,mandatorySignIn:"enable"===e.aws_mandatory_sign_in,signUpVerificationMethod:e.aws_cognito_sign_up_verification_method||"code"}),t=e.aws_user_files_s3_bucket?{AWSS3:{bucket:e.aws_user_files_s3_bucket,region:e.aws_user_files_s3_bucket_region,dangerouslyConnectToHttpEndpointForTesting:e.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing}}:e?e.Storage||e:{},e.Logging&&(n.Logging=Object(r.__assign)(Object(r.__assign)({},e.Logging),{region:e.aws_project_region})),e.geo&&(n.Geo=Object.assign({},e.geo),e.geo.amazon_location_service&&(n.Geo={AmazonLocationService:e.geo.amazon_location_service})),n.Analytics=Object.assign({},n.Analytics,e.Analytics),n.Auth=Object.assign({},n.Auth,e.Auth),n.Storage=Object.assign({},t),n.Logging=Object.assign({},n.Logging,e.Logging),u.debug("parse config",e,"to amplifyconfig",n),n},l=function(){function e(){}return e.parseMobilehubConfig=c,e}(),f=n(24);function d(e,t){void 0===t&&(t={});var n=function(e){if(e&&"j"===e[0]&&":"===e[1])return e.substr(2);return e}(e);if(function(e,t){return void 0===t&&(t=!e||"{"!==e[0]&&"["!==e[0]&&'"'!==e[0]),!t}(n,t.doNotParse))try{return JSON.parse(n)}catch(e){}return e}var h=function(){return(h=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},p=function(){function e(e,t){var n=this;this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.cookies=function(e,t){return"string"==typeof e?f.parse(e,t):"object"==typeof e&&null!==e?e:{}}(e,t),new Promise((function(){n.HAS_DOCUMENT_COOKIE="object"==typeof document&&"string"==typeof document.cookie})).catch((function(){}))}return e.prototype._updateBrowserValues=function(e){this.HAS_DOCUMENT_COOKIE&&(this.cookies=f.parse(document.cookie,e))},e.prototype._emitChange=function(e){for(var t=0;t<this.changeListeners.length;++t)this.changeListeners[t](e)},e.prototype.get=function(e,t,n){return void 0===t&&(t={}),this._updateBrowserValues(n),d(this.cookies[e],t)},e.prototype.getAll=function(e,t){void 0===e&&(e={}),this._updateBrowserValues(t);var n={};for(var r in this.cookies)n[r]=d(this.cookies[r],e);return n},e.prototype.set=function(e,t,n){var r;"object"==typeof t&&(t=JSON.stringify(t)),this.cookies=h(h({},this.cookies),((r={})[e]=t,r)),this.HAS_DOCUMENT_COOKIE&&(document.cookie=f.serialize(e,t,n)),this._emitChange({name:e,value:t,options:n})},e.prototype.remove=function(e,t){var n=t=h(h({},t),{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=h({},this.cookies),delete this.cookies[e],this.HAS_DOCUMENT_COOKIE&&(document.cookie=f.serialize(e,"",n)),this._emitChange({name:e,value:void 0,options:t})},e.prototype.addChangeListener=function(e){this.changeListeners.push(e)},e.prototype.removeChangeListener=function(e){var t=this.changeListeners.indexOf(e);t>=0&&this.changeListeners.splice(t,1)},e}(),v=n(16),g=Object(v.b)().isBrowser,y=function(){function e(e){void 0===e&&(e={}),this.cookies=new p,this.store=g?window.localStorage:Object.create(null),this.cookies=e.req?new p(e.req.headers.cookie):new p,Object.assign(this.store,this.cookies.getAll())}return Object.defineProperty(e.prototype,"length",{get:function(){return Object.entries(this.store).length},enumerable:!0,configurable:!0}),e.prototype.clear=function(){var e=this;Array.from(new Array(this.length)).map((function(t,n){return e.key(n)})).forEach((function(t){return e.removeItem(t)}))},e.prototype.getItem=function(e){return this.getLocalItem(e)},e.prototype.getLocalItem=function(e){return Object.prototype.hasOwnProperty.call(this.store,e)?this.store[e]:null},e.prototype.getUniversalItem=function(e){return this.cookies.get(e)},e.prototype.key=function(e){return Object.keys(this.store)[e]},e.prototype.removeItem=function(e){this.removeLocalItem(e),this.removeUniversalItem(e)},e.prototype.removeLocalItem=function(e){delete this.store[e]},e.prototype.removeUniversalItem=function(e){this.cookies.remove(e,{path:"/"})},e.prototype.setItem=function(e,t){switch(this.setLocalItem(e,t),e.split(".").pop()){case"LastAuthUser":case"accessToken":case"refreshToken":case"idToken":g?this.setUniversalItem(e,t):this.setLocalItem(e,t)}},e.prototype.setLocalItem=function(e,t){this.store[e]=t},e.prototype.setUniversalItem=function(e,t){this.cookies.set(e,t,{path:"/",sameSite:!0,secure:"localhost"!==window.location.hostname})},e}(),m=n(60);var b=n(37),_=n(8),w=n(9),S=function(e){var t=window.open(e,"_self");return t?Promise.resolve(t):Promise.reject()},O=n(6),E=n(13),A="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",I=function(e,t,n){s.a.dispatch("auth",{event:e,data:t,message:n},"Auth",A)},T=new o.a("OAuth"),C=function(){function e(e){var t=e.config,n=e.cognitoClientId,r=e.scopes,i=void 0===r?[]:r;if(this._urlOpener=t.urlOpener||S,this._config=t,this._cognitoClientId=n,!this.isValidScopes(i))throw Error("scopes must be a String Array");this._scopes=i}return e.prototype.isValidScopes=function(e){return Array.isArray(e)&&e.every((function(e){return"string"==typeof e}))},e.prototype.oauthSignIn=function(e,t,n,o,s,a){void 0===e&&(e="code"),void 0===s&&(s=i.b.Cognito);var u=this._generateState(32),c=a?u+"-"+a.split("").map((function(e){return e.charCodeAt(0).toString(16).padStart(2,"0")})).join(""):u;!function(e){window.sessionStorage.setItem("oauth_state",e)}(c);var l,f=this._generateRandom(128);l=f,window.sessionStorage.setItem("ouath_pkce_key",l);var d=this._generateChallenge(f),h=this._scopes.join(" "),p="https://"+t+"/oauth2/authorize?"+Object.entries(Object(r.__assign)(Object(r.__assign)({redirect_uri:n,response_type:e,client_id:o,identity_provider:s,scope:h,state:c},"code"===e?{code_challenge:d}:{}),"code"===e?{code_challenge_method:"S256"}:{})).map((function(e){var t=Object(r.__read)(e,2),n=t[0],i=t[1];return encodeURIComponent(n)+"="+encodeURIComponent(i)})).join("&");T.debug("Redirecting to "+p),this._urlOpener(p,n)},e.prototype._handleCodeFlow=function(e){return Object(r.__awaiter)(this,void 0,void 0,(function(){var t,n,o,s,a,u,c,l,f,d,h,p,v,g;return Object(r.__generator)(this,(function(y){switch(y.label){case 0:return t=(Object(w.parse)(e).query||"").split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n,i=Object(r.__read)(t,2),o=i[0],s=i[1];return Object(r.__assign)(Object(r.__assign)({},e),((n={})[o]=s,n))}),{code:void 0}).code,n=Object(w.parse)(e).pathname||"/",o=Object(w.parse)(this._config.redirectSignIn).pathname||"/",t&&n===o?(s="https://"+this._config.domain+"/oauth2/token",I("codeFlow",{},"Retrieving tokens from "+s),a=Object(i.e)(this._config)?this._cognitoClientId:this._config.clientID,u=Object(i.e)(this._config)?this._config.redirectSignIn:this._config.redirectUri,m=window.sessionStorage.getItem("ouath_pkce_key"),window.sessionStorage.removeItem("ouath_pkce_key"),c=m,l=Object(r.__assign)({grant_type:"authorization_code",code:t,client_id:a,redirect_uri:u},c?{code_verifier:c}:{}),T.debug("Calling token endpoint: "+s+" with",l),f=Object.entries(l).map((function(e){var t=Object(r.__read)(e,2),n=t[0],i=t[1];return encodeURIComponent(n)+"="+encodeURIComponent(i)})).join("&"),[4,fetch(s,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:f})]):[2];case 1:return[4,y.sent().json()];case 2:if(d=y.sent(),h=d.access_token,p=d.refresh_token,v=d.id_token,g=d.error)throw new Error(g);return[2,{accessToken:h,refreshToken:p,idToken:v}]}var m}))}))},e.prototype._handleImplicitFlow=function(e){return Object(r.__awaiter)(this,void 0,void 0,(function(){var t,n,i;return Object(r.__generator)(this,(function(o){return t=(Object(w.parse)(e).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n,i=Object(r.__read)(t,2),o=i[0],s=i[1];return Object(r.__assign)(Object(r.__assign)({},e),((n={})[o]=s,n))}),{id_token:void 0,access_token:void 0}),n=t.id_token,i=t.access_token,I("implicitFlow",{},"Got tokens from "+e),T.debug("Retrieving implicit tokens from "+e+" with"),[2,{accessToken:i,idToken:n,refreshToken:null}]}))}))},e.prototype.handleAuthResponse=function(e){return Object(r.__awaiter)(this,void 0,void 0,(function(){var t,n,i,o,s,a,u;return Object(r.__generator)(this,(function(c){switch(c.label){case 0:if(c.trys.push([0,5,,6]),t=e?Object(r.__assign)(Object(r.__assign)({},(Object(w.parse)(e).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n=Object(r.__read)(t,2),i=n[0],o=n[1];return e[i]=o,e}),{})),(Object(w.parse)(e).query||"").split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n=Object(r.__read)(t,2),i=n[0],o=n[1];return e[i]=o,e}),{})):{},n=t.error,i=t.error_description,n)throw new Error(i);return o=this._validateState(t),T.debug("Starting "+this._config.responseType+" flow with "+e),"code"!==this._config.responseType?[3,2]:(s=[{}],[4,this._handleCodeFlow(e)]);case 1:return[2,r.__assign.apply(void 0,[r.__assign.apply(void 0,s.concat([c.sent()])),{state:o}])];case 2:return a=[{}],[4,this._handleImplicitFlow(e)];case 3:return[2,r.__assign.apply(void 0,[r.__assign.apply(void 0,a.concat([c.sent()])),{state:o}])];case 4:return[3,6];case 5:throw u=c.sent(),T.error("Error handling auth response.",u),u;case 6:return[2]}}))}))},e.prototype._validateState=function(e){if(e){var t,n=(t=window.sessionStorage.getItem("oauth_state"),window.sessionStorage.removeItem("oauth_state"),t),r=e.state;if(n&&n!==r)throw new Error("Invalid state in OAuth flow");return r}},e.prototype.signOut=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){var e,t,n;return Object(r.__generator)(this,(function(o){return e="https://"+this._config.domain+"/logout?",t=Object(i.e)(this._config)?this._cognitoClientId:this._config.oauth.clientID,n=Object(i.e)(this._config)?this._config.redirectSignOut:this._config.returnTo,e+=Object.entries({client_id:t,logout_uri:encodeURIComponent(n)}).map((function(e){var t=Object(r.__read)(e,2);return t[0]+"="+t[1]})).join("&"),I("oAuthSignOut",{oAuth:"signOut"},"Signing out from "+e),T.debug("Signing out from "+e),[2,this._urlOpener(e,n)]}))}))},e.prototype._generateState=function(e){for(var t="",n=e,r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";n>0;--n)t+=r[Math.round(Math.random()*(r.length-1))];return t},e.prototype._generateChallenge=function(e){var t=new E.Sha256;t.update(e);var n=t.digestSync(),r=O.Buffer.from(n).toString("base64");return this._base64URL(r)},e.prototype._base64URL=function(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},e.prototype._generateRandom=function(e){var t=new Uint8Array(e);if("undefined"!=typeof window&&window.crypto)window.crypto.getRandomValues(t);else for(var n=0;n<e;n+=1)t[n]=Math.random()*"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~".length|0;return this._bufferToString(t)},e.prototype._bufferToString=function(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=[],r=0;r<e.byteLength;r+=1){var i=e[r]%t.length;n.push(t[i])}return n.join("")},e}(),j=n(11),P=new o.a("AuthError"),x=function(e){function t(n){var r=this,i=k[n],o=i.message,s=i.log;return(r=e.call(this,o)||this).constructor=t,Object.setPrototypeOf(r,t.prototype),r.name="AuthError",r.log=s||o,P.error(r.log),r}return Object(r.__extends)(t,e),t}(Error),N=function(e){function t(n){var r=e.call(this,n)||this;return r.constructor=t,Object.setPrototypeOf(r,t.prototype),r.name="NoUserPoolError",r}return Object(r.__extends)(t,e),t}(x),k={noConfig:{message:j.a.DEFAULT_MSG,log:"\n Error: Amplify has not been configured correctly.\n This error is typically caused by one of the following scenarios:\n\n 1. Make sure you're passing the awsconfig object to Amplify.configure() in your app's entry point\n See https://aws-amplify.github.io/docs/js/authentication#configure-your-app for more information\n \n 2. There might be multiple conflicting versions of amplify packages in your node_modules.\n\t\t\t\tRefer to our docs site for help upgrading Amplify packages (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js)\n "},missingAuthConfig:{message:j.a.DEFAULT_MSG,log:"\n Error: Amplify has not been configured correctly. \n The configuration object is missing required auth properties.\n This error is typically caused by one of the following scenarios:\n\n 1. Did you run `amplify push` after adding auth via `amplify add auth`?\n See https://aws-amplify.github.io/docs/js/authentication#amplify-project-setup for more information\n\n 2. This could also be caused by multiple conflicting versions of amplify packages, see (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js) for help upgrading Amplify packages.\n "},emptyUsername:{message:j.a.EMPTY_USERNAME},invalidUsername:{message:j.a.INVALID_USERNAME},emptyPassword:{message:j.a.EMPTY_PASSWORD},emptyCode:{message:j.a.EMPTY_CODE},signUpError:{message:j.a.SIGN_UP_ERROR,log:"The first parameter should either be non-null string or object"},noMFA:{message:j.a.NO_MFA},invalidMFA:{message:j.a.INVALID_MFA},emptyChallengeResponse:{message:j.a.EMPTY_CHALLENGE},noUserSession:{message:j.a.NO_USER_SESSION},deviceConfig:{message:j.a.DEVICE_CONFIG},networkError:{message:j.a.NETWORK_ERROR},autoSignInError:{message:j.a.AUTOSIGNIN_ERROR},default:{message:j.a.DEFAULT_MSG}};function M(e){return(M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var R=new o.a("AuthClass"),D="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",U=function(e,t,n){s.a.dispatch("auth",{event:e,data:t,message:n},"Auth",D)},F=new(function(){function e(e){var t=this;this.userPool=null,this.user=null,this.oAuthFlowInProgress=!1,this.autoSignInInitiated=!1,this.Credentials=a.a,this.wrapRefreshSessionCallback=function(e){return function(t,n){return n?U("tokenRefresh",void 0,"New token retrieved"):U("tokenRefresh_failure",t,"Failed to retrieve new token"),e(t,n)}},this.configure(e),this.currentCredentials=this.currentCredentials.bind(this),this.currentUserCredentials=this.currentUserCredentials.bind(this),s.a.listen("auth",(function(e){switch(e.payload.event){case"signIn":t._storage.setItem("amplify-signin-with-hostedUI","false");break;case"signOut":t._storage.removeItem("amplify-signin-with-hostedUI");break;case"cognitoHostedUI":t._storage.setItem("amplify-signin-with-hostedUI","true")}}))}return e.prototype.getModuleName=function(){return"Auth"},e.prototype.configure=function(e){var t=this;if(!e)return this._config||{};R.debug("configure Auth");var n=Object.assign({},this._config,l.parseMobilehubConfig(e).Auth,e);this._config=n;var r=this._config,o=r.userPoolId,s=r.userPoolWebClientId,a=r.cookieStorage,u=r.oauth,c=r.region,f=r.identityPoolId,d=r.mandatorySignIn,h=r.refreshHandlers,p=r.identityPoolRegion,g=r.clientMetadata,b=r.endpoint;if(this._config.storage){if(!this._isValidAuthStorage(this._config.storage))throw R.error("The storage in the Auth config is not valid!"),new Error("Empty storage object");this._storage=this._config.storage}else this._storage=a?new _.i(a):e.ssr?new y:(new m.a).getStorage();if(this._storageSync=Promise.resolve(),"function"==typeof this._storage.sync&&(this._storageSync=this._storage.sync()),o){var w={UserPoolId:o,ClientId:s,endpoint:b};w.Storage=this._storage,this.userPool=new _.g(w,this.wrapRefreshSessionCallback)}this.Credentials.configure({mandatorySignIn:d,region:p||c,userPoolId:o,identityPoolId:f,refreshHandlers:h,storage:this._storage});var S=u?Object(i.e)(this._config.oauth)?u:u.awsCognito:void 0;if(S){var O=Object.assign({cognitoClientId:s,UserPoolId:o,domain:S.domain,scopes:S.scope,redirectSignIn:S.redirectSignIn,redirectSignOut:S.redirectSignOut,responseType:S.responseType,Storage:this._storage,urlOpener:S.urlOpener,clientMetadata:g},S.options);this._oAuthHandler=new C({scopes:O.scopes,config:O,cognitoClientId:O.cognitoClientId});var E={};!function(e){if(Object(v.b)().isBrowser&&window.location)e({url:window.location.href});else if(!Object(v.b)().isNode)throw new Error("Not supported")}((function(e){var n=e.url;E[n]||(E[n]=!0,t._handleAuthResponse(n))}))}(U("configured",null,"The Auth category has been configured successfully"),this.autoSignInInitiated||"function"!=typeof this._storage.getItem)||(this.isTrueStorageValue("amplify-polling-started")&&(U("autoSignIn_failure",null,i.a.AutoSignInError),this._storage.removeItem("amplify-auto-sign-in")),this._storage.removeItem("amplify-polling-started"));return this._config},e.prototype.signUp=function(e){for(var t,n,r,o=this,s=[],a=1;a<arguments.length;a++)s[a-1]=arguments[a];if(!this.userPool)return this.rejectNoUserPool();var u,c=null,l=null,f=[],d=null,h={enabled:!1},p={},v={};if(e&&"string"==typeof e){c=e,l=s?s[0]:null;var g=s?s[1]:null,y=s?s[2]:null;g&&f.push(new _.f({Name:"email",Value:g})),y&&f.push(new _.f({Name:"phone_number",Value:y}))}else{if(!e||"object"!==M(e))return this.rejectAuthError(i.a.SignUpError);c=e.username,l=e.password,e&&e.clientMetadata?u=e.clientMetadata:this._config.clientMetadata&&(u=this._config.clientMetadata);var m=e.attributes;m&&Object.keys(m).map((function(e){f.push(new _.f({Name:e,Value:m[e]}))}));var b=e.validationData;b&&(d=[],Object.keys(b).map((function(e){d.push(new _.f({Name:e,Value:b[e]}))}))),(h=null!==(t=e.autoSignIn)&&void 0!==t?t:{enabled:!1}).enabled&&(this._storage.setItem("amplify-auto-sign-in","true"),p=null!==(n=h.validationData)&&void 0!==n?n:{},v=null!==(r=h.clientMetaData)&&void 0!==r?r:{})}return c?l?(R.debug("signUp attrs:",f),R.debug("signUp validation data:",d),new Promise((function(e,t){o.userPool.signUp(c,l,f,d,(function(n,r){n?(U("signUp_failure",n,c+" failed to signup"),t(n)):(U("signUp",r,c+" has signed up successfully"),h.enabled&&o.handleAutoSignIn(c,l,p,v,r),e(r))}),u)}))):this.rejectAuthError(i.a.EmptyPassword):this.rejectAuthError(i.a.EmptyUsername)},e.prototype.handleAutoSignIn=function(e,t,n,r,i){this.autoSignInInitiated=!0;var o=new _.a({Username:e,Password:t,ValidationData:n,ClientMetadata:r});i.userConfirmed?this.signInAfterUserConfirmed(o):"link"===this._config.signUpVerificationMethod?this.handleLinkAutoSignIn(o):this.handleCodeAutoSignIn(o)},e.prototype.handleCodeAutoSignIn=function(e){var t=this;s.a.listen("auth",(function n(r){"confirmSignUp"===r.payload.event&&t.signInAfterUserConfirmed(e,n)}))},e.prototype.handleLinkAutoSignIn=function(e){var t=this;this._storage.setItem("amplify-polling-started","true");var n=Date.now(),r=setInterval((function(){Date.now()-n>18e4?(clearInterval(r),U("autoSignIn_failure",null,"Please confirm your account and use your credentials to sign in."),t._storage.removeItem("amplify-auto-sign-in")):t.signInAfterUserConfirmed(e,null,r)}),5e3)},e.prototype.signInAfterUserConfirmed=function(e,t,n){return Object(r.__awaiter)(this,void 0,void 0,(function(){var i,o,a=this;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:i=this.createCognitoUser(e.getUsername()),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,i.authenticateUser(e,this.authCallbacks(i,(function(r){U("autoSignIn",r,e.getUsername()+" has signed in successfully"),t&&s.a.remove("auth",t),n&&(clearInterval(n),a._storage.removeItem("amplify-polling-started")),a._storage.removeItem("amplify-auto-sign-in")}),(function(e){R.error(e),a._storage.removeItem("amplify-auto-sign-in")})))];case 2:return r.sent(),[3,4];case 3:return o=r.sent(),R.error(o),[3,4];case 4:return[2]}}))}))},e.prototype.confirmSignUp=function(e,t,n){var r=this;if(!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(i.a.EmptyUsername);if(!t)return this.rejectAuthError(i.a.EmptyCode);var o,s=this.createCognitoUser(e),a=!n||"boolean"!=typeof n.forceAliasCreation||n.forceAliasCreation;return n&&n.clientMetadata?o=n.clientMetadata:this._config.clientMetadata&&(o=this._config.clientMetadata),new Promise((function(n,u){s.confirmRegistration(t,a,(function(t,o){t?u(t):(U("confirmSignUp",o,e+" has been confirmed successfully"),r.isTrueStorageValue("amplify-auto-sign-in")&&!r.autoSignInInitiated&&(U("autoSignIn_failure",null,i.a.AutoSignInError),r._storage.removeItem("amplify-auto-sign-in")),n(o))}),o)}))},e.prototype.isTrueStorageValue=function(e){var t=this._storage.getItem(e);return!!t&&"true"===t},e.prototype.resendSignUp=function(e,t){if(void 0===t&&(t=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(i.a.EmptyUsername);var n=this.createCognitoUser(e);return new Promise((function(e,r){n.resendConfirmationCode((function(t,n){t?r(t):e(n)}),t)}))},e.prototype.signIn=function(e,t,n){if(void 0===n&&(n=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();var r=null,o=null,s={};if("string"==typeof e)r=e,o=t;else{if(!Object(i.h)(e))return this.rejectAuthError(i.a.InvalidUsername);void 0!==t&&R.warn("The password should be defined under the first parameter object!"),r=e.username,o=e.password,s=e.validationData}if(!r)return this.rejectAuthError(i.a.EmptyUsername);var a=new _.a({Username:r,Password:o,ValidationData:s,ClientMetadata:n});return o?this.signInWithPassword(a):this.signInWithoutPassword(a)},e.prototype.authCallbacks=function(e,t,n){var i=this,o=this;return{onSuccess:function(s){return Object(r.__awaiter)(i,void 0,void 0,(function(){var i,a,u,c;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:R.debug(s),delete e.challengeName,delete e.challengeParam,r.label=1;case 1:return r.trys.push([1,4,5,9]),[4,this.Credentials.clear()];case 2:return r.sent(),[4,this.Credentials.set(s,"session")];case 3:return i=r.sent(),R.debug("succeed to get cognito credentials",i),[3,9];case 4:return a=r.sent(),R.debug("cannot get cognito credentials",a),[3,9];case 5:return r.trys.push([5,7,,8]),[4,this.currentUserPoolUser()];case 6:return u=r.sent(),o.user=u,U("signIn",u,"A user "+e.getUsername()+" has been signed in"),t(u),[3,8];case 7:return c=r.sent(),R.error("Failed to get the signed in user",c),n(c),[3,8];case 8:return[7];case 9:return[2]}}))}))},onFailure:function(t){R.debug("signIn failure",t),U("signIn_failure",t,e.getUsername()+" failed to signin"),n(t)},customChallenge:function(n){R.debug("signIn custom challenge answer required"),e.challengeName="CUSTOM_CHALLENGE",e.challengeParam=n,t(e)},mfaRequired:function(n,r){R.debug("signIn MFA required"),e.challengeName=n,e.challengeParam=r,t(e)},mfaSetup:function(n,r){R.debug("signIn mfa setup",n),e.challengeName=n,e.challengeParam=r,t(e)},newPasswordRequired:function(n,r){R.debug("signIn new password"),e.challengeName="NEW_PASSWORD_REQUIRED",e.challengeParam={userAttributes:n,requiredAttributes:r},t(e)},totpRequired:function(n,r){R.debug("signIn totpRequired"),e.challengeName=n,e.challengeParam=r,t(e)},selectMFAType:function(n,r){R.debug("signIn selectMFAType",n),e.challengeName=n,e.challengeParam=r,t(e)}}},e.prototype.signInWithPassword=function(e){var t=this;if(this.pendingSignIn)throw new Error("Pending sign-in attempt already in progress");var n=this.createCognitoUser(e.getUsername());return this.pendingSignIn=new Promise((function(r,i){n.authenticateUser(e,t.authCallbacks(n,(function(e){t.pendingSignIn=null,r(e)}),(function(e){t.pendingSignIn=null,i(e)})))})),this.pendingSignIn},e.prototype.signInWithoutPassword=function(e){var t=this,n=this.createCognitoUser(e.getUsername());return n.setAuthenticationFlowType("CUSTOM_AUTH"),new Promise((function(r,i){n.initiateAuth(e,t.authCallbacks(n,r,i))}))},e.prototype.getMFAOptions=function(e){return new Promise((function(t,n){e.getMFAOptions((function(e,r){if(e)return R.debug("get MFA Options failed",e),void n(e);R.debug("get MFA options success",r),t(r)}))}))},e.prototype.getPreferredMFA=function(e,t){var n=this,i=this;return new Promise((function(o,s){var a=n._config.clientMetadata,u=!!t&&t.bypassCache;e.getUserData((function(t,a){return Object(r.__awaiter)(n,void 0,void 0,(function(){var n,u;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:if(!t)return[3,5];if(R.debug("getting preferred mfa failed",t),!this.isSessionInvalid(t))return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return r.sent(),[3,4];case 3:return n=r.sent(),s(new Error("Session is invalid due to: "+t.message+" and failed to clean up invalid session: "+n.message)),[2];case 4:return s(t),[2];case 5:return(u=i._getMfaTypeFromUserData(a))?(o(u),[2]):(s("invalid MFA Type"),[2])}}))}))}),{bypassCache:u,clientMetadata:a})}))},e.prototype._getMfaTypeFromUserData=function(e){var t=null,n=e.PreferredMfaSetting;if(n)t=n;else{var r=e.UserMFASettingList;if(r)0===r.length?t="NOMFA":R.debug("invalid case for getPreferredMFA",e);else t=e.MFAOptions?"SMS_MFA":"NOMFA"}return t},e.prototype._getUserData=function(e,t){var n=this;return new Promise((function(i,o){e.getUserData((function(t,s){return Object(r.__awaiter)(n,void 0,void 0,(function(){var n;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:if(!t)return[3,5];if(R.debug("getting user data failed",t),!this.isSessionInvalid(t))return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return r.sent(),[3,4];case 3:return n=r.sent(),o(new Error("Session is invalid due to: "+t.message+" and failed to clean up invalid session: "+n.message)),[2];case 4:return o(t),[2];case 5:i(s),r.label=6;case 6:return[2]}}))}))}),t)}))},e.prototype.setPreferredMFA=function(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){var n,o,s,a,u,c,l=this;return Object(r.__generator)(this,(function(f){switch(f.label){case 0:return n=this._config.clientMetadata,[4,this._getUserData(e,{bypassCache:!0,clientMetadata:n})];case 1:switch(o=f.sent(),s=null,a=null,t){case"TOTP":case"SOFTWARE_TOKEN_MFA":return[3,2];case"SMS":case"SMS_MFA":return[3,3];case"NOMFA":return[3,4]}return[3,6];case 2:return a={PreferredMfa:!0,Enabled:!0},[3,7];case 3:return s={PreferredMfa:!0,Enabled:!0},[3,7];case 4:return u=o.UserMFASettingList,[4,this._getMfaTypeFromUserData(o)];case 5:if("NOMFA"===(c=f.sent()))return[2,Promise.resolve("No change for mfa type")];if("SMS_MFA"===c)s={PreferredMfa:!1,Enabled:!1};else{if("SOFTWARE_TOKEN_MFA"!==c)return[2,this.rejectAuthError(i.a.InvalidMFA)];a={PreferredMfa:!1,Enabled:!1}}return u&&0!==u.length&&u.forEach((function(e){"SMS_MFA"===e?s={PreferredMfa:!1,Enabled:!1}:"SOFTWARE_TOKEN_MFA"===e&&(a={PreferredMfa:!1,Enabled:!1})})),[3,7];case 6:return R.debug("no validmfa method provided"),[2,this.rejectAuthError(i.a.NoMFA)];case 7:return this,[2,new Promise((function(t,i){e.setUserMfaPreference(s,a,(function(o,s){if(o)return R.debug("Set user mfa preference error",o),i(o);R.debug("Set user mfa success",s),R.debug("Caching the latest user data into local"),e.getUserData((function(n,o){return Object(r.__awaiter)(l,void 0,void 0,(function(){var o;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:if(!n)return[3,5];if(R.debug("getting user data failed",n),!this.isSessionInvalid(n))return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return r.sent(),[3,4];case 3:return o=r.sent(),i(new Error("Session is invalid due to: "+n.message+" and failed to clean up invalid session: "+o.message)),[2];case 4:return[2,i(n)];case 5:return[2,t(s)]}}))}))}),{bypassCache:!0,clientMetadata:n})}))}))]}}))}))},e.prototype.disableSMS=function(e){return new Promise((function(t,n){e.disableMFA((function(e,r){if(e)return R.debug("disable mfa failed",e),void n(e);R.debug("disable mfa succeed",r),t(r)}))}))},e.prototype.enableSMS=function(e){return new Promise((function(t,n){e.enableMFA((function(e,r){if(e)return R.debug("enable mfa failed",e),void n(e);R.debug("enable mfa succeed",r),t(r)}))}))},e.prototype.setupTOTP=function(e){return new Promise((function(t,n){e.associateSoftwareToken({onFailure:function(e){R.debug("associateSoftwareToken failed",e),n(e)},associateSecretCode:function(e){R.debug("associateSoftwareToken sucess",e),t(e)}})}))},e.prototype.verifyTotpToken=function(e,t){return R.debug("verification totp token",e,t),new Promise((function(n,r){e.verifySoftwareToken(t,"My TOTP device",{onFailure:function(e){R.debug("verifyTotpToken failed",e),r(e)},onSuccess:function(t){U("signIn",e,"A user "+e.getUsername()+" has been signed in"),R.debug("verifyTotpToken success",t),n(t)}})}))},e.prototype.confirmSignIn=function(e,t,n,o){var s=this;if(void 0===o&&(o=this._config.clientMetadata),!t)return this.rejectAuthError(i.a.EmptyCode);var a=this;return new Promise((function(i,u){e.sendMFACode(t,{onSuccess:function(t){return Object(r.__awaiter)(s,void 0,void 0,(function(){var n,o;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:R.debug(t),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,this.Credentials.clear()];case 2:return r.sent(),[4,this.Credentials.set(t,"session")];case 3:return n=r.sent(),R.debug("succeed to get cognito credentials",n),[3,6];case 4:return o=r.sent(),R.debug("cannot get cognito credentials",o),[3,6];case 5:return a.user=e,U("signIn",e,"A user "+e.getUsername()+" has been signed in"),i(e),[7];case 6:return[2]}}))}))},onFailure:function(e){R.debug("confirm signIn failure",e),u(e)}},n,o)}))},e.prototype.completeNewPassword=function(e,t,n,o){var s=this;if(void 0===n&&(n={}),void 0===o&&(o=this._config.clientMetadata),!t)return this.rejectAuthError(i.a.EmptyPassword);var a=this;return new Promise((function(i,u){e.completeNewPasswordChallenge(t,n,{onSuccess:function(t){return Object(r.__awaiter)(s,void 0,void 0,(function(){var n,o;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:R.debug(t),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,this.Credentials.clear()];case 2:return r.sent(),[4,this.Credentials.set(t,"session")];case 3:return n=r.sent(),R.debug("succeed to get cognito credentials",n),[3,6];case 4:return o=r.sent(),R.debug("cannot get cognito credentials",o),[3,6];case 5:return a.user=e,U("signIn",e,"A user "+e.getUsername()+" has been signed in"),i(e),[7];case 6:return[2]}}))}))},onFailure:function(e){R.debug("completeNewPassword failure",e),U("completeNewPassword_failure",e,s.user+" failed to complete the new password flow"),u(e)},mfaRequired:function(t,n){R.debug("signIn MFA required"),e.challengeName=t,e.challengeParam=n,i(e)},mfaSetup:function(t,n){R.debug("signIn mfa setup",t),e.challengeName=t,e.challengeParam=n,i(e)},totpRequired:function(t,n){R.debug("signIn mfa setup",t),e.challengeName=t,e.challengeParam=n,i(e)}},o)}))},e.prototype.sendCustomChallengeAnswer=function(e,t,n){var r=this;if(void 0===n&&(n=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!t)return this.rejectAuthError(i.a.EmptyChallengeResponse);return new Promise((function(i,o){e.sendCustomChallengeAnswer(t,r.authCallbacks(e,i,o),n)}))},e.prototype.deleteUserAttributes=function(e,t){var n=this;return new Promise((function(r,i){n.userSession(e).then((function(n){e.deleteAttributes(t,(function(e,t){return e?i(e):r(t)}))}))}))},e.prototype.deleteUser=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){var e,t,n=this;return Object(r.__generator)(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._storageSync];case 1:return i.sent(),[3,3];case 2:throw e=i.sent(),R.debug("Failed to sync cache info into memory",e),new Error(e);case 3:return t=this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI"),[2,new Promise((function(e,i){return Object(r.__awaiter)(n,void 0,void 0,(function(){var n,o=this;return Object(r.__generator)(this,(function(s){if(this.userPool){if(!(n=this.userPool.getCurrentUser()))return R.debug("Failed to get user from user pool"),[2,i(new Error("No current user."))];n.getSession((function(s,a){return Object(r.__awaiter)(o,void 0,void 0,(function(){var o,a=this;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:if(!s)return[3,5];if(R.debug("Failed to get the user session",s),!this.isSessionInvalid(s))return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(n)];case 2:return r.sent(),[3,4];case 3:return o=r.sent(),i(new Error("Session is invalid due to: "+s.message+" and failed to clean up invalid session: "+o.message)),[2];case 4:return[2,i(s)];case 5:n.deleteUser((function(r,o){if(r)i(r);else{U("userDeleted",o,"The authenticated user has been deleted."),n.signOut(),a.user=null;try{a.cleanCachedItems()}catch(e){R.debug("failed to clear cached items")}t?a.oAuthSignOutRedirect(e,i):(U("signOut",a.user,"A user has been signed out"),e(o))}})),r.label=6;case 6:return[2]}}))}))}))}else R.debug("no Congito User pool"),i(new Error("Cognito User pool does not exist"));return[2]}))}))}))]}}))}))},e.prototype.updateUserAttributes=function(e,t,n){void 0===n&&(n=this._config.clientMetadata);var r=[],i=this;return new Promise((function(o,s){i.userSession(e).then((function(i){for(var a in t)if("sub"!==a&&a.indexOf("_verified")<0){var u={Name:a,Value:t[a]};r.push(u)}e.updateAttributes(r,(function(e,t){return e?s(e):o(t)}),n)}))}))},e.prototype.userAttributes=function(e){var t=this;return new Promise((function(n,r){t.userSession(e).then((function(t){e.getUserAttributes((function(e,t){e?r(e):n(t)}))}))}))},e.prototype.verifiedContact=function(e){var t=this;return this.userAttributes(e).then((function(e){var n=t.attributesToObject(e),r={},i={};return n.email&&(n.email_verified?i.email=n.email:r.email=n.email),n.phone_number&&(n.phone_number_verified?i.phone_number=n.phone_number:r.phone_number=n.phone_number),{verified:i,unverified:r}}))},e.prototype.isErrorWithMessage=function(e){return"object"===M(e)&&Object.prototype.hasOwnProperty.call(e,"message")},e.prototype.isTokenRevokedError=function(e){return this.isErrorWithMessage(e)&&"Access Token has been revoked"===e.message},e.prototype.isRefreshTokenRevokedError=function(e){return this.isErrorWithMessage(e)&&"Refresh Token has been revoked"===e.message},e.prototype.isUserDisabledError=function(e){return this.isErrorWithMessage(e)&&"User is disabled."===e.message},e.prototype.isUserDoesNotExistError=function(e){return this.isErrorWithMessage(e)&&"User does not exist."===e.message},e.prototype.isRefreshTokenExpiredError=function(e){return this.isErrorWithMessage(e)&&"Refresh Token has expired"===e.message},e.prototype.isSignedInHostedUI=function(){return this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI")},e.prototype.isSessionInvalid=function(e){return this.isUserDisabledError(e)||this.isUserDoesNotExistError(e)||this.isTokenRevokedError(e)||this.isRefreshTokenRevokedError(e)||this.isRefreshTokenExpiredError(e)},e.prototype.cleanUpInvalidSession=function(e){return Object(r.__awaiter)(this,void 0,void 0,(function(){var t=this;return Object(r.__generator)(this,(function(n){switch(n.label){case 0:e.signOut(),this.user=null,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.cleanCachedItems()];case 2:return n.sent(),[3,4];case 3:return n.sent(),R.debug("failed to clear cached items"),[3,4];case 4:return this.isSignedInHostedUI()?[2,new Promise((function(e,n){t.oAuthSignOutRedirect(e,n)}))]:(U("signOut",this.user,"A user has been signed out"),[2])}}))}))},e.prototype.currentUserPoolUser=function(e){var t=this;return this.userPool?new Promise((function(n,i){t._storageSync.then((function(){return Object(r.__awaiter)(t,void 0,void 0,(function(){var t,o,a=this;return Object(r.__generator)(this,(function(u){switch(u.label){case 0:return this.isOAuthInProgress()?(R.debug("OAuth signIn in progress, waiting for resolution..."),[4,new Promise((function(e){var t=setTimeout((function(){R.debug("OAuth signIn in progress timeout"),s.a.remove("auth",n),e()}),1e4);function n(r){var i=r.payload.event;"cognitoHostedUI"!==i&&"cognitoHostedUI_failure"!==i||(R.debug("OAuth signIn resolved: "+i),clearTimeout(t),s.a.remove("auth",n),e())}s.a.listen("auth",n)}))]):[3,2];case 1:u.sent(),u.label=2;case 2:return(t=this.userPool.getCurrentUser())?(o=this._config.clientMetadata,t.getSession((function(o,s){return Object(r.__awaiter)(a,void 0,void 0,(function(){var a,u,c,l,f=this;return Object(r.__generator)(this,(function(d){switch(d.label){case 0:if(!o)return[3,5];if(R.debug("Failed to get the user session",o),!this.isSessionInvalid(o))return[3,4];d.label=1;case 1:return d.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return d.sent(),[3,4];case 3:return a=d.sent(),i(new Error("Session is invalid due to: "+o.message+" and failed to clean up invalid session: "+a.message)),[2];case 4:return i(o),[2];case 5:return(u=!!e&&e.bypassCache)?[4,this.Credentials.clear()]:[3,7];case 6:d.sent(),d.label=7;case 7:return c=this._config.clientMetadata,l=s.getAccessToken().decodePayload().scope,(void 0===l?"":l).split(" ").includes("aws.cognito.signin.user.admin")?(t.getUserData((function(e,o){return Object(r.__awaiter)(f,void 0,void 0,(function(){var s,a,u,c,l,f,d;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:if(!e)return[3,7];if(R.debug("getting user data failed",e),!this.isSessionInvalid(e))return[3,5];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return r.sent(),[3,4];case 3:return s=r.sent(),i(new Error("Session is invalid due to: "+e.message+" and failed to clean up invalid session: "+s.message)),[2];case 4:return i(e),[3,6];case 5:n(t),r.label=6;case 6:return[2];case 7:for(a=o.PreferredMfaSetting||"NOMFA",u=[],c=0;c<o.UserAttributes.length;c++)l={Name:o.UserAttributes[c].Name,Value:o.UserAttributes[c].Value},f=new _.f(l),u.push(f);return d=this.attributesToObject(u),Object.assign(t,{attributes:d,preferredMFA:a}),[2,n(t)]}}))}))}),{bypassCache:u,clientMetadata:c}),[2]):(R.debug("Unable to get the user data because the aws.cognito.signin.user.admin is not in the scopes of the access token"),[2,n(t)])}}))}))}),{clientMetadata:o}),[2]):(R.debug("Failed to get user from user pool"),i("No current user"),[2])}}))}))})).catch((function(e){return R.debug("Failed to sync cache info into memory",e),i(e)}))})):this.rejectNoUserPool()},e.prototype.isOAuthInProgress=function(){return this.oAuthFlowInProgress},e.prototype.currentAuthenticatedUser=function(e){return Object(r.__awaiter)(this,void 0,void 0,(function(){var t,n,i,o,s;return Object(r.__generator)(this,(function(a){switch(a.label){case 0:R.debug("getting current authenticated user"),t=null,a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this._storageSync];case 2:return a.sent(),[3,4];case 3:throw n=a.sent(),R.debug("Failed to sync cache info into memory",n),n;case 4:try{(i=JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")))&&(t=Object(r.__assign)(Object(r.__assign)({},i.user),{token:i.token}))}catch(e){R.debug("cannot load federated user from auth storage")}return t?(this.user=t,R.debug("get current authenticated federated user",this.user),[2,this.user]):[3,5];case 5:R.debug("get current authenticated userpool user"),o=null,a.label=6;case 6:return a.trys.push([6,8,,9]),[4,this.currentUserPoolUser(e)];case 7:return o=a.sent(),[3,9];case 8:return"No userPool"===(s=a.sent())&&R.error("Cannot get the current user because the user pool is missing. Please make sure the Auth module is configured with a valid Cognito User Pool ID"),R.debug("The user is not authenticated by the error",s),[2,Promise.reject("The user is not authenticated")];case 9:return this.user=o,[2,this.user]}}))}))},e.prototype.currentSession=function(){var e=this;return R.debug("Getting current session"),this.userPool?new Promise((function(t,n){e.currentUserPoolUser().then((function(r){e.userSession(r).then((function(e){t(e)})).catch((function(e){R.debug("Failed to get the current session",e),n(e)}))})).catch((function(e){R.debug("Failed to get the current user",e),n(e)}))})):Promise.reject(new Error("No User Pool in the configuration."))},e.prototype.userSession=function(e){var t=this;if(!e)return R.debug("the user is null"),this.rejectAuthError(i.a.NoUserSession);var n=this._config.clientMetadata;return new Promise((function(i,o){R.debug("Getting the session from this user:",e),e.getSession((function(n,s){return Object(r.__awaiter)(t,void 0,void 0,(function(){var t;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:if(!n)return[3,5];if(R.debug("Failed to get the session from user",e),!this.isSessionInvalid(n))return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return r.sent(),[3,4];case 3:return t=r.sent(),o(new Error("Session is invalid due to: "+n.message+" and failed to clean up invalid session: "+t.message)),[2];case 4:return o(n),[2];case 5:return R.debug("Succeed to get the user session",s),i(s),[2]}}))}))}),{clientMetadata:n})}))},e.prototype.currentUserCredentials=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){var e,t,n=this;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:R.debug("Getting current user credentials"),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._storageSync];case 2:return r.sent(),[3,4];case 3:throw e=r.sent(),R.debug("Failed to sync cache info into memory",e),e;case 4:t=null;try{t=JSON.parse(this._storage.getItem("aws-amplify-federatedInfo"))}catch(e){R.debug("failed to get or parse item aws-amplify-federatedInfo",e)}return t?[2,this.Credentials.refreshFederatedToken(t)]:[2,this.currentSession().then((function(e){return R.debug("getting session success",e),n.Credentials.set(e,"session")})).catch((function(){return R.debug("getting guest credentials"),n.Credentials.set(null,"guest")}))]}}))}))},e.prototype.currentCredentials=function(){return R.debug("getting current credentials"),this.Credentials.get()},e.prototype.verifyUserAttribute=function(e,t,n){return void 0===n&&(n=this._config.clientMetadata),new Promise((function(r,i){e.getAttributeVerificationCode(t,{onSuccess:function(e){return r(e)},onFailure:function(e){return i(e)}},n)}))},e.prototype.verifyUserAttributeSubmit=function(e,t,n){return n?new Promise((function(r,i){e.verifyAttribute(t,n,{onSuccess:function(e){r(e)},onFailure:function(e){i(e)}})})):this.rejectAuthError(i.a.EmptyCode)},e.prototype.verifyCurrentUserAttribute=function(e){var t=this;return t.currentUserPoolUser().then((function(n){return t.verifyUserAttribute(n,e)}))},e.prototype.verifyCurrentUserAttributeSubmit=function(e,t){var n=this;return n.currentUserPoolUser().then((function(r){return n.verifyUserAttributeSubmit(r,e,t)}))},e.prototype.cognitoIdentitySignOut=function(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){var n,i,o=this;return Object(r.__generator)(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,this._storageSync];case 1:return s.sent(),[3,3];case 2:throw n=s.sent(),R.debug("Failed to sync cache info into memory",n),n;case 3:return i=this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI"),[2,new Promise((function(n,s){if(e&&e.global){R.debug("user global sign out",t);var a=o._config.clientMetadata;t.getSession((function(e,a){return Object(r.__awaiter)(o,void 0,void 0,(function(){var o,a=this;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:if(!e)return[3,5];if(R.debug("failed to get the user session",e),!this.isSessionInvalid(e))return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return r.sent(),[3,4];case 3:return o=r.sent(),s(new Error("Session is invalid due to: "+e.message+" and failed to clean up invalid session: "+o.message)),[2];case 4:return[2,s(e)];case 5:return t.globalSignOut({onSuccess:function(e){if(R.debug("global sign out success"),!i)return n();a.oAuthSignOutRedirect(n,s)},onFailure:function(e){return R.debug("global sign out failed",e),s(e)}}),[2]}}))}))}),{clientMetadata:a})}else R.debug("user sign out",t),t.signOut((function(){if(!i)return n();o.oAuthSignOutRedirect(n,s)}))}))]}}))}))},e.prototype.oAuthSignOutRedirect=function(e,t){Object(v.b)().isBrowser?this.oAuthSignOutRedirectOrReject(t):this.oAuthSignOutAndResolve(e)},e.prototype.oAuthSignOutAndResolve=function(e){this._oAuthHandler.signOut(),e()},e.prototype.oAuthSignOutRedirectOrReject=function(e){this._oAuthHandler.signOut(),setTimeout((function(){return e(Error("Signout timeout fail"))}),3e3)},e.prototype.signOut=function(e){return Object(r.__awaiter)(this,void 0,void 0,(function(){var t;return Object(r.__generator)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.cleanCachedItems()];case 1:return n.sent(),[3,3];case 2:return n.sent(),R.debug("failed to clear cached items"),[3,3];case 3:return this.userPool?(t=this.userPool.getCurrentUser())?[4,this.cognitoIdentitySignOut(e,t)]:[3,5]:[3,7];case 4:return n.sent(),[3,6];case 5:R.debug("no current Cognito user"),n.label=6;case 6:return[3,8];case 7:R.debug("no Cognito User pool"),n.label=8;case 8:return U("signOut",this.user,"A user has been signed out"),this.user=null,[2]}}))}))},e.prototype.cleanCachedItems=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(e){switch(e.label){case 0:return[4,this.Credentials.clear()];case 1:return e.sent(),[2]}}))}))},e.prototype.changePassword=function(e,t,n,r){var i=this;return void 0===r&&(r=this._config.clientMetadata),new Promise((function(o,s){i.userSession(e).then((function(i){e.changePassword(t,n,(function(e,t){return e?(R.debug("change password failure",e),s(e)):o(t)}),r)}))}))},e.prototype.forgotPassword=function(e,t){if(void 0===t&&(t=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(i.a.EmptyUsername);var n=this.createCognitoUser(e);return new Promise((function(r,i){n.forgotPassword({onSuccess:function(){r()},onFailure:function(t){R.debug("forgot password failure",t),U("forgotPassword_failure",t,e+" forgotPassword failed"),i(t)},inputVerificationCode:function(t){U("forgotPassword",n,e+" has initiated forgot password flow"),r(t)}},t)}))},e.prototype.forgotPasswordSubmit=function(e,t,n,r){if(void 0===r&&(r=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(i.a.EmptyUsername);if(!t)return this.rejectAuthError(i.a.EmptyCode);if(!n)return this.rejectAuthError(i.a.EmptyPassword);var o=this.createCognitoUser(e);return new Promise((function(i,s){o.confirmPassword(t,n,{onSuccess:function(t){U("forgotPasswordSubmit",o,e+" forgotPasswordSubmit successful"),i(t)},onFailure:function(t){U("forgotPasswordSubmit_failure",t,e+" forgotPasswordSubmit failed"),s(t)}},r)}))},e.prototype.currentUserInfo=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){var e,t,n,i,o,s,a;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return(e=this.Credentials.getCredSource())&&"aws"!==e&&"userPool"!==e?[3,9]:[4,this.currentUserPoolUser().catch((function(e){return R.error(e)}))];case 1:if(!(a=r.sent()))return[2,null];r.label=2;case 2:return r.trys.push([2,8,,9]),[4,this.userAttributes(a)];case 3:t=r.sent(),n=this.attributesToObject(t),i=null,r.label=4;case 4:return r.trys.push([4,6,,7]),[4,this.currentCredentials()];case 5:return i=r.sent(),[3,7];case 6:return o=r.sent(),R.debug("Failed to retrieve credentials while getting current user info",o),[3,7];case 7:return[2,{id:i?i.identityId:void 0,username:a.getUsername(),attributes:n}];case 8:return s=r.sent(),R.error("currentUserInfo error",s),[2,{}];case 9:return"federated"===e?[2,(a=this.user)||{}]:[2]}}))}))},e.prototype.federatedSignIn=function(e,t,n){return Object(r.__awaiter)(this,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h,p,v;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:if(!this._config.identityPoolId&&!this._config.userPoolId)throw new Error("Federation requires either a User Pool or Identity Pool in config");if(void 0===e&&this._config.identityPoolId&&!this._config.userPoolId)throw new Error("Federation with Identity Pools requires tokens passed as arguments");return Object(i.f)(e)||Object(i.g)(e)||Object(i.d)(e)||void 0===e?(o=e||{provider:i.b.Cognito},c=Object(i.f)(o)?o.provider:o.customProvider,Object(i.f)(o),s=o.customState,this._config.userPoolId&&(a=Object(i.e)(this._config.oauth)?this._config.userPoolWebClientId:this._config.oauth.clientID,u=Object(i.e)(this._config.oauth)?this._config.oauth.redirectSignIn:this._config.oauth.redirectUri,this._oAuthHandler.oauthSignIn(this._config.oauth.responseType,this._config.oauth.domain,u,a,c,s)),[3,4]):[3,1];case 1:c=e;try{(l=JSON.stringify(JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")).user))&&R.warn("There is already a signed in user: "+l+" in your app.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tYou should not call Auth.federatedSignIn method again as it may cause unexpected behavior.")}catch(e){}return f=t.token,d=t.identity_id,h=t.expires_at,[4,this.Credentials.set({provider:c,token:f,identity_id:d,user:n,expires_at:h},"federation")];case 2:return p=r.sent(),[4,this.currentAuthenticatedUser()];case 3:return v=r.sent(),U("signIn",v,"A user "+v.username+" has been signed in"),R.debug("federated sign in credentials",p),[2,p];case 4:return[2]}}))}))},e.prototype._handleAuthResponse=function(e){return Object(r.__awaiter)(this,void 0,void 0,(function(){var t,n,i,o,s,a,u,c,l,f,d,h,p,g;return Object(r.__generator)(this,(function(y){switch(y.label){case 0:if(this.oAuthFlowInProgress)return R.debug("Skipping URL "+e+" current flow in progress"),[2];y.label=1;case 1:if(y.trys.push([1,,8,9]),this.oAuthFlowInProgress=!0,!this._config.userPoolId)throw new Error("OAuth responses require a User Pool defined in config");if(U("parsingCallbackUrl",{url:e},"The callback url is being parsed"),t=e||(Object(v.b)().isBrowser?window.location.href:""),n=!!(Object(w.parse)(t).query||"").split("&").map((function(e){return e.split("=")})).find((function(e){var t=Object(r.__read)(e,1)[0];return"code"===t||"error"===t})),i=!!(Object(w.parse)(t).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).find((function(e){var t=Object(r.__read)(e,1)[0];return"access_token"===t||"error"===t})),!n&&!i)return[3,7];this._storage.setItem("amplify-redirected-from-hosted-ui","true"),y.label=2;case 2:return y.trys.push([2,6,,7]),[4,this._oAuthHandler.handleAuthResponse(t)];case 3:return o=y.sent(),s=o.accessToken,a=o.idToken,u=o.refreshToken,c=o.state,l=new _.h({IdToken:new _.c({IdToken:a}),RefreshToken:new _.d({RefreshToken:u}),AccessToken:new _.b({AccessToken:s})}),f=void 0,this._config.identityPoolId?[4,this.Credentials.set(l,"session")]:[3,5];case 4:f=y.sent(),R.debug("AWS credentials",f),y.label=5;case 5:return d=/-/.test(c),(h=this.createCognitoUser(l.getIdToken().decodePayload()["cognito:username"])).setSignInUserSession(l),window&&void 0!==window.history&&window.history.replaceState({},null,this._config.oauth.redirectSignIn),U("signIn",h,"A user "+h.getUsername()+" has been signed in"),U("cognitoHostedUI",h,"A user "+h.getUsername()+" has been signed in via Cognito Hosted UI"),d&&(p=c.split("-").splice(1).join("-"),U("customOAuthState",p.match(/.{2}/g).map((function(e){return String.fromCharCode(parseInt(e,16))})).join(""),"State for user "+h.getUsername())),[2,f];case 6:return g=y.sent(),R.debug("Error in cognito hosted auth response",g),window&&void 0!==window.history&&window.history.replaceState({},null,this._config.oauth.redirectSignIn),U("signIn_failure",g,"The OAuth response flow failed"),U("cognitoHostedUI_failure",g,"A failure occurred when returning to the Cognito Hosted UI"),U("customState_failure",g,"A failure occurred when returning state"),[3,7];case 7:return[3,9];case 8:return this.oAuthFlowInProgress=!1,[7];case 9:return[2]}}))}))},e.prototype.essentialCredentials=function(e){return{accessKeyId:e.accessKeyId,sessionToken:e.sessionToken,secretAccessKey:e.secretAccessKey,identityId:e.identityId,authenticated:e.authenticated}},e.prototype.attributesToObject=function(e){var t=this,n={};return e&&e.map((function(e){"email_verified"===e.Name||"phone_number_verified"===e.Name?n[e.Name]=t.isTruthyString(e.Value)||!0===e.Value:n[e.Name]=e.Value})),n},e.prototype.isTruthyString=function(e){return"function"==typeof e.toLowerCase&&"true"===e.toLowerCase()},e.prototype.createCognitoUser=function(e){var t={Username:e,Pool:this.userPool};t.Storage=this._storage;var n=this._config.authenticationFlowType,r=new _.e(t);return n&&r.setAuthenticationFlowType(n),r},e.prototype._isValidAuthStorage=function(e){return!!e&&"function"==typeof e.getItem&&"function"==typeof e.setItem&&"function"==typeof e.removeItem&&"function"==typeof e.clear},e.prototype.noUserPoolErrorHandler=function(e){return!e||e.userPoolId&&e.identityPoolId?i.a.NoConfig:i.a.MissingAuthConfig},e.prototype.rejectAuthError=function(e){return Promise.reject(new x(e))},e.prototype.rejectNoUserPool=function(){var e=this.noUserPoolErrorHandler(this._config);return Promise.reject(new N(e))},e.prototype.rememberDevice=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){var e,t;return Object(r.__generator)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.currentUserPoolUser()];case 1:return e=n.sent(),[3,3];case 2:return t=n.sent(),R.debug("The user is not authenticated by the error",t),[2,Promise.reject("The user is not authenticated")];case 3:return e.getCachedDeviceKeyAndPassword(),[2,new Promise((function(t,n){e.setDeviceStatusRemembered({onSuccess:function(e){t(e)},onFailure:function(e){"InvalidParameterException"===e.code?n(new x(i.a.DeviceConfig)):"NetworkError"===e.code?n(new x(i.a.NetworkError)):n(e)}})}))]}}))}))},e.prototype.forgetDevice=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){var e,t;return Object(r.__generator)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.currentUserPoolUser()];case 1:return e=n.sent(),[3,3];case 2:return t=n.sent(),R.debug("The user is not authenticated by the error",t),[2,Promise.reject("The user is not authenticated")];case 3:return e.getCachedDeviceKeyAndPassword(),[2,new Promise((function(t,n){e.forgetDevice({onSuccess:function(e){t(e)},onFailure:function(e){"InvalidParameterException"===e.code?n(new x(i.a.DeviceConfig)):"NetworkError"===e.code?n(new x(i.a.NetworkError)):n(e)}})}))]}}))}))},e.prototype.fetchDevices=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){var e,t;return Object(r.__generator)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.currentUserPoolUser()];case 1:return e=n.sent(),[3,3];case 2:throw t=n.sent(),R.debug("The user is not authenticated by the error",t),new Error("The user is not authenticated");case 3:return e.getCachedDeviceKeyAndPassword(),[2,new Promise((function(t,n){var r={onSuccess:function(e){var n=e.Devices.map((function(e){var t=e.DeviceAttributes.find((function(e){return"device_name"===e.Name}))||{};return{id:e.DeviceKey,name:t.Value}}));t(n)},onFailure:function(e){"InvalidParameterException"===e.code?n(new x(i.a.DeviceConfig)):"NetworkError"===e.code?n(new x(i.a.NetworkError)):n(e)}};e.listDevices(60,null,r)}))]}}))}))},e}())(null);b.a.register(F)},function(e,t,n){"use strict";n.r(t),n.d(t,"fromUtf8",(function(){return r})),n.d(t,"toUtf8",(function(){return i}));var r=function(e){return"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e.charCodeAt(n);if(i<128)t.push(i);else if(i<2048)t.push(i>>6|192,63&i|128);else if(n+1<e.length&&55296==(64512&i)&&56320==(64512&e.charCodeAt(n+1))){var o=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n));t.push(o>>18|240,o>>12&63|128,o>>6&63|128,63&o|128)}else t.push(i>>12|224,i>>6&63|128,63&i|128)}return Uint8Array.from(t)}(e)},i=function(e){return"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):function(e){for(var t="",n=0,r=e.length;n<r;n++){var i=e[n];if(i<128)t+=String.fromCharCode(i);else if(192<=i&&i<224){var o=e[++n];t+=String.fromCharCode((31&i)<<6|63&o)}else if(240<=i&&i<365){var s="%"+[i,e[++n],e[++n],e[++n]].map((function(e){return e.toString(16)})).join("%");t+=decodeURIComponent(s)}else t+=String.fromCharCode((15&i)<<12|(63&e[++n])<<6|63&e[++n])}return t}(e)}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return i}));var r={userAgent:"aws-amplify/4.6.1 js",product:"",navigator:null,isReactNative:!1};if("undefined"!=typeof navigator&&navigator.product)switch(r.product=navigator.product||"",r.navigator=navigator||null,navigator.product){case"ReactNative":r.userAgent="aws-amplify/4.6.1 react-native",r.isReactNative=!0;break;default:r.userAgent="aws-amplify/4.6.1 js",r.isReactNative=!1}var i=function(e){return""+r.userAgent+(e||"")}},,,function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";n.r(t),n.d(t,"locateWindow",(function(){return i}));var r={};function i(){return"undefined"!=typeof window?window:"undefined"!=typeof self?self:r}},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(0),i=n(21),o=new i.a("Amplify"),s=new(function(){function e(){this._components=[],this._config={},this._modules={},this.Auth=null,this.Analytics=null,this.API=null,this.Credentials=null,this.Storage=null,this.I18n=null,this.Cache=null,this.PubSub=null,this.Interactions=null,this.Pushnotification=null,this.UI=null,this.XR=null,this.Predictions=null,this.DataStore=null,this.Geo=null,this.Logger=i.a,this.ServiceWorker=null}return e.prototype.register=function(e){o.debug("component registered in amplify",e),this._components.push(e),"function"==typeof e.getModuleName?(this._modules[e.getModuleName()]=e,this[e.getModuleName()]=e):o.debug("no getModuleName method for component",e),e.configure(this._config)},e.prototype.configure=function(e){var t=this;return e?(this._config=Object.assign(this._config,e),o.debug("amplify config",this._config),Object.entries(this._modules).forEach((function(e){var n=Object(r.__read)(e,2),i=(n[0],n[1]);Object.keys(i).forEach((function(e){t._modules[e]&&(i[e]=t._modules[e])}))})),this._components.map((function(e){e.configure(t._config)})),this._config):this._config},e.prototype.addPluggable=function(e){e&&e.getCategory&&"function"==typeof e.getCategory&&this._components.map((function(t){t.addPluggable&&"function"==typeof t.addPluggable&&t.addPluggable(e)}))},e}())},function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return _}));var r,i,o=n(0),s=n(18),a=n(3),u=n(30),c=n(19),l=n(21),f=n(68),d=n(14),h=n(10),p=n(1),v=n(4),g=n(5),y=n(2),m=n(23),b=new l.a("DataStore");!function(e){e.CONNECTED="CONNECTED"}(r||(r={})),function(e){e[e.none=0]="none",e[e.unauth=1]="unauth",e[e.auth=2]="auth"}(i||(i={}));var _=function(){function t(e,t,n,r,i,o){void 0===n&&(n={}),void 0===o&&(o={Auth:u.a,API:s.a,Cache:c.a}),this.schema=e,this.syncPredicates=t,this.amplifyConfig=n,this.authModeStrategy=r,this.errorHandler=i,this.amplifyContext=o,this.typeQuery=new WeakMap,this.buffer=[]}return t.prototype.buildSubscription=function(e,t,n,r,i,s,a){var u=this.amplifyConfig.aws_appsync_authenticationType,c=this.getAuthorizationInfo(t,r,u,i,s,a)||{},l=c.isOwner,f=c.ownerField,d=c.ownerValue,h=Object(o.__read)(Object(v.c)(e,t,n,l,f),3);return{authMode:a,opType:h[0],opName:h[1],query:h[2],isOwner:l,ownerField:f,ownerValue:d}},t.prototype.getAuthorizationInfo=function(e,t,n,r,s,u){void 0===r&&(r={}),void 0===s&&(s={});var c=Object(v.e)(e);if(u===a.c.AWS_IAM&&c.find((function(e){return"private"===e.authStrategy&&"iam"===e.provider}))&&t===i.unauth)return null;var l,f=c.filter((function(e){return"groups"===e.authStrategy&&["userPools","oidc"].includes(e.provider)}));return u!==a.c.AMAZON_COGNITO_USER_POOLS&&u!==a.c.OPENID_CONNECT||!f.find((function(e){var t=Object(v.j)(r,e),n=Object(v.j)(s,e);return Object(o.__spread)(t,n).find((function(t){return e.groups.find((function(e){return e===t}))}))}))?((u===a.c.AMAZON_COGNITO_USER_POOLS?c.filter((function(e){return"owner"===e.authStrategy&&"userPools"===e.provider})):[]).forEach((function(e){var t=r[e.identityClaim];t&&(l={authMode:a.c.AMAZON_COGNITO_USER_POOLS,isOwner:!e.areSubscriptionsPublic,ownerField:e.ownerField,ownerValue:t})})),l||((u===a.c.OPENID_CONNECT?c.filter((function(e){return"owner"===e.authStrategy&&"oidc"===e.provider})):[]).forEach((function(e){var t=s[e.identityClaim];t&&(l={authMode:a.c.OPENID_CONNECT,isOwner:!e.areSubscriptionsPublic,ownerField:e.ownerField,ownerValue:t})})),l||{authMode:u||n,isOwner:!1})):{authMode:u,isOwner:!1}},t.prototype.hubQueryCompletionListener=function(e,t){t.payload.event===d.CONTROL_MSG.SUBSCRIPTION_ACK&&e()},t.prototype.start=function(){var t=this;return[new h.a((function(n){var s,a,u=[],c={},l=i.none;return Object(o.__awaiter)(t,void 0,void 0,(function(){var t,h,_,w,S,O,E,A,I,T,C=this;return Object(o.__generator)(this,(function(j){switch(j.label){case 0:return j.trys.push([0,2,,3]),[4,this.amplifyContext.Auth.currentCredentials()];case 1:return t=j.sent(),l=t.authenticated?i.auth:i.unauth,[3,3];case 2:return j.sent(),[3,3];case 3:return j.trys.push([3,5,,6]),[4,this.amplifyContext.Auth.currentSession()];case 4:return h=j.sent(),s=h.getIdToken().decodePayload(),[3,6];case 5:return j.sent(),[3,6];case 6:if(j.trys.push([6,11,,12]),_=this.amplifyConfig,w=_.aws_cognito_region,S=_.Auth,!w||S&&!S.region)throw"Auth is not configured";return O=void 0,[4,this.amplifyContext.Cache.getItem("federatedInfo")];case 7:return(E=j.sent())?(O=E.token,[3,10]):[3,8];case 8:return[4,this.amplifyContext.Auth.currentAuthenticatedUser()];case 9:(A=j.sent())&&(O=A.token),j.label=10;case 10:return O&&(I=O.split(".")[1],a=JSON.parse(e.from(I,"base64").toString("utf8"))),[3,12];case 11:return T=j.sent(),b.debug("error getting OIDC JWT",T),[3,12];case 12:return Object.values(this.schema.namespaces).forEach((function(e){Object.values(e.models).filter((function(e){return e.syncable})).forEach((function(t){return Object(o.__awaiter)(C,void 0,void 0,(function(){var r,i,h,_,w,S,O,E,A=this;return Object(o.__generator)(this,(function(I){switch(I.label){case 0:return[4,Object(v.h)({authModeStrategy:this.authModeStrategy,defaultAuthMode:this.amplifyConfig.aws_appsync_authenticationType,modelName:t.name,schema:this.schema})];case 1:return r=I.sent(),i=r.READ,c=Object(o.__assign)(Object(o.__assign)({},c),((S={})[t.name]=((O={})[v.a.CREATE]=[],O[v.a.UPDATE]=[],O[v.a.DELETE]=[],O),S)),h=[v.a.CREATE,v.a.UPDATE,v.a.DELETE],(E={})[v.a.CREATE]=0,E[v.a.UPDATE]=0,E[v.a.DELETE]=0,_=E,w=function(r){return Object(o.__awaiter)(A,void 0,void 0,(function(){var h,S,O,E,A,I,T,C,j,P,x,N,k,M=this;return Object(o.__generator)(this,(function(R){switch(R.label){case 0:return h=this.buildSubscription(e,t,r,l,s,a,i[_[r]]),S=h.opType,O=h.opName,E=h.query,A=h.isOwner,I=h.ownerField,T=h.ownerValue,C=h.authMode,[4,Object(v.i)(C,this.amplifyConfig)];case 1:if(j=R.sent(),P={},A){if(!T)return n.error("Owner field required, sign in is needed in order to perform this operation"),[2];P[I]=T}return b.debug("Attempting "+r+" subscription with authMode: "+i[_[r]]),x=y.f,N=this.amplifyContext.API.graphql(Object(o.__assign)(Object(o.__assign)({query:E,variables:P},{authMode:C}),{authToken:j,userAgentSuffix:x})),c[t.name][S].push(N.map((function(e){return e.value})).subscribe({next:function(e){var n=e.data,r=e.errors;if(Array.isArray(r)&&r.length>0){var i=r.map((function(e){return e.message}));return b.warn("Skipping incoming subscription. Messages: "+i.join("\n")),void M.drainBuffer()}var o=g.a.getPredicates(M.syncPredicates.get(t),!1),s=n[O];M.passesPredicateValidation(s,o)&&M.pushToBuffer(S,t,s),M.drainBuffer()},error:function(e){return Object(o.__awaiter)(M,void 0,void 0,(function(){var s,a,u,l,f,h;return Object(o.__generator)(this,(function(v){switch(v.label){case 0:if(s=e.error,a=Object(o.__read)((void 0===s?{errors:[]}:s).errors,1),u=a[0],l=(void 0===u?{}:u).message,(f=void 0===l?"":l).includes(d.CONTROL_MSG.REALTIME_SUBSCRIPTION_INIT_ERROR)||f.includes(d.CONTROL_MSG.CONNECTION_FAILED)){if(c[t.name][S].forEach((function(e){return e.unsubscribe()})),c[t.name][S]=[],_[r]++,!(_[r]>=i.length))return b.debug(r+" subscription failed with authMode: "+i[_[r]-1]+". Retrying with authMode: "+i[_[r]]),w(r),[2];b.debug(r+" subscription failed with authMode: "+i[_[r]-1])}b.warn("subscriptionError",f),v.label=1;case 1:return v.trys.push([1,3,,4]),[4,this.errorHandler({recoverySuggestion:"Ensure app code is up to date, auth directives exist and are correct on each model, and that server-side data has not been invalidated by a schema change. If the problem persists, search for or create an issue: https://github.com/aws-amplify/amplify-js/issues",localModel:null,message:f,model:t.name,operation:r,errorType:Object(m.b)(e),process:p.i.subscribe,remoteModel:null,cause:e})];case 2:return v.sent(),[3,4];case 3:return h=v.sent(),b.error("Subscription error handler failed with:",h),[3,4];case 4:return"function"==typeof k&&k(),f.includes('"errorType":"Unauthorized"')||f.includes('"errorType":"OperationDisabled"')||n.error(f),[2]}}))}))}})),u.push(Object(o.__awaiter)(M,void 0,void 0,(function(){var e,t=this;return Object(o.__generator)(this,(function(n){switch(n.label){case 0:return[4,new Promise((function(n){k=n,e=t.hubQueryCompletionListener.bind(t,n),f.a.listen("api",e)}))];case 1:return n.sent(),f.a.remove("api",e),[2]}}))}))),[2]}}))}))},h.forEach((function(e){return w(e)})),[2]}}))}))}))})),Promise.all(u).then((function(){return n.next(r.CONNECTED)})),[2]}}))})),function(){Object.keys(c).forEach((function(e){c[e][v.a.CREATE].forEach((function(e){return e.unsubscribe()})),c[e][v.a.UPDATE].forEach((function(e){return e.unsubscribe()})),c[e][v.a.DELETE].forEach((function(e){return e.unsubscribe()}))}))}})),new h.a((function(e){return t.dataObserver=e,t.drainBuffer(),function(){t.dataObserver=null}}))]},t.prototype.passesPredicateValidation=function(e,t){if(!t)return!0;var n=t.predicates,r=t.type;return Object(y.D)(e,r,n)},t.prototype.pushToBuffer=function(e,t,n){this.buffer.push([e,t,n])},t.prototype.drainBuffer=function(){var e=this;this.dataObserver&&(this.buffer.forEach((function(t){return e.dataObserver.next(t)})),this.buffer=[])},t}()}).call(this,n(6).Buffer)},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var i=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,i=n;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MAX_HASHABLE_LENGTH=t.INIT=t.KEY=t.DIGEST_LENGTH=t.BLOCK_SIZE=void 0,t.BLOCK_SIZE=64,t.DIGEST_LENGTH=32,t.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),t.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=t.numToUint8=t.isEmptyData=t.convertToBuffer=void 0;var r=n(82);Object.defineProperty(t,"convertToBuffer",{enumerable:!0,get:function(){return r.convertToBuffer}});var i=n(83);Object.defineProperty(t,"isEmptyData",{enumerable:!0,get:function(){return i.isEmptyData}});var o=n(84);Object.defineProperty(t,"numToUint8",{enumerable:!0,get:function(){return o.numToUint8}});var s=n(85);Object.defineProperty(t,"uint32ArrayFrom",{enumerable:!0,get:function(){return s.uint32ArrayFrom}})},function(e,t,n){"use strict";n.r(t),t.default=function(e,t){return t=t||{},new Promise((function(n,r){var i=new XMLHttpRequest,o=[],s=[],a={},u=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:u,headers:{keys:function(){return o},entries:function(){return s},get:function(e){return a[e.toLowerCase()]},has:function(e){return e.toLowerCase()in a}}}};for(var c in i.open(t.method||"get",e,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,n){o.push(t=t.toLowerCase()),s.push([t,n]),a[t]=a[t]?a[t]+","+n:n})),n(u())},i.onerror=r,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(c,t.headers[c]);i.send(t.body||null)}))}},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var u,c=[],l=!1,f=-1;function d(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&h())}function h(){if(!l){var e=a(d);l=!0;for(var t=c.length;t;){for(u=c,c=[];++f<t;)u&&u[f].run();f=-1,t=c.length}u=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new p(e,t)),1!==c.length||l||a(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r=function(){function e(){}return e.createPredicateBuilder=function(t){var n=t.name,r=new Set(Object.keys(t.fields)),i=new Proxy({},{get:function(t,i,o){var s=i;if(!r.has(s))throw new Error("Invalid field for model. field: "+s+", model: "+n);return function(t){return e.sortPredicateGroupsMap.get(o).push({field:s,sortDirection:t}),o}}});return e.sortPredicateGroupsMap.set(i,[]),i},e.isValidPredicate=function(t){return e.sortPredicateGroupsMap.has(t)},e.getPredicates=function(t,n){if(void 0===n&&(n=!0),n&&!e.isValidPredicate(t))throw new Error("The predicate is not valid");return e.sortPredicateGroupsMap.get(t)},e.createFromExisting=function(t,n){if(n&&t)return n(e.createPredicateBuilder(t))},e.sortPredicateGroupsMap=new WeakMap,e}()},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var i=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,i=n;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(97),i=n(50),o=n(31),s=n(36),a=function(){function e(e){e?(this.operation=function(e){return new Promise((function(t,n){var r=(0,s.locateWindow)().msCrypto.subtle.importKey("raw",u(e),i.SHA_256_HMAC_ALGO,!1,["sign"]);r.oncomplete=function(){r.result&&t(r.result),n(new Error("ImportKey completed without importing key."))},r.onerror=function(){n(new Error("ImportKey failed to import key."))}}))}(e).then((function(e){return(0,s.locateWindow)().msCrypto.subtle.sign(i.SHA_256_HMAC_ALGO,e)})),this.operation.catch((function(){}))):this.operation=Promise.resolve((0,s.locateWindow)().msCrypto.subtle.digest("SHA-256"))}return e.prototype.update=function(e){var t=this;(0,r.isEmptyData)(e)||(this.operation=this.operation.then((function(n){return n.onerror=function(){t.operation=Promise.reject(new Error("Error encountered updating hash"))},n.process(u(e)),n})),this.operation.catch((function(){})))},e.prototype.digest=function(){return this.operation.then((function(e){return new Promise((function(t,n){e.onerror=function(){n(new Error("Error encountered finalizing hash"))},e.oncomplete=function(){e.result&&t(new Uint8Array(e.result)),n(new Error("Error encountered finalizing hash"))},e.finish()}))}))},e}();function u(e){return"string"==typeof e?(0,o.fromUtf8)(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.Sha256=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EMPTY_DATA_SHA_256=t.SHA_256_HMAC_ALGO=t.SHA_256_HASH=void 0,t.SHA_256_HASH={name:"SHA-256"},t.SHA_256_HMAC_ALGO={name:"HMAC",hash:t.SHA_256_HASH},t.EMPTY_DATA_SHA_256=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(42),i=n(50),o=n(36),s=function(){function e(e){this.toHash=new Uint8Array(0),void 0!==e&&(this.key=new Promise((function(t,n){(0,o.locateWindow)().crypto.subtle.importKey("raw",(0,r.convertToBuffer)(e),i.SHA_256_HMAC_ALGO,!1,["sign"]).then(t,n)})),this.key.catch((function(){})))}return e.prototype.update=function(e){if(!(0,r.isEmptyData)(e)){var t=(0,r.convertToBuffer)(e),n=new Uint8Array(this.toHash.byteLength+t.byteLength);n.set(this.toHash,0),n.set(t,this.toHash.byteLength),this.toHash=n}},e.prototype.digest=function(){var e=this;return this.key?this.key.then((function(t){return(0,o.locateWindow)().crypto.subtle.sign(i.SHA_256_HMAC_ALGO,t,e.toHash).then((function(e){return new Uint8Array(e)}))})):(0,r.isEmptyData)(this.toHash)?Promise.resolve(i.EMPTY_DATA_SHA_256):Promise.resolve().then((function(){return(0,o.locateWindow)().crypto.subtle.digest(i.SHA_256_HASH,e.toHash)})).then((function(e){return Promise.resolve(new Uint8Array(e))}))},e}();t.Sha256=s},function(e,t,n){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},function(e,t,n){"use strict";var r=n(12);function i(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var o;if(n)o=n(t);else if(r.isURLSearchParams(t))o=t.toString();else{var s=[];r.forEach(t,(function(e,t){null!=e&&(r.isArray(e)?t+="[]":e=[e],r.forEach(e,(function(e){r.isDate(e)?e=e.toISOString():r.isObject(e)&&(e=JSON.stringify(e)),s.push(i(t)+"="+i(e))})))})),o=s.join("&")}if(o){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}},function(e,t,n){"use strict";e.exports=function(e,t,n,r,i){return e.config=t,n&&(e.code=n),e.request=r,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}},function(e,t,n){"use strict";var r=n(12),i=n(112),o=n(113),s=n(53),a=n(114),u=n(117),c=n(118),l=n(56),f=n(27),d=n(28);e.exports=function(e){return new Promise((function(t,n){var h,p=e.data,v=e.headers,g=e.responseType;function y(){e.cancelToken&&e.cancelToken.unsubscribe(h),e.signal&&e.signal.removeEventListener("abort",h)}r.isFormData(p)&&delete v["Content-Type"];var m=new XMLHttpRequest;if(e.auth){var b=e.auth.username||"",_=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";v.Authorization="Basic "+btoa(b+":"+_)}var w=a(e.baseURL,e.url);function S(){if(m){var r="getAllResponseHeaders"in m?u(m.getAllResponseHeaders()):null,o={data:g&&"text"!==g&&"json"!==g?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m};i((function(e){t(e),y()}),(function(e){n(e),y()}),o),m=null}}if(m.open(e.method.toUpperCase(),s(w,e.params,e.paramsSerializer),!0),m.timeout=e.timeout,"onloadend"in m?m.onloadend=S:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(S)},m.onabort=function(){m&&(n(l("Request aborted",e,"ECONNABORTED",m)),m=null)},m.onerror=function(){n(l("Network Error",e,null,m)),m=null},m.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",r=e.transitional||f.transitional;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(l(t,e,r.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",m)),m=null},r.isStandardBrowserEnv()){var O=(e.withCredentials||c(w))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;O&&(v[e.xsrfHeaderName]=O)}"setRequestHeader"in m&&r.forEach(v,(function(e,t){void 0===p&&"content-type"===t.toLowerCase()?delete v[t]:m.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(m.withCredentials=!!e.withCredentials),g&&"json"!==g&&(m.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&m.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&m.upload&&m.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(h=function(e){m&&(n(!e||e&&e.type?new d("canceled"):e),m.abort(),m=null)},e.cancelToken&&e.cancelToken.subscribe(h),e.signal&&(e.signal.aborted?h():e.signal.addEventListener("abort",h))),p||(p=null),m.send(p)}))}},function(e,t,n){"use strict";var r=n(54);e.exports=function(e,t,n,i,o){var s=new Error(e);return r(s,t,n,i,o)}},function(e,t,n){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,n){"use strict";var r=n(12);e.exports=function(e,t){t=t||{};var n={};function i(e,t){return r.isPlainObject(e)&&r.isPlainObject(t)?r.merge(e,t):r.isPlainObject(t)?r.merge({},t):r.isArray(t)?t.slice():t}function o(n){return r.isUndefined(t[n])?r.isUndefined(e[n])?void 0:i(void 0,e[n]):i(e[n],t[n])}function s(e){if(!r.isUndefined(t[e]))return i(void 0,t[e])}function a(n){return r.isUndefined(t[n])?r.isUndefined(e[n])?void 0:i(void 0,e[n]):i(void 0,t[n])}function u(n){return n in t?i(e[n],t[n]):n in e?i(void 0,e[n]):void 0}var c={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u};return r.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=c[e]||o,i=t(e);r.isUndefined(i)&&t!==u||(n[e]=i)})),n}},function(e,t){e.exports={version:"0.26.0"}},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r={},i=function(){function e(){}return e.setItem=function(e,t){return r[e]=t,r[e]},e.getItem=function(e){return Object.prototype.hasOwnProperty.call(r,e)?r[e]:void 0},e.removeItem=function(e){return delete r[e]},e.clear=function(){return r={}},e}(),o=function(){function e(){try{this.storageWindow=window.localStorage,this.storageWindow.setItem("aws.amplify.test-ls",1),this.storageWindow.removeItem("aws.amplify.test-ls")}catch(e){this.storageWindow=i}}return e.prototype.getStorage=function(){return this.storageWindow},e}()},function(e,t,n){"use strict";(function(e){var r;if(n.d(t,"a",(function(){return i})),"undefined"!=typeof window&&window.crypto&&(r=window.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==e&&e.crypto&&(r=e.crypto),!r)try{r=n(79)}catch(e){}function i(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")}}).call(this,n(35))},function(e,t,n){"use strict";var r,i,o=n(87);function s(e,t,n){if(e._observer)a(e._observer,t,n);else if(e._observers){var r=[];e._observers.forEach((function(e){r.push(e)})),r.forEach((function(e){a(e,t,n)}))}}function a(e,t,n){if(!e.closed)switch(t){case"next":return e.next(n);case"error":return e.error(n);case"complete":return e.complete(n)}}function u(e){return e._observer||e._observers&&e._observers.size>0}function c(e){var t=this;this._observer=null,this._observers=null,this._observable=new o((function(n){return function(e,t){!u(e)&&t&&t.start&&t.start()}(t,e),function(e,t){e._observers?e._observers.add(t):e._observer?(e._observers=new Set,e._observers.add(e._observer),e._observers.add(t),e._observer=null):e._observer=t}(t,n),function(){!function(e,t){e._observers?e._observers.delete(t):e._observer===t&&(e._observer=null)}(t,n),function(e,t){!u(e)&&t&&t.pause&&t.pause()}(t,e)}}))}r=c.prototype,i={get observable(){return this._observable},get observed(){return u(this)},next:function(e){s(this,"next",e)},error:function(e){s(this,"error",e)},complete:function(e){s(this,"complete",e)}},Object.keys(i).forEach((function(e){var t=Object.getOwnPropertyDescriptor(i,e);t.enumerable=!1,Object.defineProperty(r,e,t)})),e.exports=c},function(e,t,n){var r=n(94),i=n(95),o=i;o.v1=r,o.v4=i,e.exports=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebCryptoSha256=t.Ie11Sha256=void 0,(0,n(0).__exportStar)(n(96),t);var r=n(49);Object.defineProperty(t,"Ie11Sha256",{enumerable:!0,get:function(){return r.Sha256}});var i=n(51);Object.defineProperty(t,"WebCryptoSha256",{enumerable:!0,get:function(){return i.Sha256}})},function(e,t,n){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r=n(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,r){void 0===r&&(r=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(n),s=Math.max(i,o),a=0,u=e.map([t,n],(function(t){var n=s-e.getVersionPrecision(t),r=t+new Array(n+1).join(".0");return e.map(r.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(u[0][s]>u[1][s])return 1;if(u[0][s]===u[1][s]){if(s===a)return 0;s-=1}else if(u[0][s]<u[1][s])return-1}},e.map=function(e,t){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n+=1)r.push(t(e[n]));return r},e.find=function(e,t){var n,r;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,r=e.length;n<r;n+=1){var i=e[n];if(t(i,n))return i}},e.assign=function(e){for(var t,n,r=e,i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var a=function(){var e=o[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){r[t]=e[t]}))};for(t=0,n=o.length;t<n;t+=1)a();return e},e.getBrowserAlias=function(e){return r.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return r.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,n){"use strict";t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},o=n(18);function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var a=function(){function e(){}var t,n;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},t=e,(n=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}])&&s(t,n),e}();t.default=a,e.exports=t.default},91:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r=u(n(92)),i=u(n(93)),o=u(n(94)),s=u(n(95)),a=u(n(17));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=a.default.find(r.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=a.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=a.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=a.default.find(s.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return a.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,n={},r=0,i={},o=0;if(Object.keys(e).forEach((function(t){var s=e[t];"string"==typeof s?(i[t]=s,o+=1):"object"==typeof s&&(n[t]=s,r+=1)})),r>0){var s=Object.keys(n),u=a.default.find(s,(function(e){return t.isOS(e)}));if(u){var c=this.satisfies(n[u]);if(void 0!==c)return c}var l=a.default.find(s,(function(e){return t.isPlatform(e)}));if(l){var f=this.satisfies(n[l]);if(void 0!==f)return f}}if(o>0){var d=Object.keys(i),h=a.default.find(d,(function(e){return t.isBrowser(e,!0)}));if(void 0!==h)return this.compareVersion(i[h])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),i=a.default.getBrowserTypeByAlias(r);return t&&i&&(r=i.toLowerCase()),r===n},t.compareVersion=function(e){var t=[0],n=e,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(a.default.compareVersions(i,n,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=c,e.exports=t.default},92:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=s,e.exports=t.default},93:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(t),r={name:o.OS_MAP.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=i.default.getAndroidVersionName(t),r={name:o.OS_MAP.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:o.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=s,e.exports=t.default},94:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=s,e.exports=t.default},95:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=s,e.exports=t.default}})},function(e){e.exports=JSON.parse('{"name":"@aws-sdk/client-cognito-identity","description":"AWS SDK for JavaScript Cognito Identity Client for Node.js, Browser and React Native","version":"3.6.1","scripts":{"clean":"yarn remove-definitions && yarn remove-dist && yarn remove-documentation","build-documentation":"yarn remove-documentation && typedoc ./","prepublishOnly":"yarn build","pretest":"yarn build:cjs","remove-definitions":"rimraf ./types","remove-dist":"rimraf ./dist","remove-documentation":"rimraf ./docs","test:unit":"mocha **/cjs/**/*.spec.js","test:e2e":"mocha **/cjs/**/*.ispec.js && karma start karma.conf.js","test":"yarn test:unit","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig.es.json","build":"yarn build:cjs && yarn build:es","postbuild":"downlevel-dts types types/ts3.4"},"main":"./dist/cjs/index.js","types":"./types/index.d.ts","module":"./dist/es/index.js","browser":{"./runtimeConfig":"./runtimeConfig.browser"},"react-native":{"./runtimeConfig":"./runtimeConfig.native"},"sideEffects":false,"dependencies":{"@aws-crypto/sha256-browser":"^1.0.0","@aws-crypto/sha256-js":"^1.0.0","@aws-sdk/config-resolver":"3.6.1","@aws-sdk/credential-provider-node":"3.6.1","@aws-sdk/fetch-http-handler":"3.6.1","@aws-sdk/hash-node":"3.6.1","@aws-sdk/invalid-dependency":"3.6.1","@aws-sdk/middleware-content-length":"3.6.1","@aws-sdk/middleware-host-header":"3.6.1","@aws-sdk/middleware-logger":"3.6.1","@aws-sdk/middleware-retry":"3.6.1","@aws-sdk/middleware-serde":"3.6.1","@aws-sdk/middleware-signing":"3.6.1","@aws-sdk/middleware-stack":"3.6.1","@aws-sdk/middleware-user-agent":"3.6.1","@aws-sdk/node-config-provider":"3.6.1","@aws-sdk/node-http-handler":"3.6.1","@aws-sdk/protocol-http":"3.6.1","@aws-sdk/smithy-client":"3.6.1","@aws-sdk/types":"3.6.1","@aws-sdk/url-parser":"3.6.1","@aws-sdk/url-parser-native":"3.6.1","@aws-sdk/util-base64-browser":"3.6.1","@aws-sdk/util-base64-node":"3.6.1","@aws-sdk/util-body-length-browser":"3.6.1","@aws-sdk/util-body-length-node":"3.6.1","@aws-sdk/util-user-agent-browser":"3.6.1","@aws-sdk/util-user-agent-node":"3.6.1","@aws-sdk/util-utf8-browser":"3.6.1","@aws-sdk/util-utf8-node":"3.6.1","tslib":"^2.0.0"},"devDependencies":{"@aws-sdk/client-documentation-generator":"3.6.1","@aws-sdk/client-iam":"3.6.1","@types/chai":"^4.2.11","@types/mocha":"^8.0.4","@types/node":"^12.7.5","downlevel-dts":"0.7.0","jest":"^26.1.0","rimraf":"^3.0.0","typedoc":"^0.19.2","typescript":"~4.1.2"},"engines":{"node":">=10.0.0"},"typesVersions":{"<4.0":{"types/*":["types/ts3.4/*"]}},"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-cognito-identity","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"clients/client-cognito-identity"}}')},function(e,t,n){e.exports=n(123).Observable},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(0),i=new(n(21).a)("Hub"),o="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default";var s=new(function(){function e(e){this.listeners=[],this.patterns=[],this.protectedChannels=["core","auth","api","analytics","interactions","pubsub","storage","ui","xr"],this.name=e}return e.prototype.remove=function(e,t){if(e instanceof RegExp){var n=this.patterns.find((function(t){return t.pattern.source===e.source}));if(!n)return void i.warn("No listeners for "+e);this.patterns=Object(r.__spread)(this.patterns.filter((function(e){return e!==n})))}else{var o=this.listeners[e];if(!o)return void i.warn("No listeners for "+e);this.listeners[e]=Object(r.__spread)(o.filter((function(e){return e.callback!==t})))}},e.prototype.dispatch=function(e,t,n,s){(void 0===n&&(n=""),this.protectedChannels.indexOf(e)>-1)&&(s===o||i.warn("WARNING: "+e+" is protected and dispatching on it can have unintended consequences"));var a={channel:e,payload:Object(r.__assign)({},t),source:n,patternInfo:[]};try{this._toListeners(a)}catch(e){i.error(e)}},e.prototype.listen=function(e,t,n){var r,o=this;if(void 0===n&&(n="noname"),function(e){return void 0!==e.onHubCapsule}(t))i.warn("WARNING onHubCapsule is Deprecated. Please pass in a callback."),r=t.onHubCapsule.bind(t);else{if("function"!=typeof t)throw new Error("No callback supplied to Hub");r=t}if(e instanceof RegExp)this.patterns.push({pattern:e,callback:r});else{var s=this.listeners[e];s||(s=[],this.listeners[e]=s),s.push({name:n,callback:r})}return function(){o.remove(e,r)}},e.prototype._toListeners=function(e){var t=e.channel,n=e.payload,o=this.listeners[t];if(o&&o.forEach((function(r){i.debug("Dispatching to "+t+" with ",n);try{r.callback(e)}catch(e){i.error(e)}})),this.patterns.length>0){if(!n.message)return void i.warn("Cannot perform pattern matching without a message key");var s=n.message;this.patterns.forEach((function(t){var n=s.match(t.pattern);if(n){var o=Object(r.__read)(n).slice(1),a=Object(r.__assign)(Object(r.__assign)({},e),{patternInfo:o});try{t.callback(a)}catch(e){i.error(e)}}}))}},e}())("__default__")},,,,,function(e,t,n){var r,i,o=n(39),s=n(40),a=0,u=0;e.exports=function(e,t,n){var c=t&&n||0,l=t||[],f=(e=e||{}).node||r,d=void 0!==e.clockseq?e.clockseq:i;if(null==f||null==d){var h=o();null==f&&(f=r=[1|h[0],h[1],h[2],h[3],h[4],h[5]]),null==d&&(d=i=16383&(h[6]<<8|h[7]))}var p=void 0!==e.msecs?e.msecs:(new Date).getTime(),v=void 0!==e.nsecs?e.nsecs:u+1,g=p-a+(v-u)/1e4;if(g<0&&void 0===e.clockseq&&(d=d+1&16383),(g<0||p>a)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=p,u=v,i=d;var y=(1e4*(268435455&(p+=122192928e5))+v)%4294967296;l[c++]=y>>>24&255,l[c++]=y>>>16&255,l[c++]=y>>>8&255,l[c++]=255&y;var m=p/4294967296*1e4&268435455;l[c++]=m>>>8&255,l[c++]=255&m,l[c++]=m>>>24&15|16,l[c++]=m>>>16&255,l[c++]=d>>>8|128,l[c++]=255&d;for(var b=0;b<6;++b)l[c+b]=f[b];return t||s(l)}},function(e,t,n){var r=n(39),i=n(40);e.exports=function(e,t,n){var o=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[o+a]=s[a];return t||i(s)}},function(e,t,n){"use strict";t.byteLength=function(e){var t=c(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=c(e),s=r[0],a=r[1],u=new o(function(e,t,n){return 3*(t+n)/4-n}(0,s,a)),l=0,f=a>0?s-4:s;for(n=0;n<f;n+=4)t=i[e.charCodeAt(n)]<<18|i[e.charCodeAt(n+1)]<<12|i[e.charCodeAt(n+2)]<<6|i[e.charCodeAt(n+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===a&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===a&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=0,a=n-i;s<a;s+=16383)o.push(l(e,s,s+16383>a?a:s+16383));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)r[a]=s[a],i[s.charCodeAt(a)]=a;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var i,o,s=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){
63
+ */!function(o){if(void 0===(i="function"==typeof(r=o)?r.call(t,n,t,e):r)||(e.exports=i),!0,e.exports=o(),!!0){var s=window.Cookies,a=window.Cookies=o();a.noConflict=function(){return window.Cookies=s,a}}}((function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function i(){}function o(t,n,o){if("undefined"!=typeof document){"number"==typeof(o=e({path:"/"},i.defaults,o)).expires&&(o.expires=new Date(1*new Date+864e5*o.expires)),o.expires=o.expires?o.expires.toUTCString():"";try{var s=JSON.stringify(n);/^[\{\[]/.test(s)&&(n=s)}catch(e){}n=r.write?r.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var a="";for(var u in o)o[u]&&(a+="; "+u,!0!==o[u]&&(a+="="+o[u].split(";")[0]));return document.cookie=t+"="+n+a}}function s(e,n){if("undefined"!=typeof document){for(var i={},o=document.cookie?document.cookie.split("; "):[],s=0;s<o.length;s++){var a=o[s].split("="),u=a.slice(1).join("=");n||'"'!==u.charAt(0)||(u=u.slice(1,-1));try{var c=t(a[0]);if(u=(r.read||r)(u,c)||t(u),n)try{u=JSON.parse(u)}catch(e){}if(i[c]=u,e===c)break}catch(e){}}return e?i[e]:i}}return i.set=o,i.get=function(e){return s(e,!1)},i.getJSON=function(e){return s(e,!0)},i.remove=function(t,n){o(t,"",e(n,{expires:-1}))},i.defaults={},i.withConverter=n,i}((function(){}))}))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){e.exports=n(119)},function(e,t,n){"use strict";(function(t){var r=n(13),i=n(124),o=n(60),s={"Content-Type":"application/x-www-form-urlencoded"};function a(e,t){!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var u,c={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==t&&"[object process]"===Object.prototype.toString.call(t))&&(u=n(61)),u),transformRequest:[function(e,t){return i(t,"Accept"),i(t,"Content-Type"),r.isFormData(e)||r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e)?e:r.isArrayBufferView(e)?e.buffer:r.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):r.isObject(e)||t&&"application/json"===t["Content-Type"]?(a(t,"application/json"),function(e,t,n){if(r.isString(e))try{return(t||JSON.parse)(e),r.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||c.transitional,n=t&&t.silentJSONParsing,i=t&&t.forcedJSONParsing,s=!n&&"json"===this.responseType;if(s||i&&r.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(s){if("SyntaxError"===e.name)throw o(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],(function(e){c.headers[e]={}})),r.forEach(["post","put","patch"],(function(e){c.headers[e]=r.merge(s)})),e.exports=c}).call(this,n(47))},function(e,t,n){"use strict";function r(e){this.message=e}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,e.exports=r},function(e,t,n){var r=n(82),i=n(83),o=i;o.v1=r,o.v4=i,e.exports=o},function(e,t,n){"use strict";n.d(t,"a",(function(){return $}));var r=n(3),i=n(21),o=n(77),s=n(148),a=function(){return(a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},u=new i.a("Parser"),c=function(e){var t,n={};if(e.aws_mobile_analytics_app_id){var r={AWSPinpoint:{appId:e.aws_mobile_analytics_app_id,region:e.aws_mobile_analytics_app_region}};n.Analytics=r}return(e.aws_cognito_identity_pool_id||e.aws_user_pools_id)&&(n.Auth={userPoolId:e.aws_user_pools_id,userPoolWebClientId:e.aws_user_pools_web_client_id,region:e.aws_cognito_region,identityPoolId:e.aws_cognito_identity_pool_id,identityPoolRegion:e.aws_cognito_region,mandatorySignIn:"enable"===e.aws_mandatory_sign_in,signUpVerificationMethod:e.aws_cognito_sign_up_verification_method||"code"}),t=e.aws_user_files_s3_bucket?{AWSS3:{bucket:e.aws_user_files_s3_bucket,region:e.aws_user_files_s3_bucket_region,dangerouslyConnectToHttpEndpointForTesting:e.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing}}:e?e.Storage||e:{},e.Logging&&(n.Logging=a(a({},e.Logging),{region:e.aws_project_region})),e.geo&&(n.Geo=Object.assign({},e.geo),e.geo.amazon_location_service&&(n.Geo={AmazonLocationService:e.geo.amazon_location_service})),n.Analytics=Object.assign({},n.Analytics,e.Analytics),n.Auth=Object.assign({},n.Auth,e.Auth),n.Storage=Object.assign({},t),n.Logging=Object.assign({},n.Logging,e.Logging),u.debug("parse config",e,"to amplifyconfig",n),n},l=function(){function e(){}return e.parseMobilehubConfig=c,e}(),f=n(25);function d(e,t){void 0===t&&(t={});var n=function(e){if(e&&"j"===e[0]&&":"===e[1])return e.substr(2);return e}(e);if(function(e,t){return void 0===t&&(t=!e||"{"!==e[0]&&"["!==e[0]&&'"'!==e[0]),!t}(n,t.doNotParse))try{return JSON.parse(n)}catch(e){}return e}var h=function(){return(h=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},p=function(){function e(e,t){var n=this;this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.cookies=function(e,t){return"string"==typeof e?f.parse(e,t):"object"==typeof e&&null!==e?e:{}}(e,t),new Promise((function(){n.HAS_DOCUMENT_COOKIE="object"==typeof document&&"string"==typeof document.cookie})).catch((function(){}))}return e.prototype._updateBrowserValues=function(e){this.HAS_DOCUMENT_COOKIE&&(this.cookies=f.parse(document.cookie,e))},e.prototype._emitChange=function(e){for(var t=0;t<this.changeListeners.length;++t)this.changeListeners[t](e)},e.prototype.get=function(e,t,n){return void 0===t&&(t={}),this._updateBrowserValues(n),d(this.cookies[e],t)},e.prototype.getAll=function(e,t){void 0===e&&(e={}),this._updateBrowserValues(t);var n={};for(var r in this.cookies)n[r]=d(this.cookies[r],e);return n},e.prototype.set=function(e,t,n){var r;"object"==typeof t&&(t=JSON.stringify(t)),this.cookies=h(h({},this.cookies),((r={})[e]=t,r)),this.HAS_DOCUMENT_COOKIE&&(document.cookie=f.serialize(e,t,n)),this._emitChange({name:e,value:t,options:n})},e.prototype.remove=function(e,t){var n=t=h(h({},t),{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=h({},this.cookies),delete this.cookies[e],this.HAS_DOCUMENT_COOKIE&&(document.cookie=f.serialize(e,"",n)),this._emitChange({name:e,value:void 0,options:t})},e.prototype.addChangeListener=function(e){this.changeListeners.push(e)},e.prototype.removeChangeListener=function(e){var t=this.changeListeners.indexOf(e);t>=0&&this.changeListeners.splice(t,1)},e}(),v=n(16),y=Object(v.b)().isBrowser,g=function(){function e(e){void 0===e&&(e={}),this.cookies=new p,this.store=y?window.localStorage:Object.create(null),this.cookies=e.req?new p(e.req.headers.cookie):new p,Object.assign(this.store,this.cookies.getAll())}return Object.defineProperty(e.prototype,"length",{get:function(){return Object.entries(this.store).length},enumerable:!0,configurable:!0}),e.prototype.clear=function(){var e=this;Array.from(new Array(this.length)).map((function(t,n){return e.key(n)})).forEach((function(t){return e.removeItem(t)}))},e.prototype.getItem=function(e){return this.getLocalItem(e)},e.prototype.getLocalItem=function(e){return Object.prototype.hasOwnProperty.call(this.store,e)?this.store[e]:null},e.prototype.getUniversalItem=function(e){return this.cookies.get(e)},e.prototype.key=function(e){return Object.keys(this.store)[e]},e.prototype.removeItem=function(e){this.removeLocalItem(e),this.removeUniversalItem(e)},e.prototype.removeLocalItem=function(e){delete this.store[e]},e.prototype.removeUniversalItem=function(e){this.cookies.remove(e,{path:"/"})},e.prototype.setItem=function(e,t){switch(this.setLocalItem(e,t),e.split(".").pop()){case"LastAuthUser":case"accessToken":case"refreshToken":case"idToken":y?this.setUniversalItem(e,t):this.setLocalItem(e,t)}},e.prototype.setLocalItem=function(e,t){this.store[e]=t},e.prototype.setUniversalItem=function(e,t){this.cookies.set(e,t,{path:"/",sameSite:!0,secure:"localhost"!==window.location.hostname})},e}(),m=n(67);var b,w=n(39),S=n(8),_=n(9),E=function(e){var t=window.open(e,"_self");return t?Promise.resolve(t):Promise.reject()},A=n(74),O=n.n(A),I=n(75),T=n.n(I),C=function(){return(C=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},x=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},P=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},k=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},N="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",M=function(e,t,n){o.a.dispatch("auth",{event:e,data:t,message:n},"Auth",N)},j=new i.a("OAuth"),R=function(){function e(e){var t=e.config,n=e.cognitoClientId,r=e.scopes,i=void 0===r?[]:r;if(this._urlOpener=t.urlOpener||E,this._config=t,this._cognitoClientId=n,!this.isValidScopes(i))throw Error("scopes must be a String Array");this._scopes=i}return e.prototype.isValidScopes=function(e){return Array.isArray(e)&&e.every((function(e){return"string"==typeof e}))},e.prototype.oauthSignIn=function(e,t,n,i,o,s){void 0===e&&(e="code"),void 0===o&&(o=r.b.Cognito);var a=this._generateState(32),u=s?a+"-"+s.split("").map((function(e){return e.charCodeAt(0).toString(16).padStart(2,"0")})).join(""):a;!function(e){window.sessionStorage.setItem("oauth_state",e)}(u);var c,l=this._generateRandom(128);c=l,window.sessionStorage.setItem("ouath_pkce_key",c);var f=this._generateChallenge(l),d=this._scopes.join(" "),h="https://"+t+"/oauth2/authorize?"+Object.entries(C(C({redirect_uri:n,response_type:e,client_id:i,identity_provider:o,scope:d,state:u},"code"===e?{code_challenge:f}:{}),"code"===e?{code_challenge_method:"S256"}:{})).map((function(e){var t=k(e,2),n=t[0],r=t[1];return encodeURIComponent(n)+"="+encodeURIComponent(r)})).join("&");j.debug("Redirecting to "+h),this._urlOpener(h,n)},e.prototype._handleCodeFlow=function(e){return x(this,void 0,void 0,(function(){var t,n,i,o,s,a,u,c,l,f,d,h,p,v;return P(this,(function(y){switch(y.label){case 0:return t=(Object(_.parse)(e).query||"").split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n,r=k(t,2),i=r[0],o=r[1];return C(C({},e),((n={})[i]=o,n))}),{code:void 0}).code,n=Object(_.parse)(e).pathname||"/",i=Object(_.parse)(this._config.redirectSignIn).pathname||"/",t&&n===i?(o="https://"+this._config.domain+"/oauth2/token",M("codeFlow",{},"Retrieving tokens from "+o),s=Object(r.e)(this._config)?this._cognitoClientId:this._config.clientID,a=Object(r.e)(this._config)?this._config.redirectSignIn:this._config.redirectUri,g=window.sessionStorage.getItem("ouath_pkce_key"),window.sessionStorage.removeItem("ouath_pkce_key"),c=C({grant_type:"authorization_code",code:t,client_id:s,redirect_uri:a},(u=g)?{code_verifier:u}:{}),j.debug("Calling token endpoint: "+o+" with",c),l=Object.entries(c).map((function(e){var t=k(e,2),n=t[0],r=t[1];return encodeURIComponent(n)+"="+encodeURIComponent(r)})).join("&"),[4,fetch(o,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:l})]):[2];case 1:return[4,y.sent().json()];case 2:if(f=y.sent(),d=f.access_token,h=f.refresh_token,p=f.id_token,v=f.error)throw new Error(v);return[2,{accessToken:d,refreshToken:h,idToken:p}]}var g}))}))},e.prototype._handleImplicitFlow=function(e){return x(this,void 0,void 0,(function(){var t,n,r;return P(this,(function(i){return t=(Object(_.parse)(e).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n,r=k(t,2),i=r[0],o=r[1];return C(C({},e),((n={})[i]=o,n))}),{id_token:void 0,access_token:void 0}),n=t.id_token,r=t.access_token,M("implicitFlow",{},"Got tokens from "+e),j.debug("Retrieving implicit tokens from "+e+" with"),[2,{accessToken:r,idToken:n,refreshToken:null}]}))}))},e.prototype.handleAuthResponse=function(e){return x(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return P(this,(function(u){switch(u.label){case 0:if(u.trys.push([0,5,,6]),t=e?C(C({},(Object(_.parse)(e).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n=k(t,2),r=n[0],i=n[1];return e[r]=i,e}),{})),(Object(_.parse)(e).query||"").split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n=k(t,2),r=n[0],i=n[1];return e[r]=i,e}),{})):{},n=t.error,r=t.error_description,n)throw new Error(r);return i=this._validateState(t),j.debug("Starting "+this._config.responseType+" flow with "+e),"code"!==this._config.responseType?[3,2]:(o=[{}],[4,this._handleCodeFlow(e)]);case 1:return[2,C.apply(void 0,[C.apply(void 0,o.concat([u.sent()])),{state:i}])];case 2:return s=[{}],[4,this._handleImplicitFlow(e)];case 3:return[2,C.apply(void 0,[C.apply(void 0,s.concat([u.sent()])),{state:i}])];case 4:return[3,6];case 5:throw a=u.sent(),j.error("Error handling auth response.",a),a;case 6:return[2]}}))}))},e.prototype._validateState=function(e){if(e){var t,n=(t=window.sessionStorage.getItem("oauth_state"),window.sessionStorage.removeItem("oauth_state"),t),r=e.state;if(n&&n!==r)throw new Error("Invalid state in OAuth flow");return r}},e.prototype.signOut=function(){return x(this,void 0,void 0,(function(){var e,t,n;return P(this,(function(i){return e="https://"+this._config.domain+"/logout?",t=Object(r.e)(this._config)?this._cognitoClientId:this._config.oauth.clientID,n=Object(r.e)(this._config)?this._config.redirectSignOut:this._config.returnTo,e+=Object.entries({client_id:t,logout_uri:encodeURIComponent(n)}).map((function(e){var t=k(e,2);return t[0]+"="+t[1]})).join("&"),M("oAuthSignOut",{oAuth:"signOut"},"Signing out from "+e),j.debug("Signing out from "+e),[2,this._urlOpener(e,n)]}))}))},e.prototype._generateState=function(e){for(var t="",n=e,r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";n>0;--n)t+=r[Math.round(Math.random()*(r.length-1))];return t},e.prototype._generateChallenge=function(e){return this._base64URL(O()(e))},e.prototype._base64URL=function(e){return e.toString(T.a).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},e.prototype._generateRandom=function(e){var t=new Uint8Array(e);if("undefined"!=typeof window&&window.crypto)window.crypto.getRandomValues(t);else for(var n=0;n<e;n+=1)t[n]=Math.random()*"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~".length|0;return this._bufferToString(t)},e.prototype._bufferToString=function(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=[],r=0;r<e.byteLength;r+=1){var i=e[r]%t.length;n.push(t[i])}return n.join("")},e}(),D=n(11),U=(b=function(e,t){return(b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}b(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),F=new i.a("AuthError"),L=function(e){function t(n){var r=this,i=q[n],o=i.message,s=i.log;return(r=e.call(this,o)||this).constructor=t,Object.setPrototypeOf(r,t.prototype),r.name="AuthError",r.log=s||o,F.error(r.log),r}return U(t,e),t}(Error),B=function(e){function t(n){var r=e.call(this,n)||this;return r.constructor=t,Object.setPrototypeOf(r,t.prototype),r.name="NoUserPoolError",r}return U(t,e),t}(L),q={noConfig:{message:D.a.DEFAULT_MSG,log:"\n Error: Amplify has not been configured correctly.\n This error is typically caused by one of the following scenarios:\n\n 1. Make sure you're passing the awsconfig object to Amplify.configure() in your app's entry point\n See https://aws-amplify.github.io/docs/js/authentication#configure-your-app for more information\n \n 2. There might be multiple conflicting versions of amplify packages in your node_modules.\n\t\t\t\tRefer to our docs site for help upgrading Amplify packages (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js)\n "},missingAuthConfig:{message:D.a.DEFAULT_MSG,log:"\n Error: Amplify has not been configured correctly. \n The configuration object is missing required auth properties.\n This error is typically caused by one of the following scenarios:\n\n 1. Did you run `amplify push` after adding auth via `amplify add auth`?\n See https://aws-amplify.github.io/docs/js/authentication#amplify-project-setup for more information\n\n 2. This could also be caused by multiple conflicting versions of amplify packages, see (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js) for help upgrading Amplify packages.\n "},emptyUsername:{message:D.a.EMPTY_USERNAME},invalidUsername:{message:D.a.INVALID_USERNAME},emptyPassword:{message:D.a.EMPTY_PASSWORD},emptyCode:{message:D.a.EMPTY_CODE},signUpError:{message:D.a.SIGN_UP_ERROR,log:"The first parameter should either be non-null string or object"},noMFA:{message:D.a.NO_MFA},invalidMFA:{message:D.a.INVALID_MFA},emptyChallengeResponse:{message:D.a.EMPTY_CHALLENGE},noUserSession:{message:D.a.NO_USER_SESSION},deviceConfig:{message:D.a.DEVICE_CONFIG},networkError:{message:D.a.NETWORK_ERROR},autoSignInError:{message:D.a.AUTOSIGNIN_ERROR},default:{message:D.a.DEFAULT_MSG}};function z(e){return(z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var K=function(){return(K=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},H=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},V=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},G=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},W=new i.a("AuthClass"),Y="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",J=function(e,t,n){o.a.dispatch("auth",{event:e,data:t,message:n},"Auth",Y)},$=new(function(){function e(e){var t=this;this.userPool=null,this.user=null,this.oAuthFlowInProgress=!1,this.autoSignInInitiated=!1,this.Credentials=s.a,this.wrapRefreshSessionCallback=function(e){return function(t,n){return n?J("tokenRefresh",void 0,"New token retrieved"):J("tokenRefresh_failure",t,"Failed to retrieve new token"),e(t,n)}},this.configure(e),this.currentCredentials=this.currentCredentials.bind(this),this.currentUserCredentials=this.currentUserCredentials.bind(this),o.a.listen("auth",(function(e){switch(e.payload.event){case"signIn":t._storage.setItem("amplify-signin-with-hostedUI","false");break;case"signOut":t._storage.removeItem("amplify-signin-with-hostedUI");break;case"cognitoHostedUI":t._storage.setItem("amplify-signin-with-hostedUI","true")}}))}return e.prototype.getModuleName=function(){return"Auth"},e.prototype.configure=function(e){var t=this;if(!e)return this._config||{};W.debug("configure Auth");var n=Object.assign({},this._config,l.parseMobilehubConfig(e).Auth,e);this._config=n;var i=this._config,o=i.userPoolId,s=i.userPoolWebClientId,a=i.cookieStorage,u=i.oauth,c=i.region,f=i.identityPoolId,d=i.mandatorySignIn,h=i.refreshHandlers,p=i.identityPoolRegion,y=i.clientMetadata,b=i.endpoint;if(this._config.storage){if(!this._isValidAuthStorage(this._config.storage))throw W.error("The storage in the Auth config is not valid!"),new Error("Empty storage object");this._storage=this._config.storage}else this._storage=a?new S.i(a):e.ssr?new g:(new m.a).getStorage();if(this._storageSync=Promise.resolve(),"function"==typeof this._storage.sync&&(this._storageSync=this._storage.sync()),o){var w={UserPoolId:o,ClientId:s,endpoint:b};w.Storage=this._storage,this.userPool=new S.g(w,this.wrapRefreshSessionCallback)}this.Credentials.configure({mandatorySignIn:d,region:p||c,userPoolId:o,identityPoolId:f,refreshHandlers:h,storage:this._storage});var _=u?Object(r.e)(this._config.oauth)?u:u.awsCognito:void 0;if(_){var E=Object.assign({cognitoClientId:s,UserPoolId:o,domain:_.domain,scopes:_.scope,redirectSignIn:_.redirectSignIn,redirectSignOut:_.redirectSignOut,responseType:_.responseType,Storage:this._storage,urlOpener:_.urlOpener,clientMetadata:y},_.options);this._oAuthHandler=new R({scopes:E.scopes,config:E,cognitoClientId:E.cognitoClientId});var A={};!function(e){if(Object(v.b)().isBrowser&&window.location)e({url:window.location.href});else if(!Object(v.b)().isNode)throw new Error("Not supported")}((function(e){var n=e.url;A[n]||(A[n]=!0,t._handleAuthResponse(n))}))}(J("configured",null,"The Auth category has been configured successfully"),this.autoSignInInitiated||"function"!=typeof this._storage.getItem)||(this.isTrueStorageValue("amplify-polling-started")&&(J("autoSignIn_failure",null,r.a.AutoSignInError),this._storage.removeItem("amplify-auto-sign-in")),this._storage.removeItem("amplify-polling-started"));return this._config},e.prototype.signUp=function(e){for(var t,n,i,o=this,s=[],a=1;a<arguments.length;a++)s[a-1]=arguments[a];if(!this.userPool)return this.rejectNoUserPool();var u,c=null,l=null,f=[],d=null,h={enabled:!1},p={},v={};if(e&&"string"==typeof e){c=e,l=s?s[0]:null;var y=s?s[1]:null,g=s?s[2]:null;y&&f.push(new S.f({Name:"email",Value:y})),g&&f.push(new S.f({Name:"phone_number",Value:g}))}else{if(!e||"object"!==z(e))return this.rejectAuthError(r.a.SignUpError);c=e.username,l=e.password,e&&e.clientMetadata?u=e.clientMetadata:this._config.clientMetadata&&(u=this._config.clientMetadata);var m=e.attributes;m&&Object.keys(m).map((function(e){f.push(new S.f({Name:e,Value:m[e]}))}));var b=e.validationData;b&&(d=[],Object.keys(b).map((function(e){d.push(new S.f({Name:e,Value:b[e]}))}))),(h=null!==(t=e.autoSignIn)&&void 0!==t?t:{enabled:!1}).enabled&&(this._storage.setItem("amplify-auto-sign-in","true"),p=null!==(n=h.validationData)&&void 0!==n?n:{},v=null!==(i=h.clientMetaData)&&void 0!==i?i:{})}return c?l?(W.debug("signUp attrs:",f),W.debug("signUp validation data:",d),new Promise((function(e,t){o.userPool.signUp(c,l,f,d,(function(n,r){n?(J("signUp_failure",n,c+" failed to signup"),t(n)):(J("signUp",r,c+" has signed up successfully"),h.enabled&&o.handleAutoSignIn(c,l,p,v,r),e(r))}),u)}))):this.rejectAuthError(r.a.EmptyPassword):this.rejectAuthError(r.a.EmptyUsername)},e.prototype.handleAutoSignIn=function(e,t,n,r,i){this.autoSignInInitiated=!0;var o=new S.a({Username:e,Password:t,ValidationData:n,ClientMetadata:r});i.userConfirmed?this.signInAfterUserConfirmed(o):"link"===this._config.signUpVerificationMethod?this.handleLinkAutoSignIn(o):this.handleCodeAutoSignIn(o)},e.prototype.handleCodeAutoSignIn=function(e){var t=this;o.a.listen("auth",(function n(r){"confirmSignUp"===r.payload.event&&t.signInAfterUserConfirmed(e,n)}))},e.prototype.handleLinkAutoSignIn=function(e){var t=this;this._storage.setItem("amplify-polling-started","true");var n=Date.now(),r=setInterval((function(){Date.now()-n>18e4?(clearInterval(r),J("autoSignIn_failure",null,"Please confirm your account and use your credentials to sign in."),t._storage.removeItem("amplify-auto-sign-in")):t.signInAfterUserConfirmed(e,null,r)}),5e3)},e.prototype.signInAfterUserConfirmed=function(e,t,n){return H(this,void 0,void 0,(function(){var r,i,s=this;return V(this,(function(a){switch(a.label){case 0:r=this.createCognitoUser(e.getUsername()),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,r.authenticateUser(e,this.authCallbacks(r,(function(r){J("autoSignIn",r,e.getUsername()+" has signed in successfully"),t&&o.a.remove("auth",t),n&&(clearInterval(n),s._storage.removeItem("amplify-polling-started")),s._storage.removeItem("amplify-auto-sign-in")}),(function(e){W.error(e),s._storage.removeItem("amplify-auto-sign-in")})))];case 2:return a.sent(),[3,4];case 3:return i=a.sent(),W.error(i),[3,4];case 4:return[2]}}))}))},e.prototype.confirmSignUp=function(e,t,n){var i=this;if(!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(r.a.EmptyUsername);if(!t)return this.rejectAuthError(r.a.EmptyCode);var o,s=this.createCognitoUser(e),a=!n||"boolean"!=typeof n.forceAliasCreation||n.forceAliasCreation;return n&&n.clientMetadata?o=n.clientMetadata:this._config.clientMetadata&&(o=this._config.clientMetadata),new Promise((function(n,u){s.confirmRegistration(t,a,(function(t,o){t?u(t):(J("confirmSignUp",o,e+" has been confirmed successfully"),i.isTrueStorageValue("amplify-auto-sign-in")&&!i.autoSignInInitiated&&(J("autoSignIn_failure",null,r.a.AutoSignInError),i._storage.removeItem("amplify-auto-sign-in")),n(o))}),o)}))},e.prototype.isTrueStorageValue=function(e){var t=this._storage.getItem(e);return!!t&&"true"===t},e.prototype.resendSignUp=function(e,t){if(void 0===t&&(t=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(r.a.EmptyUsername);var n=this.createCognitoUser(e);return new Promise((function(e,r){n.resendConfirmationCode((function(t,n){t?r(t):e(n)}),t)}))},e.prototype.signIn=function(e,t,n){if(void 0===n&&(n=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();var i=null,o=null,s={};if("string"==typeof e)i=e,o=t;else{if(!Object(r.h)(e))return this.rejectAuthError(r.a.InvalidUsername);void 0!==t&&W.warn("The password should be defined under the first parameter object!"),i=e.username,o=e.password,s=e.validationData}if(!i)return this.rejectAuthError(r.a.EmptyUsername);var a=new S.a({Username:i,Password:o,ValidationData:s,ClientMetadata:n});return o?this.signInWithPassword(a):this.signInWithoutPassword(a)},e.prototype.authCallbacks=function(e,t,n){var r=this,i=this;return{onSuccess:function(o){return H(r,void 0,void 0,(function(){var r,s,a,u;return V(this,(function(c){switch(c.label){case 0:W.debug(o),delete e.challengeName,delete e.challengeParam,c.label=1;case 1:return c.trys.push([1,4,5,9]),[4,this.Credentials.clear()];case 2:return c.sent(),[4,this.Credentials.set(o,"session")];case 3:return r=c.sent(),W.debug("succeed to get cognito credentials",r),[3,9];case 4:return s=c.sent(),W.debug("cannot get cognito credentials",s),[3,9];case 5:return c.trys.push([5,7,,8]),[4,this.currentUserPoolUser()];case 6:return a=c.sent(),i.user=a,J("signIn",a,"A user "+e.getUsername()+" has been signed in"),t(a),[3,8];case 7:return u=c.sent(),W.error("Failed to get the signed in user",u),n(u),[3,8];case 8:return[7];case 9:return[2]}}))}))},onFailure:function(t){W.debug("signIn failure",t),J("signIn_failure",t,e.getUsername()+" failed to signin"),n(t)},customChallenge:function(n){W.debug("signIn custom challenge answer required"),e.challengeName="CUSTOM_CHALLENGE",e.challengeParam=n,t(e)},mfaRequired:function(n,r){W.debug("signIn MFA required"),e.challengeName=n,e.challengeParam=r,t(e)},mfaSetup:function(n,r){W.debug("signIn mfa setup",n),e.challengeName=n,e.challengeParam=r,t(e)},newPasswordRequired:function(n,r){W.debug("signIn new password"),e.challengeName="NEW_PASSWORD_REQUIRED",e.challengeParam={userAttributes:n,requiredAttributes:r},t(e)},totpRequired:function(n,r){W.debug("signIn totpRequired"),e.challengeName=n,e.challengeParam=r,t(e)},selectMFAType:function(n,r){W.debug("signIn selectMFAType",n),e.challengeName=n,e.challengeParam=r,t(e)}}},e.prototype.signInWithPassword=function(e){var t=this;if(this.pendingSignIn)throw new Error("Pending sign-in attempt already in progress");var n=this.createCognitoUser(e.getUsername());return this.pendingSignIn=new Promise((function(r,i){n.authenticateUser(e,t.authCallbacks(n,(function(e){t.pendingSignIn=null,r(e)}),(function(e){t.pendingSignIn=null,i(e)})))})),this.pendingSignIn},e.prototype.signInWithoutPassword=function(e){var t=this,n=this.createCognitoUser(e.getUsername());return n.setAuthenticationFlowType("CUSTOM_AUTH"),new Promise((function(r,i){n.initiateAuth(e,t.authCallbacks(n,r,i))}))},e.prototype.getMFAOptions=function(e){return new Promise((function(t,n){e.getMFAOptions((function(e,r){if(e)return W.debug("get MFA Options failed",e),void n(e);W.debug("get MFA options success",r),t(r)}))}))},e.prototype.getPreferredMFA=function(e,t){var n=this,r=this;return new Promise((function(i,o){var s=n._config.clientMetadata,a=!!t&&t.bypassCache;e.getUserData((function(t,s){return H(n,void 0,void 0,(function(){var n,a;return V(this,(function(u){switch(u.label){case 0:if(!t)return[3,5];if(W.debug("getting preferred mfa failed",t),!this.isSessionInvalid(t))return[3,4];u.label=1;case 1:return u.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return u.sent(),[3,4];case 3:return n=u.sent(),o(new Error("Session is invalid due to: "+t.message+" and failed to clean up invalid session: "+n.message)),[2];case 4:return o(t),[2];case 5:return(a=r._getMfaTypeFromUserData(s))?(i(a),[2]):(o("invalid MFA Type"),[2])}}))}))}),{bypassCache:a,clientMetadata:s})}))},e.prototype._getMfaTypeFromUserData=function(e){var t=null,n=e.PreferredMfaSetting;if(n)t=n;else{var r=e.UserMFASettingList;if(r)0===r.length?t="NOMFA":W.debug("invalid case for getPreferredMFA",e);else t=e.MFAOptions?"SMS_MFA":"NOMFA"}return t},e.prototype._getUserData=function(e,t){var n=this;return new Promise((function(r,i){e.getUserData((function(t,o){return H(n,void 0,void 0,(function(){var n;return V(this,(function(s){switch(s.label){case 0:if(!t)return[3,5];if(W.debug("getting user data failed",t),!this.isSessionInvalid(t))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return s.sent(),[3,4];case 3:return n=s.sent(),i(new Error("Session is invalid due to: "+t.message+" and failed to clean up invalid session: "+n.message)),[2];case 4:return i(t),[2];case 5:r(o),s.label=6;case 6:return[2]}}))}))}),t)}))},e.prototype.setPreferredMFA=function(e,t){return H(this,void 0,void 0,(function(){var n,i,o,s,a,u,c=this;return V(this,(function(l){switch(l.label){case 0:return n=this._config.clientMetadata,[4,this._getUserData(e,{bypassCache:!0,clientMetadata:n})];case 1:switch(i=l.sent(),o=null,s=null,t){case"TOTP":case"SOFTWARE_TOKEN_MFA":return[3,2];case"SMS":case"SMS_MFA":return[3,3];case"NOMFA":return[3,4]}return[3,6];case 2:return s={PreferredMfa:!0,Enabled:!0},[3,7];case 3:return o={PreferredMfa:!0,Enabled:!0},[3,7];case 4:return a=i.UserMFASettingList,[4,this._getMfaTypeFromUserData(i)];case 5:if("NOMFA"===(u=l.sent()))return[2,Promise.resolve("No change for mfa type")];if("SMS_MFA"===u)o={PreferredMfa:!1,Enabled:!1};else{if("SOFTWARE_TOKEN_MFA"!==u)return[2,this.rejectAuthError(r.a.InvalidMFA)];s={PreferredMfa:!1,Enabled:!1}}return a&&0!==a.length&&a.forEach((function(e){"SMS_MFA"===e?o={PreferredMfa:!1,Enabled:!1}:"SOFTWARE_TOKEN_MFA"===e&&(s={PreferredMfa:!1,Enabled:!1})})),[3,7];case 6:return W.debug("no validmfa method provided"),[2,this.rejectAuthError(r.a.NoMFA)];case 7:return this,[2,new Promise((function(t,r){e.setUserMfaPreference(o,s,(function(i,o){if(i)return W.debug("Set user mfa preference error",i),r(i);W.debug("Set user mfa success",o),W.debug("Caching the latest user data into local"),e.getUserData((function(n,i){return H(c,void 0,void 0,(function(){var i;return V(this,(function(s){switch(s.label){case 0:if(!n)return[3,5];if(W.debug("getting user data failed",n),!this.isSessionInvalid(n))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return s.sent(),[3,4];case 3:return i=s.sent(),r(new Error("Session is invalid due to: "+n.message+" and failed to clean up invalid session: "+i.message)),[2];case 4:return[2,r(n)];case 5:return[2,t(o)]}}))}))}),{bypassCache:!0,clientMetadata:n})}))}))]}}))}))},e.prototype.disableSMS=function(e){return new Promise((function(t,n){e.disableMFA((function(e,r){if(e)return W.debug("disable mfa failed",e),void n(e);W.debug("disable mfa succeed",r),t(r)}))}))},e.prototype.enableSMS=function(e){return new Promise((function(t,n){e.enableMFA((function(e,r){if(e)return W.debug("enable mfa failed",e),void n(e);W.debug("enable mfa succeed",r),t(r)}))}))},e.prototype.setupTOTP=function(e){return new Promise((function(t,n){e.associateSoftwareToken({onFailure:function(e){W.debug("associateSoftwareToken failed",e),n(e)},associateSecretCode:function(e){W.debug("associateSoftwareToken sucess",e),t(e)}})}))},e.prototype.verifyTotpToken=function(e,t){return W.debug("verification totp token",e,t),new Promise((function(n,r){e.verifySoftwareToken(t,"My TOTP device",{onFailure:function(e){W.debug("verifyTotpToken failed",e),r(e)},onSuccess:function(t){J("signIn",e,"A user "+e.getUsername()+" has been signed in"),W.debug("verifyTotpToken success",t),n(t)}})}))},e.prototype.confirmSignIn=function(e,t,n,i){var o=this;if(void 0===i&&(i=this._config.clientMetadata),!t)return this.rejectAuthError(r.a.EmptyCode);var s=this;return new Promise((function(r,a){e.sendMFACode(t,{onSuccess:function(t){return H(o,void 0,void 0,(function(){var n,i;return V(this,(function(o){switch(o.label){case 0:W.debug(t),o.label=1;case 1:return o.trys.push([1,4,5,6]),[4,this.Credentials.clear()];case 2:return o.sent(),[4,this.Credentials.set(t,"session")];case 3:return n=o.sent(),W.debug("succeed to get cognito credentials",n),[3,6];case 4:return i=o.sent(),W.debug("cannot get cognito credentials",i),[3,6];case 5:return s.user=e,J("signIn",e,"A user "+e.getUsername()+" has been signed in"),r(e),[7];case 6:return[2]}}))}))},onFailure:function(e){W.debug("confirm signIn failure",e),a(e)}},n,i)}))},e.prototype.completeNewPassword=function(e,t,n,i){var o=this;if(void 0===n&&(n={}),void 0===i&&(i=this._config.clientMetadata),!t)return this.rejectAuthError(r.a.EmptyPassword);var s=this;return new Promise((function(r,a){e.completeNewPasswordChallenge(t,n,{onSuccess:function(t){return H(o,void 0,void 0,(function(){var n,i;return V(this,(function(o){switch(o.label){case 0:W.debug(t),o.label=1;case 1:return o.trys.push([1,4,5,6]),[4,this.Credentials.clear()];case 2:return o.sent(),[4,this.Credentials.set(t,"session")];case 3:return n=o.sent(),W.debug("succeed to get cognito credentials",n),[3,6];case 4:return i=o.sent(),W.debug("cannot get cognito credentials",i),[3,6];case 5:return s.user=e,J("signIn",e,"A user "+e.getUsername()+" has been signed in"),r(e),[7];case 6:return[2]}}))}))},onFailure:function(e){W.debug("completeNewPassword failure",e),J("completeNewPassword_failure",e,o.user+" failed to complete the new password flow"),a(e)},mfaRequired:function(t,n){W.debug("signIn MFA required"),e.challengeName=t,e.challengeParam=n,r(e)},mfaSetup:function(t,n){W.debug("signIn mfa setup",t),e.challengeName=t,e.challengeParam=n,r(e)},totpRequired:function(t,n){W.debug("signIn mfa setup",t),e.challengeName=t,e.challengeParam=n,r(e)}},i)}))},e.prototype.sendCustomChallengeAnswer=function(e,t,n){var i=this;if(void 0===n&&(n=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!t)return this.rejectAuthError(r.a.EmptyChallengeResponse);return new Promise((function(r,o){e.sendCustomChallengeAnswer(t,i.authCallbacks(e,r,o),n)}))},e.prototype.deleteUserAttributes=function(e,t){var n=this;return new Promise((function(r,i){n.userSession(e).then((function(n){e.deleteAttributes(t,(function(e,t){return e?i(e):r(t)}))}))}))},e.prototype.deleteUser=function(){return H(this,void 0,void 0,(function(){var e,t,n=this;return V(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this._storageSync];case 1:return r.sent(),[3,3];case 2:throw e=r.sent(),W.debug("Failed to sync cache info into memory",e),new Error(e);case 3:return t=this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI"),[2,new Promise((function(e,r){return H(n,void 0,void 0,(function(){var n,i=this;return V(this,(function(o){if(this.userPool){if(!(n=this.userPool.getCurrentUser()))return W.debug("Failed to get user from user pool"),[2,r(new Error("No current user."))];n.getSession((function(o,s){return H(i,void 0,void 0,(function(){var i,s=this;return V(this,(function(a){switch(a.label){case 0:if(!o)return[3,5];if(W.debug("Failed to get the user session",o),!this.isSessionInvalid(o))return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(n)];case 2:return a.sent(),[3,4];case 3:return i=a.sent(),r(new Error("Session is invalid due to: "+o.message+" and failed to clean up invalid session: "+i.message)),[2];case 4:return[2,r(o)];case 5:n.deleteUser((function(i,o){if(i)r(i);else{J("userDeleted",o,"The authenticated user has been deleted."),n.signOut(),s.user=null;try{s.cleanCachedItems()}catch(e){W.debug("failed to clear cached items")}t?s.oAuthSignOutRedirect(e,r):(J("signOut",s.user,"A user has been signed out"),e(o))}})),a.label=6;case 6:return[2]}}))}))}))}else W.debug("no Congito User pool"),r(new Error("Cognito User pool does not exist"));return[2]}))}))}))]}}))}))},e.prototype.updateUserAttributes=function(e,t,n){void 0===n&&(n=this._config.clientMetadata);var r=[],i=this;return new Promise((function(o,s){i.userSession(e).then((function(i){for(var a in t)if("sub"!==a&&a.indexOf("_verified")<0){var u={Name:a,Value:t[a]};r.push(u)}e.updateAttributes(r,(function(e,t){return e?s(e):o(t)}),n)}))}))},e.prototype.userAttributes=function(e){var t=this;return new Promise((function(n,r){t.userSession(e).then((function(t){e.getUserAttributes((function(e,t){e?r(e):n(t)}))}))}))},e.prototype.verifiedContact=function(e){var t=this;return this.userAttributes(e).then((function(e){var n=t.attributesToObject(e),r={},i={};return n.email&&(n.email_verified?i.email=n.email:r.email=n.email),n.phone_number&&(n.phone_number_verified?i.phone_number=n.phone_number:r.phone_number=n.phone_number),{verified:i,unverified:r}}))},e.prototype.isErrorWithMessage=function(e){return"object"===z(e)&&Object.prototype.hasOwnProperty.call(e,"message")},e.prototype.isTokenRevokedError=function(e){return this.isErrorWithMessage(e)&&"Access Token has been revoked"===e.message},e.prototype.isRefreshTokenRevokedError=function(e){return this.isErrorWithMessage(e)&&"Refresh Token has been revoked"===e.message},e.prototype.isUserDisabledError=function(e){return this.isErrorWithMessage(e)&&"User is disabled."===e.message},e.prototype.isUserDoesNotExistError=function(e){return this.isErrorWithMessage(e)&&"User does not exist."===e.message},e.prototype.isRefreshTokenExpiredError=function(e){return this.isErrorWithMessage(e)&&"Refresh Token has expired"===e.message},e.prototype.isSignedInHostedUI=function(){return this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI")},e.prototype.isSessionInvalid=function(e){return this.isUserDisabledError(e)||this.isUserDoesNotExistError(e)||this.isTokenRevokedError(e)||this.isRefreshTokenRevokedError(e)||this.isRefreshTokenExpiredError(e)},e.prototype.cleanUpInvalidSession=function(e){return H(this,void 0,void 0,(function(){var t=this;return V(this,(function(n){switch(n.label){case 0:e.signOut(),this.user=null,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.cleanCachedItems()];case 2:return n.sent(),[3,4];case 3:return n.sent(),W.debug("failed to clear cached items"),[3,4];case 4:return this.isSignedInHostedUI()?[2,new Promise((function(e,n){t.oAuthSignOutRedirect(e,n)}))]:(J("signOut",this.user,"A user has been signed out"),[2])}}))}))},e.prototype.currentUserPoolUser=function(e){var t=this;return this.userPool?new Promise((function(n,r){t._storageSync.then((function(){return H(t,void 0,void 0,(function(){var t,i,s=this;return V(this,(function(a){switch(a.label){case 0:return this.isOAuthInProgress()?(W.debug("OAuth signIn in progress, waiting for resolution..."),[4,new Promise((function(e){var t=setTimeout((function(){W.debug("OAuth signIn in progress timeout"),o.a.remove("auth",n),e()}),1e4);function n(r){var i=r.payload.event;"cognitoHostedUI"!==i&&"cognitoHostedUI_failure"!==i||(W.debug("OAuth signIn resolved: "+i),clearTimeout(t),o.a.remove("auth",n),e())}o.a.listen("auth",n)}))]):[3,2];case 1:a.sent(),a.label=2;case 2:return(t=this.userPool.getCurrentUser())?(i=this._config.clientMetadata,t.getSession((function(i,o){return H(s,void 0,void 0,(function(){var s,a,u,c,l=this;return V(this,(function(f){switch(f.label){case 0:if(!i)return[3,5];if(W.debug("Failed to get the user session",i),!this.isSessionInvalid(i))return[3,4];f.label=1;case 1:return f.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return f.sent(),[3,4];case 3:return s=f.sent(),r(new Error("Session is invalid due to: "+i.message+" and failed to clean up invalid session: "+s.message)),[2];case 4:return r(i),[2];case 5:return(a=!!e&&e.bypassCache)?[4,this.Credentials.clear()]:[3,7];case 6:f.sent(),f.label=7;case 7:return u=this._config.clientMetadata,c=o.getAccessToken().decodePayload().scope,(void 0===c?"":c).split(" ").includes("aws.cognito.signin.user.admin")?(t.getUserData((function(e,i){return H(l,void 0,void 0,(function(){var o,s,a,u,c,l,f;return V(this,(function(d){switch(d.label){case 0:if(!e)return[3,7];if(W.debug("getting user data failed",e),!this.isSessionInvalid(e))return[3,5];d.label=1;case 1:return d.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return d.sent(),[3,4];case 3:return o=d.sent(),r(new Error("Session is invalid due to: "+e.message+" and failed to clean up invalid session: "+o.message)),[2];case 4:return r(e),[3,6];case 5:n(t),d.label=6;case 6:return[2];case 7:for(s=i.PreferredMfaSetting||"NOMFA",a=[],u=0;u<i.UserAttributes.length;u++)c={Name:i.UserAttributes[u].Name,Value:i.UserAttributes[u].Value},l=new S.f(c),a.push(l);return f=this.attributesToObject(a),Object.assign(t,{attributes:f,preferredMFA:s}),[2,n(t)]}}))}))}),{bypassCache:a,clientMetadata:u}),[2]):(W.debug("Unable to get the user data because the aws.cognito.signin.user.admin is not in the scopes of the access token"),[2,n(t)])}}))}))}),{clientMetadata:i}),[2]):(W.debug("Failed to get user from user pool"),r("No current user"),[2])}}))}))})).catch((function(e){return W.debug("Failed to sync cache info into memory",e),r(e)}))})):this.rejectNoUserPool()},e.prototype.isOAuthInProgress=function(){return this.oAuthFlowInProgress},e.prototype.currentAuthenticatedUser=function(e){return H(this,void 0,void 0,(function(){var t,n,r,i,o;return V(this,(function(s){switch(s.label){case 0:W.debug("getting current authenticated user"),t=null,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._storageSync];case 2:return s.sent(),[3,4];case 3:throw n=s.sent(),W.debug("Failed to sync cache info into memory",n),n;case 4:try{(r=JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")))&&(t=K(K({},r.user),{token:r.token}))}catch(e){W.debug("cannot load federated user from auth storage")}return t?(this.user=t,W.debug("get current authenticated federated user",this.user),[2,this.user]):[3,5];case 5:W.debug("get current authenticated userpool user"),i=null,s.label=6;case 6:return s.trys.push([6,8,,9]),[4,this.currentUserPoolUser(e)];case 7:return i=s.sent(),[3,9];case 8:return"No userPool"===(o=s.sent())&&W.error("Cannot get the current user because the user pool is missing. Please make sure the Auth module is configured with a valid Cognito User Pool ID"),W.debug("The user is not authenticated by the error",o),[2,Promise.reject("The user is not authenticated")];case 9:return this.user=i,[2,this.user]}}))}))},e.prototype.currentSession=function(){var e=this;return W.debug("Getting current session"),this.userPool?new Promise((function(t,n){e.currentUserPoolUser().then((function(r){e.userSession(r).then((function(e){t(e)})).catch((function(e){W.debug("Failed to get the current session",e),n(e)}))})).catch((function(e){W.debug("Failed to get the current user",e),n(e)}))})):Promise.reject(new Error("No User Pool in the configuration."))},e.prototype.userSession=function(e){var t=this;if(!e)return W.debug("the user is null"),this.rejectAuthError(r.a.NoUserSession);var n=this._config.clientMetadata;return new Promise((function(r,i){W.debug("Getting the session from this user:",e),e.getSession((function(n,o){return H(t,void 0,void 0,(function(){var t;return V(this,(function(s){switch(s.label){case 0:if(!n)return[3,5];if(W.debug("Failed to get the session from user",e),!this.isSessionInvalid(n))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return s.sent(),[3,4];case 3:return t=s.sent(),i(new Error("Session is invalid due to: "+n.message+" and failed to clean up invalid session: "+t.message)),[2];case 4:return i(n),[2];case 5:return W.debug("Succeed to get the user session",o),r(o),[2]}}))}))}),{clientMetadata:n})}))},e.prototype.currentUserCredentials=function(){return H(this,void 0,void 0,(function(){var e,t,n=this;return V(this,(function(r){switch(r.label){case 0:W.debug("Getting current user credentials"),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._storageSync];case 2:return r.sent(),[3,4];case 3:throw e=r.sent(),W.debug("Failed to sync cache info into memory",e),e;case 4:t=null;try{t=JSON.parse(this._storage.getItem("aws-amplify-federatedInfo"))}catch(e){W.debug("failed to get or parse item aws-amplify-federatedInfo",e)}return t?[2,this.Credentials.refreshFederatedToken(t)]:[2,this.currentSession().then((function(e){return W.debug("getting session success",e),n.Credentials.set(e,"session")})).catch((function(){return W.debug("getting guest credentials"),n.Credentials.set(null,"guest")}))]}}))}))},e.prototype.currentCredentials=function(){return W.debug("getting current credentials"),this.Credentials.get()},e.prototype.verifyUserAttribute=function(e,t,n){return void 0===n&&(n=this._config.clientMetadata),new Promise((function(r,i){e.getAttributeVerificationCode(t,{onSuccess:function(e){return r(e)},onFailure:function(e){return i(e)}},n)}))},e.prototype.verifyUserAttributeSubmit=function(e,t,n){return n?new Promise((function(r,i){e.verifyAttribute(t,n,{onSuccess:function(e){r(e)},onFailure:function(e){i(e)}})})):this.rejectAuthError(r.a.EmptyCode)},e.prototype.verifyCurrentUserAttribute=function(e){var t=this;return t.currentUserPoolUser().then((function(n){return t.verifyUserAttribute(n,e)}))},e.prototype.verifyCurrentUserAttributeSubmit=function(e,t){var n=this;return n.currentUserPoolUser().then((function(r){return n.verifyUserAttributeSubmit(r,e,t)}))},e.prototype.cognitoIdentitySignOut=function(e,t){return H(this,void 0,void 0,(function(){var n,r,i=this;return V(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this._storageSync];case 1:return o.sent(),[3,3];case 2:throw n=o.sent(),W.debug("Failed to sync cache info into memory",n),n;case 3:return r=this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI"),[2,new Promise((function(n,o){if(e&&e.global){W.debug("user global sign out",t);var s=i._config.clientMetadata;t.getSession((function(e,s){return H(i,void 0,void 0,(function(){var i,s=this;return V(this,(function(a){switch(a.label){case 0:if(!e)return[3,5];if(W.debug("failed to get the user session",e),!this.isSessionInvalid(e))return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return a.sent(),[3,4];case 3:return i=a.sent(),o(new Error("Session is invalid due to: "+e.message+" and failed to clean up invalid session: "+i.message)),[2];case 4:return[2,o(e)];case 5:return t.globalSignOut({onSuccess:function(e){if(W.debug("global sign out success"),!r)return n();s.oAuthSignOutRedirect(n,o)},onFailure:function(e){return W.debug("global sign out failed",e),o(e)}}),[2]}}))}))}),{clientMetadata:s})}else W.debug("user sign out",t),t.signOut((function(){if(!r)return n();i.oAuthSignOutRedirect(n,o)}))}))]}}))}))},e.prototype.oAuthSignOutRedirect=function(e,t){Object(v.b)().isBrowser?this.oAuthSignOutRedirectOrReject(t):this.oAuthSignOutAndResolve(e)},e.prototype.oAuthSignOutAndResolve=function(e){this._oAuthHandler.signOut(),e()},e.prototype.oAuthSignOutRedirectOrReject=function(e){this._oAuthHandler.signOut(),setTimeout((function(){return e(Error("Signout timeout fail"))}),3e3)},e.prototype.signOut=function(e){return H(this,void 0,void 0,(function(){var t;return V(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.cleanCachedItems()];case 1:return n.sent(),[3,3];case 2:return n.sent(),W.debug("failed to clear cached items"),[3,3];case 3:return this.userPool?(t=this.userPool.getCurrentUser())?[4,this.cognitoIdentitySignOut(e,t)]:[3,5]:[3,7];case 4:return n.sent(),[3,6];case 5:W.debug("no current Cognito user"),n.label=6;case 6:return[3,8];case 7:W.debug("no Cognito User pool"),n.label=8;case 8:return J("signOut",this.user,"A user has been signed out"),this.user=null,[2]}}))}))},e.prototype.cleanCachedItems=function(){return H(this,void 0,void 0,(function(){return V(this,(function(e){switch(e.label){case 0:return[4,this.Credentials.clear()];case 1:return e.sent(),[2]}}))}))},e.prototype.changePassword=function(e,t,n,r){var i=this;return void 0===r&&(r=this._config.clientMetadata),new Promise((function(o,s){i.userSession(e).then((function(i){e.changePassword(t,n,(function(e,t){return e?(W.debug("change password failure",e),s(e)):o(t)}),r)}))}))},e.prototype.forgotPassword=function(e,t){if(void 0===t&&(t=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(r.a.EmptyUsername);var n=this.createCognitoUser(e);return new Promise((function(r,i){n.forgotPassword({onSuccess:function(){r()},onFailure:function(t){W.debug("forgot password failure",t),J("forgotPassword_failure",t,e+" forgotPassword failed"),i(t)},inputVerificationCode:function(t){J("forgotPassword",n,e+" has initiated forgot password flow"),r(t)}},t)}))},e.prototype.forgotPasswordSubmit=function(e,t,n,i){if(void 0===i&&(i=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(r.a.EmptyUsername);if(!t)return this.rejectAuthError(r.a.EmptyCode);if(!n)return this.rejectAuthError(r.a.EmptyPassword);var o=this.createCognitoUser(e);return new Promise((function(r,s){o.confirmPassword(t,n,{onSuccess:function(t){J("forgotPasswordSubmit",o,e+" forgotPasswordSubmit successful"),r(t)},onFailure:function(t){J("forgotPasswordSubmit_failure",t,e+" forgotPasswordSubmit failed"),s(t)}},i)}))},e.prototype.currentUserInfo=function(){return H(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return V(this,(function(a){switch(a.label){case 0:return(e=this.Credentials.getCredSource())&&"aws"!==e&&"userPool"!==e?[3,9]:[4,this.currentUserPoolUser().catch((function(e){return W.error(e)}))];case 1:if(!(s=a.sent()))return[2,null];a.label=2;case 2:return a.trys.push([2,8,,9]),[4,this.userAttributes(s)];case 3:t=a.sent(),n=this.attributesToObject(t),r=null,a.label=4;case 4:return a.trys.push([4,6,,7]),[4,this.currentCredentials()];case 5:return r=a.sent(),[3,7];case 6:return i=a.sent(),W.debug("Failed to retrieve credentials while getting current user info",i),[3,7];case 7:return[2,{id:r?r.identityId:void 0,username:s.getUsername(),attributes:n}];case 8:return o=a.sent(),W.error("currentUserInfo error",o),[2,{}];case 9:return"federated"===e?[2,(s=this.user)||{}]:[2]}}))}))},e.prototype.federatedSignIn=function(e,t,n){return H(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p;return V(this,(function(v){switch(v.label){case 0:if(!this._config.identityPoolId&&!this._config.userPoolId)throw new Error("Federation requires either a User Pool or Identity Pool in config");if(void 0===e&&this._config.identityPoolId&&!this._config.userPoolId)throw new Error("Federation with Identity Pools requires tokens passed as arguments");return Object(r.f)(e)||Object(r.g)(e)||Object(r.d)(e)||void 0===e?(i=e||{provider:r.b.Cognito},u=Object(r.f)(i)?i.provider:i.customProvider,Object(r.f)(i),o=i.customState,this._config.userPoolId&&(s=Object(r.e)(this._config.oauth)?this._config.userPoolWebClientId:this._config.oauth.clientID,a=Object(r.e)(this._config.oauth)?this._config.oauth.redirectSignIn:this._config.oauth.redirectUri,this._oAuthHandler.oauthSignIn(this._config.oauth.responseType,this._config.oauth.domain,a,s,u,o)),[3,4]):[3,1];case 1:u=e;try{(c=JSON.stringify(JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")).user))&&W.warn("There is already a signed in user: "+c+" in your app.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tYou should not call Auth.federatedSignIn method again as it may cause unexpected behavior.")}catch(e){}return l=t.token,f=t.identity_id,d=t.expires_at,[4,this.Credentials.set({provider:u,token:l,identity_id:f,user:n,expires_at:d},"federation")];case 2:return h=v.sent(),[4,this.currentAuthenticatedUser()];case 3:return p=v.sent(),J("signIn",p,"A user "+p.username+" has been signed in"),W.debug("federated sign in credentials",h),[2,h];case 4:return[2]}}))}))},e.prototype._handleAuthResponse=function(e){return H(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,f,d,h,p;return V(this,(function(y){switch(y.label){case 0:if(this.oAuthFlowInProgress)return W.debug("Skipping URL "+e+" current flow in progress"),[2];y.label=1;case 1:if(y.trys.push([1,,8,9]),this.oAuthFlowInProgress=!0,!this._config.userPoolId)throw new Error("OAuth responses require a User Pool defined in config");if(J("parsingCallbackUrl",{url:e},"The callback url is being parsed"),t=e||(Object(v.b)().isBrowser?window.location.href:""),n=!!(Object(_.parse)(t).query||"").split("&").map((function(e){return e.split("=")})).find((function(e){var t=G(e,1)[0];return"code"===t||"error"===t})),r=!!(Object(_.parse)(t).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).find((function(e){var t=G(e,1)[0];return"access_token"===t||"error"===t})),!n&&!r)return[3,7];this._storage.setItem("amplify-redirected-from-hosted-ui","true"),y.label=2;case 2:return y.trys.push([2,6,,7]),[4,this._oAuthHandler.handleAuthResponse(t)];case 3:return i=y.sent(),o=i.accessToken,s=i.idToken,a=i.refreshToken,u=i.state,c=new S.h({IdToken:new S.c({IdToken:s}),RefreshToken:new S.d({RefreshToken:a}),AccessToken:new S.b({AccessToken:o})}),l=void 0,this._config.identityPoolId?[4,this.Credentials.set(c,"session")]:[3,5];case 4:l=y.sent(),W.debug("AWS credentials",l),y.label=5;case 5:return f=/-/.test(u),(d=this.createCognitoUser(c.getIdToken().decodePayload()["cognito:username"])).setSignInUserSession(c),window&&void 0!==window.history&&window.history.replaceState({},null,this._config.oauth.redirectSignIn),J("signIn",d,"A user "+d.getUsername()+" has been signed in"),J("cognitoHostedUI",d,"A user "+d.getUsername()+" has been signed in via Cognito Hosted UI"),f&&(h=u.split("-").splice(1).join("-"),J("customOAuthState",h.match(/.{2}/g).map((function(e){return String.fromCharCode(parseInt(e,16))})).join(""),"State for user "+d.getUsername())),[2,l];case 6:return p=y.sent(),W.debug("Error in cognito hosted auth response",p),window&&void 0!==window.history&&window.history.replaceState({},null,this._config.oauth.redirectSignIn),J("signIn_failure",p,"The OAuth response flow failed"),J("cognitoHostedUI_failure",p,"A failure occurred when returning to the Cognito Hosted UI"),J("customState_failure",p,"A failure occurred when returning state"),[3,7];case 7:return[3,9];case 8:return this.oAuthFlowInProgress=!1,[7];case 9:return[2]}}))}))},e.prototype.essentialCredentials=function(e){return{accessKeyId:e.accessKeyId,sessionToken:e.sessionToken,secretAccessKey:e.secretAccessKey,identityId:e.identityId,authenticated:e.authenticated}},e.prototype.attributesToObject=function(e){var t=this,n={};return e&&e.map((function(e){"email_verified"===e.Name||"phone_number_verified"===e.Name?n[e.Name]=t.isTruthyString(e.Value)||!0===e.Value:n[e.Name]=e.Value})),n},e.prototype.isTruthyString=function(e){return"function"==typeof e.toLowerCase&&"true"===e.toLowerCase()},e.prototype.createCognitoUser=function(e){var t={Username:e,Pool:this.userPool};t.Storage=this._storage;var n=this._config.authenticationFlowType,r=new S.e(t);return n&&r.setAuthenticationFlowType(n),r},e.prototype._isValidAuthStorage=function(e){return!!e&&"function"==typeof e.getItem&&"function"==typeof e.setItem&&"function"==typeof e.removeItem&&"function"==typeof e.clear},e.prototype.noUserPoolErrorHandler=function(e){return!e||e.userPoolId&&e.identityPoolId?r.a.NoConfig:r.a.MissingAuthConfig},e.prototype.rejectAuthError=function(e){return Promise.reject(new L(e))},e.prototype.rejectNoUserPool=function(){var e=this.noUserPoolErrorHandler(this._config);return Promise.reject(new B(e))},e.prototype.rememberDevice=function(){return H(this,void 0,void 0,(function(){var e,t;return V(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.currentUserPoolUser()];case 1:return e=n.sent(),[3,3];case 2:return t=n.sent(),W.debug("The user is not authenticated by the error",t),[2,Promise.reject("The user is not authenticated")];case 3:return e.getCachedDeviceKeyAndPassword(),[2,new Promise((function(t,n){e.setDeviceStatusRemembered({onSuccess:function(e){t(e)},onFailure:function(e){"InvalidParameterException"===e.code?n(new L(r.a.DeviceConfig)):"NetworkError"===e.code?n(new L(r.a.NetworkError)):n(e)}})}))]}}))}))},e.prototype.forgetDevice=function(){return H(this,void 0,void 0,(function(){var e,t;return V(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.currentUserPoolUser()];case 1:return e=n.sent(),[3,3];case 2:return t=n.sent(),W.debug("The user is not authenticated by the error",t),[2,Promise.reject("The user is not authenticated")];case 3:return e.getCachedDeviceKeyAndPassword(),[2,new Promise((function(t,n){e.forgetDevice({onSuccess:function(e){t(e)},onFailure:function(e){"InvalidParameterException"===e.code?n(new L(r.a.DeviceConfig)):"NetworkError"===e.code?n(new L(r.a.NetworkError)):n(e)}})}))]}}))}))},e.prototype.fetchDevices=function(){return H(this,void 0,void 0,(function(){var e,t;return V(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.currentUserPoolUser()];case 1:return e=n.sent(),[3,3];case 2:throw t=n.sent(),W.debug("The user is not authenticated by the error",t),new Error("The user is not authenticated");case 3:return e.getCachedDeviceKeyAndPassword(),[2,new Promise((function(t,n){var i={onSuccess:function(e){var n=e.Devices.map((function(e){var t=e.DeviceAttributes.find((function(e){return"device_name"===e.Name}))||{};return{id:e.DeviceKey,name:t.Value}}));t(n)},onFailure:function(e){"InvalidParameterException"===e.code?n(new L(r.a.DeviceConfig)):"NetworkError"===e.code?n(new L(r.a.NetworkError)):n(e)}};e.listDevices(60,null,i)}))]}}))}))},e}())(null);w.a.register($)},function(e,t,n){"use strict";n.r(t),n.d(t,"fromUtf8",(function(){return r})),n.d(t,"toUtf8",(function(){return i}));var r=function(e){return"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e.charCodeAt(n);if(i<128)t.push(i);else if(i<2048)t.push(i>>6|192,63&i|128);else if(n+1<e.length&&55296==(64512&i)&&56320==(64512&e.charCodeAt(n+1))){var o=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n));t.push(o>>18|240,o>>12&63|128,o>>6&63|128,63&o|128)}else t.push(i>>12|224,i>>6&63|128,63&i|128)}return Uint8Array.from(t)}(e)},i=function(e){return"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):function(e){for(var t="",n=0,r=e.length;n<r;n++){var i=e[n];if(i<128)t+=String.fromCharCode(i);else if(192<=i&&i<224){var o=e[++n];t+=String.fromCharCode((31&i)<<6|63&o)}else if(240<=i&&i<365){var s="%"+[i,e[++n],e[++n],e[++n]].map((function(e){return e.toString(16)})).join("%");t+=decodeURIComponent(s)}else t+=String.fromCharCode((15&i)<<12|(63&e[++n])<<6|63&e[++n])}return t}(e)}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return i}));var r={userAgent:"aws-amplify/4.6.1 js",product:"",navigator:null,isReactNative:!1};if("undefined"!=typeof navigator&&navigator.product)switch(r.product=navigator.product||"",r.navigator=navigator||null,navigator.product){case"ReactNative":r.userAgent="aws-amplify/4.6.1 react-native",r.isReactNative=!0;break;default:r.userAgent="aws-amplify/4.6.1 js",r.isReactNative=!1}var i=function(e){return""+r.userAgent+(e||"")}},,,function(e,t,n){"use strict";n.r(t),n.d(t,"locateWindow",(function(){return i}));var r={};function i(){return"undefined"!=typeof window?window:"undefined"!=typeof self?self:r}},function(e,t,n){var r;e.exports=(r=n(12),function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,s=t.algo,a=[],u=[];!function(){function t(t){for(var n=e.sqrt(t),r=2;r<=n;r++)if(!(t%r))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var r=2,i=0;i<64;)t(r)&&(i<8&&(a[i]=n(e.pow(r,.5))),u[i]=n(e.pow(r,1/3)),i++),r++}();var c=[],l=s.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],l=n[5],f=n[6],d=n[7],h=0;h<64;h++){if(h<16)c[h]=0|e[t+h];else{var p=c[h-15],v=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,y=c[h-2],g=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;c[h]=v+c[h-7]+g+c[h-16]}var m=r&i^r&o^i&o,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),w=d+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&f)+u[h]+c[h];d=f,f=l,l=a,a=s+w|0,s=o,o=i,i=r,r=w+(b+m)|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+f|0,n[7]=n[7]+d|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),r.SHA256)},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(21),i=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},o=new r.a("Amplify"),s=new(function(){function e(){this._components=[],this._config={},this._modules={},this.Auth=null,this.Analytics=null,this.API=null,this.Credentials=null,this.Storage=null,this.I18n=null,this.Cache=null,this.PubSub=null,this.Interactions=null,this.Pushnotification=null,this.UI=null,this.XR=null,this.Predictions=null,this.DataStore=null,this.Geo=null,this.Logger=r.a,this.ServiceWorker=null}return e.prototype.register=function(e){o.debug("component registered in amplify",e),this._components.push(e),"function"==typeof e.getModuleName?(this._modules[e.getModuleName()]=e,this[e.getModuleName()]=e):o.debug("no getModuleName method for component",e),e.configure(this._config)},e.prototype.configure=function(e){var t=this;return e?(this._config=Object.assign(this._config,e),o.debug("amplify config",this._config),Object.entries(this._modules).forEach((function(e){var n=i(e,2),r=(n[0],n[1]);Object.keys(r).forEach((function(e){t._modules[e]&&(r[e]=t._modules[e])}))})),this._components.map((function(e){e.configure(t._config)})),this._config):this._config},e.prototype.addPluggable=function(e){e&&e.getCategory&&"function"==typeof e.getCategory&&this._components.map((function(t){t.addPluggable&&"function"==typeof t.addPluggable&&t.addPluggable(e)}))},e}())},function(e,t,n){var r,i,o;e.exports=(o=n(12),i=(r=o).lib.WordArray,r.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var i=[],o=0;o<n;o+=3)for(var s=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a<n;a++)i.push(r.charAt(s>>>6*(3-a)&63));var u=r.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var t=e.length,n=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var o=0;o<n.length;o++)r[n.charCodeAt(o)]=o}var s=n.charAt(64);if(s){var a=e.indexOf(s);-1!==a&&(t=a)}return function(e,t,n){for(var r=[],o=0,s=0;s<t;s++)if(s%4){var a=n[e.charCodeAt(s-1)]<<s%4*2,u=n[e.charCodeAt(s)]>>>6-s%4*2,c=a|u;r[o>>>2]|=c<<24-o%4*8,o++}return i.create(r,o)}(e,t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},o.enc.Base64)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(0).__exportStar(n(136),t)},function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return A}));var r,i,o=n(18),s=n(3),a=n(32),u=n(19),c=n(21),l=n(77),f=n(14),d=n(10),h=n(1),p=n(4),v=n(5),y=n(2),g=n(23),m=function(){return(m=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},b=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},w=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},S=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},_=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(S(arguments[t]));return e},E=new c.a("DataStore");!function(e){e.CONNECTED="CONNECTED"}(r||(r={})),function(e){e[e.none=0]="none",e[e.unauth=1]="unauth",e[e.auth=2]="auth"}(i||(i={}));var A=function(){function t(e,t,n,r,i,s){void 0===n&&(n={}),void 0===s&&(s={Auth:a.a,API:o.a,Cache:u.a}),this.schema=e,this.syncPredicates=t,this.amplifyConfig=n,this.authModeStrategy=r,this.errorHandler=i,this.amplifyContext=s,this.typeQuery=new WeakMap,this.buffer=[]}return t.prototype.buildSubscription=function(e,t,n,r,i,o,s){var a=this.amplifyConfig.aws_appsync_authenticationType,u=this.getAuthorizationInfo(t,r,a,i,o,s)||{},c=u.isOwner,l=u.ownerField,f=u.ownerValue,d=S(Object(p.c)(e,t,n,c,l),3);return{authMode:s,opType:d[0],opName:d[1],query:d[2],isOwner:c,ownerField:l,ownerValue:f}},t.prototype.getAuthorizationInfo=function(e,t,n,r,o,a){void 0===r&&(r={}),void 0===o&&(o={});var u=Object(p.e)(e);if(a===s.c.AWS_IAM&&u.find((function(e){return"private"===e.authStrategy&&"iam"===e.provider}))&&t===i.unauth)return null;var c,l=u.filter((function(e){return"groups"===e.authStrategy&&["userPools","oidc"].includes(e.provider)}));return a!==s.c.AMAZON_COGNITO_USER_POOLS&&a!==s.c.OPENID_CONNECT||!l.find((function(e){var t=Object(p.j)(r,e),n=Object(p.j)(o,e);return _(t,n).find((function(t){return e.groups.find((function(e){return e===t}))}))}))?((a===s.c.AMAZON_COGNITO_USER_POOLS?u.filter((function(e){return"owner"===e.authStrategy&&"userPools"===e.provider})):[]).forEach((function(e){var t=r[e.identityClaim];t&&(c={authMode:s.c.AMAZON_COGNITO_USER_POOLS,isOwner:!e.areSubscriptionsPublic,ownerField:e.ownerField,ownerValue:t})})),c||((a===s.c.OPENID_CONNECT?u.filter((function(e){return"owner"===e.authStrategy&&"oidc"===e.provider})):[]).forEach((function(e){var t=o[e.identityClaim];t&&(c={authMode:s.c.OPENID_CONNECT,isOwner:!e.areSubscriptionsPublic,ownerField:e.ownerField,ownerValue:t})})),c||{authMode:a||n,isOwner:!1})):{authMode:a,isOwner:!1}},t.prototype.hubQueryCompletionListener=function(e,t){t.payload.event===f.CONTROL_MSG.SUBSCRIPTION_ACK&&e()},t.prototype.start=function(){var t=this;return[new d.a((function(n){var o,s,a=[],u={},c=i.none;return b(t,void 0,void 0,(function(){var t,d,_,A,O,I,T,C,x,P,k=this;return w(this,(function(N){switch(N.label){case 0:return N.trys.push([0,2,,3]),[4,this.amplifyContext.Auth.currentCredentials()];case 1:return t=N.sent(),c=t.authenticated?i.auth:i.unauth,[3,3];case 2:return N.sent(),[3,3];case 3:return N.trys.push([3,5,,6]),[4,this.amplifyContext.Auth.currentSession()];case 4:return d=N.sent(),o=d.getIdToken().decodePayload(),[3,6];case 5:return N.sent(),[3,6];case 6:if(N.trys.push([6,11,,12]),_=this.amplifyConfig,A=_.aws_cognito_region,O=_.Auth,!A||O&&!O.region)throw"Auth is not configured";return I=void 0,[4,this.amplifyContext.Cache.getItem("federatedInfo")];case 7:return(T=N.sent())?(I=T.token,[3,10]):[3,8];case 8:return[4,this.amplifyContext.Auth.currentAuthenticatedUser()];case 9:(C=N.sent())&&(I=C.token),N.label=10;case 10:return I&&(x=I.split(".")[1],s=JSON.parse(e.from(x,"base64").toString("utf8"))),[3,12];case 11:return P=N.sent(),E.debug("error getting OIDC JWT",P),[3,12];case 12:return Object.values(this.schema.namespaces).forEach((function(e){Object.values(e.models).filter((function(e){return e.syncable})).forEach((function(t){return b(k,void 0,void 0,(function(){var r,i,d,_,A,O,I,T,C=this;return w(this,(function(x){switch(x.label){case 0:return[4,Object(p.h)({authModeStrategy:this.authModeStrategy,defaultAuthMode:this.amplifyConfig.aws_appsync_authenticationType,modelName:t.name,schema:this.schema})];case 1:return r=x.sent(),i=r.READ,u=m(m({},u),((O={})[t.name]=((I={})[p.a.CREATE]=[],I[p.a.UPDATE]=[],I[p.a.DELETE]=[],I),O)),d=[p.a.CREATE,p.a.UPDATE,p.a.DELETE],(T={})[p.a.CREATE]=0,T[p.a.UPDATE]=0,T[p.a.DELETE]=0,_=T,A=function(r){return b(C,void 0,void 0,(function(){var d,O,I,T,C,x,P,k,N,M,j,R,D,U=this;return w(this,(function(F){switch(F.label){case 0:return d=this.buildSubscription(e,t,r,c,o,s,i[_[r]]),O=d.opType,I=d.opName,T=d.query,C=d.isOwner,x=d.ownerField,P=d.ownerValue,k=d.authMode,[4,Object(p.i)(k,this.amplifyConfig)];case 1:if(N=F.sent(),M={},C){if(!P)return n.error("Owner field required, sign in is needed in order to perform this operation"),[2];M[x]=P}return E.debug("Attempting "+r+" subscription with authMode: "+i[_[r]]),j=y.f,R=this.amplifyContext.API.graphql(m(m({query:T,variables:M},{authMode:k}),{authToken:N,userAgentSuffix:j})),u[t.name][O].push(R.map((function(e){return e.value})).subscribe({next:function(e){var n=e.data,r=e.errors;if(Array.isArray(r)&&r.length>0){var i=r.map((function(e){return e.message}));return E.warn("Skipping incoming subscription. Messages: "+i.join("\n")),void U.drainBuffer()}var o=v.a.getPredicates(U.syncPredicates.get(t),!1),s=n[I];U.passesPredicateValidation(s,o)&&U.pushToBuffer(O,t,s),U.drainBuffer()},error:function(e){return b(U,void 0,void 0,(function(){var o,s,a,c,l,d;return w(this,(function(p){switch(p.label){case 0:if(o=e.error,s=S((void 0===o?{errors:[]}:o).errors,1),a=s[0],c=(void 0===a?{}:a).message,(l=void 0===c?"":c).includes(f.CONTROL_MSG.REALTIME_SUBSCRIPTION_INIT_ERROR)||l.includes(f.CONTROL_MSG.CONNECTION_FAILED)){if(u[t.name][O].forEach((function(e){return e.unsubscribe()})),u[t.name][O]=[],_[r]++,!(_[r]>=i.length))return E.debug(r+" subscription failed with authMode: "+i[_[r]-1]+". Retrying with authMode: "+i[_[r]]),A(r),[2];E.debug(r+" subscription failed with authMode: "+i[_[r]-1])}E.warn("subscriptionError",l),p.label=1;case 1:return p.trys.push([1,3,,4]),[4,this.errorHandler({recoverySuggestion:"Ensure app code is up to date, auth directives exist and are correct on each model, and that server-side data has not been invalidated by a schema change. If the problem persists, search for or create an issue: https://github.com/aws-amplify/amplify-js/issues",localModel:null,message:l,model:t.name,operation:r,errorType:Object(g.b)(e),process:h.i.subscribe,remoteModel:null,cause:e})];case 2:return p.sent(),[3,4];case 3:return d=p.sent(),E.error("Subscription error handler failed with:",d),[3,4];case 4:return"function"==typeof D&&D(),l.includes('"errorType":"Unauthorized"')||l.includes('"errorType":"OperationDisabled"')||n.error(l),[2]}}))}))}})),a.push(b(U,void 0,void 0,(function(){var e,t=this;return w(this,(function(n){switch(n.label){case 0:return[4,new Promise((function(n){D=n,e=t.hubQueryCompletionListener.bind(t,n),l.a.listen("api",e)}))];case 1:return n.sent(),l.a.remove("api",e),[2]}}))}))),[2]}}))}))},d.forEach((function(e){return A(e)})),[2]}}))}))}))})),Promise.all(a).then((function(){return n.next(r.CONNECTED)})),[2]}}))})),function(){Object.keys(u).forEach((function(e){u[e][p.a.CREATE].forEach((function(e){return e.unsubscribe()})),u[e][p.a.UPDATE].forEach((function(e){return e.unsubscribe()})),u[e][p.a.DELETE].forEach((function(e){return e.unsubscribe()}))}))}})),new d.a((function(e){return t.dataObserver=e,t.drainBuffer(),function(){t.dataObserver=null}}))]},t.prototype.passesPredicateValidation=function(e,t){if(!t)return!0;var n=t.predicates,r=t.type;return Object(y.D)(e,r,n)},t.prototype.pushToBuffer=function(e,t,n){this.buffer.push([e,t,n])},t.prototype.drainBuffer=function(){var e=this;this.dataObserver&&(this.buffer.forEach((function(t){return e.dataObserver.next(t)})),this.buffer=[])},t}()}).call(this,n(6).Buffer)},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var i=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,i=n;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}},function(e,t,n){var r;e.exports=(r=n(12),function(){if("function"==typeof ArrayBuffer){var e=r.lib.WordArray,t=e.init;(e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var n=e.byteLength,r=[],i=0;i<n;i++)r[i>>>2]|=e[i]<<24-i%4*8;t.call(this,r,n)}else t.apply(this,arguments)}).prototype=e}}(),r.lib.WordArray)},function(e,t,n){"use strict";n.r(t),t.default=function(e,t){return t=t||{},new Promise((function(n,r){var i=new XMLHttpRequest,o=[],s=[],a={},u=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:u,headers:{keys:function(){return o},entries:function(){return s},get:function(e){return a[e.toLowerCase()]},has:function(e){return e.toLowerCase()in a}}}};for(var c in i.open(t.method||"get",e,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,n){o.push(t=t.toLowerCase()),s.push([t,n]),a[t]=a[t]?a[t]+","+n:n})),n(u())},i.onerror=r,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(c,t.headers[c]);i.send(t.body||null)}))}},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var u,c=[],l=!1,f=-1;function d(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&h())}function h(){if(!l){var e=a(d);l=!0;for(var t=c.length;t;){for(u=c,c=[];++f<t;)u&&u[f].run();f=-1,t=c.length}u=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new p(e,t)),1!==c.length||l||a(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r=function(){function e(){}return e.createPredicateBuilder=function(t){var n=t.name,r=new Set(Object.keys(t.fields)),i=new Proxy({},{get:function(t,i,o){var s=i;if(!r.has(s))throw new Error("Invalid field for model. field: "+s+", model: "+n);return function(t){return e.sortPredicateGroupsMap.get(o).push({field:s,sortDirection:t}),o}}});return e.sortPredicateGroupsMap.set(i,[]),i},e.isValidPredicate=function(t){return e.sortPredicateGroupsMap.has(t)},e.getPredicates=function(t,n){if(void 0===n&&(n=!0),n&&!e.isValidPredicate(t))throw new Error("The predicate is not valid");return e.sortPredicateGroupsMap.get(t)},e.createFromExisting=function(t,n){if(n&&t)return n(e.createPredicateBuilder(t))},e.sortPredicateGroupsMap=new WeakMap,e}()},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var i=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,i=n;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(102),i=n(53),o=n(33),s=n(37),a=function(){function e(e){e?(this.operation=function(e){return new Promise((function(t,n){var r=(0,s.locateWindow)().msCrypto.subtle.importKey("raw",u(e),i.SHA_256_HMAC_ALGO,!1,["sign"]);r.oncomplete=function(){r.result&&t(r.result),n(new Error("ImportKey completed without importing key."))},r.onerror=function(){n(new Error("ImportKey failed to import key."))}}))}(e).then((function(e){return(0,s.locateWindow)().msCrypto.subtle.sign(i.SHA_256_HMAC_ALGO,e)})),this.operation.catch((function(){}))):this.operation=Promise.resolve((0,s.locateWindow)().msCrypto.subtle.digest("SHA-256"))}return e.prototype.update=function(e){var t=this;(0,r.isEmptyData)(e)||(this.operation=this.operation.then((function(n){return n.onerror=function(){t.operation=Promise.reject(new Error("Error encountered updating hash"))},n.process(u(e)),n})),this.operation.catch((function(){})))},e.prototype.digest=function(){return this.operation.then((function(e){return new Promise((function(t,n){e.onerror=function(){n(new Error("Error encountered finalizing hash"))},e.oncomplete=function(){e.result&&t(new Uint8Array(e.result)),n(new Error("Error encountered finalizing hash"))},e.finish()}))}))},e}();function u(e){return"string"==typeof e?(0,o.fromUtf8)(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.Sha256=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EMPTY_DATA_SHA_256=t.SHA_256_HMAC_ALGO=t.SHA_256_HASH=void 0,t.SHA_256_HASH={name:"SHA-256"},t.SHA_256_HMAC_ALGO={name:"HMAC",hash:t.SHA_256_HASH},t.EMPTY_DATA_SHA_256=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(55),i=n(53),o=n(37),s=function(){function e(e){this.toHash=new Uint8Array(0),void 0!==e&&(this.key=new Promise((function(t,n){(0,o.locateWindow)().crypto.subtle.importKey("raw",(0,r.convertToBuffer)(e),i.SHA_256_HMAC_ALGO,!1,["sign"]).then(t,n)})),this.key.catch((function(){})))}return e.prototype.update=function(e){if(!(0,r.isEmptyData)(e)){var t=(0,r.convertToBuffer)(e),n=new Uint8Array(this.toHash.byteLength+t.byteLength);n.set(this.toHash,0),n.set(t,this.toHash.byteLength),this.toHash=n}},e.prototype.digest=function(){var e=this;return this.key?this.key.then((function(t){return(0,o.locateWindow)().crypto.subtle.sign(i.SHA_256_HMAC_ALGO,t,e.toHash).then((function(e){return new Uint8Array(e)}))})):(0,r.isEmptyData)(this.toHash)?Promise.resolve(i.EMPTY_DATA_SHA_256):Promise.resolve().then((function(){return(0,o.locateWindow)().crypto.subtle.digest(i.SHA_256_HASH,e.toHash)})).then((function(e){return Promise.resolve(new Uint8Array(e))}))},e}();t.Sha256=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=t.numToUint8=t.isEmptyData=t.convertToBuffer=void 0;var r=n(103);Object.defineProperty(t,"convertToBuffer",{enumerable:!0,get:function(){return r.convertToBuffer}});var i=n(104);Object.defineProperty(t,"isEmptyData",{enumerable:!0,get:function(){return i.isEmptyData}});var o=n(105);Object.defineProperty(t,"numToUint8",{enumerable:!0,get:function(){return o.numToUint8}});var s=n(106);Object.defineProperty(t,"uint32ArrayFrom",{enumerable:!0,get:function(){return s.uint32ArrayFrom}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MAX_HASHABLE_LENGTH=t.INIT=t.KEY=t.DIGEST_LENGTH=t.BLOCK_SIZE=void 0,t.BLOCK_SIZE=64,t.DIGEST_LENGTH=32,t.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),t.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1},function(e,t,n){(function(t){var r;e.exports=(r=r||function(e,r){var i;if("undefined"!=typeof window&&window.crypto&&(i=window.crypto),"undefined"!=typeof self&&self.crypto&&(i=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(i=globalThis.crypto),!i&&"undefined"!=typeof window&&window.msCrypto&&(i=window.msCrypto),!i&&void 0!==t&&t.crypto&&(i=t.crypto),!i)try{i=n(118)}catch(e){}var o=function(){if(i){if("function"==typeof i.getRandomValues)try{return i.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof i.randomBytes)try{return i.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),a={},u=a.lib={},c=u.Base={extend:function(e){var t=s(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},l=u.WordArray=c.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||d).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,i=e.sigBytes;if(this.clamp(),r%4)for(var o=0;o<i;o++){var s=n[o>>>2]>>>24-o%4*8&255;t[r+o>>>2]|=s<<24-(r+o)%4*8}else for(var a=0;a<i;a+=4)t[r+a>>>2]=n[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n<e;n+=4)t.push(o());return new l.init(t,e)}}),f=a.enc={},d=f.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new l.init(n,t/2)}},h=f.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new l.init(n,t)}},p=f.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},v=u.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,r=this._data,i=r.words,o=r.sigBytes,s=this.blockSize,a=o/(4*s),u=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,c=e.min(4*u,o);if(u){for(var f=0;f<u;f+=s)this._doProcessBlock(i,f);n=i.splice(0,u),r.sigBytes-=c}return new l.init(n,c)},clone:function(){var e=c.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),y=(u.Hasher=v.extend({cfg:c.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){v.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new y.HMAC.init(e,n).finalize(t)}}}),a.algo={});return a}(Math),r)}).call(this,n(27))},function(e,t,n){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},function(e,t,n){"use strict";var r=n(13);function i(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var o;if(n)o=n(t);else if(r.isURLSearchParams(t))o=t.toString();else{var s=[];r.forEach(t,(function(e,t){null!=e&&(r.isArray(e)?t+="[]":e=[e],r.forEach(e,(function(e){r.isDate(e)?e=e.toISOString():r.isObject(e)&&(e=JSON.stringify(e)),s.push(i(t)+"="+i(e))})))})),o=s.join("&")}if(o){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}},function(e,t,n){"use strict";e.exports=function(e,t,n,r,i){return e.config=t,n&&(e.code=n),e.request=r,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}},function(e,t,n){"use strict";var r=n(13),i=n(125),o=n(126),s=n(59),a=n(127),u=n(130),c=n(131),l=n(62),f=n(29),d=n(30);e.exports=function(e){return new Promise((function(t,n){var h,p=e.data,v=e.headers,y=e.responseType;function g(){e.cancelToken&&e.cancelToken.unsubscribe(h),e.signal&&e.signal.removeEventListener("abort",h)}r.isFormData(p)&&delete v["Content-Type"];var m=new XMLHttpRequest;if(e.auth){var b=e.auth.username||"",w=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";v.Authorization="Basic "+btoa(b+":"+w)}var S=a(e.baseURL,e.url);function _(){if(m){var r="getAllResponseHeaders"in m?u(m.getAllResponseHeaders()):null,o={data:y&&"text"!==y&&"json"!==y?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m};i((function(e){t(e),g()}),(function(e){n(e),g()}),o),m=null}}if(m.open(e.method.toUpperCase(),s(S,e.params,e.paramsSerializer),!0),m.timeout=e.timeout,"onloadend"in m?m.onloadend=_:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(_)},m.onabort=function(){m&&(n(l("Request aborted",e,"ECONNABORTED",m)),m=null)},m.onerror=function(){n(l("Network Error",e,null,m)),m=null},m.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",r=e.transitional||f.transitional;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(l(t,e,r.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",m)),m=null},r.isStandardBrowserEnv()){var E=(e.withCredentials||c(S))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;E&&(v[e.xsrfHeaderName]=E)}"setRequestHeader"in m&&r.forEach(v,(function(e,t){void 0===p&&"content-type"===t.toLowerCase()?delete v[t]:m.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(m.withCredentials=!!e.withCredentials),y&&"json"!==y&&(m.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&m.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&m.upload&&m.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(h=function(e){m&&(n(!e||e&&e.type?new d("canceled"):e),m.abort(),m=null)},e.cancelToken&&e.cancelToken.subscribe(h),e.signal&&(e.signal.aborted?h():e.signal.addEventListener("abort",h))),p||(p=null),m.send(p)}))}},function(e,t,n){"use strict";var r=n(60);e.exports=function(e,t,n,i,o){var s=new Error(e);return r(s,t,n,i,o)}},function(e,t,n){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,n){"use strict";var r=n(13);e.exports=function(e,t){t=t||{};var n={};function i(e,t){return r.isPlainObject(e)&&r.isPlainObject(t)?r.merge(e,t):r.isPlainObject(t)?r.merge({},t):r.isArray(t)?t.slice():t}function o(n){return r.isUndefined(t[n])?r.isUndefined(e[n])?void 0:i(void 0,e[n]):i(e[n],t[n])}function s(e){if(!r.isUndefined(t[e]))return i(void 0,t[e])}function a(n){return r.isUndefined(t[n])?r.isUndefined(e[n])?void 0:i(void 0,e[n]):i(void 0,t[n])}function u(n){return n in t?i(e[n],t[n]):n in e?i(void 0,e[n]):void 0}var c={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u};return r.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=c[e]||o,i=t(e);r.isUndefined(i)&&t!==u||(n[e]=i)})),n}},function(e,t){e.exports={version:"0.26.0"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BLOCK_SIZE=64,t.DIGEST_LENGTH=32,t.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),t.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r={},i=function(){function e(){}return e.setItem=function(e,t){return r[e]=t,r[e]},e.getItem=function(e){return Object.prototype.hasOwnProperty.call(r,e)?r[e]:void 0},e.removeItem=function(e){return delete r[e]},e.clear=function(){return r={}},e}(),o=function(){function e(){try{this.storageWindow=window.localStorage,this.storageWindow.setItem("aws.amplify.test-ls",1),this.storageWindow.removeItem("aws.amplify.test-ls")}catch(e){this.storageWindow=i}}return e.prototype.getStorage=function(){return this.storageWindow},e}()},function(e,t,n){"use strict";(function(e){var r;if(n.d(t,"a",(function(){return i})),"undefined"!=typeof window&&window.crypto&&(r=window.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==e&&e.crypto&&(r=e.crypto),!r)try{r=n(90)}catch(e){}function i(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")}}).call(this,n(27))},function(e,t,n){"use strict";var r,i,o=n(92);function s(e,t,n){if(e._observer)a(e._observer,t,n);else if(e._observers){var r=[];e._observers.forEach((function(e){r.push(e)})),r.forEach((function(e){a(e,t,n)}))}}function a(e,t,n){if(!e.closed)switch(t){case"next":return e.next(n);case"error":return e.error(n);case"complete":return e.complete(n)}}function u(e){return e._observer||e._observers&&e._observers.size>0}function c(e){var t=this;this._observer=null,this._observers=null,this._observable=new o((function(n){return function(e,t){!u(e)&&t&&t.start&&t.start()}(t,e),function(e,t){e._observers?e._observers.add(t):e._observer?(e._observers=new Set,e._observers.add(e._observer),e._observers.add(t),e._observer=null):e._observer=t}(t,n),function(){!function(e,t){e._observers?e._observers.delete(t):e._observer===t&&(e._observer=null)}(t,n),function(e,t){!u(e)&&t&&t.pause&&t.pause()}(t,e)}}))}r=c.prototype,i={get observable(){return this._observable},get observed(){return u(this)},next:function(e){s(this,"next",e)},error:function(e){s(this,"error",e)},complete:function(e){s(this,"complete",e)}},Object.keys(i).forEach((function(e){var t=Object.getOwnPropertyDescriptor(i,e);t.enumerable=!1,Object.defineProperty(r,e,t)})),e.exports=c},function(e,t,n){var r=n(99),i=n(100),o=i;o.v1=r,o.v4=i,e.exports=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebCryptoSha256=t.Ie11Sha256=void 0,(0,n(0).__exportStar)(n(101),t);var r=n(52);Object.defineProperty(t,"Ie11Sha256",{enumerable:!0,get:function(){return r.Sha256}});var i=n(54);Object.defineProperty(t,"WebCryptoSha256",{enumerable:!0,get:function(){return i.Sha256}})},function(e,t,n){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r=n(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,r){void 0===r&&(r=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(n),s=Math.max(i,o),a=0,u=e.map([t,n],(function(t){var n=s-e.getVersionPrecision(t),r=t+new Array(n+1).join(".0");return e.map(r.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(u[0][s]>u[1][s])return 1;if(u[0][s]===u[1][s]){if(s===a)return 0;s-=1}else if(u[0][s]<u[1][s])return-1}},e.map=function(e,t){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n+=1)r.push(t(e[n]));return r},e.find=function(e,t){var n,r;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,r=e.length;n<r;n+=1){var i=e[n];if(t(i,n))return i}},e.assign=function(e){for(var t,n,r=e,i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var a=function(){var e=o[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){r[t]=e[t]}))};for(t=0,n=o.length;t<n;t+=1)a();return e},e.getBrowserAlias=function(e){return r.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return r.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,n){"use strict";t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},o=n(18);function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var a=function(){function e(){}var t,n;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},t=e,(n=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}])&&s(t,n),e}();t.default=a,e.exports=t.default},91:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r=u(n(92)),i=u(n(93)),o=u(n(94)),s=u(n(95)),a=u(n(17));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=a.default.find(r.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=a.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=a.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=a.default.find(s.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return a.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,n={},r=0,i={},o=0;if(Object.keys(e).forEach((function(t){var s=e[t];"string"==typeof s?(i[t]=s,o+=1):"object"==typeof s&&(n[t]=s,r+=1)})),r>0){var s=Object.keys(n),u=a.default.find(s,(function(e){return t.isOS(e)}));if(u){var c=this.satisfies(n[u]);if(void 0!==c)return c}var l=a.default.find(s,(function(e){return t.isPlatform(e)}));if(l){var f=this.satisfies(n[l]);if(void 0!==f)return f}}if(o>0){var d=Object.keys(i),h=a.default.find(d,(function(e){return t.isBrowser(e,!0)}));if(void 0!==h)return this.compareVersion(i[h])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),i=a.default.getBrowserTypeByAlias(r);return t&&i&&(r=i.toLowerCase()),r===n},t.compareVersion=function(e){var t=[0],n=e,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(a.default.compareVersions(i,n,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=c,e.exports=t.default},92:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=s,e.exports=t.default},93:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(t),r={name:o.OS_MAP.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=i.default.getAndroidVersionName(t),r={name:o.OS_MAP.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:o.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=s,e.exports=t.default},94:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=s,e.exports=t.default},95:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=s,e.exports=t.default}})},function(e){e.exports=JSON.parse('{"name":"@aws-sdk/client-cognito-identity","description":"AWS SDK for JavaScript Cognito Identity Client for Node.js, Browser and React Native","version":"3.6.1","scripts":{"clean":"yarn remove-definitions && yarn remove-dist && yarn remove-documentation","build-documentation":"yarn remove-documentation && typedoc ./","prepublishOnly":"yarn build","pretest":"yarn build:cjs","remove-definitions":"rimraf ./types","remove-dist":"rimraf ./dist","remove-documentation":"rimraf ./docs","test:unit":"mocha **/cjs/**/*.spec.js","test:e2e":"mocha **/cjs/**/*.ispec.js && karma start karma.conf.js","test":"yarn test:unit","build:cjs":"tsc -p tsconfig.json","build:es":"tsc -p tsconfig.es.json","build":"yarn build:cjs && yarn build:es","postbuild":"downlevel-dts types types/ts3.4"},"main":"./dist/cjs/index.js","types":"./types/index.d.ts","module":"./dist/es/index.js","browser":{"./runtimeConfig":"./runtimeConfig.browser"},"react-native":{"./runtimeConfig":"./runtimeConfig.native"},"sideEffects":false,"dependencies":{"@aws-crypto/sha256-browser":"^1.0.0","@aws-crypto/sha256-js":"^1.0.0","@aws-sdk/config-resolver":"3.6.1","@aws-sdk/credential-provider-node":"3.6.1","@aws-sdk/fetch-http-handler":"3.6.1","@aws-sdk/hash-node":"3.6.1","@aws-sdk/invalid-dependency":"3.6.1","@aws-sdk/middleware-content-length":"3.6.1","@aws-sdk/middleware-host-header":"3.6.1","@aws-sdk/middleware-logger":"3.6.1","@aws-sdk/middleware-retry":"3.6.1","@aws-sdk/middleware-serde":"3.6.1","@aws-sdk/middleware-signing":"3.6.1","@aws-sdk/middleware-stack":"3.6.1","@aws-sdk/middleware-user-agent":"3.6.1","@aws-sdk/node-config-provider":"3.6.1","@aws-sdk/node-http-handler":"3.6.1","@aws-sdk/protocol-http":"3.6.1","@aws-sdk/smithy-client":"3.6.1","@aws-sdk/types":"3.6.1","@aws-sdk/url-parser":"3.6.1","@aws-sdk/url-parser-native":"3.6.1","@aws-sdk/util-base64-browser":"3.6.1","@aws-sdk/util-base64-node":"3.6.1","@aws-sdk/util-body-length-browser":"3.6.1","@aws-sdk/util-body-length-node":"3.6.1","@aws-sdk/util-user-agent-browser":"3.6.1","@aws-sdk/util-user-agent-node":"3.6.1","@aws-sdk/util-utf8-browser":"3.6.1","@aws-sdk/util-utf8-node":"3.6.1","tslib":"^2.0.0"},"devDependencies":{"@aws-sdk/client-documentation-generator":"3.6.1","@aws-sdk/client-iam":"3.6.1","@types/chai":"^4.2.11","@types/mocha":"^8.0.4","@types/node":"^12.7.5","downlevel-dts":"0.7.0","jest":"^26.1.0","rimraf":"^3.0.0","typedoc":"^0.19.2","typescript":"~4.1.2"},"engines":{"node":">=10.0.0"},"typesVersions":{"<4.0":{"types/*":["types/ts3.4/*"]}},"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-cognito-identity","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"clients/client-cognito-identity"}}')},function(e,t,n){var r;e.exports=(r=n(57),function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,s=t.algo,a=[],u=[];!function(){function t(t){for(var n=e.sqrt(t),r=2;r<=n;r++)if(!(t%r))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var r=2,i=0;i<64;)t(r)&&(i<8&&(a[i]=n(e.pow(r,.5))),u[i]=n(e.pow(r,1/3)),i++),r++}();var c=[],l=s.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],l=n[5],f=n[6],d=n[7],h=0;h<64;h++){if(h<16)c[h]=0|e[t+h];else{var p=c[h-15],v=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,y=c[h-2],g=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;c[h]=v+c[h-7]+g+c[h-16]}var m=r&i^r&o^i&o,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),w=d+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&f)+u[h]+c[h];d=f,f=l,l=a,a=s+w|0,s=o,o=i,i=r,r=w+(b+m)|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+f|0,n[7]=n[7]+d|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),r.SHA256)},function(e,t,n){var r,i,o;e.exports=(o=n(57),i=(r=o).lib.WordArray,r.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var i=[],o=0;o<n;o+=3)for(var s=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a<n;a++)i.push(r.charAt(s>>>6*(3-a)&63));var u=r.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var t=e.length,n=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var o=0;o<n.length;o++)r[n.charCodeAt(o)]=o}var s=n.charAt(64);if(s){var a=e.indexOf(s);-1!==a&&(t=a)}return function(e,t,n){for(var r=[],o=0,s=0;s<t;s++)if(s%4){var a=n[e.charCodeAt(s-1)]<<s%4*2,u=n[e.charCodeAt(s)]>>>6-s%4*2,c=a|u;r[o>>>2]|=c<<24-o%4*8,o++}return i.create(r,o)}(e,t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},o.enc.Base64)},function(e,t,n){e.exports=n(138).Observable},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(21),i=function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},o=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},s=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(o(arguments[t]));return e},a=new r.a("Hub"),u="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default";var c=new(function(){function e(e){this.listeners=[],this.patterns=[],this.protectedChannels=["core","auth","api","analytics","interactions","pubsub","storage","ui","xr"],this.name=e}return e.prototype.remove=function(e,t){if(e instanceof RegExp){var n=this.patterns.find((function(t){return t.pattern.source===e.source}));if(!n)return void a.warn("No listeners for "+e);this.patterns=s(this.patterns.filter((function(e){return e!==n})))}else{var r=this.listeners[e];if(!r)return void a.warn("No listeners for "+e);this.listeners[e]=s(r.filter((function(e){return e.callback!==t})))}},e.prototype.dispatch=function(e,t,n,r){(void 0===n&&(n=""),this.protectedChannels.indexOf(e)>-1)&&(r===u||a.warn("WARNING: "+e+" is protected and dispatching on it can have unintended consequences"));var o={channel:e,payload:i({},t),source:n,patternInfo:[]};try{this._toListeners(o)}catch(e){a.error(e)}},e.prototype.listen=function(e,t,n){var r,i=this;if(void 0===n&&(n="noname"),function(e){return void 0!==e.onHubCapsule}(t))a.warn("WARNING onHubCapsule is Deprecated. Please pass in a callback."),r=t.onHubCapsule.bind(t);else{if("function"!=typeof t)throw new Error("No callback supplied to Hub");r=t}if(e instanceof RegExp)this.patterns.push({pattern:e,callback:r});else{var o=this.listeners[e];o||(o=[],this.listeners[e]=o),o.push({name:n,callback:r})}return function(){i.remove(e,r)}},e.prototype._toListeners=function(e){var t=e.channel,n=e.payload,r=this.listeners[t];if(r&&r.forEach((function(r){a.debug("Dispatching to "+t+" with ",n);try{r.callback(e)}catch(e){a.error(e)}})),this.patterns.length>0){if(!n.message)return void a.warn("Cannot perform pattern matching without a message key");var s=n.message;this.patterns.forEach((function(t){var n=s.match(t.pattern);if(n){var r=o(n).slice(1),u=i(i({},e),{patternInfo:r});try{t.callback(u)}catch(e){a.error(e)}}}))}},e}())("__default__")},,,,,function(e,t,n){var r,i,o=n(43),s=n(44),a=0,u=0;e.exports=function(e,t,n){var c=t&&n||0,l=t||[],f=(e=e||{}).node||r,d=void 0!==e.clockseq?e.clockseq:i;if(null==f||null==d){var h=o();null==f&&(f=r=[1|h[0],h[1],h[2],h[3],h[4],h[5]]),null==d&&(d=i=16383&(h[6]<<8|h[7]))}var p=void 0!==e.msecs?e.msecs:(new Date).getTime(),v=void 0!==e.nsecs?e.nsecs:u+1,y=p-a+(v-u)/1e4;if(y<0&&void 0===e.clockseq&&(d=d+1&16383),(y<0||p>a)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=p,u=v,i=d;var g=(1e4*(268435455&(p+=122192928e5))+v)%4294967296;l[c++]=g>>>24&255,l[c++]=g>>>16&255,l[c++]=g>>>8&255,l[c++]=255&g;var m=p/4294967296*1e4&268435455;l[c++]=m>>>8&255,l[c++]=255&m,l[c++]=m>>>24&15|16,l[c++]=m>>>16&255,l[c++]=d>>>8|128,l[c++]=255&d;for(var b=0;b<6;++b)l[c+b]=f[b];return t||s(l)}},function(e,t,n){var r=n(43),i=n(44);e.exports=function(e,t,n){var o=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[o+a]=s[a];return t||i(s)}},function(e,t,n){"use strict";t.byteLength=function(e){var t=c(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=c(e),s=r[0],a=r[1],u=new o(function(e,t,n){return 3*(t+n)/4-n}(0,s,a)),l=0,f=a>0?s-4:s;for(n=0;n<f;n+=4)t=i[e.charCodeAt(n)]<<18|i[e.charCodeAt(n+1)]<<12|i[e.charCodeAt(n+2)]<<6|i[e.charCodeAt(n+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===a&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===a&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=0,a=n-i;s<a;s+=16383)o.push(l(e,s,s+16383>a?a:s+16383));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)r[a]=s[a],i[s.charCodeAt(a)]=a;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var i,o,s=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){
64
64
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
65
- t.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,l=-7,f=n?i-1:0,d=n?-1:1,h=e[t+f];for(f+=d,o=h&(1<<-l)-1,h>>=-l,l+=a;l>0;o=256*o+e[t+f],f+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+e[t+f],f+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,r),o-=c}return(h?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,u,c=8*o-i-1,l=(1<<c)-1,f=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,p=r?1:-1,v=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*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+f>=1?d/u:d*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*u-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[n+h]=255&a,h+=p,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[n+h]=255&s,h+=p,s/=256,c-=8);e[n+h-p]|=128*v}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t){},function(e,t){},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(0),i=n(41),o=n(81),s=n(42),a=function(){function e(e){if(this.hash=new o.RawSha256,e){this.outer=new o.RawSha256;var t=function(e){var t=(0,s.convertToBuffer)(e);if(t.byteLength>i.BLOCK_SIZE){var n=new o.RawSha256;n.update(t),t=n.digest()}var r=new Uint8Array(i.BLOCK_SIZE);return r.set(t),r}(e),n=new Uint8Array(i.BLOCK_SIZE);n.set(t);for(var r=0;r<i.BLOCK_SIZE;r++)t[r]^=54,n[r]^=92;this.hash.update(t),this.outer.update(n);for(r=0;r<t.byteLength;r++)t[r]=0}}return e.prototype.update=function(e){if(!(0,s.isEmptyData)(e)&&!this.error)try{this.hash.update((0,s.convertToBuffer)(e))}catch(e){this.error=e}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return(0,r.__awaiter)(this,void 0,void 0,(function(){return(0,r.__generator)(this,(function(e){return[2,this.digestSync()]}))}))},e}();t.Sha256=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RawSha256=void 0;var r=n(41),i=function(){function e(){this.state=Int32Array.from(r.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,n=e.byteLength;if(this.bytesHashed+=n,8*this.bytesHashed>r.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[t++],n--,this.bufferLength===r.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(t.setUint8(this.bufferLength++,128),n%r.BLOCK_SIZE>=r.BLOCK_SIZE-8){for(var i=this.bufferLength;i<r.BLOCK_SIZE;i++)t.setUint8(i,0);this.hashBuffer(),this.bufferLength=0}for(i=this.bufferLength;i<r.BLOCK_SIZE-8;i++)t.setUint8(i,0);t.setUint32(r.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),t.setUint32(r.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}var o=new Uint8Array(r.DIGEST_LENGTH);for(i=0;i<8;i++)o[4*i]=this.state[i]>>>24&255,o[4*i+1]=this.state[i]>>>16&255,o[4*i+2]=this.state[i]>>>8&255,o[4*i+3]=this.state[i]>>>0&255;return o},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],u=t[5],c=t[6],l=t[7],f=0;f<r.BLOCK_SIZE;f++){if(f<16)this.temp[f]=(255&e[4*f])<<24|(255&e[4*f+1])<<16|(255&e[4*f+2])<<8|255&e[4*f+3];else{var d=this.temp[f-2],h=(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,p=((d=this.temp[f-15])>>>7|d<<25)^(d>>>18|d<<14)^d>>>3;this.temp[f]=(h+this.temp[f-7]|0)+(p+this.temp[f-16]|0)}var v=(((a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7))+(a&u^~a&c)|0)+(l+(r.KEY[f]+this.temp[f]|0)|0)|0,g=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&i^n&o^i&o)|0;l=c,c=u,u=a,a=s+v|0,s=o,o=i,i=n,n=v+g|0}t[0]+=n,t[1]+=i,t[2]+=o,t[3]+=s,t[4]+=a,t[5]+=u,t[6]+=c,t[7]+=l},e}();t.RawSha256=i},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.convertToBuffer=void 0;var r=n(125),i=void 0!==e&&e.from?function(t){return e.from(t,"utf8")}:r.fromUtf8;t.convertToBuffer=function(e){return e instanceof Uint8Array?e:"string"==typeof e?i(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}}).call(this,n(6).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyData=void 0,t.isEmptyData=function(e){return"string"==typeof e?0===e.length:0===e.byteLength}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.numToUint8=void 0,t.numToUint8=function(e){return new Uint8Array([(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e])}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=void 0,t.uint32ArrayFrom=function(e){if(!Array.from){for(var t=new Uint32Array(e.length);0<e.length;)t[0]=e[0];return t}return Uint32Array.from(e)}},function(e,t,n){e.exports=self.fetch||(self.fetch=n(43).default||n(43))},function(e,t,n){e.exports=n(88).Observable},function(e,t,n){"use strict";(function(e){!function(e,t){function n(e){return"function"==typeof Symbol&&Boolean(Symbol[e])}function r(e){return n(e)?Symbol[e]:"@@"+e}function i(e){setTimeout((function(){throw e}))}function o(e,t){var n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function s(e){var t=e.constructor;return void 0!==t&&null===(t=t[r("species")])&&(t=void 0),void 0!==t?t:d}function a(e,t){Object.keys(t).forEach((function(n){var r=Object.getOwnPropertyDescriptor(t,n);r.enumerable=!1,Object.defineProperty(e,n,r)}))}function u(e){var t=e._cleanup;if(t){e._cleanup=void 0;try{t()}catch(e){i(e)}}}function c(e){return void 0===e._observer}function l(e,t){if(Object(e)!==e)throw new TypeError("Observer must be an object");this._cleanup=void 0,this._observer=e;try{var n=o(e,"start");n&&n.call(e,this)}catch(e){i(e)}if(!c(this)){e=new f(this);try{var r=t.call(void 0,e);if(null!=r){if("function"==typeof r.unsubscribe)s=r,r=function(){s.unsubscribe()};else if("function"!=typeof r)throw new TypeError(r+" is not a function");this._cleanup=r}}catch(t){return void e.error(t)}var s;c(this)&&u(this)}}function f(e){this._subscription=e}function d(e){if(!(this instanceof d))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}"function"!=typeof Symbol||Symbol.observable||(Symbol.observable=Symbol("observable")),a(l.prototype={},{get closed(){return c(this)},unsubscribe:function(){var e;c(e=this)||(e._observer=void 0,u(e))}}),a(f.prototype={},{get closed(){return c(this._subscription)},next:function(e){var t=this._subscription;if(!c(t)){var n=t._observer;try{var r=o(n,"next");r&&r.call(n,e)}catch(e){i(e)}}},error:function(e){var t=this._subscription;if(c(t))i(e);else{var n=t._observer;t._observer=void 0;try{var r=o(n,"error");if(!r)throw e;r.call(n,e)}catch(e){i(e)}u(t)}},complete:function(){var e=this._subscription;if(!c(e)){var t=e._observer;e._observer=void 0;try{var n=o(t,"complete");n&&n.call(t)}catch(e){i(e)}u(e)}}}),a(d.prototype,{subscribe:function(e){for(var t=[],n=1;n<arguments.length;++n)t.push(arguments[n]);return"function"==typeof e?e={next:e,error:t[0],complete:t[1]}:"object"==typeof e&&null!==e||(e={}),new l(e,this._subscriber)},forEach:function(e){var t=this;return new Promise((function(n,r){if("function"!=typeof e)return Promise.reject(new TypeError(e+" is not a function"));t.subscribe({_subscription:null,start:function(e){if(Object(e)!==e)throw new TypeError(e+" is not an object");this._subscription=e},next:function(t){var n=this._subscription;if(!n.closed)try{e(t)}catch(e){r(e),n.unsubscribe()}},error:r,complete:n})}))},map:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(s(this))((function(n){return t.subscribe({next:function(t){if(!n.closed){try{t=e(t)}catch(e){return n.error(e)}n.next(t)}},error:function(e){n.error(e)},complete:function(){n.complete()}})}))},filter:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(s(this))((function(n){return t.subscribe({next:function(t){if(!n.closed){try{if(!e(t))return}catch(e){return n.error(e)}n.next(t)}},error:function(e){n.error(e)},complete:function(){n.complete()}})}))},reduce:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=s(this),r=arguments.length>1,i=!1,o=arguments[1],a=o;return new n((function(n){return t.subscribe({next:function(t){if(!n.closed){var o=!i;if(i=!0,!o||r)try{a=e(a,t)}catch(e){return n.error(e)}else a=t}},error:function(e){n.error(e)},complete:function(){if(!i&&!r)return n.error(new TypeError("Cannot reduce an empty sequence"));n.next(a),n.complete()}})}))}}),Object.defineProperty(d.prototype,r("observable"),{value:function(){return this},writable:!0,configurable:!0}),a(d,{from:function(e){var t="function"==typeof this?this:d;if(null==e)throw new TypeError(e+" is not an object");var i=o(e,r("observable"));if(i){var s=i.call(e);if(Object(s)!==s)throw new TypeError(s+" is not an object");return s.constructor===t?s:new t((function(e){return s.subscribe(e)}))}if(n("iterator")&&(i=o(e,r("iterator"))))return new t((function(t){for(var n,r=i.call(e)[Symbol.iterator]();!(n=r.next()).done;){var o=n.value;if(t.next(o),t.closed)return}t.complete()}));if(Array.isArray(e))return new t((function(t){for(var n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}));throw new TypeError(e+" is not observable")},of:function(){for(var e=[],t=0;t<arguments.length;++t)e.push(arguments[t]);var n="function"==typeof this?this:d;return new n((function(t){for(var n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}))}}),Object.defineProperty(d,r("species"),{get:function(){return this},configurable:!0}),Object.defineProperty(d,"extensions",{value:{observableSymbol:r("observable"),setHostReportError:function(e){i=e}}}),e.Observable=d}(t)}).call(this,n(45)(e))},function(e,t,n){(function(e,r){var i;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(o){t&&t.nodeType,e&&e.nodeType;var s="object"==typeof r&&r;s.global!==s&&s.window!==s&&s.self;var a,u=2147483647,c=/^xn--/,l=/[^\x20-\x7E]/,f=/[\x2E\u3002\uFF0E\uFF61]/g,d={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},h=Math.floor,p=String.fromCharCode;function v(e){throw new RangeError(d[e])}function g(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function y(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+g((e=e.replace(f,".")).split("."),t).join(".")}function m(e){for(var t,n,r=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(n=e.charCodeAt(i++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),i--):r.push(t);return r}function b(e){return g(e,(function(e){var t="";return e>65535&&(t+=p((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=p(e)})).join("")}function _(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function w(e,t,n){var r=0;for(e=n?h(e/700):e>>1,e+=h(e/t);e>455;r+=36)e=h(e/35);return h(r+36*e/(e+38))}function S(e){var t,n,r,i,o,s,a,c,l,f,d,p=[],g=e.length,y=0,m=128,_=72;for((n=e.lastIndexOf("-"))<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&v("not-basic"),p.push(e.charCodeAt(r));for(i=n>0?n+1:0;i<g;){for(o=y,s=1,a=36;i>=g&&v("invalid-input"),((c=(d=e.charCodeAt(i++))-48<10?d-22:d-65<26?d-65:d-97<26?d-97:36)>=36||c>h((u-y)/s))&&v("overflow"),y+=c*s,!(c<(l=a<=_?1:a>=_+26?26:a-_));a+=36)s>h(u/(f=36-l))&&v("overflow"),s*=f;_=w(y-o,t=p.length+1,0==o),h(y/t)>u-m&&v("overflow"),m+=h(y/t),y%=t,p.splice(y++,0,m)}return b(p)}function O(e){var t,n,r,i,o,s,a,c,l,f,d,g,y,b,S,O=[];for(g=(e=m(e)).length,t=128,n=0,o=72,s=0;s<g;++s)(d=e[s])<128&&O.push(p(d));for(r=i=O.length,i&&O.push("-");r<g;){for(a=u,s=0;s<g;++s)(d=e[s])>=t&&d<a&&(a=d);for(a-t>h((u-n)/(y=r+1))&&v("overflow"),n+=(a-t)*y,t=a,s=0;s<g;++s)if((d=e[s])<t&&++n>u&&v("overflow"),d==t){for(c=n,l=36;!(c<(f=l<=o?1:l>=o+26?26:l-o));l+=36)S=c-f,b=36-f,O.push(p(_(f+S%b,0))),c=h(S/b);O.push(p(_(c,0))),o=w(n,y,r==i),n=0,++r}++n,++t}return O.join("")}a={version:"1.4.1",ucs2:{decode:m,encode:b},decode:S,encode:O,toASCII:function(e){return y(e,(function(e){return l.test(e)?"xn--"+O(e):e}))},toUnicode:function(e){return y(e,(function(e){return c.test(e)?S(e.slice(4).toLowerCase()):e}))}},void 0===(i=function(){return a}.call(t,n,t,e))||(e.exports=i)}()}).call(this,n(45)(e),n(35))},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";t.decode=t.parse=n(92),t.encode=t.stringify=n(93)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,o){t=t||"&",n=n||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var l=0;l<c;++l){var f,d,h,p,v=e[l].replace(a,"%20"),g=v.indexOf(n);g>=0?(f=v.substr(0,g),d=v.substr(g+1)):(f=v,d=""),h=decodeURIComponent(f),p=decodeURIComponent(d),r(s,h)?i(s[h])?s[h].push(p):s[h]=[s[h],p]:s[h]=p}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,a){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),(function(s){var a=encodeURIComponent(r(s))+n;return i(e[s])?o(e[s],(function(e){return a+encodeURIComponent(r(e))})).join(t):a+encodeURIComponent(r(e[s]))})).join(t):a?encodeURIComponent(r(a))+n+encodeURIComponent(r(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var s=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}},function(e,t,n){var r,i,o=n(47),s=n(48),a=0,u=0;e.exports=function(e,t,n){var c=t&&n||0,l=t||[],f=(e=e||{}).node||r,d=void 0!==e.clockseq?e.clockseq:i;if(null==f||null==d){var h=o();null==f&&(f=r=[1|h[0],h[1],h[2],h[3],h[4],h[5]]),null==d&&(d=i=16383&(h[6]<<8|h[7]))}var p=void 0!==e.msecs?e.msecs:(new Date).getTime(),v=void 0!==e.nsecs?e.nsecs:u+1,g=p-a+(v-u)/1e4;if(g<0&&void 0===e.clockseq&&(d=d+1&16383),(g<0||p>a)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=p,u=v,i=d;var y=(1e4*(268435455&(p+=122192928e5))+v)%4294967296;l[c++]=y>>>24&255,l[c++]=y>>>16&255,l[c++]=y>>>8&255,l[c++]=255&y;var m=p/4294967296*1e4&268435455;l[c++]=m>>>8&255,l[c++]=255&m,l[c++]=m>>>24&15|16,l[c++]=m>>>16&255,l[c++]=d>>>8|128,l[c++]=255&d;for(var b=0;b<6;++b)l[c+b]=f[b];return t||s(l)}},function(e,t,n){var r=n(47),i=n(48);e.exports=function(e,t,n){var o=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[o+a]=s[a];return t||i(s)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(49),i=n(51),o=n(13),s=n(98),a=n(100),u=n(36),c=function(){function e(e){(0,s.supportsWebCrypto)((0,u.locateWindow)())?this.hash=new i.Sha256(e):(0,a.isMsWindow)((0,u.locateWindow)())?this.hash=new r.Sha256(e):this.hash=new o.Sha256(e)}return e.prototype.update=function(e,t){this.hash.update(e,t)},e.prototype.digest=function(){return this.hash.digest()},e}();t.Sha256=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyData=void 0,t.isEmptyData=function(e){return"string"==typeof e?0===e.length:0===e.byteLength}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(0).__exportStar(n(99),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.supportsZeroByteGCM=t.supportsSubtleCrypto=t.supportsSecureRandom=t.supportsWebCrypto=void 0;var r=n(0),i=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function o(e){return"object"==typeof e&&"object"==typeof e.crypto&&"function"==typeof e.crypto.getRandomValues}function s(e){return e&&i.every((function(t){return"function"==typeof e[t]}))}t.supportsWebCrypto=function(e){return!(!o(e)||"object"!=typeof e.crypto.subtle)&&s(e.crypto.subtle)},t.supportsSecureRandom=o,t.supportsSubtleCrypto=s,t.supportsZeroByteGCM=function(e){return r.__awaiter(this,void 0,void 0,(function(){var t;return r.__generator(this,(function(n){switch(n.label){case 0:if(!s(e))return[2,!1];n.label=1;case 1:return n.trys.push([1,4,,5]),[4,e.generateKey({name:"AES-GCM",length:128},!1,["encrypt"])];case 2:return t=n.sent(),[4,e.encrypt({name:"AES-GCM",iv:new Uint8Array(Array(12)),additionalData:new Uint8Array(Array(16)),tagLength:128},t,new Uint8Array(0))];case 3:return[2,16===n.sent().byteLength];case 4:return n.sent(),[2,!1];case 5:return[2]}}))}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0);r.__exportStar(n(101),t),r.__exportStar(n(102),t),r.__exportStar(n(103),t),r.__exportStar(n(104),t),r.__exportStar(n(105),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isMsWindow=void 0;var r=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];t.isMsWindow=function(e){if(function(e){return"MSInputMethodContext"in e&&"msCrypto"in e}(e)&&void 0!==e.msCrypto.subtle){var t=e.msCrypto,n=t.getRandomValues,i=t.subtle;return r.map((function(e){return i[e]})).concat(n).every((function(e){return"function"==typeof e}))}return!1}},function(e,t,n){"use strict";var r=n(12),i=n(52),o=n(107),s=n(58);var a=function e(t){var n=new o(t),a=i(o.prototype.request,n);return r.extend(a,o.prototype,n),r.extend(a,n),a.create=function(n){return e(s(t,n))},a}(n(27));a.Axios=o,a.Cancel=n(28),a.CancelToken=n(120),a.isCancel=n(57),a.VERSION=n(59).version,a.all=function(e){return Promise.all(e)},a.spread=n(121),a.isAxiosError=n(122),e.exports=a,e.exports.default=a},function(e,t,n){"use strict";var r=n(12),i=n(53),o=n(108),s=n(109),a=n(58),u=n(119),c=u.validators;function l(e){this.defaults=e,this.interceptors={request:new o,response:new o}}l.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=a(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var n=t.transitional;void 0!==n&&u.assertOptions(n,{silentJSONParsing:c.transitional(c.boolean),forcedJSONParsing:c.transitional(c.boolean),clarifyTimeoutError:c.transitional(c.boolean)},!1);var r=[],i=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(i=i&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));var o,l=[];if(this.interceptors.response.forEach((function(e){l.push(e.fulfilled,e.rejected)})),!i){var f=[s,void 0];for(Array.prototype.unshift.apply(f,r),f=f.concat(l),o=Promise.resolve(t);f.length;)o=o.then(f.shift(),f.shift());return o}for(var d=t;r.length;){var h=r.shift(),p=r.shift();try{d=h(d)}catch(e){p(e);break}}try{o=s(d)}catch(e){return Promise.reject(e)}for(;l.length;)o=o.then(l.shift(),l.shift());return o},l.prototype.getUri=function(e){return e=a(this.defaults,e),i(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],(function(e){l.prototype[e]=function(t,n){return this.request(a(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(e){l.prototype[e]=function(t,n,r){return this.request(a(r||{},{method:e,url:t,data:n}))}})),e.exports=l},function(e,t,n){"use strict";var r=n(12);function i(){this.handlers=[]}i.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){r.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=i},function(e,t,n){"use strict";var r=n(12),i=n(110),o=n(57),s=n(27),a=n(28);function u(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new a("canceled")}e.exports=function(e){return u(e),e.headers=e.headers||{},e.data=i.call(e,e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||s.adapter)(e).then((function(t){return u(e),t.data=i.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(u(e),t&&t.response&&(t.response.data=i.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,n){"use strict";var r=n(12),i=n(27);e.exports=function(e,t,n){var o=this||i;return r.forEach(n,(function(n){e=n.call(o,e,t)})),e}},function(e,t,n){"use strict";var r=n(12);e.exports=function(e,t){r.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))}},function(e,t,n){"use strict";var r=n(56);e.exports=function(e,t,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},function(e,t,n){"use strict";var r=n(12);e.exports=r.isStandardBrowserEnv()?{write:function(e,t,n,i,o,s){var a=[];a.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(i)&&a.push("path="+i),r.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,n){"use strict";var r=n(115),i=n(116);e.exports=function(e,t){return e&&!r(t)?i(e,t):t}},function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}},function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";var r=n(12),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,o,s={};return e?(r.forEach(e.split("\n"),(function(e){if(o=e.indexOf(":"),t=r.trim(e.substr(0,o)).toLowerCase(),n=r.trim(e.substr(o+1)),t){if(s[t]&&i.indexOf(t)>=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([n]):s[t]?s[t]+", "+n:n}})),s):s}},function(e,t,n){"use strict";var r=n(12);e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=i(window.location.href),function(t){var n=r.isString(t)?i(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},function(e,t,n){"use strict";var r=n(59).version,i={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){i[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var o={};i.transitional=function(e,t,n){function i(e,t){return"[Axios v"+r+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,r,s){if(!1===e)throw new Error(i(r," has been removed"+(t?" in "+t:"")));return t&&!o[r]&&(o[r]=!0,console.warn(i(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,s)}},e.exports={assertOptions:function(e,t,n){if("object"!=typeof e)throw new TypeError("options must be an object");for(var r=Object.keys(e),i=r.length;i-- >0;){var o=r[i],s=t[o];if(s){var a=e[o],u=void 0===a||s(a,o,e);if(!0!==u)throw new TypeError("option "+o+" must be "+u)}else if(!0!==n)throw Error("Unknown option "+o)}},validators:i}},function(e,t,n){"use strict";var r=n(28);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;this.promise.then((function(e){if(n._listeners){var t,r=n._listeners.length;for(t=0;t<r;t++)n._listeners[t](e);n._listeners=null}})),this.promise.then=function(e){var t,r=new Promise((function(e){n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},i.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},i.source=function(){var e;return{token:new i((function(t){e=t})),cancel:e}},e.exports=i},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,n){"use strict";var r=n(12);e.exports=function(e){return r.isObject(e)&&!0===e.isAxiosError}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}Object.defineProperty(t,"__esModule",{value:!0}),t.Observable=void 0;var s=function(){return"function"==typeof Symbol},a=function(e){return s()&&Boolean(Symbol[e])},u=function(e){return a(e)?Symbol[e]:"@@"+e};s()&&!a("observable")&&(Symbol.observable=Symbol("observable"));var c=u("iterator"),l=u("observable"),f=u("species");function d(e,t){var n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function h(e){var t=e.constructor;return void 0!==t&&null===(t=t[f])&&(t=void 0),void 0!==t?t:O}function p(e){return e instanceof O}function v(e){v.log?v.log(e):setTimeout((function(){throw e}))}function g(e){Promise.resolve().then((function(){try{e()}catch(e){v(e)}}))}function y(e){var t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{var n=d(t,"unsubscribe");n&&n.call(t)}}catch(e){v(e)}}function m(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function b(e,t,n){e._state="running";var r=e._observer;try{var i=d(r,t);switch(t){case"next":i&&i.call(r,n);break;case"error":if(m(e),!i)throw n;i.call(r,n);break;case"complete":m(e),i&&i.call(r)}}catch(e){v(e)}"closed"===e._state?y(e):"running"===e._state&&(e._state="ready")}function _(e,t,n){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:n}],void g((function(){return function(e){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var n=0;n<t.length&&(b(e,t[n].type,t[n].value),"closed"!==e._state);++n);}}(e)}))):void b(e,t,n);e._queue.push({type:t,value:n})}}var w=function(){function e(t,n){r(this,e),this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var i=new S(this);try{this._cleanup=n.call(void 0,i)}catch(e){i.error(e)}"initializing"===this._state&&(this._state="ready")}return o(e,[{key:"unsubscribe",value:function(){"closed"!==this._state&&(m(this),y(this))}},{key:"closed",get:function(){return"closed"===this._state}}]),e}(),S=function(){function e(t){r(this,e),this._subscription=t}return o(e,[{key:"next",value:function(e){_(this._subscription,"next",e)}},{key:"error",value:function(e){_(this._subscription,"error",e)}},{key:"complete",value:function(){_(this._subscription,"complete")}},{key:"closed",get:function(){return"closed"===this._subscription._state}}]),e}(),O=function(){function e(t){if(r(this,e),!(this instanceof e))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof t)throw new TypeError("Observable initializer must be a function");this._subscriber=t}return o(e,[{key:"subscribe",value:function(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new w(e,this._subscriber)}},{key:"forEach",value:function(e){var t=this;return new Promise((function(n,r){if("function"==typeof e)var i=t.subscribe({next:function(t){try{e(t,o)}catch(e){r(e),i.unsubscribe()}},error:r,complete:n});else r(new TypeError(e+" is not a function"));function o(){i.unsubscribe(),n()}}))}},{key:"map",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(h(this))((function(n){return t.subscribe({next:function(t){try{t=e(t)}catch(e){return n.error(e)}n.next(t)},error:function(e){n.error(e)},complete:function(){n.complete()}})}))}},{key:"filter",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(h(this))((function(n){return t.subscribe({next:function(t){try{if(!e(t))return}catch(e){return n.error(e)}n.next(t)},error:function(e){n.error(e)},complete:function(){n.complete()}})}))}},{key:"reduce",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=h(this),r=arguments.length>1,i=!1,o=arguments[1],s=o;return new n((function(n){return t.subscribe({next:function(t){var o=!i;if(i=!0,!o||r)try{s=e(s,t)}catch(e){return n.error(e)}else s=t},error:function(e){n.error(e)},complete:function(){if(!i&&!r)return n.error(new TypeError("Cannot reduce an empty sequence"));n.next(s),n.complete()}})}))}},{key:"concat",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=h(this);return new i((function(t){var r,o=0;return function e(s){r=s.subscribe({next:function(e){t.next(e)},error:function(e){t.error(e)},complete:function(){o===n.length?(r=void 0,t.complete()):e(i.from(n[o++]))}})}(e),function(){r&&(r.unsubscribe(),r=void 0)}}))}},{key:"flatMap",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=h(this);return new n((function(r){var i=[],o=t.subscribe({next:function(t){if(e)try{t=e(t)}catch(e){return r.error(e)}var o=n.from(t).subscribe({next:function(e){r.next(e)},error:function(e){r.error(e)},complete:function(){var e=i.indexOf(o);e>=0&&i.splice(e,1),s()}});i.push(o)},error:function(e){r.error(e)},complete:function(){s()}});function s(){o.closed&&0===i.length&&r.complete()}return function(){i.forEach((function(e){return e.unsubscribe()})),o.unsubscribe()}}))}},{key:l,value:function(){return this}}],[{key:"from",value:function(t){var n="function"==typeof this?this:e;if(null==t)throw new TypeError(t+" is not an object");var r=d(t,l);if(r){var i=r.call(t);if(Object(i)!==i)throw new TypeError(i+" is not an object");return p(i)&&i.constructor===n?i:new n((function(e){return i.subscribe(e)}))}if(a("iterator")&&(r=d(t,c)))return new n((function(e){g((function(){if(!e.closed){var n=!0,i=!1,o=void 0;try{for(var s,a=r.call(t)[Symbol.iterator]();!(n=(s=a.next()).done);n=!0){var u=s.value;if(e.next(u),e.closed)return}}catch(e){i=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(i)throw o}}e.complete()}}))}));if(Array.isArray(t))return new n((function(e){g((function(){if(!e.closed){for(var n=0;n<t.length;++n)if(e.next(t[n]),e.closed)return;e.complete()}}))}));throw new TypeError(t+" is not observable")}},{key:"of",value:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i="function"==typeof this?this:e;return new i((function(e){g((function(){if(!e.closed){for(var t=0;t<n.length;++t)if(e.next(n[t]),e.closed)return;e.complete()}}))}))}},{key:f,get:function(){return this}}]),e}();t.Observable=O,s()&&Object.defineProperty(O,Symbol("extensions"),{value:{symbol:l,hostReportError:v},configurable:!0})},function(e,t,n){"use strict";n.r(t),n.d(t,"DataStore",(function(){return it})),n.d(t,"DataStoreClass",(function(){return rt})),n.d(t,"initSchema",(function(){return Le})),n.d(t,"Predicates",(function(){return w.b})),n.d(t,"ModelPredicateCreator",(function(){return w.a})),n.d(t,"ModelSortPredicateCreator",(function(){return S.a})),n.d(t,"utils",(function(){return ot})),n.d(t,"isSchemaModel",(function(){return g.w})),n.d(t,"isAssociatedWith",(function(){return g.l})),n.d(t,"isTargetNameAssociation",(function(){return g.x})),n.d(t,"isModelAttributeAuth",(function(){return g.o})),n.d(t,"isModelAttributeKey",(function(){return g.q})),n.d(t,"isModelAttributePrimaryKey",(function(){return g.r})),n.d(t,"isModelAttributeCompositeKey",(function(){return g.p})),n.d(t,"ModelAttributeAuthAllow",(function(){return g.e})),n.d(t,"ModelAttributeAuthProvider",(function(){return g.f})),n.d(t,"GraphQLScalarType",(function(){return g.c})),n.d(t,"isGraphQLScalarType",(function(){return g.n})),n.d(t,"isModelFieldType",(function(){return g.s})),n.d(t,"isNonModelFieldType",(function(){return g.t})),n.d(t,"isEnumFieldType",(function(){return g.m})),n.d(t,"OpType",(function(){return g.h})),n.d(t,"isPredicateObj",(function(){return g.v})),n.d(t,"isPredicateGroup",(function(){return g.u})),n.d(t,"QueryOne",(function(){return g.j})),n.d(t,"SortDirection",(function(){return g.k})),n.d(t,"AuthModeStrategyType",(function(){return g.a})),n.d(t,"ModelOperation",(function(){return g.g})),n.d(t,"syncExpression",(function(){return g.y})),n.d(t,"ProcessName",(function(){return g.i})),n.d(t,"DISCARD",(function(){return g.b})),n.d(t,"LimitTimerRaceResolvedValues",(function(){return g.d}));var r=n(0),i=n(18),o=n(21),s=n(16),a=n(68),u=n(37),c=n(30),l=n(19),f=n(15),d=n(29),h=n(10),p=n(17),v=n(3),g=n(1);function y(e){return"private"!==e.allow||e.provider?"public"!==e.allow||e.provider?e.provider:g.f.API_KEY:g.f.USER_POOLS}function m(e){var t=e.rules,n=e.currentUser,r=new Set;return t.forEach((function(e){switch(e.allow){case g.e.CUSTOM:e.provider&&e.provider!==g.f.FUNCTION||r.add(v.c.AWS_LAMBDA);break;case g.e.GROUPS:case g.e.OWNER:n&&(e.provider===g.f.USER_POOLS?r.add(v.c.AMAZON_COGNITO_USER_POOLS):e.provider===g.f.OIDC&&r.add(v.c.OPENID_CONNECT));break;case g.e.PRIVATE:n&&(e.provider&&e.provider!==g.f.USER_POOLS?e.provider===g.f.IAM&&r.add(v.c.AWS_IAM):r.add(v.c.AMAZON_COGNITO_USER_POOLS));break;case g.e.PUBLIC:e.provider===g.f.IAM?r.add(v.c.AWS_IAM):e.provider&&e.provider!==g.f.API_KEY||r.add(v.c.API_KEY)}})),Array.from(r)}var b=function(e){return function(t){var n=t.schema,i=t.modelName;return Object(r.__awaiter)(void 0,void 0,void 0,(function(){var t,o,s,a,u;return Object(r.__generator)(this,(function(c){switch(c.label){case 0:e.Auth=e.Auth||p.a,c.label=1;case 1:return c.trys.push([1,3,,4]),[4,e.Auth.currentAuthenticatedUser()];case 2:return t=c.sent(),[3,4];case 3:return c.sent(),[3,4];case 4:return(o=n.namespaces.user.models[i].attributes)&&(s=o.find((function(e){return"auth"===e.type})),null===(u=null==s?void 0:s.properties)||void 0===u?void 0:u.rules)?(l=s.properties.rules,f=[g.e.CUSTOM,g.e.OWNER,g.e.GROUPS,g.e.PRIVATE,g.e.PUBLIC],d=[g.f.FUNCTION,g.f.USER_POOLS,g.f.OIDC,g.f.IAM,g.f.API_KEY],a=Object(r.__spread)(l).sort((function(e,t){return e.allow===t.allow?d.indexOf(y(e))-d.indexOf(y(t)):f.indexOf(e.allow)-f.indexOf(t.allow)})),[2,m({currentUser:t,rules:a})]):[2,[]]}var l,f,d}))}))}},_=function(){return[]},w=n(5),S=n(46),O=function(){function e(){this._queue=[],this._pending=!1}return e.prototype.isLocked=function(){return this._pending},e.prototype.acquire=function(){var e=this,t=new Promise((function(t){return e._queue.push(t)}));return this._pending||this._dispatchNext(),t},e.prototype.runExclusive=function(e){return this.acquire().then((function(t){var n;try{n=e()}catch(e){throw t(),e}return Promise.resolve(n).then((function(e){return t(),e}),(function(e){throw t(),e}))}))},e.prototype._dispatchNext=function(){this._queue.length>0?(this._pending=!0,this._queue.shift()(this._dispatchNext.bind(this))):this._pending=!1},e}(),E=n(62),A=n.n(E),I=n(2);let T,C;const j=new WeakMap,P=new WeakMap,x=new WeakMap,N=new WeakMap,k=new WeakMap;let M={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return P.get(e);if("objectStoreNames"===t)return e.objectStoreNames||x.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return U(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function R(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(C||(C=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(F(this),t),U(j.get(this))}:function(...t){return U(e.apply(F(this),t))}:function(t,...n){const r=e.call(F(this),t,...n);return x.set(r,t.sort?t.sort():[t]),U(r)}}function D(e){return"function"==typeof e?R(e):(e instanceof IDBTransaction&&function(e){if(P.has(e))return;const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",o),e.removeEventListener("abort",o)},i=()=>{t(),r()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",o),e.addEventListener("abort",o)});P.set(e,t)}(e),t=e,(T||(T=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,M):e);var t}function U(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{t(U(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",o)});return t.then(t=>{t instanceof IDBCursor&&j.set(t,e)}).catch(()=>{}),k.set(t,e),t}(e);if(N.has(e))return N.get(e);const t=D(e);return t!==e&&(N.set(e,t),k.set(t,e)),t}const F=e=>k.get(e);function L(e,t,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){const s=indexedDB.open(e,t),a=U(s);return r&&s.addEventListener("upgradeneeded",e=>{r(U(s.result),e.oldVersion,e.newVersion,U(s.transaction))}),n&&s.addEventListener("blocked",()=>n()),a.then(e=>{o&&e.addEventListener("close",()=>o()),i&&e.addEventListener("versionchange",()=>i())}).catch(()=>{}),a}function B(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",()=>t()),U(n).then(()=>{})}const q=["get","getKey","getAll","getAllKeys","count"],z=["put","add","delete","clear"],V=new Map;function K(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(V.get(t))return V.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=z.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!q.includes(n))return;const o=async function(e,...t){const o=this.transaction(e,i?"readwrite":"readonly");let s=o.store;r&&(s=s.index(t.shift()));const a=await s[n](...t);return i&&await o.done,a};return V.set(t,o),o}function G(e){return(G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}M=(e=>({...e,get:(t,n,r)=>K(t,n)||e.get(t,n,r),has:(t,n)=>!!K(t,n)||e.has(t,n)}))(M);var H=new o.a("DataStore"),W=new(function(){function e(){this.dbName="amplify-datastore"}return e.prototype.checkPrivate=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(e){switch(e.label){case 0:return[4,Object(I.x)().then((function(e){return e}))];case 1:return e.sent()?(H.error("IndexedDB not supported in this browser's private mode"),[2,Promise.reject("IndexedDB not supported in this browser's private mode")]):[2,Promise.resolve()]}}))}))},e.prototype.getStorenameForModel=function(e){var t=this.namespaceResolver(e),n=e.name;return this.getStorename(t,n)},e.prototype.getStorename=function(e,t){return e+"_"+t},e.prototype.setUp=function(e,t,n,i,o){return Object(r.__awaiter)(this,void 0,void 0,(function(){var s,a,u=this;return Object(r.__generator)(this,(function(c){switch(c.label){case 0:return[4,this.checkPrivate()];case 1:return c.sent(),this.initPromise?[3,2]:(this.initPromise=new Promise((function(e,t){u.resolve=e,u.reject=t})),[3,4]);case 2:return[4,this.initPromise];case 3:c.sent(),c.label=4;case 4:o&&(this.dbName="amplify-datastore-"+o),this.schema=e,this.namespaceResolver=t,this.modelInstanceCreator=n,this.getModelConstructorByModelName=i,c.label=5;case 5:return c.trys.push([5,8,,9]),this.db?[3,7]:(2,s=this,[4,L(this.dbName,2,{upgrade:function(t,n,i,o){return Object(r.__awaiter)(u,void 0,void 0,(function(){var s,a,u,c,l,f,d,h,p,v,g,y,m=this;return Object(r.__generator)(this,(function(b){switch(b.label){case 0:if(0===n)return Object.keys(e.namespaces).forEach((function(n){var r=e.namespaces[n];Object.keys(r.models).forEach((function(e){var r=m.getStorename(n,e);m.createObjectStoreForModel(t,n,r,e)}))})),[2];if(1!==n||2!==i)return[3,16];b.label=1;case 1:b.trys.push([1,14,,15]),b.label=2;case 2:b.trys.push([2,11,12,13]),s=Object(r.__values)(o.objectStoreNames),a=s.next(),b.label=3;case 3:return a.done?[3,10]:(u=a.value,c=o.objectStore(u),l="tmp_"+u,c.name=l,(f=t.createObjectStore(u,{keyPath:void 0,autoIncrement:!0})).createIndex("byId","id",{unique:!0}),[4,c.openCursor()]);case 4:d=b.sent(),h=0,b.label=5;case 5:return d&&d.value?[4,f.put(d.value)]:[3,8];case 6:return b.sent(),[4,d.continue()];case 7:return d=b.sent(),h++,[3,5];case 8:t.deleteObjectStore(l),H.debug(h+" "+u+" records migrated"),b.label=9;case 9:return a=s.next(),[3,3];case 10:return[3,13];case 11:return p=b.sent(),g={error:p},[3,13];case 12:try{a&&!a.done&&(y=s.return)&&y.call(s)}finally{if(g)throw g.error}return[7];case 13:return Object.keys(e.namespaces).forEach((function(n){var i=e.namespaces[n],s=new Set(o.objectStoreNames);Object.keys(i.models).map((function(e){return[e,m.getStorename(n,e)]})).filter((function(e){var t=Object(r.__read)(e,2)[1];return!s.has(t)})).forEach((function(e){var i=Object(r.__read)(e,2),o=i[0],s=i[1];m.createObjectStoreForModel(t,n,s,o)}))})),[3,15];case 14:throw v=b.sent(),H.error("Error migrating IndexedDB data",v),o.abort(),v;case 15:case 16:return[2]}}))}))}})]);case 6:s.db=c.sent(),this.resolve(),c.label=7;case 7:return[3,9];case 8:return a=c.sent(),this.reject(a),[3,9];case 9:return[2]}}))}))},e.prototype._get=function(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){var n,i;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return"string"==typeof e?(i=e,n=this.db.transaction(i,"readonly").store.index("byId")):n=e.index("byId"),[4,n.get(t)];case 1:return[2,r.sent()]}}))}))},e.prototype.save=function(e,t){var n,i;return Object(r.__awaiter)(this,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h,p,v,y,m,b,_,S,O,E,A,T,C,j,P,x,N,k,M=this;return Object(r.__generator)(this,(function(R){switch(R.label){case 0:return[4,this.checkPrivate()];case 1:return R.sent(),o=Object.getPrototypeOf(e).constructor,s=this.getStorenameForModel(o),a=Object(I.C)(o.name,e,this.schema.namespaces[this.namespaceResolver(o)],this.modelInstanceCreator,this.getModelConstructorByModelName),u=this.namespaceResolver(o),c=new Set,l=Object.values(a).map((function(e){var t=e.modelName,n=e.item,r=e.instance,i=M.getStorename(u,t);return c.add(i),{storeName:i,item:n,instance:r}})),f=this.db.transaction(Object(r.__spread)([s],Array.from(c.values())),"readwrite"),d=f.objectStore(s),[4,this._get(d,e.id)];case 2:if(h=R.sent(),t&&h&&(p=w.a.getPredicates(t),v=p.predicates,y=p.type,!Object(I.D)(h,y,v)))throw m="Conditional update failed",H.error(m,{model:h,condition:v}),new Error(m);b=[],R.label=3;case 3:R.trys.push([3,11,12,17]),_=Object(r.__asyncValues)(l),R.label=4;case 4:return[4,_.next()];case 5:return(S=R.sent()).done?[3,10]:(O=S.value,E=O.storeName,A=O.item,T=O.instance,C=f.objectStore(E),j=A.id,[4,this._get(C,j)]);case 6:return P=R.sent(),x=void 0===P?g.h.INSERT:g.h.UPDATE,j!==e.id&&x!==g.h.INSERT?[3,9]:[4,C.index("byId").getKey(A.id)];case 7:return N=R.sent(),[4,C.put(A,N)];case 8:R.sent(),b.push([T,x]),R.label=9;case 9:return[3,4];case 10:return[3,17];case 11:return k=R.sent(),n={error:k},[3,17];case 12:return R.trys.push([12,,15,16]),S&&!S.done&&(i=_.return)?[4,i.call(_)]:[3,14];case 13:R.sent(),R.label=14;case 14:return[3,16];case 15:if(n)throw n.error;return[7];case 16:return[7];case 17:return[4,f.done];case 18:return R.sent(),[2,b]}}))}))},e.prototype.load=function(e,t,n){var i,o,s,a,u,c,l,f,d,h;return Object(r.__awaiter)(this,void 0,void 0,(function(){var p,v,g,y,m,b,_,w,S,O,E,A,T,C,j,P,x,N,k,M,R=this;return Object(r.__generator)(this,(function(D){switch(D.label){case 0:if(p=this.schema.namespaces[e],v=p.relationships[t].relationTypes,g=v.map((function(t){var n=t.modelName;return R.getStorename(e,n)})),y=this.getModelConstructorByModelName(e,t),0===g.length)return[2,n.map((function(e){return R.modelInstanceCreator(y,e)}))];m=this.db.transaction(Object(r.__spread)(g),"readonly"),D.label=1;case 1:D.trys.push([1,34,35,40]),b=Object(r.__asyncValues)(v),D.label=2;case 2:return[4,b.next()];case 3:if((_=D.sent()).done)return[3,33];switch(w=_.value,S=w.fieldName,O=w.modelName,E=w.targetName,A=this.getStorename(e,O),T=m.objectStore(A),C=this.getModelConstructorByModelName(e,O),w.relationType){case"HAS_ONE":return[3,4];case"BELONGS_TO":return[3,17];case"HAS_MANY":return[3,30]}return[3,31];case 4:D.trys.push([4,10,11,16]),i=Object(r.__asyncValues)(n),D.label=5;case 5:return[4,i.next()];case 6:return(o=D.sent()).done?[3,9]:(x=o.value,j=x[E]?E:S,x[j]?[4,this._get(T,x[j])]:[3,9]);case 7:N=D.sent(),x[S]=N&&this.modelInstanceCreator(C,N),D.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return P=D.sent(),l={error:P},[3,16];case 11:return D.trys.push([11,,14,15]),o&&!o.done&&(f=i.return)?[4,f.call(i)]:[3,13];case 12:D.sent(),D.label=13;case 13:return[3,15];case 14:if(l)throw l.error;return[7];case 15:return[7];case 16:return[3,32];case 17:D.trys.push([17,23,24,29]),s=Object(r.__asyncValues)(n),D.label=18;case 18:return[4,s.next()];case 19:return(a=D.sent()).done?[3,22]:(x=a.value)[E]?[4,this._get(T,x[E])]:[3,21];case 20:N=D.sent(),x[S]=N&&this.modelInstanceCreator(C,N),delete x[E],D.label=21;case 21:return[3,18];case 22:return[3,29];case 23:return k=D.sent(),d={error:k},[3,29];case 24:return D.trys.push([24,,27,28]),a&&!a.done&&(h=s.return)?[4,h.call(s)]:[3,26];case 25:D.sent(),D.label=26;case 26:return[3,28];case 27:if(d)throw d.error;return[7];case 28:return[7];case 29:case 30:return[3,32];case 31:return Object(I.h)(w.relationType),[3,32];case 32:return[3,2];case 33:return[3,40];case 34:return M=D.sent(),u={error:M},[3,40];case 35:return D.trys.push([35,,38,39]),_&&!_.done&&(c=b.return)?[4,c.call(b)]:[3,37];case 36:D.sent(),D.label=37;case 37:return[3,39];case 38:if(u)throw u.error;return[7];case 39:return[7];case 40:return[2,n.map((function(e){return R.modelInstanceCreator(y,e)}))]}}))}))},e.prototype.query=function(e,t,n){return Object(r.__awaiter)(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f=this;return Object(r.__generator)(this,(function(d){switch(d.label){case 0:return[4,this.checkPrivate()];case 1:return d.sent(),i=this.getStorenameForModel(e),o=this.namespaceResolver(e),s=t&&w.a.getPredicates(t),a=s&&this.idFromPredicate(s),u=n&&n.sort,c=n&&n.limit,[4,Object(r.__awaiter)(f,void 0,void 0,(function(){var e,t,o;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return a?[4,this.getById(i,a)]:[3,2];case 1:return[2,(e=r.sent())?[e]:[]];case 2:return s?[4,this.filterOnPredicate(i,s)]:[3,4];case 3:return t=r.sent(),[2,this.inMemoryPagination(t,n)];case 4:return u?[4,this.getAll(i)]:[3,6];case 5:return o=r.sent(),[2,this.inMemoryPagination(o,n)];case 6:return c?[2,this.enginePagination(i,n)]:[2,this.getAll(i)]}}))}))];case 2:return l=d.sent(),[4,this.load(o,e.name,l)];case 3:return[2,d.sent()]}}))}))},e.prototype.getById=function(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(n){switch(n.label){case 0:return[4,this._get(e,t)];case 1:return[2,n.sent()]}}))}))},e.prototype.getAll=function(e){return Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(t){switch(t.label){case 0:return[4,this.db.getAll(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.idFromPredicate=function(e){var t=e.predicates,n=1===t.length&&t.find((function(e){return Object(g.v)(e)&&"id"===e.field&&"eq"===e.operator}));return n&&n.operand},e.prototype.filterOnPredicate=function(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){var n,i,o;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return n=t.predicates,i=t.type,[4,this.getAll(e)];case 1:return o=r.sent(),[2,n?o.filter((function(e){return Object(I.D)(e,i,n)})):o]}}))}))},e.prototype.inMemoryPagination=function(e,t){if(t&&e.length>1){if(t.sort){var n=S.a.getPredicates(t.sort);if(n.length){var r=Object(I.B)(n);e.sort(r)}}var i=t.page,o=void 0===i?0:i,s=t.limit,a=void 0===s?0:s,u=Math.max(0,o*a)||0,c=a>0?u+a:e.length;return e.slice(u,c)}return e},e.prototype.enginePagination=function(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){var n,i,o,s,a,u,c,l,f;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return t?(i=t.page,o=void 0===i?0:i,s=t.limit,a=void 0===s?0:s,u=Math.max(0,o*a)||0,[4,this.db.transaction(e).objectStore(e).openCursor()]):[3,7];case 1:return(c=r.sent())&&u>0?[4,c.advance(u)]:[3,3];case 2:r.sent(),r.label=3;case 3:l=[],f="number"==typeof a&&a>0,r.label=4;case 4:return c&&c.value?(l.push(c.value),f&&l.length===a?[3,6]:[4,c.continue()]):[3,6];case 5:return c=r.sent(),[3,4];case 6:return n=l,[3,9];case 7:return[4,this.db.getAll(e)];case 8:n=r.sent(),r.label=9;case 9:return[2,n]}}))}))},e.prototype.queryOne=function(e,t){return void 0===t&&(t=g.j.FIRST),Object(r.__awaiter)(this,void 0,void 0,(function(){var n,i,o;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return[4,this.checkPrivate()];case 1:return r.sent(),n=this.getStorenameForModel(e),[4,this.db.transaction([n],"readonly").objectStore(n).openCursor(void 0,t===g.j.FIRST?"next":"prev")];case 2:return i=r.sent(),[2,(o=i?i.value:void 0)&&this.modelInstanceCreator(e,o)]}}))}))},e.prototype.delete=function(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){var n,i,o,s,a,u,c,l,f,d,h,p,v,g,y;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return[4,this.checkPrivate()];case 1:return r.sent(),n=[],Object(I.u)(e)?(s=e,a=this.namespaceResolver(s),u=this.getStorenameForModel(s),[4,this.query(s,t)]):[3,9];case 2:return i=r.sent(),g=this.schema.namespaces[a].relationships[s.name].relationTypes,void 0===t?[3,5]:[4,this.deleteTraverse(g,i,s.name,a,n)];case 3:return r.sent(),[4,this.deleteItem(n)];case 4:return r.sent(),y=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[i,y]];case 5:return[4,this.deleteTraverse(g,i,s.name,a,n)];case 6:return r.sent(),[4,this.db.transaction([u],"readwrite").objectStore(u).clear()];case 7:return r.sent(),y=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[i,y]];case 8:return[3,17];case 9:return o=e,s=Object.getPrototypeOf(o).constructor,a=this.namespaceResolver(s),u=this.getStorenameForModel(s),t?(c=this.db.transaction([u],"readwrite"),l=c.objectStore(u),[4,this._get(l,o.id)]):[3,13];case 10:if(void 0===(f=r.sent()))return v="Model instance not found in storage",H.warn(v,{model:o}),[2,[[o],[]]];if(d=w.a.getPredicates(t),h=d.predicates,p=d.type,!Object(I.D)(f,p,h))throw v="Conditional update failed",H.error(v,{model:f,condition:h}),new Error(v);return[4,c.done];case 11:return r.sent(),g=this.schema.namespaces[a].relationships[s.name].relationTypes,[4,this.deleteTraverse(g,[o],s.name,a,n)];case 12:return r.sent(),[3,15];case 13:return g=this.schema.namespaces[a].relationships[s.name].relationTypes,[4,this.deleteTraverse(g,[o],s.name,a,n)];case 14:r.sent(),r.label=15;case 15:return[4,this.deleteItem(n)];case 16:return r.sent(),y=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[[o],y]];case 17:return[2]}}))}))},e.prototype.deleteItem=function(e){var t,n,i,o,s,a;return Object(r.__awaiter)(this,void 0,void 0,(function(){var u,c,l,f,d,h,p,v,g,y,m,b;return Object(r.__generator)(this,(function(_){switch(_.label){case 0:u=e.map((function(e){return e.storeName})),c=this.db.transaction(Object(r.__spread)(u),"readwrite"),_.label=1;case 1:_.trys.push([1,22,23,28]),t=Object(r.__asyncValues)(e),_.label=2;case 2:return[4,t.next()];case 3:if((n=_.sent()).done)return[3,21];l=n.value,f=l.storeName,d=l.items,h=c.objectStore(f),_.label=4;case 4:_.trys.push([4,14,15,20]),p=Object(r.__asyncValues)(d),_.label=5;case 5:return[4,p.next()];case 6:return(v=_.sent()).done?[3,13]:(g=v.value)?(y=void 0,"object"!==G(g)?[3,8]:[4,h.index("byId").getKey(g.id)]):[3,12];case 7:return y=_.sent(),[3,10];case 8:return[4,h.index("byId").getKey(g.toString())];case 9:y=_.sent(),_.label=10;case 10:return void 0===y?[3,12]:[4,h.delete(y)];case 11:_.sent(),_.label=12;case 12:return[3,5];case 13:return[3,20];case 14:return m=_.sent(),s={error:m},[3,20];case 15:return _.trys.push([15,,18,19]),v&&!v.done&&(a=p.return)?[4,a.call(p)]:[3,17];case 16:_.sent(),_.label=17;case 17:return[3,19];case 18:if(s)throw s.error;return[7];case 19:return[7];case 20:return[3,2];case 21:return[3,28];case 22:return b=_.sent(),i={error:b},[3,28];case 23:return _.trys.push([23,,26,27]),n&&!n.done&&(o=t.return)?[4,o.call(t)]:[3,25];case 24:_.sent(),_.label=25;case 25:return[3,27];case 26:if(i)throw i.error;return[7];case 27:return[7];case 28:return[2]}}))}))},e.prototype.deleteTraverse=function(e,t,n,i,o){var s,a,u,c,l,f,d,h,p,v,g,y;return Object(r.__awaiter)(this,void 0,void 0,(function(){var m,b,_,w,S,O,E,A,T,C,j,P,x,N,k=this;return Object(r.__generator)(this,(function(M){switch(M.label){case 0:M.trys.push([0,35,36,41]),s=Object(r.__asyncValues)(e),M.label=1;case 1:return[4,s.next()];case 2:if((a=M.sent()).done)return[3,34];switch(m=a.value,b=m.relationType,m.fieldName,_=m.modelName,w=m.targetName,S=this.getStorename(i,_),O=Object(I.i)(this.schema.namespaces[i].relationships[_].relationTypes,n)||Object(I.j)(this.schema.namespaces[i].relationships[_].indexes,m.associatedWith),b){case"HAS_ONE":return[3,3];case"HAS_MANY":return[3,17];case"BELONGS_TO":return[3,31]}return[3,32];case 3:M.trys.push([3,10,11,16]),u=Object(r.__asyncValues)(t),M.label=4;case 4:return[4,u.next()];case 5:return(c=M.sent()).done?[3,9]:(j=c.value,E=O||"byId",(A=w in j?j[w]:j.id)?[4,this.db.transaction(S,"readwrite").objectStore(S).index(E).get(A)]:[3,9]);case 6:return T=M.sent(),[4,this.deleteTraverse(this.schema.namespaces[i].relationships[_].relationTypes,T?[T]:[],_,i,o)];case 7:M.sent(),M.label=8;case 8:return[3,4];case 9:return[3,16];case 10:return C=M.sent(),p={error:C},[3,16];case 11:return M.trys.push([11,,14,15]),c&&!c.done&&(v=u.return)?[4,v.call(u)]:[3,13];case 12:M.sent(),M.label=13;case 13:return[3,15];case 14:if(p)throw p.error;return[7];case 15:return[7];case 16:return[3,33];case 17:M.trys.push([17,24,25,30]),l=Object(r.__asyncValues)(t),M.label=18;case 18:return[4,l.next()];case 19:return(f=M.sent()).done?[3,23]:(j=f.value,[4,this.db.transaction(S,"readwrite").objectStore(S).index(O).getAll(j.id)]);case 20:return P=M.sent(),[4,this.deleteTraverse(this.schema.namespaces[i].relationships[_].relationTypes,P,_,i,o)];case 21:M.sent(),M.label=22;case 22:return[3,18];case 23:return[3,30];case 24:return x=M.sent(),g={error:x},[3,30];case 25:return M.trys.push([25,,28,29]),f&&!f.done&&(y=l.return)?[4,y.call(l)]:[3,27];case 26:M.sent(),M.label=27;case 27:return[3,29];case 28:if(g)throw g.error;return[7];case 29:return[7];case 30:case 31:return[3,33];case 32:return Object(I.h)(b),[3,33];case 33:return[3,1];case 34:return[3,41];case 35:return N=M.sent(),d={error:N},[3,41];case 36:return M.trys.push([36,,39,40]),a&&!a.done&&(h=s.return)?[4,h.call(s)]:[3,38];case 37:M.sent(),M.label=38;case 38:return[3,40];case 39:if(d)throw d.error;return[7];case 40:return[7];case 41:return o.push({storeName:this.getStorename(i,n),items:t.map((function(e){return k.modelInstanceCreator(k.getModelConstructorByModelName(i,n),e)}))}),[2]}}))}))},e.prototype.clear=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(e){switch(e.label){case 0:return[4,this.checkPrivate()];case 1:return e.sent(),this.db.close(),[4,B(this.dbName)];case 2:return e.sent(),this.db=void 0,this.initPromise=void 0,[2]}}))}))},e.prototype.batchSave=function(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){var n,i,o,s,a,u,c,l,f,d,h,p;return Object(r.__generator)(this,(function(v){switch(v.label){case 0:return 0===t.length?[2,[]]:[4,this.checkPrivate()];case 1:v.sent(),n=[],i=this.getStorenameForModel(e),o=this.db.transaction(i,"readwrite"),s=o.store,a=function(t){var i,o,a,c,l;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return i=Object(I.C)(e.name,u.modelInstanceCreator(e,t),u.schema.namespaces[u.namespaceResolver(e)],u.modelInstanceCreator,u.getModelConstructorByModelName),o=t.id,a=t._deleted,[4,s.index("byId").getKey(o)];case 1:return c=r.sent(),a?[3,3]:(l=i.find((function(e){return e.instance.id===o})).instance,n.push([l,c?g.h.UPDATE:g.h.INSERT]),[4,s.put(l,c)]);case 2:return r.sent(),[3,5];case 3:return n.push([t,g.h.DELETE]),c?[4,s.delete(c)]:[3,5];case 4:r.sent(),r.label=5;case 5:return[2]}}))},u=this,v.label=2;case 2:v.trys.push([2,7,8,9]),c=Object(r.__values)(t),l=c.next(),v.label=3;case 3:return l.done?[3,6]:(f=l.value,[5,a(f)]);case 4:v.sent(),v.label=5;case 5:return l=c.next(),[3,3];case 6:return[3,9];case 7:return d=v.sent(),h={error:d},[3,9];case 8:try{l&&!l.done&&(p=c.return)&&p.call(c)}finally{if(h)throw h.error}return[7];case 9:return[4,o.done];case 10:return v.sent(),[2,n]}}))}))},e.prototype.createObjectStoreForModel=function(e,t,n,i){return Object(r.__awaiter)(this,void 0,void 0,(function(){var o;return Object(r.__generator)(this,(function(r){return o=e.createObjectStore(n,{autoIncrement:!0}),this.schema.namespaces[t].relationships[i].indexes.forEach((function(e){return o.createIndex(e,e)})),o.createIndex("byId","id",{unique:!0}),[2]}))}))},e}()),Y=function(){var e=this;this.db=new Map,this.getAllKeys=function(){return Object(r.__awaiter)(e,void 0,void 0,(function(){return Object(r.__generator)(this,(function(e){return[2,Array.from(this.db.keys())]}))}))},this.multiGet=function(t){return Object(r.__awaiter)(e,void 0,void 0,(function(){var e=this;return Object(r.__generator)(this,(function(n){return[2,t.reduce((function(t,n){return t.push([n,e.db.get(n)]),t}),[])]}))}))},this.multiRemove=function(t,n){return Object(r.__awaiter)(e,void 0,void 0,(function(){var e=this;return Object(r.__generator)(this,(function(r){return t.forEach((function(t){return e.db.delete(t)})),"function"==typeof n&&n(),[2]}))}))},this.multiSet=function(t,n){return Object(r.__awaiter)(e,void 0,void 0,(function(){var e=this;return Object(r.__generator)(this,(function(i){return t.forEach((function(t){var n=Object(r.__read)(t,2),i=n[0],o=n[1];e.setItem(i,o)})),"function"==typeof n&&n(),[2]}))}))},this.setItem=function(t,n){return Object(r.__awaiter)(e,void 0,void 0,(function(){return Object(r.__generator)(this,(function(e){return[2,this.db.set(t,n)]}))}))},this.removeItem=function(t){return Object(r.__awaiter)(e,void 0,void 0,(function(){return Object(r.__generator)(this,(function(e){return[2,this.db.delete(t)]}))}))},this.getItem=function(t){return Object(r.__awaiter)(e,void 0,void 0,(function(){return Object(r.__generator)(this,(function(e){return[2,this.db.get(t)]}))}))}};var J=new Map,$=function(){function e(){this._collectionInMemoryIndex=new Map,this.storage=new Y}return e.prototype.getCollectionIndex=function(e){return this._collectionInMemoryIndex.has(e)||this._collectionInMemoryIndex.set(e,new Map),this._collectionInMemoryIndex.get(e)},e.prototype.getMonotonicFactory=function(e){return J.has(e)||J.set(e,Object(I.z)()),J.get(e)},e.prototype.init=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){var e,t,n,i,o,s,a,u,c,l,f,d,h,p,v,g,y,m,b,_;return Object(r.__generator)(this,(function(w){switch(w.label){case 0:return this._collectionInMemoryIndex.clear(),[4,this.storage.getAllKeys()];case 1:e=w.sent(),t=[],w.label=2;case 2:w.trys.push([2,12,13,14]),n=Object(r.__values)(e),i=n.next(),w.label=3;case 3:return i.done?[3,11]:(o=i.value,s=Object(r.__read)(o.split("::"),5),a=s[0],u=s[1],c=s[2],l=s[3],f=s[4],"@AmplifyDatastore"!==a?[3,10]:"Data"!==c?[3,9]:(d=void 0,void 0!==f?[3,7]:(h=l,p=this.getMonotonicFactory(u)(),v=this.getLegacyKeyForItem(u,h),g=this.getKeyForItem(u,h,p),[4,this.storage.getItem(v)])));case 4:return y=w.sent(),[4,this.storage.setItem(g,y)];case 5:return w.sent(),[4,this.storage.removeItem(v)];case 6:return w.sent(),d=p,[3,8];case 7:d=l,w.label=8;case 8:return this.getCollectionIndex(u).set(f,d),[3,10];case 9:"Collection"===c&&t.push(o),w.label=10;case 10:return i=n.next(),[3,3];case 11:return[3,14];case 12:return m=w.sent(),b={error:m},[3,14];case 13:try{i&&!i.done&&(_=n.return)&&_.call(n)}finally{if(b)throw b.error}return[7];case 14:return t.length>0?[4,this.storage.multiRemove(t)]:[3,16];case 15:w.sent(),w.label=16;case 16:return[2]}}))}))},e.prototype.save=function(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){var n,i;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return n=this.getCollectionIndex(t).get(e.id)||this.getMonotonicFactory(t)(),i=this.getKeyForItem(t,e.id,n),this.getCollectionIndex(t).set(e.id,n),[4,this.storage.setItem(i,JSON.stringify(e))];case 1:return r.sent(),[2]}}))}))},e.prototype.batchSave=function(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){var n,i,o,s,a,u,c,l,f,d,h,p,v,y,m,b,_,w,S,O,E,A=this;return Object(r.__generator)(this,(function(I){switch(I.label){case 0:if(0===t.length)return[2,[]];n=[],i=this.getCollectionIndex(e),o=new Set,s=new Set,a=[],u={};try{for(c=Object(r.__values)(t),l=c.next();!l.done;l=c.next())f=l.value,d=f.id,h=f._deleted,p=i.get(d)||this.getMonotonicFactory(e)(),_=this.getKeyForItem(e,d,p),a.push(_),u[_]={ulid:p,model:f},h?o.add(_):s.add(_)}catch(e){w={error:e}}finally{try{l&&!l.done&&(S=c.return)&&S.call(c)}finally{if(w)throw w.error}}return[4,this.storage.multiGet(a)];case 1:return v=I.sent(),y=v.filter((function(e){return!!Object(r.__read)(e,2)[1]})).reduce((function(e,t){var n=Object(r.__read)(t,1)[0];return e.add(n)}),new Set),[4,new Promise((function(e,t){if(0!==o.size){var n=Array.from(o);n.forEach((function(e){return i.delete(u[e].model.id)})),A.storage.multiRemove(n,(function(n){n&&n.length>0?t(n):e()}))}else e()}))];case 2:return I.sent(),[4,new Promise((function(e,t){if(0!==s.size){var n=Array.from(s).map((function(e){return[e,JSON.stringify(u[e].model)]}));s.forEach((function(e){var t=u[e],n=t.model.id,r=t.ulid;i.set(n,r)})),A.storage.multiSet(n,(function(n){n&&n.length>0?t(n):e()}))}else e()}))];case 3:I.sent();try{for(m=Object(r.__values)(a),b=m.next();!b.done;b=m.next())_=b.value,o.has(_)&&y.has(_)?n.push([u[_].model,g.h.DELETE]):s.has(_)&&n.push([u[_].model,y.has(_)?g.h.UPDATE:g.h.INSERT])}catch(e){O={error:e}}finally{try{b&&!b.done&&(E=m.return)&&E.call(m)}finally{if(O)throw O.error}}return[2,n]}}))}))},e.prototype.get=function(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){var n,i,o;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return n=this.getCollectionIndex(t).get(e),i=this.getKeyForItem(t,e,n),[4,this.storage.getItem(i)];case 1:return o=r.sent(),[2,o&&JSON.parse(o)]}}))}))},e.prototype.getOne=function(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){var n,i,o,s,a,u,c;return Object(r.__generator)(this,(function(l){switch(l.label){case 0:return n=this.getCollectionIndex(t),i=Object(r.__read)(e===g.j.FIRST?function(){var e,t,i,o,s;try{for(var a=Object(r.__values)(n),u=a.next();!u.done;u=a.next()){o=(i=Object(r.__read)(u.value,2))[0],s=i[1];break}}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return[o,s]}():function(){var e,t,i,o,s;try{for(var a=Object(r.__values)(n),u=a.next();!u.done;u=a.next())o=(i=Object(r.__read)(u.value,2))[0],s=i[1]}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return[o,s]}(),2),o=i[0],s=i[1],a=this.getKeyForItem(t,o,s),(c=a)?[4,this.storage.getItem(a)]:[3,2];case 1:c=l.sent(),l.label=2;case 2:return[2,(u=c)&&JSON.parse(u)||void 0]}}))}))},e.prototype.getAll=function(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){var n,i,o,s,a,u,c,l,f,d,h,p,v,g,y,m,b,_;return Object(r.__generator)(this,(function(w){switch(w.label){case 0:n=this.getCollectionIndex(e),o=(i=t||{}).page,s=void 0===o?0:o,a=i.limit,u=void 0===a?0:a,c=Math.max(0,s*u)||0,l=u>0?c+u:void 0,f=[],d=0;try{for(h=Object(r.__values)(n),p=h.next();!p.done&&(v=Object(r.__read)(p.value,2),g=v[0],y=v[1],++d<=c||(f.push(this.getKeyForItem(e,g,y)),d!==l));p=h.next());}catch(e){b={error:e}}finally{try{p&&!p.done&&(_=h.return)&&_.call(h)}finally{if(b)throw b.error}}return[4,this.storage.multiGet(f)];case 1:return m=w.sent(),[2,m.filter((function(e){return Object(r.__read)(e,2)[1]})).map((function(e){var t=Object(r.__read)(e,2)[1];return JSON.parse(t)}))]}}))}))},e.prototype.delete=function(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){var n,i;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return n=this.getCollectionIndex(t).get(e),i=this.getKeyForItem(t,e,n),this.getCollectionIndex(t).delete(e),[4,this.storage.removeItem(i)];case 1:return r.sent(),[2]}}))}))},e.prototype.clear=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){var e,t;return Object(r.__generator)(this,(function(n){switch(n.label){case 0:return[4,this.storage.getAllKeys()];case 1:return e=n.sent(),t=e.filter((function(e){return e.startsWith("@AmplifyDatastore")})),[4,this.storage.multiRemove(t)];case 2:return n.sent(),this._collectionInMemoryIndex.clear(),[2]}}))}))},e.prototype.getKeyForItem=function(e,t,n){return this.getKeyPrefixForStoreItems(e)+"::"+n+"::"+t},e.prototype.getLegacyKeyForItem=function(e,t){return this.getKeyPrefixForStoreItems(e)+"::"+t},e.prototype.getKeyPrefixForStoreItems=function(e){return"@AmplifyDatastore::"+e+"::Data"},e}();function Q(e){return(Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var Z,X=new o.a("DataStore"),ee=new(function(){function e(){}return e.prototype.getStorenameForModel=function(e){var t=this.namespaceResolver(e),n=e.name;return this.getStorename(t,n)},e.prototype.getStorename=function(e,t){return e+"_"+t},e.prototype.setUp=function(e,t,n,i){return Object(r.__awaiter)(this,void 0,void 0,(function(){var o,s=this;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return this.initPromise?[3,1]:(this.initPromise=new Promise((function(e,t){s.resolve=e,s.reject=t})),[3,3]);case 1:return[4,this.initPromise];case 2:return r.sent(),[2];case 3:this.schema=e,this.namespaceResolver=t,this.modelInstanceCreator=n,this.getModelConstructorByModelName=i,r.label=4;case 4:return r.trys.push([4,7,,8]),this.db?[3,6]:(this.db=new $,[4,this.db.init()]);case 5:r.sent(),this.resolve(),r.label=6;case 6:return[3,8];case 7:return o=r.sent(),this.reject(o),[3,8];case 8:return[2]}}))}))},e.prototype.save=function(e,t){var n,i;return Object(r.__awaiter)(this,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h,p,v,y,m,b,_,S,O,E,A,T,C,j,P=this;return Object(r.__generator)(this,(function(x){switch(x.label){case 0:return o=Object.getPrototypeOf(e).constructor,s=this.getStorenameForModel(o),a=Object(I.C)(o.name,e,this.schema.namespaces[this.namespaceResolver(o)],this.modelInstanceCreator,this.getModelConstructorByModelName),u=this.namespaceResolver(o),c=new Set,l=Object.values(a).map((function(e){var t=e.modelName,n=e.item,r=e.instance,i=P.getStorename(u,t);return c.add(i),{storeName:i,item:n,instance:r}})),[4,this.db.get(e.id,s)];case 1:if(f=x.sent(),t&&f&&(d=w.a.getPredicates(t),h=d.predicates,p=d.type,!Object(I.D)(f,p,h)))throw v="Conditional update failed",X.error(v,{model:f,condition:h}),new Error(v);y=[],x.label=2;case 2:x.trys.push([2,9,10,15]),m=Object(r.__asyncValues)(l),x.label=3;case 3:return[4,m.next()];case 4:return(b=x.sent()).done?[3,8]:(_=b.value,S=_.storeName,O=_.item,E=_.instance,A=O.id,[4,this.db.get(A,S)]);case 5:return T=x.sent(),C=T?g.h.UPDATE:g.h.INSERT,A!==e.id&&C!==g.h.INSERT?[3,7]:[4,this.db.save(O,S)];case 6:x.sent(),y.push([E,C]),x.label=7;case 7:return[3,3];case 8:return[3,15];case 9:return j=x.sent(),n={error:j},[3,15];case 10:return x.trys.push([10,,13,14]),b&&!b.done&&(i=m.return)?[4,i.call(m)]:[3,12];case 11:x.sent(),x.label=12;case 12:return[3,14];case 13:if(n)throw n.error;return[7];case 14:return[7];case 15:return[2,y]}}))}))},e.prototype.load=function(e,t,n){var i,o,s,a,u,c,l,f,d,h;return Object(r.__awaiter)(this,void 0,void 0,(function(){var p,v,g,y,m,b,_,w,S,O,E,A,T,C,j,P,x,N,k,M=this;return Object(r.__generator)(this,(function(R){switch(R.label){case 0:if(p=this.schema.namespaces[e],v=p.relationships[t].relationTypes,g=v.map((function(t){var n=t.modelName;return M.getStorename(e,n)})),y=this.getModelConstructorByModelName(e,t),0===g.length)return[2,n.map((function(e){return M.modelInstanceCreator(y,e)}))];R.label=1;case 1:R.trys.push([1,34,35,40]),m=Object(r.__asyncValues)(v),R.label=2;case 2:return[4,m.next()];case 3:if((b=R.sent()).done)return[3,33];switch(_=b.value,w=_.fieldName,S=_.modelName,O=_.targetName,E=_.relationType,A=this.getStorename(e,S),T=this.getModelConstructorByModelName(e,S),E){case"HAS_ONE":return[3,4];case"BELONGS_TO":return[3,17];case"HAS_MANY":return[3,30]}return[3,31];case 4:R.trys.push([4,10,11,16]),i=Object(r.__asyncValues)(n),R.label=5;case 5:return[4,i.next()];case 6:return(o=R.sent()).done?[3,9]:(P=o.value,C=P[O]?O:w,P[C]?[4,this.db.get(P[C],A)]:[3,9]);case 7:x=R.sent(),P[w]=x&&this.modelInstanceCreator(T,x),R.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return j=R.sent(),l={error:j},[3,16];case 11:return R.trys.push([11,,14,15]),o&&!o.done&&(f=i.return)?[4,f.call(i)]:[3,13];case 12:R.sent(),R.label=13;case 13:return[3,15];case 14:if(l)throw l.error;return[7];case 15:return[7];case 16:return[3,32];case 17:R.trys.push([17,23,24,29]),s=Object(r.__asyncValues)(n),R.label=18;case 18:return[4,s.next()];case 19:return(a=R.sent()).done?[3,22]:(P=a.value)[O]?[4,this.db.get(P[O],A)]:[3,21];case 20:x=R.sent(),P[w]=x&&this.modelInstanceCreator(T,x),delete P[O],R.label=21;case 21:return[3,18];case 22:return[3,29];case 23:return N=R.sent(),d={error:N},[3,29];case 24:return R.trys.push([24,,27,28]),a&&!a.done&&(h=s.return)?[4,h.call(s)]:[3,26];case 25:R.sent(),R.label=26;case 26:return[3,28];case 27:if(d)throw d.error;return[7];case 28:return[7];case 29:case 30:return[3,32];case 31:return Object(I.h)(E),[3,32];case 32:return[3,2];case 33:return[3,40];case 34:return k=R.sent(),u={error:k},[3,40];case 35:return R.trys.push([35,,38,39]),b&&!b.done&&(c=m.return)?[4,c.call(m)]:[3,37];case 36:R.sent(),R.label=37;case 37:return[3,39];case 38:if(u)throw u.error;return[7];case 39:return[7];case 40:return[2,n.map((function(e){return M.modelInstanceCreator(y,e)}))]}}))}))},e.prototype.query=function(e,t,n){return Object(r.__awaiter)(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f=this;return Object(r.__generator)(this,(function(d){switch(d.label){case 0:return i=this.getStorenameForModel(e),o=this.namespaceResolver(e),s=t&&w.a.getPredicates(t),a=s&&this.idFromPredicate(s),u=n&&n.sort,c=n&&n.limit,[4,Object(r.__awaiter)(f,void 0,void 0,(function(){var e,t,o;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return a?[4,this.getById(i,a)]:[3,2];case 1:return[2,(e=r.sent())?[e]:[]];case 2:return s?[4,this.filterOnPredicate(i,s)]:[3,4];case 3:return t=r.sent(),[2,this.inMemoryPagination(t,n)];case 4:return u||c?[4,this.getAll(i)]:[3,6];case 5:return o=r.sent(),[2,this.inMemoryPagination(o,n)];case 6:return[2,this.getAll(i)]}}))}))];case 1:return l=d.sent(),[4,this.load(o,e.name,l)];case 2:return[2,d.sent()]}}))}))},e.prototype.getById=function(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(n){switch(n.label){case 0:return[4,this.db.get(t,e)];case 1:return[2,n.sent()]}}))}))},e.prototype.getAll=function(e){return Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(t){switch(t.label){case 0:return[4,this.db.getAll(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.idFromPredicate=function(e){var t=e.predicates,n=1===t.length&&t.find((function(e){return Object(g.v)(e)&&"id"===e.field&&"eq"===e.operator}));return n&&n.operand},e.prototype.filterOnPredicate=function(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){var n,i,o;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return n=t.predicates,i=t.type,[4,this.getAll(e)];case 1:return o=r.sent(),[2,n?o.filter((function(e){return Object(I.D)(e,i,n)})):o]}}))}))},e.prototype.inMemoryPagination=function(e,t){if(t&&e.length>1){if(t.sort){var n=S.a.getPredicates(t.sort);if(n.length){var r=Object(I.B)(n);e.sort(r)}}var i=t.page,o=void 0===i?0:i,s=t.limit,a=void 0===s?0:s,u=Math.max(0,o*a)||0,c=a>0?u+a:e.length;return e.slice(u,c)}return e},e.prototype.queryOne=function(e,t){return void 0===t&&(t=g.j.FIRST),Object(r.__awaiter)(this,void 0,void 0,(function(){var n,i;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return n=this.getStorenameForModel(e),[4,this.db.getOne(t,n)];case 1:return[2,(i=r.sent())&&this.modelInstanceCreator(e,i)]}}))}))},e.prototype.delete=function(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){var n,i,o,s,a,u,c,l,f,d,h,p,v;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return n=[],Object(I.u)(e)?(s=e,a=this.namespaceResolver(s),[4,this.query(s,t)]):[3,8];case 1:return i=r.sent(),p=this.schema.namespaces[a].relationships[s.name].relationTypes,void 0===t?[3,4]:[4,this.deleteTraverse(p,i,s.name,a,n)];case 2:return r.sent(),[4,this.deleteItem(n)];case 3:return r.sent(),v=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[i,v]];case 4:return[4,this.deleteTraverse(p,i,s.name,a,n)];case 5:return r.sent(),[4,this.deleteItem(n)];case 6:return r.sent(),v=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[i,v]];case 7:return[3,15];case 8:return o=e,s=Object.getPrototypeOf(o).constructor,a=this.namespaceResolver(s),u=this.getStorenameForModel(s),t?[4,this.db.get(o.id,u)]:[3,11];case 9:if(void 0===(c=r.sent()))return h="Model instance not found in storage",X.warn(h,{model:o}),[2,[[o],[]]];if(l=w.a.getPredicates(t),f=l.predicates,d=l.type,!Object(I.D)(c,d,f))throw h="Conditional update failed",X.error(h,{model:c,condition:f}),new Error(h);return p=this.schema.namespaces[a].relationships[s.name].relationTypes,[4,this.deleteTraverse(p,[o],s.name,a,n)];case 10:return r.sent(),[3,13];case 11:return p=this.schema.namespaces[a].relationships[s.name].relationTypes,[4,this.deleteTraverse(p,[o],s.name,a,n)];case 12:r.sent(),r.label=13;case 13:return[4,this.deleteItem(n)];case 14:return r.sent(),v=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[[o],v]];case 15:return[2]}}))}))},e.prototype.deleteItem=function(e){var t,n,i,o,s,a;return Object(r.__awaiter)(this,void 0,void 0,(function(){var u,c,l,f,d,h,p,v,g;return Object(r.__generator)(this,(function(y){switch(y.label){case 0:y.trys.push([0,17,18,23]),t=Object(r.__asyncValues)(e),y.label=1;case 1:return[4,t.next()];case 2:if((n=y.sent()).done)return[3,16];u=n.value,c=u.storeName,l=u.items,y.label=3;case 3:y.trys.push([3,9,10,15]),f=Object(r.__asyncValues)(l),y.label=4;case 4:return[4,f.next()];case 5:return(d=y.sent()).done?[3,8]:(h=d.value)?"object"!==Q(h)?[3,7]:(p=h.id,[4,this.db.delete(p,c)]):[3,7];case 6:y.sent(),y.label=7;case 7:return[3,4];case 8:return[3,15];case 9:return v=y.sent(),s={error:v},[3,15];case 10:return y.trys.push([10,,13,14]),d&&!d.done&&(a=f.return)?[4,a.call(f)]:[3,12];case 11:y.sent(),y.label=12;case 12:return[3,14];case 13:if(s)throw s.error;return[7];case 14:return[7];case 15:return[3,1];case 16:return[3,23];case 17:return g=y.sent(),i={error:g},[3,23];case 18:return y.trys.push([18,,21,22]),n&&!n.done&&(o=t.return)?[4,o.call(t)]:[3,20];case 19:y.sent(),y.label=20;case 20:return[3,22];case 21:if(i)throw i.error;return[7];case 22:return[7];case 23:return[2]}}))}))},e.prototype.deleteTraverse=function(e,t,n,i,o){var s,a,u,c,l,f,d,h,p,v,g,y;return Object(r.__awaiter)(this,void 0,void 0,(function(){var m,b,_,w,S,O,E,A,T,C,j,P,x,N,k,M=this;return Object(r.__generator)(this,(function(R){switch(R.label){case 0:R.trys.push([0,35,36,41]),s=Object(r.__asyncValues)(e),R.label=1;case 1:return[4,s.next()];case 2:if((a=R.sent()).done)return[3,34];switch(m=a.value,b=m.relationType,_=m.modelName,w=m.targetName,S=this.getStorename(i,_),O=Object(I.i)(this.schema.namespaces[i].relationships[_].relationTypes,n)||Object(I.j)(this.schema.namespaces[i].relationships[_].indexes,m.associatedWith),b){case"HAS_ONE":return[3,3];case"HAS_MANY":return[3,17];case"BELONGS_TO":return[3,31]}return[3,32];case 3:R.trys.push([3,10,11,16]),u=Object(r.__asyncValues)(t),R.label=4;case 4:return[4,u.next()];case 5:return(c=R.sent()).done?[3,9]:(j=c.value,E=O||"byId",(A=w in j?j[w]:j.id)?[4,this.db.getAll(S)]:[3,9]);case 6:return P=R.sent(),T=P.filter((function(e){return e[E]===A})),[4,this.deleteTraverse(this.schema.namespaces[i].relationships[_].relationTypes,T,_,i,o)];case 7:R.sent(),R.label=8;case 8:return[3,4];case 9:return[3,16];case 10:return C=R.sent(),p={error:C},[3,16];case 11:return R.trys.push([11,,14,15]),c&&!c.done&&(v=u.return)?[4,v.call(u)]:[3,13];case 12:R.sent(),R.label=13;case 13:return[3,15];case 14:if(p)throw p.error;return[7];case 15:return[7];case 16:return[3,33];case 17:R.trys.push([17,24,25,30]),l=Object(r.__asyncValues)(t),R.label=18;case 18:return[4,l.next()];case 19:return(f=R.sent()).done?[3,23]:(j=f.value,[4,this.db.getAll(S)]);case 20:return P=R.sent(),x=P.filter((function(e){return e[O]===j.id})),[4,this.deleteTraverse(this.schema.namespaces[i].relationships[_].relationTypes,x,_,i,o)];case 21:R.sent(),R.label=22;case 22:return[3,18];case 23:return[3,30];case 24:return N=R.sent(),g={error:N},[3,30];case 25:return R.trys.push([25,,28,29]),f&&!f.done&&(y=l.return)?[4,y.call(l)]:[3,27];case 26:R.sent(),R.label=27;case 27:return[3,29];case 28:if(g)throw g.error;return[7];case 29:return[7];case 30:case 31:return[3,33];case 32:return Object(I.h)(b),[3,33];case 33:return[3,1];case 34:return[3,41];case 35:return k=R.sent(),d={error:k},[3,41];case 36:return R.trys.push([36,,39,40]),a&&!a.done&&(h=s.return)?[4,h.call(s)]:[3,38];case 37:R.sent(),R.label=38;case 38:return[3,40];case 39:if(d)throw d.error;return[7];case 40:return[7];case 41:return o.push({storeName:this.getStorename(i,n),items:t.map((function(e){return M.modelInstanceCreator(M.getModelConstructorByModelName(i,n),e)}))}),[2]}}))}))},e.prototype.clear=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(e){switch(e.label){case 0:return[4,this.db.clear()];case 1:return e.sent(),this.db=void 0,this.initPromise=void 0,[2]}}))}))},e.prototype.batchSave=function(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){var n,i,o,s,a,u,c,l,f,d,h;return Object(r.__generator)(this,(function(p){switch(p.label){case 0:n=e.name,i=this.namespaceResolver(e),o=this.getStorename(i,n),s=[],a=function(t){var n=t.id,r=Object(I.C)(e.name,u.modelInstanceCreator(e,t),u.schema.namespaces[u.namespaceResolver(e)],u.modelInstanceCreator,u.getModelConstructorByModelName).find((function(e){return e.instance.id===n})).instance;s.push(r)},u=this;try{for(c=Object(r.__values)(t),l=c.next();!l.done;l=c.next())f=l.value,a(f)}catch(e){d={error:e}}finally{try{l&&!l.done&&(h=c.return)&&h.call(c)}finally{if(d)throw d.error}}return[4,this.db.batchSave(o,s)];case 1:return[2,p.sent()]}}))}))},e}()),te=function(){return Object(s.b)().isBrowser&&window.indexedDB||Object(s.c)()&&self.indexedDB?W:ee},ne=new o.a("DataStore"),re=function(){function e(e,t,n,r,i,o){this.schema=e,this.namespaceResolver=t,this.getModelConstructorByModelName=n,this.modelInstanceCreator=r,this.adapter=i,this.sessionId=o,this.adapter=this.adapter||te(),this.pushStream=new A.a}return e.getNamespace=function(){return{name:I.c,relationships:{},enums:{},models:{},nonModels:{}}},e.prototype.init=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){var e,t;return Object(r.__generator)(this,(function(n){switch(n.label){case 0:return void 0===this.initialized?[3,2]:[4,this.initialized];case 1:return n.sent(),[2];case 2:return ne.debug("Starting Storage"),this.initialized=new Promise((function(n,r){e=n,t=r})),this.adapter.setUp(this.schema,this.namespaceResolver,this.modelInstanceCreator,this.getModelConstructorByModelName,this.sessionId).then(e,t),[4,this.initialized];case 3:return n.sent(),[2]}}))}))},e.prototype.save=function(e,t,n,i){return Object(r.__awaiter)(this,void 0,void 0,(function(){var o,s=this;return Object(r.__generator)(this,(function(a){switch(a.label){case 0:return[4,this.init()];case 1:return a.sent(),[4,this.adapter.save(e,t)];case 2:return(o=a.sent()).forEach((function(a){var u,c=Object(r.__read)(a,2),l=c[0],f=c[1],d=!!n;if(f===g.h.UPDATE&&!d&&null===(u=s.getUpdateMutationInput(e,l,i)))return o;var h=u||l,p=Object.getPrototypeOf(l).constructor;s.pushStream.next({model:p,opType:f,element:h,mutator:n,condition:w.a.getPredicates(t,!1),savedElement:l})})),[2,o]}}))}))},e.prototype.delete=function(e,t,n){return Object(r.__awaiter)(this,void 0,void 0,(function(){var i,o,s,a,u=this;return Object(r.__generator)(this,(function(c){switch(c.label){case 0:return[4,this.init()];case 1:return c.sent(),[4,this.adapter.delete(e,t)];case 2:return a=r.__read.apply(void 0,[c.sent(),2]),o=a[0],i=a[1],s=new Set(o.map((function(e){return e.id}))),Object(I.u)(e)||Array.isArray(i)||(i=[i]),i.forEach((function(r){var i,o=Object.getPrototypeOf(r).constructor;Object(I.u)(e)||(i=s.has(r.id)?w.a.getPredicates(t,!1):void 0),u.pushStream.next({model:o,opType:g.h.DELETE,element:r,mutator:n,condition:i})})),[2,[o,i]]}}))}))},e.prototype.query=function(e,t,n){return Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return[4,this.init()];case 1:return r.sent(),[4,this.adapter.query(e,t,n)];case 2:return[2,r.sent()]}}))}))},e.prototype.queryOne=function(e,t){return void 0===t&&(t=g.j.FIRST),Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(n){switch(n.label){case 0:return[4,this.init()];case 1:return n.sent(),[4,this.adapter.queryOne(e,t)];case 2:return[2,n.sent()]}}))}))},e.prototype.observe=function(e,t,n){var i=!e,o=w.a.getPredicates(t,!1)||{},s=o.predicates,a=o.type,u=!!s,c=this.pushStream.observable.filter((function(e){var t=e.mutator;return!n||t!==n})).map((function(e){e.mutator;return Object(r.__rest)(e,["mutator"])}));return i||(c=c.filter((function(t){var n=t.model,r=t.element;return e===n&&(!u||Object(I.D)(r,a,s))}))),c},e.prototype.clear=function(e){return void 0===e&&(e=!0),Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(t){switch(t.label){case 0:return this.initialized=void 0,[4,this.adapter.clear()];case 1:return t.sent(),e&&this.pushStream.complete(),[2]}}))}))},e.prototype.batchSave=function(e,t,n){return Object(r.__awaiter)(this,void 0,void 0,(function(){var i,o=this;return Object(r.__generator)(this,(function(s){switch(s.label){case 0:return[4,this.init()];case 1:return s.sent(),[4,this.adapter.batchSave(e,t)];case 2:return(i=s.sent()).forEach((function(t){var i=Object(r.__read)(t,2),s=i[0],a=i[1];o.pushStream.next({model:e,opType:a,element:s,mutator:n,condition:void 0})})),[2,i]}}))}))},e.prototype.getUpdateMutationInput=function(e,t,n){var i,o;if(!(n&&n.length))return null;var s=Object(r.__read)(n,2),a=s[0],u=s[1],c={},l=a.map((function(e){return e.path&&e.path[0]})),f=Object.getPrototypeOf(e).constructor,d=this.namespaceResolver(f),h=this.schema.namespaces[d].models[f.name].fields,p=this.schema.namespaces[d].keys[f.name],v=p.primaryKey,y=p.compositeKeys,m=void 0===y?[]:y;if(l.forEach((function(e){var n,i,o,s,a,l=Object(g.x)(null===(a=h[e])||void 0===a?void 0:a.association)||e;if(!Object(I.E)(u[l],t[l])){c[l]=void 0===t[l]?null:t[l];try{for(var f=Object(r.__values)(m),d=f.next();!d.done;d=f.next()){var p=d.value;if(p.has(l))try{for(var v=(o=void 0,Object(r.__values)(p)),y=v.next();!y.done;y=v.next()){var b=y.value;c[b]=t[b]}}catch(e){o={error:e}}finally{try{y&&!y.done&&(s=v.return)&&s.call(v)}finally{if(o)throw o.error}}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}}})),v&&v.length)try{for(var b=Object(r.__values)(v),_=b.next();!_.done;_=b.next()){var w=_.value;c[w]=t[w]}}catch(e){i={error:e}}finally{try{_&&!_.done&&(o=b.return)&&o.call(b)}finally{if(i)throw i.error}}if(0===Object.keys(c).length)return null;var S=t.id,O=t._version,E=t._lastChangedAt,A=t._deleted;return Object(r.__assign)(Object(r.__assign)({},c),{id:S,_version:O,_lastChangedAt:E,_deleted:A})},e}(),ie=function(){function e(e,t,n,r,i,o){this.mutex=new O,this.storage=new re(e,t,n,r,i,o)}return e.prototype.runExclusive=function(e){return this.mutex.runExclusive(e.bind(this,this.storage))},e.prototype.save=function(e,t,n,i){return Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(r){return[2,this.runExclusive((function(r){return r.save(e,t,n,i)}))]}))}))},e.prototype.delete=function(e,t,n){return Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(r){return[2,this.runExclusive((function(r){if(Object(I.u)(e)){var i=e;return r.delete(i,t,n)}var o=e;return r.delete(o,t,n)}))]}))}))},e.prototype.query=function(e,t,n){return Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(r){return[2,this.runExclusive((function(r){return r.query(e,t,n)}))]}))}))},e.prototype.queryOne=function(e,t){return void 0===t&&(t=g.j.FIRST),Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(n){return[2,this.runExclusive((function(n){return n.queryOne(e,t)}))]}))}))},e.getNamespace=function(){return re.getNamespace()},e.prototype.observe=function(e,t,n){return this.storage.observe(e,t,n)},e.prototype.clear=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(e){switch(e.label){case 0:return[4,this.storage.clear()];case 1:return e.sent(),[2]}}))}))},e.prototype.batchSave=function(e,t){return this.storage.batchSave(e,t)},e.prototype.init=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(e){return[2,this.storage.init()]}))}))},e}(),oe=n(14),se=(new(function(){function e(){}return e.prototype.networkMonitor=function(t){if(Object(s.b)().isNode)return h.a.from([{online:!0}]);var n=Object(s.c)()?self:window;return new h.a((function(t){t.next({online:n.navigator.onLine});var r=function(){return t.next({online:!0})},i=function(){return t.next({online:!1})};return n.addEventListener("online",r),n.addEventListener("offline",i),e._observers.push(t),function(){n.removeEventListener("online",r),n.removeEventListener("offline",i),e._observers=e._observers.filter((function(e){return e!==t}))}}))},e._observerOverride=function(t){var n,i,o=function(n){if(n.closed)return e._observers=e._observers.filter((function(e){return e!==n})),"continue";n.next(t)};try{for(var s=Object(r.__values)(e._observers),a=s.next();!a.done;a=s.next()){o(a.value)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}},e._observers=[],e}())).networkMonitor(),ae=(new o.a("DataStore"),function(){function e(){this.connectionStatus={online:!1}}return e.prototype.status=function(){var e=this;if(this.observer)throw new Error("Subscriber already exists");return new h.a((function(t){return e.observer=t,e.subscription=se.subscribe((function(n){var i=n.online;e.connectionStatus.online=i;var o=Object(r.__assign)({},e.connectionStatus);t.next(o)})),function(){clearTimeout(e.timeout),e.unsubscribe()}}))},e.prototype.unsubscribe=function(){this.subscription&&(clearTimeout(this.timeout),this.subscription.unsubscribe())},e.prototype.socketDisconnected=function(){var e=this;this.observer&&"function"==typeof this.observer.next&&(this.observer.next({online:!1}),this.timeout=setTimeout((function(){var t=Object(r.__assign)({},e.connectionStatus);e.observer.next(t)}),5e3))},e}()),ue=function(){function e(e,t){this.outbox=e,this.ownSymbol=t}return e.prototype.merge=function(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){var n,i,o,s,a;return Object(r.__generator)(this,(function(u){switch(u.label){case 0:return[4,this.outbox.getForModel(e,t)];case 1:return i=u.sent(),o=t._deleted,0!==i.length?[3,5]:o?(n=g.h.DELETE,[4,e.delete(t,void 0,this.ownSymbol)]):[3,3];case 2:return u.sent(),[3,5];case 3:return[4,e.save(t,void 0,this.ownSymbol)];case 4:s=r.__read.apply(void 0,[u.sent(),1]),a=Object(r.__read)(s[0],2),n=a[1],u.label=5;case 5:return[2,n]}}))}))},e.prototype.mergePage=function(e,t,n){return Object(r.__awaiter)(this,void 0,void 0,(function(){var i,o,s,a,u,c,l;return Object(r.__generator)(this,(function(f){switch(f.label){case 0:i=new Map;try{for(o=Object(r.__values)(n),s=o.next();!s.done;s=o.next())a=s.value,i.set(a.id,a)}catch(e){c={error:e}}finally{try{s&&!s.done&&(l=o.return)&&l.call(o)}finally{if(c)throw c.error}}return u=Object(r.__spread)(i.values()),[4,e.batchSave(t,u,this.ownSymbol)];case 1:return[2,f.sent()]}}))}))},e}(),ce=n(4),le=function(){function e(e,t,n,r){this.schema=e,this.MutationEvent=t,this.modelInstanceCreator=n,this.ownSymbol=r}return e.prototype.enqueue=function(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){var n=this;return Object(r.__generator)(this,(function(i){return e.runExclusive((function(e){return Object(r.__awaiter)(n,void 0,void 0,(function(){var n,i,o,s,a,u,c,l,f,d=this;return Object(r.__generator)(this,(function(h){switch(h.label){case 0:return n=this.schema.namespaces[I.d].models.MutationEvent,i=w.a.createFromExisting(n,(function(e){return e.modelId("eq",t.modelId).id("ne",d.inProgressMutationEventId)})),[4,e.query(this.MutationEvent,i)];case 1:return o=r.__read.apply(void 0,[h.sent(),1]),void 0!==(s=o[0])?[3,3]:[4,e.save(t,void 0,this.ownSymbol)];case 2:return h.sent(),[2];case 3:return a=t.operation,s.operation!==ce.a.CREATE?[3,8]:a!==ce.a.DELETE?[3,5]:[4,e.delete(this.MutationEvent,i)];case 4:return h.sent(),[3,7];case 5:return u=this.mergeUserFields(s,t),[4,e.save(this.MutationEvent.copyOf(s,(function(e){e.data=u.data})),void 0,this.ownSymbol)];case 6:h.sent(),h.label=7;case 7:return[3,12];case 8:return c=t.condition,l=JSON.parse(c),f=void 0,0!==Object.keys(l).length?[3,10]:(f=this.mergeUserFields(s,t),[4,e.delete(this.MutationEvent,i)]);case 9:h.sent(),h.label=10;case 10:return f=f||t,[4,e.save(f,void 0,this.ownSymbol)];case 11:h.sent(),h.label=12;case 12:return[2]}}))}))})),[2]}))}))},e.prototype.dequeue=function(e,t,n){return Object(r.__awaiter)(this,void 0,void 0,(function(){var i;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return[4,this.peek(e)];case 1:return i=r.sent(),t?[4,this.syncOutboxVersionsOnDequeue(e,t,i,n)]:[3,3];case 2:r.sent(),r.label=3;case 3:return[4,e.delete(i)];case 4:return r.sent(),this.inProgressMutationEventId=void 0,[2,i]}}))}))},e.prototype.peek=function(e){return Object(r.__awaiter)(this,void 0,void 0,(function(){var t;return Object(r.__generator)(this,(function(n){switch(n.label){case 0:return[4,e.queryOne(this.MutationEvent,g.j.FIRST)];case 1:return t=n.sent(),this.inProgressMutationEventId=t?t.id:void 0,[2,t]}}))}))},e.prototype.getForModel=function(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){var n;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return n=this.schema.namespaces[I.d].models.MutationEvent,[4,e.query(this.MutationEvent,w.a.createFromExisting(n,(function(e){return e.modelId("eq",t.id)})))];case 1:return[2,r.sent()]}}))}))},e.prototype.getModelIds=function(e){return Object(r.__awaiter)(this,void 0,void 0,(function(){var t,n;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return[4,e.query(this.MutationEvent)];case 1:return t=r.sent(),n=new Set,t.forEach((function(e){var t=e.modelId;return n.add(t)})),[2,n]}}))}))},e.prototype.syncOutboxVersionsOnDequeue=function(e,t,n,i){return Object(r.__awaiter)(this,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h,p,v,g=this;return Object(r.__generator)(this,(function(y){switch(y.label){case 0:return n.operation!==i?[2]:(o=t._version,s=t._lastChangedAt,t._deleted,a=Object(r.__rest)(t,["_version","_lastChangedAt","_deleted"]),u=this.removeTimestampFields(n.model,a),(c=JSON.parse(n.data))?(c._version,c._lastChangedAt,c._deleted,l=Object(r.__rest)(c,["_version","_lastChangedAt","_deleted"]),f=this.removeTimestampFields(n.model,l),Object(I.E)(u,f,!0)?(d=this.schema.namespaces[I.d].models.MutationEvent,h=w.a.createFromExisting(d,(function(e){return e.modelId("eq",t.id).id("ne",g.inProgressMutationEventId)})),[4,e.query(this.MutationEvent,h)]):[2]):[2]);case 1:return(p=y.sent()).length?(v=p.map((function(e){var t=JSON.parse(e.data),n=Object(r.__assign)(Object(r.__assign)({},t),{_version:o,_lastChangedAt:s});return g.MutationEvent.copyOf(e,(function(e){e.data=JSON.stringify(n)}))})),[4,e.delete(this.MutationEvent,h)]):[2];case 2:return y.sent(),[4,Promise.all(v.map((function(t){return Object(r.__awaiter)(g,void 0,void 0,(function(){return Object(r.__generator)(this,(function(n){switch(n.label){case 0:return[4,e.save(t,void 0,this.ownSymbol)];case 1:return[2,n.sent()]}}))}))})))];case 3:return y.sent(),[2]}}))}))},e.prototype.mergeUserFields=function(e,t){var n=JSON.parse(e.data),i=n._version,o=n.id,s=n._lastChangedAt,a=n._deleted,u=Object(r.__rest)(n,["_version","id","_lastChangedAt","_deleted"]),c=JSON.parse(t.data),l=(c.id,c._version,c._lastChangedAt,c._deleted,Object(r.__rest)(c,["id","_version","_lastChangedAt","_deleted"])),f=JSON.stringify(Object(r.__assign)(Object(r.__assign)({id:o,_version:i,_lastChangedAt:s,_deleted:a},u),l));return this.modelInstanceCreator(this.MutationEvent,Object(r.__assign)(Object(r.__assign)({},t),{data:f}))},e.prototype.removeTimestampFields=function(e,t){var n,r,i="createdAt",o="updatedAt",s=null===(n=this.schema.namespaces[I.e].models[e].attributes)||void 0===n?void 0:n.find((function(e){return"model"===e.type})),a=null===(r=null==s?void 0:s.properties)||void 0===r?void 0:r.timestamps;return a&&(i=a.createdAt,o=a.updatedAt),delete t[i],delete t[o],t},e}(),fe=n(131),de=n(23),he=new o.a("DataStore"),pe=function(){function e(e,t,n,r,o,s,a,u,c,l,f){void 0===a&&(a={}),this.schema=e,this.storage=t,this.userClasses=n,this.outbox=r,this.modelInstanceCreator=o,this.MutationEvent=s,this.amplifyConfig=a,this.authModeStrategy=u,this.errorHandler=c,this.conflictHandler=l,this.amplifyContext=f,this.typeQuery=new WeakMap,this.processing=!1,this.amplifyContext.API=this.amplifyContext.API||i.a,this.generateQueries()}return e.prototype.generateQueries=function(){var e=this;Object.values(this.schema.namespaces).forEach((function(t){Object.values(t.models).filter((function(e){return e.syncable})).forEach((function(n){var i=Object(r.__read)(Object(ce.b)(t,n,"CREATE"),1)[0],o=Object(r.__read)(Object(ce.b)(t,n,"UPDATE"),1)[0],s=Object(r.__read)(Object(ce.b)(t,n,"DELETE"),1)[0];e.typeQuery.set(n,[i,o,s])}))}))},e.prototype.isReady=function(){return void 0!==this.observer},e.prototype.start=function(){var e=this;return new h.a((function(t){return e.observer=t,e.resume(),function(){e.pause()}}))},e.prototype.resume=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){var e,t,n,i,o,s=this;return Object(r.__generator)(this,(function(a){switch(a.label){case 0:if(this.processing||!this.isReady())return[2];this.processing=!0,t=I.e,n=function(){var n,o,a,u,c,l,f,d,h,p,v,g,y,m,b,_;return Object(r.__generator)(this,(function(w){switch(w.label){case 0:n=e.model,o=e.operation,a=e.data,u=e.condition,c=i.userClasses[n],l=void 0,f=void 0,d=void 0,w.label=1;case 1:return w.trys.push([1,4,,5]),[4,Object(ce.h)({authModeStrategy:i.authModeStrategy,defaultAuthMode:i.amplifyConfig.aws_appsync_authenticationType,modelName:n,schema:i.schema})];case 2:return h=w.sent(),p=h[o.toUpperCase()],v=0,[4,(g=function(){return Object(r.__awaiter)(s,void 0,void 0,(function(){var i,s;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,4]),he.debug("Attempting mutation with authMode: "+p[v]),[4,this.jitteredRetry(t,n,o,a,u,c,this.MutationEvent,e,p[v])];case 1:return i=r.sent(),he.debug("Mutation sent successfully with authMode: "+p[v]),[2,i];case 2:if(s=r.sent(),++v>=p.length)throw he.debug("Mutation failed with authMode: "+p[v-1]),s;return he.debug("Mutation failed with authMode: "+p[v-1]+". Retrying with authMode: "+p[v]),[4,g()];case 3:return[2,r.sent()];case 4:return[2]}}))}))})()];case 3:return _=r.__read.apply(void 0,[w.sent(),3]),l=_[0],f=_[1],d=_[2],[3,5];case 4:return"Offline"===(y=w.sent()).message||"RetryMutation"===y.message?[2,"continue"]:[3,5];case 5:return void 0!==l?[3,7]:(he.debug("done retrying"),[4,i.storage.runExclusive((function(e){return Object(r.__awaiter)(s,void 0,void 0,(function(){return Object(r.__generator)(this,(function(t){switch(t.label){case 0:return[4,this.outbox.dequeue(e)];case 1:return t.sent(),[2]}}))}))}))]);case 6:return w.sent(),[2,"continue"];case 7:return m=l.data[f],b=!1,[4,i.storage.runExclusive((function(e){return Object(r.__awaiter)(s,void 0,void 0,(function(){return Object(r.__generator)(this,(function(t){switch(t.label){case 0:return[4,this.outbox.dequeue(e,m,o)];case 1:return t.sent(),[4,this.outbox.peek(e)];case 2:return b=void 0!==t.sent(),[2]}}))}))}))];case 8:return w.sent(),i.observer.next({operation:o,modelDefinition:d,model:m,hasMore:b}),[2]}}))},i=this,a.label=1;case 1:return(o=this.processing)?[4,this.outbox.peek(this.storage)]:[3,3];case 2:o=void 0!==(e=a.sent()),a.label=3;case 3:return o?[5,n()]:[3,5];case 4:return a.sent(),[3,1];case 5:return this.pause(),[2]}}))}))},e.prototype.jitteredRetry=function(e,t,n,i,o,s,a,u,c){return Object(r.__awaiter)(this,void 0,void 0,(function(){var l=this;return Object(r.__generator)(this,(function(f){switch(f.label){case 0:return[4,Object(fe.d)((function(t,n,i,o,s,a,u){return Object(r.__awaiter)(l,void 0,void 0,(function(){var l,f,d,h,p,v,y,m,b,_,w,S,O,E,A,T,C,j,P,x,N,k,M,R,D,U,F;return Object(r.__generator)(this,(function(L){switch(L.label){case 0:return l=Object(r.__read)(this.createQueryVariables(e,t,n,i,o),5),f=l[0],d=l[1],h=l[2],p=l[3],v=l[4],[4,Object(ce.i)(c,this.amplifyConfig)];case 1:y=L.sent(),m={query:f,variables:d,authMode:c,authToken:y,userAgentSuffix:I.f},b=0,_=this.opTypeFromTransformerOperation(n),L.label=2;case 2:return L.trys.push([2,4,,20]),[4,this.amplifyContext.API.graphql(m)];case 3:return[2,[L.sent(),p,v]];case 4:if(!((w=L.sent()).errors&&w.errors.length>0))return[3,18];if(S=Object(r.__read)(w.errors,1),O=S[0],E=O.originalError,A=(void 0===E?{}:E).code,T=void 0===A?null:A,"Unauthorized"===O.errorType)throw new fe.a("Unauthorized");if("Network Error"===O.message||"ECONNABORTED"===T){if(!this.processing)throw new fe.a("Offline");throw new Error("Network Error")}return"ConflictUnhandled"!==O.errorType?[3,13]:(b++,C=void 0,b>10?(C=g.b,[3,8]):[3,5]);case 5:return L.trys.push([5,7,,8]),[4,this.conflictHandler({modelConstructor:s,localModel:this.modelInstanceCreator(s,d.input),remoteModel:this.modelInstanceCreator(s,O.data),operation:_,attempts:b})];case 6:return C=L.sent(),[3,8];case 7:return j=L.sent(),he.warn("conflict trycatch",j),[3,20];case 8:return C!==g.b?[3,11]:(P=Object(r.__read)(Object(ce.b)(this.schema.namespaces[e],v,"GET"),1),x=Object(r.__read)(P[0],3),N=x[1],k=x[2],[4,Object(ce.i)(c,this.amplifyConfig)]);case 9:return M=L.sent(),[4,this.amplifyContext.API.graphql({query:k,variables:{id:d.input.id},authMode:c,authToken:M,userAgentSuffix:I.f})];case 10:return[2,[L.sent(),N,v]];case 11:return R=this.schema.namespaces[e],D=Object(ce.d)(R.relationships,v,_,s,C,h,a,this.modelInstanceCreator,u.id),[4,this.storage.save(D)];case 12:throw L.sent(),new fe.a("RetryMutation");case 13:return L.trys.push([13,15,16,17]),[4,this.errorHandler({recoverySuggestion:"Ensure app code is up to date, auth directives exist and are correct on each model, and that server-side data has not been invalidated by a schema change. If the problem persists, search for or create an issue: https://github.com/aws-amplify/amplify-js/issues",localModel:d.input,message:O.message,operation:n,errorType:Object(de.a)(O),errorInfo:O.errorInfo,process:g.i.mutate,cause:O,remoteModel:O.data?this.modelInstanceCreator(s,O.data):null})];case 14:return L.sent(),[3,17];case 15:return U=L.sent(),he.warn("Mutation error handler failed with:",U),[3,17];case 16:return[2,O.data?[{data:(F={},F[p]=O.data,F)},p,v]:[]];case 17:return[3,19];case 18:throw new fe.a(w);case 19:return[3,20];case 20:if(m)return[3,2];L.label=21;case 21:return[2]}}))}))}),[t,n,i,o,s,a,u],ge)];case 1:return[2,f.sent()]}}))}))},e.prototype.createQueryVariables=function(e,t,n,i,o){var s,a,u=this.schema.namespaces[e].models[t],c=this.schema.namespaces[e].keys[t].primaryKey,l=this.typeQuery.get(u),f=Object(r.__read)(l.find((function(e){return Object(r.__read)(e,1)[0]===n})),3),d=f[1],h=f[2],p=JSON.parse(i),v=p._version,y=Object(r.__rest)(p,["_version"]),m={};if(c&&c.length)try{for(var b=Object(r.__values)(c),_=b.next();!_.done;_=b.next()){var w=_.value;m[w]=y[w]}}catch(e){s={error:e}}finally{try{_&&!_.done&&(a=b.return)&&a.call(b)}finally{if(s)throw s.error}}else m.id=y.id;var S=n===ce.a.DELETE?m:Object.values(u.fields).filter((function(e){var t=e.name,r=e.type,i=e.association;return Object(g.s)(r)?!(!Object(g.x)(i)||"BELONGS_TO"!==i.connectionType):n!==ce.a.UPDATE||y.hasOwnProperty(t)})).map((function(e){var t=e.name,n=e.type,r=e.association,i=t,o=y[t];return Object(g.s)(n)&&Object(g.x)(r)&&(i=r.targetName,o=y[i]),[i,o]})).reduce((function(e,t){var n=Object(r.__read)(t,2),i=n[0],o=n[1];return e[i]=o,e}),{}),O=Object(r.__assign)(Object(r.__assign)({},S),{_version:v}),E=JSON.parse(o);return[h,Object(r.__assign)({input:O},n===ce.a.CREATE?{}:{condition:Object.keys(E).length>0?E:null}),E,d,u]},e.prototype.opTypeFromTransformerOperation=function(e){switch(e){case ce.a.CREATE:return g.h.INSERT;case ce.a.DELETE:return g.h.DELETE;case ce.a.UPDATE:return g.h.UPDATE;case ce.a.GET:break;default:Object(I.h)(e)}},e.prototype.pause=function(){this.processing=!1},e}(),ve=Object(fe.b)(3e5),ge=function(e,t,n){var r=ve(e);return!1===r&&"Network Error"===(null==n?void 0:n.message)?3e5:r},ye=n(38),me={items:[],nextToken:null,startedAt:null},be=new o.a("DataStore"),_e=function(){function e(e,t,n,r,o,s){void 0===n&&(n={}),this.schema=e,this.syncPredicates=t,this.amplifyConfig=n,this.authModeStrategy=r,this.errorHandler=o,this.amplifyContext=s,this.typeQuery=new WeakMap,s.API=s.API||i.a,this.generateQueries()}return e.prototype.generateQueries=function(){var e=this;Object.values(this.schema.namespaces).forEach((function(t){Object.values(t.models).filter((function(e){return e.syncable})).forEach((function(n){var i=Object(r.__read)(Object(ce.b)(t,n,"LIST"),1),o=Object(r.__read)(i[0]).slice(1);e.typeQuery.set(n,o)}))}))},e.prototype.graphqlFilterFromPredicate=function(e){if(!this.syncPredicates)return null;var t=w.a.getPredicates(this.syncPredicates.get(e),!1);return t?Object(ce.l)(t):null},e.prototype.retrievePage=function(e,t,n,i,o){return void 0===i&&(i=null),Object(r.__awaiter)(this,void 0,void 0,(function(){var s,a,u,c,l,f,d,h,p,v,g,y,m,b=this;return Object(r.__generator)(this,(function(_){switch(_.label){case 0:return s=Object(r.__read)(this.typeQuery.get(e),2),a=s[0],u=s[1],c={limit:i,nextToken:n,lastSync:t,filter:o},[4,Object(ce.h)({authModeStrategy:this.authModeStrategy,defaultAuthMode:this.amplifyConfig.aws_appsync_authenticationType,modelName:e.name,schema:this.schema})];case 1:return l=_.sent(),f=l.READ,d=0,[4,(h=function(){return Object(r.__awaiter)(b,void 0,void 0,(function(){var t,n,i,o;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,4]),be.debug("Attempting sync with authMode: "+f[d]),[4,this.jitteredRetry({query:u,variables:c,opName:a,modelDefinition:e,authMode:f[d]})];case 1:return t=r.sent(),be.debug("Sync successful with authMode: "+f[d]),[2,t];case 2:if(n=r.sent(),++d>=f.length){if(i=f[d-1],be.debug("Sync failed with authMode: "+i,n),Object(ce.f)(n)||Object(ce.g)(n))return be.warn("User is unauthorized to query "+a+" with auth mode "+i+". No data could be returned."),[2,{data:(o={},o[a]=me,o)}];throw n}return be.debug("Sync failed with authMode: "+f[d-1]+". Retrying with authMode: "+f[d]),[4,h()];case 3:return[2,r.sent()];case 4:return[2]}}))}))})()];case 2:return p=_.sent().data,v=p[a],g=v.items,y=v.nextToken,m=v.startedAt,[2,{nextToken:y,startedAt:m,items:g}]}}))}))},e.prototype.partialDataFeatureFlagEnabled=function(){try{var e=sessionStorage.getItem("datastorePartialData");return Boolean(e)}catch(e){return!1}},e.prototype.jitteredRetry=function(e){var t=e.query,n=e.variables,i=e.opName,o=e.modelDefinition,s=e.authMode;return Object(r.__awaiter)(this,void 0,void 0,(function(){var e=this;return Object(r.__generator)(this,(function(u){switch(u.label){case 0:return[4,Object(fe.c)((function(t,n){return Object(r.__awaiter)(e,void 0,void 0,(function(){var e,u,c,l,f,d=this;return Object(r.__generator)(this,(function(h){switch(h.label){case 0:return h.trys.push([0,3,,8]),[4,Object(ce.i)(s,this.amplifyConfig)];case 1:return e=h.sent(),[4,this.amplifyContext.API.graphql({query:t,variables:n,authMode:s,authToken:e,userAgentSuffix:I.f})];case 2:return[2,h.sent()];case 3:if(u=h.sent(),c=Object(ce.f)(u)||Object(ce.g)(u))throw new fe.a(c);return l=Boolean(u&&u.data&&u.data[i]&&u.data[i].items),this.partialDataFeatureFlagEnabled()?l?((f=u).data[i].items=f.data[i].items.filter((function(e){return null!==e})),u.errors?[4,Promise.all(u.errors.map((function(e){return Object(r.__awaiter)(d,void 0,void 0,(function(){var t;return Object(r.__generator)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.errorHandler({recoverySuggestion:"Ensure app code is up to date, auth directives exist and are correct on each model, and that server-side data has not been invalidated by a schema change. If the problem persists, search for or create an issue: https://github.com/aws-amplify/amplify-js/issues",localModel:null,message:e.message,model:o.name,operation:i,errorType:Object(de.c)(e),process:g.i.sync,remoteModel:null,cause:e})];case 1:return n.sent(),[3,3];case 2:return t=n.sent(),be.error("Sync error handler failed with:",t),[3,3];case 3:return[2]}}))}))})))]:[3,5]):[3,6]:[3,7];case 4:h.sent(),a.a.dispatch("datastore",{event:"syncQueriesPartialSyncError",data:{errors:u.errors,modelName:o.name}}),h.label=5;case 5:return[2,f];case 6:throw u;case 7:if(u&&u.errors&&u.errors.some((function(e){return"Unauthorized"===e.errorType})))return f=u,l?f.data[i].items=f.data[i].items.filter((function(e){return null!==e})):f.data[i]=Object(r.__assign)(Object(r.__assign)({},me),f.data[i]),be.warn("queryError","User is unauthorized to query "+i+", some items could not be returned."),[2,f];throw u;case 8:return[2]}}))}))}),[t,n])];case 1:return[2,u.sent()]}}))}))},e.prototype.start=function(e){var t=this,n=!0,i=this.amplifyConfig,o=i.maxRecordsToSync,s=i.syncPageSize,a=new Map;return new h.a((function(i){var u=Object.values(t.schema.namespaces).reduce((function(t,n){var i,o;try{for(var s=Object(r.__values)(Array.from(n.modelTopologicalOrdering.keys())),a=s.next();!a.done;a=s.next()){var u=a.value,c=e.get(n.models[u]);t.set(n.models[u],c)}}catch(e){i={error:e}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}return t}),new Map),c=Array.from(u.entries()).filter((function(e){return Object(r.__read)(e,1)[0].syncable})).map((function(e){var u=Object(r.__read)(e,2),c=u[0],l=Object(r.__read)(u[1],2),f=l[0],d=l[1];return Object(r.__awaiter)(t,void 0,void 0,(function(){var e,t,u,l,h,p,v,g,y,m=this;return Object(r.__generator)(this,(function(b){switch(b.label){case 0:return e=!1,t=null,u=null,l=null,h=0,p=this.graphqlFilterFromPredicate(c),v=this.schema.namespaces[f].modelTopologicalOrdering.get(c.name),g=v.map((function(e){return a.get(f+"_"+e)})),y=new Promise((function(a){return Object(r.__awaiter)(m,void 0,void 0,(function(){var v,y;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return[4,Promise.all(g)];case 1:r.sent(),r.label=2;case 2:return n?(v=Math.min(o-h,s),[4,this.retrievePage(c,d,t,v,p)]):[2];case 3:y=r.sent(),l=y.items,t=y.nextToken,u=y.startedAt,h+=l.length,e=null===t||h>=o,i.next({namespace:f,modelDefinition:c,items:l,done:e,startedAt:u,isFullSync:!d}),r.label=4;case 4:if(!e)return[3,2];r.label=5;case 5:return a(),[2]}}))}))})),a.set(f+"_"+c.name,y),[4,y];case 1:return b.sent(),[2]}}))}))}));return Promise.all(c).then((function(){i.complete()})),function(){n=!1}}))},e}(),we=Object(s.b)().isNode,Se=new o.a("DataStore"),Oe=Symbol("sync");!function(e){e.SYNC_ENGINE_STORAGE_SUBSCRIBED="storageSubscribed",e.SYNC_ENGINE_SUBSCRIPTIONS_ESTABLISHED="subscriptionsEstablished",e.SYNC_ENGINE_SYNC_QUERIES_STARTED="syncQueriesStarted",e.SYNC_ENGINE_SYNC_QUERIES_READY="syncQueriesReady",e.SYNC_ENGINE_MODEL_SYNCED="modelSynced",e.SYNC_ENGINE_OUTBOX_MUTATION_ENQUEUED="outboxMutationEnqueued",e.SYNC_ENGINE_OUTBOX_MUTATION_PROCESSED="outboxMutationProcessed",e.SYNC_ENGINE_OUTBOX_STATUS="outboxStatus",e.SYNC_ENGINE_NETWORK_STATUS="networkStatus",e.SYNC_ENGINE_READY="ready"}(Z||(Z={}));var Ee=function(){function e(e,t,n,r,i,o,s,a,u,c,l,f){void 0===c&&(c={}),this.schema=e,this.namespaceResolver=t,this.modelClasses=n,this.userModelClasses=r,this.storage=i,this.modelInstanceCreator=o,this.syncPredicates=u,this.amplifyConfig=c,this.authModeStrategy=l,this.amplifyContext=f,this.online=!1,this.modelSyncedStatus=new WeakMap;var d=this.modelClasses.MutationEvent;this.outbox=new le(this.schema,d,o,Oe),this.modelMerger=new ue(this.outbox,Oe),this.syncQueriesProcessor=new _e(this.schema,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,a,this.amplifyContext),this.subscriptionsProcessor=new ye.b(this.schema,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,a,this.amplifyContext),this.mutationsProcessor=new pe(this.schema,this.storage,this.userModelClasses,this.outbox,this.modelInstanceCreator,d,this.amplifyConfig,this.authModeStrategy,a,s,this.amplifyContext),this.datastoreConnectivity=new ae}return e.prototype.getModelSyncedStatus=function(e){return this.modelSyncedStatus.get(e)},e.prototype.start=function(e){var t=this;return new h.a((function(n){Se.log("starting sync engine...");var i=[];return Object(r.__awaiter)(t,void 0,void 0,(function(){var t,o,s,a=this;return Object(r.__generator)(this,(function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),[4,this.setupModels(e)];case 1:return u.sent(),[3,3];case 2:return t=u.sent(),n.error(t),[2];case 3:return o=new Promise((function(e){a.datastoreConnectivity.status().subscribe((function(t){var o=t.online;return Object(r.__awaiter)(a,void 0,void 0,(function(){var t,s,a,u,c,l=this;return Object(r.__generator)(this,(function(f){switch(f.label){case 0:return!o||this.online?[3,10]:(this.online=o,n.next({type:Z.SYNC_ENGINE_NETWORK_STATUS,data:{active:this.online}}),s=void 0,we?(Se.warn("Realtime disabled when in a server-side environment"),[3,6]):[3,1]);case 1:c=Object(r.__read)(this.subscriptionsProcessor.start(),2),t=c[0],s=c[1],f.label=2;case 2:return f.trys.push([2,4,,5]),[4,new Promise((function(e,n){var r=t.subscribe({next:function(t){t===ye.a.CONNECTED&&e()},error:function(e){n(e),l.disconnectionHandler()(e)}});i.push(r)}))];case 3:return f.sent(),[3,5];case 4:return a=f.sent(),n.error(a),[2];case 5:Se.log("Realtime ready"),n.next({type:Z.SYNC_ENGINE_SUBSCRIPTIONS_ESTABLISHED}),f.label=6;case 6:return f.trys.push([6,8,,9]),[4,new Promise((function(e,t){var r=l.syncQueriesObservable().subscribe({next:function(t){t.type===Z.SYNC_ENGINE_SYNC_QUERIES_READY&&e(),n.next(t)},complete:function(){e()},error:function(e){t(e)}});r&&i.push(r)}))];case 7:return f.sent(),[3,9];case 8:return u=f.sent(),n.error(u),[2];case 9:return i.push(this.mutationsProcessor.start().subscribe((function(e){var t=e.modelDefinition,r=e.model,i=e.hasMore,o=l.userModelClasses[t.name],s=l.modelInstanceCreator(o,r);l.storage.runExclusive((function(e){return l.modelMerger.merge(e,s)})),n.next({type:Z.SYNC_ENGINE_OUTBOX_MUTATION_PROCESSED,data:{model:o,element:s}}),n.next({type:Z.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:!i}})}))),we||i.push(s.subscribe((function(e){var t=Object(r.__read)(e,3),n=(t[0],t[1]),i=t[2],o=l.userModelClasses[n.name],s=l.modelInstanceCreator(o,i);l.storage.runExclusive((function(e){return l.modelMerger.merge(e,s)}))}))),[3,11];case 10:o||(this.online=o,n.next({type:Z.SYNC_ENGINE_NETWORK_STATUS,data:{active:this.online}}),i.forEach((function(e){return e.unsubscribe()})),i=[]),f.label=11;case 11:return e(),[2]}}))}))}))})),this.storage.observe(null,null,Oe).filter((function(e){var t=e.model;return!0===a.getModelDefinition(t).syncable})).subscribe({next:function(e){var t=e.opType,i=e.model,s=e.element,u=e.condition;return Object(r.__awaiter)(a,void 0,void 0,(function(){var e,a,c,l;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return e=this.schema.namespaces[this.namespaceResolver(i)],a=this.modelClasses.MutationEvent,c=Object(ce.k)(u),l=Object(ce.d)(e.relationships,this.getModelDefinition(i),t,i,s,c,a,this.modelInstanceCreator),[4,this.outbox.enqueue(this.storage,l)];case 1:return r.sent(),n.next({type:Z.SYNC_ENGINE_OUTBOX_MUTATION_ENQUEUED,data:{model:i,element:s}}),n.next({type:Z.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:!1}}),[4,o];case 2:return r.sent(),this.online&&this.mutationsProcessor.resume(),[2]}}))}))}}),n.next({type:Z.SYNC_ENGINE_STORAGE_SUBSCRIBED}),[4,this.outbox.peek(this.storage)];case 4:return s=void 0===u.sent(),n.next({type:Z.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:s}}),[4,o];case 5:return u.sent(),n.next({type:Z.SYNC_ENGINE_READY}),[2]}}))})),function(){i.forEach((function(e){return e.unsubscribe()}))}}))},e.prototype.getModelsMetadataWithNextFullSync=function(e){return Object(r.__awaiter)(this,void 0,void 0,(function(){var t,n=this;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return t=Map.bind,[4,this.getModelsMetadata()];case 1:return[2,new(t.apply(Map,[void 0,r.sent().map((function(t){var r=t.namespace,i=t.model,o=t.lastSync,s=t.lastFullSync,a=t.fullSyncInterval,u=(t.lastSyncPredicate,!s||s+a<e?0:o);return[n.schema.namespaces[r].models[i],[r,u]]}))]))]}}))}))},e.prototype.syncQueriesObservable=function(){var e=this;return this.online?new h.a((function(t){var n,i;return Object(r.__awaiter)(e,void 0,void 0,(function(){var e,o,s=this;return Object(r.__generator)(this,(function(a){switch(a.label){case 0:e=function(){var e,a,u,c,l,f,d,h,p;return Object(r.__generator)(this,(function(v){switch(v.label){case 0:return e=new WeakMap,[4,o.getModelsMetadataWithNextFullSync(Date.now())];case 1:return a=v.sent(),u=new Set(a.keys()),[4,new Promise((function(i){n=s.syncQueriesProcessor.start(a).subscribe({next:function(o){var a=o.namespace,p=o.modelDefinition,v=o.items,y=o.done,m=o.startedAt,b=o.isFullSync;return Object(r.__awaiter)(s,void 0,void 0,(function(){var o,s,_,w,S,O,E=this;return Object(r.__generator)(this,(function(A){switch(A.label){case 0:return o=this.userModelClasses[p.name],e.has(o)||(e.set(o,{new:0,updated:0,deleted:0}),f=Object(I.k)(),h=void 0===h?m:Math.max(h,m)),[4,this.storage.runExclusive((function(t){return Object(r.__awaiter)(E,void 0,void 0,(function(){var n,i,s,a,u,c,l,f,d,h,p,y,m,b,_;return Object(r.__generator)(this,(function(w){switch(w.label){case 0:return[4,this.outbox.getModelIds(t)];case 1:n=w.sent(),i=[],s=v.filter((function(e){return!n.has(e.id)||(i.push(e),!1)})),a=[],w.label=2;case 2:w.trys.push([2,7,8,9]),u=Object(r.__values)(i),c=u.next(),w.label=3;case 3:return c.done?[3,6]:(l=c.value,[4,this.modelMerger.merge(t,l)]);case 4:void 0!==(f=w.sent())&&a.push([l,f]),w.label=5;case 5:return c=u.next(),[3,3];case 6:return[3,9];case 7:return d=w.sent(),b={error:d},[3,9];case 8:try{c&&!c.done&&(_=u.return)&&_.call(u)}finally{if(b)throw b.error}return[7];case 9:return p=(h=a.push).apply,y=[a],[4,this.modelMerger.mergePage(t,o,s)];case 10:return p.apply(h,y.concat([r.__spread.apply(void 0,[w.sent()])])),m=e.get(o),a.forEach((function(e){var t=Object(r.__read)(e,2)[1];switch(t){case g.h.INSERT:m.new++;break;case g.h.UPDATE:m.updated++;break;case g.h.DELETE:m.deleted++;break;default:Object(I.h)(t)}})),[2]}}))}))}))];case 1:return A.sent(),y?(s=p.name,[4,this.getModelMetadata(a,s)]):[3,4];case 2:return _=A.sent(),w=_.lastFullSync,S=_.fullSyncInterval,l=S,c=void 0===c?w:Math.max(c,b?m:w),_=this.modelClasses.ModelMetadata.copyOf(_,(function(e){e.lastSync=m,e.lastFullSync=b?m:_.lastFullSync})),[4,this.storage.save(_,void 0,Oe)];case 3:A.sent(),O=e.get(o),this.modelSyncedStatus.set(o,!0),t.next({type:Z.SYNC_ENGINE_MODEL_SYNCED,data:{model:o,isFullSync:b,isDeltaSync:!b,counts:O}}),u.delete(p),0===u.size&&(d=Object(I.k)()-f,i(),t.next({type:Z.SYNC_ENGINE_SYNC_QUERIES_READY}),n.unsubscribe()),A.label=4;case 4:return[2]}}))}))},error:function(e){t.error(e)}}),t.next({type:Z.SYNC_ENGINE_SYNC_QUERIES_STARTED,data:{models:Array.from(u).map((function(e){return e.name}))}})}))];case 2:return v.sent(),p=c+l-(h+d),Se.debug("Next fullSync in "+p/1e3+" seconds. ("+new Date(Date.now()+p)+")"),[4,new Promise((function(e){i=setTimeout(e,p)}))];case 3:return v.sent(),[2]}}))},o=this,a.label=1;case 1:return t.closed?[3,3]:[5,e()];case 2:return a.sent(),[3,1];case 3:return[2]}}))})),function(){n&&n.unsubscribe(),i&&clearTimeout(i)}})):h.a.of()},e.prototype.disconnectionHandler=function(){var e=this;return function(t){oe.CONTROL_MSG.CONNECTION_CLOSED!==t&&oe.CONTROL_MSG.TIMEOUT_DISCONNECT!==t||e.datastoreConnectivity.socketDisconnected()}},e.prototype.unsubscribeConnectivity=function(){this.datastoreConnectivity.unsubscribe()},e.prototype.setupModels=function(e){return Object(r.__awaiter)(this,void 0,void 0,(function(){var t,n,i,o,s,a,u,c,l,f,d,h,p,v=this;return Object(r.__generator)(this,(function(g){switch(g.label){case 0:t=e.fullSyncInterval,n=this.modelClasses.ModelMetadata,i=[],Object.values(this.schema.namespaces).forEach((function(e){Object.values(e.models).filter((function(e){return e.syncable})).forEach((function(t){if(i.push([e.name,t]),e.name===I.e){var n=v.userModelClasses[t.name];v.modelSyncedStatus.set(n,!1)}}))})),s=i.map((function(e){var i=Object(r.__read)(e,2),s=i[0],a=i[1];return Object(r.__awaiter)(v,void 0,void 0,(function(){var e,i,u,c,l,f,d,h,p;return Object(r.__generator)(this,(function(v){switch(v.label){case 0:return[4,this.getModelMetadata(s,a.name)];case 1:return e=v.sent(),i=w.a.getPredicates(this.syncPredicates.get(a),!1),u=i?JSON.stringify(i):null,void 0!==e?[3,3]:[4,this.storage.save(this.modelInstanceCreator(n,{model:a.name,namespace:s,lastSync:null,fullSyncInterval:t,lastFullSync:null,lastSyncPredicate:u}),void 0,Oe)];case 2:return f=r.__read.apply(void 0,[v.sent(),1]),d=Object(r.__read)(f[0],1),o=d[0],[3,5];case 3:return c=e.lastSyncPredicate?e.lastSyncPredicate:null,l=c!==u,[4,this.storage.save(this.modelClasses.ModelMetadata.copyOf(e,(function(e){e.fullSyncInterval=t,l&&(e.lastSync=null,e.lastFullSync=null,e.lastSyncPredicate=u)})))];case 4:h=r.__read.apply(void 0,[v.sent(),1]),p=Object(r.__read)(h[0],1),o=p[0],v.label=5;case 5:return[2,o]}}))}))})),a={},g.label=1;case 1:return g.trys.push([1,6,7,8]),[4,Promise.all(s)];case 2:u=r.__values.apply(void 0,[g.sent()]),c=u.next(),g.label=3;case 3:if(c.done)return[3,5];l=c.value,f=l.model,a[f]=l,g.label=4;case 4:return c=u.next(),[3,3];case 5:return[3,8];case 6:return d=g.sent(),h={error:d},[3,8];case 7:try{c&&!c.done&&(p=u.return)&&p.call(u)}finally{if(h)throw h.error}return[7];case 8:return[2,a]}}))}))},e.prototype.getModelsMetadata=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){var e;return Object(r.__generator)(this,(function(t){switch(t.label){case 0:return e=this.modelClasses.ModelMetadata,[4,this.storage.query(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.getModelMetadata=function(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){var n,i,o;return Object(r.__generator)(this,(function(s){switch(s.label){case 0:return n=this.modelClasses.ModelMetadata,i=w.a.createFromExisting(this.schema.namespaces[I.d].models[n.name],(function(n){return n.namespace("eq",e).model("eq",t)})),[4,this.storage.query(n,i,{page:0,limit:1})];case 1:return o=r.__read.apply(void 0,[s.sent(),1]),[2,o[0]]}}))}))},e.prototype.getModelDefinition=function(e){var t=this.namespaceResolver(e);return this.schema.namespaces[t].models[e.name]},e.getNamespace=function(){return{name:I.d,relationships:{},enums:{OperationType:{name:"OperationType",values:["CREATE","UPDATE","DELETE"]}},nonModels:{},models:{MutationEvent:{name:"MutationEvent",pluralName:"MutationEvents",syncable:!1,fields:{id:{name:"id",type:"ID",isRequired:!0,isArray:!1},model:{name:"model",type:"String",isRequired:!0,isArray:!1},data:{name:"data",type:"String",isRequired:!0,isArray:!1},modelId:{name:"modelId",type:"String",isRequired:!0,isArray:!1},operation:{name:"operation",type:{enum:"Operationtype"},isArray:!1,isRequired:!0},condition:{name:"condition",type:"String",isArray:!1,isRequired:!0}}},ModelMetadata:{name:"ModelMetadata",pluralName:"ModelsMetadata",syncable:!1,fields:{id:{name:"id",type:"ID",isRequired:!0,isArray:!1},namespace:{name:"namespace",type:"String",isRequired:!0,isArray:!1},model:{name:"model",type:"String",isRequired:!0,isArray:!1},lastSync:{name:"lastSync",type:"Int",isRequired:!1,isArray:!1},lastFullSync:{name:"lastFullSync",type:"Int",isRequired:!1,isArray:!1},fullSyncInterval:{name:"fullSyncInterval",type:"Int",isRequired:!0,isArray:!1},lastSyncPredicate:{name:"lastSyncPredicate",type:"String",isRequired:!1,isArray:!1}}}}}},e}();function Ae(e){return(Ae="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object(f.e)(!0),Object(f.b)();var Ie,Te,Ce,je,Pe,xe=new o.a("DataStore"),Ne=Object(I.z)(Date.now()),ke=s.a.browserOrNode().isNode,Me=new WeakMap,Re=new WeakMap,De=function(e){var t=Me.get(e);return Ie.namespaces[t].models[e.name]},Ue=function(e){return Object(I.u)(e)&&Me.has(e)},Fe=function(e){return Me.get(e)},Le=function(e){var t;if(void 0!==Ie)return console.warn("The schema has already been initialized"),Ce;xe.log("validating schema",{schema:e});var n=Object(r.__assign)({name:I.e},e);xe.log("DataStore","Init models"),Ce=qe(n),xe.log("DataStore","Models initialized");var i={name:I.a,relationships:{},enums:{},nonModels:{},models:{Setting:{name:"Setting",pluralName:"Settings",syncable:!1,fields:{id:{name:"id",type:"ID",isRequired:!0,isArray:!1},key:{name:"key",type:"String",isRequired:!0,isArray:!1},value:{name:"value",type:"String",isRequired:!0,isArray:!1}}}}},o=ie.getNamespace(),s=Ee.getNamespace();return je=qe(i),Pe=qe(o),Te=qe(s),Ie={namespaces:(t={},t[i.name]=i,t[n.name]=n,t[o.name]=o,t[s.name]=s,t),version:e.version},Object.keys(Ie.namespaces).forEach((function(e){var t,n,i=Object(r.__read)(Object(I.g)(Ie.namespaces[e]),2),o=i[0],s=i[1];Ie.namespaces[e].relationships=o,Ie.namespaces[e].keys=s;var a=new Map;Object.values(Ie.namespaces[e].models).forEach((function(e){var t=[];Object.values(e.fields).filter((function(t){return t.association&&"BELONGS_TO"===t.association.connectionType&&t.type.model!==e.name})).forEach((function(e){return t.push(e.type.model)})),a.set(e.name,t)}));for(var u=new Map,c=1e3;c>0&&0!==a.size;){if(0===--c)throw new Error("Models are not topologically sortable. Please verify your schema.");try{for(var l=(t=void 0,Object(r.__values)(Array.from(a.keys()))),f=l.next();!f.done;f=l.next()){var d=f.value,h=a.get(d);h.every((function(e){return u.has(e)}))&&u.set(d,h)}}catch(e){t={error:e}}finally{try{f&&!f.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}Array.from(u.keys()).forEach((function(e){return a.delete(e)}))}Ie.namespaces[e].modelTopologicalOrdering=u})),Ce},Be=function(){if(void 0===Ie){var e="Schema is not initialized. DataStore will not function as expected. This could happen if you have multiple versions of DataStore installed. Please see https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js/#check-for-duplicate-versions";throw xe.error(e),new Error(e)}},qe=function(e){var t={};return Object.entries(e.models).forEach((function(n){var i=Object(r.__read)(n,2),o=i[0],s=i[1],a=Ye(s);t[o]=a,Me.set(a,e.name)})),Object.entries(e.nonModels||{}).forEach((function(e){var n=Object(r.__read)(e,2),i=n[0],o=n[1],s=Qe(o);t[i]=s})),t},ze=new WeakSet;function Ve(e,t){return ze.add(t),new e(t)}var Ke,Ge=function(e){return function(t,n){var r=e.fields[t];if(void 0!==r){var i=r.type,o=r.isRequired,s=r.isArrayNullable,a=r.name,u=r.isArray;if((!u&&o||u&&!s)&&null==n)throw new Error("Field "+a+" is required");if(Object(g.n)(i)){var c=g.c.getJSType(i),l=g.c.getValidationFunction(i);if("AWSJSON"===i){if(Ae(n)===c)return;if("string"==typeof n)try{return void JSON.parse(n)}catch(e){throw new Error("Field "+a+" is an invalid JSON object. "+n)}}if(u){var f=c;if(o||(f=c+" | null | undefined"),!Array.isArray(n)&&!s)throw new Error("Field "+a+" should be of type ["+f+"], "+Ae(n)+" received. "+n);if(!Object(I.w)(n)&&n.some((function(e){return Object(I.w)(e)?o:Ae(e)!==c}))){var d=n.map((function(e){return null===e?"null":Ae(e)})).join(",");throw new Error("All elements in the "+a+" array should be of type "+f+", ["+d+"] received. "+n)}if(l&&!Object(I.w)(n))if(!n.map((function(e){return Object(I.w)(e)?!(!Object(I.w)(e)||o):l(e)})).every((function(e){return e})))throw new Error("All elements in the "+a+" array should be of type "+i+", validation failed for one or more elements. "+n)}else{if(!o&&void 0===n)return;if(Ae(n)!==c&&null!==n)throw new Error("Field "+a+" should be of type "+c+", "+Ae(n)+" received. "+n);if(!Object(I.w)(n)&&l&&!l(n))throw new Error("Field "+a+" should be of type "+i+", validation failed. "+n)}}}}},He=function(e,t,n){var r=e.fields[t]||{},i=r.isArray,o=r.type;if("string"==typeof n&&(i||"AWSJSON"===o||Object(g.t)(o)||Object(g.s)(o)))try{return JSON.parse(n)}catch(e){}return"number"==typeof n&&"Boolean"===o?Boolean(n):n},We=function(e,t,n){var i=Ge(t);Object.entries(e).forEach((function(e){var o=Object(r.__read)(e,2),s=o[0],a=o[1],u=He(t,s,a);i(s,u),n[s]=u}))},Ye=function(e){var t=function(){function n(t){return Object(f.d)(this,(function(n){We(t,e,n);var r=ze.has(t)?t:{},i=r.id,o=r._version,s=r._lastChangedAt,a=r._deleted,u=null!=i,c=u?i:e.syncable?Object(d.v4)():Ne();u||Je(n,e),n.id=c,e.syncable&&(n._version=o,n._lastChangedAt=s,n._deleted=a)}))}return n.copyOf=function(t,n){var i,o=Object.getPrototypeOf(t||{}).constructor;if(!Ue(o)){var s="The source object is not a valid model";throw xe.error(s,{source:t}),new Error(s)}var a=Object(f.d)(t,(function(i){n(i),i.id=t.id;var o=Ge(e);Object.entries(i).forEach((function(t){var n=Object(r.__read)(t,2),i=n[0],s=n[1],a=He(e,i,s);o(i,a)}))}),(function(e){return i=e})),u=Re.has(t);if(i.length||u)if(u){var c=Object(r.__read)(Re.get(t),2),l=c[0],d=c[1],h=Object(I.y)(d,l,i);Re.set(a,[h,d]),$e(h,e)}else Re.set(a,[i,t]),$e(i,e);return a},n.fromJSON=function(n){var i=this;if(Array.isArray(n))return n.map((function(e){return i.fromJSON(e)}));var o=Ve(t,n),s=Ge(e);return Object.entries(o).forEach((function(e){var t=Object(r.__read)(e,2),n=t[0],i=t[1];s(n,i)})),o},n}();return t[f.c]=!0,Object.defineProperty(t,"name",{value:e.name}),t},Je=function(e,t){var n=Object.keys(e),r=t.fields;n.forEach((function(e){if(r[e]&&r[e].isReadOnly)throw new Error(e+" is read-only.")}))},$e=function(e,t){var n=e.map((function(e){return[e.path[0],e.value]})),i=t.fields;n.forEach((function(e){var t=Object(r.__read)(e,2),n=t[0];if(t[1]&&i[n]&&i[n].isReadOnly)throw new Error(n+" is read-only.")}))},Qe=function(e){var t=function(t){return Object(f.d)(this,(function(n){We(t,e,n)}))};return t[f.c]=!0,Object.defineProperty(t,"name",{value:e.name}),Object(I.A)(t),t};function Ze(e){return"string"==typeof e}function Xe(e){var t=e.localModel,n=e.modelConstructor,i=e.remoteModel._version;return Ve(n,Object(r.__assign)(Object(r.__assign)({},t),{_version:i}))}function et(e){xe.warn(e)}function tt(e,t){var n;switch(e){case I.a:n=je[t];break;case I.e:n=Ce[t];break;case I.d:n=Te[t];break;case I.c:n=Pe[t];break;default:Object(I.h)(e)}if(Ue(n))return n;var r="Model name is not valid for namespace. modelName: "+t+", namespace: "+e;throw xe.error(r),new Error(r)}function nt(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){var n,i,o=this;return Object(r.__generator)(this,(function(s){switch(s.label){case 0:return n=je.Setting,i=Ie.namespaces[I.a].models.Setting,[4,e.runExclusive((function(e){return Object(r.__awaiter)(o,void 0,void 0,(function(){var o,s;return Object(r.__generator)(this,(function(a){switch(a.label){case 0:return[4,e.query(n,w.a.createFromExisting(i,(function(e){return e.key("eq","schemaVersion")})),{page:0,limit:1})];case 1:return o=r.__read.apply(void 0,[a.sent(),1]),void 0===(s=o[0])||void 0===s.value?[3,4]:JSON.parse(s.value)===t?[3,3]:[4,e.clear(!1)];case 2:a.sent(),a.label=3;case 3:return[3,6];case 4:return[4,e.save(Ve(n,{key:"schemaVersion",value:JSON.stringify(t)}))];case 5:a.sent(),a.label=6;case 6:return[2]}}))}))}))];case 1:return s.sent(),[2]}}))}))}var rt=function(){function e(){var e=this;this.Auth=c.a,this.API=i.a,this.Cache=l.a,this.amplifyConfig={},this.syncPredicates=new WeakMap,this.amplifyContext={Auth:this.Auth,API:this.API,Cache:this.Cache},this.start=function(){return Object(r.__awaiter)(e,void 0,void 0,(function(){var e,t,n,i=this;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return void 0!==this.initialized?[3,1]:(xe.debug("Starting DataStore"),this.initialized=new Promise((function(e,t){i.initResolve=e,i.initReject=t})),[3,3]);case 1:return[4,this.initialized];case 2:return r.sent(),[2];case 3:return this.storage=new ie(Ie,Fe,tt,Ve,this.storageAdapter,this.sessionId),[4,this.storage.init()];case 4:return r.sent(),Be(),[4,nt(this.storage,Ie.version)];case 5:return r.sent(),(e=this.amplifyConfig.aws_appsync_graphqlEndpoint)?(xe.debug("GraphQL endpoint available",e),t=this,[4,this.processSyncExpressions()]):[3,7];case 6:return t.syncPredicates=r.sent(),this.sync=new Ee(Ie,Fe,Te,Ce,this.storage,Ve,this.conflictHandler,this.errorHandler,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,this.amplifyContext),n=1e3*this.fullSyncInterval*60,Ke=this.sync.start({fullSyncInterval:n}).subscribe({next:function(e){var t=e.type,n=e.data;t===(ke?Z.SYNC_ENGINE_SYNC_QUERIES_READY:Z.SYNC_ENGINE_STORAGE_SUBSCRIBED)&&i.initResolve(),a.a.dispatch("datastore",{event:t,data:n})},error:function(e){xe.warn("Sync error",e),i.initReject()}}),[3,8];case 7:xe.warn("Data won't be synchronized. No GraphQL endpoint configured. Did you forget `Amplify.configure(awsconfig)`?",{config:this.amplifyConfig}),this.initResolve(),r.label=8;case 8:return[4,this.initialized];case 9:return r.sent(),[2]}}))}))},this.query=function(t,n,i){return Object(r.__awaiter)(e,void 0,void 0,(function(){var e,o,s,a,u;return Object(r.__generator)(this,(function(c){switch(c.label){case 0:return[4,this.start()];case 1:if(c.sent(),!Ue(t))throw e="Constructor is not for a valid model",xe.error(e,{modelConstructor:t}),new Error(e);return"string"==typeof n&&void 0!==i&&xe.warn("Pagination is ignored when querying by id"),o=De(t),s=Ze(n)?w.a.createForId(o,n):Object(w.c)(n)?void 0:w.a.createFromExisting(o,n),a=this.processPagination(o,i),xe.debug("params ready",{modelConstructor:t,predicate:w.a.getPredicates(s,!1),pagination:Object(r.__assign)(Object(r.__assign)({},a),{sort:S.a.getPredicates(a&&a.sort,!1)})}),[4,this.storage.query(t,s,a)];case 2:return u=c.sent(),[2,Ze(n)?u[0]:u]}}))}))},this.save=function(t,n){return Object(r.__awaiter)(e,void 0,void 0,(function(){var e,i,o,s,a,u,c=this;return Object(r.__generator)(this,(function(l){switch(l.label){case 0:return[4,this.start()];case 1:if(l.sent(),e=Re.get(t),i=t?t.constructor:void 0,!Ue(i))throw o="Object is not an instance of a valid model",xe.error(o,{model:t}),new Error(o);return s=De(i),a=w.a.createFromExisting(s,n),[4,this.storage.runExclusive((function(n){return Object(r.__awaiter)(c,void 0,void 0,(function(){return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return[4,n.save(t,a,void 0,e)];case 1:return r.sent(),[2,n.query(i,w.a.createForId(s,t.id))]}}))}))}))];case 2:return u=r.__read.apply(void 0,[l.sent(),1]),[2,u[0]]}}))}))},this.setConflictHandler=function(t){var n=t.DataStore;return n&&n.conflictHandler?n.conflictHandler:e.conflictHandler===Xe&&t.conflictHandler?t.conflictHandler:e.conflictHandler||Xe},this.setErrorHandler=function(t){var n=t.DataStore;return n&&n.errorHandler?n.errorHandler:e.errorHandler===et&&t.errorHandler?t.errorHandler:e.errorHandler||et},this.delete=function(t,n){return Object(r.__awaiter)(e,void 0,void 0,(function(){var e,i,o,s,a,u,c,l,f;return Object(r.__generator)(this,(function(d){switch(d.label){case 0:return[4,this.start()];case 1:if(d.sent(),!t)throw c="Model or Model Constructor required",xe.error(c,{modelOrConstructor:t}),new Error(c);if(!Ue(t))return[3,3];if(s=t,!n)throw c="Id to delete or criteria required. Do you want to delete all? Pass Predicates.ALL",xe.error(c,{idOrCriteria:n}),new Error(c);if("string"==typeof n)e=w.a.createForId(De(s),n);else if(!(e=w.a.createFromExisting(De(s),n))||!w.a.isValidPredicate(e))throw c="Criteria required. Do you want to delete all? Pass Predicates.ALL",xe.error(c,{condition:e}),new Error(c);return[4,this.storage.delete(s,e)];case 2:return i=r.__read.apply(void 0,[d.sent(),1]),[2,i[0]];case 3:if(o=t,s=Object.getPrototypeOf(o||{}).constructor,!Ue(s))throw c="Object is not an instance of a valid model",xe.error(c,{model:o}),new Error(c);if(a=De(s),u=w.a.createForId(a,o.id),n){if("function"!=typeof n)throw c="Invalid criteria",xe.error(c,{idOrCriteria:n}),new Error(c);e=n(u)}else e=u;return[4,this.storage.delete(o,e)];case 4:return l=r.__read.apply(void 0,[d.sent(),1]),f=Object(r.__read)(l[0],1),[2,f[0]]}}))}))},this.observe=function(t,n){var i,o=t&&Ue(t)?t:void 0;if(t&&void 0===o){var s=t,a=s&&Object.getPrototypeOf(s).constructor;if(Ue(a))return n&&xe.warn("idOrCriteria is ignored when using a model instance",{model:s,idOrCriteria:n}),e.observe(a,s.id);var u="The model is not an instance of a PersistentModelConstructor";throw xe.error(u,{model:s}),new Error(u)}if(void 0!==n&&void 0===o){u="Cannot provide criteria without a modelConstructor";throw xe.error(u,n),new Error(u)}if(o&&!Ue(o)){u="Constructor is not for a valid model";throw xe.error(u,{modelConstructor:o}),new Error(u)}return i="string"==typeof n?w.a.createForId(De(o),n):o&&w.a.createFromExisting(De(o),n),new h.a((function(t){var n;return Object(r.__awaiter)(e,void 0,void 0,(function(){var e=this;return Object(r.__generator)(this,(function(s){switch(s.label){case 0:return[4,this.start()];case 1:return s.sent(),n=this.storage.observe(o,i).filter((function(e){var t=e.model;return Fe(t)===I.e})).subscribe({next:function(n){return Object(r.__awaiter)(e,void 0,void 0,(function(){var e,i;return Object(r.__generator)(this,(function(o){switch(o.label){case 0:return e=n,"DELETE"===n.opType?[3,2]:[4,this.query(n.model,n.element.id)];case 1:i=o.sent(),e=Object(r.__assign)(Object(r.__assign)({},e),{element:i}),o.label=2;case 2:return t.next(e),[2]}}))}))},error:function(e){return t.error(e)},complete:function(){return t.complete()}}),[2]}}))})),function(){n&&n.unsubscribe()}}))},this.observeQuery=function(t,n,i){return new h.a((function(o){var s,u,c=new Map,l=new Map,f=[],d=function(){var e=O();E(e)},h=new I.b({callback:d,errorHandler:o.error,maxInterval:2e3}),p=(i||{}).sort,v=p?{sort:p}:void 0,g=De(t);u=Ze(n)?w.a.createForId(g,n):Object(w.c)(n)?void 0:w.a.createFromExisting(g,n);var y=w.a.getPredicates(u,!1)||{},m=y.predicates,b=y.type,_=!!m;Object(r.__awaiter)(e,void 0,void 0,(function(){var e,i=this;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.query(t,n,v)];case 1:return r.sent().forEach((function(e){return c.set(e.id,e)})),s=this.observe(t).subscribe((function(e){var t,n,r=e.element,o=e.model,s=e.opType;if(_&&!Object(I.D)(r,b,m)){if("UPDATE"!==s||!c.has(r.id)&&!l.has(r.id))return;f.push(r.id)}"DELETE"===s?f.push(r.id):l.set(r.id,r);var a=null!==(n=null===(t=i.sync)||void 0===t?void 0:t.getModelSyncedStatus(o))&&void 0!==n&&n;(l.size-f.length>=i.syncPageSize||a)&&h.resolve(),h.start()})),d(),[3,3];case 2:return e=r.sent(),o.error(e),[3,3];case 3:return[2]}}))}));var O=function(){var n,o,s=null!==(o=null===(n=e.sync)||void 0===n?void 0:n.getModelSyncedStatus(t))&&void 0!==o&&o,a=Object(r.__spread)(Array.from(c.values()),Array.from(l.values()));return(null==i?void 0:i.sort)&&A(a),c.clear(),a.forEach((function(e){return c.set(e.id,e)})),f.forEach((function(e){return c.delete(e)})),{items:Array.from(c.values()),isSynced:s}},E=function(e){o.next(e),l.clear(),f=[]},A=function(n){var r=De(t),o=e.processPagination(r,i),s=S.a.getPredicates(o.sort);if(s.length){var a=Object(I.B)(s);n.sort(a)}};return a.a.listen("datastore",(function e(n){var r,i=n.payload,o=i.event,s=i.data;o===Z.SYNC_ENGINE_MODEL_SYNCED&&(null===(r=null==s?void 0:s.model)||void 0===r?void 0:r.name)===t.name&&(d(),a.a.remove("api",e))})),function(){s&&s.unsubscribe()}}))},this.configure=function(t){void 0===t&&(t={}),e.amplifyContext.Auth=e.Auth,e.amplifyContext.API=e.API,e.amplifyContext.Cache=e.Cache;var n=t.DataStore,i=t.authModeStrategyType,o=(t.conflictHandler,t.errorHandler,t.maxRecordsToSync),s=t.syncPageSize,a=t.fullSyncInterval,u=t.syncExpressions,c=t.authProviders,l=t.storageAdapter,f=Object(r.__rest)(t,["DataStore","authModeStrategyType","conflictHandler","errorHandler","maxRecordsToSync","syncPageSize","fullSyncInterval","syncExpressions","authProviders","storageAdapter"]);switch(e.amplifyConfig=Object(r.__assign)(Object(r.__assign)({},f),e.amplifyConfig),e.conflictHandler=e.setConflictHandler(t),e.errorHandler=e.setErrorHandler(t),n&&n.authModeStrategyType||i||g.a.DEFAULT){case g.a.MULTI_AUTH:e.authModeStrategy=b(e.amplifyContext);break;case g.a.DEFAULT:default:e.authModeStrategy=_}e.amplifyConfig.authProviders=n&&n.authProviders||c,e.syncExpressions=n&&n.syncExpressions||u||e.syncExpressions,e.maxRecordsToSync=n&&n.maxRecordsToSync||o||e.maxRecordsToSync||1e4,e.amplifyConfig.maxRecordsToSync=e.maxRecordsToSync,e.syncPageSize=n&&n.syncPageSize||s||e.syncPageSize||1e3,e.amplifyConfig.syncPageSize=e.syncPageSize,e.fullSyncInterval=n&&n.fullSyncInterval||a||e.fullSyncInterval||1440,e.storageAdapter=n&&n.storageAdapter||l||e.storageAdapter||void 0,e.sessionId=e.retrieveSessionId()},this.clear=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(e){switch(e.label){case 0:return Be(),void 0!==this.storage?[3,2]:(this.storage=new ie(Ie,Fe,tt,Ve,this.storageAdapter,this.sessionId),[4,this.storage.init()]);case 1:e.sent(),e.label=2;case 2:return Ke&&!Ke.closed&&Ke.unsubscribe(),[4,this.storage.clear()];case 3:return e.sent(),this.sync&&this.sync.unsubscribeConnectivity(),this.initialized=void 0,this.storage=void 0,this.sync=void 0,this.syncPredicates=new WeakMap,[2]}}))}))},this.stop=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(e){switch(e.label){case 0:return void 0===this.initialized?[3,2]:[4,this.start()];case 1:e.sent(),e.label=2;case 2:return Ke&&!Ke.closed&&Ke.unsubscribe(),this.sync&&this.sync.unsubscribeConnectivity(),this.initialized=void 0,this.sync=void 0,[2]}}))}))}}return e.prototype.getModuleName=function(){return"DataStore"},e.prototype.processPagination=function(e,t){var n,r=t||{},i=r.limit,o=r.page,s=r.sort;if(void 0!==i||void 0!==o||void 0!==s){if(void 0!==o&&void 0===i)throw new Error("Limit is required when requesting a page");if(void 0!==o){if("number"!=typeof o)throw new Error("Page should be a number");if(o<0)throw new Error("Page can't be negative")}if(void 0!==i){if("number"!=typeof i)throw new Error("Limit should be a number");if(i<0)throw new Error("Limit can't be negative")}return s&&(n=S.a.createFromExisting(e,t.sort)),{limit:i,page:o,sort:n}}},e.prototype.processSyncExpressions=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){var e,t=this;return Object(r.__generator)(this,(function(n){switch(n.label){case 0:return this.syncExpressions&&this.syncExpressions.length?[4,Promise.all(this.syncExpressions.map((function(e){return Object(r.__awaiter)(t,void 0,void 0,(function(){var t,n,i,o,s,a;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return[4,e];case 1:return t=r.sent(),n=t.modelConstructor,i=t.conditionProducer,o=De(n),[4,this.unwrapPromise(i)];case 2:return s=r.sent(),Object(w.c)(s)?[2,[o,null]]:(a=this.createFromCondition(o,s),[2,[o,a]])}}))}))})))]:[2,new WeakMap];case 1:return e=n.sent(),[2,this.weakMapFromEntries(e)]}}))}))},e.prototype.createFromCondition=function(e,t){try{return w.a.createFromExisting(e,t)}catch(e){throw xe.error("Error creating Sync Predicate"),e}},e.prototype.unwrapPromise=function(e){return Object(r.__awaiter)(this,void 0,void 0,(function(){var t;return Object(r.__generator)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,e()];case 1:return[2,n.sent()];case 2:if((t=n.sent())instanceof TypeError)return[2,e];throw t;case 3:return[2]}}))}))},e.prototype.weakMapFromEntries=function(e){return e.reduce((function(e,t){var n=Object(r.__read)(t,2),i=n[0],o=n[1];if(e.has(i)){var s=i.name;return xe.warn("You can only utilize one Sync Expression per model.\n Subsequent sync expressions for the "+s+" model will be ignored."),e}return o&&e.set(i,o),e}),new WeakMap)},e.prototype.retrieveSessionId=function(){try{var e=sessionStorage.getItem("datastoreSessionId");if(e){var t=this.amplifyConfig.aws_appsync_graphqlEndpoint.split("/")[2];return e+"-"+Object(r.__read)(t.split("."),1)[0]}}catch(e){return}},e}(),it=new rt;u.a.register(it);var ot={USER:I.e,traverseModel:I.C,validatePredicate:I.D,isNonModelConstructor:I.v,isModelConstructor:I.u}},function(e,t,n){"use strict";n.r(t),n.d(t,"fromUtf8",(function(){return r})),n.d(t,"toUtf8",(function(){return i}));var r=function(e){return"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e.charCodeAt(n);if(i<128)t.push(i);else if(i<2048)t.push(i>>6|192,63&i|128);else if(n+1<e.length&&55296==(64512&i)&&56320==(64512&e.charCodeAt(n+1))){var o=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n));t.push(o>>18|240,o>>12&63|128,o>>6&63|128,63&o|128)}else t.push(i>>12|224,i>>6&63|128,63&i|128)}return Uint8Array.from(t)}(e)},i=function(e){return"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):function(e){for(var t="",n=0,r=e.length;n<r;n++){var i=e[n];if(i<128)t+=String.fromCharCode(i);else if(192<=i&&i<224){var o=e[++n];t+=String.fromCharCode((31&i)<<6|63&o)}else if(240<=i&&i<365){var s="%"+[i,e[++n],e[++n],e[++n]].map((function(e){return e.toString(16)})).join("%");t+=decodeURIComponent(s)}else t+=String.fromCharCode((15&i)<<12|(63&e[++n])<<6|63&e[++n])}return t}(e)}},,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"d",(function(){return s})),n.d(t,"b",(function(){return a})),n.d(t,"c",(function(){return u}));var r=n(0),i=new(n(21).a)("Util"),o=function(e){function t(t){var n=e.call(this,t)||this;return n.nonRetryable=!0,n}return Object(r.__extends)(t,e),t}(Error);function s(e,t,n,o){return void 0===o&&(o=1),Object(r.__awaiter)(this,void 0,void 0,(function(){var a,u;return Object(r.__generator)(this,(function(c){switch(c.label){case 0:if("function"!=typeof e)throw Error("functionToRetry must be a function");i.debug(e.name+" attempt #"+o+" with this vars: "+JSON.stringify(t)),c.label=1;case 1:return c.trys.push([1,3,,8]),[4,e.apply(void 0,Object(r.__spread)(t))];case 2:return[2,c.sent()];case 3:if(a=c.sent(),i.debug("error on "+e.name,a),(l=a)&&l.nonRetryable)throw i.debug(e.name+" non retryable error",a),a;return u=n(o,t,a),i.debug(e.name+" retrying in "+u+" ms"),!1===u?[3,6]:[4,new Promise((function(e){return setTimeout(e,u)}))];case 4:return c.sent(),[4,s(e,t,n,o+1)];case 5:return[2,c.sent()];case 6:throw a;case 7:return[3,8];case 8:return[2]}var l}))}))}function a(e){void 0===e&&(e=3e5);return function(t){var n=100*Math.pow(2,t)+100*Math.random();return!(n>e)&&n}}var u=function(e,t,n){return void 0===n&&(n=3e5),s(e,t,a(n))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return Gi}));var r=n(0),i=n(21),o=n(60),s=n(16),a=n(131),u=new i.a("CognitoCredentials"),c=new Promise((function(e,t){return Object(s.b)().isBrowser?(window.gapi&&window.gapi.auth2?window.gapi.auth2:null)?(u.debug("google api already loaded"),e()):void setTimeout((function(){return e()}),2e3):(u.debug("not in the browser, directly resolved"),e())})),l=function(){function e(){this.initialized=!1,this.refreshGoogleToken=this.refreshGoogleToken.bind(this),this._refreshGoogleTokenImpl=this._refreshGoogleTokenImpl.bind(this)}return e.prototype.refreshGoogleToken=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(e){switch(e.label){case 0:return this.initialized?[3,2]:(u.debug("need to wait for the Google SDK loaded"),[4,c]);case 1:e.sent(),this.initialized=!0,u.debug("finish waiting"),e.label=2;case 2:return[2,this._refreshGoogleTokenImpl()]}}))}))},e.prototype._refreshGoogleTokenImpl=function(){var e=null;return Object(s.b)().isBrowser&&(e=window.gapi&&window.gapi.auth2?window.gapi.auth2:null),e?new Promise((function(t,n){e.getAuthInstance().then((function(e){e||(u.debug("google Auth undefined"),n(new a.a("google Auth undefined")));var r=e.currentUser.get();r.isSignedIn()?(u.debug("refreshing the google access token"),r.reloadAuthResponse().then((function(e){var n=e.id_token,r=e.expires_at;t({token:n,expires_at:r})})).catch((function(e){e&&"network_error"===e.error?n("Network error reloading google auth response"):n(new a.a("Failed to reload google auth response"))}))):n(new a.a("User is not signed in with Google"))})).catch((function(e){u.debug("Failed to refresh google token",e),n(new a.a("Failed to refresh google token"))}))})):(u.debug("no gapi auth2 available"),Promise.reject("no gapi auth2 available"))},e}(),f=new i.a("CognitoCredentials"),d=new Promise((function(e,t){return Object(s.b)().isBrowser?window.FB?(f.debug("FB SDK already loaded"),e()):void setTimeout((function(){return e()}),2e3):(f.debug("not in the browser, directly resolved"),e())})),h=function(){function e(){this.initialized=!1,this.refreshFacebookToken=this.refreshFacebookToken.bind(this),this._refreshFacebookTokenImpl=this._refreshFacebookTokenImpl.bind(this)}return e.prototype.refreshFacebookToken=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(e){switch(e.label){case 0:return this.initialized?[3,2]:(f.debug("need to wait for the Facebook SDK loaded"),[4,d]);case 1:e.sent(),this.initialized=!0,f.debug("finish waiting"),e.label=2;case 2:return[2,this._refreshFacebookTokenImpl()]}}))}))},e.prototype._refreshFacebookTokenImpl=function(){var e=null;if(Object(s.b)().isBrowser&&(e=window.FB),!e){return f.debug("no fb sdk available"),Promise.reject(new a.a("no fb sdk available"))}return new Promise((function(t,n){e.getLoginStatus((function(e){if(e&&e.authResponse){var r=e.authResponse,i=r.accessToken,o=1e3*r.expiresIn+(new Date).getTime();if(!i){s="the jwtToken is undefined";f.debug(s),n(new a.a(s))}t({token:i,expires_at:o})}else{var s="no response from facebook when refreshing the jwt token";f.debug(s),n(new a.a(s))}}),{scope:"public_profile,email"})}))},e}(),p=new l,v=new h,g=n(32),y=n(37),m=function(e,t){return(m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function b(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}m(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var _=function(){return(_=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function w(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function S(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}Object.create;function O(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}var E,A,I,T,C,j,P,x,N,k,M,R,D,U,F,L,B,q,z,V,K,G,H,W,Y,J,$,Q,Z,X,ee,te,ne,re,ie,oe,se,ae,ue,ce,le,fe,de,he,pe,ve,ge,ye,me,be,_e,we,Se,Oe,Ee,Ae,Ie;Object.create;!function(e){e.AUTHENTICATED_ROLE="AuthenticatedRole",e.DENY="Deny"}(E||(E={})),(A||(A={})).filterSensitiveLog=function(e){return _({},e)},(I||(I={})).filterSensitiveLog=function(e){return _({},e)},(T||(T={})).filterSensitiveLog=function(e){return _({},e)},(C||(C={})).filterSensitiveLog=function(e){return _({},e)},(j||(j={})).filterSensitiveLog=function(e){return _({},e)},(P||(P={})).filterSensitiveLog=function(e){return _({},e)},(x||(x={})).filterSensitiveLog=function(e){return _({},e)},(N||(N={})).filterSensitiveLog=function(e){return _({},e)},(k||(k={})).filterSensitiveLog=function(e){return _({},e)},(M||(M={})).filterSensitiveLog=function(e){return _({},e)},function(e){e.ACCESS_DENIED="AccessDenied",e.INTERNAL_SERVER_ERROR="InternalServerError"}(R||(R={})),(D||(D={})).filterSensitiveLog=function(e){return _({},e)},(U||(U={})).filterSensitiveLog=function(e){return _({},e)},(F||(F={})).filterSensitiveLog=function(e){return _({},e)},(L||(L={})).filterSensitiveLog=function(e){return _({},e)},(B||(B={})).filterSensitiveLog=function(e){return _({},e)},(q||(q={})).filterSensitiveLog=function(e){return _({},e)},(z||(z={})).filterSensitiveLog=function(e){return _({},e)},(V||(V={})).filterSensitiveLog=function(e){return _({},e)},(K||(K={})).filterSensitiveLog=function(e){return _({},e)},(G||(G={})).filterSensitiveLog=function(e){return _({},e)},(H||(H={})).filterSensitiveLog=function(e){return _({},e)},(W||(W={})).filterSensitiveLog=function(e){return _({},e)},(Y||(Y={})).filterSensitiveLog=function(e){return _({},e)},(J||(J={})).filterSensitiveLog=function(e){return _({},e)},($||($={})).filterSensitiveLog=function(e){return _({},e)},function(e){e.CONTAINS="Contains",e.EQUALS="Equals",e.NOT_EQUAL="NotEqual",e.STARTS_WITH="StartsWith"}(Q||(Q={})),(Z||(Z={})).filterSensitiveLog=function(e){return _({},e)},(X||(X={})).filterSensitiveLog=function(e){return _({},e)},function(e){e.RULES="Rules",e.TOKEN="Token"}(ee||(ee={})),(te||(te={})).filterSensitiveLog=function(e){return _({},e)},(ne||(ne={})).filterSensitiveLog=function(e){return _({},e)},(re||(re={})).filterSensitiveLog=function(e){return _({},e)},(ie||(ie={})).filterSensitiveLog=function(e){return _({},e)},(oe||(oe={})).filterSensitiveLog=function(e){return _({},e)},(se||(se={})).filterSensitiveLog=function(e){return _({},e)},(ae||(ae={})).filterSensitiveLog=function(e){return _({},e)},(ue||(ue={})).filterSensitiveLog=function(e){return _({},e)},(ce||(ce={})).filterSensitiveLog=function(e){return _({},e)},(le||(le={})).filterSensitiveLog=function(e){return _({},e)},(fe||(fe={})).filterSensitiveLog=function(e){return _({},e)},(de||(de={})).filterSensitiveLog=function(e){return _({},e)},(he||(he={})).filterSensitiveLog=function(e){return _({},e)},(pe||(pe={})).filterSensitiveLog=function(e){return _({},e)},(ve||(ve={})).filterSensitiveLog=function(e){return _({},e)},(ge||(ge={})).filterSensitiveLog=function(e){return _({},e)},(ye||(ye={})).filterSensitiveLog=function(e){return _({},e)},(me||(me={})).filterSensitiveLog=function(e){return _({},e)},(be||(be={})).filterSensitiveLog=function(e){return _({},e)},(_e||(_e={})).filterSensitiveLog=function(e){return _({},e)},(we||(we={})).filterSensitiveLog=function(e){return _({},e)},(Se||(Se={})).filterSensitiveLog=function(e){return _({},e)},(Oe||(Oe={})).filterSensitiveLog=function(e){return _({},e)},(Ee||(Ee={})).filterSensitiveLog=function(e){return _({},e)},(Ae||(Ae={})).filterSensitiveLog=function(e){return _({},e)},(Ie||(Ie={})).filterSensitiveLog=function(e){return _({},e)};var Te=function(){function e(e){this.statusCode=e.statusCode,this.headers=e.headers||{},this.body=e.body}return e.isInstance=function(e){if(!e)return!1;var t=e;return"number"==typeof t.statusCode&&"object"==typeof t.headers},e}(),Ce=function(){function e(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?":"!==e.protocol.substr(-1)?e.protocol+":":e.protocol:"https:",this.path=e.path?"/"!==e.path.charAt(0)?"/"+e.path:e.path:"/"}return e.isInstance=function(e){if(!e)return!1;var t=e;return"method"in t&&"protocol"in t&&"hostname"in t&&"path"in t&&"object"==typeof t.query&&"object"==typeof t.headers},e.prototype.clone=function(){var t,n=new e(Object(r.__assign)(Object(r.__assign)({},this),{headers:Object(r.__assign)({},this.headers)}));return n.query&&(n.query=(t=n.query,Object.keys(t).reduce((function(e,n){var i,o=t[n];return Object(r.__assign)(Object(r.__assign)({},e),((i={})[n]=Array.isArray(o)?Object(r.__spread)(o):o,i))}),{}))),n},e}();var je=function(e,t){return w(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,g;return S(this,(function(y){switch(y.label){case 0:return r=[_({},e)],g={},[4,it(e.body,t)];case 1:switch(n=_.apply(void 0,r.concat([(g.body=y.sent(),g)])),o="UnknownError",o=ot(e,n.body),o){case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":return[3,2];case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":return[3,4];case"InvalidIdentityPoolConfigurationException":case"com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException":return[3,6];case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":return[3,8];case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":return[3,10];case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":return[3,12];case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":return[3,14];case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":return[3,16]}return[3,18];case 2:return s=[{}],[4,xe(n,t)];case 3:return i=_.apply(void 0,[_.apply(void 0,s.concat([y.sent()])),{name:o,$metadata:tt(e)}]),[3,19];case 4:return a=[{}],[4,Ne(n,t)];case 5:return i=_.apply(void 0,[_.apply(void 0,a.concat([y.sent()])),{name:o,$metadata:tt(e)}]),[3,19];case 6:return u=[{}],[4,ke(n,t)];case 7:return i=_.apply(void 0,[_.apply(void 0,u.concat([y.sent()])),{name:o,$metadata:tt(e)}]),[3,19];case 8:return c=[{}],[4,Me(n,t)];case 9:return i=_.apply(void 0,[_.apply(void 0,c.concat([y.sent()])),{name:o,$metadata:tt(e)}]),[3,19];case 10:return l=[{}],[4,De(n,t)];case 11:return i=_.apply(void 0,[_.apply(void 0,l.concat([y.sent()])),{name:o,$metadata:tt(e)}]),[3,19];case 12:return f=[{}],[4,Ue(n,t)];case 13:return i=_.apply(void 0,[_.apply(void 0,f.concat([y.sent()])),{name:o,$metadata:tt(e)}]),[3,19];case 14:return d=[{}],[4,Fe(n,t)];case 15:return i=_.apply(void 0,[_.apply(void 0,d.concat([y.sent()])),{name:o,$metadata:tt(e)}]),[3,19];case 16:return h=[{}],[4,Le(n,t)];case 17:return i=_.apply(void 0,[_.apply(void 0,h.concat([y.sent()])),{name:o,$metadata:tt(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=_(_({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:tt(e)}),y.label=19;case 19:return v=i.message||i.Message||o,i.message=v,delete i.Message,[2,Promise.reject(Object.assign(new Error(v),i))]}}))}))},Pe=function(e,t){return w(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,g;return S(this,(function(y){switch(y.label){case 0:return r=[_({},e)],g={},[4,it(e.body,t)];case 1:switch(n=_.apply(void 0,r.concat([(g.body=y.sent(),g)])),o="UnknownError",o=ot(e,n.body),o){case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":return[3,2];case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":return[3,4];case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":return[3,6];case"LimitExceededException":case"com.amazonaws.cognitoidentity#LimitExceededException":return[3,8];case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":return[3,10];case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":return[3,12];case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":return[3,14];case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":return[3,16]}return[3,18];case 2:return s=[{}],[4,xe(n,t)];case 3:return i=_.apply(void 0,[_.apply(void 0,s.concat([y.sent()])),{name:o,$metadata:tt(e)}]),[3,19];case 4:return a=[{}],[4,Ne(n,t)];case 5:return i=_.apply(void 0,[_.apply(void 0,a.concat([y.sent()])),{name:o,$metadata:tt(e)}]),[3,19];case 6:return u=[{}],[4,Me(n,t)];case 7:return i=_.apply(void 0,[_.apply(void 0,u.concat([y.sent()])),{name:o,$metadata:tt(e)}]),[3,19];case 8:return c=[{}],[4,Re(n,t)];case 9:return i=_.apply(void 0,[_.apply(void 0,c.concat([y.sent()])),{name:o,$metadata:tt(e)}]),[3,19];case 10:return l=[{}],[4,De(n,t)];case 11:return i=_.apply(void 0,[_.apply(void 0,l.concat([y.sent()])),{name:o,$metadata:tt(e)}]),[3,19];case 12:return f=[{}],[4,Ue(n,t)];case 13:return i=_.apply(void 0,[_.apply(void 0,f.concat([y.sent()])),{name:o,$metadata:tt(e)}]),[3,19];case 14:return d=[{}],[4,Fe(n,t)];case 15:return i=_.apply(void 0,[_.apply(void 0,d.concat([y.sent()])),{name:o,$metadata:tt(e)}]),[3,19];case 16:return h=[{}],[4,Le(n,t)];case 17:return i=_.apply(void 0,[_.apply(void 0,h.concat([y.sent()])),{name:o,$metadata:tt(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=_(_({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:tt(e)}),y.label=19;case 19:return v=i.message||i.Message||o,i.message=v,delete i.Message,[2,Promise.reject(Object.assign(new Error(v),i))]}}))}))},xe=function(e,t){return w(void 0,void 0,void 0,(function(){var n,r;return S(this,(function(i){return n=e.body,r=Ke(n,t),[2,_({name:"ExternalServiceException",$fault:"client",$metadata:tt(e)},r)]}))}))},Ne=function(e,t){return w(void 0,void 0,void 0,(function(){var n,r;return S(this,(function(i){return n=e.body,r=We(n,t),[2,_({name:"InternalErrorException",$fault:"server",$metadata:tt(e)},r)]}))}))},ke=function(e,t){return w(void 0,void 0,void 0,(function(){var n,r;return S(this,(function(i){return n=e.body,r=Ye(n,t),[2,_({name:"InvalidIdentityPoolConfigurationException",$fault:"client",$metadata:tt(e)},r)]}))}))},Me=function(e,t){return w(void 0,void 0,void 0,(function(){var n,r;return S(this,(function(i){return n=e.body,r=Je(n,t),[2,_({name:"InvalidParameterException",$fault:"client",$metadata:tt(e)},r)]}))}))},Re=function(e,t){return w(void 0,void 0,void 0,(function(){var n,r;return S(this,(function(i){return n=e.body,r=$e(n,t),[2,_({name:"LimitExceededException",$fault:"client",$metadata:tt(e)},r)]}))}))},De=function(e,t){return w(void 0,void 0,void 0,(function(){var n,r;return S(this,(function(i){return n=e.body,r=Qe(n,t),[2,_({name:"NotAuthorizedException",$fault:"client",$metadata:tt(e)},r)]}))}))},Ue=function(e,t){return w(void 0,void 0,void 0,(function(){var n,r;return S(this,(function(i){return n=e.body,r=Ze(n,t),[2,_({name:"ResourceConflictException",$fault:"client",$metadata:tt(e)},r)]}))}))},Fe=function(e,t){return w(void 0,void 0,void 0,(function(){var n,r;return S(this,(function(i){return n=e.body,r=Xe(n,t),[2,_({name:"ResourceNotFoundException",$fault:"client",$metadata:tt(e)},r)]}))}))},Le=function(e,t){return w(void 0,void 0,void 0,(function(){var n,r;return S(this,(function(i){return n=e.body,r=et(n,t),[2,_({name:"TooManyRequestsException",$fault:"client",$metadata:tt(e)},r)]}))}))},Be=function(e,t){return _(_(_({},void 0!==e.CustomRoleArn&&null!==e.CustomRoleArn&&{CustomRoleArn:e.CustomRoleArn}),void 0!==e.IdentityId&&null!==e.IdentityId&&{IdentityId:e.IdentityId}),void 0!==e.Logins&&null!==e.Logins&&{Logins:ze(e.Logins,t)})},qe=function(e,t){return _(_(_({},void 0!==e.AccountId&&null!==e.AccountId&&{AccountId:e.AccountId}),void 0!==e.IdentityPoolId&&null!==e.IdentityPoolId&&{IdentityPoolId:e.IdentityPoolId}),void 0!==e.Logins&&null!==e.Logins&&{Logins:ze(e.Logins,t)})},ze=function(e,t){return Object.entries(e).reduce((function(e,t){var n,r=O(t,2),i=r[0],o=r[1];return null===o?e:_(_({},e),((n={})[i]=o,n))}),{})},Ve=function(e,t){return{AccessKeyId:void 0!==e.AccessKeyId&&null!==e.AccessKeyId?e.AccessKeyId:void 0,Expiration:void 0!==e.Expiration&&null!==e.Expiration?new Date(Math.round(1e3*e.Expiration)):void 0,SecretKey:void 0!==e.SecretKey&&null!==e.SecretKey?e.SecretKey:void 0,SessionToken:void 0!==e.SessionToken&&null!==e.SessionToken?e.SessionToken:void 0}},Ke=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ge=function(e,t){return{Credentials:void 0!==e.Credentials&&null!==e.Credentials?Ve(e.Credentials):void 0,IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},He=function(e,t){return{IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},We=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ye=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Je=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},$e=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Qe=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ze=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Xe=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},et=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},tt=function(e){var t;return{httpStatusCode:e.statusCode,requestId:null!==(t=e.headers["x-amzn-requestid"])&&void 0!==t?t:e.headers["x-amzn-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}},nt=function(e,t){return void 0===e&&(e=new Uint8Array),e instanceof Uint8Array?Promise.resolve(e):t.streamCollector(e)||Promise.resolve(new Uint8Array)},rt=function(e,t,n,r,i){return w(void 0,void 0,void 0,(function(){var o,s,a,u,c,l;return S(this,(function(f){switch(f.label){case 0:return[4,e.endpoint()];case 1:return o=f.sent(),s=o.hostname,a=o.protocol,u=void 0===a?"https":a,c=o.port,l={protocol:u,hostname:s,port:c,method:"POST",path:n,headers:t},void 0!==r&&(l.hostname=r),void 0!==i&&(l.body=i),[2,new Ce(l)]}}))}))},it=function(e,t){return function(e,t){return nt(e,t).then((function(e){return t.utf8Encoder(e)}))}(e,t).then((function(e){return e.length?JSON.parse(e):{}}))},ot=function(e,t){var n,r,i=function(e){var t=e;return t.indexOf(":")>=0&&(t=t.split(":")[0]),t.indexOf("#")>=0&&(t=t.split("#")[1]),t},o=(n=e.headers,r="x-amzn-errortype",Object.keys(n).find((function(e){return e.toLowerCase()===r.toLowerCase()})));return void 0!==o?i(e.headers[o]):void 0!==t.code?i(t.code):void 0!==t.__type?i(t.__type):""},st={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},at={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function ut(e,t,n){return{applyToStack:function(i){i.add(function(e,t){return function(n,i){return function(i){return Object(r.__awaiter)(void 0,void 0,void 0,(function(){var o,s;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return[4,n(i)];case 1:return o=r.sent().response,[4,t(o,e)];case 2:return s=r.sent(),[2,{response:o,output:s}]}}))}))}}}(e,n),st),i.add(function(e,t){return function(n,i){return function(i){return Object(r.__awaiter)(void 0,void 0,void 0,(function(){var o;return Object(r.__generator)(this,(function(s){switch(s.label){case 0:return[4,t(i.input,e)];case 1:return o=s.sent(),[2,n(Object(r.__assign)(Object(r.__assign)({},i),{request:o}))]}}))}))}}}(e,t),at)}}}var ct=function(){var e=[],t=[],n=new Set,i=function(n){return e.forEach((function(e){n.add(e.middleware,Object(r.__assign)({},e))})),t.forEach((function(e){n.addRelativeTo(e.middleware,Object(r.__assign)({},e))})),n},o=function(e){var t=[];return e.before.forEach((function(e){0===e.before.length&&0===e.after.length?t.push(e):t.push.apply(t,Object(r.__spread)(o(e)))})),t.push(e),e.after.reverse().forEach((function(e){0===e.before.length&&0===e.after.length?t.push(e):t.push.apply(t,Object(r.__spread)(o(e)))})),t},s=function(){var n,i=[],s=[],a={};return e.forEach((function(e){var t=Object(r.__assign)(Object(r.__assign)({},e),{before:[],after:[]});t.name&&(a[t.name]=t),i.push(t)})),t.forEach((function(e){var t=Object(r.__assign)(Object(r.__assign)({},e),{before:[],after:[]});t.name&&(a[t.name]=t),s.push(t)})),s.forEach((function(e){if(e.toMiddleware){var t=a[e.toMiddleware];if(void 0===t)throw new Error(e.toMiddleware+" is not found when adding "+(e.name||"anonymous")+" middleware "+e.relation+" "+e.toMiddleware);"after"===e.relation&&t.after.push(e),"before"===e.relation&&t.before.push(e)}})),(n=i,n.sort((function(e,t){return lt[t.step]-lt[e.step]||ft[t.priority||"normal"]-ft[e.priority||"normal"]}))).map(o).reduce((function(e,t){return e.push.apply(e,Object(r.__spread)(t)),e}),[]).map((function(e){return e.middleware}))},a={add:function(t,i){void 0===i&&(i={});var o=i.name,s=i.override,a=Object(r.__assign)({step:"initialize",priority:"normal",middleware:t},i);if(o){if(n.has(o)){if(!s)throw new Error("Duplicate middleware name '"+o+"'");var u=e.findIndex((function(e){return e.name===o})),c=e[u];if(c.step!==a.step||c.priority!==a.priority)throw new Error('"'+o+'" middleware with '+c.priority+" priority in "+c.step+" step cannot be overridden by same-name middleware with "+a.priority+" priority in "+a.step+" step.");e.splice(u,1)}n.add(o)}e.push(a)},addRelativeTo:function(e,i){var o=i.name,s=i.override,a=Object(r.__assign)({middleware:e},i);if(o){if(n.has(o)){if(!s)throw new Error("Duplicate middleware name '"+o+"'");var u=t.findIndex((function(e){return e.name===o})),c=t[u];if(c.toMiddleware!==a.toMiddleware||c.relation!==a.relation)throw new Error('"'+o+'" middleware '+c.relation+' "'+c.toMiddleware+'" middleware cannot be overridden by same-name middleware '+a.relation+' "'+a.toMiddleware+'" middleware.');t.splice(u,1)}n.add(o)}t.push(a)},clone:function(){return i(ct())},use:function(e){e.applyToStack(a)},remove:function(r){return"string"==typeof r?function(r){var i=!1,o=function(e){return!e.name||e.name!==r||(i=!0,n.delete(r),!1)};return e=e.filter(o),t=t.filter(o),i}(r):function(r){var i=!1,o=function(e){return e.middleware!==r||(i=!0,e.name&&n.delete(e.name),!1)};return e=e.filter(o),t=t.filter(o),i}(r)},removeByTag:function(r){var i=!1,o=function(e){var t=e.tags,o=e.name;return!t||!t.includes(r)||(o&&n.delete(o),i=!0,!1)};return e=e.filter(o),t=t.filter(o),i},concat:function(e){var t=i(ct());return t.use(e),t},applyToStack:i,resolve:function(e,t){var n,i;try{for(var o=Object(r.__values)(s().reverse()),a=o.next();!a.done;a=o.next()){e=(0,a.value)(e,t)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return e}};return a},lt={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},ft={high:3,normal:2,low:1},dt=function(){function e(e){this.middlewareStack=ct(),this.config=e}return e.prototype.send=function(e,t,n){var r="function"!=typeof t?t:void 0,i="function"==typeof t?t:n,o=e.resolveMiddleware(this.middlewareStack,this.config,r);if(!i)return o(e).then((function(e){return e.output}));o(e).then((function(e){return i(null,e.output)}),(function(e){return i(e)})).catch((function(){}))},e.prototype.destroy=function(){this.config.requestHandler.destroy&&this.config.requestHandler.destroy()},e}(),ht=function(){this.middlewareStack=ct()};var pt=function(){var e=Object.getPrototypeOf(this).constructor,t=Function.bind.apply(String,Object(r.__spread)([null],arguments)),n=new t;return Object.setPrototypeOf(n,e.prototype),n};pt.prototype=Object.create(String.prototype,{constructor:{value:pt,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf(pt,String);!function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Object(r.__extends)(t,e),t.prototype.deserializeJSON=function(){return JSON.parse(e.prototype.toString.call(this))},t.prototype.toJSON=function(){return e.prototype.toString.call(this)},t.fromObject=function(e){return e instanceof t?e:new t(e instanceof String||"string"==typeof e?e:JSON.stringify(e))}}(pt);var vt=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return b(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(ut(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetCredentialsForIdentityCommand",inputFilterSensitiveLog:K.filterSensitiveLog,outputFilterSensitiveLog:H.filterSensitiveLog},o=t.requestHandler;return r.resolve((function(e){return o.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return w(void 0,void 0,void 0,(function(){var n,r;return S(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetCredentialsForIdentity"},r=JSON.stringify(Be(e,t)),[2,rt(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return w(void 0,void 0,void 0,(function(){var n,r,i;return S(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,je(e,t)]:[4,it(e.body,t)];case 1:return n=o.sent(),{},r=Ge(n,t),i=_({$metadata:tt(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(ht),gt=function(e){function t(t,n){void 0===n&&(n=!0);var r=e.call(this,t)||this;return r.tryNextLink=n,r}return Object(r.__extends)(t,e),t}(Error);function yt(e){return Promise.all(Object.keys(e).reduce((function(t,n){var r=e[n];return"string"==typeof r?t.push([n,r]):t.push(r().then((function(e){return[n,e]}))),t}),[])).then((function(e){return e.reduce((function(e,t){var n=Object(r.__read)(t,2),i=n[0],o=n[1];return e[i]=o,e}),{})}))}function mt(e){var t=this;return function(){return Object(r.__awaiter)(t,void 0,void 0,(function(){var t,n,i,o,s,a,u,c,l,f,d,h,p;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return f=(l=e.client).send,d=vt.bind,p={CustomRoleArn:e.customRoleArn,IdentityId:e.identityId},e.logins?[4,yt(e.logins)]:[3,2];case 1:return h=r.sent(),[3,3];case 2:h=void 0,r.label=3;case 3:return[4,f.apply(l,[new(d.apply(vt,[void 0,(p.Logins=h,p)]))])];case 4:return t=r.sent().Credentials,n=void 0===t?function(){throw new gt("Response from Amazon Cognito contained no credentials")}():t,i=n.AccessKeyId,o=void 0===i?function(){throw new gt("Response from Amazon Cognito contained no access key ID")}():i,s=n.Expiration,a=n.SecretKey,u=void 0===a?function(){throw new gt("Response from Amazon Cognito contained no secret key")}():a,c=n.SessionToken,[2,{identityId:e.identityId,accessKeyId:o,secretAccessKey:u,sessionToken:c,expiration:s}]}}))}))}}var bt=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return b(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(ut(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetIdCommand",inputFilterSensitiveLog:Y.filterSensitiveLog,outputFilterSensitiveLog:J.filterSensitiveLog},o=t.requestHandler;return r.resolve((function(e){return o.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return w(void 0,void 0,void 0,(function(){var n,r;return S(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetId"},r=JSON.stringify(qe(e,t)),[2,rt(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return w(void 0,void 0,void 0,(function(){var n,r,i;return S(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,Pe(e,t)]:[4,it(e.body,t)];case 1:return n=o.sent(),{},r=He(n,t),i=_({$metadata:tt(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(ht),_t=function(){function e(e){void 0===e&&(e="aws:cognito-identity-ids"),this.dbName=e}return e.prototype.getItem=function(e){return this.withObjectStore("readonly",(function(t){var n=t.get(e);return new Promise((function(e){n.onerror=function(){return e(null)},n.onsuccess=function(){return e(n.result?n.result.value:null)}}))})).catch((function(){return null}))},e.prototype.removeItem=function(e){return this.withObjectStore("readwrite",(function(t){var n=t.delete(e);return new Promise((function(e,t){n.onerror=function(){return t(n.error)},n.onsuccess=function(){return e()}}))}))},e.prototype.setItem=function(e,t){return this.withObjectStore("readwrite",(function(n){var r=n.put({id:e,value:t});return new Promise((function(e,t){r.onerror=function(){return t(r.error)},r.onsuccess=function(){return e()}}))}))},e.prototype.getDb=function(){var e=self.indexedDB.open(this.dbName,1);return new Promise((function(t,n){e.onsuccess=function(){t(e.result)},e.onerror=function(){n(e.error)},e.onblocked=function(){n(new Error("Unable to access DB"))},e.onupgradeneeded=function(){var t=e.result;t.onerror=function(){n(new Error("Failed to create object store"))},t.createObjectStore("IdentityIds",{keyPath:"id"})}}))},e.prototype.withObjectStore=function(e,t){return this.getDb().then((function(n){var r=n.transaction("IdentityIds",e);return r.oncomplete=function(){return n.close()},new Promise((function(e,n){r.onerror=function(){return n(r.error)},e(t(r.objectStore("IdentityIds")))})).catch((function(e){throw n.close(),e}))}))},e}(),wt=new(function(){function e(e){void 0===e&&(e={}),this.store=e}return e.prototype.getItem=function(e){return e in this.store?this.store[e]:null},e.prototype.removeItem=function(e){delete this.store[e]},e.prototype.setItem=function(e,t){this.store[e]=t},e}());function St(e){var t=this,n=e.accountId,i=e.cache,o=void 0===i?"object"==typeof self&&self.indexedDB?new _t:"object"==typeof window&&window.localStorage?window.localStorage:wt:i,s=e.client,a=e.customRoleArn,u=e.identityPoolId,c=e.logins,l=e.userIdentifier,f=void 0===l?c&&0!==Object.keys(c).length?void 0:"ANONYMOUS":l,d=f?"aws:cognito-identity-credentials:"+u+":"+f:void 0,h=function(){return Object(r.__awaiter)(t,void 0,void 0,(function(){var e,t,i,l,f,p,v,g,y;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return(t=d)?[4,o.getItem(d)]:[3,2];case 1:t=r.sent(),r.label=2;case 2:return(e=t)?[3,7]:(p=(f=s).send,v=bt.bind,y={AccountId:n,IdentityPoolId:u},c?[4,yt(c)]:[3,4]);case 3:return g=r.sent(),[3,5];case 4:g=void 0,r.label=5;case 5:return[4,p.apply(f,[new(v.apply(bt,[void 0,(y.Logins=g,y)]))])];case 6:i=r.sent().IdentityId,l=void 0===i?function(){throw new gt("Response from Amazon Cognito contained no identity ID")}():i,e=l,d&&Promise.resolve(o.setItem(d,e)).catch((function(){})),r.label=7;case 7:return[2,(h=mt({client:s,customRoleArn:a,logins:c,identityId:e}))()]}}))}))};return function(){return h().catch((function(e){return Object(r.__awaiter)(t,void 0,void 0,(function(){return Object(r.__generator)(this,(function(t){throw d&&Promise.resolve(o.removeItem(d)).catch((function(){})),e}))}))}))}}var Ot=function(e,t){return(Ot=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function Et(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Ot(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var At=function(){return(At=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function It(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function Tt(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}Object.create;function Ct(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}Object.create;var jt=n(66),Pt=n(64),xt=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,Nt)},Nt=function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()};for(var kt=function(){function e(e){var t=(void 0===e?{}:e).requestTimeout;this.requestTimeout=t}return e.prototype.destroy=function(){},e.prototype.handle=function(e,t){var n=(void 0===t?{}:t).abortSignal,i=this.requestTimeout;if(null==n?void 0:n.aborted){var o=new Error("Request aborted");return o.name="AbortError",Promise.reject(o)}var s=e.path;if(e.query){var a=function(e){var t,n,i=[];try{for(var o=Object(r.__values)(Object.keys(e).sort()),s=o.next();!s.done;s=o.next()){var a=s.value,u=e[a];if(a=xt(a),Array.isArray(u))for(var c=0,l=u.length;c<l;c++)i.push(a+"="+xt(u[c]));else{var f=a;(u||"string"==typeof u)&&(f+="="+xt(u)),i.push(f)}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return i.join("&")}(e.query);a&&(s+="?"+a)}var u=e.port,c=e.method,l=e.protocol+"//"+e.hostname+(u?":"+u:"")+s,f={body:"GET"===c||"HEAD"===c?void 0:e.body,headers:new Headers(e.headers),method:c};"undefined"!=typeof AbortController&&(f.signal=n);var d,h=new Request(l,f),p=[fetch(h).then((function(e){var t,n,i=e.headers,o={};try{for(var s=Object(r.__values)(i.entries()),a=s.next();!a.done;a=s.next()){var u=a.value;o[u[0]]=u[1]}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return void 0!==e.body?{response:new Te({headers:o,statusCode:e.status,body:e.body})}:e.blob().then((function(t){return{response:new Te({headers:o,statusCode:e.status,body:t})}}))})),(d=i,void 0===d&&(d=0),new Promise((function(e,t){d&&setTimeout((function(){var e=new Error("Request did not complete within "+d+" ms");e.name="TimeoutError",t(e)}),d)})))];return n&&p.push(new Promise((function(e,t){n.onabort=function(){var e=new Error("Request aborted");e.name="AbortError",t(e)}}))),Promise.race(p)},e}(),Mt={},Rt=new Array(64),Dt=0,Ut="A".charCodeAt(0),Ft="Z".charCodeAt(0);Dt+Ut<=Ft;Dt++){var Lt=String.fromCharCode(Dt+Ut);Mt[Lt]=Dt,Rt[Dt]=Lt}for(Dt=0,Ut="a".charCodeAt(0),Ft="z".charCodeAt(0);Dt+Ut<=Ft;Dt++){Lt=String.fromCharCode(Dt+Ut);var Bt=Dt+26;Mt[Lt]=Bt,Rt[Bt]=Lt}for(Dt=0;Dt<10;Dt++){Mt[Dt.toString(10)]=Dt+52;Lt=Dt.toString(10),Bt=Dt+52;Mt[Lt]=Bt,Rt[Bt]=Lt}Mt["+"]=62,Rt[62]="+",Mt["/"]=63,Rt[63]="/";function qt(e){var t=e.length/4*3;"=="===e.substr(-2)?t-=2:"="===e.substr(-1)&&t--;for(var n=new ArrayBuffer(t),r=new DataView(n),i=0;i<e.length;i+=4){for(var o=0,s=0,a=i,u=i+3;a<=u;a++)"="!==e[a]?(o|=Mt[e[a]]<<6*(u-a),s+=6):o>>=6;var c=i/4*3;o>>=s%8;for(var l=Math.floor(s/8),f=0;f<l;f++){var d=8*(l-f-1);r.setUint8(c+f,(o&255<<d)>>d)}}return new Uint8Array(n)}function zt(e){return new Promise((function(t,n){var r=new FileReader;r.onloadend=function(){var e;if(2!==r.readyState)return n(new Error("Reader aborted too early"));var i=null!==(e=r.result)&&void 0!==e?e:"",o=i.indexOf(","),s=o>-1?o+1:i.length;t(i.substring(s))},r.onabort=function(){return n(new Error("Read aborted"))},r.onerror=function(){return n(r.error)},r.readAsDataURL(e)}))}var Vt={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},Kt=function(e){return{applyToStack:function(t){t.add(function(e){return function(t,n){return function(i){return Object(r.__awaiter)(void 0,void 0,void 0,(function(){var o;return Object(r.__generator)(this,(function(s){return(null===(o=null==e?void 0:e.retryStrategy)||void 0===o?void 0:o.mode)&&(n.userAgent=Object(r.__spread)(n.userAgent||[],[["cfg/retry-mode",e.retryStrategy.mode]])),[2,e.retryStrategy.retry(t,i)]}))}))}}}(e),Vt)}}},Gt=["AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch"],Ht=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],Wt=["AbortError","TimeoutError","RequestTimeout","RequestTimeoutException"],Yt=[500,502,503,504],Jt=function(e){var t,n;return 429===(null===(t=e.$metadata)||void 0===t?void 0:t.httpStatusCode)||Ht.includes(e.name)||1==(null===(n=e.$retryable)||void 0===n?void 0:n.throttling)},$t=n(63),Qt=function(e,t){return Math.floor(Math.min(2e4,Math.random()*Math.pow(2,t)*e))},Zt=function(e){return!!e&&(function(e){return void 0!==e.$retryable}(e)||function(e){return Gt.includes(e.name)}(e)||Jt(e)||function(e){var t;return Wt.includes(e.name)||Yt.includes((null===(t=e.$metadata)||void 0===t?void 0:t.httpStatusCode)||0)}(e))},Xt=function(){function e(e,t){var n,r,i,o,s,a,u,c;this.maxAttemptsProvider=e,this.mode="standard",this.retryDecider=null!==(n=null==t?void 0:t.retryDecider)&&void 0!==n?n:Zt,this.delayDecider=null!==(r=null==t?void 0:t.delayDecider)&&void 0!==r?r:Qt,this.retryQuota=null!==(i=null==t?void 0:t.retryQuota)&&void 0!==i?i:(s=o=500,a=o,u=function(e){return"TimeoutError"===e.name?10:5},c=function(e){return u(e)<=a},Object.freeze({hasRetryTokens:c,retrieveRetryTokens:function(e){if(!c(e))throw new Error("No retry token available");var t=u(e);return a-=t,t},releaseRetryTokens:function(e){a+=null!=e?e:1,a=Math.min(a,s)}}))}return e.prototype.shouldRetry=function(e,t,n){return t<n&&this.retryDecider(e)&&this.retryQuota.hasRetryTokens(e)},e.prototype.getMaxAttempts=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){var e;return Object(r.__generator)(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.maxAttemptsProvider()];case 1:return e=t.sent(),[3,3];case 2:return t.sent(),e=3,[3,3];case 3:return[2,e]}}))}))},e.prototype.retry=function(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){var n,i,o,s,a,u,c,l;return Object(r.__generator)(this,(function(f){switch(f.label){case 0:return i=0,o=0,[4,this.getMaxAttempts()];case 1:s=f.sent(),a=t.request,Ce.isInstance(a)&&(a.headers["amz-sdk-invocation-id"]=Object($t.v4)()),u=function(){var u,l,f,d,h;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,5]),Ce.isInstance(a)&&(a.headers["amz-sdk-request"]="attempt="+(i+1)+"; max="+s),[4,e(t)];case 1:return u=r.sent(),l=u.response,f=u.output,c.retryQuota.releaseRetryTokens(n),f.$metadata.attempts=i+1,f.$metadata.totalRetryDelay=o,[2,{value:{response:l,output:f}}];case 2:return d=r.sent(),i++,c.shouldRetry(d,i,s)?(n=c.retryQuota.retrieveRetryTokens(d),h=c.delayDecider(Jt(d)?500:100,i),o+=h,[4,new Promise((function(e){return setTimeout(e,h)}))]):[3,4];case 3:return r.sent(),[2,"continue"];case 4:throw d.$metadata||(d.$metadata={}),d.$metadata.attempts=i,d.$metadata.totalRetryDelay=o,d;case 5:return[2]}}))},c=this,f.label=2;case 2:return[5,u()];case 3:return"object"==typeof(l=f.sent())?[2,l.value]:[3,2];case 4:return[2]}}))}))},e}(),en=function(e){if(void 0===e&&(e=3),"number"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};var tn=n(65),nn=n.n(tn),rn=n(31),on="cognito-identity.{region}.amazonaws.com",sn=new Set(["af-south-1","ap-east-1","ap-northeast-1","ap-northeast-2","ap-south-1","ap-southeast-1","ap-southeast-2","ca-central-1","eu-central-1","eu-north-1","eu-south-1","eu-west-1","eu-west-2","eu-west-3","me-south-1","sa-east-1","us-east-1","us-east-2","us-west-1","us-west-2"]),an=new Set(["cn-north-1","cn-northwest-1"]),un=new Set(["us-iso-east-1"]),cn=new Set(["us-isob-east-1"]),ln=new Set(["us-gov-east-1","us-gov-west-1"]);var fn,dn,hn,pn,vn={apiVersion:"2014-06-30",disableHostPrefix:!1,logger:{},regionInfoProvider:function(e,t){var n=void 0;switch(e){case"ap-northeast-1":n={hostname:"cognito-identity.ap-northeast-1.amazonaws.com",partition:"aws"};break;case"ap-northeast-2":n={hostname:"cognito-identity.ap-northeast-2.amazonaws.com",partition:"aws"};break;case"ap-south-1":n={hostname:"cognito-identity.ap-south-1.amazonaws.com",partition:"aws"};break;case"ap-southeast-1":n={hostname:"cognito-identity.ap-southeast-1.amazonaws.com",partition:"aws"};break;case"ap-southeast-2":n={hostname:"cognito-identity.ap-southeast-2.amazonaws.com",partition:"aws"};break;case"ca-central-1":n={hostname:"cognito-identity.ca-central-1.amazonaws.com",partition:"aws"};break;case"cn-north-1":n={hostname:"cognito-identity.cn-north-1.amazonaws.com.cn",partition:"aws-cn"};break;case"eu-central-1":n={hostname:"cognito-identity.eu-central-1.amazonaws.com",partition:"aws"};break;case"eu-north-1":n={hostname:"cognito-identity.eu-north-1.amazonaws.com",partition:"aws"};break;case"eu-west-1":n={hostname:"cognito-identity.eu-west-1.amazonaws.com",partition:"aws"};break;case"eu-west-2":n={hostname:"cognito-identity.eu-west-2.amazonaws.com",partition:"aws"};break;case"eu-west-3":n={hostname:"cognito-identity.eu-west-3.amazonaws.com",partition:"aws"};break;case"fips-us-east-1":n={hostname:"cognito-identity-fips.us-east-1.amazonaws.com",partition:"aws",signingRegion:"us-east-1"};break;case"fips-us-east-2":n={hostname:"cognito-identity-fips.us-east-2.amazonaws.com",partition:"aws",signingRegion:"us-east-2"};break;case"fips-us-gov-west-1":n={hostname:"cognito-identity-fips.us-gov-west-1.amazonaws.com",partition:"aws-us-gov",signingRegion:"us-gov-west-1"};break;case"fips-us-west-2":n={hostname:"cognito-identity-fips.us-west-2.amazonaws.com",partition:"aws",signingRegion:"us-west-2"};break;case"sa-east-1":n={hostname:"cognito-identity.sa-east-1.amazonaws.com",partition:"aws"};break;case"us-east-1":n={hostname:"cognito-identity.us-east-1.amazonaws.com",partition:"aws"};break;case"us-east-2":n={hostname:"cognito-identity.us-east-2.amazonaws.com",partition:"aws"};break;case"us-gov-west-1":n={hostname:"cognito-identity.us-gov-west-1.amazonaws.com",partition:"aws-us-gov"};break;case"us-west-1":n={hostname:"cognito-identity.us-west-1.amazonaws.com",partition:"aws"};break;case"us-west-2":n={hostname:"cognito-identity.us-west-2.amazonaws.com",partition:"aws"};break;default:sn.has(e)&&(n={hostname:on.replace("{region}",e),partition:"aws"}),an.has(e)&&(n={hostname:"cognito-identity.{region}.amazonaws.com.cn".replace("{region}",e),partition:"aws-cn"}),un.has(e)&&(n={hostname:"cognito-identity.{region}.c2s.ic.gov".replace("{region}",e),partition:"aws-iso"}),cn.has(e)&&(n={hostname:"cognito-identity.{region}.sc2s.sgov.gov".replace("{region}",e),partition:"aws-iso-b"}),ln.has(e)&&(n={hostname:"cognito-identity.{region}.amazonaws.com".replace("{region}",e),partition:"aws-us-gov"}),void 0===n&&(n={hostname:on.replace("{region}",e),partition:"aws"})}return Promise.resolve(At({signingService:"cognito-identity"},n))},serviceId:"Cognito Identity",urlParser:function(e){var t,n=new URL(e),i=n.hostname,o=n.pathname,s=n.port,a=n.protocol,u=n.search;return u&&(t=function(e){var t,n,i={};if(e=e.replace(/^\?/,""))try{for(var o=Object(r.__values)(e.split("&")),s=o.next();!s.done;s=o.next()){var a=s.value,u=Object(r.__read)(a.split("="),2),c=u[0],l=u[1],f=void 0===l?null:l;c=decodeURIComponent(c),f&&(f=decodeURIComponent(f)),c in i?Array.isArray(i[c])?i[c].push(f):i[c]=[i[c],f]:i[c]=f}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return i}(u)),{hostname:i,port:s?parseInt(s):void 0,protocol:a,path:o,query:t}}},gn=At(At({},vn),{runtime:"browser",base64Decoder:qt,base64Encoder:function(e){for(var t="",n=0;n<e.length;n+=3){for(var r=0,i=0,o=n,s=Math.min(n+3,e.length);o<s;o++)r|=e[o]<<8*(s-o-1),i+=8;var a=Math.ceil(i/6);r<<=6*a-i;for(var u=1;u<=a;u++){var c=6*(a-u);t+=Rt[(r&63<<c)>>c]}t+="==".slice(0,4-a)}return t},bodyLengthChecker:function(e){if("string"==typeof e){for(var t=e.length,n=t-1;n>=0;n--){var r=e.charCodeAt(n);r>127&&r<=2047?t++:r>2047&&r<=65535&&(t+=2)}return t}return"number"==typeof e.byteLength?e.byteLength:"number"==typeof e.size?e.size:void 0},credentialDefaultProvider:function(e){return function(){return Promise.reject(new Error("Credential is missing"))}},defaultUserAgentProvider:(dn={serviceId:vn.serviceId,clientVersion:jt.version},hn=dn.serviceId,pn=dn.clientVersion,function(){return Object(r.__awaiter)(void 0,void 0,void 0,(function(){var e,t,n,i,o,s,a,u,c;return Object(r.__generator)(this,(function(r){return e=(null===(n=null===window||void 0===window?void 0:window.navigator)||void 0===n?void 0:n.userAgent)?nn.a.parse(window.navigator.userAgent):void 0,t=[["aws-sdk-js",pn],["os/"+((null===(i=null==e?void 0:e.os)||void 0===i?void 0:i.name)||"other"),null===(o=null==e?void 0:e.os)||void 0===o?void 0:o.version],["lang/js"],["md/browser",(null!==(a=null===(s=null==e?void 0:e.browser)||void 0===s?void 0:s.name)&&void 0!==a?a:"unknown")+"_"+(null!==(c=null===(u=null==e?void 0:e.browser)||void 0===u?void 0:u.version)&&void 0!==c?c:"unknown")]],hn&&t.push(["api/"+hn,pn]),[2,t]}))}))}),maxAttempts:3,region:(fn="Region is missing",function(){return Promise.reject(fn)}),requestHandler:new kt,sha256:Pt.Sha256,streamCollector:function(e){return"function"==typeof Blob&&e instanceof Blob?function(e){return Object(r.__awaiter)(this,void 0,void 0,(function(){var t,n;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return[4,zt(e)];case 1:return t=r.sent(),n=qt(t),[2,new Uint8Array(n)]}}))}))}(e):function(e){return Object(r.__awaiter)(this,void 0,void 0,(function(){var t,n,i,o,s,a,u;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:t=new Uint8Array(0),n=e.getReader(),i=!1,r.label=1;case 1:return i?[3,3]:[4,n.read()];case 2:return o=r.sent(),s=o.done,(a=o.value)&&(u=t,(t=new Uint8Array(u.length+a.length)).set(u),t.set(a,u.length)),i=s,[3,1];case 3:return[2,t]}}))}))}(e)},utf8Decoder:rn.fromUtf8,utf8Encoder:rn.toUtf8}),yn=function(e){var t=e.endpoint,n=e.urlParser;if("string"==typeof t){var r=Promise.resolve(n(t));return function(){return r}}if("object"==typeof t){var i=Promise.resolve(t);return function(){return i}}return t},mn=function(e){return Object(r.__awaiter)(void 0,void 0,void 0,(function(){var t,n,i,o,s;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return t=e.tls,n=void 0===t||t,[4,e.region()];case 1:if(i=r.sent(),!new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/).test(i))throw new Error("Invalid region in client config");return[4,e.regionInfoProvider(i)];case 2:if(!(o=(null!==(s=r.sent())&&void 0!==s?s:{}).hostname))throw new Error("Cannot resolve hostname from client config");return[2,e.urlParser((n?"https:":"http:")+"//"+o)]}}))}))},bn=function(e){if("string"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};var _n={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},wn=function(e){return{applyToStack:function(t){t.add(function(e){var t=this;return function(n){return function(i){return Object(r.__awaiter)(t,void 0,void 0,(function(){var t,o,s,a,u;return Object(r.__generator)(this,(function(c){return t=i.request,Ce.isInstance(t)&&(o=t.body,s=t.headers,o&&-1===Object.keys(s).map((function(e){return e.toLowerCase()})).indexOf("content-length")&&void 0!==(a=e(o))&&(t.headers=Object(r.__assign)(Object(r.__assign)({},t.headers),((u={})["content-length"]=String(a),u)))),[2,n(Object(r.__assign)(Object(r.__assign)({},i),{request:t}))]}))}))}}}(e.bodyLengthChecker),_n)}}};for(var Sn={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},On=function(e){return{applyToStack:function(t){t.add(function(e){return function(t){return function(n){return Object(r.__awaiter)(void 0,void 0,void 0,(function(){var i,o;return Object(r.__generator)(this,(function(r){return Ce.isInstance(n.request)?(i=n.request,o=(e.requestHandler.metadata||{}).handlerProtocol,(void 0===o?"":o).indexOf("h2")>=0&&!i.headers[":authority"]?(delete i.headers.host,i.headers[":authority"]=""):i.headers.host||(i.headers.host=i.hostname),[2,t(n)]):[2,t(n)]}))}))}}}(e),Sn)}}},En={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},An=function(e){return{applyToStack:function(e){e.add((function(e,t){return function(n){return Object(r.__awaiter)(void 0,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d;return Object(r.__generator)(this,(function(h){switch(h.label){case 0:return i=t.clientName,o=t.commandName,s=t.inputFilterSensitiveLog,a=t.logger,u=t.outputFilterSensitiveLog,[4,e(n)];case 1:return c=h.sent(),a?("function"==typeof a.info&&(l=c.output,f=l.$metadata,d=Object(r.__rest)(l,["$metadata"]),a.info({clientName:i,commandName:o,input:s(n.input),output:u(d),metadata:f})),[2,c]):[2,c]}}))}))}}),En)}}},In={},Tn={},Cn=0;Cn<256;Cn++){var jn=Cn.toString(16).toLowerCase();1===jn.length&&(jn="0"+jn),In[Cn]=jn,Tn[jn]=Cn}function Pn(e){for(var t="",n=0;n<e.byteLength;n++)t+=In[e[n]];return t}var xn="X-Amz-Date".toLowerCase(),Nn=["authorization",xn,"date"],kn="X-Amz-Signature".toLowerCase(),Mn="X-Amz-Security-Token".toLowerCase(),Rn={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},Dn=/^proxy-/,Un=/^sec-/,Fn="AWS4-HMAC-SHA256-PAYLOAD",Ln={},Bn=[];function qn(e,t,n){return e+"/"+t+"/"+n+"/aws4_request"}function zn(e,t,n){var r=new e(t);return r.update(n),r.digest()}function Vn(e,t,n){var i,o,s=e.headers,a={};try{for(var u=Object(r.__values)(Object.keys(s).sort()),c=u.next();!c.done;c=u.next()){var l=c.value,f=l.toLowerCase();(f in Rn||(null==t?void 0:t.has(f))||Dn.test(f)||Un.test(f))&&(!n||n&&!n.has(f))||(a[f]=s[l].trim().replace(/\s+/g," "))}}catch(e){i={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}return a}var Kn=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,Gn)},Gn=function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()};function Hn(e,t){var n=e.headers,i=e.body;return Object(r.__awaiter)(this,void 0,void 0,(function(){var e,o,s,a,u,c,l;return Object(r.__generator)(this,(function(f){switch(f.label){case 0:try{for(e=Object(r.__values)(Object.keys(n)),o=e.next();!o.done;o=e.next())if("x-amz-content-sha256"===(s=o.value).toLowerCase())return[2,n[s]]}catch(e){c={error:e}}finally{try{o&&!o.done&&(l=e.return)&&l.call(e)}finally{if(c)throw c.error}}return null!=i?[3,1]:[2,"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"];case 1:return"string"==typeof i||ArrayBuffer.isView(i)||(d=i,"function"==typeof ArrayBuffer&&d instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(d))?((a=new t).update(i),u=Pn,[4,a.digest()]):[3,3];case 2:return[2,u.apply(void 0,[f.sent()])];case 3:return[2,"UNSIGNED-PAYLOAD"]}var d}))}))}function Wn(e){var t=e.headers,n=e.query,i=Object(r.__rest)(e,["headers","query"]);return Object(r.__assign)(Object(r.__assign)({},i),{headers:Object(r.__assign)({},t),query:n?Yn(n):void 0})}function Yn(e){return Object.keys(e).reduce((function(t,n){var i,o=e[n];return Object(r.__assign)(Object(r.__assign)({},t),((i={})[n]=Array.isArray(o)?Object(r.__spread)(o):o,i))}),{})}function Jn(e){var t,n;e="function"==typeof e.clone?e.clone():Wn(e);try{for(var i=Object(r.__values)(Object.keys(e.headers)),o=i.next();!o.done;o=i.next()){var s=o.value;Nn.indexOf(s.toLowerCase())>-1&&delete e.headers[s]}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return e}function $n(e){return function(e){if("number"==typeof e)return new Date(1e3*e);if("string"==typeof e)return Number(e)?new Date(1e3*Number(e)):new Date(e);return e}(e).toISOString().replace(/\.\d{3}Z$/,"Z")}var Qn=function(){function e(e){var t=e.applyChecksum,n=e.credentials,r=e.region,i=e.service,o=e.sha256,s=e.uriEscapePath,a=void 0===s||s;this.service=i,this.sha256=o,this.uriEscapePath=a,this.applyChecksum="boolean"!=typeof t||t,this.regionProvider=er(r),this.credentialProvider=tr(n)}return e.prototype.presign=function(e,t){return void 0===t&&(t={}),Object(r.__awaiter)(this,void 0,void 0,(function(){var n,i,o,s,a,u,c,l,f,d,h,p,v,g,y,m,b,_,w,S,O,E,A,I;return Object(r.__generator)(this,(function(T){switch(T.label){case 0:return n=t.signingDate,i=void 0===n?new Date:n,o=t.expiresIn,s=void 0===o?3600:o,a=t.unsignableHeaders,u=t.unhoistableHeaders,c=t.signableHeaders,l=t.signingRegion,f=t.signingService,[4,this.credentialProvider()];case 1:return d=T.sent(),null==l?[3,2]:(p=l,[3,4]);case 2:return[4,this.regionProvider()];case 3:p=T.sent(),T.label=4;case 4:return h=p,v=Zn(i),g=v.longDate,y=v.shortDate,s>604800?[2,Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future")]:(m=qn(y,h,null!=f?f:this.service),b=function(e,t){var n,i,o;void 0===t&&(t={});var s="function"==typeof e.clone?e.clone():Wn(e),a=s.headers,u=s.query,c=void 0===u?{}:u;try{for(var l=Object(r.__values)(Object.keys(a)),f=l.next();!f.done;f=l.next()){var d=f.value,h=d.toLowerCase();"x-amz-"!==h.substr(0,6)||(null===(o=t.unhoistableHeaders)||void 0===o?void 0:o.has(h))||(c[d]=a[d],delete a[d])}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}return Object(r.__assign)(Object(r.__assign)({},e),{headers:a,query:c})}(Jn(e),{unhoistableHeaders:u}),d.sessionToken&&(b.query["X-Amz-Security-Token"]=d.sessionToken),b.query["X-Amz-Algorithm"]="AWS4-HMAC-SHA256",b.query["X-Amz-Credential"]=d.accessKeyId+"/"+m,b.query["X-Amz-Date"]=g,b.query["X-Amz-Expires"]=s.toString(10),_=Vn(b,a,c),b.query["X-Amz-SignedHeaders"]=Xn(_),w=b.query,S="X-Amz-Signature",O=this.getSignature,E=[g,m,this.getSigningKey(d,h,y,f)],A=this.createCanonicalRequest,I=[b,_],[4,Hn(e,this.sha256)]);case 5:return[4,O.apply(this,E.concat([A.apply(this,I.concat([T.sent()]))]))];case 6:return w[S]=T.sent(),[2,b]}}))}))},e.prototype.sign=function(e,t){return Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(n){return"string"==typeof e?[2,this.signString(e,t)]:e.headers&&e.payload?[2,this.signEvent(e,t)]:[2,this.signRequest(e,t)]}))}))},e.prototype.signEvent=function(e,t){var n=e.headers,i=e.payload,o=t.signingDate,s=void 0===o?new Date:o,a=t.priorSignature,u=t.signingRegion,c=t.signingService;return Object(r.__awaiter)(this,void 0,void 0,(function(){var e,t,o,l,f,d,h,p,v,g,y;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return null==u?[3,1]:(t=u,[3,3]);case 1:return[4,this.regionProvider()];case 2:t=r.sent(),r.label=3;case 3:return e=t,o=Zn(s),l=o.shortDate,f=o.longDate,d=qn(l,e,null!=c?c:this.service),[4,Hn({headers:{},body:i},this.sha256)];case 4:return h=r.sent(),(p=new this.sha256).update(n),g=Pn,[4,p.digest()];case 5:return v=g.apply(void 0,[r.sent()]),y=[Fn,f,d,a,v,h].join("\n"),[2,this.signString(y,{signingDate:s,signingRegion:e,signingService:c})]}}))}))},e.prototype.signString=function(e,t){var n=void 0===t?{}:t,i=n.signingDate,o=void 0===i?new Date:i,s=n.signingRegion,a=n.signingService;return Object(r.__awaiter)(this,void 0,void 0,(function(){var t,n,i,u,c,l,f,d;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return[4,this.credentialProvider()];case 1:return t=r.sent(),null==s?[3,2]:(i=s,[3,4]);case 2:return[4,this.regionProvider()];case 3:i=r.sent(),r.label=4;case 4:return n=i,u=Zn(o).shortDate,f=(l=this.sha256).bind,[4,this.getSigningKey(t,n,u,a)];case 5:return(c=new(f.apply(l,[void 0,r.sent()]))).update(e),d=Pn,[4,c.digest()];case 6:return[2,d.apply(void 0,[r.sent()])]}}))}))},e.prototype.signRequest=function(e,t){var n=void 0===t?{}:t,i=n.signingDate,o=void 0===i?new Date:i,s=n.signableHeaders,a=n.unsignableHeaders,u=n.signingRegion,c=n.signingService;return Object(r.__awaiter)(this,void 0,void 0,(function(){var t,n,i,l,f,d,h,p,v,g,y;return Object(r.__generator)(this,(function(m){switch(m.label){case 0:return[4,this.credentialProvider()];case 1:return t=m.sent(),null==u?[3,2]:(i=u,[3,4]);case 2:return[4,this.regionProvider()];case 3:i=m.sent(),m.label=4;case 4:return n=i,l=Jn(e),f=Zn(o),d=f.longDate,h=f.shortDate,p=qn(h,n,null!=c?c:this.service),l.headers[xn]=d,t.sessionToken&&(l.headers[Mn]=t.sessionToken),[4,Hn(l,this.sha256)];case 5:return v=m.sent(),!function(e,t){var n,i;e=e.toLowerCase();try{for(var o=Object(r.__values)(Object.keys(t)),s=o.next();!s.done;s=o.next()){if(e===s.value.toLowerCase())return!0}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return!1}("x-amz-content-sha256",l.headers)&&this.applyChecksum&&(l.headers["x-amz-content-sha256"]=v),g=Vn(l,a,s),[4,this.getSignature(d,p,this.getSigningKey(t,n,h,c),this.createCanonicalRequest(l,g,v))];case 6:return y=m.sent(),l.headers.authorization="AWS4-HMAC-SHA256 Credential="+t.accessKeyId+"/"+p+", SignedHeaders="+Xn(g)+", Signature="+y,[2,l]}}))}))},e.prototype.createCanonicalRequest=function(e,t,n){var i=Object.keys(t).sort();return e.method+"\n"+this.getCanonicalPath(e)+"\n"+function(e){var t,n,i=e.query,o=void 0===i?{}:i,s=[],a={},u=function(e){if(e.toLowerCase()===kn)return"continue";s.push(e);var t=o[e];"string"==typeof t?a[e]=Kn(e)+"="+Kn(t):Array.isArray(t)&&(a[e]=t.slice(0).sort().reduce((function(t,n){return t.concat([Kn(e)+"="+Kn(n)])}),[]).join("&"))};try{for(var c=Object(r.__values)(Object.keys(o).sort()),l=c.next();!l.done;l=c.next()){u(l.value)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}return s.map((function(e){return a[e]})).filter((function(e){return e})).join("&")}(e)+"\n"+i.map((function(e){return e+":"+t[e]})).join("\n")+"\n\n"+i.join(";")+"\n"+n},e.prototype.createStringToSign=function(e,t,n){return Object(r.__awaiter)(this,void 0,void 0,(function(){var i,o;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return(i=new this.sha256).update(n),[4,i.digest()];case 1:return o=r.sent(),[2,"AWS4-HMAC-SHA256\n"+e+"\n"+t+"\n"+Pn(o)]}}))}))},e.prototype.getCanonicalPath=function(e){var t=e.path;return this.uriEscapePath?"/"+encodeURIComponent(t.replace(/^\//,"")).replace(/%2F/g,"/"):t},e.prototype.getSignature=function(e,t,n,i){return Object(r.__awaiter)(this,void 0,void 0,(function(){var o,s,a,u,c;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return[4,this.createStringToSign(e,t,i)];case 1:return o=r.sent(),u=(a=this.sha256).bind,[4,n];case 2:return(s=new(u.apply(a,[void 0,r.sent()]))).update(o),c=Pn,[4,s.digest()];case 3:return[2,c.apply(void 0,[r.sent()])]}}))}))},e.prototype.getSigningKey=function(e,t,n,i){return function(e,t,n,i,o){return Object(r.__awaiter)(void 0,void 0,void 0,(function(){var s,a,u,c,l,f,d,h,p;return Object(r.__generator)(this,(function(v){switch(v.label){case 0:return[4,zn(e,t.secretAccessKey,t.accessKeyId)];case 1:if(s=v.sent(),(a=n+":"+i+":"+o+":"+Pn(s)+":"+t.sessionToken)in Ln)return[2,Ln[a]];for(Bn.push(a);Bn.length>50;)delete Ln[Bn.shift()];u="AWS4"+t.secretAccessKey,v.label=2;case 2:v.trys.push([2,7,8,9]),c=Object(r.__values)([n,i,o,"aws4_request"]),l=c.next(),v.label=3;case 3:return l.done?[3,6]:(f=l.value,[4,zn(e,u,f)]);case 4:u=v.sent(),v.label=5;case 5:return l=c.next(),[3,3];case 6:return[3,9];case 7:return d=v.sent(),h={error:d},[3,9];case 8:try{l&&!l.done&&(p=c.return)&&p.call(c)}finally{if(h)throw h.error}return[7];case 9:return[2,Ln[a]=u]}}))}))}(this.sha256,e,n,t,i||this.service)},e}(),Zn=function(e){var t=$n(e).replace(/[\-:]/g,"");return{longDate:t,shortDate:t.substr(0,8)}},Xn=function(e){return Object.keys(e).sort().join(";")},er=function(e){if("string"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e},tr=function(e){if("object"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};function nr(e){if("object"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e}var rr,ir,or,sr,ar,ur,cr,lr,fr,dr,hr,pr,vr,gr,yr,mr,br,_r,wr,Sr,Or,Er,Ar,Ir,Tr,Cr,jr,Pr,xr,Nr,kr,Mr,Rr,Dr,Ur,Fr,Lr,Br,qr,zr,Vr,Kr,Gr,Hr,Wr,Yr,Jr,$r,Qr,Zr,Xr,ei,ti,ni,ri,ii,oi,si=/[^\!\#\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,ai=function(e){var t=Object(r.__read)(e,2),n=t[0],i=t[1],o=n.indexOf("/"),s=n.substring(0,o),a=n.substring(o+1);return"api"===s&&(a=a.toLowerCase()),[s,a,i].filter((function(e){return e&&e.length>0})).map((function(e){return null==e?void 0:e.replace(si,"_")})).join("/")},ui={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},ci=function(e){return{applyToStack:function(t){var n;t.add((n=e,function(e,t){return function(i){return Object(r.__awaiter)(void 0,void 0,void 0,(function(){var o,s,a,u,c,l,f,d;return Object(r.__generator)(this,(function(h){switch(h.label){case 0:return o=i.request,Ce.isInstance(o)?(s=o.headers,a=(null===(f=null==t?void 0:t.userAgent)||void 0===f?void 0:f.map(ai))||[],[4,n.defaultUserAgentProvider()]):[2,e(i)];case 1:return u=h.sent().map(ai),c=(null===(d=null==n?void 0:n.customUserAgent)||void 0===d?void 0:d.map(ai))||[],s["x-amz-user-agent"]=Object(r.__spread)(u,a,c).join(" "),l=Object(r.__spread)(u.filter((function(e){return e.startsWith("aws-sdk-")})),c).join(" "),"browser"!==n.runtime&&l&&(s["user-agent"]=s["user-agent"]?s["user-agent"]+" "+l:l),[2,e(Object(r.__assign)(Object(r.__assign)({},i),{request:o}))]}}))}))}}),ui)}}},li=function(e){function t(t){var n,i,o=this,s=function(e){var t,n=this,i=nr(e.credentials||e.credentialDefaultProvider(e)),o=e.signingEscapePath,s=void 0===o||o,a=e.systemClockOffset,u=void 0===a?e.systemClockOffset||0:a,c=e.sha256;return t=e.signer?nr(e.signer):function(){return nr(e.region)().then((function(t){return Object(r.__awaiter)(n,void 0,void 0,(function(){return Object(r.__generator)(this,(function(n){switch(n.label){case 0:return[4,e.regionInfoProvider(t)];case 1:return[2,[n.sent()||{},t]]}}))}))})).then((function(t){var n=Object(r.__read)(t,2),o=n[0],a=n[1],u=o.signingRegion,l=o.signingService;return e.signingRegion=e.signingRegion||u||a,e.signingName=e.signingName||l||e.serviceId,new Qn({credentials:i,region:e.signingRegion,service:e.signingName,sha256:c,uriEscapePath:s})}))},Object(r.__assign)(Object(r.__assign)({},e),{systemClockOffset:u,signingEscapePath:s,credentials:i,signer:t})}(function(e){var t;return Object(r.__assign)(Object(r.__assign)({},e),{tls:null===(t=e.tls)||void 0===t||t,endpoint:e.endpoint?yn(e):function(){return mn(e)},isCustomEndpoint:!!e.endpoint})}(function(e){if(!e.region)throw new Error("Region is missing");return Object(r.__assign)(Object(r.__assign)({},e),{region:bn(e.region)})}(At(At({},gn),t)))),a=function(e){return Object(r.__assign)(Object(r.__assign)({},e),{customUserAgent:"string"==typeof e.customUserAgent?[[e.customUserAgent]]:e.customUserAgent})}((i=en((n=s).maxAttempts),Object(r.__assign)(Object(r.__assign)({},n),{maxAttempts:i,retryStrategy:n.retryStrategy||new Xt(i)})));return(o=e.call(this,a)||this).config=a,o.middlewareStack.use(Kt(o.config)),o.middlewareStack.use(wn(o.config)),o.middlewareStack.use(On(o.config)),o.middlewareStack.use(An(o.config)),o.middlewareStack.use(ci(o.config)),o}return Et(t,e),t.prototype.destroy=function(){e.prototype.destroy.call(this)},t}(dt);!function(e){e.AUTHENTICATED_ROLE="AuthenticatedRole",e.DENY="Deny"}(rr||(rr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(ir||(ir={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(or||(or={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(sr||(sr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(ar||(ar={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(ur||(ur={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(cr||(cr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(lr||(lr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(fr||(fr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(dr||(dr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(hr||(hr={})),function(e){e.ACCESS_DENIED="AccessDenied",e.INTERNAL_SERVER_ERROR="InternalServerError"}(pr||(pr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(vr||(vr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(gr||(gr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(yr||(yr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(mr||(mr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(br||(br={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(_r||(_r={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(wr||(wr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Sr||(Sr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Or||(Or={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Er||(Er={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Ar||(Ar={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Ir||(Ir={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Tr||(Tr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Cr||(Cr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(jr||(jr={})),function(e){e.CONTAINS="Contains",e.EQUALS="Equals",e.NOT_EQUAL="NotEqual",e.STARTS_WITH="StartsWith"}(Pr||(Pr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(xr||(xr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Nr||(Nr={})),function(e){e.RULES="Rules",e.TOKEN="Token"}(kr||(kr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Mr||(Mr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Rr||(Rr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Dr||(Dr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Ur||(Ur={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Fr||(Fr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Lr||(Lr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Br||(Br={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(qr||(qr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(zr||(zr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Vr||(Vr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Kr||(Kr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Gr||(Gr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Hr||(Hr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Wr||(Wr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Yr||(Yr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Jr||(Jr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}($r||($r={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Qr||(Qr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Zr||(Zr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(Xr||(Xr={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(ei||(ei={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(ti||(ti={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(ni||(ni={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(ri||(ri={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(ii||(ii={})),function(e){e.filterSensitiveLog=function(e){return At({},e)}}(oi||(oi={}));var fi=function(e,t){return It(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,g;return Tt(this,(function(y){switch(y.label){case 0:return r=[At({},e)],g={},[4,Bi(e.body,t)];case 1:switch(n=At.apply(void 0,r.concat([(g.body=y.sent(),g)])),o="UnknownError",o=qi(e,n.body),o){case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":return[3,2];case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":return[3,4];case"InvalidIdentityPoolConfigurationException":case"com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException":return[3,6];case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":return[3,8];case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":return[3,10];case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":return[3,12];case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":return[3,14];case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":return[3,16]}return[3,18];case 2:return s=[{}],[4,hi(n,t)];case 3:return i=At.apply(void 0,[At.apply(void 0,s.concat([y.sent()])),{name:o,$metadata:Ui(e)}]),[3,19];case 4:return a=[{}],[4,pi(n,t)];case 5:return i=At.apply(void 0,[At.apply(void 0,a.concat([y.sent()])),{name:o,$metadata:Ui(e)}]),[3,19];case 6:return u=[{}],[4,vi(n,t)];case 7:return i=At.apply(void 0,[At.apply(void 0,u.concat([y.sent()])),{name:o,$metadata:Ui(e)}]),[3,19];case 8:return c=[{}],[4,gi(n,t)];case 9:return i=At.apply(void 0,[At.apply(void 0,c.concat([y.sent()])),{name:o,$metadata:Ui(e)}]),[3,19];case 10:return l=[{}],[4,mi(n,t)];case 11:return i=At.apply(void 0,[At.apply(void 0,l.concat([y.sent()])),{name:o,$metadata:Ui(e)}]),[3,19];case 12:return f=[{}],[4,bi(n,t)];case 13:return i=At.apply(void 0,[At.apply(void 0,f.concat([y.sent()])),{name:o,$metadata:Ui(e)}]),[3,19];case 14:return d=[{}],[4,_i(n,t)];case 15:return i=At.apply(void 0,[At.apply(void 0,d.concat([y.sent()])),{name:o,$metadata:Ui(e)}]),[3,19];case 16:return h=[{}],[4,wi(n,t)];case 17:return i=At.apply(void 0,[At.apply(void 0,h.concat([y.sent()])),{name:o,$metadata:Ui(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=At(At({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:Ui(e)}),y.label=19;case 19:return v=i.message||i.Message||o,i.message=v,delete i.Message,[2,Promise.reject(Object.assign(new Error(v),i))]}}))}))},di=function(e,t){return It(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,g;return Tt(this,(function(y){switch(y.label){case 0:return r=[At({},e)],g={},[4,Bi(e.body,t)];case 1:switch(n=At.apply(void 0,r.concat([(g.body=y.sent(),g)])),o="UnknownError",o=qi(e,n.body),o){case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":return[3,2];case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":return[3,4];case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":return[3,6];case"LimitExceededException":case"com.amazonaws.cognitoidentity#LimitExceededException":return[3,8];case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":return[3,10];case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":return[3,12];case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":return[3,14];case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":return[3,16]}return[3,18];case 2:return s=[{}],[4,hi(n,t)];case 3:return i=At.apply(void 0,[At.apply(void 0,s.concat([y.sent()])),{name:o,$metadata:Ui(e)}]),[3,19];case 4:return a=[{}],[4,pi(n,t)];case 5:return i=At.apply(void 0,[At.apply(void 0,a.concat([y.sent()])),{name:o,$metadata:Ui(e)}]),[3,19];case 6:return u=[{}],[4,gi(n,t)];case 7:return i=At.apply(void 0,[At.apply(void 0,u.concat([y.sent()])),{name:o,$metadata:Ui(e)}]),[3,19];case 8:return c=[{}],[4,yi(n,t)];case 9:return i=At.apply(void 0,[At.apply(void 0,c.concat([y.sent()])),{name:o,$metadata:Ui(e)}]),[3,19];case 10:return l=[{}],[4,mi(n,t)];case 11:return i=At.apply(void 0,[At.apply(void 0,l.concat([y.sent()])),{name:o,$metadata:Ui(e)}]),[3,19];case 12:return f=[{}],[4,bi(n,t)];case 13:return i=At.apply(void 0,[At.apply(void 0,f.concat([y.sent()])),{name:o,$metadata:Ui(e)}]),[3,19];case 14:return d=[{}],[4,_i(n,t)];case 15:return i=At.apply(void 0,[At.apply(void 0,d.concat([y.sent()])),{name:o,$metadata:Ui(e)}]),[3,19];case 16:return h=[{}],[4,wi(n,t)];case 17:return i=At.apply(void 0,[At.apply(void 0,h.concat([y.sent()])),{name:o,$metadata:Ui(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=At(At({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:Ui(e)}),y.label=19;case 19:return v=i.message||i.Message||o,i.message=v,delete i.Message,[2,Promise.reject(Object.assign(new Error(v),i))]}}))}))},hi=function(e,t){return It(void 0,void 0,void 0,(function(){var n,r;return Tt(this,(function(i){return n=e.body,r=Ii(n,t),[2,At({name:"ExternalServiceException",$fault:"client",$metadata:Ui(e)},r)]}))}))},pi=function(e,t){return It(void 0,void 0,void 0,(function(){var n,r;return Tt(this,(function(i){return n=e.body,r=ji(n,t),[2,At({name:"InternalErrorException",$fault:"server",$metadata:Ui(e)},r)]}))}))},vi=function(e,t){return It(void 0,void 0,void 0,(function(){var n,r;return Tt(this,(function(i){return n=e.body,r=Pi(n,t),[2,At({name:"InvalidIdentityPoolConfigurationException",$fault:"client",$metadata:Ui(e)},r)]}))}))},gi=function(e,t){return It(void 0,void 0,void 0,(function(){var n,r;return Tt(this,(function(i){return n=e.body,r=xi(n,t),[2,At({name:"InvalidParameterException",$fault:"client",$metadata:Ui(e)},r)]}))}))},yi=function(e,t){return It(void 0,void 0,void 0,(function(){var n,r;return Tt(this,(function(i){return n=e.body,r=Ni(n,t),[2,At({name:"LimitExceededException",$fault:"client",$metadata:Ui(e)},r)]}))}))},mi=function(e,t){return It(void 0,void 0,void 0,(function(){var n,r;return Tt(this,(function(i){return n=e.body,r=ki(n,t),[2,At({name:"NotAuthorizedException",$fault:"client",$metadata:Ui(e)},r)]}))}))},bi=function(e,t){return It(void 0,void 0,void 0,(function(){var n,r;return Tt(this,(function(i){return n=e.body,r=Mi(n,t),[2,At({name:"ResourceConflictException",$fault:"client",$metadata:Ui(e)},r)]}))}))},_i=function(e,t){return It(void 0,void 0,void 0,(function(){var n,r;return Tt(this,(function(i){return n=e.body,r=Ri(n,t),[2,At({name:"ResourceNotFoundException",$fault:"client",$metadata:Ui(e)},r)]}))}))},wi=function(e,t){return It(void 0,void 0,void 0,(function(){var n,r;return Tt(this,(function(i){return n=e.body,r=Di(n,t),[2,At({name:"TooManyRequestsException",$fault:"client",$metadata:Ui(e)},r)]}))}))},Si=function(e,t){return At(At(At({},void 0!==e.CustomRoleArn&&null!==e.CustomRoleArn&&{CustomRoleArn:e.CustomRoleArn}),void 0!==e.IdentityId&&null!==e.IdentityId&&{IdentityId:e.IdentityId}),void 0!==e.Logins&&null!==e.Logins&&{Logins:Ei(e.Logins,t)})},Oi=function(e,t){return At(At(At({},void 0!==e.AccountId&&null!==e.AccountId&&{AccountId:e.AccountId}),void 0!==e.IdentityPoolId&&null!==e.IdentityPoolId&&{IdentityPoolId:e.IdentityPoolId}),void 0!==e.Logins&&null!==e.Logins&&{Logins:Ei(e.Logins,t)})},Ei=function(e,t){return Object.entries(e).reduce((function(e,t){var n,r=Ct(t,2),i=r[0],o=r[1];return null===o?e:At(At({},e),((n={})[i]=o,n))}),{})},Ai=function(e,t){return{AccessKeyId:void 0!==e.AccessKeyId&&null!==e.AccessKeyId?e.AccessKeyId:void 0,Expiration:void 0!==e.Expiration&&null!==e.Expiration?new Date(Math.round(1e3*e.Expiration)):void 0,SecretKey:void 0!==e.SecretKey&&null!==e.SecretKey?e.SecretKey:void 0,SessionToken:void 0!==e.SessionToken&&null!==e.SessionToken?e.SessionToken:void 0}},Ii=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ti=function(e,t){return{Credentials:void 0!==e.Credentials&&null!==e.Credentials?Ai(e.Credentials):void 0,IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},Ci=function(e,t){return{IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},ji=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Pi=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},xi=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ni=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},ki=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Mi=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ri=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Di=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ui=function(e){var t;return{httpStatusCode:e.statusCode,requestId:null!==(t=e.headers["x-amzn-requestid"])&&void 0!==t?t:e.headers["x-amzn-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}},Fi=function(e,t){return void 0===e&&(e=new Uint8Array),e instanceof Uint8Array?Promise.resolve(e):t.streamCollector(e)||Promise.resolve(new Uint8Array)},Li=function(e,t,n,r,i){return It(void 0,void 0,void 0,(function(){var o,s,a,u,c,l;return Tt(this,(function(f){switch(f.label){case 0:return[4,e.endpoint()];case 1:return o=f.sent(),s=o.hostname,a=o.protocol,u=void 0===a?"https":a,c=o.port,l={protocol:u,hostname:s,port:c,method:"POST",path:n,headers:t},void 0!==r&&(l.hostname=r),void 0!==i&&(l.body=i),[2,new Ce(l)]}}))}))},Bi=function(e,t){return function(e,t){return Fi(e,t).then((function(e){return t.utf8Encoder(e)}))}(e,t).then((function(e){return e.length?JSON.parse(e):{}}))},qi=function(e,t){var n,r,i=function(e){var t=e;return t.indexOf(":")>=0&&(t=t.split(":")[0]),t.indexOf("#")>=0&&(t=t.split("#")[1]),t},o=(n=e.headers,r="x-amzn-errortype",Object.keys(n).find((function(e){return e.toLowerCase()===r.toLowerCase()})));return void 0!==o?i(e.headers[o]):void 0!==t.code?i(t.code):void 0!==t.__type?i(t.__type):""},zi=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return Et(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(ut(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetIdCommand",inputFilterSensitiveLog:Tr.filterSensitiveLog,outputFilterSensitiveLog:Cr.filterSensitiveLog},o=t.requestHandler;return r.resolve((function(e){return o.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return It(void 0,void 0,void 0,(function(){var n,r;return Tt(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetId"},r=JSON.stringify(Oi(e,t)),[2,Li(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return It(void 0,void 0,void 0,(function(){var n,r,i;return Tt(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,di(e,t)]:[4,Bi(e.body,t)];case 1:return n=o.sent(),{},r=Ci(n,t),i=At({$metadata:Ui(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(ht),Vi=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return Et(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(ut(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetCredentialsForIdentityCommand",inputFilterSensitiveLog:Or.filterSensitiveLog,outputFilterSensitiveLog:Ar.filterSensitiveLog},o=t.requestHandler;return r.resolve((function(e){return o.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return It(void 0,void 0,void 0,(function(){var n,r;return Tt(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetCredentialsForIdentity"},r=JSON.stringify(Si(e,t)),[2,Li(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return It(void 0,void 0,void 0,(function(){var n,r,i;return Tt(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,fi(e,t)]:[4,Bi(e.body,t)];case 1:return n=o.sent(),{},r=Ti(n,t),i=At({$metadata:Ui(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(ht),Ki=new i.a("Credentials"),Gi=new(function(){function e(e){this._gettingCredPromise=null,this._refreshHandlers={},this.Auth=void 0,this.configure(e),this._refreshHandlers.google=p.refreshGoogleToken,this._refreshHandlers.facebook=v.refreshFacebookToken}return e.prototype.getModuleName=function(){return"Credentials"},e.prototype.getCredSource=function(){return this._credentials_source},e.prototype.configure=function(e){if(!e)return this._config||{};this._config=Object.assign({},this._config,e);var t=this._config.refreshHandlers;return t&&(this._refreshHandlers=Object(r.__assign)(Object(r.__assign)({},this._refreshHandlers),t)),this._storage=this._config.storage,this._storage||(this._storage=(new o.a).getStorage()),this._storageSync=Promise.resolve(),"function"==typeof this._storage.sync&&(this._storageSync=this._storage.sync()),this._config},e.prototype.get=function(){return Ki.debug("getting credentials"),this._pickupCredentials()},e.prototype._getCognitoIdentityIdStorageKey=function(e){return"CognitoIdentityId-"+e},e.prototype._pickupCredentials=function(){return Ki.debug("picking up credentials"),this._gettingCredPromise&&this._gettingCredPromise.isPending()?Ki.debug("getting old cred promise"):(Ki.debug("getting new cred promise"),this._gettingCredPromise=Object(s.d)(this._keepAlive())),this._gettingCredPromise},e.prototype._keepAlive=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){var e,t,n,i,o,s,a;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:if(Ki.debug("checking if credentials exists and not expired"),(e=this._credentials)&&!this._isExpired(e)&&!this._isPastTTL())return Ki.debug("credentials not changed and not expired, directly return"),[2,Promise.resolve(e)];if(Ki.debug("need to get a new credential or refresh the existing one"),t=this.Auth,!(n=void 0===t?y.a.Auth:t)||"function"!=typeof n.currentUserCredentials)return[2,Promise.reject("No Auth module registered in Amplify")];if(this._isExpired(e)||!this._isPastTTL())return[3,6];Ki.debug("ttl has passed but token is not yet expired"),r.label=1;case 1:return r.trys.push([1,5,,6]),[4,n.currentUserPoolUser()];case 2:return i=r.sent(),[4,n.currentSession()];case 3:return o=r.sent(),s=o.refreshToken,[4,new Promise((function(e,t){i.refreshSession(s,(function(n,r){return n?t(n):e(r)}))}))];case 4:return r.sent(),[3,6];case 5:return a=r.sent(),Ki.debug("Error attempting to refreshing the session",a),[3,6];case 6:return[2,n.currentUserCredentials()]}}))}))},e.prototype.refreshFederatedToken=function(e){Ki.debug("Getting federated credentials");var t=e.provider,n=e.user,r=e.token,i=e.identity_id,o=e.expires_at;o=1970===new Date(o).getFullYear()?1e3*o:o;return Ki.debug("checking if federated jwt token expired"),o>(new Date).getTime()?(Ki.debug("token not expired"),this._setCredentialsFromFederation({provider:t,token:r,user:n,identity_id:i,expires_at:o})):this._refreshHandlers[t]&&"function"==typeof this._refreshHandlers[t]?(Ki.debug("getting refreshed jwt token from federation provider"),this._providerRefreshWithRetry({refreshHandler:this._refreshHandlers[t],provider:t,user:n})):(Ki.debug("no refresh handler for provider:",t),this.clear(),Promise.reject("no refresh handler for provider"))},e.prototype._providerRefreshWithRetry=function(e){var t=this,n=e.refreshHandler,r=e.provider,i=e.user;return Object(a.c)(n,[],1e4).then((function(e){return Ki.debug("refresh federated token sucessfully",e),t._setCredentialsFromFederation({provider:r,token:e.token,user:i,identity_id:e.identity_id,expires_at:e.expires_at})})).catch((function(e){return"string"==typeof e&&0===e.toLowerCase().lastIndexOf("network error",e.length)||t.clear(),Ki.debug("refresh federated token failed",e),Promise.reject("refreshing federation token failed: "+e)}))},e.prototype._isExpired=function(e){if(!e)return Ki.debug("no credentials for expiration check"),!0;Ki.debug("are these credentials expired?",e);var t=Date.now();return e.expiration.getTime()<=t},e.prototype._isPastTTL=function(){return this._nextCredentialsRefresh<=Date.now()},e.prototype._setCredentialsForGuest=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){var e,t,n,i,o,s,a,u=this;return Object(r.__generator)(this,(function(c){switch(c.label){case 0:return Ki.debug("setting credentials for guest"),e=this._config,t=e.identityPoolId,n=e.region,e.mandatorySignIn?[2,Promise.reject("cannot get guest credentials when mandatory signin enabled")]:t?n?(o=this,[4,this._getGuestIdentityId()]):(Ki.debug("region is not configured for getting the credentials"),[2,Promise.reject("region is not configured for getting the credentials")]):(Ki.debug("No Cognito Identity pool provided for unauthenticated access"),[2,Promise.reject("No Cognito Identity pool provided for unauthenticated access")]);case 1:return i=o._identityId=c.sent(),s=new li({region:n,customUserAgent:Object(g.b)()}),a=void 0,a=i?mt({identityId:i,client:s})():function(){return Object(r.__awaiter)(u,void 0,void 0,(function(){var e;return Object(r.__generator)(this,(function(n){switch(n.label){case 0:return[4,s.send(new zi({IdentityPoolId:t}))];case 1:return e=n.sent().IdentityId,this._identityId=e,[2,mt({client:s,identityId:e})()]}}))}))}().catch((function(e){return Object(r.__awaiter)(u,void 0,void 0,(function(){return Object(r.__generator)(this,(function(t){throw e}))}))})),[2,this._loadCredentials(a,"guest",!1,null).then((function(e){return e})).catch((function(e){return Object(r.__awaiter)(u,void 0,void 0,(function(){var n=this;return Object(r.__generator)(this,(function(o){switch(o.label){case 0:return"ResourceNotFoundException"!==e.name||e.message!=="Identity '"+i+"' not found."?[3,2]:(Ki.debug("Failed to load guest credentials"),[4,this._removeGuestIdentityId()]);case 1:return o.sent(),a=function(){return Object(r.__awaiter)(n,void 0,void 0,(function(){var e;return Object(r.__generator)(this,(function(n){switch(n.label){case 0:return[4,s.send(new zi({IdentityPoolId:t}))];case 1:return e=n.sent().IdentityId,this._identityId=e,[2,mt({client:s,identityId:e})()]}}))}))}().catch((function(e){return Object(r.__awaiter)(n,void 0,void 0,(function(){return Object(r.__generator)(this,(function(t){throw e}))}))})),[2,this._loadCredentials(a,"guest",!1,null)];case 2:return[2,e]}}))}))}))]}}))}))},e.prototype._setCredentialsFromFederation=function(e){var t=e.provider,n=e.token,r=e.identity_id,i={google:"accounts.google.com",facebook:"graph.facebook.com",amazon:"www.amazon.com",developer:"cognito-identity.amazonaws.com"}[t]||t;if(!i)return Promise.reject("You must specify a federated provider");var o={};o[i]=n;var s=this._config,a=s.identityPoolId,u=s.region;if(!a)return Ki.debug("No Cognito Federated Identity pool provided"),Promise.reject("No Cognito Federated Identity pool provided");if(!u)return Ki.debug("region is not configured for getting the credentials"),Promise.reject("region is not configured for getting the credentials");var c=new li({region:u,customUserAgent:Object(g.b)()}),l=void 0;r?l=mt({identityId:r,logins:o,client:c})():l=St({logins:o,identityPoolId:a,client:c})();return this._loadCredentials(l,"federated",!0,e)},e.prototype._setCredentialsFromSession=function(e){var t=this;Ki.debug("set credentials from session");var n=e.getIdToken().getJwtToken(),i=this._config,o=i.region,s=i.userPoolId,a=i.identityPoolId;if(!a)return Ki.debug("No Cognito Federated Identity pool provided"),Promise.reject("No Cognito Federated Identity pool provided");if(!o)return Ki.debug("region is not configured for getting the credentials"),Promise.reject("region is not configured for getting the credentials");var u={};u["cognito-idp."+o+".amazonaws.com/"+s]=n;var c=new li({region:o,customUserAgent:Object(g.b)()}),l=Object(r.__awaiter)(t,void 0,void 0,(function(){var e,t,n,i,o,s,l,f,d,h;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:return[4,this._getGuestIdentityId()];case 1:return(e=r.sent())?[3,3]:[4,c.send(new zi({IdentityPoolId:a,Logins:u}))];case 2:n=r.sent().IdentityId,t=n,r.label=3;case 3:return[4,c.send(new Vi({IdentityId:e||t,Logins:u}))];case 4:return i=r.sent(),o=i.Credentials,s=o.AccessKeyId,l=o.Expiration,f=o.SecretKey,d=o.SessionToken,h=i.IdentityId,this._identityId=h,e?(Ki.debug("The guest identity "+e+" has been successfully linked to the logins"),e===h&&Ki.debug("The guest identity "+e+" has become the primary identity"),[4,this._removeGuestIdentityId()]):[3,6];case 5:r.sent(),r.label=6;case 6:return[2,{accessKeyId:s,secretAccessKey:f,sessionToken:d,expiration:l,identityId:h}]}}))})).catch((function(e){return Object(r.__awaiter)(t,void 0,void 0,(function(){return Object(r.__generator)(this,(function(t){throw e}))}))}));return this._loadCredentials(l,"userPool",!0,null)},e.prototype._loadCredentials=function(e,t,n,i){var o=this,s=this;return new Promise((function(a,u){e.then((function(e){return Object(r.__awaiter)(o,void 0,void 0,(function(){var o,u,c,l,f;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:if(Ki.debug("Load credentials successfully",e),this._identityId&&!e.identityId&&(e.identityId=this._identityId),s._credentials=e,s._credentials.authenticated=n,s._credentials_source=t,s._nextCredentialsRefresh=(new Date).getTime()+3e6,"federated"===t){o=Object.assign({id:this._credentials.identityId},i.user),u=i.provider,c=i.token,l=i.expires_at,f=i.identity_id;try{this._storage.setItem("aws-amplify-federatedInfo",JSON.stringify({provider:u,token:c,user:o,expires_at:l,identity_id:f}))}catch(e){Ki.debug("Failed to put federated info into auth storage",e)}}return"guest"!==t?[3,2]:[4,this._setGuestIdentityId(e.identityId)];case 1:r.sent(),r.label=2;case 2:return a(s._credentials),[2]}}))}))})).catch((function(t){if(t)return Ki.debug("Failed to load credentials",e),Ki.debug("Error loading credentials",t),void u(t)}))}))},e.prototype.set=function(e,t){return"session"===t?this._setCredentialsFromSession(e):"federation"===t?this._setCredentialsFromFederation(e):"guest"===t?this._setCredentialsForGuest():(Ki.debug("no source specified for setting credentials"),Promise.reject("invalid source"))},e.prototype.clear=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(e){return this._credentials=null,this._credentials_source=null,Ki.debug("removing aws-amplify-federatedInfo from storage"),this._storage.removeItem("aws-amplify-federatedInfo"),[2]}))}))},e.prototype._getGuestIdentityId=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){var e,t;return Object(r.__generator)(this,(function(n){switch(n.label){case 0:e=this._config.identityPoolId,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._storageSync];case 2:return n.sent(),[2,this._storage.getItem(this._getCognitoIdentityIdStorageKey(e))];case 3:return t=n.sent(),Ki.debug("Failed to get the cached guest identityId",t),[3,4];case 4:return[2]}}))}))},e.prototype._setGuestIdentityId=function(e){return Object(r.__awaiter)(this,void 0,void 0,(function(){var t,n;return Object(r.__generator)(this,(function(r){switch(r.label){case 0:t=this._config.identityPoolId,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._storageSync];case 2:return r.sent(),this._storage.setItem(this._getCognitoIdentityIdStorageKey(t),e),[3,4];case 3:return n=r.sent(),Ki.debug("Failed to cache guest identityId",n),[3,4];case 4:return[2]}}))}))},e.prototype._removeGuestIdentityId=function(){return Object(r.__awaiter)(this,void 0,void 0,(function(){var e;return Object(r.__generator)(this,(function(t){return e=this._config.identityPoolId,Ki.debug("removing "+this._getCognitoIdentityIdStorageKey(e)+" from storage"),this._storage.removeItem(this._getCognitoIdentityIdStorageKey(e)),[2]}))}))},e.prototype.shear=function(e){return{accessKeyId:e.accessKeyId,sessionToken:e.sessionToken,secretAccessKey:e.secretAccessKey,identityId:e.identityId,authenticated:e.authenticated}},e}())(null);y.a.register(Gi)}])}));
65
+ t.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,l=-7,f=n?i-1:0,d=n?-1:1,h=e[t+f];for(f+=d,o=h&(1<<-l)-1,h>>=-l,l+=a;l>0;o=256*o+e[t+f],f+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+e[t+f],f+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,r),o-=c}return(h?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,u,c=8*o-i-1,l=(1<<c)-1,f=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,p=r?1:-1,v=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*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+f>=1?d/u:d*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*u-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[n+h]=255&a,h+=p,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[n+h]=255&s,h+=p,s/=256,c-=8);e[n+h-p]|=128*v}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t){},function(e,t){},function(e,t,n){var r,i,o,s;e.exports=(r=n(12),o=(i=r).lib.Base,s=i.enc.Utf8,void(i.algo.HMAC=o.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var n=e.blockSize,r=4*n;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),o=this._iKey=t.clone(),a=i.words,u=o.words,c=0;c<n;c++)a[c]^=1549556828,u[c]^=909522486;i.sigBytes=o.sigBytes=r,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(n))}})))},function(e,t){},function(e,t,n){e.exports=self.fetch||(self.fetch=n(46).default||n(46))},function(e,t,n){e.exports=n(93).Observable},function(e,t,n){"use strict";(function(e){!function(e,t){function n(e){return"function"==typeof Symbol&&Boolean(Symbol[e])}function r(e){return n(e)?Symbol[e]:"@@"+e}function i(e){setTimeout((function(){throw e}))}function o(e,t){var n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function s(e){var t=e.constructor;return void 0!==t&&null===(t=t[r("species")])&&(t=void 0),void 0!==t?t:d}function a(e,t){Object.keys(t).forEach((function(n){var r=Object.getOwnPropertyDescriptor(t,n);r.enumerable=!1,Object.defineProperty(e,n,r)}))}function u(e){var t=e._cleanup;if(t){e._cleanup=void 0;try{t()}catch(e){i(e)}}}function c(e){return void 0===e._observer}function l(e,t){if(Object(e)!==e)throw new TypeError("Observer must be an object");this._cleanup=void 0,this._observer=e;try{var n=o(e,"start");n&&n.call(e,this)}catch(e){i(e)}if(!c(this)){e=new f(this);try{var r=t.call(void 0,e);if(null!=r){if("function"==typeof r.unsubscribe)s=r,r=function(){s.unsubscribe()};else if("function"!=typeof r)throw new TypeError(r+" is not a function");this._cleanup=r}}catch(t){return void e.error(t)}var s;c(this)&&u(this)}}function f(e){this._subscription=e}function d(e){if(!(this instanceof d))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}"function"!=typeof Symbol||Symbol.observable||(Symbol.observable=Symbol("observable")),a(l.prototype={},{get closed(){return c(this)},unsubscribe:function(){var e;c(e=this)||(e._observer=void 0,u(e))}}),a(f.prototype={},{get closed(){return c(this._subscription)},next:function(e){var t=this._subscription;if(!c(t)){var n=t._observer;try{var r=o(n,"next");r&&r.call(n,e)}catch(e){i(e)}}},error:function(e){var t=this._subscription;if(c(t))i(e);else{var n=t._observer;t._observer=void 0;try{var r=o(n,"error");if(!r)throw e;r.call(n,e)}catch(e){i(e)}u(t)}},complete:function(){var e=this._subscription;if(!c(e)){var t=e._observer;e._observer=void 0;try{var n=o(t,"complete");n&&n.call(t)}catch(e){i(e)}u(e)}}}),a(d.prototype,{subscribe:function(e){for(var t=[],n=1;n<arguments.length;++n)t.push(arguments[n]);return"function"==typeof e?e={next:e,error:t[0],complete:t[1]}:"object"==typeof e&&null!==e||(e={}),new l(e,this._subscriber)},forEach:function(e){var t=this;return new Promise((function(n,r){if("function"!=typeof e)return Promise.reject(new TypeError(e+" is not a function"));t.subscribe({_subscription:null,start:function(e){if(Object(e)!==e)throw new TypeError(e+" is not an object");this._subscription=e},next:function(t){var n=this._subscription;if(!n.closed)try{e(t)}catch(e){r(e),n.unsubscribe()}},error:r,complete:n})}))},map:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(s(this))((function(n){return t.subscribe({next:function(t){if(!n.closed){try{t=e(t)}catch(e){return n.error(e)}n.next(t)}},error:function(e){n.error(e)},complete:function(){n.complete()}})}))},filter:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(s(this))((function(n){return t.subscribe({next:function(t){if(!n.closed){try{if(!e(t))return}catch(e){return n.error(e)}n.next(t)}},error:function(e){n.error(e)},complete:function(){n.complete()}})}))},reduce:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=s(this),r=arguments.length>1,i=!1,o=arguments[1],a=o;return new n((function(n){return t.subscribe({next:function(t){if(!n.closed){var o=!i;if(i=!0,!o||r)try{a=e(a,t)}catch(e){return n.error(e)}else a=t}},error:function(e){n.error(e)},complete:function(){if(!i&&!r)return n.error(new TypeError("Cannot reduce an empty sequence"));n.next(a),n.complete()}})}))}}),Object.defineProperty(d.prototype,r("observable"),{value:function(){return this},writable:!0,configurable:!0}),a(d,{from:function(e){var t="function"==typeof this?this:d;if(null==e)throw new TypeError(e+" is not an object");var i=o(e,r("observable"));if(i){var s=i.call(e);if(Object(s)!==s)throw new TypeError(s+" is not an object");return s.constructor===t?s:new t((function(e){return s.subscribe(e)}))}if(n("iterator")&&(i=o(e,r("iterator"))))return new t((function(t){for(var n,r=i.call(e)[Symbol.iterator]();!(n=r.next()).done;){var o=n.value;if(t.next(o),t.closed)return}t.complete()}));if(Array.isArray(e))return new t((function(t){for(var n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}));throw new TypeError(e+" is not observable")},of:function(){for(var e=[],t=0;t<arguments.length;++t)e.push(arguments[t]);var n="function"==typeof this?this:d;return new n((function(t){for(var n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}))}}),Object.defineProperty(d,r("species"),{get:function(){return this},configurable:!0}),Object.defineProperty(d,"extensions",{value:{observableSymbol:r("observable"),setHostReportError:function(e){i=e}}}),e.Observable=d}(t)}).call(this,n(48)(e))},function(e,t,n){(function(e,r){var i;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(o){t&&t.nodeType,e&&e.nodeType;var s="object"==typeof r&&r;s.global!==s&&s.window!==s&&s.self;var a,u=2147483647,c=/^xn--/,l=/[^\x20-\x7E]/,f=/[\x2E\u3002\uFF0E\uFF61]/g,d={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},h=Math.floor,p=String.fromCharCode;function v(e){throw new RangeError(d[e])}function y(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function g(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+y((e=e.replace(f,".")).split("."),t).join(".")}function m(e){for(var t,n,r=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(n=e.charCodeAt(i++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),i--):r.push(t);return r}function b(e){return y(e,(function(e){var t="";return e>65535&&(t+=p((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=p(e)})).join("")}function w(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function S(e,t,n){var r=0;for(e=n?h(e/700):e>>1,e+=h(e/t);e>455;r+=36)e=h(e/35);return h(r+36*e/(e+38))}function _(e){var t,n,r,i,o,s,a,c,l,f,d,p=[],y=e.length,g=0,m=128,w=72;for((n=e.lastIndexOf("-"))<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&v("not-basic"),p.push(e.charCodeAt(r));for(i=n>0?n+1:0;i<y;){for(o=g,s=1,a=36;i>=y&&v("invalid-input"),((c=(d=e.charCodeAt(i++))-48<10?d-22:d-65<26?d-65:d-97<26?d-97:36)>=36||c>h((u-g)/s))&&v("overflow"),g+=c*s,!(c<(l=a<=w?1:a>=w+26?26:a-w));a+=36)s>h(u/(f=36-l))&&v("overflow"),s*=f;w=S(g-o,t=p.length+1,0==o),h(g/t)>u-m&&v("overflow"),m+=h(g/t),g%=t,p.splice(g++,0,m)}return b(p)}function E(e){var t,n,r,i,o,s,a,c,l,f,d,y,g,b,_,E=[];for(y=(e=m(e)).length,t=128,n=0,o=72,s=0;s<y;++s)(d=e[s])<128&&E.push(p(d));for(r=i=E.length,i&&E.push("-");r<y;){for(a=u,s=0;s<y;++s)(d=e[s])>=t&&d<a&&(a=d);for(a-t>h((u-n)/(g=r+1))&&v("overflow"),n+=(a-t)*g,t=a,s=0;s<y;++s)if((d=e[s])<t&&++n>u&&v("overflow"),d==t){for(c=n,l=36;!(c<(f=l<=o?1:l>=o+26?26:l-o));l+=36)_=c-f,b=36-f,E.push(p(w(f+_%b,0))),c=h(_/b);E.push(p(w(c,0))),o=S(n,g,r==i),n=0,++r}++n,++t}return E.join("")}a={version:"1.4.1",ucs2:{decode:m,encode:b},decode:_,encode:E,toASCII:function(e){return g(e,(function(e){return l.test(e)?"xn--"+E(e):e}))},toUnicode:function(e){return g(e,(function(e){return c.test(e)?_(e.slice(4).toLowerCase()):e}))}},void 0===(i=function(){return a}.call(t,n,t,e))||(e.exports=i)}()}).call(this,n(48)(e),n(27))},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";t.decode=t.parse=n(97),t.encode=t.stringify=n(98)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,o){t=t||"&",n=n||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var l=0;l<c;++l){var f,d,h,p,v=e[l].replace(a,"%20"),y=v.indexOf(n);y>=0?(f=v.substr(0,y),d=v.substr(y+1)):(f=v,d=""),h=decodeURIComponent(f),p=decodeURIComponent(d),r(s,h)?i(s[h])?s[h].push(p):s[h]=[s[h],p]:s[h]=p}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,a){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),(function(s){var a=encodeURIComponent(r(s))+n;return i(e[s])?o(e[s],(function(e){return a+encodeURIComponent(r(e))})).join(t):a+encodeURIComponent(r(e[s]))})).join(t):a?encodeURIComponent(r(a))+n+encodeURIComponent(r(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var s=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}},function(e,t,n){var r,i,o=n(50),s=n(51),a=0,u=0;e.exports=function(e,t,n){var c=t&&n||0,l=t||[],f=(e=e||{}).node||r,d=void 0!==e.clockseq?e.clockseq:i;if(null==f||null==d){var h=o();null==f&&(f=r=[1|h[0],h[1],h[2],h[3],h[4],h[5]]),null==d&&(d=i=16383&(h[6]<<8|h[7]))}var p=void 0!==e.msecs?e.msecs:(new Date).getTime(),v=void 0!==e.nsecs?e.nsecs:u+1,y=p-a+(v-u)/1e4;if(y<0&&void 0===e.clockseq&&(d=d+1&16383),(y<0||p>a)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=p,u=v,i=d;var g=(1e4*(268435455&(p+=122192928e5))+v)%4294967296;l[c++]=g>>>24&255,l[c++]=g>>>16&255,l[c++]=g>>>8&255,l[c++]=255&g;var m=p/4294967296*1e4&268435455;l[c++]=m>>>8&255,l[c++]=255&m,l[c++]=m>>>24&15|16,l[c++]=m>>>16&255,l[c++]=d>>>8|128,l[c++]=255&d;for(var b=0;b<6;++b)l[c+b]=f[b];return t||s(l)}},function(e,t,n){var r=n(50),i=n(51);e.exports=function(e,t,n){var o=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[o+a]=s[a];return t||i(s)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(52),i=n(54),o=n(107),s=n(110),a=n(112),u=n(37),c=function(){function e(e){(0,s.supportsWebCrypto)((0,u.locateWindow)())?this.hash=new i.Sha256(e):(0,a.isMsWindow)((0,u.locateWindow)())?this.hash=new r.Sha256(e):this.hash=new o.Sha256(e)}return e.prototype.update=function(e,t){this.hash.update(e,t)},e.prototype.digest=function(){return this.hash.digest()},e}();t.Sha256=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyData=void 0,t.isEmptyData=function(e){return"string"==typeof e?0===e.length:0===e.byteLength}},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.convertToBuffer=void 0;var r=n(141),i=void 0!==e&&e.from?function(t){return e.from(t,"utf8")}:r.fromUtf8;t.convertToBuffer=function(e){return e instanceof Uint8Array?e:"string"==typeof e?i(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}}).call(this,n(6).Buffer)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyData=void 0,t.isEmptyData=function(e){return"string"==typeof e?0===e.length:0===e.byteLength}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.numToUint8=void 0,t.numToUint8=function(e){return new Uint8Array([(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e])}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=void 0,t.uint32ArrayFrom=function(e){if(!Array.from){for(var t=new Uint32Array(e.length);0<e.length;)t[0]=e[0];return t}return Uint32Array.from(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),(0,n(0).__exportStar)(n(108),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(0),i=n(56),o=n(109),s=n(55),a=function(){function e(e){if(this.hash=new o.RawSha256,e){this.outer=new o.RawSha256;var t=function(e){var t=(0,s.convertToBuffer)(e);if(t.byteLength>i.BLOCK_SIZE){var n=new o.RawSha256;n.update(t),t=n.digest()}var r=new Uint8Array(i.BLOCK_SIZE);return r.set(t),r}(e),n=new Uint8Array(i.BLOCK_SIZE);n.set(t);for(var r=0;r<i.BLOCK_SIZE;r++)t[r]^=54,n[r]^=92;this.hash.update(t),this.outer.update(n);for(r=0;r<t.byteLength;r++)t[r]=0}}return e.prototype.update=function(e){if(!(0,s.isEmptyData)(e)&&!this.error)try{this.hash.update((0,s.convertToBuffer)(e))}catch(e){this.error=e}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return(0,r.__awaiter)(this,void 0,void 0,(function(){return(0,r.__generator)(this,(function(e){return[2,this.digestSync()]}))}))},e}();t.Sha256=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RawSha256=void 0;var r=n(56),i=function(){function e(){this.state=Int32Array.from(r.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,n=e.byteLength;if(this.bytesHashed+=n,8*this.bytesHashed>r.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[t++],n--,this.bufferLength===r.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(t.setUint8(this.bufferLength++,128),n%r.BLOCK_SIZE>=r.BLOCK_SIZE-8){for(var i=this.bufferLength;i<r.BLOCK_SIZE;i++)t.setUint8(i,0);this.hashBuffer(),this.bufferLength=0}for(i=this.bufferLength;i<r.BLOCK_SIZE-8;i++)t.setUint8(i,0);t.setUint32(r.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),t.setUint32(r.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}var o=new Uint8Array(r.DIGEST_LENGTH);for(i=0;i<8;i++)o[4*i]=this.state[i]>>>24&255,o[4*i+1]=this.state[i]>>>16&255,o[4*i+2]=this.state[i]>>>8&255,o[4*i+3]=this.state[i]>>>0&255;return o},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],u=t[5],c=t[6],l=t[7],f=0;f<r.BLOCK_SIZE;f++){if(f<16)this.temp[f]=(255&e[4*f])<<24|(255&e[4*f+1])<<16|(255&e[4*f+2])<<8|255&e[4*f+3];else{var d=this.temp[f-2],h=(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,p=((d=this.temp[f-15])>>>7|d<<25)^(d>>>18|d<<14)^d>>>3;this.temp[f]=(h+this.temp[f-7]|0)+(p+this.temp[f-16]|0)}var v=(((a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7))+(a&u^~a&c)|0)+(l+(r.KEY[f]+this.temp[f]|0)|0)|0,y=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&i^n&o^i&o)|0;l=c,c=u,u=a,a=s+v|0,s=o,o=i,i=n,n=v+y|0}t[0]+=n,t[1]+=i,t[2]+=o,t[3]+=s,t[4]+=a,t[5]+=u,t[6]+=c,t[7]+=l},e}();t.RawSha256=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(0).__exportStar(n(111),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.supportsZeroByteGCM=t.supportsSubtleCrypto=t.supportsSecureRandom=t.supportsWebCrypto=void 0;var r=n(0),i=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function o(e){return"object"==typeof e&&"object"==typeof e.crypto&&"function"==typeof e.crypto.getRandomValues}function s(e){return e&&i.every((function(t){return"function"==typeof e[t]}))}t.supportsWebCrypto=function(e){return!(!o(e)||"object"!=typeof e.crypto.subtle)&&s(e.crypto.subtle)},t.supportsSecureRandom=o,t.supportsSubtleCrypto=s,t.supportsZeroByteGCM=function(e){return r.__awaiter(this,void 0,void 0,(function(){var t;return r.__generator(this,(function(n){switch(n.label){case 0:if(!s(e))return[2,!1];n.label=1;case 1:return n.trys.push([1,4,,5]),[4,e.generateKey({name:"AES-GCM",length:128},!1,["encrypt"])];case 2:return t=n.sent(),[4,e.encrypt({name:"AES-GCM",iv:new Uint8Array(Array(12)),additionalData:new Uint8Array(Array(16)),tagLength:128},t,new Uint8Array(0))];case 3:return[2,16===n.sent().byteLength];case 4:return n.sent(),[2,!1];case 5:return[2]}}))}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0);r.__exportStar(n(113),t),r.__exportStar(n(114),t),r.__exportStar(n(115),t),r.__exportStar(n(116),t),r.__exportStar(n(117),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isMsWindow=void 0;var r=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];t.isMsWindow=function(e){if(function(e){return"MSInputMethodContext"in e&&"msCrypto"in e}(e)&&void 0!==e.msCrypto.subtle){var t=e.msCrypto,n=t.getRandomValues,i=t.subtle;return r.map((function(e){return i[e]})).concat(n).every((function(e){return"function"==typeof e}))}return!1}},function(e,t){},function(e,t,n){"use strict";var r=n(13),i=n(58),o=n(120),s=n(64);var a=function e(t){var n=new o(t),a=i(o.prototype.request,n);return r.extend(a,o.prototype,n),r.extend(a,n),a.create=function(n){return e(s(t,n))},a}(n(29));a.Axios=o,a.Cancel=n(30),a.CancelToken=n(133),a.isCancel=n(63),a.VERSION=n(65).version,a.all=function(e){return Promise.all(e)},a.spread=n(134),a.isAxiosError=n(135),e.exports=a,e.exports.default=a},function(e,t,n){"use strict";var r=n(13),i=n(59),o=n(121),s=n(122),a=n(64),u=n(132),c=u.validators;function l(e){this.defaults=e,this.interceptors={request:new o,response:new o}}l.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=a(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var n=t.transitional;void 0!==n&&u.assertOptions(n,{silentJSONParsing:c.transitional(c.boolean),forcedJSONParsing:c.transitional(c.boolean),clarifyTimeoutError:c.transitional(c.boolean)},!1);var r=[],i=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(i=i&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));var o,l=[];if(this.interceptors.response.forEach((function(e){l.push(e.fulfilled,e.rejected)})),!i){var f=[s,void 0];for(Array.prototype.unshift.apply(f,r),f=f.concat(l),o=Promise.resolve(t);f.length;)o=o.then(f.shift(),f.shift());return o}for(var d=t;r.length;){var h=r.shift(),p=r.shift();try{d=h(d)}catch(e){p(e);break}}try{o=s(d)}catch(e){return Promise.reject(e)}for(;l.length;)o=o.then(l.shift(),l.shift());return o},l.prototype.getUri=function(e){return e=a(this.defaults,e),i(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],(function(e){l.prototype[e]=function(t,n){return this.request(a(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(e){l.prototype[e]=function(t,n,r){return this.request(a(r||{},{method:e,url:t,data:n}))}})),e.exports=l},function(e,t,n){"use strict";var r=n(13);function i(){this.handlers=[]}i.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){r.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=i},function(e,t,n){"use strict";var r=n(13),i=n(123),o=n(63),s=n(29),a=n(30);function u(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new a("canceled")}e.exports=function(e){return u(e),e.headers=e.headers||{},e.data=i.call(e,e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||s.adapter)(e).then((function(t){return u(e),t.data=i.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(u(e),t&&t.response&&(t.response.data=i.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,n){"use strict";var r=n(13),i=n(29);e.exports=function(e,t,n){var o=this||i;return r.forEach(n,(function(n){e=n.call(o,e,t)})),e}},function(e,t,n){"use strict";var r=n(13);e.exports=function(e,t){r.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))}},function(e,t,n){"use strict";var r=n(62);e.exports=function(e,t,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},function(e,t,n){"use strict";var r=n(13);e.exports=r.isStandardBrowserEnv()?{write:function(e,t,n,i,o,s){var a=[];a.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(i)&&a.push("path="+i),r.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,n){"use strict";var r=n(128),i=n(129);e.exports=function(e,t){return e&&!r(t)?i(e,t):t}},function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}},function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";var r=n(13),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,o,s={};return e?(r.forEach(e.split("\n"),(function(e){if(o=e.indexOf(":"),t=r.trim(e.substr(0,o)).toLowerCase(),n=r.trim(e.substr(o+1)),t){if(s[t]&&i.indexOf(t)>=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([n]):s[t]?s[t]+", "+n:n}})),s):s}},function(e,t,n){"use strict";var r=n(13);e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=i(window.location.href),function(t){var n=r.isString(t)?i(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},function(e,t,n){"use strict";var r=n(65).version,i={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){i[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var o={};i.transitional=function(e,t,n){function i(e,t){return"[Axios v"+r+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,r,s){if(!1===e)throw new Error(i(r," has been removed"+(t?" in "+t:"")));return t&&!o[r]&&(o[r]=!0,console.warn(i(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,s)}},e.exports={assertOptions:function(e,t,n){if("object"!=typeof e)throw new TypeError("options must be an object");for(var r=Object.keys(e),i=r.length;i-- >0;){var o=r[i],s=t[o];if(s){var a=e[o],u=void 0===a||s(a,o,e);if(!0!==u)throw new TypeError("option "+o+" must be "+u)}else if(!0!==n)throw Error("Unknown option "+o)}},validators:i}},function(e,t,n){"use strict";var r=n(30);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;this.promise.then((function(e){if(n._listeners){var t,r=n._listeners.length;for(t=0;t<r;t++)n._listeners[t](e);n._listeners=null}})),this.promise.then=function(e){var t,r=new Promise((function(e){n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},i.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},i.source=function(){var e;return{token:new i((function(t){e=t})),cancel:e}},e.exports=i},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,n){"use strict";var r=n(13);e.exports=function(e){return r.isObject(e)&&!0===e.isAxiosError}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(66),o=n(137),s=n(140),a=function(){function e(e){if(this.hash=new o.RawSha256,e){this.outer=new o.RawSha256;var t=function(e){var t=u(e);if(t.byteLength>i.BLOCK_SIZE){var n=new o.RawSha256;n.update(t),t=n.digest()}var r=new Uint8Array(i.BLOCK_SIZE);return r.set(t),r}(e),n=new Uint8Array(i.BLOCK_SIZE);n.set(t);for(var r=0;r<i.BLOCK_SIZE;r++)t[r]^=54,n[r]^=92;this.hash.update(t),this.outer.update(n);for(r=0;r<t.byteLength;r++)t[r]=0}}return e.prototype.update=function(e){if(!function(e){if("string"==typeof e)return 0===e.length;return 0===e.byteLength}(e)&&!this.error)try{this.hash.update(u(e))}catch(e){this.error=e}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return r.__awaiter(this,void 0,void 0,(function(){return r.__generator(this,(function(e){return[2,this.digestSync()]}))}))},e}();function u(e){return"string"==typeof e?s.fromUtf8(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.Sha256=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(66),i=function(){function e(){this.state=Int32Array.from(r.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,n=e.byteLength;if(this.bytesHashed+=n,8*this.bytesHashed>r.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[t++],n--,this.bufferLength===r.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(t.setUint8(this.bufferLength++,128),n%r.BLOCK_SIZE>=r.BLOCK_SIZE-8){for(var i=this.bufferLength;i<r.BLOCK_SIZE;i++)t.setUint8(i,0);this.hashBuffer(),this.bufferLength=0}for(i=this.bufferLength;i<r.BLOCK_SIZE-8;i++)t.setUint8(i,0);t.setUint32(r.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),t.setUint32(r.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}var o=new Uint8Array(r.DIGEST_LENGTH);for(i=0;i<8;i++)o[4*i]=this.state[i]>>>24&255,o[4*i+1]=this.state[i]>>>16&255,o[4*i+2]=this.state[i]>>>8&255,o[4*i+3]=this.state[i]>>>0&255;return o},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],u=t[5],c=t[6],l=t[7],f=0;f<r.BLOCK_SIZE;f++){if(f<16)this.temp[f]=(255&e[4*f])<<24|(255&e[4*f+1])<<16|(255&e[4*f+2])<<8|255&e[4*f+3];else{var d=this.temp[f-2],h=(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,p=((d=this.temp[f-15])>>>7|d<<25)^(d>>>18|d<<14)^d>>>3;this.temp[f]=(h+this.temp[f-7]|0)+(p+this.temp[f-16]|0)}var v=(((a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7))+(a&u^~a&c)|0)+(l+(r.KEY[f]+this.temp[f]|0)|0)|0,y=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&i^n&o^i&o)|0;l=c,c=u,u=a,a=s+v|0,s=o,o=i,i=n,n=v+y|0}t[0]+=n,t[1]+=i,t[2]+=o,t[3]+=s,t[4]+=a,t[5]+=u,t[6]+=c,t[7]+=l},e}();t.RawSha256=i},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}Object.defineProperty(t,"__esModule",{value:!0}),t.Observable=void 0;var s=function(){return"function"==typeof Symbol},a=function(e){return s()&&Boolean(Symbol[e])},u=function(e){return a(e)?Symbol[e]:"@@"+e};s()&&!a("observable")&&(Symbol.observable=Symbol("observable"));var c=u("iterator"),l=u("observable"),f=u("species");function d(e,t){var n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function h(e){var t=e.constructor;return void 0!==t&&null===(t=t[f])&&(t=void 0),void 0!==t?t:E}function p(e){return e instanceof E}function v(e){v.log?v.log(e):setTimeout((function(){throw e}))}function y(e){Promise.resolve().then((function(){try{e()}catch(e){v(e)}}))}function g(e){var t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{var n=d(t,"unsubscribe");n&&n.call(t)}}catch(e){v(e)}}function m(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function b(e,t,n){e._state="running";var r=e._observer;try{var i=d(r,t);switch(t){case"next":i&&i.call(r,n);break;case"error":if(m(e),!i)throw n;i.call(r,n);break;case"complete":m(e),i&&i.call(r)}}catch(e){v(e)}"closed"===e._state?g(e):"running"===e._state&&(e._state="ready")}function w(e,t,n){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:n}],void y((function(){return function(e){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var n=0;n<t.length&&(b(e,t[n].type,t[n].value),"closed"!==e._state);++n);}}(e)}))):void b(e,t,n);e._queue.push({type:t,value:n})}}var S=function(){function e(t,n){r(this,e),this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var i=new _(this);try{this._cleanup=n.call(void 0,i)}catch(e){i.error(e)}"initializing"===this._state&&(this._state="ready")}return o(e,[{key:"unsubscribe",value:function(){"closed"!==this._state&&(m(this),g(this))}},{key:"closed",get:function(){return"closed"===this._state}}]),e}(),_=function(){function e(t){r(this,e),this._subscription=t}return o(e,[{key:"next",value:function(e){w(this._subscription,"next",e)}},{key:"error",value:function(e){w(this._subscription,"error",e)}},{key:"complete",value:function(){w(this._subscription,"complete")}},{key:"closed",get:function(){return"closed"===this._subscription._state}}]),e}(),E=function(){function e(t){if(r(this,e),!(this instanceof e))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof t)throw new TypeError("Observable initializer must be a function");this._subscriber=t}return o(e,[{key:"subscribe",value:function(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new S(e,this._subscriber)}},{key:"forEach",value:function(e){var t=this;return new Promise((function(n,r){if("function"==typeof e)var i=t.subscribe({next:function(t){try{e(t,o)}catch(e){r(e),i.unsubscribe()}},error:r,complete:n});else r(new TypeError(e+" is not a function"));function o(){i.unsubscribe(),n()}}))}},{key:"map",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(h(this))((function(n){return t.subscribe({next:function(t){try{t=e(t)}catch(e){return n.error(e)}n.next(t)},error:function(e){n.error(e)},complete:function(){n.complete()}})}))}},{key:"filter",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(h(this))((function(n){return t.subscribe({next:function(t){try{if(!e(t))return}catch(e){return n.error(e)}n.next(t)},error:function(e){n.error(e)},complete:function(){n.complete()}})}))}},{key:"reduce",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=h(this),r=arguments.length>1,i=!1,o=arguments[1],s=o;return new n((function(n){return t.subscribe({next:function(t){var o=!i;if(i=!0,!o||r)try{s=e(s,t)}catch(e){return n.error(e)}else s=t},error:function(e){n.error(e)},complete:function(){if(!i&&!r)return n.error(new TypeError("Cannot reduce an empty sequence"));n.next(s),n.complete()}})}))}},{key:"concat",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=h(this);return new i((function(t){var r,o=0;return function e(s){r=s.subscribe({next:function(e){t.next(e)},error:function(e){t.error(e)},complete:function(){o===n.length?(r=void 0,t.complete()):e(i.from(n[o++]))}})}(e),function(){r&&(r.unsubscribe(),r=void 0)}}))}},{key:"flatMap",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=h(this);return new n((function(r){var i=[],o=t.subscribe({next:function(t){if(e)try{t=e(t)}catch(e){return r.error(e)}var o=n.from(t).subscribe({next:function(e){r.next(e)},error:function(e){r.error(e)},complete:function(){var e=i.indexOf(o);e>=0&&i.splice(e,1),s()}});i.push(o)},error:function(e){r.error(e)},complete:function(){s()}});function s(){o.closed&&0===i.length&&r.complete()}return function(){i.forEach((function(e){return e.unsubscribe()})),o.unsubscribe()}}))}},{key:l,value:function(){return this}}],[{key:"from",value:function(t){var n="function"==typeof this?this:e;if(null==t)throw new TypeError(t+" is not an object");var r=d(t,l);if(r){var i=r.call(t);if(Object(i)!==i)throw new TypeError(i+" is not an object");return p(i)&&i.constructor===n?i:new n((function(e){return i.subscribe(e)}))}if(a("iterator")&&(r=d(t,c)))return new n((function(e){y((function(){if(!e.closed){var n=!0,i=!1,o=void 0;try{for(var s,a=r.call(t)[Symbol.iterator]();!(n=(s=a.next()).done);n=!0){var u=s.value;if(e.next(u),e.closed)return}}catch(e){i=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(i)throw o}}e.complete()}}))}));if(Array.isArray(t))return new n((function(e){y((function(){if(!e.closed){for(var n=0;n<t.length;++n)if(e.next(t[n]),e.closed)return;e.complete()}}))}));throw new TypeError(t+" is not observable")}},{key:"of",value:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i="function"==typeof this?this:e;return new i((function(e){y((function(){if(!e.closed){for(var t=0;t<n.length;++t)if(e.next(n[t]),e.closed)return;e.complete()}}))}))}},{key:f,get:function(){return this}}]),e}();t.Observable=E,s()&&Object.defineProperty(E,Symbol("extensions"),{value:{symbol:l,hostReportError:v},configurable:!0})},function(e,t,n){"use strict";n.r(t),n.d(t,"DataStore",(function(){return dn})),n.d(t,"DataStoreClass",(function(){return fn})),n.d(t,"initSchema",(function(){return Gt})),n.d(t,"Predicates",(function(){return A.b})),n.d(t,"ModelPredicateCreator",(function(){return A.a})),n.d(t,"ModelSortPredicateCreator",(function(){return O.a})),n.d(t,"utils",(function(){return hn})),n.d(t,"isSchemaModel",(function(){return v.w})),n.d(t,"isAssociatedWith",(function(){return v.l})),n.d(t,"isTargetNameAssociation",(function(){return v.x})),n.d(t,"isModelAttributeAuth",(function(){return v.o})),n.d(t,"isModelAttributeKey",(function(){return v.q})),n.d(t,"isModelAttributePrimaryKey",(function(){return v.r})),n.d(t,"isModelAttributeCompositeKey",(function(){return v.p})),n.d(t,"ModelAttributeAuthAllow",(function(){return v.e})),n.d(t,"ModelAttributeAuthProvider",(function(){return v.f})),n.d(t,"GraphQLScalarType",(function(){return v.c})),n.d(t,"isGraphQLScalarType",(function(){return v.n})),n.d(t,"isModelFieldType",(function(){return v.s})),n.d(t,"isNonModelFieldType",(function(){return v.t})),n.d(t,"isEnumFieldType",(function(){return v.m})),n.d(t,"OpType",(function(){return v.h})),n.d(t,"isPredicateObj",(function(){return v.v})),n.d(t,"isPredicateGroup",(function(){return v.u})),n.d(t,"QueryOne",(function(){return v.j})),n.d(t,"SortDirection",(function(){return v.k})),n.d(t,"AuthModeStrategyType",(function(){return v.a})),n.d(t,"ModelOperation",(function(){return v.g})),n.d(t,"syncExpression",(function(){return v.y})),n.d(t,"ProcessName",(function(){return v.i})),n.d(t,"DISCARD",(function(){return v.b})),n.d(t,"LimitTimerRaceResolvedValues",(function(){return v.d}));var r=n(18),i=n(21),o=n(16),s=n(77),a=n(39),u=n(32),c=n(19),l=n(15),f=n(31),d=n(10),h=n(17),p=n(3),v=n(1),y=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},g=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},m=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},b=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(m(arguments[t]));return e};function w(e){return"private"!==e.allow||e.provider?"public"!==e.allow||e.provider?e.provider:v.f.API_KEY:v.f.USER_POOLS}function S(e){var t=e.rules,n=e.currentUser,r=new Set;return t.forEach((function(e){switch(e.allow){case v.e.CUSTOM:e.provider&&e.provider!==v.f.FUNCTION||r.add(p.c.AWS_LAMBDA);break;case v.e.GROUPS:case v.e.OWNER:n&&(e.provider===v.f.USER_POOLS?r.add(p.c.AMAZON_COGNITO_USER_POOLS):e.provider===v.f.OIDC&&r.add(p.c.OPENID_CONNECT));break;case v.e.PRIVATE:n&&(e.provider&&e.provider!==v.f.USER_POOLS?e.provider===v.f.IAM&&r.add(p.c.AWS_IAM):r.add(p.c.AMAZON_COGNITO_USER_POOLS));break;case v.e.PUBLIC:e.provider===v.f.IAM?r.add(p.c.AWS_IAM):e.provider&&e.provider!==v.f.API_KEY||r.add(p.c.API_KEY)}})),Array.from(r)}var _=function(e){return function(t){var n=t.schema,r=t.modelName;return y(void 0,void 0,void 0,(function(){var t,i,o,s,a;return g(this,(function(u){switch(u.label){case 0:e.Auth=e.Auth||h.a,u.label=1;case 1:return u.trys.push([1,3,,4]),[4,e.Auth.currentAuthenticatedUser()];case 2:return t=u.sent(),[3,4];case 3:return u.sent(),[3,4];case 4:return(i=n.namespaces.user.models[r].attributes)&&(o=i.find((function(e){return"auth"===e.type})),null===(a=null==o?void 0:o.properties)||void 0===a?void 0:a.rules)?(c=o.properties.rules,l=[v.e.CUSTOM,v.e.OWNER,v.e.GROUPS,v.e.PRIVATE,v.e.PUBLIC],f=[v.f.FUNCTION,v.f.USER_POOLS,v.f.OIDC,v.f.IAM,v.f.API_KEY],s=b(c).sort((function(e,t){return e.allow===t.allow?f.indexOf(w(e))-f.indexOf(w(t)):l.indexOf(e.allow)-l.indexOf(t.allow)})),[2,S({currentUser:t,rules:s})]):[2,[]]}var c,l,f}))}))}},E=function(){return[]},A=n(5),O=n(49),I=function(){function e(){this._queue=[],this._pending=!1}return e.prototype.isLocked=function(){return this._pending},e.prototype.acquire=function(){var e=this,t=new Promise((function(t){return e._queue.push(t)}));return this._pending||this._dispatchNext(),t},e.prototype.runExclusive=function(e){return this.acquire().then((function(t){var n;try{n=e()}catch(e){throw t(),e}return Promise.resolve(n).then((function(e){return t(),e}),(function(e){throw t(),e}))}))},e.prototype._dispatchNext=function(){this._queue.length>0?(this._pending=!0,this._queue.shift()(this._dispatchNext.bind(this))):this._pending=!1},e}(),T=n(69),C=n.n(T),x=n(2);let P,k;const N=new WeakMap,M=new WeakMap,j=new WeakMap,R=new WeakMap,D=new WeakMap;let U={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return M.get(e);if("objectStoreNames"===t)return e.objectStoreNames||j.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return B(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function F(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(k||(k=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(q(this),t),B(N.get(this))}:function(...t){return B(e.apply(q(this),t))}:function(t,...n){const r=e.call(q(this),t,...n);return j.set(r,t.sort?t.sort():[t]),B(r)}}function L(e){return"function"==typeof e?F(e):(e instanceof IDBTransaction&&function(e){if(M.has(e))return;const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",o),e.removeEventListener("abort",o)},i=()=>{t(),r()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",o),e.addEventListener("abort",o)});M.set(e,t)}(e),t=e,(P||(P=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,U):e);var t}function B(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{t(B(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",o)});return t.then(t=>{t instanceof IDBCursor&&N.set(t,e)}).catch(()=>{}),D.set(t,e),t}(e);if(R.has(e))return R.get(e);const t=L(e);return t!==e&&(R.set(e,t),D.set(t,e)),t}const q=e=>D.get(e);function z(e,t,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){const s=indexedDB.open(e,t),a=B(s);return r&&s.addEventListener("upgradeneeded",e=>{r(B(s.result),e.oldVersion,e.newVersion,B(s.transaction))}),n&&s.addEventListener("blocked",()=>n()),a.then(e=>{o&&e.addEventListener("close",()=>o()),i&&e.addEventListener("versionchange",()=>i())}).catch(()=>{}),a}function K(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",()=>t()),B(n).then(()=>{})}const H=["get","getKey","getAll","getAllKeys","count"],V=["put","add","delete","clear"],G=new Map;function W(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(G.get(t))return G.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=V.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!H.includes(n))return;const o=async function(e,...t){const o=this.transaction(e,i?"readwrite":"readonly");let s=o.store;r&&(s=s.index(t.shift()));const a=await s[n](...t);return i&&await o.done,a};return G.set(t,o),o}function Y(e){return(Y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}U=(e=>({...e,get:(t,n,r)=>W(t,n)||e.get(t,n,r),has:(t,n)=>!!W(t,n)||e.has(t,n)}))(U);var J=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},$=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Z=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof Q?Q(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}},Q=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},X=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},ee=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(X(arguments[t]));return e},te=new i.a("DataStore"),ne=new(function(){function e(){this.dbName="amplify-datastore"}return e.prototype.checkPrivate=function(){return J(this,void 0,void 0,(function(){return $(this,(function(e){switch(e.label){case 0:return[4,Object(x.x)().then((function(e){return e}))];case 1:return e.sent()?(te.error("IndexedDB not supported in this browser's private mode"),[2,Promise.reject("IndexedDB not supported in this browser's private mode")]):[2,Promise.resolve()]}}))}))},e.prototype.getStorenameForModel=function(e){var t=this.namespaceResolver(e),n=e.name;return this.getStorename(t,n)},e.prototype.getStorename=function(e,t){return e+"_"+t},e.prototype.setUp=function(e,t,n,r,i){return J(this,void 0,void 0,(function(){var o,s,a=this;return $(this,(function(u){switch(u.label){case 0:return[4,this.checkPrivate()];case 1:return u.sent(),this.initPromise?[3,2]:(this.initPromise=new Promise((function(e,t){a.resolve=e,a.reject=t})),[3,4]);case 2:return[4,this.initPromise];case 3:u.sent(),u.label=4;case 4:i&&(this.dbName="amplify-datastore-"+i),this.schema=e,this.namespaceResolver=t,this.modelInstanceCreator=n,this.getModelConstructorByModelName=r,u.label=5;case 5:return u.trys.push([5,8,,9]),this.db?[3,7]:(2,o=this,[4,z(this.dbName,2,{upgrade:function(t,n,r,i){return J(a,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h,p,v,y,g=this;return $(this,(function(m){switch(m.label){case 0:if(0===n)return Object.keys(e.namespaces).forEach((function(n){var r=e.namespaces[n];Object.keys(r.models).forEach((function(e){var r=g.getStorename(n,e);g.createObjectStoreForModel(t,n,r,e)}))})),[2];if(1!==n||2!==r)return[3,16];m.label=1;case 1:m.trys.push([1,14,,15]),m.label=2;case 2:m.trys.push([2,11,12,13]),o=Q(i.objectStoreNames),s=o.next(),m.label=3;case 3:return s.done?[3,10]:(a=s.value,u=i.objectStore(a),c="tmp_"+a,u.name=c,(l=t.createObjectStore(a,{keyPath:void 0,autoIncrement:!0})).createIndex("byId","id",{unique:!0}),[4,u.openCursor()]);case 4:f=m.sent(),d=0,m.label=5;case 5:return f&&f.value?[4,l.put(f.value)]:[3,8];case 6:return m.sent(),[4,f.continue()];case 7:return f=m.sent(),d++,[3,5];case 8:t.deleteObjectStore(c),te.debug(d+" "+a+" records migrated"),m.label=9;case 9:return s=o.next(),[3,3];case 10:return[3,13];case 11:return h=m.sent(),v={error:h},[3,13];case 12:try{s&&!s.done&&(y=o.return)&&y.call(o)}finally{if(v)throw v.error}return[7];case 13:return Object.keys(e.namespaces).forEach((function(n){var r=e.namespaces[n],o=new Set(i.objectStoreNames);Object.keys(r.models).map((function(e){return[e,g.getStorename(n,e)]})).filter((function(e){var t=X(e,2)[1];return!o.has(t)})).forEach((function(e){var r=X(e,2),i=r[0],o=r[1];g.createObjectStoreForModel(t,n,o,i)}))})),[3,15];case 14:throw p=m.sent(),te.error("Error migrating IndexedDB data",p),i.abort(),p;case 15:case 16:return[2]}}))}))}})]);case 6:o.db=u.sent(),this.resolve(),u.label=7;case 7:return[3,9];case 8:return s=u.sent(),this.reject(s),[3,9];case 9:return[2]}}))}))},e.prototype._get=function(e,t){return J(this,void 0,void 0,(function(){var n,r;return $(this,(function(i){switch(i.label){case 0:return"string"==typeof e?(r=e,n=this.db.transaction(r,"readonly").store.index("byId")):n=e.index("byId"),[4,n.get(t)];case 1:return[2,i.sent()]}}))}))},e.prototype.save=function(e,t){var n,r;return J(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p,y,g,m,b,w,S,_,E,O,I,T,C,P,k,N,M=this;return $(this,(function(j){switch(j.label){case 0:return[4,this.checkPrivate()];case 1:return j.sent(),i=Object.getPrototypeOf(e).constructor,o=this.getStorenameForModel(i),s=Object(x.C)(i.name,e,this.schema.namespaces[this.namespaceResolver(i)],this.modelInstanceCreator,this.getModelConstructorByModelName),a=this.namespaceResolver(i),u=new Set,c=Object.values(s).map((function(e){var t=e.modelName,n=e.item,r=e.instance,i=M.getStorename(a,t);return u.add(i),{storeName:i,item:n,instance:r}})),l=this.db.transaction(ee([o],Array.from(u.values())),"readwrite"),f=l.objectStore(o),[4,this._get(f,e.id)];case 2:if(d=j.sent(),t&&d&&(h=A.a.getPredicates(t),p=h.predicates,y=h.type,!Object(x.D)(d,y,p)))throw g="Conditional update failed",te.error(g,{model:d,condition:p}),new Error(g);m=[],j.label=3;case 3:j.trys.push([3,11,12,17]),b=Z(c),j.label=4;case 4:return[4,b.next()];case 5:return(w=j.sent()).done?[3,10]:(S=w.value,_=S.storeName,E=S.item,O=S.instance,I=l.objectStore(_),T=E.id,[4,this._get(I,T)]);case 6:return C=j.sent(),P=void 0===C?v.h.INSERT:v.h.UPDATE,T!==e.id&&P!==v.h.INSERT?[3,9]:[4,I.index("byId").getKey(E.id)];case 7:return k=j.sent(),[4,I.put(E,k)];case 8:j.sent(),m.push([O,P]),j.label=9;case 9:return[3,4];case 10:return[3,17];case 11:return N=j.sent(),n={error:N},[3,17];case 12:return j.trys.push([12,,15,16]),w&&!w.done&&(r=b.return)?[4,r.call(b)]:[3,14];case 13:j.sent(),j.label=14;case 14:return[3,16];case 15:if(n)throw n.error;return[7];case 16:return[7];case 17:return[4,l.done];case 18:return j.sent(),[2,m]}}))}))},e.prototype.load=function(e,t,n){var r,i,o,s,a,u,c,l,f,d;return J(this,void 0,void 0,(function(){var h,p,v,y,g,m,b,w,S,_,E,A,O,I,T,C,P,k,N,M,j=this;return $(this,(function(R){switch(R.label){case 0:if(h=this.schema.namespaces[e],p=h.relationships[t].relationTypes,v=p.map((function(t){var n=t.modelName;return j.getStorename(e,n)})),y=this.getModelConstructorByModelName(e,t),0===v.length)return[2,n.map((function(e){return j.modelInstanceCreator(y,e)}))];g=this.db.transaction(ee(v),"readonly"),R.label=1;case 1:R.trys.push([1,34,35,40]),m=Z(p),R.label=2;case 2:return[4,m.next()];case 3:if((b=R.sent()).done)return[3,33];switch(w=b.value,S=w.fieldName,_=w.modelName,E=w.targetName,A=this.getStorename(e,_),O=g.objectStore(A),I=this.getModelConstructorByModelName(e,_),w.relationType){case"HAS_ONE":return[3,4];case"BELONGS_TO":return[3,17];case"HAS_MANY":return[3,30]}return[3,31];case 4:R.trys.push([4,10,11,16]),r=Z(n),R.label=5;case 5:return[4,r.next()];case 6:return(i=R.sent()).done?[3,9]:(P=i.value,T=P[E]?E:S,P[T]?[4,this._get(O,P[T])]:[3,9]);case 7:k=R.sent(),P[S]=k&&this.modelInstanceCreator(I,k),R.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return C=R.sent(),c={error:C},[3,16];case 11:return R.trys.push([11,,14,15]),i&&!i.done&&(l=r.return)?[4,l.call(r)]:[3,13];case 12:R.sent(),R.label=13;case 13:return[3,15];case 14:if(c)throw c.error;return[7];case 15:return[7];case 16:return[3,32];case 17:R.trys.push([17,23,24,29]),o=Z(n),R.label=18;case 18:return[4,o.next()];case 19:return(s=R.sent()).done?[3,22]:(P=s.value)[E]?[4,this._get(O,P[E])]:[3,21];case 20:k=R.sent(),P[S]=k&&this.modelInstanceCreator(I,k),delete P[E],R.label=21;case 21:return[3,18];case 22:return[3,29];case 23:return N=R.sent(),f={error:N},[3,29];case 24:return R.trys.push([24,,27,28]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,26];case 25:R.sent(),R.label=26;case 26:return[3,28];case 27:if(f)throw f.error;return[7];case 28:return[7];case 29:case 30:return[3,32];case 31:return Object(x.h)(w.relationType),[3,32];case 32:return[3,2];case 33:return[3,40];case 34:return M=R.sent(),a={error:M},[3,40];case 35:return R.trys.push([35,,38,39]),b&&!b.done&&(u=m.return)?[4,u.call(m)]:[3,37];case 36:R.sent(),R.label=37;case 37:return[3,39];case 38:if(a)throw a.error;return[7];case 39:return[7];case 40:return[2,n.map((function(e){return j.modelInstanceCreator(y,e)}))]}}))}))},e.prototype.query=function(e,t,n){return J(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l=this;return $(this,(function(f){switch(f.label){case 0:return[4,this.checkPrivate()];case 1:return f.sent(),r=this.getStorenameForModel(e),i=this.namespaceResolver(e),o=t&&A.a.getPredicates(t),s=o&&this.idFromPredicate(o),a=n&&n.sort,u=n&&n.limit,[4,J(l,void 0,void 0,(function(){var e,t,i;return $(this,(function(c){switch(c.label){case 0:return s?[4,this.getById(r,s)]:[3,2];case 1:return[2,(e=c.sent())?[e]:[]];case 2:return o?[4,this.filterOnPredicate(r,o)]:[3,4];case 3:return t=c.sent(),[2,this.inMemoryPagination(t,n)];case 4:return a?[4,this.getAll(r)]:[3,6];case 5:return i=c.sent(),[2,this.inMemoryPagination(i,n)];case 6:return u?[2,this.enginePagination(r,n)]:[2,this.getAll(r)]}}))}))];case 2:return c=f.sent(),[4,this.load(i,e.name,c)];case 3:return[2,f.sent()]}}))}))},e.prototype.getById=function(e,t){return J(this,void 0,void 0,(function(){return $(this,(function(n){switch(n.label){case 0:return[4,this._get(e,t)];case 1:return[2,n.sent()]}}))}))},e.prototype.getAll=function(e){return J(this,void 0,void 0,(function(){return $(this,(function(t){switch(t.label){case 0:return[4,this.db.getAll(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.idFromPredicate=function(e){var t=e.predicates,n=1===t.length&&t.find((function(e){return Object(v.v)(e)&&"id"===e.field&&"eq"===e.operator}));return n&&n.operand},e.prototype.filterOnPredicate=function(e,t){return J(this,void 0,void 0,(function(){var n,r,i;return $(this,(function(o){switch(o.label){case 0:return n=t.predicates,r=t.type,[4,this.getAll(e)];case 1:return i=o.sent(),[2,n?i.filter((function(e){return Object(x.D)(e,r,n)})):i]}}))}))},e.prototype.inMemoryPagination=function(e,t){if(t&&e.length>1){if(t.sort){var n=O.a.getPredicates(t.sort);if(n.length){var r=Object(x.B)(n);e.sort(r)}}var i=t.page,o=void 0===i?0:i,s=t.limit,a=void 0===s?0:s,u=Math.max(0,o*a)||0,c=a>0?u+a:e.length;return e.slice(u,c)}return e},e.prototype.enginePagination=function(e,t){return J(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l;return $(this,(function(f){switch(f.label){case 0:return t?(r=t.page,i=void 0===r?0:r,o=t.limit,s=void 0===o?0:o,a=Math.max(0,i*s)||0,[4,this.db.transaction(e).objectStore(e).openCursor()]):[3,7];case 1:return(u=f.sent())&&a>0?[4,u.advance(a)]:[3,3];case 2:f.sent(),f.label=3;case 3:c=[],l="number"==typeof s&&s>0,f.label=4;case 4:return u&&u.value?(c.push(u.value),l&&c.length===s?[3,6]:[4,u.continue()]):[3,6];case 5:return u=f.sent(),[3,4];case 6:return n=c,[3,9];case 7:return[4,this.db.getAll(e)];case 8:n=f.sent(),f.label=9;case 9:return[2,n]}}))}))},e.prototype.queryOne=function(e,t){return void 0===t&&(t=v.j.FIRST),J(this,void 0,void 0,(function(){var n,r,i;return $(this,(function(o){switch(o.label){case 0:return[4,this.checkPrivate()];case 1:return o.sent(),n=this.getStorenameForModel(e),[4,this.db.transaction([n],"readonly").objectStore(n).openCursor(void 0,t===v.j.FIRST?"next":"prev")];case 2:return r=o.sent(),[2,(i=r?r.value:void 0)&&this.modelInstanceCreator(e,i)]}}))}))},e.prototype.delete=function(e,t){return J(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return $(this,(function(g){switch(g.label){case 0:return[4,this.checkPrivate()];case 1:return g.sent(),n=[],Object(x.u)(e)?(o=e,s=this.namespaceResolver(o),a=this.getStorenameForModel(o),[4,this.query(o,t)]):[3,9];case 2:return r=g.sent(),v=this.schema.namespaces[s].relationships[o.name].relationTypes,void 0===t?[3,5]:[4,this.deleteTraverse(v,r,o.name,s,n)];case 3:return g.sent(),[4,this.deleteItem(n)];case 4:return g.sent(),y=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[r,y]];case 5:return[4,this.deleteTraverse(v,r,o.name,s,n)];case 6:return g.sent(),[4,this.db.transaction([a],"readwrite").objectStore(a).clear()];case 7:return g.sent(),y=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[r,y]];case 8:return[3,17];case 9:return i=e,o=Object.getPrototypeOf(i).constructor,s=this.namespaceResolver(o),a=this.getStorenameForModel(o),t?(u=this.db.transaction([a],"readwrite"),c=u.objectStore(a),[4,this._get(c,i.id)]):[3,13];case 10:if(void 0===(l=g.sent()))return p="Model instance not found in storage",te.warn(p,{model:i}),[2,[[i],[]]];if(f=A.a.getPredicates(t),d=f.predicates,h=f.type,!Object(x.D)(l,h,d))throw p="Conditional update failed",te.error(p,{model:l,condition:d}),new Error(p);return[4,u.done];case 11:return g.sent(),v=this.schema.namespaces[s].relationships[o.name].relationTypes,[4,this.deleteTraverse(v,[i],o.name,s,n)];case 12:return g.sent(),[3,15];case 13:return v=this.schema.namespaces[s].relationships[o.name].relationTypes,[4,this.deleteTraverse(v,[i],o.name,s,n)];case 14:g.sent(),g.label=15;case 15:return[4,this.deleteItem(n)];case 16:return g.sent(),y=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[[i],y]];case 17:return[2]}}))}))},e.prototype.deleteItem=function(e){var t,n,r,i,o,s;return J(this,void 0,void 0,(function(){var a,u,c,l,f,d,h,p,v,y,g,m;return $(this,(function(b){switch(b.label){case 0:a=e.map((function(e){return e.storeName})),u=this.db.transaction(ee(a),"readwrite"),b.label=1;case 1:b.trys.push([1,22,23,28]),t=Z(e),b.label=2;case 2:return[4,t.next()];case 3:if((n=b.sent()).done)return[3,21];c=n.value,l=c.storeName,f=c.items,d=u.objectStore(l),b.label=4;case 4:b.trys.push([4,14,15,20]),h=Z(f),b.label=5;case 5:return[4,h.next()];case 6:return(p=b.sent()).done?[3,13]:(v=p.value)?(y=void 0,"object"!==Y(v)?[3,8]:[4,d.index("byId").getKey(v.id)]):[3,12];case 7:return y=b.sent(),[3,10];case 8:return[4,d.index("byId").getKey(v.toString())];case 9:y=b.sent(),b.label=10;case 10:return void 0===y?[3,12]:[4,d.delete(y)];case 11:b.sent(),b.label=12;case 12:return[3,5];case 13:return[3,20];case 14:return g=b.sent(),o={error:g},[3,20];case 15:return b.trys.push([15,,18,19]),p&&!p.done&&(s=h.return)?[4,s.call(h)]:[3,17];case 16:b.sent(),b.label=17;case 17:return[3,19];case 18:if(o)throw o.error;return[7];case 19:return[7];case 20:return[3,2];case 21:return[3,28];case 22:return m=b.sent(),r={error:m},[3,28];case 23:return b.trys.push([23,,26,27]),n&&!n.done&&(i=t.return)?[4,i.call(t)]:[3,25];case 24:b.sent(),b.label=25;case 25:return[3,27];case 26:if(r)throw r.error;return[7];case 27:return[7];case 28:return[2]}}))}))},e.prototype.deleteTraverse=function(e,t,n,r,i){var o,s,a,u,c,l,f,d,h,p,v,y;return J(this,void 0,void 0,(function(){var g,m,b,w,S,_,E,A,O,I,T,C,P,k,N=this;return $(this,(function(M){switch(M.label){case 0:M.trys.push([0,35,36,41]),o=Z(e),M.label=1;case 1:return[4,o.next()];case 2:if((s=M.sent()).done)return[3,34];switch(g=s.value,m=g.relationType,g.fieldName,b=g.modelName,w=g.targetName,S=this.getStorename(r,b),_=Object(x.i)(this.schema.namespaces[r].relationships[b].relationTypes,n)||Object(x.j)(this.schema.namespaces[r].relationships[b].indexes,g.associatedWith),m){case"HAS_ONE":return[3,3];case"HAS_MANY":return[3,17];case"BELONGS_TO":return[3,31]}return[3,32];case 3:M.trys.push([3,10,11,16]),a=Z(t),M.label=4;case 4:return[4,a.next()];case 5:return(u=M.sent()).done?[3,9]:(T=u.value,E=_||"byId",(A=w in T?T[w]:T.id)?[4,this.db.transaction(S,"readwrite").objectStore(S).index(E).get(A)]:[3,9]);case 6:return O=M.sent(),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,O?[O]:[],b,r,i)];case 7:M.sent(),M.label=8;case 8:return[3,4];case 9:return[3,16];case 10:return I=M.sent(),h={error:I},[3,16];case 11:return M.trys.push([11,,14,15]),u&&!u.done&&(p=a.return)?[4,p.call(a)]:[3,13];case 12:M.sent(),M.label=13;case 13:return[3,15];case 14:if(h)throw h.error;return[7];case 15:return[7];case 16:return[3,33];case 17:M.trys.push([17,24,25,30]),c=Z(t),M.label=18;case 18:return[4,c.next()];case 19:return(l=M.sent()).done?[3,23]:(T=l.value,[4,this.db.transaction(S,"readwrite").objectStore(S).index(_).getAll(T.id)]);case 20:return C=M.sent(),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,C,b,r,i)];case 21:M.sent(),M.label=22;case 22:return[3,18];case 23:return[3,30];case 24:return P=M.sent(),v={error:P},[3,30];case 25:return M.trys.push([25,,28,29]),l&&!l.done&&(y=c.return)?[4,y.call(c)]:[3,27];case 26:M.sent(),M.label=27;case 27:return[3,29];case 28:if(v)throw v.error;return[7];case 29:return[7];case 30:case 31:return[3,33];case 32:return Object(x.h)(m),[3,33];case 33:return[3,1];case 34:return[3,41];case 35:return k=M.sent(),f={error:k},[3,41];case 36:return M.trys.push([36,,39,40]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,38];case 37:M.sent(),M.label=38;case 38:return[3,40];case 39:if(f)throw f.error;return[7];case 40:return[7];case 41:return i.push({storeName:this.getStorename(r,n),items:t.map((function(e){return N.modelInstanceCreator(N.getModelConstructorByModelName(r,n),e)}))}),[2]}}))}))},e.prototype.clear=function(){return J(this,void 0,void 0,(function(){return $(this,(function(e){switch(e.label){case 0:return[4,this.checkPrivate()];case 1:return e.sent(),this.db.close(),[4,K(this.dbName)];case 2:return e.sent(),this.db=void 0,this.initPromise=void 0,[2]}}))}))},e.prototype.batchSave=function(e,t){return J(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h;return $(this,(function(p){switch(p.label){case 0:return 0===t.length?[2,[]]:[4,this.checkPrivate()];case 1:p.sent(),n=[],r=this.getStorenameForModel(e),i=this.db.transaction(r,"readwrite"),o=i.store,s=function(t){var r,i,s,u,c;return $(this,(function(l){switch(l.label){case 0:return r=Object(x.C)(e.name,a.modelInstanceCreator(e,t),a.schema.namespaces[a.namespaceResolver(e)],a.modelInstanceCreator,a.getModelConstructorByModelName),i=t.id,s=t._deleted,[4,o.index("byId").getKey(i)];case 1:return u=l.sent(),s?[3,3]:(c=r.find((function(e){return e.instance.id===i})).instance,n.push([c,u?v.h.UPDATE:v.h.INSERT]),[4,o.put(c,u)]);case 2:return l.sent(),[3,5];case 3:return n.push([t,v.h.DELETE]),u?[4,o.delete(u)]:[3,5];case 4:l.sent(),l.label=5;case 5:return[2]}}))},a=this,p.label=2;case 2:p.trys.push([2,7,8,9]),u=Q(t),c=u.next(),p.label=3;case 3:return c.done?[3,6]:(l=c.value,[5,s(l)]);case 4:p.sent(),p.label=5;case 5:return c=u.next(),[3,3];case 6:return[3,9];case 7:return f=p.sent(),d={error:f},[3,9];case 8:try{c&&!c.done&&(h=u.return)&&h.call(u)}finally{if(d)throw d.error}return[7];case 9:return[4,i.done];case 10:return p.sent(),[2,n]}}))}))},e.prototype.createObjectStoreForModel=function(e,t,n,r){return J(this,void 0,void 0,(function(){var i;return $(this,(function(o){return i=e.createObjectStore(n,{autoIncrement:!0}),this.schema.namespaces[t].relationships[r].indexes.forEach((function(e){return i.createIndex(e,e)})),i.createIndex("byId","id",{unique:!0}),[2]}))}))},e}()),re=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},ie=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},oe=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},se=function(){var e=this;this.db=new Map,this.getAllKeys=function(){return re(e,void 0,void 0,(function(){return ie(this,(function(e){return[2,Array.from(this.db.keys())]}))}))},this.multiGet=function(t){return re(e,void 0,void 0,(function(){var e=this;return ie(this,(function(n){return[2,t.reduce((function(t,n){return t.push([n,e.db.get(n)]),t}),[])]}))}))},this.multiRemove=function(t,n){return re(e,void 0,void 0,(function(){var e=this;return ie(this,(function(r){return t.forEach((function(t){return e.db.delete(t)})),"function"==typeof n&&n(),[2]}))}))},this.multiSet=function(t,n){return re(e,void 0,void 0,(function(){var e=this;return ie(this,(function(r){return t.forEach((function(t){var n=oe(t,2),r=n[0],i=n[1];e.setItem(r,i)})),"function"==typeof n&&n(),[2]}))}))},this.setItem=function(t,n){return re(e,void 0,void 0,(function(){return ie(this,(function(e){return[2,this.db.set(t,n)]}))}))},this.removeItem=function(t){return re(e,void 0,void 0,(function(){return ie(this,(function(e){return[2,this.db.delete(t)]}))}))},this.getItem=function(t){return re(e,void 0,void 0,(function(){return ie(this,(function(e){return[2,this.db.get(t)]}))}))}};var ae=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},ue=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},ce=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},le=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},fe=new Map,de=function(){function e(){this._collectionInMemoryIndex=new Map,this.storage=new se}return e.prototype.getCollectionIndex=function(e){return this._collectionInMemoryIndex.has(e)||this._collectionInMemoryIndex.set(e,new Map),this._collectionInMemoryIndex.get(e)},e.prototype.getMonotonicFactory=function(e){return fe.has(e)||fe.set(e,Object(x.z)()),fe.get(e)},e.prototype.init=function(){return ae(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b;return ue(this,(function(w){switch(w.label){case 0:return this._collectionInMemoryIndex.clear(),[4,this.storage.getAllKeys()];case 1:e=w.sent(),t=[],w.label=2;case 2:w.trys.push([2,12,13,14]),n=ce(e),r=n.next(),w.label=3;case 3:return r.done?[3,11]:(i=r.value,o=le(i.split("::"),5),s=o[0],a=o[1],u=o[2],c=o[3],l=o[4],"@AmplifyDatastore"!==s?[3,10]:"Data"!==u?[3,9]:(f=void 0,void 0!==l?[3,7]:(d=c,h=this.getMonotonicFactory(a)(),p=this.getLegacyKeyForItem(a,d),v=this.getKeyForItem(a,d,h),[4,this.storage.getItem(p)])));case 4:return y=w.sent(),[4,this.storage.setItem(v,y)];case 5:return w.sent(),[4,this.storage.removeItem(p)];case 6:return w.sent(),f=h,[3,8];case 7:f=c,w.label=8;case 8:return this.getCollectionIndex(a).set(l,f),[3,10];case 9:"Collection"===u&&t.push(i),w.label=10;case 10:return r=n.next(),[3,3];case 11:return[3,14];case 12:return g=w.sent(),m={error:g},[3,14];case 13:try{r&&!r.done&&(b=n.return)&&b.call(n)}finally{if(m)throw m.error}return[7];case 14:return t.length>0?[4,this.storage.multiRemove(t)]:[3,16];case 15:w.sent(),w.label=16;case 16:return[2]}}))}))},e.prototype.save=function(e,t){return ae(this,void 0,void 0,(function(){var n,r;return ue(this,(function(i){switch(i.label){case 0:return n=this.getCollectionIndex(t).get(e.id)||this.getMonotonicFactory(t)(),r=this.getKeyForItem(t,e.id,n),this.getCollectionIndex(t).set(e.id,n),[4,this.storage.setItem(r,JSON.stringify(e))];case 1:return i.sent(),[2]}}))}))},e.prototype.batchSave=function(e,t){return ae(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,y,g,m,b,w,S,_,E,A=this;return ue(this,(function(O){switch(O.label){case 0:if(0===t.length)return[2,[]];n=[],r=this.getCollectionIndex(e),i=new Set,o=new Set,s=[],a={};try{for(u=ce(t),c=u.next();!c.done;c=u.next())l=c.value,f=l.id,d=l._deleted,h=r.get(f)||this.getMonotonicFactory(e)(),b=this.getKeyForItem(e,f,h),s.push(b),a[b]={ulid:h,model:l},d?i.add(b):o.add(b)}catch(e){w={error:e}}finally{try{c&&!c.done&&(S=u.return)&&S.call(u)}finally{if(w)throw w.error}}return[4,this.storage.multiGet(s)];case 1:return p=O.sent(),y=p.filter((function(e){return!!le(e,2)[1]})).reduce((function(e,t){var n=le(t,1)[0];return e.add(n)}),new Set),[4,new Promise((function(e,t){if(0!==i.size){var n=Array.from(i);n.forEach((function(e){return r.delete(a[e].model.id)})),A.storage.multiRemove(n,(function(n){n&&n.length>0?t(n):e()}))}else e()}))];case 2:return O.sent(),[4,new Promise((function(e,t){if(0!==o.size){var n=Array.from(o).map((function(e){return[e,JSON.stringify(a[e].model)]}));o.forEach((function(e){var t=a[e],n=t.model.id,i=t.ulid;r.set(n,i)})),A.storage.multiSet(n,(function(n){n&&n.length>0?t(n):e()}))}else e()}))];case 3:O.sent();try{for(g=ce(s),m=g.next();!m.done;m=g.next())b=m.value,i.has(b)&&y.has(b)?n.push([a[b].model,v.h.DELETE]):o.has(b)&&n.push([a[b].model,y.has(b)?v.h.UPDATE:v.h.INSERT])}catch(e){_={error:e}}finally{try{m&&!m.done&&(E=g.return)&&E.call(g)}finally{if(_)throw _.error}}return[2,n]}}))}))},e.prototype.get=function(e,t){return ae(this,void 0,void 0,(function(){var n,r,i;return ue(this,(function(o){switch(o.label){case 0:return n=this.getCollectionIndex(t).get(e),r=this.getKeyForItem(t,e,n),[4,this.storage.getItem(r)];case 1:return i=o.sent(),[2,i&&JSON.parse(i)]}}))}))},e.prototype.getOne=function(e,t){return ae(this,void 0,void 0,(function(){var n,r,i,o,s,a,u;return ue(this,(function(c){switch(c.label){case 0:return n=this.getCollectionIndex(t),r=le(e===v.j.FIRST?function(){var e,t,r,i,o;try{for(var s=ce(n),a=s.next();!a.done;a=s.next()){i=(r=le(a.value,2))[0],o=r[1];break}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return[i,o]}():function(){var e,t,r,i,o;try{for(var s=ce(n),a=s.next();!a.done;a=s.next())i=(r=le(a.value,2))[0],o=r[1]}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return[i,o]}(),2),i=r[0],o=r[1],s=this.getKeyForItem(t,i,o),(u=s)?[4,this.storage.getItem(s)]:[3,2];case 1:u=c.sent(),c.label=2;case 2:return[2,(a=u)&&JSON.parse(a)||void 0]}}))}))},e.prototype.getAll=function(e,t){return ae(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b;return ue(this,(function(w){switch(w.label){case 0:n=this.getCollectionIndex(e),i=(r=t||{}).page,o=void 0===i?0:i,s=r.limit,a=void 0===s?0:s,u=Math.max(0,o*a)||0,c=a>0?u+a:void 0,l=[],f=0;try{for(d=ce(n),h=d.next();!h.done&&(p=le(h.value,2),v=p[0],y=p[1],++f<=u||(l.push(this.getKeyForItem(e,v,y)),f!==c));h=d.next());}catch(e){m={error:e}}finally{try{h&&!h.done&&(b=d.return)&&b.call(d)}finally{if(m)throw m.error}}return[4,this.storage.multiGet(l)];case 1:return g=w.sent(),[2,g.filter((function(e){return le(e,2)[1]})).map((function(e){var t=le(e,2)[1];return JSON.parse(t)}))]}}))}))},e.prototype.delete=function(e,t){return ae(this,void 0,void 0,(function(){var n,r;return ue(this,(function(i){switch(i.label){case 0:return n=this.getCollectionIndex(t).get(e),r=this.getKeyForItem(t,e,n),this.getCollectionIndex(t).delete(e),[4,this.storage.removeItem(r)];case 1:return i.sent(),[2]}}))}))},e.prototype.clear=function(){return ae(this,void 0,void 0,(function(){var e,t;return ue(this,(function(n){switch(n.label){case 0:return[4,this.storage.getAllKeys()];case 1:return e=n.sent(),t=e.filter((function(e){return e.startsWith("@AmplifyDatastore")})),[4,this.storage.multiRemove(t)];case 2:return n.sent(),this._collectionInMemoryIndex.clear(),[2]}}))}))},e.prototype.getKeyForItem=function(e,t,n){return this.getKeyPrefixForStoreItems(e)+"::"+n+"::"+t},e.prototype.getLegacyKeyForItem=function(e,t){return this.getKeyPrefixForStoreItems(e)+"::"+t},e.prototype.getKeyPrefixForStoreItems=function(e){return"@AmplifyDatastore::"+e+"::Data"},e}();function he(e){return(he="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var pe,ve=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},ye=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},ge=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof me?me(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}},me=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},be=new i.a("DataStore"),we=new(function(){function e(){}return e.prototype.getStorenameForModel=function(e){var t=this.namespaceResolver(e),n=e.name;return this.getStorename(t,n)},e.prototype.getStorename=function(e,t){return e+"_"+t},e.prototype.setUp=function(e,t,n,r){return ve(this,void 0,void 0,(function(){var i,o=this;return ye(this,(function(s){switch(s.label){case 0:return this.initPromise?[3,1]:(this.initPromise=new Promise((function(e,t){o.resolve=e,o.reject=t})),[3,3]);case 1:return[4,this.initPromise];case 2:return s.sent(),[2];case 3:this.schema=e,this.namespaceResolver=t,this.modelInstanceCreator=n,this.getModelConstructorByModelName=r,s.label=4;case 4:return s.trys.push([4,7,,8]),this.db?[3,6]:(this.db=new de,[4,this.db.init()]);case 5:s.sent(),this.resolve(),s.label=6;case 6:return[3,8];case 7:return i=s.sent(),this.reject(i),[3,8];case 8:return[2]}}))}))},e.prototype.save=function(e,t){var n,r;return ve(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p,y,g,m,b,w,S,_,E,O,I,T,C=this;return ye(this,(function(P){switch(P.label){case 0:return i=Object.getPrototypeOf(e).constructor,o=this.getStorenameForModel(i),s=Object(x.C)(i.name,e,this.schema.namespaces[this.namespaceResolver(i)],this.modelInstanceCreator,this.getModelConstructorByModelName),a=this.namespaceResolver(i),u=new Set,c=Object.values(s).map((function(e){var t=e.modelName,n=e.item,r=e.instance,i=C.getStorename(a,t);return u.add(i),{storeName:i,item:n,instance:r}})),[4,this.db.get(e.id,o)];case 1:if(l=P.sent(),t&&l&&(f=A.a.getPredicates(t),d=f.predicates,h=f.type,!Object(x.D)(l,h,d)))throw p="Conditional update failed",be.error(p,{model:l,condition:d}),new Error(p);y=[],P.label=2;case 2:P.trys.push([2,9,10,15]),g=ge(c),P.label=3;case 3:return[4,g.next()];case 4:return(m=P.sent()).done?[3,8]:(b=m.value,w=b.storeName,S=b.item,_=b.instance,E=S.id,[4,this.db.get(E,w)]);case 5:return O=P.sent(),I=O?v.h.UPDATE:v.h.INSERT,E!==e.id&&I!==v.h.INSERT?[3,7]:[4,this.db.save(S,w)];case 6:P.sent(),y.push([_,I]),P.label=7;case 7:return[3,3];case 8:return[3,15];case 9:return T=P.sent(),n={error:T},[3,15];case 10:return P.trys.push([10,,13,14]),m&&!m.done&&(r=g.return)?[4,r.call(g)]:[3,12];case 11:P.sent(),P.label=12;case 12:return[3,14];case 13:if(n)throw n.error;return[7];case 14:return[7];case 15:return[2,y]}}))}))},e.prototype.load=function(e,t,n){var r,i,o,s,a,u,c,l,f,d;return ve(this,void 0,void 0,(function(){var h,p,v,y,g,m,b,w,S,_,E,A,O,I,T,C,P,k,N,M=this;return ye(this,(function(j){switch(j.label){case 0:if(h=this.schema.namespaces[e],p=h.relationships[t].relationTypes,v=p.map((function(t){var n=t.modelName;return M.getStorename(e,n)})),y=this.getModelConstructorByModelName(e,t),0===v.length)return[2,n.map((function(e){return M.modelInstanceCreator(y,e)}))];j.label=1;case 1:j.trys.push([1,34,35,40]),g=ge(p),j.label=2;case 2:return[4,g.next()];case 3:if((m=j.sent()).done)return[3,33];switch(b=m.value,w=b.fieldName,S=b.modelName,_=b.targetName,E=b.relationType,A=this.getStorename(e,S),O=this.getModelConstructorByModelName(e,S),E){case"HAS_ONE":return[3,4];case"BELONGS_TO":return[3,17];case"HAS_MANY":return[3,30]}return[3,31];case 4:j.trys.push([4,10,11,16]),r=ge(n),j.label=5;case 5:return[4,r.next()];case 6:return(i=j.sent()).done?[3,9]:(C=i.value,I=C[_]?_:w,C[I]?[4,this.db.get(C[I],A)]:[3,9]);case 7:P=j.sent(),C[w]=P&&this.modelInstanceCreator(O,P),j.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return T=j.sent(),c={error:T},[3,16];case 11:return j.trys.push([11,,14,15]),i&&!i.done&&(l=r.return)?[4,l.call(r)]:[3,13];case 12:j.sent(),j.label=13;case 13:return[3,15];case 14:if(c)throw c.error;return[7];case 15:return[7];case 16:return[3,32];case 17:j.trys.push([17,23,24,29]),o=ge(n),j.label=18;case 18:return[4,o.next()];case 19:return(s=j.sent()).done?[3,22]:(C=s.value)[_]?[4,this.db.get(C[_],A)]:[3,21];case 20:P=j.sent(),C[w]=P&&this.modelInstanceCreator(O,P),delete C[_],j.label=21;case 21:return[3,18];case 22:return[3,29];case 23:return k=j.sent(),f={error:k},[3,29];case 24:return j.trys.push([24,,27,28]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,26];case 25:j.sent(),j.label=26;case 26:return[3,28];case 27:if(f)throw f.error;return[7];case 28:return[7];case 29:case 30:return[3,32];case 31:return Object(x.h)(E),[3,32];case 32:return[3,2];case 33:return[3,40];case 34:return N=j.sent(),a={error:N},[3,40];case 35:return j.trys.push([35,,38,39]),m&&!m.done&&(u=g.return)?[4,u.call(g)]:[3,37];case 36:j.sent(),j.label=37;case 37:return[3,39];case 38:if(a)throw a.error;return[7];case 39:return[7];case 40:return[2,n.map((function(e){return M.modelInstanceCreator(y,e)}))]}}))}))},e.prototype.query=function(e,t,n){return ve(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l=this;return ye(this,(function(f){switch(f.label){case 0:return r=this.getStorenameForModel(e),i=this.namespaceResolver(e),o=t&&A.a.getPredicates(t),s=o&&this.idFromPredicate(o),a=n&&n.sort,u=n&&n.limit,[4,ve(l,void 0,void 0,(function(){var e,t,i;return ye(this,(function(c){switch(c.label){case 0:return s?[4,this.getById(r,s)]:[3,2];case 1:return[2,(e=c.sent())?[e]:[]];case 2:return o?[4,this.filterOnPredicate(r,o)]:[3,4];case 3:return t=c.sent(),[2,this.inMemoryPagination(t,n)];case 4:return a||u?[4,this.getAll(r)]:[3,6];case 5:return i=c.sent(),[2,this.inMemoryPagination(i,n)];case 6:return[2,this.getAll(r)]}}))}))];case 1:return c=f.sent(),[4,this.load(i,e.name,c)];case 2:return[2,f.sent()]}}))}))},e.prototype.getById=function(e,t){return ve(this,void 0,void 0,(function(){return ye(this,(function(n){switch(n.label){case 0:return[4,this.db.get(t,e)];case 1:return[2,n.sent()]}}))}))},e.prototype.getAll=function(e){return ve(this,void 0,void 0,(function(){return ye(this,(function(t){switch(t.label){case 0:return[4,this.db.getAll(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.idFromPredicate=function(e){var t=e.predicates,n=1===t.length&&t.find((function(e){return Object(v.v)(e)&&"id"===e.field&&"eq"===e.operator}));return n&&n.operand},e.prototype.filterOnPredicate=function(e,t){return ve(this,void 0,void 0,(function(){var n,r,i;return ye(this,(function(o){switch(o.label){case 0:return n=t.predicates,r=t.type,[4,this.getAll(e)];case 1:return i=o.sent(),[2,n?i.filter((function(e){return Object(x.D)(e,r,n)})):i]}}))}))},e.prototype.inMemoryPagination=function(e,t){if(t&&e.length>1){if(t.sort){var n=O.a.getPredicates(t.sort);if(n.length){var r=Object(x.B)(n);e.sort(r)}}var i=t.page,o=void 0===i?0:i,s=t.limit,a=void 0===s?0:s,u=Math.max(0,o*a)||0,c=a>0?u+a:e.length;return e.slice(u,c)}return e},e.prototype.queryOne=function(e,t){return void 0===t&&(t=v.j.FIRST),ve(this,void 0,void 0,(function(){var n,r;return ye(this,(function(i){switch(i.label){case 0:return n=this.getStorenameForModel(e),[4,this.db.getOne(t,n)];case 1:return[2,(r=i.sent())&&this.modelInstanceCreator(e,r)]}}))}))},e.prototype.delete=function(e,t){return ve(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p;return ye(this,(function(v){switch(v.label){case 0:return n=[],Object(x.u)(e)?(o=e,s=this.namespaceResolver(o),[4,this.query(o,t)]):[3,8];case 1:return r=v.sent(),h=this.schema.namespaces[s].relationships[o.name].relationTypes,void 0===t?[3,4]:[4,this.deleteTraverse(h,r,o.name,s,n)];case 2:return v.sent(),[4,this.deleteItem(n)];case 3:return v.sent(),p=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[r,p]];case 4:return[4,this.deleteTraverse(h,r,o.name,s,n)];case 5:return v.sent(),[4,this.deleteItem(n)];case 6:return v.sent(),p=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[r,p]];case 7:return[3,15];case 8:return i=e,o=Object.getPrototypeOf(i).constructor,s=this.namespaceResolver(o),a=this.getStorenameForModel(o),t?[4,this.db.get(i.id,a)]:[3,11];case 9:if(void 0===(u=v.sent()))return d="Model instance not found in storage",be.warn(d,{model:i}),[2,[[i],[]]];if(c=A.a.getPredicates(t),l=c.predicates,f=c.type,!Object(x.D)(u,f,l))throw d="Conditional update failed",be.error(d,{model:u,condition:l}),new Error(d);return h=this.schema.namespaces[s].relationships[o.name].relationTypes,[4,this.deleteTraverse(h,[i],o.name,s,n)];case 10:return v.sent(),[3,13];case 11:return h=this.schema.namespaces[s].relationships[o.name].relationTypes,[4,this.deleteTraverse(h,[i],o.name,s,n)];case 12:v.sent(),v.label=13;case 13:return[4,this.deleteItem(n)];case 14:return v.sent(),p=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[[i],p]];case 15:return[2]}}))}))},e.prototype.deleteItem=function(e){var t,n,r,i,o,s;return ve(this,void 0,void 0,(function(){var a,u,c,l,f,d,h,p,v;return ye(this,(function(y){switch(y.label){case 0:y.trys.push([0,17,18,23]),t=ge(e),y.label=1;case 1:return[4,t.next()];case 2:if((n=y.sent()).done)return[3,16];a=n.value,u=a.storeName,c=a.items,y.label=3;case 3:y.trys.push([3,9,10,15]),l=ge(c),y.label=4;case 4:return[4,l.next()];case 5:return(f=y.sent()).done?[3,8]:(d=f.value)?"object"!==he(d)?[3,7]:(h=d.id,[4,this.db.delete(h,u)]):[3,7];case 6:y.sent(),y.label=7;case 7:return[3,4];case 8:return[3,15];case 9:return p=y.sent(),o={error:p},[3,15];case 10:return y.trys.push([10,,13,14]),f&&!f.done&&(s=l.return)?[4,s.call(l)]:[3,12];case 11:y.sent(),y.label=12;case 12:return[3,14];case 13:if(o)throw o.error;return[7];case 14:return[7];case 15:return[3,1];case 16:return[3,23];case 17:return v=y.sent(),r={error:v},[3,23];case 18:return y.trys.push([18,,21,22]),n&&!n.done&&(i=t.return)?[4,i.call(t)]:[3,20];case 19:y.sent(),y.label=20;case 20:return[3,22];case 21:if(r)throw r.error;return[7];case 22:return[7];case 23:return[2]}}))}))},e.prototype.deleteTraverse=function(e,t,n,r,i){var o,s,a,u,c,l,f,d,h,p,v,y;return ve(this,void 0,void 0,(function(){var g,m,b,w,S,_,E,A,O,I,T,C,P,k,N,M=this;return ye(this,(function(j){switch(j.label){case 0:j.trys.push([0,35,36,41]),o=ge(e),j.label=1;case 1:return[4,o.next()];case 2:if((s=j.sent()).done)return[3,34];switch(g=s.value,m=g.relationType,b=g.modelName,w=g.targetName,S=this.getStorename(r,b),_=Object(x.i)(this.schema.namespaces[r].relationships[b].relationTypes,n)||Object(x.j)(this.schema.namespaces[r].relationships[b].indexes,g.associatedWith),m){case"HAS_ONE":return[3,3];case"HAS_MANY":return[3,17];case"BELONGS_TO":return[3,31]}return[3,32];case 3:j.trys.push([3,10,11,16]),a=ge(t),j.label=4;case 4:return[4,a.next()];case 5:return(u=j.sent()).done?[3,9]:(T=u.value,E=_||"byId",(A=w in T?T[w]:T.id)?[4,this.db.getAll(S)]:[3,9]);case 6:return C=j.sent(),O=C.filter((function(e){return e[E]===A})),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,O,b,r,i)];case 7:j.sent(),j.label=8;case 8:return[3,4];case 9:return[3,16];case 10:return I=j.sent(),h={error:I},[3,16];case 11:return j.trys.push([11,,14,15]),u&&!u.done&&(p=a.return)?[4,p.call(a)]:[3,13];case 12:j.sent(),j.label=13;case 13:return[3,15];case 14:if(h)throw h.error;return[7];case 15:return[7];case 16:return[3,33];case 17:j.trys.push([17,24,25,30]),c=ge(t),j.label=18;case 18:return[4,c.next()];case 19:return(l=j.sent()).done?[3,23]:(T=l.value,[4,this.db.getAll(S)]);case 20:return C=j.sent(),P=C.filter((function(e){return e[_]===T.id})),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,P,b,r,i)];case 21:j.sent(),j.label=22;case 22:return[3,18];case 23:return[3,30];case 24:return k=j.sent(),v={error:k},[3,30];case 25:return j.trys.push([25,,28,29]),l&&!l.done&&(y=c.return)?[4,y.call(c)]:[3,27];case 26:j.sent(),j.label=27;case 27:return[3,29];case 28:if(v)throw v.error;return[7];case 29:return[7];case 30:case 31:return[3,33];case 32:return Object(x.h)(m),[3,33];case 33:return[3,1];case 34:return[3,41];case 35:return N=j.sent(),f={error:N},[3,41];case 36:return j.trys.push([36,,39,40]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,38];case 37:j.sent(),j.label=38;case 38:return[3,40];case 39:if(f)throw f.error;return[7];case 40:return[7];case 41:return i.push({storeName:this.getStorename(r,n),items:t.map((function(e){return M.modelInstanceCreator(M.getModelConstructorByModelName(r,n),e)}))}),[2]}}))}))},e.prototype.clear=function(){return ve(this,void 0,void 0,(function(){return ye(this,(function(e){switch(e.label){case 0:return[4,this.db.clear()];case 1:return e.sent(),this.db=void 0,this.initPromise=void 0,[2]}}))}))},e.prototype.batchSave=function(e,t){return ve(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d;return ye(this,(function(h){switch(h.label){case 0:n=e.name,r=this.namespaceResolver(e),i=this.getStorename(r,n),o=[],s=function(t){var n=t.id,r=Object(x.C)(e.name,a.modelInstanceCreator(e,t),a.schema.namespaces[a.namespaceResolver(e)],a.modelInstanceCreator,a.getModelConstructorByModelName).find((function(e){return e.instance.id===n})).instance;o.push(r)},a=this;try{for(u=me(t),c=u.next();!c.done;c=u.next())l=c.value,s(l)}catch(e){f={error:e}}finally{try{c&&!c.done&&(d=u.return)&&d.call(u)}finally{if(f)throw f.error}}return[4,this.db.batchSave(i,o)];case 1:return[2,h.sent()]}}))}))},e}()),Se=function(){return Object(o.b)().isBrowser&&window.indexedDB||Object(o.c)()&&self.indexedDB?ne:we},_e=function(){return(_e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},Ee=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Ae=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Oe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},Ie=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},Te=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ce=new i.a("DataStore"),xe=function(){function e(e,t,n,r,i,o){this.schema=e,this.namespaceResolver=t,this.getModelConstructorByModelName=n,this.modelInstanceCreator=r,this.adapter=i,this.sessionId=o,this.adapter=this.adapter||Se(),this.pushStream=new C.a}return e.getNamespace=function(){return{name:x.c,relationships:{},enums:{},models:{},nonModels:{}}},e.prototype.init=function(){return Ee(this,void 0,void 0,(function(){var e,t;return Ae(this,(function(n){switch(n.label){case 0:return void 0===this.initialized?[3,2]:[4,this.initialized];case 1:return n.sent(),[2];case 2:return Ce.debug("Starting Storage"),this.initialized=new Promise((function(n,r){e=n,t=r})),this.adapter.setUp(this.schema,this.namespaceResolver,this.modelInstanceCreator,this.getModelConstructorByModelName,this.sessionId).then(e,t),[4,this.initialized];case 3:return n.sent(),[2]}}))}))},e.prototype.save=function(e,t,n,r){return Ee(this,void 0,void 0,(function(){var i,o=this;return Ae(this,(function(s){switch(s.label){case 0:return[4,this.init()];case 1:return s.sent(),[4,this.adapter.save(e,t)];case 2:return(i=s.sent()).forEach((function(s){var a,u=Ie(s,2),c=u[0],l=u[1],f=!!n;if(l===v.h.UPDATE&&!f&&null===(a=o.getUpdateMutationInput(e,c,r)))return i;var d=a||c,h=Object.getPrototypeOf(c).constructor;o.pushStream.next({model:h,opType:l,element:d,mutator:n,condition:A.a.getPredicates(t,!1),savedElement:c})})),[2,i]}}))}))},e.prototype.delete=function(e,t,n){return Ee(this,void 0,void 0,(function(){var r,i,o,s,a=this;return Ae(this,(function(u){switch(u.label){case 0:return[4,this.init()];case 1:return u.sent(),[4,this.adapter.delete(e,t)];case 2:return s=Ie.apply(void 0,[u.sent(),2]),i=s[0],r=s[1],o=new Set(i.map((function(e){return e.id}))),Object(x.u)(e)||Array.isArray(r)||(r=[r]),r.forEach((function(r){var i,s=Object.getPrototypeOf(r).constructor;Object(x.u)(e)||(i=o.has(r.id)?A.a.getPredicates(t,!1):void 0),a.pushStream.next({model:s,opType:v.h.DELETE,element:r,mutator:n,condition:i})})),[2,[i,r]]}}))}))},e.prototype.query=function(e,t,n){return Ee(this,void 0,void 0,(function(){return Ae(this,(function(r){switch(r.label){case 0:return[4,this.init()];case 1:return r.sent(),[4,this.adapter.query(e,t,n)];case 2:return[2,r.sent()]}}))}))},e.prototype.queryOne=function(e,t){return void 0===t&&(t=v.j.FIRST),Ee(this,void 0,void 0,(function(){return Ae(this,(function(n){switch(n.label){case 0:return[4,this.init()];case 1:return n.sent(),[4,this.adapter.queryOne(e,t)];case 2:return[2,n.sent()]}}))}))},e.prototype.observe=function(e,t,n){var r=!e,i=A.a.getPredicates(t,!1)||{},o=i.predicates,s=i.type,a=!!o,u=this.pushStream.observable.filter((function(e){var t=e.mutator;return!n||t!==n})).map((function(e){e.mutator;return Oe(e,["mutator"])}));return r||(u=u.filter((function(t){var n=t.model,r=t.element;return e===n&&(!a||Object(x.D)(r,s,o))}))),u},e.prototype.clear=function(e){return void 0===e&&(e=!0),Ee(this,void 0,void 0,(function(){return Ae(this,(function(t){switch(t.label){case 0:return this.initialized=void 0,[4,this.adapter.clear()];case 1:return t.sent(),e&&this.pushStream.complete(),[2]}}))}))},e.prototype.batchSave=function(e,t,n){return Ee(this,void 0,void 0,(function(){var r,i=this;return Ae(this,(function(o){switch(o.label){case 0:return[4,this.init()];case 1:return o.sent(),[4,this.adapter.batchSave(e,t)];case 2:return(r=o.sent()).forEach((function(t){var r=Ie(t,2),o=r[0],s=r[1];i.pushStream.next({model:e,opType:s,element:o,mutator:n,condition:void 0})})),[2,r]}}))}))},e.prototype.getUpdateMutationInput=function(e,t,n){var r,i;if(!(n&&n.length))return null;var o=Ie(n,2),s=o[0],a=o[1],u={},c=s.map((function(e){return e.path&&e.path[0]})),l=Object.getPrototypeOf(e).constructor,f=this.namespaceResolver(l),d=this.schema.namespaces[f].models[l.name].fields,h=this.schema.namespaces[f].keys[l.name],p=h.primaryKey,y=h.compositeKeys,g=void 0===y?[]:y;if(c.forEach((function(e){var n,r,i,o,s,c=Object(v.x)(null===(s=d[e])||void 0===s?void 0:s.association)||e;if(!Object(x.E)(a[c],t[c])){u[c]=void 0===t[c]?null:t[c];try{for(var l=Te(g),f=l.next();!f.done;f=l.next()){var h=f.value;if(h.has(c))try{for(var p=(i=void 0,Te(h)),y=p.next();!y.done;y=p.next()){var m=y.value;u[m]=t[m]}}catch(e){i={error:e}}finally{try{y&&!y.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}})),p&&p.length)try{for(var m=Te(p),b=m.next();!b.done;b=m.next()){var w=b.value;u[w]=t[w]}}catch(e){r={error:e}}finally{try{b&&!b.done&&(i=m.return)&&i.call(m)}finally{if(r)throw r.error}}if(0===Object.keys(u).length)return null;var S=t.id,_=t._version,E=t._lastChangedAt,A=t._deleted;return _e(_e({},u),{id:S,_version:_,_lastChangedAt:E,_deleted:A})},e}(),Pe=function(){function e(e,t,n,r,i,o){this.mutex=new I,this.storage=new xe(e,t,n,r,i,o)}return e.prototype.runExclusive=function(e){return this.mutex.runExclusive(e.bind(this,this.storage))},e.prototype.save=function(e,t,n,r){return Ee(this,void 0,void 0,(function(){return Ae(this,(function(i){return[2,this.runExclusive((function(i){return i.save(e,t,n,r)}))]}))}))},e.prototype.delete=function(e,t,n){return Ee(this,void 0,void 0,(function(){return Ae(this,(function(r){return[2,this.runExclusive((function(r){if(Object(x.u)(e)){var i=e;return r.delete(i,t,n)}var o=e;return r.delete(o,t,n)}))]}))}))},e.prototype.query=function(e,t,n){return Ee(this,void 0,void 0,(function(){return Ae(this,(function(r){return[2,this.runExclusive((function(r){return r.query(e,t,n)}))]}))}))},e.prototype.queryOne=function(e,t){return void 0===t&&(t=v.j.FIRST),Ee(this,void 0,void 0,(function(){return Ae(this,(function(n){return[2,this.runExclusive((function(n){return n.queryOne(e,t)}))]}))}))},e.getNamespace=function(){return xe.getNamespace()},e.prototype.observe=function(e,t,n){return this.storage.observe(e,t,n)},e.prototype.clear=function(){return Ee(this,void 0,void 0,(function(){return Ae(this,(function(e){switch(e.label){case 0:return[4,this.storage.clear()];case 1:return e.sent(),[2]}}))}))},e.prototype.batchSave=function(e,t){return this.storage.batchSave(e,t)},e.prototype.init=function(){return Ee(this,void 0,void 0,(function(){return Ae(this,(function(e){return[2,this.storage.init()]}))}))},e}(),ke=n(14),Ne=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Me=(new(function(){function e(){}return e.prototype.networkMonitor=function(t){if(Object(o.b)().isNode)return d.a.from([{online:!0}]);var n=Object(o.c)()?self:window;return new d.a((function(t){t.next({online:n.navigator.onLine});var r=function(){return t.next({online:!0})},i=function(){return t.next({online:!1})};return n.addEventListener("online",r),n.addEventListener("offline",i),e._observers.push(t),function(){n.removeEventListener("online",r),n.removeEventListener("offline",i),e._observers=e._observers.filter((function(e){return e!==t}))}}))},e._observerOverride=function(t){var n,r,i=function(n){if(n.closed)return e._observers=e._observers.filter((function(e){return e!==n})),"continue";n.next(t)};try{for(var o=Ne(e._observers),s=o.next();!s.done;s=o.next()){i(s.value)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},e._observers=[],e}())).networkMonitor(),je=function(){return(je=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},Re=(new i.a("DataStore"),function(){function e(){this.connectionStatus={online:!1}}return e.prototype.status=function(){var e=this;if(this.observer)throw new Error("Subscriber already exists");return new d.a((function(t){return e.observer=t,e.subscription=Me.subscribe((function(n){var r=n.online;e.connectionStatus.online=r;var i=je({},e.connectionStatus);t.next(i)})),function(){clearTimeout(e.timeout),e.unsubscribe()}}))},e.prototype.unsubscribe=function(){this.subscription&&(clearTimeout(this.timeout),this.subscription.unsubscribe())},e.prototype.socketDisconnected=function(){var e=this;this.observer&&"function"==typeof this.observer.next&&(this.observer.next({online:!1}),this.timeout=setTimeout((function(){var t=je({},e.connectionStatus);e.observer.next(t)}),5e3))},e}()),De=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Ue=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Fe=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},Le=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Be=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Fe(arguments[t]));return e},qe=function(){function e(e,t){this.outbox=e,this.ownSymbol=t}return e.prototype.merge=function(e,t){return De(this,void 0,void 0,(function(){var n,r,i,o,s;return Ue(this,(function(a){switch(a.label){case 0:return[4,this.outbox.getForModel(e,t)];case 1:return r=a.sent(),i=t._deleted,0!==r.length?[3,5]:i?(n=v.h.DELETE,[4,e.delete(t,void 0,this.ownSymbol)]):[3,3];case 2:return a.sent(),[3,5];case 3:return[4,e.save(t,void 0,this.ownSymbol)];case 4:o=Fe.apply(void 0,[a.sent(),1]),s=Fe(o[0],2),n=s[1],a.label=5;case 5:return[2,n]}}))}))},e.prototype.mergePage=function(e,t,n){return De(this,void 0,void 0,(function(){var r,i,o,s,a,u,c;return Ue(this,(function(l){switch(l.label){case 0:r=new Map;try{for(i=Le(n),o=i.next();!o.done;o=i.next())s=o.value,r.set(s.id,s)}catch(e){u={error:e}}finally{try{o&&!o.done&&(c=i.return)&&c.call(i)}finally{if(u)throw u.error}}return a=Be(r.values()),[4,e.batchSave(t,a,this.ownSymbol)];case 1:return[2,l.sent()]}}))}))},e}(),ze=n(4),Ke=function(){return(Ke=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},He=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Ve=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Ge=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},We=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},Ye=function(){function e(e,t,n,r){this.schema=e,this.MutationEvent=t,this.modelInstanceCreator=n,this.ownSymbol=r}return e.prototype.enqueue=function(e,t){return He(this,void 0,void 0,(function(){var n=this;return Ve(this,(function(r){return e.runExclusive((function(e){return He(n,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f=this;return Ve(this,(function(d){switch(d.label){case 0:return n=this.schema.namespaces[x.d].models.MutationEvent,r=A.a.createFromExisting(n,(function(e){return e.modelId("eq",t.modelId).id("ne",f.inProgressMutationEventId)})),[4,e.query(this.MutationEvent,r)];case 1:return i=We.apply(void 0,[d.sent(),1]),void 0!==(o=i[0])?[3,3]:[4,e.save(t,void 0,this.ownSymbol)];case 2:return d.sent(),[2];case 3:return s=t.operation,o.operation!==ze.a.CREATE?[3,8]:s!==ze.a.DELETE?[3,5]:[4,e.delete(this.MutationEvent,r)];case 4:return d.sent(),[3,7];case 5:return a=this.mergeUserFields(o,t),[4,e.save(this.MutationEvent.copyOf(o,(function(e){e.data=a.data})),void 0,this.ownSymbol)];case 6:d.sent(),d.label=7;case 7:return[3,12];case 8:return u=t.condition,c=JSON.parse(u),l=void 0,0!==Object.keys(c).length?[3,10]:(l=this.mergeUserFields(o,t),[4,e.delete(this.MutationEvent,r)]);case 9:d.sent(),d.label=10;case 10:return l=l||t,[4,e.save(l,void 0,this.ownSymbol)];case 11:d.sent(),d.label=12;case 12:return[2]}}))}))})),[2]}))}))},e.prototype.dequeue=function(e,t,n){return He(this,void 0,void 0,(function(){var r;return Ve(this,(function(i){switch(i.label){case 0:return[4,this.peek(e)];case 1:return r=i.sent(),t?[4,this.syncOutboxVersionsOnDequeue(e,t,r,n)]:[3,3];case 2:i.sent(),i.label=3;case 3:return[4,e.delete(r)];case 4:return i.sent(),this.inProgressMutationEventId=void 0,[2,r]}}))}))},e.prototype.peek=function(e){return He(this,void 0,void 0,(function(){var t;return Ve(this,(function(n){switch(n.label){case 0:return[4,e.queryOne(this.MutationEvent,v.j.FIRST)];case 1:return t=n.sent(),this.inProgressMutationEventId=t?t.id:void 0,[2,t]}}))}))},e.prototype.getForModel=function(e,t){return He(this,void 0,void 0,(function(){var n;return Ve(this,(function(r){switch(r.label){case 0:return n=this.schema.namespaces[x.d].models.MutationEvent,[4,e.query(this.MutationEvent,A.a.createFromExisting(n,(function(e){return e.modelId("eq",t.id)})))];case 1:return[2,r.sent()]}}))}))},e.prototype.getModelIds=function(e){return He(this,void 0,void 0,(function(){var t,n;return Ve(this,(function(r){switch(r.label){case 0:return[4,e.query(this.MutationEvent)];case 1:return t=r.sent(),n=new Set,t.forEach((function(e){var t=e.modelId;return n.add(t)})),[2,n]}}))}))},e.prototype.syncOutboxVersionsOnDequeue=function(e,t,n,r){return He(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p,v=this;return Ve(this,(function(y){switch(y.label){case 0:return n.operation!==r?[2]:(i=t._version,o=t._lastChangedAt,t._deleted,s=Ge(t,["_version","_lastChangedAt","_deleted"]),a=this.removeTimestampFields(n.model,s),(u=JSON.parse(n.data))?(u._version,u._lastChangedAt,u._deleted,c=Ge(u,["_version","_lastChangedAt","_deleted"]),l=this.removeTimestampFields(n.model,c),Object(x.E)(a,l,!0)?(f=this.schema.namespaces[x.d].models.MutationEvent,d=A.a.createFromExisting(f,(function(e){return e.modelId("eq",t.id).id("ne",v.inProgressMutationEventId)})),[4,e.query(this.MutationEvent,d)]):[2]):[2]);case 1:return(h=y.sent()).length?(p=h.map((function(e){var t=JSON.parse(e.data),n=Ke(Ke({},t),{_version:i,_lastChangedAt:o});return v.MutationEvent.copyOf(e,(function(e){e.data=JSON.stringify(n)}))})),[4,e.delete(this.MutationEvent,d)]):[2];case 2:return y.sent(),[4,Promise.all(p.map((function(t){return He(v,void 0,void 0,(function(){return Ve(this,(function(n){switch(n.label){case 0:return[4,e.save(t,void 0,this.ownSymbol)];case 1:return[2,n.sent()]}}))}))})))];case 3:return y.sent(),[2]}}))}))},e.prototype.mergeUserFields=function(e,t){var n=JSON.parse(e.data),r=n._version,i=n.id,o=n._lastChangedAt,s=n._deleted,a=Ge(n,["_version","id","_lastChangedAt","_deleted"]),u=JSON.parse(t.data),c=(u.id,u._version,u._lastChangedAt,u._deleted,Ge(u,["id","_version","_lastChangedAt","_deleted"])),l=JSON.stringify(Ke(Ke({id:i,_version:r,_lastChangedAt:o,_deleted:s},a),c));return this.modelInstanceCreator(this.MutationEvent,Ke(Ke({},t),{data:l}))},e.prototype.removeTimestampFields=function(e,t){var n,r,i="createdAt",o="updatedAt",s=null===(n=this.schema.namespaces[x.e].models[e].attributes)||void 0===n?void 0:n.find((function(e){return"model"===e.type})),a=null===(r=null==s?void 0:s.properties)||void 0===r?void 0:r.timestamps;return a&&(i=a.createdAt,o=a.updatedAt),delete t[i],delete t[o],t},e}(),Je=n(147),$e=n(23),Ze=function(){return(Ze=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},Qe=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Xe=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},et=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},tt=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},nt=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},rt=new i.a("DataStore"),it=function(){function e(e,t,n,i,o,s,a,u,c,l,f){void 0===a&&(a={}),this.schema=e,this.storage=t,this.userClasses=n,this.outbox=i,this.modelInstanceCreator=o,this.MutationEvent=s,this.amplifyConfig=a,this.authModeStrategy=u,this.errorHandler=c,this.conflictHandler=l,this.amplifyContext=f,this.typeQuery=new WeakMap,this.processing=!1,this.amplifyContext.API=this.amplifyContext.API||r.a,this.generateQueries()}return e.prototype.generateQueries=function(){var e=this;Object.values(this.schema.namespaces).forEach((function(t){Object.values(t.models).filter((function(e){return e.syncable})).forEach((function(n){var r=tt(Object(ze.b)(t,n,"CREATE"),1)[0],i=tt(Object(ze.b)(t,n,"UPDATE"),1)[0],o=tt(Object(ze.b)(t,n,"DELETE"),1)[0];e.typeQuery.set(n,[r,i,o])}))}))},e.prototype.isReady=function(){return void 0!==this.observer},e.prototype.start=function(){var e=this;return new d.a((function(t){return e.observer=t,e.resume(),function(){e.pause()}}))},e.prototype.resume=function(){return Qe(this,void 0,void 0,(function(){var e,t,n,r,i,o=this;return Xe(this,(function(s){switch(s.label){case 0:if(this.processing||!this.isReady())return[2];this.processing=!0,t=x.e,n=function(){var n,i,s,a,u,c,l,f,d,h,p,v,y,g,m,b;return Xe(this,(function(w){switch(w.label){case 0:n=e.model,i=e.operation,s=e.data,a=e.condition,u=r.userClasses[n],c=void 0,l=void 0,f=void 0,w.label=1;case 1:return w.trys.push([1,4,,5]),[4,Object(ze.h)({authModeStrategy:r.authModeStrategy,defaultAuthMode:r.amplifyConfig.aws_appsync_authenticationType,modelName:n,schema:r.schema})];case 2:return d=w.sent(),h=d[i.toUpperCase()],p=0,[4,(v=function(){return Qe(o,void 0,void 0,(function(){var r,o;return Xe(this,(function(c){switch(c.label){case 0:return c.trys.push([0,2,,4]),rt.debug("Attempting mutation with authMode: "+h[p]),[4,this.jitteredRetry(t,n,i,s,a,u,this.MutationEvent,e,h[p])];case 1:return r=c.sent(),rt.debug("Mutation sent successfully with authMode: "+h[p]),[2,r];case 2:if(o=c.sent(),++p>=h.length)throw rt.debug("Mutation failed with authMode: "+h[p-1]),o;return rt.debug("Mutation failed with authMode: "+h[p-1]+". Retrying with authMode: "+h[p]),[4,v()];case 3:return[2,c.sent()];case 4:return[2]}}))}))})()];case 3:return b=tt.apply(void 0,[w.sent(),3]),c=b[0],l=b[1],f=b[2],[3,5];case 4:return"Offline"===(y=w.sent()).message||"RetryMutation"===y.message?[2,"continue"]:[3,5];case 5:return void 0!==c?[3,7]:(rt.debug("done retrying"),[4,r.storage.runExclusive((function(e){return Qe(o,void 0,void 0,(function(){return Xe(this,(function(t){switch(t.label){case 0:return[4,this.outbox.dequeue(e)];case 1:return t.sent(),[2]}}))}))}))]);case 6:return w.sent(),[2,"continue"];case 7:return g=c.data[l],m=!1,[4,r.storage.runExclusive((function(e){return Qe(o,void 0,void 0,(function(){return Xe(this,(function(t){switch(t.label){case 0:return[4,this.outbox.dequeue(e,g,i)];case 1:return t.sent(),[4,this.outbox.peek(e)];case 2:return m=void 0!==t.sent(),[2]}}))}))}))];case 8:return w.sent(),r.observer.next({operation:i,modelDefinition:f,model:g,hasMore:m}),[2]}}))},r=this,s.label=1;case 1:return(i=this.processing)?[4,this.outbox.peek(this.storage)]:[3,3];case 2:i=void 0!==(e=s.sent()),s.label=3;case 3:return i?[5,n()]:[3,5];case 4:return s.sent(),[3,1];case 5:return this.pause(),[2]}}))}))},e.prototype.jitteredRetry=function(e,t,n,r,i,o,s,a,u){return Qe(this,void 0,void 0,(function(){var c=this;return Xe(this,(function(l){switch(l.label){case 0:return[4,Object(Je.d)((function(t,n,r,i,o,s,a){return Qe(c,void 0,void 0,(function(){var c,l,f,d,h,p,y,g,m,b,w,S,_,E,A,O,I,T,C,P,k,N,M,j,R,D,U;return Xe(this,(function(F){switch(F.label){case 0:return c=tt(this.createQueryVariables(e,t,n,r,i),5),l=c[0],f=c[1],d=c[2],h=c[3],p=c[4],[4,Object(ze.i)(u,this.amplifyConfig)];case 1:y=F.sent(),g={query:l,variables:f,authMode:u,authToken:y,userAgentSuffix:x.f},m=0,b=this.opTypeFromTransformerOperation(n),F.label=2;case 2:return F.trys.push([2,4,,20]),[4,this.amplifyContext.API.graphql(g)];case 3:return[2,[F.sent(),h,p]];case 4:if(!((w=F.sent()).errors&&w.errors.length>0))return[3,18];if(S=tt(w.errors,1),_=S[0],E=_.originalError,A=(void 0===E?{}:E).code,O=void 0===A?null:A,"Unauthorized"===_.errorType)throw new Je.a("Unauthorized");if("Network Error"===_.message||"ECONNABORTED"===O){if(!this.processing)throw new Je.a("Offline");throw new Error("Network Error")}return"ConflictUnhandled"!==_.errorType?[3,13]:(m++,I=void 0,m>10?(I=v.b,[3,8]):[3,5]);case 5:return F.trys.push([5,7,,8]),[4,this.conflictHandler({modelConstructor:o,localModel:this.modelInstanceCreator(o,f.input),remoteModel:this.modelInstanceCreator(o,_.data),operation:b,attempts:m})];case 6:return I=F.sent(),[3,8];case 7:return T=F.sent(),rt.warn("conflict trycatch",T),[3,20];case 8:return I!==v.b?[3,11]:(C=tt(Object(ze.b)(this.schema.namespaces[e],p,"GET"),1),P=tt(C[0],3),k=P[1],N=P[2],[4,Object(ze.i)(u,this.amplifyConfig)]);case 9:return M=F.sent(),[4,this.amplifyContext.API.graphql({query:N,variables:{id:f.input.id},authMode:u,authToken:M,userAgentSuffix:x.f})];case 10:return[2,[F.sent(),k,p]];case 11:return j=this.schema.namespaces[e],R=Object(ze.d)(j.relationships,p,b,o,I,d,s,this.modelInstanceCreator,a.id),[4,this.storage.save(R)];case 12:throw F.sent(),new Je.a("RetryMutation");case 13:return F.trys.push([13,15,16,17]),[4,this.errorHandler({recoverySuggestion:"Ensure app code is up to date, auth directives exist and are correct on each model, and that server-side data has not been invalidated by a schema change. If the problem persists, search for or create an issue: https://github.com/aws-amplify/amplify-js/issues",localModel:f.input,message:_.message,operation:n,errorType:Object($e.a)(_),errorInfo:_.errorInfo,process:v.i.mutate,cause:_,remoteModel:_.data?this.modelInstanceCreator(o,_.data):null})];case 14:return F.sent(),[3,17];case 15:return D=F.sent(),rt.warn("Mutation error handler failed with:",D),[3,17];case 16:return[2,_.data?[{data:(U={},U[h]=_.data,U)},h,p]:[]];case 17:return[3,19];case 18:throw new Je.a(w);case 19:return[3,20];case 20:if(g)return[3,2];F.label=21;case 21:return[2]}}))}))}),[t,n,r,i,o,s,a],st)];case 1:return[2,l.sent()]}}))}))},e.prototype.createQueryVariables=function(e,t,n,r,i){var o,s,a=this.schema.namespaces[e].models[t],u=this.schema.namespaces[e].keys[t].primaryKey,c=this.typeQuery.get(a),l=tt(c.find((function(e){return tt(e,1)[0]===n})),3),f=l[1],d=l[2],h=JSON.parse(r),p=h._version,y=et(h,["_version"]),g={};if(u&&u.length)try{for(var m=nt(u),b=m.next();!b.done;b=m.next()){var w=b.value;g[w]=y[w]}}catch(e){o={error:e}}finally{try{b&&!b.done&&(s=m.return)&&s.call(m)}finally{if(o)throw o.error}}else g.id=y.id;var S=n===ze.a.DELETE?g:Object.values(a.fields).filter((function(e){var t=e.name,r=e.type,i=e.association;return Object(v.s)(r)?!(!Object(v.x)(i)||"BELONGS_TO"!==i.connectionType):n!==ze.a.UPDATE||y.hasOwnProperty(t)})).map((function(e){var t=e.name,n=e.type,r=e.association,i=t,o=y[t];return Object(v.s)(n)&&Object(v.x)(r)&&(i=r.targetName,o=y[i]),[i,o]})).reduce((function(e,t){var n=tt(t,2),r=n[0],i=n[1];return e[r]=i,e}),{}),_=Ze(Ze({},S),{_version:p}),E=JSON.parse(i);return[d,Ze({input:_},n===ze.a.CREATE?{}:{condition:Object.keys(E).length>0?E:null}),E,f,a]},e.prototype.opTypeFromTransformerOperation=function(e){switch(e){case ze.a.CREATE:return v.h.INSERT;case ze.a.DELETE:return v.h.DELETE;case ze.a.UPDATE:return v.h.UPDATE;case ze.a.GET:break;default:Object(x.h)(e)}},e.prototype.pause=function(){this.processing=!1},e}(),ot=Object(Je.b)(3e5),st=function(e,t,n){var r=ot(e);return!1===r&&"Network Error"===(null==n?void 0:n.message)?3e5:r},at=n(42),ut=function(){return(ut=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},ct=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},lt=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},ft=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},dt=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ht={items:[],nextToken:null,startedAt:null},pt=new i.a("DataStore"),vt=function(){function e(e,t,n,i,o,s){void 0===n&&(n={}),this.schema=e,this.syncPredicates=t,this.amplifyConfig=n,this.authModeStrategy=i,this.errorHandler=o,this.amplifyContext=s,this.typeQuery=new WeakMap,s.API=s.API||r.a,this.generateQueries()}return e.prototype.generateQueries=function(){var e=this;Object.values(this.schema.namespaces).forEach((function(t){Object.values(t.models).filter((function(e){return e.syncable})).forEach((function(n){var r=ft(Object(ze.b)(t,n,"LIST"),1),i=ft(r[0]).slice(1);e.typeQuery.set(n,i)}))}))},e.prototype.graphqlFilterFromPredicate=function(e){if(!this.syncPredicates)return null;var t=A.a.getPredicates(this.syncPredicates.get(e),!1);return t?Object(ze.l)(t):null},e.prototype.retrievePage=function(e,t,n,r,i){return void 0===r&&(r=null),ct(this,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h,p,v,y,g,m=this;return lt(this,(function(b){switch(b.label){case 0:return o=ft(this.typeQuery.get(e),2),s=o[0],a=o[1],u={limit:r,nextToken:n,lastSync:t,filter:i},[4,Object(ze.h)({authModeStrategy:this.authModeStrategy,defaultAuthMode:this.amplifyConfig.aws_appsync_authenticationType,modelName:e.name,schema:this.schema})];case 1:return c=b.sent(),l=c.READ,f=0,[4,(d=function(){return ct(m,void 0,void 0,(function(){var t,n,r,i;return lt(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,4]),pt.debug("Attempting sync with authMode: "+l[f]),[4,this.jitteredRetry({query:a,variables:u,opName:s,modelDefinition:e,authMode:l[f]})];case 1:return t=o.sent(),pt.debug("Sync successful with authMode: "+l[f]),[2,t];case 2:if(n=o.sent(),++f>=l.length){if(r=l[f-1],pt.debug("Sync failed with authMode: "+r,n),Object(ze.f)(n)||Object(ze.g)(n))return pt.warn("User is unauthorized to query "+s+" with auth mode "+r+". No data could be returned."),[2,{data:(i={},i[s]=ht,i)}];throw n}return pt.debug("Sync failed with authMode: "+l[f-1]+". Retrying with authMode: "+l[f]),[4,d()];case 3:return[2,o.sent()];case 4:return[2]}}))}))})()];case 2:return h=b.sent().data,p=h[s],v=p.items,y=p.nextToken,g=p.startedAt,[2,{nextToken:y,startedAt:g,items:v}]}}))}))},e.prototype.partialDataFeatureFlagEnabled=function(){try{var e=sessionStorage.getItem("datastorePartialData");return Boolean(e)}catch(e){return!1}},e.prototype.jitteredRetry=function(e){var t=e.query,n=e.variables,r=e.opName,i=e.modelDefinition,o=e.authMode;return ct(this,void 0,void 0,(function(){var e=this;return lt(this,(function(a){switch(a.label){case 0:return[4,Object(Je.c)((function(t,n){return ct(e,void 0,void 0,(function(){var e,a,u,c,l,f=this;return lt(this,(function(d){switch(d.label){case 0:return d.trys.push([0,3,,8]),[4,Object(ze.i)(o,this.amplifyConfig)];case 1:return e=d.sent(),[4,this.amplifyContext.API.graphql({query:t,variables:n,authMode:o,authToken:e,userAgentSuffix:x.f})];case 2:return[2,d.sent()];case 3:if(a=d.sent(),u=Object(ze.f)(a)||Object(ze.g)(a))throw new Je.a(u);return c=Boolean(a&&a.data&&a.data[r]&&a.data[r].items),this.partialDataFeatureFlagEnabled()?c?((l=a).data[r].items=l.data[r].items.filter((function(e){return null!==e})),a.errors?[4,Promise.all(a.errors.map((function(e){return ct(f,void 0,void 0,(function(){var t;return lt(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.errorHandler({recoverySuggestion:"Ensure app code is up to date, auth directives exist and are correct on each model, and that server-side data has not been invalidated by a schema change. If the problem persists, search for or create an issue: https://github.com/aws-amplify/amplify-js/issues",localModel:null,message:e.message,model:i.name,operation:r,errorType:Object($e.c)(e),process:v.i.sync,remoteModel:null,cause:e})];case 1:return n.sent(),[3,3];case 2:return t=n.sent(),pt.error("Sync error handler failed with:",t),[3,3];case 3:return[2]}}))}))})))]:[3,5]):[3,6]:[3,7];case 4:d.sent(),s.a.dispatch("datastore",{event:"syncQueriesPartialSyncError",data:{errors:a.errors,modelName:i.name}}),d.label=5;case 5:return[2,l];case 6:throw a;case 7:if(a&&a.errors&&a.errors.some((function(e){return"Unauthorized"===e.errorType})))return l=a,c?l.data[r].items=l.data[r].items.filter((function(e){return null!==e})):l.data[r]=ut(ut({},ht),l.data[r]),pt.warn("queryError","User is unauthorized to query "+r+", some items could not be returned."),[2,l];throw a;case 8:return[2]}}))}))}),[t,n])];case 1:return[2,a.sent()]}}))}))},e.prototype.start=function(e){var t=this,n=!0,r=this.amplifyConfig,i=r.maxRecordsToSync,o=r.syncPageSize,s=new Map;return new d.a((function(r){var a=Object.values(t.schema.namespaces).reduce((function(t,n){var r,i;try{for(var o=dt(Array.from(n.modelTopologicalOrdering.keys())),s=o.next();!s.done;s=o.next()){var a=s.value,u=e.get(n.models[a]);t.set(n.models[a],u)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return t}),new Map),u=Array.from(a.entries()).filter((function(e){return ft(e,1)[0].syncable})).map((function(e){var a=ft(e,2),u=a[0],c=ft(a[1],2),l=c[0],f=c[1];return ct(t,void 0,void 0,(function(){var e,t,a,c,d,h,p,v,y,g=this;return lt(this,(function(m){switch(m.label){case 0:return e=!1,t=null,a=null,c=null,d=0,h=this.graphqlFilterFromPredicate(u),p=this.schema.namespaces[l].modelTopologicalOrdering.get(u.name),v=p.map((function(e){return s.get(l+"_"+e)})),y=new Promise((function(s){return ct(g,void 0,void 0,(function(){var p,y;return lt(this,(function(g){switch(g.label){case 0:return[4,Promise.all(v)];case 1:g.sent(),g.label=2;case 2:return n?(p=Math.min(i-d,o),[4,this.retrievePage(u,f,t,p,h)]):[2];case 3:y=g.sent(),c=y.items,t=y.nextToken,a=y.startedAt,d+=c.length,e=null===t||d>=i,r.next({namespace:l,modelDefinition:u,items:c,done:e,startedAt:a,isFullSync:!f}),g.label=4;case 4:if(!e)return[3,2];g.label=5;case 5:return s(),[2]}}))}))})),s.set(l+"_"+u.name,y),[4,y];case 1:return m.sent(),[2]}}))}))}));return Promise.all(u).then((function(){r.complete()})),function(){n=!1}}))},e}(),yt=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},gt=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},mt=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},bt=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},wt=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(mt(arguments[t]));return e},St=Object(o.b)().isNode,_t=new i.a("DataStore"),Et=Symbol("sync");!function(e){e.SYNC_ENGINE_STORAGE_SUBSCRIBED="storageSubscribed",e.SYNC_ENGINE_SUBSCRIPTIONS_ESTABLISHED="subscriptionsEstablished",e.SYNC_ENGINE_SYNC_QUERIES_STARTED="syncQueriesStarted",e.SYNC_ENGINE_SYNC_QUERIES_READY="syncQueriesReady",e.SYNC_ENGINE_MODEL_SYNCED="modelSynced",e.SYNC_ENGINE_OUTBOX_MUTATION_ENQUEUED="outboxMutationEnqueued",e.SYNC_ENGINE_OUTBOX_MUTATION_PROCESSED="outboxMutationProcessed",e.SYNC_ENGINE_OUTBOX_STATUS="outboxStatus",e.SYNC_ENGINE_NETWORK_STATUS="networkStatus",e.SYNC_ENGINE_READY="ready"}(pe||(pe={}));var At=function(){function e(e,t,n,r,i,o,s,a,u,c,l,f){void 0===c&&(c={}),this.schema=e,this.namespaceResolver=t,this.modelClasses=n,this.userModelClasses=r,this.storage=i,this.modelInstanceCreator=o,this.syncPredicates=u,this.amplifyConfig=c,this.authModeStrategy=l,this.amplifyContext=f,this.online=!1,this.modelSyncedStatus=new WeakMap;var d=this.modelClasses.MutationEvent;this.outbox=new Ye(this.schema,d,o,Et),this.modelMerger=new qe(this.outbox,Et),this.syncQueriesProcessor=new vt(this.schema,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,a,this.amplifyContext),this.subscriptionsProcessor=new at.b(this.schema,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,a,this.amplifyContext),this.mutationsProcessor=new it(this.schema,this.storage,this.userModelClasses,this.outbox,this.modelInstanceCreator,d,this.amplifyConfig,this.authModeStrategy,a,s,this.amplifyContext),this.datastoreConnectivity=new Re}return e.prototype.getModelSyncedStatus=function(e){return this.modelSyncedStatus.get(e)},e.prototype.start=function(e){var t=this;return new d.a((function(n){_t.log("starting sync engine...");var r=[];return yt(t,void 0,void 0,(function(){var t,i,o,s=this;return gt(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.setupModels(e)];case 1:return a.sent(),[3,3];case 2:return t=a.sent(),n.error(t),[2];case 3:return i=new Promise((function(e){s.datastoreConnectivity.status().subscribe((function(t){var i=t.online;return yt(s,void 0,void 0,(function(){var t,o,s,a,u,c=this;return gt(this,(function(l){switch(l.label){case 0:return!i||this.online?[3,10]:(this.online=i,n.next({type:pe.SYNC_ENGINE_NETWORK_STATUS,data:{active:this.online}}),o=void 0,St?(_t.warn("Realtime disabled when in a server-side environment"),[3,6]):[3,1]);case 1:u=mt(this.subscriptionsProcessor.start(),2),t=u[0],o=u[1],l.label=2;case 2:return l.trys.push([2,4,,5]),[4,new Promise((function(e,n){var i=t.subscribe({next:function(t){t===at.a.CONNECTED&&e()},error:function(e){n(e),c.disconnectionHandler()(e)}});r.push(i)}))];case 3:return l.sent(),[3,5];case 4:return s=l.sent(),n.error(s),[2];case 5:_t.log("Realtime ready"),n.next({type:pe.SYNC_ENGINE_SUBSCRIPTIONS_ESTABLISHED}),l.label=6;case 6:return l.trys.push([6,8,,9]),[4,new Promise((function(e,t){var i=c.syncQueriesObservable().subscribe({next:function(t){t.type===pe.SYNC_ENGINE_SYNC_QUERIES_READY&&e(),n.next(t)},complete:function(){e()},error:function(e){t(e)}});i&&r.push(i)}))];case 7:return l.sent(),[3,9];case 8:return a=l.sent(),n.error(a),[2];case 9:return r.push(this.mutationsProcessor.start().subscribe((function(e){var t=e.modelDefinition,r=e.model,i=e.hasMore,o=c.userModelClasses[t.name],s=c.modelInstanceCreator(o,r);c.storage.runExclusive((function(e){return c.modelMerger.merge(e,s)})),n.next({type:pe.SYNC_ENGINE_OUTBOX_MUTATION_PROCESSED,data:{model:o,element:s}}),n.next({type:pe.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:!i}})}))),St||r.push(o.subscribe((function(e){var t=mt(e,3),n=(t[0],t[1]),r=t[2],i=c.userModelClasses[n.name],o=c.modelInstanceCreator(i,r);c.storage.runExclusive((function(e){return c.modelMerger.merge(e,o)}))}))),[3,11];case 10:i||(this.online=i,n.next({type:pe.SYNC_ENGINE_NETWORK_STATUS,data:{active:this.online}}),r.forEach((function(e){return e.unsubscribe()})),r=[]),l.label=11;case 11:return e(),[2]}}))}))}))})),this.storage.observe(null,null,Et).filter((function(e){var t=e.model;return!0===s.getModelDefinition(t).syncable})).subscribe({next:function(e){var t=e.opType,r=e.model,o=e.element,a=e.condition;return yt(s,void 0,void 0,(function(){var e,s,u,c;return gt(this,(function(l){switch(l.label){case 0:return e=this.schema.namespaces[this.namespaceResolver(r)],s=this.modelClasses.MutationEvent,u=Object(ze.k)(a),c=Object(ze.d)(e.relationships,this.getModelDefinition(r),t,r,o,u,s,this.modelInstanceCreator),[4,this.outbox.enqueue(this.storage,c)];case 1:return l.sent(),n.next({type:pe.SYNC_ENGINE_OUTBOX_MUTATION_ENQUEUED,data:{model:r,element:o}}),n.next({type:pe.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:!1}}),[4,i];case 2:return l.sent(),this.online&&this.mutationsProcessor.resume(),[2]}}))}))}}),n.next({type:pe.SYNC_ENGINE_STORAGE_SUBSCRIBED}),[4,this.outbox.peek(this.storage)];case 4:return o=void 0===a.sent(),n.next({type:pe.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:o}}),[4,i];case 5:return a.sent(),n.next({type:pe.SYNC_ENGINE_READY}),[2]}}))})),function(){r.forEach((function(e){return e.unsubscribe()}))}}))},e.prototype.getModelsMetadataWithNextFullSync=function(e){return yt(this,void 0,void 0,(function(){var t,n=this;return gt(this,(function(r){switch(r.label){case 0:return t=Map.bind,[4,this.getModelsMetadata()];case 1:return[2,new(t.apply(Map,[void 0,r.sent().map((function(t){var r=t.namespace,i=t.model,o=t.lastSync,s=t.lastFullSync,a=t.fullSyncInterval,u=(t.lastSyncPredicate,!s||s+a<e?0:o);return[n.schema.namespaces[r].models[i],[r,u]]}))]))]}}))}))},e.prototype.syncQueriesObservable=function(){var e=this;return this.online?new d.a((function(t){var n,r;return yt(e,void 0,void 0,(function(){var e,i,o=this;return gt(this,(function(s){switch(s.label){case 0:e=function(){var e,s,a,u,c,l,f,d,h;return gt(this,(function(p){switch(p.label){case 0:return e=new WeakMap,[4,i.getModelsMetadataWithNextFullSync(Date.now())];case 1:return s=p.sent(),a=new Set(s.keys()),[4,new Promise((function(r){n=o.syncQueriesProcessor.start(s).subscribe({next:function(i){var s=i.namespace,h=i.modelDefinition,p=i.items,y=i.done,g=i.startedAt,m=i.isFullSync;return yt(o,void 0,void 0,(function(){var i,o,b,w,S,_,E=this;return gt(this,(function(A){switch(A.label){case 0:return i=this.userModelClasses[h.name],e.has(i)||(e.set(i,{new:0,updated:0,deleted:0}),l=Object(x.k)(),d=void 0===d?g:Math.max(d,g)),[4,this.storage.runExclusive((function(t){return yt(E,void 0,void 0,(function(){var n,r,o,s,a,u,c,l,f,d,h,y,g,m,b;return gt(this,(function(w){switch(w.label){case 0:return[4,this.outbox.getModelIds(t)];case 1:n=w.sent(),r=[],o=p.filter((function(e){return!n.has(e.id)||(r.push(e),!1)})),s=[],w.label=2;case 2:w.trys.push([2,7,8,9]),a=bt(r),u=a.next(),w.label=3;case 3:return u.done?[3,6]:(c=u.value,[4,this.modelMerger.merge(t,c)]);case 4:void 0!==(l=w.sent())&&s.push([c,l]),w.label=5;case 5:return u=a.next(),[3,3];case 6:return[3,9];case 7:return f=w.sent(),m={error:f},[3,9];case 8:try{u&&!u.done&&(b=a.return)&&b.call(a)}finally{if(m)throw m.error}return[7];case 9:return h=(d=s.push).apply,y=[s],[4,this.modelMerger.mergePage(t,i,o)];case 10:return h.apply(d,y.concat([wt.apply(void 0,[w.sent()])])),g=e.get(i),s.forEach((function(e){var t=mt(e,2)[1];switch(t){case v.h.INSERT:g.new++;break;case v.h.UPDATE:g.updated++;break;case v.h.DELETE:g.deleted++;break;default:Object(x.h)(t)}})),[2]}}))}))}))];case 1:return A.sent(),y?(o=h.name,[4,this.getModelMetadata(s,o)]):[3,4];case 2:return b=A.sent(),w=b.lastFullSync,S=b.fullSyncInterval,c=S,u=void 0===u?w:Math.max(u,m?g:w),b=this.modelClasses.ModelMetadata.copyOf(b,(function(e){e.lastSync=g,e.lastFullSync=m?g:b.lastFullSync})),[4,this.storage.save(b,void 0,Et)];case 3:A.sent(),_=e.get(i),this.modelSyncedStatus.set(i,!0),t.next({type:pe.SYNC_ENGINE_MODEL_SYNCED,data:{model:i,isFullSync:m,isDeltaSync:!m,counts:_}}),a.delete(h),0===a.size&&(f=Object(x.k)()-l,r(),t.next({type:pe.SYNC_ENGINE_SYNC_QUERIES_READY}),n.unsubscribe()),A.label=4;case 4:return[2]}}))}))},error:function(e){t.error(e)}}),t.next({type:pe.SYNC_ENGINE_SYNC_QUERIES_STARTED,data:{models:Array.from(a).map((function(e){return e.name}))}})}))];case 2:return p.sent(),h=u+c-(d+f),_t.debug("Next fullSync in "+h/1e3+" seconds. ("+new Date(Date.now()+h)+")"),[4,new Promise((function(e){r=setTimeout(e,h)}))];case 3:return p.sent(),[2]}}))},i=this,s.label=1;case 1:return t.closed?[3,3]:[5,e()];case 2:return s.sent(),[3,1];case 3:return[2]}}))})),function(){n&&n.unsubscribe(),r&&clearTimeout(r)}})):d.a.of()},e.prototype.disconnectionHandler=function(){var e=this;return function(t){ke.CONTROL_MSG.CONNECTION_CLOSED!==t&&ke.CONTROL_MSG.TIMEOUT_DISCONNECT!==t||e.datastoreConnectivity.socketDisconnected()}},e.prototype.unsubscribeConnectivity=function(){this.datastoreConnectivity.unsubscribe()},e.prototype.setupModels=function(e){return yt(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,f,d,h,p=this;return gt(this,(function(v){switch(v.label){case 0:t=e.fullSyncInterval,n=this.modelClasses.ModelMetadata,r=[],Object.values(this.schema.namespaces).forEach((function(e){Object.values(e.models).filter((function(e){return e.syncable})).forEach((function(t){if(r.push([e.name,t]),e.name===x.e){var n=p.userModelClasses[t.name];p.modelSyncedStatus.set(n,!1)}}))})),o=r.map((function(e){var r=mt(e,2),o=r[0],s=r[1];return yt(p,void 0,void 0,(function(){var e,r,a,u,c,l,f,d,h;return gt(this,(function(p){switch(p.label){case 0:return[4,this.getModelMetadata(o,s.name)];case 1:return e=p.sent(),r=A.a.getPredicates(this.syncPredicates.get(s),!1),a=r?JSON.stringify(r):null,void 0!==e?[3,3]:[4,this.storage.save(this.modelInstanceCreator(n,{model:s.name,namespace:o,lastSync:null,fullSyncInterval:t,lastFullSync:null,lastSyncPredicate:a}),void 0,Et)];case 2:return l=mt.apply(void 0,[p.sent(),1]),f=mt(l[0],1),i=f[0],[3,5];case 3:return u=e.lastSyncPredicate?e.lastSyncPredicate:null,c=u!==a,[4,this.storage.save(this.modelClasses.ModelMetadata.copyOf(e,(function(e){e.fullSyncInterval=t,c&&(e.lastSync=null,e.lastFullSync=null,e.lastSyncPredicate=a)})))];case 4:d=mt.apply(void 0,[p.sent(),1]),h=mt(d[0],1),i=h[0],p.label=5;case 5:return[2,i]}}))}))})),s={},v.label=1;case 1:return v.trys.push([1,6,7,8]),[4,Promise.all(o)];case 2:a=bt.apply(void 0,[v.sent()]),u=a.next(),v.label=3;case 3:if(u.done)return[3,5];c=u.value,l=c.model,s[l]=c,v.label=4;case 4:return u=a.next(),[3,3];case 5:return[3,8];case 6:return f=v.sent(),d={error:f},[3,8];case 7:try{u&&!u.done&&(h=a.return)&&h.call(a)}finally{if(d)throw d.error}return[7];case 8:return[2,s]}}))}))},e.prototype.getModelsMetadata=function(){return yt(this,void 0,void 0,(function(){var e;return gt(this,(function(t){switch(t.label){case 0:return e=this.modelClasses.ModelMetadata,[4,this.storage.query(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.getModelMetadata=function(e,t){return yt(this,void 0,void 0,(function(){var n,r,i;return gt(this,(function(o){switch(o.label){case 0:return n=this.modelClasses.ModelMetadata,r=A.a.createFromExisting(this.schema.namespaces[x.d].models[n.name],(function(n){return n.namespace("eq",e).model("eq",t)})),[4,this.storage.query(n,r,{page:0,limit:1})];case 1:return i=mt.apply(void 0,[o.sent(),1]),[2,i[0]]}}))}))},e.prototype.getModelDefinition=function(e){var t=this.namespaceResolver(e);return this.schema.namespaces[t].models[e.name]},e.getNamespace=function(){return{name:x.d,relationships:{},enums:{OperationType:{name:"OperationType",values:["CREATE","UPDATE","DELETE"]}},nonModels:{},models:{MutationEvent:{name:"MutationEvent",pluralName:"MutationEvents",syncable:!1,fields:{id:{name:"id",type:"ID",isRequired:!0,isArray:!1},model:{name:"model",type:"String",isRequired:!0,isArray:!1},data:{name:"data",type:"String",isRequired:!0,isArray:!1},modelId:{name:"modelId",type:"String",isRequired:!0,isArray:!1},operation:{name:"operation",type:{enum:"Operationtype"},isArray:!1,isRequired:!0},condition:{name:"condition",type:"String",isArray:!1,isRequired:!0}}},ModelMetadata:{name:"ModelMetadata",pluralName:"ModelsMetadata",syncable:!1,fields:{id:{name:"id",type:"ID",isRequired:!0,isArray:!1},namespace:{name:"namespace",type:"String",isRequired:!0,isArray:!1},model:{name:"model",type:"String",isRequired:!0,isArray:!1},lastSync:{name:"lastSync",type:"Int",isRequired:!1,isArray:!1},lastFullSync:{name:"lastFullSync",type:"Int",isRequired:!1,isArray:!1},fullSyncInterval:{name:"fullSyncInterval",type:"Int",isRequired:!0,isArray:!1},lastSyncPredicate:{name:"lastSyncPredicate",type:"String",isRequired:!1,isArray:!1}}}}}},e}();function Ot(e){return(Ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var It=function(){return(It=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},Tt=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Ct=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},xt=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},Pt=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},kt=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Nt=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Pt(arguments[t]));return e};Object(l.e)(!0),Object(l.b)();var Mt,jt,Rt,Dt,Ut,Ft=new i.a("DataStore"),Lt=Object(x.z)(Date.now()),Bt=o.a.browserOrNode().isNode,qt=new WeakMap,zt=new WeakMap,Kt=function(e){var t=qt.get(e);return Mt.namespaces[t].models[e.name]},Ht=function(e){return Object(x.u)(e)&&qt.has(e)},Vt=function(e){return qt.get(e)},Gt=function(e){var t;if(void 0!==Mt)return console.warn("The schema has already been initialized"),Rt;Ft.log("validating schema",{schema:e});var n=It({name:x.e},e);Ft.log("DataStore","Init models"),Rt=Yt(n),Ft.log("DataStore","Models initialized");var r={name:x.a,relationships:{},enums:{},nonModels:{},models:{Setting:{name:"Setting",pluralName:"Settings",syncable:!1,fields:{id:{name:"id",type:"ID",isRequired:!0,isArray:!1},key:{name:"key",type:"String",isRequired:!0,isArray:!1},value:{name:"value",type:"String",isRequired:!0,isArray:!1}}}}},i=Pe.getNamespace(),o=At.getNamespace();return Dt=Yt(r),Ut=Yt(i),jt=Yt(o),Mt={namespaces:(t={},t[r.name]=r,t[n.name]=n,t[i.name]=i,t[o.name]=o,t),version:e.version},Object.keys(Mt.namespaces).forEach((function(e){var t,n,r=Pt(Object(x.g)(Mt.namespaces[e]),2),i=r[0],o=r[1];Mt.namespaces[e].relationships=i,Mt.namespaces[e].keys=o;var s=new Map;Object.values(Mt.namespaces[e].models).forEach((function(e){var t=[];Object.values(e.fields).filter((function(t){return t.association&&"BELONGS_TO"===t.association.connectionType&&t.type.model!==e.name})).forEach((function(e){return t.push(e.type.model)})),s.set(e.name,t)}));for(var a=new Map,u=1e3;u>0&&0!==s.size;){if(0===--u)throw new Error("Models are not topologically sortable. Please verify your schema.");try{for(var c=(t=void 0,kt(Array.from(s.keys()))),l=c.next();!l.done;l=c.next()){var f=l.value,d=s.get(f);d.every((function(e){return a.has(e)}))&&a.set(f,d)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}Array.from(a.keys()).forEach((function(e){return s.delete(e)}))}Mt.namespaces[e].modelTopologicalOrdering=a})),Rt},Wt=function(){if(void 0===Mt){var e="Schema is not initialized. DataStore will not function as expected. This could happen if you have multiple versions of DataStore installed. Please see https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js/#check-for-duplicate-versions";throw Ft.error(e),new Error(e)}},Yt=function(e){var t={};return Object.entries(e.models).forEach((function(n){var r=Pt(n,2),i=r[0],o=r[1],s=tn(o);t[i]=s,qt.set(s,e.name)})),Object.entries(e.nonModels||{}).forEach((function(e){var n=Pt(e,2),r=n[0],i=n[1],o=on(i);t[r]=o})),t},Jt=new WeakSet;function $t(e,t){return Jt.add(t),new e(t)}var Zt,Qt=function(e){return function(t,n){var r=e.fields[t];if(void 0!==r){var i=r.type,o=r.isRequired,s=r.isArrayNullable,a=r.name,u=r.isArray;if((!u&&o||u&&!s)&&null==n)throw new Error("Field "+a+" is required");if(Object(v.n)(i)){var c=v.c.getJSType(i),l=v.c.getValidationFunction(i);if("AWSJSON"===i){if(Ot(n)===c)return;if("string"==typeof n)try{return void JSON.parse(n)}catch(e){throw new Error("Field "+a+" is an invalid JSON object. "+n)}}if(u){var f=c;if(o||(f=c+" | null | undefined"),!Array.isArray(n)&&!s)throw new Error("Field "+a+" should be of type ["+f+"], "+Ot(n)+" received. "+n);if(!Object(x.w)(n)&&n.some((function(e){return Object(x.w)(e)?o:Ot(e)!==c}))){var d=n.map((function(e){return null===e?"null":Ot(e)})).join(",");throw new Error("All elements in the "+a+" array should be of type "+f+", ["+d+"] received. "+n)}if(l&&!Object(x.w)(n))if(!n.map((function(e){return Object(x.w)(e)?!(!Object(x.w)(e)||o):l(e)})).every((function(e){return e})))throw new Error("All elements in the "+a+" array should be of type "+i+", validation failed for one or more elements. "+n)}else{if(!o&&void 0===n)return;if(Ot(n)!==c&&null!==n)throw new Error("Field "+a+" should be of type "+c+", "+Ot(n)+" received. "+n);if(!Object(x.w)(n)&&l&&!l(n))throw new Error("Field "+a+" should be of type "+i+", validation failed. "+n)}}}}},Xt=function(e,t,n){var r=e.fields[t]||{},i=r.isArray,o=r.type;if("string"==typeof n&&(i||"AWSJSON"===o||Object(v.t)(o)||Object(v.s)(o)))try{return JSON.parse(n)}catch(e){}return"number"==typeof n&&"Boolean"===o?Boolean(n):n},en=function(e,t,n){var r=Qt(t);Object.entries(e).forEach((function(e){var i=Pt(e,2),o=i[0],s=i[1],a=Xt(t,o,s);r(o,a),n[o]=a}))},tn=function(e){var t=function(){function n(t){return Object(l.d)(this,(function(n){en(t,e,n);var r=Jt.has(t)?t:{},i=r.id,o=r._version,s=r._lastChangedAt,a=r._deleted,u=null!=i,c=u?i:e.syncable?Object(f.v4)():Lt();u||nn(n,e),n.id=c,e.syncable&&(n._version=o,n._lastChangedAt=s,n._deleted=a)}))}return n.copyOf=function(t,n){var r,i=Object.getPrototypeOf(t||{}).constructor;if(!Ht(i)){var o="The source object is not a valid model";throw Ft.error(o,{source:t}),new Error(o)}var s=Object(l.d)(t,(function(r){n(r),r.id=t.id;var i=Qt(e);Object.entries(r).forEach((function(t){var n=Pt(t,2),r=n[0],o=n[1],s=Xt(e,r,o);i(r,s)}))}),(function(e){return r=e})),a=zt.has(t);if(r.length||a)if(a){var u=Pt(zt.get(t),2),c=u[0],f=u[1],d=Object(x.y)(f,c,r);zt.set(s,[d,f]),rn(d,e)}else zt.set(s,[r,t]),rn(r,e);return s},n.fromJSON=function(n){var r=this;if(Array.isArray(n))return n.map((function(e){return r.fromJSON(e)}));var i=$t(t,n),o=Qt(e);return Object.entries(i).forEach((function(e){var t=Pt(e,2),n=t[0],r=t[1];o(n,r)})),i},n}();return t[l.c]=!0,Object.defineProperty(t,"name",{value:e.name}),t},nn=function(e,t){var n=Object.keys(e),r=t.fields;n.forEach((function(e){if(r[e]&&r[e].isReadOnly)throw new Error(e+" is read-only.")}))},rn=function(e,t){var n=e.map((function(e){return[e.path[0],e.value]})),r=t.fields;n.forEach((function(e){var t=Pt(e,2),n=t[0];if(t[1]&&r[n]&&r[n].isReadOnly)throw new Error(n+" is read-only.")}))},on=function(e){var t=function(t){return Object(l.d)(this,(function(n){en(t,e,n)}))};return t[l.c]=!0,Object.defineProperty(t,"name",{value:e.name}),Object(x.A)(t),t};function sn(e){return"string"==typeof e}function an(e){var t=e.localModel,n=e.modelConstructor,r=e.remoteModel._version;return $t(n,It(It({},t),{_version:r}))}function un(e){Ft.warn(e)}function cn(e,t){var n;switch(e){case x.a:n=Dt[t];break;case x.e:n=Rt[t];break;case x.d:n=jt[t];break;case x.c:n=Ut[t];break;default:Object(x.h)(e)}if(Ht(n))return n;var r="Model name is not valid for namespace. modelName: "+t+", namespace: "+e;throw Ft.error(r),new Error(r)}function ln(e,t){return Tt(this,void 0,void 0,(function(){var n,r,i=this;return Ct(this,(function(o){switch(o.label){case 0:return n=Dt.Setting,r=Mt.namespaces[x.a].models.Setting,[4,e.runExclusive((function(e){return Tt(i,void 0,void 0,(function(){var i,o;return Ct(this,(function(s){switch(s.label){case 0:return[4,e.query(n,A.a.createFromExisting(r,(function(e){return e.key("eq","schemaVersion")})),{page:0,limit:1})];case 1:return i=Pt.apply(void 0,[s.sent(),1]),void 0===(o=i[0])||void 0===o.value?[3,4]:JSON.parse(o.value)===t?[3,3]:[4,e.clear(!1)];case 2:s.sent(),s.label=3;case 3:return[3,6];case 4:return[4,e.save($t(n,{key:"schemaVersion",value:JSON.stringify(t)}))];case 5:s.sent(),s.label=6;case 6:return[2]}}))}))}))];case 1:return o.sent(),[2]}}))}))}var fn=function(){function e(){var e=this;this.Auth=u.a,this.API=r.a,this.Cache=c.a,this.amplifyConfig={},this.syncPredicates=new WeakMap,this.amplifyContext={Auth:this.Auth,API:this.API,Cache:this.Cache},this.start=function(){return Tt(e,void 0,void 0,(function(){var e,t,n,r=this;return Ct(this,(function(i){switch(i.label){case 0:return void 0!==this.initialized?[3,1]:(Ft.debug("Starting DataStore"),this.initialized=new Promise((function(e,t){r.initResolve=e,r.initReject=t})),[3,3]);case 1:return[4,this.initialized];case 2:return i.sent(),[2];case 3:return this.storage=new Pe(Mt,Vt,cn,$t,this.storageAdapter,this.sessionId),[4,this.storage.init()];case 4:return i.sent(),Wt(),[4,ln(this.storage,Mt.version)];case 5:return i.sent(),(e=this.amplifyConfig.aws_appsync_graphqlEndpoint)?(Ft.debug("GraphQL endpoint available",e),t=this,[4,this.processSyncExpressions()]):[3,7];case 6:return t.syncPredicates=i.sent(),this.sync=new At(Mt,Vt,jt,Rt,this.storage,$t,this.conflictHandler,this.errorHandler,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,this.amplifyContext),n=1e3*this.fullSyncInterval*60,Zt=this.sync.start({fullSyncInterval:n}).subscribe({next:function(e){var t=e.type,n=e.data;t===(Bt?pe.SYNC_ENGINE_SYNC_QUERIES_READY:pe.SYNC_ENGINE_STORAGE_SUBSCRIBED)&&r.initResolve(),s.a.dispatch("datastore",{event:t,data:n})},error:function(e){Ft.warn("Sync error",e),r.initReject()}}),[3,8];case 7:Ft.warn("Data won't be synchronized. No GraphQL endpoint configured. Did you forget `Amplify.configure(awsconfig)`?",{config:this.amplifyConfig}),this.initResolve(),i.label=8;case 8:return[4,this.initialized];case 9:return i.sent(),[2]}}))}))},this.query=function(t,n,r){return Tt(e,void 0,void 0,(function(){var e,i,o,s,a;return Ct(this,(function(u){switch(u.label){case 0:return[4,this.start()];case 1:if(u.sent(),!Ht(t))throw e="Constructor is not for a valid model",Ft.error(e,{modelConstructor:t}),new Error(e);return"string"==typeof n&&void 0!==r&&Ft.warn("Pagination is ignored when querying by id"),i=Kt(t),o=sn(n)?A.a.createForId(i,n):Object(A.c)(n)?void 0:A.a.createFromExisting(i,n),s=this.processPagination(i,r),Ft.debug("params ready",{modelConstructor:t,predicate:A.a.getPredicates(o,!1),pagination:It(It({},s),{sort:O.a.getPredicates(s&&s.sort,!1)})}),[4,this.storage.query(t,o,s)];case 2:return a=u.sent(),[2,sn(n)?a[0]:a]}}))}))},this.save=function(t,n){return Tt(e,void 0,void 0,(function(){var e,r,i,o,s,a,u=this;return Ct(this,(function(c){switch(c.label){case 0:return[4,this.start()];case 1:if(c.sent(),e=zt.get(t),r=t?t.constructor:void 0,!Ht(r))throw i="Object is not an instance of a valid model",Ft.error(i,{model:t}),new Error(i);return o=Kt(r),s=A.a.createFromExisting(o,n),[4,this.storage.runExclusive((function(n){return Tt(u,void 0,void 0,(function(){return Ct(this,(function(i){switch(i.label){case 0:return[4,n.save(t,s,void 0,e)];case 1:return i.sent(),[2,n.query(r,A.a.createForId(o,t.id))]}}))}))}))];case 2:return a=Pt.apply(void 0,[c.sent(),1]),[2,a[0]]}}))}))},this.setConflictHandler=function(t){var n=t.DataStore;return n&&n.conflictHandler?n.conflictHandler:e.conflictHandler===an&&t.conflictHandler?t.conflictHandler:e.conflictHandler||an},this.setErrorHandler=function(t){var n=t.DataStore;return n&&n.errorHandler?n.errorHandler:e.errorHandler===un&&t.errorHandler?t.errorHandler:e.errorHandler||un},this.delete=function(t,n){return Tt(e,void 0,void 0,(function(){var e,r,i,o,s,a,u,c,l;return Ct(this,(function(f){switch(f.label){case 0:return[4,this.start()];case 1:if(f.sent(),!t)throw u="Model or Model Constructor required",Ft.error(u,{modelOrConstructor:t}),new Error(u);if(!Ht(t))return[3,3];if(o=t,!n)throw u="Id to delete or criteria required. Do you want to delete all? Pass Predicates.ALL",Ft.error(u,{idOrCriteria:n}),new Error(u);if("string"==typeof n)e=A.a.createForId(Kt(o),n);else if(!(e=A.a.createFromExisting(Kt(o),n))||!A.a.isValidPredicate(e))throw u="Criteria required. Do you want to delete all? Pass Predicates.ALL",Ft.error(u,{condition:e}),new Error(u);return[4,this.storage.delete(o,e)];case 2:return r=Pt.apply(void 0,[f.sent(),1]),[2,r[0]];case 3:if(i=t,o=Object.getPrototypeOf(i||{}).constructor,!Ht(o))throw u="Object is not an instance of a valid model",Ft.error(u,{model:i}),new Error(u);if(s=Kt(o),a=A.a.createForId(s,i.id),n){if("function"!=typeof n)throw u="Invalid criteria",Ft.error(u,{idOrCriteria:n}),new Error(u);e=n(a)}else e=a;return[4,this.storage.delete(i,e)];case 4:return c=Pt.apply(void 0,[f.sent(),1]),l=Pt(c[0],1),[2,l[0]]}}))}))},this.observe=function(t,n){var r,i=t&&Ht(t)?t:void 0;if(t&&void 0===i){var o=t,s=o&&Object.getPrototypeOf(o).constructor;if(Ht(s))return n&&Ft.warn("idOrCriteria is ignored when using a model instance",{model:o,idOrCriteria:n}),e.observe(s,o.id);var a="The model is not an instance of a PersistentModelConstructor";throw Ft.error(a,{model:o}),new Error(a)}if(void 0!==n&&void 0===i){a="Cannot provide criteria without a modelConstructor";throw Ft.error(a,n),new Error(a)}if(i&&!Ht(i)){a="Constructor is not for a valid model";throw Ft.error(a,{modelConstructor:i}),new Error(a)}return r="string"==typeof n?A.a.createForId(Kt(i),n):i&&A.a.createFromExisting(Kt(i),n),new d.a((function(t){var n;return Tt(e,void 0,void 0,(function(){var e=this;return Ct(this,(function(o){switch(o.label){case 0:return[4,this.start()];case 1:return o.sent(),n=this.storage.observe(i,r).filter((function(e){var t=e.model;return Vt(t)===x.e})).subscribe({next:function(n){return Tt(e,void 0,void 0,(function(){var e,r;return Ct(this,(function(i){switch(i.label){case 0:return e=n,"DELETE"===n.opType?[3,2]:[4,this.query(n.model,n.element.id)];case 1:r=i.sent(),e=It(It({},e),{element:r}),i.label=2;case 2:return t.next(e),[2]}}))}))},error:function(e){return t.error(e)},complete:function(){return t.complete()}}),[2]}}))})),function(){n&&n.unsubscribe()}}))},this.observeQuery=function(t,n,r){return new d.a((function(i){var o,a,u=new Map,c=new Map,l=[],f=function(){var e=w();S(e)},d=new x.b({callback:f,errorHandler:i.error,maxInterval:2e3}),h=(r||{}).sort,p=h?{sort:h}:void 0,v=Kt(t);a=sn(n)?A.a.createForId(v,n):Object(A.c)(n)?void 0:A.a.createFromExisting(v,n);var y=A.a.getPredicates(a,!1)||{},g=y.predicates,m=y.type,b=!!g;Tt(e,void 0,void 0,(function(){var e,r=this;return Ct(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,this.query(t,n,p)];case 1:return s.sent().forEach((function(e){return u.set(e.id,e)})),o=this.observe(t).subscribe((function(e){var t,n,i=e.element,o=e.model,s=e.opType;if(b&&!Object(x.D)(i,m,g)){if("UPDATE"!==s||!u.has(i.id)&&!c.has(i.id))return;l.push(i.id)}"DELETE"===s?l.push(i.id):c.set(i.id,i);var a=null!==(n=null===(t=r.sync)||void 0===t?void 0:t.getModelSyncedStatus(o))&&void 0!==n&&n;(c.size-l.length>=r.syncPageSize||a)&&d.resolve(),d.start()})),f(),[3,3];case 2:return e=s.sent(),i.error(e),[3,3];case 3:return[2]}}))}));var w=function(){var n,i,o=null!==(i=null===(n=e.sync)||void 0===n?void 0:n.getModelSyncedStatus(t))&&void 0!==i&&i,s=Nt(Array.from(u.values()),Array.from(c.values()));return(null==r?void 0:r.sort)&&_(s),u.clear(),s.forEach((function(e){return u.set(e.id,e)})),l.forEach((function(e){return u.delete(e)})),{items:Array.from(u.values()),isSynced:o}},S=function(e){i.next(e),c.clear(),l=[]},_=function(n){var i=Kt(t),o=e.processPagination(i,r),s=O.a.getPredicates(o.sort);if(s.length){var a=Object(x.B)(s);n.sort(a)}};return s.a.listen("datastore",(function e(n){var r,i=n.payload,o=i.event,a=i.data;o===pe.SYNC_ENGINE_MODEL_SYNCED&&(null===(r=null==a?void 0:a.model)||void 0===r?void 0:r.name)===t.name&&(f(),s.a.remove("api",e))})),function(){o&&o.unsubscribe()}}))},this.configure=function(t){void 0===t&&(t={}),e.amplifyContext.Auth=e.Auth,e.amplifyContext.API=e.API,e.amplifyContext.Cache=e.Cache;var n=t.DataStore,r=t.authModeStrategyType,i=(t.conflictHandler,t.errorHandler,t.maxRecordsToSync),o=t.syncPageSize,s=t.fullSyncInterval,a=t.syncExpressions,u=t.authProviders,c=t.storageAdapter,l=xt(t,["DataStore","authModeStrategyType","conflictHandler","errorHandler","maxRecordsToSync","syncPageSize","fullSyncInterval","syncExpressions","authProviders","storageAdapter"]);switch(e.amplifyConfig=It(It({},l),e.amplifyConfig),e.conflictHandler=e.setConflictHandler(t),e.errorHandler=e.setErrorHandler(t),n&&n.authModeStrategyType||r||v.a.DEFAULT){case v.a.MULTI_AUTH:e.authModeStrategy=_(e.amplifyContext);break;case v.a.DEFAULT:default:e.authModeStrategy=E}e.amplifyConfig.authProviders=n&&n.authProviders||u,e.syncExpressions=n&&n.syncExpressions||a||e.syncExpressions,e.maxRecordsToSync=n&&n.maxRecordsToSync||i||e.maxRecordsToSync||1e4,e.amplifyConfig.maxRecordsToSync=e.maxRecordsToSync,e.syncPageSize=n&&n.syncPageSize||o||e.syncPageSize||1e3,e.amplifyConfig.syncPageSize=e.syncPageSize,e.fullSyncInterval=n&&n.fullSyncInterval||s||e.fullSyncInterval||1440,e.storageAdapter=n&&n.storageAdapter||c||e.storageAdapter||void 0,e.sessionId=e.retrieveSessionId()},this.clear=function(){return Tt(this,void 0,void 0,(function(){return Ct(this,(function(e){switch(e.label){case 0:return Wt(),void 0!==this.storage?[3,2]:(this.storage=new Pe(Mt,Vt,cn,$t,this.storageAdapter,this.sessionId),[4,this.storage.init()]);case 1:e.sent(),e.label=2;case 2:return Zt&&!Zt.closed&&Zt.unsubscribe(),[4,this.storage.clear()];case 3:return e.sent(),this.sync&&this.sync.unsubscribeConnectivity(),this.initialized=void 0,this.storage=void 0,this.sync=void 0,this.syncPredicates=new WeakMap,[2]}}))}))},this.stop=function(){return Tt(this,void 0,void 0,(function(){return Ct(this,(function(e){switch(e.label){case 0:return void 0===this.initialized?[3,2]:[4,this.start()];case 1:e.sent(),e.label=2;case 2:return Zt&&!Zt.closed&&Zt.unsubscribe(),this.sync&&this.sync.unsubscribeConnectivity(),this.initialized=void 0,this.sync=void 0,[2]}}))}))}}return e.prototype.getModuleName=function(){return"DataStore"},e.prototype.processPagination=function(e,t){var n,r=t||{},i=r.limit,o=r.page,s=r.sort;if(void 0!==i||void 0!==o||void 0!==s){if(void 0!==o&&void 0===i)throw new Error("Limit is required when requesting a page");if(void 0!==o){if("number"!=typeof o)throw new Error("Page should be a number");if(o<0)throw new Error("Page can't be negative")}if(void 0!==i){if("number"!=typeof i)throw new Error("Limit should be a number");if(i<0)throw new Error("Limit can't be negative")}return s&&(n=O.a.createFromExisting(e,t.sort)),{limit:i,page:o,sort:n}}},e.prototype.processSyncExpressions=function(){return Tt(this,void 0,void 0,(function(){var e,t=this;return Ct(this,(function(n){switch(n.label){case 0:return this.syncExpressions&&this.syncExpressions.length?[4,Promise.all(this.syncExpressions.map((function(e){return Tt(t,void 0,void 0,(function(){var t,n,r,i,o,s;return Ct(this,(function(a){switch(a.label){case 0:return[4,e];case 1:return t=a.sent(),n=t.modelConstructor,r=t.conditionProducer,i=Kt(n),[4,this.unwrapPromise(r)];case 2:return o=a.sent(),Object(A.c)(o)?[2,[i,null]]:(s=this.createFromCondition(i,o),[2,[i,s]])}}))}))})))]:[2,new WeakMap];case 1:return e=n.sent(),[2,this.weakMapFromEntries(e)]}}))}))},e.prototype.createFromCondition=function(e,t){try{return A.a.createFromExisting(e,t)}catch(e){throw Ft.error("Error creating Sync Predicate"),e}},e.prototype.unwrapPromise=function(e){return Tt(this,void 0,void 0,(function(){var t;return Ct(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,e()];case 1:return[2,n.sent()];case 2:if((t=n.sent())instanceof TypeError)return[2,e];throw t;case 3:return[2]}}))}))},e.prototype.weakMapFromEntries=function(e){return e.reduce((function(e,t){var n=Pt(t,2),r=n[0],i=n[1];if(e.has(r)){var o=r.name;return Ft.warn("You can only utilize one Sync Expression per model.\n Subsequent sync expressions for the "+o+" model will be ignored."),e}return i&&e.set(r,i),e}),new WeakMap)},e.prototype.retrieveSessionId=function(){try{var e=sessionStorage.getItem("datastoreSessionId");if(e){var t=this.amplifyConfig.aws_appsync_graphqlEndpoint.split("/")[2];return e+"-"+Pt(t.split("."),1)[0]}}catch(e){return}},e}(),dn=new fn;a.a.register(dn);var hn={USER:x.e,traverseModel:x.C,validatePredicate:x.D,isNonModelConstructor:x.v,isModelConstructor:x.u}},function(e,t,n){"use strict";n.r(t),n.d(t,"fromUtf8",(function(){return r})),n.d(t,"toUtf8",(function(){return i}));var r=function(e){return"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e.charCodeAt(n);if(i<128)t.push(i);else if(i<2048)t.push(i>>6|192,63&i|128);else if(n+1<e.length&&55296==(64512&i)&&56320==(64512&e.charCodeAt(n+1))){var o=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n));t.push(o>>18|240,o>>12&63|128,o>>6&63|128,63&o|128)}else t.push(i>>12|224,i>>6&63|128,63&i|128)}return Uint8Array.from(t)}(e)},i=function(e){return"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):function(e){for(var t="",n=0,r=e.length;n<r;n++){var i=e[n];if(i<128)t+=String.fromCharCode(i);else if(192<=i&&i<224){var o=e[++n];t+=String.fromCharCode((31&i)<<6|63&o)}else if(240<=i&&i<365){var s="%"+[i,e[++n],e[++n],e[++n]].map((function(e){return e.toString(16)})).join("%");t+=decodeURIComponent(s)}else t+=String.fromCharCode((15&i)<<12|(63&e[++n])<<6|63&e[++n])}return t}(e)}},function(e,t,n){"use strict";n.r(t),n.d(t,"fromUtf8",(function(){return r})),n.d(t,"toUtf8",(function(){return i}));var r=function(e){return"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e.charCodeAt(n);if(i<128)t.push(i);else if(i<2048)t.push(i>>6|192,63&i|128);else if(n+1<e.length&&55296==(64512&i)&&56320==(64512&e.charCodeAt(n+1))){var o=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n));t.push(o>>18|240,o>>12&63|128,o>>6&63|128,63&o|128)}else t.push(i>>12|224,i>>6&63|128,63&i|128)}return Uint8Array.from(t)}(e)},i=function(e){return"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):function(e){for(var t="",n=0,r=e.length;n<r;n++){var i=e[n];if(i<128)t+=String.fromCharCode(i);else if(192<=i&&i<224){var o=e[++n];t+=String.fromCharCode((31&i)<<6|63&o)}else if(240<=i&&i<365){var s="%"+[i,e[++n],e[++n],e[++n]].map((function(e){return e.toString(16)})).join("%");t+=decodeURIComponent(s)}else t+=String.fromCharCode((15&i)<<12|(63&e[++n])<<6|63&e[++n])}return t}(e)}},,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return f})),n.d(t,"d",(function(){return d})),n.d(t,"b",(function(){return h})),n.d(t,"c",(function(){return p}));var r,i=n(21),o=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},a=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},u=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},c=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(u(arguments[t]));return e},l=new i.a("Util"),f=function(e){function t(t){var n=e.call(this,t)||this;return n.nonRetryable=!0,n}return o(t,e),t}(Error);function d(e,t,n,r){return void 0===r&&(r=1),s(this,void 0,void 0,(function(){var i,o;return a(this,(function(s){switch(s.label){case 0:if("function"!=typeof e)throw Error("functionToRetry must be a function");l.debug(e.name+" attempt #"+r+" with this vars: "+JSON.stringify(t)),s.label=1;case 1:return s.trys.push([1,3,,8]),[4,e.apply(void 0,c(t))];case 2:return[2,s.sent()];case 3:if(i=s.sent(),l.debug("error on "+e.name,i),(a=i)&&a.nonRetryable)throw l.debug(e.name+" non retryable error",i),i;return o=n(r,t,i),l.debug(e.name+" retrying in "+o+" ms"),!1===o?[3,6]:[4,new Promise((function(e){return setTimeout(e,o)}))];case 4:return s.sent(),[4,d(e,t,n,r+1)];case 5:return[2,s.sent()];case 6:throw i;case 7:return[3,8];case 8:return[2]}var a}))}))}function h(e){void 0===e&&(e=3e5);return function(t){var n=100*Math.pow(2,t)+100*Math.random();return!(n>e)&&n}}var p=function(e,t,n){return void 0===n&&(n=3e5),d(e,t,h(n))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return Qi}));var r=n(21),i=n(67),o=n(16),s=n(147),a=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},u=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},c=new r.a("CognitoCredentials"),l=new Promise((function(e,t){return Object(o.b)().isBrowser?(window.gapi&&window.gapi.auth2?window.gapi.auth2:null)?(c.debug("google api already loaded"),e()):void setTimeout((function(){return e()}),2e3):(c.debug("not in the browser, directly resolved"),e())})),f=function(){function e(){this.initialized=!1,this.refreshGoogleToken=this.refreshGoogleToken.bind(this),this._refreshGoogleTokenImpl=this._refreshGoogleTokenImpl.bind(this)}return e.prototype.refreshGoogleToken=function(){return a(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return this.initialized?[3,2]:(c.debug("need to wait for the Google SDK loaded"),[4,l]);case 1:e.sent(),this.initialized=!0,c.debug("finish waiting"),e.label=2;case 2:return[2,this._refreshGoogleTokenImpl()]}}))}))},e.prototype._refreshGoogleTokenImpl=function(){var e=null;return Object(o.b)().isBrowser&&(e=window.gapi&&window.gapi.auth2?window.gapi.auth2:null),e?new Promise((function(t,n){e.getAuthInstance().then((function(e){e||(c.debug("google Auth undefined"),n(new s.a("google Auth undefined")));var r=e.currentUser.get();r.isSignedIn()?(c.debug("refreshing the google access token"),r.reloadAuthResponse().then((function(e){var n=e.id_token,r=e.expires_at;t({token:n,expires_at:r})})).catch((function(e){e&&"network_error"===e.error?n("Network error reloading google auth response"):n(new s.a("Failed to reload google auth response"))}))):n(new s.a("User is not signed in with Google"))})).catch((function(e){c.debug("Failed to refresh google token",e),n(new s.a("Failed to refresh google token"))}))})):(c.debug("no gapi auth2 available"),Promise.reject("no gapi auth2 available"))},e}(),d=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},h=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},p=new r.a("CognitoCredentials"),v=new Promise((function(e,t){return Object(o.b)().isBrowser?window.FB?(p.debug("FB SDK already loaded"),e()):void setTimeout((function(){return e()}),2e3):(p.debug("not in the browser, directly resolved"),e())})),y=function(){function e(){this.initialized=!1,this.refreshFacebookToken=this.refreshFacebookToken.bind(this),this._refreshFacebookTokenImpl=this._refreshFacebookTokenImpl.bind(this)}return e.prototype.refreshFacebookToken=function(){return d(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return this.initialized?[3,2]:(p.debug("need to wait for the Facebook SDK loaded"),[4,v]);case 1:e.sent(),this.initialized=!0,p.debug("finish waiting"),e.label=2;case 2:return[2,this._refreshFacebookTokenImpl()]}}))}))},e.prototype._refreshFacebookTokenImpl=function(){var e=null;if(Object(o.b)().isBrowser&&(e=window.FB),!e){return p.debug("no fb sdk available"),Promise.reject(new s.a("no fb sdk available"))}return new Promise((function(t,n){e.getLoginStatus((function(e){if(e&&e.authResponse){var r=e.authResponse,i=r.accessToken,o=1e3*r.expiresIn+(new Date).getTime();if(!i){a="the jwtToken is undefined";p.debug(a),n(new s.a(a))}t({token:i,expires_at:o})}else{var a="no response from facebook when refreshing the jwt token";p.debug(a),n(new s.a(a))}}),{scope:"public_profile,email"})}))},e}(),g=new f,m=new y,b=n(34),w=n(39),S=n(0),_=function(e,t){return(_=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function E(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}_(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var A=function(){return(A=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function O(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function I(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}Object.create;function T(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}var C,x,P,k,N,M,j,R,D,U,F,L,B,q,z,K,H,V,G,W,Y,J,$,Z,Q,X,ee,te,ne,re,ie,oe,se,ae,ue,ce,le,fe,de,he,pe,ve,ye,ge,me,be,we,Se,_e,Ee,Ae,Oe,Ie,Te,Ce,xe,Pe;Object.create;!function(e){e.AUTHENTICATED_ROLE="AuthenticatedRole",e.DENY="Deny"}(C||(C={})),(x||(x={})).filterSensitiveLog=function(e){return A({},e)},(P||(P={})).filterSensitiveLog=function(e){return A({},e)},(k||(k={})).filterSensitiveLog=function(e){return A({},e)},(N||(N={})).filterSensitiveLog=function(e){return A({},e)},(M||(M={})).filterSensitiveLog=function(e){return A({},e)},(j||(j={})).filterSensitiveLog=function(e){return A({},e)},(R||(R={})).filterSensitiveLog=function(e){return A({},e)},(D||(D={})).filterSensitiveLog=function(e){return A({},e)},(U||(U={})).filterSensitiveLog=function(e){return A({},e)},(F||(F={})).filterSensitiveLog=function(e){return A({},e)},function(e){e.ACCESS_DENIED="AccessDenied",e.INTERNAL_SERVER_ERROR="InternalServerError"}(L||(L={})),(B||(B={})).filterSensitiveLog=function(e){return A({},e)},(q||(q={})).filterSensitiveLog=function(e){return A({},e)},(z||(z={})).filterSensitiveLog=function(e){return A({},e)},(K||(K={})).filterSensitiveLog=function(e){return A({},e)},(H||(H={})).filterSensitiveLog=function(e){return A({},e)},(V||(V={})).filterSensitiveLog=function(e){return A({},e)},(G||(G={})).filterSensitiveLog=function(e){return A({},e)},(W||(W={})).filterSensitiveLog=function(e){return A({},e)},(Y||(Y={})).filterSensitiveLog=function(e){return A({},e)},(J||(J={})).filterSensitiveLog=function(e){return A({},e)},($||($={})).filterSensitiveLog=function(e){return A({},e)},(Z||(Z={})).filterSensitiveLog=function(e){return A({},e)},(Q||(Q={})).filterSensitiveLog=function(e){return A({},e)},(X||(X={})).filterSensitiveLog=function(e){return A({},e)},(ee||(ee={})).filterSensitiveLog=function(e){return A({},e)},function(e){e.CONTAINS="Contains",e.EQUALS="Equals",e.NOT_EQUAL="NotEqual",e.STARTS_WITH="StartsWith"}(te||(te={})),(ne||(ne={})).filterSensitiveLog=function(e){return A({},e)},(re||(re={})).filterSensitiveLog=function(e){return A({},e)},function(e){e.RULES="Rules",e.TOKEN="Token"}(ie||(ie={})),(oe||(oe={})).filterSensitiveLog=function(e){return A({},e)},(se||(se={})).filterSensitiveLog=function(e){return A({},e)},(ae||(ae={})).filterSensitiveLog=function(e){return A({},e)},(ue||(ue={})).filterSensitiveLog=function(e){return A({},e)},(ce||(ce={})).filterSensitiveLog=function(e){return A({},e)},(le||(le={})).filterSensitiveLog=function(e){return A({},e)},(fe||(fe={})).filterSensitiveLog=function(e){return A({},e)},(de||(de={})).filterSensitiveLog=function(e){return A({},e)},(he||(he={})).filterSensitiveLog=function(e){return A({},e)},(pe||(pe={})).filterSensitiveLog=function(e){return A({},e)},(ve||(ve={})).filterSensitiveLog=function(e){return A({},e)},(ye||(ye={})).filterSensitiveLog=function(e){return A({},e)},(ge||(ge={})).filterSensitiveLog=function(e){return A({},e)},(me||(me={})).filterSensitiveLog=function(e){return A({},e)},(be||(be={})).filterSensitiveLog=function(e){return A({},e)},(we||(we={})).filterSensitiveLog=function(e){return A({},e)},(Se||(Se={})).filterSensitiveLog=function(e){return A({},e)},(_e||(_e={})).filterSensitiveLog=function(e){return A({},e)},(Ee||(Ee={})).filterSensitiveLog=function(e){return A({},e)},(Ae||(Ae={})).filterSensitiveLog=function(e){return A({},e)},(Oe||(Oe={})).filterSensitiveLog=function(e){return A({},e)},(Ie||(Ie={})).filterSensitiveLog=function(e){return A({},e)},(Te||(Te={})).filterSensitiveLog=function(e){return A({},e)},(Ce||(Ce={})).filterSensitiveLog=function(e){return A({},e)},(xe||(xe={})).filterSensitiveLog=function(e){return A({},e)},(Pe||(Pe={})).filterSensitiveLog=function(e){return A({},e)};var ke=function(){function e(e){this.statusCode=e.statusCode,this.headers=e.headers||{},this.body=e.body}return e.isInstance=function(e){if(!e)return!1;var t=e;return"number"==typeof t.statusCode&&"object"==typeof t.headers},e}(),Ne=function(){function e(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?":"!==e.protocol.substr(-1)?e.protocol+":":e.protocol:"https:",this.path=e.path?"/"!==e.path.charAt(0)?"/"+e.path:e.path:"/"}return e.isInstance=function(e){if(!e)return!1;var t=e;return"method"in t&&"protocol"in t&&"hostname"in t&&"path"in t&&"object"==typeof t.query&&"object"==typeof t.headers},e.prototype.clone=function(){var t,n=new e(Object(S.__assign)(Object(S.__assign)({},this),{headers:Object(S.__assign)({},this.headers)}));return n.query&&(n.query=(t=n.query,Object.keys(t).reduce((function(e,n){var r,i=t[n];return Object(S.__assign)(Object(S.__assign)({},e),((r={})[n]=Array.isArray(i)?Object(S.__spread)(i):i,r))}),{}))),n},e}();var Me=function(e,t){return O(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return I(this,(function(g){switch(g.label){case 0:return r=[A({},e)],y={},[4,ut(e.body,t)];case 1:switch(n=A.apply(void 0,r.concat([(y.body=g.sent(),y)])),o="UnknownError",o=ct(e,n.body),o){case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":return[3,2];case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":return[3,4];case"InvalidIdentityPoolConfigurationException":case"com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException":return[3,6];case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":return[3,8];case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":return[3,10];case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":return[3,12];case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":return[3,14];case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":return[3,16]}return[3,18];case 2:return s=[{}],[4,Re(n,t)];case 3:return i=A.apply(void 0,[A.apply(void 0,s.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 4:return a=[{}],[4,De(n,t)];case 5:return i=A.apply(void 0,[A.apply(void 0,a.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 6:return u=[{}],[4,Ue(n,t)];case 7:return i=A.apply(void 0,[A.apply(void 0,u.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 8:return c=[{}],[4,Fe(n,t)];case 9:return i=A.apply(void 0,[A.apply(void 0,c.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 10:return l=[{}],[4,Be(n,t)];case 11:return i=A.apply(void 0,[A.apply(void 0,l.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 12:return f=[{}],[4,qe(n,t)];case 13:return i=A.apply(void 0,[A.apply(void 0,f.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 14:return d=[{}],[4,ze(n,t)];case 15:return i=A.apply(void 0,[A.apply(void 0,d.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 16:return h=[{}],[4,Ke(n,t)];case 17:return i=A.apply(void 0,[A.apply(void 0,h.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=A(A({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:ot(e)}),g.label=19;case 19:return v=i.message||i.Message||o,i.message=v,delete i.Message,[2,Promise.reject(Object.assign(new Error(v),i))]}}))}))},je=function(e,t){return O(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return I(this,(function(g){switch(g.label){case 0:return r=[A({},e)],y={},[4,ut(e.body,t)];case 1:switch(n=A.apply(void 0,r.concat([(y.body=g.sent(),y)])),o="UnknownError",o=ct(e,n.body),o){case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":return[3,2];case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":return[3,4];case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":return[3,6];case"LimitExceededException":case"com.amazonaws.cognitoidentity#LimitExceededException":return[3,8];case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":return[3,10];case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":return[3,12];case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":return[3,14];case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":return[3,16]}return[3,18];case 2:return s=[{}],[4,Re(n,t)];case 3:return i=A.apply(void 0,[A.apply(void 0,s.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 4:return a=[{}],[4,De(n,t)];case 5:return i=A.apply(void 0,[A.apply(void 0,a.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 6:return u=[{}],[4,Fe(n,t)];case 7:return i=A.apply(void 0,[A.apply(void 0,u.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 8:return c=[{}],[4,Le(n,t)];case 9:return i=A.apply(void 0,[A.apply(void 0,c.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 10:return l=[{}],[4,Be(n,t)];case 11:return i=A.apply(void 0,[A.apply(void 0,l.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 12:return f=[{}],[4,qe(n,t)];case 13:return i=A.apply(void 0,[A.apply(void 0,f.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 14:return d=[{}],[4,ze(n,t)];case 15:return i=A.apply(void 0,[A.apply(void 0,d.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 16:return h=[{}],[4,Ke(n,t)];case 17:return i=A.apply(void 0,[A.apply(void 0,h.concat([g.sent()])),{name:o,$metadata:ot(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=A(A({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:ot(e)}),g.label=19;case 19:return v=i.message||i.Message||o,i.message=v,delete i.Message,[2,Promise.reject(Object.assign(new Error(v),i))]}}))}))},Re=function(e,t){return O(void 0,void 0,void 0,(function(){var n,r;return I(this,(function(i){return n=e.body,r=Ye(n,t),[2,A({name:"ExternalServiceException",$fault:"client",$metadata:ot(e)},r)]}))}))},De=function(e,t){return O(void 0,void 0,void 0,(function(){var n,r;return I(this,(function(i){return n=e.body,r=Ze(n,t),[2,A({name:"InternalErrorException",$fault:"server",$metadata:ot(e)},r)]}))}))},Ue=function(e,t){return O(void 0,void 0,void 0,(function(){var n,r;return I(this,(function(i){return n=e.body,r=Qe(n,t),[2,A({name:"InvalidIdentityPoolConfigurationException",$fault:"client",$metadata:ot(e)},r)]}))}))},Fe=function(e,t){return O(void 0,void 0,void 0,(function(){var n,r;return I(this,(function(i){return n=e.body,r=Xe(n,t),[2,A({name:"InvalidParameterException",$fault:"client",$metadata:ot(e)},r)]}))}))},Le=function(e,t){return O(void 0,void 0,void 0,(function(){var n,r;return I(this,(function(i){return n=e.body,r=et(n,t),[2,A({name:"LimitExceededException",$fault:"client",$metadata:ot(e)},r)]}))}))},Be=function(e,t){return O(void 0,void 0,void 0,(function(){var n,r;return I(this,(function(i){return n=e.body,r=tt(n,t),[2,A({name:"NotAuthorizedException",$fault:"client",$metadata:ot(e)},r)]}))}))},qe=function(e,t){return O(void 0,void 0,void 0,(function(){var n,r;return I(this,(function(i){return n=e.body,r=nt(n,t),[2,A({name:"ResourceConflictException",$fault:"client",$metadata:ot(e)},r)]}))}))},ze=function(e,t){return O(void 0,void 0,void 0,(function(){var n,r;return I(this,(function(i){return n=e.body,r=rt(n,t),[2,A({name:"ResourceNotFoundException",$fault:"client",$metadata:ot(e)},r)]}))}))},Ke=function(e,t){return O(void 0,void 0,void 0,(function(){var n,r;return I(this,(function(i){return n=e.body,r=it(n,t),[2,A({name:"TooManyRequestsException",$fault:"client",$metadata:ot(e)},r)]}))}))},He=function(e,t){return A(A(A({},void 0!==e.CustomRoleArn&&null!==e.CustomRoleArn&&{CustomRoleArn:e.CustomRoleArn}),void 0!==e.IdentityId&&null!==e.IdentityId&&{IdentityId:e.IdentityId}),void 0!==e.Logins&&null!==e.Logins&&{Logins:Ge(e.Logins,t)})},Ve=function(e,t){return A(A(A({},void 0!==e.AccountId&&null!==e.AccountId&&{AccountId:e.AccountId}),void 0!==e.IdentityPoolId&&null!==e.IdentityPoolId&&{IdentityPoolId:e.IdentityPoolId}),void 0!==e.Logins&&null!==e.Logins&&{Logins:Ge(e.Logins,t)})},Ge=function(e,t){return Object.entries(e).reduce((function(e,t){var n,r=T(t,2),i=r[0],o=r[1];return null===o?e:A(A({},e),((n={})[i]=o,n))}),{})},We=function(e,t){return{AccessKeyId:void 0!==e.AccessKeyId&&null!==e.AccessKeyId?e.AccessKeyId:void 0,Expiration:void 0!==e.Expiration&&null!==e.Expiration?new Date(Math.round(1e3*e.Expiration)):void 0,SecretKey:void 0!==e.SecretKey&&null!==e.SecretKey?e.SecretKey:void 0,SessionToken:void 0!==e.SessionToken&&null!==e.SessionToken?e.SessionToken:void 0}},Ye=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Je=function(e,t){return{Credentials:void 0!==e.Credentials&&null!==e.Credentials?We(e.Credentials):void 0,IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},$e=function(e,t){return{IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},Ze=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Qe=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Xe=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},et=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},tt=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},nt=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},rt=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},it=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},ot=function(e){var t;return{httpStatusCode:e.statusCode,requestId:null!==(t=e.headers["x-amzn-requestid"])&&void 0!==t?t:e.headers["x-amzn-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}},st=function(e,t){return void 0===e&&(e=new Uint8Array),e instanceof Uint8Array?Promise.resolve(e):t.streamCollector(e)||Promise.resolve(new Uint8Array)},at=function(e,t,n,r,i){return O(void 0,void 0,void 0,(function(){var o,s,a,u,c,l;return I(this,(function(f){switch(f.label){case 0:return[4,e.endpoint()];case 1:return o=f.sent(),s=o.hostname,a=o.protocol,u=void 0===a?"https":a,c=o.port,l={protocol:u,hostname:s,port:c,method:"POST",path:n,headers:t},void 0!==r&&(l.hostname=r),void 0!==i&&(l.body=i),[2,new Ne(l)]}}))}))},ut=function(e,t){return function(e,t){return st(e,t).then((function(e){return t.utf8Encoder(e)}))}(e,t).then((function(e){return e.length?JSON.parse(e):{}}))},ct=function(e,t){var n,r,i=function(e){var t=e;return t.indexOf(":")>=0&&(t=t.split(":")[0]),t.indexOf("#")>=0&&(t=t.split("#")[1]),t},o=(n=e.headers,r="x-amzn-errortype",Object.keys(n).find((function(e){return e.toLowerCase()===r.toLowerCase()})));return void 0!==o?i(e.headers[o]):void 0!==t.code?i(t.code):void 0!==t.__type?i(t.__type):""},lt={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},ft={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function dt(e,t,n){return{applyToStack:function(r){r.add(function(e,t){return function(n,r){return function(r){return Object(S.__awaiter)(void 0,void 0,void 0,(function(){var i,o;return Object(S.__generator)(this,(function(s){switch(s.label){case 0:return[4,n(r)];case 1:return i=s.sent().response,[4,t(i,e)];case 2:return o=s.sent(),[2,{response:i,output:o}]}}))}))}}}(e,n),lt),r.add(function(e,t){return function(n,r){return function(r){return Object(S.__awaiter)(void 0,void 0,void 0,(function(){var i;return Object(S.__generator)(this,(function(o){switch(o.label){case 0:return[4,t(r.input,e)];case 1:return i=o.sent(),[2,n(Object(S.__assign)(Object(S.__assign)({},r),{request:i}))]}}))}))}}}(e,t),ft)}}}var ht=function(){var e=[],t=[],n=new Set,r=function(n){return e.forEach((function(e){n.add(e.middleware,Object(S.__assign)({},e))})),t.forEach((function(e){n.addRelativeTo(e.middleware,Object(S.__assign)({},e))})),n},i=function(e){var t=[];return e.before.forEach((function(e){0===e.before.length&&0===e.after.length?t.push(e):t.push.apply(t,Object(S.__spread)(i(e)))})),t.push(e),e.after.reverse().forEach((function(e){0===e.before.length&&0===e.after.length?t.push(e):t.push.apply(t,Object(S.__spread)(i(e)))})),t},o=function(){var n,r=[],o=[],s={};return e.forEach((function(e){var t=Object(S.__assign)(Object(S.__assign)({},e),{before:[],after:[]});t.name&&(s[t.name]=t),r.push(t)})),t.forEach((function(e){var t=Object(S.__assign)(Object(S.__assign)({},e),{before:[],after:[]});t.name&&(s[t.name]=t),o.push(t)})),o.forEach((function(e){if(e.toMiddleware){var t=s[e.toMiddleware];if(void 0===t)throw new Error(e.toMiddleware+" is not found when adding "+(e.name||"anonymous")+" middleware "+e.relation+" "+e.toMiddleware);"after"===e.relation&&t.after.push(e),"before"===e.relation&&t.before.push(e)}})),(n=r,n.sort((function(e,t){return pt[t.step]-pt[e.step]||vt[t.priority||"normal"]-vt[e.priority||"normal"]}))).map(i).reduce((function(e,t){return e.push.apply(e,Object(S.__spread)(t)),e}),[]).map((function(e){return e.middleware}))},s={add:function(t,r){void 0===r&&(r={});var i=r.name,o=r.override,s=Object(S.__assign)({step:"initialize",priority:"normal",middleware:t},r);if(i){if(n.has(i)){if(!o)throw new Error("Duplicate middleware name '"+i+"'");var a=e.findIndex((function(e){return e.name===i})),u=e[a];if(u.step!==s.step||u.priority!==s.priority)throw new Error('"'+i+'" middleware with '+u.priority+" priority in "+u.step+" step cannot be overridden by same-name middleware with "+s.priority+" priority in "+s.step+" step.");e.splice(a,1)}n.add(i)}e.push(s)},addRelativeTo:function(e,r){var i=r.name,o=r.override,s=Object(S.__assign)({middleware:e},r);if(i){if(n.has(i)){if(!o)throw new Error("Duplicate middleware name '"+i+"'");var a=t.findIndex((function(e){return e.name===i})),u=t[a];if(u.toMiddleware!==s.toMiddleware||u.relation!==s.relation)throw new Error('"'+i+'" middleware '+u.relation+' "'+u.toMiddleware+'" middleware cannot be overridden by same-name middleware '+s.relation+' "'+s.toMiddleware+'" middleware.');t.splice(a,1)}n.add(i)}t.push(s)},clone:function(){return r(ht())},use:function(e){e.applyToStack(s)},remove:function(r){return"string"==typeof r?function(r){var i=!1,o=function(e){return!e.name||e.name!==r||(i=!0,n.delete(r),!1)};return e=e.filter(o),t=t.filter(o),i}(r):function(r){var i=!1,o=function(e){return e.middleware!==r||(i=!0,e.name&&n.delete(e.name),!1)};return e=e.filter(o),t=t.filter(o),i}(r)},removeByTag:function(r){var i=!1,o=function(e){var t=e.tags,o=e.name;return!t||!t.includes(r)||(o&&n.delete(o),i=!0,!1)};return e=e.filter(o),t=t.filter(o),i},concat:function(e){var t=r(ht());return t.use(e),t},applyToStack:r,resolve:function(e,t){var n,r;try{for(var i=Object(S.__values)(o().reverse()),s=i.next();!s.done;s=i.next()){e=(0,s.value)(e,t)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e}};return s},pt={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},vt={high:3,normal:2,low:1},yt=function(){function e(e){this.middlewareStack=ht(),this.config=e}return e.prototype.send=function(e,t,n){var r="function"!=typeof t?t:void 0,i="function"==typeof t?t:n,o=e.resolveMiddleware(this.middlewareStack,this.config,r);if(!i)return o(e).then((function(e){return e.output}));o(e).then((function(e){return i(null,e.output)}),(function(e){return i(e)})).catch((function(){}))},e.prototype.destroy=function(){this.config.requestHandler.destroy&&this.config.requestHandler.destroy()},e}(),gt=function(){this.middlewareStack=ht()};var mt=function(){var e=Object.getPrototypeOf(this).constructor,t=Function.bind.apply(String,Object(S.__spread)([null],arguments)),n=new t;return Object.setPrototypeOf(n,e.prototype),n};mt.prototype=Object.create(String.prototype,{constructor:{value:mt,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf(mt,String);!function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Object(S.__extends)(t,e),t.prototype.deserializeJSON=function(){return JSON.parse(e.prototype.toString.call(this))},t.prototype.toJSON=function(){return e.prototype.toString.call(this)},t.fromObject=function(e){return e instanceof t?e:new t(e instanceof String||"string"==typeof e?e:JSON.stringify(e))}}(mt);var bt=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return E(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(dt(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetCredentialsForIdentityCommand",inputFilterSensitiveLog:Y.filterSensitiveLog,outputFilterSensitiveLog:$.filterSensitiveLog},o=t.requestHandler;return r.resolve((function(e){return o.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return O(void 0,void 0,void 0,(function(){var n,r;return I(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetCredentialsForIdentity"},r=JSON.stringify(He(e,t)),[2,at(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return O(void 0,void 0,void 0,(function(){var n,r,i;return I(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,Me(e,t)]:[4,ut(e.body,t)];case 1:return n=o.sent(),{},r=Je(n,t),i=A({$metadata:ot(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(gt),wt=function(e){function t(t,n){void 0===n&&(n=!0);var r=e.call(this,t)||this;return r.tryNextLink=n,r}return Object(S.__extends)(t,e),t}(Error);function St(e){return Promise.all(Object.keys(e).reduce((function(t,n){var r=e[n];return"string"==typeof r?t.push([n,r]):t.push(r().then((function(e){return[n,e]}))),t}),[])).then((function(e){return e.reduce((function(e,t){var n=Object(S.__read)(t,2),r=n[0],i=n[1];return e[r]=i,e}),{})}))}function _t(e){var t=this;return function(){return Object(S.__awaiter)(t,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,f,d,h;return Object(S.__generator)(this,(function(p){switch(p.label){case 0:return l=(c=e.client).send,f=bt.bind,h={CustomRoleArn:e.customRoleArn,IdentityId:e.identityId},e.logins?[4,St(e.logins)]:[3,2];case 1:return d=p.sent(),[3,3];case 2:d=void 0,p.label=3;case 3:return[4,l.apply(c,[new(f.apply(bt,[void 0,(h.Logins=d,h)]))])];case 4:return t=p.sent().Credentials,n=void 0===t?function(){throw new wt("Response from Amazon Cognito contained no credentials")}():t,r=n.AccessKeyId,i=void 0===r?function(){throw new wt("Response from Amazon Cognito contained no access key ID")}():r,o=n.Expiration,s=n.SecretKey,a=void 0===s?function(){throw new wt("Response from Amazon Cognito contained no secret key")}():s,u=n.SessionToken,[2,{identityId:e.identityId,accessKeyId:i,secretAccessKey:a,sessionToken:u,expiration:o}]}}))}))}}var Et=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return E(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(dt(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetIdCommand",inputFilterSensitiveLog:Q.filterSensitiveLog,outputFilterSensitiveLog:X.filterSensitiveLog},o=t.requestHandler;return r.resolve((function(e){return o.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return O(void 0,void 0,void 0,(function(){var n,r;return I(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetId"},r=JSON.stringify(Ve(e,t)),[2,at(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return O(void 0,void 0,void 0,(function(){var n,r,i;return I(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,je(e,t)]:[4,ut(e.body,t)];case 1:return n=o.sent(),{},r=$e(n,t),i=A({$metadata:ot(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(gt),At=function(){function e(e){void 0===e&&(e="aws:cognito-identity-ids"),this.dbName=e}return e.prototype.getItem=function(e){return this.withObjectStore("readonly",(function(t){var n=t.get(e);return new Promise((function(e){n.onerror=function(){return e(null)},n.onsuccess=function(){return e(n.result?n.result.value:null)}}))})).catch((function(){return null}))},e.prototype.removeItem=function(e){return this.withObjectStore("readwrite",(function(t){var n=t.delete(e);return new Promise((function(e,t){n.onerror=function(){return t(n.error)},n.onsuccess=function(){return e()}}))}))},e.prototype.setItem=function(e,t){return this.withObjectStore("readwrite",(function(n){var r=n.put({id:e,value:t});return new Promise((function(e,t){r.onerror=function(){return t(r.error)},r.onsuccess=function(){return e()}}))}))},e.prototype.getDb=function(){var e=self.indexedDB.open(this.dbName,1);return new Promise((function(t,n){e.onsuccess=function(){t(e.result)},e.onerror=function(){n(e.error)},e.onblocked=function(){n(new Error("Unable to access DB"))},e.onupgradeneeded=function(){var t=e.result;t.onerror=function(){n(new Error("Failed to create object store"))},t.createObjectStore("IdentityIds",{keyPath:"id"})}}))},e.prototype.withObjectStore=function(e,t){return this.getDb().then((function(n){var r=n.transaction("IdentityIds",e);return r.oncomplete=function(){return n.close()},new Promise((function(e,n){r.onerror=function(){return n(r.error)},e(t(r.objectStore("IdentityIds")))})).catch((function(e){throw n.close(),e}))}))},e}(),Ot=new(function(){function e(e){void 0===e&&(e={}),this.store=e}return e.prototype.getItem=function(e){return e in this.store?this.store[e]:null},e.prototype.removeItem=function(e){delete this.store[e]},e.prototype.setItem=function(e,t){this.store[e]=t},e}());function It(e){var t=this,n=e.accountId,r=e.cache,i=void 0===r?"object"==typeof self&&self.indexedDB?new At:"object"==typeof window&&window.localStorage?window.localStorage:Ot:r,o=e.client,s=e.customRoleArn,a=e.identityPoolId,u=e.logins,c=e.userIdentifier,l=void 0===c?u&&0!==Object.keys(u).length?void 0:"ANONYMOUS":c,f=l?"aws:cognito-identity-credentials:"+a+":"+l:void 0,d=function(){return Object(S.__awaiter)(t,void 0,void 0,(function(){var e,t,r,c,l,h,p,v,y;return Object(S.__generator)(this,(function(g){switch(g.label){case 0:return(t=f)?[4,i.getItem(f)]:[3,2];case 1:t=g.sent(),g.label=2;case 2:return(e=t)?[3,7]:(h=(l=o).send,p=Et.bind,y={AccountId:n,IdentityPoolId:a},u?[4,St(u)]:[3,4]);case 3:return v=g.sent(),[3,5];case 4:v=void 0,g.label=5;case 5:return[4,h.apply(l,[new(p.apply(Et,[void 0,(y.Logins=v,y)]))])];case 6:r=g.sent().IdentityId,c=void 0===r?function(){throw new wt("Response from Amazon Cognito contained no identity ID")}():r,e=c,f&&Promise.resolve(i.setItem(f,e)).catch((function(){})),g.label=7;case 7:return[2,(d=_t({client:o,customRoleArn:s,logins:u,identityId:e}))()]}}))}))};return function(){return d().catch((function(e){return Object(S.__awaiter)(t,void 0,void 0,(function(){return Object(S.__generator)(this,(function(t){throw f&&Promise.resolve(i.removeItem(f)).catch((function(){})),e}))}))}))}}var Tt=function(e,t){return(Tt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function Ct(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Tt(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var xt=function(){return(xt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function Pt(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function kt(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}Object.create;function Nt(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}Object.create;var Mt=n(73),jt=n(71),Rt=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,Dt)},Dt=function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()};for(var Ut=function(){function e(e){var t=(void 0===e?{}:e).requestTimeout;this.requestTimeout=t}return e.prototype.destroy=function(){},e.prototype.handle=function(e,t){var n=(void 0===t?{}:t).abortSignal,r=this.requestTimeout;if(null==n?void 0:n.aborted){var i=new Error("Request aborted");return i.name="AbortError",Promise.reject(i)}var o=e.path;if(e.query){var s=function(e){var t,n,r=[];try{for(var i=Object(S.__values)(Object.keys(e).sort()),o=i.next();!o.done;o=i.next()){var s=o.value,a=e[s];if(s=Rt(s),Array.isArray(a))for(var u=0,c=a.length;u<c;u++)r.push(s+"="+Rt(a[u]));else{var l=s;(a||"string"==typeof a)&&(l+="="+Rt(a)),r.push(l)}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r.join("&")}(e.query);s&&(o+="?"+s)}var a=e.port,u=e.method,c=e.protocol+"//"+e.hostname+(a?":"+a:"")+o,l={body:"GET"===u||"HEAD"===u?void 0:e.body,headers:new Headers(e.headers),method:u};"undefined"!=typeof AbortController&&(l.signal=n);var f,d=new Request(c,l),h=[fetch(d).then((function(e){var t,n,r=e.headers,i={};try{for(var o=Object(S.__values)(r.entries()),s=o.next();!s.done;s=o.next()){var a=s.value;i[a[0]]=a[1]}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return void 0!==e.body?{response:new ke({headers:i,statusCode:e.status,body:e.body})}:e.blob().then((function(t){return{response:new ke({headers:i,statusCode:e.status,body:t})}}))})),(f=r,void 0===f&&(f=0),new Promise((function(e,t){f&&setTimeout((function(){var e=new Error("Request did not complete within "+f+" ms");e.name="TimeoutError",t(e)}),f)})))];return n&&h.push(new Promise((function(e,t){n.onabort=function(){var e=new Error("Request aborted");e.name="AbortError",t(e)}}))),Promise.race(h)},e}(),Ft={},Lt=new Array(64),Bt=0,qt="A".charCodeAt(0),zt="Z".charCodeAt(0);Bt+qt<=zt;Bt++){var Kt=String.fromCharCode(Bt+qt);Ft[Kt]=Bt,Lt[Bt]=Kt}for(Bt=0,qt="a".charCodeAt(0),zt="z".charCodeAt(0);Bt+qt<=zt;Bt++){Kt=String.fromCharCode(Bt+qt);var Ht=Bt+26;Ft[Kt]=Ht,Lt[Ht]=Kt}for(Bt=0;Bt<10;Bt++){Ft[Bt.toString(10)]=Bt+52;Kt=Bt.toString(10),Ht=Bt+52;Ft[Kt]=Ht,Lt[Ht]=Kt}Ft["+"]=62,Lt[62]="+",Ft["/"]=63,Lt[63]="/";function Vt(e){var t=e.length/4*3;"=="===e.substr(-2)?t-=2:"="===e.substr(-1)&&t--;for(var n=new ArrayBuffer(t),r=new DataView(n),i=0;i<e.length;i+=4){for(var o=0,s=0,a=i,u=i+3;a<=u;a++)"="!==e[a]?(o|=Ft[e[a]]<<6*(u-a),s+=6):o>>=6;var c=i/4*3;o>>=s%8;for(var l=Math.floor(s/8),f=0;f<l;f++){var d=8*(l-f-1);r.setUint8(c+f,(o&255<<d)>>d)}}return new Uint8Array(n)}function Gt(e){return new Promise((function(t,n){var r=new FileReader;r.onloadend=function(){var e;if(2!==r.readyState)return n(new Error("Reader aborted too early"));var i=null!==(e=r.result)&&void 0!==e?e:"",o=i.indexOf(","),s=o>-1?o+1:i.length;t(i.substring(s))},r.onabort=function(){return n(new Error("Read aborted"))},r.onerror=function(){return n(r.error)},r.readAsDataURL(e)}))}var Wt={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},Yt=function(e){return{applyToStack:function(t){t.add(function(e){return function(t,n){return function(r){return Object(S.__awaiter)(void 0,void 0,void 0,(function(){var i;return Object(S.__generator)(this,(function(o){return(null===(i=null==e?void 0:e.retryStrategy)||void 0===i?void 0:i.mode)&&(n.userAgent=Object(S.__spread)(n.userAgent||[],[["cfg/retry-mode",e.retryStrategy.mode]])),[2,e.retryStrategy.retry(t,r)]}))}))}}}(e),Wt)}}},Jt=["AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch"],$t=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],Zt=["AbortError","TimeoutError","RequestTimeout","RequestTimeoutException"],Qt=[500,502,503,504],Xt=function(e){var t,n;return 429===(null===(t=e.$metadata)||void 0===t?void 0:t.httpStatusCode)||$t.includes(e.name)||1==(null===(n=e.$retryable)||void 0===n?void 0:n.throttling)},en=n(70),tn=function(e,t){return Math.floor(Math.min(2e4,Math.random()*Math.pow(2,t)*e))},nn=function(e){return!!e&&(function(e){return void 0!==e.$retryable}(e)||function(e){return Jt.includes(e.name)}(e)||Xt(e)||function(e){var t;return Zt.includes(e.name)||Qt.includes((null===(t=e.$metadata)||void 0===t?void 0:t.httpStatusCode)||0)}(e))},rn=function(){function e(e,t){var n,r,i,o,s,a,u,c;this.maxAttemptsProvider=e,this.mode="standard",this.retryDecider=null!==(n=null==t?void 0:t.retryDecider)&&void 0!==n?n:nn,this.delayDecider=null!==(r=null==t?void 0:t.delayDecider)&&void 0!==r?r:tn,this.retryQuota=null!==(i=null==t?void 0:t.retryQuota)&&void 0!==i?i:(s=o=500,a=o,u=function(e){return"TimeoutError"===e.name?10:5},c=function(e){return u(e)<=a},Object.freeze({hasRetryTokens:c,retrieveRetryTokens:function(e){if(!c(e))throw new Error("No retry token available");var t=u(e);return a-=t,t},releaseRetryTokens:function(e){a+=null!=e?e:1,a=Math.min(a,s)}}))}return e.prototype.shouldRetry=function(e,t,n){return t<n&&this.retryDecider(e)&&this.retryQuota.hasRetryTokens(e)},e.prototype.getMaxAttempts=function(){return Object(S.__awaiter)(this,void 0,void 0,(function(){var e;return Object(S.__generator)(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.maxAttemptsProvider()];case 1:return e=t.sent(),[3,3];case 2:return t.sent(),e=3,[3,3];case 3:return[2,e]}}))}))},e.prototype.retry=function(e,t){return Object(S.__awaiter)(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c;return Object(S.__generator)(this,(function(l){switch(l.label){case 0:return r=0,i=0,[4,this.getMaxAttempts()];case 1:o=l.sent(),s=t.request,Ne.isInstance(s)&&(s.headers["amz-sdk-invocation-id"]=Object(en.v4)()),a=function(){var a,c,l,f,d;return Object(S.__generator)(this,(function(h){switch(h.label){case 0:return h.trys.push([0,2,,5]),Ne.isInstance(s)&&(s.headers["amz-sdk-request"]="attempt="+(r+1)+"; max="+o),[4,e(t)];case 1:return a=h.sent(),c=a.response,l=a.output,u.retryQuota.releaseRetryTokens(n),l.$metadata.attempts=r+1,l.$metadata.totalRetryDelay=i,[2,{value:{response:c,output:l}}];case 2:return f=h.sent(),r++,u.shouldRetry(f,r,o)?(n=u.retryQuota.retrieveRetryTokens(f),d=u.delayDecider(Xt(f)?500:100,r),i+=d,[4,new Promise((function(e){return setTimeout(e,d)}))]):[3,4];case 3:return h.sent(),[2,"continue"];case 4:throw f.$metadata||(f.$metadata={}),f.$metadata.attempts=r,f.$metadata.totalRetryDelay=i,f;case 5:return[2]}}))},u=this,l.label=2;case 2:return[5,a()];case 3:return"object"==typeof(c=l.sent())?[2,c.value]:[3,2];case 4:return[2]}}))}))},e}(),on=function(e){if(void 0===e&&(e=3),"number"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};var sn=n(72),an=n.n(sn),un=n(33),cn="cognito-identity.{region}.amazonaws.com",ln=new Set(["af-south-1","ap-east-1","ap-northeast-1","ap-northeast-2","ap-south-1","ap-southeast-1","ap-southeast-2","ca-central-1","eu-central-1","eu-north-1","eu-south-1","eu-west-1","eu-west-2","eu-west-3","me-south-1","sa-east-1","us-east-1","us-east-2","us-west-1","us-west-2"]),fn=new Set(["cn-north-1","cn-northwest-1"]),dn=new Set(["us-iso-east-1"]),hn=new Set(["us-isob-east-1"]),pn=new Set(["us-gov-east-1","us-gov-west-1"]);var vn,yn,gn,mn,bn={apiVersion:"2014-06-30",disableHostPrefix:!1,logger:{},regionInfoProvider:function(e,t){var n=void 0;switch(e){case"ap-northeast-1":n={hostname:"cognito-identity.ap-northeast-1.amazonaws.com",partition:"aws"};break;case"ap-northeast-2":n={hostname:"cognito-identity.ap-northeast-2.amazonaws.com",partition:"aws"};break;case"ap-south-1":n={hostname:"cognito-identity.ap-south-1.amazonaws.com",partition:"aws"};break;case"ap-southeast-1":n={hostname:"cognito-identity.ap-southeast-1.amazonaws.com",partition:"aws"};break;case"ap-southeast-2":n={hostname:"cognito-identity.ap-southeast-2.amazonaws.com",partition:"aws"};break;case"ca-central-1":n={hostname:"cognito-identity.ca-central-1.amazonaws.com",partition:"aws"};break;case"cn-north-1":n={hostname:"cognito-identity.cn-north-1.amazonaws.com.cn",partition:"aws-cn"};break;case"eu-central-1":n={hostname:"cognito-identity.eu-central-1.amazonaws.com",partition:"aws"};break;case"eu-north-1":n={hostname:"cognito-identity.eu-north-1.amazonaws.com",partition:"aws"};break;case"eu-west-1":n={hostname:"cognito-identity.eu-west-1.amazonaws.com",partition:"aws"};break;case"eu-west-2":n={hostname:"cognito-identity.eu-west-2.amazonaws.com",partition:"aws"};break;case"eu-west-3":n={hostname:"cognito-identity.eu-west-3.amazonaws.com",partition:"aws"};break;case"fips-us-east-1":n={hostname:"cognito-identity-fips.us-east-1.amazonaws.com",partition:"aws",signingRegion:"us-east-1"};break;case"fips-us-east-2":n={hostname:"cognito-identity-fips.us-east-2.amazonaws.com",partition:"aws",signingRegion:"us-east-2"};break;case"fips-us-gov-west-1":n={hostname:"cognito-identity-fips.us-gov-west-1.amazonaws.com",partition:"aws-us-gov",signingRegion:"us-gov-west-1"};break;case"fips-us-west-2":n={hostname:"cognito-identity-fips.us-west-2.amazonaws.com",partition:"aws",signingRegion:"us-west-2"};break;case"sa-east-1":n={hostname:"cognito-identity.sa-east-1.amazonaws.com",partition:"aws"};break;case"us-east-1":n={hostname:"cognito-identity.us-east-1.amazonaws.com",partition:"aws"};break;case"us-east-2":n={hostname:"cognito-identity.us-east-2.amazonaws.com",partition:"aws"};break;case"us-gov-west-1":n={hostname:"cognito-identity.us-gov-west-1.amazonaws.com",partition:"aws-us-gov"};break;case"us-west-1":n={hostname:"cognito-identity.us-west-1.amazonaws.com",partition:"aws"};break;case"us-west-2":n={hostname:"cognito-identity.us-west-2.amazonaws.com",partition:"aws"};break;default:ln.has(e)&&(n={hostname:cn.replace("{region}",e),partition:"aws"}),fn.has(e)&&(n={hostname:"cognito-identity.{region}.amazonaws.com.cn".replace("{region}",e),partition:"aws-cn"}),dn.has(e)&&(n={hostname:"cognito-identity.{region}.c2s.ic.gov".replace("{region}",e),partition:"aws-iso"}),hn.has(e)&&(n={hostname:"cognito-identity.{region}.sc2s.sgov.gov".replace("{region}",e),partition:"aws-iso-b"}),pn.has(e)&&(n={hostname:"cognito-identity.{region}.amazonaws.com".replace("{region}",e),partition:"aws-us-gov"}),void 0===n&&(n={hostname:cn.replace("{region}",e),partition:"aws"})}return Promise.resolve(xt({signingService:"cognito-identity"},n))},serviceId:"Cognito Identity",urlParser:function(e){var t,n=new URL(e),r=n.hostname,i=n.pathname,o=n.port,s=n.protocol,a=n.search;return a&&(t=function(e){var t,n,r={};if(e=e.replace(/^\?/,""))try{for(var i=Object(S.__values)(e.split("&")),o=i.next();!o.done;o=i.next()){var s=o.value,a=Object(S.__read)(s.split("="),2),u=a[0],c=a[1],l=void 0===c?null:c;u=decodeURIComponent(u),l&&(l=decodeURIComponent(l)),u in r?Array.isArray(r[u])?r[u].push(l):r[u]=[r[u],l]:r[u]=l}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}(a)),{hostname:r,port:o?parseInt(o):void 0,protocol:s,path:i,query:t}}},wn=xt(xt({},bn),{runtime:"browser",base64Decoder:Vt,base64Encoder:function(e){for(var t="",n=0;n<e.length;n+=3){for(var r=0,i=0,o=n,s=Math.min(n+3,e.length);o<s;o++)r|=e[o]<<8*(s-o-1),i+=8;var a=Math.ceil(i/6);r<<=6*a-i;for(var u=1;u<=a;u++){var c=6*(a-u);t+=Lt[(r&63<<c)>>c]}t+="==".slice(0,4-a)}return t},bodyLengthChecker:function(e){if("string"==typeof e){for(var t=e.length,n=t-1;n>=0;n--){var r=e.charCodeAt(n);r>127&&r<=2047?t++:r>2047&&r<=65535&&(t+=2)}return t}return"number"==typeof e.byteLength?e.byteLength:"number"==typeof e.size?e.size:void 0},credentialDefaultProvider:function(e){return function(){return Promise.reject(new Error("Credential is missing"))}},defaultUserAgentProvider:(yn={serviceId:bn.serviceId,clientVersion:Mt.version},gn=yn.serviceId,mn=yn.clientVersion,function(){return Object(S.__awaiter)(void 0,void 0,void 0,(function(){var e,t,n,r,i,o,s,a,u;return Object(S.__generator)(this,(function(c){return e=(null===(n=null===window||void 0===window?void 0:window.navigator)||void 0===n?void 0:n.userAgent)?an.a.parse(window.navigator.userAgent):void 0,t=[["aws-sdk-js",mn],["os/"+((null===(r=null==e?void 0:e.os)||void 0===r?void 0:r.name)||"other"),null===(i=null==e?void 0:e.os)||void 0===i?void 0:i.version],["lang/js"],["md/browser",(null!==(s=null===(o=null==e?void 0:e.browser)||void 0===o?void 0:o.name)&&void 0!==s?s:"unknown")+"_"+(null!==(u=null===(a=null==e?void 0:e.browser)||void 0===a?void 0:a.version)&&void 0!==u?u:"unknown")]],gn&&t.push(["api/"+gn,mn]),[2,t]}))}))}),maxAttempts:3,region:(vn="Region is missing",function(){return Promise.reject(vn)}),requestHandler:new Ut,sha256:jt.Sha256,streamCollector:function(e){return"function"==typeof Blob&&e instanceof Blob?function(e){return Object(S.__awaiter)(this,void 0,void 0,(function(){var t,n;return Object(S.__generator)(this,(function(r){switch(r.label){case 0:return[4,Gt(e)];case 1:return t=r.sent(),n=Vt(t),[2,new Uint8Array(n)]}}))}))}(e):function(e){return Object(S.__awaiter)(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return Object(S.__generator)(this,(function(u){switch(u.label){case 0:t=new Uint8Array(0),n=e.getReader(),r=!1,u.label=1;case 1:return r?[3,3]:[4,n.read()];case 2:return i=u.sent(),o=i.done,(s=i.value)&&(a=t,(t=new Uint8Array(a.length+s.length)).set(a),t.set(s,a.length)),r=o,[3,1];case 3:return[2,t]}}))}))}(e)},utf8Decoder:un.fromUtf8,utf8Encoder:un.toUtf8}),Sn=function(e){var t=e.endpoint,n=e.urlParser;if("string"==typeof t){var r=Promise.resolve(n(t));return function(){return r}}if("object"==typeof t){var i=Promise.resolve(t);return function(){return i}}return t},_n=function(e){return Object(S.__awaiter)(void 0,void 0,void 0,(function(){var t,n,r,i,o;return Object(S.__generator)(this,(function(s){switch(s.label){case 0:return t=e.tls,n=void 0===t||t,[4,e.region()];case 1:if(r=s.sent(),!new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/).test(r))throw new Error("Invalid region in client config");return[4,e.regionInfoProvider(r)];case 2:if(!(i=(null!==(o=s.sent())&&void 0!==o?o:{}).hostname))throw new Error("Cannot resolve hostname from client config");return[2,e.urlParser((n?"https:":"http:")+"//"+i)]}}))}))},En=function(e){if("string"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};var An={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},On=function(e){return{applyToStack:function(t){t.add(function(e){var t=this;return function(n){return function(r){return Object(S.__awaiter)(t,void 0,void 0,(function(){var t,i,o,s,a;return Object(S.__generator)(this,(function(u){return t=r.request,Ne.isInstance(t)&&(i=t.body,o=t.headers,i&&-1===Object.keys(o).map((function(e){return e.toLowerCase()})).indexOf("content-length")&&void 0!==(s=e(i))&&(t.headers=Object(S.__assign)(Object(S.__assign)({},t.headers),((a={})["content-length"]=String(s),a)))),[2,n(Object(S.__assign)(Object(S.__assign)({},r),{request:t}))]}))}))}}}(e.bodyLengthChecker),An)}}};for(var In={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},Tn=function(e){return{applyToStack:function(t){t.add(function(e){return function(t){return function(n){return Object(S.__awaiter)(void 0,void 0,void 0,(function(){var r,i;return Object(S.__generator)(this,(function(o){return Ne.isInstance(n.request)?(r=n.request,i=(e.requestHandler.metadata||{}).handlerProtocol,(void 0===i?"":i).indexOf("h2")>=0&&!r.headers[":authority"]?(delete r.headers.host,r.headers[":authority"]=""):r.headers.host||(r.headers.host=r.hostname),[2,t(n)]):[2,t(n)]}))}))}}}(e),In)}}},Cn={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},xn=function(e){return{applyToStack:function(e){e.add((function(e,t){return function(n){return Object(S.__awaiter)(void 0,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,f;return Object(S.__generator)(this,(function(d){switch(d.label){case 0:return r=t.clientName,i=t.commandName,o=t.inputFilterSensitiveLog,s=t.logger,a=t.outputFilterSensitiveLog,[4,e(n)];case 1:return u=d.sent(),s?("function"==typeof s.info&&(c=u.output,l=c.$metadata,f=Object(S.__rest)(c,["$metadata"]),s.info({clientName:r,commandName:i,input:o(n.input),output:a(f),metadata:l})),[2,u]):[2,u]}}))}))}}),Cn)}}},Pn={},kn={},Nn=0;Nn<256;Nn++){var Mn=Nn.toString(16).toLowerCase();1===Mn.length&&(Mn="0"+Mn),Pn[Nn]=Mn,kn[Mn]=Nn}function jn(e){for(var t="",n=0;n<e.byteLength;n++)t+=Pn[e[n]];return t}var Rn="X-Amz-Date".toLowerCase(),Dn=["authorization",Rn,"date"],Un="X-Amz-Signature".toLowerCase(),Fn="X-Amz-Security-Token".toLowerCase(),Ln={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},Bn=/^proxy-/,qn=/^sec-/,zn="AWS4-HMAC-SHA256-PAYLOAD",Kn={},Hn=[];function Vn(e,t,n){return e+"/"+t+"/"+n+"/aws4_request"}function Gn(e,t,n){var r=new e(t);return r.update(n),r.digest()}function Wn(e,t,n){var r,i,o=e.headers,s={};try{for(var a=Object(S.__values)(Object.keys(o).sort()),u=a.next();!u.done;u=a.next()){var c=u.value,l=c.toLowerCase();(l in Ln||(null==t?void 0:t.has(l))||Bn.test(l)||qn.test(l))&&(!n||n&&!n.has(l))||(s[l]=o[c].trim().replace(/\s+/g," "))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return s}var Yn=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,Jn)},Jn=function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()};function $n(e,t){var n=e.headers,r=e.body;return Object(S.__awaiter)(this,void 0,void 0,(function(){var e,i,o,s,a,u,c;return Object(S.__generator)(this,(function(l){switch(l.label){case 0:try{for(e=Object(S.__values)(Object.keys(n)),i=e.next();!i.done;i=e.next())if("x-amz-content-sha256"===(o=i.value).toLowerCase())return[2,n[o]]}catch(e){u={error:e}}finally{try{i&&!i.done&&(c=e.return)&&c.call(e)}finally{if(u)throw u.error}}return null!=r?[3,1]:[2,"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"];case 1:return"string"==typeof r||ArrayBuffer.isView(r)||(f=r,"function"==typeof ArrayBuffer&&f instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(f))?((s=new t).update(r),a=jn,[4,s.digest()]):[3,3];case 2:return[2,a.apply(void 0,[l.sent()])];case 3:return[2,"UNSIGNED-PAYLOAD"]}var f}))}))}function Zn(e){var t=e.headers,n=e.query,r=Object(S.__rest)(e,["headers","query"]);return Object(S.__assign)(Object(S.__assign)({},r),{headers:Object(S.__assign)({},t),query:n?Qn(n):void 0})}function Qn(e){return Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object(S.__assign)(Object(S.__assign)({},t),((r={})[n]=Array.isArray(i)?Object(S.__spread)(i):i,r))}),{})}function Xn(e){var t,n;e="function"==typeof e.clone?e.clone():Zn(e);try{for(var r=Object(S.__values)(Object.keys(e.headers)),i=r.next();!i.done;i=r.next()){var o=i.value;Dn.indexOf(o.toLowerCase())>-1&&delete e.headers[o]}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}return e}function er(e){return function(e){if("number"==typeof e)return new Date(1e3*e);if("string"==typeof e)return Number(e)?new Date(1e3*Number(e)):new Date(e);return e}(e).toISOString().replace(/\.\d{3}Z$/,"Z")}var tr=function(){function e(e){var t=e.applyChecksum,n=e.credentials,r=e.region,i=e.service,o=e.sha256,s=e.uriEscapePath,a=void 0===s||s;this.service=i,this.sha256=o,this.uriEscapePath=a,this.applyChecksum="boolean"!=typeof t||t,this.regionProvider=ir(r),this.credentialProvider=or(n)}return e.prototype.presign=function(e,t){return void 0===t&&(t={}),Object(S.__awaiter)(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b,w,_,E,A,O,I;return Object(S.__generator)(this,(function(T){switch(T.label){case 0:return n=t.signingDate,r=void 0===n?new Date:n,i=t.expiresIn,o=void 0===i?3600:i,s=t.unsignableHeaders,a=t.unhoistableHeaders,u=t.signableHeaders,c=t.signingRegion,l=t.signingService,[4,this.credentialProvider()];case 1:return f=T.sent(),null==c?[3,2]:(h=c,[3,4]);case 2:return[4,this.regionProvider()];case 3:h=T.sent(),T.label=4;case 4:return d=h,p=nr(r),v=p.longDate,y=p.shortDate,o>604800?[2,Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future")]:(g=Vn(y,d,null!=l?l:this.service),m=function(e,t){var n,r,i;void 0===t&&(t={});var o="function"==typeof e.clone?e.clone():Zn(e),s=o.headers,a=o.query,u=void 0===a?{}:a;try{for(var c=Object(S.__values)(Object.keys(s)),l=c.next();!l.done;l=c.next()){var f=l.value,d=f.toLowerCase();"x-amz-"!==d.substr(0,6)||(null===(i=t.unhoistableHeaders)||void 0===i?void 0:i.has(d))||(u[f]=s[f],delete s[f])}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}return Object(S.__assign)(Object(S.__assign)({},e),{headers:s,query:u})}(Xn(e),{unhoistableHeaders:a}),f.sessionToken&&(m.query["X-Amz-Security-Token"]=f.sessionToken),m.query["X-Amz-Algorithm"]="AWS4-HMAC-SHA256",m.query["X-Amz-Credential"]=f.accessKeyId+"/"+g,m.query["X-Amz-Date"]=v,m.query["X-Amz-Expires"]=o.toString(10),b=Wn(m,s,u),m.query["X-Amz-SignedHeaders"]=rr(b),w=m.query,_="X-Amz-Signature",E=this.getSignature,A=[v,g,this.getSigningKey(f,d,y,l)],O=this.createCanonicalRequest,I=[m,b],[4,$n(e,this.sha256)]);case 5:return[4,E.apply(this,A.concat([O.apply(this,I.concat([T.sent()]))]))];case 6:return w[_]=T.sent(),[2,m]}}))}))},e.prototype.sign=function(e,t){return Object(S.__awaiter)(this,void 0,void 0,(function(){return Object(S.__generator)(this,(function(n){return"string"==typeof e?[2,this.signString(e,t)]:e.headers&&e.payload?[2,this.signEvent(e,t)]:[2,this.signRequest(e,t)]}))}))},e.prototype.signEvent=function(e,t){var n=e.headers,r=e.payload,i=t.signingDate,o=void 0===i?new Date:i,s=t.priorSignature,a=t.signingRegion,u=t.signingService;return Object(S.__awaiter)(this,void 0,void 0,(function(){var e,t,i,c,l,f,d,h,p,v,y;return Object(S.__generator)(this,(function(g){switch(g.label){case 0:return null==a?[3,1]:(t=a,[3,3]);case 1:return[4,this.regionProvider()];case 2:t=g.sent(),g.label=3;case 3:return e=t,i=nr(o),c=i.shortDate,l=i.longDate,f=Vn(c,e,null!=u?u:this.service),[4,$n({headers:{},body:r},this.sha256)];case 4:return d=g.sent(),(h=new this.sha256).update(n),v=jn,[4,h.digest()];case 5:return p=v.apply(void 0,[g.sent()]),y=[zn,l,f,s,p,d].join("\n"),[2,this.signString(y,{signingDate:o,signingRegion:e,signingService:u})]}}))}))},e.prototype.signString=function(e,t){var n=void 0===t?{}:t,r=n.signingDate,i=void 0===r?new Date:r,o=n.signingRegion,s=n.signingService;return Object(S.__awaiter)(this,void 0,void 0,(function(){var t,n,r,a,u,c,l,f;return Object(S.__generator)(this,(function(d){switch(d.label){case 0:return[4,this.credentialProvider()];case 1:return t=d.sent(),null==o?[3,2]:(r=o,[3,4]);case 2:return[4,this.regionProvider()];case 3:r=d.sent(),d.label=4;case 4:return n=r,a=nr(i).shortDate,l=(c=this.sha256).bind,[4,this.getSigningKey(t,n,a,s)];case 5:return(u=new(l.apply(c,[void 0,d.sent()]))).update(e),f=jn,[4,u.digest()];case 6:return[2,f.apply(void 0,[d.sent()])]}}))}))},e.prototype.signRequest=function(e,t){var n=void 0===t?{}:t,r=n.signingDate,i=void 0===r?new Date:r,o=n.signableHeaders,s=n.unsignableHeaders,a=n.signingRegion,u=n.signingService;return Object(S.__awaiter)(this,void 0,void 0,(function(){var t,n,r,c,l,f,d,h,p,v,y;return Object(S.__generator)(this,(function(g){switch(g.label){case 0:return[4,this.credentialProvider()];case 1:return t=g.sent(),null==a?[3,2]:(r=a,[3,4]);case 2:return[4,this.regionProvider()];case 3:r=g.sent(),g.label=4;case 4:return n=r,c=Xn(e),l=nr(i),f=l.longDate,d=l.shortDate,h=Vn(d,n,null!=u?u:this.service),c.headers[Rn]=f,t.sessionToken&&(c.headers[Fn]=t.sessionToken),[4,$n(c,this.sha256)];case 5:return p=g.sent(),!function(e,t){var n,r;e=e.toLowerCase();try{for(var i=Object(S.__values)(Object.keys(t)),o=i.next();!o.done;o=i.next()){if(e===o.value.toLowerCase())return!0}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1}("x-amz-content-sha256",c.headers)&&this.applyChecksum&&(c.headers["x-amz-content-sha256"]=p),v=Wn(c,s,o),[4,this.getSignature(f,h,this.getSigningKey(t,n,d,u),this.createCanonicalRequest(c,v,p))];case 6:return y=g.sent(),c.headers.authorization="AWS4-HMAC-SHA256 Credential="+t.accessKeyId+"/"+h+", SignedHeaders="+rr(v)+", Signature="+y,[2,c]}}))}))},e.prototype.createCanonicalRequest=function(e,t,n){var r=Object.keys(t).sort();return e.method+"\n"+this.getCanonicalPath(e)+"\n"+function(e){var t,n,r=e.query,i=void 0===r?{}:r,o=[],s={},a=function(e){if(e.toLowerCase()===Un)return"continue";o.push(e);var t=i[e];"string"==typeof t?s[e]=Yn(e)+"="+Yn(t):Array.isArray(t)&&(s[e]=t.slice(0).sort().reduce((function(t,n){return t.concat([Yn(e)+"="+Yn(n)])}),[]).join("&"))};try{for(var u=Object(S.__values)(Object.keys(i).sort()),c=u.next();!c.done;c=u.next()){a(c.value)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}return o.map((function(e){return s[e]})).filter((function(e){return e})).join("&")}(e)+"\n"+r.map((function(e){return e+":"+t[e]})).join("\n")+"\n\n"+r.join(";")+"\n"+n},e.prototype.createStringToSign=function(e,t,n){return Object(S.__awaiter)(this,void 0,void 0,(function(){var r,i;return Object(S.__generator)(this,(function(o){switch(o.label){case 0:return(r=new this.sha256).update(n),[4,r.digest()];case 1:return i=o.sent(),[2,"AWS4-HMAC-SHA256\n"+e+"\n"+t+"\n"+jn(i)]}}))}))},e.prototype.getCanonicalPath=function(e){var t=e.path;return this.uriEscapePath?"/"+encodeURIComponent(t.replace(/^\//,"")).replace(/%2F/g,"/"):t},e.prototype.getSignature=function(e,t,n,r){return Object(S.__awaiter)(this,void 0,void 0,(function(){var i,o,s,a,u;return Object(S.__generator)(this,(function(c){switch(c.label){case 0:return[4,this.createStringToSign(e,t,r)];case 1:return i=c.sent(),a=(s=this.sha256).bind,[4,n];case 2:return(o=new(a.apply(s,[void 0,c.sent()]))).update(i),u=jn,[4,o.digest()];case 3:return[2,u.apply(void 0,[c.sent()])]}}))}))},e.prototype.getSigningKey=function(e,t,n,r){return function(e,t,n,r,i){return Object(S.__awaiter)(void 0,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h;return Object(S.__generator)(this,(function(p){switch(p.label){case 0:return[4,Gn(e,t.secretAccessKey,t.accessKeyId)];case 1:if(o=p.sent(),(s=n+":"+r+":"+i+":"+jn(o)+":"+t.sessionToken)in Kn)return[2,Kn[s]];for(Hn.push(s);Hn.length>50;)delete Kn[Hn.shift()];a="AWS4"+t.secretAccessKey,p.label=2;case 2:p.trys.push([2,7,8,9]),u=Object(S.__values)([n,r,i,"aws4_request"]),c=u.next(),p.label=3;case 3:return c.done?[3,6]:(l=c.value,[4,Gn(e,a,l)]);case 4:a=p.sent(),p.label=5;case 5:return c=u.next(),[3,3];case 6:return[3,9];case 7:return f=p.sent(),d={error:f},[3,9];case 8:try{c&&!c.done&&(h=u.return)&&h.call(u)}finally{if(d)throw d.error}return[7];case 9:return[2,Kn[s]=a]}}))}))}(this.sha256,e,n,t,r||this.service)},e}(),nr=function(e){var t=er(e).replace(/[\-:]/g,"");return{longDate:t,shortDate:t.substr(0,8)}},rr=function(e){return Object.keys(e).sort().join(";")},ir=function(e){if("string"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e},or=function(e){if("object"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};function sr(e){if("object"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e}var ar,ur,cr,lr,fr,dr,hr,pr,vr,yr,gr,mr,br,wr,Sr,_r,Er,Ar,Or,Ir,Tr,Cr,xr,Pr,kr,Nr,Mr,jr,Rr,Dr,Ur,Fr,Lr,Br,qr,zr,Kr,Hr,Vr,Gr,Wr,Yr,Jr,$r,Zr,Qr,Xr,ei,ti,ni,ri,ii,oi,si,ai,ui,ci,li=/[^\!\#\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,fi=function(e){var t=Object(S.__read)(e,2),n=t[0],r=t[1],i=n.indexOf("/"),o=n.substring(0,i),s=n.substring(i+1);return"api"===o&&(s=s.toLowerCase()),[o,s,r].filter((function(e){return e&&e.length>0})).map((function(e){return null==e?void 0:e.replace(li,"_")})).join("/")},di={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},hi=function(e){return{applyToStack:function(t){var n;t.add((n=e,function(e,t){return function(r){return Object(S.__awaiter)(void 0,void 0,void 0,(function(){var i,o,s,a,u,c,l,f;return Object(S.__generator)(this,(function(d){switch(d.label){case 0:return i=r.request,Ne.isInstance(i)?(o=i.headers,s=(null===(l=null==t?void 0:t.userAgent)||void 0===l?void 0:l.map(fi))||[],[4,n.defaultUserAgentProvider()]):[2,e(r)];case 1:return a=d.sent().map(fi),u=(null===(f=null==n?void 0:n.customUserAgent)||void 0===f?void 0:f.map(fi))||[],o["x-amz-user-agent"]=Object(S.__spread)(a,s,u).join(" "),c=Object(S.__spread)(a.filter((function(e){return e.startsWith("aws-sdk-")})),u).join(" "),"browser"!==n.runtime&&c&&(o["user-agent"]=o["user-agent"]?o["user-agent"]+" "+c:c),[2,e(Object(S.__assign)(Object(S.__assign)({},r),{request:i}))]}}))}))}}),di)}}},pi=function(e){function t(t){var n,r,i=this,o=function(e){var t,n=this,r=sr(e.credentials||e.credentialDefaultProvider(e)),i=e.signingEscapePath,o=void 0===i||i,s=e.systemClockOffset,a=void 0===s?e.systemClockOffset||0:s,u=e.sha256;return t=e.signer?sr(e.signer):function(){return sr(e.region)().then((function(t){return Object(S.__awaiter)(n,void 0,void 0,(function(){return Object(S.__generator)(this,(function(n){switch(n.label){case 0:return[4,e.regionInfoProvider(t)];case 1:return[2,[n.sent()||{},t]]}}))}))})).then((function(t){var n=Object(S.__read)(t,2),i=n[0],s=n[1],a=i.signingRegion,c=i.signingService;return e.signingRegion=e.signingRegion||a||s,e.signingName=e.signingName||c||e.serviceId,new tr({credentials:r,region:e.signingRegion,service:e.signingName,sha256:u,uriEscapePath:o})}))},Object(S.__assign)(Object(S.__assign)({},e),{systemClockOffset:a,signingEscapePath:o,credentials:r,signer:t})}(function(e){var t;return Object(S.__assign)(Object(S.__assign)({},e),{tls:null===(t=e.tls)||void 0===t||t,endpoint:e.endpoint?Sn(e):function(){return _n(e)},isCustomEndpoint:!!e.endpoint})}(function(e){if(!e.region)throw new Error("Region is missing");return Object(S.__assign)(Object(S.__assign)({},e),{region:En(e.region)})}(xt(xt({},wn),t)))),s=function(e){return Object(S.__assign)(Object(S.__assign)({},e),{customUserAgent:"string"==typeof e.customUserAgent?[[e.customUserAgent]]:e.customUserAgent})}((r=on((n=o).maxAttempts),Object(S.__assign)(Object(S.__assign)({},n),{maxAttempts:r,retryStrategy:n.retryStrategy||new rn(r)})));return(i=e.call(this,s)||this).config=s,i.middlewareStack.use(Yt(i.config)),i.middlewareStack.use(On(i.config)),i.middlewareStack.use(Tn(i.config)),i.middlewareStack.use(xn(i.config)),i.middlewareStack.use(hi(i.config)),i}return Ct(t,e),t.prototype.destroy=function(){e.prototype.destroy.call(this)},t}(yt);!function(e){e.AUTHENTICATED_ROLE="AuthenticatedRole",e.DENY="Deny"}(ar||(ar={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(ur||(ur={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(cr||(cr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(lr||(lr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(fr||(fr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(dr||(dr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(hr||(hr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(pr||(pr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(vr||(vr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(yr||(yr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(gr||(gr={})),function(e){e.ACCESS_DENIED="AccessDenied",e.INTERNAL_SERVER_ERROR="InternalServerError"}(mr||(mr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(br||(br={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(wr||(wr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Sr||(Sr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(_r||(_r={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Er||(Er={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Ar||(Ar={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Or||(Or={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Ir||(Ir={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Tr||(Tr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Cr||(Cr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(xr||(xr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Pr||(Pr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(kr||(kr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Nr||(Nr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Mr||(Mr={})),function(e){e.CONTAINS="Contains",e.EQUALS="Equals",e.NOT_EQUAL="NotEqual",e.STARTS_WITH="StartsWith"}(jr||(jr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Rr||(Rr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Dr||(Dr={})),function(e){e.RULES="Rules",e.TOKEN="Token"}(Ur||(Ur={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Fr||(Fr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Lr||(Lr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Br||(Br={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(qr||(qr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(zr||(zr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Kr||(Kr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Hr||(Hr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Vr||(Vr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Gr||(Gr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Wr||(Wr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Yr||(Yr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Jr||(Jr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}($r||($r={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Zr||(Zr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Qr||(Qr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(Xr||(Xr={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(ei||(ei={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(ti||(ti={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(ni||(ni={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(ri||(ri={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(ii||(ii={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(oi||(oi={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(si||(si={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(ai||(ai={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(ui||(ui={})),function(e){e.filterSensitiveLog=function(e){return xt({},e)}}(ci||(ci={}));var vi=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return kt(this,(function(g){switch(g.label){case 0:return r=[xt({},e)],y={},[4,Hi(e.body,t)];case 1:switch(n=xt.apply(void 0,r.concat([(y.body=g.sent(),y)])),o="UnknownError",o=Vi(e,n.body),o){case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":return[3,2];case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":return[3,4];case"InvalidIdentityPoolConfigurationException":case"com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException":return[3,6];case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":return[3,8];case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":return[3,10];case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":return[3,12];case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":return[3,14];case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":return[3,16]}return[3,18];case 2:return s=[{}],[4,gi(n,t)];case 3:return i=xt.apply(void 0,[xt.apply(void 0,s.concat([g.sent()])),{name:o,$metadata:qi(e)}]),[3,19];case 4:return a=[{}],[4,mi(n,t)];case 5:return i=xt.apply(void 0,[xt.apply(void 0,a.concat([g.sent()])),{name:o,$metadata:qi(e)}]),[3,19];case 6:return u=[{}],[4,bi(n,t)];case 7:return i=xt.apply(void 0,[xt.apply(void 0,u.concat([g.sent()])),{name:o,$metadata:qi(e)}]),[3,19];case 8:return c=[{}],[4,wi(n,t)];case 9:return i=xt.apply(void 0,[xt.apply(void 0,c.concat([g.sent()])),{name:o,$metadata:qi(e)}]),[3,19];case 10:return l=[{}],[4,_i(n,t)];case 11:return i=xt.apply(void 0,[xt.apply(void 0,l.concat([g.sent()])),{name:o,$metadata:qi(e)}]),[3,19];case 12:return f=[{}],[4,Ei(n,t)];case 13:return i=xt.apply(void 0,[xt.apply(void 0,f.concat([g.sent()])),{name:o,$metadata:qi(e)}]),[3,19];case 14:return d=[{}],[4,Ai(n,t)];case 15:return i=xt.apply(void 0,[xt.apply(void 0,d.concat([g.sent()])),{name:o,$metadata:qi(e)}]),[3,19];case 16:return h=[{}],[4,Oi(n,t)];case 17:return i=xt.apply(void 0,[xt.apply(void 0,h.concat([g.sent()])),{name:o,$metadata:qi(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=xt(xt({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:qi(e)}),g.label=19;case 19:return v=i.message||i.Message||o,i.message=v,delete i.Message,[2,Promise.reject(Object.assign(new Error(v),i))]}}))}))},yi=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return kt(this,(function(g){switch(g.label){case 0:return r=[xt({},e)],y={},[4,Hi(e.body,t)];case 1:switch(n=xt.apply(void 0,r.concat([(y.body=g.sent(),y)])),o="UnknownError",o=Vi(e,n.body),o){case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":return[3,2];case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":return[3,4];case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":return[3,6];case"LimitExceededException":case"com.amazonaws.cognitoidentity#LimitExceededException":return[3,8];case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":return[3,10];case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":return[3,12];case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":return[3,14];case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":return[3,16]}return[3,18];case 2:return s=[{}],[4,gi(n,t)];case 3:return i=xt.apply(void 0,[xt.apply(void 0,s.concat([g.sent()])),{name:o,$metadata:qi(e)}]),[3,19];case 4:return a=[{}],[4,mi(n,t)];case 5:return i=xt.apply(void 0,[xt.apply(void 0,a.concat([g.sent()])),{name:o,$metadata:qi(e)}]),[3,19];case 6:return u=[{}],[4,wi(n,t)];case 7:return i=xt.apply(void 0,[xt.apply(void 0,u.concat([g.sent()])),{name:o,$metadata:qi(e)}]),[3,19];case 8:return c=[{}],[4,Si(n,t)];case 9:return i=xt.apply(void 0,[xt.apply(void 0,c.concat([g.sent()])),{name:o,$metadata:qi(e)}]),[3,19];case 10:return l=[{}],[4,_i(n,t)];case 11:return i=xt.apply(void 0,[xt.apply(void 0,l.concat([g.sent()])),{name:o,$metadata:qi(e)}]),[3,19];case 12:return f=[{}],[4,Ei(n,t)];case 13:return i=xt.apply(void 0,[xt.apply(void 0,f.concat([g.sent()])),{name:o,$metadata:qi(e)}]),[3,19];case 14:return d=[{}],[4,Ai(n,t)];case 15:return i=xt.apply(void 0,[xt.apply(void 0,d.concat([g.sent()])),{name:o,$metadata:qi(e)}]),[3,19];case 16:return h=[{}],[4,Oi(n,t)];case 17:return i=xt.apply(void 0,[xt.apply(void 0,h.concat([g.sent()])),{name:o,$metadata:qi(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=xt(xt({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:qi(e)}),g.label=19;case 19:return v=i.message||i.Message||o,i.message=v,delete i.Message,[2,Promise.reject(Object.assign(new Error(v),i))]}}))}))},gi=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return kt(this,(function(i){return n=e.body,r=Pi(n,t),[2,xt({name:"ExternalServiceException",$fault:"client",$metadata:qi(e)},r)]}))}))},mi=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return kt(this,(function(i){return n=e.body,r=Mi(n,t),[2,xt({name:"InternalErrorException",$fault:"server",$metadata:qi(e)},r)]}))}))},bi=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return kt(this,(function(i){return n=e.body,r=ji(n,t),[2,xt({name:"InvalidIdentityPoolConfigurationException",$fault:"client",$metadata:qi(e)},r)]}))}))},wi=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return kt(this,(function(i){return n=e.body,r=Ri(n,t),[2,xt({name:"InvalidParameterException",$fault:"client",$metadata:qi(e)},r)]}))}))},Si=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return kt(this,(function(i){return n=e.body,r=Di(n,t),[2,xt({name:"LimitExceededException",$fault:"client",$metadata:qi(e)},r)]}))}))},_i=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return kt(this,(function(i){return n=e.body,r=Ui(n,t),[2,xt({name:"NotAuthorizedException",$fault:"client",$metadata:qi(e)},r)]}))}))},Ei=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return kt(this,(function(i){return n=e.body,r=Fi(n,t),[2,xt({name:"ResourceConflictException",$fault:"client",$metadata:qi(e)},r)]}))}))},Ai=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return kt(this,(function(i){return n=e.body,r=Li(n,t),[2,xt({name:"ResourceNotFoundException",$fault:"client",$metadata:qi(e)},r)]}))}))},Oi=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return kt(this,(function(i){return n=e.body,r=Bi(n,t),[2,xt({name:"TooManyRequestsException",$fault:"client",$metadata:qi(e)},r)]}))}))},Ii=function(e,t){return xt(xt(xt({},void 0!==e.CustomRoleArn&&null!==e.CustomRoleArn&&{CustomRoleArn:e.CustomRoleArn}),void 0!==e.IdentityId&&null!==e.IdentityId&&{IdentityId:e.IdentityId}),void 0!==e.Logins&&null!==e.Logins&&{Logins:Ci(e.Logins,t)})},Ti=function(e,t){return xt(xt(xt({},void 0!==e.AccountId&&null!==e.AccountId&&{AccountId:e.AccountId}),void 0!==e.IdentityPoolId&&null!==e.IdentityPoolId&&{IdentityPoolId:e.IdentityPoolId}),void 0!==e.Logins&&null!==e.Logins&&{Logins:Ci(e.Logins,t)})},Ci=function(e,t){return Object.entries(e).reduce((function(e,t){var n,r=Nt(t,2),i=r[0],o=r[1];return null===o?e:xt(xt({},e),((n={})[i]=o,n))}),{})},xi=function(e,t){return{AccessKeyId:void 0!==e.AccessKeyId&&null!==e.AccessKeyId?e.AccessKeyId:void 0,Expiration:void 0!==e.Expiration&&null!==e.Expiration?new Date(Math.round(1e3*e.Expiration)):void 0,SecretKey:void 0!==e.SecretKey&&null!==e.SecretKey?e.SecretKey:void 0,SessionToken:void 0!==e.SessionToken&&null!==e.SessionToken?e.SessionToken:void 0}},Pi=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},ki=function(e,t){return{Credentials:void 0!==e.Credentials&&null!==e.Credentials?xi(e.Credentials):void 0,IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},Ni=function(e,t){return{IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},Mi=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},ji=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ri=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Di=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ui=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Fi=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Li=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Bi=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},qi=function(e){var t;return{httpStatusCode:e.statusCode,requestId:null!==(t=e.headers["x-amzn-requestid"])&&void 0!==t?t:e.headers["x-amzn-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}},zi=function(e,t){return void 0===e&&(e=new Uint8Array),e instanceof Uint8Array?Promise.resolve(e):t.streamCollector(e)||Promise.resolve(new Uint8Array)},Ki=function(e,t,n,r,i){return Pt(void 0,void 0,void 0,(function(){var o,s,a,u,c,l;return kt(this,(function(f){switch(f.label){case 0:return[4,e.endpoint()];case 1:return o=f.sent(),s=o.hostname,a=o.protocol,u=void 0===a?"https":a,c=o.port,l={protocol:u,hostname:s,port:c,method:"POST",path:n,headers:t},void 0!==r&&(l.hostname=r),void 0!==i&&(l.body=i),[2,new Ne(l)]}}))}))},Hi=function(e,t){return function(e,t){return zi(e,t).then((function(e){return t.utf8Encoder(e)}))}(e,t).then((function(e){return e.length?JSON.parse(e):{}}))},Vi=function(e,t){var n,r,i=function(e){var t=e;return t.indexOf(":")>=0&&(t=t.split(":")[0]),t.indexOf("#")>=0&&(t=t.split("#")[1]),t},o=(n=e.headers,r="x-amzn-errortype",Object.keys(n).find((function(e){return e.toLowerCase()===r.toLowerCase()})));return void 0!==o?i(e.headers[o]):void 0!==t.code?i(t.code):void 0!==t.__type?i(t.__type):""},Gi=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return Ct(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(dt(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetIdCommand",inputFilterSensitiveLog:kr.filterSensitiveLog,outputFilterSensitiveLog:Nr.filterSensitiveLog},o=t.requestHandler;return r.resolve((function(e){return o.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return kt(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetId"},r=JSON.stringify(Ti(e,t)),[2,Ki(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r,i;return kt(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,yi(e,t)]:[4,Hi(e.body,t)];case 1:return n=o.sent(),{},r=Ni(n,t),i=xt({$metadata:qi(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(gt),Wi=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return Ct(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(dt(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetCredentialsForIdentityCommand",inputFilterSensitiveLog:Tr.filterSensitiveLog,outputFilterSensitiveLog:xr.filterSensitiveLog},o=t.requestHandler;return r.resolve((function(e){return o.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return kt(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetCredentialsForIdentity"},r=JSON.stringify(Ii(e,t)),[2,Ki(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r,i;return kt(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,vi(e,t)]:[4,Hi(e.body,t)];case 1:return n=o.sent(),{},r=ki(n,t),i=xt({$metadata:qi(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(gt),Yi=function(){return(Yi=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},Ji=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},$i=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Zi=new r.a("Credentials"),Qi=new(function(){function e(e){this._gettingCredPromise=null,this._refreshHandlers={},this.Auth=void 0,this.configure(e),this._refreshHandlers.google=g.refreshGoogleToken,this._refreshHandlers.facebook=m.refreshFacebookToken}return e.prototype.getModuleName=function(){return"Credentials"},e.prototype.getCredSource=function(){return this._credentials_source},e.prototype.configure=function(e){if(!e)return this._config||{};this._config=Object.assign({},this._config,e);var t=this._config.refreshHandlers;return t&&(this._refreshHandlers=Yi(Yi({},this._refreshHandlers),t)),this._storage=this._config.storage,this._storage||(this._storage=(new i.a).getStorage()),this._storageSync=Promise.resolve(),"function"==typeof this._storage.sync&&(this._storageSync=this._storage.sync()),this._config},e.prototype.get=function(){return Zi.debug("getting credentials"),this._pickupCredentials()},e.prototype._getCognitoIdentityIdStorageKey=function(e){return"CognitoIdentityId-"+e},e.prototype._pickupCredentials=function(){return Zi.debug("picking up credentials"),this._gettingCredPromise&&this._gettingCredPromise.isPending()?Zi.debug("getting old cred promise"):(Zi.debug("getting new cred promise"),this._gettingCredPromise=Object(o.d)(this._keepAlive())),this._gettingCredPromise},e.prototype._keepAlive=function(){return Ji(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return $i(this,(function(a){switch(a.label){case 0:if(Zi.debug("checking if credentials exists and not expired"),(e=this._credentials)&&!this._isExpired(e)&&!this._isPastTTL())return Zi.debug("credentials not changed and not expired, directly return"),[2,Promise.resolve(e)];if(Zi.debug("need to get a new credential or refresh the existing one"),t=this.Auth,!(n=void 0===t?w.a.Auth:t)||"function"!=typeof n.currentUserCredentials)return[2,Promise.reject("No Auth module registered in Amplify")];if(this._isExpired(e)||!this._isPastTTL())return[3,6];Zi.debug("ttl has passed but token is not yet expired"),a.label=1;case 1:return a.trys.push([1,5,,6]),[4,n.currentUserPoolUser()];case 2:return r=a.sent(),[4,n.currentSession()];case 3:return i=a.sent(),o=i.refreshToken,[4,new Promise((function(e,t){r.refreshSession(o,(function(n,r){return n?t(n):e(r)}))}))];case 4:return a.sent(),[3,6];case 5:return s=a.sent(),Zi.debug("Error attempting to refreshing the session",s),[3,6];case 6:return[2,n.currentUserCredentials()]}}))}))},e.prototype.refreshFederatedToken=function(e){Zi.debug("Getting federated credentials");var t=e.provider,n=e.user,r=e.token,i=e.identity_id,o=e.expires_at;o=1970===new Date(o).getFullYear()?1e3*o:o;return Zi.debug("checking if federated jwt token expired"),o>(new Date).getTime()?(Zi.debug("token not expired"),this._setCredentialsFromFederation({provider:t,token:r,user:n,identity_id:i,expires_at:o})):this._refreshHandlers[t]&&"function"==typeof this._refreshHandlers[t]?(Zi.debug("getting refreshed jwt token from federation provider"),this._providerRefreshWithRetry({refreshHandler:this._refreshHandlers[t],provider:t,user:n})):(Zi.debug("no refresh handler for provider:",t),this.clear(),Promise.reject("no refresh handler for provider"))},e.prototype._providerRefreshWithRetry=function(e){var t=this,n=e.refreshHandler,r=e.provider,i=e.user;return Object(s.c)(n,[],1e4).then((function(e){return Zi.debug("refresh federated token sucessfully",e),t._setCredentialsFromFederation({provider:r,token:e.token,user:i,identity_id:e.identity_id,expires_at:e.expires_at})})).catch((function(e){return"string"==typeof e&&0===e.toLowerCase().lastIndexOf("network error",e.length)||t.clear(),Zi.debug("refresh federated token failed",e),Promise.reject("refreshing federation token failed: "+e)}))},e.prototype._isExpired=function(e){if(!e)return Zi.debug("no credentials for expiration check"),!0;Zi.debug("are these credentials expired?",e);var t=Date.now();return e.expiration.getTime()<=t},e.prototype._isPastTTL=function(){return this._nextCredentialsRefresh<=Date.now()},e.prototype._setCredentialsForGuest=function(){return Ji(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a=this;return $i(this,(function(u){switch(u.label){case 0:return Zi.debug("setting credentials for guest"),e=this._config,t=e.identityPoolId,n=e.region,e.mandatorySignIn?[2,Promise.reject("cannot get guest credentials when mandatory signin enabled")]:t?n?(i=this,[4,this._getGuestIdentityId()]):(Zi.debug("region is not configured for getting the credentials"),[2,Promise.reject("region is not configured for getting the credentials")]):(Zi.debug("No Cognito Identity pool provided for unauthenticated access"),[2,Promise.reject("No Cognito Identity pool provided for unauthenticated access")]);case 1:return r=i._identityId=u.sent(),o=new pi({region:n,customUserAgent:Object(b.b)()}),s=void 0,s=r?_t({identityId:r,client:o})():function(){return Ji(a,void 0,void 0,(function(){var e;return $i(this,(function(n){switch(n.label){case 0:return[4,o.send(new Gi({IdentityPoolId:t}))];case 1:return e=n.sent().IdentityId,this._identityId=e,[2,_t({client:o,identityId:e})()]}}))}))}().catch((function(e){return Ji(a,void 0,void 0,(function(){return $i(this,(function(t){throw e}))}))})),[2,this._loadCredentials(s,"guest",!1,null).then((function(e){return e})).catch((function(e){return Ji(a,void 0,void 0,(function(){var n=this;return $i(this,(function(i){switch(i.label){case 0:return"ResourceNotFoundException"!==e.name||e.message!=="Identity '"+r+"' not found."?[3,2]:(Zi.debug("Failed to load guest credentials"),[4,this._removeGuestIdentityId()]);case 1:return i.sent(),s=function(){return Ji(n,void 0,void 0,(function(){var e;return $i(this,(function(n){switch(n.label){case 0:return[4,o.send(new Gi({IdentityPoolId:t}))];case 1:return e=n.sent().IdentityId,this._identityId=e,[2,_t({client:o,identityId:e})()]}}))}))}().catch((function(e){return Ji(n,void 0,void 0,(function(){return $i(this,(function(t){throw e}))}))})),[2,this._loadCredentials(s,"guest",!1,null)];case 2:return[2,e]}}))}))}))]}}))}))},e.prototype._setCredentialsFromFederation=function(e){var t=e.provider,n=e.token,r=e.identity_id,i={google:"accounts.google.com",facebook:"graph.facebook.com",amazon:"www.amazon.com",developer:"cognito-identity.amazonaws.com"}[t]||t;if(!i)return Promise.reject("You must specify a federated provider");var o={};o[i]=n;var s=this._config,a=s.identityPoolId,u=s.region;if(!a)return Zi.debug("No Cognito Federated Identity pool provided"),Promise.reject("No Cognito Federated Identity pool provided");if(!u)return Zi.debug("region is not configured for getting the credentials"),Promise.reject("region is not configured for getting the credentials");var c=new pi({region:u,customUserAgent:Object(b.b)()}),l=void 0;r?l=_t({identityId:r,logins:o,client:c})():l=It({logins:o,identityPoolId:a,client:c})();return this._loadCredentials(l,"federated",!0,e)},e.prototype._setCredentialsFromSession=function(e){var t=this;Zi.debug("set credentials from session");var n=e.getIdToken().getJwtToken(),r=this._config,i=r.region,o=r.userPoolId,s=r.identityPoolId;if(!s)return Zi.debug("No Cognito Federated Identity pool provided"),Promise.reject("No Cognito Federated Identity pool provided");if(!i)return Zi.debug("region is not configured for getting the credentials"),Promise.reject("region is not configured for getting the credentials");var a={};a["cognito-idp."+i+".amazonaws.com/"+o]=n;var u=new pi({region:i,customUserAgent:Object(b.b)()}),c=Ji(t,void 0,void 0,(function(){var e,t,n,r,i,o,c,l,f,d;return $i(this,(function(h){switch(h.label){case 0:return[4,this._getGuestIdentityId()];case 1:return(e=h.sent())?[3,3]:[4,u.send(new Gi({IdentityPoolId:s,Logins:a}))];case 2:n=h.sent().IdentityId,t=n,h.label=3;case 3:return[4,u.send(new Wi({IdentityId:e||t,Logins:a}))];case 4:return r=h.sent(),i=r.Credentials,o=i.AccessKeyId,c=i.Expiration,l=i.SecretKey,f=i.SessionToken,d=r.IdentityId,this._identityId=d,e?(Zi.debug("The guest identity "+e+" has been successfully linked to the logins"),e===d&&Zi.debug("The guest identity "+e+" has become the primary identity"),[4,this._removeGuestIdentityId()]):[3,6];case 5:h.sent(),h.label=6;case 6:return[2,{accessKeyId:o,secretAccessKey:l,sessionToken:f,expiration:c,identityId:d}]}}))})).catch((function(e){return Ji(t,void 0,void 0,(function(){return $i(this,(function(t){throw e}))}))}));return this._loadCredentials(c,"userPool",!0,null)},e.prototype._loadCredentials=function(e,t,n,r){var i=this,o=this;return new Promise((function(s,a){e.then((function(e){return Ji(i,void 0,void 0,(function(){var i,a,u,c,l;return $i(this,(function(f){switch(f.label){case 0:if(Zi.debug("Load credentials successfully",e),this._identityId&&!e.identityId&&(e.identityId=this._identityId),o._credentials=e,o._credentials.authenticated=n,o._credentials_source=t,o._nextCredentialsRefresh=(new Date).getTime()+3e6,"federated"===t){i=Object.assign({id:this._credentials.identityId},r.user),a=r.provider,u=r.token,c=r.expires_at,l=r.identity_id;try{this._storage.setItem("aws-amplify-federatedInfo",JSON.stringify({provider:a,token:u,user:i,expires_at:c,identity_id:l}))}catch(e){Zi.debug("Failed to put federated info into auth storage",e)}}return"guest"!==t?[3,2]:[4,this._setGuestIdentityId(e.identityId)];case 1:f.sent(),f.label=2;case 2:return s(o._credentials),[2]}}))}))})).catch((function(t){if(t)return Zi.debug("Failed to load credentials",e),Zi.debug("Error loading credentials",t),void a(t)}))}))},e.prototype.set=function(e,t){return"session"===t?this._setCredentialsFromSession(e):"federation"===t?this._setCredentialsFromFederation(e):"guest"===t?this._setCredentialsForGuest():(Zi.debug("no source specified for setting credentials"),Promise.reject("invalid source"))},e.prototype.clear=function(){return Ji(this,void 0,void 0,(function(){return $i(this,(function(e){return this._credentials=null,this._credentials_source=null,Zi.debug("removing aws-amplify-federatedInfo from storage"),this._storage.removeItem("aws-amplify-federatedInfo"),[2]}))}))},e.prototype._getGuestIdentityId=function(){return Ji(this,void 0,void 0,(function(){var e,t;return $i(this,(function(n){switch(n.label){case 0:e=this._config.identityPoolId,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._storageSync];case 2:return n.sent(),[2,this._storage.getItem(this._getCognitoIdentityIdStorageKey(e))];case 3:return t=n.sent(),Zi.debug("Failed to get the cached guest identityId",t),[3,4];case 4:return[2]}}))}))},e.prototype._setGuestIdentityId=function(e){return Ji(this,void 0,void 0,(function(){var t,n;return $i(this,(function(r){switch(r.label){case 0:t=this._config.identityPoolId,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._storageSync];case 2:return r.sent(),this._storage.setItem(this._getCognitoIdentityIdStorageKey(t),e),[3,4];case 3:return n=r.sent(),Zi.debug("Failed to cache guest identityId",n),[3,4];case 4:return[2]}}))}))},e.prototype._removeGuestIdentityId=function(){return Ji(this,void 0,void 0,(function(){var e;return $i(this,(function(t){return e=this._config.identityPoolId,Zi.debug("removing "+this._getCognitoIdentityIdStorageKey(e)+" from storage"),this._storage.removeItem(this._getCognitoIdentityIdStorageKey(e)),[2]}))}))},e.prototype.shear=function(e){return{accessKeyId:e.accessKeyId,sessionToken:e.sessionToken,secretAccessKey:e.secretAccessKey,identityId:e.identityId,authenticated:e.authenticated}},e}())(null);w.a.register(Qi)}])}));
66
66
  //# sourceMappingURL=aws-amplify-datastore.min.js.map