1import{Aa as e,Ia as t,Oi as n,Sa as r,T as i,_a as a,bi as o,fi as s,va as c,ya as l}from"./index-BovpZL4f.js";var u=t(e(),1),d=l(),f=({className:e,withVerified:t,type:l})=>{let{authUser:f,setIdentity:p,verifyOtp:m,resendOtp:h}=r(),{formatMessage:g}=c(),_=l===`email`?!!f?.email_confirmed_at:!!f?.phone_confirmed_at,v=l===`email`?f?.email:f?.phone,y=l===`email`?`link`:void 0,[b,x]=(0,u.useState)(!1),[S,C]=(0,u.useState)(void 0),[w,T]=(0,u.useState)(v||``),[E,D]=(0,u.useState)(``),[O,k]=(0,u.useState)(!_&&y===`code`),A=(0,u.useRef)(null),j=e=>{e.preventDefault(),C(void 0),!(!A.current||!A.current.checkValidity())&&(O?N(w,E):M(w))},M=e=>{x(!0),p(e,l).then(()=>{x(!1),k(y===`code`)}).catch(e=>{x(!1),e.status===422&&C(e.message)})},N=(e,t)=>{x(!0),m(e,t,l).then(()=>{x(!1),k(!1)}).catch(e=>{x(!1),C(e.error_description||e.message||`Invalid OTP`)})},P=e=>{x(!0),h(e,l).then(()=>{x(!1)}).catch(e=>{x(!1),C(e.error_description||e.message||`Could not send OTP`)})},F=e=>{C(void 0),e.key===`Enter`&&j(e)},I=l===`email`?`email`:`phone_number`;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`form`,{ref:A,onSubmit:j,className:`main verify-form `+(e||``),children:[(0,d.jsxs)(`div`,{className:`row`,children:[O&&(0,d.jsx)(o,{type:`text`,inputMode:`numeric`,autoComplete:`one-time-code`,autoFocus:!0,required:!0,maxLength:6,value:E,onChange:e=>{D(e.target.value),C(void 0),e.target.value.length===6&&N(w,e.target.value)},style:{whiteSpace:`nowrap`},onKeyDown:F,label:(0,d.jsx)(a,{id:`verification_code`}),placeholder:`XXXXXX`,errorMessage:S}
1),!O&&(0,d.jsx)(o,{type:`email`,autoComplete:`email`,required:!0,onKeyDown:F,value:w,onChange:e=>{T(e.target.value),C(void 0)},label:(0,d.jsx)(a,{id:I}),defaultValue:f?.email||``,placeholder:g({id:I})+`...`,errorMessage:S})]}),(0,d.jsxs)(`p`,{className:`hint`,style:{display:`flex`,flexDirection:`column`,gap:`var(--margin-md)`},children:[!O&&(0,d.jsx)(a,{id:l===`email`?`activation_is_sent_to_email`:`activation_is_sent_to_phone`,tagName:`span`}),O&&(0,d.jsxs)(`span`,{children:[(0,d.jsx)(a,{id:`we_sent_a_code_to`,values:{0:(0,d.jsx)(`b`,{children:w})}}),(0,d.jsx)(`br`,{}),l===`email`&&(0,d.jsx)(a,{id:`email_check_your_spam`,tagName:`strong`})]}),t&&(0,d.jsx)(`span`,{style:{display:`block`},children:_&&(0,d.jsxs)(i,{type:`success`,children:[(0,d.jsx)(n,{id:`checked`}),` `,(0,d.jsx)(a,{id:l===`email`?`email_verified`:`phone_verified`})]})})]})]}),(0,d.jsxs)(`div`,{className:`bottom verify-form `+(e||``),children:[O&&(0,d.jsx)(s,{className:b?`loading`:``,onClick:()=>P(w),children:(0,d.jsx)(a,{id:`send_again`})}),!O&&(0,d.jsx)(s,{disabled:w===v,className:b?`loading`:``,onClick:j,children:(0,d.jsx)(a,{id:`save`})})]})]})};export{f as t};
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.