1import{A as j,f as Le,h as N,i as J,j as Vt,k as Rn,C as An,l as X,m as Z,n as Q,o as ee,q as te,r as ye,t as Y,s as Gt,H as ne,u as oe,U as yn,v as Cn,w as L,x as wn,y as Tn,z as ke,E as se,F as Yt,S as pe,G as I,I as R,J as C,K as jt,L as Pn,M as Te,N as Jt,O as M,P as Nn,Q as Xt,R as xn,T as vn,V as _n,W as Pe,X as Fn,Y as On,Z as Mn,$ as Zt,a0 as Un,a1 as Dn,a2 as rt,D as Qt,c as K}from"./amplify_outputs-ByhBuvRU.js";function en(){return j.Auth.clearCredentials()}const bn=e=>{const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=[],o=new Uint8Array(e);Le().getRandomValues(o);for(const s of o)n.push(t[s%t.length]);return n.join("")};function Ln(e){return(e.match(/.{2}/g)||[]).map(n=>String.fromCharCode(parseInt(n,16))).join("")}function kn(e){return e.split("").map(t=>t.charCodeAt(0).toString(16).padStart(2,"0")).join("")}const Hn=async()=>{const{userAgentData:e}=navigator;if(!e)return navigator.userAgent;const{platform:t="",platformVersion:n="",model:o="",architecture:s="",fullVersionList:i=[]}=await e.getHighEntropyValues(["platform","platformVersion","architecture","model","fullVersionList"]),r=i.map(c=>`${c.brand}/${c.version}`).join(";");return[t,n,s,o,t,r].filter(c=>c).join(" ")||navigator.userAgent};function Bn(){return Le().getRandomValues(new Uint32Array(1))[0]}function qn(e){const{words:t}=e,{sigBytes:n}=e,o=[];for(let s=0;s<n;s++){const i=t[s>>>2]>>>24-s%4*8&255;o.push((i>>>4).toString(16)),o.push((i&15).toString(16))}return o.join("")}class He{constructor(t,n){this.words=[];let o=t;o=this.words=o||[],n!==void 0?this.sigBytes=n:this.sigBytes=o.length*4}random(t){const n=[];for(let o=0;o<t;o+=4)n.push(Bn());return new He(n,t)}toString(){return qn(this)}}var y;(function(e){e.EmptySignInUsername="EmptySignInUsername",e.EmptySignInPassword="EmptySignInPassword",e.CustomAuthSignInPassword="CustomAuthSignInPassword",e.EmptySignUpUsername="EmptySignUpUsername",e.EmptySignUpPassword="EmptySignUpPassword",e.EmptyConfirmSignUpUsername="EmptyConfirmSignUpUsername",e.EmptyConfirmSignUpCode="EmptyConfirmSignUpCode",e.EmptyResendSignUpCodeUsername="EmptyresendSignUpCodeUsername",e.EmptyChallengeResponse="EmptyChallengeResponse",e.EmptyConfirmResetPasswordUsername="EmptyConfirmResetPasswordUsername",e.EmptyConfirmResetPasswordNewPassword="EmptyConfirmResetPasswordNewPassword",e.EmptyConfirmResetPasswordConfirmationCode="EmptyConfirmResetPasswordConfirmationCode",e.EmptyResetPasswordUsername="EmptyResetPasswordUsername",e.EmptyVerifyTOTPSetupCode="EmptyVerifyTOTPSetupCode",e.EmptyConfirmUserAttributeCode="EmptyConfirmUserAttributeCode",e.IncorrectMFAMethod="IncorrectMFAMethod",e.EmptyUpdatePassword="EmptyUpdatePassword"})(y||(y={}));const Wn={[y.EmptyChallengeResponse]:{message:"challengeResponse is required to confirmSignIn"},[y.EmptyConfirmResetPasswordUsername]:{message:"username is required to confirmResetPassword"},[y.EmptyConfirmSignUpCode]:{message:"code is required to confirmSignUp"},[y.EmptyConfirmSignUpUsername]:{message:"username is required to confirmSignUp"},[y.EmptyConfirmResetPasswordConfirmationCode]:{message:"confirmationCode is required to confirmResetPassword"},[y.EmptyConfirmResetPasswordNewPassword]:{message:"newPassword is required to confirmResetPassword"},[y.EmptyResendSignUpCodeUsername]:{message:"username is required to confirmSignUp"},[y.EmptyResetPasswordUsername]:{message:"username is required to resetPassword"},[y.EmptySignInPassword]:{message:"password is required to signIn"},[y.EmptySignInUsername]:{message:"username is required to signIn"},[y.EmptySignUpPassword]:{message:"password is required to signUp"},[y.EmptySignUpUsername]:{message:"username is required to signUp"},[y.CustomAuthSignInPassword]:{message:"A password is not needed when signing in with CUSTOM_WITHOUT_SRP",recoverySuggestion:"Do not include a password in your signIn call."},[y.IncorrectMFAMethod]:{message:"Incorrect MFA method was chosen. It should be either SMS, TOTP, or EMAIL",recoverySuggestion:"Try to pass SMS, TOTP, or EMAIL as the challengeResponse"},[y.EmptyVerifyTOTPSetupCode]:{message:"code is required to verifyTotpSetup"},[y.EmptyUpdatePassword]:{message:"oldPassword and newPassword are required to changePassword"}
1,[y.EmptyConfirmUserAttributeCode]:{message:"confirmation code is required to confirmUserAttribute"}};var P;(function(e){e.DEFAULT_MSG="Authentication Error",e.EMPTY_EMAIL="Email cannot be empty",e.EMPTY_PHONE="Phone number cannot be empty",e.EMPTY_USERNAME="Username cannot be empty",e.INVALID_USERNAME="The username should either be a string or one of the sign in types",e.EMPTY_PASSWORD="Password cannot be empty",e.EMPTY_CODE="Confirmation code cannot be empty",e.SIGN_UP_ERROR="Error creating account",e.NO_MFA="No valid MFA method provided",e.INVALID_MFA="Invalid MFA type",e.EMPTY_CHALLENGE="Challenge response cannot be empty",e.NO_USER_SESSION="Failed to get the session because the user is empty",e.NETWORK_ERROR="Network Error",e.DEVICE_CONFIG="Device tracking has not been configured in this User Pool",e.AUTOSIGNIN_ERROR="Please use your credentials to sign in",e.OAUTH_ERROR="Couldn't finish OAuth flow, check your User Pool HostedUI settings"})(P||(P={}));var B;(function(e){e.SignInException="SignInException",e.OAuthSignInError="OAuthSignInException"})(B||(B={}));function $n(e,t){const{message:n,recoverySuggestion:o}=Wn[t];if(!e)throw new N({name:t,message:n,recoverySuggestion:o})}var at;(function(e){e.ConcurrentModificationException="ConcurrentModificationException",e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.NotAuthorizedException="NotAuthorizedException",e.ResourceNotFoundException="ResourceNotFoundException",e.SoftwareTokenMFANotFoundException="SoftwareTokenMFANotFoundException"})(at||(at={}));var ct;(function(e){e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.InvalidPasswordException="InvalidPasswordException",e.LimitExceededException="LimitExceededException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(ct||(ct={}));var dt;(function(e){e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidLambdaResponseException="InvalidLambdaResponseException",e.InvalidParameterException="InvalidParameterException",e.InvalidPasswordException="InvalidPasswordException",e.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UsernameExistsException="UsernameExistsException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(dt||(dt={}));var lt;(function(e){e.CodeMismatchException="CodeMismatchException",e.ExpiredCodeException="ExpiredCodeException",e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidLambdaResponseException="InvalidLambdaResponseException",e.InvalidParameterException="InvalidParameterException",e.InvalidPasswordException="InvalidPasswordException",e.LimitExceededException="LimitExceededException",e.NotAuthorizedException="NotAuthorizedException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyFailedAttemptsException="TooManyFailedAttemptsException",e.TooManyRequestsException="TooManyRequestsException",e.UnexpectedLambdaException="UnexpectedLambdaException",e.UserLambdaValidationException="UserLambdaValidationException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(lt||(lt={}));var ut;(function(e){e.AliasExistsException="AliasExistsException",e.CodeMismatchException="CodeMismatchException",e.ExpiredCodeException="ExpiredCodeException",e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidLambdaResponseException="InvalidLambdaResponseException",e.InvalidParameterException="InvalidParameterException",e.LimitExceededException="LimitExceededException",e.NotAuthorizedException="NotAuthorizedException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyFailedAttemptsException="TooManyFailedAttemptsException",e.TooManyRequestsException="TooManyRequestsException",e.UnexpectedLambdaException="UnexpectedLambdaException",e.UserLambdaValidationException="UserLambdaValidationException",e.UserNotFoundException="UserNotFoundException"})(ut||(ut={}));var pt;(function(e){e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(pt||(pt={}));var Et;(function(e){e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(Et||(Et={}));var ht;(function(e){e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(ht||(ht={}));var mt;(function(e){e.CodeDeliveryFailureException="CodeDeliveryFailureException",e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidEmailRoleAccessPol
1icyException="InvalidEmailRoleAccessPolicyException",e.InvalidLambdaResponseException="InvalidLambdaResponseException",e.InvalidParameterException="InvalidParameterException",e.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",e.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",e.LimitExceededException="LimitExceededException",e.NotAuthorizedException="NotAuthorizedException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UnexpectedLambdaException="UnexpectedLambdaException",e.UserLambdaValidationException="UserLambdaValidationException",e.UserNotFoundException="UserNotFoundException"})(mt||(mt={}));var gt;(function(e){e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(gt||(gt={}));var ft;(function(e){e.ExternalServiceException="ExternalServiceException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.LimitExceededException="LimitExceededException",e.NotAuthorizedException="NotAuthorizedException",e.ResourceConflictException="ResourceConflictException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException"})(ft||(ft={}));var St;(function(e){e.ExternalServiceException="ExternalServiceException",e.InternalErrorException="InternalErrorException",e.InvalidIdentityPoolConfigurationException="InvalidIdentityPoolConfigurationException",e.InvalidParameterException="InvalidParameterException",e.NotAuthorizedException="NotAuthorizedException",e.ResourceConflictException="ResourceConflictException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException"})(St||(St={}));var It;(function(e){e.CodeDeliveryFailureException="CodeDeliveryFailureException",e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",e.InvalidLambdaResponseException="InvalidLambdaResponseException",e.InvalidParameterException="InvalidParameterException",e.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",e.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",e.LimitExceededException="LimitExceededException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UnexpectedLambdaException="UnexpectedLambdaException",e.UserLambdaValidationException="UserLambdaValidationException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(It||(It={}));var Rt;(function(e){e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UserNotConfirmedException="UserNotConfirmedException"})(Rt||(Rt={}));var Ce;(function(e){e.PasswordResetRequiredException="PasswordResetRequiredException",e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidLambdaResponseException="InvalidLambdaResponseException",e.InvalidParameterException="InvalidParameterException",e.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",e.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",e.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",e.NotAuthorizedException="NotAuthorizedException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UnexpectedLambdaException="UnexpectedLambdaException",e.UserLambdaValidationException="UserLambdaValidationException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(Ce||(Ce={}));var At;(function(e){e.CodeDeliveryFailureException="CodeDeliveryFailureException",e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidEmailRoleAccessPol
1icyException="InvalidEmailRoleAccessPolicyException",e.InvalidLambdaResponseException="InvalidLambdaResponseException",e.InvalidParameterException="InvalidParameterException",e.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",e.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",e.LimitExceededException="LimitExceededException",e.NotAuthorizedException="NotAuthorizedException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UnexpectedLambdaException="UnexpectedLambdaException",e.UserLambdaValidationException="UserLambdaValidationException",e.UserNotFoundException="UserNotFoundException"})(At||(At={}));var yt;(function(e){e.AliasExistsException="AliasExistsException",e.CodeMismatchException="CodeMismatchException",e.ExpiredCodeException="ExpiredCodeException",e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidLambdaResponseException="InvalidLambdaResponseException",e.InvalidParameterException="InvalidParameterException",e.InvalidPasswordException="InvalidPasswordException",e.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",e.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",e.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",e.MFAMethodNotFoundException="MFAMethodNotFoundException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.SoftwareTokenMFANotFoundException="SoftwareTokenMFANotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UnexpectedLambdaException="UnexpectedLambdaException",e.UserLambdaValidationException="UserLambdaValidationException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(yt||(yt={}));var Ct;(function(e){e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(Ct||(Ct={}));var wt;(function(e){e.CodeDeliveryFailureException="CodeDeliveryFailureException",e.InternalErrorException="InternalErrorException",e.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",e.InvalidLambdaResponseException="InvalidLambdaResponseException",e.InvalidParameterException="InvalidParameterException",e.InvalidPasswordException="InvalidPasswordException",e.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",e.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",e.NotAuthorizedException="NotAuthorizedException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UnexpectedLambdaException="UnexpectedLambdaException",e.UserLambdaValidationException="UserLambdaValidationException",e.UsernameExistsException="UsernameExistsException"})(wt||(wt={}));var Tt;(function(e){e.AliasExistsException="AliasExistsException",e.CodeDeliveryFailureException="CodeDeliveryFailureException",e.CodeMismatchException="CodeMismatchException",e.ExpiredCodeException="ExpiredCodeException",e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",e.InvalidLambdaResponseException="InvalidLambdaResponseException",e.InvalidParameterException="InvalidParameterException",e.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",e.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UnexpectedLambdaException="UnexpectedLambdaException",e.UserLambdaValidationException="UserLambdaValidationException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(Tt||(Tt={}));var Pt;
1(function(e){e.CodeMismatchException="CodeMismatchException",e.EnableSoftwareTokenMFAException="EnableSoftwareTokenMFAException",e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.SoftwareTokenMFANotFoundException="SoftwareTokenMFANotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(Pt||(Pt={}));var Nt;(function(e){e.AliasExistsException="AliasExistsException",e.CodeMismatchException="CodeMismatchException",e.ExpiredCodeException="ExpiredCodeException",e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.LimitExceededException="LimitExceededException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(Nt||(Nt={}));var xt;(function(e){e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(xt||(xt={}));var vt;(function(e){e.ForbiddenException="ForbiddenException",e.InternalErrorException="InternalErrorException",e.InvalidParameterException="InvalidParameterException",e.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",e.NotAuthorizedException="NotAuthorizedException",e.PasswordResetRequiredException="PasswordResetRequiredException",e.ResourceNotFoundException="ResourceNotFoundException",e.TooManyRequestsException="TooManyRequestsException",e.UserNotConfirmedException="UserNotConfirmedException",e.UserNotFoundException="UserNotFoundException"})(vt||(vt={}));const Kn=async e=>{const t=e.getConfig().Auth?.Cognito;J(t);const n=await e.Auth.getTokens({forceRefresh:!1});Vt(n);const{"cognito:username":o,sub:s}=n.idToken?.payload??{},i={username:o,userId:s},r=zn(n);return r&&(i.signInDetails=r),i};function zn(e){return e?.signInDetails}const tn=async()=>Kn(j),w=(e,t)=>Rn({category:An.Auth,action:e,...t}),Ne=e=>X(te,ee("InitiateAuth"),Q(),{...Z,...e}),F=e=>X(te,ee("RespondToAuthChallenge"),Q(),{...Z,...e}),Vn=e=>X(te,ee("VerifySoftwareToken"),Q(),{...Z,...e}),Gn=e=>X(te,ee("AssociateSoftwareToken"),Q(),{...Z,...e});async function Be(e){if(e.AccessToken){const t=ye(e.AccessToken),n=(t.payload.iat||0)*1e3,o=new Date().getTime(),s=n>0?n-o:0;let i,r,a;e.RefreshToken&&(r=e.RefreshToken),e.IdToken&&(i=ye(e.IdToken)),e?.NewDeviceMetadata&&(a=e.NewDeviceMetadata);const c={accessToken:t,idToken:i,refreshToken:r,clockDrift:s,deviceMetadata:a,username:e.username};e?.signInDetails&&(c.signInDetails=e.signInDetails),await Y.setTokens({tokens:c})}else throw new Gt({message:"Invalid tokens",name:"InvalidTokens",recoverySuggestion:"Check Cognito UserPool settings"})}const Yn="Unable to get user session following successful sign-in.",nn=async()=>{try{ne.dispatch("auth",{event:"signedIn",data:await tn()},"Auth",oe)}catch(e){throw e.name===yn?new N({name:Cn,message:Yn,recoverySuggestion:"This most likely is due to auth tokens not being persisted. If you are using cookie store, please ensure cookies can be correctly set from your server."}):e}},jn=3*60*1e3,fe="CognitoSignInState",k={username:`${fe}.username`,challengeName:`${fe}.challengeName`,signInSession:`${fe}.signInSession`,expiry:`${fe}.expiry`},Jn=(e,t)=>{switch(t.type){case"SET_SIGN_IN_SESSION":return Se({signInSession:t.value}),{...e,signInSession:t.value};case"SET_SIGN_IN_STATE":return Se(t.value),{...t.value};case"SET_CHALLENGE_NAME":return Se({challengeName:t.value}),{...e,challengeName:t.value};case"SET_USERNAME":return Se({username:t.value}),{...e,username:t.value};case"SET_INITIAL_STATE":return Zn();case"RESET_STATE":return on(),qe();default:return e}},Xn=e=>{const t=Number(e),n=Date.now();return t<=n},Ti=()=>{q.dispatch({type:"RESET_STATE"})},on=()=>{for(const e of Object.values(k))L.removeItem(e)},qe=()=>({username:void 0,challengeName:void 0,signInSession:void 0}),Zn=()=>{const e=L.getItem(k.expiry);if(!e||Xn(e))return on(),qe();const t=L.getItem(k.username)??void 0,n=L.getItem(k.challengeName)??void 0,o=L.getItem(k.signInSession)??void 0;return{username:t,challengeName:n,signInSession:o}},Qn=e=>{let t=e(qe(),{type:"SET_INITIAL_STATE"});return{getState:()=>t,dispatch:n=>{t=e(t,n)}}},q=Qn(Jn);function eo(e){q.dispatch({type:"SET_SIGN_IN_STATE",value:e})}const Se=({challengeName:e,signInSession:t,username:n})=>{n&&L.setItem(k.username,n),e&&L.setItem(k.challengeName,e),t&&(L.setItem(k.signInSession,t),L.setItem(k.expiry,String(Date.now()+jn)))},_t="Passkeys may not be supported on this device. Ensure your application is running in a secure context (HTTPS) and Web Authentication API is supported.";class H extends Gt{constructor(t){super(t),this.constructor=H,Object.setPrototypeOf(this,H.prototype)}}var A;(function(e){e.PasskeyNotSupported="PasskeyNotSupported",e.PasskeyAlreadyExists="PasskeyAlreadyExists",e.InvalidPasskeyRegistrationOptions="InvalidPasskeyRegistrationOptions",e.InvalidPasskeyAuthenticationOptions="InvalidPasskeyAuthenticationOptions",e.RelyingPartyMismatch="RelyingPartyMismatch",e.PasskeyRegistrationFailed="PasskeyRegistrationFailed",e.PasskeyRetrievalFailed="PasskeyRetrievalFailed",e.PasskeyRegistrationCanceled="PasskeyRegistrationCanceled",e.PasskeyAuthenticationCanceled="PasskeyAuthenticationCanceled",e.PasskeyOperationAborted="PasskeyOperationAborted"})(A||(A={}));const Oe="User may have canceled the ceremony or another interruption has occurred. Check underlying error for details.",Ft="Ensure your user pool is configured to support the WEB_AUTHN as an authentication factor.",we={[A.PasskeyNotSupported]:{message:"Passkeys may not be supported on this device.",recoverySuggestion:_t},[A.InvalidPasskeyRegistrationOptions]:{message:"Invalid passkey registration options.",recoverySuggestion:Ft},[A.InvalidPasskeyAuthenticationOptions]:{message:"Invalid passkey authentication options.",recoverySuggestion:Ft},[A.PasskeyRegistrationFailed]:{message:"Device failed to create passkey.",recoverySuggestion:_t},[A.PasskeyRetrievalFailed]:{message:"Device failed to retrieve passkey.",recoverySuggestion:"Passkeys may not be available on this device. Try an alternative authentication factor like PASSWORD, EMAIL_OTP, or SMS_OTP."},[A.PasskeyAlreadyExists]:{message:"Passkey already exists in authenticator.",recoverySuggestion:"Proceed with existing passkey or try again after deleting the credential."},[A.PasskeyRegistrationCanceled]:{message:"Passkey registration ceremony has been canceled.",recoverySuggestion:Oe},[A.PasskeyAuthenticationCanceled]:{message:"Passkey authentication ceremony has been canceled.",recoverySuggestion:Oe},[A.PasskeyOperationAborted]:{message:"Passkey operation has been aborted.",recoverySuggestion:Oe},[A.RelyingPartyMismatch]:{message:"Relying party does not match current domain.",recoverySuggestion:"Ensure relying party identifier matches current domain."}},We=wn(we,H),to=e=>{if(e instanceof Error){if(e.name==="AbortError"){const{message:t,recoverySuggestion:n}=we[A.PasskeyOperationAborted];return new H({name:A.PasskeyOperationAborted,message:t,recoverySuggestion:n,underlyingError:e})}if(e.name==="SecurityError"){const{message:t,recoverySuggestion:n}=we[A.RelyingPartyMismatch];return new H({name:A.RelyingPartyMismatch,message:t,recoverySuggestion:n,underlyingError:e})}}return new H({name:Tn.Unknown,message:"An unknown error has occurred.",underlyingError:e})},no=e=>{if(e instanceof H)return e;if(e instanceof Error&&e.name==="NotAllowedError"){const{message:t,recoverySuggestion:n}=we[A.PasskeyAuthenticationCanceled];return new H({name:A.PasskeyAuthenticationCanceled,message:t,recoverySuggestion:n,underlyingError:e})}return to(e)},oo=()=>ke()&&window.isSecureContext&&"credentials"in navigator&&typeof window.PublicKeyCredential=="function",le=e=>se.convert(new Uint8Array(e),{urlSafe:!0,skipPadding:!0}),Ot=e=>Uint8Array.from(Yt.convert(e,{urlSafe:!0}),t=>t.charCodeAt(0)).buffer,so=e=>{const t=Ot(e.challenge),n=(e.allowCredentials||[]).map(o=>({...o,id:Ot(o.id)}));return{...e,challenge:t,allowCredentials:n}},io=e=>{const t={clientDataJSON:le(e.response.clientDataJSON),authenticatorData:le(e.response.authenticatorData),signature:le(e.response.signature)};e.response.userHandle&&(t.userHandle=le(e.response.userHandle));const n={id:e.id,rawId:le(e.rawId),type:e.type,clientExtensionResults:e.getClientExtensionResults(),response:t};return e.authenticatorAttachment&&(n.authenticatorAttachment=e.authenticatorAttachment),n};function ro(e){We(e&&e instanceof PublicKeyCredential&&e.response instanceof AuthenticatorAssertionResponse,A.PasskeyRetrievalFailed)}const ao=async e=>{try{const t=oo();We(t,A.PasskeyNotSupported);const n=so(e),o=await navigator.credentials.get({publicKey:n});return ro(o),io(o)}catch(t){throw no(t)}},co=e=>X(te,ee("ConfirmDevice"),Q(),{...Z,...e}),Ie={convert(e){return new TextEncoder().encode(e)}};function u(e,t){e!=null&&this.fromString(e,t)}function x(){return new u(null,null)}let z;const lo=0xdeadbeefcafe,Mt=(lo&16777215)===15715070;function uo(e,t,n,o,s,i){for(;--i>=0;){const r=t*this[e++]+n[o]+s;s=Math.floor(r/67108864),n[o++]=r&67108863}return s}function po(e,t,n,o,s,i){const r=t&32767,a=t>>15;for(;--i>=0;){let c=this[e]&32767;const d=this[e++]>>15,l=a*c+d*r;c=r*c+((l&32767)<<15)+n[o]+(s&1073741823),s=(c>>>30)+(l>>>15)+a*d+(s>>>30),n[o++]=c&1073741823}return s}function Eo(e,t,n,o,s,i){const r=t&16383,a=t>>14;for(;--i>=0;){let c=this[e]&16383;const d=this[e++]>>14,l=a*c+d*r;c=r*c+((l&16383)<<14)+n[o]+s,s=(c>>28)+(l>>14)+a*d,n[o++]=c&268435455}return s}const Ut=typeof navigator<"u";
1Ut&&Mt&&navigator.appName==="Microsoft Internet Explorer"?(u.prototype.am=po,z=30):Ut&&Mt&&navigator.appName!=="Netscape"?(u.prototype.am=uo,z=26):(u.prototype.am=Eo,z=28);u.prototype.DB=z;u.prototype.DM=(1<<z)-1;u.prototype.DV=1<<z;const $e=52;u.prototype.FV=Math.pow(2,$e);u.prototype.F1=$e-z;u.prototype.F2=2*z-$e;const ho="0123456789abcdefghijklmnopqrstuvwxyz",xe=[];let re,U;re=48;for(U=0;U<=9;++U)xe[re++]=U;re=97;for(U=10;U<36;++U)xe[re++]=U;re=65;for(U=10;U<36;++U)xe[re++]=U;function Dt(e){return ho.charAt(e)}function mo(e,t){const n=xe[e.charCodeAt(t)];return n??-1}function go(e){for(let t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function fo(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}function Ke(e){const t=x();return t.fromInt(e),t}function So(e,t){let n;if(t===16)n=4;else if(t===8)n=3;else if(t===2)n=1;else if(t===32)n=5;else if(t===4)n=2;else throw new Error("Only radix 2, 4, 8, 16, 32 are supported");this.t=0,this.s=0;let o=e.length,s=!1,i=0;for(;--o>=0;){const r=mo(e,o);if(r<0){e.charAt(o)==="-"&&(s=!0);continue}s=!1,i===0?this[this.t++]=r:i+n>this.DB?(this[this.t-1]|=(r&(1<<this.DB-i)-1)<<i,this[this.t++]=r>>this.DB-i):this[this.t-1]|=r<<i,i+=n,i>=this.DB&&(i-=this.DB)}this.clamp(),s&&u.ZERO.subTo(this,this)}function Io(){const e=this.s&this.DM;for(;this.t>0&&this[this.t-1]==e;)--this.t}function Ro(e){if(this.s<0)return"-"+this.negate().toString(e);let t;if(e==16)t=4;else if(e===8)t=3;else if(e===2)t=1;else if(e===32)t=5;else if(e===4)t=2;else throw new Error("Only radix 2, 4, 8, 16, 32 are supported");const n=(1<<t)-1;let o,s=!1,i="",r=this.t,a=this.DB-r*this.DB%t;if(r-- >0)for(a<this.DB&&(o=this[r]>>a)>0&&(s=!0,i=Dt(o));r>=0;)a<t?(o=(this[r]&(1<<a)-1)<<t-a,o|=this[--r]>>(a+=this.DB-t)):(o=this[r]>>(a-=t)&n,a<=0&&(a+=this.DB,--r)),o>0&&(s=!0),s&&(i+=Dt(o));return s?i:"0"}function Ao(){const e=x();return u.ZERO.subTo(this,e),e}function yo(){return this.s<0?this.negate():this}function Co(e){let t=this.s-e.s;if(t!=0)return t;let n=this.t;if(t=n-e.t,t!=0)return this.s<0?-t:t;for(;--n>=0;)if((t=this[n]-e[n])!=0)return t;return 0}function ze(e){let t=1,n;return(n=e>>>16)!==0&&(e=n,t+=16),(n=e>>8)!==0&&(e=n,t+=8),(n=e>>4)!==0&&(e=n,t+=4),(n=e>>2)!==0&&(e=n,t+=2),(n=e>>1)!==0&&(e=n,t+=1),t}function wo(){return this.t<=0?0:this.DB*(this.t-1)+ze(this[this.t-1]^this.s&this.DM)}function To(e,t){let n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s}function Po(e,t){for(let n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s}function No(e,t){const n=e%this.DB,o=this.DB-n,s=(1<<o)-1,i=Math.floor(e/this.DB);let r=this.s<<n&this.DM,a;for(a=this.t-1;a>=0;--a)t[a+i+1]=this[a]>>o|r,r=(this[a]&s)<<n;for(a=i-1;a>=0;--a)t[a]=0;t[i]=r,t.t=this.t+i+1,t.s=this.s,t.clamp()}function xo(e,t){t.s=this.s;const n=Math.floor(e/this.DB);if(n>=this.t){t.t=0;return}const o=e%this.DB,s=this.DB-o,i=(1<<o)-1;t[0]=this[n]>>o;for(let r=n+1;r<this.t;++r)t[r-n-1]|=(this[r]&i)<<s,t[r-n]=this[r]>>o;o>0&&(t[this.t-n-1]|=(this.s&i)<<s),t.t=this.t-n,t.clamp()}function vo(e,t){let n=0,o=0;const s=Math.min(e.t,this.t);for(;n<s;)o+=this[n]-e[n],t[n++]=o&this.DM,o>>=this.DB;if(e.t<this.t){for(o-=e.s;n<this.t;)o+=this[n],t[n++]=o&this.DM,o>>=this.DB;o+=this.s}else{for(o+=this.s;n<e.t;)o-=e[n],t[n++]=o&this.DM,o>>=this.DB;o-=e.s}t.s=o<0?-1:0,o<-1?t[n++]=this.DV+o:o>0&&(t[n++]=o),t.t=n,t.clamp()}function _o(e,t){const n=this.abs(),o=e.abs();let s=n.t;for(t.t=s+o.t;--s>=0;)t[s]=0;for(s=0;s<o.t;++s)t[s+n.t]=n.am(0,o[s],t,s,0,n.t);t.s=0,t.clamp(),this.s!==e.s&&u.ZERO.subTo(t,t)}function Fo(e){const t=this.abs();let n=e.t=2*t.t;for(;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){const o=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,o,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()}function Oo(e,t,n){const o=e.abs();if(o.t<=0)return;const s=this.abs();if(s.t<o.t){t?.fromInt(0),n!=null&&this.copyTo(n);return}n===null&&(n=x());const i=x(),r=this.s,a=e.s,c=this.DB-ze(o[o.t-1]);c>0?(o.lShiftTo(c,i),s.lShiftTo(c,n)):(o.copyTo(i),s.copyTo(n));const d=i.t,l=i[d-1];if(l===0)return;const p=l*(1<<this.F1)+(d>1?i[d-2]>>this.F2:0),E=this.FV/p,h=(1<<this.F1)/p,m=1<<this.F2;let g=n.t,S=g-d;const f=t===null?x():t;for(i.dlShiftTo(S,f),n.compareTo(f)>=0&&(n[n.t++]=1,n.subTo(f,n)),u.ONE.dlShiftTo(d,f),f.subTo(i,i);i.t<d;)i[i.t++]=0;for(;--S>=0;){let v=n[--g]===l?this.DM:Math.floor(n[g]*E+(n[g-1]+m)*h);if((n[g]+=i.am(0,v,n,S,0,d))<v)for(i.dlShiftTo(S,f),n.subTo(f,n);n[g]<--v;)n.subTo(f,n)}t!==null&&(n.drShiftTo(d,t),r!==a&&u.ZERO.subTo(t,t)),n.t=d,n.clamp(),c>0&&n.rShiftTo(c,n),r<0&&u.ZERO.subTo(n,n)}function Mo(e){const t=x();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(u.ZERO)>0&&e.subTo(t,t),t}function Uo(){if(this.t<1)return 0;const e=this[0];if(!(e&1))return 0;let t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function Do(e){return this.compareTo(e)===0}function bo(e,t){let n=0,o=0;const s=Math.min(e.t,this.t);for(;n<s;)o+=this[n]+e[n],t[n++]=o&this.DM,o>>=this.DB;if(e.t<this.t){for(o+=e.s;n<this.t;)o+=this[n],t[n++]=o&this.DM,o>>=this.DB;o+=this.s}else{for(o+=this.s;n<e.t;)o+=e[n],t[n++]=o&this.DM,o>>=this.DB;o+=e.s}t.s=o<0?-1:0,o>0?t[n++]=o:o<-1&&(t[n++]=this.DV+o),t.t=n,t.clamp()}function Lo(e){const t=x();return this.addTo(e,t),t}function ko(e){const t=x();return this.subTo(e,t),t}function Ho(e){const t=x();return this.multiplyTo(e,t),t}function Bo(e){const t=x();return this.divRemTo(e,t,null),t}function ae(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>
1>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function qo(e){const t=x();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(u.ZERO)>0&&this.m.subTo(t,t),t}function Wo(e){const t=x();return e.copyTo(t),this.reduce(t),t}function $o(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(let t=0;t<this.m.t;++t){let n=e[t]&32767;const o=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e[n]+=this.m.am(0,o,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function Ko(e,t){e.squareTo(t),this.reduce(t)}function zo(e,t,n){e.multiplyTo(t,n),this.reduce(n)}ae.prototype.convert=qo;ae.prototype.revert=Wo;ae.prototype.reduce=$o;ae.prototype.mulTo=zo;ae.prototype.sqrTo=Ko;function Vo(e,t,n){let o=e.bitLength(),s,i=Ke(1);const r=new ae(t);if(o<=0)return i;o<18?s=1:o<48?s=3:o<144?s=4:o<768?s=5:s=6;const a=[];let c=3;const d=s-1,l=(1<<s)-1;if(a[1]=r.convert(this),s>1){const f=x();for(r.sqrTo(a[1],f);c<=l;)a[c]=x(),r.mulTo(f,a[c-2],a[c]),c+=2}let p=e.t-1,E,h=!0,m=x(),g;for(o=ze(e[p])-1;p>=0;){for(o>=d?E=e[p]>>o-d&l:(E=(e[p]&(1<<o+1)-1)<<d-o,p>0&&(E|=e[p-1]>>this.DB+o-d)),c=s;!(E&1);)E>>=1,--c;if((o-=c)<0&&(o+=this.DB,--p),h)a[E].copyTo(i),h=!1;else{for(;c>1;)r.sqrTo(i,m),r.sqrTo(m,i),c-=2;c>0?r.sqrTo(i,m):(g=i,i=m,m=g),r.mulTo(m,a[E],i)}for(;p>=0&&!(e[p]&1<<o);)r.sqrTo(i,m),g=i,i=m,m=g,--o<0&&(o=this.DB-1,--p)}const S=r.revert(i);return n(null,S),S}u.prototype.copyTo=go;u.prototype.fromInt=fo;u.prototype.fromString=So;u.prototype.clamp=Io;u.prototype.dlShiftTo=To;u.prototype.drShiftTo=Po;u.prototype.lShiftTo=No;u.prototype.rShiftTo=xo;u.prototype.subTo=vo;u.prototype.multiplyTo=_o;u.prototype.squareTo=Fo;u.prototype.divRemTo=Oo;u.prototype.invDigit=Uo;u.prototype.addTo=bo;u.prototype.toString=Ro;u.prototype.negate=Ao;u.prototype.abs=yo;u.prototype.compareTo=Co;u.prototype.bitLength=wo;u.prototype.mod=Mo;u.prototype.equals=Do;u.prototype.add=Lo;u.prototype.subtract=ko;u.prototype.multiply=Ho;u.prototype.divide=Bo;u.prototype.modPow=Vo;u.ZERO=Ke(0);u.ONE=Ke(1);const Go=async({a:e,g:t,k:n,x:o,B:s,N:i,U:r})=>new Promise((a,c)=>{t.modPow(o,i,(d,l)=>{if(d){c(d);return}s.subtract(n.multiply(l)).modPow(e.add(r.multiply(o)),i,(p,E)=>{if(p){c(p);return}a(E.mod(i))})})}),Yo="FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF",sn={},Me={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),sn[e]=t,Me[t]=e}const ie=e=>{if(e.length%2!==0)throw new Error("Hex encoded strings must have an even number length");const t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2){const o=e.slice(n,n+2).toLowerCase();if(o in Me)t[n/2]=Me[o];else throw new Error(`Cannot decode unrecognized sequence ${o} as hexadecimal`)}return t},Ve=e=>{let t="";for(let n=0;n<e.byteLength;n++)t+=sn[e[n]];return t},Ue=e=>{const t=new pe;t.update(e);const n=t.digestSync(),o=Ve(n);return new Array(64-o.length).join("0")+o},Re=e=>Ue(ie(e)),jo=/^[89a-f]/i,b=e=>{if(!(e instanceof u))throw new Error("Not a BigInteger");const t=e.compareTo(u.ZERO)<0;let n=e.abs().toString(16);if(n=n.length%2!==0?`0${n}`:n,n=jo.test(n)?`00${n}`:n,t){const o=n.split("").map(i=>{const r=~parseInt(i,16)&15;return"0123456789ABCDEF".charAt(r)}).join("");n=new u(o,16).add(u.ONE).toString(16),n.toUpperCase().startsWith("FF8")&&(n=n.substring(2))}return n},Jo=({A:e,B:t})=>{const n=new u(Re(b(e)+b(t)),16);if(n.equals(u.ZERO))throw new Error("U cannot be zero.");return n},Xo=(e,t,n)=>{const o=new pe(t);o.update(e);const s=o.digestSync(),i=new pe(s);return i.update(n),i.digestSync().slice(0,16)},Ge=e=>{const t=new He().random(e).toString();return ie(t)},Zo=()=>se.convert(Ge(40));class Qo{constructor({userPoolName:t,a:n,g:o,A:s,N:i}){this.encoder=Ie,this.userPoolName=t,this.a=n,this.g=o,this.A=s,this.N=i,this.k=new u(Re(`${b(i)}${b(o)}`),16)}getRandomPassword(){if(!this.randomPassword)throw new N({name:"EmptyBigIntegerRandomPassword",message:"random password is empty"});return this.randomPassword}getSaltToHashDevices(){if(!this.saltToHashDevices)throw new N({name:"EmptyBigIntegersaltToHashDevices",message:"saltToHashDevices is empty"});return this.saltToHashDevices}getVerifierDevices(){if(!this.verifierDevices)throw new N({name:"EmptyBigIntegerVerifierDevices",message:"verifyDevices is empty"});return this.verifierDevices}async generateHashDevice(t,n){this.randomPassword=Zo();const o=`${t}${n}:${this.randomPassword}`,s=Ue(o),i=Ve(Ge(16));return this.saltToHashDevices=b(new u(i,16)),new Promise((r,a)=>{this.g.modPow(new u(Re(this.saltToHashDevices+s),16),this.N,(c,d)=>
1{if(c){a(c);return}this.verifierDevices=b(d),r()})})}async getPasswordAuthenticationKey({username:t,password:n,serverBValue:o,salt:s}){if(o.mod(this.N).equals(u.ZERO))throw new Error("B cannot be zero.");const i=Jo({A:this.A,B:o}),r=`${this.userPoolName}${t}:${n}`,a=Ue(r),c=new u(Re(b(s)+a),16),d=await Go({a:this.a,g:this.g,k:this.k,x:c,B:o,N:this.N,U:i}),l=this.encoder.convert("Caldera Derived Key"),p=this.encoder.convert("�"),E=new Uint8Array(l.byteLength+p.byteLength);return E.set(l,0),E.set(p,l.byteLength),Xo(ie(b(d)),ie(b(i)),E)}}const es=async({a:e,g:t,N:n})=>new Promise((o,s)=>{t.modPow(e,n,(i,r)=>{if(i){s(i);return}if(r.mod(n).equals(u.ZERO)){s(new Error("Illegal parameter. A mod N cannot be 0."));return}o(r)})}),Ee=async e=>{const t=new u(Yo,16),n=new u("2",16),o=ts(),s=await es({a:o,g:n,N:t});return new Qo({userPoolName:e,a:o,g:n,A:s,N:t})},ts=()=>{const e=Ve(Ge(128));return new u(e,16)};async function ns({userPoolId:e,userPoolEndpoint:t,newDeviceMetadata:n,accessToken:o}){if(!n)return;const s=e.split("_")[1]||"",i=await Ee(s),r=n?.DeviceKey,a=n?.DeviceGroupKey;try{await i.generateHashDevice(a??"",r??"")}catch{return}const c={Salt:se.convert(ie(i.getSaltToHashDevices())),PasswordVerifier:se.convert(ie(i.getVerifierDevices()))},d=i.getRandomPassword();try{return await co({endpointResolver:I({endpointOverride:t})})({region:R(e)},{AccessToken:o,DeviceName:await Hn(),DeviceKey:n?.DeviceKey,DeviceSecretVerifierConfig:c}),{deviceKey:r,deviceGroupKey:a,randomPassword:d}}catch{return}}async function os(e){const t=j.getConfig().Auth?.Cognito;J(t);const{username:n,signInSession:o,signInDetails:s,challengeName:i}=q.getState();if(i!=="WEB_AUTHN"||!n)throw new N({name:B.SignInException,message:"Unable to proceed due to invalid sign in state."});const{CREDENTIAL_REQUEST_OPTIONS:r}=e;We(!!r,A.InvalidPasskeyAuthenticationOptions);const a=await ao(JSON.parse(r)),c=F({endpointResolver:I({endpointOverride:t.userPoolEndpoint})}),{ChallengeName:d,ChallengeParameters:l,AuthenticationResult:p,Session:E}=await c({region:R(t.userPoolId),userAgentValue:w(C.ConfirmSignIn)},{ChallengeName:"WEB_AUTHN",ChallengeResponses:{USERNAME:n,CREDENTIAL:JSON.stringify(a)},ClientId:t.userPoolClientId,Session:o});if(eo({signInSession:E,username:n,challengeName:d,signInDetails:s}),p)return await Be({...p,username:n,NewDeviceMetadata:await ns({userPoolId:t.userPoolId,userPoolEndpoint:t.userPoolEndpoint,newDeviceMetadata:p.NewDeviceMetadata,accessToken:p.AccessToken}),signInDetails:s}),q.dispatch({type:"RESET_STATE"}),await nn(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}};if(d==="WEB_AUTHN")throw new N({name:B.SignInException,message:"Sequential WEB_AUTHN challenges returned from underlying service cannot be handled."});return{challengeName:d,challengeParameters:l}}function D({username:e,userPoolId:t,userPoolClientId:n}){if(typeof window>"u")return;const o=window.AmazonCognitoAdvancedSecurityData;if(typeof o>"u")return;const s=o.getData(e,t,n);return s?{EncodedData:s}:{}}const ss=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],is=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],rn=()=>{const e=new Date,t=is[e.getUTCDay()],n=ss[e.getUTCMonth()],o=e.getUTCDate();let s=e.getUTCHours();s<10&&(s=`0${s}`);let i=e.getUTCMinutes();i<10&&(i=`0${i}`);let r=e.getUTCSeconds();r<10&&(r=`0${r}`);const a=e.getUTCFullYear();return`${t} ${n} ${o} ${s}:${i}:${r} UTC ${a}`},an=({userPoolName:e,username:t,challengeParameters:n,dateNow:o,hkdf:s})=>{const i=Ie.convert(e),r=Ie.convert(t),a=rs(n.SECRET_BLOCK),c=Ie.convert(o),d=new Uint8Array(i.byteLength+r.byteLength+a.byteLength+c.byteLength);d.set(i,0),d.set(r,i.byteLength),d.set(a,i.byteLength+r.byteLength),d.set(c,i.byteLength+r.byteLength+a.byteLength);const l=new pe(s);l.update(d);const p=l.digestSync();return se.convert(p)},rs=e=>{const t="=".repeat((4-e.length%4)%4),n=(e+t).replace(/-/g,"+").replace(/_/g,"/"),o=Yt.convert(n),s=new Uint8Array(o.length);for(let i=0;i<o.length;++i)s[i]=o.charCodeAt(i);return s};async function he({username:e,config:t,clientMetadata:n,session:o,tokenOrchestrator:s}){const{userPoolId:i,userPoolEndpoint:r}=t,a=t.userPoolClientId,c=await s?.getDeviceMetadata(e);jt(c);const d=await Ee(c.deviceGroupKey),l={USERNAME:e,SRP_A:d.A.toString(16),DEVICE_KEY:c.deviceKey},p={ChallengeName:"DEVICE_SRP_AUTH",ClientId:a,ChallengeResponses:l,ClientMetadata:n,Session:o},E=F({endpointResolver:I({endpointOverride:r})}),{ChallengeParameters:h,Session:m}=await E({region:R(i)},p);return as(e,h,n,m,d,t,s)}async function as(e,t,n,o,s,{userPoolId:i,userPoolClientId:r,userPoolEndpoint:a},c){const d=await c?.getDeviceMetadata(e);jt(d);const l=new u(t?.SRP_B,16),p=new u(t?.SALT,16),{deviceKey:E}=d,{deviceGroupKey:h}=d,m=await s.getPasswordAuthenticationKey({username:d.deviceKey,password:d.randomPassword,serverBValue:l,salt:p}),g=rn(),S={USERNAME:t?.USERNAME??e,PASSWORD_CLAIM_SECRET_BLOCK:t?.SECRET_BLOCK,TIMESTAMP:g,PASSWORD_CLAIM_SIGNATURE:an({username:E,userPoolName:h,challengeParameters:t,dateNow:g,hkdf:m}),DEVICE_KEY:E},f=D({username:e,userPoolId:i,userPoolClientId:r}),v={ChallengeName:"DEVICE_PASSWORD_VERIFIER",ClientId:r,ChallengeResponses:S,Session:o,ClientMetadata:n,UserContextData:f};return F({endpointResolver:I({endpointOverride:a})})({region:R(i)},v)}async function Ye(e,t,n,o,s,i,r){const{userPoolId:a,userPoolClientId:c,userPoolEndpoint:d}=i,l=a?.split("_")[1]||"",p=new u(t?.SRP_B,16),E=new u(t?.SALT,16),h=t?.USER_ID_FOR_SRP;if(!h)throw new N({name:"EmptyUserIdForSRPException",message:"USER_ID_FOR_SRP was not found in challengeParameters"});const m=await s.getPasswordAuthenticationKey({username:h,password:e,serverBValue:p,salt:E}),g=rn(),S={USERNAME:h,PASSWORD_CLAIM_SECRET_BLOCK:t?.SECRET_BLOCK,TIMESTAMP:g,PASSWORD_CLAIM_SIGNATURE:an({username:h,userPoolName:l,challengeParameters:t,dateNow:g,hkdf:m})},f=await r.getDeviceMetadata(h);f&&f.deviceKey&&(S.DEVICE_KEY=f.deviceKey);const v=D({username:h,userPoolId:a,userPoolClientId:c}),W={ChallengeName:"PASSWORD_VERIFIER",ChallengeResponses:S,ClientMetadata:n,Session:o,ClientId:c,UserContextData:v},G=await F({endpointResolver:I({endpointOverride:d})})({region:R(a)},W);return G.ChallengeName==="DEVICE_SRP_AUTH"?he({username:h,config:i,clientMetadata:n,session:G.Session,tokenOrchestrator:r}):G}async function ve(e,t,n,o){try{return await e(...t)}catch(s){if(s instanceof N&&s.name==="ResourceNotFoundException"&&s.message.includes("Device does not exist."))return await o.clearDeviceMetadata(n),e(...t);throw s}}function ce(e){const{dispatch:t}=q;t({type:"SET_USERNAME",value:e})}async function cs({username:e,password:t,clientMetadata:n,config:o,tokenOrchestrator:s,authFlow:i,preferredChallenge:r}){const{userPoolId:a,userPoolClientId:c,userPoolEndpoint:d}=o,l=a?.split("_")[1]||"",p=await Ee(l),E={USERNAME:e,SRP_A:p.A.toString(16)};i==="USER_AUTH"&&r&&(E.PREFERRED_CHALLENGE=r);const h=D({username:e,userPoolId:a,userPoolClientId:c}),m={AuthFlow:i,AuthParameters:E,ClientMetadata:n,ClientId:c,UserContextData:h},S=await Ne({endpointResolver:I({endpointOverride:d})})({region:R(a),userAgentValue:w(C.SignIn)},m),{ChallengeParameters:f,Session:v}=S,W=f?.USERNAME??e;return ce(W),S.ChallengeName==="PASSWORD_VERIFIER"?ve(Ye,[t,f,n,v,p,o,s],W,s):S}async function ds({username:e,session:t,selectedChallenge:n,config:o,clientMetadata:s}){return F({endpointResolver:I({endpointOverride:o.userPoolEndpoint})})({region:R(o.userPoolId),userAgentValue:w(C.ConfirmSignIn)},{ChallengeName:"SELECT_CHALLENGE",ChallengeResponses:{USERNAME:e,ANSWER:n},ClientId:o.userPoolClientId,Session:t,ClientMetadata:s})}async function ls(e,t,n,o,s){const{userPoolId:i,userPoolClientId:r,userPoolEndpoint:a}=o,c={ANSWER:"PASSWORD",USERNAME:e,PASSWORD:t},d=D({username:e,userPoolId:i,userPoolClientId:r}),p=await F({endpointResolver:I({endpointOverride:a})})({region:R(i),userAgentValue:w(C.ConfirmSignIn)},{ChallengeName:"SELECT_CHALLENGE",ChallengeResponses:c,ClientId:r,ClientMetadata:n,Session:s,UserContextData:d}
1),E=p.ChallengeParameters?.USERNAME??e;return ce(E),p}async function us(e,t,n,o,s,i){const{userPoolId:r,userPoolClientId:a,userPoolEndpoint:c}=o,d=r.split("_")[1]||"",l=await Ee(d),p={ANSWER:"PASSWORD_SRP",USERNAME:e,SRP_A:l.A.toString(16)},E=D({username:e,userPoolId:r,userPoolClientId:a}),m=await F({endpointResolver:I({endpointOverride:c})})({region:R(r),userAgentValue:w(C.ConfirmSignIn)},{ChallengeName:"SELECT_CHALLENGE",ChallengeResponses:p,ClientId:a,ClientMetadata:n,Session:s,UserContextData:E}),g=m.ChallengeParameters?.USERNAME??e;return ce(g),m.ChallengeName==="PASSWORD_VERIFIER"?ve(Ye,[t,m.ChallengeParameters,n,m.Session,l,o,i],g,i):m}const De="userAttributes.";function ps(e){return"isSignedIn"in e&&"nextStep"in e}async function Es({challengeResponse:e,clientMetadata:t,session:n,username:o,config:s,tokenOrchestrator:i}){const{userPoolId:r,userPoolClientId:a,userPoolEndpoint:c}=s,d={USERNAME:o,ANSWER:e},l=await i?.getDeviceMetadata(o);l&&l.deviceKey&&(d.DEVICE_KEY=l.deviceKey);const p=D({username:o,userPoolId:r,userPoolClientId:a}),E={ChallengeName:"CUSTOM_CHALLENGE",ChallengeResponses:d,Session:n,ClientMetadata:t,ClientId:a,UserContextData:p},m=await F({endpointResolver:I({endpointOverride:c})})({region:R(r),userAgentValue:w(C.ConfirmSignIn)},E);return m.ChallengeName==="DEVICE_SRP_AUTH"?he({username:o,config:s,clientMetadata:t,session:m.Session,tokenOrchestrator:i}):m}async function hs({challengeResponse:e,username:t,clientMetadata:n,session:o,deviceName:s,config:i}){const{userPoolId:r,userPoolClientId:a,userPoolEndpoint:c}=i;if(e==="EMAIL")return{ChallengeName:"MFA_SETUP",Session:o,ChallengeParameters:{MFAS_CAN_SETUP:'["EMAIL_OTP"]'},$metadata:{}};if(e==="TOTP")return{ChallengeName:"MFA_SETUP",Session:o,ChallengeParameters:{MFAS_CAN_SETUP:'["SOFTWARE_TOKEN_MFA"]'},$metadata:{}};const d={USERNAME:t};if(/^\d+$/.test(e)){const E=Vn({endpointResolver:I({endpointOverride:c})}),{Session:h}=await E({region:R(r),userAgentValue:w(C.ConfirmSignIn)},{UserCode:e,Session:o,FriendlyDeviceName:s});q.dispatch({type:"SET_SIGN_IN_SESSION",value:h});const m={ChallengeName:"MFA_SETUP",ChallengeResponses:d,Session:h,ClientMetadata:n,ClientId:a};return F({endpointResolver:I({endpointOverride:c})})({region:R(r),userAgentValue:w(C.ConfirmSignIn)},m)}if(e.includes("@")){d.EMAIL=e;const E={ChallengeName:"MFA_SETUP",ChallengeResponses:d,Session:o,ClientMetadata:n,ClientId:a};return F({endpointResolver:I({endpointOverride:c})})({region:R(r),userAgentValue:w(C.ConfirmSignIn)},E)}throw new N({name:B.SignInException,message:`Cannot proceed with MFA setup using challengeResponse: ${e}`,recoverySuggestion:'Try passing "EMAIL", "TOTP", a valid email, or OTP code as the challengeResponse.'})}async function ms({challengeResponse:e,username:t,clientMetadata:n,session:o,config:s}){const{userPoolId:i,userPoolClientId:r,userPoolEndpoint:a}=s;$n(e==="TOTP"||e==="SMS"||e==="EMAIL",y.IncorrectMFAMethod);const c={USERNAME:t,ANSWER:As(e)},d=D({username:t,userPoolId:i,userPoolClientId:r}),l={ChallengeName:"SELECT_MFA_TYPE",ChallengeResponses:c,Session:o,ClientMetadata:n,ClientId:r,UserContextData:d};return F({endpointResolver:I({endpointOverride:a})})({region:R(i),userAgentValue:w(C.ConfirmSignIn)},l)}async function gs({challengeResponse:e,clientMetadata:t,session:n,username:o,requiredAttributes:s,config:i}){const{userPoolId:r,userPoolClientId:a,userPoolEndpoint:c}=i,d={...Rs(s),NEW_PASSWORD:e,USERNAME:o},l=D({username:o,userPoolId:r,userPoolClientId:a}),p={ChallengeName:"NEW_PASSWORD_REQUIRED",ChallengeResponses:d,ClientMetadata:t,Session:n,ClientId:a,UserContextData:l};return F({endpointResolver:I({endpointOverride:c})})({region:R(r),userAgentValue:w(C.ConfirmSignIn)},p)}async function Pi(e,t,n,o,s){const{userPoolClientId:i,userPoolId:r,userPoolEndpoint:a}=o,c={USERNAME:e,PASSWORD:t},d=await s.getDeviceMetadata(e);d&&d.deviceKey&&(c.DEVICE_KEY=d.deviceKey);const l=D({username:e,userPoolId:r,userPoolClientId:i}),p={AuthFlow:"USER_PASSWORD_AUTH",AuthParameters:c,ClientMetadata:n,ClientId:i,UserContextData:l},h=await Ne({endpointResolver:I({endpointOverride:a})})({region:R(r),userAgentValue:w(C.SignIn)}
1,p),m=h.ChallengeParameters?.USERNAME??h.ChallengeParameters?.USER_ID_FOR_SRP??e;return ce(m),h.ChallengeName==="DEVICE_SRP_AUTH"?he({username:m,config:o,clientMetadata:n,session:h.Session,tokenOrchestrator:s}):h}async function Ni(e,t,n,o,s){return cs({username:e,password:t,clientMetadata:n,config:o,tokenOrchestrator:s,authFlow:"USER_SRP_AUTH"})}async function xi(e,t,n,o){const{userPoolClientId:s,userPoolId:i,userPoolEndpoint:r}=n,a={USERNAME:e},c=await o.getDeviceMetadata(e);c&&c.deviceKey&&(a.DEVICE_KEY=c.deviceKey);const d=D({username:e,userPoolId:i,userPoolClientId:s}),l={AuthFlow:"CUSTOM_AUTH",AuthParameters:a,ClientMetadata:t,ClientId:s,UserContextData:d},E=await Ne({endpointResolver:I({endpointOverride:r})})({region:R(i),userAgentValue:w(C.SignIn)},l),h=E.ChallengeParameters?.USERNAME??e;return ce(h),E.ChallengeName==="DEVICE_SRP_AUTH"?he({username:h,config:n,clientMetadata:t,session:E.Session,tokenOrchestrator:o}):E}async function vi(e,t,n,o,s){J(o);const{userPoolId:i,userPoolClientId:r,userPoolEndpoint:a}=o,c=i?.split("_")[1]||"",d=await Ee(c),l={USERNAME:e,SRP_A:d.A.toString(16),CHALLENGE_NAME:"SRP_A"},p=D({username:e,userPoolId:i,userPoolClientId:r}),E={AuthFlow:"CUSTOM_AUTH",AuthParameters:l,ClientMetadata:n,ClientId:r,UserContextData:p},h=Ne({endpointResolver:I({endpointOverride:a})}),{ChallengeParameters:m,Session:g}=await h({region:R(i),userAgentValue:w(C.SignIn)},E),S=m?.USERNAME??e;return ce(S),ve(Ye,[t,m,n,g,d,o,s],S,s)}async function fs(e){const{challengeName:t,challengeParameters:n,availableChallenges:o}=e,s=j.getConfig().Auth?.Cognito;switch(J(s),t){case"CUSTOM_CHALLENGE":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_CUSTOM_CHALLENGE",additionalInfo:n}};case"MFA_SETUP":{const{signInSession:i,username:r}=q.getState(),a=bt(Lt(n.MFAS_CAN_SETUP))||[],c=Cs(a),d=c.includes("TOTP"),l=c.includes("EMAIL");if(d&&l)return{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_MFA_SETUP_SELECTION",allowedMFATypes:c}};if(l)return{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_EMAIL_SETUP"}};if(d){const p=Gn({endpointResolver:I({endpointOverride:s.userPoolEndpoint})}),{Session:E,SecretCode:h}=await p({region:R(s.userPoolId)},{Session:i});return q.dispatch({type:"SET_SIGN_IN_SESSION",value:E}),{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_TOTP_SETUP",totpSetupDetails:Ss(h,r)}}}throw new N({name:B.SignInException,message:`Cannot initiate MFA setup from available types: ${a}`})}case"NEW_PASSWORD_REQUIRED":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_NEW_PASSWORD_REQUIRED",missingAttributes:Is(n.requiredAttributes)}};case"SELECT_MFA_TYPE":return{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_MFA_SELECTION",allowedMFATypes:bt(Lt(n.MFAS_CAN_CHOOSE))}};case"SMS_OTP":case"SMS_MFA":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_SMS_CODE",codeDeliveryDetails:{deliveryMedium:n.CODE_DELIVERY_DELIVERY_MEDIUM,destination:n.CODE_DELIVERY_DESTINATION}}};case"SOFTWARE_TOKEN_MFA":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_TOTP_CODE"}};case"EMAIL_OTP":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_EMAIL_CODE",codeDeliveryDetails:{deliveryMedium:n.CODE_DELIVERY_DELIVERY_MEDIUM,destination:n.CODE_DELIVERY_DESTINATION}}};case"WEB_AUTHN":{const i=await os(n);return ps(i)?i:fs(i)}case"PASSWORD":case"PASSWORD_SRP":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_PASSWORD"}};case"SELECT_CHALLENGE":return{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_FIRST_FACTOR_SELECTION",availableChallenges:o}}}throw new N({name:B.SignInException,message:`An error occurred during the sign in process. ${t} challengeName returned by the underlying service was not addressed.`})}function Ss(e,t){return{sharedSecret:e,getSetupUri:(n,o)=>{const s=`otpauth://totp/${n}:${o??t}?secret=${e}&issuer=${n}`;return new Te(s)}}}function _i(e){if(e===Ce.PasswordResetRequiredException)return{isSignedIn:!1,nextStep:{signInStep:"RESET_PASSWORD"}};if(e===Ce.UserNotConfirmedException)return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_UP"}}
1}function Is(e){return e?JSON.parse(e).map(n=>n.includes(De)?n.replace(De,""):n):[]}function Rs(e){if(!e)return{};const t={};return Object.entries(e).forEach(([n,o])=>{o&&(t[`${De}${n}`]=o)}),t}async function Fi(e,t,n,o,s,i,r,a){const c=a?.userAttributes,d=a?.friendlyDeviceName;switch(t){case"WEB_AUTHN":case"SELECT_CHALLENGE":return o==="PASSWORD_SRP"||o==="PASSWORD"?{ChallengeName:o,Session:n,$metadata:{}}:ds({username:e,session:n,selectedChallenge:o,config:s,clientMetadata:r});case"SELECT_MFA_TYPE":return ms({challengeResponse:o,clientMetadata:r,session:n,username:e,config:s});case"MFA_SETUP":return hs({challengeResponse:o,clientMetadata:r,session:n,username:e,deviceName:d,config:s});case"NEW_PASSWORD_REQUIRED":return gs({challengeResponse:o,clientMetadata:r,session:n,username:e,requiredAttributes:c,config:s});case"CUSTOM_CHALLENGE":return ve(Es,[{challengeResponse:o,clientMetadata:r,session:n,username:e,config:s,tokenOrchestrator:i}],e,i);case"SMS_MFA":case"SOFTWARE_TOKEN_MFA":case"SMS_OTP":case"EMAIL_OTP":return Ts({challengeName:t,challengeResponse:o,clientMetadata:r,session:n,username:e,config:s,tokenOrchestrator:i});case"PASSWORD":return ls(e,o,r,s,n);case"PASSWORD_SRP":return us(e,o,r,s,n,i)}throw new N({name:B.SignInException,message:`An error occurred during the sign in process. 2 ${t} challengeName returned by the underlying service was not addressed.`})}function As(e){let t="SMS_MFA";return e==="TOTP"&&(t="SOFTWARE_TOKEN_MFA"),e==="EMAIL"&&(t="EMAIL_OTP"),t}function ys(e){if(e==="SMS_MFA")return"SMS";if(e==="SOFTWARE_TOKEN_MFA")return"TOTP";if(e==="EMAIL_OTP")return"EMAIL"}function bt(e){if(e)return e.map(ys).filter(Boolean)}function Lt(e){return e?JSON.parse(e):[]}function Cs(e){return e.filter(t=>t==="EMAIL"||t==="TOTP")}async function ws(){let e;try{e=await tn()}catch{}if(e&&e.userId&&e.username)throw new N({name:Pn,message:"There is already a signed in user.",recoverySuggestion:"Call signOut before calling signIn again."})}function Oi(e){return q.getState().username??e}async function Ts({challengeName:e,challengeResponse:t,clientMetadata:n,session:o,username:s,config:i,tokenOrchestrator:r}){const{userPoolId:a,userPoolClientId:c,userPoolEndpoint:d}=i,l={USERNAME:s};e==="EMAIL_OTP"&&(l.EMAIL_OTP_CODE=t),e==="SMS_MFA"&&(l.SMS_MFA_CODE=t),e==="SMS_OTP"&&(l.SMS_OTP_CODE=t),e==="SOFTWARE_TOKEN_MFA"&&(l.SOFTWARE_TOKEN_MFA_CODE=t);const p=await r?.getDeviceMetadata(s);p&&p.deviceKey&&(l.DEVICE_KEY=p.deviceKey);const E=D({username:s,userPoolId:a,userPoolClientId:c}),h={ChallengeName:e,ChallengeResponses:l,Session:o,ClientMetadata:n,ClientId:c,UserContextData:E},g=await F({endpointResolver:I({endpointOverride:d})})({region:R(a),userAgentValue:w(C.ConfirmSignIn)},h);return g.ChallengeName==="DEVICE_SRP_AUTH"?he({username:s,config:i,clientMetadata:n,session:g.Session,tokenOrchestrator:r}):g}new Jt("AuthError");const Ps={oauthSignInError:{message:P.OAUTH_ERROR,log:"Make sure Cognito Hosted UI has been configured correctly"},noConfig:{message:P.DEFAULT_MSG},missingAuthConfig:{message:P.DEFAULT_MSG},emptyUsername:{message:P.EMPTY_USERNAME},invalidUsername:{message:P.INVALID_USERNAME},emptyPassword:{message:P.EMPTY_PASSWORD},emptyCode:{message:P.EMPTY_CODE},signUpError:{message:P.SIGN_UP_ERROR},noMFA:{message:P.NO_MFA},invalidMFA:{message:P.INVALID_MFA},emptyChallengeResponse:{message:P.EMPTY_CHALLENGE},noUserSession:{message:P.NO_USER_SESSION},deviceConfig:{message:P.DEVICE_CONFIG},networkError:{message:P.NETWORK_ERROR},autoSignInError:{message:P.AUTOSIGNIN_ERROR},default:{message:P.DEFAULT_MSG}},V=(e,t)=>new N({message:e??"An error has occurred during the oauth process.",name:B.OAuthSignInError,recoverySuggestion:Ps.oauthSignInError.log});var be;(function(e){e.NoConfig="noConfig",e.MissingAuthConfig="missingAuthConfig",e.EmptyUsername="emptyUsername",e.InvalidUsername="invalidUsername",e.EmptyPassword="emptyPassword",e.EmptyCode="emptyCode",e.SignUpError="signUpError",e.NoMFA="noMFA",e.InvalidMFA="invalidMFA",e.EmptyChallengeResponse="emptyChallengeResponse",e.NoUserSession="noUserSession",e.Default="default",e.DeviceConfig="deviceConfig",e.NetworkError="networkError",e.AutoSignInError="autoSignInError",e.OAuthSignInError="oauthSignInError"})(be||(be={}));
2const Ns="`signInWithRedirect` has been canceled.",xs="An error occurred while validating the state.",vs="Try to initiate an OAuth flow from Amplify",cn=async e=>{const t=await M.loadOAuthState(),n=e===t?t:void 0;if(!n)throw new N({name:be.OAuthSignInError,message:e===null?Ns:xs,recoverySuggestion:e===null?void 0:vs});return n},dn=async({currentUrl:e,userAgentValue:t,clientId:n,redirectUri:o,responseType:s,domain:i,preferPrivateSession:r})=>{const a=new Te(e),c=a.searchParams.get("error"),d=a.searchParams.get("error_description");if(c)throw V(d??c);return s==="code"?_s({currentUrl:e,userAgentValue:t,clientId:n,redirectUri:o,domain:i,preferPrivateSession:r}):Fs({currentUrl:e,redirectUri:o,preferPrivateSession:r})},_s=async({currentUrl:e,userAgentValue:t,clientId:n,redirectUri:o,domain:s,preferPrivateSession:i})=>{const r=new Te(e),a=r.searchParams.get("code"),c=r.searchParams.get("state");if(!a||!c)throw V("User cancelled OAuth flow.");const d=await cn(c),l="https://"+s+"/oauth2/token",p=await M.loadPKCE(),E={grant_type:"authorization_code",code:a,client_id:n,redirect_uri:o,...p?{code_verifier:p}:{}},h=Object.entries(E).map(([me,_])=>`${encodeURIComponent(me)}=${encodeURIComponent(_)}`).join("&"),{access_token:m,refresh_token:g,id_token:S,error:f,error_message:v,token_type:W,expires_in:Fe}=await(await fetch(l,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",[Nn]:t},body:h})).json();if(f)throw V(v??f);const G=(m&&ye(m).payload.username)??"username";return await Be({username:G,AccessToken:m,IdToken:S,RefreshToken:g}),ln({redirectUri:o,state:d,preferPrivateSession:i})},Fs=async({currentUrl:e,redirectUri:t,preferPrivateSession:n})=>{const o=new Te(e),{id_token:s,access_token:i,state:r,token_type:a,expires_in:c,error_description:d,error:l}=(o.hash??"#").substring(1).split("&").map(h=>h.split("=")).reduce((h,[m,g])=>({...h,[m]:g}),{id_token:void 0,access_token:void 0,state:void 0,token_type:void 0,expires_in:void 0,error_description:void 0,error:void 0});if(l)throw V(d??l);if(!i)throw V("No access token returned from OAuth flow.");const p=await cn(r),E=(i&&ye(i).payload.username)??"username";return await Be({username:E,AccessToken:i,IdToken:s}),ln({redirectUri:t,state:p,preferPrivateSession:n})},ln=async({redirectUri:e,state:t,preferPrivateSession:n})=>{await Y.setOAuthMetadata({oauthSignIn:!0}),await M.clearOAuthData(),await M.storeOAuthSignIn(!0,n),Xt(),Us(e),Os(t)&&ne.dispatch("auth",{event:"customOAuthState",data:Ln(Ms(t))},"Auth",oe),ne.dispatch("auth",{event:"signInWithRedirect"},"Auth",oe),await nn()},Os=e=>/-/.test(e),Ms=e=>e.split("-").splice(1).join("-"),Us=e=>{typeof window<"u"&&typeof window.history<"u"&&window.history.replaceState(window.history.state,"",e)};function je(e,t){if(t){const n=e?.find(o=>o===t);if(!n)throw _n;return n}else{const n=e?.find(Ds)??e?.find(bs),o=e?.find(ks)??e?.find(Ls);if(n)return n;throw o?xn:vn}}const Ds=e=>e.startsWith(String(window.location.origin+(window.location.pathname||"/"))),bs=e=>e.includes(String(window.location.hostname)),Ls=e=>e.startsWith("http://"),ks=e=>e.startsWith("https://"),Je=async e=>{Xt(),await M.clearOAuthInflightData(),ne.dispatch("auth",{event:"signInWithRedirect_failure",data:{error:e}},"Auth",oe)},Hs=async e=>{try{J(e),Pe(e),M.setAuthConfig(e)}catch{return}if(await M.loadOAuthInFlight())try{const t=window.location.href,{loginWith:n,userPoolClientId:o}=e,{domain:s,redirectSignIn:i,responseType:r}=n.oauth,a=je(i);await dn({currentUrl:t,clientId:o,domain:s,redirectUri:a,responseType:r,userAgentValue:w(C.SignInWithRedirect)})}catch(t){await Je(t)}};ke()&&j[Fn](Hs);const Bs={Google:"Google",Facebook:"Facebook",Amazon:"LoginWithAmazon",Apple:"SignInWithApple"},un=async e=>{window?.location&&(window.location.href=e.replace("http://","https://"))},kt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",qs=e=>{const t=new Uint8Array(e);Le().getRandomValues(t);let n="",o;for(const s of t)n+=kt.charAt(s%kt.length);return{value:n,method:"S256",toCodeChallenge(){return o||(o=Ws(n),o)}}};function Ws(e){const t=new pe;return t.update(e),$s(se.convert(t.digestSync(),{urlSafe:!0}))}function $s(e){return e.replace(/=/g,"")}const Ks=()=>bn(32),zs=e=>{async function t(n){if(n.persisted&&await e.loadOAuthInFlight()){const s=V("User cancelled OAuth flow.");await Je(s)}window.removeEventListener("pageshow",t)}window.addEventListener("pageshow",t)};async function Ht(e){const t=j.getConfig().Auth?.Cognito;J(t),Pe(t),M.setAuthConfig(t),e?.options?.prompt||await ws();
2let n="COGNITO",o;return typeof e?.provider=="string"?n=Bs[e.provider]:e?.provider?.custom?n=e.provider.custom:e?.provider?.idpIdentifier&&({idpIdentifier:o}=e.provider),Vs({oauthConfig:t.loginWith.oauth,clientId:t.userPoolClientId,provider:n,idpIdentifier:o,customState:e?.customState,preferPrivateSession:e?.options?.preferPrivateSession,options:{loginHint:e?.options?.loginHint,lang:e?.options?.lang,nonce:e?.options?.nonce,prompt:e?.options?.prompt},authSessionOpener:e?.options?.authSessionOpener})}const Vs=async({oauthConfig:e,provider:t,idpIdentifier:n,clientId:o,customState:s,preferPrivateSession:i,options:r,authSessionOpener:a})=>{const{domain:c,redirectSignIn:d,responseType:l,scopes:p}=e,{loginHint:E,lang:h,nonce:m,prompt:g}=r??{},S=Ks(),f=a||un,v=s?`${S}-${kn(s)}`:S,{value:W,method:Fe,toCodeChallenge:G}=qs(128),me=je(e.redirectSignIn);ke()&&M.storeOAuthInFlight(!0),M.storeOAuthState(v),M.storePKCE(W);const _=new URLSearchParams([["redirect_uri",me],["response_type",l],["client_id",o]]);n?_.append("idp_identifier",n):_.append("identity_provider",t),_.append("scope",p.join(" ")),E&&_.append("login_hint",E),h&&_.append("lang",h),m&&_.append("nonce",m),g&&_.append("prompt",g.toLowerCase()),_.append("state",v),l==="code"&&(_.append("code_challenge",G()),_.append("code_challenge_method",Fe));const Sn=`https://${c}
2/oauth2/authorize?${_.toString()}`;zs(M);const{type:ge,error:In,url:st}=await f(Sn,d,i)??{};try{if(ge==="error")throw V(String(In));if(ge==="canceled")throw V(String(ge));ge==="success"&&st&&await dn({currentUrl:st,clientId:o,domain:c,redirectUri:me,responseType:l,userAgentValue:w(C.SignInWithRedirect),preferPrivateSession:i})}catch(it){throw await Je(it),it}},Gs=async e=>{await e.clearOAuthData(),Y.clearTokens(),await en(),ne.dispatch("auth",{event:"signedOut"},"Auth",oe)},Ys=async(e,t=!1,n)=>{Pe(e);const{loginWith:o,userPoolClientId:s}=e,{domain:i,redirectSignOut:r}=o.oauth,a=je(r,n),c=`https://${i}/logout?${Object.entries({client_id:s,logout_uri:encodeURIComponent(a)}).map(([d,l])=>`${d}=${l}`).join("&")}`;return un(c)},js=async(e,t,n,o)=>{const{isOAuthSignIn:s}=await t.loadOAuthSignIn(),i=await n.getOAuthMetadata();if(await Gs(t),s||i?.oauthSignIn)return Ys(e,!1,o)},Js=e=>X(te,ee("RevokeToken"),Q(),{...Z,...e}),Xs=e=>X(te,ee("GlobalSignOut"),Q(),{...Z,...e}),pn=new Jt("Auth");async function Zs(e){const t=j.getConfig().Auth?.Cognito;J(t),e?.global?await ei(t):await Qs(t);let n;try{Pe(t),n=!0}catch{n=!1}if(n){const o=new On(Zt);o.setAuthConfig(t);const{type:s}=await js(t,o,Y,e?.oauth?.redirectUrl)??{};if(s==="error")throw new N({name:Mn,message:"An error occurred when attempting to log out from OAuth provider."})}else Y.clearTokens(),await en(),ne.dispatch("auth",{event:"signedOut"},"Auth",oe)}async function Qs(e){try{const{userPoolEndpoint:t,userPoolId:n,userPoolClientId:o}=e,s=await Y.getTokenStore().loadTokens();Un(s),ti(s.accessToken)&&await Js({endpointResolver:I({endpointOverride:t})})({region:R(n),userAgentValue:w(C.SignOut)},{ClientId:o,Token:s.refreshToken})}catch{pn.debug("Client signOut error caught but will proceed with token removal")}}async function ei(e){try{const{userPoolEndpoint:t,userPoolId:n}=e,o=await Y.getTokenStore().loadTokens();Vt(o),await Xs({endpointResolver:I({endpointOverride:t})})({region:R(n),userAgentValue:w(C.SignOut)},{AccessToken:o.accessToken.toString()})}catch{pn.debug("Global signOut error caught but will proceed with token removal")}}const ti=e=>!!e?.payload?.origin_jti,ni="https://cloudmysite.ai",Bt="/login";function Xe(){return typeof window<"u"}function oi(e){const t=String(e||Bt).trim();return!t.startsWith("/")||t.startsWith("//")?Bt:t}function si(){return Xe()?window.location.origin:ni}function En(){return Xe()?window.location.hostname:"cloudmysite.ai"}function hn(){const e=En();return e==="cloudmysite.com"||e==="newsletter.cloudmysite.com"||e==="cloudmysite.ai"}function Mi(e){const t=En(),n=si(),o=oi(e?.redirectPath),s=`${n}${o}`;if(Xe()){const i=t==="cloudmysite.com"||t==="newsletter.cloudmysite.com",r=t==="cloudmysite.ai";Dn.setKeyValueStorage(i?new rt({domain:".cloudmysite.com",path:"/",expires:1,sameSite:"lax",secure:!0}):r?new rt({domain:".cloudmysite.ai",path:"/",expires:1,sameSite:"lax",secure:!0}):Zt)}return Qt.configure({...K,auth:{...K.auth,oauth:{...K.auth.oauth,redirect_sign_in_uri:[s],redirect_sign_out_uri:[`${n}/`]}}}),{origin:n,redirectSignInUri:s}}const Ze="cms_hosted_signin_in_progress",ii="cms_hosted_sso_attempted",ri=30*1e3,$="cms_hosted_sso_suppressed_until",ai=10*60*1e3,ci=["amplify","cognitoidentityserviceprovider"],di=["accessToken","idToken","refreshToken","clockDrift","signInDetails","deviceKey","deviceGroupKey","randomPasswordKey"];function T(){return typeof window<"u"}function Qe(e){const t=String(e||(T()?window.location.pathname:"default")).trim()||"default";return`${ii}:${t}`}function li(e){const t=String(e).trim();return!t.startsWith("/")||t.startsWith("//")?"/":t}function ui(e){return`${T()?window.location.origin:"https://cloudmysite.ai"}${li(e)}`}function pi(e){try{const t=Qt.getConfig().Auth?.Cognito,n=t?.loginWith?.oauth?.domain||K.auth.oauth.domain,o=t?.userPoolClientId||K.auth.user_pool_client_id;if(!n||!o)return null;const s=new URL(`https://${n}/logout`);return s.searchParams.set("client_id",o),s.searchParams.set("logout_uri",e),s.toString()}catch{return null}}function mn(e){const t=e.toLowerCase(),n=K.auth.user_pool_client_id.toLowerCase(),o=K.auth.user_pool_id.toLowerCase();return ci.some(s=>t.includes(s))||t.includes(n)||t.includes(o)}function qt(e){if(!e)return;Array.from({length:e.length},(n,o)=>
2e.key(o)).filter(Boolean).forEach(n=>{mn(n)&&e.removeItem(n)})}function Wt(){if(!T())return[];const e=window.location.hostname,t=e.split(".").filter(Boolean),n=new Set(["",e,`.${e}`]);return t.length>=2&&n.add(`.${t.slice(-2).join(".")}`),Array.from(n)}function $t(e,t){const n=e.trim();if(!n)return;const o=t?`; domain=${t}`:"";document.cookie=`${n}=; Max-Age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/${o}; SameSite=Lax; Secure`}function Ei(e){if(!T())return null;const t=`${e}=`,n=document.cookie.split(";").map(o=>o.trim()).find(o=>o.startsWith(t));return n?decodeURIComponent(n.slice(t.length)):null}function hi(){if(!T())return[];const e=K.auth.user_pool_client_id,t=`CognitoIdentityServiceProvider.${e}.LastAuthUser`,n=window.localStorage.getItem(t)||window.sessionStorage.getItem(t)||Ei(t),o=new Set([t]);return n&&di.forEach(s=>{o.add(`CognitoIdentityServiceProvider.${e}.${n}.${s}`)}),Array.from(o)}function Kt(e){if(!T())return;const t=hi();t.forEach(n=>{window.localStorage.removeItem(n),window.sessionStorage.removeItem(n)}),qt(window.localStorage),qt(window.sessionStorage),document.cookie.split(";").map(n=>n.split("=")[0]?.trim()).filter(n=>!!n&&(e?.includeAllReadableCookies||mn(n))).forEach(n=>{Wt().forEach(o=>$t(n,o))}),t.forEach(n=>{Wt().forEach(o=>$t(n,o))})}function gn(e){if(!T()&&typeof e!="string")return!1;const t=new URLSearchParams(typeof e=="string"?e:window.location.search);return t.has("code")&&t.has("state")||t.has("error")||t.has("error_description")}function Ui(e){if(!T()&&typeof e!="string")return!1;const t=new URLSearchParams(typeof e=="string"?e:window.location.search);return t.has("error")||t.has("error_description")}function mi(){return T()&&window.sessionStorage.getItem(Ze)==="1"}function Di(){T()&&window.sessionStorage.setItem(Ze,"1")}function gi(){T()&&window.sessionStorage.removeItem(Ze)}function bi(e){T()&&window.sessionStorage.setItem(Qe(e),String(Date.now()))}function fi(e){T()&&window.sessionStorage.removeItem(Qe(e))}function zt(){if(!T())return;const e=String(Date.now()+ai);window.sessionStorage.setItem($,e),window.localStorage.setItem($,e)}function Si(){if(!T())return!1;const e=Number(window.sessionStorage.getItem($)||window.localStorage.getItem($)||"0");return!Number.isFinite(e)||e<=0?!1:Date.now()<=e?!0:(window.sessionStorage.removeItem($),window.localStorage.removeItem($),!1)}function Li(){T()&&(window.sessionStorage.removeItem($),window.localStorage.removeItem($))}function ki(e,t){if(!T()||!hn()||gn()||mi()||!t?.ignoreSuppression&&Si())return!1;const n=Number(window.sessionStorage.getItem(Qe(e))||"0");return!Number.isFinite(n)||n<=0?!0:Date.now()-n>ri}function Hi(){if(!T()||!gn())return;const e=new URL(window.location.href);["code","state","error","error_description"].forEach(n=>{e.searchParams.delete(n)});const t=`${e.pathname}${e.search}${e.hash}`;window.history.replaceState(window.history.state,document.title,t)}async function Bi(e,t){const n=t?.silent?{prompt:"NONE"}:void 0;if(e==="Google"){await Ht({provider:"Google",options:n});return}await Ht(n?{options:n}:void 0)}async function qi(e){const t=ui(e?.redirectPath),n=pi(t);if(zt(),gi(),fi(),Kt({includeAllReadableCookies:!0}),!T())return!1;if(hn())return window.location.assign(n||t),!0;try{await Zs({global:!0,oauth:{redirectUrl:t}})}catch(o){console.error("Hosted sign-out failed:",o)}return zt(),Kt({includeAllReadableCookies:!0}),window.location.assign(t),!1}const et="auth:returnTo",tt="auth:pendingChatPrompt",nt="auth:pendingChatPromptAuthFlow",_e="auth:pendingChatPromptReady",ot="auth:redirectIntent",Ii=10*60*1e3,Ri=10*60*1e3;function O(){return typeof window<"u"}function de(e){const t=String(e||"").trim();return!t.startsWith("/")||t.startsWith("//")?null:t}function Wi(){return O()?`${window.location.pathname}${window.location.search}${window.location.hash}`:"/"}function $i(e){if(!O())return;const t=de(e);t&&(window.sessionStorage.setItem(et,t),Ai(t))}function Ki(){return O()?de(window.sessionStorage.getItem(et)):null}function zi(){O()&&(window.sessionStorage.removeItem(et),Ae())}function Ai(e,t=Date.now()){if(!O())return;const n=de(e);!n||!Number.isFinite(t)||t<=0||window.sessionStorage.setItem(ot,JSON.stringify({returnTo:n,timestamp:t}))}function Vi(e=Ii){if(!O())return null;const t=window.sessionStorage.getItem(ot);if(!t)return null;try{const n=JSON.parse(t),o=de(n.returnTo),s=Number(n.timestamp||0);return!o||!Number.isFinite(s)||s<=0||e>0&&Date.now()-s>e?(Ae(),null):{returnTo:o,timestamp:s}}catch{return Ae(),null}}function Ae(){O()&&window.sessionStorage.removeItem(ot)}function Gi(e){if(!O())return;const t=de(e.route),n=String(e.prompt||"").trim();!t||!n||(window.sessionStorage.setItem(tt,JSON.stringify({route:t,prompt:n,timestamp:e.timestamp})),window.sessionStorage.setItem(nt,String(e.timestamp)),window.sessionStorage.removeItem(_e))}function yi(e,t){const n=Number(window.sessionStorage.getItem(nt)||0);return!Number.isFinite(n)||n<=0||n!==e?!1:t<=0||Date.now()-n<=t}function fn(e=Ri){if(!O())return null;const t=window.sessionStorage.getItem(tt);if(!t)return null;try{const n=JSON.parse(t),o=de(n.route),s=String(n.prompt||"").trim(),i=Number(n.timestamp||0);return!o||!s||!Number.isFinite(i)||i<=0||e>0&&Date.now()-i>e||!yi(i,e)?(ue(),null):{route:o,prompt:s,timestamp:i}}catch{return ue(),null}}function Yi(){O()&&fn()&&window.sessionStorage.setItem(_e,"1")}function Ci(){return O()?window.sessionStorage.getItem(_e)==="1":!1}function ji(){if(!O()||!Ci())return null;const e=fn();return ue(),e}function ue(){O()&&(window.sessionStorage.removeItem(tt),window.sessionStorage.removeItem(nt),window.sessionStorage.removeItem(_e))}export{Bi as $,y as A,Ti as B,nn as C,fs as D,_i as E,vi as F,Ni as G,Pi as H,D as I,cs as J,Ne as K,w as L,ce as M,ws as N,Wn as O,q as P,B as Q,Fi as R,wt as S,Ht as T,Zs as U,gn as V,Ui as W,mi as X,ki as Y,bi as Z,Di as _,zi as a,Hi as a0,de as a1,Ki as a2,Vi as b,Mi as c,Li as d,fi as e,gi as f,tn as g,Si as h,hn as i,Kt as j,ue as k,Wi as l,Yi as m,Gi as n,Ci as o,ji as p,$n as q,fn as r,qi as s,ve as t,xi as u,Oi as v,$i as w,eo as x,Be as y,ns as z};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.