"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[774],{2950:(e,l,t)=>{t.d(l,{E:()=>i,PointsNotificationProvider:()=>r});var s=t(95155),a=t(12115);let n=(0,a.createContext)(void 0);function r(e){let{children:l}=e,[t,r]=(0,a.useState)([]),[i]=(0,a.useState)(()=>"undefined"!=typeof Audio?new Audio("/sounds/notification.mp3"):null),o=(0,a.useCallback)(e=>{let l="notification-".concat(Date.now(),"-").concat(Math.random()),t={id:l,points:e};r(e=>[...e,t]),i&&(i.currentTime=0,i.play().catch(e=>console.log("Audio playback failed:",e))),setTimeout(()=>{r(e=>e.filter(e=>e.id!==l))},3200)},[i]),d=(0,a.useCallback)(e=>{r(l=>l.filter(l=>l.id!==e))},[]);return(0,a.useEffect)(()=>{let e=e=>{let l=e.detail;l&&"number"==typeof l.points&&o(l.points)};return window.addEventListener("newPoints",e),()=>window.removeEventListener("newPoints",e)},[o]),(0,s.jsx)(n.Provider,{value:{notifications:t,showPointsNotification:o,dismissNotification:d},children:l})}function i(){let e=(0,a.useContext)(n);if(!e)throw Error("usePointsNotification must be used within PointsNotificationProvider");return e}},10774:(e,l,t)=>{t.d(l,{U:()=>B});var s=t(95155),a=t(12115),n=t(52619),r=t.n(n),i=t(36489),o=t(20508),d=t(1733),c=t(2950);function u(e){let{direction:l="down"}=e,{notifications:t}=(0,c.E)();if(0===t.length)return null;let a="down"===l,n=a?"absolute top-12 left-1/2 -translate-x-1/2 z-[100] pointer-events-none":"absolute bottom-10 left-1/2 -translate-x-1/2 z-[100] pointer-events-none",r=a?"animate-float-down-fade":"animate-float-up-fade";return(0,s.jsx)(s.Fragment,{children:t.map((e,l)=>{let{id:t,points:a}=e,i=a>=0,o=(e=>{let l=["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"];return Math.abs(e).toString().replace(/\d/g,e=>l[parseInt(e)])})(a),c="".concat(o).concat(i?"+":"-");return(0,s.jsx)("div",{className:n,style:{animationDelay:"".concat(150*l,"ms")},children:(0,s.jsxs)("div",{className:"relative w-14 h-14 ".concat(r," overflow-visible"),children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-[#FFA515] rounded-full shadow-[0_4px_15px_rgba(255,165,21,0.4)] border-2 border-white/20"}),(0,s.jsx)("div",{className:"absolute inset-0 flex items-center justify-center p-2.5 overflow-visible",children:(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 57.26 52.41",className:"w-full h-full text-black overflow-visible",children:(0,s.jsxs)(d.P.g,{animate:i?{y:a>=4?[0,0,0,0,-14,0,-8,0]:[0,0,0,0,-6,0,-4,0],rotate:[0,0,0,0,-5,5,-3,0]}:{x:[0,0,0,0,-4,4,-4,4,-2,2,0]},transition:{duration:2.5,times:i?[0,.2,.5,.7,.75,.8,.85,.9]:[0,.2,.5,.7,.73,.76,.79,.82,.85,.88,.9],ease:"easeInOut"},style:{originX:"28.63px",originY:"26.2px"},children:[(0,s.jsx)("path",{d:"M57.26,7.61v37.2a7.6,7.6,0,0,1-7.6,7.6H7.6A7.6,7.6,0,0,1,0,44.81V7.66A7.6,7.6,0,0,1,11.09.91l14,7.23a7.61,7.61,0,0,0,7,0L46.18.85A7.6,7.6,0,0,1,57.26,7.61Z",fill:"currentColor"}),(0,s.jsx)(d.P.ellipse,{cx:"19.04",cy:"30.22",rx:"7.44",ry:"2.29",fill:"#ffffff",animate:{rx:[7.44,7.2,7.2,7.2,7.2],ry:[2.29,7.2,7.2,7.2,7.2],x:[0,6,6,0,0],y:[0,-8,-8,0,0]},transition:{duration:2.5,times:[0,.2,.5,.7,1],ease:"easeInOut"},style:{originX:"19.04px",originY:"30.22px"}}),(0,s.jsx)(d.P.rect,{x:"11",y:"22",width:"16",height:"0",fill:"currentColor",animate:a>=4?{height:[0,0,0,12,12,12,12],x:[0,6,6,6,0,0,0],y:[0,-8,7.42,.22,8.22,8.22,8.22]}:i?{height:[0,0,0,0,16,0,0],x:[0,6,6,0,0,0,0],y:[0,-8,-8,0,0,0,0]}:{height:[0,0,0,8,8,8,8],x:[0,6,6,6,0,0,0],y:[0,-8,-8,-8,0,0,0]},transition:{duration:2.5,times:a>=4?[0,.2,.45,.5,.7,.85,1]:i?[0,.2,.5,.7,.75,.85,1]:[0,.2,.45,.5,.7,.85,1],ease:"easeInOut"}}),(0,s.jsx)(d.P.circle,{cx:"39.48",cy:"30.22",r:"6.18",fill:"#ffffff",animate:{r:[6.18,7.2,7.2,7.2,7.2],x:[0,6,6,0,0],y:[0,-8,-8,0,0]},transition:{duration:2.5,times:[0,.2,.5,.7,1],ease:"easeInOut"},style:{originX:"39.48px",originY:"30.22px"}}),(0,s.jsx)(d.P.rect,{x:"32",y:"22",width:"16",height:"0",fill:"currentColor",animate:a>=4?{height:[0,0,0,12,12,12,12],x:[0,6,6,6,0,0,0],y:[0,-8,7.42,.22,8.22,8.22,8.22]}:i?{height:[0,0,0,0,16,0,0],x:[0,6,6,0,0,0,0],y:[0,-8,-8,0,0,0,0]}:{height:[0,0,0,8,8,8,8],x:[0,6,6,6,0,0,0],y:[0,-8,-8,-8,0,0,0]},transition:{duration:2.5,times:a>=4?[0,.2,.45,.5,.7,.85,1]:i?[0,.2,.5,.7,.75,.85,1]:[0,.2,.45,.5,.7,.85,1],ease:"easeInOut"}})]})})}),(0,s.jsx)("div",{className:"absolute -top-5 -right-1.5 bg-white rounded-full px-2 py-1 shadow-md border border-gray-100 min-w-[28px] flex items-center justify-center",children:(0,s.jsx)("span",{className:"text-[20px] font-black leading-none ".concat(i?"text-emerald-600":"text-rose-600"),children:c})}),(0,s.jsx)("div",{className:"absolute inset-0 bg-[#FFA515] rounded-full blur-md opacity-30 -z-10"})]})},t)})})}var x=t(20063),m=t(27063),h=t(3998),v=t(3216);let f={activeBookings:0,totalPoints:0,level:"BEGINNER",levelLabel:"سطح ۱",levelIcon:"\uD83C\uDF31",coins:0,referralCode:null,referralCount:0,uniqueCafesCount:0,uniqueGamesCount:0,playmasterCount:0,playmateCount:0,name:null,username:null,avatar:null,archetype:null,awardedBadgeKeys:[],achievements:(0,v.AT)({}),hostLevel:0,isPlayMaster:!1};var b=t(16481),p=t(96093),j=t(6490),g=t(51950),w=t(73618),N=t(95740),y=t(52056),k=t(89559),C=t(48055),A=t(6613),P=t(30814),E=t(90368),S=t(59384);function I(e){var l,t,n,r,d,c,u,I,B;let{open:M,onOpenChange:q,className:L=""}=e,O=(0,x.useRouter)(),_=(0,x.usePathname)(),{data:z}=(0,i.useSession)(),{stats:F,loading:R,error:T,refetch:D}=function(){let{data:e}=(0,i.useSession)(),[l,t]=(0,a.useState)(f),[s,n]=(0,a.useState)(!0),[r,o]=(0,a.useState)(null),d=(0,a.useCallback)(async()=>{if(!(null==e?void 0:e.user)){t(f),n(!1),o(null);return}try{var l,s,a,r,i,d,c,u,x,m,h,b,p,j,g,w,N,y,k,C,A,P,E,S,I,B,M,q,L,O,_,z,F,R,T,D,G,$;n(!0),o(null);let f=await fetch("/api/user/profile",{method:"GET",headers:{"Content-Type":"application/json"}});if(!f.ok)throw Error("Profile request failed with status ".concat(f.status));let K=await f.json(),X=null==K?void 0:K.data,Y=null==K?void 0:K.profile,U=(null==X?void 0:X.user)||(null==Y?void 0:Y.user),V=(null==X?void 0:X.points)||(null==Y?void 0:Y.points),W=null!=(x=null!=(u=null==X?void 0:X.activeBookings)?u:null==Y||null==(l=Y.user)?void 0:l.activeBookings)?x:0,H=null!=(h=null!=(m=null==V?void 0:V.totalPoints)?m:null==(s=e.user)?void 0:s.points)?h:0,Q=null!=(b=null==V?void 0:V.currentLevel)?b:"BEGINNER",Z=null!=(p=null==V?void 0:V.levelDisplayName)?p:"سطح ۱",J=null!=(j=null==V?void 0:V.currentLevelIcon)?j:"\uD83C\uDF31",ee=null!=(g=null==U?void 0:U.coins)?g:0,el=null!=(w=null==U?void 0:U.referralCode)?w:null,et=null!=(N=null==U?void 0:U.referralCount)?N:0,es=null!=(y=null==U?void 0:U.uniqueCafesCount)?y:0,ea=null!=(k=null==U?void 0:U.uniqueGamesCount)?k:0,en=null!=(A=null!=(C=null==U?void 0:U.playmasterCount)?C:null==X?void 0:X.playmasterCount)?A:0,er=null!=(E=null!=(P=null==U?void 0:U.playmateCount)?P:null==X?void 0:X.playmateCount)?E:0,ei=null!=(S=null==U?void 0:U.awardedBadgeKeys)?S:[],eo=null!=(B=null!=(I=null==U?void 0:U.name)?I:e.user.name)?B:null,ed=null!=(q=null!=(M=null==U?void 0:U.username)?M:null==(a=e.user)?void 0:a.username)?q:null,ec=null!=(O=null!=(L=null==U?void 0:U.avatar)?L:e.user.image)?O:null,eu=null!=(z=null!=(_=null==U?void 0:U.archetype)?_:null==(r=e.user)?void 0:r.archetype)?z:null,ex=null!=(R=null!=(F=null==U?void 0:U.hostLevel)?F:null==U||null==(i=U.gamificationStats)?void 0:i.level)?R:+(null!=U&&!!U.isPlayMaster),em=!!((null==U?void 0:U.isPlayMaster)||ex>=1),eh=(0,v.AT)({username:ed,gender:null!=(D=null!=(T=null==U?void 0:U.gender)?T:null==(d=e.user)?void 0:d.gender)?D:null,ageRange:null!=($=null!=(G=null==U?void 0:U.ageRange)?G:null==(c=e.user)?void 0:c.ageRange)?$:null,referralCount:et,uniqueCafesCount:es,uniqueGamesCount:ea,playmasterCount:en,playmateCount:er,coins:ee,currentStreakWeeks:0,distinctArchetypesCount:0,awardedBadgeKeys:ei});t({activeBookings:W,totalPoints:H,level:Q,levelLabel:Z,levelIcon:J,coins:ee,referralCode:el,referralCount:et,uniqueCafesCount:es,uniqueGamesCount:ea,playmasterCount:en,playmateCount:er,name:eo,username:ed,avatar:ec,archetype:eu,awardedBadgeKeys:ei,achievements:eh,hostLevel:ex,isPlayMaster:em})}catch(e){console.error("Error fetching user stats:",e),o("خطا در دریافت اطلاعات کاربر")}finally{n(!1)}},[null==e?void 0:e.user]);return(0,a.useEffect)(()=>{d()},[d]),{stats:l,loading:s,error:r,refetch:d}}(),[G,$]=(0,a.useState)("summary"),[K,X]=(0,a.useState)(!1),[Y,U]=(0,a.useState)(!1);(0,a.useEffect)(()=>{M||$("summary")},[M]);let V=()=>{q(!1),"/dashboard"!==_&&O.push("/dashboard")},W=F.archetype||(null==z||null==(l=z.user)?void 0:l.archetype),H=W?j.aK[W]:void 0,Q=W?(0,p.i0)(W):F.avatar||(null==z||null==(t=z.user)?void 0:t.image),Z=F.name||(null==z||null==(n=z.user)?void 0:n.name)||"همبازی عزیز",J=F.username||(null==z||null==(r=z.user)?void 0:r.username),ee=(null==(d=F.achievements)?void 0:d.totalBadgesCount)||0,el=(null==(c=F.achievements)?void 0:c.earnedBadgesCount)||0,et=ee>0?Math.round(el/ee*100):0,es=null==(I=F.achievements)||null==(u=I.shadowBadges)?void 0:u[0],ea=null!=(B=F.hostLevel)?B:+!!F.isPlayMaster,en=!!(F.isPlayMaster||ea>=1);return(0,s.jsxs)(m.cj,{open:M,onOpenChange:e=>{e||$("summary"),q(e)},children:[(0,s.jsx)(m.h,{side:"bottom","data-testid":"quick-achievements-sheet-content",className:"max-h-[92vh] overflow-y-auto overflow-x-hidden no-scrollbar [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden bg-slate-950 border-t border-amber-500/40 text-white rounded-t-3xl p-4 sm:p-7 shadow-2xl backdrop-blur-2xl w-full max-w-full font-vazir font-farsi ".concat(L),children:"full"===G?(0,s.jsx)(b.h,{user:F,onBack:()=>$("summary")}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)(m.Fm,{className:"text-right space-y-1 pb-2 border-b border-white/10",children:(0,s.jsx)("div",{className:"flex items-center justify-between",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-8 h-8 rounded-xl bg-amber-500/20 border border-amber-500/30 flex items-center justify-center text-amber-400",children:(0,s.jsx)(N.A,{className:"w-4 h-4"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(m.qp,{className:"text-base sm:text-lg font-black text-white",children:"شناسنامه و افتخارات همبازی"}),(0,s.jsx)(m.Qs,{className:"text-xs text-slate-400",children:"خلاصه وضعیت پیشرفت شما"})]})]})})}),R?(0,s.jsxs)("div",{"data-testid":"quick-sheet-loading",className:"space-y-4 animate-pulse",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3.5 p-3.5 bg-slate-900/60 rounded-2xl border border-white/5",children:[(0,s.jsx)("div",{className:"w-14 h-14 rounded-full bg-slate-800"}),(0,s.jsxs)("div",{className:"space-y-2 flex-1",children:[(0,s.jsx)("div",{className:"h-4 w-32 bg-slate-800 rounded-md"}),(0,s.jsx)("div",{className:"h-3 w-24 bg-slate-800/60 rounded-md"})]})]}),(0,s.jsx)("div",{className:"h-32 bg-slate-900/60 rounded-2xl border border-white/5"}),(0,s.jsxs)("div",{className:"space-y-2.5 pt-1",children:[(0,s.jsx)("div",{className:"h-11 bg-slate-900/60 rounded-2xl"}),(0,s.jsx)("div",{className:"h-12 bg-slate-900/60 rounded-2xl"})]})]}):T?(0,s.jsxs)("div",{"data-testid":"quick-sheet-error",className:"p-5 bg-rose-950/20 border border-rose-500/30 rounded-2xl text-center space-y-4",children:[(0,s.jsx)("div",{className:"w-12 h-12 mx-auto rounded-full bg-rose-500/10 border border-rose-500/20 flex items-center justify-center text-rose-400",children:(0,s.jsx)(y.A,{className:"w-6 h-6"})}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("p",{className:"text-sm font-bold text-rose-200",children:"خطا در دریافت اطلاعات افتخارات"}),(0,s.jsx)("p",{className:"text-xs text-slate-400",children:"ارتباط با سرور برقرار نشد. لطفاً دوباره تلاش کنید."})]}),(0,s.jsxs)("div",{className:"flex items-center justify-center gap-3",children:[(0,s.jsxs)(h.$,{onClick:()=>D(),"data-testid":"quick-sheet-retry-btn",className:"bg-rose-500 hover:bg-rose-600 text-white font-bold rounded-xl h-10 px-4 text-xs flex items-center gap-2",children:[(0,s.jsx)(k.A,{className:"w-3.5 h-3.5"}),(0,s.jsx)("span",{children:"تلاش مجدد"})]}),(0,s.jsx)(h.$,{variant:"outline",onClick:V,className:"border-white/10 hover:bg-slate-900 text-slate-300 rounded-xl h-10 px-4 text-xs",children:"ورود به داشبورد"})]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3 p-3 sm:p-3.5 bg-gradient-to-r from-slate-900/90 to-slate-900/50 border border-white/10 rounded-2xl shadow-lg",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,s.jsx)("div",{className:"relative flex items-center justify-center w-12 h-12 sm:w-14 sm:h-14 rounded-full bg-gradient-to-tr from-amber-500 via-violet-600 to-indigo-600 p-[2px] shadow-md shrink-0",children:(0,s.jsx)("div",{className:"w-full h-full rounded-full bg-slate-950 flex items-center justify-center overflow-hidden",children:Q&&!K?(0,s.jsx)("img",{src:Q,alt:"آواتار کاربر",className:"w-full h-full object-cover rounded-full",onError:()=>X(!0)}):(0,s.jsx)("div",{className:"w-full h-full rounded-full bg-violet-950/60 text-violet-400 flex items-center justify-center",children:(0,s.jsx)(o.A,{className:"w-6 h-6"})})})}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("div",{className:"text-sm sm:text-base font-black text-white truncate",children:Z}),J?(0,s.jsxs)("div",{className:"text-xs text-amber-400/90 font-mono dir-ltr text-right truncate",children:["@",J]}):(0,s.jsx)("button",{type:"button",onClick:()=>U(!0),"data-testid":"choose-username-btn",className:"text-xs text-amber-400 hover:text-amber-300 font-bold transition-colors flex items-center gap-1 cursor-pointer",children:(0,s.jsx)("span",{children:"انتخاب نام کاربری"})})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,s.jsxs)("div",{className:"px-2.5 py-1 sm:px-3 sm:py-1.5 bg-amber-950/40 border border-amber-500/30 rounded-xl text-center",children:[(0,s.jsx)("div",{className:"text-xs font-black text-amber-300",children:en?"\uD83D\uDC51 پلی‌مستر":"\uD83D\uDD25 میزبان"}),(0,s.jsxs)("div",{className:"text-[10px] text-amber-400/80 font-medium font-vazir",children:["سطح ",(0,g.ub)(ea)]})]}),(0,s.jsxs)("div",{className:"px-2.5 py-1 sm:px-3 sm:py-1.5 bg-violet-950/50 border border-violet-500/30 rounded-xl text-center",children:[(0,s.jsx)("div",{className:"text-[10px] text-violet-300/80 font-medium",children:"کهن‌الگو"}),(0,s.jsx)("div",{className:"text-xs font-black text-violet-200",children:(null==H?void 0:H.title)||"همبازی"})]})]})]}),(0,s.jsxs)("div",{className:"p-3.5 sm:p-4 bg-gradient-to-br from-slate-900/90 via-slate-900/60 to-slate-950 border border-amber-500/20 rounded-2xl shadow-lg space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3 pb-2.5 border-b border-white/5",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,s.jsx)("div",{className:"w-8 h-8 rounded-xl bg-amber-500/20 border border-amber-500/30 flex items-center justify-center text-amber-400 shrink-0",children:(0,s.jsx)(C.A,{className:"w-4 h-4"})}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("div",{className:"text-xs sm:text-sm font-black text-amber-300 leading-tight",children:[(0,g.ub)(F.coins)," سکه طلا"]}),(0,s.jsx)("div",{className:"text-[10px] text-amber-400/80 truncate",children:"اعتبار ورود به رویدادهای VIP"})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1.5 px-2.5 py-1 bg-amber-500/10 border border-amber-500/20 rounded-xl shrink-0",children:[(0,s.jsx)(A.A,{className:"w-3.5 h-3.5 text-amber-400 shrink-0"}),(0,s.jsxs)("span",{className:"text-xs font-bold text-amber-300 font-vazir",children:[(0,g.ub)(el)," از ",(0,g.ub)(ee)," نشان"]})]})]}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("div",{className:"w-full h-2 bg-slate-800 rounded-full overflow-hidden p-[1px]",children:(0,s.jsx)("div",{className:"h-full bg-gradient-to-r from-amber-500 to-orange-500 rounded-full transition-all duration-500",style:{width:"".concat(et,"%")}})}),(0,s.jsxs)("div",{className:"flex justify-between text-[10px] text-slate-400",children:[(0,s.jsx)("span",{children:"پیشرفت کل"}),(0,s.jsxs)("span",{className:"font-bold text-amber-400 font-vazir",children:[(0,g.ub)(et),"٪"]})]})]}),es&&(0,s.jsxs)("div",{className:"p-2 sm:p-2.5 bg-slate-950/60 border border-amber-500/20 rounded-xl flex items-center justify-between gap-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,s.jsx)("div",{className:"w-7 h-7 rounded-lg bg-amber-500/10 border border-amber-500/20 flex items-center justify-center text-amber-400 shrink-0",children:(0,s.jsx)(P.A,{className:"w-3.5 h-3.5"})}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("span",{className:"text-[11px] font-bold text-slate-200 block truncate",children:["هدف بعدی: ",es.title]}),(0,s.jsx)("span",{className:"text-[10px] text-slate-400 block truncate",children:es.description})]})]}),(0,s.jsx)("div",{className:"text-left shrink-0",children:(0,s.jsxs)("span",{className:"text-xs font-black text-amber-400 font-vazir px-2 py-0.5 bg-amber-500/10 rounded-lg border border-amber-500/20",children:[(0,g.ub)(es.current),"/",(0,g.ub)(es.target)]})})]})]}),(0,s.jsxs)("div",{className:"space-y-2 pt-1",children:[(0,s.jsxs)(h.$,{onClick:()=>$("full"),"data-testid":"view-full-achievements-btn",variant:"outline",className:"w-full h-11 bg-slate-900/80 hover:bg-slate-800 border-amber-500/30 text-amber-300 hover:text-amber-200 rounded-2xl text-xs sm:text-sm font-bold flex items-center justify-center gap-2 transition-all duration-300",children:[(0,s.jsx)(A.A,{className:"w-4 h-4 text-amber-400"}),(0,s.jsx)("span",{children:"مشاهده تابلوی کامل افتخارات"}),(0,s.jsx)(E.A,{className:"w-4 h-4 text-slate-400 mr-auto"})]}),(0,s.jsxs)(h.$,{onClick:V,"data-testid":"go-to-dashboard-btn",className:"w-full h-12 bg-gradient-to-r from-amber-500 to-orange-500 hover:from-amber-600 hover:to-orange-600 text-slate-950 font-black rounded-2xl text-xs sm:text-sm flex items-center justify-center gap-2 shadow-lg shadow-amber-500/20 transition-all duration-300",children:[(0,s.jsx)(S.A,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"ورود به داشبورد"})]})]})]})]})}),(0,s.jsx)(w.s,{open:Y,onOpenChange:U,onSuccess:async()=>{await D()}})]})}function B(){var e,l;let{data:t}=(0,i.useSession)(),[n,d]=(0,a.useState)(!1),[c,x]=(0,a.useState)(!1),m=null==t||null==(e=t.user)?void 0:e.archetype,h=m?(0,p.i0)(m):null,v=(0,s.jsx)("div",{className:"w-full h-full rounded-full bg-white flex items-center justify-center overflow-hidden",children:h&&!n?(0,s.jsx)("img",{src:h,alt:"آرکیتایپ کاربر",className:"w-full h-full object-cover rounded-full",onError:()=>d(!0)}):(0,s.jsx)("div",{className:"w-full h-full rounded-full bg-violet-50 text-violet-600 flex items-center justify-center",children:(0,s.jsx)(o.A,{className:"w-5 h-5 sm:w-6 sm:h-6"})})}),f="relative flex items-center justify-center w-10 h-10 sm:w-11 sm:h-11 rounded-full bg-gradient-to-tr from-amber-500 via-violet-600 to-indigo-600 p-[2px] shadow-sm hover:shadow-md hover:scale-105 active:scale-95 transition-all duration-200 cursor-pointer";if(!(null==t?void 0:t.user))return(0,s.jsxs)("div",{className:"relative flex items-center",children:[(0,s.jsx)(r(),{href:"/auth/customer/signin",className:f,title:"حساب کاربری",children:v}),(0,s.jsx)(u,{})]});let b=null==(l=t.user)?void 0:l.role;return"ADMIN"===b||"SUPER_ADMIN"===b?(0,s.jsxs)("div",{className:"relative flex items-center",children:[(0,s.jsx)(r(),{href:"/admin-dashboard",className:f,title:"حساب کاربری",children:v}),(0,s.jsx)(u,{})]}):"CAFE_OWNER"===b?(0,s.jsxs)("div",{className:"relative flex items-center",children:[(0,s.jsx)(r(),{href:"/business-dashboard",className:f,title:"حساب کاربری",children:v}),(0,s.jsx)(u,{})]}):(0,s.jsxs)("div",{className:"relative flex items-center",children:[(0,s.jsx)("button",{type:"button",onClick:()=>x(!0),className:f,title:"حساب کاربری",children:v}),(0,s.jsx)(u,{}),(0,s.jsx)(I,{open:c,onOpenChange:x})]})}}}]);