@neuctra/authix 1.0.13 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2869,7 +2869,7 @@ const $s = [
2869
2869
  ...g,
2870
2870
  appId: d
2871
2871
  }, E = await Bn(f, { baseUrl: T, apiKey: S });
2872
- N({ type: "success", text: "Account created successfully!" }), u && u(E), window.location.reload();
2872
+ N({ type: "success", text: "Account created successfully!" }), u && u(E);
2873
2873
  } catch (f) {
2874
2874
  const E = f.message || "Signup failed. Please try again.";
2875
2875
  N({ type: "error", text: E }), y && y(f);
@@ -3383,7 +3383,7 @@ const $s = [
3383
3383
  { email: w, password: K, appId: S },
3384
3384
  { baseUrl: y, apiKey: T }
3385
3385
  );
3386
- N({ type: "success", text: `Welcome ${j.name}` }), c?.(j), window.location.reload();
3386
+ N({ type: "success", text: `Welcome ${j.name}` }), c?.(j);
3387
3387
  } catch (j) {
3388
3388
  const X = j.message || "Login failed";
3389
3389
  N({ type: "error", text: X }), u?.(j);
@@ -6336,7 +6336,6 @@ const $s = [
6336
6336
  style: {
6337
6337
  maxWidth: "1200px",
6338
6338
  margin: "0 auto",
6339
- padding: "16px",
6340
6339
  width: "100%",
6341
6340
  boxSizing: "border-box"
6342
6341
  },
@@ -199,12 +199,12 @@ React keys must be passed directly to JSX without using spread:
199
199
  *
200
200
  * This source code is licensed under the ISC license.
201
201
  * See the LICENSE file in the root directory of this source tree.
202
- */const Pe=$("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),$e={baseUrl:"",apiKey:"",appId:""},Gn=e=>{if(!e.baseUrl||!e.apiKey||!e.appId)throw new Error("baseUrl, apiKey, and appId are required");$e.baseUrl=e.baseUrl,$e.apiKey=e.apiKey,$e.appId=e.appId},ge=()=>$e,Zn=({logoUrl:e,logoLinkUrl:t,title:r="Create Your Account",subtitle:s="Join our platform today",footerText:o="Secure authentication powered by Neuctra Authix",primaryColor:i="#00C214",gradient:a="linear-gradient(135deg, #22c55e, #00C214)",darkMode:l=!0,showAvatar:h=!1,loginUrl:c,onSuccess:u,onError:y})=>{const{baseUrl:R,apiKey:k,appId:d}=ge(),b={name:"",email:"",password:"",...h&&{avatarUrl:""}},[g,M]=S.useState(b),[D,_]=S.useState(!1),[T,B]=S.useState(!1),[m,N]=S.useState(null),[w,F]=S.useState({}),K=typeof window<"u"?window.innerWidth<768:!1,L=l?"#ffffff":"#111827",Y=l?"#a1a1aa":"#6b7280",Z=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",E=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",J=q=>{const{name:f,value:C}=q.target;M(z=>({...z,[f]:C})),w[f]&&F(z=>({...z,[f]:void 0}))},H=()=>{const q={};return g.name.trim()||(q.name="Name is required"),g.email.trim()?/\S+@\S+\.\S+/.test(g.email)||(q.email="Invalid email address"):q.email="Email is required",g.password?g.password.length<6&&(q.password="Password must be at least 6 characters"):q.password="Password is required",F(q),Object.keys(q).length===0},A=async q=>{if(q.preventDefault(),!!H()){B(!0),N(null);try{const f={...g,appId:d},C=await An(f,{baseUrl:R,apiKey:k});N({type:"success",text:"Account created successfully!"}),u&&u(C),window.location.reload()}catch(f){const C=f.message||"Signup failed. Please try again.";N({type:"error",text:C}),y&&y(f)}finally{B(!1)}}},I={width:"100%",padding:K?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:Z,border:`1px solid ${E}`,borderRadius:"10px",color:L,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"};return n.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:[n.jsxs("div",{style:{minWidth:K?"320px":"380px",width:"100%",maxWidth:K?"340px":"390px",display:"flex",flexDirection:"column",borderRadius:"10px",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",backgroundColor:l?"#000000":"#ffffff",padding:K?"30px 24px":"18px 28px"},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"10px"},children:[e?n.jsx("a",{href:t||"/",target:"_self",rel:"noopener noreferrer",children:n.jsx("img",{src:e,alt:"Logo",style:{height:"50px",width:"50px",marginBottom:"10px"}})}):n.jsx(je,{size:40,color:i,style:{marginBottom:"10px"}}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:700,color:L,margin:0},children:r}),n.jsx("p",{style:{fontSize:"14px",color:Y},children:s})]}),h&&g.avatarUrl&&n.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:"16px"},children:n.jsx("img",{src:g.avatarUrl,alt:"Avatar Preview",style:{width:"60px",height:"60px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${i}30`},onError:q=>{const f=q.target;f.style.display="none"}})}),n.jsxs("form",{onSubmit:A,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"signup-name",style:{fontSize:"14px",fontWeight:500,color:L},children:"Full Name"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(je,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:Y}}),n.jsx("input",{id:"signup-name",type:"text",name:"name",placeholder:"Enter your full name",value:g.name,onChange:J,style:{...I,borderColor:w.name?"#ef4444":E}})]}),w.name&&n.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:w.name})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"signup-email",style:{fontSize:"14px",fontWeight:500,color:L},children:"Email Address"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(he,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:Y}}),n.jsx("input",{id:"signup-email",type:"email",name:"email",placeholder:"Enter your email address",value:g.email,onChange:J,style:{...I,borderColor:w.email?"#ef4444":E}})]}),w.email&&n.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:w.email})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"signup-password",style:{fontSize:"14px",fontWeight:500,color:L},children:"Password"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(Se,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:Y}}),n.jsx("input",{id:"signup-password",type:D?"text":"password",name:"password",placeholder:"Create a secure password",value:g.password,onChange:J,style:{...I,borderColor:w.password?"#ef4444":E}}),n.jsx("button",{type:"button",onClick:()=>_(!D),style:{position:"absolute",right:"14px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:Y,cursor:"pointer",padding:"4px"},children:D?n.jsx(nt,{size:20}):n.jsx(st,{size:20})})]}),w.password&&n.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:w.password})]}),h&&n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"signup-avatar",style:{fontSize:"14px",fontWeight:500,color:L},children:"Avatar URL (Optional)"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(Qt,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:Y}}),n.jsx("input",{id:"signup-avatar",type:"url",name:"avatarUrl",placeholder:"Paste your avatar image URL",value:g.avatarUrl||"",onChange:J,style:I})]})]}),c&&n.jsx("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:n.jsx("a",{href:c,style:{color:i,textDecoration:"none",fontWeight:500},children:"Already have an account?"})}),m&&n.jsxs("div",{style:{padding:"12px",borderRadius:"12px",fontSize:"12px",display:"flex",alignItems:"start",gap:"10px",backgroundColor:m.type==="success"?`${i}15`:"rgba(239,68,68,0.1)",border:m.type==="success"?`1px solid ${i}30`:"1px solid rgba(239,68,68,0.3)",color:m.type==="success"?i:"#ef4444"},children:[m.type==="success"?n.jsx(xe,{size:20}):n.jsx(le,{size:20}),n.jsx("span",{children:m.text})]}),n.jsx("button",{type:"submit",disabled:T,style:{padding:"12px",background:a,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600,cursor:T?"not-allowed":"pointer",opacity:T?.7:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:T?n.jsxs(n.Fragment,{children:[n.jsx(Hn,{size:18,style:{animation:"spin 1s linear infinite"}}),"Creating Account..."]}):"Create Account"})]}),n.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:Y,marginTop:"16px",padding:"0 4px"},children:["Secure authentication powered by"," ",n.jsx("span",{style:{color:i,fontWeight:600},children:"Neuctra Authix"})]})]}),n.jsx("style",{children:`
202
+ */const Pe=$("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),$e={baseUrl:"",apiKey:"",appId:""},Gn=e=>{if(!e.baseUrl||!e.apiKey||!e.appId)throw new Error("baseUrl, apiKey, and appId are required");$e.baseUrl=e.baseUrl,$e.apiKey=e.apiKey,$e.appId=e.appId},ge=()=>$e,Zn=({logoUrl:e,logoLinkUrl:t,title:r="Create Your Account",subtitle:s="Join our platform today",footerText:o="Secure authentication powered by Neuctra Authix",primaryColor:i="#00C214",gradient:a="linear-gradient(135deg, #22c55e, #00C214)",darkMode:l=!0,showAvatar:h=!1,loginUrl:c,onSuccess:u,onError:y})=>{const{baseUrl:R,apiKey:k,appId:d}=ge(),b={name:"",email:"",password:"",...h&&{avatarUrl:""}},[g,M]=S.useState(b),[D,_]=S.useState(!1),[T,B]=S.useState(!1),[m,N]=S.useState(null),[w,F]=S.useState({}),K=typeof window<"u"?window.innerWidth<768:!1,L=l?"#ffffff":"#111827",Y=l?"#a1a1aa":"#6b7280",Z=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",E=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",J=q=>{const{name:f,value:C}=q.target;M(z=>({...z,[f]:C})),w[f]&&F(z=>({...z,[f]:void 0}))},H=()=>{const q={};return g.name.trim()||(q.name="Name is required"),g.email.trim()?/\S+@\S+\.\S+/.test(g.email)||(q.email="Invalid email address"):q.email="Email is required",g.password?g.password.length<6&&(q.password="Password must be at least 6 characters"):q.password="Password is required",F(q),Object.keys(q).length===0},A=async q=>{if(q.preventDefault(),!!H()){B(!0),N(null);try{const f={...g,appId:d},C=await An(f,{baseUrl:R,apiKey:k});N({type:"success",text:"Account created successfully!"}),u&&u(C)}catch(f){const C=f.message||"Signup failed. Please try again.";N({type:"error",text:C}),y&&y(f)}finally{B(!1)}}},I={width:"100%",padding:K?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:Z,border:`1px solid ${E}`,borderRadius:"10px",color:L,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"};return n.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:[n.jsxs("div",{style:{minWidth:K?"320px":"380px",width:"100%",maxWidth:K?"340px":"390px",display:"flex",flexDirection:"column",borderRadius:"10px",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",backgroundColor:l?"#000000":"#ffffff",padding:K?"30px 24px":"18px 28px"},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"10px"},children:[e?n.jsx("a",{href:t||"/",target:"_self",rel:"noopener noreferrer",children:n.jsx("img",{src:e,alt:"Logo",style:{height:"50px",width:"50px",marginBottom:"10px"}})}):n.jsx(je,{size:40,color:i,style:{marginBottom:"10px"}}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:700,color:L,margin:0},children:r}),n.jsx("p",{style:{fontSize:"14px",color:Y},children:s})]}),h&&g.avatarUrl&&n.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:"16px"},children:n.jsx("img",{src:g.avatarUrl,alt:"Avatar Preview",style:{width:"60px",height:"60px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${i}30`},onError:q=>{const f=q.target;f.style.display="none"}})}),n.jsxs("form",{onSubmit:A,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"signup-name",style:{fontSize:"14px",fontWeight:500,color:L},children:"Full Name"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(je,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:Y}}),n.jsx("input",{id:"signup-name",type:"text",name:"name",placeholder:"Enter your full name",value:g.name,onChange:J,style:{...I,borderColor:w.name?"#ef4444":E}})]}),w.name&&n.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:w.name})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"signup-email",style:{fontSize:"14px",fontWeight:500,color:L},children:"Email Address"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(he,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:Y}}),n.jsx("input",{id:"signup-email",type:"email",name:"email",placeholder:"Enter your email address",value:g.email,onChange:J,style:{...I,borderColor:w.email?"#ef4444":E}})]}),w.email&&n.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:w.email})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"signup-password",style:{fontSize:"14px",fontWeight:500,color:L},children:"Password"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(Se,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:Y}}),n.jsx("input",{id:"signup-password",type:D?"text":"password",name:"password",placeholder:"Create a secure password",value:g.password,onChange:J,style:{...I,borderColor:w.password?"#ef4444":E}}),n.jsx("button",{type:"button",onClick:()=>_(!D),style:{position:"absolute",right:"14px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:Y,cursor:"pointer",padding:"4px"},children:D?n.jsx(nt,{size:20}):n.jsx(st,{size:20})})]}),w.password&&n.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:w.password})]}),h&&n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"signup-avatar",style:{fontSize:"14px",fontWeight:500,color:L},children:"Avatar URL (Optional)"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(Qt,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:Y}}),n.jsx("input",{id:"signup-avatar",type:"url",name:"avatarUrl",placeholder:"Paste your avatar image URL",value:g.avatarUrl||"",onChange:J,style:I})]})]}),c&&n.jsx("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:n.jsx("a",{href:c,style:{color:i,textDecoration:"none",fontWeight:500},children:"Already have an account?"})}),m&&n.jsxs("div",{style:{padding:"12px",borderRadius:"12px",fontSize:"12px",display:"flex",alignItems:"start",gap:"10px",backgroundColor:m.type==="success"?`${i}15`:"rgba(239,68,68,0.1)",border:m.type==="success"?`1px solid ${i}30`:"1px solid rgba(239,68,68,0.3)",color:m.type==="success"?i:"#ef4444"},children:[m.type==="success"?n.jsx(xe,{size:20}):n.jsx(le,{size:20}),n.jsx("span",{children:m.text})]}),n.jsx("button",{type:"submit",disabled:T,style:{padding:"12px",background:a,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600,cursor:T?"not-allowed":"pointer",opacity:T?.7:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:T?n.jsxs(n.Fragment,{children:[n.jsx(Hn,{size:18,style:{animation:"spin 1s linear infinite"}}),"Creating Account..."]}):"Create Account"})]}),n.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:Y,marginTop:"16px",padding:"0 4px"},children:["Secure authentication powered by"," ",n.jsx("span",{style:{color:i,fontWeight:600},children:"Neuctra Authix"})]})]}),n.jsx("style",{children:`
203
203
  @keyframes spin {
204
204
  from { transform: rotate(0deg); }
205
205
  to { transform: rotate(360deg); }
206
206
  }
207
- `})]})},Qn=async(e,t)=>{const{email:r,password:s,appId:o}=e,{baseUrl:i,apiKey:a}=t;if(!a)throw new Error("API key is required for login");try{const l=await W.post(`${i}/users/login`,{email:r,password:s,appId:o},{headers:{"Content-Type":"application/json","x-api-key":a}});return l.data?.user&&localStorage.setItem("userInfo",JSON.stringify(l.data.user)),l.data.user}catch(l){const h=l.response?.data?.message||l.message||"Login failed";throw console.error("Login API Error:",h),{success:!1,message:h,status:l.response?.status||500}}},es=({logoUrl:e,logoLinkUrl:t,title:r="Sign In to Your Account",subtitle:s="Welcome back! Please enter your details",footerText:o="Secure authentication powered by Neuctra Authix",primaryColor:i="#00C214",gradient:a="linear-gradient(135deg, #22c55e, #00C214)",darkMode:l=!0,signupUrl:h,onSuccess:c,onError:u})=>{const{baseUrl:y,apiKey:R,appId:k}=ge(),[d,b]=S.useState("login"),[g,M]=S.useState(1),[D,_]=S.useState(!1),[T,B]=S.useState(!1),[m,N]=S.useState(null),[w,F]=S.useState(""),[K,L]=S.useState(""),[Y,Z]=S.useState({email:"",otp:"",newPassword:"",appId:k}),E=window.innerWidth<768,J=l?"#ffffff":"#111827",H=l?"#a1a1aa":"#6b7280",A=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",I=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",q=async x=>{x.preventDefault(),B(!0),N(null);try{const j=await Qn({email:w,password:K,appId:k},{baseUrl:y,apiKey:R});N({type:"success",text:`Welcome ${j.name}`}),c?.(j),window.location.reload()}catch(j){const X=j.message||"Login failed";N({type:"error",text:X}),u?.(j)}finally{B(!1)}},f=x=>{Z({...Y,[x.target.name]:x.target.value})},C=async x=>{x.preventDefault(),B(!0),N(null);try{const j=await W.post(`${y}/users/forgot-password`,{email:Y.email,appId:k},{headers:{"x-api-key":R}});j.data.success?(M(2),N({type:"success",text:"OTP sent to your email"})):N({type:"error",text:j.data.message||"Failed to send OTP"})}catch(j){N({type:"error",text:j.response?.data?.message||"Something went wrong"})}finally{B(!1)}},z=async x=>{x.preventDefault(),B(!0),N(null);try{const j=await W.post(`${y}/users/reset-password`,Y,{headers:{"x-api-key":R}});j.data.success?(N({type:"success",text:"Password reset successfully!"}),M(1),Z({email:"",otp:"",newPassword:"",appId:k}),b("login")):N({type:"error",text:j.data.message||"Reset failed"})}catch(j){N({type:"error",text:j.response?.data?.message||"Something went wrong"})}finally{B(!1)}},O={width:"100%",padding:E?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:A,border:`1px solid ${I}`,borderRadius:"10px",color:J,fontSize:"15px",outline:"none",transition:"all 0.2s ease"};return n.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:n.jsxs("div",{style:{minWidth:E?"320px":"380px",maxWidth:E?"340px":"390px",width:"100%",display:"flex",flexDirection:"column",borderRadius:"10px",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",backgroundColor:l?"#000000":"#ffffff",padding:E?"30px 24px":"18px 28px"},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"10px"},children:[e?n.jsx("a",{href:t||"/",target:"_self",rel:"noopener noreferrer",children:n.jsx("img",{src:e,alt:"Logo",style:{height:"50px",width:"50px",marginBottom:"10px"}})}):n.jsx(je,{size:40,color:i,style:{marginBottom:"10px"}}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:700,color:J,margin:0},children:d==="login"?r:g===1?"Forgot Password":"Reset Password"}),n.jsx("p",{style:{fontSize:"14px",color:H},children:d==="login"?s:"Follow the steps to reset your password"})]}),d==="login"&&n.jsxs("form",{onSubmit:q,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"login-email",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"Email Address"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(he,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:H}}),n.jsx("input",{id:"login-email",type:"email",placeholder:"Enter your email",value:w,onChange:x=>F(x.target.value),style:O})]})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"login-password",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"Password"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(Se,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:H}}),n.jsx("input",{id:"login-password",type:D?"text":"password",placeholder:"Enter your password",value:K,onChange:x=>L(x.target.value),style:O}),n.jsx("button",{type:"button",onClick:()=>_(!D),style:{position:"absolute",right:"14px",padding:"4px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:H,cursor:"pointer"},children:D?n.jsx(nt,{size:20}):n.jsx(st,{size:20})})]})]}),n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:[h&&n.jsx("a",{href:h,style:{color:i,textDecoration:"none",fontWeight:500},children:"Create new account"}),n.jsx("button",{type:"button",onClick:()=>b("forgot"),style:{background:"none",border:"none",color:i,fontWeight:500,cursor:"pointer"},children:"Forgot password?"})]}),n.jsx("button",{type:"submit",disabled:T,style:{padding:"12px",background:a,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600},children:T?"Signing In...":"Sign In"})]}),d==="forgot"&&n.jsxs("form",{onSubmit:g===1?C:z,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[g===1?n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"forgot-email",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"Email Address"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(he,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:H}}),n.jsx("input",{id:"forgot-email",type:"email",name:"email",placeholder:"Enter your email",value:Y.email,onChange:f,style:O})]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[n.jsx("label",{htmlFor:"otp",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"One-Time Password (OTP)"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(er,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:H}}),n.jsx("input",{id:"otp",type:"text",name:"otp",placeholder:"Enter OTP",value:Y.otp,onChange:f,style:O})]})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[n.jsx("label",{htmlFor:"newPassword",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"New Password"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(Se,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:H}}),n.jsx("input",{id:"newPassword",type:"password",name:"newPassword",placeholder:"Enter new password",value:Y.newPassword,onChange:f,style:O})]})]})]}),n.jsx("button",{type:"submit",disabled:T,style:{padding:"12px",background:a,color:"#fff",border:"none",fontSize:"14px",borderRadius:"10px",fontWeight:600},children:T?"Please wait...":g===1?"Send Reset OTP":"Reset Password"}),n.jsx("button",{type:"button",onClick:()=>{b("login"),M(1)},style:{background:"none",border:"none",fontSize:"14px",color:H,marginTop:"6px",cursor:"pointer"},children:"Back to Login"})]}),m&&n.jsxs("div",{style:{marginTop:"16px",padding:"12px",borderRadius:"12px",fontSize:"14px",display:"flex",alignItems:"center",gap:"10px",backgroundColor:m.type==="success"?`${i}15`:"rgba(239,68,68,0.1)",border:m.type==="success"?`1px solid ${i}30`:"1px solid rgba(239,68,68,0.3)",color:m.type==="success"?i:"#ef4444"},children:[m.type==="success"?n.jsx(xe,{size:20}):n.jsx(le,{size:20}),n.jsx("span",{children:m.text})]}),n.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:H,marginTop:"16px",padding:"0 4px"},children:["Secure authentication powered by"," ",n.jsx("span",{style:{color:i,fontWeight:600},children:"Neuctra Authix"})]})]})})},ts=()=>{try{const e=localStorage.getItem("userInfo");return!!(e&&e!=="undefined"&&e!=="null")}catch{return!1}},rs=({children:e,fallback:t=null,width:r,height:s})=>{if(!ts())return n.jsx(n.Fragment,{children:t});const o={display:"inline-flex",alignItems:"center",verticalAlign:"middle",...r?{width:r}:{},...s?{height:s}:{}};return n.jsx("span",{style:o,children:e})},ns=()=>{try{const e=localStorage.getItem("userInfo");return!!(e&&e!=="undefined"&&e!=="null")}catch{return!1}},ss=({children:e,fallback:t=null,width:r,height:s})=>{if(ns())return n.jsx(n.Fragment,{children:t});const o={display:"inline-flex",alignItems:"center",verticalAlign:"middle",...r?{width:r}:{},...s?{height:s}:{}};return n.jsx("span",{style:o,children:e})},os=({isOpen:e,onClose:t,onSuccess:r,onError:s,userId:o,token:i,colors:a})=>{const{baseUrl:l,apiKey:h,appId:c}=ge(),[u,y]=S.useState(!1),[R,k]=S.useState(""),[d,b]=S.useState("warning"),[g,M]=S.useState(!1);if(S.useEffect(()=>{const m=()=>{M(window.innerWidth<640)};return m(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[]),!e)return null;const D=async()=>{y(!0),b("processing");try{const{data:m}=await W.delete(`${l}/users/delete/${o}`,{data:{appId:c},headers:{"x-api-key":h}});m.success?(r(m.message||"Account deleted successfully"),b("success"),setTimeout(()=>{localStorage.removeItem("userInfo"),localStorage.removeItem("userToken"),window.location.href="/"},2e3)):(s(m.message||"Failed to delete account"),b("warning"))}catch(m){s(m.response?.data?.message||"Something went wrong"),b("warning")}finally{y(!1)}},_=R.toLowerCase()==="delete my account",T=m=>{m.target===m.currentTarget&&d!=="processing"&&d!=="success"&&t()},B=()=>{switch(d){case"warning":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"24px",gap:"16px"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #ef4444, #dc2626)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(We,{size:20})}),n.jsx("div",{children:n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Delete Account"})})]}),n.jsx("button",{onClick:t,"aria-label":"Close modal",style:{background:"transparent",border:"none",color:a.textTertiary,cursor:"pointer",padding:"8px",borderRadius:"8px",width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 0.2s ease"},onMouseOver:m=>{m.currentTarget.style.backgroundColor=a.border,m.currentTarget.style.color=a.textPrimary},onMouseOut:m=>{m.currentTarget.style.backgroundColor="transparent",m.currentTarget.style.color=a.textTertiary},children:n.jsx(Pe,{size:20})})]}),n.jsxs("div",{style:{display:"flex",gap:"16px",padding:"20px",background:`${a.error}15`,border:`1px solid ${a.error}30`,borderRadius:"12px",marginBottom:"20px"},children:[n.jsx("div",{style:{color:a.error,flexShrink:0,display:"flex",alignItems:"flex-start"},children:n.jsx(sr,{size:24})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h4",{style:{color:a.textPrimary,margin:"0 0 12px 0",fontSize:"16px",fontWeight:600},children:"Before you proceed..."}),n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[{icon:n.jsx(Mn,{size:16}),text:"All your data will be permanently deleted"},{icon:n.jsx(Xn,{size:16}),text:"This action cannot be reversed"},{icon:n.jsx(ot,{size:16}),text:"You will lose access to all services"}].map((m,N)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",fontSize:"14px",color:a.textSecondary},children:[n.jsx("div",{style:{color:a.error,flexShrink:0},children:m.icon}),n.jsx("span",{children:m.text})]},N))})]})]}),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:g?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[n.jsx("button",{onClick:t,style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${a.border}`,background:"transparent",color:a.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:g?"none":1,minWidth:g?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:m=>{m.currentTarget.style.backgroundColor=a.border,m.currentTarget.style.transform="translateY(-1px)"},onMouseOut:m=>{m.currentTarget.style.backgroundColor="transparent",m.currentTarget.style.transform="translateY(0)"},children:"Cancel"}),n.jsxs("button",{onClick:()=>b("confirmation"),style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:"pointer",flex:g?"none":1,minWidth:g?"100%":"140px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver:m=>{m.currentTarget.style.transform="translateY(-1px)",m.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)"},onMouseOut:m=>{m.currentTarget.style.transform="translateY(0)",m.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)"},children:[n.jsx(We,{size:16}),"Continue to Delete"]})]})]});case"confirmation":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #f59e0b, #d97706)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(sr,{size:24})}),n.jsx("div",{style:{flex:1},children:n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Confirm Deletion"})})]}),n.jsxs("div",{style:{marginBottom:"24px"},children:[n.jsxs("p",{style:{color:a.textSecondary,marginBottom:"16px",fontSize:"14px",lineHeight:"1.5"},children:["Type"," ",n.jsx("strong",{style:{color:a.textPrimary},children:'"delete my account"'})," ","to confirm:"]}),n.jsx("input",{type:"text",value:R,onChange:m=>k(m.target.value),placeholder:"delete my account",style:{width:"100%",padding:"14px 16px",borderRadius:"10px",border:`2px solid ${_?a.success:a.error}`,backgroundColor:"transparent",color:a.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:m=>{m.target.style.boxShadow=`0 0 0 3px ${a.accent}20`},onBlur:m=>{m.target.style.boxShadow="none"},autoFocus:!0}),_&&n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"10px",color:a.success,fontSize:"14px",fontWeight:500},children:[n.jsx(rt,{size:16}),n.jsx("span",{children:"Confirmation accepted"})]})]}),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:"column-reverse",justifyContent:"flex-end",alignItems:"stretch"},children:[n.jsx("button",{onClick:()=>{b("warning"),k("")},style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${a.border}`,background:"transparent",color:a.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:g?"none":1,minWidth:g?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:m=>{m.currentTarget.style.backgroundColor=a.border,m.currentTarget.style.transform="translateY(-1px)"},onMouseOut:m=>{m.currentTarget.style.backgroundColor="transparent",m.currentTarget.style.transform="translateY(0)"},children:"Go Back"}),n.jsxs("button",{onClick:D,disabled:!_||u,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:!_||u?"not-allowed":"pointer",flex:g?"none":1,minWidth:g?"100%":"140px",opacity:!_||u?.6:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:!_||u?"none":"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver:m=>{_&&!u&&(m.currentTarget.style.transform="translateY(-1px)",m.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)")},onMouseOut:m=>{_&&!u&&(m.currentTarget.style.transform="translateY(0)",m.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)")},children:[n.jsx(We,{size:16}),"Yes, Delete My Account"]})]})]});case"processing":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #6b7280, #4b5563)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(ce,{size:20,style:{animation:"spin 1s linear infinite"}})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Deleting Account"}),n.jsx("p",{style:{color:a.textTertiary,margin:"4px 0 0 0",fontSize:"14px",lineHeight:"1.4"},children:"Please wait while we process your request"})]})]}),n.jsx("div",{style:{marginBottom:"20px"},children:n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[{text:"Removing your data",active:!0},{text:"Closing active sessions",active:!1},{text:"Finalizing deletion",active:!1}].map((m,N)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",borderRadius:"8px",transition:"all 0.2s ease",backgroundColor:m.active?`${a.accent}10`:"transparent"},children:[n.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:m.active?a.accent:a.textTertiary,transition:"all 0.3s ease",boxShadow:m.active?`0 0 0 4px ${a.accent}20`:"none"}}),n.jsx("span",{style:{fontSize:"14px",color:m.active?a.textPrimary:a.textSecondary,fontWeight:m.active?500:400},children:m.text})]},N))})}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px",background:`${a.accent}10`,borderRadius:"10px",fontSize:"14px",color:a.textSecondary},children:[n.jsx(nr,{size:18,style:{color:a.accent,flexShrink:0}}),n.jsx("span",{children:"You will be redirected to the login page shortly"})]})]});case"success":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #10b981, #059669)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(rt,{size:20})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Account Deleted"}),n.jsx("p",{style:{color:a.textTertiary,margin:"4px 0 0 0",fontSize:"14px",lineHeight:"1.4"},children:"Your account has been successfully deleted"})]})]}),n.jsxs("div",{style:{textAlign:"center",padding:"20px",background:`${a.success}10`,border:`1px solid ${a.success}20`,borderRadius:"12px",marginBottom:"24px"},children:[n.jsx(rt,{size:48,style:{color:a.success,marginBottom:"12px",display:"block",margin:"0 auto 12px auto"}}),n.jsx("p",{style:{color:a.textPrimary,fontSize:"16px",fontWeight:600,margin:"0 0 8px 0"},children:"Goodbye!"}),n.jsx("p",{style:{color:a.textSecondary,fontSize:"14px",margin:0,lineHeight:"1.5"},children:"Your account and all associated data have been permanently removed from our systems."})]}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px",background:`${a.accent}10`,borderRadius:"10px",fontSize:"14px",color:a.textSecondary,justifyContent:"center"},children:[n.jsx(ce,{size:16,style:{animation:"spin 1s linear infinite",color:a.accent}}),n.jsx("span",{children:"Redirecting to login page..."})]})]})}};return n.jsxs("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.8)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",zIndex:1e4,animation:"fadeIn 0.3s ease-out"},onClick:T,children:[n.jsx("div",{style:{backgroundColor:a.surface,border:`1px solid ${a.border}`,borderRadius:"20px",width:"100%",maxWidth:"480px",padding:"24px",boxShadow:"0 32px 64px rgba(0,0,0,0.4)",animation:"scaleIn 0.3s ease-out"},className:"delete-modal-container",children:B()}),n.jsx("style",{children:`
207
+ `})]})},Qn=async(e,t)=>{const{email:r,password:s,appId:o}=e,{baseUrl:i,apiKey:a}=t;if(!a)throw new Error("API key is required for login");try{const l=await W.post(`${i}/users/login`,{email:r,password:s,appId:o},{headers:{"Content-Type":"application/json","x-api-key":a}});return l.data?.user&&localStorage.setItem("userInfo",JSON.stringify(l.data.user)),l.data.user}catch(l){const h=l.response?.data?.message||l.message||"Login failed";throw console.error("Login API Error:",h),{success:!1,message:h,status:l.response?.status||500}}},es=({logoUrl:e,logoLinkUrl:t,title:r="Sign In to Your Account",subtitle:s="Welcome back! Please enter your details",footerText:o="Secure authentication powered by Neuctra Authix",primaryColor:i="#00C214",gradient:a="linear-gradient(135deg, #22c55e, #00C214)",darkMode:l=!0,signupUrl:h,onSuccess:c,onError:u})=>{const{baseUrl:y,apiKey:R,appId:k}=ge(),[d,b]=S.useState("login"),[g,M]=S.useState(1),[D,_]=S.useState(!1),[T,B]=S.useState(!1),[m,N]=S.useState(null),[w,F]=S.useState(""),[K,L]=S.useState(""),[Y,Z]=S.useState({email:"",otp:"",newPassword:"",appId:k}),E=window.innerWidth<768,J=l?"#ffffff":"#111827",H=l?"#a1a1aa":"#6b7280",A=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",I=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",q=async x=>{x.preventDefault(),B(!0),N(null);try{const j=await Qn({email:w,password:K,appId:k},{baseUrl:y,apiKey:R});N({type:"success",text:`Welcome ${j.name}`}),c?.(j)}catch(j){const X=j.message||"Login failed";N({type:"error",text:X}),u?.(j)}finally{B(!1)}},f=x=>{Z({...Y,[x.target.name]:x.target.value})},C=async x=>{x.preventDefault(),B(!0),N(null);try{const j=await W.post(`${y}/users/forgot-password`,{email:Y.email,appId:k},{headers:{"x-api-key":R}});j.data.success?(M(2),N({type:"success",text:"OTP sent to your email"})):N({type:"error",text:j.data.message||"Failed to send OTP"})}catch(j){N({type:"error",text:j.response?.data?.message||"Something went wrong"})}finally{B(!1)}},z=async x=>{x.preventDefault(),B(!0),N(null);try{const j=await W.post(`${y}/users/reset-password`,Y,{headers:{"x-api-key":R}});j.data.success?(N({type:"success",text:"Password reset successfully!"}),M(1),Z({email:"",otp:"",newPassword:"",appId:k}),b("login")):N({type:"error",text:j.data.message||"Reset failed"})}catch(j){N({type:"error",text:j.response?.data?.message||"Something went wrong"})}finally{B(!1)}},O={width:"100%",padding:E?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:A,border:`1px solid ${I}`,borderRadius:"10px",color:J,fontSize:"15px",outline:"none",transition:"all 0.2s ease"};return n.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:n.jsxs("div",{style:{minWidth:E?"320px":"380px",maxWidth:E?"340px":"390px",width:"100%",display:"flex",flexDirection:"column",borderRadius:"10px",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",backgroundColor:l?"#000000":"#ffffff",padding:E?"30px 24px":"18px 28px"},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"10px"},children:[e?n.jsx("a",{href:t||"/",target:"_self",rel:"noopener noreferrer",children:n.jsx("img",{src:e,alt:"Logo",style:{height:"50px",width:"50px",marginBottom:"10px"}})}):n.jsx(je,{size:40,color:i,style:{marginBottom:"10px"}}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:700,color:J,margin:0},children:d==="login"?r:g===1?"Forgot Password":"Reset Password"}),n.jsx("p",{style:{fontSize:"14px",color:H},children:d==="login"?s:"Follow the steps to reset your password"})]}),d==="login"&&n.jsxs("form",{onSubmit:q,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"login-email",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"Email Address"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(he,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:H}}),n.jsx("input",{id:"login-email",type:"email",placeholder:"Enter your email",value:w,onChange:x=>F(x.target.value),style:O})]})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"login-password",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"Password"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(Se,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:H}}),n.jsx("input",{id:"login-password",type:D?"text":"password",placeholder:"Enter your password",value:K,onChange:x=>L(x.target.value),style:O}),n.jsx("button",{type:"button",onClick:()=>_(!D),style:{position:"absolute",right:"14px",padding:"4px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:H,cursor:"pointer"},children:D?n.jsx(nt,{size:20}):n.jsx(st,{size:20})})]})]}),n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:[h&&n.jsx("a",{href:h,style:{color:i,textDecoration:"none",fontWeight:500},children:"Create new account"}),n.jsx("button",{type:"button",onClick:()=>b("forgot"),style:{background:"none",border:"none",color:i,fontWeight:500,cursor:"pointer"},children:"Forgot password?"})]}),n.jsx("button",{type:"submit",disabled:T,style:{padding:"12px",background:a,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600},children:T?"Signing In...":"Sign In"})]}),d==="forgot"&&n.jsxs("form",{onSubmit:g===1?C:z,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[g===1?n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"forgot-email",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"Email Address"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(he,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:H}}),n.jsx("input",{id:"forgot-email",type:"email",name:"email",placeholder:"Enter your email",value:Y.email,onChange:f,style:O})]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[n.jsx("label",{htmlFor:"otp",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"One-Time Password (OTP)"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(er,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:H}}),n.jsx("input",{id:"otp",type:"text",name:"otp",placeholder:"Enter OTP",value:Y.otp,onChange:f,style:O})]})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[n.jsx("label",{htmlFor:"newPassword",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"New Password"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(Se,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:H}}),n.jsx("input",{id:"newPassword",type:"password",name:"newPassword",placeholder:"Enter new password",value:Y.newPassword,onChange:f,style:O})]})]})]}),n.jsx("button",{type:"submit",disabled:T,style:{padding:"12px",background:a,color:"#fff",border:"none",fontSize:"14px",borderRadius:"10px",fontWeight:600},children:T?"Please wait...":g===1?"Send Reset OTP":"Reset Password"}),n.jsx("button",{type:"button",onClick:()=>{b("login"),M(1)},style:{background:"none",border:"none",fontSize:"14px",color:H,marginTop:"6px",cursor:"pointer"},children:"Back to Login"})]}),m&&n.jsxs("div",{style:{marginTop:"16px",padding:"12px",borderRadius:"12px",fontSize:"14px",display:"flex",alignItems:"center",gap:"10px",backgroundColor:m.type==="success"?`${i}15`:"rgba(239,68,68,0.1)",border:m.type==="success"?`1px solid ${i}30`:"1px solid rgba(239,68,68,0.3)",color:m.type==="success"?i:"#ef4444"},children:[m.type==="success"?n.jsx(xe,{size:20}):n.jsx(le,{size:20}),n.jsx("span",{children:m.text})]}),n.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:H,marginTop:"16px",padding:"0 4px"},children:["Secure authentication powered by"," ",n.jsx("span",{style:{color:i,fontWeight:600},children:"Neuctra Authix"})]})]})})},ts=()=>{try{const e=localStorage.getItem("userInfo");return!!(e&&e!=="undefined"&&e!=="null")}catch{return!1}},rs=({children:e,fallback:t=null,width:r,height:s})=>{if(!ts())return n.jsx(n.Fragment,{children:t});const o={display:"inline-flex",alignItems:"center",verticalAlign:"middle",...r?{width:r}:{},...s?{height:s}:{}};return n.jsx("span",{style:o,children:e})},ns=()=>{try{const e=localStorage.getItem("userInfo");return!!(e&&e!=="undefined"&&e!=="null")}catch{return!1}},ss=({children:e,fallback:t=null,width:r,height:s})=>{if(ns())return n.jsx(n.Fragment,{children:t});const o={display:"inline-flex",alignItems:"center",verticalAlign:"middle",...r?{width:r}:{},...s?{height:s}:{}};return n.jsx("span",{style:o,children:e})},os=({isOpen:e,onClose:t,onSuccess:r,onError:s,userId:o,token:i,colors:a})=>{const{baseUrl:l,apiKey:h,appId:c}=ge(),[u,y]=S.useState(!1),[R,k]=S.useState(""),[d,b]=S.useState("warning"),[g,M]=S.useState(!1);if(S.useEffect(()=>{const m=()=>{M(window.innerWidth<640)};return m(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[]),!e)return null;const D=async()=>{y(!0),b("processing");try{const{data:m}=await W.delete(`${l}/users/delete/${o}`,{data:{appId:c},headers:{"x-api-key":h}});m.success?(r(m.message||"Account deleted successfully"),b("success"),setTimeout(()=>{localStorage.removeItem("userInfo"),localStorage.removeItem("userToken"),window.location.href="/"},2e3)):(s(m.message||"Failed to delete account"),b("warning"))}catch(m){s(m.response?.data?.message||"Something went wrong"),b("warning")}finally{y(!1)}},_=R.toLowerCase()==="delete my account",T=m=>{m.target===m.currentTarget&&d!=="processing"&&d!=="success"&&t()},B=()=>{switch(d){case"warning":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"24px",gap:"16px"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #ef4444, #dc2626)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(We,{size:20})}),n.jsx("div",{children:n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Delete Account"})})]}),n.jsx("button",{onClick:t,"aria-label":"Close modal",style:{background:"transparent",border:"none",color:a.textTertiary,cursor:"pointer",padding:"8px",borderRadius:"8px",width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 0.2s ease"},onMouseOver:m=>{m.currentTarget.style.backgroundColor=a.border,m.currentTarget.style.color=a.textPrimary},onMouseOut:m=>{m.currentTarget.style.backgroundColor="transparent",m.currentTarget.style.color=a.textTertiary},children:n.jsx(Pe,{size:20})})]}),n.jsxs("div",{style:{display:"flex",gap:"16px",padding:"20px",background:`${a.error}15`,border:`1px solid ${a.error}30`,borderRadius:"12px",marginBottom:"20px"},children:[n.jsx("div",{style:{color:a.error,flexShrink:0,display:"flex",alignItems:"flex-start"},children:n.jsx(sr,{size:24})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h4",{style:{color:a.textPrimary,margin:"0 0 12px 0",fontSize:"16px",fontWeight:600},children:"Before you proceed..."}),n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[{icon:n.jsx(Mn,{size:16}),text:"All your data will be permanently deleted"},{icon:n.jsx(Xn,{size:16}),text:"This action cannot be reversed"},{icon:n.jsx(ot,{size:16}),text:"You will lose access to all services"}].map((m,N)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",fontSize:"14px",color:a.textSecondary},children:[n.jsx("div",{style:{color:a.error,flexShrink:0},children:m.icon}),n.jsx("span",{children:m.text})]},N))})]})]}),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:g?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[n.jsx("button",{onClick:t,style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${a.border}`,background:"transparent",color:a.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:g?"none":1,minWidth:g?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:m=>{m.currentTarget.style.backgroundColor=a.border,m.currentTarget.style.transform="translateY(-1px)"},onMouseOut:m=>{m.currentTarget.style.backgroundColor="transparent",m.currentTarget.style.transform="translateY(0)"},children:"Cancel"}),n.jsxs("button",{onClick:()=>b("confirmation"),style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:"pointer",flex:g?"none":1,minWidth:g?"100%":"140px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver:m=>{m.currentTarget.style.transform="translateY(-1px)",m.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)"},onMouseOut:m=>{m.currentTarget.style.transform="translateY(0)",m.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)"},children:[n.jsx(We,{size:16}),"Continue to Delete"]})]})]});case"confirmation":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #f59e0b, #d97706)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(sr,{size:24})}),n.jsx("div",{style:{flex:1},children:n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Confirm Deletion"})})]}),n.jsxs("div",{style:{marginBottom:"24px"},children:[n.jsxs("p",{style:{color:a.textSecondary,marginBottom:"16px",fontSize:"14px",lineHeight:"1.5"},children:["Type"," ",n.jsx("strong",{style:{color:a.textPrimary},children:'"delete my account"'})," ","to confirm:"]}),n.jsx("input",{type:"text",value:R,onChange:m=>k(m.target.value),placeholder:"delete my account",style:{width:"100%",padding:"14px 16px",borderRadius:"10px",border:`2px solid ${_?a.success:a.error}`,backgroundColor:"transparent",color:a.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:m=>{m.target.style.boxShadow=`0 0 0 3px ${a.accent}20`},onBlur:m=>{m.target.style.boxShadow="none"},autoFocus:!0}),_&&n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"10px",color:a.success,fontSize:"14px",fontWeight:500},children:[n.jsx(rt,{size:16}),n.jsx("span",{children:"Confirmation accepted"})]})]}),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:"column-reverse",justifyContent:"flex-end",alignItems:"stretch"},children:[n.jsx("button",{onClick:()=>{b("warning"),k("")},style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${a.border}`,background:"transparent",color:a.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:g?"none":1,minWidth:g?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:m=>{m.currentTarget.style.backgroundColor=a.border,m.currentTarget.style.transform="translateY(-1px)"},onMouseOut:m=>{m.currentTarget.style.backgroundColor="transparent",m.currentTarget.style.transform="translateY(0)"},children:"Go Back"}),n.jsxs("button",{onClick:D,disabled:!_||u,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:!_||u?"not-allowed":"pointer",flex:g?"none":1,minWidth:g?"100%":"140px",opacity:!_||u?.6:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:!_||u?"none":"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver:m=>{_&&!u&&(m.currentTarget.style.transform="translateY(-1px)",m.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)")},onMouseOut:m=>{_&&!u&&(m.currentTarget.style.transform="translateY(0)",m.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)")},children:[n.jsx(We,{size:16}),"Yes, Delete My Account"]})]})]});case"processing":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #6b7280, #4b5563)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(ce,{size:20,style:{animation:"spin 1s linear infinite"}})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Deleting Account"}),n.jsx("p",{style:{color:a.textTertiary,margin:"4px 0 0 0",fontSize:"14px",lineHeight:"1.4"},children:"Please wait while we process your request"})]})]}),n.jsx("div",{style:{marginBottom:"20px"},children:n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[{text:"Removing your data",active:!0},{text:"Closing active sessions",active:!1},{text:"Finalizing deletion",active:!1}].map((m,N)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",borderRadius:"8px",transition:"all 0.2s ease",backgroundColor:m.active?`${a.accent}10`:"transparent"},children:[n.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:m.active?a.accent:a.textTertiary,transition:"all 0.3s ease",boxShadow:m.active?`0 0 0 4px ${a.accent}20`:"none"}}),n.jsx("span",{style:{fontSize:"14px",color:m.active?a.textPrimary:a.textSecondary,fontWeight:m.active?500:400},children:m.text})]},N))})}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px",background:`${a.accent}10`,borderRadius:"10px",fontSize:"14px",color:a.textSecondary},children:[n.jsx(nr,{size:18,style:{color:a.accent,flexShrink:0}}),n.jsx("span",{children:"You will be redirected to the login page shortly"})]})]});case"success":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #10b981, #059669)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(rt,{size:20})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Account Deleted"}),n.jsx("p",{style:{color:a.textTertiary,margin:"4px 0 0 0",fontSize:"14px",lineHeight:"1.4"},children:"Your account has been successfully deleted"})]})]}),n.jsxs("div",{style:{textAlign:"center",padding:"20px",background:`${a.success}10`,border:`1px solid ${a.success}20`,borderRadius:"12px",marginBottom:"24px"},children:[n.jsx(rt,{size:48,style:{color:a.success,marginBottom:"12px",display:"block",margin:"0 auto 12px auto"}}),n.jsx("p",{style:{color:a.textPrimary,fontSize:"16px",fontWeight:600,margin:"0 0 8px 0"},children:"Goodbye!"}),n.jsx("p",{style:{color:a.textSecondary,fontSize:"14px",margin:0,lineHeight:"1.5"},children:"Your account and all associated data have been permanently removed from our systems."})]}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px",background:`${a.accent}10`,borderRadius:"10px",fontSize:"14px",color:a.textSecondary,justifyContent:"center"},children:[n.jsx(ce,{size:16,style:{animation:"spin 1s linear infinite",color:a.accent}}),n.jsx("span",{children:"Redirecting to login page..."})]})]})}};return n.jsxs("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.8)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",zIndex:1e4,animation:"fadeIn 0.3s ease-out"},onClick:T,children:[n.jsx("div",{style:{backgroundColor:a.surface,border:`1px solid ${a.border}`,borderRadius:"20px",width:"100%",maxWidth:"480px",padding:"24px",boxShadow:"0 32px 64px rgba(0,0,0,0.4)",animation:"scaleIn 0.3s ease-out"},className:"delete-modal-container",children:B()}),n.jsx("style",{children:`
208
208
  @keyframes fadeIn {
209
209
  from { opacity: 0; }
210
210
  to { opacity: 1; }
@@ -491,7 +491,7 @@ React keys must be passed directly to JSX without using spread:
491
491
  animation: none;
492
492
  }
493
493
  }
494
- `})]})},cs=({token:e,user:t=null,darkMode:r=!0,homeUrl:s,onLogout:o,primaryColor:i="#00C212"})=>{const{baseUrl:a,apiKey:l,appId:h}=ge(),[c,u]=S.useState(t),[y,R]=S.useState(!0),[k,d]=S.useState(!1),[b,g]=S.useState(!1),[M,D]=S.useState(!1),[_,T]=S.useState(!1),[B,m]=S.useState(!1),[N,w]=S.useState(!1),[F,K]=S.useState(!1),[L,Y]=S.useState(!1),[Z,E]=S.useState(null),[J,H]=S.useState(!1),[A,I]=S.useState({email:"",otp:"",appId:h}),[q,f]=S.useState(!1),[C,z]=S.useState(!1),O=(v,V)=>{E({type:v,message:V}),setTimeout(()=>E(null),3e3)},x=()=>{Y(!0);const v=setTimeout(()=>{K(!1),Y(!1)},150);return()=>clearTimeout(v)};S.useEffect(()=>{const v=V=>{const Q=document.querySelector(".dropdown-container");Q&&!Q.contains(V.target)&&x()};return F&&document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[F]);const j=async()=>{if(!A.email||!/\S+@\S+\.\S+/.test(A.email)){O("error","Please enter a valid email");return}try{z(!0);const v=await W.post(`${a}/users/send-verify-otp/${c?.id}`,{email:A.email},{headers:{"x-api-key":l,"x-app-id":h}});v.data.success?(O("success",v.data.message||"OTP sent to email!"),f(!0)):O("error",v.data.message||"Failed to send OTP")}catch(v){O("error",v.response?.data?.message||"Server error")}finally{z(!1)}},X=async v=>{if(v.preventDefault(),!A.email||!A.otp){O("error","Please fill in all fields");return}try{z(!0);const V=await W.post(`${a}/users/verify-email`,A);if(V.data.success){if(O("success",V.data.message||"Email verified!"),c){const Q={...c,isVerified:!0};u(Q),localStorage.setItem("userInfo",JSON.stringify({...Q,token:e}))}I({email:"",otp:"",appId:h}),f(!1),w(!1)}else O("error",V.data.message||"Verification failed")}catch(V){O("error",V.response?.data?.message||"Something went wrong")}finally{z(!1)}},se=async v=>{if(!c)return!1;try{const V={...c,avatarUrl:v},{data:Q}=await W.put(`${a}/users/update/${c.id}`,V,{headers:{"x-api-key":l}});return Q.success?(u(V),localStorage.setItem("userInfo",JSON.stringify({...V,token:e})),O("success","Avatar updated successfully!"),!0):(O("error",Q.message||"Failed to update avatar"),!1)}catch(V){return console.error("Avatar update error:",V),O("error","Failed to update avatar"),!1}},G=async()=>{if(c){g(!0);try{const{data:v}=await W.put(`${a}/users/update/${c.id}`,c,{headers:{"x-api-key":l}});v.success?(u(v.user),d(!1),localStorage.setItem("userInfo",JSON.stringify({...v.user,token:e})),O("success","Profile updated successfully")):O("error",v.message)}catch(v){console.error(v),O("error","Update failed")}finally{g(!1)}}},oe=async v=>{try{const{data:V}=await W.get(`${a}/users/check-user/${v}?appId=${h}`,{headers:{"x-api-key":l}});(!V.success||!V.exists)&&(console.warn("User not found, clearing session..."),localStorage.removeItem("userInfo"),u(null))}catch(V){console.error("User check failed:",V),localStorage.removeItem("userInfo"),u(null)}};S.useEffect(()=>{(()=>{if(t)u(t),R(!1),oe(t.id);else{const V=localStorage.getItem("userInfo");if(V){const Q=JSON.parse(V);u(Q),R(!1),oe(Q.id)}else R(!1)}})()},[t]),S.useEffect(()=>{c?.email&&I(v=>({...v,email:c.email}))},[c?.email]);const de=(v,V)=>{let Q=parseInt(v.replace("#",""),16),me=(Q>>16)+V,it=(Q>>8&255)+V,lt=(Q&255)+V;return me=Math.min(255,Math.max(0,me)),it=Math.min(255,Math.max(0,it)),lt=Math.min(255,Math.max(0,lt)),`#${(lt|it<<8|me<<16).toString(16).padStart(6,"0")}`},P=r?{background:"#000000",surface:"#09090b",surfaceLight:"#27272a",surfaceLighter:"#3f3f46",textPrimary:"#ffffff",textSecondary:"#d4d4d8",textTertiary:"#a1a1aa",accent:i,accentHover:de(i,-15),success:"#10b981",error:"#ef4444",border:"#27272a",warning:"#f59e0b"}:{background:"#ffffff",surface:"#fafafa",surfaceLight:"#f4f4f5",surfaceLighter:"#e4e4e7",textPrimary:"#18181b",textSecondary:"#52525b",textTertiary:"#71717a",accent:i,accentHover:de(i,-15),success:"#10b981",error:"#ef4444",border:"#e4e4e7",warning:"#d97706"};if(y)return n.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:P.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif"},children:n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"16px",textAlign:"center"},children:[n.jsx(ce,{size:40,color:P.accent,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}),n.jsx("p",{style:{color:P.textTertiary,margin:0},children:"Loading your profile..."})]})});if(!c)return n.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:P.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif"},children:n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",textAlign:"center"},children:[n.jsx(le,{size:40,color:P.error,"aria-hidden":"true"}),n.jsx("p",{style:{color:P.textTertiary,margin:0},children:"No profile found. Please log in again."})]})});const at=[{label:"Full Name",value:c.name,name:"name",type:"text",icon:je},{label:"Email Address",value:c.email,name:"email",type:"email",icon:he},{label:"Phone Number",value:c.phone||"Not set",name:"phone",type:"tel",icon:qn},{label:"Address",value:c.address||"Not provided",name:"address",type:"text",icon:Vn}];return n.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:P.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif",lineHeight:1.5,minHeight:"80vh"},children:[Z&&n.jsxs("div",{style:{position:"fixed",top:"20px",right:"20px",padding:"12px 24px",borderRadius:"12px",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",backdropFilter:"blur(8px)",border:"1px solid",zIndex:1e3,display:"flex",alignItems:"center",gap:"8px",fontSize:"12px",fontWeight:500,maxWidth:"400px",animation:"slideIn 0.3s ease-out",...Z.type==="success"?{backgroundColor:r?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)",borderColor:r?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)",color:r?"#34d399":"#059669"}:{backgroundColor:r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)",borderColor:r?"rgba(239, 68, 68, 0.3)":"rgba(239, 68, 68, 0.2)",color:r?"#f87171":"#dc2626"}},role:"alert","aria-live":"polite",children:[Z.type==="success"?n.jsx(xe,{size:20,"aria-hidden":"true"}):n.jsx(le,{size:20,"aria-hidden":"true"}),Z.message]}),n.jsx("div",{style:{maxWidth:"1200px",margin:"0 auto",padding:"16px",width:"100%",boxSizing:"border-box"},children:n.jsxs("div",{style:{display:"grid",gap:"24px",gridTemplateColumns:"1fr",...window.innerWidth>=1024&&{gridTemplateColumns:"1fr 2fr",gap:"10px"},...window.innerWidth>=768&&window.innerWidth<1024&&{gap:"10px"},...window.innerWidth>=600&&window.innerWidth<768&&{gap:"28px"}},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px",height:"100%"},children:[n.jsxs("section",{style:{backgroundColor:P.surface,borderRadius:"16px",position:"relative",padding:"24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)",textAlign:"center",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",flex:1,minHeight:"300px"},children:[s&&n.jsx("a",{href:s||"/",target:"_self",rel:"noopener noreferrer",style:{position:"absolute",top:"18px",left:"18px"},children:n.jsx(Wn,{size:20,style:{color:r?"#ffffff":"#000000"}})}),n.jsxs("div",{style:{position:"relative",display:"inline-block",marginBottom:"16px"},children:[n.jsx("img",{src:c.avatarUrl||`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(c.name)}`,alt:`Profile avatar of ${c.name}`,style:{width:"128px",height:"128px",borderRadius:"50%",objectFit:"cover",boxShadow:"0 10px 25px -5px rgba(0, 0, 0, 0.3)",border:`3px solid ${P.border}`},width:128,height:128,loading:"eager"}),n.jsx("button",{onClick:()=>D(!0),style:{position:"absolute",bottom:"8px",right:"8px",backgroundColor:P.accent,color:"white",padding:"8px",borderRadius:"50%",border:"none",cursor:"pointer",transition:"all 0.2s ease",display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px"},"aria-label":"Change profile picture",children:n.jsx(tt,{size:16,"aria-hidden":"true"})})]}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:600,margin:"0 0 4px 0",color:P.textPrimary},children:c.name}),n.jsx("p",{style:{color:P.textTertiary,margin:"0 0 8px 0"},children:c.email}),n.jsxs("div",{style:{backgroundColor:c.isVerified?r?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)":r?"rgba(245, 158, 11, 0.1)":"rgba(245, 158, 11, 0.05)",color:c.isVerified?P.success:P.warning,border:`1px solid ${c.isVerified?r?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)":r?"rgba(245, 158, 11, 0.3)":"rgba(245, 158, 11, 0.2)"}`,padding:"6px 12px",borderRadius:"20px",fontSize:"12px",fontWeight:500,display:"inline-flex",alignItems:"center",gap:"6px",marginTop:"8px"},children:[c.isVerified?n.jsx(xe,{size:16,"aria-hidden":"true"}):n.jsx(le,{size:16,"aria-hidden":"true"}),c.isVerified?"Email Verified":"Not Verified"]})]}),n.jsx("nav",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:k?n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>d(!1),style:{backgroundColor:P.surfaceLight,border:`1px solid ${P.border}`,color:P.textPrimary,padding:"10px 20px",borderRadius:"6px",borderStyle:"solid",cursor:"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",flex:window.innerWidth<1024?"1":"auto"},children:[n.jsx(Pe,{size:16,"aria-hidden":"true"}),"Cancel"]}),n.jsxs("button",{onClick:G,disabled:b,style:{background:`linear-gradient(to right, ${P.accent}, ${P.accentHover})`,opacity:b?.7:1,color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:b?"not-allowed":"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",flex:window.innerWidth<1024?"1":"auto"},children:[b?n.jsx(ce,{size:16,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):n.jsx(Kn,{size:16,"aria-hidden":"true"}),b?"Saving...":"Save Changes"]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>d(!0),style:{background:`linear-gradient(to right, ${P.accent}, ${P.accentHover})`,color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",flex:window.innerWidth<1024?"1":"auto"},children:[n.jsx(Yn,{size:16,"aria-hidden":"true"}),"Edit Profile"]}),n.jsxs("div",{style:{position:"relative"},children:[n.jsxs("button",{style:{backgroundColor:P.surfaceLight,color:P.textPrimary,padding:"10px 20px",borderRadius:"6px",border:"none",cursor:"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",width:"100%",boxSizing:"border-box"},onClick:()=>K(!F),children:[n.jsx(Bn,{size:16,"aria-hidden":"true"}),"More Actions"]}),F&&n.jsxs("div",{className:`dropdown-container ${L?"closing":""}`,style:{position:"absolute",bottom:"100%",left:0,right:0,backgroundColor:P.surface,border:`1px solid ${P.border}`,borderRadius:"12px 12px 0 0",boxShadow:"0 -8px 24px rgba(0, 0, 0, 0.25)",zIndex:200,marginBottom:"6px",overflow:"hidden",animation:`${L?"drawerSlideDown":"drawerSlideUp"} 0.25s ease-out forwards`},children:[n.jsxs("button",{onClick:()=>{T(!0),x()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:P.textPrimary,cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:v=>v.currentTarget.style.backgroundColor=P.surfaceLight,onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[n.jsx(tr,{size:14,"aria-hidden":"true"}),"Change Password"]}),!c.isVerified&&n.jsxs("button",{onClick:()=>{w(!0),x()},disabled:J,style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:J?P.textTertiary:P.warning,cursor:J?"not-allowed":"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",textAlign:"left",opacity:J?.6:1},onMouseEnter:v=>{J||(v.currentTarget.style.backgroundColor=P.surfaceLight)},onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[J?n.jsx(ce,{size:14,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):n.jsx(rr,{size:14,"aria-hidden":"true"}),J?"Sending...":"Verify Email"]}),o&&n.jsxs("button",{onClick:()=>{o(),x()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:r?"#fca5a5":"#dc2626",cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor=r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[n.jsx(ot,{size:14,"aria-hidden":"true"}),"Logout"]}),n.jsxs("button",{onClick:()=>{m(!0),x()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:"#ef4444",cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:600,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor=r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[n.jsx(We,{size:14,"aria-hidden":"true"}),"Delete Account"]})]})]})]})})]}),n.jsxs("div",{style:{minWidth:0,display:"flex",flexDirection:"column",gap:"12px"},children:[n.jsxs("section",{style:{backgroundColor:P.surface,borderRadius:"16px",padding:"24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},children:[n.jsxs("h2",{style:{fontSize:"20px",fontWeight:600,margin:"0 0 24px 0",color:P.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(je,{size:20,"aria-hidden":"true"}),"Personal Information"]}),n.jsx("div",{style:{display:"grid",gap:"20px",gridTemplateColumns:"1fr",...window.innerWidth>=600&&{gridTemplateColumns:"1fr 1fr",gap:"20px"}},children:at.map(v=>{const V=v.icon;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[n.jsxs("label",{style:{color:P.textTertiary,fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(V,{size:16,"aria-hidden":"true"}),v.label]}),k?n.jsx("input",{type:v.type,name:v.name,value:c[v.name],onChange:Q=>u(me=>me&&{...me,[Q.target.name]:Q.target.value}),style:{padding:"12px",borderRadius:"8px",border:`1px solid ${i}`,backgroundColor:"transparent",color:P.textPrimary,fontSize:"12px",outline:"none",transition:"border-color 0.2s ease",minHeight:"44px",width:"100%",boxSizing:"border-box"},placeholder:`Enter ${v.label.toLowerCase()}`,"aria-label":v.label}):n.jsx("div",{style:{padding:"12px",borderRadius:"8px",border:"1px solid transparent",fontSize:"12px",minHeight:"44px",display:"flex",alignItems:"center",boxSizing:"border-box",color:P.textPrimary,backgroundColor:r?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},children:v.value})]},v.name)})})]}),n.jsxs("section",{style:{backgroundColor:P.surface,borderRadius:"16px",padding:"30px 24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},children:[n.jsxs("h2",{style:{fontSize:"20px",fontWeight:600,margin:"0 0 24px 0",color:P.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(nr,{size:20,"aria-hidden":"true"}),"Security Status"]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 0"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",color:P.textSecondary},children:[n.jsx(he,{size:16,"aria-hidden":"true"}),n.jsx("span",{children:"Email Verification"})]}),n.jsx("div",{style:{padding:"6px 12px",borderRadius:"8px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px",...c.isVerified?{backgroundColor:r?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)",color:P.success,border:`1px solid ${r?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)"}`}:{backgroundColor:r?"rgba(245, 158, 11, 0.1)":"rgba(245, 158, 11, 0.05)",color:P.warning,border:`1px solid ${r?"rgba(245, 158, 11, 0.3)":"rgba(245, 158, 11, 0.2)"}`}},children:c.isVerified?n.jsxs(n.Fragment,{children:[n.jsx(xe,{size:16,"aria-hidden":"true"}),"Verified"]}):n.jsxs(n.Fragment,{children:[n.jsx(le,{size:16,"aria-hidden":"true"}),"Not Verified"]})})]}),!c.isVerified&&n.jsx("div",{style:{padding:"12px",borderRadius:"8px",backgroundColor:r?"rgba(100, 100, 100, 0.1)":"rgba(0, 0, 0, 0.05)"},children:n.jsx("p",{style:{color:P.textTertiary,fontSize:"12px",margin:0},children:"Verify your email to unlock all features and enhance your account security."})})]})]})]})]})}),n.jsx(as,{isOpen:M,onClose:()=>{D(!1)},onUpdate:se,colors:P}),n.jsx(is,{baseUrl:a,apiKey:l,appId:h,userId:c.id,isOpen:_,onClose:()=>T(!1),onSuccess:v=>O("success",v),onError:v=>O("error",v),colors:P}),n.jsx(os,{baseUrl:a,apiKey:l,appId:h,userId:c.id,token:e,isOpen:B,onClose:()=>m(!1),onSuccess:v=>O("success",v),onError:v=>O("error",v),colors:P}),n.jsx(ls,{isOpen:N,onClose:()=>{w(!1),f(!1),I({email:c?.email||"",otp:"",appId:h})},onVerify:X,onSendOTP:j,verifyFormData:A,setVerifyFormData:I,otpSent:q,verifying:C,user:c,colors:P,darkMode:r}),n.jsx("style",{children:`
494
+ `})]})},cs=({token:e,user:t=null,darkMode:r=!0,homeUrl:s,onLogout:o,primaryColor:i="#00C212"})=>{const{baseUrl:a,apiKey:l,appId:h}=ge(),[c,u]=S.useState(t),[y,R]=S.useState(!0),[k,d]=S.useState(!1),[b,g]=S.useState(!1),[M,D]=S.useState(!1),[_,T]=S.useState(!1),[B,m]=S.useState(!1),[N,w]=S.useState(!1),[F,K]=S.useState(!1),[L,Y]=S.useState(!1),[Z,E]=S.useState(null),[J,H]=S.useState(!1),[A,I]=S.useState({email:"",otp:"",appId:h}),[q,f]=S.useState(!1),[C,z]=S.useState(!1),O=(v,V)=>{E({type:v,message:V}),setTimeout(()=>E(null),3e3)},x=()=>{Y(!0);const v=setTimeout(()=>{K(!1),Y(!1)},150);return()=>clearTimeout(v)};S.useEffect(()=>{const v=V=>{const Q=document.querySelector(".dropdown-container");Q&&!Q.contains(V.target)&&x()};return F&&document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[F]);const j=async()=>{if(!A.email||!/\S+@\S+\.\S+/.test(A.email)){O("error","Please enter a valid email");return}try{z(!0);const v=await W.post(`${a}/users/send-verify-otp/${c?.id}`,{email:A.email},{headers:{"x-api-key":l,"x-app-id":h}});v.data.success?(O("success",v.data.message||"OTP sent to email!"),f(!0)):O("error",v.data.message||"Failed to send OTP")}catch(v){O("error",v.response?.data?.message||"Server error")}finally{z(!1)}},X=async v=>{if(v.preventDefault(),!A.email||!A.otp){O("error","Please fill in all fields");return}try{z(!0);const V=await W.post(`${a}/users/verify-email`,A);if(V.data.success){if(O("success",V.data.message||"Email verified!"),c){const Q={...c,isVerified:!0};u(Q),localStorage.setItem("userInfo",JSON.stringify({...Q,token:e}))}I({email:"",otp:"",appId:h}),f(!1),w(!1)}else O("error",V.data.message||"Verification failed")}catch(V){O("error",V.response?.data?.message||"Something went wrong")}finally{z(!1)}},se=async v=>{if(!c)return!1;try{const V={...c,avatarUrl:v},{data:Q}=await W.put(`${a}/users/update/${c.id}`,V,{headers:{"x-api-key":l}});return Q.success?(u(V),localStorage.setItem("userInfo",JSON.stringify({...V,token:e})),O("success","Avatar updated successfully!"),!0):(O("error",Q.message||"Failed to update avatar"),!1)}catch(V){return console.error("Avatar update error:",V),O("error","Failed to update avatar"),!1}},G=async()=>{if(c){g(!0);try{const{data:v}=await W.put(`${a}/users/update/${c.id}`,c,{headers:{"x-api-key":l}});v.success?(u(v.user),d(!1),localStorage.setItem("userInfo",JSON.stringify({...v.user,token:e})),O("success","Profile updated successfully")):O("error",v.message)}catch(v){console.error(v),O("error","Update failed")}finally{g(!1)}}},oe=async v=>{try{const{data:V}=await W.get(`${a}/users/check-user/${v}?appId=${h}`,{headers:{"x-api-key":l}});(!V.success||!V.exists)&&(console.warn("User not found, clearing session..."),localStorage.removeItem("userInfo"),u(null))}catch(V){console.error("User check failed:",V),localStorage.removeItem("userInfo"),u(null)}};S.useEffect(()=>{(()=>{if(t)u(t),R(!1),oe(t.id);else{const V=localStorage.getItem("userInfo");if(V){const Q=JSON.parse(V);u(Q),R(!1),oe(Q.id)}else R(!1)}})()},[t]),S.useEffect(()=>{c?.email&&I(v=>({...v,email:c.email}))},[c?.email]);const de=(v,V)=>{let Q=parseInt(v.replace("#",""),16),me=(Q>>16)+V,it=(Q>>8&255)+V,lt=(Q&255)+V;return me=Math.min(255,Math.max(0,me)),it=Math.min(255,Math.max(0,it)),lt=Math.min(255,Math.max(0,lt)),`#${(lt|it<<8|me<<16).toString(16).padStart(6,"0")}`},P=r?{background:"#000000",surface:"#09090b",surfaceLight:"#27272a",surfaceLighter:"#3f3f46",textPrimary:"#ffffff",textSecondary:"#d4d4d8",textTertiary:"#a1a1aa",accent:i,accentHover:de(i,-15),success:"#10b981",error:"#ef4444",border:"#27272a",warning:"#f59e0b"}:{background:"#ffffff",surface:"#fafafa",surfaceLight:"#f4f4f5",surfaceLighter:"#e4e4e7",textPrimary:"#18181b",textSecondary:"#52525b",textTertiary:"#71717a",accent:i,accentHover:de(i,-15),success:"#10b981",error:"#ef4444",border:"#e4e4e7",warning:"#d97706"};if(y)return n.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:P.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif"},children:n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"16px",textAlign:"center"},children:[n.jsx(ce,{size:40,color:P.accent,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}),n.jsx("p",{style:{color:P.textTertiary,margin:0},children:"Loading your profile..."})]})});if(!c)return n.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:P.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif"},children:n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",textAlign:"center"},children:[n.jsx(le,{size:40,color:P.error,"aria-hidden":"true"}),n.jsx("p",{style:{color:P.textTertiary,margin:0},children:"No profile found. Please log in again."})]})});const at=[{label:"Full Name",value:c.name,name:"name",type:"text",icon:je},{label:"Email Address",value:c.email,name:"email",type:"email",icon:he},{label:"Phone Number",value:c.phone||"Not set",name:"phone",type:"tel",icon:qn},{label:"Address",value:c.address||"Not provided",name:"address",type:"text",icon:Vn}];return n.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:P.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif",lineHeight:1.5,minHeight:"80vh"},children:[Z&&n.jsxs("div",{style:{position:"fixed",top:"20px",right:"20px",padding:"12px 24px",borderRadius:"12px",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",backdropFilter:"blur(8px)",border:"1px solid",zIndex:1e3,display:"flex",alignItems:"center",gap:"8px",fontSize:"12px",fontWeight:500,maxWidth:"400px",animation:"slideIn 0.3s ease-out",...Z.type==="success"?{backgroundColor:r?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)",borderColor:r?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)",color:r?"#34d399":"#059669"}:{backgroundColor:r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)",borderColor:r?"rgba(239, 68, 68, 0.3)":"rgba(239, 68, 68, 0.2)",color:r?"#f87171":"#dc2626"}},role:"alert","aria-live":"polite",children:[Z.type==="success"?n.jsx(xe,{size:20,"aria-hidden":"true"}):n.jsx(le,{size:20,"aria-hidden":"true"}),Z.message]}),n.jsx("div",{style:{maxWidth:"1200px",margin:"0 auto",width:"100%",boxSizing:"border-box"},children:n.jsxs("div",{style:{display:"grid",gap:"24px",gridTemplateColumns:"1fr",...window.innerWidth>=1024&&{gridTemplateColumns:"1fr 2fr",gap:"10px"},...window.innerWidth>=768&&window.innerWidth<1024&&{gap:"10px"},...window.innerWidth>=600&&window.innerWidth<768&&{gap:"28px"}},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px",height:"100%"},children:[n.jsxs("section",{style:{backgroundColor:P.surface,borderRadius:"16px",position:"relative",padding:"24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)",textAlign:"center",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",flex:1,minHeight:"300px"},children:[s&&n.jsx("a",{href:s||"/",target:"_self",rel:"noopener noreferrer",style:{position:"absolute",top:"18px",left:"18px"},children:n.jsx(Wn,{size:20,style:{color:r?"#ffffff":"#000000"}})}),n.jsxs("div",{style:{position:"relative",display:"inline-block",marginBottom:"16px"},children:[n.jsx("img",{src:c.avatarUrl||`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(c.name)}`,alt:`Profile avatar of ${c.name}`,style:{width:"128px",height:"128px",borderRadius:"50%",objectFit:"cover",boxShadow:"0 10px 25px -5px rgba(0, 0, 0, 0.3)",border:`3px solid ${P.border}`},width:128,height:128,loading:"eager"}),n.jsx("button",{onClick:()=>D(!0),style:{position:"absolute",bottom:"8px",right:"8px",backgroundColor:P.accent,color:"white",padding:"8px",borderRadius:"50%",border:"none",cursor:"pointer",transition:"all 0.2s ease",display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px"},"aria-label":"Change profile picture",children:n.jsx(tt,{size:16,"aria-hidden":"true"})})]}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:600,margin:"0 0 4px 0",color:P.textPrimary},children:c.name}),n.jsx("p",{style:{color:P.textTertiary,margin:"0 0 8px 0"},children:c.email}),n.jsxs("div",{style:{backgroundColor:c.isVerified?r?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)":r?"rgba(245, 158, 11, 0.1)":"rgba(245, 158, 11, 0.05)",color:c.isVerified?P.success:P.warning,border:`1px solid ${c.isVerified?r?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)":r?"rgba(245, 158, 11, 0.3)":"rgba(245, 158, 11, 0.2)"}`,padding:"6px 12px",borderRadius:"20px",fontSize:"12px",fontWeight:500,display:"inline-flex",alignItems:"center",gap:"6px",marginTop:"8px"},children:[c.isVerified?n.jsx(xe,{size:16,"aria-hidden":"true"}):n.jsx(le,{size:16,"aria-hidden":"true"}),c.isVerified?"Email Verified":"Not Verified"]})]}),n.jsx("nav",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:k?n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>d(!1),style:{backgroundColor:P.surfaceLight,border:`1px solid ${P.border}`,color:P.textPrimary,padding:"10px 20px",borderRadius:"6px",borderStyle:"solid",cursor:"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",flex:window.innerWidth<1024?"1":"auto"},children:[n.jsx(Pe,{size:16,"aria-hidden":"true"}),"Cancel"]}),n.jsxs("button",{onClick:G,disabled:b,style:{background:`linear-gradient(to right, ${P.accent}, ${P.accentHover})`,opacity:b?.7:1,color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:b?"not-allowed":"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",flex:window.innerWidth<1024?"1":"auto"},children:[b?n.jsx(ce,{size:16,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):n.jsx(Kn,{size:16,"aria-hidden":"true"}),b?"Saving...":"Save Changes"]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>d(!0),style:{background:`linear-gradient(to right, ${P.accent}, ${P.accentHover})`,color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",flex:window.innerWidth<1024?"1":"auto"},children:[n.jsx(Yn,{size:16,"aria-hidden":"true"}),"Edit Profile"]}),n.jsxs("div",{style:{position:"relative"},children:[n.jsxs("button",{style:{backgroundColor:P.surfaceLight,color:P.textPrimary,padding:"10px 20px",borderRadius:"6px",border:"none",cursor:"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",width:"100%",boxSizing:"border-box"},onClick:()=>K(!F),children:[n.jsx(Bn,{size:16,"aria-hidden":"true"}),"More Actions"]}),F&&n.jsxs("div",{className:`dropdown-container ${L?"closing":""}`,style:{position:"absolute",bottom:"100%",left:0,right:0,backgroundColor:P.surface,border:`1px solid ${P.border}`,borderRadius:"12px 12px 0 0",boxShadow:"0 -8px 24px rgba(0, 0, 0, 0.25)",zIndex:200,marginBottom:"6px",overflow:"hidden",animation:`${L?"drawerSlideDown":"drawerSlideUp"} 0.25s ease-out forwards`},children:[n.jsxs("button",{onClick:()=>{T(!0),x()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:P.textPrimary,cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:v=>v.currentTarget.style.backgroundColor=P.surfaceLight,onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[n.jsx(tr,{size:14,"aria-hidden":"true"}),"Change Password"]}),!c.isVerified&&n.jsxs("button",{onClick:()=>{w(!0),x()},disabled:J,style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:J?P.textTertiary:P.warning,cursor:J?"not-allowed":"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",textAlign:"left",opacity:J?.6:1},onMouseEnter:v=>{J||(v.currentTarget.style.backgroundColor=P.surfaceLight)},onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[J?n.jsx(ce,{size:14,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):n.jsx(rr,{size:14,"aria-hidden":"true"}),J?"Sending...":"Verify Email"]}),o&&n.jsxs("button",{onClick:()=>{o(),x()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:r?"#fca5a5":"#dc2626",cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor=r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[n.jsx(ot,{size:14,"aria-hidden":"true"}),"Logout"]}),n.jsxs("button",{onClick:()=>{m(!0),x()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:"#ef4444",cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:600,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor=r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:v=>v.currentTarget.style.backgroundColor="transparent",children:[n.jsx(We,{size:14,"aria-hidden":"true"}),"Delete Account"]})]})]})]})})]}),n.jsxs("div",{style:{minWidth:0,display:"flex",flexDirection:"column",gap:"12px"},children:[n.jsxs("section",{style:{backgroundColor:P.surface,borderRadius:"16px",padding:"24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},children:[n.jsxs("h2",{style:{fontSize:"20px",fontWeight:600,margin:"0 0 24px 0",color:P.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(je,{size:20,"aria-hidden":"true"}),"Personal Information"]}),n.jsx("div",{style:{display:"grid",gap:"20px",gridTemplateColumns:"1fr",...window.innerWidth>=600&&{gridTemplateColumns:"1fr 1fr",gap:"20px"}},children:at.map(v=>{const V=v.icon;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[n.jsxs("label",{style:{color:P.textTertiary,fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(V,{size:16,"aria-hidden":"true"}),v.label]}),k?n.jsx("input",{type:v.type,name:v.name,value:c[v.name],onChange:Q=>u(me=>me&&{...me,[Q.target.name]:Q.target.value}),style:{padding:"12px",borderRadius:"8px",border:`1px solid ${i}`,backgroundColor:"transparent",color:P.textPrimary,fontSize:"12px",outline:"none",transition:"border-color 0.2s ease",minHeight:"44px",width:"100%",boxSizing:"border-box"},placeholder:`Enter ${v.label.toLowerCase()}`,"aria-label":v.label}):n.jsx("div",{style:{padding:"12px",borderRadius:"8px",border:"1px solid transparent",fontSize:"12px",minHeight:"44px",display:"flex",alignItems:"center",boxSizing:"border-box",color:P.textPrimary,backgroundColor:r?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},children:v.value})]},v.name)})})]}),n.jsxs("section",{style:{backgroundColor:P.surface,borderRadius:"16px",padding:"30px 24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},children:[n.jsxs("h2",{style:{fontSize:"20px",fontWeight:600,margin:"0 0 24px 0",color:P.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(nr,{size:20,"aria-hidden":"true"}),"Security Status"]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 0"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",color:P.textSecondary},children:[n.jsx(he,{size:16,"aria-hidden":"true"}),n.jsx("span",{children:"Email Verification"})]}),n.jsx("div",{style:{padding:"6px 12px",borderRadius:"8px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px",...c.isVerified?{backgroundColor:r?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)",color:P.success,border:`1px solid ${r?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)"}`}:{backgroundColor:r?"rgba(245, 158, 11, 0.1)":"rgba(245, 158, 11, 0.05)",color:P.warning,border:`1px solid ${r?"rgba(245, 158, 11, 0.3)":"rgba(245, 158, 11, 0.2)"}`}},children:c.isVerified?n.jsxs(n.Fragment,{children:[n.jsx(xe,{size:16,"aria-hidden":"true"}),"Verified"]}):n.jsxs(n.Fragment,{children:[n.jsx(le,{size:16,"aria-hidden":"true"}),"Not Verified"]})})]}),!c.isVerified&&n.jsx("div",{style:{padding:"12px",borderRadius:"8px",backgroundColor:r?"rgba(100, 100, 100, 0.1)":"rgba(0, 0, 0, 0.05)"},children:n.jsx("p",{style:{color:P.textTertiary,fontSize:"12px",margin:0},children:"Verify your email to unlock all features and enhance your account security."})})]})]})]})]})}),n.jsx(as,{isOpen:M,onClose:()=>{D(!1)},onUpdate:se,colors:P}),n.jsx(is,{baseUrl:a,apiKey:l,appId:h,userId:c.id,isOpen:_,onClose:()=>T(!1),onSuccess:v=>O("success",v),onError:v=>O("error",v),colors:P}),n.jsx(os,{baseUrl:a,apiKey:l,appId:h,userId:c.id,token:e,isOpen:B,onClose:()=>m(!1),onSuccess:v=>O("success",v),onError:v=>O("error",v),colors:P}),n.jsx(ls,{isOpen:N,onClose:()=>{w(!1),f(!1),I({email:c?.email||"",otp:"",appId:h})},onVerify:X,onSendOTP:j,verifyFormData:A,setVerifyFormData:I,otpSent:q,verifying:C,user:c,colors:P,darkMode:r}),n.jsx("style",{children:`
495
495
  @keyframes slideIn {
496
496
  from {
497
497
  transform: translateX(100%);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neuctra/authix",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "description": "Authentication SDK and UI components library for React and Vue with TailwindCSS",
5
5
  "author": "Taha Asif",
6
6
  "license": "MIT",