1(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`f764f49567e6b0ecf4d75f5cc38e95bb992eec2e`};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`322912f3-a985-4ffa-9457-951c4ae19976`,e._sentryDebugIdIdentifier=`sentry-dbid-322912f3-a985-4ffa-9457-951c4ae19976`)}catch{}})();import{a as e,o as t}from"./5pVCgjj7.js";import{a as n,r}from"./NBzTq55f.js";import{o as i}from"./CsmHvC2J.js";var a={buyNowEnterEmail:`buyNowEnterEmail`,buyNowLinkSent:`buyNowLinkSent`,buyNowEnterPassword:`buyNowEnterPassword`,changeEmailEnterEmail:`changeEmailEnterEmail`,changeEmailLinkSent:`changeEmailLinkSent`,deleteAccount:`deleteAccount`,deleteAccountLinkSent:`deleteAccountLinkSent`,forgotPasswordEnterEmail:`forgotPasswordEnterEmail`,forgotPasswordLinkSent:`forgotPasswordLinkSent`,forgotPasswordEnterPassword:`forgotPasswordEnterPassword`,loginEnterEmail:`loginEnterEmail`,loginEnterPassword:`loginEnterPassword`,loginLinkSent:`loginLinkSent`,loginLinkVerified:`loginLinkVerified`,registerEnterEmail:`registerEnterEmail`,registerLinkSent:`registerLinkSent`,registerLinkVerified:`registerLinkVerified`},o=n(`login`,{state:()=>({credentials:{email:null,passcode_validate:null,password:null},loginError:null,loginView:a.loginEnterEmail,promoCode:null}),actions:{async getPromoCode(t){if(t)try{let{$api:n}=e(),r=`/meta/promo-codes/${t}`,{promo_code:i}=await n.get(r);this.setPromoCode(i)}catch{}},async getRecaptchaToken(){let{recaptchaPublicKey:e}=t().public;return new Promise((t,n)=>{window.grecaptcha.ready(()=>{try{window.grecaptcha.execute(e,{action:`submit`}).then(e=>t(e))}catch(e){n(e||Error(`Unknown error getting recaptcha token`))}})})},async makeLoginLinkRequest(t={}){let{$api:n}=e(),{request_passcode_only:r=!1,return_to:i}=t,{email:a}=this.credentials,o={email:a,request_passcode:!0,request_passcode_only:r,return_to:i},s=await n.post(`/user/login/link/request`,void 0,o);if(s.passcode_sent){let{passcode_validate:e}=s;this.setCredentials({passcode_validate:e})}return s.link_sent},async makeLoginRequest(t={}){let{$api:n}=e(),{return_to:r}=t,{email:i,password:o}=this.credentials,s={email:i,password:o,request_passcode:!0,return_to:r};this.promoCode?.is_usable&&(s.promo_code=this.promoCode.code);let{link_sent:c,messages:l,passcode_sent:u,passcode_validate:d,promo_code:f,user:p,user_has_password:m}=await n.post(`/user/login`,void 0,s);return c?(this.setLoginView(a.loginLinkSent),u&&this.setCredentials({passcode_validate:d})):m&&this.setLoginView(a.loginEnterPassword),{messages:l,promo_code:f,user:p}},async makeLoginPasscodeRequest(t={}){let{$api:n}=e(),{passcode:r}=t,{email:i,passcode_validate:a}=this.credentials,o={email:i,passcode:r,passcode_validate:a};return this.promoCode?.is_usable&&(o.promo_code=this.promoCode.code),await n.post(`/user/login/passcode`,void 0,o)},async makeLogoutRequest(){let{$api:t}=e();return r.clear(),t.post(`/user/logout`)},async makePasswordLinkRequest(t={}){let{$api:n}=e(),r=await this.getRecaptchaToken(),{return_to:i}=t,{email:o}=this.credentials,s={email:o,recaptcha_token:r,return_to:i},{link_sent:c}=await n.post(`/user/settings/password/link/request`,void 0,s);return c&&this.setLoginView(a.forgotPasswordLinkSent),c},async makeSettingsDeleteLinkRequest(){let{$api:t}=e(),{link_sent:n}=await t.post(`/user/settings/delete/link/request`);return n&&this.setLoginView(a.deleteAccountLinkSent),n},async makeSettingsEmailLinkRequest(){let{$api:t}=e(),{email:n}=this.credentials,r={email:n},{link_sent:i}=await t.post(`/user/settings/email/link/request`,void 0,r);return i&&this.setLoginView(a.changeEmailLinkSent),i},async makeSettingsPasswordLinkVerifyRequest(t){let{$api:n}=e(),{password:r}=this.credentials,i={password:r,payload:t};return(await n.post(`/user/settings/password/link/verify`,void 0,i)).user},async makeRegisterLinkRequest(t={}){let{$api:n}=e(),r=await this.getRecaptchaToken(),{request_passcode_only:i=!1,return_to:o,trial_requested:s=!0}=t,{email:c}=this.credentials,l={email:c,recaptcha_token:r,return_to:o,request_passcode:!0,request_passcode_only:i,trial_requested:s};this.promoCode?.is_usable&&(l.promo_code=this.promoCode.code);let u=await n.post(`/user/register/link/request`,void 0,l),{link_sent:d,passcode_sent:f}=u;if(d){if(f){let{passcode_validate:e}=u;this.setCredentials({passcode_validate:e})}this.loginView===a.buyNowEnterEmail?this.setLoginView(a.buyNowLinkSent):this.loginView===a.registerEnterEmail&&this.setLoginView(a.registerLinkSent)}return d}
1,async makeRegisterPasscodeRequest(t={}){let{$api:n}=e(),{passcode:r,trial_requested:a=!0}=t,{email:o,passcode_validate:s}=this.credentials,c={email:o,passcode:r,passcode_validate:s,trial_requested:a};this.promoCode?.is_usable&&(c.promo_code=this.promoCode.code);let l=await n.post(`/user/register/passcode`,void 0,c);return i(l),l},async makeBuyNowLinkRequest(e={}){let{userExists:t=!1,hasPassword:n=!1,linkRequested:r=!1}=e,i={linkSent:!1,linkRequested:r};return t&&n&&!r?(this.setLoginView(a.buyNowEnterPassword),i):(i.linkRequested=!0,i.linkSent=await(t?this.makeLoginLinkRequest({request_passcode_only:!0}):this.makeRegisterLinkRequest({trial_requested:!1,request_passcode_only:!0})),i.linkSent&&this.setLoginView(a.buyNowLinkSent),i)},makeRegisterCheckRequest(){let{$api:t}=e(),{email:n}=this.credentials;return t.get(`/user/register/check`,{email:n})},setLoginView(e){Object.keys(a).includes(e)&&(this.loginView=e)},setCredentials(e={}){let{email:t,passcode_validate:n,password:r}=e;t!==void 0&&(this.credentials.email=t),n!==void 0&&(this.credentials.passcode_validate=n),r!==void 0&&(this.credentials.password=r)},setLoginError(e){this.loginError=e},setPromoCode(e){this.promoCode=e}}});export{o as n,a as t}; 2//# sourceMappingURL=Deo1dljX2.js.map
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.