@aws-amplify/datastore 3.11.2-unstable.3 → 3.11.3
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.
- package/CHANGELOG.md +19 -0
- package/dist/aws-amplify-datastore.js +3 -3
- package/dist/aws-amplify-datastore.js.map +1 -1
- package/dist/aws-amplify-datastore.min.js +2 -2
- package/dist/aws-amplify-datastore.min.js.map +1 -1
- package/lib/storage/adapter/InMemoryStore.js +2 -2
- package/lib/storage/adapter/InMemoryStore.js.map +1 -1
- package/lib-esm/storage/adapter/InMemoryStore.js +2 -2
- package/lib-esm/storage/adapter/InMemoryStore.js.map +1 -1
- package/package.json +9 -8
- package/src/storage/adapter/InMemoryStore.ts +2 -2
|
@@ -47,7 +47,7 @@ function I(e){return i.Buffer.from((new h).random(e).toString(),"hex")}O.prototy
|
|
|
47
47
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
48
48
|
* SPDX-License-Identifier: Apache-2.0
|
|
49
49
|
*/
|
|
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(28),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(81),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"}(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(96)}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(30))},function(e,t,n){"use strict";var r=n(62),i=Object.prototype.toString;function o(e){return"[object Array]"===i.call(e)}function s(e){return void 0===e}function a(e){return null!==e&&"object"==typeof e}function u(e){if("[object Object]"!==i.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function c(e){return"[object Function]"===i.call(e)}function l(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:function(e){return"[object ArrayBuffer]"===i.call(e)},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"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:a,isPlainObject:u,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:c,isStream:function(e){return a(e)&&c(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:l,merge:function e(){var t={};function n(n,r){u(t[r])&&u(n)?t[r]=e(t[r],n):u(n)?t[r]=e({},n):o(n)?t[r]=n.slice():t[r]=n}for(var r=0,i=arguments.length;r<i;r++)l(arguments[r],n);return t},extend:function(e,t,n){return l(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";(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(50))},function(e,t,n){"use strict";var r=n(42);n(9);t.a=r.a},function(t,n){t.exports=e},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(22),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){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return i}));var r={userAgent:"aws-amplify/4.5.4 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.5.4 react-native",r.isReactNative=!0;break;default:r.userAgent="aws-amplify/4.5.4 js",r.isReactNative=!1}var i=function(){return r.userAgent}},function(e,t,n){"use strict";var r=n(42),i=n(23),o=n(22),s=n(40),a=n(19),u=n(158),c=n(72),l=n(32),f=n.n(l),d=n(8),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(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])}}},y=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},g=new o.a("RestClient"),m=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,g.debug("API Options",this._options),null==this._cancelTokenMap&&(this._cancelTokenMap=new WeakMap)}return e.prototype.ajax=function(e,t,n){return p(this,void 0,void 0,(function(){var r,i,o,s,c,l,f,p,m,b,w,S,_,E,A=this;return v(this,(function(v){switch(v.label){case 0:return g.debug(t,e),o="us-east-1",s="execute-api",c=void 0,"string"==typeof e?(r=this._parseUrl(e),i=e):(i=e.endpoint,c=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&&(p=a.a.userAgent||"aws-amplify/0.1.x",f={"User-Agent":p}),m=Object.assign({},n),b=m.response,m.body&&("function"==typeof FormData&&m.body instanceof FormData?(f["Content-Type"]="multipart/form-data",l.data=m.body):(f["Content-Type"]="application/json; charset=UTF-8",l.data=JSON.stringify(m.body))),m.responseType&&(l.responseType=m.responseType),m.withCredentials&&(l.withCredentials=m.withCredentials),m.timeout&&(l.timeout=m.timeout),m.cancellableToken&&(l.cancelToken=m.cancellableToken.token),l.signerServiceInfo=m.signerServiceInfo,"function"!=typeof c?[3,2]:[4,c()];case 1:return S=v.sent(),[3,3];case 2:S=void 0,v.label=3;case 3:return w=S,l.headers=h(h(h({},f),w),m.headers),_=Object(d.parse)(i,!0,!0),_.search,E=y(_,["search"]),l.url=Object(d.format)(h(h({},E),{query:h(h({},E.query),m.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,b)]):[2,this.Credentials.get().then((function(r){return A._signed(h({},l),r,b,{region:o,service:s}).catch((function(r){if(u.a.isClockSkewError(r)){var i=r.response.headers,o=i&&(i.date||i.Date),s=new Date(o),a=u.a.getDateFromHeaderString(l.headers["x-amz-date"]);if(u.a.isClockSkewed(s))return u.a.setClockOffset(s.getTime()-a.getTime()),A.ajax(e,t,n)}throw r}))}),(function(e){return g.debug("No credentials available, the request will be unsigned"),A._request(l,b)}))]}}))}))},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 f.a.isCancel(e)},e.prototype.getCancellableToken=function(){return f.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=y(e,["signerServiceInfo"]),u=o||this._region||this._options.region,l=i||this._service||this._options.service,d={secret_key:t.secretAccessKey,access_key:t.accessKeyId,session_token:t.sessionToken},h={region:u,service:l},p=Object.assign(h,s),v=c.a.sign(a,d,p);return v.data&&(v.body=v.data),g.debug("Signed Request: ",v),delete v.headers.host,f()(v).then((function(e){return n?e:e.data})).catch((function(e){throw g.debug(e),e}))},e.prototype._request=function(e,t){return void 0===t&&(t=!1),f()(e).then((function(e){return t?e:e.data})).catch((function(e){throw g.debug(e),e}))},e.prototype._parseUrl=function(e){var t=e.split("/");return{host:t[2],path:"/"+t.slice(3).join("/")}},e}(),b=n(17),w=function(){return(w=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)},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={};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},A=new o.a("RestAPI"),O=function(){function e(e){this._api=null,this.Credentials=s.a,this._options=e,A.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=E(t,["API"]),o=w(w({},i),r);if(A.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&&(A.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 A.debug("create Rest API instance"),this._api=new m(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 S(this,void 0,void 0,(function(){return _(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}(),I=new O(null);function T(e){return(T="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)}b.a.register(I);"function"==typeof Symbol&&null!=Symbol.iterator&&Symbol.iterator,"function"==typeof Symbol&&null!=Symbol.asyncIterator&&Symbol.asyncIterator;var C="function"==typeof Symbol&&null!=Symbol.toStringTag?Symbol.toStringTag:"@@toStringTag";function x(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 P(e){return k(e.source,x(e.source,e.start))}function k(e,t){var n=e.locationOffset.column-1,r=M(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+N([["".concat(s),p[0]]].concat(p.slice(1,d+1).map((function(e){return["",e]})),[[" ",M(h-1)+"^"],["",p[d+1]]]))}return c+N([["".concat(s-1),l[i-1]],["".concat(s),f],["",M(u-1)+"^"],["".concat(s+1),l[i+1]]])}function N(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 M(n-(t=r).length)+t+(i?" | "+i:" |")})).join("\n")}function M(e){return Array(e+1).join(" ")}function j(e){return(j="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 R(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 D(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function U(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 F(e,t){return!t||"object"!==j(t)&&"function"!=typeof t?L(e):t}function L(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function B(e){var t="function"==typeof Map?new Map:void 0;return(B=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,H(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),K(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&&K(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 K(e,t){return(K=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function H(e){return(H=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var V=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&&K(e,t)}(a,e);var t,n,r,i,o,s=(t=a,n=z(),function(){var e,r=H(t);if(n){var i=H(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return F(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=G(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=G(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 x(n,e)})):null===(f=h)||void 0===f?void 0:f.map((function(e){return x(e.source,e.start)})),d.path=null!=i?i:void 0;var m,b=null==o?void 0:o.extensions;return null==u&&("object"==T(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?R(Object(n),!0).forEach((function(t){D(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},b):d.extensions=null!=u?u:{},Object.defineProperties(L(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(L(d),"stack",{value:o.stack,writable:!0,configurable:!0}),F(d)):(Error.captureStackTrace?Error.captureStackTrace(L(d),a):Object.defineProperty(L(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"+P(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"+k(e.source,a)}return t}(this)}},{key:C,get:function(){return"Object"}}])&&U(r.prototype,i),o&&U(r,o),a}(B(Error));function G(e){return void 0===e||0===e.length?void 0:e}function W(e,t,n){return new V("Syntax Error: ".concat(n),void 0,e,[t])}var Y=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 J="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):void 0;function $(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,J&&(e.prototype[J]=t)}var Z=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}();$(Z);var Q=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 X(e){return null!=e&&"string"==typeof e.kind}$(Q);var ee=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 te(e){return(te="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 ne(e){return re(e,[])}function re(e,t){switch(te(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(J)];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:re(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(re(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+": "+re(e[n],t)})).join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}function ie(e,t){if(!Boolean(e))throw new Error(t)}var oe=function(e,t){return e instanceof t};function se(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 ae=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||ie(0,"Body must be a string. Received: ".concat(ne(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||ie(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||ie(0,"column in locationOffset is 1-indexed and must be positive.")}var t,n,r;return t=e,(n=[{key:C,get:function(){return"Source"}}])&&se(t.prototype,n),r&&se(t,r),e}();var ue=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 ce(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&&le(t[i]);)++i;for(var o=t.length;o>i&&le(t[o-1]);)--o;return t.slice(i,o).join("\n")}function le(e){for(var t=0;t<e.length;++t)if(" "!==e[t]&&"\t"!==e[t])return!1;return!0}var fe=function(){function e(e){var t=new Q(ee.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!==ee.EOF)do{var t;e=null!==(t=e.next)&&void 0!==t?t:e.next=he(this,e)}while(e.kind===ee.COMMENT);return e},e}();function de(e){return isNaN(e)?ee.EOF:e<127?JSON.stringify(String.fromCharCode(e)):'"\\u'.concat(("00"+e.toString(16).toUpperCase()).slice(-4),'"')}function he(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 Q(ee.BANG,o,o+1,a,u,t);case 35:return ve(n,o,a,u,t);case 36:return new Q(ee.DOLLAR,o,o+1,a,u,t);case 38:return new Q(ee.AMP,o,o+1,a,u,t);case 40:return new Q(ee.PAREN_L,o,o+1,a,u,t);case 41:return new Q(ee.PAREN_R,o,o+1,a,u,t);case 46:if(46===r.charCodeAt(o+1)&&46===r.charCodeAt(o+2))return new Q(ee.SPREAD,o,o+3,a,u,t);break;case 58:return new Q(ee.COLON,o,o+1,a,u,t);case 61:return new Q(ee.EQUALS,o,o+1,a,u,t);case 64:return new Q(ee.AT,o,o+1,a,u,t);case 91:return new Q(ee.BRACKET_L,o,o+1,a,u,t);case 93:return new Q(ee.BRACKET_R,o,o+1,a,u,t);case 123:return new Q(ee.BRACE_L,o,o+1,a,u,t);case 124:return new Q(ee.PIPE,o,o+1,a,u,t);case 125:return new Q(ee.BRACE_R,o,o+1,a,u,t);case 34:return 34===r.charCodeAt(o+1)&&34===r.charCodeAt(o+2)?be(n,o,a,u,t,e):me(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 ye(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 Se(n,o,a,u,t)}throw W(n,o,pe(s))}var c=e.line,l=1+o-e.lineStart;return new Q(ee.EOF,i,i,c,l,t)}function pe(e){return e<32&&9!==e&&10!==e&&13!==e?"Cannot contain the invalid character ".concat(de(e),"."):39===e?"Unexpected single quote character ('), did you mean to use a double quote (\")?":"Cannot parse the unexpected character ".concat(de(e),".")}function ve(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 Q(ee.COMMENT,t,a,n,r,i,s.slice(t+1,a))}function ye(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 W(e,u,"Invalid number, unexpected digit after 0: ".concat(de(a),"."))}else u=ge(e,u,a),a=s.charCodeAt(u);if(46===a&&(c=!0,a=s.charCodeAt(++u),u=ge(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=ge(e,u,a),a=s.charCodeAt(u)),46===a||function(e){return 95===e||e>=65&&e<=90||e>=97&&e<=122}(a))throw W(e,u,"Invalid number, expected digit but got: ".concat(de(a),"."));return new Q(c?ee.FLOAT:ee.INT,t,u,r,i,o,s.slice(t,u))}function ge(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 W(e,i,"Invalid number, expected digit but got: ".concat(de(o),"."))}function me(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 Q(ee.STRING,t,l+1,n,r,i,h);if(d<32&&9!==d)throw W(e,l,"Invalid character within String: ".concat(de(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),we(o)<<12|we(s)<<8|we(a)<<4|we(u));if(p<0){var v=c.slice(l+1,l+5);throw W(e,l,"Invalid character escape sequence: \\u".concat(v,"."))}h+=String.fromCharCode(p),l+=4;break;default:throw W(e,l,"Invalid character escape sequence: \\".concat(String.fromCharCode(d),"."))}f=++l}}throw W(e,l,"Unterminated string.")}function be(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 Q(ee.BLOCK_STRING,t,a+3,n,r,i,ce(l));if(c<32&&9!==c&&10!==c&&13!==c)throw W(e,a,"Invalid character within String: ".concat(de(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 W(e,a,"Unterminated string.")}function we(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Se(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 Q(ee.NAME,t,a,n,r,i,o.slice(t,a))}function _e(e,t){return new Ee(e,t).parseDocument()}var Ee=function(){function e(e,t){var n=function(e){return oe(e,ae)}(e)?e:new ae(e);this._lexer=new fe(n),this._options=t}var t=e.prototype;return t.parseName=function(){var e=this.expectToken(ee.NAME);return{kind:Y.NAME,value:e.value,loc:this.loc(e)}},t.parseDocument=function(){var e=this._lexer.token;return{kind:Y.DOCUMENT,definitions:this.many(ee.SOF,this.parseDefinition,ee.EOF),loc:this.loc(e)}},t.parseDefinition=function(){if(this.peek(ee.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(ee.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(ee.BRACE_L))return{kind:Y.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(e)};var t,n=this.parseOperationType();return this.peek(ee.NAME)&&(t=this.parseName()),{kind:Y.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(ee.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(ee.PAREN_L,this.parseVariableDefinition,ee.PAREN_R)},t.parseVariableDefinition=function(){var e=this._lexer.token;return{kind:Y.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(ee.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(ee.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(ee.DOLLAR),{kind:Y.VARIABLE,name:this.parseName(),loc:this.loc(e)}},t.parseSelectionSet=function(){var e=this._lexer.token;return{kind:Y.SELECTION_SET,selections:this.many(ee.BRACE_L,this.parseSelection,ee.BRACE_R),loc:this.loc(e)}},t.parseSelection=function(){return this.peek(ee.SPREAD)?this.parseFragment():this.parseField()},t.parseField=function(){var e,t,n=this._lexer.token,r=this.parseName();return this.expectOptionalToken(ee.COLON)?(e=r,t=this.parseName()):t=r,{kind:Y.FIELD,alias:e,name:t,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(ee.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},t.parseArguments=function(e){var t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(ee.PAREN_L,t,ee.PAREN_R)},t.parseArgument=function(){var e=this._lexer.token,t=this.parseName();return this.expectToken(ee.COLON),{kind:Y.ARGUMENT,name:t,value:this.parseValueLiteral(!1),loc:this.loc(e)}},t.parseConstArgument=function(){var e=this._lexer.token;return{kind:Y.ARGUMENT,name:this.parseName(),value:(this.expectToken(ee.COLON),this.parseValueLiteral(!0)),loc:this.loc(e)}},t.parseFragment=function(){var e=this._lexer.token;this.expectToken(ee.SPREAD);var t=this.expectOptionalKeyword("on");return!t&&this.peek(ee.NAME)?{kind:Y.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(e)}:{kind:Y.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:Y.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:Y.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 ee.BRACKET_L:return this.parseList(e);case ee.BRACE_L:return this.parseObject(e);case ee.INT:return this._lexer.advance(),{kind:Y.INT,value:t.value,loc:this.loc(t)};case ee.FLOAT:return this._lexer.advance(),{kind:Y.FLOAT,value:t.value,loc:this.loc(t)};case ee.STRING:case ee.BLOCK_STRING:return this.parseStringLiteral();case ee.NAME:switch(this._lexer.advance(),t.value){case"true":return{kind:Y.BOOLEAN,value:!0,loc:this.loc(t)};case"false":return{kind:Y.BOOLEAN,value:!1,loc:this.loc(t)};case"null":return{kind:Y.NULL,loc:this.loc(t)};default:return{kind:Y.ENUM,value:t.value,loc:this.loc(t)}}case ee.DOLLAR:if(!e)return this.parseVariable()}throw this.unexpected()},t.parseStringLiteral=function(){var e=this._lexer.token;return this._lexer.advance(),{kind:Y.STRING,value:e.value,block:e.kind===ee.BLOCK_STRING,loc:this.loc(e)}},t.parseList=function(e){var t=this,n=this._lexer.token;return{kind:Y.LIST,values:this.any(ee.BRACKET_L,(function(){return t.parseValueLiteral(e)}),ee.BRACKET_R),loc:this.loc(n)}},t.parseObject=function(e){var t=this,n=this._lexer.token;return{kind:Y.OBJECT,fields:this.any(ee.BRACE_L,(function(){return t.parseObjectField(e)}),ee.BRACE_R),loc:this.loc(n)}},t.parseObjectField=function(e){var t=this._lexer.token,n=this.parseName();return this.expectToken(ee.COLON),{kind:Y.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e),loc:this.loc(t)}},t.parseDirectives=function(e){for(var t=[];this.peek(ee.AT);)t.push(this.parseDirective(e));return t},t.parseDirective=function(e){var t=this._lexer.token;return this.expectToken(ee.AT),{kind:Y.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e),loc:this.loc(t)}},t.parseTypeReference=function(){var e,t=this._lexer.token;return this.expectOptionalToken(ee.BRACKET_L)?(e=this.parseTypeReference(),this.expectToken(ee.BRACKET_R),e={kind:Y.LIST_TYPE,type:e,loc:this.loc(t)}):e=this.parseNamedType(),this.expectOptionalToken(ee.BANG)?{kind:Y.NON_NULL_TYPE,type:e,loc:this.loc(t)}:e},t.parseNamedType=function(){var e=this._lexer.token;return{kind:Y.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===ee.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(ee.STRING)||this.peek(ee.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(ee.BRACE_L,this.parseOperationTypeDefinition,ee.BRACE_R);return{kind:Y.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(ee.COLON);var n=this.parseNamedType();return{kind:Y.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:Y.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:Y.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(ee.AMP);do{t.push(this.parseNamedType())}while(this.expectOptionalToken(ee.AMP)||this.peek(ee.NAME));return t}return this.delimitedMany(ee.AMP,this.parseNamedType)},t.parseFieldsDefinition=function(){var e;return!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacySDLEmptyFields)&&this.peek(ee.BRACE_L)&&this._lexer.lookahead().kind===ee.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(ee.BRACE_L,this.parseFieldDefinition,ee.BRACE_R)},t.parseFieldDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(ee.COLON);var i=this.parseTypeReference(),o=this.parseDirectives(!0);return{kind:Y.FIELD_DEFINITION,description:t,name:n,arguments:r,type:i,directives:o,loc:this.loc(e)}},t.parseArgumentDefs=function(){return this.optionalMany(ee.PAREN_L,this.parseInputValueDef,ee.PAREN_R)},t.parseInputValueDef=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(ee.COLON);var r,i=this.parseTypeReference();this.expectOptionalToken(ee.EQUALS)&&(r=this.parseValueLiteral(!0));var o=this.parseDirectives(!0);return{kind:Y.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:Y.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:Y.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:i,loc:this.loc(e)}},t.parseUnionMemberTypes=function(){return this.expectOptionalToken(ee.EQUALS)?this.delimitedMany(ee.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:Y.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:i,loc:this.loc(e)}},t.parseEnumValuesDefinition=function(){return this.optionalMany(ee.BRACE_L,this.parseEnumValueDefinition,ee.BRACE_R)},t.parseEnumValueDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseDirectives(!0);return{kind:Y.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:Y.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:i,loc:this.loc(e)}},t.parseInputFieldsDefinition=function(){return this.optionalMany(ee.BRACE_L,this.parseInputValueDef,ee.BRACE_R)},t.parseTypeSystemExtension=function(){var e=this._lexer.lookahead();if(e.kind===ee.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(ee.BRACE_L,this.parseOperationTypeDefinition,ee.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return{kind:Y.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:Y.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:Y.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:Y.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:Y.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:Y.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:Y.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(ee.AT);var n=this.parseName(),r=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var o=this.parseDirectiveLocations();return{kind:Y.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:i,locations:o,loc:this.loc(e)}},t.parseDirectiveLocations=function(){return this.delimitedMany(ee.PIPE,this.parseDirectiveLocation)},t.parseDirectiveLocation=function(){var e=this._lexer.token,t=this.parseName();if(void 0!==ue[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 Z(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 W(this._lexer.source,t.start,"Expected ".concat(Oe(e),", found ").concat(Ae(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!==ee.NAME||t.value!==e)throw W(this._lexer.source,t.start,'Expected "'.concat(e,'", found ').concat(Ae(t),"."));this._lexer.advance()},t.expectOptionalKeyword=function(e){var t=this._lexer.token;return t.kind===ee.NAME&&t.value===e&&(this._lexer.advance(),!0)},t.unexpected=function(e){var t=null!=e?e:this._lexer.token;return W(this._lexer.source,t.start,"Unexpected ".concat(Ae(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 Ae(e){var t=e.value;return Oe(e.kind)+(null!=t?' "'.concat(t,'"'):"")}function Oe(e){return function(e){return e===ee.BANG||e===ee.DOLLAR||e===ee.AMP||e===ee.PAREN_L||e===ee.PAREN_R||e===ee.SPREAD||e===ee.COLON||e===ee.EQUALS||e===ee.AT||e===ee.BRACKET_L||e===ee.BRACKET_R||e===ee.BRACE_L||e===ee.PIPE||e===ee.BRACE_R}(e)?'"'.concat(e,'"'):e}var Ie={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"]},Te=Object.freeze({});function Ce(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 xe(e){return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ie,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(!X(u))throw new Error("Invalid AST Node: ".concat(ne(u),"."));var I=Ce(t,u.kind,p);if(I){if((O=I.call(t,u,c,l,f,d))===Te)break;if(!1===O){if(!p){f.pop();continue}}else if(void 0!==O&&(a.push([c,O]),!p)){if(!X(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:Pe})}var Pe={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return Ne(e.definitions,"\n\n")+"\n"},OperationDefinition:function(e){var t=e.operation,n=e.name,r=je("(",Ne(e.variableDefinitions,", "),")"),i=Ne(e.directives," "),o=e.selectionSet;return n||i||r||"query"!==t?Ne([t,Ne([n,r]),i,o]," "):o},VariableDefinition:function(e){var t=e.variable,n=e.type,r=e.defaultValue,i=e.directives;return t+": "+n+je(" = ",r)+je(" ",Ne(i," "))},SelectionSet:function(e){return Me(e.selections)},Field:function(e){var t=e.alias,n=e.name,r=e.arguments,i=e.directives,o=e.selectionSet,s=je("",t,": ")+n,a=s+je("(",Ne(r,", "),")");return a.length>80&&(a=s+je("(\n",Re(Ne(r,"\n")),"\n)")),Ne([a,Ne(i," "),o]," ")},Argument:function(e){return e.name+": "+e.value},FragmentSpread:function(e){return"..."+e.name+je(" ",Ne(e.directives," "))},InlineFragment:function(e){var t=e.typeCondition,n=e.directives,r=e.selectionSet;return Ne(["...",je("on ",t),Ne(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(je("(",Ne(r,", "),")")," ")+"on ".concat(n," ").concat(je("",Ne(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"["+Ne(e.values,", ")+"]"},ObjectValue:function(e){return"{"+Ne(e.fields,", ")+"}"},ObjectField:function(e){return e.name+": "+e.value},Directive:function(e){return"@"+e.name+je("(",Ne(e.arguments,", "),")")},NamedType:function(e){return e.name},ListType:function(e){return"["+e.type+"]"},NonNullType:function(e){return e.type+"!"},SchemaDefinition:ke((function(e){var t=e.directives,n=e.operationTypes;return Ne(["schema",Ne(t," "),Me(n)]," ")})),OperationTypeDefinition:function(e){return e.operation+": "+e.type},ScalarTypeDefinition:ke((function(e){return Ne(["scalar",e.name,Ne(e.directives," ")]," ")})),ObjectTypeDefinition:ke((function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return Ne(["type",t,je("implements ",Ne(n," & ")),Ne(r," "),Me(i)]," ")})),FieldDefinition:ke((function(e){var t=e.name,n=e.arguments,r=e.type,i=e.directives;return t+(Ue(n)?je("(\n",Re(Ne(n,"\n")),"\n)"):je("(",Ne(n,", "),")"))+": "+r+je(" ",Ne(i," "))})),InputValueDefinition:ke((function(e){var t=e.name,n=e.type,r=e.defaultValue,i=e.directives;return Ne([t+": "+n,je("= ",r),Ne(i," ")]," ")})),InterfaceTypeDefinition:ke((function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return Ne(["interface",t,je("implements ",Ne(n," & ")),Ne(r," "),Me(i)]," ")})),UnionTypeDefinition:ke((function(e){var t=e.name,n=e.directives,r=e.types;return Ne(["union",t,Ne(n," "),r&&0!==r.length?"= "+Ne(r," | "):""]," ")})),EnumTypeDefinition:ke((function(e){var t=e.name,n=e.directives,r=e.values;return Ne(["enum",t,Ne(n," "),Me(r)]," ")})),EnumValueDefinition:ke((function(e){return Ne([e.name,Ne(e.directives," ")]," ")})),InputObjectTypeDefinition:ke((function(e){var t=e.name,n=e.directives,r=e.fields;return Ne(["input",t,Ne(n," "),Me(r)]," ")})),DirectiveDefinition:ke((function(e){var t=e.name,n=e.arguments,r=e.repeatable,i=e.locations;return"directive @"+t+(Ue(n)?je("(\n",Re(Ne(n,"\n")),"\n)"):je("(",Ne(n,", "),")"))+(r?" repeatable":"")+" on "+Ne(i," | ")})),SchemaExtension:function(e){var t=e.directives,n=e.operationTypes;return Ne(["extend schema",Ne(t," "),Me(n)]," ")},ScalarTypeExtension:function(e){return Ne(["extend scalar",e.name,Ne(e.directives," ")]," ")},ObjectTypeExtension:function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return Ne(["extend type",t,je("implements ",Ne(n," & ")),Ne(r," "),Me(i)]," ")},InterfaceTypeExtension:function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return Ne(["extend interface",t,je("implements ",Ne(n," & ")),Ne(r," "),Me(i)]," ")},UnionTypeExtension:function(e){var t=e.name,n=e.directives,r=e.types;return Ne(["extend union",t,Ne(n," "),r&&0!==r.length?"= "+Ne(r," | "):""]," ")},EnumTypeExtension:function(e){var t=e.name,n=e.directives,r=e.values;return Ne(["extend enum",t,Ne(n," "),Me(r)]," ")},InputObjectTypeExtension:function(e){var t=e.name,n=e.directives,r=e.fields;return Ne(["extend input",t,Ne(n," "),Me(r)]," ")}};function ke(e){return function(t){return Ne([t.description,e(t)],"\n")}}function Ne(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 Me(e){return je("{\n",Re(Ne(e,"\n")),"\n}")}function je(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return null!=t&&""!==t?e+t+n:""}function Re(e){return je(" ",e.replace(/\n/g,"\n "))}function De(e){return-1!==e.indexOf("\n")}function Ue(e){return null!=e&&e.some(De)}var Fe=n(7),Le=n(33),Be=n(16),qe=n.n(Be),ze=n(15),Ke=n(21),He=function(){return(He=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)},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())}))},Ge=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])}}},We=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},Ye=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},Je=new o.a("GraphQLAPI"),$e=function(){function e(e){this._api=null,this.Auth=ze.a,this.Cache=i.a,this.Credentials=s.a,this._options=e,Je.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=We(t,["API"]),o=He(He({},i),r);return Je.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&&(Je.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 Je.debug("create Rest instance"),this._options?(this._api=new m(this._options),this._api.Credentials=this.Credentials,!0):Promise.reject("API not configured")},e.prototype._headerBasedAuth=function(e,t){return void 0===t&&(t={}),Ve(this,void 0,void 0,(function(){var n,r,o,s,a,u,c,l;return Ge(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(Ke.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(Ke.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,ze.a.currentAuthenticatedUser()];case 7:(c=f.sent())&&(a=c.token),f.label=8;case 8:if(!a)throw new Error(Ke.a.NO_FEDERATED_JWT);return s={Authorization:a},[3,10];case 9:throw f.sent(),new Error(Ke.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(Ke.a.NO_CURRENT_USER);case 14:return[3,17];case 15:if(!t.Authorization)throw new Error(Ke.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=_e(e).definitions;return Ye(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("string"==typeof n?n:xe(n)),u=Ye(a.definitions.filter((function(e){return"OperationDefinition"===e.kind})),1)[0],c=(void 0===u?{}:u).operation,l=t||{};switch(s&&(l.Authorization=s),c){case"query":case"mutation":var f=this._api.getCancellableToken(),d={cancellableToken:f},h=this._graphql({query:a,variables:i,authMode:o},l,d);return this._api.updateRequestToBeCancellable(h,f),h;case"subscription":return this._graphqlSubscribe({query:a,variables:i,authMode:o},l);default:throw new Error("invalid operation type: "+c)}},e.prototype._graphql=function(e,t,n){var r=e.query,i=e.variables,o=e.authMode;return void 0===t&&(t={}),void 0===n&&(n={}),Ve(this,void 0,void 0,(function(){var e,s,a,u,c,l,f,d,h,p,v,y,g,m,b,w,S,_,E,A,O;return Ge(this,(function(I){switch(I.label){case 0:return this._api?[3,2]:[4,this.createInstance()];case 1:I.sent(),I.label=2;case 2:return e=this._options,s=e.aws_appsync_region,a=e.aws_appsync_graphqlEndpoint,u=e.graphql_headers,c=void 0===u?function(){return{}}:u,l=e.graphql_endpoint,f=e.graphql_endpoint_iam_region,h=[{}],(p=!l)?[4,this._headerBasedAuth(o,t)]:[3,4];case 3:p=I.sent(),I.label=4;case 4:return v=[He.apply(void 0,h.concat([p]))],(y=l)?f?[4,this._headerBasedAuth(o,t)]:[3,6]:[3,8];case 5:return g=I.sent(),[3,7];case 6:g={Authorization:null},I.label=7;case 7:y=g,I.label=8;case 8:return m=[He.apply(void 0,v.concat([y]))],[4,c({query:r,variables:i})];case 9:if(d=He.apply(void 0,[He.apply(void 0,[He.apply(void 0,m.concat([I.sent()])),t]),!l&&(O={},O["x-amz-user-agent"]=Fe.a.userAgent,O)]),b={query:xe(r),variables:i},w=Object.assign({headers:d,body:b,signerServiceInfo:{service:l?"execute-api":"appsync",region:l?f:s}},n),!(S=l||a))throw{data:{},errors:[new V("No graphql endpoint provided.")]};I.label=10;case 10:return I.trys.push([10,12,,13]),[4,this._api.post(S,w)];case 11:return _=I.sent(),[3,13];case 12:if(E=I.sent(),this._api.isCancel(E))throw E;return _={data:{},errors:[new V(E.message,null,null,null,null,E)]},[3,13];case 13:if((A=_.errors)&&A.length)throw _;return[2,_]}}))}))},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:Le.a,appSyncGraphqlEndpoint:u,authenticationType:h,apiKey:l,query:xe(n),region:a,variables:r,graphql_headers:d,additionalHeaders:t,authToken:o});throw Je.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 Je.debug("set credentials for api",n),!0})).catch((function(e){return Je.warn("ensure credentials error",e),!1}))},e}(),Ze=new $e(null);b.a.register(Ze);var Qe=function(){return(Qe=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)},Xe=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())}))},et=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])}}},tt=new o.a("API"),nt=new(function(){function e(e){this.Auth=r.a,this.Cache=i.a,this.Credentials=s.a,this._options=e,this._restApi=new O(e),this._graphqlApi=new $e(e),tt.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 Qe(Qe({},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 Xe(this,void 0,void 0,(function(){return et(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);b.a.register(nt);t.a=nt},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";var r=n(17),i={keyPrefix:"aws-amplify-cache",capacityInBytes:1048576,itemMaxSize:21e4,defaultTTL:2592e5,defaultPriority:5,warningThreshold:.8,storage:(new(n(31).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(22));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";n.d(t,"b",(function(){return y})),n.d(t,"a",(function(){return g}));var r=n(22),i=n(14),o=n(157),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=new r.a("CognitoCredentials"),c=new Promise((function(e,t){return Object(i.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 s(this,void 0,void 0,(function(){return a(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(i.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 o.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 o.a("Failed to reload google auth response"))}))):n(new o.a("User is not signed in with Google"))})).catch((function(e){u.debug("Failed to refresh google token",e),n(new o.a("Failed to refresh google token"))}))})):(u.debug("no gapi auth2 available"),Promise.reject("no gapi auth2 available"))},e}(),f=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())}))},d=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])}}},h=new r.a("CognitoCredentials"),p=new Promise((function(e,t){return Object(i.b)().isBrowser?window.FB?(h.debug("FB SDK already loaded"),e()):void setTimeout((function(){return e()}),2e3):(h.debug("not in the browser, directly resolved"),e())})),v=function(){function e(){this.initialized=!1,this.refreshFacebookToken=this.refreshFacebookToken.bind(this),this._refreshFacebookTokenImpl=this._refreshFacebookTokenImpl.bind(this)}return e.prototype.refreshFacebookToken=function(){return f(this,void 0,void 0,(function(){return d(this,(function(e){switch(e.label){case 0:return this.initialized?[3,2]:(h.debug("need to wait for the Facebook SDK loaded"),[4,p]);case 1:e.sent(),this.initialized=!0,h.debug("finish waiting"),e.label=2;case 2:return[2,this._refreshFacebookTokenImpl()]}}))}))},e.prototype._refreshFacebookTokenImpl=function(){var e=null;if(Object(i.b)().isBrowser&&(e=window.FB),!e){return h.debug("no fb sdk available"),Promise.reject(new o.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,s=1e3*r.expiresIn+(new Date).getTime();if(!i){a="the jwtToken is undefined";h.debug(a),n(new o.a(a))}t({token:i,expires_at:s})}else{var a="no response from facebook when refreshing the jwt token";h.debug(a),n(new o.a(a))}}),{scope:"public_profile,email"})}))},e}(),y=new l,g=new v},function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return l})),n.d(t,"c",(function(){return f}));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={BadRecord:function(e){return/^Cannot return \w+ for [\w-_]+ type/.test(e.message)},ConfigError:function(){return!1},Transient:function(){return!1},Unauthorized:function(){return!1}},a={BadRecord:function(){return!1},ConfigError:function(){return!1},Transient:function(){return!1},Unauthorized:function(e){var t=e.error,n=r((void 0===t?{errors:[]}:t).errors,1)[0],i=(void 0===n?{}:n).message;return/Connection failed.+Unauthorized/.test(void 0===i?"":i)}},u={BadRecord:function(e){return/^Cannot return \w+ for [\w-_]+ type/.test(e.message)},ConfigError:function(){return!1},Transient:function(){return!1},Unauthorized:function(){return!1}};function c(e){return d(s,e)}function l(e){return d(a,e)}function f(e){return d(u,e)}function d(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(41),n(97),r.HmacSHA256)},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(28),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(81),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"}(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(96)}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(30))},function(e,t,n){"use strict";var r=n(62),i=Object.prototype.toString;function o(e){return"[object Array]"===i.call(e)}function s(e){return void 0===e}function a(e){return null!==e&&"object"==typeof e}function u(e){if("[object Object]"!==i.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function c(e){return"[object Function]"===i.call(e)}function l(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:function(e){return"[object ArrayBuffer]"===i.call(e)},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"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:a,isPlainObject:u,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:c,isStream:function(e){return a(e)&&c(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:l,merge:function e(){var t={};function n(n,r){u(t[r])&&u(n)?t[r]=e(t[r],n):u(n)?t[r]=e({},n):o(n)?t[r]=n.slice():t[r]=n}for(var r=0,i=arguments.length;r<i;r++)l(arguments[r],n);return t},extend:function(e,t,n){return l(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";(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(50))},function(e,t,n){"use strict";var r=n(42);n(9);t.a=r.a},function(t,n){t.exports=e},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(22),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){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return i}));var r={userAgent:"aws-amplify/4.5.5 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.5.5 react-native",r.isReactNative=!0;break;default:r.userAgent="aws-amplify/4.5.5 js",r.isReactNative=!1}var i=function(){return r.userAgent}},function(e,t,n){"use strict";var r=n(42),i=n(23),o=n(22),s=n(40),a=n(19),u=n(158),c=n(72),l=n(32),f=n.n(l),d=n(8),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(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])}}},y=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},g=new o.a("RestClient"),m=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,g.debug("API Options",this._options),null==this._cancelTokenMap&&(this._cancelTokenMap=new WeakMap)}return e.prototype.ajax=function(e,t,n){return p(this,void 0,void 0,(function(){var r,i,o,s,c,l,f,p,m,b,w,S,_,E,A=this;return v(this,(function(v){switch(v.label){case 0:return g.debug(t,e),o="us-east-1",s="execute-api",c=void 0,"string"==typeof e?(r=this._parseUrl(e),i=e):(i=e.endpoint,c=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&&(p=a.a.userAgent||"aws-amplify/0.1.x",f={"User-Agent":p}),m=Object.assign({},n),b=m.response,m.body&&("function"==typeof FormData&&m.body instanceof FormData?(f["Content-Type"]="multipart/form-data",l.data=m.body):(f["Content-Type"]="application/json; charset=UTF-8",l.data=JSON.stringify(m.body))),m.responseType&&(l.responseType=m.responseType),m.withCredentials&&(l.withCredentials=m.withCredentials),m.timeout&&(l.timeout=m.timeout),m.cancellableToken&&(l.cancelToken=m.cancellableToken.token),l.signerServiceInfo=m.signerServiceInfo,"function"!=typeof c?[3,2]:[4,c()];case 1:return S=v.sent(),[3,3];case 2:S=void 0,v.label=3;case 3:return w=S,l.headers=h(h(h({},f),w),m.headers),_=Object(d.parse)(i,!0,!0),_.search,E=y(_,["search"]),l.url=Object(d.format)(h(h({},E),{query:h(h({},E.query),m.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,b)]):[2,this.Credentials.get().then((function(r){return A._signed(h({},l),r,b,{region:o,service:s}).catch((function(r){if(u.a.isClockSkewError(r)){var i=r.response.headers,o=i&&(i.date||i.Date),s=new Date(o),a=u.a.getDateFromHeaderString(l.headers["x-amz-date"]);if(u.a.isClockSkewed(s))return u.a.setClockOffset(s.getTime()-a.getTime()),A.ajax(e,t,n)}throw r}))}),(function(e){return g.debug("No credentials available, the request will be unsigned"),A._request(l,b)}))]}}))}))},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 f.a.isCancel(e)},e.prototype.getCancellableToken=function(){return f.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=y(e,["signerServiceInfo"]),u=o||this._region||this._options.region,l=i||this._service||this._options.service,d={secret_key:t.secretAccessKey,access_key:t.accessKeyId,session_token:t.sessionToken},h={region:u,service:l},p=Object.assign(h,s),v=c.a.sign(a,d,p);return v.data&&(v.body=v.data),g.debug("Signed Request: ",v),delete v.headers.host,f()(v).then((function(e){return n?e:e.data})).catch((function(e){throw g.debug(e),e}))},e.prototype._request=function(e,t){return void 0===t&&(t=!1),f()(e).then((function(e){return t?e:e.data})).catch((function(e){throw g.debug(e),e}))},e.prototype._parseUrl=function(e){var t=e.split("/");return{host:t[2],path:"/"+t.slice(3).join("/")}},e}(),b=n(17),w=function(){return(w=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)},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={};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},A=new o.a("RestAPI"),O=function(){function e(e){this._api=null,this.Credentials=s.a,this._options=e,A.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=E(t,["API"]),o=w(w({},i),r);if(A.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&&(A.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 A.debug("create Rest API instance"),this._api=new m(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 S(this,void 0,void 0,(function(){return _(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}(),I=new O(null);function T(e){return(T="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)}b.a.register(I);"function"==typeof Symbol&&null!=Symbol.iterator&&Symbol.iterator,"function"==typeof Symbol&&null!=Symbol.asyncIterator&&Symbol.asyncIterator;var C="function"==typeof Symbol&&null!=Symbol.toStringTag?Symbol.toStringTag:"@@toStringTag";function x(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 P(e){return k(e.source,x(e.source,e.start))}function k(e,t){var n=e.locationOffset.column-1,r=M(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+N([["".concat(s),p[0]]].concat(p.slice(1,d+1).map((function(e){return["",e]})),[[" ",M(h-1)+"^"],["",p[d+1]]]))}return c+N([["".concat(s-1),l[i-1]],["".concat(s),f],["",M(u-1)+"^"],["".concat(s+1),l[i+1]]])}function N(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 M(n-(t=r).length)+t+(i?" | "+i:" |")})).join("\n")}function M(e){return Array(e+1).join(" ")}function j(e){return(j="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 R(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 D(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function U(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 F(e,t){return!t||"object"!==j(t)&&"function"!=typeof t?L(e):t}function L(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function B(e){var t="function"==typeof Map?new Map:void 0;return(B=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,H(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),K(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&&K(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 K(e,t){return(K=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function H(e){return(H=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var V=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&&K(e,t)}(a,e);var t,n,r,i,o,s=(t=a,n=z(),function(){var e,r=H(t);if(n){var i=H(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return F(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=G(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=G(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 x(n,e)})):null===(f=h)||void 0===f?void 0:f.map((function(e){return x(e.source,e.start)})),d.path=null!=i?i:void 0;var m,b=null==o?void 0:o.extensions;return null==u&&("object"==T(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?R(Object(n),!0).forEach((function(t){D(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},b):d.extensions=null!=u?u:{},Object.defineProperties(L(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(L(d),"stack",{value:o.stack,writable:!0,configurable:!0}),F(d)):(Error.captureStackTrace?Error.captureStackTrace(L(d),a):Object.defineProperty(L(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"+P(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"+k(e.source,a)}return t}(this)}},{key:C,get:function(){return"Object"}}])&&U(r.prototype,i),o&&U(r,o),a}(B(Error));function G(e){return void 0===e||0===e.length?void 0:e}function W(e,t,n){return new V("Syntax Error: ".concat(n),void 0,e,[t])}var Y=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 J="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):void 0;function $(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,J&&(e.prototype[J]=t)}var Z=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}();$(Z);var Q=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 X(e){return null!=e&&"string"==typeof e.kind}$(Q);var ee=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 te(e){return(te="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 ne(e){return re(e,[])}function re(e,t){switch(te(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(J)];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:re(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(re(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+": "+re(e[n],t)})).join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}function ie(e,t){if(!Boolean(e))throw new Error(t)}var oe=function(e,t){return e instanceof t};function se(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 ae=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||ie(0,"Body must be a string. Received: ".concat(ne(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||ie(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||ie(0,"column in locationOffset is 1-indexed and must be positive.")}var t,n,r;return t=e,(n=[{key:C,get:function(){return"Source"}}])&&se(t.prototype,n),r&&se(t,r),e}();var ue=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 ce(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&&le(t[i]);)++i;for(var o=t.length;o>i&&le(t[o-1]);)--o;return t.slice(i,o).join("\n")}function le(e){for(var t=0;t<e.length;++t)if(" "!==e[t]&&"\t"!==e[t])return!1;return!0}var fe=function(){function e(e){var t=new Q(ee.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!==ee.EOF)do{var t;e=null!==(t=e.next)&&void 0!==t?t:e.next=he(this,e)}while(e.kind===ee.COMMENT);return e},e}();function de(e){return isNaN(e)?ee.EOF:e<127?JSON.stringify(String.fromCharCode(e)):'"\\u'.concat(("00"+e.toString(16).toUpperCase()).slice(-4),'"')}function he(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 Q(ee.BANG,o,o+1,a,u,t);case 35:return ve(n,o,a,u,t);case 36:return new Q(ee.DOLLAR,o,o+1,a,u,t);case 38:return new Q(ee.AMP,o,o+1,a,u,t);case 40:return new Q(ee.PAREN_L,o,o+1,a,u,t);case 41:return new Q(ee.PAREN_R,o,o+1,a,u,t);case 46:if(46===r.charCodeAt(o+1)&&46===r.charCodeAt(o+2))return new Q(ee.SPREAD,o,o+3,a,u,t);break;case 58:return new Q(ee.COLON,o,o+1,a,u,t);case 61:return new Q(ee.EQUALS,o,o+1,a,u,t);case 64:return new Q(ee.AT,o,o+1,a,u,t);case 91:return new Q(ee.BRACKET_L,o,o+1,a,u,t);case 93:return new Q(ee.BRACKET_R,o,o+1,a,u,t);case 123:return new Q(ee.BRACE_L,o,o+1,a,u,t);case 124:return new Q(ee.PIPE,o,o+1,a,u,t);case 125:return new Q(ee.BRACE_R,o,o+1,a,u,t);case 34:return 34===r.charCodeAt(o+1)&&34===r.charCodeAt(o+2)?be(n,o,a,u,t,e):me(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 ye(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 Se(n,o,a,u,t)}throw W(n,o,pe(s))}var c=e.line,l=1+o-e.lineStart;return new Q(ee.EOF,i,i,c,l,t)}function pe(e){return e<32&&9!==e&&10!==e&&13!==e?"Cannot contain the invalid character ".concat(de(e),"."):39===e?"Unexpected single quote character ('), did you mean to use a double quote (\")?":"Cannot parse the unexpected character ".concat(de(e),".")}function ve(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 Q(ee.COMMENT,t,a,n,r,i,s.slice(t+1,a))}function ye(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 W(e,u,"Invalid number, unexpected digit after 0: ".concat(de(a),"."))}else u=ge(e,u,a),a=s.charCodeAt(u);if(46===a&&(c=!0,a=s.charCodeAt(++u),u=ge(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=ge(e,u,a),a=s.charCodeAt(u)),46===a||function(e){return 95===e||e>=65&&e<=90||e>=97&&e<=122}(a))throw W(e,u,"Invalid number, expected digit but got: ".concat(de(a),"."));return new Q(c?ee.FLOAT:ee.INT,t,u,r,i,o,s.slice(t,u))}function ge(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 W(e,i,"Invalid number, expected digit but got: ".concat(de(o),"."))}function me(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 Q(ee.STRING,t,l+1,n,r,i,h);if(d<32&&9!==d)throw W(e,l,"Invalid character within String: ".concat(de(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),we(o)<<12|we(s)<<8|we(a)<<4|we(u));if(p<0){var v=c.slice(l+1,l+5);throw W(e,l,"Invalid character escape sequence: \\u".concat(v,"."))}h+=String.fromCharCode(p),l+=4;break;default:throw W(e,l,"Invalid character escape sequence: \\".concat(String.fromCharCode(d),"."))}f=++l}}throw W(e,l,"Unterminated string.")}function be(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 Q(ee.BLOCK_STRING,t,a+3,n,r,i,ce(l));if(c<32&&9!==c&&10!==c&&13!==c)throw W(e,a,"Invalid character within String: ".concat(de(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 W(e,a,"Unterminated string.")}function we(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Se(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 Q(ee.NAME,t,a,n,r,i,o.slice(t,a))}function _e(e,t){return new Ee(e,t).parseDocument()}var Ee=function(){function e(e,t){var n=function(e){return oe(e,ae)}(e)?e:new ae(e);this._lexer=new fe(n),this._options=t}var t=e.prototype;return t.parseName=function(){var e=this.expectToken(ee.NAME);return{kind:Y.NAME,value:e.value,loc:this.loc(e)}},t.parseDocument=function(){var e=this._lexer.token;return{kind:Y.DOCUMENT,definitions:this.many(ee.SOF,this.parseDefinition,ee.EOF),loc:this.loc(e)}},t.parseDefinition=function(){if(this.peek(ee.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(ee.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(ee.BRACE_L))return{kind:Y.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(e)};var t,n=this.parseOperationType();return this.peek(ee.NAME)&&(t=this.parseName()),{kind:Y.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(ee.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(ee.PAREN_L,this.parseVariableDefinition,ee.PAREN_R)},t.parseVariableDefinition=function(){var e=this._lexer.token;return{kind:Y.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(ee.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(ee.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(ee.DOLLAR),{kind:Y.VARIABLE,name:this.parseName(),loc:this.loc(e)}},t.parseSelectionSet=function(){var e=this._lexer.token;return{kind:Y.SELECTION_SET,selections:this.many(ee.BRACE_L,this.parseSelection,ee.BRACE_R),loc:this.loc(e)}},t.parseSelection=function(){return this.peek(ee.SPREAD)?this.parseFragment():this.parseField()},t.parseField=function(){var e,t,n=this._lexer.token,r=this.parseName();return this.expectOptionalToken(ee.COLON)?(e=r,t=this.parseName()):t=r,{kind:Y.FIELD,alias:e,name:t,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(ee.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},t.parseArguments=function(e){var t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(ee.PAREN_L,t,ee.PAREN_R)},t.parseArgument=function(){var e=this._lexer.token,t=this.parseName();return this.expectToken(ee.COLON),{kind:Y.ARGUMENT,name:t,value:this.parseValueLiteral(!1),loc:this.loc(e)}},t.parseConstArgument=function(){var e=this._lexer.token;return{kind:Y.ARGUMENT,name:this.parseName(),value:(this.expectToken(ee.COLON),this.parseValueLiteral(!0)),loc:this.loc(e)}},t.parseFragment=function(){var e=this._lexer.token;this.expectToken(ee.SPREAD);var t=this.expectOptionalKeyword("on");return!t&&this.peek(ee.NAME)?{kind:Y.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(e)}:{kind:Y.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:Y.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:Y.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 ee.BRACKET_L:return this.parseList(e);case ee.BRACE_L:return this.parseObject(e);case ee.INT:return this._lexer.advance(),{kind:Y.INT,value:t.value,loc:this.loc(t)};case ee.FLOAT:return this._lexer.advance(),{kind:Y.FLOAT,value:t.value,loc:this.loc(t)};case ee.STRING:case ee.BLOCK_STRING:return this.parseStringLiteral();case ee.NAME:switch(this._lexer.advance(),t.value){case"true":return{kind:Y.BOOLEAN,value:!0,loc:this.loc(t)};case"false":return{kind:Y.BOOLEAN,value:!1,loc:this.loc(t)};case"null":return{kind:Y.NULL,loc:this.loc(t)};default:return{kind:Y.ENUM,value:t.value,loc:this.loc(t)}}case ee.DOLLAR:if(!e)return this.parseVariable()}throw this.unexpected()},t.parseStringLiteral=function(){var e=this._lexer.token;return this._lexer.advance(),{kind:Y.STRING,value:e.value,block:e.kind===ee.BLOCK_STRING,loc:this.loc(e)}},t.parseList=function(e){var t=this,n=this._lexer.token;return{kind:Y.LIST,values:this.any(ee.BRACKET_L,(function(){return t.parseValueLiteral(e)}),ee.BRACKET_R),loc:this.loc(n)}},t.parseObject=function(e){var t=this,n=this._lexer.token;return{kind:Y.OBJECT,fields:this.any(ee.BRACE_L,(function(){return t.parseObjectField(e)}),ee.BRACE_R),loc:this.loc(n)}},t.parseObjectField=function(e){var t=this._lexer.token,n=this.parseName();return this.expectToken(ee.COLON),{kind:Y.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e),loc:this.loc(t)}},t.parseDirectives=function(e){for(var t=[];this.peek(ee.AT);)t.push(this.parseDirective(e));return t},t.parseDirective=function(e){var t=this._lexer.token;return this.expectToken(ee.AT),{kind:Y.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e),loc:this.loc(t)}},t.parseTypeReference=function(){var e,t=this._lexer.token;return this.expectOptionalToken(ee.BRACKET_L)?(e=this.parseTypeReference(),this.expectToken(ee.BRACKET_R),e={kind:Y.LIST_TYPE,type:e,loc:this.loc(t)}):e=this.parseNamedType(),this.expectOptionalToken(ee.BANG)?{kind:Y.NON_NULL_TYPE,type:e,loc:this.loc(t)}:e},t.parseNamedType=function(){var e=this._lexer.token;return{kind:Y.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===ee.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(ee.STRING)||this.peek(ee.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(ee.BRACE_L,this.parseOperationTypeDefinition,ee.BRACE_R);return{kind:Y.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(ee.COLON);var n=this.parseNamedType();return{kind:Y.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:Y.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:Y.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(ee.AMP);do{t.push(this.parseNamedType())}while(this.expectOptionalToken(ee.AMP)||this.peek(ee.NAME));return t}return this.delimitedMany(ee.AMP,this.parseNamedType)},t.parseFieldsDefinition=function(){var e;return!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacySDLEmptyFields)&&this.peek(ee.BRACE_L)&&this._lexer.lookahead().kind===ee.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(ee.BRACE_L,this.parseFieldDefinition,ee.BRACE_R)},t.parseFieldDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(ee.COLON);var i=this.parseTypeReference(),o=this.parseDirectives(!0);return{kind:Y.FIELD_DEFINITION,description:t,name:n,arguments:r,type:i,directives:o,loc:this.loc(e)}},t.parseArgumentDefs=function(){return this.optionalMany(ee.PAREN_L,this.parseInputValueDef,ee.PAREN_R)},t.parseInputValueDef=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(ee.COLON);var r,i=this.parseTypeReference();this.expectOptionalToken(ee.EQUALS)&&(r=this.parseValueLiteral(!0));var o=this.parseDirectives(!0);return{kind:Y.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:Y.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:Y.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:i,loc:this.loc(e)}},t.parseUnionMemberTypes=function(){return this.expectOptionalToken(ee.EQUALS)?this.delimitedMany(ee.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:Y.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:i,loc:this.loc(e)}},t.parseEnumValuesDefinition=function(){return this.optionalMany(ee.BRACE_L,this.parseEnumValueDefinition,ee.BRACE_R)},t.parseEnumValueDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseDirectives(!0);return{kind:Y.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:Y.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:i,loc:this.loc(e)}},t.parseInputFieldsDefinition=function(){return this.optionalMany(ee.BRACE_L,this.parseInputValueDef,ee.BRACE_R)},t.parseTypeSystemExtension=function(){var e=this._lexer.lookahead();if(e.kind===ee.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(ee.BRACE_L,this.parseOperationTypeDefinition,ee.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return{kind:Y.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:Y.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:Y.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:Y.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:Y.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:Y.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:Y.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(ee.AT);var n=this.parseName(),r=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var o=this.parseDirectiveLocations();return{kind:Y.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:i,locations:o,loc:this.loc(e)}},t.parseDirectiveLocations=function(){return this.delimitedMany(ee.PIPE,this.parseDirectiveLocation)},t.parseDirectiveLocation=function(){var e=this._lexer.token,t=this.parseName();if(void 0!==ue[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 Z(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 W(this._lexer.source,t.start,"Expected ".concat(Oe(e),", found ").concat(Ae(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!==ee.NAME||t.value!==e)throw W(this._lexer.source,t.start,'Expected "'.concat(e,'", found ').concat(Ae(t),"."));this._lexer.advance()},t.expectOptionalKeyword=function(e){var t=this._lexer.token;return t.kind===ee.NAME&&t.value===e&&(this._lexer.advance(),!0)},t.unexpected=function(e){var t=null!=e?e:this._lexer.token;return W(this._lexer.source,t.start,"Unexpected ".concat(Ae(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 Ae(e){var t=e.value;return Oe(e.kind)+(null!=t?' "'.concat(t,'"'):"")}function Oe(e){return function(e){return e===ee.BANG||e===ee.DOLLAR||e===ee.AMP||e===ee.PAREN_L||e===ee.PAREN_R||e===ee.SPREAD||e===ee.COLON||e===ee.EQUALS||e===ee.AT||e===ee.BRACKET_L||e===ee.BRACKET_R||e===ee.BRACE_L||e===ee.PIPE||e===ee.BRACE_R}(e)?'"'.concat(e,'"'):e}var Ie={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"]},Te=Object.freeze({});function Ce(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 xe(e){return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ie,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(!X(u))throw new Error("Invalid AST Node: ".concat(ne(u),"."));var I=Ce(t,u.kind,p);if(I){if((O=I.call(t,u,c,l,f,d))===Te)break;if(!1===O){if(!p){f.pop();continue}}else if(void 0!==O&&(a.push([c,O]),!p)){if(!X(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:Pe})}var Pe={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return Ne(e.definitions,"\n\n")+"\n"},OperationDefinition:function(e){var t=e.operation,n=e.name,r=je("(",Ne(e.variableDefinitions,", "),")"),i=Ne(e.directives," "),o=e.selectionSet;return n||i||r||"query"!==t?Ne([t,Ne([n,r]),i,o]," "):o},VariableDefinition:function(e){var t=e.variable,n=e.type,r=e.defaultValue,i=e.directives;return t+": "+n+je(" = ",r)+je(" ",Ne(i," "))},SelectionSet:function(e){return Me(e.selections)},Field:function(e){var t=e.alias,n=e.name,r=e.arguments,i=e.directives,o=e.selectionSet,s=je("",t,": ")+n,a=s+je("(",Ne(r,", "),")");return a.length>80&&(a=s+je("(\n",Re(Ne(r,"\n")),"\n)")),Ne([a,Ne(i," "),o]," ")},Argument:function(e){return e.name+": "+e.value},FragmentSpread:function(e){return"..."+e.name+je(" ",Ne(e.directives," "))},InlineFragment:function(e){var t=e.typeCondition,n=e.directives,r=e.selectionSet;return Ne(["...",je("on ",t),Ne(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(je("(",Ne(r,", "),")")," ")+"on ".concat(n," ").concat(je("",Ne(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"["+Ne(e.values,", ")+"]"},ObjectValue:function(e){return"{"+Ne(e.fields,", ")+"}"},ObjectField:function(e){return e.name+": "+e.value},Directive:function(e){return"@"+e.name+je("(",Ne(e.arguments,", "),")")},NamedType:function(e){return e.name},ListType:function(e){return"["+e.type+"]"},NonNullType:function(e){return e.type+"!"},SchemaDefinition:ke((function(e){var t=e.directives,n=e.operationTypes;return Ne(["schema",Ne(t," "),Me(n)]," ")})),OperationTypeDefinition:function(e){return e.operation+": "+e.type},ScalarTypeDefinition:ke((function(e){return Ne(["scalar",e.name,Ne(e.directives," ")]," ")})),ObjectTypeDefinition:ke((function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return Ne(["type",t,je("implements ",Ne(n," & ")),Ne(r," "),Me(i)]," ")})),FieldDefinition:ke((function(e){var t=e.name,n=e.arguments,r=e.type,i=e.directives;return t+(Ue(n)?je("(\n",Re(Ne(n,"\n")),"\n)"):je("(",Ne(n,", "),")"))+": "+r+je(" ",Ne(i," "))})),InputValueDefinition:ke((function(e){var t=e.name,n=e.type,r=e.defaultValue,i=e.directives;return Ne([t+": "+n,je("= ",r),Ne(i," ")]," ")})),InterfaceTypeDefinition:ke((function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return Ne(["interface",t,je("implements ",Ne(n," & ")),Ne(r," "),Me(i)]," ")})),UnionTypeDefinition:ke((function(e){var t=e.name,n=e.directives,r=e.types;return Ne(["union",t,Ne(n," "),r&&0!==r.length?"= "+Ne(r," | "):""]," ")})),EnumTypeDefinition:ke((function(e){var t=e.name,n=e.directives,r=e.values;return Ne(["enum",t,Ne(n," "),Me(r)]," ")})),EnumValueDefinition:ke((function(e){return Ne([e.name,Ne(e.directives," ")]," ")})),InputObjectTypeDefinition:ke((function(e){var t=e.name,n=e.directives,r=e.fields;return Ne(["input",t,Ne(n," "),Me(r)]," ")})),DirectiveDefinition:ke((function(e){var t=e.name,n=e.arguments,r=e.repeatable,i=e.locations;return"directive @"+t+(Ue(n)?je("(\n",Re(Ne(n,"\n")),"\n)"):je("(",Ne(n,", "),")"))+(r?" repeatable":"")+" on "+Ne(i," | ")})),SchemaExtension:function(e){var t=e.directives,n=e.operationTypes;return Ne(["extend schema",Ne(t," "),Me(n)]," ")},ScalarTypeExtension:function(e){return Ne(["extend scalar",e.name,Ne(e.directives," ")]," ")},ObjectTypeExtension:function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return Ne(["extend type",t,je("implements ",Ne(n," & ")),Ne(r," "),Me(i)]," ")},InterfaceTypeExtension:function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return Ne(["extend interface",t,je("implements ",Ne(n," & ")),Ne(r," "),Me(i)]," ")},UnionTypeExtension:function(e){var t=e.name,n=e.directives,r=e.types;return Ne(["extend union",t,Ne(n," "),r&&0!==r.length?"= "+Ne(r," | "):""]," ")},EnumTypeExtension:function(e){var t=e.name,n=e.directives,r=e.values;return Ne(["extend enum",t,Ne(n," "),Me(r)]," ")},InputObjectTypeExtension:function(e){var t=e.name,n=e.directives,r=e.fields;return Ne(["extend input",t,Ne(n," "),Me(r)]," ")}};function ke(e){return function(t){return Ne([t.description,e(t)],"\n")}}function Ne(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 Me(e){return je("{\n",Re(Ne(e,"\n")),"\n}")}function je(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return null!=t&&""!==t?e+t+n:""}function Re(e){return je(" ",e.replace(/\n/g,"\n "))}function De(e){return-1!==e.indexOf("\n")}function Ue(e){return null!=e&&e.some(De)}var Fe=n(7),Le=n(33),Be=n(16),qe=n.n(Be),ze=n(15),Ke=n(21),He=function(){return(He=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)},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())}))},Ge=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])}}},We=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},Ye=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},Je=new o.a("GraphQLAPI"),$e=function(){function e(e){this._api=null,this.Auth=ze.a,this.Cache=i.a,this.Credentials=s.a,this._options=e,Je.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=We(t,["API"]),o=He(He({},i),r);return Je.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&&(Je.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 Je.debug("create Rest instance"),this._options?(this._api=new m(this._options),this._api.Credentials=this.Credentials,!0):Promise.reject("API not configured")},e.prototype._headerBasedAuth=function(e,t){return void 0===t&&(t={}),Ve(this,void 0,void 0,(function(){var n,r,o,s,a,u,c,l;return Ge(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(Ke.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(Ke.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,ze.a.currentAuthenticatedUser()];case 7:(c=f.sent())&&(a=c.token),f.label=8;case 8:if(!a)throw new Error(Ke.a.NO_FEDERATED_JWT);return s={Authorization:a},[3,10];case 9:throw f.sent(),new Error(Ke.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(Ke.a.NO_CURRENT_USER);case 14:return[3,17];case 15:if(!t.Authorization)throw new Error(Ke.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=_e(e).definitions;return Ye(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("string"==typeof n?n:xe(n)),u=Ye(a.definitions.filter((function(e){return"OperationDefinition"===e.kind})),1)[0],c=(void 0===u?{}:u).operation,l=t||{};switch(s&&(l.Authorization=s),c){case"query":case"mutation":var f=this._api.getCancellableToken(),d={cancellableToken:f},h=this._graphql({query:a,variables:i,authMode:o},l,d);return this._api.updateRequestToBeCancellable(h,f),h;case"subscription":return this._graphqlSubscribe({query:a,variables:i,authMode:o},l);default:throw new Error("invalid operation type: "+c)}},e.prototype._graphql=function(e,t,n){var r=e.query,i=e.variables,o=e.authMode;return void 0===t&&(t={}),void 0===n&&(n={}),Ve(this,void 0,void 0,(function(){var e,s,a,u,c,l,f,d,h,p,v,y,g,m,b,w,S,_,E,A,O;return Ge(this,(function(I){switch(I.label){case 0:return this._api?[3,2]:[4,this.createInstance()];case 1:I.sent(),I.label=2;case 2:return e=this._options,s=e.aws_appsync_region,a=e.aws_appsync_graphqlEndpoint,u=e.graphql_headers,c=void 0===u?function(){return{}}:u,l=e.graphql_endpoint,f=e.graphql_endpoint_iam_region,h=[{}],(p=!l)?[4,this._headerBasedAuth(o,t)]:[3,4];case 3:p=I.sent(),I.label=4;case 4:return v=[He.apply(void 0,h.concat([p]))],(y=l)?f?[4,this._headerBasedAuth(o,t)]:[3,6]:[3,8];case 5:return g=I.sent(),[3,7];case 6:g={Authorization:null},I.label=7;case 7:y=g,I.label=8;case 8:return m=[He.apply(void 0,v.concat([y]))],[4,c({query:r,variables:i})];case 9:if(d=He.apply(void 0,[He.apply(void 0,[He.apply(void 0,m.concat([I.sent()])),t]),!l&&(O={},O["x-amz-user-agent"]=Fe.a.userAgent,O)]),b={query:xe(r),variables:i},w=Object.assign({headers:d,body:b,signerServiceInfo:{service:l?"execute-api":"appsync",region:l?f:s}},n),!(S=l||a))throw{data:{},errors:[new V("No graphql endpoint provided.")]};I.label=10;case 10:return I.trys.push([10,12,,13]),[4,this._api.post(S,w)];case 11:return _=I.sent(),[3,13];case 12:if(E=I.sent(),this._api.isCancel(E))throw E;return _={data:{},errors:[new V(E.message,null,null,null,null,E)]},[3,13];case 13:if((A=_.errors)&&A.length)throw _;return[2,_]}}))}))},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:Le.a,appSyncGraphqlEndpoint:u,authenticationType:h,apiKey:l,query:xe(n),region:a,variables:r,graphql_headers:d,additionalHeaders:t,authToken:o});throw Je.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 Je.debug("set credentials for api",n),!0})).catch((function(e){return Je.warn("ensure credentials error",e),!1}))},e}(),Ze=new $e(null);b.a.register(Ze);var Qe=function(){return(Qe=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)},Xe=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())}))},et=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])}}},tt=new o.a("API"),nt=new(function(){function e(e){this.Auth=r.a,this.Cache=i.a,this.Credentials=s.a,this._options=e,this._restApi=new O(e),this._graphqlApi=new $e(e),tt.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 Qe(Qe({},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 Xe(this,void 0,void 0,(function(){return et(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);b.a.register(nt);t.a=nt},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";var r=n(17),i={keyPrefix:"aws-amplify-cache",capacityInBytes:1048576,itemMaxSize:21e4,defaultTTL:2592e5,defaultPriority:5,warningThreshold:.8,storage:(new(n(31).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(22));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";n.d(t,"b",(function(){return y})),n.d(t,"a",(function(){return g}));var r=n(22),i=n(14),o=n(157),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=new r.a("CognitoCredentials"),c=new Promise((function(e,t){return Object(i.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 s(this,void 0,void 0,(function(){return a(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(i.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 o.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 o.a("Failed to reload google auth response"))}))):n(new o.a("User is not signed in with Google"))})).catch((function(e){u.debug("Failed to refresh google token",e),n(new o.a("Failed to refresh google token"))}))})):(u.debug("no gapi auth2 available"),Promise.reject("no gapi auth2 available"))},e}(),f=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())}))},d=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])}}},h=new r.a("CognitoCredentials"),p=new Promise((function(e,t){return Object(i.b)().isBrowser?window.FB?(h.debug("FB SDK already loaded"),e()):void setTimeout((function(){return e()}),2e3):(h.debug("not in the browser, directly resolved"),e())})),v=function(){function e(){this.initialized=!1,this.refreshFacebookToken=this.refreshFacebookToken.bind(this),this._refreshFacebookTokenImpl=this._refreshFacebookTokenImpl.bind(this)}return e.prototype.refreshFacebookToken=function(){return f(this,void 0,void 0,(function(){return d(this,(function(e){switch(e.label){case 0:return this.initialized?[3,2]:(h.debug("need to wait for the Facebook SDK loaded"),[4,p]);case 1:e.sent(),this.initialized=!0,h.debug("finish waiting"),e.label=2;case 2:return[2,this._refreshFacebookTokenImpl()]}}))}))},e.prototype._refreshFacebookTokenImpl=function(){var e=null;if(Object(i.b)().isBrowser&&(e=window.FB),!e){return h.debug("no fb sdk available"),Promise.reject(new o.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,s=1e3*r.expiresIn+(new Date).getTime();if(!i){a="the jwtToken is undefined";h.debug(a),n(new o.a(a))}t({token:i,expires_at:s})}else{var a="no response from facebook when refreshing the jwt token";h.debug(a),n(new o.a(a))}}),{scope:"public_profile,email"})}))},e}(),y=new l,g=new v},function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return l})),n.d(t,"c",(function(){return f}));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={BadRecord:function(e){return/^Cannot return \w+ for [\w-_]+ type/.test(e.message)},ConfigError:function(){return!1},Transient:function(){return!1},Unauthorized:function(){return!1}},a={BadRecord:function(){return!1},ConfigError:function(){return!1},Transient:function(){return!1},Unauthorized:function(e){var t=e.error,n=r((void 0===t?{errors:[]}:t).errors,1)[0],i=(void 0===n?{}:n).message;return/Connection failed.+Unauthorized/.test(void 0===i?"":i)}},u={BadRecord:function(e){return/^Cannot return \w+ for [\w-_]+ type/.test(e.message)},ConfigError:function(){return!1},Transient:function(){return!1},Unauthorized:function(){return!1}};function c(e){return d(s,e)}function l(e){return d(a,e)}function f(e){return d(u,e)}function d(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(41),n(97),r.HmacSHA256)},function(e,t,n){"use strict";
|
|
51
51
|
/*!
|
|
52
52
|
* cookie
|
|
53
53
|
* Copyright(c) 2012-2014 Roman Shtylman
|
|
@@ -62,5 +62,5 @@ var oe=function(){function e(e,t){var n=e||{},r=n.UserPoolId,i=n.ClientId,o=n.en
|
|
|
62
62
|
* Released under the MIT license
|
|
63
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){"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){e.exports=n(127)},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r="undefined"!=typeof Symbol&&"function"==typeof Symbol.for,i=(r&&Symbol.for("INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER"),r?Symbol.for("INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER"):"@@INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER")},function(e,t,n){var r=n(90),i=n(91),o=i;o.v1=r,o.v4=i,e.exports=o},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(22),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){"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,"locateWindow",(function(){return i}));var r={};function i(){return"undefined"!=typeof window?window:"undefined"!=typeof self?self:r}},function(e,t,n){"use strict";(function(t){var r=n(13),i=n(132),o=n(64),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(65)),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,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}};c.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(50))},function(e,t,n){"use strict";n.d(t,"a",(function(){return qi}));var r=n(22),i=n(31),o=n(14),s=n(24),a=n(157),u=n(19),c=n(17),l=n(0),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)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function d(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}f(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}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)};function p(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 v(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 y(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 g,m,b,w,S,_,E,A,O,I,T,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;Object.create;!function(e){e.AUTHENTICATED_ROLE="AuthenticatedRole",e.DENY="Deny"}(g||(g={})),(m||(m={})).filterSensitiveLog=function(e){return h({},e)},(b||(b={})).filterSensitiveLog=function(e){return h({},e)},(w||(w={})).filterSensitiveLog=function(e){return h({},e)},(S||(S={})).filterSensitiveLog=function(e){return h({},e)},(_||(_={})).filterSensitiveLog=function(e){return h({},e)},(E||(E={})).filterSensitiveLog=function(e){return h({},e)},(A||(A={})).filterSensitiveLog=function(e){return h({},e)},(O||(O={})).filterSensitiveLog=function(e){return h({},e)},(I||(I={})).filterSensitiveLog=function(e){return h({},e)},(T||(T={})).filterSensitiveLog=function(e){return h({},e)},function(e){e.ACCESS_DENIED="AccessDenied",e.INTERNAL_SERVER_ERROR="InternalServerError"}(C||(C={})),(x||(x={})).filterSensitiveLog=function(e){return h({},e)},(P||(P={})).filterSensitiveLog=function(e){return h({},e)},(k||(k={})).filterSensitiveLog=function(e){return h({},e)},(N||(N={})).filterSensitiveLog=function(e){return h({},e)},(M||(M={})).filterSensitiveLog=function(e){return h({},e)},(j||(j={})).filterSensitiveLog=function(e){return h({},e)},(R||(R={})).filterSensitiveLog=function(e){return h({},e)},(D||(D={})).filterSensitiveLog=function(e){return h({},e)},(U||(U={})).filterSensitiveLog=function(e){return h({},e)},(F||(F={})).filterSensitiveLog=function(e){return h({},e)},(L||(L={})).filterSensitiveLog=function(e){return h({},e)},(B||(B={})).filterSensitiveLog=function(e){return h({},e)},(q||(q={})).filterSensitiveLog=function(e){return h({},e)},(z||(z={})).filterSensitiveLog=function(e){return h({},e)},(K||(K={})).filterSensitiveLog=function(e){return h({},e)},function(e){e.CONTAINS="Contains",e.EQUALS="Equals",e.NOT_EQUAL="NotEqual",e.STARTS_WITH="StartsWith"}(H||(H={})),(V||(V={})).filterSensitiveLog=function(e){return h({},e)},(G||(G={})).filterSensitiveLog=function(e){return h({},e)},function(e){e.RULES="Rules",e.TOKEN="Token"}(W||(W={})),(Y||(Y={})).filterSensitiveLog=function(e){return h({},e)},(J||(J={})).filterSensitiveLog=function(e){return h({},e)},($||($={})).filterSensitiveLog=function(e){return h({},e)},(Z||(Z={})).filterSensitiveLog=function(e){return h({},e)},(Q||(Q={})).filterSensitiveLog=function(e){return h({},e)},(X||(X={})).filterSensitiveLog=function(e){return h({},e)},(ee||(ee={})).filterSensitiveLog=function(e){return h({},e)},(te||(te={})).filterSensitiveLog=function(e){return h({},e)},(ne||(ne={})).filterSensitiveLog=function(e){return h({},e)},(re||(re={})).filterSensitiveLog=function(e){return h({},e)},(ie||(ie={})).filterSensitiveLog=function(e){return h({},e)},(oe||(oe={})).filterSensitiveLog=function(e){return h({},e)},(se||(se={})).filterSensitiveLog=function(e){return h({},e)},(ae||(ae={})).filterSensitiveLog=function(e){return h({},e)},(ue||(ue={})).filterSensitiveLog=function(e){return h({},e)},(ce||(ce={})).filterSensitiveLog=function(e){return h({},e)},(le||(le={})).filterSensitiveLog=function(e){return h({},e)},(fe||(fe={})).filterSensitiveLog=function(e){return h({},e)},(de||(de={})).filterSensitiveLog=function(e){return h({},e)},(he||(he={})).filterSensitiveLog=function(e){return h({},e)},(pe||(pe={})).filterSensitiveLog=function(e){return h({},e)},(ve||(ve={})).filterSensitiveLog=function(e){return h({},e)},(ye||(ye={})).filterSensitiveLog=function(e){return h({},e)},(ge||(ge={})).filterSensitiveLog=function(e){return h({},e)},(me||(me={})).filterSensitiveLog=function(e){return h({},e)},(be||(be={})).filterSensitiveLog=function(e){return h({},e)};var we=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}(),Se=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(l.__assign)(Object(l.__assign)({},this),{headers:Object(l.__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(l.__assign)(Object(l.__assign)({},e),((r={})[n]=Array.isArray(i)?Object(l.__spread)(i):i,r))}),{}))),n},e}();var _e=function(e,t){return p(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,p,y,g,m;return v(this,(function(v){switch(v.label){case 0:return r=[h({},e)],m={},[4,Ze(e.body,t)];case 1:switch(n=h.apply(void 0,r.concat([(m.body=v.sent(),m)])),o="UnknownError",o=Qe(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,Ae(n,t)];case 3:return i=h.apply(void 0,[h.apply(void 0,s.concat([v.sent()])),{name:o,$metadata:Ye(e)}]),[3,19];case 4:return a=[{}],[4,Oe(n,t)];case 5:return i=h.apply(void 0,[h.apply(void 0,a.concat([v.sent()])),{name:o,$metadata:Ye(e)}]),[3,19];case 6:return u=[{}],[4,Ie(n,t)];case 7:return i=h.apply(void 0,[h.apply(void 0,u.concat([v.sent()])),{name:o,$metadata:Ye(e)}]),[3,19];case 8:return c=[{}],[4,Te(n,t)];case 9:return i=h.apply(void 0,[h.apply(void 0,c.concat([v.sent()])),{name:o,$metadata:Ye(e)}]),[3,19];case 10:return l=[{}],[4,xe(n,t)];case 11:return i=h.apply(void 0,[h.apply(void 0,l.concat([v.sent()])),{name:o,$metadata:Ye(e)}]),[3,19];case 12:return f=[{}],[4,Pe(n,t)];case 13:return i=h.apply(void 0,[h.apply(void 0,f.concat([v.sent()])),{name:o,$metadata:Ye(e)}]),[3,19];case 14:return d=[{}],[4,ke(n,t)];case 15:return i=h.apply(void 0,[h.apply(void 0,d.concat([v.sent()])),{name:o,$metadata:Ye(e)}]),[3,19];case 16:return p=[{}],[4,Ne(n,t)];case 17:return i=h.apply(void 0,[h.apply(void 0,p.concat([v.sent()])),{name:o,$metadata:Ye(e)}]),[3,19];case 18:y=n.body,o=y.code||y.Code||o,i=h(h({},y),{name:""+o,message:y.message||y.Message||o,$fault:"client",$metadata:Ye(e)}),v.label=19;case 19:return g=i.message||i.Message||o,i.message=g,delete i.Message,[2,Promise.reject(Object.assign(new Error(g),i))]}}))}))},Ee=function(e,t){return p(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,p,y,g,m;return v(this,(function(v){switch(v.label){case 0:return r=[h({},e)],m={},[4,Ze(e.body,t)];case 1:switch(n=h.apply(void 0,r.concat([(m.body=v.sent(),m)])),o="UnknownError",o=Qe(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,Ae(n,t)];case 3:return i=h.apply(void 0,[h.apply(void 0,s.concat([v.sent()])),{name:o,$metadata:Ye(e)}]),[3,19];case 4:return a=[{}],[4,Oe(n,t)];case 5:return i=h.apply(void 0,[h.apply(void 0,a.concat([v.sent()])),{name:o,$metadata:Ye(e)}]),[3,19];case 6:return u=[{}],[4,Te(n,t)];case 7:return i=h.apply(void 0,[h.apply(void 0,u.concat([v.sent()])),{name:o,$metadata:Ye(e)}]),[3,19];case 8:return c=[{}],[4,Ce(n,t)];case 9:return i=h.apply(void 0,[h.apply(void 0,c.concat([v.sent()])),{name:o,$metadata:Ye(e)}]),[3,19];case 10:return l=[{}],[4,xe(n,t)];case 11:return i=h.apply(void 0,[h.apply(void 0,l.concat([v.sent()])),{name:o,$metadata:Ye(e)}]),[3,19];case 12:return f=[{}],[4,Pe(n,t)];case 13:return i=h.apply(void 0,[h.apply(void 0,f.concat([v.sent()])),{name:o,$metadata:Ye(e)}]),[3,19];case 14:return d=[{}],[4,ke(n,t)];case 15:return i=h.apply(void 0,[h.apply(void 0,d.concat([v.sent()])),{name:o,$metadata:Ye(e)}]),[3,19];case 16:return p=[{}],[4,Ne(n,t)];case 17:return i=h.apply(void 0,[h.apply(void 0,p.concat([v.sent()])),{name:o,$metadata:Ye(e)}]),[3,19];case 18:y=n.body,o=y.code||y.Code||o,i=h(h({},y),{name:""+o,message:y.message||y.Message||o,$fault:"client",$metadata:Ye(e)}),v.label=19;case 19:return g=i.message||i.Message||o,i.message=g,delete i.Message,[2,Promise.reject(Object.assign(new Error(g),i))]}}))}))},Ae=function(e,t){return p(void 0,void 0,void 0,(function(){var n,r;return v(this,(function(i){return n=e.body,r=Ue(n,t),[2,h({name:"ExternalServiceException",$fault:"client",$metadata:Ye(e)},r)]}))}))},Oe=function(e,t){return p(void 0,void 0,void 0,(function(){var n,r;return v(this,(function(i){return n=e.body,r=Be(n,t),[2,h({name:"InternalErrorException",$fault:"server",$metadata:Ye(e)},r)]}))}))},Ie=function(e,t){return p(void 0,void 0,void 0,(function(){var n,r;return v(this,(function(i){return n=e.body,r=qe(n,t),[2,h({name:"InvalidIdentityPoolConfigurationException",$fault:"client",$metadata:Ye(e)},r)]}))}))},Te=function(e,t){return p(void 0,void 0,void 0,(function(){var n,r;return v(this,(function(i){return n=e.body,r=ze(n,t),[2,h({name:"InvalidParameterException",$fault:"client",$metadata:Ye(e)},r)]}))}))},Ce=function(e,t){return p(void 0,void 0,void 0,(function(){var n,r;return v(this,(function(i){return n=e.body,r=Ke(n,t),[2,h({name:"LimitExceededException",$fault:"client",$metadata:Ye(e)},r)]}))}))},xe=function(e,t){return p(void 0,void 0,void 0,(function(){var n,r;return v(this,(function(i){return n=e.body,r=He(n,t),[2,h({name:"NotAuthorizedException",$fault:"client",$metadata:Ye(e)},r)]}))}))},Pe=function(e,t){return p(void 0,void 0,void 0,(function(){var n,r;return v(this,(function(i){return n=e.body,r=Ve(n,t),[2,h({name:"ResourceConflictException",$fault:"client",$metadata:Ye(e)},r)]}))}))},ke=function(e,t){return p(void 0,void 0,void 0,(function(){var n,r;return v(this,(function(i){return n=e.body,r=Ge(n,t),[2,h({name:"ResourceNotFoundException",$fault:"client",$metadata:Ye(e)},r)]}))}))},Ne=function(e,t){return p(void 0,void 0,void 0,(function(){var n,r;return v(this,(function(i){return n=e.body,r=We(n,t),[2,h({name:"TooManyRequestsException",$fault:"client",$metadata:Ye(e)},r)]}))}))},Me=function(e,t){return h(h(h({},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:Re(e.Logins,t)})},je=function(e,t){return h(h(h({},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:Re(e.Logins,t)})},Re=function(e,t){return Object.entries(e).reduce((function(e,t){var n,r=y(t,2),i=r[0],o=r[1];return null===o?e:h(h({},e),((n={})[i]=o,n))}),{})},De=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}},Ue=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Fe=function(e,t){return{Credentials:void 0!==e.Credentials&&null!==e.Credentials?De(e.Credentials):void 0,IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},Le=function(e,t){return{IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},Be=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}},Ke=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},He=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ve=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ge=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},We=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ye=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"]}},Je=function(e,t){return void 0===e&&(e=new Uint8Array),e instanceof Uint8Array?Promise.resolve(e):t.streamCollector(e)||Promise.resolve(new Uint8Array)},$e=function(e,t,n,r,i){return p(void 0,void 0,void 0,(function(){var o,s,a,u,c,l;return v(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 Se(l)]}}))}))},Ze=function(e,t){return function(e,t){return Je(e,t).then((function(e){return t.utf8Encoder(e)}))}(e,t).then((function(e){return e.length?JSON.parse(e):{}}))},Qe=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):""},Xe={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},et={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function tt(e,t,n){return{applyToStack:function(r){r.add(function(e,t){return function(n,r){return function(r){return Object(l.__awaiter)(void 0,void 0,void 0,(function(){var i,o;return Object(l.__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),Xe),r.add(function(e,t){return function(n,r){return function(r){return Object(l.__awaiter)(void 0,void 0,void 0,(function(){var i;return Object(l.__generator)(this,(function(o){switch(o.label){case 0:return[4,t(r.input,e)];case 1:return i=o.sent(),[2,n(Object(l.__assign)(Object(l.__assign)({},r),{request:i}))]}}))}))}}}(e,t),et)}}}var nt=function(){var e=[],t=[],n=new Set,r=function(n){return e.forEach((function(e){n.add(e.middleware,Object(l.__assign)({},e))})),t.forEach((function(e){n.addRelativeTo(e.middleware,Object(l.__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(l.__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(l.__spread)(i(e)))})),t},o=function(){var n,r=[],o=[],s={};return e.forEach((function(e){var t=Object(l.__assign)(Object(l.__assign)({},e),{before:[],after:[]});t.name&&(s[t.name]=t),r.push(t)})),t.forEach((function(e){var t=Object(l.__assign)(Object(l.__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 rt[t.step]-rt[e.step]||it[t.priority||"normal"]-it[e.priority||"normal"]}))).map(i).reduce((function(e,t){return e.push.apply(e,Object(l.__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(l.__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(l.__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(nt())},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(nt());return t.use(e),t},applyToStack:r,resolve:function(e,t){var n,r;try{for(var i=Object(l.__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},rt={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},it={high:3,normal:2,low:1},ot=function(){function e(e){this.middlewareStack=nt(),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}(),st=function(){this.middlewareStack=nt()};var at=function(){var e=Object.getPrototypeOf(this).constructor,t=Function.bind.apply(String,Object(l.__spread)([null],arguments)),n=new t;return Object.setPrototypeOf(n,e.prototype),n};at.prototype=Object.create(String.prototype,{constructor:{value:at,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf(at,String);!function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Object(l.__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))}}(at);var ut=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return d(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(tt(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetCredentialsForIdentityCommand",inputFilterSensitiveLog:U.filterSensitiveLog,outputFilterSensitiveLog:L.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 p(void 0,void 0,void 0,(function(){var n,r;return v(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetCredentialsForIdentity"},r=JSON.stringify(Me(e,t)),[2,$e(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return p(void 0,void 0,void 0,(function(){var n,r,i;return v(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,_e(e,t)]:[4,Ze(e.body,t)];case 1:return n=o.sent(),{},r=Fe(n,t),i=h({$metadata:Ye(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(st),ct=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(l.__extends)(t,e),t}(Error);function lt(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(l.__read)(t,2),r=n[0],i=n[1];return e[r]=i,e}),{})}))}function ft(e){var t=this;return function(){return Object(l.__awaiter)(t,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,f,d,h,p;return Object(l.__generator)(this,(function(l){switch(l.label){case 0:return f=(c=e.client).send,d=ut.bind,p={CustomRoleArn:e.customRoleArn,IdentityId:e.identityId},e.logins?[4,lt(e.logins)]:[3,2];case 1:return h=l.sent(),[3,3];case 2:h=void 0,l.label=3;case 3:return[4,f.apply(c,[new(d.apply(ut,[void 0,(p.Logins=h,p)]))])];case 4:return t=l.sent().Credentials,n=void 0===t?function(){throw new ct("Response from Amazon Cognito contained no credentials")}():t,r=n.AccessKeyId,i=void 0===r?function(){throw new ct("Response from Amazon Cognito contained no access key ID")}():r,o=n.Expiration,s=n.SecretKey,a=void 0===s?function(){throw new ct("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 dt=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return d(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(tt(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetIdCommand",inputFilterSensitiveLog:q.filterSensitiveLog,outputFilterSensitiveLog:z.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 p(void 0,void 0,void 0,(function(){var n,r;return v(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetId"},r=JSON.stringify(je(e,t)),[2,$e(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return p(void 0,void 0,void 0,(function(){var n,r,i;return v(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,Ee(e,t)]:[4,Ze(e.body,t)];case 1:return n=o.sent(),{},r=Le(n,t),i=h({$metadata:Ye(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(st),ht=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}(),pt=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 vt(e){var t=this,n=e.accountId,r=e.cache,i=void 0===r?"object"==typeof self&&self.indexedDB?new ht:"object"==typeof window&&window.localStorage?window.localStorage:pt:r,o=e.client,s=e.customRoleArn,a=e.identityPoolId,u=e.logins,c=e.userIdentifier,f=void 0===c?u&&0!==Object.keys(u).length?void 0:"ANONYMOUS":c,d=f?"aws:cognito-identity-credentials:"+a+":"+f:void 0,h=function(){return Object(l.__awaiter)(t,void 0,void 0,(function(){var e,t,r,c,f,p,v,y,g;return Object(l.__generator)(this,(function(l){switch(l.label){case 0:return(t=d)?[4,i.getItem(d)]:[3,2];case 1:t=l.sent(),l.label=2;case 2:return(e=t)?[3,7]:(p=(f=o).send,v=dt.bind,g={AccountId:n,IdentityPoolId:a},u?[4,lt(u)]:[3,4]);case 3:return y=l.sent(),[3,5];case 4:y=void 0,l.label=5;case 5:return[4,p.apply(f,[new(v.apply(dt,[void 0,(g.Logins=y,g)]))])];case 6:r=l.sent().IdentityId,c=void 0===r?function(){throw new ct("Response from Amazon Cognito contained no identity ID")}():r,e=c,d&&Promise.resolve(i.setItem(d,e)).catch((function(){})),l.label=7;case 7:return[2,(h=ft({client:o,customRoleArn:s,logins:u,identityId:e}))()]}}))}))};return function(){return h().catch((function(e){return Object(l.__awaiter)(t,void 0,void 0,(function(){return Object(l.__generator)(this,(function(t){throw d&&Promise.resolve(i.removeItem(d)).catch((function(){})),e}))}))}))}}var yt=function(e,t){return(yt=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 gt(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}yt(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}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)};function bt(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 wt(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 St(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 _t=n(78),Et=n(76),At=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,Ot)},Ot=function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()};for(var It=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(l.__values)(Object.keys(e).sort()),o=i.next();!o.done;o=i.next()){var s=o.value,a=e[s];if(s=At(s),Array.isArray(a))for(var u=0,c=a.length;u<c;u++)r.push(s+"="+At(a[u]));else{var f=s;(a||"string"==typeof a)&&(f+="="+At(a)),r.push(f)}}}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,f={body:"GET"===u||"HEAD"===u?void 0:e.body,headers:new Headers(e.headers),method:u};"undefined"!=typeof AbortController&&(f.signal=n);var d,h=new Request(c,f),p=[fetch(h).then((function(e){var t,n,r=e.headers,i={};try{for(var o=Object(l.__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 we({headers:i,statusCode:e.status,body:e.body})}:e.blob().then((function(t){return{response:new we({headers:i,statusCode:e.status,body:t})}}))})),(d=r,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}(),Tt={},Ct=new Array(64),xt=0,Pt="A".charCodeAt(0),kt="Z".charCodeAt(0);xt+Pt<=kt;xt++){var Nt=String.fromCharCode(xt+Pt);Tt[Nt]=xt,Ct[xt]=Nt}for(xt=0,Pt="a".charCodeAt(0),kt="z".charCodeAt(0);xt+Pt<=kt;xt++){Nt=String.fromCharCode(xt+Pt);var Mt=xt+26;Tt[Nt]=Mt,Ct[Mt]=Nt}for(xt=0;xt<10;xt++){Tt[xt.toString(10)]=xt+52;Nt=xt.toString(10),Mt=xt+52;Tt[Nt]=Mt,Ct[Mt]=Nt}Tt["+"]=62,Ct[62]="+",Tt["/"]=63,Ct[63]="/";function jt(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|=Tt[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 Rt(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 Dt={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},Ut=function(e){return{applyToStack:function(t){t.add(function(e){return function(t,n){return function(r){return Object(l.__awaiter)(void 0,void 0,void 0,(function(){var i;return Object(l.__generator)(this,(function(o){return(null===(i=null==e?void 0:e.retryStrategy)||void 0===i?void 0:i.mode)&&(n.userAgent=Object(l.__spread)(n.userAgent||[],[["cfg/retry-mode",e.retryStrategy.mode]])),[2,e.retryStrategy.retry(t,r)]}))}))}}}(e),Dt)}}},Ft=["AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch"],Lt=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],Bt=["AbortError","TimeoutError","RequestTimeout","RequestTimeoutException"],qt=[500,502,503,504],zt=function(e){var t,n;return 429===(null===(t=e.$metadata)||void 0===t?void 0:t.httpStatusCode)||Lt.includes(e.name)||1==(null===(n=e.$retryable)||void 0===n?void 0:n.throttling)},Kt=n(75),Ht=function(e,t){return Math.floor(Math.min(2e4,Math.random()*Math.pow(2,t)*e))},Vt=function(e){return!!e&&(function(e){return void 0!==e.$retryable}(e)||function(e){return Ft.includes(e.name)}(e)||zt(e)||function(e){var t;return Bt.includes(e.name)||qt.includes((null===(t=e.$metadata)||void 0===t?void 0:t.httpStatusCode)||0)}(e))},Gt=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:Vt,this.delayDecider=null!==(r=null==t?void 0:t.delayDecider)&&void 0!==r?r:Ht,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(l.__awaiter)(this,void 0,void 0,(function(){var e;return Object(l.__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(l.__awaiter)(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c;return Object(l.__generator)(this,(function(f){switch(f.label){case 0:return r=0,i=0,[4,this.getMaxAttempts()];case 1:o=f.sent(),s=t.request,Se.isInstance(s)&&(s.headers["amz-sdk-invocation-id"]=Object(Kt.v4)()),a=function(){var a,c,f,d,h;return Object(l.__generator)(this,(function(l){switch(l.label){case 0:return l.trys.push([0,2,,5]),Se.isInstance(s)&&(s.headers["amz-sdk-request"]="attempt="+(r+1)+"; max="+o),[4,e(t)];case 1:return a=l.sent(),c=a.response,f=a.output,u.retryQuota.releaseRetryTokens(n),f.$metadata.attempts=r+1,f.$metadata.totalRetryDelay=i,[2,{value:{response:c,output:f}}];case 2:return d=l.sent(),r++,u.shouldRetry(d,r,o)?(n=u.retryQuota.retrieveRetryTokens(d),h=u.delayDecider(zt(d)?500:100,r),i+=h,[4,new Promise((function(e){return setTimeout(e,h)}))]):[3,4];case 3:return l.sent(),[2,"continue"];case 4:throw d.$metadata||(d.$metadata={}),d.$metadata.attempts=r,d.$metadata.totalRetryDelay=i,d;case 5:return[2]}}))},u=this,f.label=2;case 2:return[5,a()];case 3:return"object"==typeof(c=f.sent())?[2,c.value]:[3,2];case 4:return[2]}}))}))},e}(),Wt=function(e){if(void 0===e&&(e=3),"number"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};var Yt=n(77),Jt=n.n(Yt),$t=n(36),Zt="cognito-identity.{region}.amazonaws.com",Qt=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"]),Xt=new Set(["cn-north-1","cn-northwest-1"]),en=new Set(["us-iso-east-1"]),tn=new Set(["us-isob-east-1"]),nn=new Set(["us-gov-east-1","us-gov-west-1"]);var rn,on,sn,an,un={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:Qt.has(e)&&(n={hostname:Zt.replace("{region}",e),partition:"aws"}),Xt.has(e)&&(n={hostname:"cognito-identity.{region}.amazonaws.com.cn".replace("{region}",e),partition:"aws-cn"}),en.has(e)&&(n={hostname:"cognito-identity.{region}.c2s.ic.gov".replace("{region}",e),partition:"aws-iso"}),tn.has(e)&&(n={hostname:"cognito-identity.{region}.sc2s.sgov.gov".replace("{region}",e),partition:"aws-iso-b"}),nn.has(e)&&(n={hostname:"cognito-identity.{region}.amazonaws.com".replace("{region}",e),partition:"aws-us-gov"}),void 0===n&&(n={hostname:Zt.replace("{region}",e),partition:"aws"})}return Promise.resolve(mt({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(l.__values)(e.split("&")),o=i.next();!o.done;o=i.next()){var s=o.value,a=Object(l.__read)(s.split("="),2),u=a[0],c=a[1],f=void 0===c?null:c;u=decodeURIComponent(u),f&&(f=decodeURIComponent(f)),u in r?Array.isArray(r[u])?r[u].push(f):r[u]=[r[u],f]:r[u]=f}}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}}},cn=mt(mt({},un),{runtime:"browser",base64Decoder:jt,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+=Ct[(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:(on={serviceId:un.serviceId,clientVersion:_t.version},sn=on.serviceId,an=on.clientVersion,function(){return Object(l.__awaiter)(void 0,void 0,void 0,(function(){var e,t,n,r,i,o,s,a,u;return Object(l.__generator)(this,(function(c){return e=(null===(n=null===window||void 0===window?void 0:window.navigator)||void 0===n?void 0:n.userAgent)?Jt.a.parse(window.navigator.userAgent):void 0,t=[["aws-sdk-js",an],["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")]],sn&&t.push(["api/"+sn,an]),[2,t]}))}))}),maxAttempts:3,region:(rn="Region is missing",function(){return Promise.reject(rn)}),requestHandler:new It,sha256:Et.Sha256,streamCollector:function(e){return"function"==typeof Blob&&e instanceof Blob?function(e){return Object(l.__awaiter)(this,void 0,void 0,(function(){var t,n;return Object(l.__generator)(this,(function(r){switch(r.label){case 0:return[4,Rt(e)];case 1:return t=r.sent(),n=jt(t),[2,new Uint8Array(n)]}}))}))}(e):function(e){return Object(l.__awaiter)(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return Object(l.__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:$t.fromUtf8,utf8Encoder:$t.toUtf8}),ln=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},fn=function(e){return Object(l.__awaiter)(void 0,void 0,void 0,(function(){var t,n,r,i,o;return Object(l.__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)]}}))}))},dn=function(e){if("string"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};var hn={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},pn=function(e){return{applyToStack:function(t){t.add(function(e){var t=this;return function(n){return function(r){return Object(l.__awaiter)(t,void 0,void 0,(function(){var t,i,o,s,a;return Object(l.__generator)(this,(function(u){return t=r.request,Se.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(l.__assign)(Object(l.__assign)({},t.headers),((a={})["content-length"]=String(s),a)))),[2,n(Object(l.__assign)(Object(l.__assign)({},r),{request:t}))]}))}))}}}(e.bodyLengthChecker),hn)}}};for(var vn={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},yn=function(e){return{applyToStack:function(t){t.add(function(e){return function(t){return function(n){return Object(l.__awaiter)(void 0,void 0,void 0,(function(){var r,i;return Object(l.__generator)(this,(function(o){return Se.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),vn)}}},gn={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},mn=function(e){return{applyToStack:function(e){e.add((function(e,t){return function(n){return Object(l.__awaiter)(void 0,void 0,void 0,(function(){var r,i,o,s,a,u,c,f,d;return Object(l.__generator)(this,(function(h){switch(h.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=h.sent(),s?("function"==typeof s.info&&(c=u.output,f=c.$metadata,d=Object(l.__rest)(c,["$metadata"]),s.info({clientName:r,commandName:i,input:o(n.input),output:a(d),metadata:f})),[2,u]):[2,u]}}))}))}}),gn)}}},bn={},wn={},Sn=0;Sn<256;Sn++){var _n=Sn.toString(16).toLowerCase();1===_n.length&&(_n="0"+_n),bn[Sn]=_n,wn[_n]=Sn}function En(e){for(var t="",n=0;n<e.byteLength;n++)t+=bn[e[n]];return t}var An="X-Amz-Date".toLowerCase(),On=["authorization",An,"date"],In="X-Amz-Signature".toLowerCase(),Tn="X-Amz-Security-Token".toLowerCase(),Cn={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},xn=/^proxy-/,Pn=/^sec-/,kn="AWS4-HMAC-SHA256-PAYLOAD",Nn={},Mn=[];function jn(e,t,n){return e+"/"+t+"/"+n+"/aws4_request"}function Rn(e,t,n){var r=new e(t);return r.update(n),r.digest()}function Dn(e,t,n){var r,i,o=e.headers,s={};try{for(var a=Object(l.__values)(Object.keys(o).sort()),u=a.next();!u.done;u=a.next()){var c=u.value,f=c.toLowerCase();(f in Cn||(null==t?void 0:t.has(f))||xn.test(f)||Pn.test(f))&&(!n||n&&!n.has(f))||(s[f]=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 Un=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,Fn)},Fn=function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()};function Ln(e,t){var n=e.headers,r=e.body;return Object(l.__awaiter)(this,void 0,void 0,(function(){var e,i,o,s,a,u,c;return Object(l.__generator)(this,(function(f){switch(f.label){case 0:try{for(e=Object(l.__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)||(d=r,"function"==typeof ArrayBuffer&&d instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(d))?((s=new t).update(r),a=En,[4,s.digest()]):[3,3];case 2:return[2,a.apply(void 0,[f.sent()])];case 3:return[2,"UNSIGNED-PAYLOAD"]}var d}))}))}function Bn(e){var t=e.headers,n=e.query,r=Object(l.__rest)(e,["headers","query"]);return Object(l.__assign)(Object(l.__assign)({},r),{headers:Object(l.__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(l.__assign)(Object(l.__assign)({},t),((r={})[n]=Array.isArray(i)?Object(l.__spread)(i):i,r))}),{})}function zn(e){var t,n;e="function"==typeof e.clone?e.clone():Bn(e);try{for(var r=Object(l.__values)(Object.keys(e.headers)),i=r.next();!i.done;i=r.next()){var o=i.value;On.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 Kn(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 Hn=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=Wn(r),this.credentialProvider=Yn(n)}return e.prototype.presign=function(e,t){return void 0===t&&(t={}),Object(l.__awaiter)(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,f,d,h,p,v,y,g,m,b,w,S,_,E,A,O,I;return Object(l.__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,f=t.signingService,[4,this.credentialProvider()];case 1:return d=T.sent(),null==c?[3,2]:(p=c,[3,4]);case 2:return[4,this.regionProvider()];case 3:p=T.sent(),T.label=4;case 4:return h=p,v=Vn(r),y=v.longDate,g=v.shortDate,o>604800?[2,Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future")]:(m=jn(g,h,null!=f?f:this.service),b=function(e,t){var n,r,i;void 0===t&&(t={});var o="function"==typeof e.clone?e.clone():Bn(e),s=o.headers,a=o.query,u=void 0===a?{}:a;try{for(var c=Object(l.__values)(Object.keys(s)),f=c.next();!f.done;f=c.next()){var d=f.value,h=d.toLowerCase();"x-amz-"!==h.substr(0,6)||(null===(i=t.unhoistableHeaders)||void 0===i?void 0:i.has(h))||(u[d]=s[d],delete s[d])}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}return Object(l.__assign)(Object(l.__assign)({},e),{headers:s,query:u})}(zn(e),{unhoistableHeaders:a}),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"]=y,b.query["X-Amz-Expires"]=o.toString(10),w=Dn(b,s,u),b.query["X-Amz-SignedHeaders"]=Gn(w),S=b.query,_="X-Amz-Signature",E=this.getSignature,A=[y,m,this.getSigningKey(d,h,g,f)],O=this.createCanonicalRequest,I=[b,w],[4,Ln(e,this.sha256)]);case 5:return[4,E.apply(this,A.concat([O.apply(this,I.concat([T.sent()]))]))];case 6:return S[_]=T.sent(),[2,b]}}))}))},e.prototype.sign=function(e,t){return Object(l.__awaiter)(this,void 0,void 0,(function(){return Object(l.__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(l.__awaiter)(this,void 0,void 0,(function(){var e,t,i,c,f,d,h,p,v,y,g;return Object(l.__generator)(this,(function(l){switch(l.label){case 0:return null==a?[3,1]:(t=a,[3,3]);case 1:return[4,this.regionProvider()];case 2:t=l.sent(),l.label=3;case 3:return e=t,i=Vn(o),c=i.shortDate,f=i.longDate,d=jn(c,e,null!=u?u:this.service),[4,Ln({headers:{},body:r},this.sha256)];case 4:return h=l.sent(),(p=new this.sha256).update(n),y=En,[4,p.digest()];case 5:return v=y.apply(void 0,[l.sent()]),g=[kn,f,d,s,v,h].join("\n"),[2,this.signString(g,{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(l.__awaiter)(this,void 0,void 0,(function(){var t,n,r,a,u,c,f,d;return Object(l.__generator)(this,(function(l){switch(l.label){case 0:return[4,this.credentialProvider()];case 1:return t=l.sent(),null==o?[3,2]:(r=o,[3,4]);case 2:return[4,this.regionProvider()];case 3:r=l.sent(),l.label=4;case 4:return n=r,a=Vn(i).shortDate,f=(c=this.sha256).bind,[4,this.getSigningKey(t,n,a,s)];case 5:return(u=new(f.apply(c,[void 0,l.sent()]))).update(e),d=En,[4,u.digest()];case 6:return[2,d.apply(void 0,[l.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(l.__awaiter)(this,void 0,void 0,(function(){var t,n,r,c,f,d,h,p,v,y,g;return Object(l.__generator)(this,(function(m){switch(m.label){case 0:return[4,this.credentialProvider()];case 1:return t=m.sent(),null==a?[3,2]:(r=a,[3,4]);case 2:return[4,this.regionProvider()];case 3:r=m.sent(),m.label=4;case 4:return n=r,c=zn(e),f=Vn(i),d=f.longDate,h=f.shortDate,p=jn(h,n,null!=u?u:this.service),c.headers[An]=d,t.sessionToken&&(c.headers[Tn]=t.sessionToken),[4,Ln(c,this.sha256)];case 5:return v=m.sent(),!function(e,t){var n,r;e=e.toLowerCase();try{for(var i=Object(l.__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"]=v),y=Dn(c,s,o),[4,this.getSignature(d,p,this.getSigningKey(t,n,h,u),this.createCanonicalRequest(c,y,v))];case 6:return g=m.sent(),c.headers.authorization="AWS4-HMAC-SHA256 Credential="+t.accessKeyId+"/"+p+", SignedHeaders="+Gn(y)+", Signature="+g,[2,c]}}))}))},e.prototype.createCanonicalRequest=function(e,t,n){var r=Object.keys(t).sort();return e.method+"\n"+this.getCanonicalPath(e)+"\n"+function(e){var t,n,r=e.query,i=void 0===r?{}:r,o=[],s={},a=function(e){if(e.toLowerCase()===In)return"continue";o.push(e);var t=i[e];"string"==typeof t?s[e]=Un(e)+"="+Un(t):Array.isArray(t)&&(s[e]=t.slice(0).sort().reduce((function(t,n){return t.concat([Un(e)+"="+Un(n)])}),[]).join("&"))};try{for(var u=Object(l.__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(l.__awaiter)(this,void 0,void 0,(function(){var r,i;return Object(l.__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"+En(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(l.__awaiter)(this,void 0,void 0,(function(){var i,o,s,a,u;return Object(l.__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=En,[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(l.__awaiter)(void 0,void 0,void 0,(function(){var o,s,a,u,c,f,d,h,p;return Object(l.__generator)(this,(function(v){switch(v.label){case 0:return[4,Rn(e,t.secretAccessKey,t.accessKeyId)];case 1:if(o=v.sent(),(s=n+":"+r+":"+i+":"+En(o)+":"+t.sessionToken)in Nn)return[2,Nn[s]];for(Mn.push(s);Mn.length>50;)delete Nn[Mn.shift()];a="AWS4"+t.secretAccessKey,v.label=2;case 2:v.trys.push([2,7,8,9]),u=Object(l.__values)([n,r,i,"aws4_request"]),c=u.next(),v.label=3;case 3:return c.done?[3,6]:(f=c.value,[4,Rn(e,a,f)]);case 4:a=v.sent(),v.label=5;case 5:return c=u.next(),[3,3];case 6:return[3,9];case 7:return d=v.sent(),h={error:d},[3,9];case 8:try{c&&!c.done&&(p=u.return)&&p.call(u)}finally{if(h)throw h.error}return[7];case 9:return[2,Nn[s]=a]}}))}))}(this.sha256,e,n,t,r||this.service)},e}(),Vn=function(e){var t=Kn(e).replace(/[\-:]/g,"");return{longDate:t,shortDate:t.substr(0,8)}},Gn=function(e){return Object.keys(e).sort().join(";")},Wn=function(e){if("string"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e},Yn=function(e){if("object"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};function Jn(e){if("object"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e}var $n,Zn,Qn,Xn,er,tr,nr,rr,ir,or,sr,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=/[^\!\#\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,ei=function(e){var t=Object(l.__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(Xr,"_")})).join("/")},ti={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},ni=function(e){return{applyToStack:function(t){var n;t.add((n=e,function(e,t){return function(r){return Object(l.__awaiter)(void 0,void 0,void 0,(function(){var i,o,s,a,u,c,f,d;return Object(l.__generator)(this,(function(h){switch(h.label){case 0:return i=r.request,Se.isInstance(i)?(o=i.headers,s=(null===(f=null==t?void 0:t.userAgent)||void 0===f?void 0:f.map(ei))||[],[4,n.defaultUserAgentProvider()]):[2,e(r)];case 1:return a=h.sent().map(ei),u=(null===(d=null==n?void 0:n.customUserAgent)||void 0===d?void 0:d.map(ei))||[],o["x-amz-user-agent"]=Object(l.__spread)(a,s,u).join(" "),c=Object(l.__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(l.__assign)(Object(l.__assign)({},r),{request:i}))]}}))}))}}),ti)}}},ri=function(e){function t(t){var n,r,i=this,o=function(e){var t,n=this,r=Jn(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?Jn(e.signer):function(){return Jn(e.region)().then((function(t){return Object(l.__awaiter)(n,void 0,void 0,(function(){return Object(l.__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(l.__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 Hn({credentials:r,region:e.signingRegion,service:e.signingName,sha256:u,uriEscapePath:o})}))},Object(l.__assign)(Object(l.__assign)({},e),{systemClockOffset:a,signingEscapePath:o,credentials:r,signer:t})}(function(e){var t;return Object(l.__assign)(Object(l.__assign)({},e),{tls:null===(t=e.tls)||void 0===t||t,endpoint:e.endpoint?ln(e):function(){return fn(e)},isCustomEndpoint:!!e.endpoint})}(function(e){if(!e.region)throw new Error("Region is missing");return Object(l.__assign)(Object(l.__assign)({},e),{region:dn(e.region)})}(mt(mt({},cn),t)))),s=function(e){return Object(l.__assign)(Object(l.__assign)({},e),{customUserAgent:"string"==typeof e.customUserAgent?[[e.customUserAgent]]:e.customUserAgent})}((r=Wt((n=o).maxAttempts),Object(l.__assign)(Object(l.__assign)({},n),{maxAttempts:r,retryStrategy:n.retryStrategy||new Gt(r)})));return(i=e.call(this,s)||this).config=s,i.middlewareStack.use(Ut(i.config)),i.middlewareStack.use(pn(i.config)),i.middlewareStack.use(yn(i.config)),i.middlewareStack.use(mn(i.config)),i.middlewareStack.use(ni(i.config)),i}return gt(t,e),t.prototype.destroy=function(){e.prototype.destroy.call(this)},t}(ot);!function(e){e.AUTHENTICATED_ROLE="AuthenticatedRole",e.DENY="Deny"}($n||($n={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Zn||(Zn={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Qn||(Qn={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Xn||(Xn={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(er||(er={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(tr||(tr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(nr||(nr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(rr||(rr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(ir||(ir={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(or||(or={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(sr||(sr={})),function(e){e.ACCESS_DENIED="AccessDenied",e.INTERNAL_SERVER_ERROR="InternalServerError"}(ar||(ar={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(ur||(ur={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(cr||(cr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(lr||(lr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(fr||(fr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(dr||(dr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(hr||(hr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(pr||(pr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(vr||(vr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(yr||(yr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(gr||(gr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(mr||(mr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(br||(br={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(wr||(wr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Sr||(Sr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(_r||(_r={})),function(e){e.CONTAINS="Contains",e.EQUALS="Equals",e.NOT_EQUAL="NotEqual",e.STARTS_WITH="StartsWith"}(Er||(Er={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Ar||(Ar={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Or||(Or={})),function(e){e.RULES="Rules",e.TOKEN="Token"}(Ir||(Ir={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Tr||(Tr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Cr||(Cr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(xr||(xr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Pr||(Pr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(kr||(kr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Nr||(Nr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Mr||(Mr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(jr||(jr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Rr||(Rr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Dr||(Dr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Ur||(Ur={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Fr||(Fr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Lr||(Lr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Br||(Br={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(qr||(qr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(zr||(zr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Kr||(Kr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Hr||(Hr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Vr||(Vr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Gr||(Gr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Wr||(Wr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Yr||(Yr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Jr||(Jr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}($r||($r={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Zr||(Zr={})),function(e){e.filterSensitiveLog=function(e){return mt({},e)}}(Qr||(Qr={}));var ii=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return wt(this,(function(g){switch(g.label){case 0:return r=[mt({},e)],y={},[4,Mi(e.body,t)];case 1:switch(n=mt.apply(void 0,r.concat([(y.body=g.sent(),y)])),o="UnknownError",o=ji(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,si(n,t)];case 3:return i=mt.apply(void 0,[mt.apply(void 0,s.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 4:return a=[{}],[4,ai(n,t)];case 5:return i=mt.apply(void 0,[mt.apply(void 0,a.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 6:return u=[{}],[4,ui(n,t)];case 7:return i=mt.apply(void 0,[mt.apply(void 0,u.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 8:return c=[{}],[4,ci(n,t)];case 9:return i=mt.apply(void 0,[mt.apply(void 0,c.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 10:return l=[{}],[4,fi(n,t)];case 11:return i=mt.apply(void 0,[mt.apply(void 0,l.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 12:return f=[{}],[4,di(n,t)];case 13:return i=mt.apply(void 0,[mt.apply(void 0,f.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 14:return d=[{}],[4,hi(n,t)];case 15:return i=mt.apply(void 0,[mt.apply(void 0,d.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 16:return h=[{}],[4,pi(n,t)];case 17:return i=mt.apply(void 0,[mt.apply(void 0,h.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=mt(mt({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:Pi(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))]}}))}))},oi=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return wt(this,(function(g){switch(g.label){case 0:return r=[mt({},e)],y={},[4,Mi(e.body,t)];case 1:switch(n=mt.apply(void 0,r.concat([(y.body=g.sent(),y)])),o="UnknownError",o=ji(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,si(n,t)];case 3:return i=mt.apply(void 0,[mt.apply(void 0,s.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 4:return a=[{}],[4,ai(n,t)];case 5:return i=mt.apply(void 0,[mt.apply(void 0,a.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 6:return u=[{}],[4,ci(n,t)];case 7:return i=mt.apply(void 0,[mt.apply(void 0,u.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 8:return c=[{}],[4,li(n,t)];case 9:return i=mt.apply(void 0,[mt.apply(void 0,c.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 10:return l=[{}],[4,fi(n,t)];case 11:return i=mt.apply(void 0,[mt.apply(void 0,l.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 12:return f=[{}],[4,di(n,t)];case 13:return i=mt.apply(void 0,[mt.apply(void 0,f.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 14:return d=[{}],[4,hi(n,t)];case 15:return i=mt.apply(void 0,[mt.apply(void 0,d.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 16:return h=[{}],[4,pi(n,t)];case 17:return i=mt.apply(void 0,[mt.apply(void 0,h.concat([g.sent()])),{name:o,$metadata:Pi(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=mt(mt({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:Pi(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))]}}))}))},si=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=bi(n,t),[2,mt({name:"ExternalServiceException",$fault:"client",$metadata:Pi(e)},r)]}))}))},ai=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=_i(n,t),[2,mt({name:"InternalErrorException",$fault:"server",$metadata:Pi(e)},r)]}))}))},ui=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=Ei(n,t),[2,mt({name:"InvalidIdentityPoolConfigurationException",$fault:"client",$metadata:Pi(e)},r)]}))}))},ci=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=Ai(n,t),[2,mt({name:"InvalidParameterException",$fault:"client",$metadata:Pi(e)},r)]}))}))},li=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=Oi(n,t),[2,mt({name:"LimitExceededException",$fault:"client",$metadata:Pi(e)},r)]}))}))},fi=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=Ii(n,t),[2,mt({name:"NotAuthorizedException",$fault:"client",$metadata:Pi(e)},r)]}))}))},di=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=Ti(n,t),[2,mt({name:"ResourceConflictException",$fault:"client",$metadata:Pi(e)},r)]}))}))},hi=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=Ci(n,t),[2,mt({name:"ResourceNotFoundException",$fault:"client",$metadata:Pi(e)},r)]}))}))},pi=function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n=e.body,r=xi(n,t),[2,mt({name:"TooManyRequestsException",$fault:"client",$metadata:Pi(e)},r)]}))}))},vi=function(e,t){return mt(mt(mt({},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:gi(e.Logins,t)})},yi=function(e,t){return mt(mt(mt({},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:gi(e.Logins,t)})},gi=function(e,t){return Object.entries(e).reduce((function(e,t){var n,r=St(t,2),i=r[0],o=r[1];return null===o?e:mt(mt({},e),((n={})[i]=o,n))}),{})},mi=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}},bi=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},wi=function(e,t){return{Credentials:void 0!==e.Credentials&&null!==e.Credentials?mi(e.Credentials):void 0,IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},Si=function(e,t){return{IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},_i=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ei=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ai=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Oi=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ii=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ti=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ci=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}},Pi=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"]}},ki=function(e,t){return void 0===e&&(e=new Uint8Array),e instanceof Uint8Array?Promise.resolve(e):t.streamCollector(e)||Promise.resolve(new Uint8Array)},Ni=function(e,t,n,r,i){return bt(void 0,void 0,void 0,(function(){var o,s,a,u,c,l;return wt(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 Se(l)]}}))}))},Mi=function(e,t){return function(e,t){return ki(e,t).then((function(e){return t.utf8Encoder(e)}))}(e,t).then((function(e){return e.length?JSON.parse(e):{}}))},ji=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):""},Ri=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return gt(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(tt(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetIdCommand",inputFilterSensitiveLog:wr.filterSensitiveLog,outputFilterSensitiveLog:Sr.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 bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetId"},r=JSON.stringify(yi(e,t)),[2,Ni(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r,i;return wt(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,oi(e,t)]:[4,Mi(e.body,t)];case 1:return n=o.sent(),{},r=Si(n,t),i=mt({$metadata:Pi(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(st),Di=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return gt(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(tt(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetCredentialsForIdentityCommand",inputFilterSensitiveLog:yr.filterSensitiveLog,outputFilterSensitiveLog:mr.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 bt(void 0,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetCredentialsForIdentity"},r=JSON.stringify(vi(e,t)),[2,Ni(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return bt(void 0,void 0,void 0,(function(){var n,r,i;return wt(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,ii(e,t)]:[4,Mi(e.body,t)];case 1:return n=o.sent(),{},r=wi(n,t),i=mt({$metadata:Pi(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(st),Ui=function(){return(Ui=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)},Fi=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())}))},Li=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])}}},Bi=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=s.b.refreshGoogleToken,this._refreshHandlers.facebook=s.a.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=Ui(Ui({},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 Bi.debug("getting credentials"),this._pickupCredentials()},e.prototype._getCognitoIdentityIdStorageKey=function(e){return"CognitoIdentityId-"+e},e.prototype._pickupCredentials=function(){return Bi.debug("picking up credentials"),this._gettingCredPromise&&this._gettingCredPromise.isPending()?Bi.debug("getting old cred promise"):(Bi.debug("getting new cred promise"),this._gettingCredPromise=Object(o.d)(this._keepAlive())),this._gettingCredPromise},e.prototype._keepAlive=function(){return Fi(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return Li(this,(function(a){switch(a.label){case 0:if(Bi.debug("checking if credentials exists and not expired"),(e=this._credentials)&&!this._isExpired(e)&&!this._isPastTTL())return Bi.debug("credentials not changed and not expired, directly return"),[2,Promise.resolve(e)];if(Bi.debug("need to get a new credential or refresh the existing one"),t=this.Auth,!(n=void 0===t?c.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];Bi.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(),Bi.debug("Error attempting to refreshing the session",s),[3,6];case 6:return[2,n.currentUserCredentials()]}}))}))},e.prototype.refreshFederatedToken=function(e){Bi.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 Bi.debug("checking if federated jwt token expired"),o>(new Date).getTime()?(Bi.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]?(Bi.debug("getting refreshed jwt token from federation provider"),this._providerRefreshWithRetry({refreshHandler:this._refreshHandlers[t],provider:t,user:n})):(Bi.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 Bi.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(),Bi.debug("refresh federated token failed",e),Promise.reject("refreshing federation token failed: "+e)}))},e.prototype._isExpired=function(e){if(!e)return Bi.debug("no credentials for expiration check"),!0;Bi.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 Fi(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a=this;return Li(this,(function(c){switch(c.label){case 0:return Bi.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()]):(Bi.debug("region is not configured for getting the credentials"),[2,Promise.reject("region is not configured for getting the credentials")]):(Bi.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=c.sent(),o=new ri({region:n,customUserAgent:Object(u.b)()}),s=void 0,s=r?ft({identityId:r,client:o})():function(){return Fi(a,void 0,void 0,(function(){var e;return Li(this,(function(n){switch(n.label){case 0:return[4,o.send(new Ri({IdentityPoolId:t}))];case 1:return e=n.sent().IdentityId,this._identityId=e,[2,ft({client:o,identityId:e})()]}}))}))}().catch((function(e){return Fi(a,void 0,void 0,(function(){return Li(this,(function(t){throw e}))}))})),[2,this._loadCredentials(s,"guest",!1,null).then((function(e){return e})).catch((function(e){return Fi(a,void 0,void 0,(function(){var n=this;return Li(this,(function(i){switch(i.label){case 0:return"ResourceNotFoundException"!==e.name||e.message!=="Identity '"+r+"' not found."?[3,2]:(Bi.debug("Failed to load guest credentials"),[4,this._removeGuestIdentityId()]);case 1:return i.sent(),s=function(){return Fi(n,void 0,void 0,(function(){var e;return Li(this,(function(n){switch(n.label){case 0:return[4,o.send(new Ri({IdentityPoolId:t}))];case 1:return e=n.sent().IdentityId,this._identityId=e,[2,ft({client:o,identityId:e})()]}}))}))}().catch((function(e){return Fi(n,void 0,void 0,(function(){return Li(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,c=s.region;if(!a)return Bi.debug("No Cognito Federated Identity pool provided"),Promise.reject("No Cognito Federated Identity pool provided");if(!c)return Bi.debug("region is not configured for getting the credentials"),Promise.reject("region is not configured for getting the credentials");var l=new ri({region:c,customUserAgent:Object(u.b)()}),f=void 0;r?f=ft({identityId:r,logins:o,client:l})():f=vt({logins:o,identityPoolId:a,client:l})();return this._loadCredentials(f,"federated",!0,e)},e.prototype._setCredentialsFromSession=function(e){var t=this;Bi.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 Bi.debug("No Cognito Federated Identity pool provided"),Promise.reject("No Cognito Federated Identity pool provided");if(!i)return Bi.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 c=new ri({region:i,customUserAgent:Object(u.b)()}),l=Fi(t,void 0,void 0,(function(){var e,t,n,r,i,o,u,l,f,d;return Li(this,(function(h){switch(h.label){case 0:return[4,this._getGuestIdentityId()];case 1:return(e=h.sent())?[3,3]:[4,c.send(new Ri({IdentityPoolId:s,Logins:a}))];case 2:n=h.sent().IdentityId,t=n,h.label=3;case 3:return[4,c.send(new Di({IdentityId:e||t,Logins:a}))];case 4:return r=h.sent(),i=r.Credentials,o=i.AccessKeyId,u=i.Expiration,l=i.SecretKey,f=i.SessionToken,d=r.IdentityId,this._identityId=d,e?(Bi.debug("The guest identity "+e+" has been successfully linked to the logins"),e===d&&Bi.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:u,identityId:d}]}}))})).catch((function(e){return Fi(t,void 0,void 0,(function(){return Li(this,(function(t){throw e}))}))}));return this._loadCredentials(l,"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 Fi(i,void 0,void 0,(function(){var i,a,u,c,l;return Li(this,(function(f){switch(f.label){case 0:if(Bi.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){Bi.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 Bi.debug("Failed to load credentials",e),Bi.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():(Bi.debug("no source specified for setting credentials"),Promise.reject("invalid source"))},e.prototype.clear=function(){return Fi(this,void 0,void 0,(function(){return Li(this,(function(e){return this._credentials=null,this._credentials_source=null,Bi.debug("removing aws-amplify-federatedInfo from storage"),this._storage.removeItem("aws-amplify-federatedInfo"),[2]}))}))},e.prototype._getGuestIdentityId=function(){return Fi(this,void 0,void 0,(function(){var e,t;return Li(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(),Bi.debug("Failed to get the cached guest identityId",t),[3,4];case 4:return[2]}}))}))},e.prototype._setGuestIdentityId=function(e){return Fi(this,void 0,void 0,(function(){var t,n;return Li(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(),Bi.debug("Failed to cache guest identityId",n),[3,4];case 4:return[2]}}))}))},e.prototype._removeGuestIdentityId=function(){return Fi(this,void 0,void 0,(function(){var e;return Li(this,(function(t){return e=this._config.identityPoolId,Bi.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);c.a.register(qi)},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 z}));var r=n(4),i=n(22),o=n(35),s=n(40),a=n(60),u=n(71),c=n(31),l=n(14);var f,d=n(17),h=n(9),p=n(8),v=function(e){var t=window.open(e,"_self");return t?Promise.resolve(t):Promise.reject()},y=n(79),g=n.n(y),m=n(80),b=n.n(m),w=function(){return(w=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)},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="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",O=function(e,t,n){o.a.dispatch("auth",{event:e,data:t,message:n},"Auth",A)},I=new i.a("OAuth"),T=function(){function e(e){var t=e.config,n=e.cognitoClientId,r=e.scopes,i=void 0===r?[]:r;if(this._urlOpener=t.urlOpener||v,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(w(w({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=E(e,2),n=t[0],r=t[1];return encodeURIComponent(n)+"="+encodeURIComponent(r)})).join("&");I.debug("Redirecting to "+h),this._urlOpener(h,n)},e.prototype._handleCodeFlow=function(e){return S(this,void 0,void 0,(function(){var t,n,i,o,s,a,u,c,l,f,d,h,v,y;return _(this,(function(g){switch(g.label){case 0:return t=(Object(p.parse)(e).query||"").split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n,r=E(t,2),i=r[0],o=r[1];return w(w({},e),((n={})[i]=o,n))}),{code:void 0}).code,n=Object(p.parse)(e).pathname||"/",i=Object(p.parse)(this._config.redirectSignIn).pathname||"/",t&&n===i?(o="https://"+this._config.domain+"/oauth2/token",O("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,m=window.sessionStorage.getItem("ouath_pkce_key"),window.sessionStorage.removeItem("ouath_pkce_key"),c=w({grant_type:"authorization_code",code:t,client_id:s,redirect_uri:a},(u=m)?{code_verifier:u}:{}),I.debug("Calling token endpoint: "+o+" with",c),l=Object.entries(c).map((function(e){var t=E(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,g.sent().json()];case 2:if(f=g.sent(),d=f.access_token,h=f.refresh_token,v=f.id_token,y=f.error)throw new Error(y);return[2,{accessToken:d,refreshToken:h,idToken:v}]}var m}))}))},e.prototype._handleImplicitFlow=function(e){return S(this,void 0,void 0,(function(){var t,n,r;return _(this,(function(i){return t=(Object(p.parse)(e).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n,r=E(t,2),i=r[0],o=r[1];return w(w({},e),((n={})[i]=o,n))}),{id_token:void 0,access_token:void 0}),n=t.id_token,r=t.access_token,O("implicitFlow",{},"Got tokens from "+e),I.debug("Retrieving implicit tokens from "+e+" with"),[2,{accessToken:r,idToken:n,refreshToken:null}]}))}))},e.prototype.handleAuthResponse=function(e){return S(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return _(this,(function(u){switch(u.label){case 0:if(u.trys.push([0,5,,6]),t=e?w(w({},(Object(p.parse)(e).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n=E(t,2),r=n[0],i=n[1];return e[r]=i,e}),{})),(Object(p.parse)(e).query||"").split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n=E(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),I.debug("Starting "+this._config.responseType+" flow with "+e),"code"!==this._config.responseType?[3,2]:(o=[{}],[4,this._handleCodeFlow(e)]);case 1:return[2,w.apply(void 0,[w.apply(void 0,o.concat([u.sent()])),{state:i}])];case 2:return s=[{}],[4,this._handleImplicitFlow(e)];case 3:return[2,w.apply(void 0,[w.apply(void 0,s.concat([u.sent()])),{state:i}])];case 4:return[3,6];case 5:throw a=u.sent(),I.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 S(this,void 0,void 0,(function(){var e,t,n;return _(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=E(e,2);return t[0]+"="+t[1]})).join("&"),O("oAuthSignOut",{oAuth:"signOut"},"Signing out from "+e),I.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(g()(e))},e.prototype._base64URL=function(e){return e.toString(b.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}(),C=n(11),x=(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)}),P=new i.a("AuthError"),k=function(e){function t(n){var r=this,i=M[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 x(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 x(t,e),t}(k),M={noConfig:{message:C.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:C.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:C.a.EMPTY_USERNAME},invalidUsername:{message:C.a.INVALID_USERNAME},emptyPassword:{message:C.a.EMPTY_PASSWORD},emptyCode:{message:C.a.EMPTY_CODE},signUpError:{message:C.a.SIGN_UP_ERROR,log:"The first parameter should either be non-null string or object"},noMFA:{message:C.a.NO_MFA},invalidMFA:{message:C.a.INVALID_MFA},emptyChallengeResponse:{message:C.a.EMPTY_CHALLENGE},noUserSession:{message:C.a.NO_USER_SESSION},deviceConfig:{message:C.a.DEVICE_CONFIG},networkError:{message:C.a.NETWORK_ERROR},default:{message:C.a.DEFAULT_MSG}};function j(e){return(j="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=function(){return(R=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())}))},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])}}},F=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},L=new i.a("AuthClass"),B="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",q=function(e,t,n){o.a.dispatch("auth",{event:e,data:t,message:n},"Auth",B)},z=new(function(){function e(e){var t=this;this.userPool=null,this.user=null,this.oAuthFlowInProgress=!1,this.Credentials=s.a,this.wrapRefreshSessionCallback=function(e){return function(t,n){return n?q("tokenRefresh",void 0,"New token retrieved"):q("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||{};L.debug("configure Auth");var n=Object.assign({},this._config,a.a.parseMobilehubConfig(e).Auth,e);this._config=n;var i=this._config,o=i.userPoolId,s=i.userPoolWebClientId,f=i.cookieStorage,d=i.oauth,p=i.region,v=i.identityPoolId,y=i.mandatorySignIn,g=i.refreshHandlers,m=i.identityPoolRegion,b=i.clientMetadata,w=i.endpoint;if(this._config.storage){if(!this._isValidAuthStorage(this._config.storage))throw L.error("The storage in the Auth config is not valid!"),new Error("Empty storage object");this._storage=this._config.storage}else this._storage=f?new h.i(f):e.ssr?new u.a:(new c.a).getStorage();if(this._storageSync=Promise.resolve(),"function"==typeof this._storage.sync&&(this._storageSync=this._storage.sync()),o){var S={UserPoolId:o,ClientId:s,endpoint:w};S.Storage=this._storage,this.userPool=new h.g(S,this.wrapRefreshSessionCallback)}this.Credentials.configure({mandatorySignIn:y,region:m||p,userPoolId:o,identityPoolId:v,refreshHandlers:g,storage:this._storage});var _=d?Object(r.e)(this._config.oauth)?d:d.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:b},_.options);this._oAuthHandler=new T({scopes:E.scopes,config:E,cognitoClientId:E.cognitoClientId});var A={};!function(e){if(l.a.browserOrNode().isBrowser&&window.location)e({url:window.location.href});else if(!l.a.browserOrNode().isNode)throw new Error("Not supported")}((function(e){var n=e.url;A[n]||(A[n]=!0,t._handleAuthResponse(n))}))}return q("configured",null,"The Auth category has been configured successfully"),this._config},e.prototype.signUp=function(e){for(var t=this,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];if(!this.userPool)return this.rejectNoUserPool();var o,s=null,a=null,u=[],c=null;if(e&&"string"==typeof e){s=e,a=n?n[0]:null;var l=n?n[1]:null,f=n?n[2]:null;l&&u.push(new h.f({Name:"email",Value:l})),f&&u.push(new h.f({Name:"phone_number",Value:f}))}else{if(!e||"object"!==j(e))return this.rejectAuthError(r.a.SignUpError);s=e.username,a=e.password,e&&e.clientMetadata?o=e.clientMetadata:this._config.clientMetadata&&(o=this._config.clientMetadata);var d=e.attributes;d&&Object.keys(d).map((function(e){u.push(new h.f({Name:e,Value:d[e]}))}));var p=e.validationData;p&&(c=[],Object.keys(p).map((function(e){c.push(new h.f({Name:e,Value:p[e]}))})))}return s?a?(L.debug("signUp attrs:",u),L.debug("signUp validation data:",c),new Promise((function(e,n){t.userPool.signUp(s,a,u,c,(function(t,r){t?(q("signUp_failure",t,s+" failed to signup"),n(t)):(q("signUp",r,s+" has signed up successfully"),e(r))}),o)}))):this.rejectAuthError(r.a.EmptyPassword):this.rejectAuthError(r.a.EmptyUsername)},e.prototype.confirmSignUp=function(e,t,n){if(!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(r.a.EmptyUsername);if(!t)return this.rejectAuthError(r.a.EmptyCode);var i,o=this.createCognitoUser(e),s=!n||"boolean"!=typeof n.forceAliasCreation||n.forceAliasCreation;return n&&n.clientMetadata?i=n.clientMetadata:this._config.clientMetadata&&(i=this._config.clientMetadata),new Promise((function(e,n){o.confirmRegistration(t,s,(function(t,r){t?n(t):e(r)}),i)}))},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&&L.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 h.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 D(r,void 0,void 0,(function(){var r,s,a,u;return U(this,(function(c){switch(c.label){case 0:L.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(),L.debug("succeed to get cognito credentials",r),[3,9];case 4:return s=c.sent(),L.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,q("signIn",a,"A user "+e.getUsername()+" has been signed in"),t(a),[3,8];case 7:return u=c.sent(),L.error("Failed to get the signed in user",u),n(u),[3,8];case 8:return[7];case 9:return[2]}}))}))},onFailure:function(t){L.debug("signIn failure",t),q("signIn_failure",t,e.getUsername()+" failed to signin"),n(t)},customChallenge:function(n){L.debug("signIn custom challenge answer required"),e.challengeName="CUSTOM_CHALLENGE",e.challengeParam=n,t(e)},mfaRequired:function(n,r){L.debug("signIn MFA required"),e.challengeName=n,e.challengeParam=r,t(e)},mfaSetup:function(n,r){L.debug("signIn mfa setup",n),e.challengeName=n,e.challengeParam=r,t(e)},newPasswordRequired:function(n,r){L.debug("signIn new password"),e.challengeName="NEW_PASSWORD_REQUIRED",e.challengeParam={userAttributes:n,requiredAttributes:r},t(e)},totpRequired:function(n,r){L.debug("signIn totpRequired"),e.challengeName=n,e.challengeParam=r,t(e)},selectMFAType:function(n,r){L.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 L.debug("get MFA Options failed",e),void n(e);L.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 D(n,void 0,void 0,(function(){var n,a;return U(this,(function(u){switch(u.label){case 0:if(!t)return[3,5];if(L.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":L.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 D(n,void 0,void 0,(function(){var n;return U(this,(function(s){switch(s.label){case 0:if(!t)return[3,5];if(L.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 D(this,void 0,void 0,(function(){var n,i,o,s,a,u,c=this;return U(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 L.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 L.debug("Set user mfa preference error",i),r(i);L.debug("Set user mfa success",o),L.debug("Caching the latest user data into local"),e.getUserData((function(n,i){return D(c,void 0,void 0,(function(){var i;return U(this,(function(s){switch(s.label){case 0:if(!n)return[3,5];if(L.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 L.debug("disable mfa failed",e),void n(e);L.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 L.debug("enable mfa failed",e),void n(e);L.debug("enable mfa succeed",r),t(r)}))}))},e.prototype.setupTOTP=function(e){return new Promise((function(t,n){e.associateSoftwareToken({onFailure:function(e){L.debug("associateSoftwareToken failed",e),n(e)},associateSecretCode:function(e){L.debug("associateSoftwareToken sucess",e),t(e)}})}))},e.prototype.verifyTotpToken=function(e,t){return L.debug("verification totp token",e,t),new Promise((function(n,r){e.verifySoftwareToken(t,"My TOTP device",{onFailure:function(e){L.debug("verifyTotpToken failed",e),r(e)},onSuccess:function(t){q("signIn",e,"A user "+e.getUsername()+" has been signed in"),L.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 D(o,void 0,void 0,(function(){var n,i;return U(this,(function(o){switch(o.label){case 0:L.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(),L.debug("succeed to get cognito credentials",n),[3,6];case 4:return i=o.sent(),L.debug("cannot get cognito credentials",i),[3,6];case 5:return s.user=e,q("signIn",e,"A user "+e.getUsername()+" has been signed in"),r(e),[7];case 6:return[2]}}))}))},onFailure:function(e){L.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 D(o,void 0,void 0,(function(){var n,i;return U(this,(function(o){switch(o.label){case 0:L.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(),L.debug("succeed to get cognito credentials",n),[3,6];case 4:return i=o.sent(),L.debug("cannot get cognito credentials",i),[3,6];case 5:return s.user=e,q("signIn",e,"A user "+e.getUsername()+" has been signed in"),r(e),[7];case 6:return[2]}}))}))},onFailure:function(e){L.debug("completeNewPassword failure",e),q("completeNewPassword_failure",e,o.user+" failed to complete the new password flow"),a(e)},mfaRequired:function(t,n){L.debug("signIn MFA required"),e.challengeName=t,e.challengeParam=n,r(e)},mfaSetup:function(t,n){L.debug("signIn mfa setup",t),e.challengeName=t,e.challengeParam=n,r(e)},totpRequired:function(t,n){L.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 D(this,void 0,void 0,(function(){var e,t,n=this;return U(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(),L.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 D(n,void 0,void 0,(function(){var n,i=this;return U(this,(function(o){if(this.userPool){if(!(n=this.userPool.getCurrentUser()))return L.debug("Failed to get user from user pool"),[2,r(new Error("No current user."))];n.getSession((function(o,s){return D(i,void 0,void 0,(function(){var i,s=this;return U(this,(function(a){switch(a.label){case 0:if(!o)return[3,5];if(L.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{q("userDeleted",o,"The authenticated user has been deleted."),n.signOut(),s.user=null;try{s.cleanCachedItems()}catch(e){L.debug("failed to clear cached items")}t?s.oAuthSignOutRedirect(e,r):(q("signOut",s.user,"A user has been signed out"),e(o))}})),a.label=6;case 6:return[2]}}))}))}))}else L.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"===j(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 D(this,void 0,void 0,(function(){var t=this;return U(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(),L.debug("failed to clear cached items"),[3,4];case 4:return this.isSignedInHostedUI()?[2,new Promise((function(e,n){t.oAuthSignOutRedirect(e,n)}))]:(q("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 D(t,void 0,void 0,(function(){var t,i,s=this;return U(this,(function(a){switch(a.label){case 0:return this.isOAuthInProgress()?(L.debug("OAuth signIn in progress, waiting for resolution..."),[4,new Promise((function(e){var t=setTimeout((function(){L.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||(L.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 D(s,void 0,void 0,(function(){var s,a,u,c,l=this;return U(this,(function(f){switch(f.label){case 0:if(!i)return[3,5];if(L.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 D(l,void 0,void 0,(function(){var o,s,a,u,c,l,f;return U(this,(function(d){switch(d.label){case 0:if(!e)return[3,7];if(L.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 h.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]):(L.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]):(L.debug("Failed to get user from user pool"),r("No current user"),[2])}}))}))})).catch((function(e){return L.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 D(this,void 0,void 0,(function(){var t,n,r,i,o;return U(this,(function(s){switch(s.label){case 0:L.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(),L.debug("Failed to sync cache info into memory",n),n;case 4:try{(r=JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")))&&(t=R(R({},r.user),{token:r.token}))}catch(e){L.debug("cannot load federated user from auth storage")}return t?(this.user=t,L.debug("get current authenticated federated user",this.user),[2,this.user]):[3,5];case 5:L.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())&&L.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"),L.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 L.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){L.debug("Failed to get the current session",e),n(e)}))})).catch((function(e){L.debug("Failed to get the current user",e),n(e)}))})):this.rejectNoUserPool()},e.prototype.userSession=function(e){var t=this;if(!e)return L.debug("the user is null"),this.rejectAuthError(r.a.NoUserSession);var n=this._config.clientMetadata;return new Promise((function(r,i){L.debug("Getting the session from this user:",e),e.getSession((function(n,o){return D(t,void 0,void 0,(function(){var t;return U(this,(function(s){switch(s.label){case 0:if(!n)return[3,5];if(L.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 L.debug("Succeed to get the user session",o),r(o),[2]}}))}))}),{clientMetadata:n})}))},e.prototype.currentUserCredentials=function(){return D(this,void 0,void 0,(function(){var e,t,n=this;return U(this,(function(r){switch(r.label){case 0:L.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(),L.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){L.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 L.debug("getting session success",e),n.Credentials.set(e,"session")})).catch((function(){return L.debug("getting guest credentials"),n.Credentials.set(null,"guest")}))]}}))}))},e.prototype.currentCredentials=function(){return L.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 D(this,void 0,void 0,(function(){var n,r,i=this;return U(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(),L.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){L.debug("user global sign out",t);var s=i._config.clientMetadata;t.getSession((function(e,s){return D(i,void 0,void 0,(function(){var i,s=this;return U(this,(function(a){switch(a.label){case 0:if(!e)return[3,5];if(L.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(L.debug("global sign out success"),!r)return n();s.oAuthSignOutRedirect(n,o)},onFailure:function(e){return L.debug("global sign out failed",e),o(e)}}),[2]}}))}))}),{clientMetadata:s})}else L.debug("user sign out",t),t.signOut((function(){if(!r)return n();i.oAuthSignOutRedirect(n,o)}))}))]}}))}))},e.prototype.oAuthSignOutRedirect=function(e,t){l.a.browserOrNode().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 D(this,void 0,void 0,(function(){var t;return U(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(),L.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:L.debug("no current Cognito user"),n.label=6;case 6:return[3,8];case 7:L.debug("no Cognito User pool"),n.label=8;case 8:return q("signOut",this.user,"A user has been signed out"),this.user=null,[2]}}))}))},e.prototype.cleanCachedItems=function(){return D(this,void 0,void 0,(function(){return U(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?(L.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){L.debug("forgot password failure",t),q("forgotPassword_failure",t,e+" forgotPassword failed"),i(t)},inputVerificationCode:function(t){q("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){q("forgotPasswordSubmit",o,e+" forgotPasswordSubmit successful"),r(t)},onFailure:function(t){q("forgotPasswordSubmit_failure",t,e+" forgotPasswordSubmit failed"),s(t)}},i)}))},e.prototype.currentUserInfo=function(){return D(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return U(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 L.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(),L.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(),L.error("currentUserInfo error",o),[2,{}];case 9:return"federated"===e?[2,(s=this.user)||{}]:[2]}}))}))},e.prototype.federatedSignIn=function(e,t,n){return D(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p;return U(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))&&L.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(),q("signIn",p,"A user "+p.username+" has been signed in"),L.debug("federated sign in credentials",h),[2,h];case 4:return[2]}}))}))},e.prototype._handleAuthResponse=function(e){return D(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,f,d,v,y,g;return U(this,(function(m){switch(m.label){case 0:if(this.oAuthFlowInProgress)return L.debug("Skipping URL "+e+" current flow in progress"),[2];m.label=1;case 1:if(m.trys.push([1,,8,9]),this.oAuthFlowInProgress=!0,!this._config.userPoolId)throw new Error("OAuth responses require a User Pool defined in config");if(q("parsingCallbackUrl",{url:e},"The callback url is being parsed"),t=e||(l.a.browserOrNode().isBrowser?window.location.href:""),n=!!(Object(p.parse)(t).query||"").split("&").map((function(e){return e.split("=")})).find((function(e){var t=F(e,1)[0];return"code"===t||"error"===t})),r=!!(Object(p.parse)(t).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).find((function(e){var t=F(e,1)[0];return"access_token"===t||"error"===t})),!n&&!r)return[3,7];this._storage.setItem("amplify-redirected-from-hosted-ui","true"),m.label=2;case 2:return m.trys.push([2,6,,7]),[4,this._oAuthHandler.handleAuthResponse(t)];case 3:return i=m.sent(),o=i.accessToken,s=i.idToken,a=i.refreshToken,u=i.state,c=new h.h({IdToken:new h.c({IdToken:s}),RefreshToken:new h.d({RefreshToken:a}),AccessToken:new h.b({AccessToken:o})}),f=void 0,this._config.identityPoolId?[4,this.Credentials.set(c,"session")]:[3,5];case 4:f=m.sent(),L.debug("AWS credentials",f),m.label=5;case 5:return d=/-/.test(u),(v=this.createCognitoUser(c.getIdToken().decodePayload()["cognito:username"])).setSignInUserSession(c),window&&void 0!==window.history&&window.history.replaceState({},null,this._config.oauth.redirectSignIn),q("signIn",v,"A user "+v.getUsername()+" has been signed in"),q("cognitoHostedUI",v,"A user "+v.getUsername()+" has been signed in via Cognito Hosted UI"),d&&(y=u.split("-").splice(1).join("-"),q("customOAuthState",y.match(/.{2}/g).map((function(e){return String.fromCharCode(parseInt(e,16))})).join(""),"State for user "+v.getUsername())),[2,f];case 6:return g=m.sent(),L.debug("Error in cognito hosted auth response",g),window&&void 0!==window.history&&window.history.replaceState({},null,this._config.oauth.redirectSignIn),q("signIn_failure",g,"The OAuth response flow failed"),q("cognitoHostedUI_failure",g,"A failure occurred when returning to the Cognito Hosted UI"),q("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 h.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 k(e))},e.prototype.rejectNoUserPool=function(){var e=this.noUserPoolErrorHandler(this._config);return Promise.reject(new N(e))},e.prototype.rememberDevice=function(){return D(this,void 0,void 0,(function(){var e,t;return U(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(),L.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 k(r.a.DeviceConfig)):"NetworkError"===e.code?n(new k(r.a.NetworkError)):n(e)}})}))]}}))}))},e.prototype.forgetDevice=function(){return D(this,void 0,void 0,(function(){var e,t;return U(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(),L.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 k(r.a.DeviceConfig)):"NetworkError"===e.code?n(new k(r.a.NetworkError)):n(e)}})}))]}}))}))},e.prototype.fetchDevices=function(){return D(this,void 0,void 0,(function(){var e,t;return U(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(),L.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 k(r.a.DeviceConfig)):"NetworkError"===e.code?n(new k(r.a.NetworkError)):n(e)}};e.listDevices(60,null,i)}))]}}))}))},e}())(null);d.a.register(z)},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(145),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(4),s=n(20),a=n(15),u=n(23),c=n(22),l=n(35),f=n(16),d=n(10),h=n(1),p=n(3),v=n(5),y=n(2),g=n(25),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){void 0===n&&(n={}),this.schema=e,this.syncPredicates=t,this.amplifyConfig=n,this.authModeStrategy=r,this.errorHandler=i,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,s,a){void 0===r&&(r={}),void 0===s&&(s={});var u=Object(p.e)(e);if(a===o.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!==o.c.AMAZON_COGNITO_USER_POOLS&&a!==o.c.OPENID_CONNECT||!l.find((function(e){var t=Object(p.j)(r,e),n=Object(p.j)(s,e);return _(t,n).find((function(t){return e.groups.find((function(e){return e===t}))}))}))?((a===o.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:o.c.AMAZON_COGNITO_USER_POOLS,isOwner:!e.areSubscriptionsPublic,ownerField:e.ownerField,ownerValue:t})})),c||((a===o.c.OPENID_CONNECT?u.filter((function(e){return"owner"===e.authStrategy&&"oidc"===e.provider})):[]).forEach((function(e){var t=s[e.identityClaim];t&&(c={authMode:o.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,c,d=[],y={},_=i.none;return b(t,void 0,void 0,(function(){var t,A,O,I,T,C,x,P,k,N,M=this;return w(this,(function(j){switch(j.label){case 0:return j.trys.push([0,2,,3]),[4,a.a.currentCredentials()];case 1:return t=j.sent(),_=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,a.a.currentSession()];case 4:return A=j.sent(),o=A.getIdToken().decodePayload(),[3,6];case 5:return j.sent(),[3,6];case 6:if(j.trys.push([6,11,,12]),O=this.amplifyConfig,I=O.aws_cognito_region,T=O.Auth,!I||T&&!T.region)throw"Auth is not configured";return C=void 0,[4,u.a.getItem("federatedInfo")];case 7:return(x=j.sent())?(C=x.token,[3,10]):[3,8];case 8:return[4,a.a.currentAuthenticatedUser()];case 9:(P=j.sent())&&(C=P.token),j.label=10;case 10:return C&&(k=C.split(".")[1],c=JSON.parse(e.from(k,"base64").toString("utf8"))),[3,12];case 11:return N=j.sent(),E.debug("error getting OIDC JWT",N),[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(M,void 0,void 0,(function(){var r,i,a,u,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,y=m(m({},y),((O={})[t.name]=((I={})[p.a.CREATE]=[],I[p.a.UPDATE]=[],I[p.a.DELETE]=[],I),O)),a=[p.a.CREATE,p.a.UPDATE,p.a.DELETE],(T={})[p.a.CREATE]=0,T[p.a.UPDATE]=0,T[p.a.DELETE]=0,u=T,A=function(r){return b(C,void 0,void 0,(function(){var a,O,I,T,C,x,P,k,N,M,j,R,D=this;return w(this,(function(U){switch(U.label){case 0:return a=this.buildSubscription(e,t,r,_,o,c,i[u[r]]),O=a.opType,I=a.opName,T=a.query,C=a.isOwner,x=a.ownerField,P=a.ownerValue,k=a.authMode,[4,Object(p.i)(k,this.amplifyConfig)];case 1:if(N=U.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[u[r]]),j=s.a.graphql(m(m({query:T,variables:M},{authMode:k}),{authToken:N})),y[t.name][O].push(j.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 D.drainBuffer()}var o=v.a.getPredicates(D.syncPredicates.get(t),!1),s=n[I];D.passesPredicateValidation(s,o)&&D.pushToBuffer(O,t,s),D.drainBuffer()},error:function(e){return b(D,void 0,void 0,(function(){var o,s,a,c,l,d;return w(this,(function(p){switch(p.label){case 0: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,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("Sync error handler failed with:",d),[3,4];case 4:return l.includes(f.CONTROL_MSG.REALTIME_SUBSCRIPTION_INIT_ERROR)||l.includes(f.CONTROL_MSG.CONNECTION_FAILED)?(y[t.name][O].forEach((function(e){return e.unsubscribe()})),y[t.name][O]=[],u[r]++,u[r]>=i.length?(E.debug(r+" subscription failed with authMode: "+i[u[r]-1]),E.warn("subscriptionError",l),[2]):(E.debug(r+" subscription failed with authMode: "+i[u[r]-1]+". Retrying with authMode: "+i[u[r]]),A(r),[2])):(E.warn("subscriptionError",l),"function"==typeof R&&R(),l.includes('"errorType":"Unauthorized"')||l.includes('"errorType":"OperationDisabled"')||n.error(l),[2])}}))}))}})),d.push(b(D,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){R=n,e=t.hubQueryCompletionListener.bind(t,n),l.a.listen("api",e)}))];case 1:return n.sent(),l.a.remove("api",e),[2]}}))}))),[2]}}))}))},a.forEach((function(e){return A(e)})),[2]}}))}))}))})),Promise.all(d).then((function(){return n.next(r.CONNECTED)})),[2]}}))})),function(){Object.keys(y).forEach((function(e){y[e][p.a.CREATE].forEach((function(e){return e.unsubscribe()})),y[e][p.a.UPDATE].forEach((function(e){return e.unsubscribe()})),y[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.B)(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(110),i=n(56),o=n(36),s=n(38),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(58),i=n(56),o=n(38),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(111);Object.defineProperty(t,"convertToBuffer",{enumerable:!0,get:function(){return r.convertToBuffer}});var i=n(112);Object.defineProperty(t,"isEmptyData",{enumerable:!0,get:function(){return i.isEmptyData}});var o=n(113);Object.defineProperty(t,"numToUint8",{enumerable:!0,get:function(){return o.numToUint8}});var s=n(114);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){"use strict";n.d(t,"a",(function(){return a}));var r=n(22),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=new r.a("Parser"),s=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}),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=i(i({},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),o.debug("parse config",e,"to amplifyconfig",n),n},a=function(){function e(){}return e.parseMobilehubConfig=s,e}()},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(126)}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(30))},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}},e}},function(e,t,n){"use strict";var r=n(13),i=n(133),o=n(134),s=n(63),a=n(135),u=n(138),c=n(139),l=n(66);e.exports=function(e){return new Promise((function(t,n){var f=e.data,d=e.headers,h=e.responseType;r.isFormData(f)&&delete d["Content-Type"];var p=new XMLHttpRequest;if(e.auth){var v=e.auth.username||"",y=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";d.Authorization="Basic "+btoa(v+":"+y)}var g=a(e.baseURL,e.url);function m(){if(p){var r="getAllResponseHeaders"in p?u(p.getAllResponseHeaders()):null,o={data:h&&"text"!==h&&"json"!==h?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:r,config:e,request:p};i(t,n,o),p=null}}if(p.open(e.method.toUpperCase(),s(g,e.params,e.paramsSerializer),!0),p.timeout=e.timeout,"onloadend"in p?p.onloadend=m:p.onreadystatechange=function(){p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))&&setTimeout(m)},p.onabort=function(){p&&(n(l("Request aborted",e,"ECONNABORTED",p)),p=null)},p.onerror=function(){n(l("Network Error",e,null,p)),p=null},p.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(l(t,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",p)),p=null},r.isStandardBrowserEnv()){var b=(e.withCredentials||c(g))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;b&&(d[e.xsrfHeaderName]=b)}"setRequestHeader"in p&&r.forEach(d,(function(e,t){void 0===f&&"content-type"===t.toLowerCase()?delete d[t]:p.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(p.withCredentials=!!e.withCredentials),h&&"json"!==h&&(p.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&p.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){p&&(p.abort(),n(e),p=null)})),f||(f=null),p.send(f)}))}},function(e,t,n){"use strict";var r=n(64);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={},i=["url","method","data"],o=["headers","auth","proxy","params"],s=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function u(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 c(i){r.isUndefined(t[i])?r.isUndefined(e[i])||(n[i]=u(void 0,e[i])):n[i]=u(e[i],t[i])}r.forEach(i,(function(e){r.isUndefined(t[e])||(n[e]=u(void 0,t[e]))})),r.forEach(o,c),r.forEach(s,(function(i){r.isUndefined(t[i])?r.isUndefined(e[i])||(n[i]=u(void 0,e[i])):n[i]=u(void 0,t[i])})),r.forEach(a,(function(r){r in t?n[r]=u(e[r],t[r]):r in e&&(n[r]=u(void 0,e[r]))}));var l=i.concat(o).concat(s).concat(a),f=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===l.indexOf(e)}));return r.forEach(f,c),n}},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){"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 c}));var r=n(27);function i(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 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)},s=function(){function e(e,t){var n=this;this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.cookies=function(e,t){return"string"==typeof e?r.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=r.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),i(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]=i(this.cookies[r],e);return n},e.prototype.set=function(e,t,n){var i;"object"==typeof t&&(t=JSON.stringify(t)),this.cookies=o(o({},this.cookies),((i={})[e]=t,i)),this.HAS_DOCUMENT_COOKIE&&(document.cookie=r.serialize(e,t,n)),this._emitChange({name:e,value:t,options:n})},e.prototype.remove=function(e,t){var n=t=o(o({},t),{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=o({},this.cookies),delete this.cookies[e],this.HAS_DOCUMENT_COOKIE&&(document.cookie=r.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}(),a=n(14),u=Object(a.b)().isBrowser,c=function(){function e(e){void 0===e&&(e={}),this.cookies=new s,this.store=u?window.localStorage:Object.create(null),this.cookies=e.req?new s(e.req.headers.cookie):new s,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":u?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}()},function(e,t,n){"use strict";n.d(t,"a",(function(){return O}));for(var r=n(22),i=n(44),o={},s={},a=0;a<256;a++){var u=a.toString(16).toLowerCase();1===u.length&&(u="0"+u),o[a]=u,s[u]=a}function c(e){for(var t="",n=0;n<e.byteLength;n++)t+=o[e[n]];return t}var l=n(8),f=n(158);function d(e){return(d="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 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(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},v=new r.a("Signer"),y=function(e,t){var n=new i.Sha256(e);return n.update(t),n.digestSync()},g=function(e){var t=e||"",n=new i.Sha256;return n.update(t),c(n.digestSync())},m=function(e){return Object.keys(e).map((function(e){return e.toLowerCase()})).sort().join(";")},b=function(e){var t,n,r=Object(l.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":""),m(e.headers),g(e.data)].join("\n")},w=function(e){var t=(Object(l.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]}},S=function(e,t,n){return[e,t,n,"aws4_request"].join("/")},_=function(e,t,n,r){return[e,n,r,g(t)].join("\n")},E=function(e,t,n){v.debug(n);var r=y("AWS4"+e,t),i=y(r,n.region),o=y(i,n.service);return y(o,"aws4_request")},A=function(e,t){return c(y(e,t))},O=function(){function e(){}return e.sign=function(e,t,n){void 0===n&&(n=null),e.headers=e.headers||{};var r=f.a.getDateWithClockOffset().toISOString().replace(/[:\-]|\.\d{3}/g,""),i=r.substr(0,8),o=Object(l.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=b(e);v.debug(s);var a=n||w(e),u=S(i,a.region,a.service),c=_("AWS4-HMAC-SHA256",s,r,u),d=E(t.secret_key,i,a),h=A(d,c),p=function(e,t,n,r,i){return[e+" Credential="+t+"/"+n,"SignedHeaders="+r,"Signature="+i].join(", ")}("AWS4-HMAC-SHA256",t.access_key,u,m(e.headers),h);return e.headers.Authorization=p,e},e.signUrl=function(e,t,n,r){var i="object"===d(e)?e.url:e,o="object"===d(e)?e.method:"GET",s="object"===d(e)?e.body:void 0,a=f.a.getDateWithClockOffset().toISOString().replace(/[:\-]|\.\d{3}/g,""),u=a.substr(0,8),c=Object(l.parse)(i,!0,!0),v=(c.search,p(c,["search"])),y={host:v.host},g=n||w({url:Object(l.format)(v)}),m=g.region,O=g.service,I=S(u,m,O),T=t.session_token&&"iotdevicegateway"!==O,C=h(h(h({"X-Amz-Algorithm":"AWS4-HMAC-SHA256","X-Amz-Credential":[t.access_key,I].join("/"),"X-Amz-Date":a.substr(0,16)},T?{"X-Amz-Security-Token":""+t.session_token}:{}),r?{"X-Amz-Expires":""+r}:{}),{"X-Amz-SignedHeaders":Object.keys(y).join(",")}),x=b({method:o,url:Object(l.format)(h(h({},v),{query:h(h({},v.query),C)})),headers:y,data:s}),P=_("AWS4-HMAC-SHA256",x,a,I),k=E(t.secret_key,u,{region:m,service:O}),N=A(k,P),M=h({"X-Amz-Signature":N},t.session_token&&{"X-Amz-Security-Token":t.session_token});return Object(l.format)({protocol:v.protocol,slashes:!0,hostname:v.hostname,port:v.port,pathname:v.pathname,query:h(h(h({},v.query),C),M)})},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(98)}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(30))},function(e,t,n){"use strict";var r,i,o=n(100);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(107),i=n(108),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(109),t);var r=n(55);Object.defineProperty(t,"Ie11Sha256",{enumerable:!0,get:function(){return r.Sha256}});var i=n(57);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(61),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(61),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(147).Observable},,,,,,,,,function(e,t,n){var r,i,o=n(46),s=n(47),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(46),i=n(47);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){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(49).default||n(49))},function(e,t,n){e.exports=n(101).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(51)(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(51)(e),n(30))},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(105),t.encode=t.stringify=n(106)},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(53),s=n(54),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(53),i=n(54);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(55),i=n(57),o=n(115),s=n(118),a=n(120),u=n(38),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(150),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(116),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(0),i=n(59),o=n(117),s=n(58),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(59),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(119),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(121),t),r.__exportStar(n(122),t),r.__exportStar(n(123),t),r.__exportStar(n(124),t),r.__exportStar(n(125),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(62),o=n(128),s=n(68);function a(e){var t=new o(e),n=i(o.prototype.request,t);return r.extend(n,o.prototype,t),r.extend(n,t),n}var u=a(n(39));u.Axios=o,u.create=function(e){return a(s(u.defaults,e))},u.Cancel=n(69),u.CancelToken=n(142),u.isCancel=n(67),u.all=function(e){return Promise.all(e)},u.spread=n(143),u.isAxiosError=n(144),e.exports=u,e.exports.default=u},function(e,t,n){"use strict";var r=n(13),i=n(63),o=n(129),s=n(130),a=n(68),u=n(140),c=u.validators;function l(e){this.defaults=e,this.interceptors={request:new o,response:new o}}l.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&u.assertOptions(t,{silentJSONParsing:c.transitional(c.boolean,"1.0.0"),forcedJSONParsing:c.transitional(c.boolean,"1.0.0"),clarifyTimeoutError:c.transitional(c.boolean,"1.0.0")},!1);var n=[],r=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(r=r&&t.synchronous,n.unshift(t.fulfilled,t.rejected))}));var i,o=[];if(this.interceptors.response.forEach((function(e){o.push(e.fulfilled,e.rejected)})),!r){var l=[s,void 0];for(Array.prototype.unshift.apply(l,n),l=l.concat(o),i=Promise.resolve(e);l.length;)i=i.then(l.shift(),l.shift());return i}for(var f=e;n.length;){var d=n.shift(),h=n.shift();try{f=d(f)}catch(e){h(e);break}}try{i=s(f)}catch(e){return Promise.reject(e)}for(;o.length;)i=i.then(o.shift(),o.shift());return i},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(131),o=n(67),s=n(39);function a(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return a(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 a(e),t.data=i.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(a(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(39);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(66);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(136),i=n(137);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(141),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={},s=r.version.split(".");function a(e,t){for(var n=t?t.split("."):s,r=e.split("."),i=0;i<3;i++){if(n[i]>r[i])return!0;if(n[i]<r[i])return!1}return!1}i.transitional=function(e,t,n){var i=t&&a(t);function s(e,t){return"[Axios v"+r.version+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,r,a){if(!1===e)throw new Error(s(r," has been removed in "+t));return i&&!o[r]&&(o[r]=!0,console.warn(s(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,a)}},e.exports={isOlderVersion:a,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){e.exports=JSON.parse('{"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}')},function(e,t,n){"use strict";var r=n(69);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;e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},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";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(70),o=n(146),s=n(149),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(70),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 cr})),n.d(t,"DataStoreClass",(function(){return ur})),n.d(t,"initSchema",(function(){return Hn})),n.d(t,"Predicates",(function(){return we.b})),n.d(t,"ModelPredicateCreator",(function(){return we.a})),n.d(t,"ModelSortPredicateCreator",(function(){return Se.a})),n.d(t,"utils",(function(){return lr})),n.d(t,"isSchemaModel",(function(){return fe.w})),n.d(t,"isAssociatedWith",(function(){return fe.l})),n.d(t,"isTargetNameAssociation",(function(){return fe.x})),n.d(t,"isModelAttributeAuth",(function(){return fe.o})),n.d(t,"isModelAttributeKey",(function(){return fe.q})),n.d(t,"isModelAttributePrimaryKey",(function(){return fe.r})),n.d(t,"isModelAttributeCompositeKey",(function(){return fe.p})),n.d(t,"ModelAttributeAuthAllow",(function(){return fe.e})),n.d(t,"ModelAttributeAuthProvider",(function(){return fe.f})),n.d(t,"GraphQLScalarType",(function(){return fe.c})),n.d(t,"isGraphQLScalarType",(function(){return fe.n})),n.d(t,"isModelFieldType",(function(){return fe.s})),n.d(t,"isNonModelFieldType",(function(){return fe.t})),n.d(t,"isEnumFieldType",(function(){return fe.m})),n.d(t,"OpType",(function(){return fe.h})),n.d(t,"isPredicateObj",(function(){return fe.v})),n.d(t,"isPredicateGroup",(function(){return fe.u})),n.d(t,"QueryOne",(function(){return fe.j})),n.d(t,"SortDirection",(function(){return fe.k})),n.d(t,"AuthModeStrategyType",(function(){return fe.a})),n.d(t,"ModelOperation",(function(){return fe.g})),n.d(t,"syncExpression",(function(){return fe.y})),n.d(t,"ProcessName",(function(){return fe.i})),n.d(t,"DISCARD",(function(){return fe.b})),n.d(t,"LimitTimerRaceResolvedValues",(function(){return fe.d}));var r=n(22),i=n(14),o=n(35),s=n(17);function a(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 u(e){return!!e&&!!e[Z]}function c(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)===Q}(e)||Array.isArray(e)||!!e[$]||!!e.constructor[$]||y(e)||g(e))}function l(e,t,n){void 0===n&&(n=!1),0===f(e)?(n?Object.keys:X)(e).forEach((function(r){n&&"symbol"==typeof r||t(r,e[r],e)})):e.forEach((function(n,r){return t(r,n,e)}))}function f(e){var t=e[Z];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:y(e)?2:g(e)?3:0}function d(e,t){return 2===f(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function h(e,t){return 2===f(e)?e.get(t):e[t]}function p(e,t,n){var r=f(e);2===r?e.set(t,n):3===r?(e.delete(t),e.add(n)):e[t]=n}function v(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function y(e){return G&&e instanceof Map}function g(e){return W&&e instanceof Set}function m(e){return e.o||e.t}function b(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=ee(e);delete t[Z];for(var n=X(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 w(e,t){return void 0===t&&(t=!1),_(e)||u(e)||!c(e)||(f(e)>1&&(e.set=e.add=e.clear=e.delete=S),Object.freeze(e),t&&l(e,(function(e,t){return w(t,!0)}),!0)),e}function S(){a(2)}function _(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function E(e){var t=te[e];return t||a(18,e),t}function A(e,t){te[e]||(te[e]=t)}function O(){return H}function I(e,t){t&&(E("Patches"),e.u=[],e.s=[],e.v=t)}function T(e){C(e),e.p.forEach(P),e.p=null}function C(e){e===H&&(H=e.l)}function x(e){return H={p:[],l:H,h:e,m:!0,_:0}}function P(e){var t=e[Z];0===t.i||1===t.i?t.j():t.O=!0}function k(e,t){t._=t.p.length;var n=t.p[0],r=void 0!==e&&e!==n;return t.h.g||E("ES5").S(t,e,r),r?(n[Z].P&&(T(t),a(4)),c(e)&&(e=N(t,e),t.l||j(t,e)),t.u&&E("Patches").M(n[Z],e,t.u,t.s)):e=N(t,n,[]),T(t),t.u&&t.v(t.u,t.s),e!==J?e:void 0}function N(e,t,n){if(_(t))return t;var r=t[Z];if(!r)return l(t,(function(i,o){return M(e,r,t,i,o,n)}),!0),t;if(r.A!==e)return t;if(!r.P)return j(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=4===r.i||5===r.i?r.o=b(r.k):r.o;l(3===r.i?new Set(i):i,(function(t,o){return M(e,r,i,t,o,n)})),j(e,i,!1),n&&e.u&&E("Patches").R(r,n,e.u,e.s)}return r.o}function M(e,t,n,r,i,o){if(u(i)){var s=N(e,i,o&&t&&3!==t.i&&!d(t.D,r)?o.concat(r):void 0);if(p(n,r,s),!u(s))return;e.m=!1}if(c(i)&&!_(i)){if(!e.h.F&&e._<1)return;N(e,i),t&&t.A.l||j(e,i)}}function j(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&w(t,n)}function R(e,t){var n=e[Z];return(n?m(n):e)[t]}function D(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 U(e){e.P||(e.P=!0,e.l&&U(e.l))}function F(e){e.o||(e.o=b(e.t))}function L(e,t,n){var r=y(t)?E("MapSet").N(t,n):g(t)?E("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:O(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=r,o=ne;n&&(i=[r],o=re);var s=Proxy.revocable(i,o),a=s.revoke,u=s.proxy;return r.k=u,r.j=a,u}(t,n):E("ES5").J(t,n);return(n?n.A:O()).p.push(r),r}function B(e){return u(e)||a(22,e),function e(t){if(!c(t))return t;var n,r=t[Z],i=f(t);if(r){if(!r.P&&(r.i<4||!E("ES5").K(r)))return r.t;r.I=!0,n=q(t,i),r.I=!1}else n=q(t,i);return l(n,(function(t,i){r&&h(r.t,t)===i||p(n,t,e(i))})),3===i?new Set(n):n}(e)}function q(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return b(e)}function z(){function e(t){if(!c(t))return t;if(Array.isArray(t))return t.map(e);if(y(t))return new Map(Array.from(t.entries()).map((function(t){return[t[0],e(t[1])]})));if(g(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 d(t,$)&&(n[$]=t[$]),n}function t(t){return u(t)?e(t):t}var n="add";A("Patches",{$:function(t,r){return r.forEach((function(r){for(var i=r.path,o=r.op,s=t,u=0;u<i.length-1;u++){var c=f(s),l=""+i[u];0!==c&&1!==c||"__proto__"!==l&&"constructor"!==l||a(24),"function"==typeof s&&"prototype"===l&&a(24),"object"!=typeof(s=h(s,l))&&a(15,i.join("/"))}var d=f(s),p=e(r.value),v=i[i.length-1];switch(o){case"replace":switch(d){case 2:return s.set(v,p);case 3:a(16);default:return s[v]=p}case n:switch(d){case 1:return s.splice(v,0,p);case 2:return s.set(v,p);case 3:return s.add(p);default:return s[v]=p}case"remove":switch(d){case 1:return s.splice(v,1);case 2:return s.delete(v);case 3:return s.delete(r.value);default:return delete s[v]}default:a(17,o)}})),t},R:function(e,r,i,o){switch(e.i){case 0:case 4:case 2:return function(e,r,i,o){var s=e.t,a=e.o;l(e.D,(function(e,u){var c=h(s,e),l=h(a,e),f=u?d(s,e)?"replace":n:"remove";if(c!==l||"replace"!==f){var p=r.concat(e);i.push("remove"===f?{op:f,path:p}:{op:f,path:p,value:l}),o.push(f===n?{op:"remove",path:p}:"remove"===f?{op:n,path:p,value:t(c)}:{op:"replace",path:p,value:t(c)})}}))}(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===J?void 0:t}),r.push({op:"replace",path:[],value:e.t})}})}var K,H,V="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),G="undefined"!=typeof Map,W="undefined"!=typeof Set,Y="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,J=V?Symbol.for("immer-nothing"):((K={})["immer-nothing"]=!0,K),$=V?Symbol.for("immer-draftable"):"__$immer_draftable",Z=V?Symbol.for("immer-state"):"__$immer_state",Q=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),X="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,ee=Object.getOwnPropertyDescriptors||function(e){var t={};return X(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},te={},ne={get:function(e,t){if(t===Z)return e;var n=m(e);if(!d(n,t))return function(e,t,n){var r,i=D(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||!c(r)?r:r===R(e.t,t)?(F(e),e.o[t]=L(e.A.h,r,e)):r},has:function(e,t){return t in m(e)},ownKeys:function(e){return Reflect.ownKeys(m(e))},set:function(e,t,n){var r=D(m(e),t);if(null==r?void 0:r.set)return r.set.call(e.k,n),!0;if(!e.P){var i=R(m(e),t),o=null==i?void 0:i[Z];if(o&&o.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(v(n,i)&&(void 0!==n||d(e.t,t)))return!0;F(e),U(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!==R(e.t,t)||t in e.t?(e.D[t]=!1,F(e),U(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=m(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(){a(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){a(12)}},re={};l(ne,(function(e,t){re[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),re.deleteProperty=function(e,t){return ne.deleteProperty.call(this,e[0],t)},re.set=function(e,t,n){return ne.set.call(this,e[0],t,n,e[0])};var ie=new(function(){function e(e){var t=this;this.g=Y,this.F=!0,this.produce=function(e,n,r){if("function"==typeof e&&"function"!=typeof n){var i=n;n=e;var o=t;return function(e){var t=this;void 0===e&&(e=i);for(var r=arguments.length,s=Array(r>1?r-1:0),a=1;a<r;a++)s[a-1]=arguments[a];return o.produce(e,(function(e){var r;return(r=n).call.apply(r,[t,e].concat(s))}))}}var s;if("function"!=typeof n&&a(6),void 0!==r&&"function"!=typeof r&&a(7),c(e)){var u=x(t),l=L(t,e,void 0),f=!0;try{s=n(l),f=!1}finally{f?T(u):C(u)}return"undefined"!=typeof Promise&&s instanceof Promise?s.then((function(e){return I(u,r),k(e,u)}),(function(e){throw T(u),e})):(I(u,r),k(s,u))}if(!e||"object"!=typeof e){if((s=n(e))===J)return;return void 0===s&&(s=e),t.F&&w(s,!0),s}a(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){c(e)||a(8),u(e)&&(e=B(e));var t=x(this),n=L(this,e,void 0);return n[Z].C=!0,C(t),n},t.finishDraft=function(e,t){var n=(e&&e[Z]).A;return I(n,t),k(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!Y&&a(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 i=E("Patches").$;return u(e)?i(e,t):this.produce(e,(function(e){return i(e,t.slice(n+1))}))},e}()),oe=ie.produce,se=(ie.produceWithPatches.bind(ie),ie.setAutoFreeze.bind(ie)),ae=(ie.setUseProxies.bind(ie),ie.applyPatches.bind(ie),ie.createDraft.bind(ie),ie.finishDraft.bind(ie),n(34)),ue=n(10),ce=n(15),le=n(4),fe=n(1),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())}))},he=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])}}},pe=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},ve=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(pe(arguments[t]));return e};function ye(e){return"private"!==e.allow||e.provider?"public"!==e.allow||e.provider?e.provider:fe.f.API_KEY:fe.f.USER_POOLS}function ge(e){var t=e.rules,n=e.currentUser,r=new Set;return t.forEach((function(e){switch(e.allow){case fe.e.CUSTOM:e.provider&&e.provider!==fe.f.FUNCTION||r.add(le.c.AWS_LAMBDA);break;case fe.e.GROUPS:case fe.e.OWNER:n&&(e.provider===fe.f.USER_POOLS?r.add(le.c.AMAZON_COGNITO_USER_POOLS):e.provider===fe.f.OIDC&&r.add(le.c.OPENID_CONNECT));break;case fe.e.PRIVATE:n&&(e.provider&&e.provider!==fe.f.USER_POOLS?e.provider===fe.f.IAM&&r.add(le.c.AWS_IAM):r.add(le.c.AMAZON_COGNITO_USER_POOLS));break;case fe.e.PUBLIC:e.provider===fe.f.IAM?r.add(le.c.AWS_IAM):e.provider&&e.provider!==fe.f.API_KEY||r.add(le.c.API_KEY)}})),Array.from(r)}var me=function(e){var t=e.schema,n=e.modelName;return de(void 0,void 0,void 0,(function(){var e,r,i,o;return he(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,ce.a.currentAuthenticatedUser()];case 1:return e=s.sent(),[3,3];case 2:return s.sent(),[3,3];case 3:return(r=t.namespaces.user.models[n].attributes)&&(i=r.find((function(e){return"auth"===e.type}))).properties&&i.properties.rules?(a=i.properties.rules,u=[fe.e.CUSTOM,fe.e.OWNER,fe.e.GROUPS,fe.e.PRIVATE,fe.e.PUBLIC],c=[fe.f.FUNCTION,fe.f.USER_POOLS,fe.f.OIDC,fe.f.IAM,fe.f.API_KEY],o=ve(a).sort((function(e,t){return e.allow===t.allow?c.indexOf(ye(e))-c.indexOf(ye(t)):u.indexOf(e.allow)-u.indexOf(t.allow)})),[2,ge({currentUser:e,rules:o})]):[2,[]]}var a,u,c}))}))},be=function(){return[]},we=n(5),Se=n(52),_e=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}(),Ee=n(74),Ae=n.n(Ee),Oe=n(2);let Ie,Te;const Ce=new WeakMap,xe=new WeakMap,Pe=new WeakMap,ke=new WeakMap,Ne=new WeakMap;let Me={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return xe.get(e);if("objectStoreNames"===t)return e.objectStoreNames||Pe.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return De(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function je(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(Te||(Te=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(Ue(this),t),De(Ce.get(this))}:function(...t){return De(e.apply(Ue(this),t))}:function(t,...n){const r=e.call(Ue(this),t,...n);return Pe.set(r,t.sort?t.sort():[t]),De(r)}}function Re(e){return"function"==typeof e?je(e):(e instanceof IDBTransaction&&function(e){if(xe.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)});xe.set(e,t)}(e),t=e,(Ie||(Ie=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,Me):e);var t}function De(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(De(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",o)});return t.then(t=>{t instanceof IDBCursor&&Ce.set(t,e)}).catch(()=>{}),Ne.set(t,e),t}(e);if(ke.has(e))return ke.get(e);const t=Re(e);return t!==e&&(ke.set(e,t),Ne.set(t,e)),t}const Ue=e=>Ne.get(e);function Fe(e,t,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){const s=indexedDB.open(e,t),a=De(s);return r&&s.addEventListener("upgradeneeded",e=>{r(De(s.result),e.oldVersion,e.newVersion,De(s.transaction))}),n&&s.addEventListener("blocked",()=>n()),a.then(e=>{o&&e.addEventListener("close",()=>o()),i&&e.addEventListener("versionchange",()=>i())}).catch(()=>{}),a}function Le(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",()=>t()),De(n).then(()=>{})}const Be=["get","getKey","getAll","getAllKeys","count"],qe=["put","add","delete","clear"],ze=new Map;function Ke(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(ze.get(t))return ze.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=qe.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!Be.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 ze.set(t,o),o}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)}Me=(e=>({...e,get:(t,n,r)=>Ke(t,n)||e.get(t,n,r),has:(t,n)=>!!Ke(t,n)||e.has(t,n)}))(Me);var 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())}))},Ge=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])}}},We=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 Ye?Ye(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)}))}}},Ye=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.")},Je=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},$e=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Je(arguments[t]));return e},Ze=new r.a("DataStore"),Qe=new(function(){function e(){this.dbName="amplify-datastore"}return e.prototype.checkPrivate=function(){return Ve(this,void 0,void 0,(function(){return Ge(this,(function(e){switch(e.label){case 0:return[4,Object(Oe.w)().then((function(e){return e}))];case 1:return e.sent()?(Ze.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 Ve(this,void 0,void 0,(function(){var o,s,a=this;return Ge(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,Fe(this.dbName,2,{upgrade:function(t,n,r,i){return Ve(a,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h,p,v,y,g=this;return Ge(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=Ye(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),Ze.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=Je(e,2)[1];return!o.has(t)})).forEach((function(e){var r=Je(e,2),i=r[0],o=r[1];g.createObjectStoreForModel(t,n,o,i)}))})),[3,15];case 14:throw p=m.sent(),Ze.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 Ve(this,void 0,void 0,(function(){var n,r;return Ge(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 Ve(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b,w,S,_,E,A,O,I,T,C,x,P=this;return Ge(this,(function(k){switch(k.label){case 0:return[4,this.checkPrivate()];case 1:return k.sent(),i=Object.getPrototypeOf(e).constructor,o=this.getStorenameForModel(i),s=Object(Oe.A)(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=P.getStorename(a,t);return u.add(i),{storeName:i,item:n,instance:r}})),l=this.db.transaction($e([o],Array.from(u.values())),"readwrite"),f=l.objectStore(o),[4,this._get(f,e.id)];case 2:if(d=k.sent(),t&&d&&(h=we.a.getPredicates(t),p=h.predicates,v=h.type,!Object(Oe.B)(d,v,p)))throw y="Conditional update failed",Ze.error(y,{model:d,condition:p}),new Error(y);g=[],k.label=3;case 3:k.trys.push([3,11,12,17]),m=We(c),k.label=4;case 4:return[4,m.next()];case 5:return(b=k.sent()).done?[3,10]:(w=b.value,S=w.storeName,_=w.item,E=w.instance,A=l.objectStore(S),O=_.id,[4,this._get(A,O)]);case 6:return I=k.sent(),T=void 0===I?fe.h.INSERT:fe.h.UPDATE,O!==e.id&&T!==fe.h.INSERT?[3,9]:[4,A.index("byId").getKey(_.id)];case 7:return C=k.sent(),[4,A.put(_,C)];case 8:k.sent(),g.push([E,T]),k.label=9;case 9:return[3,4];case 10:return[3,17];case 11:return x=k.sent(),n={error:x},[3,17];case 12:return k.trys.push([12,,15,16]),b&&!b.done&&(r=m.return)?[4,r.call(m)]:[3,14];case 13:k.sent(),k.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 k.sent(),[2,g]}}))}))},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,x,P,k,N,M=this;return Ge(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)}))];g=this.db.transaction($e(v),"readonly"),j.label=1;case 1:j.trys.push([1,34,35,40]),m=We(p),j.label=2;case 2:return[4,m.next()];case 3:if((b=j.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:j.trys.push([4,10,11,16]),r=We(n),j.label=5;case 5:return[4,r.next()];case 6:return(i=j.sent()).done?[3,9]:(x=i.value,T=x[E]?E:S,x[T]?[4,this._get(O,x[T])]:[3,9]);case 7:P=j.sent(),x[S]=P&&this.modelInstanceCreator(I,P),j.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return C=j.sent(),c={error:C},[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=We(n),j.label=18;case 18:return[4,o.next()];case 19:return(s=j.sent()).done?[3,22]:(x=s.value)[E]?[4,this._get(O,x[E])]:[3,21];case 20:P=j.sent(),x[S]=P&&this.modelInstanceCreator(I,P),delete x[E],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(Oe.g)(w.relationType),[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]),b&&!b.done&&(u=m.return)?[4,u.call(m)]:[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 Ge(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&&we.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 Ge(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 Ve(this,void 0,void 0,(function(){return Ge(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 Ve(this,void 0,void 0,(function(){return Ge(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(fe.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 Ge(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(Oe.B)(e,r,n)})):i]}}))}))},e.prototype.inMemoryPagination=function(e,t){if(t&&e.length>1){if(t.sort){var n=Se.a.getPredicates(t.sort);if(n.length){var r=Object(Oe.z)(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 Ve(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l;return Ge(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=fe.j.FIRST),Ve(this,void 0,void 0,(function(){var n,r,i;return Ge(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===fe.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 Ve(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return Ge(this,(function(g){switch(g.label){case 0:return[4,this.checkPrivate()];case 1:return g.sent(),n=[],Object(Oe.t)(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",Ze.warn(p,{model:i}),[2,[[i],[]]];if(f=we.a.getPredicates(t),d=f.predicates,h=f.type,!Object(Oe.B)(l,h,d))throw p="Conditional update failed",Ze.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 Ve(this,void 0,void 0,(function(){var a,u,c,l,f,d,h,p,v,y,g,m;return Ge(this,(function(b){switch(b.label){case 0:a=e.map((function(e){return e.storeName})),u=this.db.transaction($e(a),"readwrite"),b.label=1;case 1:b.trys.push([1,22,23,28]),t=We(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=We(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"!==He(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 Ve(this,void 0,void 0,(function(){var g,m,b,w,S,_,E,A,O,I,T,C,x,P,k=this;return Ge(this,(function(N){switch(N.label){case 0:N.trys.push([0,35,36,41]),o=We(e),N.label=1;case 1:return[4,o.next()];case 2:if((s=N.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(Oe.h)(this.schema.namespaces[r].relationships[b].relationTypes,n)||Object(Oe.i)(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:N.trys.push([3,10,11,16]),a=We(t),N.label=4;case 4:return[4,a.next()];case 5:return(u=N.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=N.sent(),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,O?[O]:[],b,r,i)];case 7:N.sent(),N.label=8;case 8:return[3,4];case 9:return[3,16];case 10:return I=N.sent(),h={error:I},[3,16];case 11:return N.trys.push([11,,14,15]),u&&!u.done&&(p=a.return)?[4,p.call(a)]:[3,13];case 12:N.sent(),N.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:N.trys.push([17,24,25,30]),c=We(t),N.label=18;case 18:return[4,c.next()];case 19:return(l=N.sent()).done?[3,23]:(T=l.value,[4,this.db.transaction(S,"readwrite").objectStore(S).index(_).getAll(T.id)]);case 20:return C=N.sent(),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,C,b,r,i)];case 21:N.sent(),N.label=22;case 22:return[3,18];case 23:return[3,30];case 24:return x=N.sent(),v={error:x},[3,30];case 25:return N.trys.push([25,,28,29]),l&&!l.done&&(y=c.return)?[4,y.call(c)]:[3,27];case 26:N.sent(),N.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(Oe.g)(m),[3,33];case 33:return[3,1];case 34:return[3,41];case 35:return P=N.sent(),f={error:P},[3,41];case 36:return N.trys.push([36,,39,40]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,38];case 37:N.sent(),N.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 k.modelInstanceCreator(k.getModelConstructorByModelName(r,n),e)}))}),[2]}}))}))},e.prototype.clear=function(){return Ve(this,void 0,void 0,(function(){return Ge(this,(function(e){switch(e.label){case 0:return[4,this.checkPrivate()];case 1:return e.sent(),this.db.close(),[4,Le(this.dbName)];case 2: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,h;return Ge(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 Ge(this,(function(l){switch(l.label){case 0:return r=Object(Oe.A)(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?fe.h.UPDATE:fe.h.INSERT]),[4,o.put(c,u)]);case 2:return l.sent(),[3,5];case 3:return n.push([t,fe.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=Ye(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 Ve(this,void 0,void 0,(function(){var i;return Ge(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}()),Xe=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())}))},et=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])}}},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(){var e=this;this.db=new Map,this.getAllKeys=function(){return Xe(e,void 0,void 0,(function(){return et(this,(function(e){return[2,Array.from(this.db.keys())]}))}))},this.multiGet=function(t){return Xe(e,void 0,void 0,(function(){var e=this;return et(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 Xe(e,void 0,void 0,(function(){var e=this;return et(this,(function(r){return t.forEach((function(t){return e.db.delete(t)})),n(),[2]}))}))},this.multiSet=function(t,n){return Xe(e,void 0,void 0,(function(){var e=this;return et(this,(function(r){return t.forEach((function(t){var n=tt(t,2),r=n[0],i=n[1];e.setItem(r,i)})),n(),[2]}))}))},this.setItem=function(t,n){return Xe(e,void 0,void 0,(function(){return et(this,(function(e){return[2,this.db.set(t,n)]}))}))},this.removeItem=function(t){return Xe(e,void 0,void 0,(function(){return et(this,(function(e){return[2,this.db.delete(t)]}))}))},this.getItem=function(t){return Xe(e,void 0,void 0,(function(){return et(this,(function(e){return[2,this.db.get(t)]}))}))}};var rt=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())}))},it=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])}}},ot=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.")},st=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},at=new Map,ut=function(){function e(){this._collectionInMemoryIndex=new Map,this.storage=new nt}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 at.has(e)||at.set(e,Object(Oe.x)()),at.get(e)},e.prototype.init=function(){return rt(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 it(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=ot(e),r=n.next(),w.label=3;case 3:return r.done?[3,11]:(i=r.value,o=st(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 rt(this,void 0,void 0,(function(){var n,r;return it(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 rt(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,S,_,E=this;return it(this,(function(A){switch(A.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=ot(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)(),m=this.getKeyForItem(e,f,h),s.push(m),a[m]={ulid:h,model:l},d?i.add(m):o.add(m)}catch(e){b={error:e}}finally{try{c&&!c.done&&(w=u.return)&&w.call(u)}finally{if(b)throw b.error}}return[4,this.storage.multiGet(s)];case 1:return p=A.sent(),v=p.filter((function(e){return!!st(e,2)[1]})).reduce((function(e,t){var n=st(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)})),E.storage.multiRemove(n,(function(n){n&&n.length>0?t(n):e()}))}else e()}))];case 2:return A.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)})),E.storage.multiSet(n,(function(n){n&&n.length>0?t(n):e()}))}else e()}))];case 3:A.sent();try{for(y=ot(s),g=y.next();!g.done;g=y.next())m=g.value,i.has(m)&&v.has(m)?n.push([a[m].model,fe.h.DELETE]):o.has(m)&&n.push([a[m].model,v.has(m)?fe.h.UPDATE:fe.h.INSERT])}catch(e){S={error:e}}finally{try{g&&!g.done&&(_=y.return)&&_.call(y)}finally{if(S)throw S.error}}return[2,n]}}))}))},e.prototype.get=function(e,t){return rt(this,void 0,void 0,(function(){var n,r,i;return it(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 rt(this,void 0,void 0,(function(){var n,r,i,o,s,a,u;return it(this,(function(c){switch(c.label){case 0:return n=this.getCollectionIndex(t),r=st(e===fe.j.FIRST?function(){var e,t,r,i,o;try{for(var s=ot(n),a=s.next();!a.done;a=s.next()){i=(r=st(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=ot(n),a=s.next();!a.done;a=s.next())i=(r=st(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 rt(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 it(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=ot(n),h=d.next();!h.done&&(p=st(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 st(e,2)[1]})).map((function(e){var t=st(e,2)[1];return JSON.parse(t)}))]}}))}))},e.prototype.delete=function(e,t){return rt(this,void 0,void 0,(function(){var n,r;return it(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 rt(this,void 0,void 0,(function(){var e,t;return it(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 ct(e){return(ct="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 lt,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){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 pt?pt(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)}))}}},pt=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.")},vt=new r.a("DataStore"),yt=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 ft(this,void 0,void 0,(function(){var i,o=this;return dt(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 ut,[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 ft(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b,w,S,_,E,A,O,I=this;return dt(this,(function(T){switch(T.label){case 0:return i=Object.getPrototypeOf(e).constructor,o=this.getStorenameForModel(i),s=Object(Oe.A)(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=I.getStorename(a,t);return u.add(i),{storeName:i,item:n,instance:r}})),[4,this.db.get(e.id,o)];case 1:if(l=T.sent(),t&&l&&(f=we.a.getPredicates(t),d=f.predicates,h=f.type,!Object(Oe.B)(l,h,d)))throw p="Conditional update failed",vt.error(p,{model:l,condition:d}),new Error(p);v=[],T.label=2;case 2:T.trys.push([2,9,10,15]),y=ht(c),T.label=3;case 3:return[4,y.next()];case 4:return(g=T.sent()).done?[3,8]:(m=g.value,b=m.storeName,w=m.item,S=m.instance,_=w.id,[4,this.db.get(_,b)]);case 5:return E=T.sent(),A=E?fe.h.UPDATE:fe.h.INSERT,_!==e.id&&A!==fe.h.INSERT?[3,7]:[4,this.db.save(w,b)];case 6:T.sent(),v.push([S,A]),T.label=7;case 7:return[3,3];case 8:return[3,15];case 9:return O=T.sent(),n={error:O},[3,15];case 10:return T.trys.push([10,,13,14]),g&&!g.done&&(r=y.return)?[4,r.call(y)]:[3,12];case 11:T.sent(),T.label=12;case 12:return[3,14];case 13:if(n)throw n.error;return[7];case 14:return[7];case 15:return[2,v]}}))}))},e.prototype.load=function(e,t,n){var r,i,o,s,a,u,c,l,f,d;return ft(this,void 0,void 0,(function(){var h,p,v,y,g,m,b,w,S,_,E,A,O,I,T,C,x,P,k,N=this;return dt(this,(function(M){switch(M.label){case 0:if(h=this.schema.namespaces[e],p=h.relationships[t].relationTypes,v=p.map((function(t){var n=t.modelName;return N.getStorename(e,n)})),y=this.getModelConstructorByModelName(e,t),0===v.length)return[2,n.map((function(e){return N.modelInstanceCreator(y,e)}))];M.label=1;case 1:M.trys.push([1,34,35,40]),g=ht(p),M.label=2;case 2:return[4,g.next()];case 3:if((m=M.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:M.trys.push([4,10,11,16]),r=ht(n),M.label=5;case 5:return[4,r.next()];case 6:return(i=M.sent()).done?[3,9]:(C=i.value,I=C[_]?_:w,C[I]?[4,this.db.get(C[I],A)]:[3,9]);case 7:x=M.sent(),C[w]=x&&this.modelInstanceCreator(O,x),M.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return T=M.sent(),c={error:T},[3,16];case 11:return M.trys.push([11,,14,15]),i&&!i.done&&(l=r.return)?[4,l.call(r)]:[3,13];case 12:M.sent(),M.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:M.trys.push([17,23,24,29]),o=ht(n),M.label=18;case 18:return[4,o.next()];case 19:return(s=M.sent()).done?[3,22]:(C=s.value)[_]?[4,this.db.get(C[_],A)]:[3,21];case 20:x=M.sent(),C[w]=x&&this.modelInstanceCreator(O,x),delete C[_],M.label=21;case 21:return[3,18];case 22:return[3,29];case 23:return P=M.sent(),f={error:P},[3,29];case 24:return M.trys.push([24,,27,28]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,26];case 25:M.sent(),M.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(Oe.g)(E),[3,32];case 32:return[3,2];case 33:return[3,40];case 34:return k=M.sent(),a={error:k},[3,40];case 35:return M.trys.push([35,,38,39]),m&&!m.done&&(u=g.return)?[4,u.call(g)]:[3,37];case 36:M.sent(),M.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 N.modelInstanceCreator(y,e)}))]}}))}))},e.prototype.query=function(e,t,n){return ft(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l=this;return dt(this,(function(f){switch(f.label){case 0:return r=this.getStorenameForModel(e),i=this.namespaceResolver(e),o=t&&we.a.getPredicates(t),s=o&&this.idFromPredicate(o),a=n&&n.sort,u=n&&n.limit,[4,ft(l,void 0,void 0,(function(){var e,t,i;return dt(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 ft(this,void 0,void 0,(function(){return dt(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 ft(this,void 0,void 0,(function(){return dt(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(fe.v)(e)&&"id"===e.field&&"eq"===e.operator}));return n&&n.operand},e.prototype.filterOnPredicate=function(e,t){return ft(this,void 0,void 0,(function(){var n,r,i;return dt(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(Oe.B)(e,r,n)})):i]}}))}))},e.prototype.inMemoryPagination=function(e,t){if(t&&e.length>1){if(t.sort){var n=Se.a.getPredicates(t.sort);if(n.length){var r=Object(Oe.z)(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=fe.j.FIRST),ft(this,void 0,void 0,(function(){var n,r;return dt(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 ft(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p;return dt(this,(function(v){switch(v.label){case 0:return n=[],Object(Oe.t)(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",vt.warn(d,{model:i}),[2,[[i],[]]];if(c=we.a.getPredicates(t),l=c.predicates,f=c.type,!Object(Oe.B)(u,f,l))throw d="Conditional update failed",vt.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 ft(this,void 0,void 0,(function(){var a,u,c,l,f,d,h,p,v;return dt(this,(function(y){switch(y.label){case 0:y.trys.push([0,17,18,23]),t=ht(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=ht(c),y.label=4;case 4:return[4,l.next()];case 5:return(f=y.sent()).done?[3,8]:(d=f.value)?"object"!==ct(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 ft(this,void 0,void 0,(function(){var g,m,b,w,S,_,E,A,O,I,T,C,x,P,k,N=this;return dt(this,(function(M){switch(M.label){case 0:M.trys.push([0,35,36,41]),o=ht(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,b=g.modelName,w=g.targetName,S=this.getStorename(r,b),_=Object(Oe.h)(this.schema.namespaces[r].relationships[b].relationTypes,n)||Object(Oe.i)(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=ht(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.getAll(S)]:[3,9]);case 6:return C=M.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: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=ht(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.getAll(S)]);case 20:return C=M.sent(),x=C.filter((function(e){return e[_]===T.id})),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,x,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(Oe.g)(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 ft(this,void 0,void 0,(function(){return dt(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 ft(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d;return dt(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(Oe.A)(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=pt(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}()),gt=function(){return Object(i.b)().isBrowser&&window.indexedDB||Object(i.c)()&&self.indexedDB?Qe:yt},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=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},_t=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},Et=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.")},At=new r.a("DataStore"),Ot=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||gt(),this.pushStream=new Ae.a}return e.getNamespace=function(){return{name:Oe.c,relationships:{},enums:{},models:{},nonModels:{}}},e.prototype.init=function(){return bt(this,void 0,void 0,(function(){var e,t;return wt(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 At.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 bt(this,void 0,void 0,(function(){var i,o=this;return wt(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=_t(s,2),c=u[0],l=u[1],f=!!n;if(l===fe.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:we.a.getPredicates(t,!1),savedElement:c})})),[2,i]}}))}))},e.prototype.delete=function(e,t,n){return bt(this,void 0,void 0,(function(){var r,i,o,s,a=this;return wt(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=_t.apply(void 0,[u.sent(),2]),i=s[0],r=s[1],o=new Set(i.map((function(e){return e.id}))),Object(Oe.t)(e)||Array.isArray(r)||(r=[r]),r.forEach((function(r){var i,s=Object.getPrototypeOf(r).constructor;Object(Oe.t)(e)||(i=o.has(r.id)?we.a.getPredicates(t,!1):void 0),a.pushStream.next({model:s,opType:fe.h.DELETE,element:r,mutator:n,condition:i})})),[2,[i,r]]}}))}))},e.prototype.query=function(e,t,n){return bt(this,void 0,void 0,(function(){return wt(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=fe.j.FIRST),bt(this,void 0,void 0,(function(){return wt(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=we.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 St(e,["mutator"])}));return r||(u=u.filter((function(t){var n=t.model,r=t.element;return e===n&&(!a||Object(Oe.B)(r,s,o))}))),u},e.prototype.clear=function(e){return void 0===e&&(e=!0),bt(this,void 0,void 0,(function(){return wt(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 bt(this,void 0,void 0,(function(){var r,i=this;return wt(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=_t(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=_t(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,v=h.compositeKeys,y=void 0===v?[]:v;if(c.forEach((function(e){var n,r,i,o,s,c=Object(fe.x)(null===(s=d[e])||void 0===s?void 0:s.association)||e;if(!Object(Oe.C)(a[c],t[c])){u[c]=void 0===t[c]?null:t[c];try{for(var l=Et(y),f=l.next();!f.done;f=l.next()){var h=f.value;if(h.has(c))try{for(var p=(i=void 0,Et(h)),v=p.next();!v.done;v=p.next()){var g=v.value;u[g]=t[g]}}catch(e){i={error:e}}finally{try{v&&!v.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 g=Et(p),m=g.next();!m.done;m=g.next()){var b=m.value;u[b]=t[b]}}catch(e){r={error:e}}finally{try{m&&!m.done&&(i=g.return)&&i.call(g)}finally{if(r)throw r.error}}if(0===Object.keys(u).length)return null;var w=t.id,S=t._version,_=t._lastChangedAt,E=t._deleted;return mt(mt({},u),{id:w,_version:S,_lastChangedAt:_,_deleted:E})},e}(),It=function(){function e(e,t,n,r,i,o){this.mutex=new _e,this.storage=new Ot(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 bt(this,void 0,void 0,(function(){return wt(this,(function(i){return[2,this.runExclusive((function(i){return i.save(e,t,n,r)}))]}))}))},e.prototype.delete=function(e,t,n){return bt(this,void 0,void 0,(function(){return wt(this,(function(r){return[2,this.runExclusive((function(r){if(Object(Oe.t)(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 bt(this,void 0,void 0,(function(){return wt(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=fe.j.FIRST),bt(this,void 0,void 0,(function(){return wt(this,(function(n){return[2,this.runExclusive((function(n){return n.queryOne(e,t)}))]}))}))},e.getNamespace=function(){return Ot.getNamespace()},e.prototype.observe=function(e,t,n){return this.storage.observe(e,t,n)},e.prototype.clear=function(){return bt(this,void 0,void 0,(function(){return wt(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 bt(this,void 0,void 0,(function(){return wt(this,(function(e){return[2,this.storage.init()]}))}))},e}(),Tt=n(16),Ct=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.")},xt=(new(function(){function e(){}return e.prototype.networkMonitor=function(t){if(Object(i.b)().isNode)return ue.a.from([{online:!0}]);var n=Object(i.c)()?self:window;return new ue.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=Ct(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(),Pt=function(){return(Pt=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)},kt=(new r.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 ue.a((function(t){return e.observer=t,e.subscription=xt.subscribe((function(n){var r=n.online;e.connectionStatus.online=r;var i=Pt({},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=Pt({},e.connectionStatus);e.observer.next(t)}),5e3))},e}()),Nt=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())}))},Mt=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])}}},jt=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},Rt=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.")},Dt=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(jt(arguments[t]));return e},Ut=function(){function e(e,t){this.outbox=e,this.ownSymbol=t}return e.prototype.merge=function(e,t){return Nt(this,void 0,void 0,(function(){var n,r,i,o,s;return Mt(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=fe.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=jt.apply(void 0,[a.sent(),1]),s=jt(o[0],2),n=s[1],a.label=5;case 5:return[2,n]}}))}))},e.prototype.mergePage=function(e,t,n){return Nt(this,void 0,void 0,(function(){var r,i,o,s,a,u,c;return Mt(this,(function(l){switch(l.label){case 0:r=new Map;try{for(i=Rt(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=Dt(r.values()),[4,e.batchSave(t,a,this.ownSymbol)];case 1:return[2,l.sent()]}}))}))},e}(),Ft=n(3),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)},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())}))},qt=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])}}},zt=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},Kt=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},Ht=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 Bt(this,void 0,void 0,(function(){var n=this;return qt(this,(function(r){return e.runExclusive((function(e){return Bt(n,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f=this;return qt(this,(function(d){switch(d.label){case 0:return n=this.schema.namespaces[Oe.d].models.MutationEvent,r=we.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=Kt.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!==Ft.a.CREATE?[3,8]:s!==Ft.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 Bt(this,void 0,void 0,(function(){var r;return qt(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 Bt(this,void 0,void 0,(function(){var t;return qt(this,(function(n){switch(n.label){case 0:return[4,e.queryOne(this.MutationEvent,fe.j.FIRST)];case 1:return t=n.sent(),this.inProgressMutationEventId=t?t.id:void 0,[2,t]}}))}))},e.prototype.getForModel=function(e,t){return Bt(this,void 0,void 0,(function(){var n;return qt(this,(function(r){switch(r.label){case 0:return n=this.schema.namespaces[Oe.d].models.MutationEvent,[4,e.query(this.MutationEvent,we.a.createFromExisting(n,(function(e){return e.modelId("eq",t.id)})))];case 1:return[2,r.sent()]}}))}))},e.prototype.getModelIds=function(e){return Bt(this,void 0,void 0,(function(){var t,n;return qt(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 Bt(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p,v=this;return qt(this,(function(y){switch(y.label){case 0:return n.operation!==r?[2]:(i=t._version,o=t._lastChangedAt,t._deleted,s=zt(t,["_version","_lastChangedAt","_deleted"]),a=this.removeTimestampFields(n.model,s),(u=JSON.parse(n.data))?(u._version,u._lastChangedAt,u._deleted,c=zt(u,["_version","_lastChangedAt","_deleted"]),l=this.removeTimestampFields(n.model,c),Object(Oe.C)(a,l,!0)?(f=this.schema.namespaces[Oe.d].models.MutationEvent,d=we.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=Lt(Lt({},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 Bt(v,void 0,void 0,(function(){return qt(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=zt(n,["_version","id","_lastChangedAt","_deleted"]),u=JSON.parse(t.data),c=(u.id,u._version,u._lastChangedAt,u._deleted,zt(u,["id","_version","_lastChangedAt","_deleted"])),l=JSON.stringify(Lt(Lt({id:i,_version:r,_lastChangedAt:o,_deleted:s},a),c));return this.modelInstanceCreator(this.MutationEvent,Lt(Lt({},t),{data:l}))},e.prototype.removeTimestampFields=function(e,t){var n,r,i="createdAt",o="updatedAt",s=null===(n=this.schema.namespaces[Oe.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}(),Vt=n(20),Gt=n(157),Wt=n(25),Yt=function(){return(Yt=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)},Jt=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())}))},$t=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])}}},Zt=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},Qt=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},Xt=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.")},en=new r.a("DataStore"),tn=function(){function e(e,t,n,r,i,o,s,a,u,c){void 0===s&&(s={}),this.schema=e,this.storage=t,this.userClasses=n,this.outbox=r,this.modelInstanceCreator=i,this.MutationEvent=o,this.amplifyConfig=s,this.authModeStrategy=a,this.errorHandler=u,this.conflictHandler=c,this.typeQuery=new WeakMap,this.processing=!1,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=Qt(Object(Ft.b)(t,n,"CREATE"),1)[0],i=Qt(Object(Ft.b)(t,n,"UPDATE"),1)[0],o=Qt(Object(Ft.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 ue.a((function(t){return e.observer=t,e.resume(),function(){e.pause()}}))},e.prototype.resume=function(){return Jt(this,void 0,void 0,(function(){var e,t,n,r,i,o=this;return $t(this,(function(s){switch(s.label){case 0:if(this.processing||!this.isReady())return[2];this.processing=!0,t=Oe.e,n=function(){var n,i,s,a,u,c,l,f,d,h,p,v,y,g,m,b;return $t(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(Ft.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 Jt(o,void 0,void 0,(function(){var r,o;return $t(this,(function(c){switch(c.label){case 0:return c.trys.push([0,2,,4]),en.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(),en.debug("Mutation sent successfully with authMode: "+h[p]),[2,r];case 2:if(o=c.sent(),++p>=h.length)throw en.debug("Mutation failed with authMode: "+h[p-1]),o;return en.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=Qt.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]:(en.debug("done retrying"),[4,r.storage.runExclusive((function(e){return Jt(o,void 0,void 0,(function(){return $t(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 Jt(o,void 0,void 0,(function(){return $t(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 Jt(this,void 0,void 0,(function(){var c=this;return $t(this,(function(l){switch(l.label){case 0:return[4,Object(Gt.d)((function(t,n,r,i,o,s,a){return Jt(c,void 0,void 0,(function(){var c,l,f,d,h,p,v,y,g,m,b,w,S,_,E,A,O,I,T,C,x,P,k,N,M,j,R;return $t(this,(function(D){switch(D.label){case 0:return c=Qt(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(Ft.i)(u,this.amplifyConfig)];case 1:v=D.sent(),y={query:l,variables:f,authMode:u,authToken:v},g=0,m=this.opTypeFromTransformerOperation(n),D.label=2;case 2:return D.trys.push([2,4,,20]),[4,Vt.a.graphql(y)];case 3:return[2,[D.sent(),h,p]];case 4:if(!((b=D.sent()).errors&&b.errors.length>0))return[3,18];if(w=Qt(b.errors,1),S=w[0],_=S.originalError,E=(void 0===_?{}:_).code,A=void 0===E?null:E,"Unauthorized"===S.errorType)throw new Gt.a("Unauthorized");if("Network Error"===S.message||"ECONNABORTED"===A){if(!this.processing)throw new Gt.a("Offline");throw new Error("Network Error")}return"ConflictUnhandled"!==S.errorType?[3,13]:(g++,O=void 0,g>10?(O=fe.b,[3,8]):[3,5]);case 5:return D.trys.push([5,7,,8]),[4,this.conflictHandler({modelConstructor:o,localModel:this.modelInstanceCreator(o,f.input),remoteModel:this.modelInstanceCreator(o,S.data),operation:m,attempts:g})];case 6:return O=D.sent(),[3,8];case 7:return I=D.sent(),en.warn("conflict trycatch",I),[3,20];case 8:return O!==fe.b?[3,11]:(T=Qt(Object(Ft.b)(this.schema.namespaces[e],p,"GET"),1),C=Qt(T[0],3),x=C[1],P=C[2],[4,Object(Ft.i)(u,this.amplifyConfig)]);case 9:return k=D.sent(),[4,Vt.a.graphql({query:P,variables:{id:f.input.id},authMode:u,authToken:k})];case 10:return[2,[D.sent(),x,p]];case 11:return N=this.schema.namespaces[e],M=Object(Ft.d)(N.relationships,p,m,o,O,d,s,this.modelInstanceCreator,a.id),[4,this.storage.save(M)];case 12:throw D.sent(),new Gt.a("RetryMutation");case 13:return D.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:S.message,operation:n,errorType:Object(Wt.a)(S),errorInfo:S.errorInfo,process:fe.i.mutate,cause:S,remoteModel:S.data?this.modelInstanceCreator(o,S.data):null})];case 14:return D.sent(),[3,17];case 15:return j=D.sent(),en.warn("Mutation error handler failed with:",j),[3,17];case 16:return[2,S.data?[{data:(R={},R[h]=S.data,R)},h,p]:[]];case 17:return[3,19];case 18:throw new Gt.a(b);case 19:return[3,20];case 20:if(y)return[3,2];D.label=21;case 21:return[2]}}))}))}),[t,n,r,i,o,s,a],rn)];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=Qt(c.find((function(e){return Qt(e,1)[0]===n})),3),f=l[1],d=l[2],h=JSON.parse(r),p=h._version,v=Zt(h,["_version"]),y={};if(u&&u.length)try{for(var g=Xt(u),m=g.next();!m.done;m=g.next()){var b=m.value;y[b]=v[b]}}catch(e){o={error:e}}finally{try{m&&!m.done&&(s=g.return)&&s.call(g)}finally{if(o)throw o.error}}else y.id=v.id;var w=n===Ft.a.DELETE?y:Object.values(a.fields).filter((function(e){var t=e.name,r=e.type,i=e.association;return Object(fe.s)(r)?!(!Object(fe.x)(i)||"BELONGS_TO"!==i.connectionType):n!==Ft.a.UPDATE||v.hasOwnProperty(t)})).map((function(e){var t=e.name,n=e.type,r=e.association,i=t,o=v[t];return Object(fe.s)(n)&&Object(fe.x)(r)&&(i=r.targetName,o=v[i]),[i,o]})).reduce((function(e,t){var n=Qt(t,2),r=n[0],i=n[1];return e[r]=i,e}),{}),S=Yt(Yt({},w),{_version:p}),_=JSON.parse(i);return[d,Yt({input:S},n===Ft.a.CREATE?{}:{condition:Object.keys(_).length>0?_:null}),_,f,a]},e.prototype.opTypeFromTransformerOperation=function(e){switch(e){case Ft.a.CREATE:return fe.h.INSERT;case Ft.a.DELETE:return fe.h.DELETE;case Ft.a.UPDATE:return fe.h.UPDATE;case Ft.a.GET:break;default:Object(Oe.g)(e)}},e.prototype.pause=function(){this.processing=!1},e}(),nn=Object(Gt.b)(3e5),rn=function(e,t,n){var r=nn(e);return!1===r&&"Network Error"===(null==n?void 0:n.message)?3e5:r},on=n(45),sn=function(){return(sn=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)},an=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())}))},un=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])}}},cn=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},ln=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.")},fn={items:[],nextToken:null,startedAt:null},dn=new r.a("DataStore"),hn=function(){function e(e,t,n,r,i,o){void 0===n&&(n={}),this.schema=e,this.syncPredicates=t,this.amplifyConfig=n,this.authModeStrategy=r,this.errorHandler=i,this.modelInstanceCreator=o,this.typeQuery=new WeakMap,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=cn(Object(Ft.b)(t,n,"LIST"),1),i=cn(r[0]).slice(1);e.typeQuery.set(n,i)}))}))},e.prototype.graphqlFilterFromPredicate=function(e){if(!this.syncPredicates)return null;var t=we.a.getPredicates(this.syncPredicates.get(e),!1);return t?Object(Ft.l)(t):null},e.prototype.retrievePage=function(e,t,n,r,i){return void 0===r&&(r=null),an(this,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h,p,v,y,g,m=this;return un(this,(function(b){switch(b.label){case 0:return o=cn(this.typeQuery.get(e),2),s=o[0],a=o[1],u={limit:r,nextToken:n,lastSync:t,filter:i},[4,Object(Ft.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 an(m,void 0,void 0,(function(){var t,n,r,i;return un(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,4]),dn.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(),dn.debug("Sync successful with authMode: "+l[f]),[2,t];case 2:if(n=o.sent(),++f>=l.length){if(r=l[f-1],dn.debug("Sync failed with authMode: "+r,n),Object(Ft.f)(n)||Object(Ft.g)(n))return dn.warn("User is unauthorized to query "+s+" with auth mode "+r+". No data could be returned."),[2,{data:(i={},i[s]=fn,i)}];throw n}return dn.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,s=e.authMode;return an(this,void 0,void 0,(function(){var e=this;return un(this,(function(a){switch(a.label){case 0:return[4,Object(Gt.c)((function(t,n){return an(e,void 0,void 0,(function(){var e,a,u,c,l,f=this;return un(this,(function(d){switch(d.label){case 0:return d.trys.push([0,3,,8]),[4,Object(Ft.i)(s,this.amplifyConfig)];case 1:return e=d.sent(),[4,Vt.a.graphql({query:t,variables:n,authMode:s,authToken:e})];case 2:return[2,d.sent()];case 3:if(a=d.sent(),u=Object(Ft.f)(a)||Object(Ft.g)(a))throw new Gt.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 an(f,void 0,void 0,(function(){var t;return un(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(Wt.c)(e),process:fe.i.sync,remoteModel:null,cause:e})];case 1:return n.sent(),[3,3];case 2:return t=n.sent(),dn.error("Sync error handler failed with:",t),[3,3];case 3:return[2]}}))}))})))]:[3,5]):[3,6]:[3,7];case 4:d.sent(),o.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]=sn(sn({},fn),l.data[r]),dn.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 ue.a((function(r){var a=Object.values(t.schema.namespaces).reduce((function(t,n){var r,i;try{for(var o=ln(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 cn(e,1)[0].syncable})).map((function(e){var a=cn(e,2),u=a[0],c=cn(a[1],2),l=c[0],f=c[1];return an(t,void 0,void 0,(function(){var e,t,a,c,d,h,p,v,y,g=this;return un(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 an(g,void 0,void 0,(function(){var p,y;return un(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}(),pn=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())}))},vn=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])}}},yn=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},gn=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.")},mn=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(yn(arguments[t]));return e},bn=Object(i.b)().isNode,wn=new r.a("DataStore"),Sn=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"}(lt||(lt={}));var _n=function(){function e(e,t,n,r,i,o,s,a,u,c,l){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.online=!1,this.modelSyncedStatus=new WeakMap;var f=this.modelClasses.MutationEvent;this.outbox=new Ht(this.schema,f,o,Sn),this.modelMerger=new Ut(this.outbox,Sn),this.syncQueriesProcessor=new hn(this.schema,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,a),this.subscriptionsProcessor=new on.b(this.schema,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,a),this.mutationsProcessor=new tn(this.schema,this.storage,this.userModelClasses,this.outbox,this.modelInstanceCreator,f,this.amplifyConfig,this.authModeStrategy,a,s),this.datastoreConnectivity=new kt}return e.prototype.getModelSyncedStatus=function(e){return this.modelSyncedStatus.get(e)},e.prototype.start=function(e){var t=this;return new ue.a((function(n){wn.log("starting sync engine...");var r=[];return pn(t,void 0,void 0,(function(){var t,i,o,s=this;return vn(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 pn(s,void 0,void 0,(function(){var t,o,s,a,u,c=this;return vn(this,(function(l){switch(l.label){case 0:return!i||this.online?[3,10]:(this.online=i,n.next({type:lt.SYNC_ENGINE_NETWORK_STATUS,data:{active:this.online}}),o=void 0,bn?(wn.warn("Realtime disabled when in a server-side environment"),[3,6]):[3,1]);case 1:u=yn(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===on.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:wn.log("Realtime ready"),n.next({type:lt.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===lt.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:lt.SYNC_ENGINE_OUTBOX_MUTATION_PROCESSED,data:{model:o,element:s}}),n.next({type:lt.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:!i}})}))),bn||r.push(o.subscribe((function(e){var t=yn(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:lt.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,Sn).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 pn(s,void 0,void 0,(function(){var e,s,u,c;return vn(this,(function(l){switch(l.label){case 0:return e=this.schema.namespaces[this.namespaceResolver(r)],s=this.modelClasses.MutationEvent,u=Object(Ft.k)(a),c=Object(Ft.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:lt.SYNC_ENGINE_OUTBOX_MUTATION_ENQUEUED,data:{model:r,element:o}}),n.next({type:lt.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:!1}}),[4,i];case 2:return l.sent(),this.online&&this.mutationsProcessor.resume(),[2]}}))}))}}),n.next({type:lt.SYNC_ENGINE_STORAGE_SUBSCRIBED}),[4,this.outbox.peek(this.storage)];case 4:return o=void 0===a.sent(),n.next({type:lt.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:o}}),[4,i];case 5:return a.sent(),n.next({type:lt.SYNC_ENGINE_READY}),[2]}}))})),function(){r.forEach((function(e){return e.unsubscribe()}))}}))},e.prototype.getModelsMetadataWithNextFullSync=function(e){return pn(this,void 0,void 0,(function(){var t,n=this;return vn(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 ue.a((function(t){var n,r;return pn(e,void 0,void 0,(function(){var e,i,o=this;return vn(this,(function(s){switch(s.label){case 0:e=function(){var e,s,a,u,c,l,f,d,h;return vn(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,v=i.done,y=i.startedAt,g=i.isFullSync;return pn(o,void 0,void 0,(function(){var i,o,m,b,w,S,_=this;return vn(this,(function(E){switch(E.label){case 0:return i=this.userModelClasses[h.name],e.has(i)||(e.set(i,{new:0,updated:0,deleted:0}),l=Object(Oe.j)(),d=void 0===d?y:Math.max(d,y)),[4,this.storage.runExclusive((function(t){return pn(_,void 0,void 0,(function(){var n,r,o,s,a,u,c,l,f,d,h,v,y,g,m;return vn(this,(function(b){switch(b.label){case 0:return[4,this.outbox.getModelIds(t)];case 1:n=b.sent(),r=[],o=p.filter((function(e){return!n.has(e.id)||(r.push(e),!1)})),s=[],b.label=2;case 2:b.trys.push([2,7,8,9]),a=gn(r),u=a.next(),b.label=3;case 3:return u.done?[3,6]:(c=u.value,[4,this.modelMerger.merge(t,c)]);case 4:void 0!==(l=b.sent())&&s.push([c,l]),b.label=5;case 5:return u=a.next(),[3,3];case 6:return[3,9];case 7:return f=b.sent(),g={error:f},[3,9];case 8:try{u&&!u.done&&(m=a.return)&&m.call(a)}finally{if(g)throw g.error}return[7];case 9:return h=(d=s.push).apply,v=[s],[4,this.modelMerger.mergePage(t,i,o)];case 10:return h.apply(d,v.concat([mn.apply(void 0,[b.sent()])])),y=e.get(i),s.forEach((function(e){var t=yn(e,2)[1];switch(t){case fe.h.INSERT:y.new++;break;case fe.h.UPDATE:y.updated++;break;case fe.h.DELETE:y.deleted++;break;default:Object(Oe.g)(t)}})),[2]}}))}))}))];case 1:return E.sent(),v?(o=h.name,[4,this.getModelMetadata(s,o)]):[3,4];case 2:return m=E.sent(),b=m.lastFullSync,w=m.fullSyncInterval,c=w,u=void 0===u?b:Math.max(u,g?y:b),m=this.modelClasses.ModelMetadata.copyOf(m,(function(e){e.lastSync=y,e.lastFullSync=g?y:m.lastFullSync})),[4,this.storage.save(m,void 0,Sn)];case 3:E.sent(),S=e.get(i),this.modelSyncedStatus.set(i,!0),t.next({type:lt.SYNC_ENGINE_MODEL_SYNCED,data:{model:i,isFullSync:g,isDeltaSync:!g,counts:S}}),a.delete(h),0===a.size&&(f=Object(Oe.j)()-l,r(),t.next({type:lt.SYNC_ENGINE_SYNC_QUERIES_READY}),n.unsubscribe()),E.label=4;case 4:return[2]}}))}))},error:function(e){t.error(e)}}),t.next({type:lt.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),wn.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)}})):ue.a.of()},e.prototype.disconnectionHandler=function(){var e=this;return function(t){Tt.CONTROL_MSG.CONNECTION_CLOSED!==t&&Tt.CONTROL_MSG.TIMEOUT_DISCONNECT!==t||e.datastoreConnectivity.socketDisconnected()}},e.prototype.unsubscribeConnectivity=function(){this.datastoreConnectivity.unsubscribe()},e.prototype.setupModels=function(e){return pn(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,f,d,h,p=this;return vn(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===Oe.e){var n=p.userModelClasses[t.name];p.modelSyncedStatus.set(n,!1)}}))})),o=r.map((function(e){var r=yn(e,2),o=r[0],s=r[1];return pn(p,void 0,void 0,(function(){var e,r,a,u,c,l,f,d,h;return vn(this,(function(p){switch(p.label){case 0:return[4,this.getModelMetadata(o,s.name)];case 1:return e=p.sent(),r=we.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,Sn)];case 2:return l=yn.apply(void 0,[p.sent(),1]),f=yn(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=yn.apply(void 0,[p.sent(),1]),h=yn(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=gn.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 pn(this,void 0,void 0,(function(){var e;return vn(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 pn(this,void 0,void 0,(function(){var n,r,i;return vn(this,(function(o){switch(o.label){case 0:return n=this.modelClasses.ModelMetadata,r=we.a.createFromExisting(this.schema.namespaces[Oe.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=yn.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:Oe.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 En(e){return(En="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 An=function(){return(An=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)},On=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())}))},In=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])}}},Tn=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},Cn=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},xn=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.")},Pn=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Cn(arguments[t]));return e};se(!0),z();var kn,Nn,Mn,jn,Rn,Dn=new r.a("DataStore"),Un=Object(Oe.x)(Date.now()),Fn=i.a.browserOrNode().isNode,Ln=new WeakMap,Bn=new WeakMap,qn=function(e){var t=Ln.get(e);return kn.namespaces[t].models[e.name]},zn=function(e){return Object(Oe.t)(e)&&Ln.has(e)},Kn=function(e){return Ln.get(e)},Hn=function(e){var t;if(void 0!==kn)return console.warn("The schema has already been initialized"),Mn;Dn.log("validating schema",{schema:e});var n=An({name:Oe.e},e);Dn.log("DataStore","Init models"),Mn=Gn(n),Dn.log("DataStore","Models initialized");var r={name:Oe.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=It.getNamespace(),o=_n.getNamespace();return jn=Gn(r),Rn=Gn(i),Nn=Gn(o),kn={namespaces:(t={},t[r.name]=r,t[n.name]=n,t[i.name]=i,t[o.name]=o,t),version:e.version},Object.keys(kn.namespaces).forEach((function(e){var t,n,r=Cn(Object(Oe.f)(kn.namespaces[e]),2),i=r[0],o=r[1];kn.namespaces[e].relationships=i,kn.namespaces[e].keys=o;var s=new Map;Object.values(kn.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,xn(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)}))}kn.namespaces[e].modelTopologicalOrdering=a})),Mn},Vn=function(){if(void 0===kn){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 Dn.error(e),new Error(e)}},Gn=function(e){var t={};return Object.entries(e.models).forEach((function(n){var r=Cn(n,2),i=r[0],o=r[1],s=Xn(o);t[i]=s,Ln.set(s,e.name)})),Object.entries(e.nonModels||{}).forEach((function(e){var n=Cn(e,2),r=n[0],i=n[1],o=nr(i);t[r]=o})),t},Wn=new WeakSet;function Yn(e,t){return Wn.add(t),new e(t)}var Jn,$n=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(fe.n)(i)){var c=fe.c.getJSType(i),l=fe.c.getValidationFunction(i);if("AWSJSON"===i){if(En(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+"], "+En(n)+" received. "+n);if(!Object(Oe.v)(n)&&n.some((function(e){return Object(Oe.v)(e)?o:En(e)!==c}))){var d=n.map((function(e){return null===e?"null":En(e)})).join(",");throw new Error("All elements in the "+a+" array should be of type "+f+", ["+d+"] received. "+n)}if(l&&!Object(Oe.v)(n))if(!n.map((function(e){return Object(Oe.v)(e)?!(!Object(Oe.v)(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(En(n)!==c&&null!==n)throw new Error("Field "+a+" should be of type "+c+", "+En(n)+" received. "+n);if(!Object(Oe.v)(n)&&l&&!l(n))throw new Error("Field "+a+" should be of type "+i+", validation failed. "+n)}}}}},Zn=function(e,t,n){var r=e.fields[t]||{},i=r.isArray,o=r.type;if("string"==typeof n&&(i||"AWSJSON"===o||Object(fe.t)(o)||Object(fe.s)(o)))try{return JSON.parse(n)}catch(e){}return"number"==typeof n&&"Boolean"===o?Boolean(n):n},Qn=function(e,t,n){var r=$n(t);Object.entries(e).forEach((function(e){var i=Cn(e,2),o=i[0],s=i[1],a=Zn(t,o,s);r(o,a),n[o]=a}))},Xn=function(e){var t=function(){function n(t){return oe(this,(function(n){Qn(t,e,n);var r=Wn.has(t)?t:{},i=r.id,o=r._version,s=r._lastChangedAt,a=r._deleted,u=null!=i,c=u?i:e.syncable?Object(ae.v4)():Un();u||er(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(!zn(i)){var o="The source object is not a valid model";throw Dn.error(o,{source:t}),new Error(o)}var s=oe(t,(function(r){n(r),r.id=t.id;var i=$n(e);Object.entries(r).forEach((function(t){var n=Cn(t,2),r=n[0],o=n[1],s=Zn(e,r,o);i(r,s)}))}),(function(e){return r=e}));return r.length&&(Bn.set(s,[r,t]),tr(r,e)),s},n.fromJSON=function(n){var r=this;if(Array.isArray(n))return n.map((function(e){return r.fromJSON(e)}));var i=Yn(t,n),o=$n(e);return Object.entries(i).forEach((function(e){var t=Cn(e,2),n=t[0],r=t[1];o(n,r)})),i},n}();return t[$]=!0,Object.defineProperty(t,"name",{value:e.name}),t},er=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.")}))},tr=function(e,t){var n=e.map((function(e){return[e.path[0],e.value]})),r=t.fields;n.forEach((function(e){var t=Cn(e,2),n=t[0];if(t[1]&&r[n]&&r[n].isReadOnly)throw new Error(n+" is read-only.")}))},nr=function(e){var t=function(t){return oe(this,(function(n){Qn(t,e,n)}))};return t[$]=!0,Object.defineProperty(t,"name",{value:e.name}),Object(Oe.y)(t),t};function rr(e){return"string"==typeof e}function ir(e){var t=e.localModel,n=e.modelConstructor,r=e.remoteModel._version;return Yn(n,An(An({},t),{_version:r}))}function or(e){Dn.warn(e)}function sr(e,t){var n;switch(e){case Oe.a:n=jn[t];break;case Oe.e:n=Mn[t];break;case Oe.d:n=Nn[t];break;case Oe.c:n=Rn[t];break;default:Object(Oe.g)(e)}if(zn(n))return n;var r="Model name is not valid for namespace. modelName: "+t+", namespace: "+e;throw Dn.error(r),new Error(r)}function ar(e,t){return On(this,void 0,void 0,(function(){var n,r,i=this;return In(this,(function(o){switch(o.label){case 0:return n=jn.Setting,r=kn.namespaces[Oe.a].models.Setting,[4,e.runExclusive((function(e){return On(i,void 0,void 0,(function(){var i,o;return In(this,(function(s){switch(s.label){case 0:return[4,e.query(n,we.a.createFromExisting(r,(function(e){return e.key("eq","schemaVersion")})),{page:0,limit:1})];case 1:return i=Cn.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(Yn(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 ur=function(){function e(){var e=this;this.amplifyConfig={},this.syncPredicates=new WeakMap,this.start=function(){return On(e,void 0,void 0,(function(){var e,t,n,r=this;return In(this,(function(i){switch(i.label){case 0:return void 0!==this.initialized?[3,1]:(Dn.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 It(kn,Kn,sr,Yn,this.storageAdapter,this.sessionId),[4,this.storage.init()];case 4:return i.sent(),Vn(),[4,ar(this.storage,kn.version)];case 5:return i.sent(),(e=this.amplifyConfig.aws_appsync_graphqlEndpoint)?(Dn.debug("GraphQL endpoint available",e),t=this,[4,this.processSyncExpressions()]):[3,7];case 6:return t.syncPredicates=i.sent(),this.sync=new _n(kn,Kn,Nn,Mn,this.storage,Yn,this.conflictHandler,this.errorHandler,this.syncPredicates,this.amplifyConfig,this.authModeStrategy),n=1e3*this.fullSyncInterval*60,Jn=this.sync.start({fullSyncInterval:n}).subscribe({next:function(e){var t=e.type,n=e.data;t===(Fn?lt.SYNC_ENGINE_SYNC_QUERIES_READY:lt.SYNC_ENGINE_STORAGE_SUBSCRIBED)&&r.initResolve(),o.a.dispatch("datastore",{event:t,data:n})},error:function(e){Dn.warn("Sync error",e),r.initReject()}}),[3,8];case 7:Dn.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 On(e,void 0,void 0,(function(){var e,i,o,s,a;return In(this,(function(u){switch(u.label){case 0:return[4,this.start()];case 1:if(u.sent(),!zn(t))throw e="Constructor is not for a valid model",Dn.error(e,{modelConstructor:t}),new Error(e);return"string"==typeof n&&void 0!==r&&Dn.warn("Pagination is ignored when querying by id"),i=qn(t),o=rr(n)?we.a.createForId(i,n):Object(we.c)(n)?void 0:we.a.createFromExisting(i,n),s=this.processPagination(i,r),Dn.debug("params ready",{modelConstructor:t,predicate:we.a.getPredicates(o,!1),pagination:An(An({},s),{sort:Se.a.getPredicates(s&&s.sort,!1)})}),[4,this.storage.query(t,o,s)];case 2:return a=u.sent(),[2,rr(n)?a[0]:a]}}))}))},this.save=function(t,n){return On(e,void 0,void 0,(function(){var e,r,i,o,s,a,u=this;return In(this,(function(c){switch(c.label){case 0:return[4,this.start()];case 1:if(c.sent(),e=Bn.get(t),r=t?t.constructor:void 0,!zn(r))throw i="Object is not an instance of a valid model",Dn.error(i,{model:t}),new Error(i);return o=qn(r),s=we.a.createFromExisting(o,n),[4,this.storage.runExclusive((function(n){return On(u,void 0,void 0,(function(){return In(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,we.a.createForId(o,t.id))]}}))}))}))];case 2:return a=Cn.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===ir&&t.conflictHandler?t.conflictHandler:e.conflictHandler||ir},this.setErrorHandler=function(t){var n=t.DataStore;return n&&n.errorHandler?n.errorHandler:e.errorHandler===or&&t.errorHandler?t.errorHandler:e.errorHandler||or},this.delete=function(t,n){return On(e,void 0,void 0,(function(){var e,r,i,o,s,a,u,c,l;return In(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",Dn.error(u,{modelOrConstructor:t}),new Error(u);if(!zn(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",Dn.error(u,{idOrCriteria:n}),new Error(u);if("string"==typeof n)e=we.a.createForId(qn(o),n);else if(!(e=we.a.createFromExisting(qn(o),n))||!we.a.isValidPredicate(e))throw u="Criteria required. Do you want to delete all? Pass Predicates.ALL",Dn.error(u,{condition:e}),new Error(u);return[4,this.storage.delete(o,e)];case 2:return r=Cn.apply(void 0,[f.sent(),1]),[2,r[0]];case 3:if(i=t,o=Object.getPrototypeOf(i||{}).constructor,!zn(o))throw u="Object is not an instance of a valid model",Dn.error(u,{model:i}),new Error(u);if(s=qn(o),a=we.a.createForId(s,i.id),n){if("function"!=typeof n)throw u="Invalid criteria",Dn.error(u,{idOrCriteria:n}),new Error(u);e=n(a)}else e=a;return[4,this.storage.delete(i,e)];case 4:return c=Cn.apply(void 0,[f.sent(),1]),l=Cn(c[0],1),[2,l[0]]}}))}))},this.observe=function(t,n){var r,i=t&&zn(t)?t:void 0;if(t&&void 0===i){var o=t,s=o&&Object.getPrototypeOf(o).constructor;if(zn(s))return n&&Dn.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 Dn.error(a,{model:o}),new Error(a)}if(void 0!==n&&void 0===i){a="Cannot provide criteria without a modelConstructor";throw Dn.error(a,n),new Error(a)}if(i&&!zn(i)){a="Constructor is not for a valid model";throw Dn.error(a,{modelConstructor:i}),new Error(a)}return r="string"==typeof n?we.a.createForId(qn(i),n):i&&we.a.createFromExisting(qn(i),n),new ue.a((function(t){var n;return On(e,void 0,void 0,(function(){return In(this,(function(e){switch(e.label){case 0:return[4,this.start()];case 1:return e.sent(),n=this.storage.observe(i,r).filter((function(e){var t=e.model;return Kn(t)===Oe.e})).map((function(e){var t=e.opType,n=e.model,r=e.condition,i=e.element;return{opType:t,element:e.savedElement||i,model:n,condition:r}})).subscribe(t),[2]}}))})),function(){n&&n.unsubscribe()}}))},this.observeQuery=function(t,n,r){return new ue.a((function(i){var s,a=new Map,u=new Map,c=[],l=function(){var e=p();v(e)},f=new Oe.b({callback:l,errorHandler:i.error,maxInterval:2e3}),d=(r||{}).sort,h=d?{sort:d}:void 0;On(e,void 0,void 0,(function(){var e,r=this;return In(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.query(t,n,h)];case 1:return o.sent().forEach((function(e){return a.set(e.id,e)})),s=this.observe(t,n).subscribe((function(e){var t,n,i=e.element,o=e.model;"DELETE"===e.opType?c.push(i.id):u.set(i.id,i);var s=null!==(n=null===(t=r.sync)||void 0===t?void 0:t.getModelSyncedStatus(o))&&void 0!==n&&n;(u.size-c.length>=r.syncPageSize||s)&&f.resolve(),f.start()})),l(),[3,3];case 2:return e=o.sent(),i.error(e),[3,3];case 3:return[2]}}))}));var p=function(){var n,i,o=null!==(i=null===(n=e.sync)||void 0===n?void 0:n.getModelSyncedStatus(t))&&void 0!==i&&i,s=Pn(Array.from(a.values()),Array.from(u.values()));return(null==r?void 0:r.sort)&&y(s),a.clear(),s.forEach((function(e){return a.set(e.id,e)})),c.forEach((function(e){return a.delete(e)})),{items:Array.from(a.values()),isSynced:o}},v=function(e){i.next(e),u.clear(),c=[]},y=function(n){var i=qn(t),o=e.processPagination(i,r),s=Se.a.getPredicates(o.sort);if(s.length){var a=Object(Oe.z)(s);n.sort(a)}};return o.a.listen("datastore",(function e(n){var r,i=n.payload,s=i.event,a=i.data;s===lt.SYNC_ENGINE_MODEL_SYNCED&&(null===(r=null==a?void 0:a.model)||void 0===r?void 0:r.name)===t.name&&(l(),o.a.remove("api",e))})),function(){s&&s.unsubscribe()}}))},this.configure=function(t){void 0===t&&(t={});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=Tn(t,["DataStore","authModeStrategyType","conflictHandler","errorHandler","maxRecordsToSync","syncPageSize","fullSyncInterval","syncExpressions","authProviders","storageAdapter"]);switch(e.amplifyConfig=An(An({},l),e.amplifyConfig),e.conflictHandler=e.setConflictHandler(t),e.errorHandler=e.setErrorHandler(t),n&&n.authModeStrategyType||r||fe.a.DEFAULT){case fe.a.MULTI_AUTH:e.authModeStrategy=me;break;case fe.a.DEFAULT:default:e.authModeStrategy=be}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 On(this,void 0,void 0,(function(){return In(this,(function(e){switch(e.label){case 0:return Vn(),void 0!==this.storage?[3,2]:(this.storage=new It(kn,Kn,sr,Yn,this.storageAdapter,this.sessionId),[4,this.storage.init()]);case 1:e.sent(),e.label=2;case 2:return Jn&&!Jn.closed&&Jn.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 On(this,void 0,void 0,(function(){return In(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 Jn&&!Jn.closed&&Jn.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=Se.a.createFromExisting(e,t.sort)),{limit:i,page:o,sort:n}}},e.prototype.processSyncExpressions=function(){return On(this,void 0,void 0,(function(){var e,t=this;return In(this,(function(n){switch(n.label){case 0:return this.syncExpressions&&this.syncExpressions.length?[4,Promise.all(this.syncExpressions.map((function(e){return On(t,void 0,void 0,(function(){var t,n,r,i,o,s;return In(this,(function(a){switch(a.label){case 0:return[4,e];case 1:return t=a.sent(),n=t.modelConstructor,r=t.conditionProducer,i=qn(n),[4,this.unwrapPromise(r)];case 2:return o=a.sent(),Object(we.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 we.a.createFromExisting(e,t)}catch(e){throw Dn.error("Error creating Sync Predicate"),e}},e.prototype.unwrapPromise=function(e){return On(this,void 0,void 0,(function(){var t;return In(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=Cn(t,2),r=n[0],i=n[1];if(e.has(r)){var o=r.name;return Dn.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+"-"+Cn(t.split("."),1)[0]}}catch(e){return}},e}(),cr=new ur;s.a.register(cr);var lr={USER:Oe.e,traverseModel:Oe.A,validatePredicate:Oe.B,isNonModelConstructor:Oe.u,isModelConstructor:Oe.t}},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(22),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 i}));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={clockOffset:0,getDateWithClockOffset:function(){return i.clockOffset?new Date((new Date).getTime()+i.clockOffset):new Date},getClockOffset:function(){return i.clockOffset},getHeaderStringFromDate:function(e){return void 0===e&&(e=i.getDateWithClockOffset()),e.toISOString().replace(/[:\-]|\.\d{3}/g,"")},getDateFromHeaderString:function(e){var t=r(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()-i.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){i.clockOffset=e}}}])}));
|
|
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(49).default||n(49))},function(e,t,n){e.exports=n(101).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(51)(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(51)(e),n(30))},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(105),t.encode=t.stringify=n(106)},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(53),s=n(54),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(53),i=n(54);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(55),i=n(57),o=n(115),s=n(118),a=n(120),u=n(38),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(150),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(116),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(0),i=n(59),o=n(117),s=n(58),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(59),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(119),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(121),t),r.__exportStar(n(122),t),r.__exportStar(n(123),t),r.__exportStar(n(124),t),r.__exportStar(n(125),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(62),o=n(128),s=n(68);function a(e){var t=new o(e),n=i(o.prototype.request,t);return r.extend(n,o.prototype,t),r.extend(n,t),n}var u=a(n(39));u.Axios=o,u.create=function(e){return a(s(u.defaults,e))},u.Cancel=n(69),u.CancelToken=n(142),u.isCancel=n(67),u.all=function(e){return Promise.all(e)},u.spread=n(143),u.isAxiosError=n(144),e.exports=u,e.exports.default=u},function(e,t,n){"use strict";var r=n(13),i=n(63),o=n(129),s=n(130),a=n(68),u=n(140),c=u.validators;function l(e){this.defaults=e,this.interceptors={request:new o,response:new o}}l.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&u.assertOptions(t,{silentJSONParsing:c.transitional(c.boolean,"1.0.0"),forcedJSONParsing:c.transitional(c.boolean,"1.0.0"),clarifyTimeoutError:c.transitional(c.boolean,"1.0.0")},!1);var n=[],r=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(r=r&&t.synchronous,n.unshift(t.fulfilled,t.rejected))}));var i,o=[];if(this.interceptors.response.forEach((function(e){o.push(e.fulfilled,e.rejected)})),!r){var l=[s,void 0];for(Array.prototype.unshift.apply(l,n),l=l.concat(o),i=Promise.resolve(e);l.length;)i=i.then(l.shift(),l.shift());return i}for(var f=e;n.length;){var d=n.shift(),h=n.shift();try{f=d(f)}catch(e){h(e);break}}try{i=s(f)}catch(e){return Promise.reject(e)}for(;o.length;)i=i.then(o.shift(),o.shift());return i},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(131),o=n(67),s=n(39);function a(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return a(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 a(e),t.data=i.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(a(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(39);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(66);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(136),i=n(137);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(141),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={},s=r.version.split(".");function a(e,t){for(var n=t?t.split("."):s,r=e.split("."),i=0;i<3;i++){if(n[i]>r[i])return!0;if(n[i]<r[i])return!1}return!1}i.transitional=function(e,t,n){var i=t&&a(t);function s(e,t){return"[Axios v"+r.version+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,r,a){if(!1===e)throw new Error(s(r," has been removed in "+t));return i&&!o[r]&&(o[r]=!0,console.warn(s(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,a)}},e.exports={isOlderVersion:a,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){e.exports=JSON.parse('{"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}')},function(e,t,n){"use strict";var r=n(69);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;e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},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";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(70),o=n(146),s=n(149),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(70),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 cr})),n.d(t,"DataStoreClass",(function(){return ur})),n.d(t,"initSchema",(function(){return Hn})),n.d(t,"Predicates",(function(){return we.b})),n.d(t,"ModelPredicateCreator",(function(){return we.a})),n.d(t,"ModelSortPredicateCreator",(function(){return Se.a})),n.d(t,"utils",(function(){return lr})),n.d(t,"isSchemaModel",(function(){return fe.w})),n.d(t,"isAssociatedWith",(function(){return fe.l})),n.d(t,"isTargetNameAssociation",(function(){return fe.x})),n.d(t,"isModelAttributeAuth",(function(){return fe.o})),n.d(t,"isModelAttributeKey",(function(){return fe.q})),n.d(t,"isModelAttributePrimaryKey",(function(){return fe.r})),n.d(t,"isModelAttributeCompositeKey",(function(){return fe.p})),n.d(t,"ModelAttributeAuthAllow",(function(){return fe.e})),n.d(t,"ModelAttributeAuthProvider",(function(){return fe.f})),n.d(t,"GraphQLScalarType",(function(){return fe.c})),n.d(t,"isGraphQLScalarType",(function(){return fe.n})),n.d(t,"isModelFieldType",(function(){return fe.s})),n.d(t,"isNonModelFieldType",(function(){return fe.t})),n.d(t,"isEnumFieldType",(function(){return fe.m})),n.d(t,"OpType",(function(){return fe.h})),n.d(t,"isPredicateObj",(function(){return fe.v})),n.d(t,"isPredicateGroup",(function(){return fe.u})),n.d(t,"QueryOne",(function(){return fe.j})),n.d(t,"SortDirection",(function(){return fe.k})),n.d(t,"AuthModeStrategyType",(function(){return fe.a})),n.d(t,"ModelOperation",(function(){return fe.g})),n.d(t,"syncExpression",(function(){return fe.y})),n.d(t,"ProcessName",(function(){return fe.i})),n.d(t,"DISCARD",(function(){return fe.b})),n.d(t,"LimitTimerRaceResolvedValues",(function(){return fe.d}));var r=n(22),i=n(14),o=n(35),s=n(17);function a(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 u(e){return!!e&&!!e[Z]}function c(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)===Q}(e)||Array.isArray(e)||!!e[$]||!!e.constructor[$]||y(e)||g(e))}function l(e,t,n){void 0===n&&(n=!1),0===f(e)?(n?Object.keys:X)(e).forEach((function(r){n&&"symbol"==typeof r||t(r,e[r],e)})):e.forEach((function(n,r){return t(r,n,e)}))}function f(e){var t=e[Z];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:y(e)?2:g(e)?3:0}function d(e,t){return 2===f(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function h(e,t){return 2===f(e)?e.get(t):e[t]}function p(e,t,n){var r=f(e);2===r?e.set(t,n):3===r?(e.delete(t),e.add(n)):e[t]=n}function v(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function y(e){return G&&e instanceof Map}function g(e){return W&&e instanceof Set}function m(e){return e.o||e.t}function b(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=ee(e);delete t[Z];for(var n=X(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 w(e,t){return void 0===t&&(t=!1),_(e)||u(e)||!c(e)||(f(e)>1&&(e.set=e.add=e.clear=e.delete=S),Object.freeze(e),t&&l(e,(function(e,t){return w(t,!0)}),!0)),e}function S(){a(2)}function _(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function E(e){var t=te[e];return t||a(18,e),t}function A(e,t){te[e]||(te[e]=t)}function O(){return H}function I(e,t){t&&(E("Patches"),e.u=[],e.s=[],e.v=t)}function T(e){C(e),e.p.forEach(P),e.p=null}function C(e){e===H&&(H=e.l)}function x(e){return H={p:[],l:H,h:e,m:!0,_:0}}function P(e){var t=e[Z];0===t.i||1===t.i?t.j():t.O=!0}function k(e,t){t._=t.p.length;var n=t.p[0],r=void 0!==e&&e!==n;return t.h.g||E("ES5").S(t,e,r),r?(n[Z].P&&(T(t),a(4)),c(e)&&(e=N(t,e),t.l||j(t,e)),t.u&&E("Patches").M(n[Z],e,t.u,t.s)):e=N(t,n,[]),T(t),t.u&&t.v(t.u,t.s),e!==J?e:void 0}function N(e,t,n){if(_(t))return t;var r=t[Z];if(!r)return l(t,(function(i,o){return M(e,r,t,i,o,n)}),!0),t;if(r.A!==e)return t;if(!r.P)return j(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=4===r.i||5===r.i?r.o=b(r.k):r.o;l(3===r.i?new Set(i):i,(function(t,o){return M(e,r,i,t,o,n)})),j(e,i,!1),n&&e.u&&E("Patches").R(r,n,e.u,e.s)}return r.o}function M(e,t,n,r,i,o){if(u(i)){var s=N(e,i,o&&t&&3!==t.i&&!d(t.D,r)?o.concat(r):void 0);if(p(n,r,s),!u(s))return;e.m=!1}if(c(i)&&!_(i)){if(!e.h.F&&e._<1)return;N(e,i),t&&t.A.l||j(e,i)}}function j(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&w(t,n)}function R(e,t){var n=e[Z];return(n?m(n):e)[t]}function D(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 U(e){e.P||(e.P=!0,e.l&&U(e.l))}function F(e){e.o||(e.o=b(e.t))}function L(e,t,n){var r=y(t)?E("MapSet").N(t,n):g(t)?E("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:O(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=r,o=ne;n&&(i=[r],o=re);var s=Proxy.revocable(i,o),a=s.revoke,u=s.proxy;return r.k=u,r.j=a,u}(t,n):E("ES5").J(t,n);return(n?n.A:O()).p.push(r),r}function B(e){return u(e)||a(22,e),function e(t){if(!c(t))return t;var n,r=t[Z],i=f(t);if(r){if(!r.P&&(r.i<4||!E("ES5").K(r)))return r.t;r.I=!0,n=q(t,i),r.I=!1}else n=q(t,i);return l(n,(function(t,i){r&&h(r.t,t)===i||p(n,t,e(i))})),3===i?new Set(n):n}(e)}function q(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return b(e)}function z(){function e(t){if(!c(t))return t;if(Array.isArray(t))return t.map(e);if(y(t))return new Map(Array.from(t.entries()).map((function(t){return[t[0],e(t[1])]})));if(g(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 d(t,$)&&(n[$]=t[$]),n}function t(t){return u(t)?e(t):t}var n="add";A("Patches",{$:function(t,r){return r.forEach((function(r){for(var i=r.path,o=r.op,s=t,u=0;u<i.length-1;u++){var c=f(s),l=""+i[u];0!==c&&1!==c||"__proto__"!==l&&"constructor"!==l||a(24),"function"==typeof s&&"prototype"===l&&a(24),"object"!=typeof(s=h(s,l))&&a(15,i.join("/"))}var d=f(s),p=e(r.value),v=i[i.length-1];switch(o){case"replace":switch(d){case 2:return s.set(v,p);case 3:a(16);default:return s[v]=p}case n:switch(d){case 1:return s.splice(v,0,p);case 2:return s.set(v,p);case 3:return s.add(p);default:return s[v]=p}case"remove":switch(d){case 1:return s.splice(v,1);case 2:return s.delete(v);case 3:return s.delete(r.value);default:return delete s[v]}default:a(17,o)}})),t},R:function(e,r,i,o){switch(e.i){case 0:case 4:case 2:return function(e,r,i,o){var s=e.t,a=e.o;l(e.D,(function(e,u){var c=h(s,e),l=h(a,e),f=u?d(s,e)?"replace":n:"remove";if(c!==l||"replace"!==f){var p=r.concat(e);i.push("remove"===f?{op:f,path:p}:{op:f,path:p,value:l}),o.push(f===n?{op:"remove",path:p}:"remove"===f?{op:n,path:p,value:t(c)}:{op:"replace",path:p,value:t(c)})}}))}(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===J?void 0:t}),r.push({op:"replace",path:[],value:e.t})}})}var K,H,V="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),G="undefined"!=typeof Map,W="undefined"!=typeof Set,Y="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,J=V?Symbol.for("immer-nothing"):((K={})["immer-nothing"]=!0,K),$=V?Symbol.for("immer-draftable"):"__$immer_draftable",Z=V?Symbol.for("immer-state"):"__$immer_state",Q=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),X="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,ee=Object.getOwnPropertyDescriptors||function(e){var t={};return X(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},te={},ne={get:function(e,t){if(t===Z)return e;var n=m(e);if(!d(n,t))return function(e,t,n){var r,i=D(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||!c(r)?r:r===R(e.t,t)?(F(e),e.o[t]=L(e.A.h,r,e)):r},has:function(e,t){return t in m(e)},ownKeys:function(e){return Reflect.ownKeys(m(e))},set:function(e,t,n){var r=D(m(e),t);if(null==r?void 0:r.set)return r.set.call(e.k,n),!0;if(!e.P){var i=R(m(e),t),o=null==i?void 0:i[Z];if(o&&o.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(v(n,i)&&(void 0!==n||d(e.t,t)))return!0;F(e),U(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!==R(e.t,t)||t in e.t?(e.D[t]=!1,F(e),U(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=m(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(){a(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){a(12)}},re={};l(ne,(function(e,t){re[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),re.deleteProperty=function(e,t){return ne.deleteProperty.call(this,e[0],t)},re.set=function(e,t,n){return ne.set.call(this,e[0],t,n,e[0])};var ie=new(function(){function e(e){var t=this;this.g=Y,this.F=!0,this.produce=function(e,n,r){if("function"==typeof e&&"function"!=typeof n){var i=n;n=e;var o=t;return function(e){var t=this;void 0===e&&(e=i);for(var r=arguments.length,s=Array(r>1?r-1:0),a=1;a<r;a++)s[a-1]=arguments[a];return o.produce(e,(function(e){var r;return(r=n).call.apply(r,[t,e].concat(s))}))}}var s;if("function"!=typeof n&&a(6),void 0!==r&&"function"!=typeof r&&a(7),c(e)){var u=x(t),l=L(t,e,void 0),f=!0;try{s=n(l),f=!1}finally{f?T(u):C(u)}return"undefined"!=typeof Promise&&s instanceof Promise?s.then((function(e){return I(u,r),k(e,u)}),(function(e){throw T(u),e})):(I(u,r),k(s,u))}if(!e||"object"!=typeof e){if((s=n(e))===J)return;return void 0===s&&(s=e),t.F&&w(s,!0),s}a(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){c(e)||a(8),u(e)&&(e=B(e));var t=x(this),n=L(this,e,void 0);return n[Z].C=!0,C(t),n},t.finishDraft=function(e,t){var n=(e&&e[Z]).A;return I(n,t),k(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!Y&&a(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 i=E("Patches").$;return u(e)?i(e,t):this.produce(e,(function(e){return i(e,t.slice(n+1))}))},e}()),oe=ie.produce,se=(ie.produceWithPatches.bind(ie),ie.setAutoFreeze.bind(ie)),ae=(ie.setUseProxies.bind(ie),ie.applyPatches.bind(ie),ie.createDraft.bind(ie),ie.finishDraft.bind(ie),n(34)),ue=n(10),ce=n(15),le=n(4),fe=n(1),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())}))},he=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])}}},pe=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},ve=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(pe(arguments[t]));return e};function ye(e){return"private"!==e.allow||e.provider?"public"!==e.allow||e.provider?e.provider:fe.f.API_KEY:fe.f.USER_POOLS}function ge(e){var t=e.rules,n=e.currentUser,r=new Set;return t.forEach((function(e){switch(e.allow){case fe.e.CUSTOM:e.provider&&e.provider!==fe.f.FUNCTION||r.add(le.c.AWS_LAMBDA);break;case fe.e.GROUPS:case fe.e.OWNER:n&&(e.provider===fe.f.USER_POOLS?r.add(le.c.AMAZON_COGNITO_USER_POOLS):e.provider===fe.f.OIDC&&r.add(le.c.OPENID_CONNECT));break;case fe.e.PRIVATE:n&&(e.provider&&e.provider!==fe.f.USER_POOLS?e.provider===fe.f.IAM&&r.add(le.c.AWS_IAM):r.add(le.c.AMAZON_COGNITO_USER_POOLS));break;case fe.e.PUBLIC:e.provider===fe.f.IAM?r.add(le.c.AWS_IAM):e.provider&&e.provider!==fe.f.API_KEY||r.add(le.c.API_KEY)}})),Array.from(r)}var me=function(e){var t=e.schema,n=e.modelName;return de(void 0,void 0,void 0,(function(){var e,r,i,o;return he(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,ce.a.currentAuthenticatedUser()];case 1:return e=s.sent(),[3,3];case 2:return s.sent(),[3,3];case 3:return(r=t.namespaces.user.models[n].attributes)&&(i=r.find((function(e){return"auth"===e.type}))).properties&&i.properties.rules?(a=i.properties.rules,u=[fe.e.CUSTOM,fe.e.OWNER,fe.e.GROUPS,fe.e.PRIVATE,fe.e.PUBLIC],c=[fe.f.FUNCTION,fe.f.USER_POOLS,fe.f.OIDC,fe.f.IAM,fe.f.API_KEY],o=ve(a).sort((function(e,t){return e.allow===t.allow?c.indexOf(ye(e))-c.indexOf(ye(t)):u.indexOf(e.allow)-u.indexOf(t.allow)})),[2,ge({currentUser:e,rules:o})]):[2,[]]}var a,u,c}))}))},be=function(){return[]},we=n(5),Se=n(52),_e=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}(),Ee=n(74),Ae=n.n(Ee),Oe=n(2);let Ie,Te;const Ce=new WeakMap,xe=new WeakMap,Pe=new WeakMap,ke=new WeakMap,Ne=new WeakMap;let Me={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return xe.get(e);if("objectStoreNames"===t)return e.objectStoreNames||Pe.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return De(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function je(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(Te||(Te=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(Ue(this),t),De(Ce.get(this))}:function(...t){return De(e.apply(Ue(this),t))}:function(t,...n){const r=e.call(Ue(this),t,...n);return Pe.set(r,t.sort?t.sort():[t]),De(r)}}function Re(e){return"function"==typeof e?je(e):(e instanceof IDBTransaction&&function(e){if(xe.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)});xe.set(e,t)}(e),t=e,(Ie||(Ie=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,Me):e);var t}function De(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(De(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",o)});return t.then(t=>{t instanceof IDBCursor&&Ce.set(t,e)}).catch(()=>{}),Ne.set(t,e),t}(e);if(ke.has(e))return ke.get(e);const t=Re(e);return t!==e&&(ke.set(e,t),Ne.set(t,e)),t}const Ue=e=>Ne.get(e);function Fe(e,t,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){const s=indexedDB.open(e,t),a=De(s);return r&&s.addEventListener("upgradeneeded",e=>{r(De(s.result),e.oldVersion,e.newVersion,De(s.transaction))}),n&&s.addEventListener("blocked",()=>n()),a.then(e=>{o&&e.addEventListener("close",()=>o()),i&&e.addEventListener("versionchange",()=>i())}).catch(()=>{}),a}function Le(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",()=>t()),De(n).then(()=>{})}const Be=["get","getKey","getAll","getAllKeys","count"],qe=["put","add","delete","clear"],ze=new Map;function Ke(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(ze.get(t))return ze.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=qe.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!Be.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 ze.set(t,o),o}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)}Me=(e=>({...e,get:(t,n,r)=>Ke(t,n)||e.get(t,n,r),has:(t,n)=>!!Ke(t,n)||e.has(t,n)}))(Me);var 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())}))},Ge=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])}}},We=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 Ye?Ye(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)}))}}},Ye=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.")},Je=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},$e=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Je(arguments[t]));return e},Ze=new r.a("DataStore"),Qe=new(function(){function e(){this.dbName="amplify-datastore"}return e.prototype.checkPrivate=function(){return Ve(this,void 0,void 0,(function(){return Ge(this,(function(e){switch(e.label){case 0:return[4,Object(Oe.w)().then((function(e){return e}))];case 1:return e.sent()?(Ze.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 Ve(this,void 0,void 0,(function(){var o,s,a=this;return Ge(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,Fe(this.dbName,2,{upgrade:function(t,n,r,i){return Ve(a,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h,p,v,y,g=this;return Ge(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=Ye(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),Ze.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=Je(e,2)[1];return!o.has(t)})).forEach((function(e){var r=Je(e,2),i=r[0],o=r[1];g.createObjectStoreForModel(t,n,o,i)}))})),[3,15];case 14:throw p=m.sent(),Ze.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 Ve(this,void 0,void 0,(function(){var n,r;return Ge(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 Ve(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b,w,S,_,E,A,O,I,T,C,x,P=this;return Ge(this,(function(k){switch(k.label){case 0:return[4,this.checkPrivate()];case 1:return k.sent(),i=Object.getPrototypeOf(e).constructor,o=this.getStorenameForModel(i),s=Object(Oe.A)(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=P.getStorename(a,t);return u.add(i),{storeName:i,item:n,instance:r}})),l=this.db.transaction($e([o],Array.from(u.values())),"readwrite"),f=l.objectStore(o),[4,this._get(f,e.id)];case 2:if(d=k.sent(),t&&d&&(h=we.a.getPredicates(t),p=h.predicates,v=h.type,!Object(Oe.B)(d,v,p)))throw y="Conditional update failed",Ze.error(y,{model:d,condition:p}),new Error(y);g=[],k.label=3;case 3:k.trys.push([3,11,12,17]),m=We(c),k.label=4;case 4:return[4,m.next()];case 5:return(b=k.sent()).done?[3,10]:(w=b.value,S=w.storeName,_=w.item,E=w.instance,A=l.objectStore(S),O=_.id,[4,this._get(A,O)]);case 6:return I=k.sent(),T=void 0===I?fe.h.INSERT:fe.h.UPDATE,O!==e.id&&T!==fe.h.INSERT?[3,9]:[4,A.index("byId").getKey(_.id)];case 7:return C=k.sent(),[4,A.put(_,C)];case 8:k.sent(),g.push([E,T]),k.label=9;case 9:return[3,4];case 10:return[3,17];case 11:return x=k.sent(),n={error:x},[3,17];case 12:return k.trys.push([12,,15,16]),b&&!b.done&&(r=m.return)?[4,r.call(m)]:[3,14];case 13:k.sent(),k.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 k.sent(),[2,g]}}))}))},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,x,P,k,N,M=this;return Ge(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)}))];g=this.db.transaction($e(v),"readonly"),j.label=1;case 1:j.trys.push([1,34,35,40]),m=We(p),j.label=2;case 2:return[4,m.next()];case 3:if((b=j.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:j.trys.push([4,10,11,16]),r=We(n),j.label=5;case 5:return[4,r.next()];case 6:return(i=j.sent()).done?[3,9]:(x=i.value,T=x[E]?E:S,x[T]?[4,this._get(O,x[T])]:[3,9]);case 7:P=j.sent(),x[S]=P&&this.modelInstanceCreator(I,P),j.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return C=j.sent(),c={error:C},[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=We(n),j.label=18;case 18:return[4,o.next()];case 19:return(s=j.sent()).done?[3,22]:(x=s.value)[E]?[4,this._get(O,x[E])]:[3,21];case 20:P=j.sent(),x[S]=P&&this.modelInstanceCreator(I,P),delete x[E],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(Oe.g)(w.relationType),[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]),b&&!b.done&&(u=m.return)?[4,u.call(m)]:[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 Ge(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&&we.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 Ge(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 Ve(this,void 0,void 0,(function(){return Ge(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 Ve(this,void 0,void 0,(function(){return Ge(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(fe.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 Ge(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(Oe.B)(e,r,n)})):i]}}))}))},e.prototype.inMemoryPagination=function(e,t){if(t&&e.length>1){if(t.sort){var n=Se.a.getPredicates(t.sort);if(n.length){var r=Object(Oe.z)(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 Ve(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l;return Ge(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=fe.j.FIRST),Ve(this,void 0,void 0,(function(){var n,r,i;return Ge(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===fe.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 Ve(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return Ge(this,(function(g){switch(g.label){case 0:return[4,this.checkPrivate()];case 1:return g.sent(),n=[],Object(Oe.t)(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",Ze.warn(p,{model:i}),[2,[[i],[]]];if(f=we.a.getPredicates(t),d=f.predicates,h=f.type,!Object(Oe.B)(l,h,d))throw p="Conditional update failed",Ze.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 Ve(this,void 0,void 0,(function(){var a,u,c,l,f,d,h,p,v,y,g,m;return Ge(this,(function(b){switch(b.label){case 0:a=e.map((function(e){return e.storeName})),u=this.db.transaction($e(a),"readwrite"),b.label=1;case 1:b.trys.push([1,22,23,28]),t=We(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=We(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"!==He(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 Ve(this,void 0,void 0,(function(){var g,m,b,w,S,_,E,A,O,I,T,C,x,P,k=this;return Ge(this,(function(N){switch(N.label){case 0:N.trys.push([0,35,36,41]),o=We(e),N.label=1;case 1:return[4,o.next()];case 2:if((s=N.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(Oe.h)(this.schema.namespaces[r].relationships[b].relationTypes,n)||Object(Oe.i)(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:N.trys.push([3,10,11,16]),a=We(t),N.label=4;case 4:return[4,a.next()];case 5:return(u=N.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=N.sent(),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,O?[O]:[],b,r,i)];case 7:N.sent(),N.label=8;case 8:return[3,4];case 9:return[3,16];case 10:return I=N.sent(),h={error:I},[3,16];case 11:return N.trys.push([11,,14,15]),u&&!u.done&&(p=a.return)?[4,p.call(a)]:[3,13];case 12:N.sent(),N.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:N.trys.push([17,24,25,30]),c=We(t),N.label=18;case 18:return[4,c.next()];case 19:return(l=N.sent()).done?[3,23]:(T=l.value,[4,this.db.transaction(S,"readwrite").objectStore(S).index(_).getAll(T.id)]);case 20:return C=N.sent(),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,C,b,r,i)];case 21:N.sent(),N.label=22;case 22:return[3,18];case 23:return[3,30];case 24:return x=N.sent(),v={error:x},[3,30];case 25:return N.trys.push([25,,28,29]),l&&!l.done&&(y=c.return)?[4,y.call(c)]:[3,27];case 26:N.sent(),N.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(Oe.g)(m),[3,33];case 33:return[3,1];case 34:return[3,41];case 35:return P=N.sent(),f={error:P},[3,41];case 36:return N.trys.push([36,,39,40]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,38];case 37:N.sent(),N.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 k.modelInstanceCreator(k.getModelConstructorByModelName(r,n),e)}))}),[2]}}))}))},e.prototype.clear=function(){return Ve(this,void 0,void 0,(function(){return Ge(this,(function(e){switch(e.label){case 0:return[4,this.checkPrivate()];case 1:return e.sent(),this.db.close(),[4,Le(this.dbName)];case 2: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,h;return Ge(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 Ge(this,(function(l){switch(l.label){case 0:return r=Object(Oe.A)(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?fe.h.UPDATE:fe.h.INSERT]),[4,o.put(c,u)]);case 2:return l.sent(),[3,5];case 3:return n.push([t,fe.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=Ye(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 Ve(this,void 0,void 0,(function(){var i;return Ge(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}()),Xe=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())}))},et=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])}}},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(){var e=this;this.db=new Map,this.getAllKeys=function(){return Xe(e,void 0,void 0,(function(){return et(this,(function(e){return[2,Array.from(this.db.keys())]}))}))},this.multiGet=function(t){return Xe(e,void 0,void 0,(function(){var e=this;return et(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 Xe(e,void 0,void 0,(function(){var e=this;return et(this,(function(r){return t.forEach((function(t){return e.db.delete(t)})),"function"==typeof n&&n(),[2]}))}))},this.multiSet=function(t,n){return Xe(e,void 0,void 0,(function(){var e=this;return et(this,(function(r){return t.forEach((function(t){var n=tt(t,2),r=n[0],i=n[1];e.setItem(r,i)})),"function"==typeof n&&n(),[2]}))}))},this.setItem=function(t,n){return Xe(e,void 0,void 0,(function(){return et(this,(function(e){return[2,this.db.set(t,n)]}))}))},this.removeItem=function(t){return Xe(e,void 0,void 0,(function(){return et(this,(function(e){return[2,this.db.delete(t)]}))}))},this.getItem=function(t){return Xe(e,void 0,void 0,(function(){return et(this,(function(e){return[2,this.db.get(t)]}))}))}};var rt=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())}))},it=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])}}},ot=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.")},st=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},at=new Map,ut=function(){function e(){this._collectionInMemoryIndex=new Map,this.storage=new nt}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 at.has(e)||at.set(e,Object(Oe.x)()),at.get(e)},e.prototype.init=function(){return rt(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 it(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=ot(e),r=n.next(),w.label=3;case 3:return r.done?[3,11]:(i=r.value,o=st(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 rt(this,void 0,void 0,(function(){var n,r;return it(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 rt(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,S,_,E=this;return it(this,(function(A){switch(A.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=ot(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)(),m=this.getKeyForItem(e,f,h),s.push(m),a[m]={ulid:h,model:l},d?i.add(m):o.add(m)}catch(e){b={error:e}}finally{try{c&&!c.done&&(w=u.return)&&w.call(u)}finally{if(b)throw b.error}}return[4,this.storage.multiGet(s)];case 1:return p=A.sent(),v=p.filter((function(e){return!!st(e,2)[1]})).reduce((function(e,t){var n=st(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)})),E.storage.multiRemove(n,(function(n){n&&n.length>0?t(n):e()}))}else e()}))];case 2:return A.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)})),E.storage.multiSet(n,(function(n){n&&n.length>0?t(n):e()}))}else e()}))];case 3:A.sent();try{for(y=ot(s),g=y.next();!g.done;g=y.next())m=g.value,i.has(m)&&v.has(m)?n.push([a[m].model,fe.h.DELETE]):o.has(m)&&n.push([a[m].model,v.has(m)?fe.h.UPDATE:fe.h.INSERT])}catch(e){S={error:e}}finally{try{g&&!g.done&&(_=y.return)&&_.call(y)}finally{if(S)throw S.error}}return[2,n]}}))}))},e.prototype.get=function(e,t){return rt(this,void 0,void 0,(function(){var n,r,i;return it(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 rt(this,void 0,void 0,(function(){var n,r,i,o,s,a,u;return it(this,(function(c){switch(c.label){case 0:return n=this.getCollectionIndex(t),r=st(e===fe.j.FIRST?function(){var e,t,r,i,o;try{for(var s=ot(n),a=s.next();!a.done;a=s.next()){i=(r=st(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=ot(n),a=s.next();!a.done;a=s.next())i=(r=st(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 rt(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 it(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=ot(n),h=d.next();!h.done&&(p=st(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 st(e,2)[1]})).map((function(e){var t=st(e,2)[1];return JSON.parse(t)}))]}}))}))},e.prototype.delete=function(e,t){return rt(this,void 0,void 0,(function(){var n,r;return it(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 rt(this,void 0,void 0,(function(){var e,t;return it(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 ct(e){return(ct="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 lt,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){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 pt?pt(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)}))}}},pt=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.")},vt=new r.a("DataStore"),yt=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 ft(this,void 0,void 0,(function(){var i,o=this;return dt(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 ut,[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 ft(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b,w,S,_,E,A,O,I=this;return dt(this,(function(T){switch(T.label){case 0:return i=Object.getPrototypeOf(e).constructor,o=this.getStorenameForModel(i),s=Object(Oe.A)(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=I.getStorename(a,t);return u.add(i),{storeName:i,item:n,instance:r}})),[4,this.db.get(e.id,o)];case 1:if(l=T.sent(),t&&l&&(f=we.a.getPredicates(t),d=f.predicates,h=f.type,!Object(Oe.B)(l,h,d)))throw p="Conditional update failed",vt.error(p,{model:l,condition:d}),new Error(p);v=[],T.label=2;case 2:T.trys.push([2,9,10,15]),y=ht(c),T.label=3;case 3:return[4,y.next()];case 4:return(g=T.sent()).done?[3,8]:(m=g.value,b=m.storeName,w=m.item,S=m.instance,_=w.id,[4,this.db.get(_,b)]);case 5:return E=T.sent(),A=E?fe.h.UPDATE:fe.h.INSERT,_!==e.id&&A!==fe.h.INSERT?[3,7]:[4,this.db.save(w,b)];case 6:T.sent(),v.push([S,A]),T.label=7;case 7:return[3,3];case 8:return[3,15];case 9:return O=T.sent(),n={error:O},[3,15];case 10:return T.trys.push([10,,13,14]),g&&!g.done&&(r=y.return)?[4,r.call(y)]:[3,12];case 11:T.sent(),T.label=12;case 12:return[3,14];case 13:if(n)throw n.error;return[7];case 14:return[7];case 15:return[2,v]}}))}))},e.prototype.load=function(e,t,n){var r,i,o,s,a,u,c,l,f,d;return ft(this,void 0,void 0,(function(){var h,p,v,y,g,m,b,w,S,_,E,A,O,I,T,C,x,P,k,N=this;return dt(this,(function(M){switch(M.label){case 0:if(h=this.schema.namespaces[e],p=h.relationships[t].relationTypes,v=p.map((function(t){var n=t.modelName;return N.getStorename(e,n)})),y=this.getModelConstructorByModelName(e,t),0===v.length)return[2,n.map((function(e){return N.modelInstanceCreator(y,e)}))];M.label=1;case 1:M.trys.push([1,34,35,40]),g=ht(p),M.label=2;case 2:return[4,g.next()];case 3:if((m=M.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:M.trys.push([4,10,11,16]),r=ht(n),M.label=5;case 5:return[4,r.next()];case 6:return(i=M.sent()).done?[3,9]:(C=i.value,I=C[_]?_:w,C[I]?[4,this.db.get(C[I],A)]:[3,9]);case 7:x=M.sent(),C[w]=x&&this.modelInstanceCreator(O,x),M.label=8;case 8:return[3,5];case 9:return[3,16];case 10:return T=M.sent(),c={error:T},[3,16];case 11:return M.trys.push([11,,14,15]),i&&!i.done&&(l=r.return)?[4,l.call(r)]:[3,13];case 12:M.sent(),M.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:M.trys.push([17,23,24,29]),o=ht(n),M.label=18;case 18:return[4,o.next()];case 19:return(s=M.sent()).done?[3,22]:(C=s.value)[_]?[4,this.db.get(C[_],A)]:[3,21];case 20:x=M.sent(),C[w]=x&&this.modelInstanceCreator(O,x),delete C[_],M.label=21;case 21:return[3,18];case 22:return[3,29];case 23:return P=M.sent(),f={error:P},[3,29];case 24:return M.trys.push([24,,27,28]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,26];case 25:M.sent(),M.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(Oe.g)(E),[3,32];case 32:return[3,2];case 33:return[3,40];case 34:return k=M.sent(),a={error:k},[3,40];case 35:return M.trys.push([35,,38,39]),m&&!m.done&&(u=g.return)?[4,u.call(g)]:[3,37];case 36:M.sent(),M.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 N.modelInstanceCreator(y,e)}))]}}))}))},e.prototype.query=function(e,t,n){return ft(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l=this;return dt(this,(function(f){switch(f.label){case 0:return r=this.getStorenameForModel(e),i=this.namespaceResolver(e),o=t&&we.a.getPredicates(t),s=o&&this.idFromPredicate(o),a=n&&n.sort,u=n&&n.limit,[4,ft(l,void 0,void 0,(function(){var e,t,i;return dt(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 ft(this,void 0,void 0,(function(){return dt(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 ft(this,void 0,void 0,(function(){return dt(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(fe.v)(e)&&"id"===e.field&&"eq"===e.operator}));return n&&n.operand},e.prototype.filterOnPredicate=function(e,t){return ft(this,void 0,void 0,(function(){var n,r,i;return dt(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(Oe.B)(e,r,n)})):i]}}))}))},e.prototype.inMemoryPagination=function(e,t){if(t&&e.length>1){if(t.sort){var n=Se.a.getPredicates(t.sort);if(n.length){var r=Object(Oe.z)(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=fe.j.FIRST),ft(this,void 0,void 0,(function(){var n,r;return dt(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 ft(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p;return dt(this,(function(v){switch(v.label){case 0:return n=[],Object(Oe.t)(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",vt.warn(d,{model:i}),[2,[[i],[]]];if(c=we.a.getPredicates(t),l=c.predicates,f=c.type,!Object(Oe.B)(u,f,l))throw d="Conditional update failed",vt.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 ft(this,void 0,void 0,(function(){var a,u,c,l,f,d,h,p,v;return dt(this,(function(y){switch(y.label){case 0:y.trys.push([0,17,18,23]),t=ht(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=ht(c),y.label=4;case 4:return[4,l.next()];case 5:return(f=y.sent()).done?[3,8]:(d=f.value)?"object"!==ct(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 ft(this,void 0,void 0,(function(){var g,m,b,w,S,_,E,A,O,I,T,C,x,P,k,N=this;return dt(this,(function(M){switch(M.label){case 0:M.trys.push([0,35,36,41]),o=ht(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,b=g.modelName,w=g.targetName,S=this.getStorename(r,b),_=Object(Oe.h)(this.schema.namespaces[r].relationships[b].relationTypes,n)||Object(Oe.i)(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=ht(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.getAll(S)]:[3,9]);case 6:return C=M.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: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=ht(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.getAll(S)]);case 20:return C=M.sent(),x=C.filter((function(e){return e[_]===T.id})),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,x,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(Oe.g)(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 ft(this,void 0,void 0,(function(){return dt(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 ft(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d;return dt(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(Oe.A)(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=pt(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}()),gt=function(){return Object(i.b)().isBrowser&&window.indexedDB||Object(i.c)()&&self.indexedDB?Qe:yt},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=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},_t=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},Et=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.")},At=new r.a("DataStore"),Ot=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||gt(),this.pushStream=new Ae.a}return e.getNamespace=function(){return{name:Oe.c,relationships:{},enums:{},models:{},nonModels:{}}},e.prototype.init=function(){return bt(this,void 0,void 0,(function(){var e,t;return wt(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 At.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 bt(this,void 0,void 0,(function(){var i,o=this;return wt(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=_t(s,2),c=u[0],l=u[1],f=!!n;if(l===fe.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:we.a.getPredicates(t,!1),savedElement:c})})),[2,i]}}))}))},e.prototype.delete=function(e,t,n){return bt(this,void 0,void 0,(function(){var r,i,o,s,a=this;return wt(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=_t.apply(void 0,[u.sent(),2]),i=s[0],r=s[1],o=new Set(i.map((function(e){return e.id}))),Object(Oe.t)(e)||Array.isArray(r)||(r=[r]),r.forEach((function(r){var i,s=Object.getPrototypeOf(r).constructor;Object(Oe.t)(e)||(i=o.has(r.id)?we.a.getPredicates(t,!1):void 0),a.pushStream.next({model:s,opType:fe.h.DELETE,element:r,mutator:n,condition:i})})),[2,[i,r]]}}))}))},e.prototype.query=function(e,t,n){return bt(this,void 0,void 0,(function(){return wt(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=fe.j.FIRST),bt(this,void 0,void 0,(function(){return wt(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=we.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 St(e,["mutator"])}));return r||(u=u.filter((function(t){var n=t.model,r=t.element;return e===n&&(!a||Object(Oe.B)(r,s,o))}))),u},e.prototype.clear=function(e){return void 0===e&&(e=!0),bt(this,void 0,void 0,(function(){return wt(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 bt(this,void 0,void 0,(function(){var r,i=this;return wt(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=_t(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=_t(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,v=h.compositeKeys,y=void 0===v?[]:v;if(c.forEach((function(e){var n,r,i,o,s,c=Object(fe.x)(null===(s=d[e])||void 0===s?void 0:s.association)||e;if(!Object(Oe.C)(a[c],t[c])){u[c]=void 0===t[c]?null:t[c];try{for(var l=Et(y),f=l.next();!f.done;f=l.next()){var h=f.value;if(h.has(c))try{for(var p=(i=void 0,Et(h)),v=p.next();!v.done;v=p.next()){var g=v.value;u[g]=t[g]}}catch(e){i={error:e}}finally{try{v&&!v.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 g=Et(p),m=g.next();!m.done;m=g.next()){var b=m.value;u[b]=t[b]}}catch(e){r={error:e}}finally{try{m&&!m.done&&(i=g.return)&&i.call(g)}finally{if(r)throw r.error}}if(0===Object.keys(u).length)return null;var w=t.id,S=t._version,_=t._lastChangedAt,E=t._deleted;return mt(mt({},u),{id:w,_version:S,_lastChangedAt:_,_deleted:E})},e}(),It=function(){function e(e,t,n,r,i,o){this.mutex=new _e,this.storage=new Ot(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 bt(this,void 0,void 0,(function(){return wt(this,(function(i){return[2,this.runExclusive((function(i){return i.save(e,t,n,r)}))]}))}))},e.prototype.delete=function(e,t,n){return bt(this,void 0,void 0,(function(){return wt(this,(function(r){return[2,this.runExclusive((function(r){if(Object(Oe.t)(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 bt(this,void 0,void 0,(function(){return wt(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=fe.j.FIRST),bt(this,void 0,void 0,(function(){return wt(this,(function(n){return[2,this.runExclusive((function(n){return n.queryOne(e,t)}))]}))}))},e.getNamespace=function(){return Ot.getNamespace()},e.prototype.observe=function(e,t,n){return this.storage.observe(e,t,n)},e.prototype.clear=function(){return bt(this,void 0,void 0,(function(){return wt(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 bt(this,void 0,void 0,(function(){return wt(this,(function(e){return[2,this.storage.init()]}))}))},e}(),Tt=n(16),Ct=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.")},xt=(new(function(){function e(){}return e.prototype.networkMonitor=function(t){if(Object(i.b)().isNode)return ue.a.from([{online:!0}]);var n=Object(i.c)()?self:window;return new ue.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=Ct(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(),Pt=function(){return(Pt=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)},kt=(new r.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 ue.a((function(t){return e.observer=t,e.subscription=xt.subscribe((function(n){var r=n.online;e.connectionStatus.online=r;var i=Pt({},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=Pt({},e.connectionStatus);e.observer.next(t)}),5e3))},e}()),Nt=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())}))},Mt=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])}}},jt=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},Rt=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.")},Dt=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(jt(arguments[t]));return e},Ut=function(){function e(e,t){this.outbox=e,this.ownSymbol=t}return e.prototype.merge=function(e,t){return Nt(this,void 0,void 0,(function(){var n,r,i,o,s;return Mt(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=fe.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=jt.apply(void 0,[a.sent(),1]),s=jt(o[0],2),n=s[1],a.label=5;case 5:return[2,n]}}))}))},e.prototype.mergePage=function(e,t,n){return Nt(this,void 0,void 0,(function(){var r,i,o,s,a,u,c;return Mt(this,(function(l){switch(l.label){case 0:r=new Map;try{for(i=Rt(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=Dt(r.values()),[4,e.batchSave(t,a,this.ownSymbol)];case 1:return[2,l.sent()]}}))}))},e}(),Ft=n(3),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)},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())}))},qt=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])}}},zt=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},Kt=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},Ht=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 Bt(this,void 0,void 0,(function(){var n=this;return qt(this,(function(r){return e.runExclusive((function(e){return Bt(n,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f=this;return qt(this,(function(d){switch(d.label){case 0:return n=this.schema.namespaces[Oe.d].models.MutationEvent,r=we.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=Kt.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!==Ft.a.CREATE?[3,8]:s!==Ft.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 Bt(this,void 0,void 0,(function(){var r;return qt(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 Bt(this,void 0,void 0,(function(){var t;return qt(this,(function(n){switch(n.label){case 0:return[4,e.queryOne(this.MutationEvent,fe.j.FIRST)];case 1:return t=n.sent(),this.inProgressMutationEventId=t?t.id:void 0,[2,t]}}))}))},e.prototype.getForModel=function(e,t){return Bt(this,void 0,void 0,(function(){var n;return qt(this,(function(r){switch(r.label){case 0:return n=this.schema.namespaces[Oe.d].models.MutationEvent,[4,e.query(this.MutationEvent,we.a.createFromExisting(n,(function(e){return e.modelId("eq",t.id)})))];case 1:return[2,r.sent()]}}))}))},e.prototype.getModelIds=function(e){return Bt(this,void 0,void 0,(function(){var t,n;return qt(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 Bt(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p,v=this;return qt(this,(function(y){switch(y.label){case 0:return n.operation!==r?[2]:(i=t._version,o=t._lastChangedAt,t._deleted,s=zt(t,["_version","_lastChangedAt","_deleted"]),a=this.removeTimestampFields(n.model,s),(u=JSON.parse(n.data))?(u._version,u._lastChangedAt,u._deleted,c=zt(u,["_version","_lastChangedAt","_deleted"]),l=this.removeTimestampFields(n.model,c),Object(Oe.C)(a,l,!0)?(f=this.schema.namespaces[Oe.d].models.MutationEvent,d=we.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=Lt(Lt({},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 Bt(v,void 0,void 0,(function(){return qt(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=zt(n,["_version","id","_lastChangedAt","_deleted"]),u=JSON.parse(t.data),c=(u.id,u._version,u._lastChangedAt,u._deleted,zt(u,["id","_version","_lastChangedAt","_deleted"])),l=JSON.stringify(Lt(Lt({id:i,_version:r,_lastChangedAt:o,_deleted:s},a),c));return this.modelInstanceCreator(this.MutationEvent,Lt(Lt({},t),{data:l}))},e.prototype.removeTimestampFields=function(e,t){var n,r,i="createdAt",o="updatedAt",s=null===(n=this.schema.namespaces[Oe.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}(),Vt=n(20),Gt=n(157),Wt=n(25),Yt=function(){return(Yt=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)},Jt=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())}))},$t=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])}}},Zt=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},Qt=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},Xt=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.")},en=new r.a("DataStore"),tn=function(){function e(e,t,n,r,i,o,s,a,u,c){void 0===s&&(s={}),this.schema=e,this.storage=t,this.userClasses=n,this.outbox=r,this.modelInstanceCreator=i,this.MutationEvent=o,this.amplifyConfig=s,this.authModeStrategy=a,this.errorHandler=u,this.conflictHandler=c,this.typeQuery=new WeakMap,this.processing=!1,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=Qt(Object(Ft.b)(t,n,"CREATE"),1)[0],i=Qt(Object(Ft.b)(t,n,"UPDATE"),1)[0],o=Qt(Object(Ft.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 ue.a((function(t){return e.observer=t,e.resume(),function(){e.pause()}}))},e.prototype.resume=function(){return Jt(this,void 0,void 0,(function(){var e,t,n,r,i,o=this;return $t(this,(function(s){switch(s.label){case 0:if(this.processing||!this.isReady())return[2];this.processing=!0,t=Oe.e,n=function(){var n,i,s,a,u,c,l,f,d,h,p,v,y,g,m,b;return $t(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(Ft.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 Jt(o,void 0,void 0,(function(){var r,o;return $t(this,(function(c){switch(c.label){case 0:return c.trys.push([0,2,,4]),en.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(),en.debug("Mutation sent successfully with authMode: "+h[p]),[2,r];case 2:if(o=c.sent(),++p>=h.length)throw en.debug("Mutation failed with authMode: "+h[p-1]),o;return en.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=Qt.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]:(en.debug("done retrying"),[4,r.storage.runExclusive((function(e){return Jt(o,void 0,void 0,(function(){return $t(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 Jt(o,void 0,void 0,(function(){return $t(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 Jt(this,void 0,void 0,(function(){var c=this;return $t(this,(function(l){switch(l.label){case 0:return[4,Object(Gt.d)((function(t,n,r,i,o,s,a){return Jt(c,void 0,void 0,(function(){var c,l,f,d,h,p,v,y,g,m,b,w,S,_,E,A,O,I,T,C,x,P,k,N,M,j,R;return $t(this,(function(D){switch(D.label){case 0:return c=Qt(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(Ft.i)(u,this.amplifyConfig)];case 1:v=D.sent(),y={query:l,variables:f,authMode:u,authToken:v},g=0,m=this.opTypeFromTransformerOperation(n),D.label=2;case 2:return D.trys.push([2,4,,20]),[4,Vt.a.graphql(y)];case 3:return[2,[D.sent(),h,p]];case 4:if(!((b=D.sent()).errors&&b.errors.length>0))return[3,18];if(w=Qt(b.errors,1),S=w[0],_=S.originalError,E=(void 0===_?{}:_).code,A=void 0===E?null:E,"Unauthorized"===S.errorType)throw new Gt.a("Unauthorized");if("Network Error"===S.message||"ECONNABORTED"===A){if(!this.processing)throw new Gt.a("Offline");throw new Error("Network Error")}return"ConflictUnhandled"!==S.errorType?[3,13]:(g++,O=void 0,g>10?(O=fe.b,[3,8]):[3,5]);case 5:return D.trys.push([5,7,,8]),[4,this.conflictHandler({modelConstructor:o,localModel:this.modelInstanceCreator(o,f.input),remoteModel:this.modelInstanceCreator(o,S.data),operation:m,attempts:g})];case 6:return O=D.sent(),[3,8];case 7:return I=D.sent(),en.warn("conflict trycatch",I),[3,20];case 8:return O!==fe.b?[3,11]:(T=Qt(Object(Ft.b)(this.schema.namespaces[e],p,"GET"),1),C=Qt(T[0],3),x=C[1],P=C[2],[4,Object(Ft.i)(u,this.amplifyConfig)]);case 9:return k=D.sent(),[4,Vt.a.graphql({query:P,variables:{id:f.input.id},authMode:u,authToken:k})];case 10:return[2,[D.sent(),x,p]];case 11:return N=this.schema.namespaces[e],M=Object(Ft.d)(N.relationships,p,m,o,O,d,s,this.modelInstanceCreator,a.id),[4,this.storage.save(M)];case 12:throw D.sent(),new Gt.a("RetryMutation");case 13:return D.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:S.message,operation:n,errorType:Object(Wt.a)(S),errorInfo:S.errorInfo,process:fe.i.mutate,cause:S,remoteModel:S.data?this.modelInstanceCreator(o,S.data):null})];case 14:return D.sent(),[3,17];case 15:return j=D.sent(),en.warn("Mutation error handler failed with:",j),[3,17];case 16:return[2,S.data?[{data:(R={},R[h]=S.data,R)},h,p]:[]];case 17:return[3,19];case 18:throw new Gt.a(b);case 19:return[3,20];case 20:if(y)return[3,2];D.label=21;case 21:return[2]}}))}))}),[t,n,r,i,o,s,a],rn)];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=Qt(c.find((function(e){return Qt(e,1)[0]===n})),3),f=l[1],d=l[2],h=JSON.parse(r),p=h._version,v=Zt(h,["_version"]),y={};if(u&&u.length)try{for(var g=Xt(u),m=g.next();!m.done;m=g.next()){var b=m.value;y[b]=v[b]}}catch(e){o={error:e}}finally{try{m&&!m.done&&(s=g.return)&&s.call(g)}finally{if(o)throw o.error}}else y.id=v.id;var w=n===Ft.a.DELETE?y:Object.values(a.fields).filter((function(e){var t=e.name,r=e.type,i=e.association;return Object(fe.s)(r)?!(!Object(fe.x)(i)||"BELONGS_TO"!==i.connectionType):n!==Ft.a.UPDATE||v.hasOwnProperty(t)})).map((function(e){var t=e.name,n=e.type,r=e.association,i=t,o=v[t];return Object(fe.s)(n)&&Object(fe.x)(r)&&(i=r.targetName,o=v[i]),[i,o]})).reduce((function(e,t){var n=Qt(t,2),r=n[0],i=n[1];return e[r]=i,e}),{}),S=Yt(Yt({},w),{_version:p}),_=JSON.parse(i);return[d,Yt({input:S},n===Ft.a.CREATE?{}:{condition:Object.keys(_).length>0?_:null}),_,f,a]},e.prototype.opTypeFromTransformerOperation=function(e){switch(e){case Ft.a.CREATE:return fe.h.INSERT;case Ft.a.DELETE:return fe.h.DELETE;case Ft.a.UPDATE:return fe.h.UPDATE;case Ft.a.GET:break;default:Object(Oe.g)(e)}},e.prototype.pause=function(){this.processing=!1},e}(),nn=Object(Gt.b)(3e5),rn=function(e,t,n){var r=nn(e);return!1===r&&"Network Error"===(null==n?void 0:n.message)?3e5:r},on=n(45),sn=function(){return(sn=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)},an=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())}))},un=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])}}},cn=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},ln=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.")},fn={items:[],nextToken:null,startedAt:null},dn=new r.a("DataStore"),hn=function(){function e(e,t,n,r,i,o){void 0===n&&(n={}),this.schema=e,this.syncPredicates=t,this.amplifyConfig=n,this.authModeStrategy=r,this.errorHandler=i,this.modelInstanceCreator=o,this.typeQuery=new WeakMap,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=cn(Object(Ft.b)(t,n,"LIST"),1),i=cn(r[0]).slice(1);e.typeQuery.set(n,i)}))}))},e.prototype.graphqlFilterFromPredicate=function(e){if(!this.syncPredicates)return null;var t=we.a.getPredicates(this.syncPredicates.get(e),!1);return t?Object(Ft.l)(t):null},e.prototype.retrievePage=function(e,t,n,r,i){return void 0===r&&(r=null),an(this,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h,p,v,y,g,m=this;return un(this,(function(b){switch(b.label){case 0:return o=cn(this.typeQuery.get(e),2),s=o[0],a=o[1],u={limit:r,nextToken:n,lastSync:t,filter:i},[4,Object(Ft.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 an(m,void 0,void 0,(function(){var t,n,r,i;return un(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,4]),dn.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(),dn.debug("Sync successful with authMode: "+l[f]),[2,t];case 2:if(n=o.sent(),++f>=l.length){if(r=l[f-1],dn.debug("Sync failed with authMode: "+r,n),Object(Ft.f)(n)||Object(Ft.g)(n))return dn.warn("User is unauthorized to query "+s+" with auth mode "+r+". No data could be returned."),[2,{data:(i={},i[s]=fn,i)}];throw n}return dn.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,s=e.authMode;return an(this,void 0,void 0,(function(){var e=this;return un(this,(function(a){switch(a.label){case 0:return[4,Object(Gt.c)((function(t,n){return an(e,void 0,void 0,(function(){var e,a,u,c,l,f=this;return un(this,(function(d){switch(d.label){case 0:return d.trys.push([0,3,,8]),[4,Object(Ft.i)(s,this.amplifyConfig)];case 1:return e=d.sent(),[4,Vt.a.graphql({query:t,variables:n,authMode:s,authToken:e})];case 2:return[2,d.sent()];case 3:if(a=d.sent(),u=Object(Ft.f)(a)||Object(Ft.g)(a))throw new Gt.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 an(f,void 0,void 0,(function(){var t;return un(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(Wt.c)(e),process:fe.i.sync,remoteModel:null,cause:e})];case 1:return n.sent(),[3,3];case 2:return t=n.sent(),dn.error("Sync error handler failed with:",t),[3,3];case 3:return[2]}}))}))})))]:[3,5]):[3,6]:[3,7];case 4:d.sent(),o.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]=sn(sn({},fn),l.data[r]),dn.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 ue.a((function(r){var a=Object.values(t.schema.namespaces).reduce((function(t,n){var r,i;try{for(var o=ln(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 cn(e,1)[0].syncable})).map((function(e){var a=cn(e,2),u=a[0],c=cn(a[1],2),l=c[0],f=c[1];return an(t,void 0,void 0,(function(){var e,t,a,c,d,h,p,v,y,g=this;return un(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 an(g,void 0,void 0,(function(){var p,y;return un(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}(),pn=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())}))},vn=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])}}},yn=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},gn=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.")},mn=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(yn(arguments[t]));return e},bn=Object(i.b)().isNode,wn=new r.a("DataStore"),Sn=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"}(lt||(lt={}));var _n=function(){function e(e,t,n,r,i,o,s,a,u,c,l){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.online=!1,this.modelSyncedStatus=new WeakMap;var f=this.modelClasses.MutationEvent;this.outbox=new Ht(this.schema,f,o,Sn),this.modelMerger=new Ut(this.outbox,Sn),this.syncQueriesProcessor=new hn(this.schema,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,a),this.subscriptionsProcessor=new on.b(this.schema,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,a),this.mutationsProcessor=new tn(this.schema,this.storage,this.userModelClasses,this.outbox,this.modelInstanceCreator,f,this.amplifyConfig,this.authModeStrategy,a,s),this.datastoreConnectivity=new kt}return e.prototype.getModelSyncedStatus=function(e){return this.modelSyncedStatus.get(e)},e.prototype.start=function(e){var t=this;return new ue.a((function(n){wn.log("starting sync engine...");var r=[];return pn(t,void 0,void 0,(function(){var t,i,o,s=this;return vn(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 pn(s,void 0,void 0,(function(){var t,o,s,a,u,c=this;return vn(this,(function(l){switch(l.label){case 0:return!i||this.online?[3,10]:(this.online=i,n.next({type:lt.SYNC_ENGINE_NETWORK_STATUS,data:{active:this.online}}),o=void 0,bn?(wn.warn("Realtime disabled when in a server-side environment"),[3,6]):[3,1]);case 1:u=yn(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===on.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:wn.log("Realtime ready"),n.next({type:lt.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===lt.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:lt.SYNC_ENGINE_OUTBOX_MUTATION_PROCESSED,data:{model:o,element:s}}),n.next({type:lt.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:!i}})}))),bn||r.push(o.subscribe((function(e){var t=yn(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:lt.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,Sn).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 pn(s,void 0,void 0,(function(){var e,s,u,c;return vn(this,(function(l){switch(l.label){case 0:return e=this.schema.namespaces[this.namespaceResolver(r)],s=this.modelClasses.MutationEvent,u=Object(Ft.k)(a),c=Object(Ft.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:lt.SYNC_ENGINE_OUTBOX_MUTATION_ENQUEUED,data:{model:r,element:o}}),n.next({type:lt.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:!1}}),[4,i];case 2:return l.sent(),this.online&&this.mutationsProcessor.resume(),[2]}}))}))}}),n.next({type:lt.SYNC_ENGINE_STORAGE_SUBSCRIBED}),[4,this.outbox.peek(this.storage)];case 4:return o=void 0===a.sent(),n.next({type:lt.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:o}}),[4,i];case 5:return a.sent(),n.next({type:lt.SYNC_ENGINE_READY}),[2]}}))})),function(){r.forEach((function(e){return e.unsubscribe()}))}}))},e.prototype.getModelsMetadataWithNextFullSync=function(e){return pn(this,void 0,void 0,(function(){var t,n=this;return vn(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 ue.a((function(t){var n,r;return pn(e,void 0,void 0,(function(){var e,i,o=this;return vn(this,(function(s){switch(s.label){case 0:e=function(){var e,s,a,u,c,l,f,d,h;return vn(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,v=i.done,y=i.startedAt,g=i.isFullSync;return pn(o,void 0,void 0,(function(){var i,o,m,b,w,S,_=this;return vn(this,(function(E){switch(E.label){case 0:return i=this.userModelClasses[h.name],e.has(i)||(e.set(i,{new:0,updated:0,deleted:0}),l=Object(Oe.j)(),d=void 0===d?y:Math.max(d,y)),[4,this.storage.runExclusive((function(t){return pn(_,void 0,void 0,(function(){var n,r,o,s,a,u,c,l,f,d,h,v,y,g,m;return vn(this,(function(b){switch(b.label){case 0:return[4,this.outbox.getModelIds(t)];case 1:n=b.sent(),r=[],o=p.filter((function(e){return!n.has(e.id)||(r.push(e),!1)})),s=[],b.label=2;case 2:b.trys.push([2,7,8,9]),a=gn(r),u=a.next(),b.label=3;case 3:return u.done?[3,6]:(c=u.value,[4,this.modelMerger.merge(t,c)]);case 4:void 0!==(l=b.sent())&&s.push([c,l]),b.label=5;case 5:return u=a.next(),[3,3];case 6:return[3,9];case 7:return f=b.sent(),g={error:f},[3,9];case 8:try{u&&!u.done&&(m=a.return)&&m.call(a)}finally{if(g)throw g.error}return[7];case 9:return h=(d=s.push).apply,v=[s],[4,this.modelMerger.mergePage(t,i,o)];case 10:return h.apply(d,v.concat([mn.apply(void 0,[b.sent()])])),y=e.get(i),s.forEach((function(e){var t=yn(e,2)[1];switch(t){case fe.h.INSERT:y.new++;break;case fe.h.UPDATE:y.updated++;break;case fe.h.DELETE:y.deleted++;break;default:Object(Oe.g)(t)}})),[2]}}))}))}))];case 1:return E.sent(),v?(o=h.name,[4,this.getModelMetadata(s,o)]):[3,4];case 2:return m=E.sent(),b=m.lastFullSync,w=m.fullSyncInterval,c=w,u=void 0===u?b:Math.max(u,g?y:b),m=this.modelClasses.ModelMetadata.copyOf(m,(function(e){e.lastSync=y,e.lastFullSync=g?y:m.lastFullSync})),[4,this.storage.save(m,void 0,Sn)];case 3:E.sent(),S=e.get(i),this.modelSyncedStatus.set(i,!0),t.next({type:lt.SYNC_ENGINE_MODEL_SYNCED,data:{model:i,isFullSync:g,isDeltaSync:!g,counts:S}}),a.delete(h),0===a.size&&(f=Object(Oe.j)()-l,r(),t.next({type:lt.SYNC_ENGINE_SYNC_QUERIES_READY}),n.unsubscribe()),E.label=4;case 4:return[2]}}))}))},error:function(e){t.error(e)}}),t.next({type:lt.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),wn.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)}})):ue.a.of()},e.prototype.disconnectionHandler=function(){var e=this;return function(t){Tt.CONTROL_MSG.CONNECTION_CLOSED!==t&&Tt.CONTROL_MSG.TIMEOUT_DISCONNECT!==t||e.datastoreConnectivity.socketDisconnected()}},e.prototype.unsubscribeConnectivity=function(){this.datastoreConnectivity.unsubscribe()},e.prototype.setupModels=function(e){return pn(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,f,d,h,p=this;return vn(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===Oe.e){var n=p.userModelClasses[t.name];p.modelSyncedStatus.set(n,!1)}}))})),o=r.map((function(e){var r=yn(e,2),o=r[0],s=r[1];return pn(p,void 0,void 0,(function(){var e,r,a,u,c,l,f,d,h;return vn(this,(function(p){switch(p.label){case 0:return[4,this.getModelMetadata(o,s.name)];case 1:return e=p.sent(),r=we.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,Sn)];case 2:return l=yn.apply(void 0,[p.sent(),1]),f=yn(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=yn.apply(void 0,[p.sent(),1]),h=yn(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=gn.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 pn(this,void 0,void 0,(function(){var e;return vn(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 pn(this,void 0,void 0,(function(){var n,r,i;return vn(this,(function(o){switch(o.label){case 0:return n=this.modelClasses.ModelMetadata,r=we.a.createFromExisting(this.schema.namespaces[Oe.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=yn.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:Oe.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 En(e){return(En="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 An=function(){return(An=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)},On=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())}))},In=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])}}},Tn=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},Cn=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},xn=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.")},Pn=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Cn(arguments[t]));return e};se(!0),z();var kn,Nn,Mn,jn,Rn,Dn=new r.a("DataStore"),Un=Object(Oe.x)(Date.now()),Fn=i.a.browserOrNode().isNode,Ln=new WeakMap,Bn=new WeakMap,qn=function(e){var t=Ln.get(e);return kn.namespaces[t].models[e.name]},zn=function(e){return Object(Oe.t)(e)&&Ln.has(e)},Kn=function(e){return Ln.get(e)},Hn=function(e){var t;if(void 0!==kn)return console.warn("The schema has already been initialized"),Mn;Dn.log("validating schema",{schema:e});var n=An({name:Oe.e},e);Dn.log("DataStore","Init models"),Mn=Gn(n),Dn.log("DataStore","Models initialized");var r={name:Oe.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=It.getNamespace(),o=_n.getNamespace();return jn=Gn(r),Rn=Gn(i),Nn=Gn(o),kn={namespaces:(t={},t[r.name]=r,t[n.name]=n,t[i.name]=i,t[o.name]=o,t),version:e.version},Object.keys(kn.namespaces).forEach((function(e){var t,n,r=Cn(Object(Oe.f)(kn.namespaces[e]),2),i=r[0],o=r[1];kn.namespaces[e].relationships=i,kn.namespaces[e].keys=o;var s=new Map;Object.values(kn.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,xn(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)}))}kn.namespaces[e].modelTopologicalOrdering=a})),Mn},Vn=function(){if(void 0===kn){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 Dn.error(e),new Error(e)}},Gn=function(e){var t={};return Object.entries(e.models).forEach((function(n){var r=Cn(n,2),i=r[0],o=r[1],s=Xn(o);t[i]=s,Ln.set(s,e.name)})),Object.entries(e.nonModels||{}).forEach((function(e){var n=Cn(e,2),r=n[0],i=n[1],o=nr(i);t[r]=o})),t},Wn=new WeakSet;function Yn(e,t){return Wn.add(t),new e(t)}var Jn,$n=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(fe.n)(i)){var c=fe.c.getJSType(i),l=fe.c.getValidationFunction(i);if("AWSJSON"===i){if(En(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+"], "+En(n)+" received. "+n);if(!Object(Oe.v)(n)&&n.some((function(e){return Object(Oe.v)(e)?o:En(e)!==c}))){var d=n.map((function(e){return null===e?"null":En(e)})).join(",");throw new Error("All elements in the "+a+" array should be of type "+f+", ["+d+"] received. "+n)}if(l&&!Object(Oe.v)(n))if(!n.map((function(e){return Object(Oe.v)(e)?!(!Object(Oe.v)(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(En(n)!==c&&null!==n)throw new Error("Field "+a+" should be of type "+c+", "+En(n)+" received. "+n);if(!Object(Oe.v)(n)&&l&&!l(n))throw new Error("Field "+a+" should be of type "+i+", validation failed. "+n)}}}}},Zn=function(e,t,n){var r=e.fields[t]||{},i=r.isArray,o=r.type;if("string"==typeof n&&(i||"AWSJSON"===o||Object(fe.t)(o)||Object(fe.s)(o)))try{return JSON.parse(n)}catch(e){}return"number"==typeof n&&"Boolean"===o?Boolean(n):n},Qn=function(e,t,n){var r=$n(t);Object.entries(e).forEach((function(e){var i=Cn(e,2),o=i[0],s=i[1],a=Zn(t,o,s);r(o,a),n[o]=a}))},Xn=function(e){var t=function(){function n(t){return oe(this,(function(n){Qn(t,e,n);var r=Wn.has(t)?t:{},i=r.id,o=r._version,s=r._lastChangedAt,a=r._deleted,u=null!=i,c=u?i:e.syncable?Object(ae.v4)():Un();u||er(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(!zn(i)){var o="The source object is not a valid model";throw Dn.error(o,{source:t}),new Error(o)}var s=oe(t,(function(r){n(r),r.id=t.id;var i=$n(e);Object.entries(r).forEach((function(t){var n=Cn(t,2),r=n[0],o=n[1],s=Zn(e,r,o);i(r,s)}))}),(function(e){return r=e}));return r.length&&(Bn.set(s,[r,t]),tr(r,e)),s},n.fromJSON=function(n){var r=this;if(Array.isArray(n))return n.map((function(e){return r.fromJSON(e)}));var i=Yn(t,n),o=$n(e);return Object.entries(i).forEach((function(e){var t=Cn(e,2),n=t[0],r=t[1];o(n,r)})),i},n}();return t[$]=!0,Object.defineProperty(t,"name",{value:e.name}),t},er=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.")}))},tr=function(e,t){var n=e.map((function(e){return[e.path[0],e.value]})),r=t.fields;n.forEach((function(e){var t=Cn(e,2),n=t[0];if(t[1]&&r[n]&&r[n].isReadOnly)throw new Error(n+" is read-only.")}))},nr=function(e){var t=function(t){return oe(this,(function(n){Qn(t,e,n)}))};return t[$]=!0,Object.defineProperty(t,"name",{value:e.name}),Object(Oe.y)(t),t};function rr(e){return"string"==typeof e}function ir(e){var t=e.localModel,n=e.modelConstructor,r=e.remoteModel._version;return Yn(n,An(An({},t),{_version:r}))}function or(e){Dn.warn(e)}function sr(e,t){var n;switch(e){case Oe.a:n=jn[t];break;case Oe.e:n=Mn[t];break;case Oe.d:n=Nn[t];break;case Oe.c:n=Rn[t];break;default:Object(Oe.g)(e)}if(zn(n))return n;var r="Model name is not valid for namespace. modelName: "+t+", namespace: "+e;throw Dn.error(r),new Error(r)}function ar(e,t){return On(this,void 0,void 0,(function(){var n,r,i=this;return In(this,(function(o){switch(o.label){case 0:return n=jn.Setting,r=kn.namespaces[Oe.a].models.Setting,[4,e.runExclusive((function(e){return On(i,void 0,void 0,(function(){var i,o;return In(this,(function(s){switch(s.label){case 0:return[4,e.query(n,we.a.createFromExisting(r,(function(e){return e.key("eq","schemaVersion")})),{page:0,limit:1})];case 1:return i=Cn.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(Yn(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 ur=function(){function e(){var e=this;this.amplifyConfig={},this.syncPredicates=new WeakMap,this.start=function(){return On(e,void 0,void 0,(function(){var e,t,n,r=this;return In(this,(function(i){switch(i.label){case 0:return void 0!==this.initialized?[3,1]:(Dn.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 It(kn,Kn,sr,Yn,this.storageAdapter,this.sessionId),[4,this.storage.init()];case 4:return i.sent(),Vn(),[4,ar(this.storage,kn.version)];case 5:return i.sent(),(e=this.amplifyConfig.aws_appsync_graphqlEndpoint)?(Dn.debug("GraphQL endpoint available",e),t=this,[4,this.processSyncExpressions()]):[3,7];case 6:return t.syncPredicates=i.sent(),this.sync=new _n(kn,Kn,Nn,Mn,this.storage,Yn,this.conflictHandler,this.errorHandler,this.syncPredicates,this.amplifyConfig,this.authModeStrategy),n=1e3*this.fullSyncInterval*60,Jn=this.sync.start({fullSyncInterval:n}).subscribe({next:function(e){var t=e.type,n=e.data;t===(Fn?lt.SYNC_ENGINE_SYNC_QUERIES_READY:lt.SYNC_ENGINE_STORAGE_SUBSCRIBED)&&r.initResolve(),o.a.dispatch("datastore",{event:t,data:n})},error:function(e){Dn.warn("Sync error",e),r.initReject()}}),[3,8];case 7:Dn.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 On(e,void 0,void 0,(function(){var e,i,o,s,a;return In(this,(function(u){switch(u.label){case 0:return[4,this.start()];case 1:if(u.sent(),!zn(t))throw e="Constructor is not for a valid model",Dn.error(e,{modelConstructor:t}),new Error(e);return"string"==typeof n&&void 0!==r&&Dn.warn("Pagination is ignored when querying by id"),i=qn(t),o=rr(n)?we.a.createForId(i,n):Object(we.c)(n)?void 0:we.a.createFromExisting(i,n),s=this.processPagination(i,r),Dn.debug("params ready",{modelConstructor:t,predicate:we.a.getPredicates(o,!1),pagination:An(An({},s),{sort:Se.a.getPredicates(s&&s.sort,!1)})}),[4,this.storage.query(t,o,s)];case 2:return a=u.sent(),[2,rr(n)?a[0]:a]}}))}))},this.save=function(t,n){return On(e,void 0,void 0,(function(){var e,r,i,o,s,a,u=this;return In(this,(function(c){switch(c.label){case 0:return[4,this.start()];case 1:if(c.sent(),e=Bn.get(t),r=t?t.constructor:void 0,!zn(r))throw i="Object is not an instance of a valid model",Dn.error(i,{model:t}),new Error(i);return o=qn(r),s=we.a.createFromExisting(o,n),[4,this.storage.runExclusive((function(n){return On(u,void 0,void 0,(function(){return In(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,we.a.createForId(o,t.id))]}}))}))}))];case 2:return a=Cn.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===ir&&t.conflictHandler?t.conflictHandler:e.conflictHandler||ir},this.setErrorHandler=function(t){var n=t.DataStore;return n&&n.errorHandler?n.errorHandler:e.errorHandler===or&&t.errorHandler?t.errorHandler:e.errorHandler||or},this.delete=function(t,n){return On(e,void 0,void 0,(function(){var e,r,i,o,s,a,u,c,l;return In(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",Dn.error(u,{modelOrConstructor:t}),new Error(u);if(!zn(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",Dn.error(u,{idOrCriteria:n}),new Error(u);if("string"==typeof n)e=we.a.createForId(qn(o),n);else if(!(e=we.a.createFromExisting(qn(o),n))||!we.a.isValidPredicate(e))throw u="Criteria required. Do you want to delete all? Pass Predicates.ALL",Dn.error(u,{condition:e}),new Error(u);return[4,this.storage.delete(o,e)];case 2:return r=Cn.apply(void 0,[f.sent(),1]),[2,r[0]];case 3:if(i=t,o=Object.getPrototypeOf(i||{}).constructor,!zn(o))throw u="Object is not an instance of a valid model",Dn.error(u,{model:i}),new Error(u);if(s=qn(o),a=we.a.createForId(s,i.id),n){if("function"!=typeof n)throw u="Invalid criteria",Dn.error(u,{idOrCriteria:n}),new Error(u);e=n(a)}else e=a;return[4,this.storage.delete(i,e)];case 4:return c=Cn.apply(void 0,[f.sent(),1]),l=Cn(c[0],1),[2,l[0]]}}))}))},this.observe=function(t,n){var r,i=t&&zn(t)?t:void 0;if(t&&void 0===i){var o=t,s=o&&Object.getPrototypeOf(o).constructor;if(zn(s))return n&&Dn.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 Dn.error(a,{model:o}),new Error(a)}if(void 0!==n&&void 0===i){a="Cannot provide criteria without a modelConstructor";throw Dn.error(a,n),new Error(a)}if(i&&!zn(i)){a="Constructor is not for a valid model";throw Dn.error(a,{modelConstructor:i}),new Error(a)}return r="string"==typeof n?we.a.createForId(qn(i),n):i&&we.a.createFromExisting(qn(i),n),new ue.a((function(t){var n;return On(e,void 0,void 0,(function(){return In(this,(function(e){switch(e.label){case 0:return[4,this.start()];case 1:return e.sent(),n=this.storage.observe(i,r).filter((function(e){var t=e.model;return Kn(t)===Oe.e})).map((function(e){var t=e.opType,n=e.model,r=e.condition,i=e.element;return{opType:t,element:e.savedElement||i,model:n,condition:r}})).subscribe(t),[2]}}))})),function(){n&&n.unsubscribe()}}))},this.observeQuery=function(t,n,r){return new ue.a((function(i){var s,a=new Map,u=new Map,c=[],l=function(){var e=p();v(e)},f=new Oe.b({callback:l,errorHandler:i.error,maxInterval:2e3}),d=(r||{}).sort,h=d?{sort:d}:void 0;On(e,void 0,void 0,(function(){var e,r=this;return In(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.query(t,n,h)];case 1:return o.sent().forEach((function(e){return a.set(e.id,e)})),s=this.observe(t,n).subscribe((function(e){var t,n,i=e.element,o=e.model;"DELETE"===e.opType?c.push(i.id):u.set(i.id,i);var s=null!==(n=null===(t=r.sync)||void 0===t?void 0:t.getModelSyncedStatus(o))&&void 0!==n&&n;(u.size-c.length>=r.syncPageSize||s)&&f.resolve(),f.start()})),l(),[3,3];case 2:return e=o.sent(),i.error(e),[3,3];case 3:return[2]}}))}));var p=function(){var n,i,o=null!==(i=null===(n=e.sync)||void 0===n?void 0:n.getModelSyncedStatus(t))&&void 0!==i&&i,s=Pn(Array.from(a.values()),Array.from(u.values()));return(null==r?void 0:r.sort)&&y(s),a.clear(),s.forEach((function(e){return a.set(e.id,e)})),c.forEach((function(e){return a.delete(e)})),{items:Array.from(a.values()),isSynced:o}},v=function(e){i.next(e),u.clear(),c=[]},y=function(n){var i=qn(t),o=e.processPagination(i,r),s=Se.a.getPredicates(o.sort);if(s.length){var a=Object(Oe.z)(s);n.sort(a)}};return o.a.listen("datastore",(function e(n){var r,i=n.payload,s=i.event,a=i.data;s===lt.SYNC_ENGINE_MODEL_SYNCED&&(null===(r=null==a?void 0:a.model)||void 0===r?void 0:r.name)===t.name&&(l(),o.a.remove("api",e))})),function(){s&&s.unsubscribe()}}))},this.configure=function(t){void 0===t&&(t={});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=Tn(t,["DataStore","authModeStrategyType","conflictHandler","errorHandler","maxRecordsToSync","syncPageSize","fullSyncInterval","syncExpressions","authProviders","storageAdapter"]);switch(e.amplifyConfig=An(An({},l),e.amplifyConfig),e.conflictHandler=e.setConflictHandler(t),e.errorHandler=e.setErrorHandler(t),n&&n.authModeStrategyType||r||fe.a.DEFAULT){case fe.a.MULTI_AUTH:e.authModeStrategy=me;break;case fe.a.DEFAULT:default:e.authModeStrategy=be}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 On(this,void 0,void 0,(function(){return In(this,(function(e){switch(e.label){case 0:return Vn(),void 0!==this.storage?[3,2]:(this.storage=new It(kn,Kn,sr,Yn,this.storageAdapter,this.sessionId),[4,this.storage.init()]);case 1:e.sent(),e.label=2;case 2:return Jn&&!Jn.closed&&Jn.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 On(this,void 0,void 0,(function(){return In(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 Jn&&!Jn.closed&&Jn.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=Se.a.createFromExisting(e,t.sort)),{limit:i,page:o,sort:n}}},e.prototype.processSyncExpressions=function(){return On(this,void 0,void 0,(function(){var e,t=this;return In(this,(function(n){switch(n.label){case 0:return this.syncExpressions&&this.syncExpressions.length?[4,Promise.all(this.syncExpressions.map((function(e){return On(t,void 0,void 0,(function(){var t,n,r,i,o,s;return In(this,(function(a){switch(a.label){case 0:return[4,e];case 1:return t=a.sent(),n=t.modelConstructor,r=t.conditionProducer,i=qn(n),[4,this.unwrapPromise(r)];case 2:return o=a.sent(),Object(we.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 we.a.createFromExisting(e,t)}catch(e){throw Dn.error("Error creating Sync Predicate"),e}},e.prototype.unwrapPromise=function(e){return On(this,void 0,void 0,(function(){var t;return In(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=Cn(t,2),r=n[0],i=n[1];if(e.has(r)){var o=r.name;return Dn.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+"-"+Cn(t.split("."),1)[0]}}catch(e){return}},e}(),cr=new ur;s.a.register(cr);var lr={USER:Oe.e,traverseModel:Oe.A,validatePredicate:Oe.B,isNonModelConstructor:Oe.u,isModelConstructor:Oe.t}},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(22),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 i}));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={clockOffset:0,getDateWithClockOffset:function(){return i.clockOffset?new Date((new Date).getTime()+i.clockOffset):new Date},getClockOffset:function(){return i.clockOffset},getHeaderStringFromDate:function(e){return void 0===e&&(e=i.getDateWithClockOffset()),e.toISOString().replace(/[:\-]|\.\d{3}/g,"")},getDateFromHeaderString:function(e){var t=r(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()-i.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){i.clockOffset=e}}}])}));
|
|
66
66
|
//# sourceMappingURL=aws-amplify-datastore.min.js.map
|