1import{F as ue,H as fe,r as u,E as _e,a9 as he,a2 as L,_,Z as z,$ as Y,j as t,B as M,O as pe,Q as R,R as J,M as ge,G as w,p as y,X as b,aa as xe,q as Te,N as ye,ab as be,v as Se,w as Pe,x as Oe,a8 as ve,u as we,b as Ee,ac as Ne}from"./index-DJL08Sm5.js";import{u as je,b as Ae,a as Me,c as Re,O as ke}from"./CustomOtp-DNKVsSFS.js";import{R as Ce}from"./RegisterCommonComponents-D8ZSCh3A.js";import{i as He,a as We,b as Ue,c as De,d as Ie,e as $e,f as Fe,g as Ge,h as Ve,j as qe,k as Be,l as Le,m as ze,n as Ye,o as Je,p as Ke}from"./lib-BN86pUPR.js";function Qe(){const i=()=>He?"iPad":We?"Tablet":Ue?"Mobile":De||Ie?"Desktop":$e?"Smart TV":Fe?"Console":Ge?"Wearable":Ve?"Embedded":"Unknown",h=()=>qe?"-Mobile Safari":Be?"-Chromium-based":Le?"-Chrome":ze?"-Firefox":"",E=()=>Ye?"-Android":Je?"-Windows Phone":Ke?"-iOS":"";try{return`${i()}${h()}${E()}`}catch{return"Unknown device"}}function K(i){if(!i)return"";const h=String(i);return h.length<=4?h:h.slice(-4)}function Xe(){const[i]=ue(),h=fe(e=>e.sync_user),[E,k]=je(),[x,C]=u.useState(""),[H,S]=u.useState(null),[f,d]=u.useState(!1),[r,W]=u.useState(1),[D,Q]=u.useState(null),[l,X]=u.useState(!0),[P,Z]=u.useState(void 0),I=i.get("redirect"),ee=window.location.search,{mutateAsync:te}=Ae(),{input_ref:N,otp:se,setOtp:ae,getValue:ne,reset_otp:j}=Me(),$=_e({mutationFn:he,onSuccess:async e=>{await ie({access:e.data.tokens.access,refresh:e.data.tokens.refresh}),e.data.redirect==null?L(`${I||"/matches"}`):L(`/register/details/${e.data.redirect}${ee}`)},onError:e=>{var s,a,c,m,o,p,g,T,O;if((a=(s=e==null?void 0:e.response)==null?void 0:s.data)!=null&&a.non_field_errors)_.error((o=(m=(c=e==null?void 0:e.response)==null?void 0:c.data)==null?void 0:m.non_field_errors)==null?void 0:o[0]);else{let v=e==null?void 0:e.message;(g=(p=e==null?void 0:e.response)==null?void 0:p.data)!=null&&g.error&&(v=(O=(T=e==null?void 0:e.response)==null?void 0:T.data)==null?void 0:O.error),_.error(v,{duration:6e3})}}}),ie=u.useCallback(async function(e){z(Y.ACCESS_TOKEN,e.access,{JsonStringify:!1}),z(Y.REFRESH_TOKEN,e.refresh,{JsonStringify:!1}),await h()},[h]);async function re(e){try{if(!await Se(e,!0,"register")){S("Too many requests. Please try again later.");return}if(!window.recaptchaVerifier){_.error("Recaptcha verification failed. Please try again later."),console.error("Recaptcha verifier is not initialized");return}const a=await Pe(Oe,e,window.recaptchaVerifier);Q(a),W(2),k(30),console.log("OTP requested successfully for",e)}catch(s){console.error("OTP Request Error:",s),_.error(s instanceof Error&&s.message?s.message:"Something went wrong. Please try again later.")}finally{d(!1)}}const oe=async e=>{var s,a,c,m,o,p,g,T,O,v,V,q,B;try{await te({otp_for:"R",phone_number:e,id_token:"test"}),W(2),k(120),d(!1)}catch(n){if(d(!1),(a=(s=n==null?void 0:n.response)==null?void 0:s.data)!=null&&a.phone_number){const A=(o=(m=(c=n==null?void 0:n.response)==null?void 0:c.data)==null?void 0:m.ph
1one_number)==null?void 0:o[0];_.error(A)}if((g=(p=n==null?void 0:n.response)==null?void 0:p.data)!=null&&g.non_field_errors){const A=(v=(O=(T=n==null?void 0:n.response)==null?void 0:T.data)==null?void 0:O.non_field_errors)==null?void 0:v[0];A==="NOT_EXPIRED"&&(W(2),k(parseInt((B=(q=(V=n==null?void 0:n.response)==null?void 0:V.data)==null?void 0:q.non_field_errors)==null?void 0:B[1])||5),d(!1)),A==="OTP Request Limit Reached"&&_.error("TOo Many Request Please try again later.")}}};async function U(e){const s=(e==null?void 0:e.trim())||x;if(!s||s.length<10){S("Please enter a valid 10-digit mobile number");return}d(!0),S(""),l?oe(x):re(s)}function ce(){j(),U()}const le=(e,s)=>s?e:"",F=()=>{const e=le(i.get("referrer")||"",P||""),s=ve(),a=i.get("coupon_code"),c=Qe(),m=i.get("accept_matches_with_kids");return{...s,customCoupon:a,deviceType:c,referrer:e,...m&&{accept_matched_with_kids:m=="yes"}}};async function de(e){var s;if(!D){j();return}d(!0);try{const c=await(await D.confirm(e)).user.getIdToken();await $.mutateAsync({phone:x,token_id:c,...F()})}catch(a){j(),((s=a==null?void 0:a.message)==null?void 0:s.toString())==="Firebase: Error (auth/invalid-verification-code)."?S("Invalid OTP"):(_.error("Something went wrong."),console.log(a)),d(!1)}}async function me(e){d(!0);try{await $.mutateAsync({custom_otp:!0,phone:x,token_id:e,...F()}),d(!1)}catch{j(),d(!1)}}async function G(e){if(e.length!==6){_.error("invalid OTP");return}S(""),l?me(e):de(e)}return u.useEffect(()=>{const e=async m=>{var p,g;const o=await be(m).catch(T=>(console.error(T),null));!o||!((p=o==null?void 0:o.data)!=null&&p.name)||Z((g=o==null?void 0:o.data)==null?void 0:g.name)},s=i.get("referrer"),a=i.get("phone"),c=i.get("invalid_phone");a&&(C(String(a)||""),U(String(a)||"")),c&&(C(String(c)||""),_.error("Please Verify your Phone Number!")),s&&e(s)},[i]),u.useEffect(()=>{var e;r==2&&N&&((e=N.current)==null||e.focus())},[r,N]),Re(),t.jsxs("div",{className:"rg-step-container flex w-full max-w-[573px] flex-col justify-between gap-5 rounded-xl bg-white p-6",children:[r===1&&t.jsx("div",{className:"rg-back-to-home-btn",children:t.jsx(M,{startIcon:t.jsx(pe,{fontSize:"inherit"}),size:"medium",variant:"text",href:"/",children:"Back to home"})}),r===2&&t.jsx("div",{}),t.jsxs("div",{className:"flex flex-col gap-0",children:[r===1?t.jsxs("div",{className:"mb-10",children:[P&&t.jsxs("p",{className:"mt-2 text-sm text-primary",children:["You've"," been referred by ",P]}),t.jsxs("h1",{className:"text-xl font-semibold md:text-2xl",children:["ð Welcome to ",R(),"!"]}),t.jsxs("p",{className:"mt-2 text-sm text-gray-500 md:text-base",children:["Weâre excited to have you here. To get started, letâs verify your mobile number. All profiles are"," ",t.jsx("strong",{children:"100% mobile verified"})," to ensure a secure and trustworthy experience."]})]}):t.jsxs("div",{className:"mb-10",children:[P&&t.jsxs("p",{className:"mt-2 text-sm text-primary",children:["You've"," been referred by ",P]}),t.jsx("h1",{className:"text-2xl font-semibold",children:"Verify Your Mobile Number"}),t.jsx("p",{className:`mt-2 ${l?"text-[15px]":"text-[14px]"} text-gray-500`,children:l?"Weâve sent a One-Time Password (OTP) to your WhatsApp number. Please open WhatsApp and enter the OTP below to verify your account.":" Weâve sent a One-Time Password (OTP) to your mobile number via SMS. Please enter the OTP below to verify your account."})]}),t.jsxs("div",{className:"flex max-w-[418px] flex-col gap-4",children:[r===1&&t.jsxs("div",{children:[t.jsx(J,{label:"Register with OTP"}),t.jsx(ge,{onChange:e=>C(e),value:x,error:!!H,helperText:H})]}),r===2&&t.jsxs("div",{className:"flex flex-col",children:[t.jsx(J,{label:l?`Enter the 6-digit OTP sent to your verified WhatsApp number ending with ${K(x)}.`:`Enter the 6-digit OTP sent to your verified mobile number ending with ${K(x)}.`}),t.jsx(ke,{disable:f,ref:N,otp:se,setOTP:ae,error:H,autoCallBack:G})]}),r===2&&!f&&t.jsx("div",{className:"flex flex-col text-sm",children:E>0?t.jsxs("p",{children:["OTP will expire in ",E," seconds."]}):t.jsxs("div",{className:"inline-flex items-center",children:["Didnât get the OTP?"," ",t.jsx(M,{size:"small",fullWidth:!1,variant:"text",color:"secondary",onClick:ce,className:w,"data-gtm-name":y.AUTH__OTP_RESEND,"data-gtm-method":l?b.METHOD__WHATSAPP:b.METHOD__SMS,children:"Resend OTP"})]})}),f&&t.jsx("div",{className:"-mt-20 flex items-center justify-center",children:t.jsx(xe,{})}),t.jsxs("div",{className:"mt-3 space-y-4 text-center",children:[r===1&&!f&&t.jsxs(M,{variant:"contained",disabled:f,onClick:()=>U(),size:"large",fullWidth:!0,sx:{boxShadow:"None"},className:w,"data-gtm-name":y.AUTH__OTP_REQUEST,"data-gtm-method":l?b.METHOD__WHATSAPP:b.METHOD__SMS,"data-gtm-reason":Te.REASON__REGISTER,children:["Get OTP via ",l?"WhatsApp":"SMS"]}),r===1&&t.jsx("div",{className:"gap-2 pt-2 text-sm md:pt-5",children:t.jsxs("div",{children:[" ",l?"Trouble receiving WhatsApp OTP?":"Prefer to receive the WhatsApp OTP?",t.jsx("button",{type:"button",disabled:f,className:`ml-2 text-primary underline ${w}`,onClick:()=>{X(e=>!e)},"data-gtm-name":l?y.AUTH__TO_OTP_METHOD__SMS:y.AUTH__TO_OTP_METHOD__WHATSAPP,children:"Click here"})]})}),r===2&&!f&&t.jsx(M,{variant:"contained",disabled:f,onClick:()=>G(ne()),size:"large",sx:{boxShadow:"None"},"data-gtm-name":y.AUTH__OTP_VERIFY,"data-gtm-method":l?b.METHOD__WHATSAPP:b.METHOD__SMS,"data-gtm-reason":"register",className:w,children:"Verify OTP"})]}),r===1&&t.jsx(Ce,{}),r===1&&!f&&t.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-center gap-2",children:[t.jsx("span",{className:"text-gray-500",children:"Already have an account?"}),t.jsx("button",{className:w,"data-gtm-name":y.AUTH__TO_LOGIN,onClick:()=>{ye(!1);const e=window.location.search;window.location.href=`/login${e}`},children:t.jsx("span",{className:"text-primary underline",children:"Login"})})]})]}),t.jsx("div",{id:"re-captcha"})]}),t.jsx("div",{})]})}const at=()=>(we("Register"),Ee(`Join ${R()}, the leading matrimony site offering 'Till You Marry' assurance. Register for free and find your perfect match with our exclusive package!`,[`${R()} matrimony registration`,`${R()} matrimony free sign up`,"marriage site free registration","free registration matrimony","tamil matrimony free","find your match","online matrimonial services","free registration in matrimonial"]),t.jsx(Ne,{children:t.jsx(Xe,{})}));export{at as default};
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.