(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8634],{12112:(e,s,a)=>{"use strict";a.d(s,{nO:()=>o,LI:()=>j,Qv:()=>f,CE:()=>h,lV:()=>c,gE:()=>d,Cg:()=>u,p8:()=>x,kt:()=>t.LoadingSpinner,YY:()=>m,x_:()=>v,r5:()=>g}),a(44254);var t=a(56210),r=a(95155),l=a(12115),n=a(3998),i=a(64269);let c=(0,l.forwardRef)((e,s)=>{let{loading:a=!1,loadingText:l,spinnerSize:c="sm",disabledOnLoading:d=!0,loadingIcon:o,children:x,disabled:m,className:h,...u}=e,p=m||d&&a;return(0,r.jsxs)(n.$,{ref:s,disabled:p,className:(0,i.cn)("relative",a&&"cursor-not-allowed",h),...u,children:[(0,r.jsx)("div",{className:(0,i.cn)("flex items-center justify-center gap-2",a&&"opacity-0"),children:x}),a&&(0,r.jsxs)("div",{className:"absolute inset-0 flex items-center justify-center gap-2",children:[o||(0,r.jsx)(t.LoadingSpinner,{size:c}),l&&(0,r.jsx)("span",{className:"text-sm font-medium",children:l})]})]})});function d(e){let{loading:s=!1,loadingButtonIndex:a,children:t,className:n,...d}=e;return(0,r.jsx)("div",{className:(0,i.cn)("flex gap-2",n),...d,children:l.Children.map(t,(e,t)=>l.isValidElement(e)&&e.type===c?l.cloneElement(e,{loading:s&&(void 0===a||a===t)}):e)})}function o(e){let{onAsyncClick:s,successText:a,errorText:t,children:n,...i}=e,[d,o]=l.useState("idle"),x=async()=>{if("loading"!==d){o("loading");try{await s(),o("success"),a?setTimeout(()=>o("idle"),2e3):o("idle")}catch(e){console.error("Async operation failed:",e),o("error"),t?setTimeout(()=>o("idle"),3e3):o("idle")}}};return(0,r.jsx)(c,{...i,loading:"loading"===d,loadingText:(()=>{switch(d){case"loading":return i.loadingText||"در حال پردازش...";case"success":return a||"انجام شد";case"error":return t||"خطا رخ داد";default:return}})(),onClick:x,variant:"success"===d?"default":"error"===d?"destructive":i.variant,children:"success"===d&&a?a:"error"===d&&t?t:n})}function x(e){let{show:s=!1,blur:a=!1,backgroundColor:l="rgba(0, 0, 0, 0.5)",closable:n=!1,children:c,size:d="md",className:o,message:x,...m}=e;return s?(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("div",{className:(0,i.cn)("transition-all duration-200",a&&"filter blur-sm"),children:c}),(0,r.jsx)("div",{className:(0,i.cn)("absolute inset-0 flex items-center justify-center z-50","bg-black/50 backdrop-blur-sm",n&&"cursor-pointer",o),style:{backgroundColor:l},onClick:n?()=>{}:void 0,...m,children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-4 p-6 bg-white rounded-lg shadow-lg",children:[(0,r.jsx)(t.LoadingSpinner,{size:d}),x&&(0,r.jsx)("p",{className:"text-sm text-gray-600 text-center",children:x})]})})]}):(0,r.jsx)(r.Fragment,{children:c})}function m(e){let{show:s=!1,message:a="در حال بارگذاری...",size:l="lg",className:n,...c}=e;return s?(0,r.jsx)("div",{className:(0,i.cn)("fixed inset-0 flex items-center justify-center z-50","bg-white",n),...c,children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-6",children:[(0,r.jsx)(t.LoadingSpinner,{size:l}),a&&(0,r.jsx)("p",{className:"text-lg text-gray-600 text-center",children:a})]})}):null}function h(e){let{show:s=!1,message:a,size:l="sm",className:n,children:c,...d}=e;return(0,r.jsxs)("div",{className:"relative",children:[c,s&&(0,r.jsx)("div",{className:(0,i.cn)("absolute inset-0 flex items-center justify-center","bg-white/80 backdrop-blur-sm rounded",n),...d,children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,r.jsx)(t.LoadingSpinner,{size:l}),a&&(0,r.jsx)("p",{className:"text-xs text-gray-600 text-center",children:a})]})})]})}function u(e){let{show:s=!1,title:a="در حال پردازش",message:l="لطفاً صبر کنید...",size:n="md",className:c,...d}=e;return s?(0,r.jsx)("div",{className:(0,i.cn)("fixed inset-0 flex items-center justify-center z-50","bg-black/50 backdrop-blur-sm"),children:(0,r.jsxs)("div",{className:(0,i.cn)("bg-white rounded-lg shadow-xl p-6 max-w-sm mx-4","flex flex-col items-center gap-4",c),...d,children:[(0,r.jsx)(t.LoadingSpinner,{size:n}),(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:a}),(0,r.jsx)("p",{className:"text-sm text-gray-600",children:l})]})]})}):null}function p(e){let{lines:s=1,lineHeight:a=16,widths:t=[],gap:l=8,size:n="md",className:c,show:d=!0,...o}=e;return d?1===s?(0,r.jsx)("div",{className:(0,i.cn)("animate-pulse bg-gray-200 rounded",function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"md",s={xs:"h-2",sm:"h-3",md:"h-4",lg:"h-6",xl:"h-8"};return s[e]||s.md}(n),c),...o}):(0,r.jsx)("div",{className:(0,i.cn)("flex flex-col gap-2",c),...o,children:Array.from({length:s},(e,l)=>{let n=t[l]||(l===s-1?60:100);return(0,r.jsx)("div",{className:"animate-pulse bg-gray-200 rounded",style:{height:a,width:"".concat(n,"%")}},l)})}):null}function g(e){let{lines:s=3,className:a,...t}=e;return(0,r.jsx)(p,{lines:s,className:(0,i.cn)("space-y-2",a),...t})}function f(e){let{className:s,show:a=!0,...t}=e;return a?(0,r.jsx)("div",{className:(0,i.cn)("animate-pulse bg-gray-200 rounded-lg p-4","border border-gray-100",s),...t,children:(0,r.jsxs)("div",{className:"flex items-center space-x-4 rtl:space-x-reverse",children:[(0,r.jsx)("div",{className:"w-12 h-12 bg-gray-300 rounded-full"}),(0,r.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,r.jsx)("div",{className:"h-4 bg-gray-300 rounded w-3/4"}),(0,r.jsx)("div",{className:"h-3 bg-gray-300 rounded w-1/2"})]})]})}):null}function j(e){let{size:s="md",className:a,show:t=!0,...l}=e;return t?(0,r.jsx)("div",{className:(0,i.cn)("animate-pulse bg-gray-200 rounded-full",{sm:"w-8 h-8",md:"w-12 h-12",lg:"w-16 h-16",xl:"w-24 h-24"}[s],a),...l}):null}function v(e){let{rows:s=5,columns:a=4,className:t,show:l=!0,...n}=e;return l?(0,r.jsxs)("div",{className:(0,i.cn)("animate-pulse",t),...n,children:[(0,r.jsx)("div",{className:"flex space-x-4 rtl:space-x-reverse mb-4",children:Array.from({length:a},(e,s)=>(0,r.jsx)("div",{className:"h-4 bg-gray-200 rounded flex-1"},"header-".concat(s)))}),Array.from({length:s},(e,s)=>(0,r.jsx)("div",{className:"flex space-x-4 rtl:space-x-reverse mb-3",children:Array.from({length:a},(e,t)=>(0,r.jsx)("div",{className:"h-3 bg-gray-200 rounded flex-1",style:{width:t===a-1?"60%":"100%"}},"cell-".concat(s,"-").concat(t)))},"row-".concat(s)))]}):null}c.displayName="LoadingButton"},27790:(e,s,a)=>{Promise.resolve().then(a.bind(a,42563))},42563:(e,s,a)=>{"use strict";a.r(s),a.d(s,{default:()=>em});var t=a(95155),r=a(3998),l=a(86948),n=a(65142),i=a(11647),c=a(10774),d=a(12115),o=a(85897),x=a(51834),m=a(56154),h=a(39347),u=a(95740),p=a(95322),g=a(68854),f=a(59865),j=a(91169),v=a(83457),b=a(16645),N=a(56210),y=a(18720),w=a(12112),E=a(20508),A=a(6613),k=a(2317),C=a(5937);function L(e){var s,a;let{isOpen:n,onClose:c,userId:m}=e,[u,p]=(0,d.useState)(null),[g,f]=(0,d.useState)(!1),j=(0,d.useCallback)(async()=>{if(m)try{f(!0);let e=await fetch("/api/user/profile/".concat(m)),s=await e.json();s.success?p(s.data):(y.o.error(s.error||"خطا در دریافت اطلاعات پروفایل"),c())}catch(e){console.error("خطا در دریافت پروفایل:",e),y.o.error("خطا در دریافت اطلاعات"),c()}finally{f(!1)}},[m,c]);return((0,d.useEffect)(()=>{n&&m&&j()},[n,m,j]),g)?(0,t.jsx)(x.lG,{open:n,onOpenChange:c,children:(0,t.jsxs)(x.Cf,{className:"sm:max-w-lg",dir:"rtl",children:[(0,t.jsx)(x.c7,{children:(0,t.jsx)(x.L3,{className:"text-right",children:"پروفایل کاربر"})}),(0,t.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,t.jsx)(w.kt,{size:"lg"})})]})}):u?(0,t.jsx)(x.lG,{open:n,onOpenChange:c,children:(0,t.jsxs)(x.Cf,{className:"sm:max-w-2xl max-h-[90vh] overflow-y-auto",dir:"rtl",children:[(0,t.jsx)(x.c7,{children:(0,t.jsx)(x.L3,{className:"text-right",children:"پروفایل کاربر"})}),(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"flex items-start gap-6 p-6 bg-gradient-to-r from-blue-50 to-purple-50 rounded-lg",children:[(0,t.jsxs)(o.eu,{className:"w-24 h-24",children:[(0,t.jsx)(o.BK,{src:u.avatar?"https://asset.playmo.ir/public".concat(u.avatar):"",alt:u.name||""}),(0,t.jsx)(o.q5,{className:"text-2xl",children:(null==(s=u.name)?void 0:s.slice(0,2).toUpperCase())||"U"})]}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,t.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:u.name}),(0,t.jsx)(i.E,{className:(e=>{switch(e){case"BEGINNER":return"bg-green-100 text-green-800";case"INTERMEDIATE":return"bg-blue-100 text-blue-800";case"ADVANCED":return"bg-purple-100 text-purple-800";case"EXPERT":return"bg-orange-100 text-orange-800";case"MASTER":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}})(u.currentLevel),children:u.currentLevel})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm text-gray-600",children:[u.age&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(E.A,{className:"w-4 h-4"}),(0,t.jsxs)("span",{children:[u.age," ساله"]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(A.A,{className:"w-4 h-4"}),(0,t.jsxs)("span",{children:[u.totalPoints.toLocaleString("fa")," امتیاز"]})]}),u.ranking&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(h.A,{className:"w-4 h-4"}),(0,t.jsxs)("span",{children:["رنک ",u.ranking.position.toLocaleString("fa")]})]})]})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsxs)(r.$,{variant:"default",className:"gap-2",children:[(0,t.jsx)(k.A,{className:"w-4 h-4"}),"دعوت به بازی"]}),(0,t.jsxs)(r.$,{variant:"outline",className:"gap-2",children:[(0,t.jsx)(C.A,{className:"w-4 h-4"}),"پیام"]})]})]}),(0,t.jsxs)(l.Zp,{children:[(0,t.jsx)(l.aR,{children:(0,t.jsxs)(l.ZB,{className:"flex items-center gap-2",children:[(0,t.jsx)(k.A,{className:"w-5 h-5"}),"بازی‌های مورد علاقه"]})}),(0,t.jsx)(l.Wu,{children:u.gamePreferences&&u.gamePreferences.length>0?(0,t.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:u.gamePreferences.map((e,s)=>(0,t.jsxs)("div",{className:"p-3 bg-gray-50 rounded-lg",children:[(0,t.jsx)("h4",{className:"font-semibold text-gray-900",children:e.gameTitle}),(0,t.jsxs)("div",{className:"flex gap-2 mt-1",children:[(0,t.jsx)(i.E,{variant:"secondary",children:e.category}),(0,t.jsx)(i.E,{variant:"outline",children:e.skillLevel})]})]},s))}):(0,t.jsx)("p",{className:"text-gray-500 text-center py-8",children:"علایق گیمینگ ثبت نشده"})})]}),(0,t.jsxs)(l.Zp,{children:[(0,t.jsx)(l.aR,{children:(0,t.jsxs)(l.ZB,{className:"flex items-center gap-2",children:[(0,t.jsx)(A.A,{className:"w-5 h-5"}),"آمار بازیکن"]})}),(0,t.jsx)(l.Wu,{children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"text-center p-4 bg-blue-50 rounded-lg",children:[(0,t.jsx)("div",{className:"text-2xl font-bold text-blue-600",children:u.totalPoints.toLocaleString("fa")}),(0,t.jsx)("div",{className:"text-sm text-gray-600",children:"کل امتیازات"})]}),(0,t.jsxs)("div",{className:"text-center p-4 bg-green-50 rounded-lg",children:[(0,t.jsx)("div",{className:"text-2xl font-bold text-green-600",children:null==(a=u.ranking)?void 0:a.position.toLocaleString("fa")}),(0,t.jsx)("div",{className:"text-sm text-gray-600",children:"رنک کلی"})]})]})})]})]})]})}):null}var z=a(36489),S=a(52619),P=a.n(S),T=a(96093),R=a(6490);function I(e){var s,a;let{participant:r}=e,[l,n]=(0,d.useState)(!1),[i,c]=(0,d.useState)(!1),x=!r.avatar&&!!r.archetype,m=x?(0,R.Al)(r.archetype):null,h=(0,T.g0)(r.avatar,r.archetype);return(0,t.jsx)(o.eu,{className:"w-16 h-16 sm:w-20 sm:h-20 relative overflow-hidden transition-transform duration-300 group-hover:scale-105",children:h&&!l?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("img",{src:h,alt:r.name||"",className:"w-full h-full object-cover rounded-full ".concat(i?"opacity-100":"opacity-0"),onLoad:()=>c(!0),onError:()=>n(!0)}),!i&&(0,t.jsx)(o.q5,{className:"text-xl font-bold bg-gray-50 text-gray-400 absolute inset-0",children:(null==(s=r.name)?void 0:s.slice(0,1).toUpperCase())||"U"}),x&&m&&i&&(0,t.jsx)("div",{className:"absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/85 via-black/50 to-transparent pt-3 pb-1 z-10 pointer-events-none",children:(0,t.jsx)("span",{className:"text-[8px] sm:text-[9px] font-bold text-white truncate max-w-[85%] mx-auto block drop-shadow text-center leading-none",children:m})})]}):(0,t.jsx)(o.q5,{className:"text-xl font-bold bg-gray-50 text-gray-400",children:(null==(a=r.name)?void 0:a.slice(0,1).toUpperCase())||"U"})})}function D(e){let{isOpen:s,onClose:a,eventId:l,eventTitle:n}=e,{data:i,status:c}=(0,z.useSession)(),[o,w]=(0,d.useState)(null),[E,A]=(0,d.useState)(!1),[k,C]=(0,d.useState)({open:!1,userId:""});(0,d.useEffect)(()=>{s&&l&&"authenticated"===c&&S()},[s,l,c]);let S=async()=>{try{A(!0);let e=await fetch("/api/events/".concat(l,"/participants"));if(401===e.status)return;let s=await e.json();s.success?w(s.data):y.o.error(s.error||"خطا در دریافت اطلاعات شرکت‌کنندگان")}catch(e){console.error("خطا در دریافت شرکت‌کنندگان:",e),y.o.error("خطا در دریافت اطلاعات")}finally{A(!1)}};return E||"loading"===c?(0,t.jsx)(x.lG,{open:s,onOpenChange:a,children:(0,t.jsxs)(x.Cf,{className:"sm:max-w-md rounded-3xl",dir:"rtl",showCloseButton:!1,children:[(0,t.jsx)(x.c7,{children:(0,t.jsx)(x.L3,{className:"text-right mr-4",children:"شرکت‌کنندگان"})}),(0,t.jsx)("div",{className:"flex items-center justify-center p-12",children:(0,t.jsx)(N.LoadingSpinner,{size:"lg"})})]})}):"unauthenticated"===c?(0,t.jsx)(x.lG,{open:s,onOpenChange:a,children:(0,t.jsx)(x.Cf,{className:"sm:max-w-md rounded-3xl p-8",dir:"rtl",showCloseButton:!1,children:(0,t.jsxs)("div",{className:"text-center space-y-6",children:[(0,t.jsx)("div",{className:"w-20 h-20 bg-blue-50 rounded-full flex items-center justify-center mx-auto",children:(0,t.jsx)(f.A,{className:"w-10 h-10 text-blue-500"})}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h3",{className:"text-xl font-bold text-gray-800",children:"مشاهده شرکت‌کنندگان"}),(0,t.jsx)("p",{className:"text-gray-500 text-sm leading-relaxed",children:"برای مشاهده لیست شرکت‌کنندگان در این رویداد، لطفاً وارد حساب کاربری خود شوید یا ثبت‌نام کنید."})]}),(0,t.jsxs)("div",{className:"grid gap-3",children:[(0,t.jsx)(P(),{href:"/auth/customer/signin",className:"w-full",children:(0,t.jsx)(r.$,{className:"w-full h-11 text-base font-medium bg-playmo-purple-600 hover:bg-playmo-purple-700",children:"ورود به حساب کاربری"})}),(0,t.jsx)(P(),{href:"/auth/customer/signup",className:"w-full",children:(0,t.jsx)(r.$,{variant:"outline",className:"w-full h-11 text-base font-medium border-gray-300 text-gray-700 hover:bg-gray-50",children:"ثبت‌نام در پلیمو"})})]})]})})}):o?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.lG,{open:s,onOpenChange:a,children:(0,t.jsxs)(x.Cf,{className:"sm:max-w-lg max-h-[85vh] overflow-y-auto rounded-[2rem] p-0 !border-0 !ring-0 !outline-none shadow-2xl bg-white/95 backdrop-blur-xl",dir:"rtl",showCloseButton:!1,children:[(0,t.jsxs)("div",{className:"sticky top-0 z-10 bg-white/80 backdrop-blur-md border-b border-gray-100 flex items-center justify-between p-4 px-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-gray-800",children:[(0,t.jsx)(j.A,{className:"w-5 h-5 text-playmo-purple-600"}),(0,t.jsxs)("span",{className:"font-bold text-lg",children:[o.total," شرکت‌کننده"]})]}),(0,t.jsx)(x.L3,{className:"hidden",children:"لیست شرکت‌کنندگان"})," ",(0,t.jsx)("div",{className:"w-8 h-1 bg-gray-200 rounded-full sm:hidden absolute top-2 left-1/2 transform -translate-x-1/2"})]}),(0,t.jsx)("div",{className:"p-6",children:(0,t.jsx)("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-y-8 gap-x-4",children:o.allParticipants.length>0?o.allParticipants.map(e=>{var s;return(0,t.jsxs)("div",{className:"flex flex-col items-center group cursor-pointer",onClick:()=>!e.isExternal&&void C({open:!0,userId:e.id}),children:[(0,t.jsxs)("div",{className:"relative mb-2",children:[(0,t.jsx)("div",{className:"p-1 rounded-full border-2 ".concat(e.isFriend?"border-red-400":"border-playmo-purple-100 group-hover:border-playmo-purple-300"," transition-colors duration-300"),children:(0,t.jsx)(I,{participant:e})}),e.isFriend&&(0,t.jsx)("div",{className:"absolute -bottom-1 -right-1 bg-red-500 rounded-full p-1 border-2 border-white shadow-sm z-10",children:(0,t.jsx)(v.A,{className:"w-3 h-3 text-white fill-current"})}),!e.isFriend&&e.isTeammate&&(0,t.jsx)("div",{className:"absolute -bottom-1 -right-1 bg-blue-500 rounded-full p-1 border-2 border-white shadow-sm z-10",children:(0,t.jsx)(b.A,{className:"w-3 h-3 text-white hover:rotate-12 transition-transform"})}),!e.isExternal&&(0,t.jsx)("div",{className:"absolute -bottom-1 -left-1 ".concat((e=>{switch(e){case"MASTER":return"bg-red-500";case"EXPERT":return"bg-orange-500";case"ADVANCED":return"bg-purple-500";case"INTERMEDIATE":return"bg-blue-500";default:return"bg-green-500"}})(e.currentLevel)," rounded-full w-6 h-6 flex items-center justify-center border-2 border-white shadow-sm z-10 text-xs text-white"),children:(0,t.jsx)("div",{className:"w-3.5 h-3.5 flex items-center justify-center",children:(e=>{switch(e){case"⚡":return(0,t.jsx)(m.A,{className:"w-full h-full stroke-[1.5]"});case"⭐":return(0,t.jsx)(h.A,{className:"w-full h-full stroke-[1.5]"});case"\uD83D\uDCAB":return(0,t.jsx)(u.A,{className:"w-full h-full stroke-[1.5]"});case"\uD83D\uDC8E":return(0,t.jsx)(p.A,{className:"w-full h-full stroke-[1.5]"});case"\uD83D\uDC51":return(0,t.jsx)(g.A,{className:"w-full h-full stroke-[1.5]"});default:return(0,t.jsx)("span",{className:"text-sm",children:e||"\uD83C\uDF31"})}})(e.currentLevelIcon)})}),e.isExternal&&(0,t.jsx)("div",{className:"absolute -bottom-1 -left-1 bg-orange-400 rounded-full px-1.5 py-0.5 border-2 border-white shadow-sm z-10",children:(0,t.jsx)("span",{className:"text-[9px] font-bold text-white",children:"خارجی"})})]}),(0,t.jsx)("div",{className:"text-center w-full",children:(0,t.jsxs)("h4",{className:"font-medium text-sm text-gray-800 truncate w-full px-1 py-0.5 rounded-lg group-hover:bg-gray-50 transition-colors",children:[null==(s=e.name)?void 0:s.split(" ")[0]," "]})})]},e.id)}):(0,t.jsxs)("div",{className:"col-span-full text-center py-16 text-gray-400",children:[(0,t.jsx)("div",{className:"w-20 h-20 bg-gray-50 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,t.jsx)(j.A,{className:"w-10 h-10 text-gray-300"})}),(0,t.jsx)("p",{className:"text-gray-500 font-medium",children:"هنوز کسی ثبت نام نکرده"})]})})})]})}),(0,t.jsx)(L,{isOpen:k.open,onClose:()=>{C({open:!1,userId:""})},userId:k.userId})]}):null}var O=a(6132),$=a(52056),F=a(89559),_=a(65993),B=a(20063);function U(){return{handleError:d.useCallback((e,s)=>{console.error("Error in ".concat(s||"component",":"),e),y.o.error("خطایی رخ داد",{description:e.message||"خطای غیرمنتظره‌ای رخ داده است"})},[])}}function M(e){var s;let{participant:a}=e,[r,l]=(0,d.useState)(!1),n=(0,T.g0)(a.avatar,a.archetype);return(0,t.jsx)(o.eu,{className:"w-7 h-7",children:n&&!r?(0,t.jsx)("img",{src:n,alt:a.name||"کاربر",className:"w-full h-full object-cover rounded-full",onError:()=>l(!0)}):(0,t.jsx)(o.q5,{className:"text-[9px]",children:(null==(s=a.name)?void 0:s.slice(0,2).toUpperCase())||"U"})})}function V(e){let{eventId:s,eventTitle:a,maxPlayers:l,registeredPlayers:n}=e,[c,o]=(0,d.useState)(null),[x,m]=(0,d.useState)(!1),[h,u]=(0,d.useState)(null),[p,g]=(0,d.useState)(!1),{handleError:f}=U(),{handleAsyncError:b}=function(){let{handleError:e}=U();return{handleAsyncError:d.useCallback(async(s,a)=>{try{return await s()}catch(s){return e(s instanceof Error?s:Error(String(s)),a),null}},[e])}}(),N=(0,d.useCallback)(async()=>{let e=await b(async()=>{m(!0),u(null);let e=await fetch("/api/events/".concat(s,"/participants"));if(!e.ok)throw Error("HTTP ".concat(e.status,": ").concat(e.statusText));let a=await e.json();if(!a.success){var t;throw Error((null==(t=a.error)?void 0:t.message)||"خطا در دریافت اطلاعات شرکت‌کنندگان")}return a.data},"EventParticipants.fetchParticipants");e?o(e):u("خطا در بارگیری شرکت‌کنندگان"),m(!1)},[s,b]),y=(0,d.useCallback)(()=>{N()},[N]);if((0,d.useEffect)(()=>{N()},[N]),x)return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("div",{className:"animate-pulse flex gap-1",children:[(0,t.jsx)("div",{className:"w-6 h-6 bg-gray-200 rounded-full"}),(0,t.jsx)("div",{className:"w-6 h-6 bg-gray-200 rounded-full"}),(0,t.jsx)("div",{className:"w-6 h-6 bg-gray-200 rounded-full"})]}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:"در حال بارگذاری..."})]});if(h)return(0,t.jsxs)("div",{className:"flex items-center gap-2 text-red-500",children:[(0,t.jsx)(O.A,{size:16}),(0,t.jsx)("span",{className:"text-sm",children:h}),(0,t.jsx)(r.$,{variant:"ghost",size:"sm",onClick:y,className:"text-xs",children:"تلاش مجدد"})]});if(!c||0===c.total)return"number"==typeof n&&n>0?(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,t.jsx)(j.A,{className:"w-4 h-4 text-gray-500"}),(0,t.jsxs)("span",{className:"text-gray-700",children:[n,"/",l]})]}):(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,t.jsx)(j.A,{className:"w-4 h-4"}),(0,t.jsxs)("span",{children:["0/",l]})]});let w=Math.min(c.participants.length,3);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex items-center cursor-pointer hover:scale-105 transition-transform",onClick:()=>{g(!0)},children:c.participants.slice(0,w).map((e,s)=>e&&e.id?(0,t.jsx)("div",{className:"relative rounded-full border-2 ".concat((e=>{switch(e){case"MASTER":return"border-red-500";case"EXPERT":return"border-orange-500";case"ADVANCED":return"border-purple-500";case"INTERMEDIATE":return"border-blue-500";default:return"border-green-500"}})(e.currentLevel)," bg-white p-[1px]"),style:{marginRight:s>0?"-12px":"0",zIndex:3-s},children:(0,t.jsx)(M,{participant:e})},e.id):null).filter(Boolean)}),(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,t.jsx)(j.A,{className:"w-4 h-4 text-gray-500"}),(0,t.jsxs)("span",{className:"text-gray-700",children:[null!=n?n:c.total,"/",l]}),c.friendsCount>0&&(0,t.jsxs)(i.E,{variant:"secondary",className:"gap-1 px-2 py-0.5 text-xs",children:[(0,t.jsx)(v.A,{className:"w-3 h-3"}),c.friendsCount," دوست"]})]})]}),(0,t.jsx)(D,{isOpen:p,onClose:()=>{g(!1)},eventId:s,eventTitle:a})]})}d.Component;var Y=a(6191),Z=a(86651),G=a(30940),W=a(94610),q=a(16485),H=a(26983),K=a(21873),X=a(52987),Q=a(15239),J=a(51950),ee=a(58779),es=a(86600),ea=a(66091),et=a(16536);let er=e=>{let{event:s}=e,[a,r]=d.useState(!1),n=function(e){return e.mainImage?(0,T.zL)([e.mainImage])[0]:e.images&&e.images.length>0?(0,T.zL)(e.images)[0]:e.genre?(0,T.eI)(e.genre):null}(s),c=!!(n&&!a),o="PLAYER_TABLE"===s.type||"PLAYER_TABLE"===s.eventType,x=s.registeredPlayers>=s.maxPlayers;return(0,t.jsx)(P(),{href:"/events/".concat(s.id),children:(0,t.jsxs)(l.Zp,{className:"relative aspect-[4/3] w-full overflow-hidden rounded-3xl border-0 shadow-md group cursor-pointer transition-[transform,box-shadow] duration-200 ease-out transform-gpu will-change-[transform,box-shadow] md:hover:-translate-y-1 md:hover:shadow-xl",children:[(0,t.jsx)("div",{className:"absolute inset-0 z-0 bg-gray-950",children:c?(0,t.jsx)(Q.default,{src:n,alt:s.title,fill:!0,sizes:"(max-width: 768px) 50vw, (max-width: 1200px) 33vw, 25vw",className:"object-cover w-full h-full transition-transform duration-300 ease-out transform-gpu md:group-hover:scale-105",unoptimized:!(0,T.Vd)(n),onError:()=>r(!0)}):(0,t.jsx)("div",{className:"w-full h-full bg-[#ffa515] flex items-center justify-center p-6",children:(0,t.jsx)("div",{className:"relative w-1/2",style:{aspectRatio:"169.26/53.85"},children:(0,t.jsx)(Q.default,{src:"/logo-full.svg",alt:"Playmo",fill:!0,className:"object-contain transition-transform duration-300 ease-out transform-gpu md:group-hover:scale-105",priority:!0})})})}),(0,t.jsx)("div",{className:"absolute inset-0 z-10 bg-gradient-to-t from-black/90 via-black/35 to-black/10 group-hover:from-black/95 group-hover:via-black/45 transition-colors duration-300"}),(0,t.jsxs)("div",{className:"absolute top-2.5 right-2.5 left-2.5 z-20 flex justify-between items-start pointer-events-none",children:[(0,t.jsx)(i.E,{className:"h-6 rounded-lg border-0 backdrop-blur-md text-white text-[10px] sm:text-[11px] font-semibold flex items-center gap-1 px-2 ".concat(o?"bg-playmo-purple-600/90":"bg-playmo-blue-600/90"),children:(0,t.jsx)("span",{children:o?"\uD83D\uDC51 پلی‌مستر":"☕ کافه"})}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 items-end",children:[s.isRegistered&&(0,t.jsx)(i.E,{className:"h-5 rounded-lg bg-green-500/90 border-0 text-white text-[9px] sm:text-[10px] px-1.5 animate-pulse",children:"ثبت نام شده"}),x&&(0,t.jsx)(i.E,{className:"h-5 rounded-lg bg-red-500/90 border-0 text-white text-[9px] sm:text-[10px] px-1.5",children:"تکمیل ظرفیت"})]})]}),(0,t.jsxs)("div",{className:"absolute bottom-0 left-0 right-0 p-3 sm:p-4 z-20 text-right flex flex-col gap-1",children:[(0,t.jsx)("div",{className:"text-white/90 text-[10px] sm:text-[11px] font-medium leading-none drop-shadow-sm mb-0.5",children:s.game}),(0,t.jsx)("h3",{className:"text-sm sm:text-base font-bold text-white leading-tight line-clamp-1 drop-shadow-sm",children:s.title}),(0,t.jsxs)("div",{className:"flex items-center justify-between text-[10px] sm:text-[11px] text-white/80",children:[(0,t.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,t.jsx)(q.A,{className:"h-3 w-3 text-white/60 ml-0.5 inline"}),(0,t.jsx)("span",{children:(0,ee.Or)(s.date)})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(j.A,{className:"h-3 w-3 text-white/60 ml-0.5 inline"}),(0,t.jsxs)("span",{children:[s.registeredPlayers,"/",s.maxPlayers]})]})]})]})]})})};var el=a(85898),en=a(25913),ei=a(27022),ec=a(94897),ed=a(73618),eo=a(77733),ex=a(41751);function em(){var e,s,a,o,x;let[m,u]=(0,d.useState)(""),[p,g]=(0,d.useState)("همه"),[f,v]=(0,d.useState)("grid"),[b,N]=(0,d.useState)(!1),[y,w]=(0,d.useState)(!1),[E,A]=(0,d.useState)(!1),[k,C]=(0,d.useState)(!1),{data:L,update:S}=(0,z.useSession)(),R=(0,B.useRouter)(),{data:I,mutate:D}=(0,es.C)((null==L?void 0:L.user)?"/api/user/gamification-progress":null),O=null==I?void 0:I.data,$=(null!=(x=null==O?void 0:O.level)?x:0)>=1,F=(0,ex.x)(null==O?void 0:O.username,null==L||null==(e=L.user)?void 0:e.username),_=()=>(null==L?void 0:L.user)?L.user.archetype?F?void N(!0):void C(!0):void w(!0):void R.push((0,ea.kk)()+"?callbackUrl=/events"),U=()=>{if(!(null==L?void 0:L.user))return void R.push((0,ea.kk)()+"?callbackUrl=/events");$?_():A(!0)},M=async e=>{S&&await S(e?{archetype:e}:void 0),w(!1),setTimeout(()=>{F?N(!0):C(!0)},150)},em=async e=>{try{S&&e&&await S({username:e}),D&&await D()}catch(e){console.error("Failed to sync session and cache after username registration",e)}setTimeout(()=>{N(!0)},150)},{data:eh,isLoading:eu,error:ep,mutate:eg}=(0,es.C)("/api/events"),ef=(null==eh||null==(s=eh.data)?void 0:s.events)||[];(0,d.useEffect)(()=>{let e=()=>{eg()};return window.addEventListener("event-updated",e),()=>window.removeEventListener("event-updated",e)},[eg]);let ej=d.useCallback(e=>{var s;return null==(s=e.cafe)?void 0:s.city},[]),{selectedCity:ev,setSelectedCity:eb,smartCities:eN,matchesCity:ey}=(0,en.W)(ef,ej,null==L||null==(a=L.user)?void 0:a.city),ew=d.useMemo(()=>ef.filter(e=>{var s;let a=e.title.toLowerCase().includes(m.toLowerCase())||e.game.toLowerCase().includes(m.toLowerCase()),t="PLAYER_TABLE"===e.type||"PLAYER_TABLE"===e.eventType,r="همه"===p||"کافه"===p&&!t||"پلی‌مستر"===p&&t;return a&&r&&ey(null==(s=e.cafe)?void 0:s.city)}),[ef,m,p,ey]);return(0,t.jsxs)("div",{className:"min-h-screen bg-gradient-to-br from-playmo-blue-50 via-white to-playmo-purple-50",children:[(0,t.jsxs)("div",{className:"fixed top-0 left-0 right-0 z-50 bg-white/50 backdrop-blur-xl shadow-sm border-b border-gray-200/60",children:[(0,t.jsx)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:(0,t.jsxs)("div",{className:"flex items-center justify-between h-16",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-4 space-x-reverse",children:[(0,t.jsx)(c.U,{}),(0,t.jsx)("div",{className:"h-6 w-px bg-gray-300 hidden sm:block"}),(0,t.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,t.jsx)("h1",{className:"text-xl sm:text-2xl font-bold text-gray-900",children:"رویدادها"}),(0,t.jsxs)(i.E,{variant:"secondary",className:"hidden sm:inline-flex bg-playmo-purple-100 text-playmo-purple-700 text-xs font-semibold px-2 py-0.5 rounded-full",children:[(0,J.ub)(ew.length)," رویداد"]})]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2 sm:space-x-3 space-x-reverse",children:[(0,t.jsxs)("div",{className:"hidden md:flex items-center space-x-4 space-x-reverse",children:[(0,t.jsx)(P(),{href:"/",children:(0,t.jsxs)(r.$,{variant:"ghost",size:"sm",className:"flex items-center gap-2 text-gray-700 hover:text-amber-600 hover:bg-amber-50/60 transition-colors",children:[(0,t.jsx)(Q.default,{src:"/icon-playmo.png",alt:"آرشین‌ها",width:20,height:20,className:"w-5 h-5 object-contain"}),(0,t.jsx)("span",{children:"آرشـین‌ها"})]})}),(0,t.jsx)(P(),{href:"/cafes",children:(0,t.jsx)(r.$,{variant:"ghost",size:"sm",children:"کافه‌گیم‌ها"})}),(0,t.jsx)(r.$,{onClick:U,size:"sm",className:"bg-gradient-to-r from-playmo-purple-600 to-playmo-blue-600 hover:from-playmo-purple-700 hover:to-playmo-blue-700 text-white shadow-md active:scale-95 transition-transform rounded-xl text-xs font-bold flex items-center gap-1.5 border-0",children:$?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-sm",children:"⚡"}),"ارتقای پاداش (۳٪)"]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-sm",children:"\uD83D\uDC51"}),"پلی‌مستر شو"]})}),(null==L?void 0:L.user)?(0,t.jsx)(P(),{href:(()=>{var e;if(!(null==L?void 0:L.user))return"/auth/customer/signin";switch(null==(e=L.user)?void 0:e.role){case"ADMIN":case"SUPER_ADMIN":return"/admin-dashboard";case"CAFE_OWNER":return"/business-dashboard";default:return"/dashboard"}})(),children:(0,t.jsx)(r.$,{variant:"ghost",size:"sm",children:"داشبورد"})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(P(),{href:(0,ea.kk)(),children:(0,t.jsx)(r.$,{variant:"ghost",size:"sm",children:"ورود"})}),(0,t.jsx)(P(),{href:(0,ea.Ku)(),children:(0,t.jsx)(r.$,{variant:"outline",size:"sm",children:"ثبت نام"})})]})]}),(null==L?void 0:L.user)&&(null==(o=L.user)?void 0:o.role)==="CAFE_OWNER"?(0,t.jsx)(P(),{href:"/business-dashboard/events/new",className:"block sm:hidden",children:(0,t.jsx)("div",{className:"flex items-center justify-center w-16 h-16",children:(0,t.jsx)(r.$,{size:"icon",className:"w-10 h-10 rounded-xl bg-green-600 hover:bg-green-700 text-white shadow-md active:scale-95 transition-transform flex items-center justify-center border-0",children:(0,t.jsx)(Y.A,{className:"h-6 w-6"})})})}):(0,t.jsx)("div",{className:"block sm:hidden flex items-center",children:(0,t.jsx)(r.$,{onClick:U,className:"h-9 px-3 rounded-xl bg-gradient-to-r from-playmo-purple-600 to-playmo-blue-600 hover:from-playmo-purple-700 hover:to-playmo-blue-700 text-white shadow-md active:scale-95 transition-transform flex items-center gap-1.5 text-xs font-bold border-0",children:$?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-sm",children:"⚡"}),"ارتقای پاداش (۳٪)"]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-sm",children:"\uD83D\uDC51"}),"پلی‌مستر شو"]})})}),(0,t.jsx)(el.r,{})]})]})}),(0,t.jsx)("div",{className:"hidden sm:block border-t border-gray-100 bg-gray-50/50",children:(0,t.jsx)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-3",children:(0,t.jsx)("p",{className:"text-sm text-gray-600 text-center",children:"بهترین رویدادها را پیدا کنید"})})})]}),(0,t.jsxs)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 pb-4 pt-20 sm:pb-8 sm:pt-36",children:[(0,t.jsx)("div",{className:"bg-white/80 backdrop-blur-md rounded-3xl shadow-sm border border-gray-200/80 p-4 sm:p-6 mb-6",children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(Z.A,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-5 w-5"}),(0,t.jsx)(n.p,{placeholder:"جستجو در رویدادها و بازی‌ها...",value:m,onChange:e=>u(e.target.value),className:"pr-10 text-right h-11 rounded-2xl border-gray-200 bg-white/60 focus:bg-white transition-colors"})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-3 pt-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("span",{className:"text-xs font-semibold text-gray-500 whitespace-nowrap min-w-[44px] text-right",children:"دسته:"}),(0,t.jsxs)("div",{className:"flex-1 flex overflow-x-auto gap-2 pb-1 scrollbar-none [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[(0,t.jsx)(r.$,{variant:"همه"===p?"default":"outline",size:"sm",onClick:()=>g("همه"),className:"h-7 rounded-lg px-2.5 text-xs font-medium transition-all duration-150 whitespace-nowrap ".concat("همه"===p?"bg-gray-900 text-white hover:bg-gray-800 shadow-sm":"hover:bg-gray-50 hover:text-gray-900 border-gray-200"),children:"همه رویدادها"}),(0,t.jsx)(r.$,{variant:"کافه"===p?"default":"outline",size:"sm",onClick:()=>g("کافه"),className:"h-7 rounded-lg px-2.5 text-xs font-medium transition-all duration-150 whitespace-nowrap ".concat("کافه"===p?"bg-playmo-blue-600 text-white hover:bg-playmo-blue-700 shadow-sm":"hover:bg-playmo-blue-50 hover:text-playmo-blue-600 border-gray-200"),children:"☕ کافه‌ها"}),(0,t.jsx)(r.$,{variant:"پلی‌مستر"===p?"default":"outline",size:"sm",onClick:()=>g("پلی‌مستر"),className:"h-7 rounded-lg px-2.5 text-xs font-medium transition-all duration-150 whitespace-nowrap ".concat("پلی‌مستر"===p?"bg-playmo-purple-600 text-white hover:bg-playmo-purple-700 shadow-sm":"hover:bg-playmo-purple-50 hover:text-playmo-purple-600 border-gray-200"),children:"\uD83D\uDC51 پلی‌مسترها"})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("span",{className:"text-xs font-semibold text-gray-500 whitespace-nowrap min-w-[44px] text-right",children:"شهر:"}),(0,t.jsx)("div",{className:"flex-1 flex overflow-x-auto gap-2 pb-1 scrollbar-none [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:eN.map(e=>{let s=ev===e.name;return(0,t.jsxs)(r.$,{variant:s?"default":"outline",size:"sm",onClick:()=>eb(e.name),className:"h-7 rounded-lg px-2.5 text-xs font-medium transition-all duration-150 whitespace-nowrap flex items-center gap-1.5 ".concat(s?"bg-playmo-blue-600 text-white hover:bg-playmo-blue-700 shadow-sm":e.hasItems?"bg-white text-gray-800 hover:bg-playmo-blue-50 hover:text-playmo-blue-600 border-gray-300 font-semibold shadow-xs":"text-gray-400 hover:bg-gray-100 hover:text-gray-600 border-gray-200"),children:[(0,t.jsx)("span",{children:e.name}),e.count>0&&(0,t.jsx)("span",{className:"text-[10px] px-1.5 py-0.2 rounded-full font-bold leading-tight ".concat(s?"bg-white/25 text-white":"bg-playmo-blue-100 text-playmo-blue-700"),children:(0,J.ub)(e.count)})]},e.name)})})]})]})]})}),(0,t.jsxs)("div",{className:"flex items-center justify-between mb-6 px-2 sm:px-0 select-none animate-fade-in",children:[(0,t.jsxs)("div",{className:"text-sm text-gray-500 font-medium text-right",children:["تعداد رویدادها: ",(0,t.jsx)("span",{className:"font-bold text-gray-800",children:ew.length})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 bg-gray-100/80 p-1 rounded-xl shadow-inner border border-gray-200/20",children:[(0,t.jsx)(r.$,{variant:"ghost",size:"sm",onClick:()=>v("grid"),title:"نمای کارت بزرگ",className:"h-8 w-8 p-0 rounded-lg transition-all duration-200 flex items-center justify-center ".concat("grid"===f?"bg-white text-gray-900 shadow-sm":"text-gray-500 hover:text-gray-900 hover:bg-white/40"),children:(0,t.jsx)(G.A,{className:"h-4 w-4"})}),(0,t.jsx)(r.$,{variant:"ghost",size:"sm",onClick:()=>v("compact"),title:"نمای فشرده",className:"h-8 w-8 p-0 rounded-lg transition-all duration-200 flex items-center justify-center ".concat("compact"===f?"bg-white text-gray-900 shadow-sm":"text-gray-500 hover:text-gray-900 hover:bg-white/40"),children:(0,t.jsx)(W.A,{className:"h-4 w-4"})})]})]}),eu?"grid"===f?(0,t.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 px-4 sm:px-0",children:Array(6).fill(0).map((e,s)=>(0,t.jsxs)(l.Zp,{className:"animate-pulse border-0 shadow-md rounded-3xl mx-2",children:[(0,t.jsx)("div",{className:"aspect-video bg-gray-200 rounded-3xl"}),(0,t.jsxs)(l.Wu,{className:"p-6 space-y-4",children:[(0,t.jsx)("div",{className:"h-5 bg-gray-200 rounded w-1/3 mb-2"}),(0,t.jsx)("div",{className:"h-4 bg-gray-200 rounded w-full"}),(0,t.jsx)("div",{className:"h-4 bg-gray-200 rounded w-5/6"}),(0,t.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,t.jsx)("div",{className:"h-4 bg-gray-200 rounded w-3/4"}),(0,t.jsx)("div",{className:"h-4 bg-gray-200 rounded w-1/2"})]}),(0,t.jsx)("div",{className:"h-10 bg-gray-200 rounded-xl mt-4"})]})]},s))}):(0,t.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 px-2 sm:px-0",children:Array(8).fill(0).map((e,s)=>(0,t.jsx)(l.Zp,{className:"animate-pulse border-0 shadow-md rounded-3xl aspect-[4/3] bg-gray-200 mx-1"},s))}):0===ew.length?(0,t.jsxs)("div",{className:"text-center py-12",children:[(0,t.jsx)(q.A,{className:"w-16 h-16 mx-auto mb-4 text-gray-300"}),(0,t.jsx)("p",{className:"text-lg text-gray-500",children:"هیچ رویدادی یافت نشد"}),(0,t.jsx)("p",{className:"text-sm text-gray-400 mb-4",children:"لطفاً فیلترهای جستجو را تغییر دهید"}),(0,t.jsx)(r.$,{variant:"outline",onClick:()=>{u(""),g("همه"),eb("همه")},children:"پاک کردن فیلترها"})]}):"grid"===f?(0,t.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 px-4 sm:px-0",children:ew.map(e=>(0,t.jsxs)(l.Zp,{className:"group transition-[transform,box-shadow] duration-200 ease-out transform-gpu will-change-[transform,box-shadow] md:hover:-translate-y-1 md:hover:shadow-xl border-0 shadow-md overflow-hidden pt-0 rounded-3xl mx-2 ".concat(e.isRegistered?"ring-2 ring-green-500/50 ring-offset-2 ring-offset-white":""),children:[(0,t.jsxs)("div",{className:"relative overflow-hidden group aspect-video bg-gradient-to-br from-playmo-purple-500 via-playmo-blue-500 to-playmo-purple-700 rounded-3xl",children:[(()=>{let s=e.mainImage?(0,T.zL)([e.mainImage])[0]:e.images&&e.images.length>0?(0,T.zL)(e.images)[0]:e.genre?(0,T.eI)(e.genre):null;return s?(0,t.jsx)(Q.default,{src:s,alt:e.title,fill:!0,sizes:"(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw",className:"object-cover transition-transform duration-300 ease-out transform-gpu md:group-hover:scale-105",unoptimized:!(0,T.Vd)(s),onError:e=>{e.currentTarget.style.display="none"}}):(0,t.jsx)("div",{className:"w-full h-full bg-[#ffa515] flex items-center justify-center p-6",children:(0,t.jsx)("div",{className:"relative w-1/3",style:{aspectRatio:"169.26/53.85"},children:(0,t.jsx)(Q.default,{src:"/logo-full.svg",alt:"Playmo",fill:!0,className:"object-contain transition-transform duration-300 ease-out transform-gpu md:group-hover:scale-105",priority:!0})})})})(),(0,t.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 via-black/20 to-transparent"}),(0,t.jsx)("div",{className:"absolute bottom-4 left-4 right-4 z-10",children:(0,t.jsxs)("div",{className:"text-white",children:[(0,t.jsx)("div",{className:"text-2xl font-bold mb-1 drop-shadow-lg",children:e.game}),(0,t.jsx)("div",{className:"text-sm opacity-90 bg-white/20 px-3 py-1 rounded-full backdrop-blur-sm inline-block",children:e.difficulty||({BEGINNER:"مبتدی",INTERMEDIATE:"متوسط",ADVANCED:"پیشرفته",PROFESSIONAL:"حرفه‌ای",ALL_LEVELS:"همه سطوح"})[e.skillLevel]||"همه سطوح"})]})}),(0,t.jsxs)("div",{className:"absolute top-3 right-3 flex flex-col gap-2 z-10",children:[e.isRegistered&&(0,t.jsx)(i.E,{className:"bg-green-500/90 text-white border-0 shadow-sm",children:"ثبت نام شده"}),e.registeredPlayers>=e.maxPlayers&&(0,t.jsx)(i.E,{variant:"destructive",className:"bg-red-500/90 text-white border-0",children:"تکمیل ظرفیت"})]}),(0,t.jsx)("div",{className:"absolute top-3 left-3 flex flex-col gap-2 z-10",children:"PLAYER_TABLE"===e.type||"PLAYER_TABLE"===e.eventType?(0,t.jsx)(i.E,{className:"bg-playmo-purple-600/90 text-white border-0 shadow-sm backdrop-blur-sm text-xs font-semibold",children:"\uD83D\uDC51 پلی‌مستر"}):(0,t.jsx)(i.E,{className:"bg-playmo-blue-600/90 text-white border-0 shadow-sm backdrop-blur-sm text-xs font-semibold",children:"☕ کافه"})}),(0,t.jsx)("div",{className:"absolute bottom-3 left-3",children:(0,t.jsxs)("div",{className:"bg-white/90 backdrop-blur-sm px-2 py-1 rounded-full flex items-center gap-1 text-xs font-medium",children:[(0,t.jsx)(j.A,{className:"h-3 w-3 text-playmo-purple-600"}),(0,t.jsxs)("span",{className:"text-gray-700",children:[e.registeredPlayers,"/",e.maxPlayers]})]})})]}),(0,t.jsxs)(l.Wu,{className:"p-6 space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-lg font-bold text-gray-900 mb-2 group-hover:text-playmo-purple-600 transition-colors leading-tight",children:e.title}),(0,t.jsx)("p",{className:"text-sm text-gray-600 line-clamp-2 leading-relaxed",children:e.description})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 space-x-reverse",children:[(0,t.jsx)("div",{className:"p-1.5 bg-playmo-blue-50 rounded-lg",children:(0,t.jsx)(q.A,{className:"h-4 w-4 text-playmo-blue-600"})}),(0,t.jsx)("span",{className:"text-gray-700 font-medium",children:(0,ee.Or)(e.date)})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2 space-x-reverse",children:[(0,t.jsx)("div",{className:"p-1.5 bg-playmo-purple-50 rounded-lg",children:(0,t.jsx)(H.A,{className:"h-4 w-4 text-playmo-purple-600"})}),(0,t.jsx)("span",{className:"text-gray-700 font-medium",children:e.time})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-between",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2 space-x-reverse",children:[(0,t.jsx)("div",{className:"p-1.5 bg-green-50 rounded-lg",children:(0,t.jsx)(K.A,{className:"h-4 w-4 text-green-600"})}),(0,t.jsxs)("div",{className:"flex items-center gap-8",children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900",children:e.cafe.name}),(0,t.jsxs)("span",{className:"text-sm text-gray-600",children:[" . ",(0,et.dM)(e.cafe.city)]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-1 space-x-reverse ml-4",children:[(0,t.jsx)(h.A,{className:"h-3 w-3 text-yellow-400 fill-current"}),(0,t.jsx)("span",{className:"text-xs text-gray-600 font-medium",children:e.cafe.rating>0?e.cafe.rating:"بدون امتیاز"})]})]})]})})]}),(0,t.jsx)("div",{className:"flex items-center justify-between",children:(0,t.jsx)(V,{eventId:e.id.toString(),eventTitle:e.title,maxPlayers:e.maxPlayers,registeredPlayers:e.registeredPlayers})}),e.tags&&e.tags.length>0&&(0,t.jsxs)("div",{className:"flex flex-wrap gap-1 mb-4",children:[e.tags.slice(0,3).map((e,s)=>(0,t.jsx)(i.E,{variant:"outline",className:"text-xs px-2 py-1 border-gray-200 text-gray-600 hover:border-playmo-purple-300 hover:text-playmo-purple-700 transition-colors",children:e},s)),e.tags.length>3&&(0,t.jsxs)(i.E,{variant:"outline",className:"text-xs px-2 py-1 border-gray-200 text-gray-500",children:["+",e.tags.length-3]})]}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(P(),{href:"/events/".concat(e.id),children:(0,t.jsx)(r.$,{className:"w-full group/btn relative overflow-hidden bg-gradient-to-r from-playmo-purple-600 to-playmo-blue-600 hover:from-playmo-purple-700 hover:to-playmo-blue-700 border-0 h-11 rounded-2xl px-6",disabled:e.registeredPlayers>=e.maxPlayers,children:e.registeredPlayers>=e.maxPlayers?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.A,{className:"mr-2 h-4 w-4"}),"ظرفیت تکمیل شده"]}):e.isRegistered?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,t.jsx)("span",{className:"font-medium",children:"مشاهده جزئیات"}),(0,t.jsx)(X.A,{className:"h-4 w-4 group-hover/btn:translate-x-1 transition-transform"})]}),(0,t.jsx)("div",{className:"absolute inset-0 -top-0.5 -bottom-0.5 bg-gradient-to-r from-transparent via-white/20 to-transparent translate-x-[-100%] group-hover/btn:translate-x-[100%] transition-transform duration-700"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,t.jsxs)("span",{className:"font-medium",children:["ثبت نام در رویداد (",0===e.price?"رایگان":"".concat((0,J.$g)(e.price)," تومان"),")"]}),(0,t.jsx)(X.A,{className:"h-4 w-4 group-hover/btn:translate-x-1 transition-transform"})]}),(0,t.jsx)("div",{className:"absolute inset-0 -top-0.5 -bottom-0.5 bg-gradient-to-r from-transparent via-white/20 to-transparent translate-x-[-100%] group-hover/btn:translate-x-[100%] transition-transform duration-700"})]})})})})]})]},e.id))}):(0,t.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 px-2 sm:px-0",children:ew.map(e=>(0,t.jsx)(er,{event:e},e.id))}),!eu&&(0,t.jsx)("div",{className:"text-center mt-12 text-gray-500",children:(0,t.jsx)("p",{children:ew.length>0?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"font-semibold text-playmo-purple-600",children:ew.length})," رویداد یافت شد"]}):null})})]}),(0,t.jsx)(ei.k,{open:b,onOpenChange:N,userCity:ev}),(0,t.jsx)(ec.A,{isOpen:y,onClose:()=>w(!1),onSelectedSuccess:M,introTitle:"ابتدا آرکی‌تایپ خودتو کشف کن",resultButtonText:"ثبت و ورود به ساخت میز \uD83D\uDE80"}),(0,t.jsx)(eo.V,{open:E,onOpenChange:A,onOpenCreateTable:_,onOpenQuiz:()=>w(!0),onOpenUsernamePrompt:()=>C(!0)}),(0,t.jsx)(ed.s,{open:k,onOpenChange:C,onSuccess:em})]})}},85897:(e,s,a)=>{"use strict";a.d(s,{BK:()=>c,eu:()=>i,q5:()=>d});var t=a(95155),r=a(12115),l=a(46591),n=a(64269);let i=r.forwardRef((e,s)=>{let{className:a,...r}=e;return(0,t.jsx)(l.bL,{ref:s,className:(0,n.cn)("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",a),...r})});i.displayName=l.bL.displayName;let c=r.forwardRef((e,s)=>{let{className:a,...r}=e;return(0,t.jsx)(l._V,{ref:s,className:(0,n.cn)("aspect-square h-full w-full",a),...r})});c.displayName=l._V.displayName;let d=r.forwardRef((e,s)=>{let{className:a,...r}=e;return(0,t.jsx)(l.H4,{ref:s,className:(0,n.cn)("flex h-full w-full items-center justify-center rounded-full bg-muted",a),...r})});d.displayName=l.H4.displayName}},e=>{e.O(0,[9268,586,9017,2619,6489,7173,3171,8720,1691,2387,2377,5239,6524,9829,1805,9597,1733,2268,8079,1900,8907,9619,6645,6858,774,9368,8441,1255,7358],()=>e(e.s=27790)),_N_E=e.O()}]);