"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6858],{1288:(e,t,a)=>{a.d(t,{bh:()=>r}),a(4368);let r={ACTION_TAKER:{key:"ACTION_TAKER",title:"مدال عملگرایی",description:"ثبت آیدی اختصاصی و برداشتن اولین قدم در کلاب پلیمو",icon:"\uD83C\uDFC5",gradient:"from-amber-400 via-amber-500 to-orange-500"},REFERRAL_AMBASSADOR:{key:"REFERRAL_AMBASSADOR",title:"سفیر پلیمو",description:"دعوت موفق از ۵ همبازی به کلاب",icon:"\uD83C\uDFC5",gradient:"from-amber-500 to-yellow-400"},COMMUNITY_BUILDER:{key:"COMMUNITY_BUILDER",title:"جامعه‌ساز",description:"دعوت موفق از ۱۰ همبازی به کلاب",icon:"\uD83C\uDF96️",gradient:"from-blue-500 to-indigo-600"},PLAYMATE_LEGEND:{key:"PLAYMATE_LEGEND",title:"افسانه همبازی‌ها",description:"دعوت موفق از ۱۵ همبازی به کلاب",icon:"\uD83C\uDF1F",gradient:"from-purple-500 to-pink-500"},GAME_LEADER:{key:"GAME_LEADER",title:"پیشوای بازی",description:"دعوت موفق از ۲۰ همبازی به کلاب",icon:"\uD83D\uDD25",gradient:"from-orange-500 to-red-500"},GRAND_MAGNET:{key:"GRAND_MAGNET",title:"مغناطیس بزرگ",description:"دعوت موفق از ۵۰ همبازی به کلاب (دارای تیک طلایی)",icon:"\uD83D\uDC8E",gradient:"from-cyan-400 to-blue-600"},AMBASSADOR_COUNCIL:{key:"AMBASSADOR_COUNCIL",title:"شورای سفیران پلیمو",description:"عضویت دائم در شورای سفیران کلاب با ۱۰۰ دعوت موفق",icon:"\uD83D\uDC51",gradient:"from-amber-400 via-orange-500 to-yellow-500"},ARCHETYPE_DIPLOMAT:{key:"ARCHETYPE_DIPLOMAT",title:"دیپلمات آرکتایپ‌ها",description:"تجربه بازی با تیپ‌های شخصیتی گوناگون",icon:"\uD83C\uDFAD",gradient:"from-violet-500 to-purple-600"},CAFE_EXPLORER:{key:"CAFE_EXPLORER",title:"کافه‌گرد کاوشگر",description:"کشف و تجربه بازی در کافه‌های مختلف شهر",icon:"☕",gradient:"from-emerald-500 to-teal-600"},GAME_COLLECTOR:{key:"GAME_COLLECTOR",title:"کلکسیونر بردگیم",description:"تجربه و ثبت عناوین متنوع بردگیم در کارنامه",icon:"\uD83C\uDFB2",gradient:"from-blue-500 to-indigo-600"},RELIABLE_HOST:{key:"RELIABLE_HOST",title:"میزبان خوش‌قول",description:"برگزاری میزهای بازی موفق و بدون کنسلی",icon:"\uD83D\uDEE1️",gradient:"from-amber-500 to-orange-600"},WEEKEND_WARRIOR:{key:"WEEKEND_WARRIOR",title:"شعله استریک",description:"تداوم هفتگی و حضور پیوسته در رویدادها",icon:"\uD83D\uDD25",gradient:"from-red-500 to-rose-600"}}},3216:(e,t,a)=>{a.d(t,{AT:()=>l});var r=a(1288);let s=[{key:"ACTION_TAKER",target:1,category:"exploration",unit:"آیدی",getStat:e=>e.username&&e.username.trim().length>0?1:0},{key:"REFERRAL_AMBASSADOR",target:5,category:"referral",unit:"دوست",getStat:e=>{var t;return null!=(t=e.referralCount)?t:0}},{key:"COMMUNITY_BUILDER",target:10,category:"referral",unit:"دوست",getStat:e=>{var t;return null!=(t=e.referralCount)?t:0}},{key:"PLAYMATE_LEGEND",target:15,category:"referral",unit:"دوست",getStat:e=>{var t;return null!=(t=e.referralCount)?t:0}},{key:"GAME_LEADER",target:20,category:"referral",unit:"دوست",getStat:e=>{var t;return null!=(t=e.referralCount)?t:0}},{key:"GRAND_MAGNET",target:50,category:"referral",unit:"دوست",getStat:e=>{var t;return null!=(t=e.referralCount)?t:0}},{key:"AMBASSADOR_COUNCIL",target:100,category:"referral",unit:"دوست",getStat:e=>{var t;return null!=(t=e.referralCount)?t:0}},{key:"CAFE_EXPLORER",target:3,category:"exploration",unit:"کافه",getStat:e=>{var t;return null!=(t=e.uniqueCafesCount)?t:0}},{key:"GAME_COLLECTOR",target:5,category:"exploration",unit:"بازی",getStat:e=>{var t;return null!=(t=e.uniqueGamesCount)?t:0}},{key:"RELIABLE_HOST",target:3,category:"hosting",unit:"میزبانی",getStat:e=>{var t;return null!=(t=e.playmasterCount)?t:0}},{key:"ARCHETYPE_DIPLOMAT",target:4,category:"exploration",unit:"آرکتایپ",getStat:e=>{var t;return null!=(t=e.distinctArchetypesCount)?t:0}},{key:"WEEKEND_WARRIOR",target:2,category:"streak",unit:"هفته",getStat:e=>{var t;return null!=(t=e.currentStreakWeeks)?t:0}}],n=[{id:"catan-masters-vip",title:"تورنمنت مخفی قهرمانان کاتان",subtitle:"نبرد استراتژیست‌های برتر کلاب",description:"رویداد اختصاصی محرمانه با حضور برترین همبازی‌های استراتژیک و جوایز نفیس شمش طلا.",tag:"سطح ۳",reward:"۵۰ سکه شمش + نشان افتخار کاتان",targetCount:5,targetMetric:"referralCount",conditionText:"دعوت موفق از حداقل ۵ همبازی به کلاب",vipMessage:"تبریک! با دعوت از ۵ همبازی، قفل رویداد ویژه کاتان برای شما باز شد. صندلی VIP شما در انتظار است!"},{id:"shadow-syndicate-night",title:"شب مافیای تاریک سایه‌ها",subtitle:"نشست سالانه استادان نقش‌مخفی",description:"یک شب پر رمز و راز با سناریوی اختصاصی، پذیرایی VIP و نبرد ذهنی برترین بازیکنان نقش مخفی.",tag:"سطح ۴",reward:"۳۰ سکه + تندیس گرداننده برتر",targetCount:3,targetMetric:"uniqueCafesCount",conditionText:"کشف و بازی در حداقل ۳ کافه مختلف شهر",vipMessage:"تبریک! با کشف ۳ کافه مختلف، دعوت‌نامه شب مافیای تاریک برای شما ارسال شد."},{id:"legends-council-gala",title:"گردهمایی تالار اساطیر بردگیم",subtitle:"ضیافت شام اختصاصی پلی‌مسترهای نخبه",description:"ضیافت مجلل و بازی آزمایشی بردگیم‌های جدید پیش از عرضه عمومی به همراه پذیرایی ویژه.",tag:"سطح ۵",reward:"۱۰۰ سکه + عضویت شورای اساطیر",targetCount:10,targetMetric:"uniqueGamesCount",conditionText:"تجربه و ثبت حداقل ۱۰ عنوان بازی رومیزی",vipMessage:"تبریک اسطوره! شما با تجربه ۱۰ بازی متنوع، به گردهمایی سالانه اساطیر راه یافتید."}];function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=[],a=[],l=new Set(e.awardedBadgeKeys||[]);for(let n of s){let s=r.bh[n.key];if(!s)continue;let o=l.has(n.key),i=Math.max(0,n.getStat(e)),d=o?Math.max(n.target,i):i,c=o||d>=n.target,m=c?100:Math.min(100,Math.floor(d/n.target*100)),x={key:n.key,title:s.title,description:s.description,icon:s.icon,gradient:s.gradient,target:n.target,current:d,progressPercent:m,isEarned:c,category:n.category,unit:n.unit};c?t.push(x):a.push(x)}a.sort((e,t)=>t.progressPercent-e.progressPercent);let o=n.map(t=>{var a;let r=Math.max(0,null!=(a=e[t.targetMetric])?a:0),s=r<t.targetCount,n=s?Math.min(100,Math.floor(r/t.targetCount*100)):100;return{id:t.id,title:t.title,subtitle:t.subtitle,description:t.description,tag:t.tag,reward:t.reward,targetCount:t.targetCount,currentCount:r,progressPercent:n,conditionText:t.conditionText,isLocked:s,vipMessage:t.vipMessage}});return{earnedBadges:t,shadowBadges:a,totalBadgesCount:t.length+a.length,earnedBadgesCount:t.length,events:o,unlockedEventsCount:o.filter(e=>!e.isLocked).length,totalEventsCount:o.length}}},16481:(e,t,a)=>{a.d(t,{u:()=>I,h:()=>D});var r=a(95155),s=a(12115),n=a(27063),l=a(3998),o=a(51950),i=a(61362);function d(e){let{badge:t,className:a="",onClick:s}=e,n=!!s;return(0,r.jsxs)("div",{role:n?"button":void 0,tabIndex:n?0:void 0,onClick:n?()=>{s&&s(t)}:void 0,onKeyDown:n?e=>{("Enter"===e.key||" "===e.key)&&s&&(e.preventDefault(),s(t))}:void 0,"data-testid":"medal-badge-".concat(t.key),title:"".concat(t.title," (").concat((0,o.ub)(t.progressPercent),"٪)"),"aria-label":"".concat(t.title," - ").concat(t.isEarned?"کسب‌شده":"در حال پیشرفت"),className:"group flex flex-col items-center gap-1.5 select-none ".concat(n?"cursor-pointer active:scale-95":""," ").concat(a),children:[(0,r.jsxs)("div",{className:"relative w-14 h-14 sm:w-16 sm:h-16 rounded-full flex items-center justify-center transition-all duration-300 shadow-md ".concat(t.isEarned?"bg-gradient-to-b from-amber-500/15 via-slate-900 to-slate-950 border-2 border-amber-400 shadow-lg shadow-amber-500/20":"bg-slate-900/70 border border-slate-700/60 shadow-inner"),children:[t.isEarned&&(0,r.jsx)("div",{className:"pointer-events-none absolute inset-0 rounded-full bg-amber-400/15 blur-sm"}),(0,r.jsx)("span",{role:"img","aria-label":t.title,className:"text-2xl sm:text-3xl transition-all duration-300 ".concat(t.isEarned?"opacity-100 scale-105 filter-none drop-shadow-sm":"filter grayscale contrast-75 opacity-40 group-hover:opacity-60"),children:t.icon}),t.isEarned&&(0,r.jsx)("div",{className:"absolute -top-0.5 -right-0.5 w-4 h-4 rounded-full bg-amber-500 text-slate-950 flex items-center justify-center shadow-xs",children:(0,r.jsx)(i.A,{className:"w-3 h-3 stroke-[3]"})})]}),(0,r.jsx)("div",{className:"w-10 sm:w-12 h-1.5 bg-slate-800/90 rounded-full overflow-hidden border border-white/5 p-[0.5px]",children:(0,r.jsx)("div",{"data-testid":"medal-progress-bar",className:"h-full rounded-full transition-all duration-500 ".concat(t.isEarned?"bg-gradient-to-r from-amber-500 to-yellow-400 shadow-xs shadow-amber-500/40":"bg-gradient-to-r from-amber-600/90 to-amber-500/80"),style:{width:"".concat(t.progressPercent,"%")}})})]})}let c=(0,s.forwardRef)((e,t)=>{let{className:a=""}=e,[n,l]=(0,s.useState)([]),o=(0,s.useRef)(null),i=(0,s.useRef)(0),d=(0,s.useRef)(null),c=(0,s.useCallback)(e=>{let t=Date.now();if(t-i.current<400||(i.current=t,window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches))return;let a=o.current,r=null==a?void 0:a.getBoundingClientRect(),s=100,n=50;r&&r.width>0&&r.height>0&&(e&&"number"==typeof e.clientX&&"number"==typeof e.clientY&&e.clientX>0&&e.clientY>0?(s=e.clientX-r.left,n=e.clientY-r.top):(s=r.width/2,n=r.height/2));let c=["#fde047","#fbbf24","#f59e0b","#d97706","#ffffff"],m=[];for(let e=0;e<12;e++){let a=Math.PI/180*(30*e+(20*Math.random()-10)),r=30+45*Math.random(),l=Math.cos(a)*r,o=Math.sin(a)*r-(10+15*Math.random()),i=3+3.5*Math.random(),d=500+250*Math.random(),x=60*Math.random(),u=c[e%c.length];m.push({id:t+e,x:s,y:n,tx:l,ty:o,size:i,duration:d,delay:x,color:u})}l(m),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{l([])},850)},[]);return(0,s.useImperativeHandle)(t,()=>({trigger:c})),(0,r.jsxs)("div",{ref:o,"data-testid":"gold-dust-container",className:"pointer-events-none absolute inset-0 overflow-hidden z-20 ".concat(a),"aria-hidden":"true",children:[(0,r.jsx)("style",{children:"\n          @keyframes goldDustBurstAnimation {\n            0% {\n              transform: translate3d(0, 0, 0) scale(1);\n              opacity: 1;\n            }\n            70% {\n              opacity: 0.9;\n            }\n            100% {\n              transform: translate3d(var(--tx), var(--ty), 0) scale(0.2);\n              opacity: 0;\n            }\n          }\n          @media (prefers-reduced-motion: reduce) {\n            .gold-dust-spark {\n              display: none !important;\n            }\n          }\n        "}),n.map(e=>(0,r.jsx)("span",{"data-testid":"gold-dust-particle",className:"gold-dust-spark absolute rounded-full",style:{left:"".concat(e.x,"px"),top:"".concat(e.y,"px"),width:"".concat(e.size,"px"),height:"".concat(e.size,"px"),backgroundColor:e.color,boxShadow:"0 0 6px 1.5px ".concat(e.color),"--tx":"".concat(e.tx,"px"),"--ty":"".concat(e.ty,"px"),animation:"goldDustBurstAnimation ".concat(e.duration,"ms cubic-bezier(0.22, 1, 0.36, 1) ").concat(e.delay,"ms forwards"),willChange:"transform, opacity"}},e.id))]})});c.displayName="GoldDustEffect";var m=a(51834),x=a(99708),u=a(35795),h=a(95740),b=a(60709);function p(e){let{event:t,className:a="",onOpenVIPDialog:n}=e,i=(0,s.useRef)(null),[d,p]=(0,s.useState)(!1),g=e=>{if(t.isLocked){var a;null==(a=i.current)||a.trigger(e)}else n&&n(t),p(!0)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{role:"button",tabIndex:0,onClick:g,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),g(e))},"data-testid":"shadow-event-card-".concat(t.id),"aria-label":"".concat(t.title," - ").concat(t.isLocked?"قفل":"بازگشایی‌شده"),className:"group relative overflow-hidden rounded-3xl border transition-all duration-200 select-none cursor-pointer scale-100 active:scale-95 focus:outline-hidden focus-visible:ring-2 focus-visible:ring-amber-400 ".concat(t.isLocked?"bg-gradient-to-b from-slate-900/80 via-slate-900/95 to-slate-950/90 border-white/10 hover:border-amber-500/40 shadow-lg":"bg-gradient-to-br from-slate-900/90 via-purple-950/40 to-amber-950/40 border-amber-500/50 shadow-xl shadow-amber-500/10 hover:border-amber-400"," p-4 sm:p-5 backdrop-blur-xl ").concat(a),children:[(0,r.jsx)(c,{ref:i}),!t.isLocked&&(0,r.jsx)("div",{className:"pointer-events-none absolute -top-12 -left-12 w-28 h-28 bg-amber-500/15 rounded-full blur-2xl"}),(0,r.jsx)("div",{className:"absolute top-3.5 left-3.5 z-20",children:(0,r.jsx)("span",{className:"px-2.5 py-0.5 rounded-full text-[10px] font-bold tracking-wide border shadow-xs ".concat(t.isLocked?"bg-purple-950/70 border-purple-800/60 text-purple-300":"bg-amber-500/20 border-amber-400/50 text-amber-300 shadow-amber-500/10"),children:t.tag})}),(0,r.jsxs)("div",{className:"relative z-10 flex flex-col items-center justify-center py-2 sm:py-3 px-2 text-center",children:[(0,r.jsx)("div",{className:"w-13 h-13 sm:w-14 sm:h-14 rounded-2xl flex items-center justify-center transition-transform duration-300 group-hover:scale-105 shadow-md ".concat(t.isLocked?"bg-slate-800/90 border border-slate-700/80 text-amber-400/90 shadow-inner":"bg-gradient-to-tr from-amber-500 to-yellow-400 text-slate-950 shadow-amber-500/30"),children:t.isLocked?(0,r.jsx)(x.A,{className:"w-5 h-5 sm:w-6 sm:h-6"}):(0,r.jsx)(u.A,{className:"w-5 h-5 sm:w-6 sm:h-6 animate-bounce"})}),(0,r.jsx)("h4",{className:"text-sm sm:text-base font-bold leading-snug mt-3 transition-colors ".concat(t.isLocked?"text-slate-200 group-hover:text-amber-300":"text-amber-200"),children:t.title}),(0,r.jsxs)("div",{className:"w-36 sm:w-48 mt-3.5 space-y-1",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between text-[10px] font-mono font-bold text-slate-400 px-0.5",children:[(0,r.jsx)("span",{children:t.isLocked?"پیشرفت بازگشایی":"آزاد شد ✓"}),(0,r.jsx)("span",{className:t.isLocked?"text-amber-400":"text-emerald-400",children:t.isLocked?"".concat((0,o.ub)(t.currentCount)," / ").concat((0,o.ub)(t.targetCount)):"۱۰۰٪"})]}),(0,r.jsx)("div",{className:"w-full h-1.5 bg-slate-800/90 rounded-full overflow-hidden p-[0.5px]",children:(0,r.jsx)("div",{"data-testid":"event-progress-bar",className:"h-full rounded-full transition-all duration-500 ".concat(t.isLocked?"bg-gradient-to-r from-amber-600 to-amber-400":"bg-gradient-to-r from-emerald-500 to-teal-400 shadow-xs shadow-emerald-400/50"),style:{width:"".concat(t.progressPercent,"%")}})})]})]})]}),(0,r.jsx)(m.lG,{open:d,onOpenChange:p,children:(0,r.jsxs)(m.Cf,{className:"z-[60] max-w-xs sm:max-w-sm bg-slate-950/95 border-amber-500/40 text-white backdrop-blur-2xl rounded-3xl p-6 shadow-2xl shadow-amber-500/20",children:[(0,r.jsxs)(m.c7,{className:"text-center space-y-3",children:[(0,r.jsx)("div",{className:"w-14 h-14 rounded-2xl bg-gradient-to-tr from-amber-500/30 to-purple-500/30 border border-amber-400/50 flex items-center justify-center mx-auto shadow-inner shadow-amber-400/20",children:(0,r.jsx)(h.A,{className:"w-7 h-7 text-amber-300"})}),(0,r.jsx)("div",{className:"inline-block px-3 py-1 rounded-full text-[11px] font-bold tracking-wide bg-gradient-to-r from-purple-500/30 to-pink-500/30 border border-purple-400/40 text-purple-200 mx-auto",children:t.tag}),(0,r.jsx)(m.L3,{className:"text-lg font-bold text-white leading-snug",children:t.title}),(0,r.jsx)("p",{className:"text-xs text-amber-300/90 font-medium",children:t.subtitle}),(0,r.jsx)(m.rr,{className:"text-xs text-slate-300 leading-relaxed pt-1",children:t.description})]}),(0,r.jsxs)("div",{className:"my-4 p-3.5 rounded-2xl bg-slate-900/90 border border-amber-500/30 space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs text-amber-400 font-semibold",children:[(0,r.jsx)(b.A,{className:"w-4 h-4 text-amber-400 shrink-0"}),(0,r.jsx)("span",{children:"پاداش اختصاصی رویداد:"})]}),(0,r.jsx)("p",{className:"text-xs text-slate-200 font-medium pr-6 leading-relaxed",children:t.reward})]}),(0,r.jsx)("div",{className:"p-3 rounded-xl bg-purple-950/40 border border-purple-500/30 text-xs text-purple-200 leading-relaxed text-center",children:t.vipMessage}),(0,r.jsx)(l.$,{onClick:()=>p(!1),className:"w-full mt-2 h-11 bg-gradient-to-r from-amber-500 to-orange-500 hover:from-amber-600 hover:to-orange-600 text-slate-950 font-bold rounded-xl text-sm transition-all duration-300 shadow-md shadow-amber-500/20",children:"افتخار همراهی را می‌پذیرم"})]})})]})}var g=a(20057),f=a(48055),w=a(5917);let v=[{id:1,stepNumber:"۱",label:"گام ۱",rangeLabel:"۱ تا ۵ دوست",rewardPerFriend:"۱ سکه",rewardPill:"+۱ سکه",minFriends:1,maxFriends:5},{id:2,stepNumber:"۲",label:"گام ۲",rangeLabel:"۶ تا ۱۰ دوست",rewardPerFriend:"۲ سکه",rewardPill:"+۲ سکه",minFriends:6,maxFriends:10},{id:3,stepNumber:"۳",label:"گام ۳",rangeLabel:"۱۱ تا ۱۵ دوست",rewardPerFriend:"۳ سکه",rewardPill:"+۳ سکه",minFriends:11,maxFriends:15},{id:4,stepNumber:"۴",label:"گام ۴",rangeLabel:"+۱۶ دوست",rewardPerFriend:"۴ سکه",rewardPill:"+۴ سکه",minFriends:16,maxFriends:1/0}];function j(e){let{referralCount:t=0,className:a=""}=e,s=t<=0?0:t<=5?Math.min(33.33,t/5*33.33):t<=10?Math.min(66.66,33.33+(t-5)/5*33.33):t<=15?Math.min(100,66.66+(t-10)/5*33.34):100,n=t>=16?3:t>=11?2:+(t>=6);return(0,r.jsxs)("div",{"data-testid":"referral-reward-stepper",dir:"rtl",className:"space-y-3 ".concat(a),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("span",{className:"text-xs font-semibold text-amber-400 flex items-center gap-1.5",children:[(0,r.jsx)(f.A,{className:"w-4 h-4 text-amber-400 shrink-0"}),(0,r.jsx)("span",{children:"پلکان پاداش سکه‌ها"})]}),t>0?(0,r.jsxs)("div",{className:"flex items-center gap-1.5 text-[11px] font-medium text-amber-300/90 bg-amber-500/10 px-2.5 py-0.5 rounded-full border border-amber-500/20",children:[(0,r.jsx)(h.A,{className:"w-3 h-3 text-amber-400 shrink-0"}),(0,r.jsxs)("span",{children:["دعوت‌های شما: ",(0,r.jsx)("strong",{children:(0,o.ub)(t)})," دوست"]})]}):(0,r.jsx)("span",{className:"text-[11px] text-slate-400",children:"به ازای هر دوست جدید"})]}),(0,r.jsxs)("div",{className:"p-3.5 sm:p-5 rounded-2xl bg-gradient-to-b from-slate-900/90 via-slate-900/60 to-slate-950 border border-slate-800/80 shadow-inner",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("div",{className:"grid grid-cols-4 mb-2.5",style:{gridTemplateColumns:"repeat(4, minmax(0, 1fr))"},children:v.map((e,a)=>{let s=a<n||a===n&&t>=e.maxFriends,l=a===n&&t<e.maxFriends;return(0,r.jsx)("div",{className:"flex items-center justify-center px-0.5",children:(0,r.jsx)("span",{"data-testid":"station-pill-".concat(e.id),className:"px-2 py-0.5 sm:px-2.5 sm:py-1 rounded-lg text-[11px] sm:text-xs font-black transition-all flex items-center justify-center whitespace-nowrap ".concat(s||l?"bg-amber-500/20 text-amber-300 border border-amber-500/40 shadow-xs shadow-amber-500/10":"bg-slate-800/70 text-slate-400 border border-slate-700/50"),children:e.rewardPill})},"pill-".concat(e.id))})}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("div",{"aria-hidden":"true",className:"absolute top-1/2 -translate-y-1/2 right-[12.5%] left-[12.5%] h-1 bg-slate-800/90 rounded-full z-0 overflow-hidden pointer-events-none",children:(0,r.jsx)("div",{"data-testid":"stepper-progress-fill",className:"h-full bg-gradient-to-l from-amber-500 via-orange-400 to-amber-300 rounded-full transition-all duration-500 shadow-sm shadow-amber-500/50",style:{width:"".concat(s,"%")}})}),(0,r.jsx)("div",{className:"grid grid-cols-4 relative z-10",style:{gridTemplateColumns:"repeat(4, minmax(0, 1fr))"},children:v.map((e,a)=>{let s=a<n||a===n&&t>=e.maxFriends,l=a===n&&t<e.maxFriends;return(0,r.jsx)("div",{"data-testid":"stepper-station-".concat(e.id),className:"flex justify-center items-center h-8",children:(0,r.jsxs)("div",{className:"relative flex items-center justify-center w-7 h-7 sm:w-8 sm:h-8",children:[(0,r.jsx)("div",{"data-testid":"station-node-".concat(e.id),className:"w-7 h-7 sm:w-8 sm:h-8 rounded-full flex items-center justify-center text-xs font-black transition-all duration-300 ".concat(s?"bg-gradient-to-tr from-amber-500 to-orange-500 text-slate-950 border-2 border-amber-300 shadow-md shadow-amber-500/30":l?"bg-slate-950 text-amber-400 border-2 border-amber-400 ring-4 ring-amber-500/25 shadow-md shadow-amber-500/30":"bg-slate-900 text-slate-500 border-2 border-slate-700"),children:s?(0,r.jsx)(w.A,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 stroke-[3]"}):(0,r.jsx)("span",{children:e.stepNumber})}),l&&(0,r.jsx)("span",{"aria-hidden":"true",className:"absolute inset-0 rounded-full border border-amber-400 animate-ping opacity-40 pointer-events-none"})]})},"node-".concat(e.id))})})]}),(0,r.jsx)("div",{className:"grid grid-cols-4 mt-2.5",style:{gridTemplateColumns:"repeat(4, minmax(0, 1fr))"},children:v.map((e,a)=>{let s=a<n||a===n&&t>=e.maxFriends,l=a===n&&t<e.maxFriends;return(0,r.jsx)("div",{className:"flex flex-col items-center text-center px-1",children:(0,r.jsx)("span",{"data-testid":"station-range-".concat(e.id),className:"block text-[11px] sm:text-xs font-bold leading-tight ".concat(s||l?"text-white":"text-slate-400"),children:e.rangeLabel})},"label-".concat(e.id))})})]}),(0,r.jsxs)("div",{className:"mt-4 pt-3 border-t border-slate-800/80 flex items-center justify-between text-[11px] text-slate-400 px-1",children:[(0,r.jsx)("span",{children:"شروع: ۱ سکه به ازای هر دوست"}),(0,r.jsx)("span",{className:"text-amber-400 font-semibold",children:"سقف دائمی: ۴ سکه به ازای هر دوست"})]})]})]})}var N=a(3216),y=a(1288),k=a(18720),C=a(52987),E=a(6613),A=a(91169),R=a(76907),L=a(75426),S=a(54690),M=a(17181);function D(e){var t,a,i,c,m,x,u,v,D,I,O;let{user:T,defaultTab:_="achievements",onOpenQr:F,className:P="",onBack:B}=e,[G,U]=(0,s.useState)(_),[z,q]=(0,s.useState)(!1),[Y,K]=(0,s.useState)(!1);(0,s.useEffect)(()=>{_&&U(_)},[_]);let W=null!=(t=null==T?void 0:T.coins)?t:0,$=null!=(a=null==T?void 0:T.referralCode)?a:"",H=(0,N.AT)({username:null==T?void 0:T.username,referralCount:null!=(i=null==T?void 0:T.referralCount)?i:0,uniqueCafesCount:null!=(c=null==T?void 0:T.uniqueCafesCount)?c:0,uniqueGamesCount:null!=(m=null==T?void 0:T.uniqueGamesCount)?m:0,playmasterCount:null!=(x=null==T?void 0:T.playmasterCount)?x:0,playmateCount:null!=(u=null==T?void 0:T.playmateCount)?u:0,coins:W,currentStreakWeeks:null!=(v=null==T?void 0:T.currentStreakWeeks)?v:0,distinctArchetypesCount:null!=(D=null==T?void 0:T.distinctArchetypesCount)?D:0,awardedBadgeKeys:null!=(I=null==T?void 0:T.awardedBadgeKeys)?I:[]}),Q="".concat(window.location.origin,"/invite/").concat($),X="دوست من، به جمع آرشین‌های کلاب بازی پلیمو ملحق شو! با ورود از این لینک ۱ سکه طلایی هدیه می‌گیری \uD83E\uDE99\n".concat(Q),V=async()=>{try{await navigator.clipboard.writeText(Q),q(!0),k.o.success("لینک اختصاصی دعوت کپی شد"),setTimeout(()=>q(!1),2e3)}catch(e){k.o.error("خطا در کپی لینک")}},J=async()=>{if("undefined"!=typeof navigator&&navigator.share)try{await navigator.share({title:"کارنامه افتخارات ".concat((null==T?void 0:T.name)||"همبازی کلاب"," در پلیمو"),text:"مدال‌ها و دستاوردهای من در کلاب بازی پلیمو را ببینید و به جمع همبازی‌ها ملحق شوید! \uD83C\uDFB2✨",url:Q}),k.o.success("کارت افتخارات به اشتراک گذاشته شد");return}catch(e){}V()},Z=[{...y.bh.REFERRAL_AMBASSADOR,target:"۵ دوست"},{...y.bh.COMMUNITY_BUILDER,target:"۱۰ دوست"},{...y.bh.PLAYMATE_LEGEND,target:"۱۵ دوست"},{...y.bh.GAME_LEADER,target:"۲۰ دوست"},{...y.bh.GRAND_MAGNET,target:"۵۰ دوست"},{...y.bh.AMBASSADOR_COUNCIL,target:"۱۰۰ دوست"}];return(0,r.jsxs)("div",{className:"space-y-6 ".concat(P),children:[(0,r.jsxs)(n.Fm,{className:"text-right space-y-3 pb-4 sm:pb-5 border-b border-white/10",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[B&&(0,r.jsx)("button",{type:"button",onClick:B,"aria-label":"بازگشت به نمای خلاصه","data-testid":"achievements-back-btn",className:"w-9 h-9 rounded-xl bg-slate-900 border border-white/10 hover:border-amber-500/50 flex items-center justify-center text-slate-300 hover:text-white transition-colors shrink-0",children:(0,r.jsx)(C.A,{className:"w-4 h-4"})}),(0,r.jsx)("div",{className:"w-10 h-10 rounded-2xl bg-gradient-to-tr from-amber-500 to-orange-500 flex items-center justify-center shadow-md shadow-amber-500/20 text-slate-950 shrink-0",children:(0,r.jsx)(E.A,{className:"w-5 h-5"})}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)(n.qp,{className:"text-base sm:text-lg font-black text-white truncate",children:"تابلوی افتخارات"}),(0,r.jsx)(n.Qs,{className:"text-xs text-slate-400 truncate",children:"مدال‌ها و دستاوردهای کلاب پلیمو"})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 sm:px-3.5 sm:py-2 bg-gradient-to-r from-amber-500/15 via-amber-500/10 to-yellow-500/10 border border-amber-500/30 rounded-2xl shadow-md shadow-amber-500/10 shrink-0",children:[(0,r.jsx)(f.A,{className:"w-4 h-4 sm:w-5 sm:h-5 text-amber-400 animate-bounce shrink-0"}),(0,r.jsxs)("div",{className:"text-right",children:[(0,r.jsxs)("div",{className:"text-xs sm:text-sm font-black text-amber-300",children:[(0,o.ub)(W)," سکه طلا"]}),(0,r.jsx)("div",{className:"text-[9px] sm:text-[10px] text-amber-400/80 font-medium",children:"اعتبار ورود به رویدادهای VIP"})]})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-2 pt-2",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>U("achievements"),"data-testid":"tab-achievements",className:"flex items-center justify-center gap-2 py-2.5 px-4 rounded-xl text-xs sm:text-sm font-bold transition-all duration-300 ".concat("achievements"===G?"bg-gradient-to-r from-amber-500 to-orange-500 text-slate-950 shadow-md shadow-amber-500/20":"bg-slate-900/80 text-slate-400 hover:text-slate-200 border border-white/5"),children:[(0,r.jsx)(E.A,{className:"w-4 h-4"}),(0,r.jsx)("span",{children:"مدال‌ها و ماجراجویی‌ها"})]}),(0,r.jsxs)("button",{type:"button",onClick:()=>U("invite"),"data-testid":"tab-invite",className:"flex items-center justify-center gap-2 py-2.5 px-4 rounded-xl text-xs sm:text-sm font-bold transition-all duration-300 ".concat("invite"===G?"bg-gradient-to-r from-amber-500 to-orange-500 text-slate-950 shadow-md shadow-amber-500/20":"bg-slate-900/80 text-slate-400 hover:text-slate-200 border border-white/5"),children:[(0,r.jsx)(A.A,{className:"w-4 h-4"}),(0,r.jsx)("span",{children:"دعوت و پاداش سکه‌ها"})]})]})]}),"achievements"===G&&(0,r.jsxs)("div",{className:"space-y-6 pt-5",children:[(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(h.A,{className:"w-4 h-4 text-amber-400"}),(0,r.jsx)("h3",{className:"text-sm font-bold text-white",children:"مدال‌های افتخار"})]}),(0,r.jsxs)("span",{className:"text-xs font-bold text-amber-400 font-vazir",children:[(0,o.ub)(H.earnedBadgesCount)," از"," ",(0,o.ub)(H.totalBadgesCount)," نشان"]})]}),(0,r.jsx)("div",{className:"p-3.5 sm:p-5 rounded-3xl bg-slate-900/40 border border-white/5",children:(0,r.jsx)("div",{className:"grid grid-cols-4 sm:grid-cols-6 gap-y-4 gap-x-2 sm:gap-4 justify-items-center",children:[...H.earnedBadges,...H.shadowBadges].map(e=>(0,r.jsx)(d,{badge:e},e.key))})})]}),(0,r.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(R.A,{className:"w-4 h-4 text-purple-400"}),(0,r.jsx)("h3",{className:"text-sm font-bold text-white",children:"کارت‌های رویدادهای رازآلود کلاب"})]}),(0,r.jsxs)("span",{className:"text-xs text-purple-300 font-bold font-vazir",children:[(0,o.ub)(H.unlockedEventsCount)," از"," ",(0,o.ub)(H.totalEventsCount)," آزاد شد"]})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 gap-3",children:H.events.map(e=>(0,r.jsx)(p,{event:e},e.id))})]})]}),"invite"===G&&(0,r.jsxs)("div",{className:"space-y-6 pt-5",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between pb-3 border-b border-white/5",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,r.jsx)("div",{className:"w-9 h-9 rounded-xl bg-amber-500/20 border border-amber-500/30 flex items-center justify-center",children:(0,r.jsx)(A.A,{className:"w-4 h-4 text-amber-400"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-sm font-bold text-white",children:"دعوت از دوستان به کلاب پلیمو"}),(0,r.jsx)("p",{className:"text-[11px] text-slate-400",children:"دوستانت را دعوت کن، سکه طلا پاداش بگیر و مدال‌های کلاب را باز کن!"})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1.5 px-2.5 py-1 bg-amber-500/10 border border-amber-500/30 rounded-xl",children:[(0,r.jsx)(f.A,{className:"w-3.5 h-3.5 text-amber-400"}),(0,r.jsxs)("span",{className:"text-xs font-bold text-amber-300",children:[W," سکه"]})]})]}),(0,r.jsx)(j,{referralCount:null!=(O=null==T?void 0:T.referralCount)?O:0}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("span",{className:"text-xs font-semibold text-purple-400 flex items-center gap-1",children:[(0,r.jsx)(R.A,{className:"w-3.5 h-3.5"}),(0,r.jsx)("span",{children:"ایستگاه‌های مدال و نشان‌های افتخار"})]}),(0,r.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:Z.map((e,t)=>(0,r.jsxs)("div",{className:"p-3 bg-slate-900/60 border border-slate-800 rounded-xl flex items-center gap-2.5",children:[(0,r.jsx)("span",{className:"text-xl",children:e.icon}),(0,r.jsxs)("div",{className:"overflow-hidden",children:[(0,r.jsx)("span",{className:"text-xs font-bold text-white block truncate",children:e.title}),(0,r.jsx)("span",{className:"text-[10px] text-slate-400 block",children:e.target})]})]},t))})]}),(0,r.jsxs)("div",{className:"p-4 bg-gradient-to-br from-slate-900 to-slate-950 border border-amber-500/20 rounded-2xl flex flex-col sm:flex-row items-center justify-between gap-3 shadow-inner",children:[(0,r.jsxs)("div",{className:"text-center sm:text-right",children:[(0,r.jsx)("span",{className:"text-xs text-slate-400 block mb-1",children:"کد اختصاصی معرفی شما:"}),(0,r.jsx)("span",{className:"text-xl font-mono font-black tracking-wider text-amber-400",children:$||"دریافت نشده"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:[(0,r.jsx)(l.$,{size:"sm",onClick:V,"data-testid":"copy-invite-link-btn",className:"flex-1 sm:flex-initial bg-amber-500 hover:bg-amber-600 text-slate-950 font-bold rounded-xl h-10 px-4 flex items-center justify-center gap-1.5",children:z?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(w.A,{className:"w-4 h-4"}),(0,r.jsx)("span",{children:"کپی شد"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(L.A,{className:"w-4 h-4"}),(0,r.jsx)("span",{children:"کپی لینک"})]})}),(0,r.jsx)(l.$,{size:"sm",variant:"outline",onClick:()=>{F?F():K(!0)},"data-testid":"open-qr-btn",className:"border-slate-700 bg-slate-800/80 text-white hover:bg-slate-700 rounded-xl h-10 px-3",title:"نمایش QR Code",children:(0,r.jsx)(S.A,{className:"w-4 h-4 text-amber-400"})})]})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("span",{className:"text-xs font-medium text-slate-400 block",children:"اشتراک‌گذاری مستقیم در پیام‌رسان‌ها:"}),(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-2.5",children:[(0,r.jsxs)(l.$,{variant:"outline",onClick:()=>{let e="https://ble.ir/share/url?url=".concat(encodeURIComponent(Q),"&text=").concat(encodeURIComponent("دوست من، به جمع آرشین‌های کلاب پلیمو ملحق شو! با ورود از لینک ۱ سکه هدیه می‌گیری \uD83E\uDE99"));window.open(e,"_blank","noopener,noreferrer")},className:"h-11 bg-emerald-950/30 hover:bg-emerald-900/40 border-emerald-500/30 text-emerald-300 rounded-xl text-xs flex items-center justify-center gap-1.5 transition-all",children:[(0,r.jsx)(M.A,{className:"w-3.5 h-3.5"}),(0,r.jsx)("span",{children:"ارسال در بله"})]}),(0,r.jsxs)(l.$,{variant:"outline",onClick:()=>{let e="https://t.me/share/url?url=".concat(encodeURIComponent(Q),"&text=").concat(encodeURIComponent("دوست من، به جمع آرشین‌های کلاب پلیمو ملحق شو! \uD83E\uDE99"));window.open(e,"_blank","noopener,noreferrer")},className:"h-11 bg-sky-950/30 hover:bg-sky-900/40 border-sky-500/30 text-sky-300 rounded-xl text-xs flex items-center justify-center gap-1.5 transition-all",children:[(0,r.jsx)(M.A,{className:"w-3.5 h-3.5"}),(0,r.jsx)("span",{children:"ارسال در تلگرام"})]}),(0,r.jsxs)(l.$,{variant:"outline",onClick:()=>{let e="https://api.whatsapp.com/send?text=".concat(encodeURIComponent(X));window.open(e,"_blank","noopener,noreferrer")},className:"h-11 bg-green-950/30 hover:bg-green-900/40 border-green-500/30 text-green-300 rounded-xl text-xs flex items-center justify-center gap-1.5 transition-all",children:[(0,r.jsx)(M.A,{className:"w-3.5 h-3.5"}),(0,r.jsx)("span",{children:"واتساپ"})]})]})]}),(0,r.jsxs)("div",{className:"p-3.5 bg-purple-950/30 border border-purple-500/30 rounded-2xl flex items-start gap-3",children:[(0,r.jsx)("div",{className:"w-8 h-8 rounded-lg bg-purple-500/20 border border-purple-500/40 flex items-center justify-center shrink-0 mt-0.5",children:(0,r.jsx)(b.A,{className:"w-4 h-4 text-purple-400"})}),(0,r.jsxs)("div",{className:"text-xs text-purple-200 leading-relaxed",children:[(0,r.jsx)("strong",{className:"text-purple-300 font-bold block mb-0.5",children:"\uD83C\uDF81 هدیه ورودی برای دوست شما:"}),"دوست شما با ورود از لینک، تکمیل ثبت‌نام، آزمون کهن‌الگو و ثبت نام کاربری،"," ",(0,r.jsx)("strong",{children:"۱ سکه طلایی هدیه خوش‌آمدگویی"})," دریافت می‌کند."]})]}),(0,r.jsxs)("div",{className:"p-3.5 bg-amber-500/10 border border-amber-500/20 rounded-2xl flex items-start gap-2.5 text-xs text-amber-200/90 leading-relaxed",children:[(0,r.jsx)(f.A,{className:"w-4 h-4 text-amber-400 shrink-0 mt-0.5"}),(0,r.jsxs)("span",{children:["\uD83E\uDE99 ",(0,r.jsx)("strong",{children:"ارزش آینده سکه‌ها:"})," این سکه‌ها کلید طلایی شما برای ورود ویژه به رویدادها، بازی‌های VIP و اتاق‌های اختصاصی سطوح بالاتر کلاب پلیمو هستند."]})]})]}),(0,r.jsx)("div",{className:"pt-6 border-t border-white/10 mt-6",children:(0,r.jsxs)(l.$,{onClick:J,"data-testid":"share-achievements-btn",className:"w-full h-12 bg-gradient-to-r from-amber-500 via-orange-500 to-amber-600 hover:from-amber-600 hover:to-orange-600 text-slate-950 font-bold rounded-2xl text-sm transition-all duration-300 shadow-lg shadow-amber-500/20 flex items-center justify-center gap-2",children:[(0,r.jsx)(M.A,{className:"w-4 h-4"}),(0,r.jsx)("span",{children:"اشتراک‌گذاری تابلوی افتخارات"})]})}),!F&&$&&(0,r.jsx)(g.j,{open:Y,onOpenChange:K,referralCode:$})]})}function I(e){let{open:t,onOpenChange:a,user:s,defaultTab:l="achievements",onOpenQr:o,className:i=""}=e;return(0,r.jsx)(n.cj,{open:t,onOpenChange:a,children:(0,r.jsx)(n.h,{side:"bottom","data-testid":"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(i),children:(0,r.jsx)(D,{user:s,defaultTab:l,onOpenQr:o})})})}},19881:(e,t,a)=>{a.d(t,{E:()=>l});var r=a(12115),s=a(14734),n=a(25112);function l(e){let[t,a]=(0,r.useState)(0),[l,o]=(0,r.useState)(!1),[i,d]=(0,r.useState)(null),{socket:c,isConnected:m}=(0,s.F)(),{lastNotification:x}=(0,n.h)(),[u,h]=(0,r.useState)("none"),[b,p]=(0,r.useState)(0),[g,f]=(0,r.useState)(0),w=(0,r.useCallback)(async()=>{if(e){o(!0),d(null);try{console.log("\uD83D\uDD04 Loading unread count for user:",e);let t=await fetch("/api/notifications?unread=true"),r=await t.json();if(r.success){let e=r.data.unreadCount;a(t=>(console.log("\uD83D\uDCCA Loaded unread count:",e,"previous:",t),t!==e&&console.log("✅ Unread count updated:",t,"->",e),e))}else d("خطا در بارگذاری تعداد اعلان‌ها")}catch(e){console.error("Error loading unread count:",e),d("خطا در اتصال به سرور")}finally{o(!1)}}},[e]),v=(0,r.useCallback)(async()=>{await w()},[w]);return(0,r.useEffect)(()=>{if(!c||!m||!e)return;"none"!==u&&"socket"!==u&&console.log("⚠️ Socket listener active alongside:",u),console.log("\uD83D\uDD0C Setting up notification socket listeners for user:",e),c.emit("joinUserRoom",e);let t=e=>{console.log("\uD83D\uDD14 New notification received via socket:",e),h("socket"),p(Date.now()),f(0),a(t=>{let a=t+1;return console.log("� SOCKET.IO notification received:",{from:t,to:a,data:e,timestamp:new Date().toISOString()}),a})};c.on("notification",t);let r=setTimeout(()=>{"none"===u&&(console.log("⚠️ Socket.IO timeout - falling back to SSE"),h("sse"))},1e4);return()=>{console.log("\uD83E\uDDF9 Cleaning up notification socket listeners"),clearTimeout(r),c.off("notification",t)}},[c,m,e,u]),(0,r.useEffect)(()=>{x&&"notification"===x.type&&"socket"!==u&&(console.log("\uD83D\uDD14 New SSE notification received:",x),h("sse"),p(Date.now()),f(0),a(e=>{let t=e+1;return console.log("� SSE notification received:",{from:e,to:t,data:x,timestamp:new Date().toISOString()}),t}))},[x,u]),(0,r.useEffect)(()=>{let e=()=>{console.log("\uD83D\uDD14 Custom newNotification event received"),a(e=>e+1)};return window.addEventListener("newNotification",e),()=>{window.removeEventListener("newNotification",e)}},[]),(0,r.useEffect)(()=>{let t;if(!e)return;if("socket"===u||"sse"===u)return void console.log("✅ Real-time method active, skipping polling");console.log("⏰ Setting up smart polling for user:",e),console.log("\uD83D\uDCCA Current method:",u,"failures:",g);let a=setInterval(async()=>{if(Date.now()-b<12e4&&"none"!==u)return void console.log("✅ Recent notification received, reducing polling frequency");console.log("⏰ POLLING notification check:",{method:"polling",timestamp:new Date().toISOString(),interval:t}),h("polling");try{await w(),f(0),console.log("✅ Polling successful")}catch(e){f(e=>e+1),console.warn("❌ Polling failed:",e)}},t=g>3?6e4:"none"===u?3e4:15e3);return()=>{clearInterval(a)}},[e,w,u,g,b]),(0,r.useEffect)(()=>{if(!e)return;let t=()=>{let e=Date.now()-b;"none"===u||"polling"===u||e>3e5?(console.log("\uD83D\uDD0D Window focused - refreshing notifications (smart)"),w()):console.log("✅ Window focused but real-time is active, skipping refresh")},a=()=>{document.hidden||(console.log("\uD83D\uDCF1 Mobile app became visible - refreshing notifications"),w())};return window.addEventListener("focus",t),document.addEventListener("visibilitychange",a),()=>{window.removeEventListener("focus",t),document.removeEventListener("visibilitychange",a)}},[e,w,u,b]),(0,r.useEffect)(()=>{e&&w()},[e,w]),(0,r.useEffect)(()=>{e&&(window.debugNotifications=()=>{console.log("\uD83D\uDC1B NOTIFICATION DEBUG INFO:",{userId:e,unreadCount:t,realtimeMethod:u,isSocketConnected:m,consecutiveFailures:g,lastNotificationTime:new Date(b).toISOString(),timeSinceLastNotification:Math.round((Date.now()-b)/1e3)+"s"})})},[e,t,u,m,g,b]),{unreadCount:t,loading:l,error:i,refreshUnreadCount:v,realtimeMethod:u,debugInfo:{lastNotificationTime:b,consecutiveFailures:g,isSocketConnected:m}}}},20057:(e,t,a)=>{a.d(t,{j:()=>x});var r=a(95155),s=a(12115),n=a(51834),l=a(3998),o=a(54690),i=a(95740),d=a(5917),c=a(75426),m=a(18720);function x(e){let{open:t,onOpenChange:a,referralCode:x}=e,[u,h]=(0,s.useState)(!1),b="".concat(window.location.origin,"/invite/").concat(x),p="https://api.qrserver.com/v1/create-qr-code/?size=260x260&margin=10&data=".concat(encodeURIComponent(b)),g=async()=>{try{await navigator.clipboard.writeText(b),h(!0),m.o.success("لینک دعوت با موفقیت کپی شد"),setTimeout(()=>h(!1),2e3)}catch(e){m.o.error("خطا در کپی لینک")}};return(0,r.jsx)(n.lG,{open:t,onOpenChange:a,children:(0,r.jsxs)(n.Cf,{className:"z-[60] max-w-xs sm:max-w-sm bg-slate-950/95 border-amber-500/30 text-white backdrop-blur-2xl rounded-3xl p-6 shadow-2xl shadow-amber-500/10",children:[(0,r.jsxs)(n.c7,{className:"text-center space-y-2",children:[(0,r.jsx)("div",{className:"w-12 h-12 rounded-2xl bg-gradient-to-tr from-amber-500/20 to-purple-500/20 border border-amber-500/40 flex items-center justify-center mx-auto shadow-inner",children:(0,r.jsx)(o.A,{className:"w-6 h-6 text-amber-400"})}),(0,r.jsxs)(n.L3,{className:"text-lg font-bold text-white flex items-center justify-center gap-1.5",children:[(0,r.jsx)("span",{children:"کد تصویری دعوت به کلاب"}),(0,r.jsx)(i.A,{className:"w-4 h-4 text-amber-400"})]}),(0,r.jsx)(n.rr,{className:"text-xs text-slate-400 leading-relaxed",children:"گوشی دوستت را روبه‌روی این کد بگیر تا فوراً به جمع همبازی‌هایت ملحق شود."})]}),(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center my-4",children:[(0,r.jsx)("div",{className:"relative p-3 bg-white rounded-2xl shadow-xl border-4 border-amber-400/30",children:(0,r.jsx)("img",{src:p,alt:"کد QR دعوت برای کد ".concat(x),width:200,height:200,className:"w-48 h-48 rounded-lg",loading:"lazy"})}),(0,r.jsxs)("div",{className:"mt-4 flex items-center gap-2 px-4 py-1.5 bg-slate-900/90 border border-slate-700/60 rounded-full",children:[(0,r.jsx)("span",{className:"text-xs text-slate-400",children:"کد اختصاصی:"}),(0,r.jsx)("span",{className:"text-sm font-mono font-bold tracking-widest text-amber-400",children:x})]})]}),(0,r.jsx)(l.$,{onClick:g,className:"w-full h-11 bg-gradient-to-r from-amber-500 to-orange-500 hover:from-amber-600 hover:to-orange-600 text-slate-950 font-semibold rounded-xl text-sm transition-all duration-300 shadow-md shadow-amber-500/20 flex items-center justify-center gap-2",children:u?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d.A,{className:"w-4 h-4"}),(0,r.jsx)("span",{children:"لینک کپی شد"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.A,{className:"w-4 h-4"}),(0,r.jsx)("span",{children:"کپی آدرس لینک دعوت"})]})})]})})}},27063:(e,t,a)=>{a.d(t,{Fm:()=>m,Qs:()=>u,cj:()=>o,h:()=>c,qp:()=>x});var r=a(95155);a(12115);var s=a(89511),n=a(65229),l=a(64269);function o(e){let{...t}=e;return(0,r.jsx)(s.bL,{"data-slot":"sheet",...t})}function i(e){let{...t}=e;return(0,r.jsx)(s.ZL,{"data-slot":"sheet-portal",...t})}function d(e){let{className:t,...a}=e;return(0,r.jsx)(s.hJ,{"data-slot":"sheet-overlay",className:(0,l.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/60 backdrop-blur-sm",t),...a})}function c(e){let{className:t,children:a,side:o="right",...c}=e;return(0,r.jsxs)(i,{children:[(0,r.jsx)(d,{}),(0,r.jsxs)(s.UC,{"data-slot":"sheet-content",className:(0,l.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500","right"===o&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm","left"===o&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm","top"===o&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b","bottom"===o&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",t),...c,children:[a,(0,r.jsxs)(s.bm,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[(0,r.jsx)(n.A,{className:"size-4"}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function m(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"sheet-header",className:(0,l.cn)("flex flex-col gap-1.5 p-4",t),...a})}function x(e){let{className:t,...a}=e;return(0,r.jsx)(s.hE,{"data-slot":"sheet-title",className:(0,l.cn)("text-foreground font-semibold",t),...a})}function u(e){let{className:t,...a}=e;return(0,r.jsx)(s.VY,{"data-slot":"sheet-description",className:(0,l.cn)("text-muted-foreground text-sm",t),...a})}},85898:(e,t,a)=>{a.d(t,{r:()=>h});var r=a(95155),s=a(12115),n=a(36489),l=a(20063),o=a(13492),i=a(85998),d=a(64269),c=a(19881),m=a(56645),x=a(27063),u=a(66091);function h(e){var t,a;let{className:h,iconClassName:b}=e,{data:p}=(0,n.useSession)(),g=(0,l.useRouter)(),f=(0,l.usePathname)(),[w,v]=(0,s.useState)(!1),j=null==p||null==(t=p.user)?void 0:t.id,{unreadCount:N,refreshUnreadCount:y}=(0,c.E)(j);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{type:"button",onClick:()=>{if(!(null==p?void 0:p.user)){let e="".concat((0,u.kk)(),"?callbackUrl=").concat(encodeURIComponent(f||"/"));g.push(e);return}v(!0)},className:(0,d.cn)("relative w-10 h-10 rounded-2xl bg-white/90 backdrop-blur-md border border-purple-100 text-gray-700 hover:text-purple-700 hover:border-purple-300 flex items-center justify-center shadow-sm hover:shadow-md transition-all active:scale-95",h),title:"اعلان‌ها","aria-label":"اعلان‌ها",children:[N>0?(0,r.jsx)(o.A,{className:(0,d.cn)("w-5 h-5 text-purple-600 animate-pulse",b)}):(0,r.jsx)(i.A,{className:(0,d.cn)("w-5 h-5 text-gray-700 transition-colors",b)}),N>0&&(0,r.jsx)("span",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] px-1 bg-red-500 text-white text-[10px] font-black rounded-full flex items-center justify-center shadow-md animate-bounce",children:N>99?"+۹۹":(e=>{let t=["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"];return e.toString().replace(/\d/g,e=>t[parseInt(e,10)])})(N)})]}),(null==p||null==(a=p.user)?void 0:a.id)&&(0,r.jsx)(x.cj,{open:w,onOpenChange:v,children:(0,r.jsxs)(x.h,{side:"bottom",className:"dir-rtl font-vazir font-farsi rounded-t-[32px] border-t border-purple-100 p-4 sm:p-6 shadow-2xl bg-white/95 backdrop-blur-xl max-w-lg mx-auto no-scrollbar max-h-[88vh] overflow-y-auto [&::-webkit-scrollbar]:hidden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=open]:slide-in-from-bottom-full data-[state=closed]:slide-out-to-bottom-full data-[state=open]:duration-500 data-[state=closed]:duration-300 transition-all ease-out",children:[(0,r.jsx)("div",{className:"w-12 h-1.5 bg-gray-200 rounded-full mx-auto -mt-2 mb-3"}),(0,r.jsxs)(x.Fm,{className:"sr-only",children:[(0,r.jsx)(x.qp,{children:"مرکز اعلان‌ها"}),(0,r.jsx)(x.Qs,{children:"مشاهده و مدیریت اعلان‌های دریافتی"})]}),(0,r.jsx)("div",{className:"w-full",children:(0,r.jsx)(m.NotificationPanel,{userId:p.user.id,showCloseButton:!0,onClose:()=>v(!1),onNotificationRead:()=>{y()},className:"border-0 shadow-none p-0 bg-transparent"})})]})})]})}}}]);