PageSourceSearch

https://analyticsindiamag.com/assets/Profile-CbgKB0Aa.js

js analyticsindiamag.com collected 2026-09-24 08:26:49 UTC 36,467 bytes, 1 lines download raw bytes

1import{a as ae,r as p,j as e,m as i,B as f,A as D,L as A,I as b,s as P,a1 as H,br as $,S as me,a3 as q,X as se,u as xe,e as pe,G as F,H as he,bs as ue}from"./index-KSWbwNeY.js";import{P as ge}from"./ProfileSidebar-RSiubeOO.js";import{T as fe}from"./textarea-BXv-lbww.js";import{R as ve}from"./receipt-DgWJf9Ou.js";import{P as R}from"./pencil-BI2V26IC.js";import be from"./Footer-DPSMpmUX.js";import{D as je,a as Ne,b as we,c as ye}from"./dialog-Bpfij23O.js";import{T as ke,a as Ce,b as V,c as K}from"./tabs-BRVJAWkX.js";import{R as _e}from"./rotate-ccw-L8AGeQxc.js";import{P as Se}from"./palette-DgiBJZzP.js";import{U as Ee}from"./upload-CstIFHrJ.js";import{G as Te}from"./globe-CoeBqXIi.js";import{B as Pe}from"./building-2-BHBT7DvO.js";import{B as ze}from"./briefcase-B44Bkvp2.js";import{L as Ie}from"./linkedin-B1bA0DJP.js";import{T as Ae}from"./twitter-yEUqfNJX.js";import"./alert-dialog-DFWe8irl.js";import"./index-BpbyRUKB.js";import"./trash-2-CwcwS_bf.js";import"./lock-DNHSxtLD.js";import"./monitor-DWTsCiB7.js";import"./youtube-CwivUiPT.js";import"./facebook-DahhNxAJ.js";const W=[{key:"billing_name",label:"Billing Name"},{key:"billing_email",label:"Billing Email"},{key:"billing_address",label:"Billing Address",type:"textarea"},{key:"billing_state",label:"State"},{key:"billing_gstin",label:"GSTIN"},{key:"company_name",label:"Company Name"},{key:"company_address",label:"Company Address",type:"textarea"},{key:"company_gstin",label:"Company GSTIN"}],He=({userId:s,isAdmin:m})=>{const{toast:u}=ae(),[z,o]=p.useState(!0),[w,_]=p.useState(!1),[n,k]=p.useState(!1),[h,C]=p.useState(null),[g,j]=p.useState({});p.useEffect(()=>{let d=!1;return(async()=>{o(!0);const{data:E,error:r}=await P.from("invoices").select("id, billing_name, billing_email, billing_address, billing_state, billing_gstin, company_name, company_address, company_gstin").eq("user_id",s).order("invoice_date",{ascending:!1}).limit(1);d||(r&&console.error("Failed to load billing",r),C(E&&E.length>0?E[0]:null),o(!1))})(),()=>{d=!0}},[s]);const l=()=>{j(h??{}),k(!0)},c=()=>{k(!1),j({})},x=async()=>{if(!(h!=null&&h.id))return;_(!0);const d=W.reduce((E,r)=>{var I;return E[r.key]=((I=g[r.key])==null?void 0:I.trim())||null,E},{}),{error:S}=await P.from("invoices").update(d).eq("id",h.id);if(_(!1),S){u({title:"Could not save",description:S.message,variant:"destructive"});return}C({...h,...d}),k(!1),u({title:"Billing address updated"})};return e.jsxs(i.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.4},className:"bg-white rounded-2xl shadow-sm border border-slate-100 p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ve,{className:"h-4 w-4 text-slate-500"}),e.jsx("h2",{className:"text-[15px] font-semibold text-slate-900 font-sans",children:"Billing Address"})]}),m&&!n&&h&&e.jsx(i.div,{whileHover:{scale:1.02},whileTap:{scale:.98},children:e.jsxs(f,{variant:"outline",size:"sm",onClick:l,className:"rounded-lg border-slate-200 text-slate-600 hover:bg-slate-50 hover:border-slate-300 text-[12px] font-medium h-8 px-3",children:[e.jsx(R,{className:"h-3 w-3 mr-1.5"}),"Edit"]})})]}),!m&&e.jsx("p",{className:"text-[11px] text-slate-400 mb-3 font-sans",children:"Billing details are taken from your latest invoice. Contact support to make changes."}),e.jsx(D,{mode:"wait",children:z?e.jsx(i.div,{className:"h-20 flex items-center justify-center",children:e.jsx(A,{className:"h-4 w-4 animate-spin text-slate-400"})},"loading"):h?n?e.jsxs(i.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"space-y-3",children:[e.jsx("div",{className:"grid sm:grid-cols-2 gap-3",children:W.map(d=>e.jsxs("div",{className:d.type==="textarea"?"sm:col-span-2 space-y-1":"space-y-1",children:[e.jsx("label",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wide",children:d.label}),d.type==="textarea"?e.jsx(fe,{value:g[d.key]??"",onChange:S=>j({...g,[d.key]:S.target.value}
1),className:"rounded-lg border-slate-200 text-[13px] min-h-[60px]"}):e.jsx(b,{value:g[d.key]??"",onChange:S=>j({...g,[d.key]:S.target.value}),className:"rounded-lg border-slate-200 text-[13px] h-9"})]},d.key))}),e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-1",children:[e.jsx("button",{onClick:c,className:"text-[12px] font-medium text-slate-500 hover:text-slate-700 transition-colors",children:"Cancel"}),e.jsx(i.div,{whileHover:{scale:1.02},whileTap:{scale:.98},children:e.jsx(f,{size:"sm",onClick:x,disabled:w,className:"bg-emerald-500 hover:bg-emerald-600 text-white rounded-lg text-[12px] font-medium h-8 px-4",children:w?e.jsx(A,{className:"h-3.5 w-3.5 animate-spin"}):"Save changes"})})]})]},"edit"):e.jsx(i.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"grid sm:grid-cols-2 gap-4",children:W.map(d=>e.jsxs("div",{className:d.type==="textarea"?"sm:col-span-2":"",children:[e.jsx("p",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wide mb-0.5",children:d.label}),e.jsx("p",{className:"text-[13px] font-medium text-slate-800 whitespace-pre-line break-words",children:h[d.key]||"—"})]},d.key))},"view"):e.jsx(i.p,{initial:{opacity:0}
1,animate:{opacity:1},className:"text-[13px] text-slate-500 font-sans py-2",children:"No billing address on file yet. It will be saved automatically from your next invoice."},"empty")})]})},te={baseIndex:0,accessories:{}},ie=[{id:"none",name:"None",icon:"∅"},{id:"santa",name:"Santa Hat",icon:"🎅"},{id:"graduation",name:"Graduation Cap",icon:"🎓"},{id:"crown",name:"Crown",icon:"👑"},{id:"party",name:"Party Hat",icon:"🎉"},{id:"cowboy",name:"Cowboy Hat",icon:"🤠"},{id:"beanie",name:"Beanie",icon:"🧢"}],le=[{id:"none",name:"None",icon:"∅"},{id:"round",name:"Round Glasses",icon:"👓"},{id:"aviator",name:"Aviator",icon:"🕶️"},{id:"heart",name:"Heart Glasses",icon:"💕"},{id:"monocle",name:"Monocle",icon:"🧐"},{id:"nerd",name:"Nerd Glasses",icon:"🤓"}],De=[{id:"none",name:"None",icon:"∅"},{id:"gold",name:"Gold Ring",icon:"🥇"},{id:"silver",name:"Silver Ring",icon:"🥈"},{id:"rainbow",name:"Rainbow",icon:"🌈"},{id:"fire",name:"Fire Ring",icon:"🔥"},{id:"sparkle",name:"Sparkle",icon:"✨"}],Be=[{id:"none",name:"None",icon:"∅"},{id:"purple",name:"Purple Gradient",icon:"💜"},{id:"sunset",name:"Sunset",icon:"🌅"},{id:"ocean",name:"Ocean",icon:"🌊"},{id:"forest",name:"Forest",icon:"🌲"},{id:"stars",name:"Starry Night",icon:"⭐"}],Q=[{id:"hat",name:"Hats",icon:"🎩",items:ie},{id:"glasses",name:"Glasses",icon:"👓",items:le},{id:"frame",name:"Frames",icon:"🖼️",items:De},{id:"background",name:"Backgrounds",icon:"🌈",items:Be}],Le=s=>{switch(s){case"gold":return"ring-4 ring-amber-400 shadow-lg shadow-amber-200/50";case"silver":return"ring-4 ring-slate-300 shadow-lg shadow-slate-200/50";case"rainbow":return"ring-4 ring-gradient-rainbow animate-pulse";case"fire":return"ring-4 ring-orange-500 shadow-lg shadow-orange-300/50";case"sparkle":return"ring-4 ring-purple-400 shadow-lg shadow-purple-200/50";default:return""}},Fe=s=>{switch(s){case"purple":return"bg-gradient-to-br from-purple-500 to-pink-500";case"sunset":return"bg-gradient-to-br from-orange-400 via-pink-500 to-purple-600";case"ocean":return"bg-gradient-to-br from-cyan-400 to-blue-600";case"forest":return"bg-gradient-to-br from-green-400 to-emerald-600";case"stars":return"bg-gradient-to-br from-indigo-900 to-purple-900";default:return""}},Re=s=>{const m=ie.find(u=>u.id===s);return(m==null?void 0:m.icon)||""},Ge=s=>{const m=le.find(u=>u.id===s);return(m==null?void 0:m.icon)||""},Oe={sm:"h-8 w-8 text-xs",md:"h-10 w-10 text-sm",lg:"h-16 w-16 text-base",xl:"h-24 w-24 text-lg"},Ue={sm:"text-[10px]",md:"text-xs",lg:"text-base",xl:"text-xl"},$e={sm:"text-[8px]",md:"text-[10px]",lg:"text-sm",xl:"text-base"},J=p.memo(({config:s,avatarUrl:m,size:u="md",className:z,fallbackName:o})=>{const w=m&&!$.includes(m),_=(s==null?void 0:s.baseIndex)??0,n=(s==null?void 0:s.accessories)??{},k=_!==void 0?$[_]:m||$[0];Object.values(n).some(l=>l&&l!=="none");const h=n.frame?Le(n.frame):"",C=n.background?Fe(n.background):"",g=n.hat?Re(n.hat):"",j=n.glasses?Ge(n.glasses):"";return e.jsxs("div",{className:H("relative rounded-full overflow-visible flex-shrink-0",Oe[u],z),children:[C&&e.jsx("div",{className:H("absolute inset-0 rounded-full",C)}),e.jsx("div",{className:H("relative w-full h-full rounded-full overflow-hidden",h),children:e.jsx("img",{src:w?m:k,alt:o||"Avatar",className:"w-full h-full object-cover",loading:"lazy"})}),g&&n.hat!=="none"&&e.jsx("span",{className:H("absolute left-1/2 -translate-x-1/2 z-10 pointer-events-none","drop-shadow-sm",Ue[u]),style:{top:"-15%"},"aria-hidden":"true",children:g}),j&&n.glasses!=="none"&&e.jsx("span",{className:H("absolute left-1/2 -translate-x-1/2 z-10 pointer-events-none","drop-shadow-sm",$e[u]),style:{top:"30%"},"aria-hidden":"true",children:j})]})});J.displayName="CompositeAvatar";const Z=["Cat","Dog","Fox","Owl","Panda","Bear","Rabbit","Lion","Tiger","Elephant","Koala","Penguin","Wolf","Deer","Raccoon","Sloth","Red Panda","Hedgehog","Otter","Unicorn"],ee=s=>!s||typeof s!="object"||s.baseIndex===void 0?{...te}:{baseIndex:s.baseIndex??0,accessories:s.accessories??{}},qe=({open:s,onOpenChange:m,currentConfig:u,onSave:z})=>{const[o,w]=p.useState(ee(u)),[_,n]=p.useState("base");p.useEffect(()=>{s&&w(ee(u))},[s,u]);const k=l=>{w(c=>({...c,baseIndex:l}))},h=(l,c)=>{w(x=>({...x,accessories:{...x.accessories,[l]:c==="none"?void 0:c}}))},C=()=>{w({...te})},g=()=>{z(o),m(!1)},j=o.baseIndex!==0||Object.values(o.accessories).some(l=>l&&l!=="none");return e.jsx(je,{open:s,onOpenChange:m,children:e.jsxs(Ne,{className:"sm:max-w-lg bg-white max-h-[90vh] overflow-hidden flex flex-col",children:[e.jsx(we,{children:e.jsxs(ye,{className:"text-lg font-semibold text-slate-900 font-sans flex items-center gap-2",children:[e.jsx(me,{className:"h-5 w-5 text-amber-500"}),"Customize Your Avatar"]})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[e.jsx("div",{className:"flex justify-center py-4",children:e.jsxs(i.div,{initial:{scale:.9,opacity:0}
1,animate:{scale:1,opacity:1},transition:{type:"spring",stiffness:300,damping:25},className:"relative",children:[e.jsx(J,{config:o,size:"xl",className:"h-28 w-28"}),j&&e.jsx(i.div,{initial:{scale:0},animate:{scale:1},className:"absolute -bottom-1 -right-1 bg-emerald-500 text-white rounded-full p-1",children:e.jsx(q,{className:"h-3 w-3"})})]},JSON.stringify(o))}),e.jsxs(ke,{value:_,onValueChange:n,className:"flex-1 overflow-hidden flex flex-col",children:[e.jsxs(Ce,{className:"grid grid-cols-5 w-full bg-slate-100 p-1 rounded-lg",children:[e.jsx(V,{value:"base",className:"text-xs font-medium data-[state=active]:bg-white data-[state=active]:shadow-sm",children:"🐾 Base"}),Q.map(l=>e.jsx(V,{value:l.id,className:"text-xs font-medium data-[state=active]:bg-white data-[state=active]:shadow-sm",children:l.icon},l.id))]}),e.jsxs("div",{className:"flex-1 overflow-y-auto mt-3 pr-1",children:[e.jsxs(K,{value:"base",className:"m-0",children:[e.jsx("p",{className:"text-xs text-slate-500 mb-3",children:"Choose your base animal avatar"}),e.jsx("div",{className:"grid grid-cols-5 gap-2",children:$.map((l,c)=>{const x=o.baseIndex===c;return e.jsxs(i.button,{type:"button",onClick:()=>k(c),whileHover:{scale:1.05},whileTap:{scale:.95},className:H("relative aspect-square rounded-xl overflow-hidden border-2 transition-all duration-200","focus:outline-none focus:ring-2 focus:ring-amber-400 focus:ring-offset-1",x?"border-amber-500 shadow-lg shadow-amber-200/50":"border-slate-200 hover:border-slate-300"),"aria-label":`Select ${Z[c]} avatar`,children:[e.jsx("img",{src:l,alt:Z[c],className:"w-full h-full object-cover",loading:"lazy"}),e.jsx(D,{children:x&&e.jsx(i.div,{initial:{opacity:0,scale:.5},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.5},className:"absolute inset-0 bg-amber-500/20 flex items-center justify-center",children:e.jsx("div",{className:"bg-amber-500 rounded-full p-1",children:e.jsx(q,{className:"h-3 w-3 text-white"})})})})]},c)})})]}),Q.map(l=>e.jsxs(K,{value:l.id,className:"m-0",children:[e.jsxs("p",{className:"text-xs text-slate-500 mb-3",children:["Add ",l.name.toLowerCase()," to your avatar"]}),e.jsx("div",{className:"grid grid-cols-4 gap-2",children:l.items.map(c=>{const x=o.accessories[l.id]===c.id||c.id==="none"&&!o.accessories[l.id];return e.jsxs(i.button,{type:"button",onClick:()=>h(l.id,c.id),whileHover:{scale:1.05},whileTap:{scale:.95},className:H("flex flex-col items-center justify-center gap-1 p-3 rounded-xl border-2 transition-all duration-200","focus:outline-none focus:ring-2 focus:ring-amber-400 focus:ring-offset-1",x?"border-amber-500 bg-amber-50 shadow-lg shadow-amber-200/50":"border-slate-200 bg-white hover:border-slate-300 hover:bg-slate-50"),"aria-label":`Select ${c.name}`,children:[e.jsx("span",{className:"text-2xl",children:c.icon}),e.jsx("span",{className:"text-[10px] font-medium text-slate-600 text-center leading-tight",children:c.name})]},c.id)})})]},l.id))]})]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-slate-100 mt-4",children:[e.jsxs(f,{variant:"ghost",size:"sm",onClick:C,disabled:!j,className:"text-slate-500 hover:text-slate-700",children:[e.jsx(_e,{className:"h-3.5 w-3.5 mr-1.5"}),"Reset"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(f,{variant:"outline",size:"sm",onClick:()=>m(!1),className:"rounded-lg text-[13px] font-medium",children:[e.jsx(se,{className:"h-3.5 w-3.5 mr-1.5"}),"Cancel"]}),e.jsxs(f,{size:"sm",onClick:g,className:"rounded-lg text-[13px] font-medium bg-amber-500 hover:bg-amber-600 text-white",children:[e.jsx(q,{className:"h-3.5 w-3.5 mr-1.5"}),"Save Avatar"]})]})]})]})})},ha=()=>{const{user:s,loading:m,isAdmin:u}=xe(),z=pe(),{toast:o}=ae(),[w,_]=p.useState(!0),[n,k]=p.useState(!1),[h,C]=p.useState(!1),[g,j]=p.useState(""),[l,c]=p.useState(null),[x,d]=p.useState({}),[S,E]=p.useState(!1),[r,I]=p.useState({full_name:"",phone:"",address:"",city:"",state:"",country:"",pincode:"",linkedin_url:"",twitter_url:"",company:"",designation:"",work_email:"",avatar_url:"",avatar_config:null}),M=p.useMemo(()=>{const a=[{key:"avatar_url",label:"Upload your photo",weight:5},{key:"full_name",label:"Personal Info",weight:10},{key:"city",label:"Location",weight:20},{key:"company",label:"Company",weight:15},{key:"designation",label:"Designation",weight:15},{key:"linkedin_url",label:"LinkedIn",weight:20},{key:"twitter_url",label:"Twitter",weight:15}];let t=0;const v=a.map(N=>{const T=r[N.key],L=typeof T=="string"&&T.trim()!=="";return L&&(t+=N.weight),{...N,isComplete:L}});return{percentage:t,items:v}},[r]);p.useEffect(()=>{!m&&!s&&z("/auth?redirect=/profile")},[s,m,z]),p.useEffect(()=>{s&&(async()=>
1{if(s)try{const{data:t,error:v}=await P.from("profiles").select("*").eq("id",s.id).single();if(v)throw v;if(t){j(t.email||"");const N=t.avatar_config?t.avatar_config:null;I({full_name:t.full_name||"",phone:t.phone||"",address:t.address||"",city:t.city||"",state:t.state||"",country:t.country||"",pincode:t.pincode||"",linkedin_url:t.linkedin_url||"",twitter_url:t.twitter_url||"",company:t.company||"",designation:t.designation||"",work_email:t.work_email||"",avatar_url:t.avatar_url||"",avatar_config:N})}}catch(t){console.error("Error fetching profile:",t),o({title:"Error",description:"Failed to load profile data",variant:"destructive"})}finally{_(!1)}})()},[s,o]);const ne=async a=>{var v;const t=(v=a.target.files)==null?void 0:v[0];if(!(!t||!s)){if(!t.type.startsWith("image/")){o({title:"Invalid file",description:"Please upload an image file",variant:"destructive"});return}if(t.size>5*1024*1024){o({title:"File too large",description:"Please upload an image smaller than 5MB",variant:"destructive"});return}C(!0);try{const N=t.name.split(".").pop(),T=`avatars/${s.id}.${N}`,{error:L}=await P.storage.from("images").upload(T,t,{cacheControl:"public, max-age=31536000, immutable",upsert:!0});if(L)throw L;const{data:ce}=P.storage.from("images").getPublicUrl(T),X=ce.publicUrl,{error:Y}=await P.from("profiles").update({avatar_url:X,updated_at:new Date().toISOString()}).eq("id",s.id);if(Y)throw Y;I(de=>({...de,avatar_url:X})),o({title:"Success",description:"Profile picture updated"})}catch(N){console.error("Error uploading avatar:",N),o({title:"Upload failed",description:"Failed to upload profile picture",variant:"destructive"})}finally{C(!1)}}},re=async a=>{if(s)try{const{error:t}=await P.from("profiles").update({avatar_config:JSON.parse(JSON.stringify(a)),avatar_url:"",updated_at:new Date().toISOString()}).eq("id",s.id);if(t)throw t;I(v=>({...v,avatar_config:a,avatar_url:""})),o({title:"Success",description:"Avatar customization saved"})}catch(t){console.error("Error saving avatar config:",t),o({title:"Error",description:"Failed to save avatar customization",variant:"destructive"})}},G=a=>{c(a),d({...r})},O=()=>{c(null),d({})},U=async()=>{if(s){k(!0);try{const{avatar_config:a,...t}=x,v="work_email"in t&&(t.work_email||"").trim().toLowerCase()!==(r.work_email||"").trim().toLowerCase(),{error:N}=await P.from("profiles").update({...t,updated_at:new Date().toISOString()}).eq("id",s.id);if(N)throw N;I(T=>({...T,...t})),c(null),d({}),o({title:"Saved",description:"Your changes have been saved"}),v&&(t.work_email||"").trim()&&P.functions.invoke("enrich-user-profile",{body:{user_ids:[s.id]}}).catch(T=>console.warn("Enrichment trigger failed:",T))}catch(a){console.error("Error saving profile:",a),o({title:"Error",description:"Failed to save changes",variant:"destructive"})}finally{k(!1)}}},y=(a,t)=>{d(v=>({...v,[a]:t}))},oe=()=>{var a;return r.full_name?r.full_name.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2):((a=g==null?void 0:g[0])==null?void 0:a.toUpperCase())||"U"};if(m||w)return e.jsx("div",{className:"min-h-screen bg-slate-50 font-sans",children:e.jsxs("div",{className:"max-w-6xl mx-auto px-6 py-10",children:[e.jsx(F,{className:"h-7 w-32 mb-8 rounded-lg"}),e.jsxs("div",{className:"grid lg:grid-cols-[200px_1fr_260px] gap-10",children:[e.jsx(F,{className:"h-48 w-full rounded-xl"}),e.jsxs("div",{className:"space-y-5",children:[e.jsx(F,{className:"h-32 w-full rounded-xl"}),e.jsx(F,{className:"h-28 w-full rounded-xl"})]}),e.jsx(F,{className:"h-64 w-full rounded-xl"})]})]})});const B={hidden:{opacity:0,y:20},visible:{opacity:1,y:0}};return e.jsxs(e.Fragment,{children:[e.jsxs(he,{children:[e.jsx("title",{children:"Edit Profile | AIM"}),e.jsx("meta",{name:"robots",content:"noindex, nofollow"})]}),e.jsx("div",{className:"min-h-screen bg-slate-50 font-sans",children:e.jsxs("div",{className:"max-w-6xl mx-auto px-6 py-10",children:[e.jsx(i.h1,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},transition:{duration:.4},className:"text-lg font-semibold text-slate-900 mb-8 font-sans",children:"Edit Profile"}),e.jsxs("div",{className:"grid lg:grid-cols-[200px_1fr_260px] gap-10",children:[e.jsx(ge,{}),e.jsxs("div",{className:"space-y-5",children:[e.jsx(i.div,{variants:B,initial:"hidden",animate:"visible",transition:{delay:.1,duration:.4},className:"bg-white rounded-2xl shadow-sm border border-slate-100 p-5",children:e.jsxs("div",{className:"flex items-center gap-5",children:[e.jsx(i.div,{className:"relative",whileHover:{scale:1.02},transition:{duration:.2},children:e.jsx("div",{className:"ring-[3px] ring-amber-400 ring-offset-2 rounded-full",children:e.jsx(J,{config:r.avatar_config,avatarUrl:r.avatar_url||(s?ue(s.id):void 0),size:"xl",className:"h-20 w-20",fallbackName:r.full_name||oe()})})}),e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(i.div,{whileHover:{scale:1.02},whileTap:{scale:.98},children:e.jsxs(f,{variant:"outline",size:"sm",onClick:()=>E(!0),disabled:h,className:"cursor-pointer rounded-lg border-slate-200 text-slate-700 hover:bg-slate-50 hover:border-slate-300 text-[13px] font-medium h-9 px-4",children:[e.jsx(Se,{className:"h-3.5 w-3.5 mr-1.5"}),"Customize avatar"]})}),e.jsx("span",{className:"text-slate-300 text-[12px]",children:"or"}),e.jsx("label",{htmlFor:"avatar-upload",children:e.jsx(i.div,{whileHover:{scale:1.02},whileTap:{scale:.98},children:e.jsx(f,{variant:"outline",size:"sm",className:"cursor-pointer rounded-lg border-slate-200 text-slate-700 hover:bg-slate-50 hover:border-slate-300 text-[13px] font-medium h-9 px-4",disabled:h,asChild:!0,children:e.jsxs("span",{children:[h?e.jsx(A,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):e.jsx(Ee,{className:"h-3.5 w-3.5 mr-1.5"}),"Upload photo"]})})})}),e.jsx("input",{id:"avatar-upload",type:"file",accept:"image/*",onChange:ne,className:"hidden",disabled:h})]}),e.jsx("p",{className:"text-[11px] text-slate-400 leading-relaxed",children:"Customize your avatar with accessories or upload your own photo"})]})]})}),e.jsx(qe,{open:S,onOpenChange:E,currentConfig:r.avatar_config,onSave:re}),e.jsxs(i.div,{variants:B,initial:"hidden",animate:"visible",transition:{delay:.15,duration:.4},className:"bg-white rounded-2xl shadow-sm border border-slate-100 p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4 font-sans",children:[e.jsx("h2",{className:"text-[15px] font-semibold text-slate-900 font-sans",children:"Personal Info"}),l!=="personal"&&e.jsx(i.div,{whileHover:{scale:1.02},whileTap:{scale:.98},children:e.jsxs(f,{variant:"outline",size:"sm",onClick:()=>G("personal"),className:"rounded-lg border-slate-200 text-slate-600 hover:bg-slate-50 hover:border-slate-300 text-[12px] font-medium h-8 px-3",children:[e.jsx(R,{className:"h-3 w-3 mr-1.5"}),"Edit"]})})]}),e.jsx(D,{mode:"wait",children:l==="personal"?e.jsxs(i.div,{initial:{opacity:0,height:0}
1,animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2},className:"space-y-4",children:[e.jsxs("div",{className:"grid sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wide",children:"Full Name"}),e.jsx(b,{value:x.full_name||"",onChange:a=>y("full_name",a.target.value),placeholder:"Enter your name",className:"rounded-lg border-slate-200 text-[13px] h-9 focus:border-slate-400 focus:ring-slate-400"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wide",children:"Email"}),e.jsx(b,{value:g,disabled:!0,className:"bg-slate-50 rounded-lg border-slate-200 text-[13px] h-9 text-slate-500"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wide",children:"Phone"}),e.jsx(b,{value:x.phone||"",onChange:a=>y("phone",a.target.value),placeholder:"Enter phone",className:"rounded-lg border-slate-200 text-[13px] h-9 focus:border-slate-400 focus:ring-slate-400"})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("label",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wide flex items-center gap-2",children:["Work Email",e.jsx("span",{className:"text-[10px] font-normal text-slate-400 normal-case tracking-normal",children:"(optional — helps us personalise your experience)"})]}),e.jsx(b,{type:"email",value:x.work_email||"",onChange:a=>y("work_email",a.target.value),placeholder:"[email protected]",className:"rounded-lg border-slate-200 text-[13px] h-9 focus:border-slate-400 focus:ring-slate-400"})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-1",children:[e.jsx("button",{onClick:O,className:"text-[12px] font-medium text-slate-500 hover:text-slate-700 transition-colors",children:"Cancel"}),e.jsx(i.div,{whileHover:{scale:1.02},whileTap:{scale:.98},children:e.jsx(f,{size:"sm",onClick:U,disabled:n,className:"bg-emerald-500 hover:bg-emerald-600 text-white rounded-lg text-[12px] font-medium h-8 px-4",children:n?e.jsx(A,{className:"h-3.5 w-3.5 animate-spin"}):"Save changes"})})]})]},"editing"):e.jsxs(i.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},className:"grid sm:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wide mb-0.5",children:"Full Name"}),e.jsx("p",{className:"text-[13px] font-medium text-slate-800",children:r.full_name||"—"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wide mb-0.5",children:"Email"}),e.jsx("p",{className:"text-[13px] font-medium text-slate-800",children:g||"—"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wide mb-0.5",children:"Phone"}),e.jsx("p",{className:"text-[13px] font-medium text-slate-800",children:r.phone||"—"})]}),e.jsxs("div",{className:"sm:col-span-3",children:[e.jsx("p",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wide mb-0.5",children:"Work Email"}),e.jsx("p",{className:"text-[13px] font-medium text-slate-800",children:r.work_email||"—"})]})]},"viewing")})]}),e.jsxs(i.div,{variants:B,initial:"hidden",animate:"visible",transition:{delay:.2,duration:.4},className:"bg-white rounded-2xl shadow-sm border border-slate-100 p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-[15px] font-semibold text-slate-900 font-sans",children:"Location"}),l!=="location"?e.jsx(i.div,{whileHover:{scale:1.02},whileTap:{scale:.98},children:e.jsxs(f,{variant:"outline",size:"sm",onClick:()=>G("location"),className:"rounded-lg border-slate-200 text-slate-600 hover:bg-slate-50 hover:border-slate-300 text-[12px] font-medium h-8 px-3",children:[e.jsx(R,{className:"h-3 w-3 mr-1.5"}),"Edit"]})}):e.jsx("button",{onClick:O,className:"text-[12px] font-medium text-slate-500 hover:text-slate-700 transition-colors",children:"Cancel"})]}),e.jsx(D,{mode:"wait",children:l==="location"?e.jsxs(i.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2},className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(Te,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400"}),e.jsx(b,{value:x.city||"",onChange:a=>y("city",a.target.value),placeholder:"Enter city",className:"pl-10 rounded-lg border-slate-200 text-[13px] h-10 focus:border-emerald-400 focus:ring-emerald-400"})]}),e.jsx(i.div,{whileHover:{scale:1.02},whileTap:{scale:.98},children:e.jsx(f,{size:"sm",onClick:U,disabled:n,className:"bg-emerald-500 hover:bg-emerald-600 text-white rounded-lg text-[12px] font-medium h-10 px-5",children:n?e.jsx(A,{className:"h-3.5 w-3.5 animate-spin"}):"Save changes"})})]}),e.jsxs("div",{className:"grid sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wide",children:"State"}),e.jsx(b,{value:x.state||"",onChange:a=>y("state",a.target.value),placeholder:"State",className:"rounded-lg border-slate-200 text-[13px] h-9"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wide",children:"Country"}),e.jsx(b,{value:x.country||"",onChange:a=>y("country",a.target.value),placeholder:"Country",className:"rounded-lg border-slate-200 text-[13px] h-9"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wide",children:"PIN Code"}),e.jsx(b,{value:x.pincode||"",onChange:a=>y("pincode",a.target.value),placeholder:"PIN",className:"rounded-lg border-slate-200 text-[13px] h-9"})]})]})]},"editing"):e.jsxs(i.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},className:"grid sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wide mb-0.5",children:"City"}),e.jsx("p",{className:"text-[13px] font-medium text-slate-800",children:r.city||"—"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wide mb-0.5",children:"Country"}),e.jsx("p",{className:"text-[13px] font-medium text-slate-800",children:r.country||"—"})]})]},"viewing")})]}),e.jsxs(i.div,{variants:B,initial:"hidden",animate:"visible",transition:{delay:.25,duration:.4},className:"bg-white rounded-2xl shadow-sm border border-slate-100 p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-[15px] font-semibold text-slate-900 font-sans",children:"Professional"}),l!=="professional"&&e.jsx(i.div,{whileHover:{scale:1.02},whileTap:{scale:.98},children:e.jsxs(f,{variant:"outline",size:"sm",onClick:()=>G("professional"),className:"rounded-lg border-slate-200 text-slate-600 hover:bg-slate-50 hover:border-slate-300 text-[12px] font-medium h-8 px-3",children:[e.jsx(R,{className:"h-3 w-3 mr-1.5"}),"Edit"]})})]}),e.jsx(D,{mode:"wait",children:l==="professional"?e.jsxs(i.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2},className:"space-y-4",children:[e.jsxs("div",{className:"grid sm:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wide",children:"Company"}),e.jsxs("div",{className:"relative",children:[e.jsx(Pe,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400"}),e.jsx(b,{value:x.company||"",onChange:a=>y("company",a.target.value),placeholder:"Company name",className:"pl-10 rounded-lg border-slate-200 text-[13px] h-9"})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wide",children:"Designation"}),e.jsxs("div",{className:"relative",children:[e.jsx(ze,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400"}),e.jsx(b,{value:x.designation||"",onChange:a=>y("designation",a.target.value),placeholder:"Your role",className:"pl-10 rounded-lg border-slate-200 text-[13px] h-9"})]})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-1",children:[e.jsx("button",{onClick:O,className:"text-[12px] font-medium text-slate-500 hover:text-slate-700 transition-colors",children:"Cancel"}),e.jsx(i.div,{whileHover:{scale:1.02},whileTap:{scale:.98},children:e.jsx(f,{size:"sm",onClick:U,disabled:n,className:"bg-emerald-500 hover:bg-emerald-600 text-white rounded-lg text-[12px] font-medium h-8 px-4",children:n?e.jsx(A,{className:"h-3.5 w-3.5 animate-spin"}):"Save changes"})})]})]},"editing"):e.jsxs(i.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},className:"grid sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wide mb-0.5",children:"Company"}),e.jsx("p",{className:"text-[13px] font-medium text-slate-800",children:r.company||"—"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wide mb-0.5",children:"Designation"}),e.jsx("p",{className:"text-[13px] font-medium text-slate-800",children:r.designation||"—"})]})]},"viewing")})]}),e.jsxs(i.div,{variants:B,initial:"hidden",animate:"visible",transition:{delay:.3,duration:.4},className:"bg-white rounded-2xl shadow-sm border border-slate-100 p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-[15px] font-semibold text-slate-900 font-sans",children:"Social Links"}),l!=="social"&&e.jsx(i.div,{whileHover:{scale:1.02},whileTap:{scale:.98},children:e.jsxs(f,{variant:"outline",size:"sm",onClick:()=>G("social"),className:"rounded-lg border-slate-200 text-slate-600 hover:bg-slate-50 hover:border-slate-300 text-[12px] font-medium h-8 px-3",children:[e.jsx(R,{className:"h-3 w-3 mr-1.5"}),"Edit"]})})]}),e.jsx(D,{mode:"wait",children:l==="social"?e.jsxs(i.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2},className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wide",children:"LinkedIn"}),e.jsxs("div",{className:"relative",children:[e.jsx(Ie,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400"}),e.jsx(b,{value:x.linkedin_url||"",onChange:a=>y("linkedin_url",a.target.value),placeholder:"https://linkedin.com/in/yourprofile",className:"pl-10 rounded-lg border-slate-200 text-[13px] h-9"})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wide",children:"Twitter / X"}),e.jsxs("div",{className:"relative",children:[e.jsx(Ae,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400"}),e.jsx(b,{value:x.twitter_url||"",onChange:a=>y("twitter_url",a.target.value),placeholder:"https://twitter.com/yourhandle",className:"pl-10 rounded-lg border-slate-200 text-[13px] h-9"})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-1",children:[e.jsx("button",{onClick:O,className:"text-[12px] font-medium text-slate-500 hover:text-slate-700 transition-colors",children:"Cancel"}),e.jsx(i.div,{whileHover:{scale:1.02},whileTap:{scale:.98},children:e.jsx(f,{size:"sm",onClick:U,disabled:n,className:"bg-emerald-500 hover:bg-emerald-600 text-white rounded-lg text-[12px] font-medium h-8 px-4",children:n?e.jsx(A,{className:"h-3.5 w-3.5 animate-spin"}):"Save changes"})})]})]},"editing"):e.jsxs(i.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},className:"grid sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wide mb-0.5",children:"LinkedIn"}),e.jsx("p",{className:"text-[13px] font-medium text-slate-800 truncate",children:r.linkedin_url||"—"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-medium text-slate-400 uppercase tracking-wide mb-0.5",children:"Twitter / X"}),e.jsx("p",{className:"text-[13px] font-medium text-slate-800 truncate",children:r.twitter_url||"—"})]})]},"viewing")})]}),e.jsx(He,{userId:s.id,isAdmin:u})]}),e.jsx(i.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{delay:.35,duration:.4},className:"lg:sticky lg:top-24 h-fit",children:e.jsxs("div",{className:"bg-white rounded-2xl shadow-sm border border-slate-100 p-5",children:[e.jsx("h3",{className:"text-[14px] font-semibold text-slate-900 text-center mb-5 font-sans",children:"Complete your profile"}),e.jsx("div",{className:"flex justify-center mb-5",children:e.jsxs("div",{className:"relative w-28 h-28",children:[e.jsxs("svg",{className:"w-full h-full transform -rotate-90",children:[e.jsx("circle",{cx:"56",cy:"56",r:"48",stroke:"currentColor",strokeWidth:"6",fill:"none",className:"text-slate-100"}),e.jsx(i.circle,{cx:"56",cy:"56",r:"48",stroke:"currentColor",strokeWidth:"6",fill:"none",strokeDasharray:2*Math.PI*48,initial:{strokeDashoffset:2*Math.PI*48},animate:{strokeDashoffset:2*Math.PI*48*(1-M.percentage/100)},transition:{duration:1,ease:"easeOut",delay:.5},strokeLinecap:"round",className:"text-emerald-500"})]}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs(i.span,{initial:{opacity:0,scale:.5},animate:{opacity:1,scale:1},transition:{delay:.6,duration:.3},className:"text-xl font-bold text-slate-900",children:[M.percentage,"%"]})})]})}),e.jsx("div",{className:"space-y-2",children:M.items.map((a,t)=>e.jsxs(i.div,{initial:{opacity:0,x:10},animate:{opacity:1,x:0},transition:{delay:.5+t*.05,duration:.3},className:"flex items-center justify-between py-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[a.isComplete?e.jsx(q,{className:"h-3.5 w-3.5 text-slate-400"}):e.jsx(se,{className:"h-3.5 w-3.5 text-slate-300"}),e.jsx("span",{className:`text-[12px] ${a.isComplete?"text-slate-700":"text-slate-500"}`,children:a.label})]}),e.jsx("span",{className:`text-[12px] font-medium ${a.isComplete?"text-slate-400":"text-emerald-500"}`,children:a.isComplete?`${a.weight}%`:`+${a.weight}%`})]},a.key))})]})})]})]})}),e.jsx(be,{})]})};export{ha as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.