@aws-amplify/datastore 3.14.6 → 3.14.7

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.
@@ -59,7 +59,7 @@ function I(e){return i.Buffer.from((new h).random(e).toString(),"hex")}O.prototy
59
59
  *
60
60
  * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
61
61
  * Released under the MIT license
62
- */!function(o){if(void 0===(i="function"==typeof(r=o)?r.call(t,n,t,e):r)||(e.exports=i),!0,e.exports=o(),!!0){var s=window.Cookies,a=window.Cookies=o();a.noConflict=function(){return window.Cookies=s,a}}}((function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function i(){}function o(t,n,o){if("undefined"!=typeof document){"number"==typeof(o=e({path:"/"},i.defaults,o)).expires&&(o.expires=new Date(1*new Date+864e5*o.expires)),o.expires=o.expires?o.expires.toUTCString():"";try{var s=JSON.stringify(n);/^[\{\[]/.test(s)&&(n=s)}catch(e){}n=r.write?r.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var a="";for(var u in o)o[u]&&(a+="; "+u,!0!==o[u]&&(a+="="+o[u].split(";")[0]));return document.cookie=t+"="+n+a}}function s(e,n){if("undefined"!=typeof document){for(var i={},o=document.cookie?document.cookie.split("; "):[],s=0;s<o.length;s++){var a=o[s].split("="),u=a.slice(1).join("=");n||'"'!==u.charAt(0)||(u=u.slice(1,-1));try{var c=t(a[0]);if(u=(r.read||r)(u,c)||t(u),n)try{u=JSON.parse(u)}catch(e){}if(i[c]=u,e===c)break}catch(e){}}return e?i[e]:i}}return i.set=o,i.get=function(e){return s(e,!1)},i.getJSON=function(e){return s(e,!0)},i.remove=function(t,n){o(t,"",e(n,{expires:-1}))},i.defaults={},i.withConverter=n,i}((function(){}))}))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){e.exports=n(125)},function(e,t,n){"use strict";(function(t){var r=n(13),i=n(130),o=n(57),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(58)),u),transformRequest:[function(e,t){return i(t,"Accept"),i(t,"Content-Type"),r.isFormData(e)||r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e)?e:r.isArrayBufferView(e)?e.buffer:r.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):r.isObject(e)||t&&"application/json"===t["Content-Type"]?(a(t,"application/json"),function(e,t,n){if(r.isString(e))try{return(t||JSON.parse)(e),r.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||c.transitional,n=t&&t.silentJSONParsing,i=t&&t.forcedJSONParsing,s=!n&&"json"===this.responseType;if(s||i&&r.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(s){if("SyntaxError"===e.name)throw o(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],(function(e){c.headers[e]={}})),r.forEach(["post","put","patch"],(function(e){c.headers[e]=r.merge(s)})),e.exports=c}).call(this,n(45))},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";n.d(t,"a",(function(){return $}));var r=n(4),i=n(21),o=n(76),s=n(154),a=function(){return(a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},u=new i.a("Parser"),c=function(e){var t,n={};if(e.aws_mobile_analytics_app_id){var r={AWSPinpoint:{appId:e.aws_mobile_analytics_app_id,region:e.aws_mobile_analytics_app_region}};n.Analytics=r}return(e.aws_cognito_identity_pool_id||e.aws_user_pools_id)&&(n.Auth={userPoolId:e.aws_user_pools_id,userPoolWebClientId:e.aws_user_pools_web_client_id,region:e.aws_cognito_region,identityPoolId:e.aws_cognito_identity_pool_id,identityPoolRegion:e.aws_cognito_region,mandatorySignIn:"enable"===e.aws_mandatory_sign_in,signUpVerificationMethod:e.aws_cognito_sign_up_verification_method||"code"}),t=e.aws_user_files_s3_bucket?{AWSS3:{bucket:e.aws_user_files_s3_bucket,region:e.aws_user_files_s3_bucket_region,dangerouslyConnectToHttpEndpointForTesting:e.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing}}:e?e.Storage||e:{},e.Logging&&(n.Logging=a(a({},e.Logging),{region:e.aws_project_region})),e.geo&&(n.Geo=Object.assign({},e.geo),e.geo.amazon_location_service&&(n.Geo={AmazonLocationService:e.geo.amazon_location_service})),n.Analytics=Object.assign({},n.Analytics,e.Analytics),n.Auth=Object.assign({},n.Auth,e.Auth),n.Storage=Object.assign({},t),n.Logging=Object.assign({},n.Logging,e.Logging),u.debug("parse config",e,"to amplifyconfig",n),n},l=function(){function e(){}return e.parseMobilehubConfig=c,e}(),f=n(26);function d(e,t){void 0===t&&(t={});var n=function(e){if(e&&"j"===e[0]&&":"===e[1])return e.substr(2);return e}(e);if(function(e,t){return void 0===t&&(t=!e||"{"!==e[0]&&"["!==e[0]&&'"'!==e[0]),!t}(n,t.doNotParse))try{return JSON.parse(n)}catch(e){}return e}var h=function(){return(h=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},p=function(){function e(e,t){var n=this;this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.cookies=function(e,t){return"string"==typeof e?f.parse(e,t):"object"==typeof e&&null!==e?e:{}}(e,t),new Promise((function(){n.HAS_DOCUMENT_COOKIE="object"==typeof document&&"string"==typeof document.cookie})).catch((function(){}))}return e.prototype._updateBrowserValues=function(e){this.HAS_DOCUMENT_COOKIE&&(this.cookies=f.parse(document.cookie,e))},e.prototype._emitChange=function(e){for(var t=0;t<this.changeListeners.length;++t)this.changeListeners[t](e)},e.prototype.get=function(e,t,n){return void 0===t&&(t={}),this._updateBrowserValues(n),d(this.cookies[e],t)},e.prototype.getAll=function(e,t){void 0===e&&(e={}),this._updateBrowserValues(t);var n={};for(var r in this.cookies)n[r]=d(this.cookies[r],e);return n},e.prototype.set=function(e,t,n){var r;"object"==typeof t&&(t=JSON.stringify(t)),this.cookies=h(h({},this.cookies),((r={})[e]=t,r)),this.HAS_DOCUMENT_COOKIE&&(document.cookie=f.serialize(e,t,n)),this._emitChange({name:e,value:t,options:n})},e.prototype.remove=function(e,t){var n=t=h(h({},t),{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=h({},this.cookies),delete this.cookies[e],this.HAS_DOCUMENT_COOKIE&&(document.cookie=f.serialize(e,"",n)),this._emitChange({name:e,value:void 0,options:t})},e.prototype.addChangeListener=function(e){this.changeListeners.push(e)},e.prototype.removeChangeListener=function(e){var t=this.changeListeners.indexOf(e);t>=0&&this.changeListeners.splice(t,1)},e}(),v=n(16),y=Object(v.b)().isBrowser,g=function(){function e(e){void 0===e&&(e={}),this.cookies=new p,this.store=y?window.localStorage:Object.create(null),this.cookies=e.req?new p(e.req.headers.cookie):new p,Object.assign(this.store,this.cookies.getAll())}return Object.defineProperty(e.prototype,"length",{get:function(){return Object.entries(this.store).length},enumerable:!0,configurable:!0}),e.prototype.clear=function(){var e=this;Array.from(new Array(this.length)).map((function(t,n){return e.key(n)})).forEach((function(t){return e.removeItem(t)}))},e.prototype.getItem=function(e){return this.getLocalItem(e)},e.prototype.getLocalItem=function(e){return Object.prototype.hasOwnProperty.call(this.store,e)?this.store[e]:null},e.prototype.getUniversalItem=function(e){return this.cookies.get(e)},e.prototype.key=function(e){return Object.keys(this.store)[e]},e.prototype.removeItem=function(e){this.removeLocalItem(e),this.removeUniversalItem(e)},e.prototype.removeLocalItem=function(e){delete this.store[e]},e.prototype.removeUniversalItem=function(e){this.cookies.remove(e,{path:"/"})},e.prototype.setItem=function(e,t){switch(this.setLocalItem(e,t),e.split(".").pop()){case"LastAuthUser":case"accessToken":case"refreshToken":case"idToken":y?this.setUniversalItem(e,t):this.setLocalItem(e,t)}},e.prototype.setLocalItem=function(e,t){this.store[e]=t},e.prototype.setUniversalItem=function(e,t){this.cookies.set(e,t,{path:"/",sameSite:!0,secure:"localhost"!==window.location.hostname})},e}(),m=n(65);var b,w=n(37),S=n(8),_=n(9),E=function(e){var t=window.open(e,"_self");return t?Promise.resolve(t):Promise.reject()},A=n(72),O=n.n(A),I=n(73),T=n.n(I),C=function(){return(C=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},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())}))},x=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},k=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},N="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",j=function(e,t,n){o.a.dispatch("auth",{event:e,data:t,message:n},"Auth",N)},M=new i.a("OAuth"),R=function(){function e(e){var t=e.config,n=e.cognitoClientId,r=e.scopes,i=void 0===r?[]:r;if(this._urlOpener=t.urlOpener||E,this._config=t,this._cognitoClientId=n,!this.isValidScopes(i))throw Error("scopes must be a String Array");this._scopes=i}return e.prototype.isValidScopes=function(e){return Array.isArray(e)&&e.every((function(e){return"string"==typeof e}))},e.prototype.oauthSignIn=function(e,t,n,i,o,s){void 0===e&&(e="code"),void 0===o&&(o=r.b.Cognito);var a=this._generateState(32),u=s?a+"-"+s.split("").map((function(e){return e.charCodeAt(0).toString(16).padStart(2,"0")})).join(""):a;!function(e){window.sessionStorage.setItem("oauth_state",e)}(u);var c,l=this._generateRandom(128);c=l,window.sessionStorage.setItem("ouath_pkce_key",c);var f=this._generateChallenge(l),d=this._scopes.join(" "),h="https://"+t+"/oauth2/authorize?"+Object.entries(C(C({redirect_uri:n,response_type:e,client_id:i,identity_provider:o,scope:d,state:u},"code"===e?{code_challenge:f}:{}),"code"===e?{code_challenge_method:"S256"}:{})).map((function(e){var t=k(e,2),n=t[0],r=t[1];return encodeURIComponent(n)+"="+encodeURIComponent(r)})).join("&");M.debug("Redirecting to "+h),this._urlOpener(h,n)},e.prototype._handleCodeFlow=function(e){return P(this,void 0,void 0,(function(){var t,n,i,o,s,a,u,c,l,f,d,h,p,v;return x(this,(function(y){switch(y.label){case 0:return t=(Object(_.parse)(e).query||"").split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n,r=k(t,2),i=r[0],o=r[1];return C(C({},e),((n={})[i]=o,n))}),{code:void 0}).code,n=Object(_.parse)(e).pathname||"/",i=Object(_.parse)(this._config.redirectSignIn).pathname||"/",t&&n===i?(o="https://"+this._config.domain+"/oauth2/token",j("codeFlow",{},"Retrieving tokens from "+o),s=Object(r.e)(this._config)?this._cognitoClientId:this._config.clientID,a=Object(r.e)(this._config)?this._config.redirectSignIn:this._config.redirectUri,g=window.sessionStorage.getItem("ouath_pkce_key"),window.sessionStorage.removeItem("ouath_pkce_key"),c=C({grant_type:"authorization_code",code:t,client_id:s,redirect_uri:a},(u=g)?{code_verifier:u}:{}),M.debug("Calling token endpoint: "+o+" with",c),l=Object.entries(c).map((function(e){var t=k(e,2),n=t[0],r=t[1];return encodeURIComponent(n)+"="+encodeURIComponent(r)})).join("&"),[4,fetch(o,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:l})]):[2];case 1:return[4,y.sent().json()];case 2:if(f=y.sent(),d=f.access_token,h=f.refresh_token,p=f.id_token,v=f.error)throw new Error(v);return[2,{accessToken:d,refreshToken:h,idToken:p}]}var g}))}))},e.prototype._handleImplicitFlow=function(e){return P(this,void 0,void 0,(function(){var t,n,r;return x(this,(function(i){return t=(Object(_.parse)(e).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n,r=k(t,2),i=r[0],o=r[1];return C(C({},e),((n={})[i]=o,n))}),{id_token:void 0,access_token:void 0}),n=t.id_token,r=t.access_token,j("implicitFlow",{},"Got tokens from "+e),M.debug("Retrieving implicit tokens from "+e+" with"),[2,{accessToken:r,idToken:n,refreshToken:null}]}))}))},e.prototype.handleAuthResponse=function(e){return P(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return x(this,(function(u){switch(u.label){case 0:if(u.trys.push([0,5,,6]),t=e?C(C({},(Object(_.parse)(e).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n=k(t,2),r=n[0],i=n[1];return e[r]=i,e}),{})),(Object(_.parse)(e).query||"").split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n=k(t,2),r=n[0],i=n[1];return e[r]=i,e}),{})):{},n=t.error,r=t.error_description,n)throw new Error(r);return i=this._validateState(t),M.debug("Starting "+this._config.responseType+" flow with "+e),"code"!==this._config.responseType?[3,2]:(o=[{}],[4,this._handleCodeFlow(e)]);case 1:return[2,C.apply(void 0,[C.apply(void 0,o.concat([u.sent()])),{state:i}])];case 2:return s=[{}],[4,this._handleImplicitFlow(e)];case 3:return[2,C.apply(void 0,[C.apply(void 0,s.concat([u.sent()])),{state:i}])];case 4:return[3,6];case 5:throw a=u.sent(),M.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 P(this,void 0,void 0,(function(){var e,t,n;return x(this,(function(i){return e="https://"+this._config.domain+"/logout?",t=Object(r.e)(this._config)?this._cognitoClientId:this._config.oauth.clientID,n=Object(r.e)(this._config)?this._config.redirectSignOut:this._config.returnTo,e+=Object.entries({client_id:t,logout_uri:encodeURIComponent(n)}).map((function(e){var t=k(e,2);return t[0]+"="+t[1]})).join("&"),j("oAuthSignOut",{oAuth:"signOut"},"Signing out from "+e),M.debug("Signing out from "+e),[2,this._urlOpener(e,n)]}))}))},e.prototype._generateState=function(e){for(var t="",n=e,r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";n>0;--n)t+=r[Math.round(Math.random()*(r.length-1))];return t},e.prototype._generateChallenge=function(e){return this._base64URL(O()(e))},e.prototype._base64URL=function(e){return e.toString(T.a).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},e.prototype._generateRandom=function(e){var t=new Uint8Array(e);if("undefined"!=typeof window&&window.crypto)window.crypto.getRandomValues(t);else for(var n=0;n<e;n+=1)t[n]=Math.random()*"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~".length|0;return this._bufferToString(t)},e.prototype._bufferToString=function(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=[],r=0;r<e.byteLength;r+=1){var i=e[r]%t.length;n.push(t[i])}return n.join("")},e}(),D=n(11),U=(b=function(e,t){return(b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}b(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),F=new i.a("AuthError"),L=function(e){function t(n){var r=this,i=q[n],o=i.message,s=i.log;return(r=e.call(this,o)||this).constructor=t,Object.setPrototypeOf(r,t.prototype),r.name="AuthError",r.log=s||o,F.error(r.log),r}return U(t,e),t}(Error),B=function(e){function t(n){var r=e.call(this,n)||this;return r.constructor=t,Object.setPrototypeOf(r,t.prototype),r.name="NoUserPoolError",r}return U(t,e),t}(L),q={noConfig:{message:D.a.DEFAULT_MSG,log:"\n Error: Amplify has not been configured correctly.\n This error is typically caused by one of the following scenarios:\n\n 1. Make sure you're passing the awsconfig object to Amplify.configure() in your app's entry point\n See https://aws-amplify.github.io/docs/js/authentication#configure-your-app for more information\n \n 2. There might be multiple conflicting versions of amplify packages in your node_modules.\n\t\t\t\tRefer to our docs site for help upgrading Amplify packages (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js)\n "},missingAuthConfig:{message:D.a.DEFAULT_MSG,log:"\n Error: Amplify has not been configured correctly. \n The configuration object is missing required auth properties.\n This error is typically caused by one of the following scenarios:\n\n 1. Did you run `amplify push` after adding auth via `amplify add auth`?\n See https://aws-amplify.github.io/docs/js/authentication#amplify-project-setup for more information\n\n 2. This could also be caused by multiple conflicting versions of amplify packages, see (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js) for help upgrading Amplify packages.\n "},emptyUsername:{message:D.a.EMPTY_USERNAME},invalidUsername:{message:D.a.INVALID_USERNAME},emptyPassword:{message:D.a.EMPTY_PASSWORD},emptyCode:{message:D.a.EMPTY_CODE},signUpError:{message:D.a.SIGN_UP_ERROR,log:"The first parameter should either be non-null string or object"},noMFA:{message:D.a.NO_MFA},invalidMFA:{message:D.a.INVALID_MFA},emptyChallengeResponse:{message:D.a.EMPTY_CHALLENGE},noUserSession:{message:D.a.NO_USER_SESSION},deviceConfig:{message:D.a.DEVICE_CONFIG},networkError:{message:D.a.NETWORK_ERROR},autoSignInError:{message:D.a.AUTOSIGNIN_ERROR},default:{message:D.a.DEFAULT_MSG}};function z(e){return(z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var K=function(){return(K=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},V=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},H=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},G=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},W=new i.a("AuthClass"),Y="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",J=function(e,t,n){o.a.dispatch("auth",{event:e,data:t,message:n},"Auth",Y)},$=new(function(){function e(e){var t=this;this.userPool=null,this.user=null,this.oAuthFlowInProgress=!1,this.autoSignInInitiated=!1,this.Credentials=s.a,this.wrapRefreshSessionCallback=function(e){return function(t,n){return n?J("tokenRefresh",void 0,"New token retrieved"):J("tokenRefresh_failure",t,"Failed to retrieve new token"),e(t,n)}},this.configure(e),this.currentCredentials=this.currentCredentials.bind(this),this.currentUserCredentials=this.currentUserCredentials.bind(this),o.a.listen("auth",(function(e){switch(e.payload.event){case"signIn":t._storage.setItem("amplify-signin-with-hostedUI","false");break;case"signOut":t._storage.removeItem("amplify-signin-with-hostedUI");break;case"cognitoHostedUI":t._storage.setItem("amplify-signin-with-hostedUI","true")}}))}return e.prototype.getModuleName=function(){return"Auth"},e.prototype.configure=function(e){var t=this;if(!e)return this._config||{};W.debug("configure Auth");var n=Object.assign({},this._config,l.parseMobilehubConfig(e).Auth,e);this._config=n;var i=this._config,o=i.userPoolId,s=i.userPoolWebClientId,a=i.cookieStorage,u=i.oauth,c=i.region,f=i.identityPoolId,d=i.mandatorySignIn,h=i.refreshHandlers,p=i.identityPoolRegion,y=i.clientMetadata,b=i.endpoint;if(this._config.storage){if(!this._isValidAuthStorage(this._config.storage))throw W.error("The storage in the Auth config is not valid!"),new Error("Empty storage object");this._storage=this._config.storage}else this._storage=a?new S.i(a):e.ssr?new g:(new m.a).getStorage();if(this._storageSync=Promise.resolve(),"function"==typeof this._storage.sync&&(this._storageSync=this._storage.sync()),o){var w={UserPoolId:o,ClientId:s,endpoint:b};w.Storage=this._storage,this.userPool=new S.g(w,this.wrapRefreshSessionCallback)}this.Credentials.configure({mandatorySignIn:d,region:p||c,userPoolId:o,identityPoolId:f,refreshHandlers:h,storage:this._storage});var _=u?Object(r.e)(this._config.oauth)?u:u.awsCognito:void 0;if(_){var E=Object.assign({cognitoClientId:s,UserPoolId:o,domain:_.domain,scopes:_.scope,redirectSignIn:_.redirectSignIn,redirectSignOut:_.redirectSignOut,responseType:_.responseType,Storage:this._storage,urlOpener:_.urlOpener,clientMetadata:y},_.options);this._oAuthHandler=new R({scopes:E.scopes,config:E,cognitoClientId:E.cognitoClientId});var A={};!function(e){if(Object(v.b)().isBrowser&&window.location)e({url:window.location.href});else if(!Object(v.b)().isNode)throw new Error("Not supported")}((function(e){var n=e.url;A[n]||(A[n]=!0,t._handleAuthResponse(n))}))}(J("configured",null,"The Auth category has been configured successfully"),this.autoSignInInitiated||"function"!=typeof this._storage.getItem)||(this.isTrueStorageValue("amplify-polling-started")&&(J("autoSignIn_failure",null,r.a.AutoSignInError),this._storage.removeItem("amplify-auto-sign-in")),this._storage.removeItem("amplify-polling-started"));return this._config},e.prototype.signUp=function(e){for(var t,n,i,o=this,s=[],a=1;a<arguments.length;a++)s[a-1]=arguments[a];if(!this.userPool)return this.rejectNoUserPool();var u,c=null,l=null,f=[],d=null,h={enabled:!1},p={},v={};if(e&&"string"==typeof e){c=e,l=s?s[0]:null;var y=s?s[1]:null,g=s?s[2]:null;y&&f.push(new S.f({Name:"email",Value:y})),g&&f.push(new S.f({Name:"phone_number",Value:g}))}else{if(!e||"object"!==z(e))return this.rejectAuthError(r.a.SignUpError);c=e.username,l=e.password,e&&e.clientMetadata?u=e.clientMetadata:this._config.clientMetadata&&(u=this._config.clientMetadata);var m=e.attributes;m&&Object.keys(m).map((function(e){f.push(new S.f({Name:e,Value:m[e]}))}));var b=e.validationData;b&&(d=[],Object.keys(b).map((function(e){d.push(new S.f({Name:e,Value:b[e]}))}))),(h=null!==(t=e.autoSignIn)&&void 0!==t?t:{enabled:!1}).enabled&&(this._storage.setItem("amplify-auto-sign-in","true"),p=null!==(n=h.validationData)&&void 0!==n?n:{},v=null!==(i=h.clientMetaData)&&void 0!==i?i:{})}return c?l?(W.debug("signUp attrs:",f),W.debug("signUp validation data:",d),new Promise((function(e,t){o.userPool.signUp(c,l,f,d,(function(n,r){n?(J("signUp_failure",n,c+" failed to signup"),t(n)):(J("signUp",r,c+" has signed up successfully"),h.enabled&&o.handleAutoSignIn(c,l,p,v,r),e(r))}),u)}))):this.rejectAuthError(r.a.EmptyPassword):this.rejectAuthError(r.a.EmptyUsername)},e.prototype.handleAutoSignIn=function(e,t,n,r,i){this.autoSignInInitiated=!0;var o=new S.a({Username:e,Password:t,ValidationData:n,ClientMetadata:r});i.userConfirmed?this.signInAfterUserConfirmed(o):"link"===this._config.signUpVerificationMethod?this.handleLinkAutoSignIn(o):this.handleCodeAutoSignIn(o)},e.prototype.handleCodeAutoSignIn=function(e){var t=this;o.a.listen("auth",(function n(r){"confirmSignUp"===r.payload.event&&t.signInAfterUserConfirmed(e,n)}))},e.prototype.handleLinkAutoSignIn=function(e){var t=this;this._storage.setItem("amplify-polling-started","true");var n=Date.now(),r=setInterval((function(){Date.now()-n>18e4?(clearInterval(r),J("autoSignIn_failure",null,"Please confirm your account and use your credentials to sign in."),t._storage.removeItem("amplify-auto-sign-in")):t.signInAfterUserConfirmed(e,null,r)}),5e3)},e.prototype.signInAfterUserConfirmed=function(e,t,n){return V(this,void 0,void 0,(function(){var r,i,s=this;return H(this,(function(a){switch(a.label){case 0:r=this.createCognitoUser(e.getUsername()),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,r.authenticateUser(e,this.authCallbacks(r,(function(r){J("autoSignIn",r,e.getUsername()+" has signed in successfully"),t&&o.a.remove("auth",t),n&&(clearInterval(n),s._storage.removeItem("amplify-polling-started")),s._storage.removeItem("amplify-auto-sign-in")}),(function(e){W.error(e),s._storage.removeItem("amplify-auto-sign-in")})))];case 2:return a.sent(),[3,4];case 3:return i=a.sent(),W.error(i),[3,4];case 4:return[2]}}))}))},e.prototype.confirmSignUp=function(e,t,n){var i=this;if(!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(r.a.EmptyUsername);if(!t)return this.rejectAuthError(r.a.EmptyCode);var o,s=this.createCognitoUser(e),a=!n||"boolean"!=typeof n.forceAliasCreation||n.forceAliasCreation;return n&&n.clientMetadata?o=n.clientMetadata:this._config.clientMetadata&&(o=this._config.clientMetadata),new Promise((function(n,u){s.confirmRegistration(t,a,(function(t,o){t?u(t):(J("confirmSignUp",o,e+" has been confirmed successfully"),i.isTrueStorageValue("amplify-auto-sign-in")&&!i.autoSignInInitiated&&(J("autoSignIn_failure",null,r.a.AutoSignInError),i._storage.removeItem("amplify-auto-sign-in")),n(o))}),o)}))},e.prototype.isTrueStorageValue=function(e){var t=this._storage.getItem(e);return!!t&&"true"===t},e.prototype.resendSignUp=function(e,t){if(void 0===t&&(t=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(r.a.EmptyUsername);var n=this.createCognitoUser(e);return new Promise((function(e,r){n.resendConfirmationCode((function(t,n){t?r(t):e(n)}),t)}))},e.prototype.signIn=function(e,t,n){if(void 0===n&&(n=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();var i=null,o=null,s={};if("string"==typeof e)i=e,o=t;else{if(!Object(r.h)(e))return this.rejectAuthError(r.a.InvalidUsername);void 0!==t&&W.warn("The password should be defined under the first parameter object!"),i=e.username,o=e.password,s=e.validationData}if(!i)return this.rejectAuthError(r.a.EmptyUsername);var a=new S.a({Username:i,Password:o,ValidationData:s,ClientMetadata:n});return o?this.signInWithPassword(a):this.signInWithoutPassword(a)},e.prototype.authCallbacks=function(e,t,n){var r=this,i=this;return{onSuccess:function(o){return V(r,void 0,void 0,(function(){var r,s,a,u;return H(this,(function(c){switch(c.label){case 0:W.debug(o),delete e.challengeName,delete e.challengeParam,c.label=1;case 1:return c.trys.push([1,4,5,9]),[4,this.Credentials.clear()];case 2:return c.sent(),[4,this.Credentials.set(o,"session")];case 3:return r=c.sent(),W.debug("succeed to get cognito credentials",r),[3,9];case 4:return s=c.sent(),W.debug("cannot get cognito credentials",s),[3,9];case 5:return c.trys.push([5,7,,8]),[4,this.currentUserPoolUser()];case 6:return a=c.sent(),i.user=a,J("signIn",a,"A user "+e.getUsername()+" has been signed in"),t(a),[3,8];case 7:return u=c.sent(),W.error("Failed to get the signed in user",u),n(u),[3,8];case 8:return[7];case 9:return[2]}}))}))},onFailure:function(t){W.debug("signIn failure",t),J("signIn_failure",t,e.getUsername()+" failed to signin"),n(t)},customChallenge:function(n){W.debug("signIn custom challenge answer required"),e.challengeName="CUSTOM_CHALLENGE",e.challengeParam=n,t(e)},mfaRequired:function(n,r){W.debug("signIn MFA required"),e.challengeName=n,e.challengeParam=r,t(e)},mfaSetup:function(n,r){W.debug("signIn mfa setup",n),e.challengeName=n,e.challengeParam=r,t(e)},newPasswordRequired:function(n,r){W.debug("signIn new password"),e.challengeName="NEW_PASSWORD_REQUIRED",e.challengeParam={userAttributes:n,requiredAttributes:r},t(e)},totpRequired:function(n,r){W.debug("signIn totpRequired"),e.challengeName=n,e.challengeParam=r,t(e)},selectMFAType:function(n,r){W.debug("signIn selectMFAType",n),e.challengeName=n,e.challengeParam=r,t(e)}}},e.prototype.signInWithPassword=function(e){var t=this;if(this.pendingSignIn)throw new Error("Pending sign-in attempt already in progress");var n=this.createCognitoUser(e.getUsername());return this.pendingSignIn=new Promise((function(r,i){n.authenticateUser(e,t.authCallbacks(n,(function(e){t.pendingSignIn=null,r(e)}),(function(e){t.pendingSignIn=null,i(e)})))})),this.pendingSignIn},e.prototype.signInWithoutPassword=function(e){var t=this,n=this.createCognitoUser(e.getUsername());return n.setAuthenticationFlowType("CUSTOM_AUTH"),new Promise((function(r,i){n.initiateAuth(e,t.authCallbacks(n,r,i))}))},e.prototype.getMFAOptions=function(e){return new Promise((function(t,n){e.getMFAOptions((function(e,r){if(e)return W.debug("get MFA Options failed",e),void n(e);W.debug("get MFA options success",r),t(r)}))}))},e.prototype.getPreferredMFA=function(e,t){var n=this,r=this;return new Promise((function(i,o){var s=n._config.clientMetadata,a=!!t&&t.bypassCache;e.getUserData((function(t,s){return V(n,void 0,void 0,(function(){var n,a;return H(this,(function(u){switch(u.label){case 0:if(!t)return[3,5];if(W.debug("getting preferred mfa failed",t),!this.isSessionInvalid(t))return[3,4];u.label=1;case 1:return u.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return u.sent(),[3,4];case 3:return n=u.sent(),o(new Error("Session is invalid due to: "+t.message+" and failed to clean up invalid session: "+n.message)),[2];case 4:return o(t),[2];case 5:return(a=r._getMfaTypeFromUserData(s))?(i(a),[2]):(o("invalid MFA Type"),[2])}}))}))}),{bypassCache:a,clientMetadata:s})}))},e.prototype._getMfaTypeFromUserData=function(e){var t=null,n=e.PreferredMfaSetting;if(n)t=n;else{var r=e.UserMFASettingList;if(r)0===r.length?t="NOMFA":W.debug("invalid case for getPreferredMFA",e);else t=e.MFAOptions?"SMS_MFA":"NOMFA"}return t},e.prototype._getUserData=function(e,t){var n=this;return new Promise((function(r,i){e.getUserData((function(t,o){return V(n,void 0,void 0,(function(){var n;return H(this,(function(s){switch(s.label){case 0:if(!t)return[3,5];if(W.debug("getting user data failed",t),!this.isSessionInvalid(t))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return s.sent(),[3,4];case 3:return n=s.sent(),i(new Error("Session is invalid due to: "+t.message+" and failed to clean up invalid session: "+n.message)),[2];case 4:return i(t),[2];case 5:r(o),s.label=6;case 6:return[2]}}))}))}),t)}))},e.prototype.setPreferredMFA=function(e,t){return V(this,void 0,void 0,(function(){var n,i,o,s,a,u,c=this;return H(this,(function(l){switch(l.label){case 0:return n=this._config.clientMetadata,[4,this._getUserData(e,{bypassCache:!0,clientMetadata:n})];case 1:switch(i=l.sent(),o=null,s=null,t){case"TOTP":case"SOFTWARE_TOKEN_MFA":return[3,2];case"SMS":case"SMS_MFA":return[3,3];case"NOMFA":return[3,4]}return[3,6];case 2:return s={PreferredMfa:!0,Enabled:!0},[3,7];case 3:return o={PreferredMfa:!0,Enabled:!0},[3,7];case 4:return a=i.UserMFASettingList,[4,this._getMfaTypeFromUserData(i)];case 5:if("NOMFA"===(u=l.sent()))return[2,Promise.resolve("No change for mfa type")];if("SMS_MFA"===u)o={PreferredMfa:!1,Enabled:!1};else{if("SOFTWARE_TOKEN_MFA"!==u)return[2,this.rejectAuthError(r.a.InvalidMFA)];s={PreferredMfa:!1,Enabled:!1}}return a&&0!==a.length&&a.forEach((function(e){"SMS_MFA"===e?o={PreferredMfa:!1,Enabled:!1}:"SOFTWARE_TOKEN_MFA"===e&&(s={PreferredMfa:!1,Enabled:!1})})),[3,7];case 6:return W.debug("no validmfa method provided"),[2,this.rejectAuthError(r.a.NoMFA)];case 7:return this,[2,new Promise((function(t,r){e.setUserMfaPreference(o,s,(function(i,o){if(i)return W.debug("Set user mfa preference error",i),r(i);W.debug("Set user mfa success",o),W.debug("Caching the latest user data into local"),e.getUserData((function(n,i){return V(c,void 0,void 0,(function(){var i;return H(this,(function(s){switch(s.label){case 0:if(!n)return[3,5];if(W.debug("getting user data failed",n),!this.isSessionInvalid(n))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return s.sent(),[3,4];case 3:return i=s.sent(),r(new Error("Session is invalid due to: "+n.message+" and failed to clean up invalid session: "+i.message)),[2];case 4:return[2,r(n)];case 5:return[2,t(o)]}}))}))}),{bypassCache:!0,clientMetadata:n})}))}))]}}))}))},e.prototype.disableSMS=function(e){return new Promise((function(t,n){e.disableMFA((function(e,r){if(e)return W.debug("disable mfa failed",e),void n(e);W.debug("disable mfa succeed",r),t(r)}))}))},e.prototype.enableSMS=function(e){return new Promise((function(t,n){e.enableMFA((function(e,r){if(e)return W.debug("enable mfa failed",e),void n(e);W.debug("enable mfa succeed",r),t(r)}))}))},e.prototype.setupTOTP=function(e){return new Promise((function(t,n){e.associateSoftwareToken({onFailure:function(e){W.debug("associateSoftwareToken failed",e),n(e)},associateSecretCode:function(e){W.debug("associateSoftwareToken sucess",e),t(e)}})}))},e.prototype.verifyTotpToken=function(e,t){return W.debug("verification totp token",e,t),new Promise((function(n,r){e.verifySoftwareToken(t,"My TOTP device",{onFailure:function(e){W.debug("verifyTotpToken failed",e),r(e)},onSuccess:function(t){J("signIn",e,"A user "+e.getUsername()+" has been signed in"),W.debug("verifyTotpToken success",t),n(t)}})}))},e.prototype.confirmSignIn=function(e,t,n,i){var o=this;if(void 0===i&&(i=this._config.clientMetadata),!t)return this.rejectAuthError(r.a.EmptyCode);var s=this;return new Promise((function(r,a){e.sendMFACode(t,{onSuccess:function(t){return V(o,void 0,void 0,(function(){var n,i;return H(this,(function(o){switch(o.label){case 0:W.debug(t),o.label=1;case 1:return o.trys.push([1,4,5,6]),[4,this.Credentials.clear()];case 2:return o.sent(),[4,this.Credentials.set(t,"session")];case 3:return n=o.sent(),W.debug("succeed to get cognito credentials",n),[3,6];case 4:return i=o.sent(),W.debug("cannot get cognito credentials",i),[3,6];case 5:return s.user=e,J("signIn",e,"A user "+e.getUsername()+" has been signed in"),r(e),[7];case 6:return[2]}}))}))},onFailure:function(e){W.debug("confirm signIn failure",e),a(e)}},n,i)}))},e.prototype.completeNewPassword=function(e,t,n,i){var o=this;if(void 0===n&&(n={}),void 0===i&&(i=this._config.clientMetadata),!t)return this.rejectAuthError(r.a.EmptyPassword);var s=this;return new Promise((function(r,a){e.completeNewPasswordChallenge(t,n,{onSuccess:function(t){return V(o,void 0,void 0,(function(){var n,i;return H(this,(function(o){switch(o.label){case 0:W.debug(t),o.label=1;case 1:return o.trys.push([1,4,5,6]),[4,this.Credentials.clear()];case 2:return o.sent(),[4,this.Credentials.set(t,"session")];case 3:return n=o.sent(),W.debug("succeed to get cognito credentials",n),[3,6];case 4:return i=o.sent(),W.debug("cannot get cognito credentials",i),[3,6];case 5:return s.user=e,J("signIn",e,"A user "+e.getUsername()+" has been signed in"),r(e),[7];case 6:return[2]}}))}))},onFailure:function(e){W.debug("completeNewPassword failure",e),J("completeNewPassword_failure",e,o.user+" failed to complete the new password flow"),a(e)},mfaRequired:function(t,n){W.debug("signIn MFA required"),e.challengeName=t,e.challengeParam=n,r(e)},mfaSetup:function(t,n){W.debug("signIn mfa setup",t),e.challengeName=t,e.challengeParam=n,r(e)},totpRequired:function(t,n){W.debug("signIn mfa setup",t),e.challengeName=t,e.challengeParam=n,r(e)}},i)}))},e.prototype.sendCustomChallengeAnswer=function(e,t,n){var i=this;if(void 0===n&&(n=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!t)return this.rejectAuthError(r.a.EmptyChallengeResponse);return new Promise((function(r,o){e.sendCustomChallengeAnswer(t,i.authCallbacks(e,r,o),n)}))},e.prototype.deleteUserAttributes=function(e,t){var n=this;return new Promise((function(r,i){n.userSession(e).then((function(n){e.deleteAttributes(t,(function(e,t){return e?i(e):r(t)}))}))}))},e.prototype.deleteUser=function(){return V(this,void 0,void 0,(function(){var e,t,n=this;return H(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this._storageSync];case 1:return r.sent(),[3,3];case 2:throw e=r.sent(),W.debug("Failed to sync cache info into memory",e),new Error(e);case 3:return t=this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI"),[2,new Promise((function(e,r){return V(n,void 0,void 0,(function(){var n,i=this;return H(this,(function(o){if(this.userPool){if(!(n=this.userPool.getCurrentUser()))return W.debug("Failed to get user from user pool"),[2,r(new Error("No current user."))];n.getSession((function(o,s){return V(i,void 0,void 0,(function(){var i,s=this;return H(this,(function(a){switch(a.label){case 0:if(!o)return[3,5];if(W.debug("Failed to get the user session",o),!this.isSessionInvalid(o))return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(n)];case 2:return a.sent(),[3,4];case 3:return i=a.sent(),r(new Error("Session is invalid due to: "+o.message+" and failed to clean up invalid session: "+i.message)),[2];case 4:return[2,r(o)];case 5:n.deleteUser((function(i,o){if(i)r(i);else{J("userDeleted",o,"The authenticated user has been deleted."),n.signOut(),s.user=null;try{s.cleanCachedItems()}catch(e){W.debug("failed to clear cached items")}t?s.oAuthSignOutRedirect(e,r):(J("signOut",s.user,"A user has been signed out"),e(o))}})),a.label=6;case 6:return[2]}}))}))}))}else W.debug("no Congito User pool"),r(new Error("Cognito User pool does not exist"));return[2]}))}))}))]}}))}))},e.prototype.updateUserAttributes=function(e,t,n){void 0===n&&(n=this._config.clientMetadata);var r=[],i=this;return new Promise((function(o,s){i.userSession(e).then((function(i){for(var a in t)if("sub"!==a&&a.indexOf("_verified")<0){var u={Name:a,Value:t[a]};r.push(u)}e.updateAttributes(r,(function(e,t){return e?s(e):o(t)}),n)}))}))},e.prototype.userAttributes=function(e){var t=this;return new Promise((function(n,r){t.userSession(e).then((function(t){e.getUserAttributes((function(e,t){e?r(e):n(t)}))}))}))},e.prototype.verifiedContact=function(e){var t=this;return this.userAttributes(e).then((function(e){var n=t.attributesToObject(e),r={},i={};return n.email&&(n.email_verified?i.email=n.email:r.email=n.email),n.phone_number&&(n.phone_number_verified?i.phone_number=n.phone_number:r.phone_number=n.phone_number),{verified:i,unverified:r}}))},e.prototype.isErrorWithMessage=function(e){return"object"===z(e)&&Object.prototype.hasOwnProperty.call(e,"message")},e.prototype.isTokenRevokedError=function(e){return this.isErrorWithMessage(e)&&"Access Token has been revoked"===e.message},e.prototype.isRefreshTokenRevokedError=function(e){return this.isErrorWithMessage(e)&&"Refresh Token has been revoked"===e.message},e.prototype.isUserDisabledError=function(e){return this.isErrorWithMessage(e)&&"User is disabled."===e.message},e.prototype.isUserDoesNotExistError=function(e){return this.isErrorWithMessage(e)&&"User does not exist."===e.message},e.prototype.isRefreshTokenExpiredError=function(e){return this.isErrorWithMessage(e)&&"Refresh Token has expired"===e.message},e.prototype.isSignedInHostedUI=function(){return this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI")},e.prototype.isSessionInvalid=function(e){return this.isUserDisabledError(e)||this.isUserDoesNotExistError(e)||this.isTokenRevokedError(e)||this.isRefreshTokenRevokedError(e)||this.isRefreshTokenExpiredError(e)},e.prototype.cleanUpInvalidSession=function(e){return V(this,void 0,void 0,(function(){var t=this;return H(this,(function(n){switch(n.label){case 0:e.signOut(),this.user=null,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.cleanCachedItems()];case 2:return n.sent(),[3,4];case 3:return n.sent(),W.debug("failed to clear cached items"),[3,4];case 4:return this.isSignedInHostedUI()?[2,new Promise((function(e,n){t.oAuthSignOutRedirect(e,n)}))]:(J("signOut",this.user,"A user has been signed out"),[2])}}))}))},e.prototype.currentUserPoolUser=function(e){var t=this;return this.userPool?new Promise((function(n,r){t._storageSync.then((function(){return V(t,void 0,void 0,(function(){var t,i,s=this;return H(this,(function(a){switch(a.label){case 0:return this.isOAuthInProgress()?(W.debug("OAuth signIn in progress, waiting for resolution..."),[4,new Promise((function(e){var t=setTimeout((function(){W.debug("OAuth signIn in progress timeout"),o.a.remove("auth",n),e()}),1e4);function n(r){var i=r.payload.event;"cognitoHostedUI"!==i&&"cognitoHostedUI_failure"!==i||(W.debug("OAuth signIn resolved: "+i),clearTimeout(t),o.a.remove("auth",n),e())}o.a.listen("auth",n)}))]):[3,2];case 1:a.sent(),a.label=2;case 2:return(t=this.userPool.getCurrentUser())?(i=this._config.clientMetadata,t.getSession((function(i,o){return V(s,void 0,void 0,(function(){var s,a,u,c,l=this;return H(this,(function(f){switch(f.label){case 0:if(!i)return[3,5];if(W.debug("Failed to get the user session",i),!this.isSessionInvalid(i))return[3,4];f.label=1;case 1:return f.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return f.sent(),[3,4];case 3:return s=f.sent(),r(new Error("Session is invalid due to: "+i.message+" and failed to clean up invalid session: "+s.message)),[2];case 4:return r(i),[2];case 5:return(a=!!e&&e.bypassCache)?[4,this.Credentials.clear()]:[3,7];case 6:f.sent(),f.label=7;case 7:return u=this._config.clientMetadata,c=o.getAccessToken().decodePayload().scope,(void 0===c?"":c).split(" ").includes("aws.cognito.signin.user.admin")?(t.getUserData((function(e,i){return V(l,void 0,void 0,(function(){var o,s,a,u,c,l,f;return H(this,(function(d){switch(d.label){case 0:if(!e)return[3,7];if(W.debug("getting user data failed",e),!this.isSessionInvalid(e))return[3,5];d.label=1;case 1:return d.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return d.sent(),[3,4];case 3:return o=d.sent(),r(new Error("Session is invalid due to: "+e.message+" and failed to clean up invalid session: "+o.message)),[2];case 4:return r(e),[3,6];case 5:n(t),d.label=6;case 6:return[2];case 7:for(s=i.PreferredMfaSetting||"NOMFA",a=[],u=0;u<i.UserAttributes.length;u++)c={Name:i.UserAttributes[u].Name,Value:i.UserAttributes[u].Value},l=new S.f(c),a.push(l);return f=this.attributesToObject(a),Object.assign(t,{attributes:f,preferredMFA:s}),[2,n(t)]}}))}))}),{bypassCache:a,clientMetadata:u}),[2]):(W.debug("Unable to get the user data because the aws.cognito.signin.user.admin is not in the scopes of the access token"),[2,n(t)])}}))}))}),{clientMetadata:i}),[2]):(W.debug("Failed to get user from user pool"),r("No current user"),[2])}}))}))})).catch((function(e){return W.debug("Failed to sync cache info into memory",e),r(e)}))})):this.rejectNoUserPool()},e.prototype.isOAuthInProgress=function(){return this.oAuthFlowInProgress},e.prototype.currentAuthenticatedUser=function(e){return V(this,void 0,void 0,(function(){var t,n,r,i,o;return H(this,(function(s){switch(s.label){case 0:W.debug("getting current authenticated user"),t=null,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._storageSync];case 2:return s.sent(),[3,4];case 3:throw n=s.sent(),W.debug("Failed to sync cache info into memory",n),n;case 4:try{(r=JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")))&&(t=K(K({},r.user),{token:r.token}))}catch(e){W.debug("cannot load federated user from auth storage")}return t?(this.user=t,W.debug("get current authenticated federated user",this.user),[2,this.user]):[3,5];case 5:W.debug("get current authenticated userpool user"),i=null,s.label=6;case 6:return s.trys.push([6,8,,9]),[4,this.currentUserPoolUser(e)];case 7:return i=s.sent(),[3,9];case 8:return"No userPool"===(o=s.sent())&&W.error("Cannot get the current user because the user pool is missing. Please make sure the Auth module is configured with a valid Cognito User Pool ID"),W.debug("The user is not authenticated by the error",o),[2,Promise.reject("The user is not authenticated")];case 9:return this.user=i,[2,this.user]}}))}))},e.prototype.currentSession=function(){var e=this;return W.debug("Getting current session"),this.userPool?new Promise((function(t,n){e.currentUserPoolUser().then((function(r){e.userSession(r).then((function(e){t(e)})).catch((function(e){W.debug("Failed to get the current session",e),n(e)}))})).catch((function(e){W.debug("Failed to get the current user",e),n(e)}))})):Promise.reject(new Error("No User Pool in the configuration."))},e.prototype.userSession=function(e){var t=this;if(!e)return W.debug("the user is null"),this.rejectAuthError(r.a.NoUserSession);var n=this._config.clientMetadata;return new Promise((function(r,i){W.debug("Getting the session from this user:",e),e.getSession((function(n,o){return V(t,void 0,void 0,(function(){var t;return H(this,(function(s){switch(s.label){case 0:if(!n)return[3,5];if(W.debug("Failed to get the session from user",e),!this.isSessionInvalid(n))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return s.sent(),[3,4];case 3:return t=s.sent(),i(new Error("Session is invalid due to: "+n.message+" and failed to clean up invalid session: "+t.message)),[2];case 4:return i(n),[2];case 5:return W.debug("Succeed to get the user session",o),r(o),[2]}}))}))}),{clientMetadata:n})}))},e.prototype.currentUserCredentials=function(){return V(this,void 0,void 0,(function(){var e,t,n=this;return H(this,(function(r){switch(r.label){case 0:W.debug("Getting current user credentials"),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._storageSync];case 2:return r.sent(),[3,4];case 3:throw e=r.sent(),W.debug("Failed to sync cache info into memory",e),e;case 4:t=null;try{t=JSON.parse(this._storage.getItem("aws-amplify-federatedInfo"))}catch(e){W.debug("failed to get or parse item aws-amplify-federatedInfo",e)}return t?[2,this.Credentials.refreshFederatedToken(t)]:[2,this.currentSession().then((function(e){return W.debug("getting session success",e),n.Credentials.set(e,"session")})).catch((function(){return W.debug("getting guest credentials"),n.Credentials.set(null,"guest")}))]}}))}))},e.prototype.currentCredentials=function(){return W.debug("getting current credentials"),this.Credentials.get()},e.prototype.verifyUserAttribute=function(e,t,n){return void 0===n&&(n=this._config.clientMetadata),new Promise((function(r,i){e.getAttributeVerificationCode(t,{onSuccess:function(e){return r(e)},onFailure:function(e){return i(e)}},n)}))},e.prototype.verifyUserAttributeSubmit=function(e,t,n){return n?new Promise((function(r,i){e.verifyAttribute(t,n,{onSuccess:function(e){r(e)},onFailure:function(e){i(e)}})})):this.rejectAuthError(r.a.EmptyCode)},e.prototype.verifyCurrentUserAttribute=function(e){var t=this;return t.currentUserPoolUser().then((function(n){return t.verifyUserAttribute(n,e)}))},e.prototype.verifyCurrentUserAttributeSubmit=function(e,t){var n=this;return n.currentUserPoolUser().then((function(r){return n.verifyUserAttributeSubmit(r,e,t)}))},e.prototype.cognitoIdentitySignOut=function(e,t){return V(this,void 0,void 0,(function(){var n,r,i=this;return H(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this._storageSync];case 1:return o.sent(),[3,3];case 2:throw n=o.sent(),W.debug("Failed to sync cache info into memory",n),n;case 3:return r=this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI"),[2,new Promise((function(n,o){if(e&&e.global){W.debug("user global sign out",t);var s=i._config.clientMetadata;t.getSession((function(e,s){return V(i,void 0,void 0,(function(){var i,s=this;return H(this,(function(a){switch(a.label){case 0:if(!e)return[3,5];if(W.debug("failed to get the user session",e),!this.isSessionInvalid(e))return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return a.sent(),[3,4];case 3:return i=a.sent(),o(new Error("Session is invalid due to: "+e.message+" and failed to clean up invalid session: "+i.message)),[2];case 4:return[2,o(e)];case 5:return t.globalSignOut({onSuccess:function(e){if(W.debug("global sign out success"),!r)return n();s.oAuthSignOutRedirect(n,o)},onFailure:function(e){return W.debug("global sign out failed",e),o(e)}}),[2]}}))}))}),{clientMetadata:s})}else W.debug("user sign out",t),t.signOut((function(){if(!r)return n();i.oAuthSignOutRedirect(n,o)}))}))]}}))}))},e.prototype.oAuthSignOutRedirect=function(e,t){Object(v.b)().isBrowser?this.oAuthSignOutRedirectOrReject(t):this.oAuthSignOutAndResolve(e)},e.prototype.oAuthSignOutAndResolve=function(e){this._oAuthHandler.signOut(),e()},e.prototype.oAuthSignOutRedirectOrReject=function(e){this._oAuthHandler.signOut(),setTimeout((function(){return e(Error("Signout timeout fail"))}),3e3)},e.prototype.signOut=function(e){return V(this,void 0,void 0,(function(){var t;return H(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.cleanCachedItems()];case 1:return n.sent(),[3,3];case 2:return n.sent(),W.debug("failed to clear cached items"),[3,3];case 3:return this.userPool?(t=this.userPool.getCurrentUser())?[4,this.cognitoIdentitySignOut(e,t)]:[3,5]:[3,7];case 4:return n.sent(),[3,6];case 5:W.debug("no current Cognito user"),n.label=6;case 6:return[3,8];case 7:W.debug("no Cognito User pool"),n.label=8;case 8:return J("signOut",this.user,"A user has been signed out"),this.user=null,[2]}}))}))},e.prototype.cleanCachedItems=function(){return V(this,void 0,void 0,(function(){return H(this,(function(e){switch(e.label){case 0:return[4,this.Credentials.clear()];case 1:return e.sent(),[2]}}))}))},e.prototype.changePassword=function(e,t,n,r){var i=this;return void 0===r&&(r=this._config.clientMetadata),new Promise((function(o,s){i.userSession(e).then((function(i){e.changePassword(t,n,(function(e,t){return e?(W.debug("change password failure",e),s(e)):o(t)}),r)}))}))},e.prototype.forgotPassword=function(e,t){if(void 0===t&&(t=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(r.a.EmptyUsername);var n=this.createCognitoUser(e);return new Promise((function(r,i){n.forgotPassword({onSuccess:function(){r()},onFailure:function(t){W.debug("forgot password failure",t),J("forgotPassword_failure",t,e+" forgotPassword failed"),i(t)},inputVerificationCode:function(t){J("forgotPassword",n,e+" has initiated forgot password flow"),r(t)}},t)}))},e.prototype.forgotPasswordSubmit=function(e,t,n,i){if(void 0===i&&(i=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(r.a.EmptyUsername);if(!t)return this.rejectAuthError(r.a.EmptyCode);if(!n)return this.rejectAuthError(r.a.EmptyPassword);var o=this.createCognitoUser(e);return new Promise((function(r,s){o.confirmPassword(t,n,{onSuccess:function(t){J("forgotPasswordSubmit",o,e+" forgotPasswordSubmit successful"),r(t)},onFailure:function(t){J("forgotPasswordSubmit_failure",t,e+" forgotPasswordSubmit failed"),s(t)}},i)}))},e.prototype.currentUserInfo=function(){return V(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return H(this,(function(a){switch(a.label){case 0:return(e=this.Credentials.getCredSource())&&"aws"!==e&&"userPool"!==e?[3,9]:[4,this.currentUserPoolUser().catch((function(e){return W.error(e)}))];case 1:if(!(s=a.sent()))return[2,null];a.label=2;case 2:return a.trys.push([2,8,,9]),[4,this.userAttributes(s)];case 3:t=a.sent(),n=this.attributesToObject(t),r=null,a.label=4;case 4:return a.trys.push([4,6,,7]),[4,this.currentCredentials()];case 5:return r=a.sent(),[3,7];case 6:return i=a.sent(),W.debug("Failed to retrieve credentials while getting current user info",i),[3,7];case 7:return[2,{id:r?r.identityId:void 0,username:s.getUsername(),attributes:n}];case 8:return o=a.sent(),W.error("currentUserInfo error",o),[2,{}];case 9:return"federated"===e?[2,(s=this.user)||{}]:[2]}}))}))},e.prototype.federatedSignIn=function(e,t,n){return V(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p;return H(this,(function(v){switch(v.label){case 0:if(!this._config.identityPoolId&&!this._config.userPoolId)throw new Error("Federation requires either a User Pool or Identity Pool in config");if(void 0===e&&this._config.identityPoolId&&!this._config.userPoolId)throw new Error("Federation with Identity Pools requires tokens passed as arguments");return Object(r.f)(e)||Object(r.g)(e)||Object(r.d)(e)||void 0===e?(i=e||{provider:r.b.Cognito},u=Object(r.f)(i)?i.provider:i.customProvider,Object(r.f)(i),o=i.customState,this._config.userPoolId&&(s=Object(r.e)(this._config.oauth)?this._config.userPoolWebClientId:this._config.oauth.clientID,a=Object(r.e)(this._config.oauth)?this._config.oauth.redirectSignIn:this._config.oauth.redirectUri,this._oAuthHandler.oauthSignIn(this._config.oauth.responseType,this._config.oauth.domain,a,s,u,o)),[3,4]):[3,1];case 1:u=e;try{(c=JSON.stringify(JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")).user))&&W.warn("There is already a signed in user: "+c+" in your app.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tYou should not call Auth.federatedSignIn method again as it may cause unexpected behavior.")}catch(e){}return l=t.token,f=t.identity_id,d=t.expires_at,[4,this.Credentials.set({provider:u,token:l,identity_id:f,user:n,expires_at:d},"federation")];case 2:return h=v.sent(),[4,this.currentAuthenticatedUser()];case 3:return p=v.sent(),J("signIn",p,"A user "+p.username+" has been signed in"),W.debug("federated sign in credentials",h),[2,h];case 4:return[2]}}))}))},e.prototype._handleAuthResponse=function(e){return V(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,f,d,h,p;return H(this,(function(y){switch(y.label){case 0:if(this.oAuthFlowInProgress)return W.debug("Skipping URL "+e+" current flow in progress"),[2];y.label=1;case 1:if(y.trys.push([1,,8,9]),this.oAuthFlowInProgress=!0,!this._config.userPoolId)throw new Error("OAuth responses require a User Pool defined in config");if(J("parsingCallbackUrl",{url:e},"The callback url is being parsed"),t=e||(Object(v.b)().isBrowser?window.location.href:""),n=!!(Object(_.parse)(t).query||"").split("&").map((function(e){return e.split("=")})).find((function(e){var t=G(e,1)[0];return"code"===t||"error"===t})),r=!!(Object(_.parse)(t).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).find((function(e){var t=G(e,1)[0];return"access_token"===t||"error"===t})),!n&&!r)return[3,7];this._storage.setItem("amplify-redirected-from-hosted-ui","true"),y.label=2;case 2:return y.trys.push([2,6,,7]),[4,this._oAuthHandler.handleAuthResponse(t)];case 3:return i=y.sent(),o=i.accessToken,s=i.idToken,a=i.refreshToken,u=i.state,c=new S.h({IdToken:new S.c({IdToken:s}),RefreshToken:new S.d({RefreshToken:a}),AccessToken:new S.b({AccessToken:o})}),l=void 0,this._config.identityPoolId?[4,this.Credentials.set(c,"session")]:[3,5];case 4:l=y.sent(),W.debug("AWS credentials",l),y.label=5;case 5:return f=/-/.test(u),(d=this.createCognitoUser(c.getIdToken().decodePayload()["cognito:username"])).setSignInUserSession(c),window&&void 0!==window.history&&window.history.replaceState({},null,this._config.oauth.redirectSignIn),J("signIn",d,"A user "+d.getUsername()+" has been signed in"),J("cognitoHostedUI",d,"A user "+d.getUsername()+" has been signed in via Cognito Hosted UI"),f&&(h=u.split("-").splice(1).join("-"),J("customOAuthState",h.match(/.{2}/g).map((function(e){return String.fromCharCode(parseInt(e,16))})).join(""),"State for user "+d.getUsername())),[2,l];case 6:return p=y.sent(),W.debug("Error in cognito hosted auth response",p),window&&void 0!==window.history&&window.history.replaceState({},null,this._config.oauth.redirectSignIn),J("signIn_failure",p,"The OAuth response flow failed"),J("cognitoHostedUI_failure",p,"A failure occurred when returning to the Cognito Hosted UI"),J("customState_failure",p,"A failure occurred when returning state"),[3,7];case 7:return[3,9];case 8:return this.oAuthFlowInProgress=!1,[7];case 9:return[2]}}))}))},e.prototype.essentialCredentials=function(e){return{accessKeyId:e.accessKeyId,sessionToken:e.sessionToken,secretAccessKey:e.secretAccessKey,identityId:e.identityId,authenticated:e.authenticated}},e.prototype.attributesToObject=function(e){var t=this,n={};return e&&e.map((function(e){"email_verified"===e.Name||"phone_number_verified"===e.Name?n[e.Name]=t.isTruthyString(e.Value)||!0===e.Value:n[e.Name]=e.Value})),n},e.prototype.isTruthyString=function(e){return"function"==typeof e.toLowerCase&&"true"===e.toLowerCase()},e.prototype.createCognitoUser=function(e){var t={Username:e,Pool:this.userPool};t.Storage=this._storage;var n=this._config.authenticationFlowType,r=new S.e(t);return n&&r.setAuthenticationFlowType(n),r},e.prototype._isValidAuthStorage=function(e){return!!e&&"function"==typeof e.getItem&&"function"==typeof e.setItem&&"function"==typeof e.removeItem&&"function"==typeof e.clear},e.prototype.noUserPoolErrorHandler=function(e){return!e||e.userPoolId&&e.identityPoolId?r.a.NoConfig:r.a.MissingAuthConfig},e.prototype.rejectAuthError=function(e){return Promise.reject(new L(e))},e.prototype.rejectNoUserPool=function(){var e=this.noUserPoolErrorHandler(this._config);return Promise.reject(new B(e))},e.prototype.rememberDevice=function(){return V(this,void 0,void 0,(function(){var e,t;return H(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.currentUserPoolUser()];case 1:return e=n.sent(),[3,3];case 2:return t=n.sent(),W.debug("The user is not authenticated by the error",t),[2,Promise.reject("The user is not authenticated")];case 3:return e.getCachedDeviceKeyAndPassword(),[2,new Promise((function(t,n){e.setDeviceStatusRemembered({onSuccess:function(e){t(e)},onFailure:function(e){"InvalidParameterException"===e.code?n(new L(r.a.DeviceConfig)):"NetworkError"===e.code?n(new L(r.a.NetworkError)):n(e)}})}))]}}))}))},e.prototype.forgetDevice=function(){return V(this,void 0,void 0,(function(){var e,t;return H(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.currentUserPoolUser()];case 1:return e=n.sent(),[3,3];case 2:return t=n.sent(),W.debug("The user is not authenticated by the error",t),[2,Promise.reject("The user is not authenticated")];case 3:return e.getCachedDeviceKeyAndPassword(),[2,new Promise((function(t,n){e.forgetDevice({onSuccess:function(e){t(e)},onFailure:function(e){"InvalidParameterException"===e.code?n(new L(r.a.DeviceConfig)):"NetworkError"===e.code?n(new L(r.a.NetworkError)):n(e)}})}))]}}))}))},e.prototype.fetchDevices=function(){return V(this,void 0,void 0,(function(){var e,t;return H(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.currentUserPoolUser()];case 1:return e=n.sent(),[3,3];case 2:throw t=n.sent(),W.debug("The user is not authenticated by the error",t),new Error("The user is not authenticated");case 3:return e.getCachedDeviceKeyAndPassword(),[2,new Promise((function(t,n){var i={onSuccess:function(e){var n=e.Devices.map((function(e){var t=e.DeviceAttributes.find((function(e){return"device_name"===e.Name}))||{};return{id:e.DeviceKey,name:t.Value}}));t(n)},onFailure:function(e){"InvalidParameterException"===e.code?n(new L(r.a.DeviceConfig)):"NetworkError"===e.code?n(new L(r.a.NetworkError)):n(e)}};e.listDevices(60,null,i)}))]}}))}))},e}())(null);w.a.register($)},,,function(e,t,n){"use strict";n.r(t),n.d(t,"locateWindow",(function(){return i}));const r={};function i(){return"undefined"!=typeof window?window:"undefined"!=typeof self?self:r}},function(e,t,n){var r;e.exports=(r=n(12),function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,s=t.algo,a=[],u=[];!function(){function t(t){for(var n=e.sqrt(t),r=2;r<=n;r++)if(!(t%r))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var r=2,i=0;i<64;)t(r)&&(i<8&&(a[i]=n(e.pow(r,.5))),u[i]=n(e.pow(r,1/3)),i++),r++}();var c=[],l=s.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],l=n[5],f=n[6],d=n[7],h=0;h<64;h++){if(h<16)c[h]=0|e[t+h];else{var p=c[h-15],v=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,y=c[h-2],g=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;c[h]=v+c[h-7]+g+c[h-16]}var m=r&i^r&o^i&o,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),w=d+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&f)+u[h]+c[h];d=f,f=l,l=a,a=s+w|0,s=o,o=i,i=r,r=w+(b+m)|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+f|0,n[7]=n[7]+d|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),r.SHA256)},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(21),i=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},o=new r.a("Amplify"),s=new(function(){function e(){this._components=[],this._config={},this._modules={},this.Auth=null,this.Analytics=null,this.API=null,this.Credentials=null,this.Storage=null,this.I18n=null,this.Cache=null,this.PubSub=null,this.Interactions=null,this.Pushnotification=null,this.UI=null,this.XR=null,this.Predictions=null,this.DataStore=null,this.Geo=null,this.Logger=r.a,this.ServiceWorker=null}return e.prototype.register=function(e){o.debug("component registered in amplify",e),this._components.push(e),"function"==typeof e.getModuleName?(this._modules[e.getModuleName()]=e,this[e.getModuleName()]=e):o.debug("no getModuleName method for component",e),e.configure(this._config)},e.prototype.configure=function(e){var t=this;return e?(this._config=Object.assign(this._config,e),o.debug("amplify config",this._config),Object.entries(this._modules).forEach((function(e){var n=i(e,2),r=(n[0],n[1]);Object.keys(r).forEach((function(e){t._modules[e]&&(r[e]=t._modules[e])}))})),this._components.map((function(e){e.configure(t._config)})),this._config):this._config},e.prototype.addPluggable=function(e){e&&e.getCategory&&"function"==typeof e.getCategory&&this._components.map((function(t){t.addPluggable&&"function"==typeof t.addPluggable&&t.addPluggable(e)}))},e}())},function(e,t,n){var r,i,o;e.exports=(o=n(12),i=(r=o).lib.WordArray,r.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var i=[],o=0;o<n;o+=3)for(var s=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a<n;a++)i.push(r.charAt(s>>>6*(3-a)&63));var u=r.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var t=e.length,n=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var o=0;o<n.length;o++)r[n.charCodeAt(o)]=o}var s=n.charAt(64);if(s){var a=e.indexOf(s);-1!==a&&(t=a)}return function(e,t,n){for(var r=[],o=0,s=0;s<t;s++)if(s%4){var a=n[e.charCodeAt(s-1)]<<s%4*2,u=n[e.charCodeAt(s)]>>>6-s%4*2,c=a|u;r[o>>>2]|=c<<24-o%4*8,o++}return i.create(r,o)}(e,t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},o.enc.Base64)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(1).__exportStar(n(142),t)},function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return O}));var r,i,o=n(18),s=n(4),a=n(32),u=n(19),c=n(21),l=n(148),f=n(76),d=n(14),h=n(10),p=n(2),v=n(3),y=n(5),g=n(0),m=n(23),b=function(){return(b=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},w=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())}))},S=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},_=function(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(_(arguments[t]));return e},A=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 O=function(){function t(e,t,n,r,i,s){void 0===n&&(n={}),void 0===s&&(s={Auth:a.a,API:o.a,Cache:u.a}),this.schema=e,this.syncPredicates=t,this.amplifyConfig=n,this.authModeStrategy=r,this.errorHandler=i,this.amplifyContext=s,this.typeQuery=new WeakMap,this.buffer=[],this.runningProcesses=new l.a}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=_(Object(v.c)(e,t,n,c,l),3);return{authMode:s,opType:d[0],opName:d[1],query:d[2],isOwner:c,ownerField:l,ownerValue:f}},t.prototype.getAuthorizationInfo=function(e,t,n,r,o,a){void 0===r&&(r={}),void 0===o&&(o={});var u=Object(v.e)(e);if(a===s.c.AWS_IAM&&u.find((function(e){return"private"===e.authStrategy&&"iam"===e.provider}))&&t===i.unauth)return null;var c,l=u.filter((function(e){return"groups"===e.authStrategy&&["userPools","oidc"].includes(e.provider)}));return a!==s.c.AMAZON_COGNITO_USER_POOLS&&a!==s.c.OPENID_CONNECT||!l.find((function(e){var t=Object(v.k)(r,e),n=Object(v.k)(o,e);return E(t,n).find((function(t){return e.groups.find((function(e){return e===t}))}))}))?((a===s.c.AMAZON_COGNITO_USER_POOLS?u.filter((function(e){return"owner"===e.authStrategy&&"userPools"===e.provider})):[]).forEach((function(e){var t=r[e.identityClaim];t&&(c={authMode:s.c.AMAZON_COGNITO_USER_POOLS,isOwner:!e.areSubscriptionsPublic,ownerField:e.ownerField,ownerValue:t})})),c||((a===s.c.OPENID_CONNECT?u.filter((function(e){return"owner"===e.authStrategy&&"oidc"===e.provider})):[]).forEach((function(e){var t=o[e.identityClaim];t&&(c={authMode:s.c.OPENID_CONNECT,isOwner:!e.areSubscriptionsPublic,ownerField:e.ownerField,ownerValue:t})})),c||{authMode:a||n,isOwner:!1})):{authMode:a,isOwner:!1}},t.prototype.hubQueryCompletionListener=function(e,t){t.payload.event===d.CONTROL_MSG.SUBSCRIPTION_ACK&&e()},t.prototype.start=function(){var t=this;return[new h.a((function(n){var o,s,a=[],u={},c=i.none;return t.runningProcesses.add((function(){return w(t,void 0,void 0,(function(){var t,l,h,E,O,I,T,C,P,x,k=this;return S(this,(function(N){switch(N.label){case 0:return N.trys.push([0,2,,3]),[4,this.amplifyContext.Auth.currentCredentials()];case 1:return t=N.sent(),c=t.authenticated?i.auth:i.unauth,[3,3];case 2:return N.sent(),[3,3];case 3:return N.trys.push([3,5,,6]),[4,this.amplifyContext.Auth.currentSession()];case 4:return l=N.sent(),o=l.getIdToken().decodePayload(),[3,6];case 5:return N.sent(),[3,6];case 6:if(N.trys.push([6,11,,12]),h=this.amplifyConfig,E=h.aws_cognito_region,O=h.Auth,!E||O&&!O.region)throw"Auth is not configured";return I=void 0,[4,this.amplifyContext.Cache.getItem("federatedInfo")];case 7:return(T=N.sent())?(I=T.token,[3,10]):[3,8];case 8:return[4,this.amplifyContext.Auth.currentAuthenticatedUser()];case 9:(C=N.sent())&&(I=C.token),N.label=10;case 10:return I&&(P=I.split(".")[1],s=JSON.parse(e.from(P,"base64").toString("utf8"))),[3,12];case 11:return x=N.sent(),A.debug("error getting OIDC JWT",x),[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 k.runningProcesses.isOpen&&k.runningProcesses.add((function(){return w(k,void 0,void 0,(function(){var r,i,l,h,E,O,I,T,C=this;return S(this,(function(P){switch(P.label){case 0:return[4,Object(v.i)({authModeStrategy:this.authModeStrategy,defaultAuthMode:this.amplifyConfig.aws_appsync_authenticationType,modelName:t.name,schema:this.schema})];case 1:return r=P.sent(),i=r.READ,u=b(b({},u),((O={})[t.name]=((I={})[v.a.CREATE]=[],I[v.a.UPDATE]=[],I[v.a.DELETE]=[],I),O)),l=[v.a.CREATE,v.a.UPDATE,v.a.DELETE],(T={})[v.a.CREATE]=0,T[v.a.UPDATE]=0,T[v.a.DELETE]=0,h=T,E=function(r){return w(C,void 0,void 0,(function(){var l,O,I,T,C,P,x,k,N,j,M,R,D,U=this;return S(this,(function(F){switch(F.label){case 0:return l=this.buildSubscription(e,t,r,c,o,s,i[h[r]]),O=l.opType,I=l.opName,T=l.query,C=l.isOwner,P=l.ownerField,x=l.ownerValue,k=l.authMode,[4,Object(v.j)(k,this.amplifyConfig)];case 1:if(N=F.sent(),j={},C){if(!x)return n.error("Owner field required, sign in is needed in order to perform this operation"),[2];j[P]=x}return A.debug("Attempting "+r+" subscription with authMode: "+i[h[r]]),M=g.i,R=this.amplifyContext.API.graphql(b(b({query:T,variables:j},{authMode:k}),{authToken:N,userAgentSuffix:M})),u[t.name][O].push(R.map((function(e){return e.value})).subscribe({next:function(e){var n=e.data,r=e.errors;if(Array.isArray(r)&&r.length>0){var i=r.map((function(e){return e.message}));return A.warn("Skipping incoming subscription. Messages: "+i.join("\n")),void U.drainBuffer()}var o=y.a.getPredicates(U.syncPredicates.get(t),!1),s=n[I];U.passesPredicateValidation(s,o)&&U.pushToBuffer(O,t,s),U.drainBuffer()},error:function(e){return w(U,void 0,void 0,(function(){var o,s,a,c,l,f;return S(this,(function(v){switch(v.label){case 0:if(o=e.error,s=_((void 0===o?{errors:[]}:o).errors,1),a=s[0],c=(void 0===a?{}:a).message,(l=void 0===c?"":c).includes(d.CONTROL_MSG.REALTIME_SUBSCRIPTION_INIT_ERROR)||l.includes(d.CONTROL_MSG.CONNECTION_FAILED)){if(u[t.name][O].forEach((function(e){return e.unsubscribe()})),u[t.name][O]=[],h[r]++,!(h[r]>=i.length))return A.debug(r+" subscription failed with authMode: "+i[h[r]-1]+". Retrying with authMode: "+i[h[r]]),E(r),[2];A.debug(r+" subscription failed with authMode: "+i[h[r]-1])}A.warn("subscriptionError",l),v.label=1;case 1:return v.trys.push([1,3,,4]),[4,this.errorHandler({recoverySuggestion:"Ensure app code is up to date, auth directives exist and are correct on each model, and that server-side data has not been invalidated by a schema change. If the problem persists, search for or create an issue: https://github.com/aws-amplify/amplify-js/issues",localModel:null,message:l,model:t.name,operation:r,errorType:Object(m.b)(e),process:p.i.subscribe,remoteModel:null,cause:e})];case 2:return v.sent(),[3,4];case 3:return f=v.sent(),A.error("Subscription error handler failed with:",f),[3,4];case 4:return"function"==typeof D&&D(),l.includes('"errorType":"Unauthorized"')||l.includes('"errorType":"OperationDisabled"')?[2]:(n.error(l),[2])}}))}))}})),a.push(w(U,void 0,void 0,(function(){var e,t=this;return S(this,(function(n){switch(n.label){case 0:return[4,new Promise((function(n){D=n,e=t.hubQueryCompletionListener.bind(t,n),f.a.listen("api",e)}))];case 1:return n.sent(),f.a.remove("api",e),[2]}}))}))),[2]}}))}))},l.forEach((function(e){return E(e)})),[2]}}))}))}))}))})),this.runningProcesses.isOpen&&this.runningProcesses.add((function(){return Promise.all(a).then((function(){n.next(r.CONNECTED)}))})),[2]}}))}))}),"subscription processor new subscriber"),t.runningProcesses.addCleaner((function(){return w(t,void 0,void 0,(function(){return S(this,(function(e){return Object.keys(u).forEach((function(e){u[e][v.a.CREATE].forEach((function(e){return e.unsubscribe()})),u[e][v.a.UPDATE].forEach((function(e){return e.unsubscribe()})),u[e][v.a.DELETE].forEach((function(e){return e.unsubscribe()}))})),[2]}))}))}))})),new h.a((function(e){return t.dataObserver=e,t.drainBuffer(),t.runningProcesses.addCleaner((function(){return w(t,void 0,void 0,(function(){return S(this,(function(e){return this.dataObserver=null,[2]}))}))}))}))]},t.prototype.stop=function(){return w(this,void 0,void 0,(function(){return S(this,(function(e){switch(e.label){case 0:return[4,this.runningProcesses.close()];case 1:return e.sent(),[4,this.runningProcesses.open()];case 2:return e.sent(),[2]}}))}))},t.prototype.passesPredicateValidation=function(e,t){if(!t)return!0;var n=t.predicates,r=t.type;return Object(g.S)(e,r,n)},t.prototype.pushToBuffer=function(e,t,n){this.buffer.push([e,t,n])},t.prototype.drainBuffer=function(){var e=this;this.dataObserver&&(this.buffer.forEach((function(t){return e.dataObserver.next(t)})),this.buffer=[])},t}()}).call(this,n(6).Buffer)},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var i=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,i=n;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}},function(e,t,n){var r;e.exports=(r=n(12),function(){if("function"==typeof ArrayBuffer){var e=r.lib.WordArray,t=e.init;(e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var n=e.byteLength,r=[],i=0;i<n;i++)r[i>>>2]|=e[i]<<24-i%4*8;t.call(this,r,n)}else t.apply(this,arguments)}).prototype=e}}(),r.lib.WordArray)},function(e,t,n){"use strict";n.r(t),t.default=function(e,t){return t=t||{},new Promise((function(n,r){var i=new XMLHttpRequest,o=[],s=[],a={},u=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:u,headers:{keys:function(){return o},entries:function(){return s},get:function(e){return a[e.toLowerCase()]},has:function(e){return e.toLowerCase()in a}}}};for(var c in i.open(t.method||"get",e,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,n){o.push(t=t.toLowerCase()),s.push([t,n]),a[t]=a[t]?a[t]+","+n:n})),n(u())},i.onerror=r,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(c,t.headers[c]);i.send(t.body||null)}))}},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var u,c=[],l=!1,f=-1;function d(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&h())}function h(){if(!l){var e=a(d);l=!0;for(var t=c.length;t;){for(u=c,c=[];++f<t;)u&&u[f].run();f=-1,t=c.length}u=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new p(e,t)),1!==c.length||l||a(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r=function(){function e(){}return e.createPredicateBuilder=function(t){var n=t.name,r=new Set(Object.keys(t.fields)),i=new Proxy({},{get:function(t,i,o){var s=i;if(!r.has(s))throw new Error("Invalid field for model. field: "+s+", model: "+n);return function(t){return e.sortPredicateGroupsMap.get(o).push({field:s,sortDirection:t}),o}}});return e.sortPredicateGroupsMap.set(i,[]),i},e.isValidPredicate=function(t){return e.sortPredicateGroupsMap.has(t)},e.getPredicates=function(t,n){if(void 0===n&&(n=!0),n&&!e.isValidPredicate(t))throw new Error("The predicate is not valid");return e.sortPredicateGroupsMap.get(t)},e.createFromExisting=function(t,n){if(n&&t)return n(e.createPredicateBuilder(t))},e.sortPredicateGroupsMap=new WeakMap,e}()},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var i=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,i=n;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(102),i=n(51),o=n(64),s=n(35),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(103),i=n(51),o=n(35),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.MAX_HASHABLE_LENGTH=t.INIT=t.KEY=t.DIGEST_LENGTH=t.BLOCK_SIZE=void 0,t.BLOCK_SIZE=64,t.DIGEST_LENGTH=32,t.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),t.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1},function(e,t,n){(function(t){var r;e.exports=(r=r||function(e,r){var i;if("undefined"!=typeof window&&window.crypto&&(i=window.crypto),"undefined"!=typeof self&&self.crypto&&(i=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(i=globalThis.crypto),!i&&"undefined"!=typeof window&&window.msCrypto&&(i=window.msCrypto),!i&&void 0!==t&&t.crypto&&(i=t.crypto),!i)try{i=n(124)}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(28))},function(e,t,n){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},function(e,t,n){"use strict";var r=n(13);function i(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var o;if(n)o=n(t);else if(r.isURLSearchParams(t))o=t.toString();else{var s=[];r.forEach(t,(function(e,t){null!=e&&(r.isArray(e)?t+="[]":e=[e],r.forEach(e,(function(e){r.isDate(e)?e=e.toISOString():r.isObject(e)&&(e=JSON.stringify(e)),s.push(i(t)+"="+i(e))})))})),o=s.join("&")}if(o){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}},function(e,t,n){"use strict";e.exports=function(e,t,n,r,i){return e.config=t,n&&(e.code=n),e.request=r,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}},function(e,t,n){"use strict";var r=n(13),i=n(131),o=n(132),s=n(56),a=n(133),u=n(136),c=n(137),l=n(59),f=n(30),d=n(31);e.exports=function(e){return new Promise((function(t,n){var h,p=e.data,v=e.headers,y=e.responseType;function g(){e.cancelToken&&e.cancelToken.unsubscribe(h),e.signal&&e.signal.removeEventListener("abort",h)}r.isFormData(p)&&delete v["Content-Type"];var m=new XMLHttpRequest;if(e.auth){var b=e.auth.username||"",w=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";v.Authorization="Basic "+btoa(b+":"+w)}var S=a(e.baseURL,e.url);function _(){if(m){var r="getAllResponseHeaders"in m?u(m.getAllResponseHeaders()):null,o={data:y&&"text"!==y&&"json"!==y?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m};i((function(e){t(e),g()}),(function(e){n(e),g()}),o),m=null}}if(m.open(e.method.toUpperCase(),s(S,e.params,e.paramsSerializer),!0),m.timeout=e.timeout,"onloadend"in m?m.onloadend=_:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(_)},m.onabort=function(){m&&(n(l("Request aborted",e,"ECONNABORTED",m)),m=null)},m.onerror=function(){n(l("Network Error",e,null,m)),m=null},m.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",r=e.transitional||f.transitional;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(l(t,e,r.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",m)),m=null},r.isStandardBrowserEnv()){var E=(e.withCredentials||c(S))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;E&&(v[e.xsrfHeaderName]=E)}"setRequestHeader"in m&&r.forEach(v,(function(e,t){void 0===p&&"content-type"===t.toLowerCase()?delete v[t]:m.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(m.withCredentials=!!e.withCredentials),y&&"json"!==y&&(m.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&m.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&m.upload&&m.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(h=function(e){m&&(n(!e||e&&e.type?new d("canceled"):e),m.abort(),m=null)},e.cancelToken&&e.cancelToken.subscribe(h),e.signal&&(e.signal.aborted?h():e.signal.addEventListener("abort",h))),p||(p=null),m.send(p)}))}},function(e,t,n){"use strict";var r=n(57);e.exports=function(e,t,n,i,o){var s=new Error(e);return r(s,t,n,i,o)}},function(e,t,n){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,n){"use strict";var r=n(13);e.exports=function(e,t){t=t||{};var n={};function i(e,t){return r.isPlainObject(e)&&r.isPlainObject(t)?r.merge(e,t):r.isPlainObject(t)?r.merge({},t):r.isArray(t)?t.slice():t}function o(n){return r.isUndefined(t[n])?r.isUndefined(e[n])?void 0:i(void 0,e[n]):i(e[n],t[n])}function s(e){if(!r.isUndefined(t[e]))return i(void 0,t[e])}function a(n){return r.isUndefined(t[n])?r.isUndefined(e[n])?void 0:i(void 0,e[n]):i(void 0,t[n])}function u(n){return n in t?i(e[n],t[n]):n in e?i(void 0,e[n]):void 0}var c={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u};return r.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=c[e]||o,i=t(e);r.isUndefined(i)&&t!==u||(n[e]=i)})),n}},function(e,t){e.exports={version:"0.26.0"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BLOCK_SIZE=64,t.DIGEST_LENGTH=32,t.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),t.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1},function(e,t,n){"use strict";n.r(t),n.d(t,"fromUtf8",(function(){return r})),n.d(t,"toUtf8",(function(){return i}));const r=e=>"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):(e=>{const t=[];for(let n=0,r=e.length;n<r;n++){const r=e.charCodeAt(n);if(r<128)t.push(r);else if(r<2048)t.push(r>>6|192,63&r|128);else if(n+1<e.length&&55296==(64512&r)&&56320==(64512&e.charCodeAt(n+1))){const i=65536+((1023&r)<<10)+(1023&e.charCodeAt(++n));t.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}else t.push(r>>12|224,r>>6&63|128,63&r|128)}return Uint8Array.from(t)})(e),i=e=>"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):(e=>{let t="";for(let n=0,r=e.length;n<r;n++){const r=e[n];if(r<128)t+=String.fromCharCode(r);else if(192<=r&&r<224){const i=e[++n];t+=String.fromCharCode((31&r)<<6|63&i)}else if(240<=r&&r<365){const i="%"+[r,e[++n],e[++n],e[++n]].map(e=>e.toString(16)).join("%");t+=decodeURIComponent(i)}else t+=String.fromCharCode((15&r)<<12|(63&e[++n])<<6|63&e[++n])}return t})(e)},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r={},i=function(){function e(){}return e.setItem=function(e,t){return r[e]=t,r[e]},e.getItem=function(e){return Object.prototype.hasOwnProperty.call(r,e)?r[e]:void 0},e.removeItem=function(e){return delete r[e]},e.clear=function(){return r={}},e}(),o=function(){function e(){try{this.storageWindow=window.localStorage,this.storageWindow.setItem("aws.amplify.test-ls",1),this.storageWindow.removeItem("aws.amplify.test-ls")}catch(e){this.storageWindow=i}}return e.prototype.getStorage=function(){return this.storageWindow},e}()},function(e,t,n){"use strict";(function(e){var r;if(n.d(t,"a",(function(){return i})),"undefined"!=typeof window&&window.crypto&&(r=window.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==e&&e.crypto&&(r=e.crypto),!r)try{r=n(90)}catch(e){}function i(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")}}).call(this,n(28))},function(e,t,n){"use strict";var r,i,o=n(92);function s(e,t,n){if(e._observer)a(e._observer,t,n);else if(e._observers){var r=[];e._observers.forEach((function(e){r.push(e)})),r.forEach((function(e){a(e,t,n)}))}}function a(e,t,n){if(!e.closed)switch(t){case"next":return e.next(n);case"error":return e.error(n);case"complete":return e.complete(n)}}function u(e){return e._observer||e._observers&&e._observers.size>0}function c(e){var t=this;this._observer=null,this._observers=null,this._observable=new o((function(n){return function(e,t){!u(e)&&t&&t.start&&t.start()}(t,e),function(e,t){e._observers?e._observers.add(t):e._observer?(e._observers=new Set,e._observers.add(e._observer),e._observers.add(t),e._observer=null):e._observer=t}(t,n),function(){!function(e,t){e._observers?e._observers.delete(t):e._observer===t&&(e._observer=null)}(t,n),function(e,t){!u(e)&&t&&t.pause&&t.pause()}(t,e)}}))}r=c.prototype,i={get observable(){return this._observable},get observed(){return u(this)},next:function(e){s(this,"next",e)},error:function(e){s(this,"error",e)},complete:function(e){s(this,"complete",e)}},Object.keys(i).forEach((function(e){var t=Object.getOwnPropertyDescriptor(i,e);t.enumerable=!1,Object.defineProperty(r,e,t)})),e.exports=c},function(e,t,n){var r=n(99),i=n(100),o=i;o.v1=r,o.v4=i,e.exports=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebCryptoSha256=t.Ie11Sha256=void 0,(0,n(1).__exportStar)(n(101),t);var r=n(50);Object.defineProperty(t,"Ie11Sha256",{enumerable:!0,get:function(){return r.Sha256}});var i=n(52);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(54),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(54),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(144).Observable},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.7.13 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.7.13 react-native",r.isReactNative=!0;break;default:r.userAgent="aws-amplify/4.7.13 js",r.isReactNative=!1}var i=function(e){return""+r.userAgent+(e||"")}},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(21),i=function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},o=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},s=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(o(arguments[t]));return e},a=new r.a("Hub"),u="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default";var c=new(function(){function e(e){this.listeners=[],this.patterns=[],this.protectedChannels=["core","auth","api","analytics","interactions","pubsub","storage","ui","xr"],this.name=e}return e.prototype.remove=function(e,t){if(e instanceof RegExp){var n=this.patterns.find((function(t){return t.pattern.source===e.source}));if(!n)return void a.warn("No listeners for "+e);this.patterns=s(this.patterns.filter((function(e){return e!==n})))}else{var r=this.listeners[e];if(!r)return void a.warn("No listeners for "+e);this.listeners[e]=s(r.filter((function(e){return e.callback!==t})))}},e.prototype.dispatch=function(e,t,n,r){(void 0===n&&(n=""),this.protectedChannels.indexOf(e)>-1)&&(r===u||a.warn("WARNING: "+e+" is protected and dispatching on it can have unintended consequences"));var o={channel:e,payload:i({},t),source:n,patternInfo:[]};try{this._toListeners(o)}catch(e){a.error(e)}},e.prototype.listen=function(e,t,n){var r,i=this;if(void 0===n&&(n="noname"),function(e){return void 0!==e.onHubCapsule}(t))a.warn("WARNING onHubCapsule is Deprecated. Please pass in a callback."),r=t.onHubCapsule.bind(t);else{if("function"!=typeof t)throw new Error("No callback supplied to Hub");r=t}if(e instanceof RegExp)this.patterns.push({pattern:e,callback:r});else{var o=this.listeners[e];o||(o=[],this.listeners[e]=o),o.push({name:n,callback:r})}return function(){i.remove(e,r)}},e.prototype._toListeners=function(e){var t=e.channel,n=e.payload,r=this.listeners[t];if(r&&r.forEach((function(r){a.debug("Dispatching to "+t+" with ",n);try{r.callback(e)}catch(e){a.error(e)}})),this.patterns.length>0){if(!n.message)return void a.warn("Cannot perform pattern matching without a message key");var s=n.message;this.patterns.forEach((function(t){var n=s.match(t.pattern);if(n){var r=o(n).slice(1),u=i(i({},e),{patternInfo:r});try{t.callback(u)}catch(e){a.error(e)}}}))}},e}())("__default__")},,,,,,function(e,t,n){var r,i,o=n(41),s=n(42),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(41),i=n(42);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){
62
+ */!function(o){if(void 0===(i="function"==typeof(r=o)?r.call(t,n,t,e):r)||(e.exports=i),!0,e.exports=o(),!!0){var s=window.Cookies,a=window.Cookies=o();a.noConflict=function(){return window.Cookies=s,a}}}((function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function i(){}function o(t,n,o){if("undefined"!=typeof document){"number"==typeof(o=e({path:"/"},i.defaults,o)).expires&&(o.expires=new Date(1*new Date+864e5*o.expires)),o.expires=o.expires?o.expires.toUTCString():"";try{var s=JSON.stringify(n);/^[\{\[]/.test(s)&&(n=s)}catch(e){}n=r.write?r.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var a="";for(var u in o)o[u]&&(a+="; "+u,!0!==o[u]&&(a+="="+o[u].split(";")[0]));return document.cookie=t+"="+n+a}}function s(e,n){if("undefined"!=typeof document){for(var i={},o=document.cookie?document.cookie.split("; "):[],s=0;s<o.length;s++){var a=o[s].split("="),u=a.slice(1).join("=");n||'"'!==u.charAt(0)||(u=u.slice(1,-1));try{var c=t(a[0]);if(u=(r.read||r)(u,c)||t(u),n)try{u=JSON.parse(u)}catch(e){}if(i[c]=u,e===c)break}catch(e){}}return e?i[e]:i}}return i.set=o,i.get=function(e){return s(e,!1)},i.getJSON=function(e){return s(e,!0)},i.remove=function(t,n){o(t,"",e(n,{expires:-1}))},i.defaults={},i.withConverter=n,i}((function(){}))}))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){e.exports=n(125)},function(e,t,n){"use strict";(function(t){var r=n(13),i=n(130),o=n(57),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(58)),u),transformRequest:[function(e,t){return i(t,"Accept"),i(t,"Content-Type"),r.isFormData(e)||r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e)?e:r.isArrayBufferView(e)?e.buffer:r.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):r.isObject(e)||t&&"application/json"===t["Content-Type"]?(a(t,"application/json"),function(e,t,n){if(r.isString(e))try{return(t||JSON.parse)(e),r.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||c.transitional,n=t&&t.silentJSONParsing,i=t&&t.forcedJSONParsing,s=!n&&"json"===this.responseType;if(s||i&&r.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(s){if("SyntaxError"===e.name)throw o(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],(function(e){c.headers[e]={}})),r.forEach(["post","put","patch"],(function(e){c.headers[e]=r.merge(s)})),e.exports=c}).call(this,n(45))},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";n.d(t,"a",(function(){return $}));var r=n(4),i=n(21),o=n(76),s=n(154),a=function(){return(a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},u=new i.a("Parser"),c=function(e){var t,n={};if(e.aws_mobile_analytics_app_id){var r={AWSPinpoint:{appId:e.aws_mobile_analytics_app_id,region:e.aws_mobile_analytics_app_region}};n.Analytics=r}return(e.aws_cognito_identity_pool_id||e.aws_user_pools_id)&&(n.Auth={userPoolId:e.aws_user_pools_id,userPoolWebClientId:e.aws_user_pools_web_client_id,region:e.aws_cognito_region,identityPoolId:e.aws_cognito_identity_pool_id,identityPoolRegion:e.aws_cognito_region,mandatorySignIn:"enable"===e.aws_mandatory_sign_in,signUpVerificationMethod:e.aws_cognito_sign_up_verification_method||"code"}),t=e.aws_user_files_s3_bucket?{AWSS3:{bucket:e.aws_user_files_s3_bucket,region:e.aws_user_files_s3_bucket_region,dangerouslyConnectToHttpEndpointForTesting:e.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing}}:e?e.Storage||e:{},e.Logging&&(n.Logging=a(a({},e.Logging),{region:e.aws_project_region})),e.geo&&(n.Geo=Object.assign({},e.geo),e.geo.amazon_location_service&&(n.Geo={AmazonLocationService:e.geo.amazon_location_service})),n.Analytics=Object.assign({},n.Analytics,e.Analytics),n.Auth=Object.assign({},n.Auth,e.Auth),n.Storage=Object.assign({},t),n.Logging=Object.assign({},n.Logging,e.Logging),u.debug("parse config",e,"to amplifyconfig",n),n},l=function(){function e(){}return e.parseMobilehubConfig=c,e}(),f=n(26);function d(e,t){void 0===t&&(t={});var n=function(e){if(e&&"j"===e[0]&&":"===e[1])return e.substr(2);return e}(e);if(function(e,t){return void 0===t&&(t=!e||"{"!==e[0]&&"["!==e[0]&&'"'!==e[0]),!t}(n,t.doNotParse))try{return JSON.parse(n)}catch(e){}return e}var h=function(){return(h=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},p=function(){function e(e,t){var n=this;this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.cookies=function(e,t){return"string"==typeof e?f.parse(e,t):"object"==typeof e&&null!==e?e:{}}(e,t),new Promise((function(){n.HAS_DOCUMENT_COOKIE="object"==typeof document&&"string"==typeof document.cookie})).catch((function(){}))}return e.prototype._updateBrowserValues=function(e){this.HAS_DOCUMENT_COOKIE&&(this.cookies=f.parse(document.cookie,e))},e.prototype._emitChange=function(e){for(var t=0;t<this.changeListeners.length;++t)this.changeListeners[t](e)},e.prototype.get=function(e,t,n){return void 0===t&&(t={}),this._updateBrowserValues(n),d(this.cookies[e],t)},e.prototype.getAll=function(e,t){void 0===e&&(e={}),this._updateBrowserValues(t);var n={};for(var r in this.cookies)n[r]=d(this.cookies[r],e);return n},e.prototype.set=function(e,t,n){var r;"object"==typeof t&&(t=JSON.stringify(t)),this.cookies=h(h({},this.cookies),((r={})[e]=t,r)),this.HAS_DOCUMENT_COOKIE&&(document.cookie=f.serialize(e,t,n)),this._emitChange({name:e,value:t,options:n})},e.prototype.remove=function(e,t){var n=t=h(h({},t),{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=h({},this.cookies),delete this.cookies[e],this.HAS_DOCUMENT_COOKIE&&(document.cookie=f.serialize(e,"",n)),this._emitChange({name:e,value:void 0,options:t})},e.prototype.addChangeListener=function(e){this.changeListeners.push(e)},e.prototype.removeChangeListener=function(e){var t=this.changeListeners.indexOf(e);t>=0&&this.changeListeners.splice(t,1)},e}(),v=n(16),y=Object(v.b)().isBrowser,g=function(){function e(e){void 0===e&&(e={}),this.cookies=new p,this.store=y?window.localStorage:Object.create(null),this.cookies=e.req?new p(e.req.headers.cookie):new p,Object.assign(this.store,this.cookies.getAll())}return Object.defineProperty(e.prototype,"length",{get:function(){return Object.entries(this.store).length},enumerable:!0,configurable:!0}),e.prototype.clear=function(){var e=this;Array.from(new Array(this.length)).map((function(t,n){return e.key(n)})).forEach((function(t){return e.removeItem(t)}))},e.prototype.getItem=function(e){return this.getLocalItem(e)},e.prototype.getLocalItem=function(e){return Object.prototype.hasOwnProperty.call(this.store,e)?this.store[e]:null},e.prototype.getUniversalItem=function(e){return this.cookies.get(e)},e.prototype.key=function(e){return Object.keys(this.store)[e]},e.prototype.removeItem=function(e){this.removeLocalItem(e),this.removeUniversalItem(e)},e.prototype.removeLocalItem=function(e){delete this.store[e]},e.prototype.removeUniversalItem=function(e){this.cookies.remove(e,{path:"/"})},e.prototype.setItem=function(e,t){switch(this.setLocalItem(e,t),e.split(".").pop()){case"LastAuthUser":case"accessToken":case"refreshToken":case"idToken":y?this.setUniversalItem(e,t):this.setLocalItem(e,t)}},e.prototype.setLocalItem=function(e,t){this.store[e]=t},e.prototype.setUniversalItem=function(e,t){this.cookies.set(e,t,{path:"/",sameSite:!0,secure:"localhost"!==window.location.hostname})},e}(),m=n(65);var b,w=n(37),S=n(8),_=n(9),E=function(e){var t=window.open(e,"_self");return t?Promise.resolve(t):Promise.reject()},A=n(72),O=n.n(A),I=n(73),T=n.n(I),C=function(){return(C=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},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())}))},x=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},k=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},N="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",j=function(e,t,n){o.a.dispatch("auth",{event:e,data:t,message:n},"Auth",N)},M=new i.a("OAuth"),R=function(){function e(e){var t=e.config,n=e.cognitoClientId,r=e.scopes,i=void 0===r?[]:r;if(this._urlOpener=t.urlOpener||E,this._config=t,this._cognitoClientId=n,!this.isValidScopes(i))throw Error("scopes must be a String Array");this._scopes=i}return e.prototype.isValidScopes=function(e){return Array.isArray(e)&&e.every((function(e){return"string"==typeof e}))},e.prototype.oauthSignIn=function(e,t,n,i,o,s){void 0===e&&(e="code"),void 0===o&&(o=r.b.Cognito);var a=this._generateState(32),u=s?a+"-"+s.split("").map((function(e){return e.charCodeAt(0).toString(16).padStart(2,"0")})).join(""):a;!function(e){window.sessionStorage.setItem("oauth_state",e)}(u);var c,l=this._generateRandom(128);c=l,window.sessionStorage.setItem("ouath_pkce_key",c);var f=this._generateChallenge(l),d=this._scopes.join(" "),h="https://"+t+"/oauth2/authorize?"+Object.entries(C(C({redirect_uri:n,response_type:e,client_id:i,identity_provider:o,scope:d,state:u},"code"===e?{code_challenge:f}:{}),"code"===e?{code_challenge_method:"S256"}:{})).map((function(e){var t=k(e,2),n=t[0],r=t[1];return encodeURIComponent(n)+"="+encodeURIComponent(r)})).join("&");M.debug("Redirecting to "+h),this._urlOpener(h,n)},e.prototype._handleCodeFlow=function(e){return P(this,void 0,void 0,(function(){var t,n,i,o,s,a,u,c,l,f,d,h,p,v;return x(this,(function(y){switch(y.label){case 0:return t=(Object(_.parse)(e).query||"").split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n,r=k(t,2),i=r[0],o=r[1];return C(C({},e),((n={})[i]=o,n))}),{code:void 0}).code,n=Object(_.parse)(e).pathname||"/",i=Object(_.parse)(this._config.redirectSignIn).pathname||"/",t&&n===i?(o="https://"+this._config.domain+"/oauth2/token",j("codeFlow",{},"Retrieving tokens from "+o),s=Object(r.e)(this._config)?this._cognitoClientId:this._config.clientID,a=Object(r.e)(this._config)?this._config.redirectSignIn:this._config.redirectUri,g=window.sessionStorage.getItem("ouath_pkce_key"),window.sessionStorage.removeItem("ouath_pkce_key"),c=C({grant_type:"authorization_code",code:t,client_id:s,redirect_uri:a},(u=g)?{code_verifier:u}:{}),M.debug("Calling token endpoint: "+o+" with",c),l=Object.entries(c).map((function(e){var t=k(e,2),n=t[0],r=t[1];return encodeURIComponent(n)+"="+encodeURIComponent(r)})).join("&"),[4,fetch(o,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:l})]):[2];case 1:return[4,y.sent().json()];case 2:if(f=y.sent(),d=f.access_token,h=f.refresh_token,p=f.id_token,v=f.error)throw new Error(v);return[2,{accessToken:d,refreshToken:h,idToken:p}]}var g}))}))},e.prototype._handleImplicitFlow=function(e){return P(this,void 0,void 0,(function(){var t,n,r;return x(this,(function(i){return t=(Object(_.parse)(e).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n,r=k(t,2),i=r[0],o=r[1];return C(C({},e),((n={})[i]=o,n))}),{id_token:void 0,access_token:void 0}),n=t.id_token,r=t.access_token,j("implicitFlow",{},"Got tokens from "+e),M.debug("Retrieving implicit tokens from "+e+" with"),[2,{accessToken:r,idToken:n,refreshToken:null}]}))}))},e.prototype.handleAuthResponse=function(e){return P(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return x(this,(function(u){switch(u.label){case 0:if(u.trys.push([0,5,,6]),t=e?C(C({},(Object(_.parse)(e).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n=k(t,2),r=n[0],i=n[1];return e[r]=i,e}),{})),(Object(_.parse)(e).query||"").split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n=k(t,2),r=n[0],i=n[1];return e[r]=i,e}),{})):{},n=t.error,r=t.error_description,n)throw new Error(r);return i=this._validateState(t),M.debug("Starting "+this._config.responseType+" flow with "+e),"code"!==this._config.responseType?[3,2]:(o=[{}],[4,this._handleCodeFlow(e)]);case 1:return[2,C.apply(void 0,[C.apply(void 0,o.concat([u.sent()])),{state:i}])];case 2:return s=[{}],[4,this._handleImplicitFlow(e)];case 3:return[2,C.apply(void 0,[C.apply(void 0,s.concat([u.sent()])),{state:i}])];case 4:return[3,6];case 5:throw a=u.sent(),M.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 P(this,void 0,void 0,(function(){var e,t,n;return x(this,(function(i){return e="https://"+this._config.domain+"/logout?",t=Object(r.e)(this._config)?this._cognitoClientId:this._config.oauth.clientID,n=Object(r.e)(this._config)?this._config.redirectSignOut:this._config.returnTo,e+=Object.entries({client_id:t,logout_uri:encodeURIComponent(n)}).map((function(e){var t=k(e,2);return t[0]+"="+t[1]})).join("&"),j("oAuthSignOut",{oAuth:"signOut"},"Signing out from "+e),M.debug("Signing out from "+e),[2,this._urlOpener(e,n)]}))}))},e.prototype._generateState=function(e){for(var t="",n=e,r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";n>0;--n)t+=r[Math.round(Math.random()*(r.length-1))];return t},e.prototype._generateChallenge=function(e){return this._base64URL(O()(e))},e.prototype._base64URL=function(e){return e.toString(T.a).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},e.prototype._generateRandom=function(e){var t=new Uint8Array(e);if("undefined"!=typeof window&&window.crypto)window.crypto.getRandomValues(t);else for(var n=0;n<e;n+=1)t[n]=Math.random()*"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~".length|0;return this._bufferToString(t)},e.prototype._bufferToString=function(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=[],r=0;r<e.byteLength;r+=1){var i=e[r]%t.length;n.push(t[i])}return n.join("")},e}(),D=n(11),U=(b=function(e,t){return(b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}b(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),F=new i.a("AuthError"),L=function(e){function t(n){var r=this,i=q[n],o=i.message,s=i.log;return(r=e.call(this,o)||this).constructor=t,Object.setPrototypeOf(r,t.prototype),r.name="AuthError",r.log=s||o,F.error(r.log),r}return U(t,e),t}(Error),B=function(e){function t(n){var r=e.call(this,n)||this;return r.constructor=t,Object.setPrototypeOf(r,t.prototype),r.name="NoUserPoolError",r}return U(t,e),t}(L),q={noConfig:{message:D.a.DEFAULT_MSG,log:"\n Error: Amplify has not been configured correctly.\n This error is typically caused by one of the following scenarios:\n\n 1. Make sure you're passing the awsconfig object to Amplify.configure() in your app's entry point\n See https://aws-amplify.github.io/docs/js/authentication#configure-your-app for more information\n \n 2. There might be multiple conflicting versions of amplify packages in your node_modules.\n\t\t\t\tRefer to our docs site for help upgrading Amplify packages (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js)\n "},missingAuthConfig:{message:D.a.DEFAULT_MSG,log:"\n Error: Amplify has not been configured correctly. \n The configuration object is missing required auth properties.\n This error is typically caused by one of the following scenarios:\n\n 1. Did you run `amplify push` after adding auth via `amplify add auth`?\n See https://aws-amplify.github.io/docs/js/authentication#amplify-project-setup for more information\n\n 2. This could also be caused by multiple conflicting versions of amplify packages, see (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js) for help upgrading Amplify packages.\n "},emptyUsername:{message:D.a.EMPTY_USERNAME},invalidUsername:{message:D.a.INVALID_USERNAME},emptyPassword:{message:D.a.EMPTY_PASSWORD},emptyCode:{message:D.a.EMPTY_CODE},signUpError:{message:D.a.SIGN_UP_ERROR,log:"The first parameter should either be non-null string or object"},noMFA:{message:D.a.NO_MFA},invalidMFA:{message:D.a.INVALID_MFA},emptyChallengeResponse:{message:D.a.EMPTY_CHALLENGE},noUserSession:{message:D.a.NO_USER_SESSION},deviceConfig:{message:D.a.DEVICE_CONFIG},networkError:{message:D.a.NETWORK_ERROR},autoSignInError:{message:D.a.AUTOSIGNIN_ERROR},default:{message:D.a.DEFAULT_MSG}};function z(e){return(z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var K=function(){return(K=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},V=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},H=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},G=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},W=new i.a("AuthClass"),Y="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",J=function(e,t,n){o.a.dispatch("auth",{event:e,data:t,message:n},"Auth",Y)},$=new(function(){function e(e){var t=this;this.userPool=null,this.user=null,this.oAuthFlowInProgress=!1,this.autoSignInInitiated=!1,this.Credentials=s.a,this.wrapRefreshSessionCallback=function(e){return function(t,n){return n?J("tokenRefresh",void 0,"New token retrieved"):J("tokenRefresh_failure",t,"Failed to retrieve new token"),e(t,n)}},this.configure(e),this.currentCredentials=this.currentCredentials.bind(this),this.currentUserCredentials=this.currentUserCredentials.bind(this),o.a.listen("auth",(function(e){switch(e.payload.event){case"signIn":t._storage.setItem("amplify-signin-with-hostedUI","false");break;case"signOut":t._storage.removeItem("amplify-signin-with-hostedUI");break;case"cognitoHostedUI":t._storage.setItem("amplify-signin-with-hostedUI","true")}}))}return e.prototype.getModuleName=function(){return"Auth"},e.prototype.configure=function(e){var t=this;if(!e)return this._config||{};W.debug("configure Auth");var n=Object.assign({},this._config,l.parseMobilehubConfig(e).Auth,e);this._config=n;var i=this._config,o=i.userPoolId,s=i.userPoolWebClientId,a=i.cookieStorage,u=i.oauth,c=i.region,f=i.identityPoolId,d=i.mandatorySignIn,h=i.refreshHandlers,p=i.identityPoolRegion,y=i.clientMetadata,b=i.endpoint;if(this._config.storage){if(!this._isValidAuthStorage(this._config.storage))throw W.error("The storage in the Auth config is not valid!"),new Error("Empty storage object");this._storage=this._config.storage}else this._storage=a?new S.i(a):e.ssr?new g:(new m.a).getStorage();if(this._storageSync=Promise.resolve(),"function"==typeof this._storage.sync&&(this._storageSync=this._storage.sync()),o){var w={UserPoolId:o,ClientId:s,endpoint:b};w.Storage=this._storage,this.userPool=new S.g(w,this.wrapRefreshSessionCallback)}this.Credentials.configure({mandatorySignIn:d,region:p||c,userPoolId:o,identityPoolId:f,refreshHandlers:h,storage:this._storage});var _=u?Object(r.e)(this._config.oauth)?u:u.awsCognito:void 0;if(_){var E=Object.assign({cognitoClientId:s,UserPoolId:o,domain:_.domain,scopes:_.scope,redirectSignIn:_.redirectSignIn,redirectSignOut:_.redirectSignOut,responseType:_.responseType,Storage:this._storage,urlOpener:_.urlOpener,clientMetadata:y},_.options);this._oAuthHandler=new R({scopes:E.scopes,config:E,cognitoClientId:E.cognitoClientId});var A={};!function(e){if(Object(v.b)().isBrowser&&window.location)e({url:window.location.href});else if(!Object(v.b)().isNode)throw new Error("Not supported")}((function(e){var n=e.url;A[n]||(A[n]=!0,t._handleAuthResponse(n))}))}(J("configured",null,"The Auth category has been configured successfully"),this.autoSignInInitiated||"function"!=typeof this._storage.getItem)||(this.isTrueStorageValue("amplify-polling-started")&&(J("autoSignIn_failure",null,r.a.AutoSignInError),this._storage.removeItem("amplify-auto-sign-in")),this._storage.removeItem("amplify-polling-started"));return this._config},e.prototype.signUp=function(e){for(var t,n,i,o=this,s=[],a=1;a<arguments.length;a++)s[a-1]=arguments[a];if(!this.userPool)return this.rejectNoUserPool();var u,c=null,l=null,f=[],d=null,h={enabled:!1},p={},v={};if(e&&"string"==typeof e){c=e,l=s?s[0]:null;var y=s?s[1]:null,g=s?s[2]:null;y&&f.push(new S.f({Name:"email",Value:y})),g&&f.push(new S.f({Name:"phone_number",Value:g}))}else{if(!e||"object"!==z(e))return this.rejectAuthError(r.a.SignUpError);c=e.username,l=e.password,e&&e.clientMetadata?u=e.clientMetadata:this._config.clientMetadata&&(u=this._config.clientMetadata);var m=e.attributes;m&&Object.keys(m).map((function(e){f.push(new S.f({Name:e,Value:m[e]}))}));var b=e.validationData;b&&(d=[],Object.keys(b).map((function(e){d.push(new S.f({Name:e,Value:b[e]}))}))),(h=null!==(t=e.autoSignIn)&&void 0!==t?t:{enabled:!1}).enabled&&(this._storage.setItem("amplify-auto-sign-in","true"),p=null!==(n=h.validationData)&&void 0!==n?n:{},v=null!==(i=h.clientMetaData)&&void 0!==i?i:{})}return c?l?(W.debug("signUp attrs:",f),W.debug("signUp validation data:",d),new Promise((function(e,t){o.userPool.signUp(c,l,f,d,(function(n,r){n?(J("signUp_failure",n,c+" failed to signup"),t(n)):(J("signUp",r,c+" has signed up successfully"),h.enabled&&o.handleAutoSignIn(c,l,p,v,r),e(r))}),u)}))):this.rejectAuthError(r.a.EmptyPassword):this.rejectAuthError(r.a.EmptyUsername)},e.prototype.handleAutoSignIn=function(e,t,n,r,i){this.autoSignInInitiated=!0;var o=new S.a({Username:e,Password:t,ValidationData:n,ClientMetadata:r});i.userConfirmed?this.signInAfterUserConfirmed(o):"link"===this._config.signUpVerificationMethod?this.handleLinkAutoSignIn(o):this.handleCodeAutoSignIn(o)},e.prototype.handleCodeAutoSignIn=function(e){var t=this;o.a.listen("auth",(function n(r){"confirmSignUp"===r.payload.event&&t.signInAfterUserConfirmed(e,n)}))},e.prototype.handleLinkAutoSignIn=function(e){var t=this;this._storage.setItem("amplify-polling-started","true");var n=Date.now(),r=setInterval((function(){Date.now()-n>18e4?(clearInterval(r),J("autoSignIn_failure",null,"Please confirm your account and use your credentials to sign in."),t._storage.removeItem("amplify-auto-sign-in")):t.signInAfterUserConfirmed(e,null,r)}),5e3)},e.prototype.signInAfterUserConfirmed=function(e,t,n){return V(this,void 0,void 0,(function(){var r,i,s=this;return H(this,(function(a){switch(a.label){case 0:r=this.createCognitoUser(e.getUsername()),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,r.authenticateUser(e,this.authCallbacks(r,(function(r){J("autoSignIn",r,e.getUsername()+" has signed in successfully"),t&&o.a.remove("auth",t),n&&(clearInterval(n),s._storage.removeItem("amplify-polling-started")),s._storage.removeItem("amplify-auto-sign-in")}),(function(e){W.error(e),s._storage.removeItem("amplify-auto-sign-in")})))];case 2:return a.sent(),[3,4];case 3:return i=a.sent(),W.error(i),[3,4];case 4:return[2]}}))}))},e.prototype.confirmSignUp=function(e,t,n){var i=this;if(!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(r.a.EmptyUsername);if(!t)return this.rejectAuthError(r.a.EmptyCode);var o,s=this.createCognitoUser(e),a=!n||"boolean"!=typeof n.forceAliasCreation||n.forceAliasCreation;return n&&n.clientMetadata?o=n.clientMetadata:this._config.clientMetadata&&(o=this._config.clientMetadata),new Promise((function(n,u){s.confirmRegistration(t,a,(function(t,o){t?u(t):(J("confirmSignUp",o,e+" has been confirmed successfully"),i.isTrueStorageValue("amplify-auto-sign-in")&&!i.autoSignInInitiated&&(J("autoSignIn_failure",null,r.a.AutoSignInError),i._storage.removeItem("amplify-auto-sign-in")),n(o))}),o)}))},e.prototype.isTrueStorageValue=function(e){var t=this._storage.getItem(e);return!!t&&"true"===t},e.prototype.resendSignUp=function(e,t){if(void 0===t&&(t=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(r.a.EmptyUsername);var n=this.createCognitoUser(e);return new Promise((function(e,r){n.resendConfirmationCode((function(t,n){t?r(t):e(n)}),t)}))},e.prototype.signIn=function(e,t,n){if(void 0===n&&(n=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();var i=null,o=null,s={};if("string"==typeof e)i=e,o=t;else{if(!Object(r.h)(e))return this.rejectAuthError(r.a.InvalidUsername);void 0!==t&&W.warn("The password should be defined under the first parameter object!"),i=e.username,o=e.password,s=e.validationData}if(!i)return this.rejectAuthError(r.a.EmptyUsername);var a=new S.a({Username:i,Password:o,ValidationData:s,ClientMetadata:n});return o?this.signInWithPassword(a):this.signInWithoutPassword(a)},e.prototype.authCallbacks=function(e,t,n){var r=this,i=this;return{onSuccess:function(o){return V(r,void 0,void 0,(function(){var r,s,a,u;return H(this,(function(c){switch(c.label){case 0:W.debug(o),delete e.challengeName,delete e.challengeParam,c.label=1;case 1:return c.trys.push([1,4,5,9]),[4,this.Credentials.clear()];case 2:return c.sent(),[4,this.Credentials.set(o,"session")];case 3:return r=c.sent(),W.debug("succeed to get cognito credentials",r),[3,9];case 4:return s=c.sent(),W.debug("cannot get cognito credentials",s),[3,9];case 5:return c.trys.push([5,7,,8]),[4,this.currentUserPoolUser()];case 6:return a=c.sent(),i.user=a,J("signIn",a,"A user "+e.getUsername()+" has been signed in"),t(a),[3,8];case 7:return u=c.sent(),W.error("Failed to get the signed in user",u),n(u),[3,8];case 8:return[7];case 9:return[2]}}))}))},onFailure:function(t){W.debug("signIn failure",t),J("signIn_failure",t,e.getUsername()+" failed to signin"),n(t)},customChallenge:function(n){W.debug("signIn custom challenge answer required"),e.challengeName="CUSTOM_CHALLENGE",e.challengeParam=n,t(e)},mfaRequired:function(n,r){W.debug("signIn MFA required"),e.challengeName=n,e.challengeParam=r,t(e)},mfaSetup:function(n,r){W.debug("signIn mfa setup",n),e.challengeName=n,e.challengeParam=r,t(e)},newPasswordRequired:function(n,r){W.debug("signIn new password"),e.challengeName="NEW_PASSWORD_REQUIRED",e.challengeParam={userAttributes:n,requiredAttributes:r},t(e)},totpRequired:function(n,r){W.debug("signIn totpRequired"),e.challengeName=n,e.challengeParam=r,t(e)},selectMFAType:function(n,r){W.debug("signIn selectMFAType",n),e.challengeName=n,e.challengeParam=r,t(e)}}},e.prototype.signInWithPassword=function(e){var t=this;if(this.pendingSignIn)throw new Error("Pending sign-in attempt already in progress");var n=this.createCognitoUser(e.getUsername());return this.pendingSignIn=new Promise((function(r,i){n.authenticateUser(e,t.authCallbacks(n,(function(e){t.pendingSignIn=null,r(e)}),(function(e){t.pendingSignIn=null,i(e)})))})),this.pendingSignIn},e.prototype.signInWithoutPassword=function(e){var t=this,n=this.createCognitoUser(e.getUsername());return n.setAuthenticationFlowType("CUSTOM_AUTH"),new Promise((function(r,i){n.initiateAuth(e,t.authCallbacks(n,r,i))}))},e.prototype.getMFAOptions=function(e){return new Promise((function(t,n){e.getMFAOptions((function(e,r){if(e)return W.debug("get MFA Options failed",e),void n(e);W.debug("get MFA options success",r),t(r)}))}))},e.prototype.getPreferredMFA=function(e,t){var n=this,r=this;return new Promise((function(i,o){var s=n._config.clientMetadata,a=!!t&&t.bypassCache;e.getUserData((function(t,s){return V(n,void 0,void 0,(function(){var n,a;return H(this,(function(u){switch(u.label){case 0:if(!t)return[3,5];if(W.debug("getting preferred mfa failed",t),!this.isSessionInvalid(t))return[3,4];u.label=1;case 1:return u.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return u.sent(),[3,4];case 3:return n=u.sent(),o(new Error("Session is invalid due to: "+t.message+" and failed to clean up invalid session: "+n.message)),[2];case 4:return o(t),[2];case 5:return(a=r._getMfaTypeFromUserData(s))?(i(a),[2]):(o("invalid MFA Type"),[2])}}))}))}),{bypassCache:a,clientMetadata:s})}))},e.prototype._getMfaTypeFromUserData=function(e){var t=null,n=e.PreferredMfaSetting;if(n)t=n;else{var r=e.UserMFASettingList;if(r)0===r.length?t="NOMFA":W.debug("invalid case for getPreferredMFA",e);else t=e.MFAOptions?"SMS_MFA":"NOMFA"}return t},e.prototype._getUserData=function(e,t){var n=this;return new Promise((function(r,i){e.getUserData((function(t,o){return V(n,void 0,void 0,(function(){var n;return H(this,(function(s){switch(s.label){case 0:if(!t)return[3,5];if(W.debug("getting user data failed",t),!this.isSessionInvalid(t))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return s.sent(),[3,4];case 3:return n=s.sent(),i(new Error("Session is invalid due to: "+t.message+" and failed to clean up invalid session: "+n.message)),[2];case 4:return i(t),[2];case 5:r(o),s.label=6;case 6:return[2]}}))}))}),t)}))},e.prototype.setPreferredMFA=function(e,t){return V(this,void 0,void 0,(function(){var n,i,o,s,a,u,c=this;return H(this,(function(l){switch(l.label){case 0:return n=this._config.clientMetadata,[4,this._getUserData(e,{bypassCache:!0,clientMetadata:n})];case 1:switch(i=l.sent(),o=null,s=null,t){case"TOTP":case"SOFTWARE_TOKEN_MFA":return[3,2];case"SMS":case"SMS_MFA":return[3,3];case"NOMFA":return[3,4]}return[3,6];case 2:return s={PreferredMfa:!0,Enabled:!0},[3,7];case 3:return o={PreferredMfa:!0,Enabled:!0},[3,7];case 4:return a=i.UserMFASettingList,[4,this._getMfaTypeFromUserData(i)];case 5:if("NOMFA"===(u=l.sent()))return[2,Promise.resolve("No change for mfa type")];if("SMS_MFA"===u)o={PreferredMfa:!1,Enabled:!1};else{if("SOFTWARE_TOKEN_MFA"!==u)return[2,this.rejectAuthError(r.a.InvalidMFA)];s={PreferredMfa:!1,Enabled:!1}}return a&&0!==a.length&&a.forEach((function(e){"SMS_MFA"===e?o={PreferredMfa:!1,Enabled:!1}:"SOFTWARE_TOKEN_MFA"===e&&(s={PreferredMfa:!1,Enabled:!1})})),[3,7];case 6:return W.debug("no validmfa method provided"),[2,this.rejectAuthError(r.a.NoMFA)];case 7:return this,[2,new Promise((function(t,r){e.setUserMfaPreference(o,s,(function(i,o){if(i)return W.debug("Set user mfa preference error",i),r(i);W.debug("Set user mfa success",o),W.debug("Caching the latest user data into local"),e.getUserData((function(n,i){return V(c,void 0,void 0,(function(){var i;return H(this,(function(s){switch(s.label){case 0:if(!n)return[3,5];if(W.debug("getting user data failed",n),!this.isSessionInvalid(n))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return s.sent(),[3,4];case 3:return i=s.sent(),r(new Error("Session is invalid due to: "+n.message+" and failed to clean up invalid session: "+i.message)),[2];case 4:return[2,r(n)];case 5:return[2,t(o)]}}))}))}),{bypassCache:!0,clientMetadata:n})}))}))]}}))}))},e.prototype.disableSMS=function(e){return new Promise((function(t,n){e.disableMFA((function(e,r){if(e)return W.debug("disable mfa failed",e),void n(e);W.debug("disable mfa succeed",r),t(r)}))}))},e.prototype.enableSMS=function(e){return new Promise((function(t,n){e.enableMFA((function(e,r){if(e)return W.debug("enable mfa failed",e),void n(e);W.debug("enable mfa succeed",r),t(r)}))}))},e.prototype.setupTOTP=function(e){return new Promise((function(t,n){e.associateSoftwareToken({onFailure:function(e){W.debug("associateSoftwareToken failed",e),n(e)},associateSecretCode:function(e){W.debug("associateSoftwareToken sucess",e),t(e)}})}))},e.prototype.verifyTotpToken=function(e,t){return W.debug("verification totp token",e,t),new Promise((function(n,r){e.verifySoftwareToken(t,"My TOTP device",{onFailure:function(e){W.debug("verifyTotpToken failed",e),r(e)},onSuccess:function(t){J("signIn",e,"A user "+e.getUsername()+" has been signed in"),W.debug("verifyTotpToken success",t),n(t)}})}))},e.prototype.confirmSignIn=function(e,t,n,i){var o=this;if(void 0===i&&(i=this._config.clientMetadata),!t)return this.rejectAuthError(r.a.EmptyCode);var s=this;return new Promise((function(r,a){e.sendMFACode(t,{onSuccess:function(t){return V(o,void 0,void 0,(function(){var n,i;return H(this,(function(o){switch(o.label){case 0:W.debug(t),o.label=1;case 1:return o.trys.push([1,4,5,6]),[4,this.Credentials.clear()];case 2:return o.sent(),[4,this.Credentials.set(t,"session")];case 3:return n=o.sent(),W.debug("succeed to get cognito credentials",n),[3,6];case 4:return i=o.sent(),W.debug("cannot get cognito credentials",i),[3,6];case 5:return s.user=e,J("signIn",e,"A user "+e.getUsername()+" has been signed in"),r(e),[7];case 6:return[2]}}))}))},onFailure:function(e){W.debug("confirm signIn failure",e),a(e)}},n,i)}))},e.prototype.completeNewPassword=function(e,t,n,i){var o=this;if(void 0===n&&(n={}),void 0===i&&(i=this._config.clientMetadata),!t)return this.rejectAuthError(r.a.EmptyPassword);var s=this;return new Promise((function(r,a){e.completeNewPasswordChallenge(t,n,{onSuccess:function(t){return V(o,void 0,void 0,(function(){var n,i;return H(this,(function(o){switch(o.label){case 0:W.debug(t),o.label=1;case 1:return o.trys.push([1,4,5,6]),[4,this.Credentials.clear()];case 2:return o.sent(),[4,this.Credentials.set(t,"session")];case 3:return n=o.sent(),W.debug("succeed to get cognito credentials",n),[3,6];case 4:return i=o.sent(),W.debug("cannot get cognito credentials",i),[3,6];case 5:return s.user=e,J("signIn",e,"A user "+e.getUsername()+" has been signed in"),r(e),[7];case 6:return[2]}}))}))},onFailure:function(e){W.debug("completeNewPassword failure",e),J("completeNewPassword_failure",e,o.user+" failed to complete the new password flow"),a(e)},mfaRequired:function(t,n){W.debug("signIn MFA required"),e.challengeName=t,e.challengeParam=n,r(e)},mfaSetup:function(t,n){W.debug("signIn mfa setup",t),e.challengeName=t,e.challengeParam=n,r(e)},totpRequired:function(t,n){W.debug("signIn mfa setup",t),e.challengeName=t,e.challengeParam=n,r(e)}},i)}))},e.prototype.sendCustomChallengeAnswer=function(e,t,n){var i=this;if(void 0===n&&(n=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!t)return this.rejectAuthError(r.a.EmptyChallengeResponse);return new Promise((function(r,o){e.sendCustomChallengeAnswer(t,i.authCallbacks(e,r,o),n)}))},e.prototype.deleteUserAttributes=function(e,t){var n=this;return new Promise((function(r,i){n.userSession(e).then((function(n){e.deleteAttributes(t,(function(e,t){return e?i(e):r(t)}))}))}))},e.prototype.deleteUser=function(){return V(this,void 0,void 0,(function(){var e,t,n=this;return H(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this._storageSync];case 1:return r.sent(),[3,3];case 2:throw e=r.sent(),W.debug("Failed to sync cache info into memory",e),new Error(e);case 3:return t=this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI"),[2,new Promise((function(e,r){return V(n,void 0,void 0,(function(){var n,i=this;return H(this,(function(o){if(this.userPool){if(!(n=this.userPool.getCurrentUser()))return W.debug("Failed to get user from user pool"),[2,r(new Error("No current user."))];n.getSession((function(o,s){return V(i,void 0,void 0,(function(){var i,s=this;return H(this,(function(a){switch(a.label){case 0:if(!o)return[3,5];if(W.debug("Failed to get the user session",o),!this.isSessionInvalid(o))return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(n)];case 2:return a.sent(),[3,4];case 3:return i=a.sent(),r(new Error("Session is invalid due to: "+o.message+" and failed to clean up invalid session: "+i.message)),[2];case 4:return[2,r(o)];case 5:n.deleteUser((function(i,o){if(i)r(i);else{J("userDeleted",o,"The authenticated user has been deleted."),n.signOut(),s.user=null;try{s.cleanCachedItems()}catch(e){W.debug("failed to clear cached items")}t?s.oAuthSignOutRedirect(e,r):(J("signOut",s.user,"A user has been signed out"),e(o))}})),a.label=6;case 6:return[2]}}))}))}))}else W.debug("no Congito User pool"),r(new Error("Cognito User pool does not exist"));return[2]}))}))}))]}}))}))},e.prototype.updateUserAttributes=function(e,t,n){void 0===n&&(n=this._config.clientMetadata);var r=[],i=this;return new Promise((function(o,s){i.userSession(e).then((function(i){for(var a in t)if("sub"!==a&&a.indexOf("_verified")<0){var u={Name:a,Value:t[a]};r.push(u)}e.updateAttributes(r,(function(e,t){return e?s(e):o(t)}),n)}))}))},e.prototype.userAttributes=function(e){var t=this;return new Promise((function(n,r){t.userSession(e).then((function(t){e.getUserAttributes((function(e,t){e?r(e):n(t)}))}))}))},e.prototype.verifiedContact=function(e){var t=this;return this.userAttributes(e).then((function(e){var n=t.attributesToObject(e),r={},i={};return n.email&&(n.email_verified?i.email=n.email:r.email=n.email),n.phone_number&&(n.phone_number_verified?i.phone_number=n.phone_number:r.phone_number=n.phone_number),{verified:i,unverified:r}}))},e.prototype.isErrorWithMessage=function(e){return"object"===z(e)&&Object.prototype.hasOwnProperty.call(e,"message")},e.prototype.isTokenRevokedError=function(e){return this.isErrorWithMessage(e)&&"Access Token has been revoked"===e.message},e.prototype.isRefreshTokenRevokedError=function(e){return this.isErrorWithMessage(e)&&"Refresh Token has been revoked"===e.message},e.prototype.isUserDisabledError=function(e){return this.isErrorWithMessage(e)&&"User is disabled."===e.message},e.prototype.isUserDoesNotExistError=function(e){return this.isErrorWithMessage(e)&&"User does not exist."===e.message},e.prototype.isRefreshTokenExpiredError=function(e){return this.isErrorWithMessage(e)&&"Refresh Token has expired"===e.message},e.prototype.isSignedInHostedUI=function(){return this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI")},e.prototype.isSessionInvalid=function(e){return this.isUserDisabledError(e)||this.isUserDoesNotExistError(e)||this.isTokenRevokedError(e)||this.isRefreshTokenRevokedError(e)||this.isRefreshTokenExpiredError(e)},e.prototype.cleanUpInvalidSession=function(e){return V(this,void 0,void 0,(function(){var t=this;return H(this,(function(n){switch(n.label){case 0:e.signOut(),this.user=null,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.cleanCachedItems()];case 2:return n.sent(),[3,4];case 3:return n.sent(),W.debug("failed to clear cached items"),[3,4];case 4:return this.isSignedInHostedUI()?[2,new Promise((function(e,n){t.oAuthSignOutRedirect(e,n)}))]:(J("signOut",this.user,"A user has been signed out"),[2])}}))}))},e.prototype.currentUserPoolUser=function(e){var t=this;return this.userPool?new Promise((function(n,r){t._storageSync.then((function(){return V(t,void 0,void 0,(function(){var t,i,s=this;return H(this,(function(a){switch(a.label){case 0:return this.isOAuthInProgress()?(W.debug("OAuth signIn in progress, waiting for resolution..."),[4,new Promise((function(e){var t=setTimeout((function(){W.debug("OAuth signIn in progress timeout"),o.a.remove("auth",n),e()}),1e4);function n(r){var i=r.payload.event;"cognitoHostedUI"!==i&&"cognitoHostedUI_failure"!==i||(W.debug("OAuth signIn resolved: "+i),clearTimeout(t),o.a.remove("auth",n),e())}o.a.listen("auth",n)}))]):[3,2];case 1:a.sent(),a.label=2;case 2:return(t=this.userPool.getCurrentUser())?(i=this._config.clientMetadata,t.getSession((function(i,o){return V(s,void 0,void 0,(function(){var s,a,u,c,l=this;return H(this,(function(f){switch(f.label){case 0:if(!i)return[3,5];if(W.debug("Failed to get the user session",i),!this.isSessionInvalid(i))return[3,4];f.label=1;case 1:return f.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return f.sent(),[3,4];case 3:return s=f.sent(),r(new Error("Session is invalid due to: "+i.message+" and failed to clean up invalid session: "+s.message)),[2];case 4:return r(i),[2];case 5:return(a=!!e&&e.bypassCache)?[4,this.Credentials.clear()]:[3,7];case 6:f.sent(),f.label=7;case 7:return u=this._config.clientMetadata,c=o.getAccessToken().decodePayload().scope,(void 0===c?"":c).split(" ").includes("aws.cognito.signin.user.admin")?(t.getUserData((function(e,i){return V(l,void 0,void 0,(function(){var o,s,a,u,c,l,f;return H(this,(function(d){switch(d.label){case 0:if(!e)return[3,7];if(W.debug("getting user data failed",e),!this.isSessionInvalid(e))return[3,5];d.label=1;case 1:return d.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return d.sent(),[3,4];case 3:return o=d.sent(),r(new Error("Session is invalid due to: "+e.message+" and failed to clean up invalid session: "+o.message)),[2];case 4:return r(e),[3,6];case 5:n(t),d.label=6;case 6:return[2];case 7:for(s=i.PreferredMfaSetting||"NOMFA",a=[],u=0;u<i.UserAttributes.length;u++)c={Name:i.UserAttributes[u].Name,Value:i.UserAttributes[u].Value},l=new S.f(c),a.push(l);return f=this.attributesToObject(a),Object.assign(t,{attributes:f,preferredMFA:s}),[2,n(t)]}}))}))}),{bypassCache:a,clientMetadata:u}),[2]):(W.debug("Unable to get the user data because the aws.cognito.signin.user.admin is not in the scopes of the access token"),[2,n(t)])}}))}))}),{clientMetadata:i}),[2]):(W.debug("Failed to get user from user pool"),r("No current user"),[2])}}))}))})).catch((function(e){return W.debug("Failed to sync cache info into memory",e),r(e)}))})):this.rejectNoUserPool()},e.prototype.isOAuthInProgress=function(){return this.oAuthFlowInProgress},e.prototype.currentAuthenticatedUser=function(e){return V(this,void 0,void 0,(function(){var t,n,r,i,o;return H(this,(function(s){switch(s.label){case 0:W.debug("getting current authenticated user"),t=null,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._storageSync];case 2:return s.sent(),[3,4];case 3:throw n=s.sent(),W.debug("Failed to sync cache info into memory",n),n;case 4:try{(r=JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")))&&(t=K(K({},r.user),{token:r.token}))}catch(e){W.debug("cannot load federated user from auth storage")}return t?(this.user=t,W.debug("get current authenticated federated user",this.user),[2,this.user]):[3,5];case 5:W.debug("get current authenticated userpool user"),i=null,s.label=6;case 6:return s.trys.push([6,8,,9]),[4,this.currentUserPoolUser(e)];case 7:return i=s.sent(),[3,9];case 8:return"No userPool"===(o=s.sent())&&W.error("Cannot get the current user because the user pool is missing. Please make sure the Auth module is configured with a valid Cognito User Pool ID"),W.debug("The user is not authenticated by the error",o),[2,Promise.reject("The user is not authenticated")];case 9:return this.user=i,[2,this.user]}}))}))},e.prototype.currentSession=function(){var e=this;return W.debug("Getting current session"),this.userPool?new Promise((function(t,n){e.currentUserPoolUser().then((function(r){e.userSession(r).then((function(e){t(e)})).catch((function(e){W.debug("Failed to get the current session",e),n(e)}))})).catch((function(e){W.debug("Failed to get the current user",e),n(e)}))})):Promise.reject(new Error("No User Pool in the configuration."))},e.prototype.userSession=function(e){var t=this;if(!e)return W.debug("the user is null"),this.rejectAuthError(r.a.NoUserSession);var n=this._config.clientMetadata;return new Promise((function(r,i){W.debug("Getting the session from this user:",e),e.getSession((function(n,o){return V(t,void 0,void 0,(function(){var t;return H(this,(function(s){switch(s.label){case 0:if(!n)return[3,5];if(W.debug("Failed to get the session from user",e),!this.isSessionInvalid(n))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(e)];case 2:return s.sent(),[3,4];case 3:return t=s.sent(),i(new Error("Session is invalid due to: "+n.message+" and failed to clean up invalid session: "+t.message)),[2];case 4:return i(n),[2];case 5:return W.debug("Succeed to get the user session",o),r(o),[2]}}))}))}),{clientMetadata:n})}))},e.prototype.currentUserCredentials=function(){return V(this,void 0,void 0,(function(){var e,t,n=this;return H(this,(function(r){switch(r.label){case 0:W.debug("Getting current user credentials"),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._storageSync];case 2:return r.sent(),[3,4];case 3:throw e=r.sent(),W.debug("Failed to sync cache info into memory",e),e;case 4:t=null;try{t=JSON.parse(this._storage.getItem("aws-amplify-federatedInfo"))}catch(e){W.debug("failed to get or parse item aws-amplify-federatedInfo",e)}return t?[2,this.Credentials.refreshFederatedToken(t)]:[2,this.currentSession().then((function(e){return W.debug("getting session success",e),n.Credentials.set(e,"session")})).catch((function(){return W.debug("getting guest credentials"),n.Credentials.set(null,"guest")}))]}}))}))},e.prototype.currentCredentials=function(){return W.debug("getting current credentials"),this.Credentials.get()},e.prototype.verifyUserAttribute=function(e,t,n){return void 0===n&&(n=this._config.clientMetadata),new Promise((function(r,i){e.getAttributeVerificationCode(t,{onSuccess:function(e){return r(e)},onFailure:function(e){return i(e)}},n)}))},e.prototype.verifyUserAttributeSubmit=function(e,t,n){return n?new Promise((function(r,i){e.verifyAttribute(t,n,{onSuccess:function(e){r(e)},onFailure:function(e){i(e)}})})):this.rejectAuthError(r.a.EmptyCode)},e.prototype.verifyCurrentUserAttribute=function(e){var t=this;return t.currentUserPoolUser().then((function(n){return t.verifyUserAttribute(n,e)}))},e.prototype.verifyCurrentUserAttributeSubmit=function(e,t){var n=this;return n.currentUserPoolUser().then((function(r){return n.verifyUserAttributeSubmit(r,e,t)}))},e.prototype.cognitoIdentitySignOut=function(e,t){return V(this,void 0,void 0,(function(){var n,r,i=this;return H(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this._storageSync];case 1:return o.sent(),[3,3];case 2:throw n=o.sent(),W.debug("Failed to sync cache info into memory",n),n;case 3:return r=this._oAuthHandler&&"true"===this._storage.getItem("amplify-signin-with-hostedUI"),[2,new Promise((function(n,o){if(e&&e.global){W.debug("user global sign out",t);var s=i._config.clientMetadata;t.getSession((function(e,s){return V(i,void 0,void 0,(function(){var i,s=this;return H(this,(function(a){switch(a.label){case 0:if(!e)return[3,5];if(W.debug("failed to get the user session",e),!this.isSessionInvalid(e))return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.cleanUpInvalidSession(t)];case 2:return a.sent(),[3,4];case 3:return i=a.sent(),o(new Error("Session is invalid due to: "+e.message+" and failed to clean up invalid session: "+i.message)),[2];case 4:return[2,o(e)];case 5:return t.globalSignOut({onSuccess:function(e){if(W.debug("global sign out success"),!r)return n();s.oAuthSignOutRedirect(n,o)},onFailure:function(e){return W.debug("global sign out failed",e),o(e)}}),[2]}}))}))}),{clientMetadata:s})}else W.debug("user sign out",t),t.signOut((function(){if(!r)return n();i.oAuthSignOutRedirect(n,o)}))}))]}}))}))},e.prototype.oAuthSignOutRedirect=function(e,t){Object(v.b)().isBrowser?this.oAuthSignOutRedirectOrReject(t):this.oAuthSignOutAndResolve(e)},e.prototype.oAuthSignOutAndResolve=function(e){this._oAuthHandler.signOut(),e()},e.prototype.oAuthSignOutRedirectOrReject=function(e){this._oAuthHandler.signOut(),setTimeout((function(){return e(Error("Signout timeout fail"))}),3e3)},e.prototype.signOut=function(e){return V(this,void 0,void 0,(function(){var t;return H(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.cleanCachedItems()];case 1:return n.sent(),[3,3];case 2:return n.sent(),W.debug("failed to clear cached items"),[3,3];case 3:return this.userPool?(t=this.userPool.getCurrentUser())?[4,this.cognitoIdentitySignOut(e,t)]:[3,5]:[3,7];case 4:return n.sent(),[3,6];case 5:W.debug("no current Cognito user"),n.label=6;case 6:return[3,8];case 7:W.debug("no Cognito User pool"),n.label=8;case 8:return J("signOut",this.user,"A user has been signed out"),this.user=null,[2]}}))}))},e.prototype.cleanCachedItems=function(){return V(this,void 0,void 0,(function(){return H(this,(function(e){switch(e.label){case 0:return[4,this.Credentials.clear()];case 1:return e.sent(),[2]}}))}))},e.prototype.changePassword=function(e,t,n,r){var i=this;return void 0===r&&(r=this._config.clientMetadata),new Promise((function(o,s){i.userSession(e).then((function(i){e.changePassword(t,n,(function(e,t){return e?(W.debug("change password failure",e),s(e)):o(t)}),r)}))}))},e.prototype.forgotPassword=function(e,t){if(void 0===t&&(t=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(r.a.EmptyUsername);var n=this.createCognitoUser(e);return new Promise((function(r,i){n.forgotPassword({onSuccess:function(){r()},onFailure:function(t){W.debug("forgot password failure",t),J("forgotPassword_failure",t,e+" forgotPassword failed"),i(t)},inputVerificationCode:function(t){J("forgotPassword",n,e+" has initiated forgot password flow"),r(t)}},t)}))},e.prototype.forgotPasswordSubmit=function(e,t,n,i){if(void 0===i&&(i=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(r.a.EmptyUsername);if(!t)return this.rejectAuthError(r.a.EmptyCode);if(!n)return this.rejectAuthError(r.a.EmptyPassword);var o=this.createCognitoUser(e);return new Promise((function(r,s){o.confirmPassword(t,n,{onSuccess:function(t){J("forgotPasswordSubmit",o,e+" forgotPasswordSubmit successful"),r(t)},onFailure:function(t){J("forgotPasswordSubmit_failure",t,e+" forgotPasswordSubmit failed"),s(t)}},i)}))},e.prototype.currentUserInfo=function(){return V(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return H(this,(function(a){switch(a.label){case 0:return(e=this.Credentials.getCredSource())&&"aws"!==e&&"userPool"!==e?[3,9]:[4,this.currentUserPoolUser().catch((function(e){return W.error(e)}))];case 1:if(!(s=a.sent()))return[2,null];a.label=2;case 2:return a.trys.push([2,8,,9]),[4,this.userAttributes(s)];case 3:t=a.sent(),n=this.attributesToObject(t),r=null,a.label=4;case 4:return a.trys.push([4,6,,7]),[4,this.currentCredentials()];case 5:return r=a.sent(),[3,7];case 6:return i=a.sent(),W.debug("Failed to retrieve credentials while getting current user info",i),[3,7];case 7:return[2,{id:r?r.identityId:void 0,username:s.getUsername(),attributes:n}];case 8:return o=a.sent(),W.error("currentUserInfo error",o),[2,{}];case 9:return"federated"===e?[2,(s=this.user)||{}]:[2]}}))}))},e.prototype.federatedSignIn=function(e,t,n){return V(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p;return H(this,(function(v){switch(v.label){case 0:if(!this._config.identityPoolId&&!this._config.userPoolId)throw new Error("Federation requires either a User Pool or Identity Pool in config");if(void 0===e&&this._config.identityPoolId&&!this._config.userPoolId)throw new Error("Federation with Identity Pools requires tokens passed as arguments");return Object(r.f)(e)||Object(r.g)(e)||Object(r.d)(e)||void 0===e?(i=e||{provider:r.b.Cognito},u=Object(r.f)(i)?i.provider:i.customProvider,Object(r.f)(i),o=i.customState,this._config.userPoolId&&(s=Object(r.e)(this._config.oauth)?this._config.userPoolWebClientId:this._config.oauth.clientID,a=Object(r.e)(this._config.oauth)?this._config.oauth.redirectSignIn:this._config.oauth.redirectUri,this._oAuthHandler.oauthSignIn(this._config.oauth.responseType,this._config.oauth.domain,a,s,u,o)),[3,4]):[3,1];case 1:u=e;try{(c=JSON.stringify(JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")).user))&&W.warn("There is already a signed in user: "+c+" in your app.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tYou should not call Auth.federatedSignIn method again as it may cause unexpected behavior.")}catch(e){}return l=t.token,f=t.identity_id,d=t.expires_at,[4,this.Credentials.set({provider:u,token:l,identity_id:f,user:n,expires_at:d},"federation")];case 2:return h=v.sent(),[4,this.currentAuthenticatedUser()];case 3:return p=v.sent(),J("signIn",p,"A user "+p.username+" has been signed in"),W.debug("federated sign in credentials",h),[2,h];case 4:return[2]}}))}))},e.prototype._handleAuthResponse=function(e){return V(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,f,d,h,p;return H(this,(function(y){switch(y.label){case 0:if(this.oAuthFlowInProgress)return W.debug("Skipping URL "+e+" current flow in progress"),[2];y.label=1;case 1:if(y.trys.push([1,,8,9]),this.oAuthFlowInProgress=!0,!this._config.userPoolId)throw new Error("OAuth responses require a User Pool defined in config");if(J("parsingCallbackUrl",{url:e},"The callback url is being parsed"),t=e||(Object(v.b)().isBrowser?window.location.href:""),n=!!(Object(_.parse)(t).query||"").split("&").map((function(e){return e.split("=")})).find((function(e){var t=G(e,1)[0];return"code"===t||"error"===t})),r=!!(Object(_.parse)(t).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).find((function(e){var t=G(e,1)[0];return"access_token"===t||"error"===t})),!n&&!r)return[3,7];this._storage.setItem("amplify-redirected-from-hosted-ui","true"),y.label=2;case 2:return y.trys.push([2,6,,7]),[4,this._oAuthHandler.handleAuthResponse(t)];case 3:return i=y.sent(),o=i.accessToken,s=i.idToken,a=i.refreshToken,u=i.state,c=new S.h({IdToken:new S.c({IdToken:s}),RefreshToken:new S.d({RefreshToken:a}),AccessToken:new S.b({AccessToken:o})}),l=void 0,this._config.identityPoolId?[4,this.Credentials.set(c,"session")]:[3,5];case 4:l=y.sent(),W.debug("AWS credentials",l),y.label=5;case 5:return f=/-/.test(u),(d=this.createCognitoUser(c.getIdToken().decodePayload()["cognito:username"])).setSignInUserSession(c),window&&void 0!==window.history&&window.history.replaceState({},null,this._config.oauth.redirectSignIn),J("signIn",d,"A user "+d.getUsername()+" has been signed in"),J("cognitoHostedUI",d,"A user "+d.getUsername()+" has been signed in via Cognito Hosted UI"),f&&(h=u.split("-").splice(1).join("-"),J("customOAuthState",h.match(/.{2}/g).map((function(e){return String.fromCharCode(parseInt(e,16))})).join(""),"State for user "+d.getUsername())),[2,l];case 6:return p=y.sent(),W.debug("Error in cognito hosted auth response",p),window&&void 0!==window.history&&window.history.replaceState({},null,this._config.oauth.redirectSignIn),J("signIn_failure",p,"The OAuth response flow failed"),J("cognitoHostedUI_failure",p,"A failure occurred when returning to the Cognito Hosted UI"),J("customState_failure",p,"A failure occurred when returning state"),[3,7];case 7:return[3,9];case 8:return this.oAuthFlowInProgress=!1,[7];case 9:return[2]}}))}))},e.prototype.essentialCredentials=function(e){return{accessKeyId:e.accessKeyId,sessionToken:e.sessionToken,secretAccessKey:e.secretAccessKey,identityId:e.identityId,authenticated:e.authenticated}},e.prototype.attributesToObject=function(e){var t=this,n={};return e&&e.map((function(e){"email_verified"===e.Name||"phone_number_verified"===e.Name?n[e.Name]=t.isTruthyString(e.Value)||!0===e.Value:n[e.Name]=e.Value})),n},e.prototype.isTruthyString=function(e){return"function"==typeof e.toLowerCase&&"true"===e.toLowerCase()},e.prototype.createCognitoUser=function(e){var t={Username:e,Pool:this.userPool};t.Storage=this._storage;var n=this._config.authenticationFlowType,r=new S.e(t);return n&&r.setAuthenticationFlowType(n),r},e.prototype._isValidAuthStorage=function(e){return!!e&&"function"==typeof e.getItem&&"function"==typeof e.setItem&&"function"==typeof e.removeItem&&"function"==typeof e.clear},e.prototype.noUserPoolErrorHandler=function(e){return!e||e.userPoolId&&e.identityPoolId?r.a.NoConfig:r.a.MissingAuthConfig},e.prototype.rejectAuthError=function(e){return Promise.reject(new L(e))},e.prototype.rejectNoUserPool=function(){var e=this.noUserPoolErrorHandler(this._config);return Promise.reject(new B(e))},e.prototype.rememberDevice=function(){return V(this,void 0,void 0,(function(){var e,t;return H(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.currentUserPoolUser()];case 1:return e=n.sent(),[3,3];case 2:return t=n.sent(),W.debug("The user is not authenticated by the error",t),[2,Promise.reject("The user is not authenticated")];case 3:return e.getCachedDeviceKeyAndPassword(),[2,new Promise((function(t,n){e.setDeviceStatusRemembered({onSuccess:function(e){t(e)},onFailure:function(e){"InvalidParameterException"===e.code?n(new L(r.a.DeviceConfig)):"NetworkError"===e.code?n(new L(r.a.NetworkError)):n(e)}})}))]}}))}))},e.prototype.forgetDevice=function(){return V(this,void 0,void 0,(function(){var e,t;return H(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.currentUserPoolUser()];case 1:return e=n.sent(),[3,3];case 2:return t=n.sent(),W.debug("The user is not authenticated by the error",t),[2,Promise.reject("The user is not authenticated")];case 3:return e.getCachedDeviceKeyAndPassword(),[2,new Promise((function(t,n){e.forgetDevice({onSuccess:function(e){t(e)},onFailure:function(e){"InvalidParameterException"===e.code?n(new L(r.a.DeviceConfig)):"NetworkError"===e.code?n(new L(r.a.NetworkError)):n(e)}})}))]}}))}))},e.prototype.fetchDevices=function(){return V(this,void 0,void 0,(function(){var e,t;return H(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.currentUserPoolUser()];case 1:return e=n.sent(),[3,3];case 2:throw t=n.sent(),W.debug("The user is not authenticated by the error",t),new Error("The user is not authenticated");case 3:return e.getCachedDeviceKeyAndPassword(),[2,new Promise((function(t,n){var i={onSuccess:function(e){var n=e.Devices.map((function(e){var t=e.DeviceAttributes.find((function(e){return"device_name"===e.Name}))||{};return{id:e.DeviceKey,name:t.Value}}));t(n)},onFailure:function(e){"InvalidParameterException"===e.code?n(new L(r.a.DeviceConfig)):"NetworkError"===e.code?n(new L(r.a.NetworkError)):n(e)}};e.listDevices(60,null,i)}))]}}))}))},e}())(null);w.a.register($)},,,function(e,t,n){"use strict";n.r(t),n.d(t,"locateWindow",(function(){return i}));const r={};function i(){return"undefined"!=typeof window?window:"undefined"!=typeof self?self:r}},function(e,t,n){var r;e.exports=(r=n(12),function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,s=t.algo,a=[],u=[];!function(){function t(t){for(var n=e.sqrt(t),r=2;r<=n;r++)if(!(t%r))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var r=2,i=0;i<64;)t(r)&&(i<8&&(a[i]=n(e.pow(r,.5))),u[i]=n(e.pow(r,1/3)),i++),r++}();var c=[],l=s.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],l=n[5],f=n[6],d=n[7],h=0;h<64;h++){if(h<16)c[h]=0|e[t+h];else{var p=c[h-15],v=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,y=c[h-2],g=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;c[h]=v+c[h-7]+g+c[h-16]}var m=r&i^r&o^i&o,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),w=d+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&f)+u[h]+c[h];d=f,f=l,l=a,a=s+w|0,s=o,o=i,i=r,r=w+(b+m)|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+f|0,n[7]=n[7]+d|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),r.SHA256)},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(21),i=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},o=new r.a("Amplify"),s=new(function(){function e(){this._components=[],this._config={},this._modules={},this.Auth=null,this.Analytics=null,this.API=null,this.Credentials=null,this.Storage=null,this.I18n=null,this.Cache=null,this.PubSub=null,this.Interactions=null,this.Pushnotification=null,this.UI=null,this.XR=null,this.Predictions=null,this.DataStore=null,this.Geo=null,this.Logger=r.a,this.ServiceWorker=null}return e.prototype.register=function(e){o.debug("component registered in amplify",e),this._components.push(e),"function"==typeof e.getModuleName?(this._modules[e.getModuleName()]=e,this[e.getModuleName()]=e):o.debug("no getModuleName method for component",e),e.configure(this._config)},e.prototype.configure=function(e){var t=this;return e?(this._config=Object.assign(this._config,e),o.debug("amplify config",this._config),Object.entries(this._modules).forEach((function(e){var n=i(e,2),r=(n[0],n[1]);Object.keys(r).forEach((function(e){t._modules[e]&&(r[e]=t._modules[e])}))})),this._components.map((function(e){e.configure(t._config)})),this._config):this._config},e.prototype.addPluggable=function(e){e&&e.getCategory&&"function"==typeof e.getCategory&&this._components.map((function(t){t.addPluggable&&"function"==typeof t.addPluggable&&t.addPluggable(e)}))},e}())},function(e,t,n){var r,i,o;e.exports=(o=n(12),i=(r=o).lib.WordArray,r.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var i=[],o=0;o<n;o+=3)for(var s=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a<n;a++)i.push(r.charAt(s>>>6*(3-a)&63));var u=r.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var t=e.length,n=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var o=0;o<n.length;o++)r[n.charCodeAt(o)]=o}var s=n.charAt(64);if(s){var a=e.indexOf(s);-1!==a&&(t=a)}return function(e,t,n){for(var r=[],o=0,s=0;s<t;s++)if(s%4){var a=n[e.charCodeAt(s-1)]<<s%4*2,u=n[e.charCodeAt(s)]>>>6-s%4*2,c=a|u;r[o>>>2]|=c<<24-o%4*8,o++}return i.create(r,o)}(e,t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},o.enc.Base64)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(1).__exportStar(n(142),t)},function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return O}));var r,i,o=n(18),s=n(4),a=n(32),u=n(19),c=n(21),l=n(148),f=n(76),d=n(14),h=n(10),p=n(2),v=n(3),y=n(5),g=n(0),m=n(23),b=function(){return(b=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},w=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())}))},S=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},_=function(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(_(arguments[t]));return e},A=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 O=function(){function t(e,t,n,r,i,s){void 0===n&&(n={}),void 0===s&&(s={Auth:a.a,API:o.a,Cache:u.a}),this.schema=e,this.syncPredicates=t,this.amplifyConfig=n,this.authModeStrategy=r,this.errorHandler=i,this.amplifyContext=s,this.typeQuery=new WeakMap,this.buffer=[],this.runningProcesses=new l.a}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=_(Object(v.c)(e,t,n,c,l),3);return{authMode:s,opType:d[0],opName:d[1],query:d[2],isOwner:c,ownerField:l,ownerValue:f}},t.prototype.getAuthorizationInfo=function(e,t,n,r,o,a){void 0===r&&(r={}),void 0===o&&(o={});var u=Object(v.e)(e);if(a===s.c.AWS_IAM&&u.find((function(e){return"private"===e.authStrategy&&"iam"===e.provider}))&&t===i.unauth)return null;var c,l=u.filter((function(e){return"groups"===e.authStrategy&&["userPools","oidc"].includes(e.provider)}));return a!==s.c.AMAZON_COGNITO_USER_POOLS&&a!==s.c.OPENID_CONNECT||!l.find((function(e){var t=Object(v.k)(r,e),n=Object(v.k)(o,e);return E(t,n).find((function(t){return e.groups.find((function(e){return e===t}))}))}))?((a===s.c.AMAZON_COGNITO_USER_POOLS?u.filter((function(e){return"owner"===e.authStrategy&&"userPools"===e.provider})):[]).forEach((function(e){var t=r[e.identityClaim];t&&(c={authMode:s.c.AMAZON_COGNITO_USER_POOLS,isOwner:!e.areSubscriptionsPublic,ownerField:e.ownerField,ownerValue:t})})),c||((a===s.c.OPENID_CONNECT?u.filter((function(e){return"owner"===e.authStrategy&&"oidc"===e.provider})):[]).forEach((function(e){var t=o[e.identityClaim];t&&(c={authMode:s.c.OPENID_CONNECT,isOwner:!e.areSubscriptionsPublic,ownerField:e.ownerField,ownerValue:t})})),c||{authMode:a||n,isOwner:!1})):{authMode:a,isOwner:!1}},t.prototype.hubQueryCompletionListener=function(e,t){t.payload.event===d.CONTROL_MSG.SUBSCRIPTION_ACK&&e()},t.prototype.start=function(){var t=this;return[new h.a((function(n){var o,s,a=[],u={},c=i.none;return t.runningProcesses.add((function(){return w(t,void 0,void 0,(function(){var t,l,h,E,O,I,T,C,P,x,k=this;return S(this,(function(N){switch(N.label){case 0:return N.trys.push([0,2,,3]),[4,this.amplifyContext.Auth.currentCredentials()];case 1:return t=N.sent(),c=t.authenticated?i.auth:i.unauth,[3,3];case 2:return N.sent(),[3,3];case 3:return N.trys.push([3,5,,6]),[4,this.amplifyContext.Auth.currentSession()];case 4:return l=N.sent(),o=l.getIdToken().decodePayload(),[3,6];case 5:return N.sent(),[3,6];case 6:if(N.trys.push([6,11,,12]),h=this.amplifyConfig,E=h.aws_cognito_region,O=h.Auth,!E||O&&!O.region)throw"Auth is not configured";return I=void 0,[4,this.amplifyContext.Cache.getItem("federatedInfo")];case 7:return(T=N.sent())?(I=T.token,[3,10]):[3,8];case 8:return[4,this.amplifyContext.Auth.currentAuthenticatedUser()];case 9:(C=N.sent())&&(I=C.token),N.label=10;case 10:return I&&(P=I.split(".")[1],s=JSON.parse(e.from(P,"base64").toString("utf8"))),[3,12];case 11:return x=N.sent(),A.debug("error getting OIDC JWT",x),[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 k.runningProcesses.isOpen&&k.runningProcesses.add((function(){return w(k,void 0,void 0,(function(){var r,i,l,h,E,O,I,T,C=this;return S(this,(function(P){switch(P.label){case 0:return[4,Object(v.i)({authModeStrategy:this.authModeStrategy,defaultAuthMode:this.amplifyConfig.aws_appsync_authenticationType,modelName:t.name,schema:this.schema})];case 1:return r=P.sent(),i=r.READ,u=b(b({},u),((O={})[t.name]=((I={})[v.a.CREATE]=[],I[v.a.UPDATE]=[],I[v.a.DELETE]=[],I),O)),l=[v.a.CREATE,v.a.UPDATE,v.a.DELETE],(T={})[v.a.CREATE]=0,T[v.a.UPDATE]=0,T[v.a.DELETE]=0,h=T,E=function(r){return w(C,void 0,void 0,(function(){var l,O,I,T,C,P,x,k,N,j,M,R,D,U=this;return S(this,(function(F){switch(F.label){case 0:return l=this.buildSubscription(e,t,r,c,o,s,i[h[r]]),O=l.opType,I=l.opName,T=l.query,C=l.isOwner,P=l.ownerField,x=l.ownerValue,k=l.authMode,[4,Object(v.j)(k,this.amplifyConfig)];case 1:if(N=F.sent(),j={},C){if(!x)return n.error("Owner field required, sign in is needed in order to perform this operation"),[2];j[P]=x}return A.debug("Attempting "+r+" subscription with authMode: "+i[h[r]]),M=g.i,R=this.amplifyContext.API.graphql(b(b({query:T,variables:j},{authMode:k}),{authToken:N,userAgentSuffix:M})),u[t.name][O].push(R.map((function(e){return e.value})).subscribe({next:function(e){var n=e.data,r=e.errors;if(Array.isArray(r)&&r.length>0){var i=r.map((function(e){return e.message}));return A.warn("Skipping incoming subscription. Messages: "+i.join("\n")),void U.drainBuffer()}var o=y.a.getPredicates(U.syncPredicates.get(t),!1),s=n[I];U.passesPredicateValidation(s,o)&&U.pushToBuffer(O,t,s),U.drainBuffer()},error:function(e){return w(U,void 0,void 0,(function(){var o,s,a,c,l,f;return S(this,(function(v){switch(v.label){case 0:if(o=e.error,s=_((void 0===o?{errors:[]}:o).errors,1),a=s[0],c=(void 0===a?{}:a).message,(l=void 0===c?"":c).includes(d.CONTROL_MSG.REALTIME_SUBSCRIPTION_INIT_ERROR)||l.includes(d.CONTROL_MSG.CONNECTION_FAILED)){if(u[t.name][O].forEach((function(e){return e.unsubscribe()})),u[t.name][O]=[],h[r]++,!(h[r]>=i.length))return A.debug(r+" subscription failed with authMode: "+i[h[r]-1]+". Retrying with authMode: "+i[h[r]]),E(r),[2];A.debug(r+" subscription failed with authMode: "+i[h[r]-1])}A.warn("subscriptionError",l),v.label=1;case 1:return v.trys.push([1,3,,4]),[4,this.errorHandler({recoverySuggestion:"Ensure app code is up to date, auth directives exist and are correct on each model, and that server-side data has not been invalidated by a schema change. If the problem persists, search for or create an issue: https://github.com/aws-amplify/amplify-js/issues",localModel:null,message:l,model:t.name,operation:r,errorType:Object(m.b)(e),process:p.i.subscribe,remoteModel:null,cause:e})];case 2:return v.sent(),[3,4];case 3:return f=v.sent(),A.error("Subscription error handler failed with:",f),[3,4];case 4:return"function"==typeof D&&D(),l.includes('"errorType":"Unauthorized"')||l.includes('"errorType":"OperationDisabled"')?[2]:(n.error(l),[2])}}))}))}})),a.push(w(U,void 0,void 0,(function(){var e,t=this;return S(this,(function(n){switch(n.label){case 0:return[4,new Promise((function(n){D=n,e=t.hubQueryCompletionListener.bind(t,n),f.a.listen("api",e)}))];case 1:return n.sent(),f.a.remove("api",e),[2]}}))}))),[2]}}))}))},l.forEach((function(e){return E(e)})),[2]}}))}))}))}))})),this.runningProcesses.isOpen&&this.runningProcesses.add((function(){return Promise.all(a).then((function(){n.next(r.CONNECTED)}))})),[2]}}))}))}),"subscription processor new subscriber"),t.runningProcesses.addCleaner((function(){return w(t,void 0,void 0,(function(){return S(this,(function(e){return Object.keys(u).forEach((function(e){u[e][v.a.CREATE].forEach((function(e){return e.unsubscribe()})),u[e][v.a.UPDATE].forEach((function(e){return e.unsubscribe()})),u[e][v.a.DELETE].forEach((function(e){return e.unsubscribe()}))})),[2]}))}))}))})),new h.a((function(e){return t.dataObserver=e,t.drainBuffer(),t.runningProcesses.addCleaner((function(){return w(t,void 0,void 0,(function(){return S(this,(function(e){return this.dataObserver=null,[2]}))}))}))}))]},t.prototype.stop=function(){return w(this,void 0,void 0,(function(){return S(this,(function(e){switch(e.label){case 0:return[4,this.runningProcesses.close()];case 1:return e.sent(),[4,this.runningProcesses.open()];case 2:return e.sent(),[2]}}))}))},t.prototype.passesPredicateValidation=function(e,t){if(!t)return!0;var n=t.predicates,r=t.type;return Object(g.S)(e,r,n)},t.prototype.pushToBuffer=function(e,t,n){this.buffer.push([e,t,n])},t.prototype.drainBuffer=function(){var e=this;this.dataObserver&&(this.buffer.forEach((function(t){return e.dataObserver.next(t)})),this.buffer=[])},t}()}).call(this,n(6).Buffer)},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var i=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,i=n;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}},function(e,t,n){var r;e.exports=(r=n(12),function(){if("function"==typeof ArrayBuffer){var e=r.lib.WordArray,t=e.init;(e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var n=e.byteLength,r=[],i=0;i<n;i++)r[i>>>2]|=e[i]<<24-i%4*8;t.call(this,r,n)}else t.apply(this,arguments)}).prototype=e}}(),r.lib.WordArray)},function(e,t,n){"use strict";n.r(t),t.default=function(e,t){return t=t||{},new Promise((function(n,r){var i=new XMLHttpRequest,o=[],s=[],a={},u=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:u,headers:{keys:function(){return o},entries:function(){return s},get:function(e){return a[e.toLowerCase()]},has:function(e){return e.toLowerCase()in a}}}};for(var c in i.open(t.method||"get",e,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,n){o.push(t=t.toLowerCase()),s.push([t,n]),a[t]=a[t]?a[t]+","+n:n})),n(u())},i.onerror=r,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(c,t.headers[c]);i.send(t.body||null)}))}},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var u,c=[],l=!1,f=-1;function d(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&h())}function h(){if(!l){var e=a(d);l=!0;for(var t=c.length;t;){for(u=c,c=[];++f<t;)u&&u[f].run();f=-1,t=c.length}u=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new p(e,t)),1!==c.length||l||a(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r=function(){function e(){}return e.createPredicateBuilder=function(t){var n=t.name,r=new Set(Object.keys(t.fields)),i=new Proxy({},{get:function(t,i,o){var s=i;if(!r.has(s))throw new Error("Invalid field for model. field: "+s+", model: "+n);return function(t){return e.sortPredicateGroupsMap.get(o).push({field:s,sortDirection:t}),o}}});return e.sortPredicateGroupsMap.set(i,[]),i},e.isValidPredicate=function(t){return e.sortPredicateGroupsMap.has(t)},e.getPredicates=function(t,n){if(void 0===n&&(n=!0),n&&!e.isValidPredicate(t))throw new Error("The predicate is not valid");return e.sortPredicateGroupsMap.get(t)},e.createFromExisting=function(t,n){if(n&&t)return n(e.createPredicateBuilder(t))},e.sortPredicateGroupsMap=new WeakMap,e}()},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var i=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,i=n;return[i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],"-",i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]],i[e[r++]]].join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(102),i=n(51),o=n(64),s=n(35),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(103),i=n(51),o=n(35),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.MAX_HASHABLE_LENGTH=t.INIT=t.KEY=t.DIGEST_LENGTH=t.BLOCK_SIZE=void 0,t.BLOCK_SIZE=64,t.DIGEST_LENGTH=32,t.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),t.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1},function(e,t,n){(function(t){var r;e.exports=(r=r||function(e,r){var i;if("undefined"!=typeof window&&window.crypto&&(i=window.crypto),"undefined"!=typeof self&&self.crypto&&(i=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(i=globalThis.crypto),!i&&"undefined"!=typeof window&&window.msCrypto&&(i=window.msCrypto),!i&&void 0!==t&&t.crypto&&(i=t.crypto),!i)try{i=n(124)}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(28))},function(e,t,n){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},function(e,t,n){"use strict";var r=n(13);function i(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var o;if(n)o=n(t);else if(r.isURLSearchParams(t))o=t.toString();else{var s=[];r.forEach(t,(function(e,t){null!=e&&(r.isArray(e)?t+="[]":e=[e],r.forEach(e,(function(e){r.isDate(e)?e=e.toISOString():r.isObject(e)&&(e=JSON.stringify(e)),s.push(i(t)+"="+i(e))})))})),o=s.join("&")}if(o){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}},function(e,t,n){"use strict";e.exports=function(e,t,n,r,i){return e.config=t,n&&(e.code=n),e.request=r,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}},function(e,t,n){"use strict";var r=n(13),i=n(131),o=n(132),s=n(56),a=n(133),u=n(136),c=n(137),l=n(59),f=n(30),d=n(31);e.exports=function(e){return new Promise((function(t,n){var h,p=e.data,v=e.headers,y=e.responseType;function g(){e.cancelToken&&e.cancelToken.unsubscribe(h),e.signal&&e.signal.removeEventListener("abort",h)}r.isFormData(p)&&delete v["Content-Type"];var m=new XMLHttpRequest;if(e.auth){var b=e.auth.username||"",w=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";v.Authorization="Basic "+btoa(b+":"+w)}var S=a(e.baseURL,e.url);function _(){if(m){var r="getAllResponseHeaders"in m?u(m.getAllResponseHeaders()):null,o={data:y&&"text"!==y&&"json"!==y?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m};i((function(e){t(e),g()}),(function(e){n(e),g()}),o),m=null}}if(m.open(e.method.toUpperCase(),s(S,e.params,e.paramsSerializer),!0),m.timeout=e.timeout,"onloadend"in m?m.onloadend=_:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(_)},m.onabort=function(){m&&(n(l("Request aborted",e,"ECONNABORTED",m)),m=null)},m.onerror=function(){n(l("Network Error",e,null,m)),m=null},m.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",r=e.transitional||f.transitional;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(l(t,e,r.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",m)),m=null},r.isStandardBrowserEnv()){var E=(e.withCredentials||c(S))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;E&&(v[e.xsrfHeaderName]=E)}"setRequestHeader"in m&&r.forEach(v,(function(e,t){void 0===p&&"content-type"===t.toLowerCase()?delete v[t]:m.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(m.withCredentials=!!e.withCredentials),y&&"json"!==y&&(m.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&m.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&m.upload&&m.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(h=function(e){m&&(n(!e||e&&e.type?new d("canceled"):e),m.abort(),m=null)},e.cancelToken&&e.cancelToken.subscribe(h),e.signal&&(e.signal.aborted?h():e.signal.addEventListener("abort",h))),p||(p=null),m.send(p)}))}},function(e,t,n){"use strict";var r=n(57);e.exports=function(e,t,n,i,o){var s=new Error(e);return r(s,t,n,i,o)}},function(e,t,n){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,n){"use strict";var r=n(13);e.exports=function(e,t){t=t||{};var n={};function i(e,t){return r.isPlainObject(e)&&r.isPlainObject(t)?r.merge(e,t):r.isPlainObject(t)?r.merge({},t):r.isArray(t)?t.slice():t}function o(n){return r.isUndefined(t[n])?r.isUndefined(e[n])?void 0:i(void 0,e[n]):i(e[n],t[n])}function s(e){if(!r.isUndefined(t[e]))return i(void 0,t[e])}function a(n){return r.isUndefined(t[n])?r.isUndefined(e[n])?void 0:i(void 0,e[n]):i(void 0,t[n])}function u(n){return n in t?i(e[n],t[n]):n in e?i(void 0,e[n]):void 0}var c={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u};return r.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=c[e]||o,i=t(e);r.isUndefined(i)&&t!==u||(n[e]=i)})),n}},function(e,t){e.exports={version:"0.26.0"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BLOCK_SIZE=64,t.DIGEST_LENGTH=32,t.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),t.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1},function(e,t,n){"use strict";n.r(t),n.d(t,"fromUtf8",(function(){return r})),n.d(t,"toUtf8",(function(){return i}));const r=e=>"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):(e=>{const t=[];for(let n=0,r=e.length;n<r;n++){const r=e.charCodeAt(n);if(r<128)t.push(r);else if(r<2048)t.push(r>>6|192,63&r|128);else if(n+1<e.length&&55296==(64512&r)&&56320==(64512&e.charCodeAt(n+1))){const i=65536+((1023&r)<<10)+(1023&e.charCodeAt(++n));t.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}else t.push(r>>12|224,r>>6&63|128,63&r|128)}return Uint8Array.from(t)})(e),i=e=>"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):(e=>{let t="";for(let n=0,r=e.length;n<r;n++){const r=e[n];if(r<128)t+=String.fromCharCode(r);else if(192<=r&&r<224){const i=e[++n];t+=String.fromCharCode((31&r)<<6|63&i)}else if(240<=r&&r<365){const i="%"+[r,e[++n],e[++n],e[++n]].map(e=>e.toString(16)).join("%");t+=decodeURIComponent(i)}else t+=String.fromCharCode((15&r)<<12|(63&e[++n])<<6|63&e[++n])}return t})(e)},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r={},i=function(){function e(){}return e.setItem=function(e,t){return r[e]=t,r[e]},e.getItem=function(e){return Object.prototype.hasOwnProperty.call(r,e)?r[e]:void 0},e.removeItem=function(e){return delete r[e]},e.clear=function(){return r={}},e}(),o=function(){function e(){try{this.storageWindow=window.localStorage,this.storageWindow.setItem("aws.amplify.test-ls",1),this.storageWindow.removeItem("aws.amplify.test-ls")}catch(e){this.storageWindow=i}}return e.prototype.getStorage=function(){return this.storageWindow},e}()},function(e,t,n){"use strict";(function(e){var r;if(n.d(t,"a",(function(){return i})),"undefined"!=typeof window&&window.crypto&&(r=window.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==e&&e.crypto&&(r=e.crypto),!r)try{r=n(90)}catch(e){}function i(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")}}).call(this,n(28))},function(e,t,n){"use strict";var r,i,o=n(92);function s(e,t,n){if(e._observer)a(e._observer,t,n);else if(e._observers){var r=[];e._observers.forEach((function(e){r.push(e)})),r.forEach((function(e){a(e,t,n)}))}}function a(e,t,n){if(!e.closed)switch(t){case"next":return e.next(n);case"error":return e.error(n);case"complete":return e.complete(n)}}function u(e){return e._observer||e._observers&&e._observers.size>0}function c(e){var t=this;this._observer=null,this._observers=null,this._observable=new o((function(n){return function(e,t){!u(e)&&t&&t.start&&t.start()}(t,e),function(e,t){e._observers?e._observers.add(t):e._observer?(e._observers=new Set,e._observers.add(e._observer),e._observers.add(t),e._observer=null):e._observer=t}(t,n),function(){!function(e,t){e._observers?e._observers.delete(t):e._observer===t&&(e._observer=null)}(t,n),function(e,t){!u(e)&&t&&t.pause&&t.pause()}(t,e)}}))}r=c.prototype,i={get observable(){return this._observable},get observed(){return u(this)},next:function(e){s(this,"next",e)},error:function(e){s(this,"error",e)},complete:function(e){s(this,"complete",e)}},Object.keys(i).forEach((function(e){var t=Object.getOwnPropertyDescriptor(i,e);t.enumerable=!1,Object.defineProperty(r,e,t)})),e.exports=c},function(e,t,n){var r=n(99),i=n(100),o=i;o.v1=r,o.v4=i,e.exports=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebCryptoSha256=t.Ie11Sha256=void 0,(0,n(1).__exportStar)(n(101),t);var r=n(50);Object.defineProperty(t,"Ie11Sha256",{enumerable:!0,get:function(){return r.Sha256}});var i=n(52);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(54),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(54),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(144).Observable},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.7.14 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.7.14 react-native",r.isReactNative=!0;break;default:r.userAgent="aws-amplify/4.7.14 js",r.isReactNative=!1}var i=function(e){return""+r.userAgent+(e||"")}},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(21),i=function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},o=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},s=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(o(arguments[t]));return e},a=new r.a("Hub"),u="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default";var c=new(function(){function e(e){this.listeners=[],this.patterns=[],this.protectedChannels=["core","auth","api","analytics","interactions","pubsub","storage","ui","xr"],this.name=e}return e.prototype.remove=function(e,t){if(e instanceof RegExp){var n=this.patterns.find((function(t){return t.pattern.source===e.source}));if(!n)return void a.warn("No listeners for "+e);this.patterns=s(this.patterns.filter((function(e){return e!==n})))}else{var r=this.listeners[e];if(!r)return void a.warn("No listeners for "+e);this.listeners[e]=s(r.filter((function(e){return e.callback!==t})))}},e.prototype.dispatch=function(e,t,n,r){(void 0===n&&(n=""),this.protectedChannels.indexOf(e)>-1)&&(r===u||a.warn("WARNING: "+e+" is protected and dispatching on it can have unintended consequences"));var o={channel:e,payload:i({},t),source:n,patternInfo:[]};try{this._toListeners(o)}catch(e){a.error(e)}},e.prototype.listen=function(e,t,n){var r,i=this;if(void 0===n&&(n="noname"),function(e){return void 0!==e.onHubCapsule}(t))a.warn("WARNING onHubCapsule is Deprecated. Please pass in a callback."),r=t.onHubCapsule.bind(t);else{if("function"!=typeof t)throw new Error("No callback supplied to Hub");r=t}if(e instanceof RegExp)this.patterns.push({pattern:e,callback:r});else{var o=this.listeners[e];o||(o=[],this.listeners[e]=o),o.push({name:n,callback:r})}return function(){i.remove(e,r)}},e.prototype._toListeners=function(e){var t=e.channel,n=e.payload,r=this.listeners[t];if(r&&r.forEach((function(r){a.debug("Dispatching to "+t+" with ",n);try{r.callback(e)}catch(e){a.error(e)}})),this.patterns.length>0){if(!n.message)return void a.warn("Cannot perform pattern matching without a message key");var s=n.message;this.patterns.forEach((function(t){var n=s.match(t.pattern);if(n){var r=o(n).slice(1),u=i(i({},e),{patternInfo:r});try{t.callback(u)}catch(e){a.error(e)}}}))}},e}())("__default__")},,,,,,function(e,t,n){var r,i,o=n(41),s=n(42),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(41),i=n(42);e.exports=function(e,t,n){var o=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[o+a]=s[a];return t||i(s)}},function(e,t,n){"use strict";t.byteLength=function(e){var t=c(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=c(e),s=r[0],a=r[1],u=new o(function(e,t,n){return 3*(t+n)/4-n}(0,s,a)),l=0,f=a>0?s-4:s;for(n=0;n<f;n+=4)t=i[e.charCodeAt(n)]<<18|i[e.charCodeAt(n+1)]<<12|i[e.charCodeAt(n+2)]<<6|i[e.charCodeAt(n+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===a&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===a&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=0,a=n-i;s<a;s+=16383)o.push(l(e,s,s+16383>a?a:s+16383));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)r[a]=s[a],i[s.charCodeAt(a)]=a;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var i,o,s=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){
63
63
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
64
- 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(44).default||n(44))},function(e,t,n){e.exports=n(93).Observable},function(e,t,n){"use strict";(function(e){!function(e,t){function n(e){return"function"==typeof Symbol&&Boolean(Symbol[e])}function r(e){return n(e)?Symbol[e]:"@@"+e}function i(e){setTimeout((function(){throw e}))}function o(e,t){var n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function s(e){var t=e.constructor;return void 0!==t&&null===(t=t[r("species")])&&(t=void 0),void 0!==t?t:d}function a(e,t){Object.keys(t).forEach((function(n){var r=Object.getOwnPropertyDescriptor(t,n);r.enumerable=!1,Object.defineProperty(e,n,r)}))}function u(e){var t=e._cleanup;if(t){e._cleanup=void 0;try{t()}catch(e){i(e)}}}function c(e){return void 0===e._observer}function l(e,t){if(Object(e)!==e)throw new TypeError("Observer must be an object");this._cleanup=void 0,this._observer=e;try{var n=o(e,"start");n&&n.call(e,this)}catch(e){i(e)}if(!c(this)){e=new f(this);try{var r=t.call(void 0,e);if(null!=r){if("function"==typeof r.unsubscribe)s=r,r=function(){s.unsubscribe()};else if("function"!=typeof r)throw new TypeError(r+" is not a function");this._cleanup=r}}catch(t){return void e.error(t)}var s;c(this)&&u(this)}}function f(e){this._subscription=e}function d(e){if(!(this instanceof d))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}"function"!=typeof Symbol||Symbol.observable||(Symbol.observable=Symbol("observable")),a(l.prototype={},{get closed(){return c(this)},unsubscribe:function(){var e;c(e=this)||(e._observer=void 0,u(e))}}),a(f.prototype={},{get closed(){return c(this._subscription)},next:function(e){var t=this._subscription;if(!c(t)){var n=t._observer;try{var r=o(n,"next");r&&r.call(n,e)}catch(e){i(e)}}},error:function(e){var t=this._subscription;if(c(t))i(e);else{var n=t._observer;t._observer=void 0;try{var r=o(n,"error");if(!r)throw e;r.call(n,e)}catch(e){i(e)}u(t)}},complete:function(){var e=this._subscription;if(!c(e)){var t=e._observer;e._observer=void 0;try{var n=o(t,"complete");n&&n.call(t)}catch(e){i(e)}u(e)}}}),a(d.prototype,{subscribe:function(e){for(var t=[],n=1;n<arguments.length;++n)t.push(arguments[n]);return"function"==typeof e?e={next:e,error:t[0],complete:t[1]}:"object"==typeof e&&null!==e||(e={}),new l(e,this._subscriber)},forEach:function(e){var t=this;return new Promise((function(n,r){if("function"!=typeof e)return Promise.reject(new TypeError(e+" is not a function"));t.subscribe({_subscription:null,start:function(e){if(Object(e)!==e)throw new TypeError(e+" is not an object");this._subscription=e},next:function(t){var n=this._subscription;if(!n.closed)try{e(t)}catch(e){r(e),n.unsubscribe()}},error:r,complete:n})}))},map:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(s(this))((function(n){return t.subscribe({next:function(t){if(!n.closed){try{t=e(t)}catch(e){return n.error(e)}n.next(t)}},error:function(e){n.error(e)},complete:function(){n.complete()}})}))},filter:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(s(this))((function(n){return t.subscribe({next:function(t){if(!n.closed){try{if(!e(t))return}catch(e){return n.error(e)}n.next(t)}},error:function(e){n.error(e)},complete:function(){n.complete()}})}))},reduce:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=s(this),r=arguments.length>1,i=!1,o=arguments[1],a=o;return new n((function(n){return t.subscribe({next:function(t){if(!n.closed){var o=!i;if(i=!0,!o||r)try{a=e(a,t)}catch(e){return n.error(e)}else a=t}},error:function(e){n.error(e)},complete:function(){if(!i&&!r)return n.error(new TypeError("Cannot reduce an empty sequence"));n.next(a),n.complete()}})}))}}),Object.defineProperty(d.prototype,r("observable"),{value:function(){return this},writable:!0,configurable:!0}),a(d,{from:function(e){var t="function"==typeof this?this:d;if(null==e)throw new TypeError(e+" is not an object");var i=o(e,r("observable"));if(i){var s=i.call(e);if(Object(s)!==s)throw new TypeError(s+" is not an object");return s.constructor===t?s:new t((function(e){return s.subscribe(e)}))}if(n("iterator")&&(i=o(e,r("iterator"))))return new t((function(t){for(var n,r=i.call(e)[Symbol.iterator]();!(n=r.next()).done;){var o=n.value;if(t.next(o),t.closed)return}t.complete()}));if(Array.isArray(e))return new t((function(t){for(var n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}));throw new TypeError(e+" is not observable")},of:function(){for(var e=[],t=0;t<arguments.length;++t)e.push(arguments[t]);var n="function"==typeof this?this:d;return new n((function(t){for(var n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}))}}),Object.defineProperty(d,r("species"),{get:function(){return this},configurable:!0}),Object.defineProperty(d,"extensions",{value:{observableSymbol:r("observable"),setHostReportError:function(e){i=e}}}),e.Observable=d}(t)}).call(this,n(46)(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(46)(e),n(28))},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";t.decode=t.parse=n(97),t.encode=t.stringify=n(98)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,o){t=t||"&",n=n||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var l=0;l<c;++l){var f,d,h,p,v=e[l].replace(a,"%20"),y=v.indexOf(n);y>=0?(f=v.substr(0,y),d=v.substr(y+1)):(f=v,d=""),h=decodeURIComponent(f),p=decodeURIComponent(d),r(s,h)?i(s[h])?s[h].push(p):s[h]=[s[h],p]:s[h]=p}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,a){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),(function(s){var a=encodeURIComponent(r(s))+n;return i(e[s])?o(e[s],(function(e){return a+encodeURIComponent(r(e))})).join(t):a+encodeURIComponent(r(e[s]))})).join(t):a?encodeURIComponent(r(a))+n+encodeURIComponent(r(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var s=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}},function(e,t,n){var r,i,o=n(48),s=n(49),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(48),i=n(49);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(50),i=n(52),o=n(108),s=n(116),a=n(118),u=n(35),c=function(){function e(e){(0,s.supportsWebCrypto)((0,u.locateWindow)())?this.hash=new i.Sha256(e):(0,a.isMsWindow)((0,u.locateWindow)())?this.hash=new r.Sha256(e):this.hash=new o.Sha256(e)}return e.prototype.update=function(e,t){this.hash.update(e,t)},e.prototype.digest=function(){return this.hash.digest()},e}();t.Sha256=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyData=void 0,t.isEmptyData=function(e){return"string"==typeof e?0===e.length:0===e.byteLength}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=t.numToUint8=t.isEmptyData=t.convertToBuffer=void 0;var r=n(104);Object.defineProperty(t,"convertToBuffer",{enumerable:!0,get:function(){return r.convertToBuffer}});var i=n(105);Object.defineProperty(t,"isEmptyData",{enumerable:!0,get:function(){return i.isEmptyData}});var o=n(106);Object.defineProperty(t,"numToUint8",{enumerable:!0,get:function(){return o.numToUint8}});var s=n(107);Object.defineProperty(t,"uint32ArrayFrom",{enumerable:!0,get:function(){return s.uint32ArrayFrom}})},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.convertToBuffer=void 0;var r=n(64),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(1).__exportStar)(n(109),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(1),i=n(53),o=n(110),s=n(111),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(53),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}),t.uint32ArrayFrom=t.numToUint8=t.isEmptyData=t.convertToBuffer=void 0;var r=n(112);Object.defineProperty(t,"convertToBuffer",{enumerable:!0,get:function(){return r.convertToBuffer}});var i=n(113);Object.defineProperty(t,"isEmptyData",{enumerable:!0,get:function(){return i.isEmptyData}});var o=n(114);Object.defineProperty(t,"numToUint8",{enumerable:!0,get:function(){return o.numToUint8}});var s=n(115);Object.defineProperty(t,"uint32ArrayFrom",{enumerable:!0,get:function(){return s.uint32ArrayFrom}})},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.convertToBuffer=void 0;var r=n(147),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}),n(1).__exportStar(n(117),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(1),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(1);r.__exportStar(n(119),t),r.__exportStar(n(120),t),r.__exportStar(n(121),t),r.__exportStar(n(122),t),r.__exportStar(n(123),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(55),o=n(126),s=n(61);var a=function e(t){var n=new o(t),a=i(o.prototype.request,n);return r.extend(a,o.prototype,n),r.extend(a,n),a.create=function(n){return e(s(t,n))},a}(n(30));a.Axios=o,a.Cancel=n(31),a.CancelToken=n(139),a.isCancel=n(60),a.VERSION=n(62).version,a.all=function(e){return Promise.all(e)},a.spread=n(140),a.isAxiosError=n(141),e.exports=a,e.exports.default=a},function(e,t,n){"use strict";var r=n(13),i=n(56),o=n(127),s=n(128),a=n(61),u=n(138),c=u.validators;function l(e){this.defaults=e,this.interceptors={request:new o,response:new o}}l.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=a(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var n=t.transitional;void 0!==n&&u.assertOptions(n,{silentJSONParsing:c.transitional(c.boolean),forcedJSONParsing:c.transitional(c.boolean),clarifyTimeoutError:c.transitional(c.boolean)},!1);var r=[],i=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(i=i&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));var o,l=[];if(this.interceptors.response.forEach((function(e){l.push(e.fulfilled,e.rejected)})),!i){var f=[s,void 0];for(Array.prototype.unshift.apply(f,r),f=f.concat(l),o=Promise.resolve(t);f.length;)o=o.then(f.shift(),f.shift());return o}for(var d=t;r.length;){var h=r.shift(),p=r.shift();try{d=h(d)}catch(e){p(e);break}}try{o=s(d)}catch(e){return Promise.reject(e)}for(;l.length;)o=o.then(l.shift(),l.shift());return o},l.prototype.getUri=function(e){return e=a(this.defaults,e),i(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],(function(e){l.prototype[e]=function(t,n){return this.request(a(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(e){l.prototype[e]=function(t,n,r){return this.request(a(r||{},{method:e,url:t,data:n}))}})),e.exports=l},function(e,t,n){"use strict";var r=n(13);function i(){this.handlers=[]}i.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){r.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=i},function(e,t,n){"use strict";var r=n(13),i=n(129),o=n(60),s=n(30),a=n(31);function u(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new a("canceled")}e.exports=function(e){return u(e),e.headers=e.headers||{},e.data=i.call(e,e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||s.adapter)(e).then((function(t){return u(e),t.data=i.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(u(e),t&&t.response&&(t.response.data=i.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,n){"use strict";var r=n(13),i=n(30);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(59);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(134),i=n(135);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(62).version,i={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){i[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var o={};i.transitional=function(e,t,n){function i(e,t){return"[Axios v"+r+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,r,s){if(!1===e)throw new Error(i(r," has been removed"+(t?" in "+t:"")));return t&&!o[r]&&(o[r]=!0,console.warn(i(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,s)}},e.exports={assertOptions:function(e,t,n){if("object"!=typeof e)throw new TypeError("options must be an object");for(var r=Object.keys(e),i=r.length;i-- >0;){var o=r[i],s=t[o];if(s){var a=e[o],u=void 0===a||s(a,o,e);if(!0!==u)throw new TypeError("option "+o+" must be "+u)}else if(!0!==n)throw Error("Unknown option "+o)}},validators:i}},function(e,t,n){"use strict";var r=n(31);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;this.promise.then((function(e){if(n._listeners){var t,r=n._listeners.length;for(t=0;t<r;t++)n._listeners[t](e);n._listeners=null}})),this.promise.then=function(e){var t,r=new Promise((function(e){n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},i.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},i.source=function(){var e;return{token:new i((function(t){e=t})),cancel:e}},e.exports=i},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,n){"use strict";var r=n(13);e.exports=function(e){return r.isObject(e)&&!0===e.isAxiosError}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),i=n(63),o=n(143),s=n(146),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(63),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 yn})),n.d(t,"DataStoreClass",(function(){return vn})),n.d(t,"initSchema",(function(){return Jt})),n.d(t,"Predicates",(function(){return O.b})),n.d(t,"ModelPredicateCreator",(function(){return O.a})),n.d(t,"ModelSortPredicateCreator",(function(){return I.a})),n.d(t,"utils",(function(){return gn})),n.d(t,"isSchemaModel",(function(){return y.x})),n.d(t,"isSchemaModelWithAttributes",(function(){return y.y})),n.d(t,"isAssociatedWith",(function(){return y.l})),n.d(t,"isTargetNameAssociation",(function(){return y.z})),n.d(t,"isModelAttributeAuth",(function(){return y.p})),n.d(t,"isModelAttributeKey",(function(){return y.r})),n.d(t,"isModelAttributePrimaryKey",(function(){return y.s})),n.d(t,"isModelAttributeCompositeKey",(function(){return y.q})),n.d(t,"ModelAttributeAuthAllow",(function(){return y.e})),n.d(t,"ModelAttributeAuthProvider",(function(){return y.f})),n.d(t,"GraphQLScalarType",(function(){return y.c})),n.d(t,"isGraphQLScalarType",(function(){return y.n})),n.d(t,"isModelFieldType",(function(){return y.t})),n.d(t,"isNonModelFieldType",(function(){return y.u})),n.d(t,"isEnumFieldType",(function(){return y.m})),n.d(t,"isIdentifierObject",(function(){return y.o})),n.d(t,"OpType",(function(){return y.h})),n.d(t,"isPredicateObj",(function(){return y.w})),n.d(t,"isPredicateGroup",(function(){return y.v})),n.d(t,"QueryOne",(function(){return y.j})),n.d(t,"SortDirection",(function(){return y.k})),n.d(t,"AuthModeStrategyType",(function(){return y.a})),n.d(t,"ModelOperation",(function(){return y.g})),n.d(t,"syncExpression",(function(){return y.A})),n.d(t,"ProcessName",(function(){return y.i})),n.d(t,"DISCARD",(function(){return y.b})),n.d(t,"LimitTimerRaceResolvedValues",(function(){return y.d}));var r=n(18),i=n(32),o=n(19),s=n(21),a=n(16),u=n(148),c=n(76),l=n(37),f=n(15),d=n(24),h=n(10),p=n(17),v=n(4),y=n(2),g=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())}))},m=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])}}},b=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},w=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(b(arguments[t]));return e};function S(e){return"private"!==e.allow||e.provider?"public"!==e.allow||e.provider?e.provider:y.f.API_KEY:y.f.USER_POOLS}function _(e){var t=e.rules,n=e.currentUser,r=new Set;return t.forEach((function(e){switch(e.allow){case y.e.CUSTOM:e.provider&&e.provider!==y.f.FUNCTION||r.add(v.c.AWS_LAMBDA);break;case y.e.GROUPS:case y.e.OWNER:n&&(e.provider===y.f.USER_POOLS?r.add(v.c.AMAZON_COGNITO_USER_POOLS):e.provider===y.f.OIDC&&r.add(v.c.OPENID_CONNECT));break;case y.e.PRIVATE:n&&(e.provider&&e.provider!==y.f.USER_POOLS?e.provider===y.f.IAM&&r.add(v.c.AWS_IAM):r.add(v.c.AMAZON_COGNITO_USER_POOLS));break;case y.e.PUBLIC:e.provider===y.f.IAM?r.add(v.c.AWS_IAM):e.provider&&e.provider!==y.f.API_KEY||r.add(v.c.API_KEY)}})),Array.from(r)}var E=function(e){return function(t){var n=t.schema,r=t.modelName;return g(void 0,void 0,void 0,(function(){var t,i,o,s,a;return m(this,(function(u){switch(u.label){case 0:e.Auth=e.Auth||p.a,u.label=1;case 1:return u.trys.push([1,3,,4]),[4,e.Auth.currentAuthenticatedUser()];case 2:return t=u.sent(),[3,4];case 3:return u.sent(),[3,4];case 4:return(i=n.namespaces.user.models[r].attributes)&&(o=i.find((function(e){return"auth"===e.type})),null===(a=null==o?void 0:o.properties)||void 0===a?void 0:a.rules)?(c=o.properties.rules,l=[y.e.CUSTOM,y.e.OWNER,y.e.GROUPS,y.e.PRIVATE,y.e.PUBLIC],f=[y.f.FUNCTION,y.f.USER_POOLS,y.f.OIDC,y.f.IAM,y.f.API_KEY],s=w(c).sort((function(e,t){return e.allow===t.allow?f.indexOf(S(e))-f.indexOf(S(t)):l.indexOf(e.allow)-l.indexOf(t.allow)})),[2,_({currentUser:t,rules:s})]):[2,[]]}var c,l,f}))}))}},A=function(){return[]},O=n(5),I=n(47),T=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}(),C=n(67),P=n.n(C),x=n(0),k=n(3);let N,j;const M=new WeakMap,R=new WeakMap,D=new WeakMap,U=new WeakMap,F=new WeakMap;let L={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return R.get(e);if("objectStoreNames"===t)return e.objectStoreNames||D.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return z(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function B(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(j||(j=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(K(this),t),z(M.get(this))}:function(...t){return z(e.apply(K(this),t))}:function(t,...n){const r=e.call(K(this),t,...n);return D.set(r,t.sort?t.sort():[t]),z(r)}}function q(e){return"function"==typeof e?B(e):(e instanceof IDBTransaction&&function(e){if(R.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)});R.set(e,t)}(e),t=e,(N||(N=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,L):e);var t}function z(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(z(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",o)});return t.then(t=>{t instanceof IDBCursor&&M.set(t,e)}).catch(()=>{}),F.set(t,e),t}(e);if(U.has(e))return U.get(e);const t=q(e);return t!==e&&(U.set(e,t),F.set(t,e)),t}const K=e=>F.get(e);function V(e,t,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){const s=indexedDB.open(e,t),a=z(s);return r&&s.addEventListener("upgradeneeded",e=>{r(z(s.result),e.oldVersion,e.newVersion,z(s.transaction))}),n&&s.addEventListener("blocked",()=>n()),a.then(e=>{o&&e.addEventListener("close",()=>o()),i&&e.addEventListener("versionchange",()=>i())}).catch(()=>{}),a}function H(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",()=>t()),z(n).then(()=>{})}const G=["get","getKey","getAll","getAllKeys","count"],W=["put","add","delete","clear"],Y=new Map;function J(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(Y.get(t))return Y.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=W.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!G.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 Y.set(t,o),o}function $(e){return($="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}L=(e=>({...e,get:(t,n,r)=>J(t,n)||e.get(t,n,r),has:(t,n)=>!!J(t,n)||e.has(t,n)}))(L);var Q=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Z=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},X=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 te?te(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)}))}}},ee=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},te=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ne=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(ee(arguments[t]));return e},re=new s.a("DataStore"),ie=new(function(){function e(){var e=this;this.dbName="amplify-datastore",this.safariCompatabilityMode=!1,this.canonicalKeyPath=function(t){return e.safariCompatabilityMode?t.length>1?t:t[0]:t}}return e.prototype.getStorenameForModel=function(e){var t=this.namespaceResolver(e),n=e.name;return Object(x.u)(t,n)},e.prototype.getIndexKeyValuesFromModel=function(e){var t=Object.getPrototypeOf(e).constructor,n=this.namespaceResolver(t),r=Object(x.s)(this.schema.namespaces[n],t.name);return Object(x.n)(e,r)},e.prototype.checkPrivate=function(){return Q(this,void 0,void 0,(function(){return Z(this,(function(e){switch(e.label){case 0:return[4,Object(x.K)().then((function(e){return e}))];case 1:return e.sent()?(re.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.setSafariCompatabilityMode=function(){return Q(this,void 0,void 0,(function(){var e;return Z(this,(function(t){switch(t.label){case 0:return e=this,[4,Object(x.L)()];case 1:return e.safariCompatabilityMode=t.sent(),!0===this.safariCompatabilityMode&&re.debug("IndexedDB Adapter is running in Safari Compatability Mode"),[2]}}))}))},e.prototype.getNamespaceAndModelFromStorename=function(e){var t=ee(e.split("_"));return{namespaceName:t[0],modelName:t.slice(1).join("_")}},e.prototype.setUp=function(e,t,n,r,i){return Q(this,void 0,void 0,(function(){var o,s,a=this;return Z(this,(function(u){switch(u.label){case 0:return[4,this.checkPrivate()];case 1:return u.sent(),[4,this.setSafariCompatabilityMode()];case 2:return u.sent(),this.initPromise?[3,3]:(this.initPromise=new Promise((function(e,t){a.resolve=e,a.reject=t})),[3,5]);case 3:return[4,this.initPromise];case 4:u.sent(),u.label=5;case 5:i&&(this.dbName="amplify-datastore-"+i),this.schema=e,this.namespaceResolver=t,this.modelInstanceCreator=n,this.getModelConstructorByModelName=r,u.label=6;case 6:return u.trys.push([6,9,,10]),this.db?[3,8]:(3,o=this,[4,V(this.dbName,3,{upgrade:function(t,n,r,i){return Q(a,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h,p,v,y,g,m,b,w=this;return Z(this,(function(S){switch(S.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=Object(x.u)(n,e);w.createObjectStoreForModel(t,n,r,e)}))})),[2];if(1!==n&&2!==n||3!==r)return[3,16];S.label=1;case 1:S.trys.push([1,14,,15]),S.label=2;case 2:S.trys.push([2,11,12,13]),o=te(i.objectStoreNames),s=o.next(),S.label=3;case 3:return s.done?[3,10]:(a=s.value,u=i.objectStore(a),c="tmp_"+a,u.name=c,l=this.getNamespaceAndModelFromStorename(a),f=l.namespaceName,d=l.modelName,h=this.createObjectStoreForModel(t,f,a,d),[4,u.openCursor()]);case 4:p=S.sent(),v=0,S.label=5;case 5:return p&&p.value?[4,h.put(p.value)]:[3,8];case 6:return S.sent(),[4,p.continue()];case 7:return p=S.sent(),v++,[3,5];case 8:t.deleteObjectStore(c),re.debug(v+" "+a+" records migrated"),S.label=9;case 9:return s=o.next(),[3,3];case 10:return[3,13];case 11:return y=S.sent(),m={error:y},[3,13];case 12:try{s&&!s.done&&(b=o.return)&&b.call(o)}finally{if(m)throw m.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,Object(x.u)(n,e)]})).filter((function(e){var t=ee(e,2)[1];return!o.has(t)})).forEach((function(e){var r=ee(e,2),i=r[0],o=r[1];w.createObjectStoreForModel(t,n,o,i)}))})),[3,15];case 14:throw g=S.sent(),re.error("Error migrating IndexedDB data",g),i.abort(),g;case 15:case 16:return[2]}}))}))}})]);case 7:o.db=u.sent(),this.resolve(),u.label=8;case 8:return[3,10];case 9:return s=u.sent(),this.reject(s),[3,10];case 10:return[2]}}))}))},e.prototype._get=function(e,t){return Q(this,void 0,void 0,(function(){var n,r;return Z(this,(function(i){switch(i.label){case 0:return"string"==typeof e?(r=e,n=this.db.transaction(r,"readonly").store.index("byPk")):n=e.index("byPk"),[4,n.get(this.canonicalKeyPath(t))];case 1:return[2,i.sent()]}}))}))},e.prototype.save=function(e,t){var n,r;return Q(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p,v,g,m,b,w,S,_,E,A,I,T,C,P,k,N,j,M,R,D=this;return Z(this,(function(U){switch(U.label){case 0:return[4,this.checkPrivate()];case 1:return U.sent(),i=Object.getPrototypeOf(e).constructor,o=this.getStorenameForModel(i),s=this.namespaceResolver(i),a=Object(x.R)(i.name,e,this.schema.namespaces[s],this.modelInstanceCreator,this.getModelConstructorByModelName),u=new Set,c=Object.values(a).map((function(e){var t=e.modelName,n=e.item,r=e.instance,i=Object(x.u)(s,t);return u.add(i),{storeName:i,item:n,instance:r,keys:Object(x.s)(D.schema.namespaces[s],t)}})),l=this.db.transaction(ne([o],Array.from(u.values())),"readwrite"),f=l.objectStore(o),d=this.getIndexKeyValuesFromModel(e),[4,this._get(f,d)];case 2:if(h=U.sent(),t&&h&&(p=O.a.getPredicates(t),v=p.predicates,g=p.type,!Object(x.S)(h,g,v)))throw m="Conditional update failed",re.error(m,{model:h,condition:v}),new Error(m);b=[],U.label=3;case 3:U.trys.push([3,11,12,17]),w=X(c),U.label=4;case 4:return[4,w.next()];case 5:return(S=U.sent()).done?[3,10]:(_=S.value,E=_.storeName,A=_.item,I=_.instance,T=_.keys,C=l.objectStore(E),P=T.map((function(e){return A[e]})),[4,this._get(C,P)]);case 6:return k=U.sent(),N=void 0===k?y.h.INSERT:y.h.UPDATE,j=this.getIndexKeyValuesFromModel(e),Object(x.M)(P,j)||N===y.h.INSERT?[4,C.index("byPk").getKey(this.canonicalKeyPath(P))]:[3,9];case 7:return M=U.sent(),[4,C.put(A,M)];case 8:U.sent(),b.push([I,N]),U.label=9;case 9:return[3,4];case 10:return[3,17];case 11:return R=U.sent(),n={error:R},[3,17];case 12:return U.trys.push([12,,15,16]),S&&!S.done&&(r=w.return)?[4,r.call(w)]:[3,14];case 13:U.sent(),U.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 U.sent(),[2,b]}}))}))},e.prototype.load=function(e,t,n){var r,i,o,s,a,u,c,l,f,d;return Q(this,void 0,void 0,(function(){var h,p,v,y,g,m,b,w,S,_,E,A,O,I,T,C,P,k,N,j,M,R,D,U=this;return Z(this,(function(F){switch(F.label){case 0:if(h=this.schema.namespaces[e],p=h.relationships[t].relationTypes,v=p.map((function(t){var n=t.modelName;return Object(x.u)(e,n)})),y=this.getModelConstructorByModelName(e,t),0===v.length)return[2,n.map((function(e){return U.modelInstanceCreator(y,e)}))];g=this.db.transaction(ne(v),"readonly"),F.label=1;case 1:F.trys.push([1,38,39,44]),m=X(p),F.label=2;case 2:return[4,m.next()];case 3:if((b=F.sent()).done)return[3,37];switch(w=b.value,S=w.fieldName,_=w.modelName,E=w.targetName,A=w.targetNames,O=Object(x.u)(e,_),I=g.objectStore(O),T=this.getModelConstructorByModelName(e,_),w.relationType){case"HAS_ONE":return[3,4];case"BELONGS_TO":return[3,19];case"HAS_MANY":return[3,34]}return[3,35];case 4:F.trys.push([4,12,13,18]),r=X(n),F.label=5;case 5:return[4,r.next()];case 6:return(i=F.sent()).done?[3,11]:(k=i.value,(null==A?void 0:A.length)?([],void 0,A.every((function(e){return null!=k[e]}))?(N=A.map((function(e){return k[e]})),[4,this._get(I,N)]):[3,11]):[3,8]);case 7:return M=F.sent(),k[S]=M&&this.modelInstanceCreator(T,M),[3,10];case 8:return C=k[E]?E:S,k[C]?(j=[k[C]],[4,this._get(I,j)]):[3,11];case 9:M=F.sent(),k[S]=M&&this.modelInstanceCreator(T,M),F.label=10;case 10:return[3,5];case 11:return[3,18];case 12:return P=F.sent(),c={error:P},[3,18];case 13:return F.trys.push([13,,16,17]),i&&!i.done&&(l=r.return)?[4,l.call(r)]:[3,15];case 14:F.sent(),F.label=15;case 15:return[3,17];case 16:if(c)throw c.error;return[7];case 17:return[7];case 18:return[3,36];case 19:F.trys.push([19,27,28,33]),o=X(n),F.label=20;case 20:return[4,o.next()];case 21:return(s=F.sent()).done?[3,26]:(k=s.value,(null==A?void 0:A.length)?(void 0,A.every((function(e){return null!=k[e]}))?(N=A.filter((function(e){var t;return null!==(t=k[e])&&void 0!==t&&t})).map((function(e){return k[e]})),[4,this._get(I,N)]):[3,26]):[3,23]);case 22:return M=F.sent(),k[S]=M&&this.modelInstanceCreator(T,M),null==A||A.map((function(e){delete k[e]})),[3,25];case 23:return k[E]?(j=[k[E]],[4,this._get(I,j)]):[3,25];case 24:M=F.sent(),k[S]=M&&this.modelInstanceCreator(T,M),delete k[E],F.label=25;case 25:return[3,20];case 26:return[3,33];case 27:return R=F.sent(),f={error:R},[3,33];case 28:return F.trys.push([28,,31,32]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,30];case 29:F.sent(),F.label=30;case 30:return[3,32];case 31:if(f)throw f.error;return[7];case 32:return[7];case 33:case 34:return[3,36];case 35:return Object(x.l)(w.relationType),[3,36];case 36:return[3,2];case 37:return[3,44];case 38:return D=F.sent(),a={error:D},[3,44];case 39:return F.trys.push([39,,42,43]),b&&!b.done&&(u=m.return)?[4,u.call(m)]:[3,41];case 40:F.sent(),F.label=41;case 41:return[3,43];case 42:if(a)throw a.error;return[7];case 43:return[7];case 44:return[2,n.map((function(e){return U.modelInstanceCreator(y,e)}))]}}))}))},e.prototype.query=function(e,t,n){return Q(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,f=this;return Z(this,(function(d){switch(d.label){case 0:return[4,this.checkPrivate()];case 1:return d.sent(),r=this.getStorenameForModel(e),i=this.namespaceResolver(e),o=t&&O.a.getPredicates(t),s=Object(x.s)(this.schema.namespaces[i],e.name),a=o&&this.keyValueFromPredicate(o,s),u=n&&n.sort,c=n&&n.limit,[4,Q(f,void 0,void 0,(function(){var e,t,i;return Z(this,(function(s){switch(s.label){case 0:return a?[4,this.getByKey(r,a)]:[3,2];case 1:return[2,(e=s.sent())?[e]:[]];case 2:return o?[4,this.filterOnPredicate(r,o)]:[3,4];case 3:return t=s.sent(),[2,this.inMemoryPagination(t,n)];case 4:return u?[4,this.getAll(r)]:[3,6];case 5:return i=s.sent(),[2,this.inMemoryPagination(i,n)];case 6:return c?[2,this.enginePagination(r,n)]:[2,this.getAll(r)]}}))}))];case 2:return l=d.sent(),[4,this.load(i,e.name,l)];case 3:return[2,d.sent()]}}))}))},e.prototype.getByKey=function(e,t){return Q(this,void 0,void 0,(function(){return Z(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 Q(this,void 0,void 0,(function(){return Z(this,(function(t){switch(t.label){case 0:return[4,this.db.getAll(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.keyValueFromPredicate=function(e,t){var n,r,i=e.predicates;if(i.length===t.length){var o=[],s=function(e){var t=i.find((function(t){return Object(y.w)(t)&&t.field===e&&"eq"===t.operator}));t&&o.push(t.operand)};try{for(var a=te(t),u=a.next();!u.done;u=a.next()){s(u.value)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o.length===t.length?o:void 0}},e.prototype.filterOnPredicate=function(e,t){return Q(this,void 0,void 0,(function(){var n,r,i;return Z(this,(function(o){switch(o.label){case 0:return n=t.predicates,r=t.type,[4,this.getAll(e)];case 1:return i=o.sent(),[2,n?i.filter((function(e){return Object(x.S)(e,r,n)})):i]}}))}))},e.prototype.inMemoryPagination=function(e,t){if(t&&e.length>1){if(t.sort){var n=I.a.getPredicates(t.sort);if(n.length){var r=Object(x.Q)(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 Q(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l;return Z(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=y.j.FIRST),Q(this,void 0,void 0,(function(){var n,r,i;return Z(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===y.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 Q(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y,g,m;return Z(this,(function(b){switch(b.label){case 0:return[4,this.checkPrivate()];case 1:return b.sent(),n=[],Object(x.H)(e)?(s=e,r=this.namespaceResolver(s),u=this.getStorenameForModel(s),[4,this.query(s,t)]):[3,9];case 2:return i=b.sent(),g=this.schema.namespaces[r].relationships[s.name].relationTypes,void 0===t?[3,5]:[4,this.deleteTraverse(g,i,s.name,r,n)];case 3:return b.sent(),[4,this.deleteItem(n)];case 4:return b.sent(),m=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[i,m]];case 5:return[4,this.deleteTraverse(g,i,s.name,r,n)];case 6:return b.sent(),[4,this.db.transaction([u],"readwrite").objectStore(u).clear()];case 7:return b.sent(),m=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[i,m]];case 8:return[3,17];case 9:return o=e,s=Object.getPrototypeOf(o).constructor,a=this.namespaceResolver(s),u=this.getStorenameForModel(s),t?(c=this.db.transaction([u],"readwrite"),l=c.objectStore(u),f=this.getIndexKeyValuesFromModel(o),[4,this._get(l,f)]):[3,13];case 10:if(void 0===(d=b.sent()))return y="Model instance not found in storage",re.warn(y,{model:o}),[2,[[o],[]]];if(h=O.a.getPredicates(t),p=h.predicates,v=h.type,!Object(x.S)(d,v,p))throw y="Conditional update failed",re.error(y,{model:d,condition:p}),new Error(y);return[4,c.done];case 11:return b.sent(),g=this.schema.namespaces[a].relationships[s.name].relationTypes,[4,this.deleteTraverse(g,[o],s.name,a,n)];case 12:return b.sent(),[3,15];case 13:return g=this.schema.namespaces[a].relationships[s.name].relationTypes,[4,this.deleteTraverse(g,[o],s.name,a,n)];case 14:b.sent(),b.label=15;case 15:return[4,this.deleteItem(n)];case 16:return b.sent(),m=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[[o],m]];case 17:return[2]}}))}))},e.prototype.deleteItem=function(e){var t,n,r,i,o,s;return Q(this,void 0,void 0,(function(){var a,u,c,l,f,d,h,p,v,y,g,m,b,w;return Z(this,(function(S){switch(S.label){case 0:a=e.map((function(e){return e.storeName})),u=this.db.transaction(ne(a),"readwrite"),S.label=1;case 1:S.trys.push([1,22,23,28]),t=X(e),S.label=2;case 2:return[4,t.next()];case 3:if((n=S.sent()).done)return[3,21];c=n.value,l=c.storeName,f=c.items,d=u.objectStore(l),S.label=4;case 4:S.trys.push([4,14,15,20]),h=X(f),S.label=5;case 5:return[4,h.next()];case 6:return(p=S.sent()).done?[3,13]:(v=p.value)?(y=void 0,"object"!==$(v)?[3,8]:(g=this.getIndexKeyValuesFromModel(v),[4,d.index("byPk").getKey(this.canonicalKeyPath(g))])):[3,12];case 7:return y=S.sent(),[3,10];case 8:return m=v.toString(),[4,d.index("byPk").getKey(m)];case 9:y=S.sent(),S.label=10;case 10:return void 0===y?[3,12]:[4,d.delete(y)];case 11:S.sent(),S.label=12;case 12:return[3,5];case 13:return[3,20];case 14:return b=S.sent(),o={error:b},[3,20];case 15:return S.trys.push([15,,18,19]),p&&!p.done&&(s=h.return)?[4,s.call(h)]:[3,17];case 16:S.sent(),S.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 w=S.sent(),r={error:w},[3,28];case 23:return S.trys.push([23,,26,27]),n&&!n.done&&(i=t.return)?[4,i.call(t)]:[3,25];case 24:S.sent(),S.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 Q(this,void 0,void 0,(function(){var g,m,b,w,S,_,E,A,O,I,T,C,P,k,N,j,M,R,D=this;return Z(this,(function(U){switch(U.label){case 0:U.trys.push([0,38,39,44]),o=X(e),U.label=1;case 1:return[4,o.next()];case 2:if((s=U.sent()).done)return[3,37];switch(g=s.value,m=g.relationType,b=g.modelName,w=g.targetName,S=g.targetNames,_=g.associatedWith,E=Object(x.u)(r,b),m){case"HAS_ONE":return[3,3];case"HAS_MANY":return[3,20];case"BELONGS_TO":return[3,34]}return[3,35];case 3:U.trys.push([3,13,14,19]),a=X(t),U.label=4;case 4:return[4,a.next()];case 5:return(u=U.sent()).done?[3,12]:(P=u.value,A="byPk",(null==S?void 0:S.length)?0===(O=S.filter((function(e){var t;return null!==(t=P[e])&&void 0!==t&&t})).map((function(e){return P[e]}))).length?[3,12]:[4,this.db.transaction(E,"readwrite").objectStore(E).index(A).get(this.canonicalKeyPath(O))]:[3,8]);case 6:return T=U.sent(),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,T?[T]:[],b,r,i)];case 7:return U.sent(),[3,12];case 8:return k=void 0,O=void 0,w&&w in P?(k=A,I=P[w],O=[I]):(k=Object(x.q)(this.schema.namespaces[r].relationships[b].relationTypes,n),O=this.getIndexKeyValuesFromModel(P)),O&&k?[4,this.db.transaction(E,"readwrite").objectStore(E).index(k).get(this.canonicalKeyPath(O))]:[3,12];case 9:return T=U.sent(),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,T?[T]:[],b,r,i)];case 10:U.sent(),U.label=11;case 11:return[3,4];case 12:return[3,19];case 13:return C=U.sent(),h={error:C},[3,19];case 14:return U.trys.push([14,,17,18]),u&&!u.done&&(p=a.return)?[4,p.call(a)]:[3,16];case 15:U.sent(),U.label=16;case 16:return[3,18];case 17:if(h)throw h.error;return[7];case 18:return[7];case 19:return[3,36];case 20:U.trys.push([20,27,28,33]),c=X(t),U.label=21;case 21:return[4,c.next()];case 22:return(l=U.sent()).done?[3,26]:(P=l.value,k=Object(x.q)(this.schema.namespaces[r].relationships[b].relationTypes,n)||Object(x.r)(this.schema.namespaces[r].relationships[b].indexes,_),N=this.getIndexKeyValuesFromModel(P),[4,this.db.transaction(E,"readwrite").objectStore(E).index(k).getAll(this.canonicalKeyPath(N))]);case 23:return j=U.sent(),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,j,b,r,i)];case 24:U.sent(),U.label=25;case 25:return[3,21];case 26:return[3,33];case 27:return M=U.sent(),v={error:M},[3,33];case 28:return U.trys.push([28,,31,32]),l&&!l.done&&(y=c.return)?[4,y.call(c)]:[3,30];case 29:U.sent(),U.label=30;case 30:return[3,32];case 31:if(v)throw v.error;return[7];case 32:return[7];case 33:case 34:return[3,36];case 35:return Object(x.l)(m),[3,36];case 36:return[3,1];case 37:return[3,44];case 38:return R=U.sent(),f={error:R},[3,44];case 39:return U.trys.push([39,,42,43]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,41];case 40:U.sent(),U.label=41;case 41:return[3,43];case 42:if(f)throw f.error;return[7];case 43:return[7];case 44:return i.push({storeName:Object(x.u)(r,n),items:t.map((function(e){return D.modelInstanceCreator(D.getModelConstructorByModelName(r,n),e)}))}),[2]}}))}))},e.prototype.clear=function(){var e;return Q(this,void 0,void 0,(function(){return Z(this,(function(t){switch(t.label){case 0:return[4,this.checkPrivate()];case 1:return t.sent(),null===(e=this.db)||void 0===e||e.close(),[4,H(this.dbName)];case 2:return t.sent(),this.db=void 0,this.initPromise=void 0,[2]}}))}))},e.prototype.batchSave=function(e,t){return Q(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p=this;return Z(this,(function(v){switch(v.label){case 0:return 0===t.length?[2,[]]:[4,this.checkPrivate()];case 1:v.sent(),n=[],r=this.getStorenameForModel(e),i=this.db.transaction(r,"readwrite"),o=i.store,s=function(t){var r,i,s,u,c,l,f,d;return Z(this,(function(h){switch(h.label){case 0:return r=a.namespaceResolver(e),i=e.name,s=a.modelInstanceCreator(e,t),u=Object(x.R)(i,s,a.schema.namespaces[r],a.modelInstanceCreator,a.getModelConstructorByModelName),c=a.getIndexKeyValuesFromModel(s),l=t._deleted,[4,o.index("byPk").getKey(a.canonicalKeyPath(c))];case 1:return f=h.sent(),l?[3,3]:(d=u.find((function(e){var t=e.instance,n=p.getIndexKeyValuesFromModel(t);return Object(x.M)(n,c)})).instance,n.push([d,f?y.h.UPDATE:y.h.INSERT]),[4,o.put(d,f)]);case 2:return h.sent(),[3,5];case 3:return n.push([t,y.h.DELETE]),f?[4,o.delete(f)]:[3,5];case 4:h.sent(),h.label=5;case 5:return[2]}}))},a=this,v.label=2;case 2:v.trys.push([2,7,8,9]),u=te(t),c=u.next(),v.label=3;case 3:return c.done?[3,6]:(l=c.value,[5,s(l)]);case 4:v.sent(),v.label=5;case 5:return c=u.next(),[3,3];case 6:return[3,9];case 7:return f=v.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 v.sent(),[2,n]}}))}))},e.prototype.createObjectStoreForModel=function(e,t,n,r){var i=e.createObjectStore(n,{autoIncrement:!0});return this.schema.namespaces[t].relationships[r].indexes.forEach((function(e){var t=ee(e,3),n=t[0],r=t[1],o=t[2];i.createIndex(n,r,o)})),i},e}()),oe=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())}))},se=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])}}},ae=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},ue=function(){var e=this;this.db=new Map,this.getAllKeys=function(){return oe(e,void 0,void 0,(function(){return se(this,(function(e){return[2,Array.from(this.db.keys())]}))}))},this.multiGet=function(t){return oe(e,void 0,void 0,(function(){var e=this;return se(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 oe(e,void 0,void 0,(function(){var e=this;return se(this,(function(r){return t.forEach((function(t){return e.db.delete(t)})),"function"==typeof n&&n(),[2]}))}))},this.multiSet=function(t,n){return oe(e,void 0,void 0,(function(){var e=this;return se(this,(function(r){return t.forEach((function(t){var n=ae(t,2),r=n[0],i=n[1];e.setItem(r,i)})),"function"==typeof n&&n(),[2]}))}))},this.setItem=function(t,n){return oe(e,void 0,void 0,(function(){return se(this,(function(e){return[2,this.db.set(t,n)]}))}))},this.removeItem=function(t){return oe(e,void 0,void 0,(function(){return se(this,(function(e){return[2,this.db.delete(t)]}))}))},this.getItem=function(t){return oe(e,void 0,void 0,(function(){return se(this,(function(e){return[2,this.db.get(t)]}))}))}};var ce=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())}))},le=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},fe=function(e){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.")},de=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},he=new Map,pe=function(){function e(){this._collectionInMemoryIndex=new Map,this.storage=new ue}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 he.has(e)||he.set(e,Object(x.O)()),he.get(e)},e.prototype.init=function(){return ce(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 le(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=fe(e),r=n.next(),w.label=3;case 3:return r.done?[3,11]:(i=r.value,o=de(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,n,r){return ce(this,void 0,void 0,(function(){var i,o,s;return le(this,(function(a){switch(a.label){case 0:return i=Object(x.v)(n),o=this.getCollectionIndex(t).get(i)||this.getMonotonicFactory(t)(),s=this.getKeyForItem(t,r,o),this.getCollectionIndex(t).set(r,o),[4,this.storage.setItem(s,JSON.stringify(e))];case 1:return a.sent(),[2]}}))}))},e.prototype.batchSave=function(e,t,n){return ce(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,f,d,h,p,v,g,m,b,w,S,_,E,A=this;return le(this,(function(O){switch(O.label){case 0:if(0===t.length)return[2,[]];r=[],i=this.getCollectionIndex(e),o=new Set,s=new Set,a=[],u={},c=function(t){var r=n.map((function(e){return t[e]})),c=t._deleted,f=i.get(r.join(x.b))||l.getMonotonicFactory(e)(),d=l.getKeyForItem(e,r.join(x.b),f);a.push(d),u[d]={ulid:f,model:t},c?o.add(d):s.add(d)},l=this;try{for(f=fe(t),d=f.next();!d.done;d=f.next())h=d.value,c(h)}catch(e){w={error:e}}finally{try{d&&!d.done&&(S=f.return)&&S.call(f)}finally{if(w)throw w.error}}return[4,this.storage.multiGet(a)];case 1:return p=O.sent(),v=p.filter((function(e){return!!de(e,2)[1]})).reduce((function(e,t){var n=de(t,1)[0];return e.add(n)}),new Set),[4,new Promise((function(e,t){if(0!==o.size){var r=Array.from(o);r.forEach((function(e){var t=n.map((function(t){return u[e].model[t]})).join(x.b);i.delete(t)})),A.storage.multiRemove(r,(function(n){n&&n.length>0?t(n):e()}))}else e()}))];case 2:return O.sent(),[4,new Promise((function(e,t){if(0!==s.size){var r=Array.from(s).map((function(e){return[e,JSON.stringify(u[e].model)]}));s.forEach((function(e){var t=u[e],r=t.model,o=t.ulid,s=n.map((function(e){return r[e]})).join(x.b);i.set(s,o)})),A.storage.multiSet(r,(function(n){n&&n.length>0?t(n):e()}))}else e()}))];case 3:O.sent();try{for(g=fe(a),m=g.next();!m.done;m=g.next())b=m.value,o.has(b)&&v.has(b)?r.push([u[b].model,y.h.DELETE]):s.has(b)&&r.push([u[b].model,v.has(b)?y.h.UPDATE:y.h.INSERT])}catch(e){_={error:e}}finally{try{m&&!m.done&&(E=g.return)&&E.call(g)}finally{if(_)throw _.error}}return[2,r]}}))}))},e.prototype.get=function(e,t){return ce(this,void 0,void 0,(function(){var n,r,i;return le(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 ce(this,void 0,void 0,(function(){var n,r,i,o,s,a,u;return le(this,(function(c){switch(c.label){case 0:return n=this.getCollectionIndex(t),r=de(e===y.j.FIRST?function(){var e,t,r,i,o;try{for(var s=fe(n),a=s.next();!a.done;a=s.next()){i=(r=de(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=fe(n),a=s.next();!a.done;a=s.next())i=(r=de(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 ce(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 le(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=fe(n),h=d.next();!h.done&&(p=de(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 de(e,2)[1]})).map((function(e){var t=de(e,2)[1];return JSON.parse(t)}))]}}))}))},e.prototype.delete=function(e,t){return ce(this,void 0,void 0,(function(){var n,r;return le(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 ce(this,void 0,void 0,(function(){var e,t;return le(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 ve(e){return(ve="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 ye,ge=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())}))},me=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])}}},be=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 we?we(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)}))}}},we=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.")},Se=new s.a("DataStore"),_e=new(function(){function e(){}return e.prototype.getStorenameForModel=function(e){var t=this.namespaceResolver(e),n=e.name;return Object(x.u)(t,n)},e.prototype.getIndexKeyValuesFromModel=function(e){var t=Object.getPrototypeOf(e).constructor,n=this.namespaceResolver(t),r=Object(x.s)(this.schema.namespaces[n],t.name);return Object(x.n)(e,r)},e.prototype.getIndexKeyValuesPath=function(e){return this.getIndexKeyValuesFromModel(e).join(x.b)},e.prototype.setUp=function(e,t,n,r){return ge(this,void 0,void 0,(function(){var i,o=this;return me(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 pe,[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 ge(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p,v,g,m,b,w,S,_,E,A,I,T,C,P,k,N,j=this;return me(this,(function(M){switch(M.label){case 0:return i=Object.getPrototypeOf(e).constructor,o=this.getStorenameForModel(i),s=this.namespaceResolver(i),a=Object(x.R)(i.name,e,this.schema.namespaces[s],this.modelInstanceCreator,this.getModelConstructorByModelName),u=new Set,c=Object.values(a).map((function(e){var t=e.modelName,n=e.item,r=e.instance,i=Object(x.u)(s,t);return u.add(i),{storeName:i,item:n,instance:r,keys:Object(x.s)(j.schema.namespaces[s],t)}})),l=this.getIndexKeyValuesPath(e),[4,this.db.get(l,o)];case 1:if(f=M.sent(),t&&f&&(d=O.a.getPredicates(t),h=d.predicates,p=d.type,!Object(x.S)(f,p,h)))throw v="Conditional update failed",Se.error(v,{model:f,condition:h}),new Error(v);g=[],M.label=2;case 2:M.trys.push([2,9,10,15]),m=be(c),M.label=3;case 3:return[4,m.next()];case 4:return(b=M.sent()).done?[3,8]:(w=b.value,S=w.storeName,_=w.item,E=w.instance,A=w.keys,I=A.map((function(e){return _[e]})),T=I.join(x.b),[4,this.db.get(T,S)]);case 5:return C=M.sent(),P=C?y.h.UPDATE:y.h.INSERT,k=this.getIndexKeyValuesFromModel(e),Object(x.M)(I,k)||P===y.h.INSERT?[4,this.db.save(_,S,A,T)]:[3,7];case 6:M.sent(),g.push([E,P]),M.label=7;case 7:return[3,3];case 8:return[3,15];case 9:return N=M.sent(),n={error:N},[3,15];case 10:return M.trys.push([10,,13,14]),b&&!b.done&&(r=m.return)?[4,r.call(m)]:[3,12];case 11:M.sent(),M.label=12;case 12:return[3,14];case 13:if(n)throw n.error;return[7];case 14:return[7];case 15:return[2,g]}}))}))},e.prototype.load=function(e,t,n){var r,i,o,s,a,u,c,l,f,d;return ge(this,void 0,void 0,(function(){var h,p,v,y,g,m,b,w,S,_,E,A,O,I,T,C,P,k,N,j,M,R,D=this;return me(this,(function(U){switch(U.label){case 0:if(h=this.schema.namespaces[e],p=h.relationships[t].relationTypes,v=p.map((function(t){var n=t.modelName;return Object(x.u)(e,n)})),y=this.getModelConstructorByModelName(e,t),0===v.length)return[2,n.map((function(e){return D.modelInstanceCreator(y,e)}))];U.label=1;case 1:U.trys.push([1,38,39,44]),g=be(p),U.label=2;case 2:return[4,g.next()];case 3:if((m=U.sent()).done)return[3,37];switch(b=m.value,w=b.fieldName,S=b.modelName,_=b.targetName,E=b.targetNames,A=b.relationType,O=Object(x.u)(e,S),I=this.getModelConstructorByModelName(e,S),A){case"HAS_ONE":return[3,4];case"BELONGS_TO":return[3,19];case"HAS_MANY":return[3,34]}return[3,35];case 4:U.trys.push([4,12,13,18]),r=be(n),U.label=5;case 5:return[4,r.next()];case 6:return(i=U.sent()).done?[3,11]:(P=i.value,(null==E?void 0:E.length)?([],void 0,E.every((function(e){return null!=P[e]}))?(k=E.map((function(e){return P[e]})).join(x.b),[4,this.db.get(k,O)]):[3,11]):[3,8]);case 7:return j=U.sent(),P[w]=j&&this.modelInstanceCreator(I,j),[3,10];case 8:return T=P[_]?_:w,P[T]?(N=P[T],[4,this.db.get(N,O)]):[3,11];case 9:j=U.sent(),P[w]=j&&this.modelInstanceCreator(I,j),U.label=10;case 10:return[3,5];case 11:return[3,18];case 12:return C=U.sent(),c={error:C},[3,18];case 13:return U.trys.push([13,,16,17]),i&&!i.done&&(l=r.return)?[4,l.call(r)]:[3,15];case 14:U.sent(),U.label=15;case 15:return[3,17];case 16:if(c)throw c.error;return[7];case 17:return[7];case 18:return[3,36];case 19:U.trys.push([19,27,28,33]),o=be(n),U.label=20;case 20:return[4,o.next()];case 21:return(s=U.sent()).done?[3,26]:(P=s.value,(null==E?void 0:E.length)?(void 0,E.every((function(e){return null!=P[e]}))?(k=E.map((function(e){return P[e]})).join(x.b),[4,this.db.get(k,O)]):[3,26]):[3,23]);case 22:return j=U.sent(),P[w]=j&&this.modelInstanceCreator(I,j),null==E||E.map((function(e){delete P[e]})),[3,25];case 23:return P[_]?(N=P[_],[4,this.db.get(N,O)]):[3,25];case 24:j=U.sent(),P[w]=j&&this.modelInstanceCreator(I,j),delete P[_],U.label=25;case 25:return[3,20];case 26:return[3,33];case 27:return M=U.sent(),f={error:M},[3,33];case 28:return U.trys.push([28,,31,32]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,30];case 29:U.sent(),U.label=30;case 30:return[3,32];case 31:if(f)throw f.error;return[7];case 32:return[7];case 33:case 34:return[3,36];case 35:return Object(x.l)(A),[3,36];case 36:return[3,2];case 37:return[3,44];case 38:return R=U.sent(),a={error:R},[3,44];case 39:return U.trys.push([39,,42,43]),m&&!m.done&&(u=g.return)?[4,u.call(g)]:[3,41];case 40:U.sent(),U.label=41;case 41:return[3,43];case 42:if(a)throw a.error;return[7];case 43:return[7];case 44:return[2,n.map((function(e){return D.modelInstanceCreator(y,e)}))]}}))}))},e.prototype.query=function(e,t,n){return ge(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,f=this;return me(this,(function(d){switch(d.label){case 0:return r=this.getStorenameForModel(e),i=this.namespaceResolver(e),o=t&&O.a.getPredicates(t),s=Object(x.s)(this.schema.namespaces[i],e.name),a=o&&this.keyValueFromPredicate(o,s),u=n&&n.sort,c=n&&n.limit,[4,ge(f,void 0,void 0,(function(){var e,t,i;return me(this,(function(s){switch(s.label){case 0:return a?[4,this.getByKey(r,a)]:[3,2];case 1:return[2,(e=s.sent())?[e]:[]];case 2:return o?[4,this.filterOnPredicate(r,o)]:[3,4];case 3:return t=s.sent(),[2,this.inMemoryPagination(t,n)];case 4:return u||c?[4,this.getAll(r)]:[3,6];case 5:return i=s.sent(),[2,this.inMemoryPagination(i,n)];case 6:return[2,this.getAll(r)]}}))}))];case 1:return l=d.sent(),[4,this.load(i,e.name,l)];case 2:return[2,d.sent()]}}))}))},e.prototype.getByKey=function(e,t){return ge(this,void 0,void 0,(function(){return me(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 ge(this,void 0,void 0,(function(){return me(this,(function(t){switch(t.label){case 0:return[4,this.db.getAll(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.keyValueFromPredicate=function(e,t){var n,r,i=e.predicates;if(i.length===t.length){var o=[],s=function(e){var t=i.find((function(t){return Object(y.w)(t)&&t.field===e&&"eq"===t.operator}));t&&o.push(t.operand)};try{for(var a=we(t),u=a.next();!u.done;u=a.next()){s(u.value)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o.length===t.length?o.join(x.b):void 0}},e.prototype.filterOnPredicate=function(e,t){return ge(this,void 0,void 0,(function(){var n,r,i;return me(this,(function(o){switch(o.label){case 0:return n=t.predicates,r=t.type,[4,this.getAll(e)];case 1:return i=o.sent(),[2,n?i.filter((function(e){return Object(x.S)(e,r,n)})):i]}}))}))},e.prototype.inMemoryPagination=function(e,t){if(t&&e.length>1){if(t.sort){var n=I.a.getPredicates(t.sort);if(n.length){var r=Object(x.Q)(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=y.j.FIRST),ge(this,void 0,void 0,(function(){var n,r;return me(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 ge(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return me(this,(function(g){switch(g.label){case 0:return n=[],Object(x.H)(e)?(s=e,r=this.namespaceResolver(s),[4,this.query(s,t)]):[3,8];case 1:return i=g.sent(),v=this.schema.namespaces[r].relationships[s.name].relationTypes,void 0===t?[3,4]:[4,this.deleteTraverse(v,i,s.name,r,n)];case 2:return g.sent(),[4,this.deleteItem(n)];case 3:return g.sent(),y=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[i,y]];case 4:return[4,this.deleteTraverse(v,i,s.name,r,n)];case 5:return g.sent(),[4,this.deleteItem(n)];case 6:return g.sent(),y=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[i,y]];case 7:return[3,15];case 8:return o=e,s=Object.getPrototypeOf(o).constructor,a=this.namespaceResolver(s),u=this.getStorenameForModel(s),t?(c=this.getIndexKeyValuesPath(o),[4,this.db.get(c,u)]):[3,11];case 9:if(void 0===(l=g.sent()))return p="Model instance not found in storage",Se.warn(p,{model:o}),[2,[[o],[]]];if(f=O.a.getPredicates(t),d=f.predicates,h=f.type,!Object(x.S)(l,h,d))throw p="Conditional update failed",Se.error(p,{model:l,condition:d}),new Error(p);return v=this.schema.namespaces[a].relationships[s.name].relationTypes,[4,this.deleteTraverse(v,[o],s.name,a,n)];case 10:return g.sent(),[3,13];case 11:return v=this.schema.namespaces[a].relationships[s.name].relationTypes,[4,this.deleteTraverse(v,[o],s.name,a,n)];case 12:g.sent(),g.label=13;case 13:return[4,this.deleteItem(n)];case 14:return g.sent(),y=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[[o],y]];case 15:return[2]}}))}))},e.prototype.deleteItem=function(e){var t,n,r,i,o,s;return ge(this,void 0,void 0,(function(){var a,u,c,l,f,d,h,p,v;return me(this,(function(y){switch(y.label){case 0:y.trys.push([0,17,18,23]),t=be(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=be(c),y.label=4;case 4:return[4,l.next()];case 5:return(f=y.sent()).done?[3,8]:(d=f.value)?"object"!==ve(d)?[3,7]:(h=this.getIndexKeyValuesPath(d),[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 ge(this,void 0,void 0,(function(){var g,m,b,w,S,_,E,A,O,I,T,C,P,k,N,j,M,R,D,U,F,L,B,q,z,K=this;return me(this,(function(V){switch(V.label){case 0:V.trys.push([0,38,39,44]),o=be(e),V.label=1;case 1:return[4,o.next()];case 2:if((s=V.sent()).done)return[3,37];switch(g=s.value,m=g.relationType,b=g.modelName,w=g.targetName,S=g.targetNames,_=g.associatedWith,E=Object(x.u)(r,b),A=Object(x.q)(this.schema.namespaces[r].relationships[b].relationTypes,n)||Object(x.r)(this.schema.namespaces[r].relationships[b].indexes,g.associatedWith),m){case"HAS_ONE":return[3,3];case"HAS_MANY":return[3,20];case"BELONGS_TO":return[3,34]}return[3,35];case 3:V.trys.push([3,13,14,19]),a=be(t),V.label=4;case 4:return[4,a.next()];case 5:return(u=V.sent()).done?[3,12]:(D=u.value,S&&(null==S?void 0:S.length)?(A?O=A.split(x.e):_&&(O=Array.isArray(_)?_:[_]),I=S.every((function(e){return D.hasOwnProperty(e)})),N=this.getIndexKeyValuesPath(D),C=O===_,0===(T=I&&C?S.filter((function(e){var t;return null!==(t=D[e])&&void 0!==t&&t})).map((function(e){return D[e]})):N.split(x.b)).length?[3,12]:[4,this.db.getAll(E)]):[3,8]);case 6:return F=V.sent(),M=void 0,M=I?F.filter((function(e){return O.every((function(t){return T.includes(e[t])}))})):F.filter((function(e){return e[O]===T})),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,M,b,r,i)];case 7:return V.sent(),[3,11];case 8:return P=A||_,k=w in D,N=this.getIndexKeyValuesPath(D),(j=k?D[w]:N)?[4,this.db.getAll(E)]:[3,12];case 9:return F=V.sent(),M=F.filter((function(e){return e[P]===j})),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,M,b,r,i)];case 10:V.sent(),V.label=11;case 11:return[3,4];case 12:return[3,19];case 13:return R=V.sent(),h={error:R},[3,19];case 14:return V.trys.push([14,,17,18]),u&&!u.done&&(p=a.return)?[4,p.call(a)]:[3,16];case 15:V.sent(),V.label=16;case 16:return[3,18];case 17:if(h)throw h.error;return[7];case 18:return[7];case 19:return[3,36];case 20:V.trys.push([20,27,28,33]),c=be(t),V.label=21;case 21:return[4,c.next()];case 22:return(l=V.sent()).done?[3,26]:(D=l.value,U=this.getIndexKeyValuesFromModel(D),[4,this.db.getAll(E)]);case 23:return F=V.sent(),L=A.split(x.e),B=F.filter((function(e){return L.every((function(t){return U.includes(e[t])}))})),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,B,b,r,i)];case 24:V.sent(),V.label=25;case 25:return[3,21];case 26:return[3,33];case 27:return q=V.sent(),v={error:q},[3,33];case 28:return V.trys.push([28,,31,32]),l&&!l.done&&(y=c.return)?[4,y.call(c)]:[3,30];case 29:V.sent(),V.label=30;case 30:return[3,32];case 31:if(v)throw v.error;return[7];case 32:return[7];case 33:case 34:return[3,36];case 35:return Object(x.l)(m),[3,36];case 36:return[3,1];case 37:return[3,44];case 38:return z=V.sent(),f={error:z},[3,44];case 39:return V.trys.push([39,,42,43]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,41];case 40:V.sent(),V.label=41;case 41:return[3,43];case 42:if(f)throw f.error;return[7];case 43:return[7];case 44:return i.push({storeName:Object(x.u)(r,n),items:t.map((function(e){return K.modelInstanceCreator(K.getModelConstructorByModelName(r,n),e)}))}),[2]}}))}))},e.prototype.clear=function(){return ge(this,void 0,void 0,(function(){return me(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 ge(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p=this;return me(this,(function(v){switch(v.label){case 0:n=e.name,r=this.namespaceResolver(e),i=Object(x.u)(r,n),o=Object(x.s)(this.schema.namespaces[r],n),s=[],a=function(t){var i=u.modelInstanceCreator(e,t),o=Object(x.R)(n,i,u.schema.namespaces[r],u.modelInstanceCreator,u.getModelConstructorByModelName),a=u.getIndexKeyValuesPath(i),c=o.find((function(e){var t=e.instance,n=p.getIndexKeyValuesPath(t);return Object(x.M)([n],[a])})).instance;s.push(c)},u=this;try{for(c=we(t),l=c.next();!l.done;l=c.next())f=l.value,a(f)}catch(e){d={error:e}}finally{try{l&&!l.done&&(h=c.return)&&h.call(c)}finally{if(d)throw d.error}}return[4,this.db.batchSave(i,s,o)];case 1:return[2,v.sent()]}}))}))},e}()),Ee=function(){return Object(a.b)().isBrowser&&window.indexedDB||Object(a.c)()&&self.indexedDB?ie:_e},Ae=function(){return(Ae=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)},Oe=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Ie=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Te=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},Ce=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},Pe=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.")},xe=new s.a("DataStore"),ke=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||Ee(),this.pushStream=new P.a}return e.getNamespace=function(){return{name:x.f,relationships:{},enums:{},models:{},nonModels:{}}},e.prototype.init=function(){return Oe(this,void 0,void 0,(function(){var e,t;return Ie(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 xe.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 Oe(this,void 0,void 0,(function(){var i,o=this;return Ie(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=Ce(s,2),c=u[0],l=u[1],f=!!n;if(l===y.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:O.a.getPredicates(t,!1),savedElement:c})})),[2,i]}}))}))},e.prototype.delete=function(e,t,n){return Oe(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l=this;return Ie(this,(function(f){switch(f.label){case 0:return[4,this.init()];case 1:return f.sent(),[4,this.adapter.delete(e,t)];case 2:return c=Ce.apply(void 0,[f.sent(),2]),i=c[0],r=c[1],o=Object(x.H)(e)?e:Object.getPrototypeOf(e||{}).constructor,s=this.namespaceResolver(o),a=this.schema.namespaces[s].models[o.name],u=new Set(i.map((function(e){return Object(k.h)(a,e)}))),Object(x.H)(e)||Array.isArray(r)||(r=[r]),r.forEach((function(r){var i,o=Object.getPrototypeOf(r).constructor;if(!Object(x.H)(e)){var s=Object(k.h)(a,r);i=u.has(s)?O.a.getPredicates(t,!1):void 0}l.pushStream.next({model:o,opType:y.h.DELETE,element:r,mutator:n,condition:i})})),[2,[i,r]]}}))}))},e.prototype.query=function(e,t,n){return Oe(this,void 0,void 0,(function(){return Ie(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=y.j.FIRST),Oe(this,void 0,void 0,(function(){return Ie(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=O.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 Te(e,["mutator"])}));return r||(u=u.filter((function(t){var n=t.model,r=t.element;return e===n&&(!a||Object(x.S)(r,s,o))}))),u},e.prototype.clear=function(e){return void 0===e&&(e=!0),Oe(this,void 0,void 0,(function(){return Ie(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 Oe(this,void 0,void 0,(function(){var r,i=this;return Ie(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=Ce(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=Ce(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,g=void 0===v?[]:v;if(c.forEach((function(e){var n,r,i,o,s,c,l,f,h,p,v,m=Object(y.z)(null===(v=d[e])||void 0===v?void 0:v.association);if(Array.isArray(m))try{for(var b=Pe(m),w=b.next();!w.done;w=b.next()){var S=w.value;if(!Object(x.T)(a[S],t[S])){u[S]=void 0===t[S]?null:t[S];try{for(var _=(i=void 0,Pe(g)),E=_.next();!E.done;E=_.next()){if((k=E.value).has(S))try{for(var A=(s=void 0,Pe(k)),O=A.next();!O.done;O=A.next()){var I=O.value;u[I]=t[I]}}catch(e){s={error:e}}finally{try{O&&!O.done&&(c=A.return)&&c.call(A)}finally{if(s)throw s.error}}}}catch(e){i={error:e}}finally{try{E&&!E.done&&(o=_.return)&&o.call(_)}finally{if(i)throw i.error}}}}}catch(e){n={error:e}}finally{try{w&&!w.done&&(r=b.return)&&r.call(b)}finally{if(n)throw n.error}}else{var T=m||e;if(!Object(x.T)(a[T],t[T])){u[T]=void 0===t[T]?null:t[T];try{for(var C=Pe(g),P=C.next();!P.done;P=C.next()){var k;if((k=P.value).has(T))try{for(var N=(h=void 0,Pe(k)),j=N.next();!j.done;j=N.next()){I=j.value;u[I]=t[I]}}catch(e){h={error:e}}finally{try{j&&!j.done&&(p=N.return)&&p.call(N)}finally{if(h)throw h.error}}}}catch(e){l={error:e}}finally{try{P&&!P.done&&(f=C.return)&&f.call(C)}finally{if(l)throw l.error}}}}})),0===Object.keys(u).length)return null;if(p&&p.length)try{for(var m=Pe(p),b=m.next();!b.done;b=m.next()){var w=b.value;u[w]=t[w]}}catch(e){r={error:e}}finally{try{b&&!b.done&&(i=m.return)&&i.call(m)}finally{if(r)throw r.error}}var S=t.id,_=t._version,E=t._lastChangedAt,A=t._deleted;return Ae(Ae({},u),{id:S,_version:_,_lastChangedAt:E,_deleted:A})},e}(),Ne=function(){function e(e,t,n,r,i,o){this.mutex=new T,this.storage=new ke(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 Oe(this,void 0,void 0,(function(){return Ie(this,(function(i){return[2,this.runExclusive((function(i){return i.save(e,t,n,r)}))]}))}))},e.prototype.delete=function(e,t,n){return Oe(this,void 0,void 0,(function(){return Ie(this,(function(r){return[2,this.runExclusive((function(r){if(Object(x.H)(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 Oe(this,void 0,void 0,(function(){return Ie(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=y.j.FIRST),Oe(this,void 0,void 0,(function(){return Ie(this,(function(n){return[2,this.runExclusive((function(n){return n.queryOne(e,t)}))]}))}))},e.getNamespace=function(){return ke.getNamespace()},e.prototype.observe=function(e,t,n){return this.storage.observe(e,t,n)},e.prototype.clear=function(){return Oe(this,void 0,void 0,(function(){return Ie(this,(function(e){switch(e.label){case 0:return[4,this.runExclusive((function(e){return e.clear()}))];case 1:return e.sent(),[2]}}))}))},e.prototype.batchSave=function(e,t){return this.storage.batchSave(e,t)},e.prototype.init=function(){return Oe(this,void 0,void 0,(function(){return Ie(this,(function(e){return[2,this.storage.init()]}))}))},e}(),je=n(14),Me=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Re=(new(function(){function e(){}return e.prototype.networkMonitor=function(t){if(Object(a.b)().isNode)return h.a.from([{online:!0}]);var n=Object(a.c)()?self:window;return new h.a((function(t){t.next({online:n.navigator.onLine});var r=function(){return t.next({online:!0})},i=function(){return t.next({online:!1})};return n.addEventListener("online",r),n.addEventListener("offline",i),e._observers.push(t),function(){n.removeEventListener("online",r),n.removeEventListener("offline",i),e._observers=e._observers.filter((function(e){return e!==t}))}}))},e._observerOverride=function(t){var n,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=Me(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(),De=function(){return(De=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)},Ue=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())}))},Fe=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])}}},Le=(new s.a("DataStore"),function(){function e(){this.connectionStatus={online:!1}}return e.prototype.status=function(){var e=this;if(this.observer)throw new Error("Subscriber already exists");return new h.a((function(t){return e.observer=t,e.subscription=Re.subscribe((function(n){var r=n.online;e.connectionStatus.online=r;var i=De({},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.stop=function(){return Ue(this,void 0,void 0,(function(){return Fe(this,(function(e){return this.unsubscribe(),[2]}))}))},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=De({},e.connectionStatus);e.observer.next(t)}),5e3))},e}()),Be=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())}))},qe=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])}}},ze=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},Ke=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.")},Ve=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(ze(arguments[t]));return e},He=function(){function e(e,t){this.outbox=e,this.ownSymbol=t}return e.prototype.merge=function(e,t,n){return Be(this,void 0,void 0,(function(){var r,i,o,s,a;return qe(this,(function(u){switch(u.label){case 0:return[4,this.outbox.getForModel(e,t,n)];case 1:return i=u.sent(),o=t._deleted,0!==i.length?[3,5]:o?(r=y.h.DELETE,[4,e.delete(t,void 0,this.ownSymbol)]):[3,3];case 2:return u.sent(),[3,5];case 3:return[4,e.save(t,void 0,this.ownSymbol)];case 4:s=ze.apply(void 0,[u.sent(),1]),a=ze(s[0],2),r=a[1],u.label=5;case 5:return[2,r]}}))}))},e.prototype.mergePage=function(e,t,n,r){return Be(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f;return qe(this,(function(d){switch(d.label){case 0:i=new Map;try{for(o=Ke(n),s=o.next();!s.done;s=o.next())a=s.value,u=Object(k.h)(r,a),i.set(u,a)}catch(e){l={error:e}}finally{try{s&&!s.done&&(f=o.return)&&f.call(o)}finally{if(l)throw l.error}}return c=Ve(i.values()),[4,e.batchSave(t,c,this.ownSymbol)];case 1:return[2,d.sent()]}}))}))},e}(),Ge=function(){return(Ge=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)},We=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Ye=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Je=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},$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},Qe=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 We(this,void 0,void 0,(function(){var n=this;return Ye(this,(function(r){switch(r.label){case 0:return[4,e.runExclusive((function(e){return We(n,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f=this;return Ye(this,(function(d){switch(d.label){case 0:return n=this.schema.namespaces[x.g].models.MutationEvent,r=O.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=$e.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!==k.a.CREATE?[3,8]:s!==k.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]}}))}))}))];case 1:return r.sent(),[2]}}))}))},e.prototype.dequeue=function(e,t,n){return We(this,void 0,void 0,(function(){var r;return Ye(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 We(this,void 0,void 0,(function(){var t;return Ye(this,(function(n){switch(n.label){case 0:return[4,e.queryOne(this.MutationEvent,y.j.FIRST)];case 1:return t=n.sent(),this.inProgressMutationEventId=t?t.id:void 0,[2,t]}}))}))},e.prototype.getForModel=function(e,t,n){return We(this,void 0,void 0,(function(){var r,i;return Ye(this,(function(o){switch(o.label){case 0:return r=this.schema.namespaces[x.g].models.MutationEvent,i=Object(k.h)(n,t),[4,e.query(this.MutationEvent,O.a.createFromExisting(r,(function(e){return e.modelId("eq",i)})))];case 1:return[2,o.sent()]}}))}))},e.prototype.getModelIds=function(e){return We(this,void 0,void 0,(function(){var t,n;return Ye(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 We(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p,v,y,g=this;return Ye(this,(function(m){switch(m.label){case 0:return n.operation!==r?[2]:(i=t._version,o=t._lastChangedAt,t._deleted,s=Je(t,["_version","_lastChangedAt","_deleted"]),a=this.removeTimestampFields(n.model,s),(u=JSON.parse(n.data))?(u._version,u._lastChangedAt,u._deleted,c=Je(u,["_version","_lastChangedAt","_deleted"]),l=this.removeTimestampFields(n.model,c),Object(x.T)(a,l,!0)?(f=this.schema.namespaces[x.g].models.MutationEvent,d=this.schema.namespaces.user.models[n.model],h=Object(k.h)(d,t),p=O.a.createFromExisting(f,(function(e){return e.modelId("eq",h).id("ne",g.inProgressMutationEventId)})),[4,e.query(this.MutationEvent,p)]):[2]):[2]);case 1:return(v=m.sent()).length?(y=v.map((function(e){var t=JSON.parse(e.data),n=Ge(Ge({},t),{_version:i,_lastChangedAt:o});return g.MutationEvent.copyOf(e,(function(e){e.data=JSON.stringify(n)}))})),[4,e.delete(this.MutationEvent,p)]):[2];case 2:return m.sent(),[4,Promise.all(y.map((function(t){return We(g,void 0,void 0,(function(){return Ye(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 m.sent(),[2]}}))}))},e.prototype.mergeUserFields=function(e,t){var n=JSON.parse(e.data),r=n._version,i=n._lastChangedAt,o=n._deleted,s=Je(n,["_version","_lastChangedAt","_deleted"]),a=JSON.parse(t.data),u=(a._version,a._lastChangedAt,a._deleted,Je(a,["_version","_lastChangedAt","_deleted"])),c=JSON.stringify(Ge(Ge({_version:r,_lastChangedAt:i,_deleted:o},s),u));return this.modelInstanceCreator(this.MutationEvent,Ge(Ge({},t),{data:c}))},e.prototype.removeTimestampFields=function(e,t){var n,r,i="createdAt",o="updatedAt",s=null===(n=this.schema.namespaces[x.h].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}(),Ze=n(153),Xe=n(23),et=function(){return(et=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},tt=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},nt=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])}}},rt=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},it=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},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=new s.a("DataStore"),at=function(){function e(e,t,n,i,o,s,a,c,l,f,d){void 0===a&&(a={}),this.schema=e,this.storage=t,this.userClasses=n,this.outbox=i,this.modelInstanceCreator=o,this.MutationEvent=s,this.amplifyConfig=a,this.authModeStrategy=c,this.errorHandler=l,this.conflictHandler=f,this.amplifyContext=d,this.typeQuery=new WeakMap,this.processing=!1,this.runningProcesses=new u.a,this.amplifyContext.API=this.amplifyContext.API||r.a,this.generateQueries()}return e.prototype.generateQueries=function(){var e=this;Object.values(this.schema.namespaces).forEach((function(t){Object.values(t.models).filter((function(e){return e.syncable})).forEach((function(n){var r=it(Object(k.b)(t,n,"CREATE"),1)[0],i=it(Object(k.b)(t,n,"UPDATE"),1)[0],o=it(Object(k.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 h.a((function(t){e.observer=t;try{e.resume()}catch(e){throw st.error("mutations processor start error",e),e}return e.runningProcesses.addCleaner((function(){return tt(e,void 0,void 0,(function(){return nt(this,(function(e){return this.pause(),[2]}))}))}))}))},e.prototype.stop=function(){return tt(this,void 0,void 0,(function(){return nt(this,(function(e){switch(e.label){case 0:return[4,this.runningProcesses.close()];case 1:return e.sent(),[4,this.runningProcesses.open()];case 2:return e.sent(),[2]}}))}))},e.prototype.resume=function(){return tt(this,void 0,void 0,(function(){var e=this;return nt(this,(function(t){switch(t.label){case 0:return[4,this.runningProcesses.isOpen&&this.runningProcesses.add((function(t){return tt(e,void 0,void 0,(function(){var e,n,r,i,o,s=this;return nt(this,(function(a){switch(a.label){case 0:if(this.processing||!this.isReady()||!this.runningProcesses.isOpen)return[2];this.processing=!0,n=x.h,r=function(){var r,o,a,u,c,l,f,d,h,p,v,y,g,m,b,w;return nt(this,(function(S){switch(S.label){case 0:r=e.model,o=e.operation,a=e.data,u=e.condition,c=i.userClasses[r],l=void 0,f=void 0,d=void 0,S.label=1;case 1:return S.trys.push([1,4,,5]),[4,Object(k.i)({authModeStrategy:i.authModeStrategy,defaultAuthMode:i.amplifyConfig.aws_appsync_authenticationType,modelName:r,schema:i.schema})];case 2:return h=S.sent(),p=h[o.toUpperCase()],v=0,[4,(y=function(){return tt(s,void 0,void 0,(function(){var i,s;return nt(this,(function(l){switch(l.label){case 0:return l.trys.push([0,2,,4]),st.debug("Attempting mutation with authMode: "+p[v]),[4,this.jitteredRetry(n,r,o,a,u,c,this.MutationEvent,e,p[v],t)];case 1:return i=l.sent(),st.debug("Mutation sent successfully with authMode: "+p[v]),[2,i];case 2:if(s=l.sent(),++v>=p.length)throw st.debug("Mutation failed with authMode: "+p[v-1]),s;return st.debug("Mutation failed with authMode: "+p[v-1]+". Retrying with authMode: "+p[v]),[4,y()];case 3:return[2,l.sent()];case 4:return[2]}}))}))})()];case 3:return w=it.apply(void 0,[S.sent(),3]),l=w[0],f=w[1],d=w[2],[3,5];case 4:return"Offline"===(g=S.sent()).message||"RetryMutation"===g.message?[2,"continue"]:[3,5];case 5:return void 0!==l?[3,7]:(st.debug("done retrying"),[4,i.storage.runExclusive((function(e){return tt(s,void 0,void 0,(function(){return nt(this,(function(t){switch(t.label){case 0:return[4,this.outbox.dequeue(e)];case 1:return t.sent(),[2]}}))}))}))]);case 6:return S.sent(),[2,"continue"];case 7:return m=l.data[f],b=!1,[4,i.storage.runExclusive((function(e){return tt(s,void 0,void 0,(function(){return nt(this,(function(t){switch(t.label){case 0:return[4,this.outbox.dequeue(e,m,o)];case 1:return t.sent(),[4,this.outbox.peek(e)];case 2:return b=void 0!==t.sent(),[2]}}))}))}))];case 8:return S.sent(),i.observer.next({operation:o,modelDefinition:d,model:m,hasMore:b}),[2]}}))},i=this,a.label=1;case 1:return(o=this.processing&&this.runningProcesses.isOpen)?[4,this.outbox.peek(this.storage)]:[3,3];case 2:o=void 0!==(e=a.sent()),a.label=3;case 3:return o?[5,r()]:[3,5];case 4:return a.sent(),[3,1];case 5:return this.pause(),[2]}}))}))}),"mutation resume loop")];case 1:return t.sent(),[2]}}))}))},e.prototype.jitteredRetry=function(e,t,n,r,i,o,s,a,u,c){return tt(this,void 0,void 0,(function(){var l=this;return nt(this,(function(f){switch(f.label){case 0:return[4,Object(Ze.d)((function(t,n,r,i,o,s,a){return tt(l,void 0,void 0,(function(){var c,l,f,d,h,p,v,g,m,b,w,S,_,E,A,O,I,T,C,P,N,j,M,R,D,U;return nt(this,(function(F){switch(F.label){case 0:return c=it(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(k.j)(u,this.amplifyConfig)];case 1:v=F.sent(),g={query:l,variables:f,authMode:u,authToken:v,userAgentSuffix:x.i},m=0,b=this.opTypeFromTransformerOperation(n),F.label=2;case 2:return F.trys.push([2,4,,17]),[4,this.amplifyContext.API.graphql(g)];case 3:return[2,[F.sent(),h,p]];case 4:if(!((w=F.sent()).errors&&w.errors.length>0))return[3,15];if(S=it(w.errors,1),_=S[0],E=_.originalError,A=(void 0===E?{}:E).code,O=void 0===A?null:A,"Unauthorized"===_.errorType)throw new Ze.a("Unauthorized");if("Network Error"===_.message||"ECONNABORTED"===O){if(!this.processing)throw new Ze.a("Offline");throw new Error("Network Error")}return"ConflictUnhandled"!==_.errorType?[3,13]:(m++,I=void 0,m>10?(I=y.b,[3,8]):[3,5]);case 5:return F.trys.push([5,7,,8]),[4,this.conflictHandler({modelConstructor:o,localModel:this.modelInstanceCreator(o,f.input),remoteModel:this.modelInstanceCreator(o,_.data),operation:b,attempts:m})];case 6:return I=F.sent(),[3,8];case 7:return T=F.sent(),st.warn("conflict trycatch",T),[3,17];case 8:return I!==y.b?[3,11]:(C=it(Object(k.b)(this.schema.namespaces[e],p,"GET"),1),P=it(C[0],3),N=P[1],j=P[2],[4,Object(k.j)(u,this.amplifyConfig)]);case 9:return M=F.sent(),[4,this.amplifyContext.API.graphql({query:j,variables:{id:f.input.id},authMode:u,authToken:M,userAgentSuffix:x.i})];case 10:return[2,[F.sent(),N,p]];case 11:return R=this.schema.namespaces[e],D=Object(k.d)(R.relationships,p,b,o,I,d,s,this.modelInstanceCreator,a.id),[4,this.storage.save(D)];case 12:throw F.sent(),new Ze.a("RetryMutation");case 13:try{this.errorHandler({recoverySuggestion:"Ensure app code is up to date, auth directives exist and are correct on each model, and that server-side data has not been invalidated by a schema change. If the problem persists, search for or create an issue: https://github.com/aws-amplify/amplify-js/issues",localModel:f.input,message:_.message,operation:n,errorType:Object(Xe.a)(_),errorInfo:_.errorInfo,process:y.i.mutate,cause:_,remoteModel:_.data?this.modelInstanceCreator(o,_.data):null})}catch(e){st.warn("Mutation error handler failed with:",e)}finally{return[2,_.data?[{data:(U={},U[h]=_.data,U)},h,p]:[]]}F.label=14;case 14:return[3,16];case 15:throw new Ze.a(w);case 16:return[3,17];case 17:if(g)return[3,2];F.label=18;case 18:return[2]}}))}))}),[t,n,r,i,o,s,a],ct,c)];case 1:return[2,f.sent()]}}))}))},e.prototype.createQueryVariables=function(e,t,n,r,i){var o,s,a,u,c,l,f,d=this.schema.namespaces[e].models[t],h=this.schema.namespaces[e].keys[t].primaryKey,p=this.typeQuery.get(d),v=it(p.find((function(e){return it(e,1)[0]===n})),3),g=v[1],m=v[2],b=JSON.parse(r),w=b._version,S=rt(b,["_version"]),_={};if(null==h?void 0:h.length)try{for(var E=ot(h),A=E.next();!A.done;A=E.next()){var O=A.value;_[O]=S[O]}}catch(e){o={error:e}}finally{try{A&&!A.done&&(s=E.return)&&s.call(E)}finally{if(o)throw o.error}}else _[x.d]=S.id;if(n===k.a.DELETE)f=_;else{f={};var I=Object.values(d.fields);try{for(var T=ot(I),C=T.next();!C.done;C=T.next()){var P=C.value,N=P.name,j=P.type,M=P.association;if(Object(y.t)(j)){if(Object(y.z)(M)&&"BELONGS_TO"===M.connectionType){var R=Object(x.p)(M);if(R)try{for(var D=(c=void 0,ot(R)),U=D.next();!U.done;U=D.next()){var F=U.value;f[F]=S[F]}}catch(e){c={error:e}}finally{try{U&&!U.done&&(l=D.return)&&l.call(D)}finally{if(c)throw c.error}}}}else(n!==k.a.UPDATE||S.hasOwnProperty(N))&&(f[N]=S[N])}}catch(e){a={error:e}}finally{try{C&&!C.done&&(u=T.return)&&u.call(T)}finally{if(a)throw a.error}}}var L=et(et({},f),{_version:w}),B=JSON.parse(i);return[m,et({input:L},n===k.a.CREATE?{}:{condition:Object.keys(B).length>0?B:null}),B,g,d]},e.prototype.opTypeFromTransformerOperation=function(e){switch(e){case k.a.CREATE:return y.h.INSERT;case k.a.DELETE:return y.h.DELETE;case k.a.UPDATE:return y.h.UPDATE;case k.a.GET:break;default:Object(x.l)(e)}},e.prototype.pause=function(){this.processing=!1},e}(),ut=Object(Ze.b)(3e5),ct=function(e,t,n){var r=ut(e);return!1===r&&"Network Error"===(null==n?void 0:n.message)?3e5:r},lt=n(40),ft=function(){return(ft=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)},dt=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())}))},ht=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])}}},pt=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},vt=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.")},yt={items:[],nextToken:null,startedAt:null},gt=new s.a("DataStore"),mt=function(){function e(e,t,n,i,o,s){void 0===n&&(n={}),this.schema=e,this.syncPredicates=t,this.amplifyConfig=n,this.authModeStrategy=i,this.errorHandler=o,this.amplifyContext=s,this.typeQuery=new WeakMap,this.runningProcesses=new u.a,s.API=s.API||r.a,this.generateQueries()}return e.prototype.generateQueries=function(){var e=this;Object.values(this.schema.namespaces).forEach((function(t){Object.values(t.models).filter((function(e){return e.syncable})).forEach((function(n){var r=pt(Object(k.b)(t,n,"LIST"),1),i=pt(r[0]).slice(1);e.typeQuery.set(n,i)}))}))},e.prototype.graphqlFilterFromPredicate=function(e){if(!this.syncPredicates)return null;var t=O.a.getPredicates(this.syncPredicates.get(e),!1);return t?Object(k.m)(t):null},e.prototype.retrievePage=function(e,t,n,r,i,o){return void 0===r&&(r=null),dt(this,void 0,void 0,(function(){var s,a,u,c,l,f,d,h,p,v,y,g,m,b=this;return ht(this,(function(w){switch(w.label){case 0:return s=pt(this.typeQuery.get(e),2),a=s[0],u=s[1],c={limit:r,nextToken:n,lastSync:t,filter:i},[4,Object(k.i)({authModeStrategy:this.authModeStrategy,defaultAuthMode:this.amplifyConfig.aws_appsync_authenticationType,modelName:e.name,schema:this.schema})];case 1:return l=w.sent(),f=l.READ,d=0,[4,(h=function(){return dt(b,void 0,void 0,(function(){var t,n,r,i;return ht(this,(function(s){switch(s.label){case 0:if(!this.runningProcesses.isOpen)throw new Error("sync.retreievePage termination was requested. Exiting.");s.label=1;case 1:return s.trys.push([1,3,,5]),gt.debug("Attempting sync with authMode: "+f[d]),[4,this.jitteredRetry({query:u,variables:c,opName:a,modelDefinition:e,authMode:f[d],onTerminate:o})];case 2:return t=s.sent(),gt.debug("Sync successful with authMode: "+f[d]),[2,t];case 3:if(n=s.sent(),++d>=f.length){if(r=f[d-1],gt.debug("Sync failed with authMode: "+r,n),Object(k.f)(n)||Object(k.g)(n))return gt.warn("User is unauthorized to query "+a+" with auth mode "+r+". No data could be returned."),[2,{data:(i={},i[a]=yt,i)}];throw n}return gt.debug("Sync failed with authMode: "+f[d-1]+". Retrying with authMode: "+f[d]),[4,h()];case 4:return[2,s.sent()];case 5:return[2]}}))}))})()];case 2:return p=w.sent().data,v=p[a],y=v.items,g=v.nextToken,m=v.startedAt,[2,{nextToken:g,startedAt:m,items:y}]}}))}))},e.prototype.jitteredRetry=function(e){var t=e.query,n=e.variables,r=e.opName,i=e.modelDefinition,o=e.authMode,s=e.onTerminate;return dt(this,void 0,void 0,(function(){var e=this;return ht(this,(function(a){switch(a.label){case 0:return[4,Object(Ze.c)((function(t,n){return dt(e,void 0,void 0,(function(){var e,s,a,u,l,f,d,h,p,v,g,m=this;return ht(this,(function(b){switch(b.label){case 0:return b.trys.push([0,3,,6]),[4,Object(k.j)(o,this.amplifyConfig)];case 1:return e=b.sent(),[4,this.amplifyContext.API.graphql({query:t,variables:n,authMode:o,authToken:e,userAgentSuffix:x.i})];case 2:return[2,b.sent()];case 3:if(s=b.sent(),a=Object(k.f)(s)||Object(k.g)(s))throw new Ze.a(a);return u=Boolean(null===(p=null===(h=null==s?void 0:s.data)||void 0===h?void 0:h[r])||void 0===p?void 0:p.items),l=(null==s?void 0:s.errors)&&s.errors.some((function(e){return"Unauthorized"===e.errorType})),f=(null==s?void 0:s.errors)&&s.errors.filter((function(e){return"Unauthorized"!==e.errorType})),d=s,u&&(d.data[r].items=d.data[r].items.filter((function(e){return null!==e}))),u&&(null==f?void 0:f.length)?[4,Promise.all(f.map((function(e){return dt(m,void 0,void 0,(function(){var t;return ht(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(Xe.c)(e),process:y.i.sync,remoteModel:null,cause:e})];case 1:return n.sent(),[3,3];case 2:return t=n.sent(),gt.error("Sync error handler failed with:",t),[3,3];case 3:return[2]}}))}))})))]:[3,5];case 4:b.sent(),c.a.dispatch("datastore",{event:"nonApplicableDataReceived",data:{errors:f,modelName:i.name}}),b.label=5;case 5:if(l)return gt.warn("queryError","User is unauthorized to query "+r+", some items could not be returned."),d.data=d.data||{},d.data[r]=ft(ft({},yt),d.data[r]),[2,d];if(null===(g=null===(v=d.data)||void 0===v?void 0:v[r].items)||void 0===g?void 0:g.length)return[2,d];throw s;case 6:return[2]}}))}))}),[t,n],void 0,s)];case 1:return[2,a.sent()]}}))}))},e.prototype.start=function(e){var t=this,n=this.amplifyConfig,r=n.maxRecordsToSync,i=n.syncPageSize,o=new Map;return new h.a((function(n){var s=Object.values(t.schema.namespaces).reduce((function(t,n){var r,i;try{for(var o=vt(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),a=Array.from(s.entries()).filter((function(e){return pt(e,1)[0].syncable})).map((function(e){var s=pt(e,2),a=s[0],u=pt(s[1],2),c=u[0],l=u[1];return t.runningProcesses.isOpen&&t.runningProcesses.add((function(e){return dt(t,void 0,void 0,(function(){var t,s,u,f,d,h,p,v,y,g=this;return ht(this,(function(m){switch(m.label){case 0:return t=!1,s=null,u=null,f=null,d=0,h=this.graphqlFilterFromPredicate(a),p=this.schema.namespaces[c].modelTopologicalOrdering.get(a.name),v=p.map((function(e){return o.get(c+"_"+e)})),y=new Promise((function(o){return dt(g,void 0,void 0,(function(){var p,y;return ht(this,(function(g){switch(g.label){case 0:return[4,Promise.all(v)];case 1:g.sent(),g.label=2;case 2:return this.runningProcesses.isOpen?(p=Math.min(r-d,i),[4,this.retrievePage(a,l,s,p,h,e)]):[2];case 3:y=g.sent(),f=y.items,s=y.nextToken,u=y.startedAt,d+=f.length,t=null===s||d>=r,n.next({namespace:c,modelDefinition:a,items:f,done:t,startedAt:u,isFullSync:!l}),g.label=4;case 4:if(!t)return[3,2];g.label=5;case 5:return o(),[2]}}))}))})),o.set(c+"_"+a.name,y),[4,y];case 1:return m.sent(),[2]}}))}))}),"adding model "+a.name)}));Promise.all(a).then((function(){n.complete()}))}))},e.prototype.stop=function(){return dt(this,void 0,void 0,(function(){return ht(this,(function(e){switch(e.label){case 0:return gt.debug("stopping sync processor"),[4,this.runningProcesses.close()];case 1:return e.sent(),[4,this.runningProcesses.open()];case 2:return e.sent(),gt.debug("sync processor stopped"),[2]}}))}))},e}(),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="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},_t=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.")},Et=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(St(arguments[t]));return e},At=Object(a.b)().isNode,Ot=new s.a("DataStore"),It=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"}(ye||(ye={}));var Tt=function(){function e(e,t,n,r,i,o,s,a,c,l,f,d,h){void 0===l&&(l={}),this.schema=e,this.namespaceResolver=t,this.modelClasses=n,this.userModelClasses=r,this.storage=i,this.modelInstanceCreator=o,this.syncPredicates=c,this.amplifyConfig=l,this.authModeStrategy=f,this.amplifyContext=d,this.connectivityMonitor=h,this.online=!1,this.modelSyncedStatus=new WeakMap,this.runningProcesses=new u.a;var p=this.modelClasses.MutationEvent;this.outbox=new Qe(this.schema,p,o,It),this.modelMerger=new He(this.outbox,It),this.syncQueriesProcessor=new mt(this.schema,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,a,this.amplifyContext),this.subscriptionsProcessor=new lt.b(this.schema,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,a,this.amplifyContext),this.mutationsProcessor=new at(this.schema,this.storage,this.userModelClasses,this.outbox,this.modelInstanceCreator,p,this.amplifyConfig,this.authModeStrategy,a,s,this.amplifyContext),this.datastoreConnectivity=this.connectivityMonitor||new Le}return e.prototype.getModelSyncedStatus=function(e){return this.modelSyncedStatus.get(e)},e.prototype.start=function(e){var t=this;return new h.a((function(n){Ot.log("starting sync engine...");var r=[];t.runningProcesses.add((function(){return bt(t,void 0,void 0,(function(){var t,i,o,s=this;return wt(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,t){s.datastoreConnectivity.status().subscribe((function(i){var o=i.online;return bt(s,void 0,void 0,(function(){var i=this;return wt(this,(function(s){return[2,this.runningProcesses.isOpen&&this.runningProcesses.add((function(s){return bt(i,void 0,void 0,(function(){var i,a,u,c,l,f=this;return wt(this,(function(d){switch(d.label){case 0:return!o||this.online?[3,10]:(this.online=o,n.next({type:ye.SYNC_ENGINE_NETWORK_STATUS,data:{active:this.online}}),a=void 0,At?(Ot.warn("Realtime disabled when in a server-side environment"),[3,6]):[3,1]);case 1:l=St(this.subscriptionsProcessor.start(),2),i=l[0],a=l[1],d.label=2;case 2:return d.trys.push([2,4,,5]),[4,new Promise((function(e,t){s.then(t);var n=i.subscribe({next:function(t){t===lt.a.CONNECTED&&e()},error:function(e){t(e),f.disconnectionHandler()(e)}});r.push(n)}))];case 3:return d.sent(),[3,5];case 4:return u=d.sent(),n.error(u),t(),[2];case 5:Ot.log("Realtime ready"),n.next({type:ye.SYNC_ENGINE_SUBSCRIPTIONS_ESTABLISHED}),d.label=6;case 6:return d.trys.push([6,8,,9]),[4,new Promise((function(e,t){var i=f.syncQueriesObservable().subscribe({next:function(t){t.type===ye.SYNC_ENGINE_SYNC_QUERIES_READY&&e(),n.next(t)},complete:function(){e()},error:function(e){t(e)}});i&&r.push(i)}))];case 7:return d.sent(),[3,9];case 8:return c=d.sent(),n.error(c),t(),[2];case 9:return r.push(this.mutationsProcessor.start().subscribe((function(e){var t=e.modelDefinition,r=e.model,i=e.hasMore;return f.runningProcesses.add((function(){return bt(f,void 0,void 0,(function(){var e,o,s=this;return wt(this,(function(a){switch(a.label){case 0:return e=this.userModelClasses[t.name],o=this.modelInstanceCreator(e,r),[4,this.storage.runExclusive((function(e){return s.modelMerger.merge(e,o,t)}))];case 1:return a.sent(),n.next({type:ye.SYNC_ENGINE_OUTBOX_MUTATION_PROCESSED,data:{model:e,element:o}}),n.next({type:ye.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:!i}}),[2]}}))}))}),"mutation processor event")}))),At||r.push(a.subscribe((function(e){var t=St(e,3),n=(t[0],t[1]),r=t[2];return f.runningProcesses.add((function(){return bt(f,void 0,void 0,(function(){var e,t,i=this;return wt(this,(function(o){switch(o.label){case 0:return e=this.userModelClasses[n.name],t=this.modelInstanceCreator(e,r),[4,this.storage.runExclusive((function(e){return i.modelMerger.merge(e,t,n)}))];case 1:return o.sent(),[2]}}))}))}),"subscription dataSubsObservable event")}))),[3,11];case 10:o||(this.online=o,n.next({type:ye.SYNC_ENGINE_NETWORK_STATUS,data:{active:this.online}}),r.forEach((function(e){return e.unsubscribe()})),r=[]),d.label=11;case 11:return e(),[2]}}))}))}),"datastore connectivity event")]}))}))}))})),this.storage.observe(null,null,It).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 bt(s,void 0,void 0,(function(){var e=this;return wt(this,(function(s){return[2,this.runningProcesses.add((function(){return bt(e,void 0,void 0,(function(){var e,s,u,c,l;return wt(this,(function(f){switch(f.label){case 0:return e=this.schema.namespaces[this.namespaceResolver(r)],s=this.modelClasses.MutationEvent,u=this.getModelDefinition(r),c=Object(k.l)(a,u),l=Object(k.d)(e.relationships,this.getModelDefinition(r),t,r,o,c,s,this.modelInstanceCreator),[4,this.outbox.enqueue(this.storage,l)];case 1:return f.sent(),n.next({type:ye.SYNC_ENGINE_OUTBOX_MUTATION_ENQUEUED,data:{model:r,element:o}}),n.next({type:ye.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:!1}}),[4,i];case 2:return f.sent(),this.online&&this.mutationsProcessor.resume(),[2]}}))}))}),"storage event")]}))}))}}),n.next({type:ye.SYNC_ENGINE_STORAGE_SUBSCRIBED}),[4,this.outbox.peek(this.storage)];case 4:return o=void 0===a.sent(),n.next({type:ye.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:o}}),[4,i];case 5:return a.sent(),n.next({type:ye.SYNC_ENGINE_READY}),[2]}}))}))}),"sync start")}))},e.prototype.getModelsMetadataWithNextFullSync=function(e){return bt(this,void 0,void 0,(function(){var t,n=this;return wt(this,(function(r){switch(r.label){case 0:return t=Map.bind,[4,this.runningProcesses.add((function(){return n.getModelsMetadata()}),"sync/index getModelsMetadataWithNextFullSync")];case 1:return[2,new(t.apply(Map,[void 0,r.sent().map((function(t){var r=t.namespace,i=t.model,o=t.lastSync,s=t.lastFullSync,a=t.fullSyncInterval,u=(t.lastSyncPredicate,!s||s+a<e?0:o);return[n.schema.namespaces[r].models[i],[r,u]]}))]))]}}))}))},e.prototype.syncQueriesObservable=function(){var e=this;return this.online?new h.a((function(t){var n;e.runningProcesses.isOpen&&e.runningProcesses.add((function(r){return bt(e,void 0,void 0,(function(){var e,i,o,s=this;return wt(this,(function(a){switch(a.label){case 0:e=!1,i=function(){var i,a,u,c,l,f,d,h,p;return wt(this,(function(v){switch(v.label){case 0:return i=new WeakMap,[4,o.getModelsMetadataWithNextFullSync(Date.now())];case 1:return a=v.sent(),u=new Set(a.keys()),[4,new Promise((function(e,o){s.runningProcesses.isOpen||e(),r.then((function(){return e()})),n=s.syncQueriesProcessor.start(a).subscribe({next:function(r){var o=r.namespace,a=r.modelDefinition,p=r.items,v=r.done,g=r.startedAt,m=r.isFullSync;return bt(s,void 0,void 0,(function(){var r,s,b,w,S,_,E=this;return wt(this,(function(A){switch(A.label){case 0:return r=this.userModelClasses[a.name],i.has(r)||(i.set(r,{new:0,updated:0,deleted:0}),f=Object(x.t)(),h=void 0===h?g:Math.max(h,g)),[4,this.storage.runExclusive((function(e){return bt(E,void 0,void 0,(function(){var t,n,o,s,u,c,l,f,d,h,v,g,m,b,w;return wt(this,(function(S){switch(S.label){case 0:return[4,this.outbox.getModelIds(e)];case 1:t=S.sent(),n=[],o=p.filter((function(e){var r=Object(k.h)(a,e);return!t.has(r)||(n.push(e),!1)})),s=[],S.label=2;case 2:S.trys.push([2,7,8,9]),u=_t(n),c=u.next(),S.label=3;case 3:return c.done?[3,6]:(l=c.value,[4,this.modelMerger.merge(e,l,a)]);case 4:void 0!==(f=S.sent())&&s.push([l,f]),S.label=5;case 5:return c=u.next(),[3,3];case 6:return[3,9];case 7:return d=S.sent(),b={error:d},[3,9];case 8:try{c&&!c.done&&(w=u.return)&&w.call(u)}finally{if(b)throw b.error}return[7];case 9:return v=(h=s.push).apply,g=[s],[4,this.modelMerger.mergePage(e,r,o,a)];case 10:return v.apply(h,g.concat([Et.apply(void 0,[S.sent()])])),m=i.get(r),s.forEach((function(e){var t=St(e,2)[1];switch(t){case y.h.INSERT:m.new++;break;case y.h.UPDATE:m.updated++;break;case y.h.DELETE:m.deleted++;break;default:Object(x.l)(t)}})),[2]}}))}))}))];case 1:return A.sent(),v?(s=a.name,[4,this.getModelMetadata(o,s)]):[3,4];case 2:return b=A.sent(),w=b.lastFullSync,S=b.fullSyncInterval,l=S,c=void 0===c?w:Math.max(c,m?g:w),b=this.modelClasses.ModelMetadata.copyOf(b,(function(e){e.lastSync=g,e.lastFullSync=m?g:b.lastFullSync})),[4,this.storage.save(b,void 0,It)];case 3:A.sent(),_=i.get(r),this.modelSyncedStatus.set(r,!0),t.next({type:ye.SYNC_ENGINE_MODEL_SYNCED,data:{model:r,isFullSync:m,isDeltaSync:!m,counts:_}}),u.delete(a),0===u.size&&(d=Object(x.t)()-f,e(),t.next({type:ye.SYNC_ENGINE_SYNC_QUERIES_READY}),n.unsubscribe()),A.label=4;case 4:return[2]}}))}))},error:function(e){t.error(e)}}),t.next({type:ye.SYNC_ENGINE_SYNC_QUERIES_STARTED,data:{models:Array.from(u).map((function(e){return e.name}))}})}))];case 2:return v.sent(),p=c+l-(h+d),Ot.debug("Next fullSync in "+p/1e3+" seconds. ("+new Date(Date.now()+p)+")"),[4,o.runningProcesses.add((function(t){return bt(s,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return r=new Promise((function(e){n=e,setTimeout(n,p)})),t.then((function(){e=!0,n()})),[2,r]}))}))}),"syncQueriesObservable sleep")];case 3:return v.sent(),[2]}}))},o=this,a.label=1;case 1:return t.closed||e?[3,3]:[5,i()];case 2:return a.sent(),[3,1];case 3:return[2]}}))}))}),"syncQueriesObservable main")})):h.a.of()},e.prototype.disconnectionHandler=function(){var e=this;return function(t){je.CONTROL_MSG.CONNECTION_CLOSED!==t&&je.CONTROL_MSG.TIMEOUT_DISCONNECT!==t||e.datastoreConnectivity.socketDisconnected()}},e.prototype.unsubscribeConnectivity=function(){this.datastoreConnectivity.unsubscribe()},e.prototype.stop=function(){return bt(this,void 0,void 0,(function(){return wt(this,(function(e){switch(e.label){case 0:return Ot.debug("stopping sync engine"),this.unsubscribeConnectivity(),[4,this.mutationsProcessor.stop()];case 1:return e.sent(),[4,this.subscriptionsProcessor.stop()];case 2:return e.sent(),[4,this.datastoreConnectivity.stop()];case 3:return e.sent(),[4,this.syncQueriesProcessor.stop()];case 4:return e.sent(),[4,this.runningProcesses.close()];case 5:return e.sent(),[4,this.runningProcesses.open()];case 6:return e.sent(),Ot.debug("sync engine stopped and ready to restart"),[2]}}))}))},e.prototype.setupModels=function(e){return bt(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,f,d,h,p=this;return wt(this,(function(v){switch(v.label){case 0:t=e.fullSyncInterval,n=this.modelClasses.ModelMetadata,r=[],Object.values(this.schema.namespaces).forEach((function(e){Object.values(e.models).filter((function(e){return e.syncable})).forEach((function(t){if(r.push([e.name,t]),e.name===x.h){var n=p.userModelClasses[t.name];p.modelSyncedStatus.set(n,!1)}}))})),o=r.map((function(e){var r=St(e,2),o=r[0],s=r[1];return bt(p,void 0,void 0,(function(){var e,r,a,u,c,l,f,d,h;return wt(this,(function(p){switch(p.label){case 0:return[4,this.getModelMetadata(o,s.name)];case 1:return e=p.sent(),r=O.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,It)];case 2:return l=St.apply(void 0,[p.sent(),1]),f=St(l[0],1),i=f[0],[3,5];case 3:return u=e.lastSyncPredicate?e.lastSyncPredicate:null,c=u!==a,[4,this.storage.save(n.copyOf(e,(function(e){e.fullSyncInterval=t,c&&(e.lastSync=null,e.lastFullSync=null,e.lastSyncPredicate=a)})))];case 4:d=St.apply(void 0,[p.sent(),1]),h=St(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=_t.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 bt(this,void 0,void 0,(function(){var e;return wt(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 bt(this,void 0,void 0,(function(){var n,r,i;return wt(this,(function(o){switch(o.label){case 0:return n=this.modelClasses.ModelMetadata,r=O.a.createFromExisting(this.schema.namespaces[x.g].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=St.apply(void 0,[o.sent(),1]),[2,i[0]]}}))}))},e.prototype.getModelDefinition=function(e){var t=this.namespaceResolver(e);return this.schema.namespaces[t].models[e.name]},e.getNamespace=function(){return{name:x.g,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 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 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)},xt=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())}))},kt=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])}}},Nt=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},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},Mt=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Rt=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(jt(arguments[t]));return e};Object(f.e)(!0),Object(f.b)();var Dt,Ut,Ft,Lt,Bt,qt=new s.a("DataStore"),zt=Object(x.O)(Date.now()),Kt=a.a.browserOrNode().isNode,Vt=new WeakMap,Ht=new WeakMap,Gt=function(e){var t=Vt.get(e);return Dt.namespaces[t].models[e.name]},Wt=function(e){return Object(x.H)(e)&&Vt.has(e)},Yt=function(e){return Vt.get(e)},Jt=function(e){var t;if(void 0!==Dt)return console.warn("The schema has already been initialized"),Ft;qt.log("validating schema",{schema:e});var n=Pt({name:x.h},e);qt.log("DataStore","Init models"),Ft=Qt(n),qt.log("DataStore","Models initialized");var r={name:x.a,relationships:{},enums:{},nonModels:{},models:{Setting:{name:"Setting",pluralName:"Settings",syncable:!1,fields:{id:{name:"id",type:"ID",isRequired:!0,isArray:!1},key:{name:"key",type:"String",isRequired:!0,isArray:!1},value:{name:"value",type:"String",isRequired:!0,isArray:!1}}}}},i=Ne.getNamespace(),o=Tt.getNamespace();return Lt=Qt(r),Bt=Qt(i),Ut=Qt(o),Dt={namespaces:(t={},t[r.name]=r,t[n.name]=n,t[i.name]=i,t[o.name]=o,t),version:e.version},Object.keys(Dt.namespaces).forEach((function(e){var t,n,r=jt(Object(x.k)(Dt.namespaces[e]),2),i=r[0],o=r[1];Dt.namespaces[e].relationships=i,Dt.namespaces[e].keys=o;var s=new Map;Object.values(Dt.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,Mt(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)}))}Dt.namespaces[e].modelTopologicalOrdering=a})),Ft},$t=function(){if(void 0===Dt){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 qt.error(e),new Error(e)}},Qt=function(e){var t={};return Object.entries(e.models).forEach((function(n){var r=jt(n,2),i=r[0],o=r[1],s=sn(o);t[i]=s,Vt.set(s,e.name)})),Object.entries(e.nonModels||{}).forEach((function(e){var n=jt(e,2),r=n[0],i=n[1],o=cn(i);t[r]=o})),t},Zt=new WeakSet;function Xt(e,t){return Zt.add(t),new e(t)}var en,tn,nn=function e(t){return function(n,r){var i=t.fields[n];if(void 0!==i){var o=i.type,s=i.isRequired,a=i.isArrayNullable,u=i.name,c=i.isArray;if((!c&&s||c&&!a)&&null==r)throw new Error("Field "+u+" is required");if(Object(y.y)(t)&&!Object(x.F)(t))if(Object(x.m)(t).includes(n)&&""===r)throw qt.error(x.j.idEmptyString,{k:n,value:r}),new Error(x.j.idEmptyString);if(Object(y.n)(o)){var l=y.c.getJSType(o),f=y.c.getValidationFunction(o);if("AWSJSON"===o){if(Ct(r)===l)return;if("string"==typeof r)try{return void JSON.parse(r)}catch(e){throw new Error("Field "+u+" is an invalid JSON object. "+r)}}if(c){var d=l;if(s||(d=l+" | null | undefined"),!Array.isArray(r)&&!a)throw new Error("Field "+u+" should be of type ["+d+"], "+Ct(r)+" received. "+r);if(!Object(x.J)(r)&&r.some((function(e){return Object(x.J)(e)?s:Ct(e)!==l}))){var h=r.map((function(e){return null===e?"null":Ct(e)})).join(",");throw new Error("All elements in the "+u+" array should be of type "+d+", ["+h+"] received. "+r)}if(f&&!Object(x.J)(r))if(!r.map((function(e){return Object(x.J)(e)?!(!Object(x.J)(e)||s):f(e)})).every((function(e){return e})))throw new Error("All elements in the "+u+" array should be of type "+o+", validation failed for one or more elements. "+r)}else{if(!s&&void 0===r)return;if(Ct(r)!==l&&null!==r)throw new Error("Field "+u+" should be of type "+l+", "+Ct(r)+" received. "+r);if(!Object(x.J)(r)&&f&&!f(r))throw new Error("Field "+u+" should be of type "+o+", validation failed. "+r)}}else if(Object(y.u)(o)&&!Object(x.J)(r)){var p=Dt.namespaces.user.nonModels[o.nonModel],v=e(p);if(c){d=o.nonModel;if(s||(d=o.nonModel+" | null | undefined"),!Array.isArray(r))throw new Error("Field "+u+" should be of type ["+d+"], "+Ct(r)+" received. "+r);r.forEach((function(e){if(Object(x.J)(e)&&s||"object"!==Ct(e)&&void 0!==e)throw new Error("All elements in the "+u+" array should be of type "+o.nonModel+", ["+Ct(e)+"] received. "+e);Object(x.J)(e)||Object.keys(p.fields).forEach((function(t){v(t,e[t])}))}))}else{if("object"!==Ct(r))throw new Error("Field "+u+" should be of type "+o.nonModel+", "+Ct(r)+" recieved. "+r);Object.keys(p.fields).forEach((function(e){v(e,r[e])}))}}}}},rn=function(e,t,n){var r=e.fields[t]||{},i=r.isArray,o=r.type;if("string"==typeof n&&(i||"AWSJSON"===o||Object(y.u)(o)||Object(y.t)(o)))try{return JSON.parse(n)}catch(e){}return"number"==typeof n&&"Boolean"===o?Boolean(n):n},on=function(e,t,n){var r=nn(t);Object.entries(e).forEach((function(e){var i=jt(e,2),o=i[0],s=i[1],a=rn(t,o,s);r(o,a),n[o]=a}))},sn=function(e){var t=function(){function n(t){return Object(f.d)(this,(function(n){on(t,e,n);var r=Zt.has(t),i=r?t:{},o=i.id;if(Object(x.F)(e)){var s=null!=o?o:e.syncable?Object(d.v4)():zt();n.id=s}else Object(x.G)(e)&&(n.id=n.id||Object(d.v4)());r||an(n,e);var a=i._version,u=i._lastChangedAt,c=i._deleted;e.syncable&&(n._version=a,n._lastChangedAt=u,n._deleted=c)}))}return n.copyOf=function(t,n){var r,i=Object.getPrototypeOf(t||{}).constructor;if(!Wt(i)){var o="The source object is not a valid model";throw qt.error(o,{source:t}),new Error(o)}var s=Object(f.d)(t,(function(r){n(r),Object(x.m)(e).forEach((function(e){return r[e]=t[e]}));var i=nn(e);Object.entries(r).forEach((function(t){var n=jt(t,2),r=n[0],o=n[1],s=rn(e,r,o);i(r,s)}))}),(function(e){return r=e})),a=Ht.has(t);if(r.length||a)if(a){var u=jt(Ht.get(t),2),c=u[0],l=u[1],d=Object(x.N)(l,c,r);Ht.set(s,[d,l]),un(d,e)}else Ht.set(s,[r,t]),un(r,e);return s},n.fromJSON=function(n){var r=this;if(Array.isArray(n))return n.map((function(e){return r.fromJSON(e)}));var i=Xt(t,n),o=nn(e);return Object.entries(i).forEach((function(e){var t=jt(e,2),n=t[0],r=t[1];o(n,r)})),i},n}();return t[f.c]=!0,Object.defineProperty(t,"name",{value:e.name}),t},an=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.")}))},un=function(e,t){var n=e.map((function(e){return[e.path[0],e.value]})),r=t.fields;n.forEach((function(e){var t=jt(e,2),n=t[0];if(t[1]&&r[n]&&r[n].isReadOnly)throw new Error(n+" is read-only.")}))},cn=function(e){var t=function(t){return Object(f.d)(this,(function(n){on(t,e,n)}))};return t[f.c]=!0,Object.defineProperty(t,"name",{value:e.name}),Object(x.P)(t),t};function ln(e){return"string"==typeof e}function fn(e){var t=e.localModel,n=e.modelConstructor,r=e.remoteModel._version;return Xt(n,Pt(Pt({},t),{_version:r}))}function dn(e){qt.warn(e)}function hn(e,t){var n;switch(e){case x.a:n=Lt[t];break;case x.h:n=Ft[t];break;case x.g:n=Ut[t];break;case x.f:n=Bt[t];break;default:Object(x.l)(e)}if(Wt(n))return n;var r="Model name is not valid for namespace. modelName: "+t+", namespace: "+e;throw qt.error(r),new Error(r)}function pn(e,t){return xt(this,void 0,void 0,(function(){var n,r,i=this;return kt(this,(function(o){switch(o.label){case 0:return n=Lt.Setting,r=Dt.namespaces[x.a].models.Setting,[4,e.runExclusive((function(e){return xt(i,void 0,void 0,(function(){var i,o;return kt(this,(function(s){switch(s.label){case 0:return[4,e.query(n,O.a.createFromExisting(r,(function(e){return e.key("eq","schemaVersion")})),{page:0,limit:1})];case 1:return i=jt.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(Xt(n,{key:"schemaVersion",value:JSON.stringify(t)}))];case 5:s.sent(),s.label=6;case 6:return[2]}}))}))}))];case 1:return o.sent(),[2]}}))}))}!function(e){e.NotRunning="Not Running",e.Starting="Starting",e.Running="Running",e.Stopping="Stopping",e.Clearing="Clearing"}(tn||(tn={}));var vn=function(){function e(){var e=this;this.Auth=i.a,this.API=r.a,this.Cache=o.a,this.amplifyConfig={},this.syncPredicates=new WeakMap,this.amplifyContext={Auth:this.Auth,API:this.API,Cache:this.Cache},this.runningProcesses=new u.a,this.state=tn.NotRunning,this.start=function(){return xt(e,void 0,void 0,(function(){var e=this;return kt(this,(function(t){return[2,this.runningProcesses.add((function(){return xt(e,void 0,void 0,(function(){var e,t,n,r=this;return kt(this,(function(i){switch(i.label){case 0:return this.state=tn.Starting,void 0!==this.initialized?[3,1]:(qt.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 Ne(Dt,Yt,hn,Xt,this.storageAdapter,this.sessionId),[4,this.storage.init()];case 4:return i.sent(),$t(),[4,pn(this.storage,Dt.version)];case 5:return i.sent(),(e=this.amplifyConfig.aws_appsync_graphqlEndpoint)?(qt.debug("GraphQL endpoint available",e),t=this,[4,this.processSyncExpressions()]):[3,7];case 6:return t.syncPredicates=i.sent(),this.sync=new Tt(Dt,Yt,Ut,Ft,this.storage,Xt,this.conflictHandler,this.errorHandler,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,this.amplifyContext,this.connectivityMonitor),n=1e3*this.fullSyncInterval*60,en=this.sync.start({fullSyncInterval:n}).subscribe({next:function(e){var t=e.type,n=e.data;t===(Kt?ye.SYNC_ENGINE_SYNC_QUERIES_READY:ye.SYNC_ENGINE_STORAGE_SUBSCRIBED)&&r.initResolve(),c.a.dispatch("datastore",{event:t,data:n})},error:function(e){qt.warn("Sync error",e),r.initReject()}}),[3,8];case 7:qt.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(),this.state=tn.Running,[2]}}))}))}),"datastore start").catch(this.handleAddProcError("DataStore.start()"))]}))}))},this.query=function(t,n,r){return xt(e,void 0,void 0,(function(){var e=this;return kt(this,(function(i){return[2,this.runningProcesses.add((function(){return xt(e,void 0,void 0,(function(){var e,i,o,s,a,u;return kt(this,(function(c){switch(c.label){case 0:return[4,this.start()];case 1:if(c.sent(),!Wt(t))throw s="Constructor is not for a valid model",qt.error(s,{modelConstructor:t}),new Error(s);if("string"==typeof n&&void 0!==r&&qt.warn("Pagination is ignored when querying by id"),e=Gt(t),i=Object(x.m)(e),ln(n)){if(i.length>1)throw s=x.j.queryByPkWithCompositeKeyPresent,qt.error(s,{keyFields:i}),new Error(s);o=O.a.createForSingleField(e,i[0],n)}else o=Object(y.o)(n,e)?O.a.createForPk(e,n):Object(O.c)(n)?void 0:O.a.createFromExisting(e,n);return a=this.processPagination(e,r),qt.debug("params ready",{modelConstructor:t,predicate:O.a.getPredicates(o,!1),pagination:Pt(Pt({},a),{sort:I.a.getPredicates(a&&a.sort,!1)})}),[4,this.storage.query(t,o,a)];case 2:return u=c.sent(),[2,ln(n)||Object(y.o)(n,e)?u[0]:u]}}))}))}),"datastore query").catch(this.handleAddProcError("DataStore.query()"))]}))}))},this.save=function(t,n){return xt(e,void 0,void 0,(function(){var e=this;return kt(this,(function(r){return[2,this.runningProcesses.add((function(){return xt(e,void 0,void 0,(function(){var e,r,i,o,s,a,u=this;return kt(this,(function(c){switch(c.label){case 0:return[4,this.start()];case 1:if(c.sent(),e=Ht.get(t),r=t?t.constructor:void 0,!Wt(r))throw i="Object is not an instance of a valid model",qt.error(i,{model:t}),new Error(i);return o=Gt(r),s=O.a.createFromExisting(o,n),[4,this.storage.runExclusive((function(n){return xt(u,void 0,void 0,(function(){return kt(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,O.a.createForPk(o,t))]}}))}))}))];case 2:return a=jt.apply(void 0,[c.sent(),1]),[2,a[0]]}}))}))}),"datastore save").catch(this.handleAddProcError("DataStore.save()"))]}))}))},this.setConflictHandler=function(t){var n=t.DataStore;return n&&n.conflictHandler?n.conflictHandler:e.conflictHandler===fn&&t.conflictHandler?t.conflictHandler:e.conflictHandler||fn},this.setErrorHandler=function(t){var n=t.DataStore;return n&&n.errorHandler?n.errorHandler:e.errorHandler===dn&&t.errorHandler?t.errorHandler:e.errorHandler||dn},this.delete=function(t,n){return xt(e,void 0,void 0,(function(){var e=this;return kt(this,(function(r){return[2,this.runningProcesses.add((function(){return xt(e,void 0,void 0,(function(){var e,r,i,o,s,a,u,c,l,f;return kt(this,(function(d){switch(d.label){case 0:return[4,this.start()];case 1:if(d.sent(),!t)throw c="Model or Model Constructor required",qt.error(c,{modelOrConstructor:t}),new Error(c);if(!Wt(t))return[3,3];if(s=t,!n)throw c="Id to delete or criteria required. Do you want to delete all? Pass Predicates.ALL",qt.error(c,{identifierOrCriteria:n}),new Error(c);if(a=Gt(s),"string"==typeof n){if((r=Object(x.m)(a)).length>1)throw c=x.j.deleteByPkWithCompositeKeyPresent,qt.error(c,{keyFields:r}),new Error(c);e=O.a.createForSingleField(Gt(s),r[0],n)}else if(!(e=Object(y.o)(n,a)?O.a.createForPk(a,n):O.a.createFromExisting(a,n))||!O.a.isValidPredicate(e))throw c="Criteria required. Do you want to delete all? Pass Predicates.ALL",qt.error(c,{condition:e}),new Error(c);return[4,this.storage.delete(s,e)];case 2:return i=jt.apply(void 0,[d.sent(),1]),[2,i[0]];case 3:if(o=t,s=Object.getPrototypeOf(o||{}).constructor,!Wt(s))throw c="Object is not an instance of a valid model",qt.error(c,{model:o}),new Error(c);if(a=Gt(s),u=O.a.createForPk(a,o),n){if("function"!=typeof n)throw c="Invalid criteria",qt.error(c,{identifierOrCriteria:n}),new Error(c);e=n(u)}else e=u;return[4,this.storage.delete(o,e)];case 4:return l=jt.apply(void 0,[d.sent(),1]),f=jt(l[0],1),[2,f[0]]}}))}))}),"datastore delete").catch(this.handleAddProcError("DataStore.delete()"))]}))}))},this.observe=function(t,n){var r,i=t&&Wt(t)?t:void 0;if(t&&void 0===i){var o=t,s=o&&Object.getPrototypeOf(o).constructor;if(Wt(s))return n&&qt.warn("idOrCriteria is ignored when using a model instance",{model:o,identifierOrCriteria:n}),e.observe(s,o.id);var a="The model is not an instance of a PersistentModelConstructor";throw qt.error(a,{model:o}),new Error(a)}if(n&&i&&Object(y.o)(n,Gt(i))){a=x.j.observeWithObjectLiteral;throw qt.error(a,{objectLiteral:n}),new Error(a)}if(void 0!==n&&void 0===i){a="Cannot provide criteria without a modelConstructor";throw qt.error(a,n),new Error(a)}if(i&&!Wt(i)){a="Constructor is not for a valid model";throw qt.error(a,{modelConstructor:i}),new Error(a)}if("string"==typeof n){var u=Gt(i),c=jt(Object(x.m)(u),1)[0];r=O.a.createForSingleField(Gt(i),c,n)}else r=Object(O.c)(n)?void 0:i&&O.a.createFromExisting(Gt(i),n);return new h.a((function(t){var n;return e.runningProcesses.add((function(){return xt(e,void 0,void 0,(function(){var e=this;return kt(this,(function(o){switch(o.label){case 0:return[4,this.start()];case 1:return o.sent(),n=this.storage.observe(i,r).filter((function(e){var t=e.model;return Yt(t)===x.h})).subscribe({next:function(n){return e.runningProcesses.isOpen&&e.runningProcesses.add((function(){return xt(e,void 0,void 0,(function(){var e,r,i,o,s;return kt(this,(function(a){switch(a.label){case 0:return e=n,"DELETE"===n.opType?[3,2]:(r=Gt(n.model),i=Object(x.m)(r),o=Object(x.o)(n.element,i),[4,this.query(n.model,o)]);case 1:s=a.sent(),e=Pt(Pt({},e),{element:s}),a.label=2;case 2:return t.next(e),[2]}}))}))}),"datastore observe message handler")},error:function(e){return t.error(e)},complete:function(){return t.complete()}}),[2]}}))}))}),"datastore observe observable initialization").catch(e.handleAddProcError("DataStore.observe()")).catch((function(e){t.error(e)})),e.runningProcesses.addCleaner((function(){return xt(e,void 0,void 0,(function(){return kt(this,(function(e){return n&&n.unsubscribe(),[2]}))}))}),"DataStore.observe() cleanup")}))},this.observeQuery=function(t,n,r){return new h.a((function(i){var o,s,a=new Map,u=new Map,l=[],f=function(){var e=S();_(e)},d=new x.c({callback:f,errorHandler:i.error,maxInterval:2e3}),h=(r||{}).sort,p=h?{sort:h}:void 0,v=Gt(t),y=Object(x.m)(v);s=ln(n)?O.a.createForSingleField(v,y[0],n):Object(O.c)(n)?void 0:O.a.createFromExisting(v,n);var g=O.a.getPredicates(s,!1)||{},m=g.predicates,b=g.type,w=!!m;e.runningProcesses.add((function(){return xt(e,void 0,void 0,(function(){var e,r=this;return kt(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,this.query(t,n,p)];case 1:return s.sent().forEach((function(e){var n=Gt(t),r=Object(k.h)(n,e);a.set(r,e)})),o=this.observe(t).subscribe((function(e){var t,n,i=e.element,o=e.model,s=e.opType,c=Gt(o),f=Object(k.h)(c,i);if(w&&!Object(x.S)(i,b,m)){if("UPDATE"!==s||!a.has(f)&&!u.has(f))return;l.push(f)}"DELETE"===s?l.push(f):u.set(f,i);var h=null!==(n=null===(t=r.sync)||void 0===t?void 0:t.getModelSyncedStatus(o))&&void 0!==n&&n;(u.size-l.length>=r.syncPageSize||h)&&d.resolve(),d.start()})),f(),[3,3];case 2:return e=s.sent(),i.error(e),[3,3];case 3:return[2]}}))}))}),"datastore observequery startup").catch(e.handleAddProcError("DataStore.observeQuery()")).catch((function(e){i.error(e)}));var S=function(){var n,i,o=null!==(i=null===(n=e.sync)||void 0===n?void 0:n.getModelSyncedStatus(t))&&void 0!==i&&i,s=Rt(Array.from(a.values()),Array.from(u.values()));return(null==r?void 0:r.sort)&&E(s),a.clear(),s.forEach((function(e){var n=Gt(t),r=Object(k.h)(n,e);a.set(r,e)})),l.forEach((function(e){return a.delete(e)})),{items:Array.from(a.values()),isSynced:o}},_=function(e){i.next(e),u.clear(),l=[]},E=function(n){var i=Gt(t),o=e.processPagination(i,r),s=I.a.getPredicates(o.sort);if(s.length){var a=Object(x.Q)(s);n.sort(a)}};return c.a.listen("datastore",(function e(n){var r,i=n.payload,o=i.event,s=i.data;o===ye.SYNC_ENGINE_MODEL_SYNCED&&(null===(r=null==s?void 0:s.model)||void 0===r?void 0:r.name)===t.name&&(f(),c.a.remove("datastore",e))})),e.runningProcesses.addCleaner((function(){return xt(e,void 0,void 0,(function(){return kt(this,(function(e){return o&&o.unsubscribe(),[2]}))}))}),"datastore observequery cleaner")}))},this.configure=function(t){void 0===t&&(t={}),e.amplifyContext.Auth=e.Auth,e.amplifyContext.API=e.API,e.amplifyContext.Cache=e.Cache;var n=t.DataStore,r=t.authModeStrategyType,i=(t.conflictHandler,t.errorHandler,t.maxRecordsToSync),o=t.syncPageSize,s=t.fullSyncInterval,a=t.syncExpressions,u=t.authProviders,c=t.storageAdapter,l=Nt(t,["DataStore","authModeStrategyType","conflictHandler","errorHandler","maxRecordsToSync","syncPageSize","fullSyncInterval","syncExpressions","authProviders","storageAdapter"]);switch(e.amplifyConfig=Pt(Pt({},l),e.amplifyConfig),e.conflictHandler=e.setConflictHandler(t),e.errorHandler=e.setErrorHandler(t),n&&n.authModeStrategyType||r||y.a.DEFAULT){case y.a.MULTI_AUTH:e.authModeStrategy=E(e.amplifyContext);break;case y.a.DEFAULT:default:e.authModeStrategy=A}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()}}return e.prototype.getModuleName=function(){return"DataStore"},e.prototype.handleAddProcError=function(e){var t=this;return function(n){throw n.message.startsWith("BackgroundManagerNotOpenError")?new Error(["DataStoreStateError: Tried to execute `"+e+'` while DataStore was "'+t.state+'".','This can only be done while DataStore is "Started" or "Stopped". To remedy:',"Ensure all calls to `stop()` and `clear()` have completed first.","If this is not possible, retry the operation until it succeeds."].join("\n")):n}},e.prototype.clear=function(){return xt(this,void 0,void 0,(function(){return kt(this,(function(e){switch(e.label){case 0:return $t(),this.state=tn.Clearing,[4,this.runningProcesses.close()];case 1:return e.sent(),void 0!==this.storage?[3,3]:(this.storage=new Ne(Dt,Yt,hn,Xt,this.storageAdapter,this.sessionId),[4,this.storage.init()]);case 2:e.sent(),e.label=3;case 3:return en&&!en.closed&&en.unsubscribe(),this.sync?[4,this.sync.stop()]:[3,5];case 4:e.sent(),e.label=5;case 5:return[4,this.storage.clear()];case 6:return e.sent(),this.initialized=void 0,this.storage=void 0,this.sync=void 0,this.syncPredicates=new WeakMap,[4,this.runningProcesses.open()];case 7:return e.sent(),this.state=tn.NotRunning,[2]}}))}))},e.prototype.stop=function(){return xt(this,void 0,void 0,(function(){return kt(this,(function(e){switch(e.label){case 0:return this.state=tn.Stopping,[4,this.runningProcesses.close()];case 1:return e.sent(),en&&!en.closed&&en.unsubscribe(),this.sync?[4,this.sync.stop()]:[3,3];case 2:e.sent(),e.label=3;case 3:return this.initialized=void 0,this.sync=void 0,[4,this.runningProcesses.open()];case 4:return e.sent(),this.state=tn.NotRunning,[2]}}))}))},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=I.a.createFromExisting(e,t.sort)),{limit:i,page:o,sort:n}}},e.prototype.processSyncExpressions=function(){return xt(this,void 0,void 0,(function(){var e,t=this;return kt(this,(function(n){switch(n.label){case 0:return this.syncExpressions&&this.syncExpressions.length?[4,Promise.all(this.syncExpressions.map((function(e){return xt(t,void 0,void 0,(function(){var t,n,r,i,o,s;return kt(this,(function(a){switch(a.label){case 0:return[4,e];case 1:return t=a.sent(),n=t.modelConstructor,r=t.conditionProducer,i=Gt(n),[4,this.unwrapPromise(r)];case 2:return o=a.sent(),Object(O.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 O.a.createFromExisting(e,t)}catch(e){throw qt.error("Error creating Sync Predicate"),e}},e.prototype.unwrapPromise=function(e){return xt(this,void 0,void 0,(function(){var t;return kt(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=jt(t,2),r=n[0],i=n[1];if(e.has(r)){var o=r.name;return qt.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+"-"+jt(t.split("."),1)[0]}}catch(e){}},e}(),yn=new vn;l.a.register(yn);var gn={USER:x.h,traverseModel:x.R,validatePredicate:x.S,isNonModelConstructor:x.I,isModelConstructor:x.H}},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}));const r=e=>"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):(e=>{const t=[];for(let n=0,r=e.length;n<r;n++){const r=e.charCodeAt(n);if(r<128)t.push(r);else if(r<2048)t.push(r>>6|192,63&r|128);else if(n+1<e.length&&55296==(64512&r)&&56320==(64512&e.charCodeAt(n+1))){const i=65536+((1023&r)<<10)+(1023&e.charCodeAt(++n));t.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}else t.push(r>>12|224,r>>6&63|128,63&r|128)}return Uint8Array.from(t)})(e),i=e=>"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):(e=>{let t="";for(let n=0,r=e.length;n<r;n++){const r=e[n];if(r<128)t+=String.fromCharCode(r);else if(192<=r&&r<224){const i=e[++n];t+=String.fromCharCode((31&r)<<6|63&i)}else if(240<=r&&r<365){const i="%"+[r,e[++n],e[++n],e[++n]].map(e=>e.toString(16)).join("%");t+=decodeURIComponent(i)}else t+=String.fromCharCode((15&r)<<12|(63&e[++n])<<6|63&e[++n])}return t})(e)},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r,i,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){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.")},c=function(){function e(){this._state=i.Open,this.jobs=new Set}return e.prototype.add=function(t,n){var r,i;"string"==typeof t?(r=void 0,i=t):(r=t,i=n);var o=this.closedFailure(i);if(o)return o;if(void 0===r)return this.addHook(i);if("function"==typeof r)return this.addFunction(r,i);if(r instanceof e)return this.addManager(r,i);throw new Error("If `job` is provided, it must be an Observable, Function, or BackgroundProcessManager.")},e.prototype.addCleaner=function(e,t){var n=this,r=this.addHook(t),i=r.resolve,o=function(){return s(n,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,e()];case 1:return t.sent(),i(),[2]}}))}))};return r.onTerminate.then(o),o},e.prototype.addFunction=function(e,t){var n,r=e(new Promise((function(e){n=e})));return"function"==typeof(null==r?void 0:r.then)&&this.registerPromise(r,n,t),r},e.prototype.addManager=function(e,t){var n=this;this.addCleaner((function(){return s(n,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,e.close()];case 1:return[2,t.sent()]}}))}))}),t)},e.prototype.addHook=function(e){var t,n,r,i=new Promise((function(e,r){t=e,n=r})),o=new Promise((function(e){r=e}));return this.registerPromise(i,r,e),{resolve:t,reject:n,onTerminate:o}},e.prototype.registerPromise=function(e,t,n){var r=this,i={promise:e,terminate:t,description:n};this.jobs.add(i),e.then((function(){r.jobs.delete(i)})).catch((function(){r.jobs.delete(i)}))},Object.defineProperty(e.prototype,"length",{get:function(){return this.jobs.size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pending",{get:function(){return Array.from(this.jobs).map((function(e){return e.description}))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isOpen",{get:function(){return this._state===i.Open},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isClosing",{get:function(){return this._state===i.Closing},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isClosed",{get:function(){return this._state===i.Closed},enumerable:!0,configurable:!0}),e.prototype.closedFailure=function(e){if(!this.isOpen)return Promise.reject(new l(["The manager is "+this.state+".",'You tried to add "'+e+'".',"Pending jobs: [\n"+this.pending.map((function(e){return" "+e})).join(",\n")+"\n]"].join("\n")))},e.prototype.close=function(){return s(this,void 0,void 0,(function(){var e,t,n,r,o;return a(this,(function(s){switch(s.label){case 0:if(!this.isOpen)return[3,2];this._state=i.Closing;try{for(e=u(Array.from(this.jobs)),t=e.next();!t.done;t=e.next()){n=t.value;try{n.terminate()}catch(e){console.warn("Failed to send termination signal to job. Error: "+e.message,n)}}}catch(e){r={error:e}}finally{try{t&&!t.done&&(o=e.return)&&o.call(e)}finally{if(r)throw r.error}}return this._closingPromise=Promise.allSettled(Array.from(this.jobs).map((function(e){return e.promise}))),[4,this._closingPromise];case 1:s.sent(),this._state=i.Closed,s.label=2;case 2:return[2,this._closingPromise]}}))}))},e.prototype.open=function(){return s(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return this.isClosing?[4,this.close()]:[3,2];case 1:e.sent(),e.label=2;case 2:return this._state=i.Open,[2]}}))}))},e}(),l=function(e){function t(t){return e.call(this,"BackgroundManagerNotOpenError: "+t)||this}return o(t,e),t}(Error);!function(e){e.Open="Open",e.Closing="Closing",e.Closed="Closed"}(i||(i={}))},,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"d",(function(){return h})),n.d(t,"b",(function(){return p})),n.d(t,"c",(function(){return v}));var r=n(21);function i(e){return(i="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 o,s=(o=function(e,t){return(o=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}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},u=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},c=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=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(c(arguments[t]));return e},f=new r.a("Util"),d=function(e){function t(t){var n=e.call(this,t)||this;return n.nonRetryable=!0,n}return s(t,e),t}(Error);function h(e,t,n,r){return a(this,void 0,void 0,(function(){var o=this;return u(this,(function(s){if("function"!=typeof e)throw Error("functionToRetry must be a function");return[2,new Promise((function(s,c){return a(o,void 0,void 0,(function(){var o,a,d,h,p,v,y;return u(this,(function(g){switch(g.label){case 0:o=0,a=!1,h=function(){},r&&r.then((function(){a=!0,clearTimeout(d),h()})),v=function(){var r,i,v,y;return u(this,(function(u){switch(u.label){case 0:o++,f.debug(e.name+" attempt #"+o+" with this vars: "+JSON.stringify(t)),u.label=1;case 1:return u.trys.push([1,3,,7]),r={},i=s,[4,e.apply(void 0,l(t))];case 2:return[2,(r.value=i.apply(void 0,[u.sent()]),r)];case 3:return v=u.sent(),p=v,f.debug("error on "+e.name,v),(g=v)&&g.nonRetryable?(f.debug(e.name+" non retryable error",v),[2,{value:c(v)}]):(y=n(o,t,v),f.debug(e.name+" retrying in "+y+" ms"),!1===y||a?[2,{value:c(v)}]:[3,4]);case 4:return[4,new Promise((function(e){h=e,d=setTimeout(h,y)}))];case 5:u.sent(),u.label=6;case 6:return[3,7];case 7:return[2]}var g}))},g.label=1;case 1:return a?[3,3]:[5,v()];case 2:return"object"===i(y=g.sent())?[2,y.value]:[3,1];case 3:return c(p),[2]}}))}))}))]}))}))}function p(e){void 0===e&&(e=3e5);return function(t){var n=100*Math.pow(2,t)+100*Math.random();return!(n>e)&&n}}var v=function(e,t,n,r){return void 0===n&&(n=3e5),h(e,t,p(n),r)}},function(e,t,n){"use strict";n.d(t,"a",(function(){return Xi}));var r=n(21),i=n(65),o=n(16),s=n(153),a=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},u=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},c=new r.a("CognitoCredentials"),l=new Promise((function(e,t){return Object(o.b)().isBrowser?(window.gapi&&window.gapi.auth2?window.gapi.auth2:null)?(c.debug("google api already loaded"),e()):void setTimeout((function(){return e()}),2e3):(c.debug("not in the browser, directly resolved"),e())})),f=function(){function e(){this.initialized=!1,this.refreshGoogleToken=this.refreshGoogleToken.bind(this),this._refreshGoogleTokenImpl=this._refreshGoogleTokenImpl.bind(this)}return e.prototype.refreshGoogleToken=function(){return a(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return this.initialized?[3,2]:(c.debug("need to wait for the Google SDK loaded"),[4,l]);case 1:e.sent(),this.initialized=!0,c.debug("finish waiting"),e.label=2;case 2:return[2,this._refreshGoogleTokenImpl()]}}))}))},e.prototype._refreshGoogleTokenImpl=function(){var e=null;return Object(o.b)().isBrowser&&(e=window.gapi&&window.gapi.auth2?window.gapi.auth2:null),e?new Promise((function(t,n){e.getAuthInstance().then((function(e){e||(c.debug("google Auth undefined"),n(new s.a("google Auth undefined")));var r=e.currentUser.get();r.isSignedIn()?(c.debug("refreshing the google access token"),r.reloadAuthResponse().then((function(e){var n=e.id_token,r=e.expires_at;t({token:n,expires_at:r})})).catch((function(e){e&&"network_error"===e.error?n("Network error reloading google auth response"):n(new s.a("Failed to reload google auth response"))}))):n(new s.a("User is not signed in with Google"))})).catch((function(e){c.debug("Failed to refresh google token",e),n(new s.a("Failed to refresh google token"))}))})):(c.debug("no gapi auth2 available"),Promise.reject("no gapi auth2 available"))},e}(),d=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},h=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},p=new r.a("CognitoCredentials"),v=new Promise((function(e,t){return Object(o.b)().isBrowser?window.FB?(p.debug("FB SDK already loaded"),e()):void setTimeout((function(){return e()}),2e3):(p.debug("not in the browser, directly resolved"),e())})),y=function(){function e(){this.initialized=!1,this.refreshFacebookToken=this.refreshFacebookToken.bind(this),this._refreshFacebookTokenImpl=this._refreshFacebookTokenImpl.bind(this)}return e.prototype.refreshFacebookToken=function(){return d(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return this.initialized?[3,2]:(p.debug("need to wait for the Facebook SDK loaded"),[4,v]);case 1:e.sent(),this.initialized=!0,p.debug("finish waiting"),e.label=2;case 2:return[2,this._refreshFacebookTokenImpl()]}}))}))},e.prototype._refreshFacebookTokenImpl=function(){var e=null;if(Object(o.b)().isBrowser&&(e=window.FB),!e){return p.debug("no fb sdk available"),Promise.reject(new s.a("no fb sdk available"))}return new Promise((function(t,n){e.getLoginStatus((function(e){if(e&&e.authResponse){var r=e.authResponse,i=r.accessToken,o=1e3*r.expiresIn+(new Date).getTime();if(!i){a="the jwtToken is undefined";p.debug(a),n(new s.a(a))}t({token:i,expires_at:o})}else{var a="no response from facebook when refreshing the jwt token";p.debug(a),n(new s.a(a))}}),{scope:"public_profile,email"})}))},e}(),g=new f,m=new y,b=n(37),w=n(1),S=function(e,t){return(S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function _(e,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}S(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var E=function(){return(E=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function A(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 O(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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}Object.create;function I(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 T,C,P,x,k,N,j,M,R,D,U,F,L,B,q,z,K,V,H,G,W,Y,J,$,Q,Z,X,ee,te,ne,re,ie,oe,se,ae,ue,ce,le,fe,de,he,pe,ve,ye,ge,me,be,we,Se,_e,Ee,Ae,Oe,Ie,Te,Ce,Pe;Object.create;!function(e){e.AUTHENTICATED_ROLE="AuthenticatedRole",e.DENY="Deny"}(T||(T={})),(C||(C={})).filterSensitiveLog=function(e){return E({},e)},(P||(P={})).filterSensitiveLog=function(e){return E({},e)},(x||(x={})).filterSensitiveLog=function(e){return E({},e)},(k||(k={})).filterSensitiveLog=function(e){return E({},e)},(N||(N={})).filterSensitiveLog=function(e){return E({},e)},(j||(j={})).filterSensitiveLog=function(e){return E({},e)},(M||(M={})).filterSensitiveLog=function(e){return E({},e)},(R||(R={})).filterSensitiveLog=function(e){return E({},e)},(D||(D={})).filterSensitiveLog=function(e){return E({},e)},(U||(U={})).filterSensitiveLog=function(e){return E({},e)},function(e){e.ACCESS_DENIED="AccessDenied",e.INTERNAL_SERVER_ERROR="InternalServerError"}(F||(F={})),(L||(L={})).filterSensitiveLog=function(e){return E({},e)},(B||(B={})).filterSensitiveLog=function(e){return E({},e)},(q||(q={})).filterSensitiveLog=function(e){return E({},e)},(z||(z={})).filterSensitiveLog=function(e){return E({},e)},(K||(K={})).filterSensitiveLog=function(e){return E({},e)},(V||(V={})).filterSensitiveLog=function(e){return E({},e)},(H||(H={})).filterSensitiveLog=function(e){return E({},e)},(G||(G={})).filterSensitiveLog=function(e){return E({},e)},(W||(W={})).filterSensitiveLog=function(e){return E({},e)},(Y||(Y={})).filterSensitiveLog=function(e){return E({},e)},(J||(J={})).filterSensitiveLog=function(e){return E({},e)},($||($={})).filterSensitiveLog=function(e){return E({},e)},(Q||(Q={})).filterSensitiveLog=function(e){return E({},e)},(Z||(Z={})).filterSensitiveLog=function(e){return E({},e)},(X||(X={})).filterSensitiveLog=function(e){return E({},e)},function(e){e.CONTAINS="Contains",e.EQUALS="Equals",e.NOT_EQUAL="NotEqual",e.STARTS_WITH="StartsWith"}(ee||(ee={})),(te||(te={})).filterSensitiveLog=function(e){return E({},e)},(ne||(ne={})).filterSensitiveLog=function(e){return E({},e)},function(e){e.RULES="Rules",e.TOKEN="Token"}(re||(re={})),(ie||(ie={})).filterSensitiveLog=function(e){return E({},e)},(oe||(oe={})).filterSensitiveLog=function(e){return E({},e)},(se||(se={})).filterSensitiveLog=function(e){return E({},e)},(ae||(ae={})).filterSensitiveLog=function(e){return E({},e)},(ue||(ue={})).filterSensitiveLog=function(e){return E({},e)},(ce||(ce={})).filterSensitiveLog=function(e){return E({},e)},(le||(le={})).filterSensitiveLog=function(e){return E({},e)},(fe||(fe={})).filterSensitiveLog=function(e){return E({},e)},(de||(de={})).filterSensitiveLog=function(e){return E({},e)},(he||(he={})).filterSensitiveLog=function(e){return E({},e)},(pe||(pe={})).filterSensitiveLog=function(e){return E({},e)},(ve||(ve={})).filterSensitiveLog=function(e){return E({},e)},(ye||(ye={})).filterSensitiveLog=function(e){return E({},e)},(ge||(ge={})).filterSensitiveLog=function(e){return E({},e)},(me||(me={})).filterSensitiveLog=function(e){return E({},e)},(be||(be={})).filterSensitiveLog=function(e){return E({},e)},(we||(we={})).filterSensitiveLog=function(e){return E({},e)},(Se||(Se={})).filterSensitiveLog=function(e){return E({},e)},(_e||(_e={})).filterSensitiveLog=function(e){return E({},e)},(Ee||(Ee={})).filterSensitiveLog=function(e){return E({},e)},(Ae||(Ae={})).filterSensitiveLog=function(e){return E({},e)},(Oe||(Oe={})).filterSensitiveLog=function(e){return E({},e)},(Ie||(Ie={})).filterSensitiveLog=function(e){return E({},e)},(Te||(Te={})).filterSensitiveLog=function(e){return E({},e)},(Ce||(Ce={})).filterSensitiveLog=function(e){return E({},e)},(Pe||(Pe={})).filterSensitiveLog=function(e){return E({},e)};var xe=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}(),ke=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(w.__assign)(Object(w.__assign)({},this),{headers:Object(w.__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(w.__assign)(Object(w.__assign)({},e),((r={})[n]=Array.isArray(i)?Object(w.__spread)(i):i,r))}),{}))),n},e}();var Ne=function(e,t){return A(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return O(this,(function(g){switch(g.label){case 0:return r=[E({},e)],y={},[4,at(e.body,t)];case 1:switch(n=E.apply(void 0,r.concat([(y.body=g.sent(),y)])),o="UnknownError",o=ut(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,Me(n,t)];case 3:return i=E.apply(void 0,[E.apply(void 0,s.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 4:return a=[{}],[4,Re(n,t)];case 5:return i=E.apply(void 0,[E.apply(void 0,a.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 6:return u=[{}],[4,De(n,t)];case 7:return i=E.apply(void 0,[E.apply(void 0,u.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 8:return c=[{}],[4,Ue(n,t)];case 9:return i=E.apply(void 0,[E.apply(void 0,c.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 10:return l=[{}],[4,Le(n,t)];case 11:return i=E.apply(void 0,[E.apply(void 0,l.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 12:return f=[{}],[4,Be(n,t)];case 13:return i=E.apply(void 0,[E.apply(void 0,f.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 14:return d=[{}],[4,qe(n,t)];case 15:return i=E.apply(void 0,[E.apply(void 0,d.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 16:return h=[{}],[4,ze(n,t)];case 17:return i=E.apply(void 0,[E.apply(void 0,h.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=E(E({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:it(e)}),g.label=19;case 19:return v=i.message||i.Message||o,i.message=v,delete i.Message,[2,Promise.reject(Object.assign(new Error(v),i))]}}))}))},je=function(e,t){return A(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return O(this,(function(g){switch(g.label){case 0:return r=[E({},e)],y={},[4,at(e.body,t)];case 1:switch(n=E.apply(void 0,r.concat([(y.body=g.sent(),y)])),o="UnknownError",o=ut(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,Me(n,t)];case 3:return i=E.apply(void 0,[E.apply(void 0,s.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 4:return a=[{}],[4,Re(n,t)];case 5:return i=E.apply(void 0,[E.apply(void 0,a.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 6:return u=[{}],[4,Ue(n,t)];case 7:return i=E.apply(void 0,[E.apply(void 0,u.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 8:return c=[{}],[4,Fe(n,t)];case 9:return i=E.apply(void 0,[E.apply(void 0,c.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 10:return l=[{}],[4,Le(n,t)];case 11:return i=E.apply(void 0,[E.apply(void 0,l.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 12:return f=[{}],[4,Be(n,t)];case 13:return i=E.apply(void 0,[E.apply(void 0,f.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 14:return d=[{}],[4,qe(n,t)];case 15:return i=E.apply(void 0,[E.apply(void 0,d.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 16:return h=[{}],[4,ze(n,t)];case 17:return i=E.apply(void 0,[E.apply(void 0,h.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=E(E({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:it(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))]}}))}))},Me=function(e,t){return A(void 0,void 0,void 0,(function(){var n,r;return O(this,(function(i){return n=e.body,r=We(n,t),[2,E({name:"ExternalServiceException",$fault:"client",$metadata:it(e)},r)]}))}))},Re=function(e,t){return A(void 0,void 0,void 0,(function(){var n,r;return O(this,(function(i){return n=e.body,r=$e(n,t),[2,E({name:"InternalErrorException",$fault:"server",$metadata:it(e)},r)]}))}))},De=function(e,t){return A(void 0,void 0,void 0,(function(){var n,r;return O(this,(function(i){return n=e.body,r=Qe(n,t),[2,E({name:"InvalidIdentityPoolConfigurationException",$fault:"client",$metadata:it(e)},r)]}))}))},Ue=function(e,t){return A(void 0,void 0,void 0,(function(){var n,r;return O(this,(function(i){return n=e.body,r=Ze(n,t),[2,E({name:"InvalidParameterException",$fault:"client",$metadata:it(e)},r)]}))}))},Fe=function(e,t){return A(void 0,void 0,void 0,(function(){var n,r;return O(this,(function(i){return n=e.body,r=Xe(n,t),[2,E({name:"LimitExceededException",$fault:"client",$metadata:it(e)},r)]}))}))},Le=function(e,t){return A(void 0,void 0,void 0,(function(){var n,r;return O(this,(function(i){return n=e.body,r=et(n,t),[2,E({name:"NotAuthorizedException",$fault:"client",$metadata:it(e)},r)]}))}))},Be=function(e,t){return A(void 0,void 0,void 0,(function(){var n,r;return O(this,(function(i){return n=e.body,r=tt(n,t),[2,E({name:"ResourceConflictException",$fault:"client",$metadata:it(e)},r)]}))}))},qe=function(e,t){return A(void 0,void 0,void 0,(function(){var n,r;return O(this,(function(i){return n=e.body,r=nt(n,t),[2,E({name:"ResourceNotFoundException",$fault:"client",$metadata:it(e)},r)]}))}))},ze=function(e,t){return A(void 0,void 0,void 0,(function(){var n,r;return O(this,(function(i){return n=e.body,r=rt(n,t),[2,E({name:"TooManyRequestsException",$fault:"client",$metadata:it(e)},r)]}))}))},Ke=function(e,t){return E(E(E({},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:He(e.Logins,t)})},Ve=function(e,t){return E(E(E({},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:He(e.Logins,t)})},He=function(e,t){return Object.entries(e).reduce((function(e,t){var n,r=I(t,2),i=r[0],o=r[1];return null===o?e:E(E({},e),((n={})[i]=o,n))}),{})},Ge=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}},We=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ye=function(e,t){return{Credentials:void 0!==e.Credentials&&null!==e.Credentials?Ge(e.Credentials):void 0,IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},Je=function(e,t){return{IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},$e=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Qe=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ze=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Xe=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},et=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},tt=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},nt=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},rt=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},it=function(e){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"]}},ot=function(e,t){return void 0===e&&(e=new Uint8Array),e instanceof Uint8Array?Promise.resolve(e):t.streamCollector(e)||Promise.resolve(new Uint8Array)},st=function(e,t,n,r,i){return A(void 0,void 0,void 0,(function(){var o,s,a,u,c,l;return O(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 ke(l)]}}))}))},at=function(e,t){return function(e,t){return ot(e,t).then((function(e){return t.utf8Encoder(e)}))}(e,t).then((function(e){return e.length?JSON.parse(e):{}}))},ut=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):""},ct={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},lt={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function ft(e,t,n){return{applyToStack:function(r){r.add(function(e,t){return function(n,r){return function(r){return Object(w.__awaiter)(void 0,void 0,void 0,(function(){var i,o;return Object(w.__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),ct),r.add(function(e,t){return function(n,r){return function(r){return Object(w.__awaiter)(void 0,void 0,void 0,(function(){var i;return Object(w.__generator)(this,(function(o){switch(o.label){case 0:return[4,t(r.input,e)];case 1:return i=o.sent(),[2,n(Object(w.__assign)(Object(w.__assign)({},r),{request:i}))]}}))}))}}}(e,t),lt)}}}var dt=function(){var e=[],t=[],n=new Set,r=function(n){return e.forEach((function(e){n.add(e.middleware,Object(w.__assign)({},e))})),t.forEach((function(e){n.addRelativeTo(e.middleware,Object(w.__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(w.__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(w.__spread)(i(e)))})),t},o=function(){var n,r=[],o=[],s={};return e.forEach((function(e){var t=Object(w.__assign)(Object(w.__assign)({},e),{before:[],after:[]});t.name&&(s[t.name]=t),r.push(t)})),t.forEach((function(e){var t=Object(w.__assign)(Object(w.__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 ht[t.step]-ht[e.step]||pt[t.priority||"normal"]-pt[e.priority||"normal"]}))).map(i).reduce((function(e,t){return e.push.apply(e,Object(w.__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(w.__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(w.__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(dt())},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(dt());return t.use(e),t},applyToStack:r,resolve:function(e,t){var n,r;try{for(var i=Object(w.__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},ht={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},pt={high:3,normal:2,low:1},vt=function(){function e(e){this.middlewareStack=dt(),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}(),yt=function(){this.middlewareStack=dt()};var gt=function(){var e=Object.getPrototypeOf(this).constructor,t=Function.bind.apply(String,Object(w.__spread)([null],arguments)),n=new t;return Object.setPrototypeOf(n,e.prototype),n};gt.prototype=Object.create(String.prototype,{constructor:{value:gt,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf(gt,String);!function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Object(w.__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))}}(gt);var mt=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return _(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(ft(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetCredentialsForIdentityCommand",inputFilterSensitiveLog:W.filterSensitiveLog,outputFilterSensitiveLog:J.filterSensitiveLog},o=t.requestHandler;return r.resolve((function(e){return o.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return A(void 0,void 0,void 0,(function(){var n,r;return O(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetCredentialsForIdentity"},r=JSON.stringify(Ke(e,t)),[2,st(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return A(void 0,void 0,void 0,(function(){var n,r,i;return O(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,Ne(e,t)]:[4,at(e.body,t)];case 1:return n=o.sent(),{},r=Ye(n,t),i=E({$metadata:it(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(yt),bt=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(w.__extends)(t,e),t}(Error);function wt(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(w.__read)(t,2),r=n[0],i=n[1];return e[r]=i,e}),{})}))}function St(e){var t=this;return function(){return Object(w.__awaiter)(t,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,f,d,h;return Object(w.__generator)(this,(function(p){switch(p.label){case 0:return l=(c=e.client).send,f=mt.bind,h={CustomRoleArn:e.customRoleArn,IdentityId:e.identityId},e.logins?[4,wt(e.logins)]:[3,2];case 1:return d=p.sent(),[3,3];case 2:d=void 0,p.label=3;case 3:return[4,l.apply(c,[new(f.apply(mt,[void 0,(h.Logins=d,h)]))])];case 4:return t=p.sent().Credentials,n=void 0===t?function(){throw new bt("Response from Amazon Cognito contained no credentials")}():t,r=n.AccessKeyId,i=void 0===r?function(){throw new bt("Response from Amazon Cognito contained no access key ID")}():r,o=n.Expiration,s=n.SecretKey,a=void 0===s?function(){throw new bt("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 _t=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return _(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(ft(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 A(void 0,void 0,void 0,(function(){var n,r;return O(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetId"},r=JSON.stringify(Ve(e,t)),[2,st(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return A(void 0,void 0,void 0,(function(){var n,r,i;return O(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,je(e,t)]:[4,at(e.body,t)];case 1:return n=o.sent(),{},r=Je(n,t),i=E({$metadata:it(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(yt),Et=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}(),At=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 Ot(e){var t=this,n=e.accountId,r=e.cache,i=void 0===r?"object"==typeof self&&self.indexedDB?new Et:"object"==typeof window&&window.localStorage?window.localStorage:At:r,o=e.client,s=e.customRoleArn,a=e.identityPoolId,u=e.logins,c=e.userIdentifier,l=void 0===c?u&&0!==Object.keys(u).length?void 0:"ANONYMOUS":c,f=l?"aws:cognito-identity-credentials:"+a+":"+l:void 0,d=function(){return Object(w.__awaiter)(t,void 0,void 0,(function(){var e,t,r,c,l,h,p,v,y;return Object(w.__generator)(this,(function(g){switch(g.label){case 0:return(t=f)?[4,i.getItem(f)]:[3,2];case 1:t=g.sent(),g.label=2;case 2:return(e=t)?[3,7]:(h=(l=o).send,p=_t.bind,y={AccountId:n,IdentityPoolId:a},u?[4,wt(u)]:[3,4]);case 3:return v=g.sent(),[3,5];case 4:v=void 0,g.label=5;case 5:return[4,h.apply(l,[new(p.apply(_t,[void 0,(y.Logins=v,y)]))])];case 6:r=g.sent().IdentityId,c=void 0===r?function(){throw new bt("Response from Amazon Cognito contained no identity ID")}():r,e=c,f&&Promise.resolve(i.setItem(f,e)).catch((function(){})),g.label=7;case 7:return[2,(d=St({client:o,customRoleArn:s,logins:u,identityId:e}))()]}}))}))};return function(){return d().catch((function(e){return Object(w.__awaiter)(t,void 0,void 0,(function(){return Object(w.__generator)(this,(function(t){throw f&&Promise.resolve(i.removeItem(f)).catch((function(){})),e}))}))}))}}var It=function(e,t){return(It=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 Tt(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}It(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Ct=function(){return(Ct=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function Pt(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function xt(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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}Object.create;function kt(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 Nt,jt,Mt,Rt,Dt,Ut,Ft,Lt,Bt,qt,zt,Kt,Vt,Ht,Gt,Wt,Yt,Jt,$t,Qt,Zt,Xt,en,tn,nn,rn,on,sn,an,un,cn,ln,fn,dn,hn,pn,vn,yn,gn,mn,bn,wn,Sn,_n,En,An,On,In,Tn,Cn,Pn,xn,kn,Nn,jn,Mn,Rn;Object.create;!function(e){e.AUTHENTICATED_ROLE="AuthenticatedRole",e.DENY="Deny"}(Nt||(Nt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(jt||(jt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Mt||(Mt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Rt||(Rt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Dt||(Dt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Ut||(Ut={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Ft||(Ft={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Lt||(Lt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Bt||(Bt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(qt||(qt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(zt||(zt={})),function(e){e.ACCESS_DENIED="AccessDenied",e.INTERNAL_SERVER_ERROR="InternalServerError"}(Kt||(Kt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Vt||(Vt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Ht||(Ht={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Gt||(Gt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Wt||(Wt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Yt||(Yt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Jt||(Jt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}($t||($t={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Qt||(Qt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Zt||(Zt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Xt||(Xt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(en||(en={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(tn||(tn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(nn||(nn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(rn||(rn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(on||(on={})),function(e){e.CONTAINS="Contains",e.EQUALS="Equals",e.NOT_EQUAL="NotEqual",e.STARTS_WITH="StartsWith"}(sn||(sn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(an||(an={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(un||(un={})),function(e){e.RULES="Rules",e.TOKEN="Token"}(cn||(cn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(ln||(ln={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(fn||(fn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(dn||(dn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(hn||(hn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(pn||(pn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(vn||(vn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(yn||(yn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(gn||(gn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(mn||(mn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(bn||(bn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(wn||(wn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Sn||(Sn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(_n||(_n={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(En||(En={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(An||(An={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(On||(On={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(In||(In={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Tn||(Tn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Cn||(Cn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Pn||(Pn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(xn||(xn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(kn||(kn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Nn||(Nn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(jn||(jn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Mn||(Mn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Rn||(Rn={}));var Dn=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return xt(this,(function(g){switch(g.label){case 0:return r=[Ct({},e)],y={},[4,fr(e.body,t)];case 1:switch(n=Ct.apply(void 0,r.concat([(y.body=g.sent(),y)])),o="UnknownError",o=dr(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,Fn(n,t)];case 3:return i=Ct.apply(void 0,[Ct.apply(void 0,s.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 4:return a=[{}],[4,Ln(n,t)];case 5:return i=Ct.apply(void 0,[Ct.apply(void 0,a.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 6:return u=[{}],[4,Bn(n,t)];case 7:return i=Ct.apply(void 0,[Ct.apply(void 0,u.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 8:return c=[{}],[4,qn(n,t)];case 9:return i=Ct.apply(void 0,[Ct.apply(void 0,c.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 10:return l=[{}],[4,Kn(n,t)];case 11:return i=Ct.apply(void 0,[Ct.apply(void 0,l.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 12:return f=[{}],[4,Vn(n,t)];case 13:return i=Ct.apply(void 0,[Ct.apply(void 0,f.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 14:return d=[{}],[4,Hn(n,t)];case 15:return i=Ct.apply(void 0,[Ct.apply(void 0,d.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 16:return h=[{}],[4,Gn(n,t)];case 17:return i=Ct.apply(void 0,[Ct.apply(void 0,h.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=Ct(Ct({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:ur(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))]}}))}))},Un=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return xt(this,(function(g){switch(g.label){case 0:return r=[Ct({},e)],y={},[4,fr(e.body,t)];case 1:switch(n=Ct.apply(void 0,r.concat([(y.body=g.sent(),y)])),o="UnknownError",o=dr(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,Fn(n,t)];case 3:return i=Ct.apply(void 0,[Ct.apply(void 0,s.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 4:return a=[{}],[4,Ln(n,t)];case 5:return i=Ct.apply(void 0,[Ct.apply(void 0,a.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 6:return u=[{}],[4,qn(n,t)];case 7:return i=Ct.apply(void 0,[Ct.apply(void 0,u.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 8:return c=[{}],[4,zn(n,t)];case 9:return i=Ct.apply(void 0,[Ct.apply(void 0,c.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 10:return l=[{}],[4,Kn(n,t)];case 11:return i=Ct.apply(void 0,[Ct.apply(void 0,l.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 12:return f=[{}],[4,Vn(n,t)];case 13:return i=Ct.apply(void 0,[Ct.apply(void 0,f.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 14:return d=[{}],[4,Hn(n,t)];case 15:return i=Ct.apply(void 0,[Ct.apply(void 0,d.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 16:return h=[{}],[4,Gn(n,t)];case 17:return i=Ct.apply(void 0,[Ct.apply(void 0,h.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=Ct(Ct({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:ur(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))]}}))}))},Fn=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return xt(this,(function(i){return n=e.body,r=Qn(n,t),[2,Ct({name:"ExternalServiceException",$fault:"client",$metadata:ur(e)},r)]}))}))},Ln=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return xt(this,(function(i){return n=e.body,r=er(n,t),[2,Ct({name:"InternalErrorException",$fault:"server",$metadata:ur(e)},r)]}))}))},Bn=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return xt(this,(function(i){return n=e.body,r=tr(n,t),[2,Ct({name:"InvalidIdentityPoolConfigurationException",$fault:"client",$metadata:ur(e)},r)]}))}))},qn=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return xt(this,(function(i){return n=e.body,r=nr(n,t),[2,Ct({name:"InvalidParameterException",$fault:"client",$metadata:ur(e)},r)]}))}))},zn=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return xt(this,(function(i){return n=e.body,r=rr(n,t),[2,Ct({name:"LimitExceededException",$fault:"client",$metadata:ur(e)},r)]}))}))},Kn=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return xt(this,(function(i){return n=e.body,r=ir(n,t),[2,Ct({name:"NotAuthorizedException",$fault:"client",$metadata:ur(e)},r)]}))}))},Vn=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return xt(this,(function(i){return n=e.body,r=or(n,t),[2,Ct({name:"ResourceConflictException",$fault:"client",$metadata:ur(e)},r)]}))}))},Hn=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return xt(this,(function(i){return n=e.body,r=sr(n,t),[2,Ct({name:"ResourceNotFoundException",$fault:"client",$metadata:ur(e)},r)]}))}))},Gn=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return xt(this,(function(i){return n=e.body,r=ar(n,t),[2,Ct({name:"TooManyRequestsException",$fault:"client",$metadata:ur(e)},r)]}))}))},Wn=function(e,t){return Ct(Ct(Ct({},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:Jn(e.Logins,t)})},Yn=function(e,t){return Ct(Ct(Ct({},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:Jn(e.Logins,t)})},Jn=function(e,t){return Object.entries(e).reduce((function(e,t){var n,r=kt(t,2),i=r[0],o=r[1];return null===o?e:Ct(Ct({},e),((n={})[i]=o,n))}),{})},$n=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}},Qn=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Zn=function(e,t){return{Credentials:void 0!==e.Credentials&&null!==e.Credentials?$n(e.Credentials):void 0,IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},Xn=function(e,t){return{IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},er=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},tr=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},nr=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},rr=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},ir=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},or=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},sr=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},ar=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},ur=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"]}},cr=function(e,t){return void 0===e&&(e=new Uint8Array),e instanceof Uint8Array?Promise.resolve(e):t.streamCollector(e)||Promise.resolve(new Uint8Array)},lr=function(e,t,n,r,i){return Pt(void 0,void 0,void 0,(function(){var o,s,a,u,c,l;return xt(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 ke(l)]}}))}))},fr=function(e,t){return function(e,t){return cr(e,t).then((function(e){return t.utf8Encoder(e)}))}(e,t).then((function(e){return e.length?JSON.parse(e):{}}))},dr=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):""},hr=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return Tt(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(ft(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetIdCommand",inputFilterSensitiveLog:nn.filterSensitiveLog,outputFilterSensitiveLog:rn.filterSensitiveLog},o=t.requestHandler;return r.resolve((function(e){return o.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return xt(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetId"},r=JSON.stringify(Yn(e,t)),[2,lr(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r,i;return xt(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,Un(e,t)]:[4,fr(e.body,t)];case 1:return n=o.sent(),{},r=Xn(n,t),i=Ct({$metadata:ur(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(yt),pr=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return Tt(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(ft(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetCredentialsForIdentityCommand",inputFilterSensitiveLog:Zt.filterSensitiveLog,outputFilterSensitiveLog:en.filterSensitiveLog},o=t.requestHandler;return r.resolve((function(e){return o.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return xt(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetCredentialsForIdentity"},r=JSON.stringify(Wn(e,t)),[2,lr(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r,i;return xt(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,Dn(e,t)]:[4,fr(e.body,t)];case 1:return n=o.sent(),{},r=Zn(n,t),i=Ct({$metadata:ur(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(yt),vr=n(71),yr=n(69),gr=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,mr)},mr=function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()};for(var br=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(w.__values)(Object.keys(e).sort()),o=i.next();!o.done;o=i.next()){var s=o.value,a=e[s];if(s=gr(s),Array.isArray(a))for(var u=0,c=a.length;u<c;u++)r.push(s+"="+gr(a[u]));else{var l=s;(a||"string"==typeof a)&&(l+="="+gr(a)),r.push(l)}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r.join("&")}(e.query);s&&(o+="?"+s)}var a=e.port,u=e.method,c=e.protocol+"//"+e.hostname+(a?":"+a:"")+o,l={body:"GET"===u||"HEAD"===u?void 0:e.body,headers:new Headers(e.headers),method:u};"undefined"!=typeof AbortController&&(l.signal=n);var f,d=new Request(c,l),h=[fetch(d).then((function(e){var t,n,r=e.headers,i={};try{for(var o=Object(w.__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 xe({headers:i,statusCode:e.status,body:e.body})}:e.blob().then((function(t){return{response:new xe({headers:i,statusCode:e.status,body:t})}}))})),(f=r,void 0===f&&(f=0),new Promise((function(e,t){f&&setTimeout((function(){var e=new Error("Request did not complete within "+f+" ms");e.name="TimeoutError",t(e)}),f)})))];return n&&h.push(new Promise((function(e,t){n.onabort=function(){var e=new Error("Request aborted");e.name="AbortError",t(e)}}))),Promise.race(h)},e}(),wr={},Sr=new Array(64),_r=0,Er="A".charCodeAt(0),Ar="Z".charCodeAt(0);_r+Er<=Ar;_r++){var Or=String.fromCharCode(_r+Er);wr[Or]=_r,Sr[_r]=Or}for(_r=0,Er="a".charCodeAt(0),Ar="z".charCodeAt(0);_r+Er<=Ar;_r++){Or=String.fromCharCode(_r+Er);var Ir=_r+26;wr[Or]=Ir,Sr[Ir]=Or}for(_r=0;_r<10;_r++){wr[_r.toString(10)]=_r+52;Or=_r.toString(10),Ir=_r+52;wr[Or]=Ir,Sr[Ir]=Or}wr["+"]=62,Sr[62]="+",wr["/"]=63,Sr[63]="/";function Tr(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|=wr[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 Cr(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 Pr={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},xr=function(e){return{applyToStack:function(t){t.add(function(e){return function(t,n){return function(r){return Object(w.__awaiter)(void 0,void 0,void 0,(function(){var i;return Object(w.__generator)(this,(function(o){return(null===(i=null==e?void 0:e.retryStrategy)||void 0===i?void 0:i.mode)&&(n.userAgent=Object(w.__spread)(n.userAgent||[],[["cfg/retry-mode",e.retryStrategy.mode]])),[2,e.retryStrategy.retry(t,r)]}))}))}}}(e),Pr)}}},kr=["AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch"],Nr=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],jr=["AbortError","TimeoutError","RequestTimeout","RequestTimeoutException"],Mr=[500,502,503,504],Rr=function(e){var t,n;return 429===(null===(t=e.$metadata)||void 0===t?void 0:t.httpStatusCode)||Nr.includes(e.name)||1==(null===(n=e.$retryable)||void 0===n?void 0:n.throttling)},Dr=n(68),Ur=function(e,t){return Math.floor(Math.min(2e4,Math.random()*Math.pow(2,t)*e))},Fr=function(e){return!!e&&(function(e){return void 0!==e.$retryable}(e)||function(e){return kr.includes(e.name)}(e)||Rr(e)||function(e){var t;return jr.includes(e.name)||Mr.includes((null===(t=e.$metadata)||void 0===t?void 0:t.httpStatusCode)||0)}(e))},Lr=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:Fr,this.delayDecider=null!==(r=null==t?void 0:t.delayDecider)&&void 0!==r?r:Ur,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(w.__awaiter)(this,void 0,void 0,(function(){var e;return Object(w.__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(w.__awaiter)(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c;return Object(w.__generator)(this,(function(l){switch(l.label){case 0:return r=0,i=0,[4,this.getMaxAttempts()];case 1:o=l.sent(),s=t.request,ke.isInstance(s)&&(s.headers["amz-sdk-invocation-id"]=Object(Dr.v4)()),a=function(){var a,c,l,f,d;return Object(w.__generator)(this,(function(h){switch(h.label){case 0:return h.trys.push([0,2,,5]),ke.isInstance(s)&&(s.headers["amz-sdk-request"]="attempt="+(r+1)+"; max="+o),[4,e(t)];case 1:return a=h.sent(),c=a.response,l=a.output,u.retryQuota.releaseRetryTokens(n),l.$metadata.attempts=r+1,l.$metadata.totalRetryDelay=i,[2,{value:{response:c,output:l}}];case 2:return f=h.sent(),r++,u.shouldRetry(f,r,o)?(n=u.retryQuota.retrieveRetryTokens(f),d=u.delayDecider(Rr(f)?500:100,r),i+=d,[4,new Promise((function(e){return setTimeout(e,d)}))]):[3,4];case 3:return h.sent(),[2,"continue"];case 4:throw f.$metadata||(f.$metadata={}),f.$metadata.attempts=r,f.$metadata.totalRetryDelay=i,f;case 5:return[2]}}))},u=this,l.label=2;case 2:return[5,a()];case 3:return"object"==typeof(c=l.sent())?[2,c.value]:[3,2];case 4:return[2]}}))}))},e}(),Br=function(e){if(void 0===e&&(e=3),"number"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};var qr=n(70),zr=n.n(qr);var Kr="cognito-identity.{region}.amazonaws.com",Vr=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"]),Hr=new Set(["cn-north-1","cn-northwest-1"]),Gr=new Set(["us-iso-east-1"]),Wr=new Set(["us-isob-east-1"]),Yr=new Set(["us-gov-east-1","us-gov-west-1"]);var Jr,$r,Qr,Zr,Xr={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:Vr.has(e)&&(n={hostname:Kr.replace("{region}",e),partition:"aws"}),Hr.has(e)&&(n={hostname:"cognito-identity.{region}.amazonaws.com.cn".replace("{region}",e),partition:"aws-cn"}),Gr.has(e)&&(n={hostname:"cognito-identity.{region}.c2s.ic.gov".replace("{region}",e),partition:"aws-iso"}),Wr.has(e)&&(n={hostname:"cognito-identity.{region}.sc2s.sgov.gov".replace("{region}",e),partition:"aws-iso-b"}),Yr.has(e)&&(n={hostname:"cognito-identity.{region}.amazonaws.com".replace("{region}",e),partition:"aws-us-gov"}),void 0===n&&(n={hostname:Kr.replace("{region}",e),partition:"aws"})}return Promise.resolve(Ct({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(w.__values)(e.split("&")),o=i.next();!o.done;o=i.next()){var s=o.value,a=Object(w.__read)(s.split("="),2),u=a[0],c=a[1],l=void 0===c?null:c;u=decodeURIComponent(u),l&&(l=decodeURIComponent(l)),u in r?Array.isArray(r[u])?r[u].push(l):r[u]=[r[u],l]:r[u]=l}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}(a)),{hostname:r,port:o?parseInt(o):void 0,protocol:s,path:i,query:t}}},ei=Ct(Ct({},Xr),{runtime:"browser",base64Decoder:Tr,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+=Sr[(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:($r={serviceId:Xr.serviceId,clientVersion:vr.version},Qr=$r.serviceId,Zr=$r.clientVersion,function(){return Object(w.__awaiter)(void 0,void 0,void 0,(function(){var e,t,n,r,i,o,s,a,u;return Object(w.__generator)(this,(function(c){return e=(null===(n=null===window||void 0===window?void 0:window.navigator)||void 0===n?void 0:n.userAgent)?zr.a.parse(window.navigator.userAgent):void 0,t=[["aws-sdk-js",Zr],["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")]],Qr&&t.push(["api/"+Qr,Zr]),[2,t]}))}))}),maxAttempts:3,region:(Jr="Region is missing",function(){return Promise.reject(Jr)}),requestHandler:new br,sha256:yr.Sha256,streamCollector:function(e){return"function"==typeof Blob&&e instanceof Blob?function(e){return Object(w.__awaiter)(this,void 0,void 0,(function(){var t,n;return Object(w.__generator)(this,(function(r){switch(r.label){case 0:return[4,Cr(e)];case 1:return t=r.sent(),n=Tr(t),[2,new Uint8Array(n)]}}))}))}(e):function(e){return Object(w.__awaiter)(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return Object(w.__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: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)},utf8Encoder: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)}}),ti=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},ni=function(e){return Object(w.__awaiter)(void 0,void 0,void 0,(function(){var t,n,r,i,o;return Object(w.__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)]}}))}))},ri=function(e){if("string"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};var ii={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},oi=function(e){return{applyToStack:function(t){t.add(function(e){var t=this;return function(n){return function(r){return Object(w.__awaiter)(t,void 0,void 0,(function(){var t,i,o,s,a;return Object(w.__generator)(this,(function(u){return t=r.request,ke.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(w.__assign)(Object(w.__assign)({},t.headers),((a={})["content-length"]=String(s),a)))),[2,n(Object(w.__assign)(Object(w.__assign)({},r),{request:t}))]}))}))}}}(e.bodyLengthChecker),ii)}}};for(var si={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},ai=function(e){return{applyToStack:function(t){t.add(function(e){return function(t){return function(n){return Object(w.__awaiter)(void 0,void 0,void 0,(function(){var r,i;return Object(w.__generator)(this,(function(o){return ke.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),si)}}},ui={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},ci=function(e){return{applyToStack:function(e){e.add((function(e,t){return function(n){return Object(w.__awaiter)(void 0,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,f;return Object(w.__generator)(this,(function(d){switch(d.label){case 0:return r=t.clientName,i=t.commandName,o=t.inputFilterSensitiveLog,s=t.logger,a=t.outputFilterSensitiveLog,[4,e(n)];case 1:return u=d.sent(),s?("function"==typeof s.info&&(c=u.output,l=c.$metadata,f=Object(w.__rest)(c,["$metadata"]),s.info({clientName:r,commandName:i,input:o(n.input),output:a(f),metadata:l})),[2,u]):[2,u]}}))}))}}),ui)}}},li={},fi={},di=0;di<256;di++){var hi=di.toString(16).toLowerCase();1===hi.length&&(hi="0"+hi),li[di]=hi,fi[hi]=di}function pi(e){for(var t="",n=0;n<e.byteLength;n++)t+=li[e[n]];return t}var vi="X-Amz-Date".toLowerCase(),yi=["authorization",vi,"date"],gi="X-Amz-Signature".toLowerCase(),mi="X-Amz-Security-Token".toLowerCase(),bi={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},wi=/^proxy-/,Si=/^sec-/,_i="AWS4-HMAC-SHA256-PAYLOAD",Ei={},Ai=[];function Oi(e,t,n){return e+"/"+t+"/"+n+"/aws4_request"}function Ii(e,t,n){var r=new e(t);return r.update(n),r.digest()}function Ti(e,t,n){var r,i,o=e.headers,s={};try{for(var a=Object(w.__values)(Object.keys(o).sort()),u=a.next();!u.done;u=a.next()){var c=u.value,l=c.toLowerCase();(l in bi||(null==t?void 0:t.has(l))||wi.test(l)||Si.test(l))&&(!n||n&&!n.has(l))||(s[l]=o[c].trim().replace(/\s+/g," "))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return s}var Ci=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,Pi)},Pi=function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()};function xi(e,t){var n=e.headers,r=e.body;return Object(w.__awaiter)(this,void 0,void 0,(function(){var e,i,o,s,a,u,c;return Object(w.__generator)(this,(function(l){switch(l.label){case 0:try{for(e=Object(w.__values)(Object.keys(n)),i=e.next();!i.done;i=e.next())if("x-amz-content-sha256"===(o=i.value).toLowerCase())return[2,n[o]]}catch(e){u={error:e}}finally{try{i&&!i.done&&(c=e.return)&&c.call(e)}finally{if(u)throw u.error}}return null!=r?[3,1]:[2,"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"];case 1:return"string"==typeof r||ArrayBuffer.isView(r)||(f=r,"function"==typeof ArrayBuffer&&f instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(f))?((s=new t).update(r),a=pi,[4,s.digest()]):[3,3];case 2:return[2,a.apply(void 0,[l.sent()])];case 3:return[2,"UNSIGNED-PAYLOAD"]}var f}))}))}function ki(e){var t=e.headers,n=e.query,r=Object(w.__rest)(e,["headers","query"]);return Object(w.__assign)(Object(w.__assign)({},r),{headers:Object(w.__assign)({},t),query:n?Ni(n):void 0})}function Ni(e){return Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object(w.__assign)(Object(w.__assign)({},t),((r={})[n]=Array.isArray(i)?Object(w.__spread)(i):i,r))}),{})}function ji(e){var t,n;e="function"==typeof e.clone?e.clone():ki(e);try{for(var r=Object(w.__values)(Object.keys(e.headers)),i=r.next();!i.done;i=r.next()){var o=i.value;yi.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 Mi(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 Ri=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=Fi(r),this.credentialProvider=Li(n)}return e.prototype.presign=function(e,t){return void 0===t&&(t={}),Object(w.__awaiter)(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b,S,_,E,A,O,I;return Object(w.__generator)(this,(function(T){switch(T.label){case 0:return n=t.signingDate,r=void 0===n?new Date:n,i=t.expiresIn,o=void 0===i?3600:i,s=t.unsignableHeaders,a=t.unhoistableHeaders,u=t.signableHeaders,c=t.signingRegion,l=t.signingService,[4,this.credentialProvider()];case 1:return f=T.sent(),null==c?[3,2]:(h=c,[3,4]);case 2:return[4,this.regionProvider()];case 3:h=T.sent(),T.label=4;case 4:return d=h,p=Di(r),v=p.longDate,y=p.shortDate,o>604800?[2,Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future")]:(g=Oi(y,d,null!=l?l:this.service),m=function(e,t){var n,r,i;void 0===t&&(t={});var o="function"==typeof e.clone?e.clone():ki(e),s=o.headers,a=o.query,u=void 0===a?{}:a;try{for(var c=Object(w.__values)(Object.keys(s)),l=c.next();!l.done;l=c.next()){var f=l.value,d=f.toLowerCase();"x-amz-"!==d.substr(0,6)||(null===(i=t.unhoistableHeaders)||void 0===i?void 0:i.has(d))||(u[f]=s[f],delete s[f])}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}return Object(w.__assign)(Object(w.__assign)({},e),{headers:s,query:u})}(ji(e),{unhoistableHeaders:a}),f.sessionToken&&(m.query["X-Amz-Security-Token"]=f.sessionToken),m.query["X-Amz-Algorithm"]="AWS4-HMAC-SHA256",m.query["X-Amz-Credential"]=f.accessKeyId+"/"+g,m.query["X-Amz-Date"]=v,m.query["X-Amz-Expires"]=o.toString(10),b=Ti(m,s,u),m.query["X-Amz-SignedHeaders"]=Ui(b),S=m.query,_="X-Amz-Signature",E=this.getSignature,A=[v,g,this.getSigningKey(f,d,y,l)],O=this.createCanonicalRequest,I=[m,b],[4,xi(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,m]}}))}))},e.prototype.sign=function(e,t){return Object(w.__awaiter)(this,void 0,void 0,(function(){return Object(w.__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(w.__awaiter)(this,void 0,void 0,(function(){var e,t,i,c,l,f,d,h,p,v,y;return Object(w.__generator)(this,(function(g){switch(g.label){case 0:return null==a?[3,1]:(t=a,[3,3]);case 1:return[4,this.regionProvider()];case 2:t=g.sent(),g.label=3;case 3:return e=t,i=Di(o),c=i.shortDate,l=i.longDate,f=Oi(c,e,null!=u?u:this.service),[4,xi({headers:{},body:r},this.sha256)];case 4:return d=g.sent(),(h=new this.sha256).update(n),v=pi,[4,h.digest()];case 5:return p=v.apply(void 0,[g.sent()]),y=[_i,l,f,s,p,d].join("\n"),[2,this.signString(y,{signingDate:o,signingRegion:e,signingService:u})]}}))}))},e.prototype.signString=function(e,t){var n=void 0===t?{}:t,r=n.signingDate,i=void 0===r?new Date:r,o=n.signingRegion,s=n.signingService;return Object(w.__awaiter)(this,void 0,void 0,(function(){var t,n,r,a,u,c,l,f;return Object(w.__generator)(this,(function(d){switch(d.label){case 0:return[4,this.credentialProvider()];case 1:return t=d.sent(),null==o?[3,2]:(r=o,[3,4]);case 2:return[4,this.regionProvider()];case 3:r=d.sent(),d.label=4;case 4:return n=r,a=Di(i).shortDate,l=(c=this.sha256).bind,[4,this.getSigningKey(t,n,a,s)];case 5:return(u=new(l.apply(c,[void 0,d.sent()]))).update(e),f=pi,[4,u.digest()];case 6:return[2,f.apply(void 0,[d.sent()])]}}))}))},e.prototype.signRequest=function(e,t){var n=void 0===t?{}:t,r=n.signingDate,i=void 0===r?new Date:r,o=n.signableHeaders,s=n.unsignableHeaders,a=n.signingRegion,u=n.signingService;return Object(w.__awaiter)(this,void 0,void 0,(function(){var t,n,r,c,l,f,d,h,p,v,y;return Object(w.__generator)(this,(function(g){switch(g.label){case 0:return[4,this.credentialProvider()];case 1:return t=g.sent(),null==a?[3,2]:(r=a,[3,4]);case 2:return[4,this.regionProvider()];case 3:r=g.sent(),g.label=4;case 4:return n=r,c=ji(e),l=Di(i),f=l.longDate,d=l.shortDate,h=Oi(d,n,null!=u?u:this.service),c.headers[vi]=f,t.sessionToken&&(c.headers[mi]=t.sessionToken),[4,xi(c,this.sha256)];case 5:return p=g.sent(),!function(e,t){var n,r;e=e.toLowerCase();try{for(var i=Object(w.__values)(Object.keys(t)),o=i.next();!o.done;o=i.next()){if(e===o.value.toLowerCase())return!0}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1}("x-amz-content-sha256",c.headers)&&this.applyChecksum&&(c.headers["x-amz-content-sha256"]=p),v=Ti(c,s,o),[4,this.getSignature(f,h,this.getSigningKey(t,n,d,u),this.createCanonicalRequest(c,v,p))];case 6:return y=g.sent(),c.headers.authorization="AWS4-HMAC-SHA256 Credential="+t.accessKeyId+"/"+h+", SignedHeaders="+Ui(v)+", Signature="+y,[2,c]}}))}))},e.prototype.createCanonicalRequest=function(e,t,n){var r=Object.keys(t).sort();return e.method+"\n"+this.getCanonicalPath(e)+"\n"+function(e){var t,n,r=e.query,i=void 0===r?{}:r,o=[],s={},a=function(e){if(e.toLowerCase()===gi)return"continue";o.push(e);var t=i[e];"string"==typeof t?s[e]=Ci(e)+"="+Ci(t):Array.isArray(t)&&(s[e]=t.slice(0).sort().reduce((function(t,n){return t.concat([Ci(e)+"="+Ci(n)])}),[]).join("&"))};try{for(var u=Object(w.__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(w.__awaiter)(this,void 0,void 0,(function(){var r,i;return Object(w.__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"+pi(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(w.__awaiter)(this,void 0,void 0,(function(){var i,o,s,a,u;return Object(w.__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=pi,[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(w.__awaiter)(void 0,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h;return Object(w.__generator)(this,(function(p){switch(p.label){case 0:return[4,Ii(e,t.secretAccessKey,t.accessKeyId)];case 1:if(o=p.sent(),(s=n+":"+r+":"+i+":"+pi(o)+":"+t.sessionToken)in Ei)return[2,Ei[s]];for(Ai.push(s);Ai.length>50;)delete Ei[Ai.shift()];a="AWS4"+t.secretAccessKey,p.label=2;case 2:p.trys.push([2,7,8,9]),u=Object(w.__values)([n,r,i,"aws4_request"]),c=u.next(),p.label=3;case 3:return c.done?[3,6]:(l=c.value,[4,Ii(e,a,l)]);case 4:a=p.sent(),p.label=5;case 5:return c=u.next(),[3,3];case 6:return[3,9];case 7:return f=p.sent(),d={error:f},[3,9];case 8:try{c&&!c.done&&(h=u.return)&&h.call(u)}finally{if(d)throw d.error}return[7];case 9:return[2,Ei[s]=a]}}))}))}(this.sha256,e,n,t,r||this.service)},e}(),Di=function(e){var t=Mi(e).replace(/[\-:]/g,"");return{longDate:t,shortDate:t.substr(0,8)}},Ui=function(e){return Object.keys(e).sort().join(";")},Fi=function(e){if("string"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e},Li=function(e){if("object"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};function Bi(e){if("object"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e}var qi=/[^\!\#\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,zi=function(e){var t=Object(w.__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(qi,"_")})).join("/")},Ki={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},Vi=function(e){return{applyToStack:function(t){var n;t.add((n=e,function(e,t){return function(r){return Object(w.__awaiter)(void 0,void 0,void 0,(function(){var i,o,s,a,u,c,l,f;return Object(w.__generator)(this,(function(d){switch(d.label){case 0:return i=r.request,ke.isInstance(i)?(o=i.headers,s=(null===(l=null==t?void 0:t.userAgent)||void 0===l?void 0:l.map(zi))||[],[4,n.defaultUserAgentProvider()]):[2,e(r)];case 1:return a=d.sent().map(zi),u=(null===(f=null==n?void 0:n.customUserAgent)||void 0===f?void 0:f.map(zi))||[],o["x-amz-user-agent"]=Object(w.__spread)(a,s,u).join(" "),c=Object(w.__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(w.__assign)(Object(w.__assign)({},r),{request:i}))]}}))}))}}),Ki)}}},Hi=function(e){function t(t){var n,r,i=this,o=function(e){var t,n=this,r=Bi(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?Bi(e.signer):function(){return Bi(e.region)().then((function(t){return Object(w.__awaiter)(n,void 0,void 0,(function(){return Object(w.__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(w.__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 Ri({credentials:r,region:e.signingRegion,service:e.signingName,sha256:u,uriEscapePath:o})}))},Object(w.__assign)(Object(w.__assign)({},e),{systemClockOffset:a,signingEscapePath:o,credentials:r,signer:t})}(function(e){var t;return Object(w.__assign)(Object(w.__assign)({},e),{tls:null===(t=e.tls)||void 0===t||t,endpoint:e.endpoint?ti(e):function(){return ni(e)},isCustomEndpoint:!!e.endpoint})}(function(e){if(!e.region)throw new Error("Region is missing");return Object(w.__assign)(Object(w.__assign)({},e),{region:ri(e.region)})}(Ct(Ct({},ei),t)))),s=function(e){return Object(w.__assign)(Object(w.__assign)({},e),{customUserAgent:"string"==typeof e.customUserAgent?[[e.customUserAgent]]:e.customUserAgent})}((r=Br((n=o).maxAttempts),Object(w.__assign)(Object(w.__assign)({},n),{maxAttempts:r,retryStrategy:n.retryStrategy||new Lr(r)})));return(i=e.call(this,s)||this).config=s,i.middlewareStack.use(xr(i.config)),i.middlewareStack.use(oi(i.config)),i.middlewareStack.use(ai(i.config)),i.middlewareStack.use(ci(i.config)),i.middlewareStack.use(Vi(i.config)),i}return Tt(t,e),t.prototype.destroy=function(){e.prototype.destroy.call(this)},t}(vt),Gi=n(75),Wi=function(){return(Wi=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 Yi(e){var t=new Hi({region:e.region,customUserAgent:Object(Gi.b)()});return t.middlewareStack.add((function(e,t){return function(t){return e(function(e){return Wi(Wi({},e),{request:Wi(Wi({},e.request),{headers:Wi(Wi({},e.request.headers),{"cache-control":"no-store"})})})}(t))}}),{step:"build",name:"cacheControlMiddleWare"}),t}var Ji=function(){return(Ji=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)},$i=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())}))},Qi=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Zi=new r.a("Credentials"),Xi=new(function(){function e(e){this._gettingCredPromise=null,this._refreshHandlers={},this.Auth=void 0,this.configure(e),this._refreshHandlers.google=g.refreshGoogleToken,this._refreshHandlers.facebook=m.refreshFacebookToken}return e.prototype.getModuleName=function(){return"Credentials"},e.prototype.getCredSource=function(){return this._credentials_source},e.prototype.configure=function(e){if(!e)return this._config||{};this._config=Object.assign({},this._config,e);var t=this._config.refreshHandlers;return t&&(this._refreshHandlers=Ji(Ji({},this._refreshHandlers),t)),this._storage=this._config.storage,this._storage||(this._storage=(new i.a).getStorage()),this._storageSync=Promise.resolve(),"function"==typeof this._storage.sync&&(this._storageSync=this._storage.sync()),this._config},e.prototype.get=function(){return Zi.debug("getting credentials"),this._pickupCredentials()},e.prototype._getCognitoIdentityIdStorageKey=function(e){return"CognitoIdentityId-"+e},e.prototype._pickupCredentials=function(){return Zi.debug("picking up credentials"),this._gettingCredPromise&&this._gettingCredPromise.isPending()?Zi.debug("getting old cred promise"):(Zi.debug("getting new cred promise"),this._gettingCredPromise=Object(o.d)(this._keepAlive())),this._gettingCredPromise},e.prototype._keepAlive=function(){return $i(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return Qi(this,(function(a){switch(a.label){case 0:if(Zi.debug("checking if credentials exists and not expired"),(e=this._credentials)&&!this._isExpired(e)&&!this._isPastTTL())return Zi.debug("credentials not changed and not expired, directly return"),[2,Promise.resolve(e)];if(Zi.debug("need to get a new credential or refresh the existing one"),t=this.Auth,!(n=void 0===t?b.a.Auth:t)||"function"!=typeof n.currentUserCredentials)return[2,Promise.reject("No Auth module registered in Amplify")];if(this._isExpired(e)||!this._isPastTTL())return[3,6];Zi.debug("ttl has passed but token is not yet expired"),a.label=1;case 1:return a.trys.push([1,5,,6]),[4,n.currentUserPoolUser()];case 2:return r=a.sent(),[4,n.currentSession()];case 3:return i=a.sent(),o=i.refreshToken,[4,new Promise((function(e,t){r.refreshSession(o,(function(n,r){return n?t(n):e(r)}))}))];case 4:return a.sent(),[3,6];case 5:return s=a.sent(),Zi.debug("Error attempting to refreshing the session",s),[3,6];case 6:return[2,n.currentUserCredentials()]}}))}))},e.prototype.refreshFederatedToken=function(e){Zi.debug("Getting federated credentials");var t=e.provider,n=e.user,r=e.token,i=e.identity_id,o=e.expires_at;o=1970===new Date(o).getFullYear()?1e3*o:o;return Zi.debug("checking if federated jwt token expired"),o>(new Date).getTime()?(Zi.debug("token not expired"),this._setCredentialsFromFederation({provider:t,token:r,user:n,identity_id:i,expires_at:o})):this._refreshHandlers[t]&&"function"==typeof this._refreshHandlers[t]?(Zi.debug("getting refreshed jwt token from federation provider"),this._providerRefreshWithRetry({refreshHandler:this._refreshHandlers[t],provider:t,user:n})):(Zi.debug("no refresh handler for provider:",t),this.clear(),Promise.reject("no refresh handler for provider"))},e.prototype._providerRefreshWithRetry=function(e){var t=this,n=e.refreshHandler,r=e.provider,i=e.user;return Object(s.c)(n,[],1e4).then((function(e){return Zi.debug("refresh federated token sucessfully",e),t._setCredentialsFromFederation({provider:r,token:e.token,user:i,identity_id:e.identity_id,expires_at:e.expires_at})})).catch((function(e){return"string"==typeof e&&0===e.toLowerCase().lastIndexOf("network error",e.length)||t.clear(),Zi.debug("refresh federated token failed",e),Promise.reject("refreshing federation token failed: "+e)}))},e.prototype._isExpired=function(e){if(!e)return Zi.debug("no credentials for expiration check"),!0;Zi.debug("are these credentials expired?",e);var t=Date.now();return e.expiration.getTime()<=t},e.prototype._isPastTTL=function(){return this._nextCredentialsRefresh<=Date.now()},e.prototype._setCredentialsForGuest=function(){return $i(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a=this;return Qi(this,(function(u){switch(u.label){case 0:return Zi.debug("setting credentials for guest"),e=this._config,t=e.identityPoolId,n=e.region,e.mandatorySignIn?[2,Promise.reject("cannot get guest credentials when mandatory signin enabled")]:t?n?(i=this,[4,this._getGuestIdentityId()]):(Zi.debug("region is not configured for getting the credentials"),[2,Promise.reject("region is not configured for getting the credentials")]):(Zi.debug("No Cognito Identity pool provided for unauthenticated access"),[2,Promise.reject("No Cognito Identity pool provided for unauthenticated access")]);case 1:return r=i._identityId=u.sent(),o=Yi({region:n}),s=void 0,s=r?St({identityId:r,client:o})():function(){return $i(a,void 0,void 0,(function(){var e;return Qi(this,(function(n){switch(n.label){case 0:return[4,o.send(new hr({IdentityPoolId:t}))];case 1:return e=n.sent().IdentityId,this._identityId=e,[2,St({client:o,identityId:e})()]}}))}))}().catch((function(e){return $i(a,void 0,void 0,(function(){return Qi(this,(function(t){throw e}))}))})),[2,this._loadCredentials(s,"guest",!1,null).then((function(e){return e})).catch((function(e){return $i(a,void 0,void 0,(function(){var n=this;return Qi(this,(function(i){switch(i.label){case 0:return"ResourceNotFoundException"!==e.name||e.message!=="Identity '"+r+"' not found."?[3,2]:(Zi.debug("Failed to load guest credentials"),[4,this._removeGuestIdentityId()]);case 1:return i.sent(),s=function(){return $i(n,void 0,void 0,(function(){var e;return Qi(this,(function(n){switch(n.label){case 0:return[4,o.send(new hr({IdentityPoolId:t}))];case 1:return e=n.sent().IdentityId,this._identityId=e,[2,St({client:o,identityId:e})()]}}))}))}().catch((function(e){return $i(n,void 0,void 0,(function(){return Qi(this,(function(t){throw e}))}))})),[2,this._loadCredentials(s,"guest",!1,null)];case 2:return[2,e]}}))}))}))]}}))}))},e.prototype._setCredentialsFromFederation=function(e){var t=e.provider,n=e.token,r=e.identity_id,i={google:"accounts.google.com",facebook:"graph.facebook.com",amazon:"www.amazon.com",developer:"cognito-identity.amazonaws.com"}[t]||t;if(!i)return Promise.reject("You must specify a federated provider");var o={};o[i]=n;var s=this._config,a=s.identityPoolId,u=s.region;if(!a)return Zi.debug("No Cognito Federated Identity pool provided"),Promise.reject("No Cognito Federated Identity pool provided");if(!u)return Zi.debug("region is not configured for getting the credentials"),Promise.reject("region is not configured for getting the credentials");var c=Yi({region:u}),l=void 0;r?l=St({identityId:r,logins:o,client:c})():l=Ot({logins:o,identityPoolId:a,client:c})();return this._loadCredentials(l,"federated",!0,e)},e.prototype._setCredentialsFromSession=function(e){var t=this;Zi.debug("set credentials from session");var n=e.getIdToken().getJwtToken(),r=this._config,i=r.region,o=r.userPoolId,s=r.identityPoolId;if(!s)return Zi.debug("No Cognito Federated Identity pool provided"),Promise.reject("No Cognito Federated Identity pool provided");if(!i)return Zi.debug("region is not configured for getting the credentials"),Promise.reject("region is not configured for getting the credentials");var a={};a["cognito-idp."+i+".amazonaws.com/"+o]=n;var u=Yi({region:i}),c=$i(t,void 0,void 0,(function(){var e,t,n,r,i,o,c,l,f,d;return Qi(this,(function(h){switch(h.label){case 0:return[4,this._getGuestIdentityId()];case 1:return(e=h.sent())?[3,3]:[4,u.send(new hr({IdentityPoolId:s,Logins:a}))];case 2:n=h.sent().IdentityId,t=n,h.label=3;case 3:return[4,u.send(new pr({IdentityId:e||t,Logins:a}))];case 4:return r=h.sent(),i=r.Credentials,o=i.AccessKeyId,c=i.Expiration,l=i.SecretKey,f=i.SessionToken,d=r.IdentityId,this._identityId=d,e?(Zi.debug("The guest identity "+e+" has been successfully linked to the logins"),e===d&&Zi.debug("The guest identity "+e+" has become the primary identity"),[4,this._removeGuestIdentityId()]):[3,6];case 5:h.sent(),h.label=6;case 6:return[2,{accessKeyId:o,secretAccessKey:l,sessionToken:f,expiration:c,identityId:d}]}}))})).catch((function(e){return $i(t,void 0,void 0,(function(){return Qi(this,(function(t){throw e}))}))}));return this._loadCredentials(c,"userPool",!0,null)},e.prototype._loadCredentials=function(e,t,n,r){var i=this,o=this;return new Promise((function(s,a){e.then((function(e){return $i(i,void 0,void 0,(function(){var i,a,u,c,l;return Qi(this,(function(f){switch(f.label){case 0:if(Zi.debug("Load credentials successfully",e),this._identityId&&!e.identityId&&(e.identityId=this._identityId),o._credentials=e,o._credentials.authenticated=n,o._credentials_source=t,o._nextCredentialsRefresh=(new Date).getTime()+3e6,"federated"===t){i=Object.assign({id:this._credentials.identityId},r.user),a=r.provider,u=r.token,c=r.expires_at,l=r.identity_id;try{this._storage.setItem("aws-amplify-federatedInfo",JSON.stringify({provider:a,token:u,user:i,expires_at:c,identity_id:l}))}catch(e){Zi.debug("Failed to put federated info into auth storage",e)}}return"guest"!==t?[3,2]:[4,this._setGuestIdentityId(e.identityId)];case 1:f.sent(),f.label=2;case 2:return s(o._credentials),[2]}}))}))})).catch((function(t){if(t)return Zi.debug("Failed to load credentials",e),Zi.debug("Error loading credentials",t),void a(t)}))}))},e.prototype.set=function(e,t){return"session"===t?this._setCredentialsFromSession(e):"federation"===t?this._setCredentialsFromFederation(e):"guest"===t?this._setCredentialsForGuest():(Zi.debug("no source specified for setting credentials"),Promise.reject("invalid source"))},e.prototype.clear=function(){return $i(this,void 0,void 0,(function(){return Qi(this,(function(e){return this._credentials=null,this._credentials_source=null,Zi.debug("removing aws-amplify-federatedInfo from storage"),this._storage.removeItem("aws-amplify-federatedInfo"),[2]}))}))},e.prototype._getGuestIdentityId=function(){return $i(this,void 0,void 0,(function(){var e,t;return Qi(this,(function(n){switch(n.label){case 0:e=this._config.identityPoolId,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._storageSync];case 2:return n.sent(),[2,this._storage.getItem(this._getCognitoIdentityIdStorageKey(e))];case 3:return t=n.sent(),Zi.debug("Failed to get the cached guest identityId",t),[3,4];case 4:return[2]}}))}))},e.prototype._setGuestIdentityId=function(e){return $i(this,void 0,void 0,(function(){var t,n;return Qi(this,(function(r){switch(r.label){case 0:t=this._config.identityPoolId,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._storageSync];case 2:return r.sent(),this._storage.setItem(this._getCognitoIdentityIdStorageKey(t),e),[3,4];case 3:return n=r.sent(),Zi.debug("Failed to cache guest identityId",n),[3,4];case 4:return[2]}}))}))},e.prototype._removeGuestIdentityId=function(){return $i(this,void 0,void 0,(function(){var e;return Qi(this,(function(t){return e=this._config.identityPoolId,Zi.debug("removing "+this._getCognitoIdentityIdStorageKey(e)+" from storage"),this._storage.removeItem(this._getCognitoIdentityIdStorageKey(e)),[2]}))}))},e.prototype.shear=function(e){return{accessKeyId:e.accessKeyId,sessionToken:e.sessionToken,secretAccessKey:e.secretAccessKey,identityId:e.identityId,authenticated:e.authenticated}},e}())(null);b.a.register(Xi)}])}));
64
+ 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(44).default||n(44))},function(e,t,n){e.exports=n(93).Observable},function(e,t,n){"use strict";(function(e){!function(e,t){function n(e){return"function"==typeof Symbol&&Boolean(Symbol[e])}function r(e){return n(e)?Symbol[e]:"@@"+e}function i(e){setTimeout((function(){throw e}))}function o(e,t){var n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function s(e){var t=e.constructor;return void 0!==t&&null===(t=t[r("species")])&&(t=void 0),void 0!==t?t:d}function a(e,t){Object.keys(t).forEach((function(n){var r=Object.getOwnPropertyDescriptor(t,n);r.enumerable=!1,Object.defineProperty(e,n,r)}))}function u(e){var t=e._cleanup;if(t){e._cleanup=void 0;try{t()}catch(e){i(e)}}}function c(e){return void 0===e._observer}function l(e,t){if(Object(e)!==e)throw new TypeError("Observer must be an object");this._cleanup=void 0,this._observer=e;try{var n=o(e,"start");n&&n.call(e,this)}catch(e){i(e)}if(!c(this)){e=new f(this);try{var r=t.call(void 0,e);if(null!=r){if("function"==typeof r.unsubscribe)s=r,r=function(){s.unsubscribe()};else if("function"!=typeof r)throw new TypeError(r+" is not a function");this._cleanup=r}}catch(t){return void e.error(t)}var s;c(this)&&u(this)}}function f(e){this._subscription=e}function d(e){if(!(this instanceof d))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}"function"!=typeof Symbol||Symbol.observable||(Symbol.observable=Symbol("observable")),a(l.prototype={},{get closed(){return c(this)},unsubscribe:function(){var e;c(e=this)||(e._observer=void 0,u(e))}}),a(f.prototype={},{get closed(){return c(this._subscription)},next:function(e){var t=this._subscription;if(!c(t)){var n=t._observer;try{var r=o(n,"next");r&&r.call(n,e)}catch(e){i(e)}}},error:function(e){var t=this._subscription;if(c(t))i(e);else{var n=t._observer;t._observer=void 0;try{var r=o(n,"error");if(!r)throw e;r.call(n,e)}catch(e){i(e)}u(t)}},complete:function(){var e=this._subscription;if(!c(e)){var t=e._observer;e._observer=void 0;try{var n=o(t,"complete");n&&n.call(t)}catch(e){i(e)}u(e)}}}),a(d.prototype,{subscribe:function(e){for(var t=[],n=1;n<arguments.length;++n)t.push(arguments[n]);return"function"==typeof e?e={next:e,error:t[0],complete:t[1]}:"object"==typeof e&&null!==e||(e={}),new l(e,this._subscriber)},forEach:function(e){var t=this;return new Promise((function(n,r){if("function"!=typeof e)return Promise.reject(new TypeError(e+" is not a function"));t.subscribe({_subscription:null,start:function(e){if(Object(e)!==e)throw new TypeError(e+" is not an object");this._subscription=e},next:function(t){var n=this._subscription;if(!n.closed)try{e(t)}catch(e){r(e),n.unsubscribe()}},error:r,complete:n})}))},map:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(s(this))((function(n){return t.subscribe({next:function(t){if(!n.closed){try{t=e(t)}catch(e){return n.error(e)}n.next(t)}},error:function(e){n.error(e)},complete:function(){n.complete()}})}))},filter:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(s(this))((function(n){return t.subscribe({next:function(t){if(!n.closed){try{if(!e(t))return}catch(e){return n.error(e)}n.next(t)}},error:function(e){n.error(e)},complete:function(){n.complete()}})}))},reduce:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var n=s(this),r=arguments.length>1,i=!1,o=arguments[1],a=o;return new n((function(n){return t.subscribe({next:function(t){if(!n.closed){var o=!i;if(i=!0,!o||r)try{a=e(a,t)}catch(e){return n.error(e)}else a=t}},error:function(e){n.error(e)},complete:function(){if(!i&&!r)return n.error(new TypeError("Cannot reduce an empty sequence"));n.next(a),n.complete()}})}))}}),Object.defineProperty(d.prototype,r("observable"),{value:function(){return this},writable:!0,configurable:!0}),a(d,{from:function(e){var t="function"==typeof this?this:d;if(null==e)throw new TypeError(e+" is not an object");var i=o(e,r("observable"));if(i){var s=i.call(e);if(Object(s)!==s)throw new TypeError(s+" is not an object");return s.constructor===t?s:new t((function(e){return s.subscribe(e)}))}if(n("iterator")&&(i=o(e,r("iterator"))))return new t((function(t){for(var n,r=i.call(e)[Symbol.iterator]();!(n=r.next()).done;){var o=n.value;if(t.next(o),t.closed)return}t.complete()}));if(Array.isArray(e))return new t((function(t){for(var n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}));throw new TypeError(e+" is not observable")},of:function(){for(var e=[],t=0;t<arguments.length;++t)e.push(arguments[t]);var n="function"==typeof this?this:d;return new n((function(t){for(var n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}))}}),Object.defineProperty(d,r("species"),{get:function(){return this},configurable:!0}),Object.defineProperty(d,"extensions",{value:{observableSymbol:r("observable"),setHostReportError:function(e){i=e}}}),e.Observable=d}(t)}).call(this,n(46)(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(46)(e),n(28))},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";t.decode=t.parse=n(97),t.encode=t.stringify=n(98)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,o){t=t||"&",n=n||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var l=0;l<c;++l){var f,d,h,p,v=e[l].replace(a,"%20"),y=v.indexOf(n);y>=0?(f=v.substr(0,y),d=v.substr(y+1)):(f=v,d=""),h=decodeURIComponent(f),p=decodeURIComponent(d),r(s,h)?i(s[h])?s[h].push(p):s[h]=[s[h],p]:s[h]=p}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,a){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),(function(s){var a=encodeURIComponent(r(s))+n;return i(e[s])?o(e[s],(function(e){return a+encodeURIComponent(r(e))})).join(t):a+encodeURIComponent(r(e[s]))})).join(t):a?encodeURIComponent(r(a))+n+encodeURIComponent(r(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var s=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}},function(e,t,n){var r,i,o=n(48),s=n(49),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(48),i=n(49);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(50),i=n(52),o=n(108),s=n(116),a=n(118),u=n(35),c=function(){function e(e){(0,s.supportsWebCrypto)((0,u.locateWindow)())?this.hash=new i.Sha256(e):(0,a.isMsWindow)((0,u.locateWindow)())?this.hash=new r.Sha256(e):this.hash=new o.Sha256(e)}return e.prototype.update=function(e,t){this.hash.update(e,t)},e.prototype.digest=function(){return this.hash.digest()},e}();t.Sha256=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyData=void 0,t.isEmptyData=function(e){return"string"==typeof e?0===e.length:0===e.byteLength}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=t.numToUint8=t.isEmptyData=t.convertToBuffer=void 0;var r=n(104);Object.defineProperty(t,"convertToBuffer",{enumerable:!0,get:function(){return r.convertToBuffer}});var i=n(105);Object.defineProperty(t,"isEmptyData",{enumerable:!0,get:function(){return i.isEmptyData}});var o=n(106);Object.defineProperty(t,"numToUint8",{enumerable:!0,get:function(){return o.numToUint8}});var s=n(107);Object.defineProperty(t,"uint32ArrayFrom",{enumerable:!0,get:function(){return s.uint32ArrayFrom}})},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.convertToBuffer=void 0;var r=n(64),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(1).__exportStar)(n(109),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var r=n(1),i=n(53),o=n(110),s=n(111),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(53),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}),t.uint32ArrayFrom=t.numToUint8=t.isEmptyData=t.convertToBuffer=void 0;var r=n(112);Object.defineProperty(t,"convertToBuffer",{enumerable:!0,get:function(){return r.convertToBuffer}});var i=n(113);Object.defineProperty(t,"isEmptyData",{enumerable:!0,get:function(){return i.isEmptyData}});var o=n(114);Object.defineProperty(t,"numToUint8",{enumerable:!0,get:function(){return o.numToUint8}});var s=n(115);Object.defineProperty(t,"uint32ArrayFrom",{enumerable:!0,get:function(){return s.uint32ArrayFrom}})},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.convertToBuffer=void 0;var r=n(147),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}),n(1).__exportStar(n(117),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(1),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(1);r.__exportStar(n(119),t),r.__exportStar(n(120),t),r.__exportStar(n(121),t),r.__exportStar(n(122),t),r.__exportStar(n(123),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(55),o=n(126),s=n(61);var a=function e(t){var n=new o(t),a=i(o.prototype.request,n);return r.extend(a,o.prototype,n),r.extend(a,n),a.create=function(n){return e(s(t,n))},a}(n(30));a.Axios=o,a.Cancel=n(31),a.CancelToken=n(139),a.isCancel=n(60),a.VERSION=n(62).version,a.all=function(e){return Promise.all(e)},a.spread=n(140),a.isAxiosError=n(141),e.exports=a,e.exports.default=a},function(e,t,n){"use strict";var r=n(13),i=n(56),o=n(127),s=n(128),a=n(61),u=n(138),c=u.validators;function l(e){this.defaults=e,this.interceptors={request:new o,response:new o}}l.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=a(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var n=t.transitional;void 0!==n&&u.assertOptions(n,{silentJSONParsing:c.transitional(c.boolean),forcedJSONParsing:c.transitional(c.boolean),clarifyTimeoutError:c.transitional(c.boolean)},!1);var r=[],i=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(i=i&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));var o,l=[];if(this.interceptors.response.forEach((function(e){l.push(e.fulfilled,e.rejected)})),!i){var f=[s,void 0];for(Array.prototype.unshift.apply(f,r),f=f.concat(l),o=Promise.resolve(t);f.length;)o=o.then(f.shift(),f.shift());return o}for(var d=t;r.length;){var h=r.shift(),p=r.shift();try{d=h(d)}catch(e){p(e);break}}try{o=s(d)}catch(e){return Promise.reject(e)}for(;l.length;)o=o.then(l.shift(),l.shift());return o},l.prototype.getUri=function(e){return e=a(this.defaults,e),i(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],(function(e){l.prototype[e]=function(t,n){return this.request(a(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(e){l.prototype[e]=function(t,n,r){return this.request(a(r||{},{method:e,url:t,data:n}))}})),e.exports=l},function(e,t,n){"use strict";var r=n(13);function i(){this.handlers=[]}i.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){r.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=i},function(e,t,n){"use strict";var r=n(13),i=n(129),o=n(60),s=n(30),a=n(31);function u(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new a("canceled")}e.exports=function(e){return u(e),e.headers=e.headers||{},e.data=i.call(e,e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||s.adapter)(e).then((function(t){return u(e),t.data=i.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(u(e),t&&t.response&&(t.response.data=i.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,n){"use strict";var r=n(13),i=n(30);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(59);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(134),i=n(135);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(62).version,i={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){i[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var o={};i.transitional=function(e,t,n){function i(e,t){return"[Axios v"+r+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,r,s){if(!1===e)throw new Error(i(r," has been removed"+(t?" in "+t:"")));return t&&!o[r]&&(o[r]=!0,console.warn(i(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,s)}},e.exports={assertOptions:function(e,t,n){if("object"!=typeof e)throw new TypeError("options must be an object");for(var r=Object.keys(e),i=r.length;i-- >0;){var o=r[i],s=t[o];if(s){var a=e[o],u=void 0===a||s(a,o,e);if(!0!==u)throw new TypeError("option "+o+" must be "+u)}else if(!0!==n)throw Error("Unknown option "+o)}},validators:i}},function(e,t,n){"use strict";var r=n(31);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;this.promise.then((function(e){if(n._listeners){var t,r=n._listeners.length;for(t=0;t<r;t++)n._listeners[t](e);n._listeners=null}})),this.promise.then=function(e){var t,r=new Promise((function(e){n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},i.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},i.source=function(){var e;return{token:new i((function(t){e=t})),cancel:e}},e.exports=i},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,n){"use strict";var r=n(13);e.exports=function(e){return r.isObject(e)&&!0===e.isAxiosError}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),i=n(63),o=n(143),s=n(146),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(63),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 yn})),n.d(t,"DataStoreClass",(function(){return vn})),n.d(t,"initSchema",(function(){return Jt})),n.d(t,"Predicates",(function(){return O.b})),n.d(t,"ModelPredicateCreator",(function(){return O.a})),n.d(t,"ModelSortPredicateCreator",(function(){return I.a})),n.d(t,"utils",(function(){return gn})),n.d(t,"isSchemaModel",(function(){return y.x})),n.d(t,"isSchemaModelWithAttributes",(function(){return y.y})),n.d(t,"isAssociatedWith",(function(){return y.l})),n.d(t,"isTargetNameAssociation",(function(){return y.z})),n.d(t,"isModelAttributeAuth",(function(){return y.p})),n.d(t,"isModelAttributeKey",(function(){return y.r})),n.d(t,"isModelAttributePrimaryKey",(function(){return y.s})),n.d(t,"isModelAttributeCompositeKey",(function(){return y.q})),n.d(t,"ModelAttributeAuthAllow",(function(){return y.e})),n.d(t,"ModelAttributeAuthProvider",(function(){return y.f})),n.d(t,"GraphQLScalarType",(function(){return y.c})),n.d(t,"isGraphQLScalarType",(function(){return y.n})),n.d(t,"isModelFieldType",(function(){return y.t})),n.d(t,"isNonModelFieldType",(function(){return y.u})),n.d(t,"isEnumFieldType",(function(){return y.m})),n.d(t,"isIdentifierObject",(function(){return y.o})),n.d(t,"OpType",(function(){return y.h})),n.d(t,"isPredicateObj",(function(){return y.w})),n.d(t,"isPredicateGroup",(function(){return y.v})),n.d(t,"QueryOne",(function(){return y.j})),n.d(t,"SortDirection",(function(){return y.k})),n.d(t,"AuthModeStrategyType",(function(){return y.a})),n.d(t,"ModelOperation",(function(){return y.g})),n.d(t,"syncExpression",(function(){return y.A})),n.d(t,"ProcessName",(function(){return y.i})),n.d(t,"DISCARD",(function(){return y.b})),n.d(t,"LimitTimerRaceResolvedValues",(function(){return y.d}));var r=n(18),i=n(32),o=n(19),s=n(21),a=n(16),u=n(148),c=n(76),l=n(37),f=n(15),d=n(24),h=n(10),p=n(17),v=n(4),y=n(2),g=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())}))},m=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])}}},b=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},w=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(b(arguments[t]));return e};function S(e){return"private"!==e.allow||e.provider?"public"!==e.allow||e.provider?e.provider:y.f.API_KEY:y.f.USER_POOLS}function _(e){var t=e.rules,n=e.currentUser,r=new Set;return t.forEach((function(e){switch(e.allow){case y.e.CUSTOM:e.provider&&e.provider!==y.f.FUNCTION||r.add(v.c.AWS_LAMBDA);break;case y.e.GROUPS:case y.e.OWNER:n&&(e.provider===y.f.USER_POOLS?r.add(v.c.AMAZON_COGNITO_USER_POOLS):e.provider===y.f.OIDC&&r.add(v.c.OPENID_CONNECT));break;case y.e.PRIVATE:n&&(e.provider&&e.provider!==y.f.USER_POOLS?e.provider===y.f.IAM&&r.add(v.c.AWS_IAM):r.add(v.c.AMAZON_COGNITO_USER_POOLS));break;case y.e.PUBLIC:e.provider===y.f.IAM?r.add(v.c.AWS_IAM):e.provider&&e.provider!==y.f.API_KEY||r.add(v.c.API_KEY)}})),Array.from(r)}var E=function(e){return function(t){var n=t.schema,r=t.modelName;return g(void 0,void 0,void 0,(function(){var t,i,o,s,a;return m(this,(function(u){switch(u.label){case 0:e.Auth=e.Auth||p.a,u.label=1;case 1:return u.trys.push([1,3,,4]),[4,e.Auth.currentAuthenticatedUser()];case 2:return t=u.sent(),[3,4];case 3:return u.sent(),[3,4];case 4:return(i=n.namespaces.user.models[r].attributes)&&(o=i.find((function(e){return"auth"===e.type})),null===(a=null==o?void 0:o.properties)||void 0===a?void 0:a.rules)?(c=o.properties.rules,l=[y.e.CUSTOM,y.e.OWNER,y.e.GROUPS,y.e.PRIVATE,y.e.PUBLIC],f=[y.f.FUNCTION,y.f.USER_POOLS,y.f.OIDC,y.f.IAM,y.f.API_KEY],s=w(c).sort((function(e,t){return e.allow===t.allow?f.indexOf(S(e))-f.indexOf(S(t)):l.indexOf(e.allow)-l.indexOf(t.allow)})),[2,_({currentUser:t,rules:s})]):[2,[]]}var c,l,f}))}))}},A=function(){return[]},O=n(5),I=n(47),T=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}(),C=n(67),P=n.n(C),x=n(0),k=n(3);let N,j;const M=new WeakMap,R=new WeakMap,D=new WeakMap,U=new WeakMap,F=new WeakMap;let L={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return R.get(e);if("objectStoreNames"===t)return e.objectStoreNames||D.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return z(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function B(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(j||(j=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(K(this),t),z(M.get(this))}:function(...t){return z(e.apply(K(this),t))}:function(t,...n){const r=e.call(K(this),t,...n);return D.set(r,t.sort?t.sort():[t]),z(r)}}function q(e){return"function"==typeof e?B(e):(e instanceof IDBTransaction&&function(e){if(R.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)});R.set(e,t)}(e),t=e,(N||(N=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,L):e);var t}function z(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(z(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",o)});return t.then(t=>{t instanceof IDBCursor&&M.set(t,e)}).catch(()=>{}),F.set(t,e),t}(e);if(U.has(e))return U.get(e);const t=q(e);return t!==e&&(U.set(e,t),F.set(t,e)),t}const K=e=>F.get(e);function V(e,t,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){const s=indexedDB.open(e,t),a=z(s);return r&&s.addEventListener("upgradeneeded",e=>{r(z(s.result),e.oldVersion,e.newVersion,z(s.transaction))}),n&&s.addEventListener("blocked",()=>n()),a.then(e=>{o&&e.addEventListener("close",()=>o()),i&&e.addEventListener("versionchange",()=>i())}).catch(()=>{}),a}function H(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",()=>t()),z(n).then(()=>{})}const G=["get","getKey","getAll","getAllKeys","count"],W=["put","add","delete","clear"],Y=new Map;function J(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(Y.get(t))return Y.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=W.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!G.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 Y.set(t,o),o}function $(e){return($="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}L=(e=>({...e,get:(t,n,r)=>J(t,n)||e.get(t,n,r),has:(t,n)=>!!J(t,n)||e.has(t,n)}))(L);var Q=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Z=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},X=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 te?te(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)}))}}},ee=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},te=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ne=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(ee(arguments[t]));return e},re=new s.a("DataStore"),ie=new(function(){function e(){var e=this;this.dbName="amplify-datastore",this.safariCompatabilityMode=!1,this.canonicalKeyPath=function(t){return e.safariCompatabilityMode?t.length>1?t:t[0]:t}}return e.prototype.getStorenameForModel=function(e){var t=this.namespaceResolver(e),n=e.name;return Object(x.u)(t,n)},e.prototype.getIndexKeyValuesFromModel=function(e){var t=Object.getPrototypeOf(e).constructor,n=this.namespaceResolver(t),r=Object(x.s)(this.schema.namespaces[n],t.name);return Object(x.n)(e,r)},e.prototype.checkPrivate=function(){return Q(this,void 0,void 0,(function(){return Z(this,(function(e){switch(e.label){case 0:return[4,Object(x.K)().then((function(e){return e}))];case 1:return e.sent()?(re.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.setSafariCompatabilityMode=function(){return Q(this,void 0,void 0,(function(){var e;return Z(this,(function(t){switch(t.label){case 0:return e=this,[4,Object(x.L)()];case 1:return e.safariCompatabilityMode=t.sent(),!0===this.safariCompatabilityMode&&re.debug("IndexedDB Adapter is running in Safari Compatability Mode"),[2]}}))}))},e.prototype.getNamespaceAndModelFromStorename=function(e){var t=ee(e.split("_"));return{namespaceName:t[0],modelName:t.slice(1).join("_")}},e.prototype.setUp=function(e,t,n,r,i){return Q(this,void 0,void 0,(function(){var o,s,a=this;return Z(this,(function(u){switch(u.label){case 0:return[4,this.checkPrivate()];case 1:return u.sent(),[4,this.setSafariCompatabilityMode()];case 2:return u.sent(),this.initPromise?[3,3]:(this.initPromise=new Promise((function(e,t){a.resolve=e,a.reject=t})),[3,5]);case 3:return[4,this.initPromise];case 4:u.sent(),u.label=5;case 5:i&&(this.dbName="amplify-datastore-"+i),this.schema=e,this.namespaceResolver=t,this.modelInstanceCreator=n,this.getModelConstructorByModelName=r,u.label=6;case 6:return u.trys.push([6,9,,10]),this.db?[3,8]:(3,o=this,[4,V(this.dbName,3,{upgrade:function(t,n,r,i){return Q(a,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h,p,v,y,g,m,b,w=this;return Z(this,(function(S){switch(S.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=Object(x.u)(n,e);w.createObjectStoreForModel(t,n,r,e)}))})),[2];if(1!==n&&2!==n||3!==r)return[3,16];S.label=1;case 1:S.trys.push([1,14,,15]),S.label=2;case 2:S.trys.push([2,11,12,13]),o=te(i.objectStoreNames),s=o.next(),S.label=3;case 3:return s.done?[3,10]:(a=s.value,u=i.objectStore(a),c="tmp_"+a,u.name=c,l=this.getNamespaceAndModelFromStorename(a),f=l.namespaceName,d=l.modelName,h=this.createObjectStoreForModel(t,f,a,d),[4,u.openCursor()]);case 4:p=S.sent(),v=0,S.label=5;case 5:return p&&p.value?[4,h.put(p.value)]:[3,8];case 6:return S.sent(),[4,p.continue()];case 7:return p=S.sent(),v++,[3,5];case 8:t.deleteObjectStore(c),re.debug(v+" "+a+" records migrated"),S.label=9;case 9:return s=o.next(),[3,3];case 10:return[3,13];case 11:return y=S.sent(),m={error:y},[3,13];case 12:try{s&&!s.done&&(b=o.return)&&b.call(o)}finally{if(m)throw m.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,Object(x.u)(n,e)]})).filter((function(e){var t=ee(e,2)[1];return!o.has(t)})).forEach((function(e){var r=ee(e,2),i=r[0],o=r[1];w.createObjectStoreForModel(t,n,o,i)}))})),[3,15];case 14:throw g=S.sent(),re.error("Error migrating IndexedDB data",g),i.abort(),g;case 15:case 16:return[2]}}))}))}})]);case 7:o.db=u.sent(),this.resolve(),u.label=8;case 8:return[3,10];case 9:return s=u.sent(),this.reject(s),[3,10];case 10:return[2]}}))}))},e.prototype._get=function(e,t){return Q(this,void 0,void 0,(function(){var n,r;return Z(this,(function(i){switch(i.label){case 0:return"string"==typeof e?(r=e,n=this.db.transaction(r,"readonly").store.index("byPk")):n=e.index("byPk"),[4,n.get(this.canonicalKeyPath(t))];case 1:return[2,i.sent()]}}))}))},e.prototype.save=function(e,t){var n,r;return Q(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p,v,g,m,b,w,S,_,E,A,I,T,C,P,k,N,j,M,R,D=this;return Z(this,(function(U){switch(U.label){case 0:return[4,this.checkPrivate()];case 1:return U.sent(),i=Object.getPrototypeOf(e).constructor,o=this.getStorenameForModel(i),s=this.namespaceResolver(i),a=Object(x.R)(i.name,e,this.schema.namespaces[s],this.modelInstanceCreator,this.getModelConstructorByModelName),u=new Set,c=Object.values(a).map((function(e){var t=e.modelName,n=e.item,r=e.instance,i=Object(x.u)(s,t);return u.add(i),{storeName:i,item:n,instance:r,keys:Object(x.s)(D.schema.namespaces[s],t)}})),l=this.db.transaction(ne([o],Array.from(u.values())),"readwrite"),f=l.objectStore(o),d=this.getIndexKeyValuesFromModel(e),[4,this._get(f,d)];case 2:if(h=U.sent(),t&&h&&(p=O.a.getPredicates(t),v=p.predicates,g=p.type,!Object(x.S)(h,g,v)))throw m="Conditional update failed",re.error(m,{model:h,condition:v}),new Error(m);b=[],U.label=3;case 3:U.trys.push([3,11,12,17]),w=X(c),U.label=4;case 4:return[4,w.next()];case 5:return(S=U.sent()).done?[3,10]:(_=S.value,E=_.storeName,A=_.item,I=_.instance,T=_.keys,C=l.objectStore(E),P=T.map((function(e){return A[e]})),[4,this._get(C,P)]);case 6:return k=U.sent(),N=void 0===k?y.h.INSERT:y.h.UPDATE,j=this.getIndexKeyValuesFromModel(e),Object(x.M)(P,j)||N===y.h.INSERT?[4,C.index("byPk").getKey(this.canonicalKeyPath(P))]:[3,9];case 7:return M=U.sent(),[4,C.put(A,M)];case 8:U.sent(),b.push([I,N]),U.label=9;case 9:return[3,4];case 10:return[3,17];case 11:return R=U.sent(),n={error:R},[3,17];case 12:return U.trys.push([12,,15,16]),S&&!S.done&&(r=w.return)?[4,r.call(w)]:[3,14];case 13:U.sent(),U.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 U.sent(),[2,b]}}))}))},e.prototype.load=function(e,t,n){var r,i,o,s,a,u,c,l,f,d;return Q(this,void 0,void 0,(function(){var h,p,v,y,g,m,b,w,S,_,E,A,O,I,T,C,P,k,N,j,M,R,D,U=this;return Z(this,(function(F){switch(F.label){case 0:if(h=this.schema.namespaces[e],p=h.relationships[t].relationTypes,v=p.map((function(t){var n=t.modelName;return Object(x.u)(e,n)})),y=this.getModelConstructorByModelName(e,t),0===v.length)return[2,n.map((function(e){return U.modelInstanceCreator(y,e)}))];g=this.db.transaction(ne(v),"readonly"),F.label=1;case 1:F.trys.push([1,38,39,44]),m=X(p),F.label=2;case 2:return[4,m.next()];case 3:if((b=F.sent()).done)return[3,37];switch(w=b.value,S=w.fieldName,_=w.modelName,E=w.targetName,A=w.targetNames,O=Object(x.u)(e,_),I=g.objectStore(O),T=this.getModelConstructorByModelName(e,_),w.relationType){case"HAS_ONE":return[3,4];case"BELONGS_TO":return[3,19];case"HAS_MANY":return[3,34]}return[3,35];case 4:F.trys.push([4,12,13,18]),r=X(n),F.label=5;case 5:return[4,r.next()];case 6:return(i=F.sent()).done?[3,11]:(k=i.value,(null==A?void 0:A.length)?([],void 0,A.every((function(e){return null!=k[e]}))?(N=A.map((function(e){return k[e]})),[4,this._get(I,N)]):[3,11]):[3,8]);case 7:return M=F.sent(),k[S]=M&&this.modelInstanceCreator(T,M),[3,10];case 8:return C=k[E]?E:S,k[C]?(j=[k[C]],[4,this._get(I,j)]):[3,11];case 9:M=F.sent(),k[S]=M&&this.modelInstanceCreator(T,M),F.label=10;case 10:return[3,5];case 11:return[3,18];case 12:return P=F.sent(),c={error:P},[3,18];case 13:return F.trys.push([13,,16,17]),i&&!i.done&&(l=r.return)?[4,l.call(r)]:[3,15];case 14:F.sent(),F.label=15;case 15:return[3,17];case 16:if(c)throw c.error;return[7];case 17:return[7];case 18:return[3,36];case 19:F.trys.push([19,27,28,33]),o=X(n),F.label=20;case 20:return[4,o.next()];case 21:return(s=F.sent()).done?[3,26]:(k=s.value,(null==A?void 0:A.length)?(void 0,A.every((function(e){return null!=k[e]}))?(N=A.filter((function(e){var t;return null!==(t=k[e])&&void 0!==t&&t})).map((function(e){return k[e]})),[4,this._get(I,N)]):[3,26]):[3,23]);case 22:return M=F.sent(),k[S]=M&&this.modelInstanceCreator(T,M),null==A||A.map((function(e){delete k[e]})),[3,25];case 23:return k[E]?(j=[k[E]],[4,this._get(I,j)]):[3,25];case 24:M=F.sent(),k[S]=M&&this.modelInstanceCreator(T,M),delete k[E],F.label=25;case 25:return[3,20];case 26:return[3,33];case 27:return R=F.sent(),f={error:R},[3,33];case 28:return F.trys.push([28,,31,32]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,30];case 29:F.sent(),F.label=30;case 30:return[3,32];case 31:if(f)throw f.error;return[7];case 32:return[7];case 33:case 34:return[3,36];case 35:return Object(x.l)(w.relationType),[3,36];case 36:return[3,2];case 37:return[3,44];case 38:return D=F.sent(),a={error:D},[3,44];case 39:return F.trys.push([39,,42,43]),b&&!b.done&&(u=m.return)?[4,u.call(m)]:[3,41];case 40:F.sent(),F.label=41;case 41:return[3,43];case 42:if(a)throw a.error;return[7];case 43:return[7];case 44:return[2,n.map((function(e){return U.modelInstanceCreator(y,e)}))]}}))}))},e.prototype.query=function(e,t,n){return Q(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,f=this;return Z(this,(function(d){switch(d.label){case 0:return[4,this.checkPrivate()];case 1:return d.sent(),r=this.getStorenameForModel(e),i=this.namespaceResolver(e),o=t&&O.a.getPredicates(t),s=Object(x.s)(this.schema.namespaces[i],e.name),a=o&&this.keyValueFromPredicate(o,s),u=n&&n.sort,c=n&&n.limit,[4,Q(f,void 0,void 0,(function(){var e,t,i;return Z(this,(function(s){switch(s.label){case 0:return a?[4,this.getByKey(r,a)]:[3,2];case 1:return[2,(e=s.sent())?[e]:[]];case 2:return o?[4,this.filterOnPredicate(r,o)]:[3,4];case 3:return t=s.sent(),[2,this.inMemoryPagination(t,n)];case 4:return u?[4,this.getAll(r)]:[3,6];case 5:return i=s.sent(),[2,this.inMemoryPagination(i,n)];case 6:return c?[2,this.enginePagination(r,n)]:[2,this.getAll(r)]}}))}))];case 2:return l=d.sent(),[4,this.load(i,e.name,l)];case 3:return[2,d.sent()]}}))}))},e.prototype.getByKey=function(e,t){return Q(this,void 0,void 0,(function(){return Z(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 Q(this,void 0,void 0,(function(){return Z(this,(function(t){switch(t.label){case 0:return[4,this.db.getAll(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.keyValueFromPredicate=function(e,t){var n,r,i=e.predicates;if(i.length===t.length){var o=[],s=function(e){var t=i.find((function(t){return Object(y.w)(t)&&t.field===e&&"eq"===t.operator}));t&&o.push(t.operand)};try{for(var a=te(t),u=a.next();!u.done;u=a.next()){s(u.value)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o.length===t.length?o:void 0}},e.prototype.filterOnPredicate=function(e,t){return Q(this,void 0,void 0,(function(){var n,r,i;return Z(this,(function(o){switch(o.label){case 0:return n=t.predicates,r=t.type,[4,this.getAll(e)];case 1:return i=o.sent(),[2,n?i.filter((function(e){return Object(x.S)(e,r,n)})):i]}}))}))},e.prototype.inMemoryPagination=function(e,t){if(t&&e.length>1){if(t.sort){var n=I.a.getPredicates(t.sort);if(n.length){var r=Object(x.Q)(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 Q(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l;return Z(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=y.j.FIRST),Q(this,void 0,void 0,(function(){var n,r,i;return Z(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===y.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 Q(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y,g,m;return Z(this,(function(b){switch(b.label){case 0:return[4,this.checkPrivate()];case 1:return b.sent(),n=[],Object(x.H)(e)?(s=e,r=this.namespaceResolver(s),u=this.getStorenameForModel(s),[4,this.query(s,t)]):[3,9];case 2:return i=b.sent(),g=this.schema.namespaces[r].relationships[s.name].relationTypes,void 0===t?[3,5]:[4,this.deleteTraverse(g,i,s.name,r,n)];case 3:return b.sent(),[4,this.deleteItem(n)];case 4:return b.sent(),m=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[i,m]];case 5:return[4,this.deleteTraverse(g,i,s.name,r,n)];case 6:return b.sent(),[4,this.db.transaction([u],"readwrite").objectStore(u).clear()];case 7:return b.sent(),m=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[i,m]];case 8:return[3,17];case 9:return o=e,s=Object.getPrototypeOf(o).constructor,a=this.namespaceResolver(s),u=this.getStorenameForModel(s),t?(c=this.db.transaction([u],"readwrite"),l=c.objectStore(u),f=this.getIndexKeyValuesFromModel(o),[4,this._get(l,f)]):[3,13];case 10:if(void 0===(d=b.sent()))return y="Model instance not found in storage",re.warn(y,{model:o}),[2,[[o],[]]];if(h=O.a.getPredicates(t),p=h.predicates,v=h.type,!Object(x.S)(d,v,p))throw y="Conditional update failed",re.error(y,{model:d,condition:p}),new Error(y);return[4,c.done];case 11:return b.sent(),g=this.schema.namespaces[a].relationships[s.name].relationTypes,[4,this.deleteTraverse(g,[o],s.name,a,n)];case 12:return b.sent(),[3,15];case 13:return g=this.schema.namespaces[a].relationships[s.name].relationTypes,[4,this.deleteTraverse(g,[o],s.name,a,n)];case 14:b.sent(),b.label=15;case 15:return[4,this.deleteItem(n)];case 16:return b.sent(),m=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[[o],m]];case 17:return[2]}}))}))},e.prototype.deleteItem=function(e){var t,n,r,i,o,s;return Q(this,void 0,void 0,(function(){var a,u,c,l,f,d,h,p,v,y,g,m,b,w;return Z(this,(function(S){switch(S.label){case 0:a=e.map((function(e){return e.storeName})),u=this.db.transaction(ne(a),"readwrite"),S.label=1;case 1:S.trys.push([1,22,23,28]),t=X(e),S.label=2;case 2:return[4,t.next()];case 3:if((n=S.sent()).done)return[3,21];c=n.value,l=c.storeName,f=c.items,d=u.objectStore(l),S.label=4;case 4:S.trys.push([4,14,15,20]),h=X(f),S.label=5;case 5:return[4,h.next()];case 6:return(p=S.sent()).done?[3,13]:(v=p.value)?(y=void 0,"object"!==$(v)?[3,8]:(g=this.getIndexKeyValuesFromModel(v),[4,d.index("byPk").getKey(this.canonicalKeyPath(g))])):[3,12];case 7:return y=S.sent(),[3,10];case 8:return m=v.toString(),[4,d.index("byPk").getKey(m)];case 9:y=S.sent(),S.label=10;case 10:return void 0===y?[3,12]:[4,d.delete(y)];case 11:S.sent(),S.label=12;case 12:return[3,5];case 13:return[3,20];case 14:return b=S.sent(),o={error:b},[3,20];case 15:return S.trys.push([15,,18,19]),p&&!p.done&&(s=h.return)?[4,s.call(h)]:[3,17];case 16:S.sent(),S.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 w=S.sent(),r={error:w},[3,28];case 23:return S.trys.push([23,,26,27]),n&&!n.done&&(i=t.return)?[4,i.call(t)]:[3,25];case 24:S.sent(),S.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 Q(this,void 0,void 0,(function(){var g,m,b,w,S,_,E,A,O,I,T,C,P,k,N,j,M,R,D=this;return Z(this,(function(U){switch(U.label){case 0:U.trys.push([0,38,39,44]),o=X(e),U.label=1;case 1:return[4,o.next()];case 2:if((s=U.sent()).done)return[3,37];switch(g=s.value,m=g.relationType,b=g.modelName,w=g.targetName,S=g.targetNames,_=g.associatedWith,E=Object(x.u)(r,b),m){case"HAS_ONE":return[3,3];case"HAS_MANY":return[3,20];case"BELONGS_TO":return[3,34]}return[3,35];case 3:U.trys.push([3,13,14,19]),a=X(t),U.label=4;case 4:return[4,a.next()];case 5:return(u=U.sent()).done?[3,12]:(P=u.value,A="byPk",(null==S?void 0:S.length)?0===(O=S.filter((function(e){var t;return null!==(t=P[e])&&void 0!==t&&t})).map((function(e){return P[e]}))).length?[3,12]:[4,this.db.transaction(E,"readwrite").objectStore(E).index(A).get(this.canonicalKeyPath(O))]:[3,8]);case 6:return T=U.sent(),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,T?[T]:[],b,r,i)];case 7:return U.sent(),[3,12];case 8:if(k=void 0,O=void 0,w&&w in P){if(k=A,!(I=P[w]))return[3,12];O=[I]}else k=Object(x.q)(this.schema.namespaces[r].relationships[b].relationTypes,n),O=this.getIndexKeyValuesFromModel(P);return O&&k?[4,this.db.transaction(E,"readwrite").objectStore(E).index(k).get(this.canonicalKeyPath(O))]:[3,12];case 9:return T=U.sent(),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,T?[T]:[],b,r,i)];case 10:U.sent(),U.label=11;case 11:return[3,4];case 12:return[3,19];case 13:return C=U.sent(),h={error:C},[3,19];case 14:return U.trys.push([14,,17,18]),u&&!u.done&&(p=a.return)?[4,p.call(a)]:[3,16];case 15:U.sent(),U.label=16;case 16:return[3,18];case 17:if(h)throw h.error;return[7];case 18:return[7];case 19:return[3,36];case 20:U.trys.push([20,27,28,33]),c=X(t),U.label=21;case 21:return[4,c.next()];case 22:return(l=U.sent()).done?[3,26]:(P=l.value,k=Object(x.q)(this.schema.namespaces[r].relationships[b].relationTypes,n)||Object(x.r)(this.schema.namespaces[r].relationships[b].indexes,_),N=this.getIndexKeyValuesFromModel(P),[4,this.db.transaction(E,"readwrite").objectStore(E).index(k).getAll(this.canonicalKeyPath(N))]);case 23:return j=U.sent(),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,j,b,r,i)];case 24:U.sent(),U.label=25;case 25:return[3,21];case 26:return[3,33];case 27:return M=U.sent(),v={error:M},[3,33];case 28:return U.trys.push([28,,31,32]),l&&!l.done&&(y=c.return)?[4,y.call(c)]:[3,30];case 29:U.sent(),U.label=30;case 30:return[3,32];case 31:if(v)throw v.error;return[7];case 32:return[7];case 33:case 34:return[3,36];case 35:return Object(x.l)(m),[3,36];case 36:return[3,1];case 37:return[3,44];case 38:return R=U.sent(),f={error:R},[3,44];case 39:return U.trys.push([39,,42,43]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,41];case 40:U.sent(),U.label=41;case 41:return[3,43];case 42:if(f)throw f.error;return[7];case 43:return[7];case 44:return i.push({storeName:Object(x.u)(r,n),items:t.map((function(e){return D.modelInstanceCreator(D.getModelConstructorByModelName(r,n),e)}))}),[2]}}))}))},e.prototype.clear=function(){var e;return Q(this,void 0,void 0,(function(){return Z(this,(function(t){switch(t.label){case 0:return[4,this.checkPrivate()];case 1:return t.sent(),null===(e=this.db)||void 0===e||e.close(),[4,H(this.dbName)];case 2:return t.sent(),this.db=void 0,this.initPromise=void 0,[2]}}))}))},e.prototype.batchSave=function(e,t){return Q(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p=this;return Z(this,(function(v){switch(v.label){case 0:return 0===t.length?[2,[]]:[4,this.checkPrivate()];case 1:v.sent(),n=[],r=this.getStorenameForModel(e),i=this.db.transaction(r,"readwrite"),o=i.store,s=function(t){var r,i,s,u,c,l,f,d;return Z(this,(function(h){switch(h.label){case 0:return r=a.namespaceResolver(e),i=e.name,s=a.modelInstanceCreator(e,t),u=Object(x.R)(i,s,a.schema.namespaces[r],a.modelInstanceCreator,a.getModelConstructorByModelName),c=a.getIndexKeyValuesFromModel(s),l=t._deleted,[4,o.index("byPk").getKey(a.canonicalKeyPath(c))];case 1:return f=h.sent(),l?[3,3]:(d=u.find((function(e){var t=e.instance,n=p.getIndexKeyValuesFromModel(t);return Object(x.M)(n,c)})).instance,n.push([d,f?y.h.UPDATE:y.h.INSERT]),[4,o.put(d,f)]);case 2:return h.sent(),[3,5];case 3:return n.push([t,y.h.DELETE]),f?[4,o.delete(f)]:[3,5];case 4:h.sent(),h.label=5;case 5:return[2]}}))},a=this,v.label=2;case 2:v.trys.push([2,7,8,9]),u=te(t),c=u.next(),v.label=3;case 3:return c.done?[3,6]:(l=c.value,[5,s(l)]);case 4:v.sent(),v.label=5;case 5:return c=u.next(),[3,3];case 6:return[3,9];case 7:return f=v.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 v.sent(),[2,n]}}))}))},e.prototype.createObjectStoreForModel=function(e,t,n,r){var i=e.createObjectStore(n,{autoIncrement:!0});return this.schema.namespaces[t].relationships[r].indexes.forEach((function(e){var t=ee(e,3),n=t[0],r=t[1],o=t[2];i.createIndex(n,r,o)})),i},e}()),oe=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())}))},se=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])}}},ae=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},ue=function(){var e=this;this.db=new Map,this.getAllKeys=function(){return oe(e,void 0,void 0,(function(){return se(this,(function(e){return[2,Array.from(this.db.keys())]}))}))},this.multiGet=function(t){return oe(e,void 0,void 0,(function(){var e=this;return se(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 oe(e,void 0,void 0,(function(){var e=this;return se(this,(function(r){return t.forEach((function(t){return e.db.delete(t)})),"function"==typeof n&&n(),[2]}))}))},this.multiSet=function(t,n){return oe(e,void 0,void 0,(function(){var e=this;return se(this,(function(r){return t.forEach((function(t){var n=ae(t,2),r=n[0],i=n[1];e.setItem(r,i)})),"function"==typeof n&&n(),[2]}))}))},this.setItem=function(t,n){return oe(e,void 0,void 0,(function(){return se(this,(function(e){return[2,this.db.set(t,n)]}))}))},this.removeItem=function(t){return oe(e,void 0,void 0,(function(){return se(this,(function(e){return[2,this.db.delete(t)]}))}))},this.getItem=function(t){return oe(e,void 0,void 0,(function(){return se(this,(function(e){return[2,this.db.get(t)]}))}))}};var ce=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())}))},le=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},fe=function(e){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.")},de=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},he=new Map,pe=function(){function e(){this._collectionInMemoryIndex=new Map,this.storage=new ue}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 he.has(e)||he.set(e,Object(x.O)()),he.get(e)},e.prototype.init=function(){return ce(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 le(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=fe(e),r=n.next(),w.label=3;case 3:return r.done?[3,11]:(i=r.value,o=de(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,n,r){return ce(this,void 0,void 0,(function(){var i,o,s;return le(this,(function(a){switch(a.label){case 0:return i=Object(x.v)(n),o=this.getCollectionIndex(t).get(i)||this.getMonotonicFactory(t)(),s=this.getKeyForItem(t,r,o),this.getCollectionIndex(t).set(r,o),[4,this.storage.setItem(s,JSON.stringify(e))];case 1:return a.sent(),[2]}}))}))},e.prototype.batchSave=function(e,t,n){return ce(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,f,d,h,p,v,g,m,b,w,S,_,E,A=this;return le(this,(function(O){switch(O.label){case 0:if(0===t.length)return[2,[]];r=[],i=this.getCollectionIndex(e),o=new Set,s=new Set,a=[],u={},c=function(t){var r=n.map((function(e){return t[e]})),c=t._deleted,f=i.get(r.join(x.b))||l.getMonotonicFactory(e)(),d=l.getKeyForItem(e,r.join(x.b),f);a.push(d),u[d]={ulid:f,model:t},c?o.add(d):s.add(d)},l=this;try{for(f=fe(t),d=f.next();!d.done;d=f.next())h=d.value,c(h)}catch(e){w={error:e}}finally{try{d&&!d.done&&(S=f.return)&&S.call(f)}finally{if(w)throw w.error}}return[4,this.storage.multiGet(a)];case 1:return p=O.sent(),v=p.filter((function(e){return!!de(e,2)[1]})).reduce((function(e,t){var n=de(t,1)[0];return e.add(n)}),new Set),[4,new Promise((function(e,t){if(0!==o.size){var r=Array.from(o);r.forEach((function(e){var t=n.map((function(t){return u[e].model[t]})).join(x.b);i.delete(t)})),A.storage.multiRemove(r,(function(n){n&&n.length>0?t(n):e()}))}else e()}))];case 2:return O.sent(),[4,new Promise((function(e,t){if(0!==s.size){var r=Array.from(s).map((function(e){return[e,JSON.stringify(u[e].model)]}));s.forEach((function(e){var t=u[e],r=t.model,o=t.ulid,s=n.map((function(e){return r[e]})).join(x.b);i.set(s,o)})),A.storage.multiSet(r,(function(n){n&&n.length>0?t(n):e()}))}else e()}))];case 3:O.sent();try{for(g=fe(a),m=g.next();!m.done;m=g.next())b=m.value,o.has(b)&&v.has(b)?r.push([u[b].model,y.h.DELETE]):s.has(b)&&r.push([u[b].model,v.has(b)?y.h.UPDATE:y.h.INSERT])}catch(e){_={error:e}}finally{try{m&&!m.done&&(E=g.return)&&E.call(g)}finally{if(_)throw _.error}}return[2,r]}}))}))},e.prototype.get=function(e,t){return ce(this,void 0,void 0,(function(){var n,r,i;return le(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 ce(this,void 0,void 0,(function(){var n,r,i,o,s,a,u;return le(this,(function(c){switch(c.label){case 0:return n=this.getCollectionIndex(t),r=de(e===y.j.FIRST?function(){var e,t,r,i,o;try{for(var s=fe(n),a=s.next();!a.done;a=s.next()){i=(r=de(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=fe(n),a=s.next();!a.done;a=s.next())i=(r=de(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 ce(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 le(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=fe(n),h=d.next();!h.done&&(p=de(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 de(e,2)[1]})).map((function(e){var t=de(e,2)[1];return JSON.parse(t)}))]}}))}))},e.prototype.delete=function(e,t){return ce(this,void 0,void 0,(function(){var n,r;return le(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 ce(this,void 0,void 0,(function(){var e,t;return le(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 ve(e){return(ve="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 ye,ge=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())}))},me=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])}}},be=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 we?we(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)}))}}},we=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.")},Se=new s.a("DataStore"),_e=new(function(){function e(){}return e.prototype.getStorenameForModel=function(e){var t=this.namespaceResolver(e),n=e.name;return Object(x.u)(t,n)},e.prototype.getIndexKeyValuesFromModel=function(e){var t=Object.getPrototypeOf(e).constructor,n=this.namespaceResolver(t),r=Object(x.s)(this.schema.namespaces[n],t.name);return Object(x.n)(e,r)},e.prototype.getIndexKeyValuesPath=function(e){return this.getIndexKeyValuesFromModel(e).join(x.b)},e.prototype.setUp=function(e,t,n,r){return ge(this,void 0,void 0,(function(){var i,o=this;return me(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 pe,[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 ge(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p,v,g,m,b,w,S,_,E,A,I,T,C,P,k,N,j=this;return me(this,(function(M){switch(M.label){case 0:return i=Object.getPrototypeOf(e).constructor,o=this.getStorenameForModel(i),s=this.namespaceResolver(i),a=Object(x.R)(i.name,e,this.schema.namespaces[s],this.modelInstanceCreator,this.getModelConstructorByModelName),u=new Set,c=Object.values(a).map((function(e){var t=e.modelName,n=e.item,r=e.instance,i=Object(x.u)(s,t);return u.add(i),{storeName:i,item:n,instance:r,keys:Object(x.s)(j.schema.namespaces[s],t)}})),l=this.getIndexKeyValuesPath(e),[4,this.db.get(l,o)];case 1:if(f=M.sent(),t&&f&&(d=O.a.getPredicates(t),h=d.predicates,p=d.type,!Object(x.S)(f,p,h)))throw v="Conditional update failed",Se.error(v,{model:f,condition:h}),new Error(v);g=[],M.label=2;case 2:M.trys.push([2,9,10,15]),m=be(c),M.label=3;case 3:return[4,m.next()];case 4:return(b=M.sent()).done?[3,8]:(w=b.value,S=w.storeName,_=w.item,E=w.instance,A=w.keys,I=A.map((function(e){return _[e]})),T=I.join(x.b),[4,this.db.get(T,S)]);case 5:return C=M.sent(),P=C?y.h.UPDATE:y.h.INSERT,k=this.getIndexKeyValuesFromModel(e),Object(x.M)(I,k)||P===y.h.INSERT?[4,this.db.save(_,S,A,T)]:[3,7];case 6:M.sent(),g.push([E,P]),M.label=7;case 7:return[3,3];case 8:return[3,15];case 9:return N=M.sent(),n={error:N},[3,15];case 10:return M.trys.push([10,,13,14]),b&&!b.done&&(r=m.return)?[4,r.call(m)]:[3,12];case 11:M.sent(),M.label=12;case 12:return[3,14];case 13:if(n)throw n.error;return[7];case 14:return[7];case 15:return[2,g]}}))}))},e.prototype.load=function(e,t,n){var r,i,o,s,a,u,c,l,f,d;return ge(this,void 0,void 0,(function(){var h,p,v,y,g,m,b,w,S,_,E,A,O,I,T,C,P,k,N,j,M,R,D=this;return me(this,(function(U){switch(U.label){case 0:if(h=this.schema.namespaces[e],p=h.relationships[t].relationTypes,v=p.map((function(t){var n=t.modelName;return Object(x.u)(e,n)})),y=this.getModelConstructorByModelName(e,t),0===v.length)return[2,n.map((function(e){return D.modelInstanceCreator(y,e)}))];U.label=1;case 1:U.trys.push([1,38,39,44]),g=be(p),U.label=2;case 2:return[4,g.next()];case 3:if((m=U.sent()).done)return[3,37];switch(b=m.value,w=b.fieldName,S=b.modelName,_=b.targetName,E=b.targetNames,A=b.relationType,O=Object(x.u)(e,S),I=this.getModelConstructorByModelName(e,S),A){case"HAS_ONE":return[3,4];case"BELONGS_TO":return[3,19];case"HAS_MANY":return[3,34]}return[3,35];case 4:U.trys.push([4,12,13,18]),r=be(n),U.label=5;case 5:return[4,r.next()];case 6:return(i=U.sent()).done?[3,11]:(P=i.value,(null==E?void 0:E.length)?([],void 0,E.every((function(e){return null!=P[e]}))?(k=E.map((function(e){return P[e]})).join(x.b),[4,this.db.get(k,O)]):[3,11]):[3,8]);case 7:return j=U.sent(),P[w]=j&&this.modelInstanceCreator(I,j),[3,10];case 8:return T=P[_]?_:w,P[T]?(N=P[T],[4,this.db.get(N,O)]):[3,11];case 9:j=U.sent(),P[w]=j&&this.modelInstanceCreator(I,j),U.label=10;case 10:return[3,5];case 11:return[3,18];case 12:return C=U.sent(),c={error:C},[3,18];case 13:return U.trys.push([13,,16,17]),i&&!i.done&&(l=r.return)?[4,l.call(r)]:[3,15];case 14:U.sent(),U.label=15;case 15:return[3,17];case 16:if(c)throw c.error;return[7];case 17:return[7];case 18:return[3,36];case 19:U.trys.push([19,27,28,33]),o=be(n),U.label=20;case 20:return[4,o.next()];case 21:return(s=U.sent()).done?[3,26]:(P=s.value,(null==E?void 0:E.length)?(void 0,E.every((function(e){return null!=P[e]}))?(k=E.map((function(e){return P[e]})).join(x.b),[4,this.db.get(k,O)]):[3,26]):[3,23]);case 22:return j=U.sent(),P[w]=j&&this.modelInstanceCreator(I,j),null==E||E.map((function(e){delete P[e]})),[3,25];case 23:return P[_]?(N=P[_],[4,this.db.get(N,O)]):[3,25];case 24:j=U.sent(),P[w]=j&&this.modelInstanceCreator(I,j),delete P[_],U.label=25;case 25:return[3,20];case 26:return[3,33];case 27:return M=U.sent(),f={error:M},[3,33];case 28:return U.trys.push([28,,31,32]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,30];case 29:U.sent(),U.label=30;case 30:return[3,32];case 31:if(f)throw f.error;return[7];case 32:return[7];case 33:case 34:return[3,36];case 35:return Object(x.l)(A),[3,36];case 36:return[3,2];case 37:return[3,44];case 38:return R=U.sent(),a={error:R},[3,44];case 39:return U.trys.push([39,,42,43]),m&&!m.done&&(u=g.return)?[4,u.call(g)]:[3,41];case 40:U.sent(),U.label=41;case 41:return[3,43];case 42:if(a)throw a.error;return[7];case 43:return[7];case 44:return[2,n.map((function(e){return D.modelInstanceCreator(y,e)}))]}}))}))},e.prototype.query=function(e,t,n){return ge(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,f=this;return me(this,(function(d){switch(d.label){case 0:return r=this.getStorenameForModel(e),i=this.namespaceResolver(e),o=t&&O.a.getPredicates(t),s=Object(x.s)(this.schema.namespaces[i],e.name),a=o&&this.keyValueFromPredicate(o,s),u=n&&n.sort,c=n&&n.limit,[4,ge(f,void 0,void 0,(function(){var e,t,i;return me(this,(function(s){switch(s.label){case 0:return a?[4,this.getByKey(r,a)]:[3,2];case 1:return[2,(e=s.sent())?[e]:[]];case 2:return o?[4,this.filterOnPredicate(r,o)]:[3,4];case 3:return t=s.sent(),[2,this.inMemoryPagination(t,n)];case 4:return u||c?[4,this.getAll(r)]:[3,6];case 5:return i=s.sent(),[2,this.inMemoryPagination(i,n)];case 6:return[2,this.getAll(r)]}}))}))];case 1:return l=d.sent(),[4,this.load(i,e.name,l)];case 2:return[2,d.sent()]}}))}))},e.prototype.getByKey=function(e,t){return ge(this,void 0,void 0,(function(){return me(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 ge(this,void 0,void 0,(function(){return me(this,(function(t){switch(t.label){case 0:return[4,this.db.getAll(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.keyValueFromPredicate=function(e,t){var n,r,i=e.predicates;if(i.length===t.length){var o=[],s=function(e){var t=i.find((function(t){return Object(y.w)(t)&&t.field===e&&"eq"===t.operator}));t&&o.push(t.operand)};try{for(var a=we(t),u=a.next();!u.done;u=a.next()){s(u.value)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o.length===t.length?o.join(x.b):void 0}},e.prototype.filterOnPredicate=function(e,t){return ge(this,void 0,void 0,(function(){var n,r,i;return me(this,(function(o){switch(o.label){case 0:return n=t.predicates,r=t.type,[4,this.getAll(e)];case 1:return i=o.sent(),[2,n?i.filter((function(e){return Object(x.S)(e,r,n)})):i]}}))}))},e.prototype.inMemoryPagination=function(e,t){if(t&&e.length>1){if(t.sort){var n=I.a.getPredicates(t.sort);if(n.length){var r=Object(x.Q)(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=y.j.FIRST),ge(this,void 0,void 0,(function(){var n,r;return me(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 ge(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return me(this,(function(g){switch(g.label){case 0:return n=[],Object(x.H)(e)?(s=e,r=this.namespaceResolver(s),[4,this.query(s,t)]):[3,8];case 1:return i=g.sent(),v=this.schema.namespaces[r].relationships[s.name].relationTypes,void 0===t?[3,4]:[4,this.deleteTraverse(v,i,s.name,r,n)];case 2:return g.sent(),[4,this.deleteItem(n)];case 3:return g.sent(),y=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[i,y]];case 4:return[4,this.deleteTraverse(v,i,s.name,r,n)];case 5:return g.sent(),[4,this.deleteItem(n)];case 6:return g.sent(),y=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[i,y]];case 7:return[3,15];case 8:return o=e,s=Object.getPrototypeOf(o).constructor,a=this.namespaceResolver(s),u=this.getStorenameForModel(s),t?(c=this.getIndexKeyValuesPath(o),[4,this.db.get(c,u)]):[3,11];case 9:if(void 0===(l=g.sent()))return p="Model instance not found in storage",Se.warn(p,{model:o}),[2,[[o],[]]];if(f=O.a.getPredicates(t),d=f.predicates,h=f.type,!Object(x.S)(l,h,d))throw p="Conditional update failed",Se.error(p,{model:l,condition:d}),new Error(p);return v=this.schema.namespaces[a].relationships[s.name].relationTypes,[4,this.deleteTraverse(v,[o],s.name,a,n)];case 10:return g.sent(),[3,13];case 11:return v=this.schema.namespaces[a].relationships[s.name].relationTypes,[4,this.deleteTraverse(v,[o],s.name,a,n)];case 12:g.sent(),g.label=13;case 13:return[4,this.deleteItem(n)];case 14:return g.sent(),y=n.reduce((function(e,t){var n=t.items;return e.concat(n)}),[]),[2,[[o],y]];case 15:return[2]}}))}))},e.prototype.deleteItem=function(e){var t,n,r,i,o,s;return ge(this,void 0,void 0,(function(){var a,u,c,l,f,d,h,p,v;return me(this,(function(y){switch(y.label){case 0:y.trys.push([0,17,18,23]),t=be(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=be(c),y.label=4;case 4:return[4,l.next()];case 5:return(f=y.sent()).done?[3,8]:(d=f.value)?"object"!==ve(d)?[3,7]:(h=this.getIndexKeyValuesPath(d),[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 ge(this,void 0,void 0,(function(){var g,m,b,w,S,_,E,A,O,I,T,C,P,k,N,j,M,R,D,U,F,L,B,q,z,K=this;return me(this,(function(V){switch(V.label){case 0:V.trys.push([0,38,39,44]),o=be(e),V.label=1;case 1:return[4,o.next()];case 2:if((s=V.sent()).done)return[3,37];switch(g=s.value,m=g.relationType,b=g.modelName,w=g.targetName,S=g.targetNames,_=g.associatedWith,E=Object(x.u)(r,b),A=Object(x.q)(this.schema.namespaces[r].relationships[b].relationTypes,n)||Object(x.r)(this.schema.namespaces[r].relationships[b].indexes,g.associatedWith),m){case"HAS_ONE":return[3,3];case"HAS_MANY":return[3,20];case"BELONGS_TO":return[3,34]}return[3,35];case 3:V.trys.push([3,13,14,19]),a=be(t),V.label=4;case 4:return[4,a.next()];case 5:return(u=V.sent()).done?[3,12]:(D=u.value,S&&(null==S?void 0:S.length)?(A?O=A.split(x.e):_&&(O=Array.isArray(_)?_:[_]),I=S.every((function(e){return D.hasOwnProperty(e)})),N=this.getIndexKeyValuesPath(D),C=O===_,0===(T=I&&C?S.filter((function(e){var t;return null!==(t=D[e])&&void 0!==t&&t})).map((function(e){return D[e]})):N.split(x.b)).length?[3,12]:[4,this.db.getAll(E)]):[3,8]);case 6:return F=V.sent(),M=void 0,M=I?F.filter((function(e){return O.every((function(t){return T.includes(e[t])}))})):F.filter((function(e){return e[O]===T})),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,M,b,r,i)];case 7:return V.sent(),[3,11];case 8:return P=A||_,k=w in D,N=this.getIndexKeyValuesPath(D),(j=k?D[w]:N)?[4,this.db.getAll(E)]:[3,12];case 9:return F=V.sent(),M=F.filter((function(e){return e[P]===j})),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,M,b,r,i)];case 10:V.sent(),V.label=11;case 11:return[3,4];case 12:return[3,19];case 13:return R=V.sent(),h={error:R},[3,19];case 14:return V.trys.push([14,,17,18]),u&&!u.done&&(p=a.return)?[4,p.call(a)]:[3,16];case 15:V.sent(),V.label=16;case 16:return[3,18];case 17:if(h)throw h.error;return[7];case 18:return[7];case 19:return[3,36];case 20:V.trys.push([20,27,28,33]),c=be(t),V.label=21;case 21:return[4,c.next()];case 22:return(l=V.sent()).done?[3,26]:(D=l.value,U=this.getIndexKeyValuesFromModel(D),[4,this.db.getAll(E)]);case 23:return F=V.sent(),L=A.split(x.e),B=F.filter((function(e){return L.every((function(t){return U.includes(e[t])}))})),[4,this.deleteTraverse(this.schema.namespaces[r].relationships[b].relationTypes,B,b,r,i)];case 24:V.sent(),V.label=25;case 25:return[3,21];case 26:return[3,33];case 27:return q=V.sent(),v={error:q},[3,33];case 28:return V.trys.push([28,,31,32]),l&&!l.done&&(y=c.return)?[4,y.call(c)]:[3,30];case 29:V.sent(),V.label=30;case 30:return[3,32];case 31:if(v)throw v.error;return[7];case 32:return[7];case 33:case 34:return[3,36];case 35:return Object(x.l)(m),[3,36];case 36:return[3,1];case 37:return[3,44];case 38:return z=V.sent(),f={error:z},[3,44];case 39:return V.trys.push([39,,42,43]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,41];case 40:V.sent(),V.label=41;case 41:return[3,43];case 42:if(f)throw f.error;return[7];case 43:return[7];case 44:return i.push({storeName:Object(x.u)(r,n),items:t.map((function(e){return K.modelInstanceCreator(K.getModelConstructorByModelName(r,n),e)}))}),[2]}}))}))},e.prototype.clear=function(){return ge(this,void 0,void 0,(function(){return me(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 ge(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p=this;return me(this,(function(v){switch(v.label){case 0:n=e.name,r=this.namespaceResolver(e),i=Object(x.u)(r,n),o=Object(x.s)(this.schema.namespaces[r],n),s=[],a=function(t){var i=u.modelInstanceCreator(e,t),o=Object(x.R)(n,i,u.schema.namespaces[r],u.modelInstanceCreator,u.getModelConstructorByModelName),a=u.getIndexKeyValuesPath(i),c=o.find((function(e){var t=e.instance,n=p.getIndexKeyValuesPath(t);return Object(x.M)([n],[a])})).instance;s.push(c)},u=this;try{for(c=we(t),l=c.next();!l.done;l=c.next())f=l.value,a(f)}catch(e){d={error:e}}finally{try{l&&!l.done&&(h=c.return)&&h.call(c)}finally{if(d)throw d.error}}return[4,this.db.batchSave(i,s,o)];case 1:return[2,v.sent()]}}))}))},e}()),Ee=function(){return Object(a.b)().isBrowser&&window.indexedDB||Object(a.c)()&&self.indexedDB?ie:_e},Ae=function(){return(Ae=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)},Oe=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Ie=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Te=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},Ce=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},Pe=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.")},xe=new s.a("DataStore"),ke=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||Ee(),this.pushStream=new P.a}return e.getNamespace=function(){return{name:x.f,relationships:{},enums:{},models:{},nonModels:{}}},e.prototype.init=function(){return Oe(this,void 0,void 0,(function(){var e,t;return Ie(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 xe.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 Oe(this,void 0,void 0,(function(){var i,o=this;return Ie(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=Ce(s,2),c=u[0],l=u[1],f=!!n;if(l===y.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:O.a.getPredicates(t,!1),savedElement:c})})),[2,i]}}))}))},e.prototype.delete=function(e,t,n){return Oe(this,void 0,void 0,(function(){var r,i,o,s,a,u,c,l=this;return Ie(this,(function(f){switch(f.label){case 0:return[4,this.init()];case 1:return f.sent(),[4,this.adapter.delete(e,t)];case 2:return c=Ce.apply(void 0,[f.sent(),2]),i=c[0],r=c[1],o=Object(x.H)(e)?e:Object.getPrototypeOf(e||{}).constructor,s=this.namespaceResolver(o),a=this.schema.namespaces[s].models[o.name],u=new Set(i.map((function(e){return Object(k.h)(a,e)}))),Object(x.H)(e)||Array.isArray(r)||(r=[r]),r.forEach((function(r){var i,o=Object.getPrototypeOf(r).constructor;if(!Object(x.H)(e)){var s=Object(k.h)(a,r);i=u.has(s)?O.a.getPredicates(t,!1):void 0}l.pushStream.next({model:o,opType:y.h.DELETE,element:r,mutator:n,condition:i})})),[2,[i,r]]}}))}))},e.prototype.query=function(e,t,n){return Oe(this,void 0,void 0,(function(){return Ie(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=y.j.FIRST),Oe(this,void 0,void 0,(function(){return Ie(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=O.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 Te(e,["mutator"])}));return r||(u=u.filter((function(t){var n=t.model,r=t.element;return e===n&&(!a||Object(x.S)(r,s,o))}))),u},e.prototype.clear=function(e){return void 0===e&&(e=!0),Oe(this,void 0,void 0,(function(){return Ie(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 Oe(this,void 0,void 0,(function(){var r,i=this;return Ie(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=Ce(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=Ce(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,g=void 0===v?[]:v;if(c.forEach((function(e){var n,r,i,o,s,c,l,f,h,p,v,m=Object(y.z)(null===(v=d[e])||void 0===v?void 0:v.association);if(Array.isArray(m))try{for(var b=Pe(m),w=b.next();!w.done;w=b.next()){var S=w.value;if(!Object(x.T)(a[S],t[S])){u[S]=void 0===t[S]?null:t[S];try{for(var _=(i=void 0,Pe(g)),E=_.next();!E.done;E=_.next()){if((k=E.value).has(S))try{for(var A=(s=void 0,Pe(k)),O=A.next();!O.done;O=A.next()){var I=O.value;u[I]=t[I]}}catch(e){s={error:e}}finally{try{O&&!O.done&&(c=A.return)&&c.call(A)}finally{if(s)throw s.error}}}}catch(e){i={error:e}}finally{try{E&&!E.done&&(o=_.return)&&o.call(_)}finally{if(i)throw i.error}}}}}catch(e){n={error:e}}finally{try{w&&!w.done&&(r=b.return)&&r.call(b)}finally{if(n)throw n.error}}else{var T=m||e;if(!Object(x.T)(a[T],t[T])){u[T]=void 0===t[T]?null:t[T];try{for(var C=Pe(g),P=C.next();!P.done;P=C.next()){var k;if((k=P.value).has(T))try{for(var N=(h=void 0,Pe(k)),j=N.next();!j.done;j=N.next()){I=j.value;u[I]=t[I]}}catch(e){h={error:e}}finally{try{j&&!j.done&&(p=N.return)&&p.call(N)}finally{if(h)throw h.error}}}}catch(e){l={error:e}}finally{try{P&&!P.done&&(f=C.return)&&f.call(C)}finally{if(l)throw l.error}}}}})),0===Object.keys(u).length)return null;if(p&&p.length)try{for(var m=Pe(p),b=m.next();!b.done;b=m.next()){var w=b.value;u[w]=t[w]}}catch(e){r={error:e}}finally{try{b&&!b.done&&(i=m.return)&&i.call(m)}finally{if(r)throw r.error}}var S=t.id,_=t._version,E=t._lastChangedAt,A=t._deleted;return Ae(Ae({},u),{id:S,_version:_,_lastChangedAt:E,_deleted:A})},e}(),Ne=function(){function e(e,t,n,r,i,o){this.mutex=new T,this.storage=new ke(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 Oe(this,void 0,void 0,(function(){return Ie(this,(function(i){return[2,this.runExclusive((function(i){return i.save(e,t,n,r)}))]}))}))},e.prototype.delete=function(e,t,n){return Oe(this,void 0,void 0,(function(){return Ie(this,(function(r){return[2,this.runExclusive((function(r){if(Object(x.H)(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 Oe(this,void 0,void 0,(function(){return Ie(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=y.j.FIRST),Oe(this,void 0,void 0,(function(){return Ie(this,(function(n){return[2,this.runExclusive((function(n){return n.queryOne(e,t)}))]}))}))},e.getNamespace=function(){return ke.getNamespace()},e.prototype.observe=function(e,t,n){return this.storage.observe(e,t,n)},e.prototype.clear=function(){return Oe(this,void 0,void 0,(function(){return Ie(this,(function(e){switch(e.label){case 0:return[4,this.runExclusive((function(e){return e.clear()}))];case 1:return e.sent(),[2]}}))}))},e.prototype.batchSave=function(e,t){return this.storage.batchSave(e,t)},e.prototype.init=function(){return Oe(this,void 0,void 0,(function(){return Ie(this,(function(e){return[2,this.storage.init()]}))}))},e}(),je=n(14),Me=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Re=(new(function(){function e(){}return e.prototype.networkMonitor=function(t){if(Object(a.b)().isNode)return h.a.from([{online:!0}]);var n=Object(a.c)()?self:window;return new h.a((function(t){t.next({online:n.navigator.onLine});var r=function(){return t.next({online:!0})},i=function(){return t.next({online:!1})};return n.addEventListener("online",r),n.addEventListener("offline",i),e._observers.push(t),function(){n.removeEventListener("online",r),n.removeEventListener("offline",i),e._observers=e._observers.filter((function(e){return e!==t}))}}))},e._observerOverride=function(t){var n,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=Me(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(),De=function(){return(De=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)},Ue=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())}))},Fe=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])}}},Le=(new s.a("DataStore"),function(){function e(){this.connectionStatus={online:!1}}return e.prototype.status=function(){var e=this;if(this.observer)throw new Error("Subscriber already exists");return new h.a((function(t){return e.observer=t,e.subscription=Re.subscribe((function(n){var r=n.online;e.connectionStatus.online=r;var i=De({},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.stop=function(){return Ue(this,void 0,void 0,(function(){return Fe(this,(function(e){return this.unsubscribe(),[2]}))}))},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=De({},e.connectionStatus);e.observer.next(t)}),5e3))},e}()),Be=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())}))},qe=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])}}},ze=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},Ke=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.")},Ve=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(ze(arguments[t]));return e},He=function(){function e(e,t){this.outbox=e,this.ownSymbol=t}return e.prototype.merge=function(e,t,n){return Be(this,void 0,void 0,(function(){var r,i,o,s,a;return qe(this,(function(u){switch(u.label){case 0:return[4,this.outbox.getForModel(e,t,n)];case 1:return i=u.sent(),o=t._deleted,0!==i.length?[3,5]:o?(r=y.h.DELETE,[4,e.delete(t,void 0,this.ownSymbol)]):[3,3];case 2:return u.sent(),[3,5];case 3:return[4,e.save(t,void 0,this.ownSymbol)];case 4:s=ze.apply(void 0,[u.sent(),1]),a=ze(s[0],2),r=a[1],u.label=5;case 5:return[2,r]}}))}))},e.prototype.mergePage=function(e,t,n,r){return Be(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f;return qe(this,(function(d){switch(d.label){case 0:i=new Map;try{for(o=Ke(n),s=o.next();!s.done;s=o.next())a=s.value,u=Object(k.h)(r,a),i.set(u,a)}catch(e){l={error:e}}finally{try{s&&!s.done&&(f=o.return)&&f.call(o)}finally{if(l)throw l.error}}return c=Ve(i.values()),[4,e.batchSave(t,c,this.ownSymbol)];case 1:return[2,d.sent()]}}))}))},e}(),Ge=function(){return(Ge=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)},We=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},Ye=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Je=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},$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},Qe=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 We(this,void 0,void 0,(function(){var n=this;return Ye(this,(function(r){switch(r.label){case 0:return[4,e.runExclusive((function(e){return We(n,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f=this;return Ye(this,(function(d){switch(d.label){case 0:return n=this.schema.namespaces[x.g].models.MutationEvent,r=O.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=$e.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!==k.a.CREATE?[3,8]:s!==k.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]}}))}))}))];case 1:return r.sent(),[2]}}))}))},e.prototype.dequeue=function(e,t,n){return We(this,void 0,void 0,(function(){var r;return Ye(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 We(this,void 0,void 0,(function(){var t;return Ye(this,(function(n){switch(n.label){case 0:return[4,e.queryOne(this.MutationEvent,y.j.FIRST)];case 1:return t=n.sent(),this.inProgressMutationEventId=t?t.id:void 0,[2,t]}}))}))},e.prototype.getForModel=function(e,t,n){return We(this,void 0,void 0,(function(){var r,i;return Ye(this,(function(o){switch(o.label){case 0:return r=this.schema.namespaces[x.g].models.MutationEvent,i=Object(k.h)(n,t),[4,e.query(this.MutationEvent,O.a.createFromExisting(r,(function(e){return e.modelId("eq",i)})))];case 1:return[2,o.sent()]}}))}))},e.prototype.getModelIds=function(e){return We(this,void 0,void 0,(function(){var t,n;return Ye(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 We(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,d,h,p,v,y,g=this;return Ye(this,(function(m){switch(m.label){case 0:return n.operation!==r?[2]:(i=t._version,o=t._lastChangedAt,t._deleted,s=Je(t,["_version","_lastChangedAt","_deleted"]),a=this.removeTimestampFields(n.model,s),(u=JSON.parse(n.data))?(u._version,u._lastChangedAt,u._deleted,c=Je(u,["_version","_lastChangedAt","_deleted"]),l=this.removeTimestampFields(n.model,c),Object(x.T)(a,l,!0)?(f=this.schema.namespaces[x.g].models.MutationEvent,d=this.schema.namespaces.user.models[n.model],h=Object(k.h)(d,t),p=O.a.createFromExisting(f,(function(e){return e.modelId("eq",h).id("ne",g.inProgressMutationEventId)})),[4,e.query(this.MutationEvent,p)]):[2]):[2]);case 1:return(v=m.sent()).length?(y=v.map((function(e){var t=JSON.parse(e.data),n=Ge(Ge({},t),{_version:i,_lastChangedAt:o});return g.MutationEvent.copyOf(e,(function(e){e.data=JSON.stringify(n)}))})),[4,e.delete(this.MutationEvent,p)]):[2];case 2:return m.sent(),[4,Promise.all(y.map((function(t){return We(g,void 0,void 0,(function(){return Ye(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 m.sent(),[2]}}))}))},e.prototype.mergeUserFields=function(e,t){var n=JSON.parse(e.data),r=n._version,i=n._lastChangedAt,o=n._deleted,s=Je(n,["_version","_lastChangedAt","_deleted"]),a=JSON.parse(t.data),u=(a._version,a._lastChangedAt,a._deleted,Je(a,["_version","_lastChangedAt","_deleted"])),c=JSON.stringify(Ge(Ge({_version:r,_lastChangedAt:i,_deleted:o},s),u));return this.modelInstanceCreator(this.MutationEvent,Ge(Ge({},t),{data:c}))},e.prototype.removeTimestampFields=function(e,t){var n,r,i="createdAt",o="updatedAt",s=null===(n=this.schema.namespaces[x.h].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}(),Ze=n(153),Xe=n(23),et=function(){return(et=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},tt=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},nt=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])}}},rt=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},it=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},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=new s.a("DataStore"),at=function(){function e(e,t,n,i,o,s,a,c,l,f,d){void 0===a&&(a={}),this.schema=e,this.storage=t,this.userClasses=n,this.outbox=i,this.modelInstanceCreator=o,this.MutationEvent=s,this.amplifyConfig=a,this.authModeStrategy=c,this.errorHandler=l,this.conflictHandler=f,this.amplifyContext=d,this.typeQuery=new WeakMap,this.processing=!1,this.runningProcesses=new u.a,this.amplifyContext.API=this.amplifyContext.API||r.a,this.generateQueries()}return e.prototype.generateQueries=function(){var e=this;Object.values(this.schema.namespaces).forEach((function(t){Object.values(t.models).filter((function(e){return e.syncable})).forEach((function(n){var r=it(Object(k.b)(t,n,"CREATE"),1)[0],i=it(Object(k.b)(t,n,"UPDATE"),1)[0],o=it(Object(k.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 h.a((function(t){e.observer=t;try{e.resume()}catch(e){throw st.error("mutations processor start error",e),e}return e.runningProcesses.addCleaner((function(){return tt(e,void 0,void 0,(function(){return nt(this,(function(e){return this.pause(),[2]}))}))}))}))},e.prototype.stop=function(){return tt(this,void 0,void 0,(function(){return nt(this,(function(e){switch(e.label){case 0:return[4,this.runningProcesses.close()];case 1:return e.sent(),[4,this.runningProcesses.open()];case 2:return e.sent(),[2]}}))}))},e.prototype.resume=function(){return tt(this,void 0,void 0,(function(){var e=this;return nt(this,(function(t){switch(t.label){case 0:return[4,this.runningProcesses.isOpen&&this.runningProcesses.add((function(t){return tt(e,void 0,void 0,(function(){var e,n,r,i,o,s=this;return nt(this,(function(a){switch(a.label){case 0:if(this.processing||!this.isReady()||!this.runningProcesses.isOpen)return[2];this.processing=!0,n=x.h,r=function(){var r,o,a,u,c,l,f,d,h,p,v,y,g,m,b,w;return nt(this,(function(S){switch(S.label){case 0:r=e.model,o=e.operation,a=e.data,u=e.condition,c=i.userClasses[r],l=void 0,f=void 0,d=void 0,S.label=1;case 1:return S.trys.push([1,4,,5]),[4,Object(k.i)({authModeStrategy:i.authModeStrategy,defaultAuthMode:i.amplifyConfig.aws_appsync_authenticationType,modelName:r,schema:i.schema})];case 2:return h=S.sent(),p=h[o.toUpperCase()],v=0,[4,(y=function(){return tt(s,void 0,void 0,(function(){var i,s;return nt(this,(function(l){switch(l.label){case 0:return l.trys.push([0,2,,4]),st.debug("Attempting mutation with authMode: "+p[v]),[4,this.jitteredRetry(n,r,o,a,u,c,this.MutationEvent,e,p[v],t)];case 1:return i=l.sent(),st.debug("Mutation sent successfully with authMode: "+p[v]),[2,i];case 2:if(s=l.sent(),++v>=p.length)throw st.debug("Mutation failed with authMode: "+p[v-1]),s;return st.debug("Mutation failed with authMode: "+p[v-1]+". Retrying with authMode: "+p[v]),[4,y()];case 3:return[2,l.sent()];case 4:return[2]}}))}))})()];case 3:return w=it.apply(void 0,[S.sent(),3]),l=w[0],f=w[1],d=w[2],[3,5];case 4:return"Offline"===(g=S.sent()).message||"RetryMutation"===g.message?[2,"continue"]:[3,5];case 5:return void 0!==l?[3,7]:(st.debug("done retrying"),[4,i.storage.runExclusive((function(e){return tt(s,void 0,void 0,(function(){return nt(this,(function(t){switch(t.label){case 0:return[4,this.outbox.dequeue(e)];case 1:return t.sent(),[2]}}))}))}))]);case 6:return S.sent(),[2,"continue"];case 7:return m=l.data[f],b=!1,[4,i.storage.runExclusive((function(e){return tt(s,void 0,void 0,(function(){return nt(this,(function(t){switch(t.label){case 0:return[4,this.outbox.dequeue(e,m,o)];case 1:return t.sent(),[4,this.outbox.peek(e)];case 2:return b=void 0!==t.sent(),[2]}}))}))}))];case 8:return S.sent(),i.observer.next({operation:o,modelDefinition:d,model:m,hasMore:b}),[2]}}))},i=this,a.label=1;case 1:return(o=this.processing&&this.runningProcesses.isOpen)?[4,this.outbox.peek(this.storage)]:[3,3];case 2:o=void 0!==(e=a.sent()),a.label=3;case 3:return o?[5,r()]:[3,5];case 4:return a.sent(),[3,1];case 5:return this.pause(),[2]}}))}))}),"mutation resume loop")];case 1:return t.sent(),[2]}}))}))},e.prototype.jitteredRetry=function(e,t,n,r,i,o,s,a,u,c){return tt(this,void 0,void 0,(function(){var l=this;return nt(this,(function(f){switch(f.label){case 0:return[4,Object(Ze.d)((function(t,n,r,i,o,s,a){return tt(l,void 0,void 0,(function(){var c,l,f,d,h,p,v,g,m,b,w,S,_,E,A,O,I,T,C,P,N,j,M,R,D,U;return nt(this,(function(F){switch(F.label){case 0:return c=it(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(k.j)(u,this.amplifyConfig)];case 1:v=F.sent(),g={query:l,variables:f,authMode:u,authToken:v,userAgentSuffix:x.i},m=0,b=this.opTypeFromTransformerOperation(n),F.label=2;case 2:return F.trys.push([2,4,,17]),[4,this.amplifyContext.API.graphql(g)];case 3:return[2,[F.sent(),h,p]];case 4:if(!((w=F.sent()).errors&&w.errors.length>0))return[3,15];if(S=it(w.errors,1),_=S[0],E=_.originalError,A=(void 0===E?{}:E).code,O=void 0===A?null:A,"Unauthorized"===_.errorType)throw new Ze.a("Unauthorized");if("Network Error"===_.message||"ECONNABORTED"===O){if(!this.processing)throw new Ze.a("Offline");throw new Error("Network Error")}return"ConflictUnhandled"!==_.errorType?[3,13]:(m++,I=void 0,m>10?(I=y.b,[3,8]):[3,5]);case 5:return F.trys.push([5,7,,8]),[4,this.conflictHandler({modelConstructor:o,localModel:this.modelInstanceCreator(o,f.input),remoteModel:this.modelInstanceCreator(o,_.data),operation:b,attempts:m})];case 6:return I=F.sent(),[3,8];case 7:return T=F.sent(),st.warn("conflict trycatch",T),[3,17];case 8:return I!==y.b?[3,11]:(C=it(Object(k.b)(this.schema.namespaces[e],p,"GET"),1),P=it(C[0],3),N=P[1],j=P[2],[4,Object(k.j)(u,this.amplifyConfig)]);case 9:return M=F.sent(),[4,this.amplifyContext.API.graphql({query:j,variables:{id:f.input.id},authMode:u,authToken:M,userAgentSuffix:x.i})];case 10:return[2,[F.sent(),N,p]];case 11:return R=this.schema.namespaces[e],D=Object(k.d)(R.relationships,p,b,o,I,d,s,this.modelInstanceCreator,a.id),[4,this.storage.save(D)];case 12:throw F.sent(),new Ze.a("RetryMutation");case 13:try{this.errorHandler({recoverySuggestion:"Ensure app code is up to date, auth directives exist and are correct on each model, and that server-side data has not been invalidated by a schema change. If the problem persists, search for or create an issue: https://github.com/aws-amplify/amplify-js/issues",localModel:f.input,message:_.message,operation:n,errorType:Object(Xe.a)(_),errorInfo:_.errorInfo,process:y.i.mutate,cause:_,remoteModel:_.data?this.modelInstanceCreator(o,_.data):null})}catch(e){st.warn("Mutation error handler failed with:",e)}finally{return[2,_.data?[{data:(U={},U[h]=_.data,U)},h,p]:[]]}F.label=14;case 14:return[3,16];case 15:throw new Ze.a(w);case 16:return[3,17];case 17:if(g)return[3,2];F.label=18;case 18:return[2]}}))}))}),[t,n,r,i,o,s,a],ct,c)];case 1:return[2,f.sent()]}}))}))},e.prototype.createQueryVariables=function(e,t,n,r,i){var o,s,a,u,c,l,f,d=this.schema.namespaces[e].models[t],h=this.schema.namespaces[e].keys[t].primaryKey,p=this.typeQuery.get(d),v=it(p.find((function(e){return it(e,1)[0]===n})),3),g=v[1],m=v[2],b=JSON.parse(r),w=b._version,S=rt(b,["_version"]),_={};if(null==h?void 0:h.length)try{for(var E=ot(h),A=E.next();!A.done;A=E.next()){var O=A.value;_[O]=S[O]}}catch(e){o={error:e}}finally{try{A&&!A.done&&(s=E.return)&&s.call(E)}finally{if(o)throw o.error}}else _[x.d]=S.id;if(n===k.a.DELETE)f=_;else{f={};var I=Object.values(d.fields);try{for(var T=ot(I),C=T.next();!C.done;C=T.next()){var P=C.value,N=P.name,j=P.type,M=P.association;if(Object(y.t)(j)){if(Object(y.z)(M)&&"BELONGS_TO"===M.connectionType){var R=Object(x.p)(M);if(R)try{for(var D=(c=void 0,ot(R)),U=D.next();!U.done;U=D.next()){var F=U.value;f[F]=S[F]}}catch(e){c={error:e}}finally{try{U&&!U.done&&(l=D.return)&&l.call(D)}finally{if(c)throw c.error}}}}else(n!==k.a.UPDATE||S.hasOwnProperty(N))&&(f[N]=S[N])}}catch(e){a={error:e}}finally{try{C&&!C.done&&(u=T.return)&&u.call(T)}finally{if(a)throw a.error}}}var L=et(et({},f),{_version:w}),B=JSON.parse(i);return[m,et({input:L},n===k.a.CREATE?{}:{condition:Object.keys(B).length>0?B:null}),B,g,d]},e.prototype.opTypeFromTransformerOperation=function(e){switch(e){case k.a.CREATE:return y.h.INSERT;case k.a.DELETE:return y.h.DELETE;case k.a.UPDATE:return y.h.UPDATE;case k.a.GET:break;default:Object(x.l)(e)}},e.prototype.pause=function(){this.processing=!1},e}(),ut=Object(Ze.b)(3e5),ct=function(e,t,n){var r=ut(e);return!1===r&&"Network Error"===(null==n?void 0:n.message)?3e5:r},lt=n(40),ft=function(){return(ft=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)},dt=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())}))},ht=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])}}},pt=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},vt=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.")},yt={items:[],nextToken:null,startedAt:null},gt=new s.a("DataStore"),mt=function(){function e(e,t,n,i,o,s){void 0===n&&(n={}),this.schema=e,this.syncPredicates=t,this.amplifyConfig=n,this.authModeStrategy=i,this.errorHandler=o,this.amplifyContext=s,this.typeQuery=new WeakMap,this.runningProcesses=new u.a,s.API=s.API||r.a,this.generateQueries()}return e.prototype.generateQueries=function(){var e=this;Object.values(this.schema.namespaces).forEach((function(t){Object.values(t.models).filter((function(e){return e.syncable})).forEach((function(n){var r=pt(Object(k.b)(t,n,"LIST"),1),i=pt(r[0]).slice(1);e.typeQuery.set(n,i)}))}))},e.prototype.graphqlFilterFromPredicate=function(e){if(!this.syncPredicates)return null;var t=O.a.getPredicates(this.syncPredicates.get(e),!1);return t?Object(k.m)(t):null},e.prototype.retrievePage=function(e,t,n,r,i,o){return void 0===r&&(r=null),dt(this,void 0,void 0,(function(){var s,a,u,c,l,f,d,h,p,v,y,g,m,b=this;return ht(this,(function(w){switch(w.label){case 0:return s=pt(this.typeQuery.get(e),2),a=s[0],u=s[1],c={limit:r,nextToken:n,lastSync:t,filter:i},[4,Object(k.i)({authModeStrategy:this.authModeStrategy,defaultAuthMode:this.amplifyConfig.aws_appsync_authenticationType,modelName:e.name,schema:this.schema})];case 1:return l=w.sent(),f=l.READ,d=0,[4,(h=function(){return dt(b,void 0,void 0,(function(){var t,n,r,i;return ht(this,(function(s){switch(s.label){case 0:if(!this.runningProcesses.isOpen)throw new Error("sync.retreievePage termination was requested. Exiting.");s.label=1;case 1:return s.trys.push([1,3,,5]),gt.debug("Attempting sync with authMode: "+f[d]),[4,this.jitteredRetry({query:u,variables:c,opName:a,modelDefinition:e,authMode:f[d],onTerminate:o})];case 2:return t=s.sent(),gt.debug("Sync successful with authMode: "+f[d]),[2,t];case 3:if(n=s.sent(),++d>=f.length){if(r=f[d-1],gt.debug("Sync failed with authMode: "+r,n),Object(k.f)(n)||Object(k.g)(n))return gt.warn("User is unauthorized to query "+a+" with auth mode "+r+". No data could be returned."),[2,{data:(i={},i[a]=yt,i)}];throw n}return gt.debug("Sync failed with authMode: "+f[d-1]+". Retrying with authMode: "+f[d]),[4,h()];case 4:return[2,s.sent()];case 5:return[2]}}))}))})()];case 2:return p=w.sent().data,v=p[a],y=v.items,g=v.nextToken,m=v.startedAt,[2,{nextToken:g,startedAt:m,items:y}]}}))}))},e.prototype.jitteredRetry=function(e){var t=e.query,n=e.variables,r=e.opName,i=e.modelDefinition,o=e.authMode,s=e.onTerminate;return dt(this,void 0,void 0,(function(){var e=this;return ht(this,(function(a){switch(a.label){case 0:return[4,Object(Ze.c)((function(t,n){return dt(e,void 0,void 0,(function(){var e,s,a,u,l,f,d,h,p,v,g,m=this;return ht(this,(function(b){switch(b.label){case 0:return b.trys.push([0,3,,6]),[4,Object(k.j)(o,this.amplifyConfig)];case 1:return e=b.sent(),[4,this.amplifyContext.API.graphql({query:t,variables:n,authMode:o,authToken:e,userAgentSuffix:x.i})];case 2:return[2,b.sent()];case 3:if(s=b.sent(),a=Object(k.f)(s)||Object(k.g)(s))throw new Ze.a(a);return u=Boolean(null===(p=null===(h=null==s?void 0:s.data)||void 0===h?void 0:h[r])||void 0===p?void 0:p.items),l=(null==s?void 0:s.errors)&&s.errors.some((function(e){return"Unauthorized"===e.errorType})),f=(null==s?void 0:s.errors)&&s.errors.filter((function(e){return"Unauthorized"!==e.errorType})),d=s,u&&(d.data[r].items=d.data[r].items.filter((function(e){return null!==e}))),u&&(null==f?void 0:f.length)?[4,Promise.all(f.map((function(e){return dt(m,void 0,void 0,(function(){var t;return ht(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(Xe.c)(e),process:y.i.sync,remoteModel:null,cause:e})];case 1:return n.sent(),[3,3];case 2:return t=n.sent(),gt.error("Sync error handler failed with:",t),[3,3];case 3:return[2]}}))}))})))]:[3,5];case 4:b.sent(),c.a.dispatch("datastore",{event:"nonApplicableDataReceived",data:{errors:f,modelName:i.name}}),b.label=5;case 5:if(l)return gt.warn("queryError","User is unauthorized to query "+r+", some items could not be returned."),d.data=d.data||{},d.data[r]=ft(ft({},yt),d.data[r]),[2,d];if(null===(g=null===(v=d.data)||void 0===v?void 0:v[r].items)||void 0===g?void 0:g.length)return[2,d];throw s;case 6:return[2]}}))}))}),[t,n],void 0,s)];case 1:return[2,a.sent()]}}))}))},e.prototype.start=function(e){var t=this,n=this.amplifyConfig,r=n.maxRecordsToSync,i=n.syncPageSize,o=new Map;return new h.a((function(n){var s=Object.values(t.schema.namespaces).reduce((function(t,n){var r,i;try{for(var o=vt(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),a=Array.from(s.entries()).filter((function(e){return pt(e,1)[0].syncable})).map((function(e){var s=pt(e,2),a=s[0],u=pt(s[1],2),c=u[0],l=u[1];return t.runningProcesses.isOpen&&t.runningProcesses.add((function(e){return dt(t,void 0,void 0,(function(){var t,s,u,f,d,h,p,v,y,g=this;return ht(this,(function(m){switch(m.label){case 0:return t=!1,s=null,u=null,f=null,d=0,h=this.graphqlFilterFromPredicate(a),p=this.schema.namespaces[c].modelTopologicalOrdering.get(a.name),v=p.map((function(e){return o.get(c+"_"+e)})),y=new Promise((function(o){return dt(g,void 0,void 0,(function(){var p,y;return ht(this,(function(g){switch(g.label){case 0:return[4,Promise.all(v)];case 1:g.sent(),g.label=2;case 2:return this.runningProcesses.isOpen?(p=Math.min(r-d,i),[4,this.retrievePage(a,l,s,p,h,e)]):[2];case 3:y=g.sent(),f=y.items,s=y.nextToken,u=y.startedAt,d+=f.length,t=null===s||d>=r,n.next({namespace:c,modelDefinition:a,items:f,done:t,startedAt:u,isFullSync:!l}),g.label=4;case 4:if(!t)return[3,2];g.label=5;case 5:return o(),[2]}}))}))})),o.set(c+"_"+a.name,y),[4,y];case 1:return m.sent(),[2]}}))}))}),"adding model "+a.name)}));Promise.all(a).then((function(){n.complete()}))}))},e.prototype.stop=function(){return dt(this,void 0,void 0,(function(){return ht(this,(function(e){switch(e.label){case 0:return gt.debug("stopping sync processor"),[4,this.runningProcesses.close()];case 1:return e.sent(),[4,this.runningProcesses.open()];case 2:return e.sent(),gt.debug("sync processor stopped"),[2]}}))}))},e}(),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="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},_t=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.")},Et=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(St(arguments[t]));return e},At=Object(a.b)().isNode,Ot=new s.a("DataStore"),It=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"}(ye||(ye={}));var Tt=function(){function e(e,t,n,r,i,o,s,a,c,l,f,d,h){void 0===l&&(l={}),this.schema=e,this.namespaceResolver=t,this.modelClasses=n,this.userModelClasses=r,this.storage=i,this.modelInstanceCreator=o,this.syncPredicates=c,this.amplifyConfig=l,this.authModeStrategy=f,this.amplifyContext=d,this.connectivityMonitor=h,this.online=!1,this.modelSyncedStatus=new WeakMap,this.runningProcesses=new u.a;var p=this.modelClasses.MutationEvent;this.outbox=new Qe(this.schema,p,o,It),this.modelMerger=new He(this.outbox,It),this.syncQueriesProcessor=new mt(this.schema,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,a,this.amplifyContext),this.subscriptionsProcessor=new lt.b(this.schema,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,a,this.amplifyContext),this.mutationsProcessor=new at(this.schema,this.storage,this.userModelClasses,this.outbox,this.modelInstanceCreator,p,this.amplifyConfig,this.authModeStrategy,a,s,this.amplifyContext),this.datastoreConnectivity=this.connectivityMonitor||new Le}return e.prototype.getModelSyncedStatus=function(e){return this.modelSyncedStatus.get(e)},e.prototype.start=function(e){var t=this;return new h.a((function(n){Ot.log("starting sync engine...");var r=[];t.runningProcesses.add((function(){return bt(t,void 0,void 0,(function(){var t,i,o,s=this;return wt(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,t){s.datastoreConnectivity.status().subscribe((function(i){var o=i.online;return bt(s,void 0,void 0,(function(){var i=this;return wt(this,(function(s){return[2,this.runningProcesses.isOpen&&this.runningProcesses.add((function(s){return bt(i,void 0,void 0,(function(){var i,a,u,c,l,f=this;return wt(this,(function(d){switch(d.label){case 0:return!o||this.online?[3,10]:(this.online=o,n.next({type:ye.SYNC_ENGINE_NETWORK_STATUS,data:{active:this.online}}),a=void 0,At?(Ot.warn("Realtime disabled when in a server-side environment"),[3,6]):[3,1]);case 1:l=St(this.subscriptionsProcessor.start(),2),i=l[0],a=l[1],d.label=2;case 2:return d.trys.push([2,4,,5]),[4,new Promise((function(e,t){s.then(t);var n=i.subscribe({next:function(t){t===lt.a.CONNECTED&&e()},error:function(e){t(e),f.disconnectionHandler()(e)}});r.push(n)}))];case 3:return d.sent(),[3,5];case 4:return u=d.sent(),n.error(u),t(),[2];case 5:Ot.log("Realtime ready"),n.next({type:ye.SYNC_ENGINE_SUBSCRIPTIONS_ESTABLISHED}),d.label=6;case 6:return d.trys.push([6,8,,9]),[4,new Promise((function(e,t){var i=f.syncQueriesObservable().subscribe({next:function(t){t.type===ye.SYNC_ENGINE_SYNC_QUERIES_READY&&e(),n.next(t)},complete:function(){e()},error:function(e){t(e)}});i&&r.push(i)}))];case 7:return d.sent(),[3,9];case 8:return c=d.sent(),n.error(c),t(),[2];case 9:return r.push(this.mutationsProcessor.start().subscribe((function(e){var t=e.modelDefinition,r=e.model,i=e.hasMore;return f.runningProcesses.add((function(){return bt(f,void 0,void 0,(function(){var e,o,s=this;return wt(this,(function(a){switch(a.label){case 0:return e=this.userModelClasses[t.name],o=this.modelInstanceCreator(e,r),[4,this.storage.runExclusive((function(e){return s.modelMerger.merge(e,o,t)}))];case 1:return a.sent(),n.next({type:ye.SYNC_ENGINE_OUTBOX_MUTATION_PROCESSED,data:{model:e,element:o}}),n.next({type:ye.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:!i}}),[2]}}))}))}),"mutation processor event")}))),At||r.push(a.subscribe((function(e){var t=St(e,3),n=(t[0],t[1]),r=t[2];return f.runningProcesses.add((function(){return bt(f,void 0,void 0,(function(){var e,t,i=this;return wt(this,(function(o){switch(o.label){case 0:return e=this.userModelClasses[n.name],t=this.modelInstanceCreator(e,r),[4,this.storage.runExclusive((function(e){return i.modelMerger.merge(e,t,n)}))];case 1:return o.sent(),[2]}}))}))}),"subscription dataSubsObservable event")}))),[3,11];case 10:o||(this.online=o,n.next({type:ye.SYNC_ENGINE_NETWORK_STATUS,data:{active:this.online}}),r.forEach((function(e){return e.unsubscribe()})),r=[]),d.label=11;case 11:return e(),[2]}}))}))}),"datastore connectivity event")]}))}))}))})),this.storage.observe(null,null,It).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 bt(s,void 0,void 0,(function(){var e=this;return wt(this,(function(s){return[2,this.runningProcesses.add((function(){return bt(e,void 0,void 0,(function(){var e,s,u,c,l;return wt(this,(function(f){switch(f.label){case 0:return e=this.schema.namespaces[this.namespaceResolver(r)],s=this.modelClasses.MutationEvent,u=this.getModelDefinition(r),c=Object(k.l)(a,u),l=Object(k.d)(e.relationships,this.getModelDefinition(r),t,r,o,c,s,this.modelInstanceCreator),[4,this.outbox.enqueue(this.storage,l)];case 1:return f.sent(),n.next({type:ye.SYNC_ENGINE_OUTBOX_MUTATION_ENQUEUED,data:{model:r,element:o}}),n.next({type:ye.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:!1}}),[4,i];case 2:return f.sent(),this.online&&this.mutationsProcessor.resume(),[2]}}))}))}),"storage event")]}))}))}}),n.next({type:ye.SYNC_ENGINE_STORAGE_SUBSCRIBED}),[4,this.outbox.peek(this.storage)];case 4:return o=void 0===a.sent(),n.next({type:ye.SYNC_ENGINE_OUTBOX_STATUS,data:{isEmpty:o}}),[4,i];case 5:return a.sent(),n.next({type:ye.SYNC_ENGINE_READY}),[2]}}))}))}),"sync start")}))},e.prototype.getModelsMetadataWithNextFullSync=function(e){return bt(this,void 0,void 0,(function(){var t,n=this;return wt(this,(function(r){switch(r.label){case 0:return t=Map.bind,[4,this.runningProcesses.add((function(){return n.getModelsMetadata()}),"sync/index getModelsMetadataWithNextFullSync")];case 1:return[2,new(t.apply(Map,[void 0,r.sent().map((function(t){var r=t.namespace,i=t.model,o=t.lastSync,s=t.lastFullSync,a=t.fullSyncInterval,u=(t.lastSyncPredicate,!s||s+a<e?0:o);return[n.schema.namespaces[r].models[i],[r,u]]}))]))]}}))}))},e.prototype.syncQueriesObservable=function(){var e=this;return this.online?new h.a((function(t){var n;e.runningProcesses.isOpen&&e.runningProcesses.add((function(r){return bt(e,void 0,void 0,(function(){var e,i,o,s=this;return wt(this,(function(a){switch(a.label){case 0:e=!1,i=function(){var i,a,u,c,l,f,d,h,p;return wt(this,(function(v){switch(v.label){case 0:return i=new WeakMap,[4,o.getModelsMetadataWithNextFullSync(Date.now())];case 1:return a=v.sent(),u=new Set(a.keys()),[4,new Promise((function(e,o){s.runningProcesses.isOpen||e(),r.then((function(){return e()})),n=s.syncQueriesProcessor.start(a).subscribe({next:function(r){var o=r.namespace,a=r.modelDefinition,p=r.items,v=r.done,g=r.startedAt,m=r.isFullSync;return bt(s,void 0,void 0,(function(){var r,s,b,w,S,_,E=this;return wt(this,(function(A){switch(A.label){case 0:return r=this.userModelClasses[a.name],i.has(r)||(i.set(r,{new:0,updated:0,deleted:0}),f=Object(x.t)(),h=void 0===h?g:Math.max(h,g)),[4,this.storage.runExclusive((function(e){return bt(E,void 0,void 0,(function(){var t,n,o,s,u,c,l,f,d,h,v,g,m,b,w;return wt(this,(function(S){switch(S.label){case 0:return[4,this.outbox.getModelIds(e)];case 1:t=S.sent(),n=[],o=p.filter((function(e){var r=Object(k.h)(a,e);return!t.has(r)||(n.push(e),!1)})),s=[],S.label=2;case 2:S.trys.push([2,7,8,9]),u=_t(n),c=u.next(),S.label=3;case 3:return c.done?[3,6]:(l=c.value,[4,this.modelMerger.merge(e,l,a)]);case 4:void 0!==(f=S.sent())&&s.push([l,f]),S.label=5;case 5:return c=u.next(),[3,3];case 6:return[3,9];case 7:return d=S.sent(),b={error:d},[3,9];case 8:try{c&&!c.done&&(w=u.return)&&w.call(u)}finally{if(b)throw b.error}return[7];case 9:return v=(h=s.push).apply,g=[s],[4,this.modelMerger.mergePage(e,r,o,a)];case 10:return v.apply(h,g.concat([Et.apply(void 0,[S.sent()])])),m=i.get(r),s.forEach((function(e){var t=St(e,2)[1];switch(t){case y.h.INSERT:m.new++;break;case y.h.UPDATE:m.updated++;break;case y.h.DELETE:m.deleted++;break;default:Object(x.l)(t)}})),[2]}}))}))}))];case 1:return A.sent(),v?(s=a.name,[4,this.getModelMetadata(o,s)]):[3,4];case 2:return b=A.sent(),w=b.lastFullSync,S=b.fullSyncInterval,l=S,c=void 0===c?w:Math.max(c,m?g:w),b=this.modelClasses.ModelMetadata.copyOf(b,(function(e){e.lastSync=g,e.lastFullSync=m?g:b.lastFullSync})),[4,this.storage.save(b,void 0,It)];case 3:A.sent(),_=i.get(r),this.modelSyncedStatus.set(r,!0),t.next({type:ye.SYNC_ENGINE_MODEL_SYNCED,data:{model:r,isFullSync:m,isDeltaSync:!m,counts:_}}),u.delete(a),0===u.size&&(d=Object(x.t)()-f,e(),t.next({type:ye.SYNC_ENGINE_SYNC_QUERIES_READY}),n.unsubscribe()),A.label=4;case 4:return[2]}}))}))},error:function(e){t.error(e)}}),t.next({type:ye.SYNC_ENGINE_SYNC_QUERIES_STARTED,data:{models:Array.from(u).map((function(e){return e.name}))}})}))];case 2:return v.sent(),p=c+l-(h+d),Ot.debug("Next fullSync in "+p/1e3+" seconds. ("+new Date(Date.now()+p)+")"),[4,o.runningProcesses.add((function(t){return bt(s,void 0,void 0,(function(){var n,r;return wt(this,(function(i){return r=new Promise((function(e){n=e,setTimeout(n,p)})),t.then((function(){e=!0,n()})),[2,r]}))}))}),"syncQueriesObservable sleep")];case 3:return v.sent(),[2]}}))},o=this,a.label=1;case 1:return t.closed||e?[3,3]:[5,i()];case 2:return a.sent(),[3,1];case 3:return[2]}}))}))}),"syncQueriesObservable main")})):h.a.of()},e.prototype.disconnectionHandler=function(){var e=this;return function(t){je.CONTROL_MSG.CONNECTION_CLOSED!==t&&je.CONTROL_MSG.TIMEOUT_DISCONNECT!==t||e.datastoreConnectivity.socketDisconnected()}},e.prototype.unsubscribeConnectivity=function(){this.datastoreConnectivity.unsubscribe()},e.prototype.stop=function(){return bt(this,void 0,void 0,(function(){return wt(this,(function(e){switch(e.label){case 0:return Ot.debug("stopping sync engine"),this.unsubscribeConnectivity(),[4,this.mutationsProcessor.stop()];case 1:return e.sent(),[4,this.subscriptionsProcessor.stop()];case 2:return e.sent(),[4,this.datastoreConnectivity.stop()];case 3:return e.sent(),[4,this.syncQueriesProcessor.stop()];case 4:return e.sent(),[4,this.runningProcesses.close()];case 5:return e.sent(),[4,this.runningProcesses.open()];case 6:return e.sent(),Ot.debug("sync engine stopped and ready to restart"),[2]}}))}))},e.prototype.setupModels=function(e){return bt(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,f,d,h,p=this;return wt(this,(function(v){switch(v.label){case 0:t=e.fullSyncInterval,n=this.modelClasses.ModelMetadata,r=[],Object.values(this.schema.namespaces).forEach((function(e){Object.values(e.models).filter((function(e){return e.syncable})).forEach((function(t){if(r.push([e.name,t]),e.name===x.h){var n=p.userModelClasses[t.name];p.modelSyncedStatus.set(n,!1)}}))})),o=r.map((function(e){var r=St(e,2),o=r[0],s=r[1];return bt(p,void 0,void 0,(function(){var e,r,a,u,c,l,f,d,h;return wt(this,(function(p){switch(p.label){case 0:return[4,this.getModelMetadata(o,s.name)];case 1:return e=p.sent(),r=O.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,It)];case 2:return l=St.apply(void 0,[p.sent(),1]),f=St(l[0],1),i=f[0],[3,5];case 3:return u=e.lastSyncPredicate?e.lastSyncPredicate:null,c=u!==a,[4,this.storage.save(n.copyOf(e,(function(e){e.fullSyncInterval=t,c&&(e.lastSync=null,e.lastFullSync=null,e.lastSyncPredicate=a)})))];case 4:d=St.apply(void 0,[p.sent(),1]),h=St(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=_t.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 bt(this,void 0,void 0,(function(){var e;return wt(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 bt(this,void 0,void 0,(function(){var n,r,i;return wt(this,(function(o){switch(o.label){case 0:return n=this.modelClasses.ModelMetadata,r=O.a.createFromExisting(this.schema.namespaces[x.g].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=St.apply(void 0,[o.sent(),1]),[2,i[0]]}}))}))},e.prototype.getModelDefinition=function(e){var t=this.namespaceResolver(e);return this.schema.namespaces[t].models[e.name]},e.getNamespace=function(){return{name:x.g,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 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 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)},xt=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())}))},kt=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])}}},Nt=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},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},Mt=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Rt=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(jt(arguments[t]));return e};Object(f.e)(!0),Object(f.b)();var Dt,Ut,Ft,Lt,Bt,qt=new s.a("DataStore"),zt=Object(x.O)(Date.now()),Kt=a.a.browserOrNode().isNode,Vt=new WeakMap,Ht=new WeakMap,Gt=function(e){var t=Vt.get(e);return Dt.namespaces[t].models[e.name]},Wt=function(e){return Object(x.H)(e)&&Vt.has(e)},Yt=function(e){return Vt.get(e)},Jt=function(e){var t;if(void 0!==Dt)return console.warn("The schema has already been initialized"),Ft;qt.log("validating schema",{schema:e});var n=Pt({name:x.h},e);qt.log("DataStore","Init models"),Ft=Qt(n),qt.log("DataStore","Models initialized");var r={name:x.a,relationships:{},enums:{},nonModels:{},models:{Setting:{name:"Setting",pluralName:"Settings",syncable:!1,fields:{id:{name:"id",type:"ID",isRequired:!0,isArray:!1},key:{name:"key",type:"String",isRequired:!0,isArray:!1},value:{name:"value",type:"String",isRequired:!0,isArray:!1}}}}},i=Ne.getNamespace(),o=Tt.getNamespace();return Lt=Qt(r),Bt=Qt(i),Ut=Qt(o),Dt={namespaces:(t={},t[r.name]=r,t[n.name]=n,t[i.name]=i,t[o.name]=o,t),version:e.version},Object.keys(Dt.namespaces).forEach((function(e){var t,n,r=jt(Object(x.k)(Dt.namespaces[e]),2),i=r[0],o=r[1];Dt.namespaces[e].relationships=i,Dt.namespaces[e].keys=o;var s=new Map;Object.values(Dt.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,Mt(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)}))}Dt.namespaces[e].modelTopologicalOrdering=a})),Ft},$t=function(){if(void 0===Dt){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 qt.error(e),new Error(e)}},Qt=function(e){var t={};return Object.entries(e.models).forEach((function(n){var r=jt(n,2),i=r[0],o=r[1],s=sn(o);t[i]=s,Vt.set(s,e.name)})),Object.entries(e.nonModels||{}).forEach((function(e){var n=jt(e,2),r=n[0],i=n[1],o=cn(i);t[r]=o})),t},Zt=new WeakSet;function Xt(e,t){return Zt.add(t),new e(t)}var en,tn,nn=function e(t){return function(n,r){var i=t.fields[n];if(void 0!==i){var o=i.type,s=i.isRequired,a=i.isArrayNullable,u=i.name,c=i.isArray;if((!c&&s||c&&!a)&&null==r)throw new Error("Field "+u+" is required");if(Object(y.y)(t)&&!Object(x.F)(t))if(Object(x.m)(t).includes(n)&&""===r)throw qt.error(x.j.idEmptyString,{k:n,value:r}),new Error(x.j.idEmptyString);if(Object(y.n)(o)){var l=y.c.getJSType(o),f=y.c.getValidationFunction(o);if("AWSJSON"===o){if(Ct(r)===l)return;if("string"==typeof r)try{return void JSON.parse(r)}catch(e){throw new Error("Field "+u+" is an invalid JSON object. "+r)}}if(c){var d=l;if(s||(d=l+" | null | undefined"),!Array.isArray(r)&&!a)throw new Error("Field "+u+" should be of type ["+d+"], "+Ct(r)+" received. "+r);if(!Object(x.J)(r)&&r.some((function(e){return Object(x.J)(e)?s:Ct(e)!==l}))){var h=r.map((function(e){return null===e?"null":Ct(e)})).join(",");throw new Error("All elements in the "+u+" array should be of type "+d+", ["+h+"] received. "+r)}if(f&&!Object(x.J)(r))if(!r.map((function(e){return Object(x.J)(e)?!(!Object(x.J)(e)||s):f(e)})).every((function(e){return e})))throw new Error("All elements in the "+u+" array should be of type "+o+", validation failed for one or more elements. "+r)}else{if(!s&&void 0===r)return;if(Ct(r)!==l&&null!==r)throw new Error("Field "+u+" should be of type "+l+", "+Ct(r)+" received. "+r);if(!Object(x.J)(r)&&f&&!f(r))throw new Error("Field "+u+" should be of type "+o+", validation failed. "+r)}}else if(Object(y.u)(o)&&!Object(x.J)(r)){var p=Dt.namespaces.user.nonModels[o.nonModel],v=e(p);if(c){d=o.nonModel;if(s||(d=o.nonModel+" | null | undefined"),!Array.isArray(r))throw new Error("Field "+u+" should be of type ["+d+"], "+Ct(r)+" received. "+r);r.forEach((function(e){if(Object(x.J)(e)&&s||"object"!==Ct(e)&&void 0!==e)throw new Error("All elements in the "+u+" array should be of type "+o.nonModel+", ["+Ct(e)+"] received. "+e);Object(x.J)(e)||Object.keys(p.fields).forEach((function(t){v(t,e[t])}))}))}else{if("object"!==Ct(r))throw new Error("Field "+u+" should be of type "+o.nonModel+", "+Ct(r)+" recieved. "+r);Object.keys(p.fields).forEach((function(e){v(e,r[e])}))}}}}},rn=function(e,t,n){var r=e.fields[t]||{},i=r.isArray,o=r.type;if("string"==typeof n&&(i||"AWSJSON"===o||Object(y.u)(o)||Object(y.t)(o)))try{return JSON.parse(n)}catch(e){}return"number"==typeof n&&"Boolean"===o?Boolean(n):n},on=function(e,t,n){var r=nn(t);Object.entries(e).forEach((function(e){var i=jt(e,2),o=i[0],s=i[1],a=rn(t,o,s);r(o,a),n[o]=a}))},sn=function(e){var t=function(){function n(t){return Object(f.d)(this,(function(n){on(t,e,n);var r=Zt.has(t),i=r?t:{},o=i.id;if(Object(x.F)(e)){var s=null!=o?o:e.syncable?Object(d.v4)():zt();n.id=s}else Object(x.G)(e)&&(n.id=n.id||Object(d.v4)());r||an(n,e);var a=i._version,u=i._lastChangedAt,c=i._deleted;e.syncable&&(n._version=a,n._lastChangedAt=u,n._deleted=c)}))}return n.copyOf=function(t,n){var r,i=Object.getPrototypeOf(t||{}).constructor;if(!Wt(i)){var o="The source object is not a valid model";throw qt.error(o,{source:t}),new Error(o)}var s=Object(f.d)(t,(function(r){n(r),Object(x.m)(e).forEach((function(e){return r[e]=t[e]}));var i=nn(e);Object.entries(r).forEach((function(t){var n=jt(t,2),r=n[0],o=n[1],s=rn(e,r,o);i(r,s)}))}),(function(e){return r=e})),a=Ht.has(t);if(r.length||a)if(a){var u=jt(Ht.get(t),2),c=u[0],l=u[1],d=Object(x.N)(l,c,r);Ht.set(s,[d,l]),un(d,e)}else Ht.set(s,[r,t]),un(r,e);return s},n.fromJSON=function(n){var r=this;if(Array.isArray(n))return n.map((function(e){return r.fromJSON(e)}));var i=Xt(t,n),o=nn(e);return Object.entries(i).forEach((function(e){var t=jt(e,2),n=t[0],r=t[1];o(n,r)})),i},n}();return t[f.c]=!0,Object.defineProperty(t,"name",{value:e.name}),t},an=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.")}))},un=function(e,t){var n=e.map((function(e){return[e.path[0],e.value]})),r=t.fields;n.forEach((function(e){var t=jt(e,2),n=t[0];if(t[1]&&r[n]&&r[n].isReadOnly)throw new Error(n+" is read-only.")}))},cn=function(e){var t=function(t){return Object(f.d)(this,(function(n){on(t,e,n)}))};return t[f.c]=!0,Object.defineProperty(t,"name",{value:e.name}),Object(x.P)(t),t};function ln(e){return"string"==typeof e}function fn(e){var t=e.localModel,n=e.modelConstructor,r=e.remoteModel._version;return Xt(n,Pt(Pt({},t),{_version:r}))}function dn(e){qt.warn(e)}function hn(e,t){var n;switch(e){case x.a:n=Lt[t];break;case x.h:n=Ft[t];break;case x.g:n=Ut[t];break;case x.f:n=Bt[t];break;default:Object(x.l)(e)}if(Wt(n))return n;var r="Model name is not valid for namespace. modelName: "+t+", namespace: "+e;throw qt.error(r),new Error(r)}function pn(e,t){return xt(this,void 0,void 0,(function(){var n,r,i=this;return kt(this,(function(o){switch(o.label){case 0:return n=Lt.Setting,r=Dt.namespaces[x.a].models.Setting,[4,e.runExclusive((function(e){return xt(i,void 0,void 0,(function(){var i,o;return kt(this,(function(s){switch(s.label){case 0:return[4,e.query(n,O.a.createFromExisting(r,(function(e){return e.key("eq","schemaVersion")})),{page:0,limit:1})];case 1:return i=jt.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(Xt(n,{key:"schemaVersion",value:JSON.stringify(t)}))];case 5:s.sent(),s.label=6;case 6:return[2]}}))}))}))];case 1:return o.sent(),[2]}}))}))}!function(e){e.NotRunning="Not Running",e.Starting="Starting",e.Running="Running",e.Stopping="Stopping",e.Clearing="Clearing"}(tn||(tn={}));var vn=function(){function e(){var e=this;this.Auth=i.a,this.API=r.a,this.Cache=o.a,this.amplifyConfig={},this.syncPredicates=new WeakMap,this.amplifyContext={Auth:this.Auth,API:this.API,Cache:this.Cache},this.runningProcesses=new u.a,this.state=tn.NotRunning,this.start=function(){return xt(e,void 0,void 0,(function(){var e=this;return kt(this,(function(t){return[2,this.runningProcesses.add((function(){return xt(e,void 0,void 0,(function(){var e,t,n,r=this;return kt(this,(function(i){switch(i.label){case 0:return this.state=tn.Starting,void 0!==this.initialized?[3,1]:(qt.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 Ne(Dt,Yt,hn,Xt,this.storageAdapter,this.sessionId),[4,this.storage.init()];case 4:return i.sent(),$t(),[4,pn(this.storage,Dt.version)];case 5:return i.sent(),(e=this.amplifyConfig.aws_appsync_graphqlEndpoint)?(qt.debug("GraphQL endpoint available",e),t=this,[4,this.processSyncExpressions()]):[3,7];case 6:return t.syncPredicates=i.sent(),this.sync=new Tt(Dt,Yt,Ut,Ft,this.storage,Xt,this.conflictHandler,this.errorHandler,this.syncPredicates,this.amplifyConfig,this.authModeStrategy,this.amplifyContext,this.connectivityMonitor),n=1e3*this.fullSyncInterval*60,en=this.sync.start({fullSyncInterval:n}).subscribe({next:function(e){var t=e.type,n=e.data;t===(Kt?ye.SYNC_ENGINE_SYNC_QUERIES_READY:ye.SYNC_ENGINE_STORAGE_SUBSCRIBED)&&r.initResolve(),c.a.dispatch("datastore",{event:t,data:n})},error:function(e){qt.warn("Sync error",e),r.initReject()}}),[3,8];case 7:qt.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(),this.state=tn.Running,[2]}}))}))}),"datastore start").catch(this.handleAddProcError("DataStore.start()"))]}))}))},this.query=function(t,n,r){return xt(e,void 0,void 0,(function(){var e=this;return kt(this,(function(i){return[2,this.runningProcesses.add((function(){return xt(e,void 0,void 0,(function(){var e,i,o,s,a,u;return kt(this,(function(c){switch(c.label){case 0:return[4,this.start()];case 1:if(c.sent(),!Wt(t))throw s="Constructor is not for a valid model",qt.error(s,{modelConstructor:t}),new Error(s);if("string"==typeof n&&void 0!==r&&qt.warn("Pagination is ignored when querying by id"),e=Gt(t),i=Object(x.m)(e),ln(n)){if(i.length>1)throw s=x.j.queryByPkWithCompositeKeyPresent,qt.error(s,{keyFields:i}),new Error(s);o=O.a.createForSingleField(e,i[0],n)}else o=Object(y.o)(n,e)?O.a.createForPk(e,n):Object(O.c)(n)?void 0:O.a.createFromExisting(e,n);return a=this.processPagination(e,r),qt.debug("params ready",{modelConstructor:t,predicate:O.a.getPredicates(o,!1),pagination:Pt(Pt({},a),{sort:I.a.getPredicates(a&&a.sort,!1)})}),[4,this.storage.query(t,o,a)];case 2:return u=c.sent(),[2,ln(n)||Object(y.o)(n,e)?u[0]:u]}}))}))}),"datastore query").catch(this.handleAddProcError("DataStore.query()"))]}))}))},this.save=function(t,n){return xt(e,void 0,void 0,(function(){var e=this;return kt(this,(function(r){return[2,this.runningProcesses.add((function(){return xt(e,void 0,void 0,(function(){var e,r,i,o,s,a,u=this;return kt(this,(function(c){switch(c.label){case 0:return[4,this.start()];case 1:if(c.sent(),e=Ht.get(t),r=t?t.constructor:void 0,!Wt(r))throw i="Object is not an instance of a valid model",qt.error(i,{model:t}),new Error(i);return o=Gt(r),s=O.a.createFromExisting(o,n),[4,this.storage.runExclusive((function(n){return xt(u,void 0,void 0,(function(){return kt(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,O.a.createForPk(o,t))]}}))}))}))];case 2:return a=jt.apply(void 0,[c.sent(),1]),[2,a[0]]}}))}))}),"datastore save").catch(this.handleAddProcError("DataStore.save()"))]}))}))},this.setConflictHandler=function(t){var n=t.DataStore;return n&&n.conflictHandler?n.conflictHandler:e.conflictHandler===fn&&t.conflictHandler?t.conflictHandler:e.conflictHandler||fn},this.setErrorHandler=function(t){var n=t.DataStore;return n&&n.errorHandler?n.errorHandler:e.errorHandler===dn&&t.errorHandler?t.errorHandler:e.errorHandler||dn},this.delete=function(t,n){return xt(e,void 0,void 0,(function(){var e=this;return kt(this,(function(r){return[2,this.runningProcesses.add((function(){return xt(e,void 0,void 0,(function(){var e,r,i,o,s,a,u,c,l,f;return kt(this,(function(d){switch(d.label){case 0:return[4,this.start()];case 1:if(d.sent(),!t)throw c="Model or Model Constructor required",qt.error(c,{modelOrConstructor:t}),new Error(c);if(!Wt(t))return[3,3];if(s=t,!n)throw c="Id to delete or criteria required. Do you want to delete all? Pass Predicates.ALL",qt.error(c,{identifierOrCriteria:n}),new Error(c);if(a=Gt(s),"string"==typeof n){if((r=Object(x.m)(a)).length>1)throw c=x.j.deleteByPkWithCompositeKeyPresent,qt.error(c,{keyFields:r}),new Error(c);e=O.a.createForSingleField(Gt(s),r[0],n)}else if(!(e=Object(y.o)(n,a)?O.a.createForPk(a,n):O.a.createFromExisting(a,n))||!O.a.isValidPredicate(e))throw c="Criteria required. Do you want to delete all? Pass Predicates.ALL",qt.error(c,{condition:e}),new Error(c);return[4,this.storage.delete(s,e)];case 2:return i=jt.apply(void 0,[d.sent(),1]),[2,i[0]];case 3:if(o=t,s=Object.getPrototypeOf(o||{}).constructor,!Wt(s))throw c="Object is not an instance of a valid model",qt.error(c,{model:o}),new Error(c);if(a=Gt(s),u=O.a.createForPk(a,o),n){if("function"!=typeof n)throw c="Invalid criteria",qt.error(c,{identifierOrCriteria:n}),new Error(c);e=n(u)}else e=u;return[4,this.storage.delete(o,e)];case 4:return l=jt.apply(void 0,[d.sent(),1]),f=jt(l[0],1),[2,f[0]]}}))}))}),"datastore delete").catch(this.handleAddProcError("DataStore.delete()"))]}))}))},this.observe=function(t,n){var r,i=t&&Wt(t)?t:void 0;if(t&&void 0===i){var o=t,s=o&&Object.getPrototypeOf(o).constructor;if(Wt(s))return n&&qt.warn("idOrCriteria is ignored when using a model instance",{model:o,identifierOrCriteria:n}),e.observe(s,o.id);var a="The model is not an instance of a PersistentModelConstructor";throw qt.error(a,{model:o}),new Error(a)}if(n&&i&&Object(y.o)(n,Gt(i))){a=x.j.observeWithObjectLiteral;throw qt.error(a,{objectLiteral:n}),new Error(a)}if(void 0!==n&&void 0===i){a="Cannot provide criteria without a modelConstructor";throw qt.error(a,n),new Error(a)}if(i&&!Wt(i)){a="Constructor is not for a valid model";throw qt.error(a,{modelConstructor:i}),new Error(a)}if("string"==typeof n){var u=Gt(i),c=jt(Object(x.m)(u),1)[0];r=O.a.createForSingleField(Gt(i),c,n)}else r=Object(O.c)(n)?void 0:i&&O.a.createFromExisting(Gt(i),n);return new h.a((function(t){var n;return e.runningProcesses.add((function(){return xt(e,void 0,void 0,(function(){var e=this;return kt(this,(function(o){switch(o.label){case 0:return[4,this.start()];case 1:return o.sent(),n=this.storage.observe(i,r).filter((function(e){var t=e.model;return Yt(t)===x.h})).subscribe({next:function(n){return e.runningProcesses.isOpen&&e.runningProcesses.add((function(){return xt(e,void 0,void 0,(function(){var e,r,i,o,s;return kt(this,(function(a){switch(a.label){case 0:return e=n,"DELETE"===n.opType?[3,2]:(r=Gt(n.model),i=Object(x.m)(r),o=Object(x.o)(n.element,i),[4,this.query(n.model,o)]);case 1:s=a.sent(),e=Pt(Pt({},e),{element:s}),a.label=2;case 2:return t.next(e),[2]}}))}))}),"datastore observe message handler")},error:function(e){return t.error(e)},complete:function(){return t.complete()}}),[2]}}))}))}),"datastore observe observable initialization").catch(e.handleAddProcError("DataStore.observe()")).catch((function(e){t.error(e)})),e.runningProcesses.addCleaner((function(){return xt(e,void 0,void 0,(function(){return kt(this,(function(e){return n&&n.unsubscribe(),[2]}))}))}),"DataStore.observe() cleanup")}))},this.observeQuery=function(t,n,r){return new h.a((function(i){var o,s,a=new Map,u=new Map,l=[],f=function(){var e=S();_(e)},d=new x.c({callback:f,errorHandler:i.error,maxInterval:2e3}),h=(r||{}).sort,p=h?{sort:h}:void 0,v=Gt(t),y=Object(x.m)(v);s=ln(n)?O.a.createForSingleField(v,y[0],n):Object(O.c)(n)?void 0:O.a.createFromExisting(v,n);var g=O.a.getPredicates(s,!1)||{},m=g.predicates,b=g.type,w=!!m;e.runningProcesses.add((function(){return xt(e,void 0,void 0,(function(){var e,r=this;return kt(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,this.query(t,n,p)];case 1:return s.sent().forEach((function(e){var n=Gt(t),r=Object(k.h)(n,e);a.set(r,e)})),o=this.observe(t).subscribe((function(e){var t,n,i=e.element,o=e.model,s=e.opType,c=Gt(o),f=Object(k.h)(c,i);if(w&&!Object(x.S)(i,b,m)){if("UPDATE"!==s||!a.has(f)&&!u.has(f))return;l.push(f)}"DELETE"===s?l.push(f):u.set(f,i);var h=null!==(n=null===(t=r.sync)||void 0===t?void 0:t.getModelSyncedStatus(o))&&void 0!==n&&n;(u.size-l.length>=r.syncPageSize||h)&&d.resolve(),d.start()})),f(),[3,3];case 2:return e=s.sent(),i.error(e),[3,3];case 3:return[2]}}))}))}),"datastore observequery startup").catch(e.handleAddProcError("DataStore.observeQuery()")).catch((function(e){i.error(e)}));var S=function(){var n,i,o=null!==(i=null===(n=e.sync)||void 0===n?void 0:n.getModelSyncedStatus(t))&&void 0!==i&&i,s=Rt(Array.from(a.values()),Array.from(u.values()));return(null==r?void 0:r.sort)&&E(s),a.clear(),s.forEach((function(e){var n=Gt(t),r=Object(k.h)(n,e);a.set(r,e)})),l.forEach((function(e){return a.delete(e)})),{items:Array.from(a.values()),isSynced:o}},_=function(e){i.next(e),u.clear(),l=[]},E=function(n){var i=Gt(t),o=e.processPagination(i,r),s=I.a.getPredicates(o.sort);if(s.length){var a=Object(x.Q)(s);n.sort(a)}};return c.a.listen("datastore",(function e(n){var r,i=n.payload,o=i.event,s=i.data;o===ye.SYNC_ENGINE_MODEL_SYNCED&&(null===(r=null==s?void 0:s.model)||void 0===r?void 0:r.name)===t.name&&(f(),c.a.remove("datastore",e))})),e.runningProcesses.addCleaner((function(){return xt(e,void 0,void 0,(function(){return kt(this,(function(e){return o&&o.unsubscribe(),[2]}))}))}),"datastore observequery cleaner")}))},this.configure=function(t){void 0===t&&(t={}),e.amplifyContext.Auth=e.Auth,e.amplifyContext.API=e.API,e.amplifyContext.Cache=e.Cache;var n=t.DataStore,r=t.authModeStrategyType,i=(t.conflictHandler,t.errorHandler,t.maxRecordsToSync),o=t.syncPageSize,s=t.fullSyncInterval,a=t.syncExpressions,u=t.authProviders,c=t.storageAdapter,l=Nt(t,["DataStore","authModeStrategyType","conflictHandler","errorHandler","maxRecordsToSync","syncPageSize","fullSyncInterval","syncExpressions","authProviders","storageAdapter"]);switch(e.amplifyConfig=Pt(Pt({},l),e.amplifyConfig),e.conflictHandler=e.setConflictHandler(t),e.errorHandler=e.setErrorHandler(t),n&&n.authModeStrategyType||r||y.a.DEFAULT){case y.a.MULTI_AUTH:e.authModeStrategy=E(e.amplifyContext);break;case y.a.DEFAULT:default:e.authModeStrategy=A}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()}}return e.prototype.getModuleName=function(){return"DataStore"},e.prototype.handleAddProcError=function(e){var t=this;return function(n){throw n.message.startsWith("BackgroundManagerNotOpenError")?new Error(["DataStoreStateError: Tried to execute `"+e+'` while DataStore was "'+t.state+'".','This can only be done while DataStore is "Started" or "Stopped". To remedy:',"Ensure all calls to `stop()` and `clear()` have completed first.","If this is not possible, retry the operation until it succeeds."].join("\n")):n}},e.prototype.clear=function(){return xt(this,void 0,void 0,(function(){return kt(this,(function(e){switch(e.label){case 0:return $t(),this.state=tn.Clearing,[4,this.runningProcesses.close()];case 1:return e.sent(),void 0!==this.storage?[3,3]:(this.storage=new Ne(Dt,Yt,hn,Xt,this.storageAdapter,this.sessionId),[4,this.storage.init()]);case 2:e.sent(),e.label=3;case 3:return en&&!en.closed&&en.unsubscribe(),this.sync?[4,this.sync.stop()]:[3,5];case 4:e.sent(),e.label=5;case 5:return[4,this.storage.clear()];case 6:return e.sent(),this.initialized=void 0,this.storage=void 0,this.sync=void 0,this.syncPredicates=new WeakMap,[4,this.runningProcesses.open()];case 7:return e.sent(),this.state=tn.NotRunning,[2]}}))}))},e.prototype.stop=function(){return xt(this,void 0,void 0,(function(){return kt(this,(function(e){switch(e.label){case 0:return this.state=tn.Stopping,[4,this.runningProcesses.close()];case 1:return e.sent(),en&&!en.closed&&en.unsubscribe(),this.sync?[4,this.sync.stop()]:[3,3];case 2:e.sent(),e.label=3;case 3:return this.initialized=void 0,this.sync=void 0,[4,this.runningProcesses.open()];case 4:return e.sent(),this.state=tn.NotRunning,[2]}}))}))},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=I.a.createFromExisting(e,t.sort)),{limit:i,page:o,sort:n}}},e.prototype.processSyncExpressions=function(){return xt(this,void 0,void 0,(function(){var e,t=this;return kt(this,(function(n){switch(n.label){case 0:return this.syncExpressions&&this.syncExpressions.length?[4,Promise.all(this.syncExpressions.map((function(e){return xt(t,void 0,void 0,(function(){var t,n,r,i,o,s;return kt(this,(function(a){switch(a.label){case 0:return[4,e];case 1:return t=a.sent(),n=t.modelConstructor,r=t.conditionProducer,i=Gt(n),[4,this.unwrapPromise(r)];case 2:return o=a.sent(),Object(O.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 O.a.createFromExisting(e,t)}catch(e){throw qt.error("Error creating Sync Predicate"),e}},e.prototype.unwrapPromise=function(e){return xt(this,void 0,void 0,(function(){var t;return kt(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=jt(t,2),r=n[0],i=n[1];if(e.has(r)){var o=r.name;return qt.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+"-"+jt(t.split("."),1)[0]}}catch(e){}},e}(),yn=new vn;l.a.register(yn);var gn={USER:x.h,traverseModel:x.R,validatePredicate:x.S,isNonModelConstructor:x.I,isModelConstructor:x.H}},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}));const r=e=>"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):(e=>{const t=[];for(let n=0,r=e.length;n<r;n++){const r=e.charCodeAt(n);if(r<128)t.push(r);else if(r<2048)t.push(r>>6|192,63&r|128);else if(n+1<e.length&&55296==(64512&r)&&56320==(64512&e.charCodeAt(n+1))){const i=65536+((1023&r)<<10)+(1023&e.charCodeAt(++n));t.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}else t.push(r>>12|224,r>>6&63|128,63&r|128)}return Uint8Array.from(t)})(e),i=e=>"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):(e=>{let t="";for(let n=0,r=e.length;n<r;n++){const r=e[n];if(r<128)t+=String.fromCharCode(r);else if(192<=r&&r<224){const i=e[++n];t+=String.fromCharCode((31&r)<<6|63&i)}else if(240<=r&&r<365){const i="%"+[r,e[++n],e[++n],e[++n]].map(e=>e.toString(16)).join("%");t+=decodeURIComponent(i)}else t+=String.fromCharCode((15&r)<<12|(63&e[++n])<<6|63&e[++n])}return t})(e)},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r,i,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){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.")},c=function(){function e(){this._state=i.Open,this.jobs=new Set}return e.prototype.add=function(t,n){var r,i;"string"==typeof t?(r=void 0,i=t):(r=t,i=n);var o=this.closedFailure(i);if(o)return o;if(void 0===r)return this.addHook(i);if("function"==typeof r)return this.addFunction(r,i);if(r instanceof e)return this.addManager(r,i);throw new Error("If `job` is provided, it must be an Observable, Function, or BackgroundProcessManager.")},e.prototype.addCleaner=function(e,t){var n=this,r=this.addHook(t),i=r.resolve,o=function(){return s(n,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,e()];case 1:return t.sent(),i(),[2]}}))}))};return r.onTerminate.then(o),o},e.prototype.addFunction=function(e,t){var n,r=e(new Promise((function(e){n=e})));return"function"==typeof(null==r?void 0:r.then)&&this.registerPromise(r,n,t),r},e.prototype.addManager=function(e,t){var n=this;this.addCleaner((function(){return s(n,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,e.close()];case 1:return[2,t.sent()]}}))}))}),t)},e.prototype.addHook=function(e){var t,n,r,i=new Promise((function(e,r){t=e,n=r})),o=new Promise((function(e){r=e}));return this.registerPromise(i,r,e),{resolve:t,reject:n,onTerminate:o}},e.prototype.registerPromise=function(e,t,n){var r=this,i={promise:e,terminate:t,description:n};this.jobs.add(i),e.then((function(){r.jobs.delete(i)})).catch((function(){r.jobs.delete(i)}))},Object.defineProperty(e.prototype,"length",{get:function(){return this.jobs.size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pending",{get:function(){return Array.from(this.jobs).map((function(e){return e.description}))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isOpen",{get:function(){return this._state===i.Open},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isClosing",{get:function(){return this._state===i.Closing},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isClosed",{get:function(){return this._state===i.Closed},enumerable:!0,configurable:!0}),e.prototype.closedFailure=function(e){if(!this.isOpen)return Promise.reject(new l(["The manager is "+this.state+".",'You tried to add "'+e+'".',"Pending jobs: [\n"+this.pending.map((function(e){return" "+e})).join(",\n")+"\n]"].join("\n")))},e.prototype.close=function(){return s(this,void 0,void 0,(function(){var e,t,n,r,o;return a(this,(function(s){switch(s.label){case 0:if(!this.isOpen)return[3,2];this._state=i.Closing;try{for(e=u(Array.from(this.jobs)),t=e.next();!t.done;t=e.next()){n=t.value;try{n.terminate()}catch(e){console.warn("Failed to send termination signal to job. Error: "+e.message,n)}}}catch(e){r={error:e}}finally{try{t&&!t.done&&(o=e.return)&&o.call(e)}finally{if(r)throw r.error}}return this._closingPromise=Promise.allSettled(Array.from(this.jobs).map((function(e){return e.promise}))),[4,this._closingPromise];case 1:s.sent(),this._state=i.Closed,s.label=2;case 2:return[2,this._closingPromise]}}))}))},e.prototype.open=function(){return s(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return this.isClosing?[4,this.close()]:[3,2];case 1:e.sent(),e.label=2;case 2:return this._state=i.Open,[2]}}))}))},e}(),l=function(e){function t(t){return e.call(this,"BackgroundManagerNotOpenError: "+t)||this}return o(t,e),t}(Error);!function(e){e.Open="Open",e.Closing="Closing",e.Closed="Closed"}(i||(i={}))},,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"d",(function(){return h})),n.d(t,"b",(function(){return p})),n.d(t,"c",(function(){return v}));var r=n(21);function i(e){return(i="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 o,s=(o=function(e,t){return(o=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}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},u=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},c=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=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(c(arguments[t]));return e},f=new r.a("Util"),d=function(e){function t(t){var n=e.call(this,t)||this;return n.nonRetryable=!0,n}return s(t,e),t}(Error);function h(e,t,n,r){return a(this,void 0,void 0,(function(){var o=this;return u(this,(function(s){if("function"!=typeof e)throw Error("functionToRetry must be a function");return[2,new Promise((function(s,c){return a(o,void 0,void 0,(function(){var o,a,d,h,p,v,y;return u(this,(function(g){switch(g.label){case 0:o=0,a=!1,h=function(){},r&&r.then((function(){a=!0,clearTimeout(d),h()})),v=function(){var r,i,v,y;return u(this,(function(u){switch(u.label){case 0:o++,f.debug(e.name+" attempt #"+o+" with this vars: "+JSON.stringify(t)),u.label=1;case 1:return u.trys.push([1,3,,7]),r={},i=s,[4,e.apply(void 0,l(t))];case 2:return[2,(r.value=i.apply(void 0,[u.sent()]),r)];case 3:return v=u.sent(),p=v,f.debug("error on "+e.name,v),(g=v)&&g.nonRetryable?(f.debug(e.name+" non retryable error",v),[2,{value:c(v)}]):(y=n(o,t,v),f.debug(e.name+" retrying in "+y+" ms"),!1===y||a?[2,{value:c(v)}]:[3,4]);case 4:return[4,new Promise((function(e){h=e,d=setTimeout(h,y)}))];case 5:u.sent(),u.label=6;case 6:return[3,7];case 7:return[2]}var g}))},g.label=1;case 1:return a?[3,3]:[5,v()];case 2:return"object"===i(y=g.sent())?[2,y.value]:[3,1];case 3:return c(p),[2]}}))}))}))]}))}))}function p(e){void 0===e&&(e=3e5);return function(t){var n=100*Math.pow(2,t)+100*Math.random();return!(n>e)&&n}}var v=function(e,t,n,r){return void 0===n&&(n=3e5),h(e,t,p(n),r)}},function(e,t,n){"use strict";n.d(t,"a",(function(){return Xi}));var r=n(21),i=n(65),o=n(16),s=n(153),a=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},u=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},c=new r.a("CognitoCredentials"),l=new Promise((function(e,t){return Object(o.b)().isBrowser?(window.gapi&&window.gapi.auth2?window.gapi.auth2:null)?(c.debug("google api already loaded"),e()):void setTimeout((function(){return e()}),2e3):(c.debug("not in the browser, directly resolved"),e())})),f=function(){function e(){this.initialized=!1,this.refreshGoogleToken=this.refreshGoogleToken.bind(this),this._refreshGoogleTokenImpl=this._refreshGoogleTokenImpl.bind(this)}return e.prototype.refreshGoogleToken=function(){return a(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return this.initialized?[3,2]:(c.debug("need to wait for the Google SDK loaded"),[4,l]);case 1:e.sent(),this.initialized=!0,c.debug("finish waiting"),e.label=2;case 2:return[2,this._refreshGoogleTokenImpl()]}}))}))},e.prototype._refreshGoogleTokenImpl=function(){var e=null;return Object(o.b)().isBrowser&&(e=window.gapi&&window.gapi.auth2?window.gapi.auth2:null),e?new Promise((function(t,n){e.getAuthInstance().then((function(e){e||(c.debug("google Auth undefined"),n(new s.a("google Auth undefined")));var r=e.currentUser.get();r.isSignedIn()?(c.debug("refreshing the google access token"),r.reloadAuthResponse().then((function(e){var n=e.id_token,r=e.expires_at;t({token:n,expires_at:r})})).catch((function(e){e&&"network_error"===e.error?n("Network error reloading google auth response"):n(new s.a("Failed to reload google auth response"))}))):n(new s.a("User is not signed in with Google"))})).catch((function(e){c.debug("Failed to refresh google token",e),n(new s.a("Failed to refresh google token"))}))})):(c.debug("no gapi auth2 available"),Promise.reject("no gapi auth2 available"))},e}(),d=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},h=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},p=new r.a("CognitoCredentials"),v=new Promise((function(e,t){return Object(o.b)().isBrowser?window.FB?(p.debug("FB SDK already loaded"),e()):void setTimeout((function(){return e()}),2e3):(p.debug("not in the browser, directly resolved"),e())})),y=function(){function e(){this.initialized=!1,this.refreshFacebookToken=this.refreshFacebookToken.bind(this),this._refreshFacebookTokenImpl=this._refreshFacebookTokenImpl.bind(this)}return e.prototype.refreshFacebookToken=function(){return d(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return this.initialized?[3,2]:(p.debug("need to wait for the Facebook SDK loaded"),[4,v]);case 1:e.sent(),this.initialized=!0,p.debug("finish waiting"),e.label=2;case 2:return[2,this._refreshFacebookTokenImpl()]}}))}))},e.prototype._refreshFacebookTokenImpl=function(){var e=null;if(Object(o.b)().isBrowser&&(e=window.FB),!e){return p.debug("no fb sdk available"),Promise.reject(new s.a("no fb sdk available"))}return new Promise((function(t,n){e.getLoginStatus((function(e){if(e&&e.authResponse){var r=e.authResponse,i=r.accessToken,o=1e3*r.expiresIn+(new Date).getTime();if(!i){a="the jwtToken is undefined";p.debug(a),n(new s.a(a))}t({token:i,expires_at:o})}else{var a="no response from facebook when refreshing the jwt token";p.debug(a),n(new s.a(a))}}),{scope:"public_profile,email"})}))},e}(),g=new f,m=new y,b=n(37),w=n(1),S=function(e,t){return(S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function _(e,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}S(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var E=function(){return(E=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function A(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 O(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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}Object.create;function I(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 T,C,P,x,k,N,j,M,R,D,U,F,L,B,q,z,K,V,H,G,W,Y,J,$,Q,Z,X,ee,te,ne,re,ie,oe,se,ae,ue,ce,le,fe,de,he,pe,ve,ye,ge,me,be,we,Se,_e,Ee,Ae,Oe,Ie,Te,Ce,Pe;Object.create;!function(e){e.AUTHENTICATED_ROLE="AuthenticatedRole",e.DENY="Deny"}(T||(T={})),(C||(C={})).filterSensitiveLog=function(e){return E({},e)},(P||(P={})).filterSensitiveLog=function(e){return E({},e)},(x||(x={})).filterSensitiveLog=function(e){return E({},e)},(k||(k={})).filterSensitiveLog=function(e){return E({},e)},(N||(N={})).filterSensitiveLog=function(e){return E({},e)},(j||(j={})).filterSensitiveLog=function(e){return E({},e)},(M||(M={})).filterSensitiveLog=function(e){return E({},e)},(R||(R={})).filterSensitiveLog=function(e){return E({},e)},(D||(D={})).filterSensitiveLog=function(e){return E({},e)},(U||(U={})).filterSensitiveLog=function(e){return E({},e)},function(e){e.ACCESS_DENIED="AccessDenied",e.INTERNAL_SERVER_ERROR="InternalServerError"}(F||(F={})),(L||(L={})).filterSensitiveLog=function(e){return E({},e)},(B||(B={})).filterSensitiveLog=function(e){return E({},e)},(q||(q={})).filterSensitiveLog=function(e){return E({},e)},(z||(z={})).filterSensitiveLog=function(e){return E({},e)},(K||(K={})).filterSensitiveLog=function(e){return E({},e)},(V||(V={})).filterSensitiveLog=function(e){return E({},e)},(H||(H={})).filterSensitiveLog=function(e){return E({},e)},(G||(G={})).filterSensitiveLog=function(e){return E({},e)},(W||(W={})).filterSensitiveLog=function(e){return E({},e)},(Y||(Y={})).filterSensitiveLog=function(e){return E({},e)},(J||(J={})).filterSensitiveLog=function(e){return E({},e)},($||($={})).filterSensitiveLog=function(e){return E({},e)},(Q||(Q={})).filterSensitiveLog=function(e){return E({},e)},(Z||(Z={})).filterSensitiveLog=function(e){return E({},e)},(X||(X={})).filterSensitiveLog=function(e){return E({},e)},function(e){e.CONTAINS="Contains",e.EQUALS="Equals",e.NOT_EQUAL="NotEqual",e.STARTS_WITH="StartsWith"}(ee||(ee={})),(te||(te={})).filterSensitiveLog=function(e){return E({},e)},(ne||(ne={})).filterSensitiveLog=function(e){return E({},e)},function(e){e.RULES="Rules",e.TOKEN="Token"}(re||(re={})),(ie||(ie={})).filterSensitiveLog=function(e){return E({},e)},(oe||(oe={})).filterSensitiveLog=function(e){return E({},e)},(se||(se={})).filterSensitiveLog=function(e){return E({},e)},(ae||(ae={})).filterSensitiveLog=function(e){return E({},e)},(ue||(ue={})).filterSensitiveLog=function(e){return E({},e)},(ce||(ce={})).filterSensitiveLog=function(e){return E({},e)},(le||(le={})).filterSensitiveLog=function(e){return E({},e)},(fe||(fe={})).filterSensitiveLog=function(e){return E({},e)},(de||(de={})).filterSensitiveLog=function(e){return E({},e)},(he||(he={})).filterSensitiveLog=function(e){return E({},e)},(pe||(pe={})).filterSensitiveLog=function(e){return E({},e)},(ve||(ve={})).filterSensitiveLog=function(e){return E({},e)},(ye||(ye={})).filterSensitiveLog=function(e){return E({},e)},(ge||(ge={})).filterSensitiveLog=function(e){return E({},e)},(me||(me={})).filterSensitiveLog=function(e){return E({},e)},(be||(be={})).filterSensitiveLog=function(e){return E({},e)},(we||(we={})).filterSensitiveLog=function(e){return E({},e)},(Se||(Se={})).filterSensitiveLog=function(e){return E({},e)},(_e||(_e={})).filterSensitiveLog=function(e){return E({},e)},(Ee||(Ee={})).filterSensitiveLog=function(e){return E({},e)},(Ae||(Ae={})).filterSensitiveLog=function(e){return E({},e)},(Oe||(Oe={})).filterSensitiveLog=function(e){return E({},e)},(Ie||(Ie={})).filterSensitiveLog=function(e){return E({},e)},(Te||(Te={})).filterSensitiveLog=function(e){return E({},e)},(Ce||(Ce={})).filterSensitiveLog=function(e){return E({},e)},(Pe||(Pe={})).filterSensitiveLog=function(e){return E({},e)};var xe=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}(),ke=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(w.__assign)(Object(w.__assign)({},this),{headers:Object(w.__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(w.__assign)(Object(w.__assign)({},e),((r={})[n]=Array.isArray(i)?Object(w.__spread)(i):i,r))}),{}))),n},e}();var Ne=function(e,t){return A(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return O(this,(function(g){switch(g.label){case 0:return r=[E({},e)],y={},[4,at(e.body,t)];case 1:switch(n=E.apply(void 0,r.concat([(y.body=g.sent(),y)])),o="UnknownError",o=ut(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,Me(n,t)];case 3:return i=E.apply(void 0,[E.apply(void 0,s.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 4:return a=[{}],[4,Re(n,t)];case 5:return i=E.apply(void 0,[E.apply(void 0,a.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 6:return u=[{}],[4,De(n,t)];case 7:return i=E.apply(void 0,[E.apply(void 0,u.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 8:return c=[{}],[4,Ue(n,t)];case 9:return i=E.apply(void 0,[E.apply(void 0,c.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 10:return l=[{}],[4,Le(n,t)];case 11:return i=E.apply(void 0,[E.apply(void 0,l.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 12:return f=[{}],[4,Be(n,t)];case 13:return i=E.apply(void 0,[E.apply(void 0,f.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 14:return d=[{}],[4,qe(n,t)];case 15:return i=E.apply(void 0,[E.apply(void 0,d.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 16:return h=[{}],[4,ze(n,t)];case 17:return i=E.apply(void 0,[E.apply(void 0,h.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=E(E({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:it(e)}),g.label=19;case 19:return v=i.message||i.Message||o,i.message=v,delete i.Message,[2,Promise.reject(Object.assign(new Error(v),i))]}}))}))},je=function(e,t){return A(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return O(this,(function(g){switch(g.label){case 0:return r=[E({},e)],y={},[4,at(e.body,t)];case 1:switch(n=E.apply(void 0,r.concat([(y.body=g.sent(),y)])),o="UnknownError",o=ut(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,Me(n,t)];case 3:return i=E.apply(void 0,[E.apply(void 0,s.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 4:return a=[{}],[4,Re(n,t)];case 5:return i=E.apply(void 0,[E.apply(void 0,a.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 6:return u=[{}],[4,Ue(n,t)];case 7:return i=E.apply(void 0,[E.apply(void 0,u.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 8:return c=[{}],[4,Fe(n,t)];case 9:return i=E.apply(void 0,[E.apply(void 0,c.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 10:return l=[{}],[4,Le(n,t)];case 11:return i=E.apply(void 0,[E.apply(void 0,l.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 12:return f=[{}],[4,Be(n,t)];case 13:return i=E.apply(void 0,[E.apply(void 0,f.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 14:return d=[{}],[4,qe(n,t)];case 15:return i=E.apply(void 0,[E.apply(void 0,d.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 16:return h=[{}],[4,ze(n,t)];case 17:return i=E.apply(void 0,[E.apply(void 0,h.concat([g.sent()])),{name:o,$metadata:it(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=E(E({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:it(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))]}}))}))},Me=function(e,t){return A(void 0,void 0,void 0,(function(){var n,r;return O(this,(function(i){return n=e.body,r=We(n,t),[2,E({name:"ExternalServiceException",$fault:"client",$metadata:it(e)},r)]}))}))},Re=function(e,t){return A(void 0,void 0,void 0,(function(){var n,r;return O(this,(function(i){return n=e.body,r=$e(n,t),[2,E({name:"InternalErrorException",$fault:"server",$metadata:it(e)},r)]}))}))},De=function(e,t){return A(void 0,void 0,void 0,(function(){var n,r;return O(this,(function(i){return n=e.body,r=Qe(n,t),[2,E({name:"InvalidIdentityPoolConfigurationException",$fault:"client",$metadata:it(e)},r)]}))}))},Ue=function(e,t){return A(void 0,void 0,void 0,(function(){var n,r;return O(this,(function(i){return n=e.body,r=Ze(n,t),[2,E({name:"InvalidParameterException",$fault:"client",$metadata:it(e)},r)]}))}))},Fe=function(e,t){return A(void 0,void 0,void 0,(function(){var n,r;return O(this,(function(i){return n=e.body,r=Xe(n,t),[2,E({name:"LimitExceededException",$fault:"client",$metadata:it(e)},r)]}))}))},Le=function(e,t){return A(void 0,void 0,void 0,(function(){var n,r;return O(this,(function(i){return n=e.body,r=et(n,t),[2,E({name:"NotAuthorizedException",$fault:"client",$metadata:it(e)},r)]}))}))},Be=function(e,t){return A(void 0,void 0,void 0,(function(){var n,r;return O(this,(function(i){return n=e.body,r=tt(n,t),[2,E({name:"ResourceConflictException",$fault:"client",$metadata:it(e)},r)]}))}))},qe=function(e,t){return A(void 0,void 0,void 0,(function(){var n,r;return O(this,(function(i){return n=e.body,r=nt(n,t),[2,E({name:"ResourceNotFoundException",$fault:"client",$metadata:it(e)},r)]}))}))},ze=function(e,t){return A(void 0,void 0,void 0,(function(){var n,r;return O(this,(function(i){return n=e.body,r=rt(n,t),[2,E({name:"TooManyRequestsException",$fault:"client",$metadata:it(e)},r)]}))}))},Ke=function(e,t){return E(E(E({},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:He(e.Logins,t)})},Ve=function(e,t){return E(E(E({},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:He(e.Logins,t)})},He=function(e,t){return Object.entries(e).reduce((function(e,t){var n,r=I(t,2),i=r[0],o=r[1];return null===o?e:E(E({},e),((n={})[i]=o,n))}),{})},Ge=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}},We=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ye=function(e,t){return{Credentials:void 0!==e.Credentials&&null!==e.Credentials?Ge(e.Credentials):void 0,IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},Je=function(e,t){return{IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},$e=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Qe=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Ze=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Xe=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},et=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},tt=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},nt=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},rt=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},it=function(e){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"]}},ot=function(e,t){return void 0===e&&(e=new Uint8Array),e instanceof Uint8Array?Promise.resolve(e):t.streamCollector(e)||Promise.resolve(new Uint8Array)},st=function(e,t,n,r,i){return A(void 0,void 0,void 0,(function(){var o,s,a,u,c,l;return O(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 ke(l)]}}))}))},at=function(e,t){return function(e,t){return ot(e,t).then((function(e){return t.utf8Encoder(e)}))}(e,t).then((function(e){return e.length?JSON.parse(e):{}}))},ut=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):""},ct={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},lt={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function ft(e,t,n){return{applyToStack:function(r){r.add(function(e,t){return function(n,r){return function(r){return Object(w.__awaiter)(void 0,void 0,void 0,(function(){var i,o;return Object(w.__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),ct),r.add(function(e,t){return function(n,r){return function(r){return Object(w.__awaiter)(void 0,void 0,void 0,(function(){var i;return Object(w.__generator)(this,(function(o){switch(o.label){case 0:return[4,t(r.input,e)];case 1:return i=o.sent(),[2,n(Object(w.__assign)(Object(w.__assign)({},r),{request:i}))]}}))}))}}}(e,t),lt)}}}var dt=function(){var e=[],t=[],n=new Set,r=function(n){return e.forEach((function(e){n.add(e.middleware,Object(w.__assign)({},e))})),t.forEach((function(e){n.addRelativeTo(e.middleware,Object(w.__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(w.__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(w.__spread)(i(e)))})),t},o=function(){var n,r=[],o=[],s={};return e.forEach((function(e){var t=Object(w.__assign)(Object(w.__assign)({},e),{before:[],after:[]});t.name&&(s[t.name]=t),r.push(t)})),t.forEach((function(e){var t=Object(w.__assign)(Object(w.__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 ht[t.step]-ht[e.step]||pt[t.priority||"normal"]-pt[e.priority||"normal"]}))).map(i).reduce((function(e,t){return e.push.apply(e,Object(w.__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(w.__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(w.__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(dt())},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(dt());return t.use(e),t},applyToStack:r,resolve:function(e,t){var n,r;try{for(var i=Object(w.__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},ht={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},pt={high:3,normal:2,low:1},vt=function(){function e(e){this.middlewareStack=dt(),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}(),yt=function(){this.middlewareStack=dt()};var gt=function(){var e=Object.getPrototypeOf(this).constructor,t=Function.bind.apply(String,Object(w.__spread)([null],arguments)),n=new t;return Object.setPrototypeOf(n,e.prototype),n};gt.prototype=Object.create(String.prototype,{constructor:{value:gt,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf(gt,String);!function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Object(w.__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))}}(gt);var mt=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return _(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(ft(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetCredentialsForIdentityCommand",inputFilterSensitiveLog:W.filterSensitiveLog,outputFilterSensitiveLog:J.filterSensitiveLog},o=t.requestHandler;return r.resolve((function(e){return o.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return A(void 0,void 0,void 0,(function(){var n,r;return O(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetCredentialsForIdentity"},r=JSON.stringify(Ke(e,t)),[2,st(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return A(void 0,void 0,void 0,(function(){var n,r,i;return O(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,Ne(e,t)]:[4,at(e.body,t)];case 1:return n=o.sent(),{},r=Ye(n,t),i=E({$metadata:it(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(yt),bt=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(w.__extends)(t,e),t}(Error);function wt(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(w.__read)(t,2),r=n[0],i=n[1];return e[r]=i,e}),{})}))}function St(e){var t=this;return function(){return Object(w.__awaiter)(t,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,c,l,f,d,h;return Object(w.__generator)(this,(function(p){switch(p.label){case 0:return l=(c=e.client).send,f=mt.bind,h={CustomRoleArn:e.customRoleArn,IdentityId:e.identityId},e.logins?[4,wt(e.logins)]:[3,2];case 1:return d=p.sent(),[3,3];case 2:d=void 0,p.label=3;case 3:return[4,l.apply(c,[new(f.apply(mt,[void 0,(h.Logins=d,h)]))])];case 4:return t=p.sent().Credentials,n=void 0===t?function(){throw new bt("Response from Amazon Cognito contained no credentials")}():t,r=n.AccessKeyId,i=void 0===r?function(){throw new bt("Response from Amazon Cognito contained no access key ID")}():r,o=n.Expiration,s=n.SecretKey,a=void 0===s?function(){throw new bt("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 _t=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return _(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(ft(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 A(void 0,void 0,void 0,(function(){var n,r;return O(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetId"},r=JSON.stringify(Ve(e,t)),[2,st(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return A(void 0,void 0,void 0,(function(){var n,r,i;return O(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,je(e,t)]:[4,at(e.body,t)];case 1:return n=o.sent(),{},r=Je(n,t),i=E({$metadata:it(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(yt),Et=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}(),At=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 Ot(e){var t=this,n=e.accountId,r=e.cache,i=void 0===r?"object"==typeof self&&self.indexedDB?new Et:"object"==typeof window&&window.localStorage?window.localStorage:At:r,o=e.client,s=e.customRoleArn,a=e.identityPoolId,u=e.logins,c=e.userIdentifier,l=void 0===c?u&&0!==Object.keys(u).length?void 0:"ANONYMOUS":c,f=l?"aws:cognito-identity-credentials:"+a+":"+l:void 0,d=function(){return Object(w.__awaiter)(t,void 0,void 0,(function(){var e,t,r,c,l,h,p,v,y;return Object(w.__generator)(this,(function(g){switch(g.label){case 0:return(t=f)?[4,i.getItem(f)]:[3,2];case 1:t=g.sent(),g.label=2;case 2:return(e=t)?[3,7]:(h=(l=o).send,p=_t.bind,y={AccountId:n,IdentityPoolId:a},u?[4,wt(u)]:[3,4]);case 3:return v=g.sent(),[3,5];case 4:v=void 0,g.label=5;case 5:return[4,h.apply(l,[new(p.apply(_t,[void 0,(y.Logins=v,y)]))])];case 6:r=g.sent().IdentityId,c=void 0===r?function(){throw new bt("Response from Amazon Cognito contained no identity ID")}():r,e=c,f&&Promise.resolve(i.setItem(f,e)).catch((function(){})),g.label=7;case 7:return[2,(d=St({client:o,customRoleArn:s,logins:u,identityId:e}))()]}}))}))};return function(){return d().catch((function(e){return Object(w.__awaiter)(t,void 0,void 0,(function(){return Object(w.__generator)(this,(function(t){throw f&&Promise.resolve(i.removeItem(f)).catch((function(){})),e}))}))}))}}var It=function(e,t){return(It=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 Tt(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}It(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Ct=function(){return(Ct=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function Pt(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function xt(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(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}Object.create;function kt(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 Nt,jt,Mt,Rt,Dt,Ut,Ft,Lt,Bt,qt,zt,Kt,Vt,Ht,Gt,Wt,Yt,Jt,$t,Qt,Zt,Xt,en,tn,nn,rn,on,sn,an,un,cn,ln,fn,dn,hn,pn,vn,yn,gn,mn,bn,wn,Sn,_n,En,An,On,In,Tn,Cn,Pn,xn,kn,Nn,jn,Mn,Rn;Object.create;!function(e){e.AUTHENTICATED_ROLE="AuthenticatedRole",e.DENY="Deny"}(Nt||(Nt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(jt||(jt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Mt||(Mt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Rt||(Rt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Dt||(Dt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Ut||(Ut={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Ft||(Ft={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Lt||(Lt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Bt||(Bt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(qt||(qt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(zt||(zt={})),function(e){e.ACCESS_DENIED="AccessDenied",e.INTERNAL_SERVER_ERROR="InternalServerError"}(Kt||(Kt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Vt||(Vt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Ht||(Ht={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Gt||(Gt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Wt||(Wt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Yt||(Yt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Jt||(Jt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}($t||($t={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Qt||(Qt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Zt||(Zt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Xt||(Xt={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(en||(en={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(tn||(tn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(nn||(nn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(rn||(rn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(on||(on={})),function(e){e.CONTAINS="Contains",e.EQUALS="Equals",e.NOT_EQUAL="NotEqual",e.STARTS_WITH="StartsWith"}(sn||(sn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(an||(an={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(un||(un={})),function(e){e.RULES="Rules",e.TOKEN="Token"}(cn||(cn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(ln||(ln={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(fn||(fn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(dn||(dn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(hn||(hn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(pn||(pn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(vn||(vn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(yn||(yn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(gn||(gn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(mn||(mn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(bn||(bn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(wn||(wn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Sn||(Sn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(_n||(_n={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(En||(En={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(An||(An={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(On||(On={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(In||(In={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Tn||(Tn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Cn||(Cn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Pn||(Pn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(xn||(xn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(kn||(kn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Nn||(Nn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(jn||(jn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Mn||(Mn={})),function(e){e.filterSensitiveLog=function(e){return Ct({},e)}}(Rn||(Rn={}));var Dn=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return xt(this,(function(g){switch(g.label){case 0:return r=[Ct({},e)],y={},[4,fr(e.body,t)];case 1:switch(n=Ct.apply(void 0,r.concat([(y.body=g.sent(),y)])),o="UnknownError",o=dr(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,Fn(n,t)];case 3:return i=Ct.apply(void 0,[Ct.apply(void 0,s.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 4:return a=[{}],[4,Ln(n,t)];case 5:return i=Ct.apply(void 0,[Ct.apply(void 0,a.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 6:return u=[{}],[4,Bn(n,t)];case 7:return i=Ct.apply(void 0,[Ct.apply(void 0,u.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 8:return c=[{}],[4,qn(n,t)];case 9:return i=Ct.apply(void 0,[Ct.apply(void 0,c.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 10:return l=[{}],[4,Kn(n,t)];case 11:return i=Ct.apply(void 0,[Ct.apply(void 0,l.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 12:return f=[{}],[4,Vn(n,t)];case 13:return i=Ct.apply(void 0,[Ct.apply(void 0,f.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 14:return d=[{}],[4,Hn(n,t)];case 15:return i=Ct.apply(void 0,[Ct.apply(void 0,d.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 16:return h=[{}],[4,Gn(n,t)];case 17:return i=Ct.apply(void 0,[Ct.apply(void 0,h.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=Ct(Ct({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:ur(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))]}}))}))},Un=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y;return xt(this,(function(g){switch(g.label){case 0:return r=[Ct({},e)],y={},[4,fr(e.body,t)];case 1:switch(n=Ct.apply(void 0,r.concat([(y.body=g.sent(),y)])),o="UnknownError",o=dr(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,Fn(n,t)];case 3:return i=Ct.apply(void 0,[Ct.apply(void 0,s.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 4:return a=[{}],[4,Ln(n,t)];case 5:return i=Ct.apply(void 0,[Ct.apply(void 0,a.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 6:return u=[{}],[4,qn(n,t)];case 7:return i=Ct.apply(void 0,[Ct.apply(void 0,u.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 8:return c=[{}],[4,zn(n,t)];case 9:return i=Ct.apply(void 0,[Ct.apply(void 0,c.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 10:return l=[{}],[4,Kn(n,t)];case 11:return i=Ct.apply(void 0,[Ct.apply(void 0,l.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 12:return f=[{}],[4,Vn(n,t)];case 13:return i=Ct.apply(void 0,[Ct.apply(void 0,f.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 14:return d=[{}],[4,Hn(n,t)];case 15:return i=Ct.apply(void 0,[Ct.apply(void 0,d.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 16:return h=[{}],[4,Gn(n,t)];case 17:return i=Ct.apply(void 0,[Ct.apply(void 0,h.concat([g.sent()])),{name:o,$metadata:ur(e)}]),[3,19];case 18:p=n.body,o=p.code||p.Code||o,i=Ct(Ct({},p),{name:""+o,message:p.message||p.Message||o,$fault:"client",$metadata:ur(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))]}}))}))},Fn=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return xt(this,(function(i){return n=e.body,r=Qn(n,t),[2,Ct({name:"ExternalServiceException",$fault:"client",$metadata:ur(e)},r)]}))}))},Ln=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return xt(this,(function(i){return n=e.body,r=er(n,t),[2,Ct({name:"InternalErrorException",$fault:"server",$metadata:ur(e)},r)]}))}))},Bn=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return xt(this,(function(i){return n=e.body,r=tr(n,t),[2,Ct({name:"InvalidIdentityPoolConfigurationException",$fault:"client",$metadata:ur(e)},r)]}))}))},qn=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return xt(this,(function(i){return n=e.body,r=nr(n,t),[2,Ct({name:"InvalidParameterException",$fault:"client",$metadata:ur(e)},r)]}))}))},zn=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return xt(this,(function(i){return n=e.body,r=rr(n,t),[2,Ct({name:"LimitExceededException",$fault:"client",$metadata:ur(e)},r)]}))}))},Kn=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return xt(this,(function(i){return n=e.body,r=ir(n,t),[2,Ct({name:"NotAuthorizedException",$fault:"client",$metadata:ur(e)},r)]}))}))},Vn=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return xt(this,(function(i){return n=e.body,r=or(n,t),[2,Ct({name:"ResourceConflictException",$fault:"client",$metadata:ur(e)},r)]}))}))},Hn=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return xt(this,(function(i){return n=e.body,r=sr(n,t),[2,Ct({name:"ResourceNotFoundException",$fault:"client",$metadata:ur(e)},r)]}))}))},Gn=function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return xt(this,(function(i){return n=e.body,r=ar(n,t),[2,Ct({name:"TooManyRequestsException",$fault:"client",$metadata:ur(e)},r)]}))}))},Wn=function(e,t){return Ct(Ct(Ct({},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:Jn(e.Logins,t)})},Yn=function(e,t){return Ct(Ct(Ct({},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:Jn(e.Logins,t)})},Jn=function(e,t){return Object.entries(e).reduce((function(e,t){var n,r=kt(t,2),i=r[0],o=r[1];return null===o?e:Ct(Ct({},e),((n={})[i]=o,n))}),{})},$n=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}},Qn=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},Zn=function(e,t){return{Credentials:void 0!==e.Credentials&&null!==e.Credentials?$n(e.Credentials):void 0,IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},Xn=function(e,t){return{IdentityId:void 0!==e.IdentityId&&null!==e.IdentityId?e.IdentityId:void 0}},er=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},tr=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},nr=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},rr=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},ir=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},or=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},sr=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},ar=function(e,t){return{message:void 0!==e.message&&null!==e.message?e.message:void 0}},ur=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"]}},cr=function(e,t){return void 0===e&&(e=new Uint8Array),e instanceof Uint8Array?Promise.resolve(e):t.streamCollector(e)||Promise.resolve(new Uint8Array)},lr=function(e,t,n,r,i){return Pt(void 0,void 0,void 0,(function(){var o,s,a,u,c,l;return xt(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 ke(l)]}}))}))},fr=function(e,t){return function(e,t){return cr(e,t).then((function(e){return t.utf8Encoder(e)}))}(e,t).then((function(e){return e.length?JSON.parse(e):{}}))},dr=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):""},hr=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return Tt(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(ft(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetIdCommand",inputFilterSensitiveLog:nn.filterSensitiveLog,outputFilterSensitiveLog:rn.filterSensitiveLog},o=t.requestHandler;return r.resolve((function(e){return o.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return xt(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetId"},r=JSON.stringify(Yn(e,t)),[2,lr(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r,i;return xt(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,Un(e,t)]:[4,fr(e.body,t)];case 1:return n=o.sent(),{},r=Xn(n,t),i=Ct({$metadata:ur(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(yt),pr=function(e){function t(t){var n=e.call(this)||this;return n.input=t,n}return Tt(t,e),t.prototype.resolveMiddleware=function(e,t,n){this.middlewareStack.use(ft(t,this.serialize,this.deserialize));var r=e.concat(this.middlewareStack),i={logger:t.logger,clientName:"CognitoIdentityClient",commandName:"GetCredentialsForIdentityCommand",inputFilterSensitiveLog:Zt.filterSensitiveLog,outputFilterSensitiveLog:en.filterSensitiveLog},o=t.requestHandler;return r.resolve((function(e){return o.handle(e.request,n||{})}),i)},t.prototype.serialize=function(e,t){return function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r;return xt(this,(function(i){return n={"content-type":"application/x-amz-json-1.1","x-amz-target":"AWSCognitoIdentityService.GetCredentialsForIdentity"},r=JSON.stringify(Wn(e,t)),[2,lr(t,n,"/",void 0,r)]}))}))}(e,t)},t.prototype.deserialize=function(e,t){return function(e,t){return Pt(void 0,void 0,void 0,(function(){var n,r,i;return xt(this,(function(o){switch(o.label){case 0:return e.statusCode>=300?[2,Dn(e,t)]:[4,fr(e.body,t)];case 1:return n=o.sent(),{},r=Zn(n,t),i=Ct({$metadata:ur(e)},r),[2,Promise.resolve(i)]}}))}))}(e,t)},t}(yt),vr=n(71),yr=n(69),gr=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,mr)},mr=function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()};for(var br=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(w.__values)(Object.keys(e).sort()),o=i.next();!o.done;o=i.next()){var s=o.value,a=e[s];if(s=gr(s),Array.isArray(a))for(var u=0,c=a.length;u<c;u++)r.push(s+"="+gr(a[u]));else{var l=s;(a||"string"==typeof a)&&(l+="="+gr(a)),r.push(l)}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r.join("&")}(e.query);s&&(o+="?"+s)}var a=e.port,u=e.method,c=e.protocol+"//"+e.hostname+(a?":"+a:"")+o,l={body:"GET"===u||"HEAD"===u?void 0:e.body,headers:new Headers(e.headers),method:u};"undefined"!=typeof AbortController&&(l.signal=n);var f,d=new Request(c,l),h=[fetch(d).then((function(e){var t,n,r=e.headers,i={};try{for(var o=Object(w.__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 xe({headers:i,statusCode:e.status,body:e.body})}:e.blob().then((function(t){return{response:new xe({headers:i,statusCode:e.status,body:t})}}))})),(f=r,void 0===f&&(f=0),new Promise((function(e,t){f&&setTimeout((function(){var e=new Error("Request did not complete within "+f+" ms");e.name="TimeoutError",t(e)}),f)})))];return n&&h.push(new Promise((function(e,t){n.onabort=function(){var e=new Error("Request aborted");e.name="AbortError",t(e)}}))),Promise.race(h)},e}(),wr={},Sr=new Array(64),_r=0,Er="A".charCodeAt(0),Ar="Z".charCodeAt(0);_r+Er<=Ar;_r++){var Or=String.fromCharCode(_r+Er);wr[Or]=_r,Sr[_r]=Or}for(_r=0,Er="a".charCodeAt(0),Ar="z".charCodeAt(0);_r+Er<=Ar;_r++){Or=String.fromCharCode(_r+Er);var Ir=_r+26;wr[Or]=Ir,Sr[Ir]=Or}for(_r=0;_r<10;_r++){wr[_r.toString(10)]=_r+52;Or=_r.toString(10),Ir=_r+52;wr[Or]=Ir,Sr[Ir]=Or}wr["+"]=62,Sr[62]="+",wr["/"]=63,Sr[63]="/";function Tr(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|=wr[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 Cr(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 Pr={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},xr=function(e){return{applyToStack:function(t){t.add(function(e){return function(t,n){return function(r){return Object(w.__awaiter)(void 0,void 0,void 0,(function(){var i;return Object(w.__generator)(this,(function(o){return(null===(i=null==e?void 0:e.retryStrategy)||void 0===i?void 0:i.mode)&&(n.userAgent=Object(w.__spread)(n.userAgent||[],[["cfg/retry-mode",e.retryStrategy.mode]])),[2,e.retryStrategy.retry(t,r)]}))}))}}}(e),Pr)}}},kr=["AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch"],Nr=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],jr=["AbortError","TimeoutError","RequestTimeout","RequestTimeoutException"],Mr=[500,502,503,504],Rr=function(e){var t,n;return 429===(null===(t=e.$metadata)||void 0===t?void 0:t.httpStatusCode)||Nr.includes(e.name)||1==(null===(n=e.$retryable)||void 0===n?void 0:n.throttling)},Dr=n(68),Ur=function(e,t){return Math.floor(Math.min(2e4,Math.random()*Math.pow(2,t)*e))},Fr=function(e){return!!e&&(function(e){return void 0!==e.$retryable}(e)||function(e){return kr.includes(e.name)}(e)||Rr(e)||function(e){var t;return jr.includes(e.name)||Mr.includes((null===(t=e.$metadata)||void 0===t?void 0:t.httpStatusCode)||0)}(e))},Lr=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:Fr,this.delayDecider=null!==(r=null==t?void 0:t.delayDecider)&&void 0!==r?r:Ur,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(w.__awaiter)(this,void 0,void 0,(function(){var e;return Object(w.__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(w.__awaiter)(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c;return Object(w.__generator)(this,(function(l){switch(l.label){case 0:return r=0,i=0,[4,this.getMaxAttempts()];case 1:o=l.sent(),s=t.request,ke.isInstance(s)&&(s.headers["amz-sdk-invocation-id"]=Object(Dr.v4)()),a=function(){var a,c,l,f,d;return Object(w.__generator)(this,(function(h){switch(h.label){case 0:return h.trys.push([0,2,,5]),ke.isInstance(s)&&(s.headers["amz-sdk-request"]="attempt="+(r+1)+"; max="+o),[4,e(t)];case 1:return a=h.sent(),c=a.response,l=a.output,u.retryQuota.releaseRetryTokens(n),l.$metadata.attempts=r+1,l.$metadata.totalRetryDelay=i,[2,{value:{response:c,output:l}}];case 2:return f=h.sent(),r++,u.shouldRetry(f,r,o)?(n=u.retryQuota.retrieveRetryTokens(f),d=u.delayDecider(Rr(f)?500:100,r),i+=d,[4,new Promise((function(e){return setTimeout(e,d)}))]):[3,4];case 3:return h.sent(),[2,"continue"];case 4:throw f.$metadata||(f.$metadata={}),f.$metadata.attempts=r,f.$metadata.totalRetryDelay=i,f;case 5:return[2]}}))},u=this,l.label=2;case 2:return[5,a()];case 3:return"object"==typeof(c=l.sent())?[2,c.value]:[3,2];case 4:return[2]}}))}))},e}(),Br=function(e){if(void 0===e&&(e=3),"number"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};var qr=n(70),zr=n.n(qr);var Kr="cognito-identity.{region}.amazonaws.com",Vr=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"]),Hr=new Set(["cn-north-1","cn-northwest-1"]),Gr=new Set(["us-iso-east-1"]),Wr=new Set(["us-isob-east-1"]),Yr=new Set(["us-gov-east-1","us-gov-west-1"]);var Jr,$r,Qr,Zr,Xr={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:Vr.has(e)&&(n={hostname:Kr.replace("{region}",e),partition:"aws"}),Hr.has(e)&&(n={hostname:"cognito-identity.{region}.amazonaws.com.cn".replace("{region}",e),partition:"aws-cn"}),Gr.has(e)&&(n={hostname:"cognito-identity.{region}.c2s.ic.gov".replace("{region}",e),partition:"aws-iso"}),Wr.has(e)&&(n={hostname:"cognito-identity.{region}.sc2s.sgov.gov".replace("{region}",e),partition:"aws-iso-b"}),Yr.has(e)&&(n={hostname:"cognito-identity.{region}.amazonaws.com".replace("{region}",e),partition:"aws-us-gov"}),void 0===n&&(n={hostname:Kr.replace("{region}",e),partition:"aws"})}return Promise.resolve(Ct({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(w.__values)(e.split("&")),o=i.next();!o.done;o=i.next()){var s=o.value,a=Object(w.__read)(s.split("="),2),u=a[0],c=a[1],l=void 0===c?null:c;u=decodeURIComponent(u),l&&(l=decodeURIComponent(l)),u in r?Array.isArray(r[u])?r[u].push(l):r[u]=[r[u],l]:r[u]=l}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}(a)),{hostname:r,port:o?parseInt(o):void 0,protocol:s,path:i,query:t}}},ei=Ct(Ct({},Xr),{runtime:"browser",base64Decoder:Tr,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+=Sr[(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:($r={serviceId:Xr.serviceId,clientVersion:vr.version},Qr=$r.serviceId,Zr=$r.clientVersion,function(){return Object(w.__awaiter)(void 0,void 0,void 0,(function(){var e,t,n,r,i,o,s,a,u;return Object(w.__generator)(this,(function(c){return e=(null===(n=null===window||void 0===window?void 0:window.navigator)||void 0===n?void 0:n.userAgent)?zr.a.parse(window.navigator.userAgent):void 0,t=[["aws-sdk-js",Zr],["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")]],Qr&&t.push(["api/"+Qr,Zr]),[2,t]}))}))}),maxAttempts:3,region:(Jr="Region is missing",function(){return Promise.reject(Jr)}),requestHandler:new br,sha256:yr.Sha256,streamCollector:function(e){return"function"==typeof Blob&&e instanceof Blob?function(e){return Object(w.__awaiter)(this,void 0,void 0,(function(){var t,n;return Object(w.__generator)(this,(function(r){switch(r.label){case 0:return[4,Cr(e)];case 1:return t=r.sent(),n=Tr(t),[2,new Uint8Array(n)]}}))}))}(e):function(e){return Object(w.__awaiter)(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return Object(w.__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: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)},utf8Encoder: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)}}),ti=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},ni=function(e){return Object(w.__awaiter)(void 0,void 0,void 0,(function(){var t,n,r,i,o;return Object(w.__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)]}}))}))},ri=function(e){if("string"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};var ii={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},oi=function(e){return{applyToStack:function(t){t.add(function(e){var t=this;return function(n){return function(r){return Object(w.__awaiter)(t,void 0,void 0,(function(){var t,i,o,s,a;return Object(w.__generator)(this,(function(u){return t=r.request,ke.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(w.__assign)(Object(w.__assign)({},t.headers),((a={})["content-length"]=String(s),a)))),[2,n(Object(w.__assign)(Object(w.__assign)({},r),{request:t}))]}))}))}}}(e.bodyLengthChecker),ii)}}};for(var si={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},ai=function(e){return{applyToStack:function(t){t.add(function(e){return function(t){return function(n){return Object(w.__awaiter)(void 0,void 0,void 0,(function(){var r,i;return Object(w.__generator)(this,(function(o){return ke.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),si)}}},ui={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},ci=function(e){return{applyToStack:function(e){e.add((function(e,t){return function(n){return Object(w.__awaiter)(void 0,void 0,void 0,(function(){var r,i,o,s,a,u,c,l,f;return Object(w.__generator)(this,(function(d){switch(d.label){case 0:return r=t.clientName,i=t.commandName,o=t.inputFilterSensitiveLog,s=t.logger,a=t.outputFilterSensitiveLog,[4,e(n)];case 1:return u=d.sent(),s?("function"==typeof s.info&&(c=u.output,l=c.$metadata,f=Object(w.__rest)(c,["$metadata"]),s.info({clientName:r,commandName:i,input:o(n.input),output:a(f),metadata:l})),[2,u]):[2,u]}}))}))}}),ui)}}},li={},fi={},di=0;di<256;di++){var hi=di.toString(16).toLowerCase();1===hi.length&&(hi="0"+hi),li[di]=hi,fi[hi]=di}function pi(e){for(var t="",n=0;n<e.byteLength;n++)t+=li[e[n]];return t}var vi="X-Amz-Date".toLowerCase(),yi=["authorization",vi,"date"],gi="X-Amz-Signature".toLowerCase(),mi="X-Amz-Security-Token".toLowerCase(),bi={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},wi=/^proxy-/,Si=/^sec-/,_i="AWS4-HMAC-SHA256-PAYLOAD",Ei={},Ai=[];function Oi(e,t,n){return e+"/"+t+"/"+n+"/aws4_request"}function Ii(e,t,n){var r=new e(t);return r.update(n),r.digest()}function Ti(e,t,n){var r,i,o=e.headers,s={};try{for(var a=Object(w.__values)(Object.keys(o).sort()),u=a.next();!u.done;u=a.next()){var c=u.value,l=c.toLowerCase();(l in bi||(null==t?void 0:t.has(l))||wi.test(l)||Si.test(l))&&(!n||n&&!n.has(l))||(s[l]=o[c].trim().replace(/\s+/g," "))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return s}var Ci=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,Pi)},Pi=function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()};function xi(e,t){var n=e.headers,r=e.body;return Object(w.__awaiter)(this,void 0,void 0,(function(){var e,i,o,s,a,u,c;return Object(w.__generator)(this,(function(l){switch(l.label){case 0:try{for(e=Object(w.__values)(Object.keys(n)),i=e.next();!i.done;i=e.next())if("x-amz-content-sha256"===(o=i.value).toLowerCase())return[2,n[o]]}catch(e){u={error:e}}finally{try{i&&!i.done&&(c=e.return)&&c.call(e)}finally{if(u)throw u.error}}return null!=r?[3,1]:[2,"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"];case 1:return"string"==typeof r||ArrayBuffer.isView(r)||(f=r,"function"==typeof ArrayBuffer&&f instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(f))?((s=new t).update(r),a=pi,[4,s.digest()]):[3,3];case 2:return[2,a.apply(void 0,[l.sent()])];case 3:return[2,"UNSIGNED-PAYLOAD"]}var f}))}))}function ki(e){var t=e.headers,n=e.query,r=Object(w.__rest)(e,["headers","query"]);return Object(w.__assign)(Object(w.__assign)({},r),{headers:Object(w.__assign)({},t),query:n?Ni(n):void 0})}function Ni(e){return Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object(w.__assign)(Object(w.__assign)({},t),((r={})[n]=Array.isArray(i)?Object(w.__spread)(i):i,r))}),{})}function ji(e){var t,n;e="function"==typeof e.clone?e.clone():ki(e);try{for(var r=Object(w.__values)(Object.keys(e.headers)),i=r.next();!i.done;i=r.next()){var o=i.value;yi.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 Mi(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 Ri=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=Fi(r),this.credentialProvider=Li(n)}return e.prototype.presign=function(e,t){return void 0===t&&(t={}),Object(w.__awaiter)(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,d,h,p,v,y,g,m,b,S,_,E,A,O,I;return Object(w.__generator)(this,(function(T){switch(T.label){case 0:return n=t.signingDate,r=void 0===n?new Date:n,i=t.expiresIn,o=void 0===i?3600:i,s=t.unsignableHeaders,a=t.unhoistableHeaders,u=t.signableHeaders,c=t.signingRegion,l=t.signingService,[4,this.credentialProvider()];case 1:return f=T.sent(),null==c?[3,2]:(h=c,[3,4]);case 2:return[4,this.regionProvider()];case 3:h=T.sent(),T.label=4;case 4:return d=h,p=Di(r),v=p.longDate,y=p.shortDate,o>604800?[2,Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future")]:(g=Oi(y,d,null!=l?l:this.service),m=function(e,t){var n,r,i;void 0===t&&(t={});var o="function"==typeof e.clone?e.clone():ki(e),s=o.headers,a=o.query,u=void 0===a?{}:a;try{for(var c=Object(w.__values)(Object.keys(s)),l=c.next();!l.done;l=c.next()){var f=l.value,d=f.toLowerCase();"x-amz-"!==d.substr(0,6)||(null===(i=t.unhoistableHeaders)||void 0===i?void 0:i.has(d))||(u[f]=s[f],delete s[f])}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}return Object(w.__assign)(Object(w.__assign)({},e),{headers:s,query:u})}(ji(e),{unhoistableHeaders:a}),f.sessionToken&&(m.query["X-Amz-Security-Token"]=f.sessionToken),m.query["X-Amz-Algorithm"]="AWS4-HMAC-SHA256",m.query["X-Amz-Credential"]=f.accessKeyId+"/"+g,m.query["X-Amz-Date"]=v,m.query["X-Amz-Expires"]=o.toString(10),b=Ti(m,s,u),m.query["X-Amz-SignedHeaders"]=Ui(b),S=m.query,_="X-Amz-Signature",E=this.getSignature,A=[v,g,this.getSigningKey(f,d,y,l)],O=this.createCanonicalRequest,I=[m,b],[4,xi(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,m]}}))}))},e.prototype.sign=function(e,t){return Object(w.__awaiter)(this,void 0,void 0,(function(){return Object(w.__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(w.__awaiter)(this,void 0,void 0,(function(){var e,t,i,c,l,f,d,h,p,v,y;return Object(w.__generator)(this,(function(g){switch(g.label){case 0:return null==a?[3,1]:(t=a,[3,3]);case 1:return[4,this.regionProvider()];case 2:t=g.sent(),g.label=3;case 3:return e=t,i=Di(o),c=i.shortDate,l=i.longDate,f=Oi(c,e,null!=u?u:this.service),[4,xi({headers:{},body:r},this.sha256)];case 4:return d=g.sent(),(h=new this.sha256).update(n),v=pi,[4,h.digest()];case 5:return p=v.apply(void 0,[g.sent()]),y=[_i,l,f,s,p,d].join("\n"),[2,this.signString(y,{signingDate:o,signingRegion:e,signingService:u})]}}))}))},e.prototype.signString=function(e,t){var n=void 0===t?{}:t,r=n.signingDate,i=void 0===r?new Date:r,o=n.signingRegion,s=n.signingService;return Object(w.__awaiter)(this,void 0,void 0,(function(){var t,n,r,a,u,c,l,f;return Object(w.__generator)(this,(function(d){switch(d.label){case 0:return[4,this.credentialProvider()];case 1:return t=d.sent(),null==o?[3,2]:(r=o,[3,4]);case 2:return[4,this.regionProvider()];case 3:r=d.sent(),d.label=4;case 4:return n=r,a=Di(i).shortDate,l=(c=this.sha256).bind,[4,this.getSigningKey(t,n,a,s)];case 5:return(u=new(l.apply(c,[void 0,d.sent()]))).update(e),f=pi,[4,u.digest()];case 6:return[2,f.apply(void 0,[d.sent()])]}}))}))},e.prototype.signRequest=function(e,t){var n=void 0===t?{}:t,r=n.signingDate,i=void 0===r?new Date:r,o=n.signableHeaders,s=n.unsignableHeaders,a=n.signingRegion,u=n.signingService;return Object(w.__awaiter)(this,void 0,void 0,(function(){var t,n,r,c,l,f,d,h,p,v,y;return Object(w.__generator)(this,(function(g){switch(g.label){case 0:return[4,this.credentialProvider()];case 1:return t=g.sent(),null==a?[3,2]:(r=a,[3,4]);case 2:return[4,this.regionProvider()];case 3:r=g.sent(),g.label=4;case 4:return n=r,c=ji(e),l=Di(i),f=l.longDate,d=l.shortDate,h=Oi(d,n,null!=u?u:this.service),c.headers[vi]=f,t.sessionToken&&(c.headers[mi]=t.sessionToken),[4,xi(c,this.sha256)];case 5:return p=g.sent(),!function(e,t){var n,r;e=e.toLowerCase();try{for(var i=Object(w.__values)(Object.keys(t)),o=i.next();!o.done;o=i.next()){if(e===o.value.toLowerCase())return!0}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1}("x-amz-content-sha256",c.headers)&&this.applyChecksum&&(c.headers["x-amz-content-sha256"]=p),v=Ti(c,s,o),[4,this.getSignature(f,h,this.getSigningKey(t,n,d,u),this.createCanonicalRequest(c,v,p))];case 6:return y=g.sent(),c.headers.authorization="AWS4-HMAC-SHA256 Credential="+t.accessKeyId+"/"+h+", SignedHeaders="+Ui(v)+", Signature="+y,[2,c]}}))}))},e.prototype.createCanonicalRequest=function(e,t,n){var r=Object.keys(t).sort();return e.method+"\n"+this.getCanonicalPath(e)+"\n"+function(e){var t,n,r=e.query,i=void 0===r?{}:r,o=[],s={},a=function(e){if(e.toLowerCase()===gi)return"continue";o.push(e);var t=i[e];"string"==typeof t?s[e]=Ci(e)+"="+Ci(t):Array.isArray(t)&&(s[e]=t.slice(0).sort().reduce((function(t,n){return t.concat([Ci(e)+"="+Ci(n)])}),[]).join("&"))};try{for(var u=Object(w.__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(w.__awaiter)(this,void 0,void 0,(function(){var r,i;return Object(w.__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"+pi(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(w.__awaiter)(this,void 0,void 0,(function(){var i,o,s,a,u;return Object(w.__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=pi,[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(w.__awaiter)(void 0,void 0,void 0,(function(){var o,s,a,u,c,l,f,d,h;return Object(w.__generator)(this,(function(p){switch(p.label){case 0:return[4,Ii(e,t.secretAccessKey,t.accessKeyId)];case 1:if(o=p.sent(),(s=n+":"+r+":"+i+":"+pi(o)+":"+t.sessionToken)in Ei)return[2,Ei[s]];for(Ai.push(s);Ai.length>50;)delete Ei[Ai.shift()];a="AWS4"+t.secretAccessKey,p.label=2;case 2:p.trys.push([2,7,8,9]),u=Object(w.__values)([n,r,i,"aws4_request"]),c=u.next(),p.label=3;case 3:return c.done?[3,6]:(l=c.value,[4,Ii(e,a,l)]);case 4:a=p.sent(),p.label=5;case 5:return c=u.next(),[3,3];case 6:return[3,9];case 7:return f=p.sent(),d={error:f},[3,9];case 8:try{c&&!c.done&&(h=u.return)&&h.call(u)}finally{if(d)throw d.error}return[7];case 9:return[2,Ei[s]=a]}}))}))}(this.sha256,e,n,t,r||this.service)},e}(),Di=function(e){var t=Mi(e).replace(/[\-:]/g,"");return{longDate:t,shortDate:t.substr(0,8)}},Ui=function(e){return Object.keys(e).sort().join(";")},Fi=function(e){if("string"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e},Li=function(e){if("object"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e};function Bi(e){if("object"==typeof e){var t=Promise.resolve(e);return function(){return t}}return e}var qi=/[^\!\#\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,zi=function(e){var t=Object(w.__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(qi,"_")})).join("/")},Ki={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},Vi=function(e){return{applyToStack:function(t){var n;t.add((n=e,function(e,t){return function(r){return Object(w.__awaiter)(void 0,void 0,void 0,(function(){var i,o,s,a,u,c,l,f;return Object(w.__generator)(this,(function(d){switch(d.label){case 0:return i=r.request,ke.isInstance(i)?(o=i.headers,s=(null===(l=null==t?void 0:t.userAgent)||void 0===l?void 0:l.map(zi))||[],[4,n.defaultUserAgentProvider()]):[2,e(r)];case 1:return a=d.sent().map(zi),u=(null===(f=null==n?void 0:n.customUserAgent)||void 0===f?void 0:f.map(zi))||[],o["x-amz-user-agent"]=Object(w.__spread)(a,s,u).join(" "),c=Object(w.__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(w.__assign)(Object(w.__assign)({},r),{request:i}))]}}))}))}}),Ki)}}},Hi=function(e){function t(t){var n,r,i=this,o=function(e){var t,n=this,r=Bi(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?Bi(e.signer):function(){return Bi(e.region)().then((function(t){return Object(w.__awaiter)(n,void 0,void 0,(function(){return Object(w.__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(w.__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 Ri({credentials:r,region:e.signingRegion,service:e.signingName,sha256:u,uriEscapePath:o})}))},Object(w.__assign)(Object(w.__assign)({},e),{systemClockOffset:a,signingEscapePath:o,credentials:r,signer:t})}(function(e){var t;return Object(w.__assign)(Object(w.__assign)({},e),{tls:null===(t=e.tls)||void 0===t||t,endpoint:e.endpoint?ti(e):function(){return ni(e)},isCustomEndpoint:!!e.endpoint})}(function(e){if(!e.region)throw new Error("Region is missing");return Object(w.__assign)(Object(w.__assign)({},e),{region:ri(e.region)})}(Ct(Ct({},ei),t)))),s=function(e){return Object(w.__assign)(Object(w.__assign)({},e),{customUserAgent:"string"==typeof e.customUserAgent?[[e.customUserAgent]]:e.customUserAgent})}((r=Br((n=o).maxAttempts),Object(w.__assign)(Object(w.__assign)({},n),{maxAttempts:r,retryStrategy:n.retryStrategy||new Lr(r)})));return(i=e.call(this,s)||this).config=s,i.middlewareStack.use(xr(i.config)),i.middlewareStack.use(oi(i.config)),i.middlewareStack.use(ai(i.config)),i.middlewareStack.use(ci(i.config)),i.middlewareStack.use(Vi(i.config)),i}return Tt(t,e),t.prototype.destroy=function(){e.prototype.destroy.call(this)},t}(vt),Gi=n(75),Wi=function(){return(Wi=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 Yi(e){var t=new Hi({region:e.region,customUserAgent:Object(Gi.b)()});return t.middlewareStack.add((function(e,t){return function(t){return e(function(e){return Wi(Wi({},e),{request:Wi(Wi({},e.request),{headers:Wi(Wi({},e.request.headers),{"cache-control":"no-store"})})})}(t))}}),{step:"build",name:"cacheControlMiddleWare"}),t}var Ji=function(){return(Ji=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)},$i=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())}))},Qi=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Zi=new r.a("Credentials"),Xi=new(function(){function e(e){this._gettingCredPromise=null,this._refreshHandlers={},this.Auth=void 0,this.configure(e),this._refreshHandlers.google=g.refreshGoogleToken,this._refreshHandlers.facebook=m.refreshFacebookToken}return e.prototype.getModuleName=function(){return"Credentials"},e.prototype.getCredSource=function(){return this._credentials_source},e.prototype.configure=function(e){if(!e)return this._config||{};this._config=Object.assign({},this._config,e);var t=this._config.refreshHandlers;return t&&(this._refreshHandlers=Ji(Ji({},this._refreshHandlers),t)),this._storage=this._config.storage,this._storage||(this._storage=(new i.a).getStorage()),this._storageSync=Promise.resolve(),"function"==typeof this._storage.sync&&(this._storageSync=this._storage.sync()),this._config},e.prototype.get=function(){return Zi.debug("getting credentials"),this._pickupCredentials()},e.prototype._getCognitoIdentityIdStorageKey=function(e){return"CognitoIdentityId-"+e},e.prototype._pickupCredentials=function(){return Zi.debug("picking up credentials"),this._gettingCredPromise&&this._gettingCredPromise.isPending()?Zi.debug("getting old cred promise"):(Zi.debug("getting new cred promise"),this._gettingCredPromise=Object(o.d)(this._keepAlive())),this._gettingCredPromise},e.prototype._keepAlive=function(){return $i(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return Qi(this,(function(a){switch(a.label){case 0:if(Zi.debug("checking if credentials exists and not expired"),(e=this._credentials)&&!this._isExpired(e)&&!this._isPastTTL())return Zi.debug("credentials not changed and not expired, directly return"),[2,Promise.resolve(e)];if(Zi.debug("need to get a new credential or refresh the existing one"),t=this.Auth,!(n=void 0===t?b.a.Auth:t)||"function"!=typeof n.currentUserCredentials)return[2,Promise.reject("No Auth module registered in Amplify")];if(this._isExpired(e)||!this._isPastTTL())return[3,6];Zi.debug("ttl has passed but token is not yet expired"),a.label=1;case 1:return a.trys.push([1,5,,6]),[4,n.currentUserPoolUser()];case 2:return r=a.sent(),[4,n.currentSession()];case 3:return i=a.sent(),o=i.refreshToken,[4,new Promise((function(e,t){r.refreshSession(o,(function(n,r){return n?t(n):e(r)}))}))];case 4:return a.sent(),[3,6];case 5:return s=a.sent(),Zi.debug("Error attempting to refreshing the session",s),[3,6];case 6:return[2,n.currentUserCredentials()]}}))}))},e.prototype.refreshFederatedToken=function(e){Zi.debug("Getting federated credentials");var t=e.provider,n=e.user,r=e.token,i=e.identity_id,o=e.expires_at;o=1970===new Date(o).getFullYear()?1e3*o:o;return Zi.debug("checking if federated jwt token expired"),o>(new Date).getTime()?(Zi.debug("token not expired"),this._setCredentialsFromFederation({provider:t,token:r,user:n,identity_id:i,expires_at:o})):this._refreshHandlers[t]&&"function"==typeof this._refreshHandlers[t]?(Zi.debug("getting refreshed jwt token from federation provider"),this._providerRefreshWithRetry({refreshHandler:this._refreshHandlers[t],provider:t,user:n})):(Zi.debug("no refresh handler for provider:",t),this.clear(),Promise.reject("no refresh handler for provider"))},e.prototype._providerRefreshWithRetry=function(e){var t=this,n=e.refreshHandler,r=e.provider,i=e.user;return Object(s.c)(n,[],1e4).then((function(e){return Zi.debug("refresh federated token sucessfully",e),t._setCredentialsFromFederation({provider:r,token:e.token,user:i,identity_id:e.identity_id,expires_at:e.expires_at})})).catch((function(e){return"string"==typeof e&&0===e.toLowerCase().lastIndexOf("network error",e.length)||t.clear(),Zi.debug("refresh federated token failed",e),Promise.reject("refreshing federation token failed: "+e)}))},e.prototype._isExpired=function(e){if(!e)return Zi.debug("no credentials for expiration check"),!0;Zi.debug("are these credentials expired?",e);var t=Date.now();return e.expiration.getTime()<=t},e.prototype._isPastTTL=function(){return this._nextCredentialsRefresh<=Date.now()},e.prototype._setCredentialsForGuest=function(){return $i(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a=this;return Qi(this,(function(u){switch(u.label){case 0:return Zi.debug("setting credentials for guest"),e=this._config,t=e.identityPoolId,n=e.region,e.mandatorySignIn?[2,Promise.reject("cannot get guest credentials when mandatory signin enabled")]:t?n?(i=this,[4,this._getGuestIdentityId()]):(Zi.debug("region is not configured for getting the credentials"),[2,Promise.reject("region is not configured for getting the credentials")]):(Zi.debug("No Cognito Identity pool provided for unauthenticated access"),[2,Promise.reject("No Cognito Identity pool provided for unauthenticated access")]);case 1:return r=i._identityId=u.sent(),o=Yi({region:n}),s=void 0,s=r?St({identityId:r,client:o})():function(){return $i(a,void 0,void 0,(function(){var e;return Qi(this,(function(n){switch(n.label){case 0:return[4,o.send(new hr({IdentityPoolId:t}))];case 1:return e=n.sent().IdentityId,this._identityId=e,[2,St({client:o,identityId:e})()]}}))}))}().catch((function(e){return $i(a,void 0,void 0,(function(){return Qi(this,(function(t){throw e}))}))})),[2,this._loadCredentials(s,"guest",!1,null).then((function(e){return e})).catch((function(e){return $i(a,void 0,void 0,(function(){var n=this;return Qi(this,(function(i){switch(i.label){case 0:return"ResourceNotFoundException"!==e.name||e.message!=="Identity '"+r+"' not found."?[3,2]:(Zi.debug("Failed to load guest credentials"),[4,this._removeGuestIdentityId()]);case 1:return i.sent(),s=function(){return $i(n,void 0,void 0,(function(){var e;return Qi(this,(function(n){switch(n.label){case 0:return[4,o.send(new hr({IdentityPoolId:t}))];case 1:return e=n.sent().IdentityId,this._identityId=e,[2,St({client:o,identityId:e})()]}}))}))}().catch((function(e){return $i(n,void 0,void 0,(function(){return Qi(this,(function(t){throw e}))}))})),[2,this._loadCredentials(s,"guest",!1,null)];case 2:return[2,e]}}))}))}))]}}))}))},e.prototype._setCredentialsFromFederation=function(e){var t=e.provider,n=e.token,r=e.identity_id,i={google:"accounts.google.com",facebook:"graph.facebook.com",amazon:"www.amazon.com",developer:"cognito-identity.amazonaws.com"}[t]||t;if(!i)return Promise.reject("You must specify a federated provider");var o={};o[i]=n;var s=this._config,a=s.identityPoolId,u=s.region;if(!a)return Zi.debug("No Cognito Federated Identity pool provided"),Promise.reject("No Cognito Federated Identity pool provided");if(!u)return Zi.debug("region is not configured for getting the credentials"),Promise.reject("region is not configured for getting the credentials");var c=Yi({region:u}),l=void 0;r?l=St({identityId:r,logins:o,client:c})():l=Ot({logins:o,identityPoolId:a,client:c})();return this._loadCredentials(l,"federated",!0,e)},e.prototype._setCredentialsFromSession=function(e){var t=this;Zi.debug("set credentials from session");var n=e.getIdToken().getJwtToken(),r=this._config,i=r.region,o=r.userPoolId,s=r.identityPoolId;if(!s)return Zi.debug("No Cognito Federated Identity pool provided"),Promise.reject("No Cognito Federated Identity pool provided");if(!i)return Zi.debug("region is not configured for getting the credentials"),Promise.reject("region is not configured for getting the credentials");var a={};a["cognito-idp."+i+".amazonaws.com/"+o]=n;var u=Yi({region:i}),c=$i(t,void 0,void 0,(function(){var e,t,n,r,i,o,c,l,f,d;return Qi(this,(function(h){switch(h.label){case 0:return[4,this._getGuestIdentityId()];case 1:return(e=h.sent())?[3,3]:[4,u.send(new hr({IdentityPoolId:s,Logins:a}))];case 2:n=h.sent().IdentityId,t=n,h.label=3;case 3:return[4,u.send(new pr({IdentityId:e||t,Logins:a}))];case 4:return r=h.sent(),i=r.Credentials,o=i.AccessKeyId,c=i.Expiration,l=i.SecretKey,f=i.SessionToken,d=r.IdentityId,this._identityId=d,e?(Zi.debug("The guest identity "+e+" has been successfully linked to the logins"),e===d&&Zi.debug("The guest identity "+e+" has become the primary identity"),[4,this._removeGuestIdentityId()]):[3,6];case 5:h.sent(),h.label=6;case 6:return[2,{accessKeyId:o,secretAccessKey:l,sessionToken:f,expiration:c,identityId:d}]}}))})).catch((function(e){return $i(t,void 0,void 0,(function(){return Qi(this,(function(t){throw e}))}))}));return this._loadCredentials(c,"userPool",!0,null)},e.prototype._loadCredentials=function(e,t,n,r){var i=this,o=this;return new Promise((function(s,a){e.then((function(e){return $i(i,void 0,void 0,(function(){var i,a,u,c,l;return Qi(this,(function(f){switch(f.label){case 0:if(Zi.debug("Load credentials successfully",e),this._identityId&&!e.identityId&&(e.identityId=this._identityId),o._credentials=e,o._credentials.authenticated=n,o._credentials_source=t,o._nextCredentialsRefresh=(new Date).getTime()+3e6,"federated"===t){i=Object.assign({id:this._credentials.identityId},r.user),a=r.provider,u=r.token,c=r.expires_at,l=r.identity_id;try{this._storage.setItem("aws-amplify-federatedInfo",JSON.stringify({provider:a,token:u,user:i,expires_at:c,identity_id:l}))}catch(e){Zi.debug("Failed to put federated info into auth storage",e)}}return"guest"!==t?[3,2]:[4,this._setGuestIdentityId(e.identityId)];case 1:f.sent(),f.label=2;case 2:return s(o._credentials),[2]}}))}))})).catch((function(t){if(t)return Zi.debug("Failed to load credentials",e),Zi.debug("Error loading credentials",t),void a(t)}))}))},e.prototype.set=function(e,t){return"session"===t?this._setCredentialsFromSession(e):"federation"===t?this._setCredentialsFromFederation(e):"guest"===t?this._setCredentialsForGuest():(Zi.debug("no source specified for setting credentials"),Promise.reject("invalid source"))},e.prototype.clear=function(){return $i(this,void 0,void 0,(function(){return Qi(this,(function(e){return this._credentials=null,this._credentials_source=null,Zi.debug("removing aws-amplify-federatedInfo from storage"),this._storage.removeItem("aws-amplify-federatedInfo"),[2]}))}))},e.prototype._getGuestIdentityId=function(){return $i(this,void 0,void 0,(function(){var e,t;return Qi(this,(function(n){switch(n.label){case 0:e=this._config.identityPoolId,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._storageSync];case 2:return n.sent(),[2,this._storage.getItem(this._getCognitoIdentityIdStorageKey(e))];case 3:return t=n.sent(),Zi.debug("Failed to get the cached guest identityId",t),[3,4];case 4:return[2]}}))}))},e.prototype._setGuestIdentityId=function(e){return $i(this,void 0,void 0,(function(){var t,n;return Qi(this,(function(r){switch(r.label){case 0:t=this._config.identityPoolId,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._storageSync];case 2:return r.sent(),this._storage.setItem(this._getCognitoIdentityIdStorageKey(t),e),[3,4];case 3:return n=r.sent(),Zi.debug("Failed to cache guest identityId",n),[3,4];case 4:return[2]}}))}))},e.prototype._removeGuestIdentityId=function(){return $i(this,void 0,void 0,(function(){var e;return Qi(this,(function(t){return e=this._config.identityPoolId,Zi.debug("removing "+this._getCognitoIdentityIdStorageKey(e)+" from storage"),this._storage.removeItem(this._getCognitoIdentityIdStorageKey(e)),[2]}))}))},e.prototype.shear=function(e){return{accessKeyId:e.accessKeyId,sessionToken:e.sessionToken,secretAccessKey:e.secretAccessKey,identityId:e.identityId,authenticated:e.authenticated}},e}())(null);b.a.register(Xi)}])}));
65
65
  //# sourceMappingURL=aws-amplify-datastore.min.js.map