UNPKG

@knapsack/app

Version:

Build Design Systems on top of knapsack, by Basalt

2 lines • 81 kB
(window.webpackJsonp=window.webpackJsonp||[]).push([["vendors~App-7KZ9F~propose-change-page-FI1f0~store-XBI5Y~user-page-DUsdt~092158aa"],{"../node_modules/@aws-amplify/auth/lib-esm/index.js":function(e,t,n){var r,o;function isFederatedSignInOptions(e){return e&&!!["provider","customState"].find((function(t){return e.hasOwnProperty(t)}))}function isCognitoHostedOpts(e){return void 0!==e.redirectSignIn}!function(e){e.Cognito="COGNITO",e.Google="Google",e.Facebook="Facebook",e.Amazon="LoginWithAmazon"}(r||(r={})),function(e){e.NoConfig="noConfig",e.MissingAuthConfig="missingAuthConfig",e.EmptyUsername="emptyUsername",e.InvalidUsername="invalidUsername",e.EmptyPassword="emptyPassword",e.EmptyCode="emptyCode",e.SignUpError="signUpError",e.NoMFA="noMFA",e.InvalidMFA="invalidMFA",e.EmptyChallengeResponse="emptyChallengeResponse",e.NoUserSession="noUserSession",e.Default="default"}(o||(o={}));var i,s,a=n("../node_modules/@aws-amplify/core/lib-esm/index.js"),u=n("../node_modules/amazon-cognito-identity-js/es/index.js"),c=n("../node_modules/url/url.js"),launchUri=function(e){var t=window.open(e,"_self");return t?Promise.resolve(t):Promise.reject()},__assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},__awaiter=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?o(e.value):function adopt(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())}))},__generator=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function verb(i){return function(a){return function step(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},l=n("../node_modules/crypto-js/sha256.js"),d=n("../node_modules/crypto-js/enc-base64.js"),f="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",dispatchAuthEvent=function(e,t,n){a.f.dispatch("auth",{event:e,data:t,message:n},"Auth",f)},g=new a.c("OAuth"),h=function(){function OAuth(e){var t=e.config,n=e.cognitoClientId,r=e.scopes,o=void 0===r?[]:r;this._urlOpener=t.urlOpener||launchUri,this._config=t,this._cognitoClientId=n,this._scopes=o}return OAuth.prototype.oauthSignIn=function(e,t,n,o,i,s){void 0===e&&(e="code"),void 0===i&&(i=r.Cognito);var a=this._generateState(32),u=s?a+"-"+s:a;!function(e){window.sessionStorage.setItem("oauth_state",e)}(encodeURIComponent(u));var c,l=this._generateRandom(128);c=l,window.sessionStorage.setItem("ouath_pkce_key",c);var d=this._generateChallenge(l),f="https://"+t+"/oauth2/authorize?"+Object.entries(__assign(__assign({redirect_uri:n,response_type:e,client_id:o,identity_provider:i,scopes:this._scopes,state:u},"code"===e?{code_challenge:d}:{}),"code"===e?{code_challenge_method:"S256"}:{})).map((function(e){var t=e[0],n=e[1];return encodeURIComponent(t)+"="+encodeURIComponent(n)})).join("&");g.debug("Redirecting to "+f),this._urlOpener(f,n)},OAuth.prototype._handleCodeFlow=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,u,l,d,f,h;return __generator(this,(function(p){switch(p.label){case 0:return(t=(Object(c.parse)(e).query||"").split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n,r=t[0],o=t[1];return __assign(__assign({},e),((n={})[r]=o,n))}),{code:void 0}).code)?(n="https://"+this._config.domain+"/oauth2/token",dispatchAuthEvent("codeFlow",{},"Retrieving tokens from "+n),r=isCognitoHostedOpts(this._config)?this._cognitoClientId:this._config.clientID,o=isCognitoHostedOpts(this._config)?this._config.redirectSignIn:this._config.redirectUri,y=window.sessionStorage.getItem("ouath_pkce_key"),window.sessionStorage.removeItem("ouath_pkce_key"),s=__assign({grant_type:"authorization_code",code:t,client_id:r,redirect_uri:o},(i=y)?{code_verifier:i}:{}),g.debug("Calling token endpoint: "+n+" with",s),a=Object.entries(s).map((function(e){var t=e[0],n=e[1];return encodeURIComponent(t)+"="+encodeURIComponent(n)})).join("&"),[4,fetch(n,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:a})]):[2];case 1:return[4,p.sent().json()];case 2:if(u=p.sent(),l=u.access_token,d=u.refresh_token,f=u.id_token,h=u.error)throw new Error(h);return[2,{accessToken:l,refreshToken:d,idToken:f}]}var y}))}))},OAuth.prototype._handleImplicitFlow=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,r;return __generator(this,(function(o){return t=Object(c.parse)(e).hash.substr(1).split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n,r=t[0],o=t[1];return __assign(__assign({},e),((n={})[r]=o,n))}),{id_token:void 0,access_token:void 0}),n=t.id_token,r=t.access_token,dispatchAuthEvent("implicitFlow",{},"Got tokens from "+e),g.debug("Retrieving implicit tokens from "+e+" with"),[2,{accessToken:r,idToken:n,refreshToken:null}]}))}))},OAuth.prototype.handleAuthResponse=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,r,o,i,s,a;return __generator(this,(function(u){switch(u.label){case 0:if(u.trys.push([0,5,,6]),t=e?__assign(__assign({},(Object(c.parse)(e).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n=t[0],r=t[1];return e[n]=r,e}),{})),(Object(c.parse)(e).query||"").split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var n=t[0],r=t[1];return e[n]=r,e}),{})):{},n=t.error,r=t.error_description,n)throw new Error(r);return o=this._validateState(t),g.debug("Starting "+this._config.responseType+" flow with "+e),"code"!==this._config.responseType?[3,2]:(i=[{}],[4,this._handleCodeFlow(e)]);case 1:return[2,__assign.apply(void 0,[__assign.apply(void 0,i.concat([u.sent()])),{state:o}])];case 2:return s=[{}],[4,this._handleImplicitFlow(e)];case 3:return[2,__assign.apply(void 0,[__assign.apply(void 0,s.concat([u.sent()])),{state:o}])];case 4:return[3,6];case 5:return a=u.sent(),g.error("Error handling auth response.",a),[3,6];case 6:return[2]}}))}))},OAuth.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}},OAuth.prototype.signOut=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(r){return e="https://"+this._config.domain+"/logout?",t=isCognitoHostedOpts(this._config)?this._cognitoClientId:this._config.oauth.clientID,n=isCognitoHostedOpts(this._config)?this._config.redirectSignOut:this._config.returnTo,e+=Object.entries({client_id:t,logout_uri:encodeURIComponent(n)}).map((function(e){return e[0]+"="+e[1]})).join("&"),dispatchAuthEvent("oAuthSignOut",{oAuth:"signOut"},"Signing out from "+e),g.debug("Signing out from "+e),[2,this._urlOpener(e)]}))}))},OAuth.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},OAuth.prototype._generateChallenge=function(e){return this._base64URL(l(e))},OAuth.prototype._base64URL=function(e){return e.toString(d).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},OAuth.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)},OAuth.prototype._bufferToString=function(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=[],r=0;r<e.byteLength;r+=1){var o=e[r]%t.length;n.push(t[o])}return n.join("")},OAuth}(),p=(i=function(e,t){return(i=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 __(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),y=new a.c("AuthError"),m=function(e){function AuthError(t){var n=this,r=v[t],o=r.message,i=r.log;return(n=e.call(this,o)||this).constructor=AuthError,Object.setPrototypeOf(n,AuthError.prototype),n.name="AuthError",n.log=i||o,y.error(n.log),n}return p(AuthError,e),AuthError}(Error),b=function(e){function NoUserPoolError(t){var n=e.call(this,t)||this;return n.constructor=NoUserPoolError,Object.setPrototypeOf(n,NoUserPoolError.prototype),n.name="NoUserPoolError",n}return p(NoUserPoolError,e),NoUserPoolError}(m),v={noConfig:{message:"Authentication Error",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 aws-amplify or amplify packages in your node_modules.\n                Try deleting your node_modules folder and reinstalling the dependencies with `yarn install`\n        "},missingAuthConfig:{message:"Authentication Error",log:"\n            Error: Amplify has not been configured correctly. \n            The configuration object is missing required auth properties. \n            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        "},emptyUsername:{message:"Username cannot be empty"},invalidUsername:{message:"The username should either be a string or one of the sign in types"},emptyPassword:{message:"Password cannot be empty"},emptyCode:{message:"Confirmation code cannot be empty"},signUpError:{message:"Error creating account",log:"The first parameter should either be non-null string or object"},noMFA:{message:"No valid MFA method provided"},invalidMFA:{message:"Invalid MFA type"},emptyChallengeResponse:{message:"Challenge response cannot be empty"},noUserSession:{message:"Failed to get the session because the user is empty"},default:{message:"Authentication Error"}},Auth_awaiter=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?o(e.value):function adopt(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())}))},Auth_generator=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function verb(i){return function(a){return function step(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},w=new a.c("AuthClass"),_="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default",Auth_dispatchAuthEvent=function(e,t,n){a.f.dispatch("auth",{event:e,data:t,message:n},"Auth",_)};!function(e){e.Cognito="COGNITO",e.Google="Google",e.Facebook="Facebook",e.Amazon="LoginWithAmazon"}(s||(s={}));var A=function(){function AuthClass(e){var t=this;this.userPool=null,this.user=null,this.configure(e),this.currentUserCredentials=this.currentUserCredentials.bind(this),a.a.config?a.a.config.update({customUserAgent:a.d.userAgent}):w.warn("No AWS.config"),a.f.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 AuthClass.prototype.getModuleName=function(){return"Auth"},AuthClass.prototype.configure=function(e){var t=this;if(!e)return this._config||{};w.debug("configure Auth");var n=Object.assign({},this._config,a.j.parseMobilehubConfig(e).Auth,e);this._config=n;var r=this._config,o=r.userPoolId,i=r.userPoolWebClientId,s=r.cookieStorage,c=r.oauth,l=r.region,d=r.identityPoolId,f=r.mandatorySignIn,g=r.refreshHandlers,p=r.identityPoolRegion,y=r.clientMetadata;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=s?new u.i(s):(new a.n).getStorage();if(this._storageSync=Promise.resolve(),"function"==typeof this._storage.sync&&(this._storageSync=this._storage.sync()),o){var m={UserPoolId:o,ClientId:i};m.Storage=this._storage,this.userPool=new u.g(m)}a.e.configure({mandatorySignIn:f,region:p||l,userPoolId:o,identityPoolId:d,refreshHandlers:g,storage:this._storage});var b=c?isCognitoHostedOpts(this._config.oauth)?c:c.awsCognito:void 0;if(b){var v=Object.assign({cognitoClientId:i,UserPoolId:o,domain:b.domain,scopes:b.scope,redirectSignIn:b.redirectSignIn,redirectSignOut:b.redirectSignOut,responseType:b.responseType,Storage:this._storage,urlOpener:b.urlOpener,clientMetadata:y},b.options);this._oAuthHandler=new h({scopes:v.scopes,config:v,cognitoClientId:v.cognitoClientId}),function(e){if(a.h.browserOrNode().isBrowser&&window.location)e({url:window.location.href});else if(!a.h.browserOrNode().isNode)throw new Error("Not supported")}((function(e){var n=e.url;t._handleAuthResponse(n)}))}return Auth_dispatchAuthEvent("configured",null,"The Auth category has been configured successfully"),this._config},AuthClass.prototype.signUp=function(e){for(var t=this,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];if(!this.userPool)return this.rejectNoUserPool();var i,s=null,a=null,u=[],c=null;if(e&&"string"==typeof e){s=e,a=n?n[0]:null;var l=n?n[1]:null,d=n?n[2]:null;l&&u.push({Name:"email",Value:l}),d&&u.push({Name:"phone_number",Value:d})}else{if(!e||"object"!=typeof e)return this.rejectAuthError(o.SignUpError);s=e.username,a=e.password,e&&e.clientMetadata?i=e.clientMetadata:this._config.clientMetadata&&(i=this._config.clientMetadata);var f=e.attributes;f&&Object.keys(f).map((function(e){var t={Name:e,Value:f[e]};u.push(t)})),c=e.validationData||null}return s?a?(w.debug("signUp attrs:",u),w.debug("signUp validation data:",c),new Promise((function(e,n){t.userPool.signUp(s,a,u,c,(function(t,r){t?(Auth_dispatchAuthEvent("signUp_failure",t,s+" failed to signup"),n(t)):(Auth_dispatchAuthEvent("signUp",r,s+" has signed up successfully"),e(r))}),i)}))):this.rejectAuthError(o.EmptyPassword):this.rejectAuthError(o.EmptyUsername)},AuthClass.prototype.confirmSignUp=function(e,t,n){if(!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(o.EmptyUsername);if(!t)return this.rejectAuthError(o.EmptyCode);var r,i=this.createCognitoUser(e),s=!n||"boolean"!=typeof n.forceAliasCreation||n.forceAliasCreation;return n&&n.clientMetadata?r=n.clientMetadata:this._config.clientMetadata&&(r=this._config.clientMetadata),new Promise((function(e,n){i.confirmRegistration(t,s,(function(t,r){t?n(t):e(r)}),r)}))},AuthClass.prototype.resendSignUp=function(e,t){if(void 0===t&&(t=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(o.EmptyUsername);var n=this.createCognitoUser(e);return new Promise((function(e,r){n.resendConfirmationCode((function(t,n){t?r(t):e(n)}),t)}))},AuthClass.prototype.signIn=function(e,t,n){if(void 0===n&&(n=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();var r=null,i=null,s={};if("string"==typeof e)r=e,i=t;else{if(!function isUsernamePasswordOpts(e){return!!e.username}(e))return this.rejectAuthError(o.InvalidUsername);void 0!==t&&w.warn("The password should be defined under the first parameter object!"),r=e.username,i=e.password,s=e.validationData}if(!r)return this.rejectAuthError(o.EmptyUsername);var a=new u.a({Username:r,Password:i,ValidationData:s,ClientMetadata:n});return i?this.signInWithPassword(a):this.signInWithoutPassword(a)},AuthClass.prototype.authCallbacks=function(e,t,n){var r=this,o=this;return{onSuccess:function(i){return Auth_awaiter(r,void 0,void 0,(function(){var r,s,u,c;return Auth_generator(this,(function(l){switch(l.label){case 0:w.debug(i),delete e.challengeName,delete e.challengeParam,l.label=1;case 1:return l.trys.push([1,4,5,9]),[4,a.e.clear()];case 2:return l.sent(),[4,a.e.set(i,"session")];case 3:return r=l.sent(),w.debug("succeed to get cognito credentials",r),[3,9];case 4:return s=l.sent(),w.debug("cannot get cognito credentials",s),[3,9];case 5:return l.trys.push([5,7,,8]),[4,this.currentUserPoolUser()];case 6:return u=l.sent(),o.user=u,Auth_dispatchAuthEvent("signIn",u,"A user "+e.getUsername()+" has been signed in"),t(u),[3,8];case 7:return c=l.sent(),w.error("Failed to get the signed in user",c),n(c),[3,8];case 8:return[7];case 9:return[2]}}))}))},onFailure:function(t){w.debug("signIn failure",t),Auth_dispatchAuthEvent("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)}}},AuthClass.prototype.signInWithPassword=function(e){var t=this,n=this.createCognitoUser(e.getUsername());return new Promise((function(r,o){n.authenticateUser(e,t.authCallbacks(n,r,o))}))},AuthClass.prototype.signInWithoutPassword=function(e){var t=this,n=this.createCognitoUser(e.getUsername());return n.setAuthenticationFlowType("CUSTOM_AUTH"),new Promise((function(r,o){n.initiateAuth(e,t.authCallbacks(n,r,o))}))},AuthClass.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)}))}))},AuthClass.prototype.getPreferredMFA=function(e,t){var n=this;return new Promise((function(r,o){var i=!!t&&t.bypassCache;e.getUserData((function(e,t){if(e)return w.debug("getting preferred mfa failed",e),void o(e);var i=n._getMfaTypeFromUserData(t);return i?void r(i):void o("invalid MFA Type")}),{bypassCache:i})}))},AuthClass.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},AuthClass.prototype._getUserData=function(e,t){return new Promise((function(n,r){e.getUserData((function(e,t){return e?(w.debug("getting user data failed",e),void r(e)):void n(t)}),t)}))},AuthClass.prototype.setPreferredMFA=function(e,t){return Auth_awaiter(this,void 0,void 0,(function(){var n,r,i,s,a;return Auth_generator(this,(function(u){switch(u.label){case 0:return[4,this._getUserData(e,{bypassCache:!0})];case 1:switch(n=u.sent(),r=null,i=null,t){case"TOTP":return[3,2];case"SMS":return[3,3];case"NOMFA":return[3,4]}return[3,6];case 2:return i={PreferredMfa:!0,Enabled:!0},[3,7];case 3:return r={PreferredMfa:!0,Enabled:!0},[3,7];case 4:return s=n.UserMFASettingList,[4,this._getMfaTypeFromUserData(n)];case 5:if("NOMFA"===(a=u.sent()))return[2,Promise.resolve("No change for mfa type")];if("SMS_MFA"===a)r={PreferredMfa:!1,Enabled:!1};else{if("SOFTWARE_TOKEN_MFA"!==a)return[2,this.rejectAuthError(o.InvalidMFA)];i={PreferredMfa:!1,Enabled:!1}}return s&&0!==s.length&&s.forEach((function(e){"SMS_MFA"===e?r={PreferredMfa:!1,Enabled:!1}:"SOFTWARE_TOKEN_MFA"===e&&(i={PreferredMfa:!1,Enabled:!1})})),[3,7];case 6:return w.debug("no validmfa method provided"),[2,this.rejectAuthError(o.NoMFA)];case 7:return this,[2,new Promise((function(t,n){e.setUserMfaPreference(r,i,(function(r,o){if(r)return w.debug("Set user mfa preference error",r),n(r);w.debug("Set user mfa success",o),w.debug("Caching the latest user data into local"),e.getUserData((function(e,r){return e?(w.debug("getting user data failed",e),n(e)):t(o)}),{bypassCache:!0})}))}))]}}))}))},AuthClass.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)}))}))},AuthClass.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)}))}))},AuthClass.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)}})}))},AuthClass.prototype.verifyTotpToken=function(e,t){return w.debug("verfication 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(e){w.debug("verifyTotpToken success",e),n(e)}})}))},AuthClass.prototype.confirmSignIn=function(e,t,n,r){var i=this;if(void 0===r&&(r=this._config.clientMetadata),!t)return this.rejectAuthError(o.EmptyCode);var s=this;return new Promise((function(o,u){e.sendMFACode(t,{onSuccess:function(t){return Auth_awaiter(i,void 0,void 0,(function(){var n,r;return Auth_generator(this,(function(i){switch(i.label){case 0:w.debug(t),i.label=1;case 1:return i.trys.push([1,4,5,6]),[4,a.e.clear()];case 2:return i.sent(),[4,a.e.set(t,"session")];case 3:return n=i.sent(),w.debug("succeed to get cognito credentials",n),[3,6];case 4:return r=i.sent(),w.debug("cannot get cognito credentials",r),[3,6];case 5:return s.user=e,Auth_dispatchAuthEvent("signIn",e,e+" has signed in"),o(e),[7];case 6:return[2]}}))}))},onFailure:function(e){w.debug("confirm signIn failure",e),u(e)}},n,r)}))},AuthClass.prototype.completeNewPassword=function(e,t,n,r){var i=this;if(void 0===r&&(r=this._config.clientMetadata),!t)return this.rejectAuthError(o.EmptyPassword);var s=this;return new Promise((function(o,u){e.completeNewPasswordChallenge(t,n,{onSuccess:function(t){return Auth_awaiter(i,void 0,void 0,(function(){var n,r;return Auth_generator(this,(function(i){switch(i.label){case 0:w.debug(t),i.label=1;case 1:return i.trys.push([1,4,5,6]),[4,a.e.clear()];case 2:return i.sent(),[4,a.e.set(t,"session")];case 3:return n=i.sent(),w.debug("succeed to get cognito credentials",n),[3,6];case 4:return r=i.sent(),w.debug("cannot get cognito credentials",r),[3,6];case 5:return s.user=e,Auth_dispatchAuthEvent("signIn",e,e+" has signed in"),o(e),[7];case 6:return[2]}}))}))},onFailure:function(e){w.debug("completeNewPassword failure",e),Auth_dispatchAuthEvent("completeNewPassword_failure",e,i.user+" failed to complete the new password flow"),u(e)},mfaRequired:function(t,n){w.debug("signIn MFA required"),e.challengeName=t,e.challengeParam=n,o(e)},mfaSetup:function(t,n){w.debug("signIn mfa setup",t),e.challengeName=t,e.challengeParam=n,o(e)}},r)}))},AuthClass.prototype.sendCustomChallengeAnswer=function(e,t,n){var r=this;if(void 0===n&&(n=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!t)return this.rejectAuthError(o.EmptyChallengeResponse);return new Promise((function(o,i){e.sendCustomChallengeAnswer(t,r.authCallbacks(e,o,i),n)}))},AuthClass.prototype.updateUserAttributes=function(e,t,n){void 0===n&&(n=this._config.clientMetadata);var r=[],o=this;return new Promise((function(i,s){o.userSession(e).then((function(o){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):i(t)}),n)}))}))},AuthClass.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)}))}))}))},AuthClass.prototype.verifiedContact=function(e){var t=this;return this.userAttributes(e).then((function(e){var n=t.attributesToObject(e),r={},o={};return n.email&&(n.email_verified?o.email=n.email:r.email=n.email),n.phone_number&&(n.phone_number_verified?o.phone_number=n.phone_number:r.phone_number=n.phone_number),{verified:o,unverified:r}}))},AuthClass.prototype.currentUserPoolUser=function(e){var t=this;if(!this.userPool)return this.rejectNoUserPool();var n=this;return new Promise((function(r,o){t._storageSync.then((function(){var t=n.userPool.getCurrentUser();if(!t)return w.debug("Failed to get user from user pool"),void o("No current user");t.getSession((function(i,s){if(i)return w.debug("Failed to get the user session",i),void o(i);var a=!!e&&e.bypassCache,c=s.getAccessToken().decodePayload().scope;if(!(void 0===c?"":c).split(" ").includes("aws.cognito.signin.user.admin"))return w.debug("Unable to get the user data because the aws.cognito.signin.user.admin is not in the scopes of the access token"),r(t);t.getUserData((function(e,i){if(e)return w.debug("getting user data failed",e),void("User is disabled"===e.message||"User does not exist."===e.message?o(e):r(t));for(var s=i.PreferredMfaSetting||"NOMFA",a=[],c=0;c<i.UserAttributes.length;c++){var l={Name:i.UserAttributes[c].Name,Value:i.UserAttributes[c].Value},d=new u.f(l);a.push(d)}var f=n.attributesToObject(a);return Object.assign(t,{attributes:f,preferredMFA:s}),r(t)}),{bypassCache:a})}))})).catch((function(e){return w.debug("Failed to sync cache info into memory",e),o(e)}))}))},AuthClass.prototype.currentAuthenticatedUser=function(e){return Auth_awaiter(this,void 0,void 0,(function(){var t,n,r,o;return Auth_generator(this,(function(i){switch(i.label){case 0:w.debug("getting current authenticated user"),t=null,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._storageSync];case 2:return i.sent(),[3,4];case 3:throw n=i.sent(),w.debug("Failed to sync cache info into memory",n),n;case 4:try{t=JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")).user}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"),r=null,i.label=6;case 6:return i.trys.push([6,8,,9]),[4,this.currentUserPoolUser(e)];case 7:return r=i.sent(),[3,9];case 8:throw"No userPool"===(o=i.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),"not authenticated";case 9:return this.user=r,[2,this.user]}}))}))},AuthClass.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()},AuthClass.prototype.userSession=function(e){return e?new Promise((function(t,n){w.debug("Getting the session from this user:",e),e.getSession((function(r,o){return r?(w.debug("Failed to get the session from user",e),void n(r)):(w.debug("Succeed to get the user session",o),void t(o))}))})):(w.debug("the user is null"),this.rejectAuthError(o.NoUserSession))},AuthClass.prototype.currentUserCredentials=function(){return Auth_awaiter(this,void 0,void 0,(function(){var e,t;return Auth_generator(this,(function(n){switch(n.label){case 0:this,w.debug("Getting current user credentials"),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._storageSync];case 2:return n.sent(),[3,4];case 3:throw e=n.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,a.e.refreshFederatedToken(t)]:[2,this.currentSession().then((function(e){return w.debug("getting session success",e),a.e.set(e,"session")})).catch((function(e){return w.debug("getting session failed",e),a.e.set(null,"guest")}))]}}))}))},AuthClass.prototype.currentCredentials=function(){return w.debug("getting current credntials"),a.e.get()},AuthClass.prototype.verifyUserAttribute=function(e,t,n){return void 0===n&&(n=this._config.clientMetadata),new Promise((function(r,o){e.getAttributeVerificationCode(t,{onSuccess:function(){return r()},onFailure:function(e){return o(e)},clientMetadata:n})}))},AuthClass.prototype.verifyUserAttributeSubmit=function(e,t,n){return n?new Promise((function(r,o){e.verifyAttribute(t,n,{onSuccess:function(e){r(e)},onFailure:function(e){o(e)}})})):this.rejectAuthError(o.EmptyCode)},AuthClass.prototype.verifyCurrentUserAttribute=function(e){var t=this;return t.currentUserPoolUser().then((function(n){return t.verifyUserAttribute(n,e)}))},AuthClass.prototype.verifyCurrentUserAttributeSubmit=function(e,t){var n=this;return n.currentUserPoolUser().then((function(r){return n.verifyUserAttributeSubmit(r,e,t)}))},AuthClass.prototype.cognitoIdentitySignOut=function(e,t){return Auth_awaiter(this,void 0,void 0,(function(){var n,r,o=this;return Auth_generator(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._storageSync];case 1:return i.sent(),[3,3];case 2:throw n=i.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,i){if(!e||!e.global)return w.debug("user sign out",t),t.signOut(),r?n(o._oAuthHandler.signOut()):n();w.debug("user global sign out",t),t.getSession((function(e,s){if(e)return w.debug("failed to get the user session",e),i(e);t.globalSignOut({onSuccess:function(e){return w.debug("global sign out success"),r?n(o._oAuthHandler.signOut()):n()},onFailure:function(e){return w.debug("global sign out failed",e),i(e)}})}))}))]}}))}))},AuthClass.prototype.signOut=function(e){return Auth_awaiter(this,void 0,void 0,(function(){var t;return Auth_generator(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.cleanCachedItems()];case 1:return n.sent(),[3,3];case 2:return n.sent(),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 Congito User pool"),n.label=8;case 8:return Auth_dispatchAuthEvent("signOut",this.user,"A user has been signed out"),this.user=null,[2]}}))}))},AuthClass.prototype.cleanCachedItems=function(){return Auth_awaiter(this,void 0,void 0,(function(){return Auth_generator(this,(function(e){switch(e.label){case 0:return[4,a.e.clear()];case 1:return e.sent(),[2]}}))}))},AuthClass.prototype.changePassword=function(e,t,n,r){var o=this;return void 0===r&&(r=this._config.clientMetadata),new Promise((function(i,s){o.userSession(e).then((function(o){e.changePassword(t,n,(function(e,t){return e?(w.debug("change password failure",e),s(e)):i(t)}),r)}))}))},AuthClass.prototype.forgotPassword=function(e,t){if(void 0===t&&(t=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(o.EmptyUsername);var n=this.createCognitoUser(e);return new Promise((function(r,o){n.forgotPassword({onSuccess:function(){r()},onFailure:function(t){w.debug("forgot password failure",t),Auth_dispatchAuthEvent("forgotPassword_failure",t,e+" forgotPassword failed"),o(t)},inputVerificationCode:function(t){Auth_dispatchAuthEvent("forgotPassword",n,e+" has initiated forgot password flow"),r(t)}},t)}))},AuthClass.prototype.forgotPasswordSubmit=function(e,t,n,r){if(void 0===r&&(r=this._config.clientMetadata),!this.userPool)return this.rejectNoUserPool();if(!e)return this.rejectAuthError(o.EmptyUsername);if(!t)return this.rejectAuthError(o.EmptyCode);if(!n)return this.rejectAuthError(o.EmptyPassword);var i=this.createCognitoUser(e);return new Promise((function(o,s){i.confirmPassword(t,n,{onSuccess:function(){Auth_dispatchAuthEvent("forgotPasswordSubmit",i,e+" forgotPasswordSubmit successful"),o()},onFailure:function(t){Auth_dispatchAuthEvent("forgotPasswordSubmit_failure",t,e+" forgotPasswordSubmit failed"),s(t)}},r)}))},AuthClass.prototype.currentUserInfo=function(){return Auth_awaiter(this,void 0,void 0,(function(){var e,t,n,r,o,i,s;return Auth_generator(this,(function(u){switch(u.label){case 0:return(e=a.e.getCredSource())&&"aws"!==e&&"userPool"!==e?[3,9]:[4,this.currentUserPoolUser().catch((function(e){return w.debug(e)}))];case 1:if(!(s=u.sent()))return[2,null];u.label=2;case 2:return u.trys.push([2,8,,9]),[4,this.userAttributes(s)];case 3:t=u.sent(),n=this.attributesToObject(t),r=null,u.label=4;case 4:return u.trys.push([4,6,,7]),[4,this.currentCredentials()];case 5:return r=u.sent(),[3,7];case 6:return o=u.sent(),w.debug("Failed to retrieve credentials while getting current user info",o),[3,7];case 7:return[2,{id:r?r.identityId:void 0,username:s.getUsername(),attributes:n}];case 8:return i=u.sent(),w.debug("currentUserInfo error",i),[2,{}];case 9:return"federated"===e?[2,(s=this.user)||{}]:[2]}}))}))},AuthClass.prototype.federatedSignIn=function(e,t,n){return Auth_awaiter(this,void 0,void 0,(function(){var r,o,i,u,c,l,d,f,g,h,p;return Auth_generator(this,(function(y){switch(y.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 isFederatedSignInOptions(e)||function isFederatedSignInOptionsCustom(e){return e&&!!["customProvider","customState"].find((function(t){return e.hasOwnProperty(t)}))}(e)||void 0===e?(r=e||{provider:s.Cognito},c=isFederatedSignInOptions(r)?r.provider:r.customProvider,isFederatedSignInOptions(r),o=r.customState,this._config.userPoolId&&(i=isCognitoHostedOpts(this._config.oauth)?this._config.userPoolWebClientId:this._config.oauth.clientID,u=isCognitoHostedOpts(this._config.oauth)?this._config.oauth.redirectSignIn:this._config.oauth.redirectUri,this._oAuthHandler.oauthSignIn(this._config.oauth.responseType,this._config.oauth.domain,u,i,c,o)),[3,4]):[3,1];case 1:c=e;try{(l=JSON.stringify(JSON.parse(this._storage.getItem("aws-amplify-federatedInfo")).user))&&w.warn("There is already a signed in user: "+l+" in your app.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tYou should not call Auth.federatedSignIn method again as it may cause unexpected behavior.")}catch(e){}return d=t.token,f=t.identity_id,g=t.expires_at,[4,a.e.set({provider:c,token:d,identity_id:f,user:n,expires_at:g},"federation")];case 2:return h=y.sent(),[4,this.currentAuthenticatedUser()];case 3:return p=y.sent(),Auth_dispatchAuthEvent("signIn",p,"A user "+p.username+" has been signed in"),w.debug("federated sign in credentials",h),[2,h];case 4:return[2]}}))}))},AuthClass.prototype._handleAuthResponse=function(e){return Auth_awaiter(this,void 0,void 0,(function(){var t,n,r,o,i,s,l,d,f,g,h,p,y,m,b;return Auth_generator(this,(function(v){switch(v.label){case 0:if(!this._config.userPoolId)throw new Error("OAuth responses require a User Pool defined in config");if(Auth_dispatchAuthEvent("parsingCallbackUrl",{url:e},"The callback url is being parsed"),t=e||(a.h.browserOrNode().isBrowser?window.location.href:""),n=!!(Object(c.parse)(t).query||"").split("&").map((function(e){return e.split("=")})).find((function(e){var t=e[0];return"code"===t||"error"===t})),r=!!(Object(c.parse)(t).hash||"#").substr(1).split("&").map((function(e){return e.split("=")})).find((function(e){var t=e[0];return"access_token"===t||"error"===t})),!n&&!r)return[3,6];v.label=1;case 1:return v.trys.push([1,5,,6]),[4,this._oAuthHandler.handleAuthResponse(t)];case 2:return o=v.sent(),i=o.accessToken,s=o.idToken,l=o.refreshToken,d=o.state,f=new u.h({IdToken:new u.c({IdToken:s}),RefreshToken:new u.d({RefreshToken:l}),AccessToken:new u.b({AccessToken:i})}),g=void 0,this._config.identityPoolId?[4,a.e.set(f,"session")]:[3,4];case 3:g=v.sent(),w.debug("AWS credentials",g),v.label=4;case 4:return h=/-/.test(d),p=this.createCognitoUser(f.getIdToken().decodePayload()["cognito:username"]),Auth_dispatchAuthEvent("signIn",p,"A user "+p.getUsername()+" has been signed in"),Auth_dispatchAuthEvent("cognitoHostedUI",p,"A user "+p.getUsername()+" has been signed in via Cognito Hosted UI"),h&&(y=d.split("-"),m=y[1],Auth_dispatchAuthEvent("customOAuthState",m,"State for user "+p.getUsername())),p.setSignInUserSession(f),window&&void 0!==window.history&&window.history.replaceState({},null,this._config.oauth.redirectSignIn),[2,g];case 5:throw b=v.sent(),w.debug("Error in cognito hosted auth response",b),Auth_dispatchAuthEvent("signIn_failure",b,"The OAuth response flow failed"),Auth_dispatchAuthEvent("cognitoHostedUI_failure",b,"A failure occurred when returning to the Cognito Hosted UI"),Auth_dispatchAuthEvent("customState_failure",b,"A failure occurred when returning state"),b;case 6:return[2]}}))}))},AuthClass.prototype.essentialCredentials=function(e){return{accessKeyId:e.accessKeyId,sessionToken:e.sessionToken,secretAccessKey:e.secretAccessKey,identityId:e.identityId,authenticated:e.authenticated}},AuthClass.prototype.attributesToObject=function(e){var t={};return e&&e.map((function(e){"true"===e.Value?t[e.Name]=!0:"false"===e.Value?t[e.Name]=!1:t[e.Name]=e.Value})),t},AuthClass.prototype.createCognitoUser=function(e){var t={Username:e,Pool:this.userPool};t.Storage=this._storage;var n=this._config.authenticationFlowType,r=new u.e(t);return n&&r.setAuthenticationFlowType(n),r},AuthClass.prototype._isValidAuthStorage=function(e){return!!e&&"function"==typeof e.getItem&&"function"==typeof e.setItem&&"function"==typeof e.removeItem&&"function"==typeof e.clear},AuthClass.prototype.noUserPoolErrorHandler=function(e){return!e||e.userPoolId&&e.identityPoolId?o.NoConfig:o.MissingAuthConfig},AuthClass.prototype.rejectAuthError=function(e){return Promise.reject(new m(e))},AuthClass.prototype.rejectNoUserPool=function(){var e=this.noUserPoolErrorHandler(this._config);return Promise.reject(new b(e))},AuthClass}(),C=new a.c("Auth"),S=null;S||(C.debug("Create Auth Instance"),S=new A(null));var I=S;a.o.register(I);t.a=I},"../node_modules/@aws-amplify/core/lib-esm/JS.js":function(e,t,n){(function(e){var n=[{type:"text/plain",ext:"txt"},{type:"text/html",ext:"html"},{type:"text/javascript",ext:"js"},{type:"text/css",ext:"css"},{type:"text/csv",ext:"csv"},{type:"text/yaml",ext:"yml"},{type:"text/yaml",ext:"yaml"},{type:"text/calendar",ext:"ics"},{type:"text/calendar",ext:"ical"},{type:"image/png",ext:"png"},{type:"image/gif",ext:"gif"},{type:"image/jpeg",ext:"jpg"},{type:"image/jpeg",ext:"jpeg"},{type:"image/bmp",ext:"bmp"},{type:"image/x-icon",ext:"ico"},{type:"image/tiff",ext:"tif"},{type:"image/tiff",ext:"tiff"},{type:"image/svg+xml",ext:"svg"},{type:"application/json",ext:"json"},{type:"application/xml",ext:"xml"},{type:"application/x-sh",ext:"sh"},{type:"application/zip",ext:"zip"},{type:"application/x-rar-compressed",ext:"rar"},{type:"application/x-tar",ext:"tar"},{type:"application/x-bzip",ext:"bz"},{type:"application/x-bzip2",ext:"bz2"},{type:"application/pdf",ext:"pdf"},{type:"application/java-archive",ext:"jar"},{type:"application/msword",ext:"doc"},{type:"application/vnd.ms-excel",ext:"xls"},{type:"application/vnd.ms-excel",ext:"xlsx"},{type:"message/rfc822",ext:"eml"}],r=function(){function JS(){}return JS.isEmpty=function(e){return 0===Object.keys(e).length},JS.sortByField=function(e,t,n){if(!e||!e.sort)return!1;var r=n&&"desc"===n?-1:1;return e.sort((function(e,n){var o=e[t],i=n[t];return void 0===i?void 0===o?0:1*r:void 0===o?-1*r:o<i?-1*r:o>i?1*r:0})),!0},JS.objectLessAttributes=function(e,t){var n=Object.assign({},e);return t&&("string"==typeof t?delete n[t]:t.forEach((function(e){delete n[e]}))),n},JS.filenameToContentType=function(e,t){void 0===t&&(t="application/octet-stream");var r=e.toLowerCase(),o=n.filter((function(e){return r.endsWith("."+e.ext)}));return o.length>0?o[0].type:t},JS.isTextFile=function(e){var t=e.toLowerCase();return!!t.startsWith("text/")||("application/json"===t||"application/xml"===t||"application/sh"===t)},JS.generateRandomString=function(){for(var e="",t="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n=32;n>0;n-=1)e+=t[Math.floor(Math.random()*t.length)];return e},JS.makeQuerablePromise=function(e){if(e.isResolved)return e;var t=!0,n=!1,r=!1,o=e.then((function(e){return r=!0,t=!1,e}),(function(e){throw n=!0,t=!1,e}));return o.isFullfilled=function(){return r},o.isPending=function(){return t},o.isRejected=function(){return n},o},JS.browserOrNode=function(){return{isBrowser:"undefined"!=typeof window&&void 0!==window.document,isNode:void 0!==e&&null!=e.versions&&null!=e.versions.node}},JS.transferKeyToLowerCase=function(e,t,n){if(void 0===t&&(t=[]),void 0===n&&(n=[]),!JS.isStrictObject(e))return e;var r={};for(var o in e){if(e.hasOwnProperty(o))r[t.includes(o)?o:o[0].toLowerCase()+o.slice(1)]=n.includes(o)?e[o]:JS.transferKeyToLowerCase(e[o],t,n)}return r},JS.transferKeyToUpperCase=function(e,t,n){if(void 0===t&&(t=[]),void 0===n&&(n=[]),!JS.isStrictObject(e))return e;var r={};for(var o in e){if(e.hasOwnProperty(o))r[t.includes(o)?o:o[0].toUpperCase()+o.slice(1)]=n.includes(o)?e[o]:JS.transferKeyToUpperCase(e[o],t,n)}return r},JS.isStrictObject=function(e){return!(!(e instanceof Object)||e instanceof Array||e instanceof Function||e instanceof Number||e instanceof String||e instanceof Boolean)},JS}();t.a=r}).call(this,n("../node_modules/process/browser.js"))},"../node_modules/@aws-amplify/core/lib-esm/index.js":function(e,t,n){n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return c})),n.d(t,"c",(function(){return i})),n.d(t,"i",(function(){return i})),n.d(t,"f",(function(){return f})),n.d(t,"g",(function(){return v})),n.d(t,"h",(function(){return w.a})),n.d(t,"m",(function(){return S})),n.d(t,"j",(function(){return P})),n.d(t,"e",(function(){return H})),n.d(t,"l",(function(){return D})),n.d(t,"n",(function(){return R})),n.d(t,"k",(function(){return J})),n.d(t,"d",(function(){return V}));var r=n("../node_modules/aws-sdk/browser.js"),__spreadArrays=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],s=0,a=i.length;s<a;s++,o++)r[o]=i[s];return r},o={VERBOSE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5},i=function(){function ConsoleLogger(e,t){void 0===t&&(t="WARN"),this.name=e,this.level=t}return ConsoleLogger.prototype._padding=function(e){return e<10?"0"+e:""+e},ConsoleLogger.prototype._ts=function(){var e=new Date;return[this._padding(e.getMinutes()),this._padding(e.getSeconds())].join(":")+"."+e.getMilliseconds()},ConsoleLogger.prototype._log=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=this.level;ConsoleLogger.LOG_LEVEL&&(r=ConsoleLogger.LOG_LEVEL),"undefined"!=typeof window&&window.LOG_LEVEL&&(r=window.LOG_LEVEL);var i=o[r],s=o[e];if(s>=i){var a=console.log.bind(console);"ERROR"===e&&console.error&&(a=console.error.bind(console)),"WARN"===e&&console.warn&&(a=console.warn.bind(console));var u="["+e+"] "+this._ts()+" "+this.name;if(1===t.length&&"string"==typeof t[0])a(u+" - "+t[0]);else if(1===t.length)a(u,t[0]);else if("string"==typeof t[0]){var c=t.slice(1);1===c.length&&(c=c[0]),a(u+" - "+t[0],c)}else a(u,t)}},ConsoleLogger.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,__spreadArrays(["INFO"],e))},ConsoleLogger.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,__spreadArrays(["INFO"],e))},ConsoleLogger.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,__spreadArrays(["WARN"],e))},ConsoleLogger.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,__spreadArrays(["ERROR"],e))},ConsoleLogger.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,__spreadArrays(["DEBUG"],e))},ConsoleLogger.prototype.verbose=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._log.apply(this,__spreadArrays(["VERBOSE"],e))},ConsoleLogger.LOG_LEVEL=null,ConsoleLogger}(),s=new i("Amplify"),a=function(){function Amplify(){}return Amplify.register=function(e){s.debug("component registered in amplify",e),this._components.push(e),"function"==typeof e.getModuleName?Amplify[e.getModuleName()]=e:s.debug("no getModuleName method for component",e)},Amplify.configure=function(e){var t=this;return e?(this._config=Object.assign(this._config,e),s.debug("amplify config",this._config),this._components.map((function(e){e.configure(t._config)})),this._config):this._config},Amplify.addPluggable=function(e){e&&e.getCategory&&"function"==typeof e.getCategory&&this._components.map((function(t){t.addPluggable&&"function"==typeof t.addPluggable&&t.addPluggable(e)}))},Amplify._components=[],Amplify._config={},Amplify.Auth=null,Amplify.Analytics=null,Amplify.API=null,Amplify.Storage=null,Amplify.I18n=null,Amplify.Cache=null,Amplify.PubSub=null,Amplify.Interactions=null,Amplify.Pushnotification=null,Amplify.UI=null,Amplify.XR=null,Amplify.Predictions=null,Amplify.Logger=i,Amplify.ServiceWorker=null,Amplify}(),u=new i("ClientDevice_Browser");function clientInfo(){return"undefined"==typeof window?{}:function browserClientInfo(){if("undefined"==typeof window)return u.warn("No window object available to get browser client info"),{};var e=window.navigator;if(!e)return u.warn("No navigator object available to get browser client info"),{};var t=e.platform,n=e.product,r=e.vendor,o=e.userAgent,i=e.language,s=function browserType(e){var t=/.+(Opera[\s[A-Z]*|OPR[\sA-Z]*)\/([0-9\.]+).*/i.exec(e);if(t)return{type:t[1],version:t[2]};var n=/.+(Trident|Edge)\/([0-9\.]+).*/i.exec(e);if(n)return{type:n[1],version:n[2]};var r=/.+(Chrome|Firefox|FxiOS)\/([0-9\.]+).*/i.exec(e);if(r)return{type:r[1],version:r[2]};var o=/.+(Safari)\/([0-9\.]+).*/i.exec(e);if(o)return{type:o[1],version:o[2]};var i=/.+(AppleWebKit)\/([0-9\.]+).*/i.exec(e);if(i)return{type:i[1],version:i[2]};var s=/.*([A-Z]+)\/([0-9\.]+).*/i.exec(e);if(s)return{type:s[1],version:s[2]};return{type:"",version:""}}(o),a=function browserTimezone(){var e=/\(([A-Za-z\s].*)\)/.exec((new Date).toString());return e&&e[1]||""}();return{platform:t,make:n||r,model:s.type,version:s.version,appVersion:[s.type,s.version].join("/"),language:i,timezone:a}}()}var c=function(){function ClientDevice(){}return ClientDevice.clientInfo=function(){return clientInfo()},ClientDevice.dimension=function(){return function dimension(){return"undefined"==typeof window?(u.warn("No window object available to get browser client info"),{width:320,height:320}):{width:window.innerWidth,height:window.innerHeight}}()},ClientDevice}();var __assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},Hub_spreadArrays=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],s=0,a=i.length;s<a;s++,o++)r[o]=i[s];return r},l=new i("Hub"),d="undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("amplify_default"):"@@amplify_default";var f=new(function(){function HubClass(e){this.listeners=[],this.patterns=[],this.protectedChannels=["core","auth","api","analytics","interactions","pubsub","storage","xr"],this.name=e}return HubClass.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 l.warn("No listeners for "+e);this.patterns=Hub_spreadArrays(this.patterns.filter((function(e){return e!==n})))}else{var r=this.listeners[e];if(!r)return void l.warn("No listeners for "+e);this.listeners[e]=Hub_spreadArrays(r.filter((function(e){return e.callback!==t})))}},HubClass.prototype.dispatch=function(e,t,n,r){(void 0===n&&(n=""),this.protectedChannels.indexOf(e)>-1)&&(r===d||l.warn("WARNING: "+e+" is protected and dispatching on it can have unintended consequences"));var o={channel:e,payload:__assign({},t),source:n,patternInfo:[]};try{this._toListeners(o)}catch(e){l.error(e)}},HubClass.prototype.listen=function(e,t,n){var r;if(void 0===n&&(n="noname"),function isLegacyCallback(e){return void 0!==e.onHubCapsule}(t))l.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})}},HubClass.prototype._toListeners=function(e){var t=e.channel,n=e.payload,r=this.listeners[t];if(r&&r.forEach((function(r){l.debug("Dispatching to "+t+" with ",n);try{r.callback(e)}catch(e){l.error(e)}})),this.patterns.length>0){if(!n.message)return void l.warn("Cannot perform pattern matching without a message key");var o=n.message;this.patterns.forEach((function(t){var n=o.match(t.pattern);if(n){var r=n.slice(1),i=__assign(__assign({},e),{patternInfo:r});try{t.callback(i)}catch(e){l.error(e)}}}))}},HubClass}())("__default__"),g=new i("I18n"),h=function(){function I18n(e){this._options=null,this._lang=null,this._dict={},this._options=Object.assign({},e),this._lang=this._options.language,!this._lang&&"undefined"!=typeof window&&window&&window.navigator&&(this._lang=window.navigator.language),g.debug(this._lang)}return I18n.prototype.setLanguage=function(e){this._lang=e},I18n.prototype.get=function(e,t){if(void 0===t&&(t=void 0),!this._lang)return void 0!==t?t:e;var n=this._lang,r=this.getByLanguage(e,n);return r||(n.indexOf("-")>0&&(r=this.getByLanguage(e,n.split("-")[0])),r||(void 0!==t?t:e))},I18n.prototype.getByLanguage=function(e,t,n){if(void 0===n&&(n=null),!t)return n;var r=this._dict[t];return r?r[e]:n},I18n.prototype.putVocabulariesForLanguage=function(e,t){var n=this._dict[e];n||(n=this._dict[e]={}),Object.assign(n,t)},I18n.prototype.putVocabularies=function(e){var t=this;Object.keys(e).map((function(n){t.putVocabulariesForLanguage(n,e[n])}))},I18n}(),p=new i("I18n"),y=null,m=null,b=function(){function I18n(){}return I18n.configure=function(e){return p.debug("configure I18n"),e?(y=Object.assign({},y,e.I18n||e),I18n.createInstance(),y):y},I18n.getModuleName=function(){return"I18n"},I18n.createInstance=function(){p.debug("create I18n instance"),m||(m=new h(y))},I18n.setLanguage=function(e){return I18n.checkConfig(),m.setLanguage(e)},I18n.get=function(e,t){return I18n.checkConfig()?m.get(e,t):void 0===t?e:t},I18n.putVocabulariesForLanguage=function(e,t){return I18n.checkConfig(),m.putVocabulariesForLanguage(e,t)},I18n.putVocabularies=function(e){return I18n.checkConfig(),m.putVocabularies(e)},I18n.checkConfig=function(){return m||(m=new h(y)),!0},I18n}();a.register(b);var v=b,w=n("../node_modules/@aws-amplify/core/lib-esm/JS.js"),Signer_assign=function(){return(Signer_assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},__rest=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 o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n},_=new i("Signer"),A=n("../node_modules/url/url.js"),C=r.util.crypto,encrypt=function(e,t,n){return C.lib.createHmac("sha256",e).update(t,"utf8").digest(n)},hash=function(e){var t=e||"";return C.createHash("sha256").update(t,"utf8").digest("hex")},signed_headers=function(e){return Object.keys(e).map((function(e){return e.toLowerCase()})).sort().join(";")},canonical_request=function(e){var t,n,r=A.parse(e.url);return[e.method||"/",encodeURIComponent(r.pathname).replace(/%2F/gi,"/"),(n=r.query,n&&0!==n.length?n.split("&").map((function(e){var t=e.split("=");if(1===t.length)return e;var n=t[1].replace(/[!'()*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}));return t[0]+"="+n})).sort((function(e,t){var n=e.split("=")[0],r=t.split("=")[0];return n===r?e<t?-1:1:n<r?-1:1})).join("&"):""),(t=e.headers,t&&0!==Object.keys(t).length?Object.keys(t).map((function(e){return{key:e.toLowerCase(),value:t[e]?t[e].trim().replace(/\s+/g," "):""}})).sort((function(e,t){return e.key<t.key?-1:1})).map((function(e){return e.key+":"+e.value})).join("\n")+"\n":""),signed_headers(e.headers),hash(e.data)].join("\n")},parse_service_info=function(e){var t=(A.parse(e.url).host.match(/([^\.]+)\.(?:([^\.]*)\.)?amazonaws\.com$/)||[]).slice(1,3);return"es"===t[1]&&(t=t.reverse()),{service:e.service||t[0],region:e.region||t[1]}},credential_scope=function(e,t,n){return[e,t,n,"aws4_request"].join("/")},string_to_sign=function(e,t,n,r){return[e,n,r,hash(t)].join("\n")},get_signing_key=function(e,t,n){_.debug(n);var r=encrypt("AWS4"+e,t),o=encrypt(r,n.region),i=encrypt(o,n.service);return encrypt(i,"aws4_request")},get_signature=function(e,t){return encrypt(e,t,"hex")},S=function(){function Signer(){}return Signer.sign=function(e,t,n){void 0===n&&(n=null),e.headers=e.headers||{};var r=(new Date).toISOString().replace(/[:\-]|\.\d{3}/g,""),o=r.substr(0,8),i=A.parse(e.url);e.headers.host=i.host,e.headers["x-amz-date"]=r,t.session_token&&(e.headers["X-Amz-Security-Token"]=t.session_token);var s=canonical_request(e);_.debug(s);var a=n||parse_service_info(e),u=credential_scope(o,a.region,a.service),c=string_to_sign("AWS4-HMAC-SHA256",s,r,u),l=get_signing_key(t.secret_key,o,a),d=get_signature(l,c),f=function(e,t,n,r,o){return[e+" Credential="+t+"/"+n,"SignedHeaders="+r,"Signature="+o].join(", ")}("AWS4-HMAC-SHA256",t.access_key,u,signed_headers(e.headers),d);return e.headers.Authorization=f,e},Signer.signUrl=function(e,t,n,r){var o="object"==typeof e?e.url:e,i="object"==typeof e?e.method:"GET",s="object"==typeof e?e.body:void 0,a=(new Date).toISOString().replace(/[:\-]|\.\d{3}/g,""),u=a.substr(0,8),c=A.parse(o,!0,!0),l=(c.search,__rest(c,["search"])),d={host:l.host},f=n||parse_service_info({url:A.format(l)}),g=f.region,h=f.service,p=credential_scope(u,g,h),y=t.session_token&&"iotdevicegateway"!==h,m=Signer_assign(Signer_assign(Signer_assign({"X-Amz-Algorithm":"AWS4-HMAC-SHA256","X-Amz-Credential":[t.access_key,p].join("/"),"X-Amz-Date":a.substr(0,16)},y?{"X-Amz-Security-Token":""+t.session_token}:{}),r?{"X-Amz-Expires":""+r}:{}),{"X-Amz-SignedHeaders":Object.keys(d).join(",")}),b=canonical_request({method:i,url:A.format(Signer_assign(Signer_assign({},l),{query:Signer_assign(Signer_assign({},l.query),m)})),headers:d,data:s}),v=string_to_sign("AWS4-HMAC-SHA256",b,a,p),w=get_signing_key(t.secret_key,u,{region:g,service:h}),_=get_signature(w,v),C=Signer_assign({"X-Amz-Signature":_},t.session_token&&{"X-Amz-Security-Token":t.session_token});return A.format({protocol:l.protocol,slashes:!0,hostname:l.hostname,port:l.port,pathname:l.pathname,query:Signer_assign(Signer_assign(Signer_assign({},l.query),m),C)})},Signer}(),I=new i("Parser"),P=function(){function Parser(){}return Parser.parseMobilehubConfig=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}if(e.aws_cognito_identity_pool_id||e.aws_user_pools_id){var o={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,mandatorySignIn:"enable"===e.aws_mandatory_sign_in};n.Auth=o}return 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:{},n.Analytics=Object.assign({},n.Analytics,e.Analytics),n.Auth=Object.assign({},n.Auth,e.Auth),n.Storage=Object.assign({},t),I.debug("parse config",e,"to amplifyconfig",n),n},Parser}(),__awaiter=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?o(e.value):function adopt(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())}))},__generator=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function verb(i){return function(a){return function step(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},k=new i("CognitoCredentials"),j=new Promise((function(e,t){return w.a.browserOrNode().isBrowser?(window.gapi&&window.gapi.auth2?window.gapi.auth2:null)?(k.debug("google api already loaded"),e()):void setTimeout((function(){return e()}),2e3):(k.debug("not in the browser, directly resolved"),e())})),O=function(){function GoogleOAuth(){this.initialized=!1,this.refreshGoogleToken=this.refreshGoogleToken.bind(this),this._refreshGoogleTokenImpl=this._refreshGoogleTokenImpl.bind(this)}return GoogleOAuth.prototype.refreshGoogleToken=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return this.initialized?[3,2]:(k.debug("need to wait for the Google SDK loaded"),[4,j]);case 1:e.sent(),this.initialized=!0,k.debug("finish waiting"),e.label=2;case 2:return[2,this._refreshGoogleTokenImpl()]}}))}))},GoogleOAuth.prototype._refreshGoogleTokenImpl=function(){var e=null;return w.a.browserOrNode().isBrowser&&(e=window.gapi&&window.gapi.auth2?window.gapi.auth2:null),e?new Promise((function(t,n){e.getAuthInstance().then((function(e){e||(console.log("google Auth undefiend"),n("google Auth undefiend"));var r=e.currentUser.get();r.isSignedIn()?(k.debug("refreshing the google access token"),r.reloadAuthResponse().then((function(e){var n=e.id_token,o=e.expires_at,i=r.getBasicProfile();i.getEmail(),i.getName();t({token:n,expires_at:o})}))):n("User is not signed in with Google")})).catch((function(e){k.debug("Failed to refresh google token",e),n("Failed to refresh google token")}))})):(k.debug("no gapi auth2 available"),Promise.reject("no gapi auth2 available"))},GoogleOAuth}(),FacebookOAuth_awaiter=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?o(e.value):function adopt(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())}))},FacebookOAuth_generator=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function verb(i){return function(a){return function step(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},U=new i("CognitoCredentials"),x=new Promise((function(e,t){return w.a.browserOrNode().isBrowser?window.FB?(U.debug("FB SDK already loaded"),e()):void setTimeout((function(){return e()}),2e3):(U.debug("not in the browser, directly resolved"),e())})),F=function(){function FacebookOAuth(){this.initialized=!1,this.refreshFacebookToken=this.refreshFacebookToken.bind(this),this._refreshFacebookTokenImpl=this._refreshFacebookTokenImpl.bind(this)}return FacebookOAuth.prototype.refreshFacebookToken=function(){return FacebookOAuth_awaiter(this,void 0,void 0,(function(){return FacebookOAuth_generator(this,(function(e){switch(e.label){case 0:return this.initialized?[3,2]:(U.debug("need to wait for the Facebook SDK loaded"),[4,x]);case 1:e.sent(),this.initialized=!0,U.debug("finish waiting"),e.label=2;case 2:return[2,this._refreshFacebookTokenImpl()]}}))}))},FacebookOAuth.prototype._refreshFacebookTokenImpl=function(){var e=null;return w.a.browserOrNode().isBrowser&&(e=window.FB),e?new Promise((function(t,n){e.getLoginStatus((function(e){e&&e.authResponse||(U.debug("no response from facebook when refreshing the jwt token"),n("no response from facebook when refreshing the jwt token"));var r=e.authResponse,o=r.accessToken,i=1e3*r.expiresIn+(new Date).getTime();o||(U.debug("the jwtToken is undefined"),n("the jwtToken is undefined")),t({token:o,expires_at:i})}),{scope:"public_profile,email"})})):(U.debug("no fb sdk available"),Promise.reject("no fb sdk available"))},FacebookOAuth}(),E=new O,T=new F,N={},M=function(){function MemoryStorage(){}return MemoryStorage.setItem=function(e,t){return N[e]=t,N[e]},MemoryStorage.getItem=function(e){return Object.prototype.hasOwnProperty.call(N,e)?N[e]:void 0},MemoryStorage.removeItem=function(e){return delete N[e]},MemoryStorage.clear=function(){return N={}},MemoryStorage}(),R=function(){function StorageHelper(){try{this.storageWindow=window.localStorage,this.storageWindow.setItem("aws.amplify.test-ls",1),this.storageWindow.removeItem("aws.amplify.test-ls")}catch(e){this.storageWindow=M}}return StorageHelper.prototype.getStorage=function(){return this.storageWindow},StorageHelper}(),W=(w.a.browserOrNode().isBrowser&&(new R).getStorage(),function(){return(W=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)}),Credentials_awaiter=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?o(e.value):function adopt(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())}))},Credentials_generator=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function verb(i){return function(a){return function step(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},L=new i("Credentials"),H=new(function(){function Credentials(e){this._gettingCredPromise=null,this._refreshHandlers={},this.configure(e),this._refreshHandlers.google=E.refreshGoogleToken,this._refreshHandlers.facebook=T.refreshFacebookToken}return Credentials.prototype.getCredSource=function(){return this._credentials_source},Credentials.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=W(W({},this._refreshHandlers),t)),this._storage=this._config.storage,this._storage||(this._storage=(new R).getStorage()),this._storageSync=Promise.resolve(),"function"==typeof this._storage.sync&&(this._storageSync=this._storage.sync()),this._config},Credentials.prototype.get=function(){return L.debug("getting credentials"),this._pickupCredentials()},Credentials.prototype._pickupCredentials=function(){return L.debug("picking up credentials"),this._gettingCredPromise&&this._gettingCredPromise.isPending()?L.debug("getting old cred promise"):(L.debug("getting new cred promise"),r.config&&r.config.credentials&&r.config.credentials instanceof r.Credentials?this._gettingCredPromise=w.a.makeQuerablePromise(this._setCredentialsFromAWS()):this._gettingCredPromise=w.a.makeQuerablePromise(this._keepAlive())),this._gettingCredPromise},Credentials.prototype._keepAlive=function(){L.debug("checking if credentials exists and not expired");var e=this._credentials;return e&&!this._isExpired(e)?(L.debug("credentials not changed and not expired, directly return"),Promise.resolve(e)):(L.debug("need to get a new credential or refresh the existing one"),a.Auth&&"function"==typeof a.Auth.currentUserCredentials?a.Auth.currentUserCredentials():Promise.reject("No Auth module registered in Amplify"))},Credentials.prototype.refreshFederatedToken=function(e){var t=this;L.debug("Getting federated credentials");var n=e.provider,r=e.user,o=e.token,i=e.expires_at,s=e.identity_id,a=this;return L.debug("checking if federated jwt token expired"),i>(new Date).getTime()?(L.debug("token not expired"),this._setCredentialsFromFederation({provider:n,token:o,user:r,identity_id:s,expires_at:i})):a._refreshHandlers[n]&&"function"==typeof a._refreshHandlers[n]?(L.debug("getting refreshed jwt token from federation provider"),a._refreshHandlers[n]().then((function(e){return L.debug("refresh federated token sucessfully",e),o=e.token,s=e.identity_id,i=e.expires_at,a._setCredentialsFromFederation({provider:n,token:o,user:r,identity_id:s,expires_at:i})})).catch((function(e){return L.debug("refresh federated token failed",e),t.clear(),Promise.reject("refreshing federation token failed: "+e)}))):(L.debug("no refresh handler for provider:",n),this.clear(),Promise.reject("no refresh handler for provider"))},Credentials.prototype._isExpired=function(e){if(!e)return L.debug("no credentials for expiration check"),!0;L.debug("is this credentials expired?",e);var t=(new Date).getTime(),n=e.expired,r=e.expireTime;return!(!n&&r>t+6e5)},Credentials.prototype._setCredentialsForGuest=function(){return Credentials_awaiter(this,void 0,void 0,(function(){var e,t,n,o,i,s,a,u=this;return Credentials_generator(this,(function(c){switch(c.label){case 0:if(e=!1,L.debug("setting credentials for guest"),t=this._config,n=t.identityPoolId,o=t.region,t.mandatorySignIn)return[2,Promise.reject("cannot get guest credentials when mandatory signin enabled")];if(!n)return L.debug("No Cognito Federated Identity pool provided"),[2,Promise.reject("No Cognito Federated Identity pool provided")];i=void 0,c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this._storageSync];case 2:return c.sent(),i=this._storage.getItem("CognitoIdentityId-"+n),[3,4];case 3:return s=c.sent(),L.debug("Failed to get the cached identityId",s),[3,4];case 4:return a=new r.CognitoIdentityCredentials({IdentityPoolId:n,IdentityId:i||void 0},{region:o}),this,[2,this._loadCredentials(a,"guest",!1,null).then((function(e){return e})).catch((function(t){return Credentials_awaiter(u,void 0,void 0,(function(){var s;return Credentials_generator(this,(function(u){return"ResourceNotFoundException"!==t.code||t.message!=="Identity '"+i+"' not found."||e?[2,t]:(e=!0,L.debug("Failed to load guest credentials"),this._storage.removeItem("CognitoIdentityId-"+n),a.clearCachedId(),s=new r.CognitoIdentityCredentials({IdentityPoolId:n,IdentityId:void 0},{region:o}),[2,this._loadCredentials(s,"guest",!1,null)])}))}))}))]}}))}))},Credentials.prototype._setCredentialsFromAWS=function(){var e=r.config.credentials;L.debug("setting credentials from aws");return e instanceof r.Credentials?Promise.resolve(e):(L.debug("AWS.config.credentials is not an instance of AWS Credentials"),Promise.reject("AWS.config.credentials is not an instance of AWS Credentials"))},Credentials.prototype._setCredentialsFromFederation=function(e){var t=e.provider,n=e.token,o=e.identity_id,i=(e.user,e.expires_at,{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 s={};s[i]=n;var a=this._config,u=a.identityPoolId,c=a.region;if(!u)return L.debug("No Cognito Federated Identity pool provided"),Promise.reject("No Cognito Federated Identity pool provided");var l=new r.CognitoIdentityCredentials({IdentityPoolId:u,IdentityId:o,Logins:s},{region:c});return this._loadCredentials(l,"federated",!0,e)},Credentials.prototype._setCredentialsFromSession=function(e){L.debug("set credentials from session");var t=e.getIdToken().getJwtToken(),n=this._config,o=n.region,i=n.userPoolId,s=n.identityPoolId;if(!s)return L.debug("No Cognito Federated Identity pool provided"),Promise.reject("No Cognito Federated Identity pool provided");var a={};a["cognito-idp."+o+".amazonaws.com/"+i]=t;var u=new r.CognitoIdentityCredentials({IdentityPoolId:s,Logins:a},{region:o});return this._loadCredentials(u,"userPool",!0,null)},Credentials.prototype._loadCredentials=function(e,t,n,r){var o=this,i=this,s=this._config.identityPoolId;return new Promise((function(u,c){e.get((function(l){return Credentials_awaiter(o,void 0,void 0,(function(){var o,d,f,g,h,p;return Credentials_generator(this,(function(y){switch(y.label){case 0:if(l)return L.debug("Failed to load credentials",e),c(l),[2];if(L.debug("Load credentials successfully",e),i._credentials=e,i._credentials.authenticated=n,i._credentials_source=t,"federated"!==t)return[3,3];o=Object.assign({id:this._credentials.identityId},r.user),d=r.provider,f=r.token,g=r.expires_at,h=r.identity_id;try{this._storage.setItem("aws-amplify-federatedInfo",JSON.stringify({provider:d,token:f,user:o,expires_at:g,identity_id:h}))}catch(e){L.debug("Failed to put federated info into auth storage",e)}return a.Cache&&"function"==typeof a.Cache.setItem?[4,a.Cache.setItem("federatedInfo",{provider:d,token:f,user:o,expires_at:g,identity_id:h},{priority:1})]:[3,2];case 1:return y.sent(),[3,3];case 2:L.debug("No Cache module registered in Amplify"),y.label=3;case 3:if("guest"!==t)return[3,7];y.label=4;case 4:return y.trys.push([4,6,,7]),[4,this._storageSync];case 5:return y.sent(),this._storage.setItem("CognitoIdentityId-"+s,e.identityId),[3,7];case 6:return p=y.sent(),L.debug("Failed to cache identityId",p),[3,7];case 7:return u(i._credentials),[2]}}))}))}))}))},Credentials.prototype.set=function(e,t){return"session"===t?this._setCredentialsFromSession(e):"federation"===t?this._setCredentialsFromFederation(e):"guest"===t?this._setCredentialsForGuest():(L.debug("no source specified for setting credentials"),Promise.reject("invalid source"))},Credentials.prototype.clear=function(){return Credentials_awaiter(this,void 0,void 0,(function(){var e,t,n;return Credentials_generator(this,(function(o){switch(o.label){case 0:return e=this._config,t=e.identityPoolId,n=e.region,t&&new r.CognitoIdentityCredentials({IdentityPoolId:t},{region:n}).clearCachedId(),this._credentials=null,this._credentials_source=null,this._storage.removeItem("aws-amplify-federatedInfo"),a.Cache&&"function"==typeof a.Cache.setItem?[4,a.Cache.removeItem("federatedInfo")]:[3,2];case 1:return o.sent(),[3,3];case 2:L.debug("No Cache module registered in Amplify"),o.label=3;case 3:return[2]}}))}))},Credentials.prototype.shear=function(e){return{accessKeyId:e.accessKeyId,sessionToken:e.sessionToken,secretAccessKey:e.secretAccessKey,identityId:e.identityId,authenticated:e.authenticated}},Credentials}())(null),D=function(){function ServiceWorkerClass(){this._logger=new i("ServiceWorker")}return Object.defineProperty(ServiceWorkerClass.prototype,"serviceWorker",{get:function(){return this._serviceWorker},enumerable:!0,configurable:!0}),ServiceWorkerClass.prototype.register=function(e,t){var n=this;return void 0===e&&(e="/service-worker.js"),void 0===t&&(t="/"),this._logger.debug("registering "+e),this._logger.debug("registering service worker with scope "+t),new Promise((function(r,o){if(!(navigator&&"serviceWorker"in navigator))return o(new Error("Service Worker not available"));navigator.serviceWorker.register(e,{scope:t}).then((function(e){return e.installing?n._serviceWorker=e.installing:e.waiting?n._serviceWorker=e.waiting:e.active&&(n._serviceWorker=e.active),n._registration=e,n._setupListeners(),n._logger.debug("Service Worker Registration Success: "+e),r(e)})).catch((function(e){return n._logger.debug("Service Worker Registration Failed "+e),o(e)}))}))},ServiceWorkerClass.prototype.enablePush=function(e){var t=this;if(!this._registration)throw new Error("Service Worker not registered");return this._publicKey=e,new Promise((function(n,r){if(!w.a.browserOrNode().isBrowser)return r(new Error("Service Worker not available"));t._registration.pushManager.getSubscription().then((function(r){if(!r)return t._logger.debug("User is NOT subscribed to push"),t._registration.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:t._urlB64ToUint8Array(e)}).then((function(e){t._subscription=e,t._logger.debug("User subscribed: "+JSON.stringify(e)),n(e)})).catch((function(e){t._logger.error(e)}));t._subscription=r,t._logger.debug("User is subscribed to push: "+JSON.stringify(r)),n(r)}))}))},ServiceWorkerClass.prototype._urlB64ToUint8Array=function(e){for(var t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=window.atob(t),r=new Uint8Array(n.length),o=0;o<n.length;++o)r[o]=n.charCodeAt(o);return r},ServiceWorkerClass.prototype.send=function(e){this._serviceWorker&&this._serviceWorker.postMessage("object"==typeof e?JSON.stringify(e):e)},ServiceWorkerClass.prototype._setupListeners=function(){var e=this;this._serviceWorker.addEventListener("statechange",(function(t){var n=e._serviceWorker.state;e._logger.debug("ServiceWorker statechange: "+n),a.Analytics&&"function"==typeof a.Analytics.record&&a.Analytics.record({name:"ServiceWorker",attributes:{state:n}})})),this._serviceWorker.addEventListener("message",(function(t){e._logger.debug("ServiceWorker message event: "+t)}))},ServiceWorkerClass}(),G=n("../node_modules/@aws-amplify/core/package.json"),z={userAgent:"aws-amplify/"+G.version+" js",product:"",navigator:null,isReactNative:!1};if("undefined"!=typeof navigator&&navigator.product)switch(z.product=navigator.product||"",z.navigator=navigator||null,navigator.product){case"ReactNative":z.userAgent="aws-amplify/"+G.version+" react-native",z.isReactNative=!0;break;default:z.userAgent="aws-amplify/"+G.version+" js",z.isReactNative=!1}var J=z,V={userAgent:J.userAgent},B=(t.o=a,new i("Core"));r.util?r.util.userAgent=function(){return V.userAgent}:r.config?r.config.update({customUserAgent:V.userAgent}):B.warn("No AWS.config")},"../node_modules/@aws-amplify/core/package.json":function(e){e.exports=JSON.parse('{"name":"@aws-amplify/core","version":"1.2.4","description":"Core category of aws-amplify","main":"./index.js","module":"./lib-esm/index.js","typings":"./lib-esm/index.d.ts","publishConfig":{"access":"public"},"scripts":{"test":"tslint \'src/**/*.ts\' && jest -w 1 --coverage","build-with-test":"npm test && npm run build","build:cjs":"node ./build es5 && webpack && webpack --config ./webpack.config.dev.js","build:esm":"node ./build es6","build":"npm run clean && npm run build:esm && npm run build:cjs","clean":"rimraf lib-esm lib dist","format":"echo \\"Not implemented\\"","lint":"tslint \'src/**/*.ts\'"},"react-native":{"./lib/ClientDevice":"./lib/ClientDevice/reactnative.js","./lib/RNComponents":"./lib/RNComponents/reactnative.js","./lib/StorageHelper":"./lib/StorageHelper/reactnative.js"},"repository":{"type":"git","url":"https://github.com/aws-amplify/amplify-js.git"},"author":"Amazon Web Services","license":"Apache-2.0","bugs":{"url":"https://github.com/aws/aws-amplify/issues"},"homepage":"https://aws-amplify.github.io/","devDependencies":{"find":"^0.2.7","prepend-file":"^1.3.1","prettier":"^1.7.4","typescript":"^3.2.2"},"dependencies":{"aws-sdk":"2.518.0","url":"^0.11.0"},"jest":{"globals":{"ts-jest":{"diagnostics":false,"tsConfig":{"lib":["es5","es2015","dom","esnext.asynciterable","es2017.object"],"allowJs":true}}},"transform":{"^.+\\\\.(js|jsx|ts|tsx)$":"ts-jest"},"testRegex":"(/__tests__/.*|\\\\.(test|spec))\\\\.(tsx?|jsx?)$","moduleFileExtensions":["ts","tsx","js","json","jsx"],"testEnvironment":"jsdom","coverageThreshold":{"global":{"branches":0,"functions":0,"lines":0,"statements":0}},"testURL":"http://localhost/","coveragePathIgnorePatterns":["/node_modules/"]},"gitHead":"c4fdc5ce1d754c7d690a92336f81f108db0f0b51"}')}}]);
//# sourceMappingURL=vendors~App-7KZ9F~propose-change-page-FI1f0~store-XBI5Y~user-page-DUsdt~092158aa.chunk.eaa5497fb7f7db0479e3.js.map