1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,732903,395288,e=>{"use strict";var t=e.i(115497),r=e.i(360685),n=(0,r.createRuntimeFn)({defaultClassName:"yap3hi0",variantClassNames:{type:{negative:"yap3hi1"},size:{large:"yap3hi2"}},defaultVariants:{},compoundVariants:[]}),i=(0,r.createRuntimeFn)({defaultClassName:"yap3hi4",variantClassNames:{size:{large:"yap3hi5"}},defaultVariants:{},compoundVariants:[]}),o=e.i(712584),a=e.i(600343);let s={src:e.i(565931).default,width:9,height:9,blurWidth:0,blurHeight:0};var l=e.i(892419);let d={negative:o.faTimesCircle};e.s(["Banner25",0,({type:e,message:r,onClose:o,size:u,dismissable:c=!1,button:h=!1})=>(0,t.jsxs)("div",{className:n({type:e,size:u}),children:[(0,t.jsx)(a.FontAwesomeIcon,{className:"yap3hi3",icon:d[e]}),(0,t.jsx)("span",{className:i({size:u}),children:r}),c&&(0,t.jsx)("button",{className:"yap3hi6",onClick:o,children:(0,t.jsx)(l.default,{src:s,alt:"Close"})})]})],732903);var u=e.i(650394);class c extends u.Component{componentDidCatch(e,t){this.props.onError(e,t)}render(){return this.props.children}}e.s(["CallbackErrorBoundary",0,c],395288)},661883,e=>{e.v({"email-verify":"EmailVerify-module-scss-module__lBDF7W__email-verify","resend-button":"EmailVerify-module-scss-module__lBDF7W__resend-button","resend-container":"EmailVerify-module-scss-module__lBDF7W__resend-container","resend-text":"EmailVerify-module-scss-module__lBDF7W__resend-text"})},978135,e=>{"use strict";e.s(["default",()=>s]);var t=e.i(115497),r=e.i(755317),n=e.i(132810),i=e.i(307894),o=e.i(650394),a=e.i(661883);function s({email:e,onVerified:l,initialEmailId:d}){let[u,c]=(0,o.useState)(d),[h,p]=(0,o.useState)(""),[m,g]=(0,o.useState)(""),[f,_]=(0,o.useState)(!1),w=(0,o.useRef)(!1),y=(0,o.useRef)(!1),v=(0,o.useCallback)(async()=>{_(!0),g(""),p("");try{let t=await (0,i.getToken)();if(!t)return void g("Could not authenticate your session. Refresh the page and try again.");let r=await fetch(`${n.NEXT_PUBLIC_AUTH_API_BASE_URL}/email/link`,{method:"POST",headers:{authorization:`Bearer ${t}`,"content-type":"application/json"},body:JSON.stringify({email:e})}),o=r.ok?function(e){if("object"==typeof e&&null!==e&&"email_id"in e){let{email_id:t}=e;if("string"==typeof t)return t}}(await r.json()):void 0;if(!o)return void g("Could not send a code. Try again.");c(o)}catch{g("Could not send a code. Try again.")}finally{_(!1)}},[e]),b=(0,o.useCallback)(async e=>{if(u&&!y.current){y.current=!0,_(!0),g("");try{let t=await (0,i.getToken)();if(!t)return void g("Could not authenticate your session. Refresh the page and try again.");let r=await fetch(`${n.NEXT_PUBLIC_AUTH_API_BASE_URL}/email/link/verify`,{method:"POST",headers:{authorization:`Bearer ${t}`,"content-type":"application/json"},body:JSON.stringify({email_id:u,code:e})});if(r.ok)return void l();g(400===r.status||401===r.status?"That code didnât work. Check it and try again.":"Something went wrong. Try again.")}catch{g("Something went wrong. Try again.")}finally{y.current=!1,_(!1)}}},[u,l]);return(0,o.useEffect)(()=>{!w.current&&(w.current=!0,d||v())},[v,d]),(0,t.jsxs)("div",{className:a.default["email-verify"],children:[(0,t.jsx)(r.EmailOtpPinInput,{error:m,value:h,onChange:e=>{g(""),p(e),6!==e.length||f||b(e)}}),(0,t.jsx)("div",{className:a.default["resend-container"],children:(0,t.jsxs)("p",{className:a.default["resend-text"],children:["Didn't receive a code?"," ",(0,t.jsx)("button",{type:"button",className:a.default["resend-button"],disabled:f,onClick:()=>void v(),children:"Resend code"})]})})]})}},791131,(e,t,r)=>{"use strict";var n,i=e.e&&e.e.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=e.e&&e.e.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})},a=e.e&&e.e.__generator||function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){var d=[s,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,d[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&d[0]?n.return:d[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,d[1])).done)return i;switch(n=0,i&&(d=[2&d[0],i.value]),d[0]){case 0:case 1:i=d;break;case 4:return a.label++,{value:d[1],done:!1};case 5:a.label++,n=d[1],d=[0];continue;case 7:d=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===d[0]||2===d[0])){a=0;continue}if(3===d[0]&&(!i||d[1]>i[0]&&d[1]<i[3])){a.label=d[1];break}if(6===d[0]&&a.label<i[1]){a.label=i[1],i=d;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(d);break}i[2]&&a.ops.pop(),a.trys.pop();continue}d=t.call(e,a)}catch(e){d=[6,e],n=0}finally{r=i=0}if(5&d[0])throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}};
1Object.defineProperty(r,"__esModule",{value:!0}),r.BreachedError=r.InvalidPasswordError=r.TimedOutError=r.UnexpectedHttpResponseError=void 0;var s=function(e){function t(t){var r=e.call(this,"IsPwned received an unexpected HTTP response: ".concat(t))||this;return r.name="UnexpectedHttpResponseError",r}return i(t,e),t}(Error);r.UnexpectedHttpResponseError=s;var l=function(e){function t(){var t=e.call(this,"IsPwned timed out while making request.")||this;return t.name="TimedOutError",t}return i(t,e),t}(Error);r.TimedOutError=l;var d=function(e){function t(){var t=e.call(this,"IsPwned received an invalid or empty password.")||this;return t.name="InvalidPasswordError",t}return i(t,e),t}(Error);r.InvalidPasswordError=d;var u=function(e){function t(t){var r=e.call(this,"This password has been detected in a known breach.")||this;return r.name="BreachedError",r.count=t,r}return i(t,e),t}(Error);r.BreachedError=u;var c=function(e,t){return e<<t|e>>>32-t},h=function(e){for(var t="",r=7;r>=0;r--)t+=(e>>>4*r&15).toString(16);return t},p=function(e){var t="";e=e.replace(/\r\n/g,"\n");for(var r=0;r<e.length;r++){var n=e.charCodeAt(r);n<128?t+=String.fromCharCode(n):(n>127&&n<2048?t+=String.fromCharCode(n>>6|192):(t+=String.fromCharCode(n>>12|224),t+=String.fromCharCode(n>>6&63|128)),t+=String.fromCharCode(63&n|128))}return t},m=function(e){for(var t,r,n,i,o,a,s=Array(80),l=0x67452301,d=0xefcdab89,u=0x98badcfe,m=0x10325476,g=0xc3d2e1f0,f=p(e),_=[],w=0;w<f.length-3;w+=4)_.push(f.charCodeAt(w)<<24|f.charCodeAt(w+1)<<16|f.charCodeAt(w+2)<<8|f.charCodeAt(w+3));for(_.push(function(){switch(f.length%4){case 0:return 0x80000000;case 1:return f.charCodeAt(f.length-1)<<24|8388608;case 2:return f.charCodeAt(f.length-2)<<24|f.charCodeAt(f.length-1)<<16|32768;case 3:return f.charCodeAt(f.length-3)<<24|f.charCodeAt(f.length-2)<<16|f.charCodeAt(f.length-1)<<8|128}}());_.length%16!=14;)_.push(0);_.push(f.length>>>29),_.push(f.length<<3);for(var w=0;w<_.length;w+=16){for(var y=0;y<16;y++)s[y]=_[w+y];for(var y=16;y<=79;y++)s[y]=c(s[y-3]^s[y-8]^s[y-14]^s[y-16],1);t=l,r=d,n=u,i=m,o=g;for(var y=0;y<=19;y++)a=c(t,5)+(r&n|~r&i)+o+s[y]+0x5a827999|0,o=i,i=n,n=c(r,30),r=t,t=a;for(var y=20;y<=39;y++)a=c(t,5)+(r^n^i)+o+s[y]+0x6ed9eba1|0,o=i,i=n,n=c(r,30),r=t,t=a;for(var y=40;y<=59;y++)a=c(t,5)+(r&n|r&i|n&i)+o+s[y]+0x8f1bbcdc|0,o=i,i=n,n=c(r,30),r=t,t=a;for(var y=60;y<=79;y++)a=c(t,5)+(r^n^i)+o+s[y]+0xca62c1d6|0,o=i,i=n,n=c(r,30),r=t,t=a;l=l+t|0,d=d+r|0,u=u+n|0,m=m+i|0,g=g+o|0}return(h(l)+h(d)+h(u)+h(m)+h(g)).toUpperCase()};r.default=function(){function e(e){if(void 0===e&&(e={}),"u"<typeof window)throw Error("IsPwned is meant for use in the browser only.");this.endpoint=e.endpoint||"https://api.pwnedpasswords.com/range/",this.userAgent=e.userAgent||"is-pwned-js",this.timeout=e.timeout||5e3,this.resolveOnTimeout=e.resolveOnTimeout||!1}return e.prototype.hashPassword=function(e){if(!e||"string"!=typeof e)throw new d;return m(e)},e.prototype.check=function(e){return o(this,void 0,void 0,function(){var t,r,n,i;return a(this,function(o){switch(o.label){case 0:return r=(t=this.hashPassword(e)).substring(0,5),n=t.substring(5),[4,this.makeRequest(r)];case 1:if((i=o.sent().split("\n").filter(function(e){return e.indexOf(n)>-1})).length>0)throw new u(i.map(function(e){return parseInt(e.split(":")[1])}).reduce(function(e,t){return e+t}));return[2,!0]}})})},e.prototype.makeRequest=function(e){return o(this,void 0,void 0,function(){var t,r,n,i=this;return a(this,function(o){switch(o.label){case 0:return t="u">typeof AbortController?new AbortController:void 0,r=setTimeout(function(){if(t&&t.abort(),i.resolveOnTimeout)return Promise.resolve();throw new l},this.timeout),[4,fetch(this.endpoint+e,{signal:t?t.signal:void 0,headers:{"User-Agent":this.userAgent}})];case 1:if(n=o.sent(),clearTimeout(r),200===n.status)return[2,n.text()];throw new s(n.statusText)}})})},e}()},245954,e=>{e.v({"button-content":"SSOLoginButton-module-scss-module__LU5qIW__button-content",logo:"SSOLoginButton-module-scss-module__LU5qIW__logo","precedence-hack":"SSOLoginButton-module-scss-module__LU5qIW__precedence-hack","
1sso-login-button":"SSOLoginButton-module-scss-module__LU5qIW__sso-login-button",text:"SSOLoginButton-module-scss-module__LU5qIW__text"})},827801,e=>{e.v({container:"LoginForm-module-scss-module__gUDqCG__container","email-input-container":"LoginForm-module-scss-module__gUDqCG__email-input-container","email-login-container":"LoginForm-module-scss-module__gUDqCG__email-login-container","email-otp-login-container":"LoginForm-module-scss-module__gUDqCG__email-otp-login-container","email-otp-login-text":"LoginForm-module-scss-module__gUDqCG__email-otp-login-text","email-otp-pin-input":"LoginForm-module-scss-module__gUDqCG__email-otp-pin-input","email-otp-pin-input-container":"LoginForm-module-scss-module__gUDqCG__email-otp-pin-input-container","email-otp-pin-input-error":"LoginForm-module-scss-module__gUDqCG__email-otp-pin-input-error","email-otp-resend-code-button":"LoginForm-module-scss-module__gUDqCG__email-otp-resend-code-button","email-otp-resend-code-container":"LoginForm-module-scss-module__gUDqCG__email-otp-resend-code-container","email-otp-resend-code-text":"LoginForm-module-scss-module__gUDqCG__email-
1otp-resend-code-text","email-reset-password-container":"LoginForm-module-scss-module__gUDqCG__email-reset-password-container","error-message-container":"LoginForm-module-scss-module__gUDqCG__error-message-container",explainer:"LoginForm-module-scss-module__gUDqCG__explainer","form-btns-container":"LoginForm-module-scss-module__gUDqCG__form-btns-container",hr:"LoginForm-module-scss-module__gUDqCG__hr",loader:"LoginForm-module-scss-module__gUDqCG__loader","login-form":"LoginForm-module-scss-module__gUDqCG__login-form","main-btn-container":"LoginForm-module-scss-module__gUDqCG__main-btn-container","password-login-container":"LoginForm-module-scss-module__gUDqCG__password-login-container","password-visibility-toggle":"LoginForm-module-scss-module__gUDqCG__password-visibility-toggle","possible-causes":"LoginForm-module-scss-module__gUDqCG__possible-causes","secondary-btn":"LoginForm-module-scss-module__gUDqCG__secondary-btn","secondary-btn-container":"LoginForm-module-scss-module__gUDqCG__secondary-btn-container","sent-reset-email-message":"LoginForm-module-scss-module__gUDqCG__sent-reset-email-message",seperator:"LoginForm-module-scss-module__gUDqCG__seperator","small-heading":"LoginForm-module-scss-module__gUDqCG__small-heading","success-tick-container":"LoginForm-module-scss-module__gUDqCG__success-tick-container","trouble-btns-container":"LoginForm-module-scss-module__gUDqCG__trouble-btns-container"})},755317,342687,e=>{"use strict";e.s(["EmailOtpPinInput",()=>e_,"LoginForm",()=>ef],755317);var t,r=e.i(115497),n=e.i(782518),i=e.i(732903),o=e.i(395288),a=e.i(978135),s=e.i(488239),l=e.i(585512),d=e.i(728032),u=e.i(752432),c=e.i(984628),h=e.i(912651),p=e.i(650394),m=e.i(180756),g=e.i(735798),f=e.i(769936),_=e.i(358082),w=e.i(56880),y=e.i(522253),v=e.i(860048),b=e.i(469597),S=e.i(753149),I=e.i(546400),x=e.i(923511),C=e.i(835373),E=e.i(658256);function O(e,t){if(e<1)return[];let r=Array(e).fill("");
1if(t){let n=t.trim().split("");for(let t=0;t<Math.min(e,n.length);t+=1)r[t]=" "===n[t]?"":n[t]}return r}let k={root:"m_f1cb205a",pinInput:"m_cb288ead"},L={number:/^[0-9]+$/,alphanumeric:/^[a-zA-Z0-9]+$/i},N={gap:"sm",length:4,manageFocus:!0,oneTimeCode:!0,placeholder:"â",type:"alphanumeric",ariaLabel:"PinInput"},P=(0,y.createVarsResolver)((e,{size:t})=>({root:{"--pin-input-size":(0,w.getSize)(t??N.size,"pin-input-size")}})),A=(0,I.factory)((e,t)=>{let{name:n,form:i,className:o,value:a,defaultValue:s,variant:l,gap:d,style:u,size:c,classNames:h,styles:m,unstyled:w,length:y,onChange:I,onComplete:E,manageFocus:A,autoFocus:U,error:R,radius:T,disabled:j,oneTimeCode:D,placeholder:M,type:F,mask:G,readOnly:W,inputType:q,inputMode:B,ariaLabel:H,vars:z,id:V,hiddenInputProps:$,rootRef:Y,getInputProps:X,...K}=(0,S.useProps)("PinInput",N,e),Q=(0,g.useId)(V),J=(0,b.useStyles)({name:"PinInput",classes:k,props:e,className:o,style:u,classNames:h,styles:m,unstyled:w,vars:z,varsResolver:P}),{resolvedClassNames:Z,resolvedStyles:ee}=(0,v.useResolvedStylesApi)({classNames:h,styles:m,props:e}),[et,er]=(0,p.useState)(-1),[en,ei]=(0,f.useUncontrolled)({value:a?O(y??0,a):void 0,defaultValue:s?.split("").slice(0,y??0),finalValue:O(y??0,""),onChange:"function"==typeof I?e=>{I(e.join("").trim())}:void 0}),eo=en.join("").trim(),ea=(0,p.useRef)([]),es=e=>{let t=F instanceof RegExp?F:F&&F in L?L[F]:null;return t?.test(e)},el=(e,t,r)=>{if(!A)return void r?.preventDefault();if("next"===e){let e=t+1;e<(y??0)&&(r?.preventDefault(),ea.current[e].focus())}if("prev"===e){let e=t-1;e>-1&&(r?.preventDefault(),ea.current[e].focus())}},ed=(e,t)=>{let r=[...en];r[t]=e,ei(r)},eu=()=>{er(-1)},ec=e=>{e.preventDefault();let t=e.clipboardData.getData("text/plain").replace(/[\n\r\s]+/g,"");if(es(t.trim())){let e=O(y??0,t);ei(e),el("next",e.length-2)}};return(0,p.useEffect)(()=>{eo.length===y&&E?.(eo)},[y,eo]),(0,p.useEffect)(()=>{y!==en.length&&ei(O(y??0,en.join("")))},[y,en]),(0,p.useEffect)(()=>{""===a&&ei(O(y??0,a))},[a]),(0,p.useEffect)(()=>{j&&er(-1)},[j]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(x.Group,{...K,...J("root"),ref:Y,role:"group",id:Q,gap:d,unstyled:w,wrap:"nowrap",variant:l,__size:c,dir:"ltr",children:en.map((e,r)=>(0,p.createElement)(C.Input,{component:"input",...J("pinInput",{style:{"--input-padding":"0","--input-text-align":"center"}}),classNames:Z,styles:ee,size:c,__staticSelector:"PinInput",id:`${Q}-${r+1}`,key:`${Q}-${r}`,inputMode:B||("number"===F?"numeric":"text"),onChange:e=>{let t,n,i;return i=es(n=2===(t=e.target.value).length?t.split("")[t.length-1]:t),void(n.length<2?i?(ed(n,r),el("next",r)):ed("",r):i&&ei(O(y??0,t)))},onKeyDown:e=>((e,t)=>{let{ctrlKey:r,metaKey:n,key:i,shiftKey:o,target:a}=e,s=a.value;"numeric"===B&&("Backspace"===i||"Tab"===i||"Control"===i||"Delete"===i||r&&"v"===i||n&&"v"===i||!Number.isNaN(Number(i))||e.preventDefault()),"ArrowLeft"===i||o&&"Tab"===i?el("prev",t,e):"ArrowRight"===i||"Tab"===i||" "===i?el("next",t,e):"Delete"===i?ed("",t):"Backspace"===i?0!==t&&(ed("",t),y===t+1?""===e.target.value&&el("prev",t,e):el("prev",t,e)):s.length>0&&i===en[t]&&el("next",t,e)})(e,r),onFocus:e=>{e.target.select(),er(r)},onBlur:eu,onPaste:ec,type:q||(G?"password":"number"===F?"tel":"text"),radius:T,error:R,variant:l,disabled:j,ref:e=>{0===r&&(0,_.assignRef)(t,e),ea.current[r]=e},autoComplete:D?"one-time-code":"off",placeholder:et===r?"":M,value:e,autoFocus:U&&0===r,unstyled:w,"aria-label":H,readOnly:W,...X?.(r)}))}),(0,r.jsx)("input",{type:"hidden",name:n,form:i,value:eo,...$})]})});A.classes={...k,...E.InputBase.classes},A.displayName="@mantine/core/PinInput";var U=e.i(221030),R=e.i(307894),T=e.i(8199),j=e.i(988196),D=e.i(220738),M=e.i(297388),F=e.i(443552),G=e.i(329735),W=e.i(269613),q=e.i(719064),B=e.i(945099);e.i(585514);var H=e.i(404496),z=e.i(489747),V=e.i(380684),$=e.i(99067),Y=e.i(285501),X=e.i(442533),K=e.i(703849),Q=e.i(864571),J=e.i(892419);let Z={src:e.i(702474).default,width:20,height:20,blurWidth:0,blurHeight:0};
1var ee=(0,e.i(360685).createRuntimeFn)({defaultClassName:"_1w3lwdq0",variantClassNames:{size:{mini:"_1w3lwdq1"},type:{black:"_1w3lwdq2"}},defaultVariants:{size:"mini"},compoundVariants:[]});let et=({ref:e,type:t,size:n,text:i})=>{let[o,a]=(0,p.useState)(!1);return(0,p.useImperativeHandle)(e,()=>({show:e=>{a(!0),setTimeout(()=>a(!1),e)}})),(0,r.jsx)(K.AnimatePresence,{children:o&&(0,r.jsxs)(Q.motion.div,{className:ee({type:t,size:n}),initial:{y:"-6rem"},animate:{y:0,transition:{ease:"easeOut",duration:.3}},exit:{y:"-5rem",transition:{ease:"easeOut",duration:.3}},children:[(0,r.jsx)(J.default,{src:Z,alt:"info icon",className:"_1w3lwdq3"}),(0,r.jsx)("span",{className:"_1w3lwdq4",children:i})]})})};et.displayName="Toast";var er=e.i(791131),en=e.i(922524),ei=e.i(275678),eo=e.i(911984),ea=e.i(944967),es=e.i(245954);let el=({name:e,logo:t,onClick:n,disabled:i=!1})=>(0,r.jsx)(eo.default,{size:"medium",variant:"tertiary",onClick:n,disabled:i,className:(0,ea.default)(es.default["sso-login-button"],es.default["precedence-hack"]),children:(0,r.jsxs)("div",{className:es.default["button-content"],children:[(0,r.jsx)("img",{src:t,alt:`${e} logo`,role:"presentation","aria-hidden":"true",className:es.default.logo}),(0,r.jsxs)("span",{className:es.default.text,children:["Continue with ",e]})]})});var ed=e.i(567772),eu=e.i(229417),ec=e.i(26688);let eh=({email:e,onSelectWorkEmail:t,onSelectPersonalEmail:n})=>(0,r.jsxs)(eu.Stack,{gap:"large",children:[(0,r.jsx)(ed.Heading,{level:"3",children:"Switch to a work email?"}),(0,r.jsxs)(eu.Stack,{gap:"large",children:[(0,r.jsxs)(ec.Text,{tone:"secondary",size:"large",children:["It looks like you are signing up with a personal email - ",e]}),(0,r.jsx)(ec.Text,{tone:"secondary",size:"large",children:"If you have a work email, signing up with it can help us find your team and tailor your Blinq experience based on your company needs."}),(0,r.jsxs)(eu.Stack,{gap:"medium",children:[(0,r.jsx)(H.Button,{width:"full",onClick:t,children:"Switch to a work email"}),(0,r.jsx)(H.Button,{variant:"outline",width:"full",onClick:n,children:"Continue anyway"})]})]})]});var ep=e.i(827801),em=((t={})[t.SIGN_IN_OR_SIGN_UP=0]="SIGN_IN_OR_SIGN_UP",t[t.FINISH_SIGNING_IN_PASSWORD=1]="FINISH_SIGNING_IN_PASSWORD",t[t.FINISH_SIGNING_IN_OTP=2]="FINISH_SIGNING_IN_OTP",t[t.RESET_PASSWORD=3]="RESET_PASSWORD",t[t.CREATE_A_BLINQ_ACCOUNT=4]="CREATE_A_BLINQ_ACCOUNT",t[t.FINISH_SIGNING_UP_OTP=5]="FINISH_SIGNING_UP_OTP",t[t.FINISH_SIGNING_UP_PASSWORD=6]="FINISH_SIGNING_UP_PASSWORD",t[t.CATASTROPHIC_ERROR=7]="CATASTROPHIC_ERROR",t);e.s(["LoginState",()=>em],342687);let eg=(0,G.createChildLogger)({module:"components/LoginForm"}),ef=({ref:e,beforeLoginHook:t,email:g,onEmailChange:f,password:_,onPasswordChange:w,mode:y,onShowLogin:v,onShowReset:b,onLogin:S,onLink:I,newUserDetails:x={},enableClearEmailButton:C=!1,reuseAnonUserIfPossible:E=!1,preferWorkEmail:O=!1,authProfile:k,setAuthProfile:L,enteredPersonalEmail:N,setEnteredPersonalEmail:P,favouredEmail
1:A,setFavouredEmail:G,setLoginState:z,refPage:J,usePopupAuth:Z})=>{let[ee,eo]=(0,p.useState)(!1),[ea,es]=(0,p.useState)(!1),[ed,eu]=(0,p.useState)(null),[ec,ef]=(0,p.useState)(""),[ew,ey]=(0,p.useState)(!1),[ev,eb]=(0,p.useState)(!1),[eS,eI]=(0,p.useState)(!1),[ex,eC]=(0,p.useState)(!1),[eE,eO]=(0,p.useState)(!1),[ek,eL]=(()=>{let[e,t]=(0,p.useState)(null);return(0,p.useEffect)(()=>{let r=setInterval(()=>{if(null===e||e<=1){t(null),clearInterval(r);return}t(e-1)},1e3);return()=>clearInterval(r)},[e]),[e,t]})(),[eN,eP]=(0,c.default)(),[eA,eU]=(0,c.default)(),[eR,eT]=(0,p.useState)(""),[ej,eD]=(0,p.useState)(!1),[eM,eF]=(0,m.default)(_,m.passwordValidators),[,,eG]=(0,h.default)(eN),[eW,eq]=(0,m.default)(g,[m.emailValidator]),[eB,eH]=(0,p.useState)(""),[ez,eV]=(0,c.default)(),[,,e$]=(0,h.default)(ez),[,eY,eX]=(0,h.default)(eA,!0),[eK,eQ]=(0,m.default)(g,[m.emailValidator]),[eJ,eZ]=(0,p.useState)(!1),[e0,e1]=(0,p.useState)(!1),[e2,e5]=(0,p.useState)(void 0),e3=(0,p.useRef)("login"),e8=(0,p.useRef)(!1),e9=(0,p.useRef)(null),[e6,e4]=(0,p.useState)(null),e7=(0,p.useRef)((0,en.nanoid)()),[te]=(0,R.useOtpLoginOrCreate)(e7.current),[tt]=(0,R.useOtpAuthenticate)(e7.current),[tr]=(0,R.useAuthenticateStytchPassword)(),[tn]=(0,R.useSetStytchPassword)(),[ti,to]=(0,p.useState)(null),ta=(0,p.useRef)(null),[ts,tl]=(0,p.useState)(""),[td,tu]=(0,p.useState)(""),tc=(0,p.useRef)(null),th=(0,p.useRef)(null),[tp,tm]=(0,p.useState)(!1),tg=(0,p.useCallback)(()=>{tm(!0),eC(!1),eO(!1),to(null),z?.(em.CATASTROPHIC_ERROR)},[z]),tf=(0,p.useCallback)(()=>{eC(!0),eu(R.LoginMethod.PASSWORD),eO(!1),tm(!1),z?.("link"===y?em.FINISH_SIGNING_UP_PASSWORD:em.FINISH_SIGNING_IN_PASSWORD)},[z,y]);async function t_(){let e=!0;return ti||(e=await tw()),e&&(eO(!0),eC(!1),tm(!1),eu(R.LoginMethod.EMAIL_OTP),z?.("link"===y?em.FINISH_SIGNING_UP_OTP:em.FINISH_SIGNING_IN_OTP)),e}let tw=(0,p.useCallback)(async()=>{let e,t="OTP login or create operation completed.";try{return U.analytics.track({name:"otp_request_sent",properties:{type:k.type,email:g,request_id:e7.current,domain:g.split("@")[1]}}),e=await te(g),to(e),ta.current=Date.now(),eO(!0),z?.("link"===y?em.FINISH_SIGNING_UP_OTP:em.FINISH_SIGNING_IN_OTP),eL(59),U.analytics.track({name:"otp_verification_viewed",properties:{type:k.type,domain:g.split("@")[1]}}),eg.info(t,{email:g,methodId:e}),!!e}catch(n){eg.error(t,{error:n,email:g});let r=n instanceof R.OtpLoginOrCreateError&&"unknown_error"===n.code;if(ex||e){let e="There was an error when trying to send an email code. Please try again later.";return n instanceof R.OtpLoginOrCreateError?ef(R.loginOrCreateErrors.get(n.code)||e):ef(e),!1}if(k.enabledMethods?.includes(R.LoginMethod.PASSWORD))return eg.info("OTP login or create operation failed. Falling back to password.",{error:n,email:g,enabledMethods:k.enabledMethods}),tf(),!1;return r?(eg.warn("Catastrophic error when trying to send OTP code.",{email:g,error:n,enabledMethod:k.enabledMethods}),U.analytics.track({name:"otp_failed_viewed",properties:{type:k.type,request_id:e7.current}})):eg.error("Unknown error when trying to send OTP code.",{error:n}),tg(),!1}},[te,z,g,k,ex,y,eL,tg,tf]);function ty(){eC(!1),eO(!1),eu(null),v(),eT(""),w(""),eD(!1),tl(""),tu(""),z?.("link"===y?em.CREATE_A_BLINQ_ACCOUNT:em.SIGN_IN_OR_SIGN_UP),tm(!1)}(0,p.useImperativeHandle)(e,()=>({goBack:ty}));let tv=(0,p.useCallback)(async()=>{if(ey(!0),!ti)return;let e=performance.now(),t="OTP authenticate operation completed.",r=eg.child({email:g,methodId:ti,mode:y,is_existing_user:k.isExistingUser,has_password:k.enabledMethods?.includes(R.LoginMethod.PASSWORD)});try{U.analytics.track({name:"otp_verification_sent",properties:{type:k.type,domain:g.split("@")[1],email:g,request_id:e7.current}});let n=await tt(ti,ts);r.info(t);let i=performance.now();U.analytics.track({name:"otp_verification_received",properties:{type:k.type,domain:g.split("@")[1],email:g,request_id:e7.current,result:"success",duration:i-e}}),await M.authService.signInWithCustomToken(n),r.info("Signed in with custom token from otp using firebase"),eo(!0)}catch(o){let n=r.child({error:o}),i=performance.now();o instanceof R.OtpAuthenticateError&&U.analytics.track({name:"otp_verification_received",properties:{type:k.type,domain:g.split("@")[1],email:g,request_id:e7.current,result:"failed",duration:i-e,error_code:o.code}}),o instanceof R.OtpAuthenticateError&&"invalid_code"===o.code?(n.info("User entered invali
1d OTP code."),tu("The code you entered is incorrect. Please try again.")):o instanceof R.OtpAuthenticateError&&"expired_code"===o.code?(n.info("Expired OTP entered by user."),await tw(),tu("The code is no longer valid. We've sent a new code to your email.")):o instanceof R.OtpAuthenticateError&&"access_restricted"===o.code?(n.info("User tried to authenticate with a restricted stytch account"),k.enabledMethods?.includes(R.LoginMethod.PASSWORD)?(ef(k.isExistingUser?"Oops, that was one too many failed attempts. Try signing in with password instead.":"Oops, that was one too many failed attempts. Try signing up with a password instead."),tf(),k.enabledMethods=k.enabledMethods?.filter(e=>e!==R.LoginMethod.EMAIL_OTP)):tg()):o instanceof R.OtpAuthenticateError&&"unknown_error"===o.code?(n.error("Error when trying to authenticate OTP. Catastrophe flow initiated."),k.enabledMethods?.includes(R.LoginMethod.PASSWORD)?(ef(k.isExistingUser?"Oops, something went wrong. Try signing in with password instead.":"Oops, something went wrong. Try signing up with a password instead."),tf(),k.enabledMethods=k.enabledMethods?.filter(e=>e!==R.LoginMethod.EMAIL_OTP)):tg(),U.analytics.track({name:"otp_failed_viewed",properties:{type:k.type,request_id:e7.current}})):n.error(t),ey(!1)}},[ti,ts,tt,tw,g,k,tg,tf,y]),tb=(0,p.useRef)(0);(0,p.useEffect)(()=>{6===tb.current||6!==ts.length||ew||tv(),tb.current=ts.length},[ts,tv,ew]);let{createUserDoc:tS}=(0,l.useCreateUserDoc)(),[tI,tx]=(0,p.useState)(!1),tC=(0,u.default)(x),[tE,{loading:tO}]=(0,j.useFeatureFlag)(T.CELLO_REFERRAL_FLAG,"off",!1),tk=(0,u.default)(tE),tL=(0,u.default)(tO),{reportReferredSignup:tN}=(0,s.useCelloReferralCompletion)(),tP="reset"===y,tA=(0,d.default)(["(min-width: 701px)"],["large"],"small"),tU=_.length>9&&/\d/.test(_)&&/[A-Z]/.test(_),tR=(0,p.useRef)(null);(0,p.useEffect)(()=>{localStorage.getItem(R.AuthConstants.LS_SSO_LOGIN)&&(tR.current=localStorage.getItem(R.AuthConstants.LS_SSO_METHOD),es(!0),eo(!0),localStorage.removeItem(R.AuthConstants.LS_SSO_LOGIN),localStorage.removeItem(R.AuthConstants.LS_SSO_METHOD))},[]);let[tT]=(0,R.useSetLoginPreference)(),tj=(0,p.useCallback)(e=>{let t=e||k;return ed||t.loginPreference||t.methodId},[k,ed]),tD=(0,p.useCallback)(async e=>{let t,r,i=tR.current;t=eE?R.LoginMethod.EMAIL_OTP:ex?R.LoginMethod.PASSWORD:i||null;let o=eg.child({email:g,mode:tj(),login_method_used:t,user_id:e?.user.uid??null,is_anon_user:e?.isAnonUser??null,is_new_user:e?.isNewUser??null});if(null===t&&o.warn("Could not determine login method used."),!ee)return void o.warn("Login event received before submission. Ignoring.");if((t===R.LoginMethod.EMAIL_OTP||t===R.LoginMethod.PASSWORD)&&(localStorage.removeItem(R.AuthConstants.LS_SSO_METHOD),localStorage.removeItem(R.AuthConstants.LS_SSO_LOGIN)),!e){o.warn("Login event received with no user info. Ignoring."),ef("link"!==y&&("hybrid"!==y||k.isExistingUser)?"An error occurred while signing in":"An error occurred while signing up"),es(!1);return}if(e8.current){e9.current=e,o.info("Holding login completion until Stytch password enrolment resolves.");return}let a=e.user,s=performance.now();try{[r]=await Promise.all([(0,n.getUserDetails)(a.uid),t?tT(t):async()=>void 0])}catch(e){throw o.error("Failed to resolve user details and login preference.",{duration_ms:Math.round(performance.now()-s),error:e}),e}if(o.info("Resolved user details and login preference.",{duration_ms:Math.round(performance.now()-s),has_legacy_user:!!r?.user}),!r?.user&&"hybrid"===y&&a&&!tI){o.info("User created a new Firebase account via the login form. Creating new user doc.");let e=(0,W.createNewUser)(a,tC.current);await tS(e),tx(!0),o.info("User created a new Firebase account via the login form. Created new user doc."),S?.({...r,user:e},"signup");return}k.isExistingUser||U.analytics.identify({traits:{sign_up_type:eE?"otp":ex?"password":"sso"},user_id:e.user.uid});try{if(S){let e=k.isExistingUser?e3.current:"signup";o.info("Dispatching auth completion to onLogin",{dispatch_mode:e}),S(r,e);return}if(I){o.info("User linked. Dispatching to onLink."),I();return}}catch(e){o.error("Error dispatching login event to onLogin or onLink.",{error:e}),ef("An error occurred while logging in"),es(!1);return}if(e.isAnonUser){o.error("onLoginEvent triggered with an anonymous user."),ef("An error occurred while logging in"),es(!1);return}if("login"===y&&e.isNewUser){try{o.info("Reporting the referred signup before onboarding"),await tN(e.user.uid)}catch(e){o.error("Failed to report the referred signup, continuing to onboarding",{error:e})}
1let t="small"===tA?"/onboarding/personal-details?source=onboarding":"/onboarding/customize-card?source=onboarding";ei.default.push(t);return}try{if((0,T.getCachedCelloReferralCode)()){if(o.info("Waiting on the Cello referral variant before routing"),await (0,T.waitForCelloReferralVariant)(tL),"on"===tk.current){o.info("Routing the referred user to the Cello paywall"),ei.default.push(`${T.CELLO_REFERRAL_PAYWALL_ROUTE}?returning=1`);return}o.info("Referred user is not in the Cello variant, using the default destination")}}catch(e){o.error("Cello referral routing failed, using the default destination",{error:e})}"INDIVIDUAL"===e.userDetails.currentWorkspace.type&&"OWNER"===e.userDetails.currentWorkspace.profile.role?ei.default.push("/"):ei.default.push((0,q.getUserHomePageRoute)(e.userDetails))},[ee,y,tC,tk,tL,tN,S,I,tA,tS,tI,tT,tj,ex,eE,g,k]);function tM(){e8.current=!1;let e=e9.current;e9.current=null,e&&tD(e).catch(e=>{eg.error("Failed to complete login after Stytch password enrolment.",{email:g,error:e}),ef("An error occurred while logging in"),ey(!1)})}async function tF(e,t){try{await M.authService.signInWithEmailAndPassword(e,t),eg.info("Re-authenticated after Stytch password enrolment.",{email:e})}catch(t){eg.warn("Failed to re-authenticate after Stytch password enrolment.",{email:e,error:t})}}async function tG(){let e=eg.child({email:g});try{await tn(_),await tF(g,_)}catch(t){if(t instanceof R.StytchPasswordError&&"email_verification_required"===t.code){e.info("Stytch password enrolment needs email verification; routing to the email-OTP step."),e4({email:g,password:_,emailId:ti&&null!==ta.current&&Date.now()-ta.current<6e5?ti:void 0});return}e.warn("Best-effort Stytch password enrolment failed; will retry next sign-in.",{error:t})}tM()}async function tW(){if(!e6)return;let e=eg.child({email:e6.email});try{await tn(e6.password),e.info("Stytch password enrolled after email verification."),await tF(e6.email,e6.password)}catch(t){e.warn("Stytch password enrolment after email verification failed; will retry next sign-in.",{error:t})}e4(null),tM()}async function tq(){let e=eg.child({email:g}),t=new URLSearchParams(window.location.search);if(!_){eT("Please enter a password"),ey(!1);return}if(eM){eT(eF),ey(!1);return}e3.current="signup",e8.current=!0;try{if(E&&D.auth.currentUser)await (0,R.addEmailAndPasswordLoginToCurrentUser)(g,_),e.info("Used anonymous user to sign user up with password.");else{let r=await M.authService.createUserWithEmailAndPassword(g,_);if(e.info("User signed up with password."),r.user){let n=tC.current,i=(0,W.createNewUser)(r.user,{...n,signInEmailAddress:g,firstName:n.firstName||t.get("first_name")||void 0,lastName:n.lastName||t.get("last_name")||void 0});await tS(i),e.info("User doc created for user sign up with password.",{userDoc:i})}tx(!0)}}catch(e){throw e8.current=!1,e}await tG()}async function tB(){k.defaultMethod===R.LoginMethod.EMAIL_OTP?(await t_(),eg.info("Directed new user to OTP sign in based on defaultMethod.",{email:g,authProfile:k})):(tf(),eg.info("Directed new user to password sign in based on defaultMethod.",{email:g,authProfile:k}))}async function tH(e){let t=eg.child({email:g,mode:y}),r=Z?M.authService.signInWithPopup.bind(M.authService):M.authService.signInWithRedirect.bind(M.authService);try{if(ey(!0),t.info("handleLogin",{method:e,mode:y}),e.methodId&&e.ssoEnforced){if(eg.info("handleLogin: SSO enforced",{method:e}),!e.defaultMethod)throw Error("sso enforced but no defaultMethod provided. this should never happen.");let t=(0,R.mapLoginMethodToOAuthProvider)(e.defaultMethod);await r({email:g,providerId:t}),ey(!1);return}if(!k.isExistingUser&&ex)return void await tq();switch(tj(e)||k.methodId){case R.LoginMethod.PASSWORD:if(!ex){tf(),ey(!1);return}if(eY||eo(!1),!_){ey(!1),eT("Please enter a password");return}if("stytch"===k.passwordProvider)try{let e=await tr(g,_);await M.authService.signInWithCustomToken(e),t.info("Signed in with Stytch password.")}catch(e){if(e instanceof R.StytchPasswordError&&"unauthorized_credentials"===e.code)t.info("Stytch password rejected; falling back to the Firebase password."),await M.authService.signInWithEmailAndPassword(g,_);else throw e}else{e8.current=!0;try{await M.authService.signInWithEmailAndPassword(g,_),t.info("Signed in with email and password through firebase.")}catch(e){throw e8.current=!1,e}await tG()}break;
1case R.LoginMethod.EMAIL_OTP:await t_(),ey(!1);break;case R.LoginMethod.NEW_USER:if("login"===y)ei.default.push(`/onboarding/customize-card?login_hint=${encodeURIComponent(g)}`);else{if(!ex){await tB(),ey(!1);return}await tq()}break;case R.LoginMethod.GOOGLE:await r({email:g,providerId:"google.com"});break;case R.LoginMethod.MICROSOFT:await r({email:g,providerId:"microsoft.com"});break;case R.LoginMethod.APPLE:await r({email:g,providerId:"apple.com"});break;case R.LoginMethod.OAUTH2PROXY:await r({email:g,providerId:"oidc.oauth2proxy"});return}}catch(e){if(e instanceof R.StytchPasswordError){"unauthorized_credentials"===e.code?eT("Wrong password"):ef((0,R.getStytchLoginErrorMessage)(e.code)),ey(!1);return}if((0,R.isRateLimitError)(e)){ef("Your access has been temporarily restricted. Please try again later."),ey(!1);return}switch(e?.code){case"auth/invalid-email":eH(e.message);break;case"auth/wrong-password":case"auth/invalid-credential":eT(e.message);break;case"unauthorized_credentials":eT("Wrong password");break;case"auth/popup-blocked":t.warn("Sign in popup was blocked by the browser"),ef("The sign-in popup was blocked by your browser. Please allow popups for this site and try again.");break;case"auth/popup-closed-by-user":t.info("Sign in popup was closed by user");break;case"auth/network-request-failed":case"auth/too-many-requests":case"auth/user-not-found":t.warn(`Sign in attempt resulted in firebase error ${e.code}`),ef(e.message);break;default:t.error("Unknown error when logging in",{error:e}),ef(e.message??"An unknown error occurred")}ey(!1)}}async function tz(){let e="Reset link action complete";try{e1(!0),await (0,R.sendResetLink)(g),eg.info(e,{email:g}),eZ(!0)}catch(t){ef(t.message),eg.error(e,{email:g,error:t})}finally{e1(!1)}}async function tV(e){let t=eg.child({email:g});if(eT(""),e.ssoEnforced){if(!e.defaultMethod){t.error("handleLink: SSO is enforced but no SSO methodId is provided"),ef("Login via SSO failed"),ey(!1);return}let r=(0,R.mapLoginMethodToOAuthProvider)(e.defaultMethod);await tX(r)();return}if(eM)return void ey(!1);e8.current=!0;try{ey(!0),await (0,R.addEmailAndPasswordLoginToCurrentUser)(g,_),t.info("Added email and password login to current user.")}catch(e){e8.current=!1,"auth/network-request-failed"===e.code?t.warn(`Sign up attempt resulted in firebase error with code ${e.code}`,{error:e}):t.error("Unknown error adding email and password to current user.",{error:e}),ef(e.message),ey(!1);return}await tG()}async function t$(e,t,r){if(!e)return{methodId:null,ssoEnforced:!1,isExistingUser:!1,type:"otp_signup"};e5(r);let n=await (0,R.pickLoginMethodForEmail)(e);switch(!0){case n.methodId!==R.LoginMethod.NEW_USER&&"link"===t&&!n.ssoEnforced:eH("This email has already been used to join Blinq.");break;case n.methodId===R.LoginMethod.OAUTH2PROXY&&"reset"===t:ef("Your account is linked to a SSO provider. You can not reset your password using this method."),L(n);break;default:L(n)}return e5(void 0),n}async function tY(e){try{e.preventDefault();let r=await t$(g,y,"manual");if(t){ey(!0);let e=await t(g);if(e){ef(e),ey(!1);return}}if(!ex&&r.isExistingUser&&r.enabledMethods?.length===0){eg.warn("No enabled login methods for user. Catastrophe flow triggered.",{email:g}),tg(),U.analytics.track({name:"otp_failed_viewed",properties:{type:r.type,request_id:e7.current}});return}if(O&&r.publicEmailAddress&&P&&!A)return void P(!0);if(r.methodId===R.LoginMethod.NEW_USER&&""!==_&&tU){let e=new er.default;try{await e.check(_)}catch(e){if(!(e instanceof Error))return;"BreachedError"===e.name?U.analytics.track({name:"haveibeenpwned_pwnedpassword_entered"}):U.analytics.track({name:"haveibeenpwned_api_failed"})}}switch(["login","hybrid","link"].includes(y)&&U.analytics.track({name:"continue_clicked",properties:{ref_page:r.isExistingUser?"dashboard_signin":"dashboard_signup",type:r.type,request_id:e7.current,email:g,domain:g.split("@")[1]}}),eT(""),eo(!0),y){case"reset":await tz();break;case"login":case"hybrid":await tH(r);break;case"link":if(r.methodId!==R.LoginMethod.NEW_USER&&!r.ssoEnforced)return;if(!ex&&!eE){ey(!0),await tB(),ey(!1);return}await tV(r)}}catch(e){eg.error("Unknown error occurred in handleSubmit",{email:g,error:e}),ef("An error occurred. Please try again"),ey(!1)}}function tX(e){return()=>"link"===y?(0,R.addSocialProviderLoginToCurrentUser)(e):Z?M.authService.signInWithPopup({email:g,providerId:e}):M.authService.signInWithRedirect({email:g,providerId:e})}function tK(){if(!g||k.ssoEnforced)return"Continue";switch(tj()+y){case R.LoginMethod.PASSWORD+"login":case R.LoginMethod.PASSWORD+"hybrid":if(ex)return k.isExistingUser?"Sign in":"Sign up";return"Continue";case R.LoginMethod.NEW_USER+"login":return"Sign up";case R.LoginMethod.PASSWORD+"link":case R.LoginMethod.NEW_USER+"hybrid":if(ex)return"Sign up";return"Create account";default:return"Continue"}}(0,p.useEffect)(()=>{let e=R.authEvents.onLogin(tD);return()=>{e()}},[tD]),(0,p.useEffect)(()=>
1{if(to(null),eL(null),!(0,B.isEmail)(g))return void L({methodId:null,ssoEnforced:!1,publicEmailAddress:!1,isExistingUser:!1,type:"otp_signup"});let e=setTimeout(()=>{t$(g,y,"auto")},300);return()=>clearTimeout(e)},[g,y]),(0,p.useEffect)(()=>{k.methodId===R.LoginMethod.PASSWORD&&eA&&eA.focus()},[k,eA]),(0,p.useEffect)(()=>{(async()=>{let e="link"===y,t=tR.current,r=e||!!t;r&&eg.info("Starting Firebase redirect result resolution.",{is_link_mode:e,sso_redirect_method:t});try{let n=await M.authService.getRedirectResult(),i=n?.user,o=(i?.providerData.length||0)>=1;if((r||n)&&eg.info("Firebase redirect result resolved.",{has_redirect_result:!!n,has_user_from_redirect:!!i,is_link_mode:e,provider_ids:i?.providerData.map(e=>e.providerId)??[],provider_linked:o,sso_redirect_method:t,user_id:i?.uid??null}),o&&e&&I)return I();if(i||e)return;es(!1),eo(!1)}catch(r){eg.error("Firebase redirect result resolution failed.",{error:r,is_link_mode:e,sso_redirect_method:t}),eo(!1),ef(r.message),es(!1)}})()},[y,I]);let tQ=e=>{eB&&eH("");let t=e.currentTarget.value;F.GoogleTagManagerUtils.setUserData({email:t}),F.GoogleTagManagerUtils.sendFormSubmitEvent(),f(t)};return e6?(0,r.jsxs)("div",{className:ep.default["login-form"],children:[(0,r.jsxs)("p",{className:ep.default["email-otp-login-text"],children:["Last step â verify your email to secure your password. Enter the code we sent to"," ",(0,r.jsx)("strong",{children:e6.email}),"."]}),(0,r.jsx)(a.default,{email:e6.email,initialEmailId:e6.emailId,onVerified:()=>void tW()})]}):ea?(0,r.jsx)("span",{className:ep.default.loader,children:(0,r.jsx)(Y.Loader,{})}):O&&N&&!A?(0,r.jsx)(eh,{onSelectWorkEmail:()=>{G?.("work"),f(""),w("")},onSelectPersonalEmail:()=>{G?.("personal")},email:g}):(0,r.jsx)(o.CallbackErrorBoundary,{onError:(e,t)=>{eg.error("Uncaught error inside LoginForm.",{error:e,errorInfo:t})},children:(0,r.jsxs)("div",{className:ep.default["login-form"],children:[!!ec&&(0,r.jsx)("div",{className:ep.default["error-message-container"],children:(0,r.jsx)(i.Banner25,{type:"negative",size:"large",message:ec,onClose:()=>ef(""),dismissable:!0})}),tp&&(0,r.jsx)(Q.motion.div,{initial:{opacity:0}
1,animate:{opacity:1},children:(0,r.jsx)(K.AnimatePresence,{children:(0,r.jsx)(H.Button,{size:"large25",width:"full",variant:"solid25",onClick:()=>{(0,R.sendResetLink)(g),tf(),v()},children:(0,r.jsx)(Q.motion.span,{initial:{opacity:0},animate:{opacity:1,transition:{ease:"easeOut",duration:.3}},exit:{opacity:0,transition:{ease:"easeIn",duration:.3}},children:"Continue with password instead"},"catastrophic-error")})})}),!tp&&!tP&&!eE&&(0,r.jsxs)(Q.motion.form,{className:ep.default["email-login-container"],onSubmit:tY,initial:{opacity:0},animate:{opacity:1},children:[!ex&&(0,r.jsx)("div",{className:ep.default["email-input-container"],children:(0,r.jsx)(X.TextField,{size:"large25",label:"Email",value:g,onChange:tQ,type:"email",autoComplete:"email",ref:eP,tone:eB||eW&&eG?"critical25":"neutral25",message:eB||eW&&eG?eB||eq:void 0,onClear:C?()=>{f("")}:void 0})}),ex&&(0,r.jsx)("div",{className:ep.default["password-login-container"],children:(0,r.jsx)(X.TextField,{size:"large25",label:"Password",value:_,onChange:e=>{w(e.currentTarget.value)},type:ej?"text":"password",autoComplete:"current-password",ref:eU,disabled:k.ssoEnforced,adornment:(0,r.jsx)("button",{type:"button",className:ep.default["password-visibility-toggle"],"aria-label":ej?"Hide password":"Show password",disabled:k.ssoEnforced,onClick:()=>eD(e=>!e),children:ej?(0,r.jsx)(V.IconEyeHide,{}):(0,r.jsx)($.IconEyeShow,{})}),message:ee&&!ev&&(eR||k.methodId===R.LoginMethod.NEW_USER&&eF&&eX)?eR||eF:void 0,tone:ee&&!ev&&(eR||k.methodId===R.LoginMethod.NEW_USER&&eF&&eX)?"critical25":"neutral25"})}),(0,r.jsxs)("div",{className:ep.default["form-btns-container"],children:[(0,r.jsxs)("div",{className:ep.default["main-btn-container"],children:[(0,r.jsx)(K.AnimatePresence,{children:(0,r.jsx)(H.Button,{size:"large25",width:"full",variant:"solid25",disabled:!g||eW||!!eB||ev,loading:"manual"===e2||ew,type:"submit",children:(0,r.jsx)(Q.motion.span,{initial:{opacity:0}
1,animate:{opacity:1,transition:{ease:"easeOut",duration:.3}},exit:{opacity:0,transition:{ease:"easeIn",duration:.3}},children:tK()},tK())})}),ex&&(0,r.jsxs)(K.AnimatePresence,{children:[k.enabledMethods?.includes(R.LoginMethod.EMAIL_OTP)&&(0,r.jsx)(H.Button,{size:"large25",width:"full",variant:"outline25",type:"button",disabled:ew||ev,loading:ev,onClick:async()=>{eb(!0),await t_(),eb(!1)},children:(0,r.jsx)(Q.motion.span,{initial:{opacity:0},animate:{opacity:1,transition:{ease:"easeOut",duration:.3}},exit:{opacity:0,transition:{ease:"easeIn",duration:.3}},children:"Continue with code"},"otp-continue-with-code-text")},"continue-with-code-button"),"hybrid"===y&&(0,r.jsx)(H.Button,{size:"large25",width:"full",variant:"outline25",type:"button",disabled:ew||ev,onClick:()=>ty(),children:(0,r.jsx)(Q.motion.span,{initial:{opacity:0},animate:{opacity:1,transition:{ease:"easeOut",duration:.3}},exit:{opacity:0,transition:{ease:"easeIn",duration:.3}},children:"Back"},"back-button-text")},"go-back-button"),"login"===y&&(0,r.jsx)(H.Button,{size:"large25",width:"full",variant:"text25",disabled:ew||ev,type:"button",onClick:()=>{z?.(em.RESET_PASSWORD),b()},children:(0,r.jsx)(Q.motion.span,{initial:{opacity:0}
1,animate:{opacity:1,transition:{ease:"easeOut",duration:.3}},exit:{opacity:0,transition:{ease:"easeIn",duration:.3}},children:"Forgot Password?"},"forgot-password-text")},"forgot-password-button")]})]}),!ex&&(0,r.jsxs)(Q.motion.div,{className:ep.default.container,animate:{opacity:k.methodId===R.LoginMethod.OAUTH2PROXY?.3:1},children:[(0,r.jsx)("hr",{className:ep.default.hr}),(0,r.jsx)(el,{name:"Google",logo:"/img/google-logo.svg",onClick:tX("google.com"),disabled:k.methodId===R.LoginMethod.OAUTH2PROXY}),(0,r.jsx)(el,{name:"Microsoft",logo:"/img/microsoft-logo.svg",onClick:tX("microsoft.com"),disabled:k.methodId===R.LoginMethod.OAUTH2PROXY}),(0,r.jsx)(el,{name:"Apple",logo:"/img/apple-logo.svg",onClick:tX("apple.com"),disabled:k.methodId===R.LoginMethod.OAUTH2PROXY})]},"sso-button-container")]})]}),!tp&&eE&&(0,r.jsxs)(Q.motion.div,{className:ep.default["email-otp-login-container"],initial:{opacity:0},animate:{opacity:1},children:[(0,r.jsx)(et,{ref:th,size:"mini",type:"black",text:"Sign in code sent"}),(0,r.jsxs)("p",{className:ep.default["email-otp-login-text"],children:["Once you enter the code we sent you to ",(0,r.jsx)("strong",{children:g}),", you'll be all signed in."]}),(0,r.jsx)(e_,{error:td,ref:tc,value:ts,onChange:e=>{tu(""),tl(e)}}),(0,r.jsx)("div",{className:ep.default["email-otp-resend-code-container"],children:(0,r.jsxs)("p",{className:ep.default["email-otp-resend-code-text"],children:["Didn't receive a code?",(0,r.jsx)("button",{className:ep.default["email-otp-resend-code-button"],disabled:ew||eS||!!ek,type:"button",onClick:async()=>{eI(!0);let e=k.isExistingUser?"otp_login":"otp_signup";U.analytics.track({name:"otp_resend_clicked",properties:{ref_page:J,type:e,request_id:e7.current}}),await tw()&&(tl(""),th.current?.show(3e3),tc.current?.focus()),eI(!1)},children:ek?`Resend code in 0:${ek/10<1?"0":""}${ek}`:"Resend code"})]})}),(0,r.jsx)("div",{className:ep.default["form-btns-container"],children:(0,r.jsxs)("div",{className:ep.default["main-btn-container"],children:[(0,r.jsx)(H.Button,{size:"large25",width:"full",variant:"solid25",disabled:ts.length<6||ew||eS,loading:ew,onClick:tv,type:"button",children:"Continue"}),k.enabledMethods?.includes(R.LoginMethod.PASSWORD)&&(0,r.jsx)(H.Button,{size:"large25",width:"full",variant:"outline25",disabled:ew,type:"button",onClick:()=>{tf(),tl(""),tu(""),U.analytics.track({name:"otp_password_clicked",properties:{ref_page:J,type:k.type,request_id:e7.current}})},children:"Continue with password"}),"hybrid"===y&&(0,r.jsx)(H.Button,{size:"large25",width:"full",variant:"outline25",type:"button",disabled:ew,onClick:()=>ty(),children:(0,r.jsx)(Q.motion.span,{initial:{opacity:0}
1,animate:{opacity:1,transition:{ease:"easeOut",duration:.3}},exit:{opacity:0,transition:{ease:"easeIn",duration:.3}},children:"Back"},"otp-back-button-text")},"otp-go-back-button")]})})]}),!tp&&tP&&(0,r.jsxs)(r.Fragment,{children:[!eJ&&(0,r.jsxs)(Q.motion.form,{className:ep.default["email-reset-password-container"],onSubmit:tY,initial:{opacity:0},animate:{opacity:1},children:[(0,r.jsx)(X.TextField,{size:"large25",label:"Email",value:g,onChange:tQ,type:"email",autoComplete:"email",ref:eV,tone:eK&&e$?"critical25":"neutral25",message:eK&&e$?eQ:void 0,onClear:C?()=>{f("")}:void 0}),(0,r.jsx)("div",{className:ep.default["form-btns-container"],children:(0,r.jsxs)("div",{className:ep.default["main-btn-container"],children:[(0,r.jsx)(H.Button,{size:"large25",variant:"solid25",width:"full",disabled:!g||k.methodId===R.LoginMethod.OAUTH2PROXY,loading:e0,type:"button",onClick:tz,children:"Send reset link"}),(0,r.jsx)(H.Button,{size:"large25",variant:"outline25",width:"full",type:"button",disabled:!g||k.methodId===R.LoginMethod.OAUTH2PROXY,onClick:ty,children:"Return to sign in"})]})})]}),eJ&&(0,r.jsx)("p",{className:ep.default["sent-reset-email-message"],children:"Check your inbox for the link to reset your password"})]})]})})},e_=({ref:e,error:t,value:n,onChange:i})=>(0,r.jsxs)("div",{className:ep.default["email-otp-pin-input-container"],children:[(0,r.jsx)(A,{classNames:{input:ep.default["email-otp-pin-input"]},onPaste:e=>{e.preventDefault(),i(e.clipboardData.getData("text"))},error:!!t,ref:e,oneTimeCode:!0,autoFocus:!0,gap:8,size:"lg",value:n,length:6,onChange:i,placeholder:"",type:"number"}),t&&(0,r.jsxs)("p",{className:ep.default["email-otp-pin-input-error"],children:[(0,r.jsx)(z.IconCloseCircle,{}),t]})]})}]); 2 3//# sourceMappingURL=05ddzvny-sx27.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.