(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8634],{3998:(e,s,a)=>{"use strict";a.d(s,{$:()=>c});var r=a(95155);a(12115);var t=a(32467),l=a(83101),n=a(64269);let i=(0,l.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function c(e){let{className:s,variant:a,size:l,asChild:c=!1,...d}=e,o=c?t.DX:"button";return(0,r.jsx)(o,{"data-slot":"button",className:(0,n.cn)(i({variant:a,size:l,className:s})),...d})}},7420:(e,s,a)=>{"use strict";a.d(s,{W:()=>t});var r=a(95155);function t(e){let{className:s,variant:a="short",...t}=e;return"full"===a?(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 169.26 53.85",className:s,...t,children:(0,r.jsx)("g",{id:"Layer_2","data-name":"Layer 2",children:(0,r.jsxs)("g",{id:"Layer_1-2","data-name":"Layer 1",children:[(0,r.jsx)("path",{d:"M0,26.2V9.62A9.32,9.32,0,0,1,14,1.55L28.34,9.84l14.37,8.29a9.32,9.32,0,0,1,0,16.14l-14.37,8.3L14,50.86A9.32,9.32,0,0,1,0,42.79Z",fill:"currentColor"}),(0,r.jsx)("circle",{cx:"143.34",cy:"27.93",r:"25.92",fill:"currentColor"}),(0,r.jsx)("path",{d:"M111,7.61v37.2a7.6,7.6,0,0,1-7.6,7.6H61.36a7.61,7.61,0,0,1-7.6-7.6V7.66A7.6,7.6,0,0,1,64.86.91l14,7.23a7.59,7.59,0,0,0,7,0L99.94.85A7.6,7.6,0,0,1,111,7.61Z",fill:"currentColor"}),(0,r.jsx)("ellipse",{cx:"72.81",cy:"30.22",rx:"7.44",ry:"2.29",fill:"#ffffff"}),(0,r.jsx)("circle",{cx:"93.25",cy:"30.22",r:"6.18",fill:"#ffffff"})]})})}):(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 57.26 52.41",className:s,...t,children:(0,r.jsx)("g",{id:"Layer_2","data-name":"Layer 2",children:(0,r.jsxs)("g",{id:"Layer_1-2","data-name":"Layer 1",children:[(0,r.jsx)("path",{d:"M57.26,7.61v37.2a7.6,7.6,0,0,1-7.6,7.6H7.6A7.6,7.6,0,0,1,0,44.81V7.66A7.6,7.6,0,0,1,11.09.91l14,7.23a7.61,7.61,0,0,0,7,0L46.18.85A7.6,7.6,0,0,1,57.26,7.61Z",fill:"currentColor"}),(0,r.jsx)("ellipse",{cx:"19.04",cy:"30.22",rx:"7.44",ry:"2.29",fill:"#ffffff"}),(0,r.jsx)("circle",{cx:"39.48",cy:"30.22",r:"6.18",fill:"#ffffff"})]})})})}a(12115)},16536:(e,s,a)=>{"use strict";a.d(s,{Tb:()=>l,dM:()=>n});let r={تهران:"Tehran",اصفهان:"Isfahan",مشهد:"Mashhad",شیراز:"Shiraz",تبریز:"Tabriz",کرج:"Karaj",قم:"Qom",اهواز:"Ahvaz"},t={Tehran:"تهران",Isfahan:"اصفهان",Mashhad:"مشهد",Shiraz:"شیراز",Tabriz:"تبریز",Karaj:"کرج",Qom:"قم",Ahvaz:"اهواز"};function l(e){return r[e]||e}function n(e){return t[e]||e}},27790:(e,s,a)=>{Promise.resolve().then(a.bind(a,42563))},42563:(e,s,a)=>{"use strict";a.r(s),a.d(s,{default:()=>et});var r=a(95155),t=a(3998),l=a(86948),n=a(65142),i=a(11647),c=a(7420),d=a(12115),o=a(85897),x=a(51834),m=a(56154),u=a(39347),h=a(95740),p=a(95322),g=a(68854),f=a(59865),v=a(91169),j=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,[h,p]=(0,d.useState)(null),[g,f]=(0,d.useState)(!1),v=(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&&v()},[n,m,v]),g)?(0,r.jsx)(x.lG,{open:n,onOpenChange:c,children:(0,r.jsxs)(x.Cf,{className:"sm:max-w-lg",dir:"rtl",children:[(0,r.jsx)(x.c7,{children:(0,r.jsx)(x.L3,{className:"text-right",children:"پروفایل کاربر"})}),(0,r.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,r.jsx)(w.kt,{size:"lg"})})]})}):h?(0,r.jsx)(x.lG,{open:n,onOpenChange:c,children:(0,r.jsxs)(x.Cf,{className:"sm:max-w-2xl max-h-[90vh] overflow-y-auto",dir:"rtl",children:[(0,r.jsx)(x.c7,{children:(0,r.jsx)(x.L3,{className:"text-right",children:"پروفایل کاربر"})}),(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"flex items-start gap-6 p-6 bg-gradient-to-r from-blue-50 to-purple-50 rounded-lg",children:[(0,r.jsxs)(o.eu,{className:"w-24 h-24",children:[(0,r.jsx)(o.BK,{src:h.avatar?"https://asset.playmo.ir/public".concat(h.avatar):"",alt:h.name||""}),(0,r.jsx)(o.q5,{className:"text-2xl",children:(null==(s=h.name)?void 0:s.slice(0,2).toUpperCase())||"U"})]}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,r.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:h.name}),(0,r.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"}})(h.currentLevel),children:h.currentLevel})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm text-gray-600",children:[h.age&&(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(E.A,{className:"w-4 h-4"}),(0,r.jsxs)("span",{children:[h.age," ساله"]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(A.A,{className:"w-4 h-4"}),(0,r.jsxs)("span",{children:[h.totalPoints.toLocaleString("fa")," امتیاز"]})]}),h.ranking&&(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(u.A,{className:"w-4 h-4"}),(0,r.jsxs)("span",{children:["رنک ",h.ranking.position.toLocaleString("fa")]})]})]})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,r.jsxs)(t.$,{variant:"default",className:"gap-2",children:[(0,r.jsx)(k.A,{className:"w-4 h-4"}),"دعوت به بازی"]}),(0,r.jsxs)(t.$,{variant:"outline",className:"gap-2",children:[(0,r.jsx)(C.A,{className:"w-4 h-4"}),"پیام"]})]})]}),(0,r.jsxs)(l.Zp,{children:[(0,r.jsx)(l.aR,{children:(0,r.jsxs)(l.ZB,{className:"flex items-center gap-2",children:[(0,r.jsx)(k.A,{className:"w-5 h-5"}),"بازی‌های مورد علاقه"]})}),(0,r.jsx)(l.Wu,{children:h.gamePreferences&&h.gamePreferences.length>0?(0,r.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:h.gamePreferences.map((e,s)=>(0,r.jsxs)("div",{className:"p-3 bg-gray-50 rounded-lg",children:[(0,r.jsx)("h4",{className:"font-semibold text-gray-900",children:e.gameTitle}),(0,r.jsxs)("div",{className:"flex gap-2 mt-1",children:[(0,r.jsx)(i.E,{variant:"secondary",children:e.category}),(0,r.jsx)(i.E,{variant:"outline",children:e.skillLevel})]})]},s))}):(0,r.jsx)("p",{className:"text-gray-500 text-center py-8",children:"علایق گیمینگ ثبت نشده"})})]}),(0,r.jsxs)(l.Zp,{children:[(0,r.jsx)(l.aR,{children:(0,r.jsxs)(l.ZB,{className:"flex items-center gap-2",children:[(0,r.jsx)(A.A,{className:"w-5 h-5"}),"آمار بازیکن"]})}),(0,r.jsx)(l.Wu,{children:(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{className:"text-center p-4 bg-blue-50 rounded-lg",children:[(0,r.jsx)("div",{className:"text-2xl font-bold text-blue-600",children:h.totalPoints.toLocaleString("fa")}),(0,r.jsx)("div",{className:"text-sm text-gray-600",children:"کل امتیازات"})]}),(0,r.jsxs)("div",{className:"text-center p-4 bg-green-50 rounded-lg",children:[(0,r.jsx)("div",{className:"text-2xl font-bold text-green-600",children:null==(a=h.ranking)?void 0:a.position.toLocaleString("fa")}),(0,r.jsx)("div",{className:"text-sm text-gray-600",children:"رنک کلی"})]})]})})]})]})]})}):null}var z=a(36489),P=a(52619),T=a.n(P);function R(e){let{isOpen:s,onClose:a,eventId:l,eventTitle:n}=e,{data:i,status:c}=(0,z.useSession)(),[w,E]=(0,d.useState)(null),[A,k]=(0,d.useState)(!1),[C,P]=(0,d.useState)({open:!1,userId:""});(0,d.useEffect)(()=>{s&&l&&"authenticated"===c&&R()},[s,l,c]);let R=async()=>{try{k(!0);let e=await fetch("/api/events/".concat(l,"/participants"));if(401===e.status)return;let s=await e.json();s.success?E(s.data):y.o.error(s.error||"خطا در دریافت اطلاعات شرکت‌کنندگان")}catch(e){console.error("خطا در دریافت شرکت‌کنندگان:",e),y.o.error("خطا در دریافت اطلاعات")}finally{k(!1)}};return A||"loading"===c?(0,r.jsx)(x.lG,{open:s,onOpenChange:a,children:(0,r.jsxs)(x.Cf,{className:"sm:max-w-md rounded-3xl",dir:"rtl",showCloseButton:!1,children:[(0,r.jsx)(x.c7,{children:(0,r.jsx)(x.L3,{className:"text-right mr-4",children:"شرکت‌کنندگان"})}),(0,r.jsx)("div",{className:"flex items-center justify-center p-12",children:(0,r.jsx)(N.kt,{size:"lg"})})]})}):"unauthenticated"===c?(0,r.jsx)(x.lG,{open:s,onOpenChange:a,children:(0,r.jsx)(x.Cf,{className:"sm:max-w-md rounded-3xl p-8",dir:"rtl",showCloseButton:!1,children:(0,r.jsxs)("div",{className:"text-center space-y-6",children:[(0,r.jsx)("div",{className:"w-20 h-20 bg-blue-50 rounded-full flex items-center justify-center mx-auto",children:(0,r.jsx)(f.A,{className:"w-10 h-10 text-blue-500"})}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("h3",{className:"text-xl font-bold text-gray-800",children:"مشاهده شرکت‌کنندگان"}),(0,r.jsx)("p",{className:"text-gray-500 text-sm leading-relaxed",children:"برای مشاهده لیست شرکت‌کنندگان در این رویداد، لطفاً وارد حساب کاربری خود شوید یا ثبت‌نام کنید."})]}),(0,r.jsxs)("div",{className:"grid gap-3",children:[(0,r.jsx)(T(),{href:"/auth/customer/signin",className:"w-full",children:(0,r.jsx)(t.$,{className:"w-full h-11 text-base font-medium bg-playmo-purple-600 hover:bg-playmo-purple-700",children:"ورود به حساب کاربری"})}),(0,r.jsx)(T(),{href:"/auth/customer/signup",className:"w-full",children:(0,r.jsx)(t.$,{variant:"outline",className:"w-full h-11 text-base font-medium border-gray-300 text-gray-700 hover:bg-gray-50",children:"ثبت‌نام در پلیمو"})})]})]})})}):w?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(x.lG,{open:s,onOpenChange:a,children:(0,r.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,r.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,r.jsxs)("div",{className:"flex items-center gap-2 text-gray-800",children:[(0,r.jsx)(v.A,{className:"w-5 h-5 text-playmo-purple-600"}),(0,r.jsxs)("span",{className:"font-bold text-lg",children:[w.total," شرکت‌کننده"]})]}),(0,r.jsx)(x.L3,{className:"hidden",children:"لیست شرکت‌کنندگان"})," ",(0,r.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,r.jsx)("div",{className:"p-6",children:(0,r.jsx)("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-y-8 gap-x-4",children:w.allParticipants.length>0?w.allParticipants.map(e=>{var s,a;return(0,r.jsxs)("div",{className:"flex flex-col items-center group cursor-pointer",onClick:()=>!e.isExternal&&void P({open:!0,userId:e.id}),children:[(0,r.jsxs)("div",{className:"relative mb-2",children:[(0,r.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,r.jsxs)(o.eu,{className:"w-16 h-16 sm:w-20 sm:h-20 transition-transform duration-300 group-hover:scale-105",children:[(0,r.jsx)(o.BK,{src:e.avatar?"https://asset.playmo.ir/public".concat(e.avatar):"",alt:e.name||"",className:"object-cover"}),(0,r.jsx)(o.q5,{className:"text-xl font-bold bg-gray-50 text-gray-400",children:(null==(s=e.name)?void 0:s.slice(0,1).toUpperCase())||"U"})]})}),e.isFriend&&(0,r.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,r.jsx)(j.A,{className:"w-3 h-3 text-white fill-current"})}),!e.isFriend&&e.isTeammate&&(0,r.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,r.jsx)(b.A,{className:"w-3 h-3 text-white hover:rotate-12 transition-transform"})}),!e.isExternal&&(0,r.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,r.jsx)("div",{className:"w-3.5 h-3.5 flex items-center justify-center",children:(e=>{switch(e){case"⚡":return(0,r.jsx)(m.A,{className:"w-full h-full stroke-[1.5]"});case"⭐":return(0,r.jsx)(u.A,{className:"w-full h-full stroke-[1.5]"});case"\uD83D\uDCAB":return(0,r.jsx)(h.A,{className:"w-full h-full stroke-[1.5]"});case"\uD83D\uDC8E":return(0,r.jsx)(p.A,{className:"w-full h-full stroke-[1.5]"});case"\uD83D\uDC51":return(0,r.jsx)(g.A,{className:"w-full h-full stroke-[1.5]"});default:return(0,r.jsx)("span",{className:"text-sm",children:e||"\uD83C\uDF31"})}})(e.currentLevelIcon)})}),e.isExternal&&(0,r.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,r.jsx)("span",{className:"text-[9px] font-bold text-white",children:"خارجی"})})]}),(0,r.jsx)("div",{className:"text-center w-full",children:(0,r.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==(a=e.name)?void 0:a.split(" ")[0]," "]})})]},e.id)}):(0,r.jsxs)("div",{className:"col-span-full text-center py-16 text-gray-400",children:[(0,r.jsx)("div",{className:"w-20 h-20 bg-gray-50 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,r.jsx)(v.A,{className:"w-10 h-10 text-gray-300"})}),(0,r.jsx)("p",{className:"text-gray-500 font-medium",children:"هنوز کسی ثبت نام نکرده"})]})})})]})}),(0,r.jsx)(L,{isOpen:C.open,onClose:()=>{P({open:!1,userId:""})},userId:C.userId})]}):null}var I=a(6132),S=a(52056),_=a(89559),D=a(65993),M=a(20063);function B(){return{handleError:d.useCallback((e,s)=>{console.error("Error in ".concat(s||"component",":"),e),y.o.error("خطایی رخ داد",{description:e.message||"خطای غیرمنتظره‌ای رخ داده است"})},[])}}function $(e){let{eventId:s,eventTitle:a,maxPlayers:l,registeredPlayers:n}=e,[c,x]=(0,d.useState)(null),[m,u]=(0,d.useState)(!1),[h,p]=(0,d.useState)(null),[g,f]=(0,d.useState)(!1),{handleError:b}=B(),{handleAsyncError:N}=function(){let{handleError:e}=B();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])}}(),y=(0,d.useCallback)(async()=>{let e=await N(async()=>{u(!0),p(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 r;throw Error((null==(r=a.error)?void 0:r.message)||"خطا در دریافت اطلاعات شرکت‌کنندگان")}return a.data},"EventParticipants.fetchParticipants");e?x(e):p("خطا در بارگیری شرکت‌کنندگان"),u(!1)},[s,N]),w=(0,d.useCallback)(()=>{y()},[y]);if((0,d.useEffect)(()=>{y()},[y]),m)return(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("div",{className:"animate-pulse flex gap-1",children:[(0,r.jsx)("div",{className:"w-6 h-6 bg-gray-200 rounded-full"}),(0,r.jsx)("div",{className:"w-6 h-6 bg-gray-200 rounded-full"}),(0,r.jsx)("div",{className:"w-6 h-6 bg-gray-200 rounded-full"})]}),(0,r.jsx)("span",{className:"text-sm text-gray-500",children:"در حال بارگذاری..."})]});if(h)return(0,r.jsxs)("div",{className:"flex items-center gap-2 text-red-500",children:[(0,r.jsx)(I.A,{size:16}),(0,r.jsx)("span",{className:"text-sm",children:h}),(0,r.jsx)(t.$,{variant:"ghost",size:"sm",onClick:w,className:"text-xs",children:"تلاش مجدد"})]});if(!c||0===c.total)return"number"==typeof n&&n>0?(0,r.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,r.jsx)(v.A,{className:"w-4 h-4 text-gray-500"}),(0,r.jsxs)("span",{className:"text-gray-700",children:[n,"/",l]})]}):(0,r.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,r.jsx)(v.A,{className:"w-4 h-4"}),(0,r.jsxs)("span",{children:["0/",l]})]});let E=Math.min(c.participants.length,3);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"flex items-center cursor-pointer hover:scale-105 transition-transform",onClick:()=>{f(!0)},children:c.participants.slice(0,E).map((e,s)=>{var a;return e&&e.id?(0,r.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,r.jsxs)(o.eu,{className:"w-7 h-7",children:[(0,r.jsx)(o.BK,{src:e.avatar?"https://asset.playmo.ir/public".concat(e.avatar):"",alt:e.name||"کاربر"}),(0,r.jsx)(o.q5,{className:"text-[9px]",children:(null==(a=e.name)?void 0:a.slice(0,2).toUpperCase())||"U"})]})},e.id):null}).filter(Boolean)}),(0,r.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,r.jsx)(v.A,{className:"w-4 h-4 text-gray-500"}),(0,r.jsxs)("span",{className:"text-gray-700",children:[null!=n?n:c.total,"/",l]}),c.friendsCount>0&&(0,r.jsxs)(i.E,{variant:"secondary",className:"gap-1 px-2 py-0.5 text-xs",children:[(0,r.jsx)(j.A,{className:"w-3 h-3"}),c.friendsCount," دوست"]})]})]}),(0,r.jsx)(R,{isOpen:g,onClose:()=>{f(!1)},eventId:s,eventTitle:a})]})}d.Component;var O=a(6191),Y=a(86651),F=a(30940),U=a(94610),V=a(16485),Z=a(26983),W=a(21873),G=a(52987),H=a(82636),K=a(15239),q=a(51950),X=a(58779),Q=a(86600),J=a(66091),ee=a(96093),es=a(16536);let ea=e=>{let{event:s}=e,[a,t]=d.useState(!1),n=function(e){return e.mainImage?(0,ee.zL)([e.mainImage])[0]:e.images&&e.images.length>0?(0,ee.zL)(e.images)[0]:e.genre?(0,ee.eI)(e.genre):null}(s),c=!!(n&&!a),o="PLAYER_TABLE"===s.type||"PLAYER_TABLE"===s.eventType,x=s.registeredPlayers>=s.maxPlayers;return(0,r.jsx)(T(),{href:"/events/".concat(s.id),children:(0,r.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,r.jsx)("div",{className:"absolute inset-0 z-0 bg-gray-950",children:c?(0,r.jsx)(K.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,ee.Vd)(n),onError:()=>t(!0)}):(0,r.jsx)("div",{className:"w-full h-full bg-[#ffa515] flex items-center justify-center p-6",children:(0,r.jsx)("div",{className:"relative w-1/2",style:{aspectRatio:"169.26/53.85"},children:(0,r.jsx)(K.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,r.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,r.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,r.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,r.jsx)("span",{children:o?"\uD83D\uDC51 پلی‌مستر":"☕ کافه"})}),(0,r.jsxs)("div",{className:"flex flex-col gap-1 items-end",children:[s.isRegistered&&(0,r.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,r.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,r.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,r.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,r.jsx)("h3",{className:"text-sm sm:text-base font-bold text-white leading-tight line-clamp-1 drop-shadow-sm",children:s.title}),(0,r.jsxs)("div",{className:"flex items-center justify-between text-[10px] sm:text-[11px] text-white/80",children:[(0,r.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,r.jsx)(V.A,{className:"h-3 w-3 text-white/60 ml-0.5 inline"}),(0,r.jsx)("span",{children:(0,X.Or)(s.date)})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(v.A,{className:"h-3 w-3 text-white/60 ml-0.5 inline"}),(0,r.jsxs)("span",{children:[s.registeredPlayers,"/",s.maxPlayers]})]})]})]})]})})};var er=a(95704);function et(){var e,s;let[a,o]=(0,d.useState)(""),[x,m]=(0,d.useState)("همه"),[h,p]=(0,d.useState)("همه"),[g,f]=(0,d.useState)("grid"),[j,b]=(0,d.useState)(!1),{data:N}=(0,z.useSession)(),{data:y,isLoading:w,error:E,mutate:A}=(0,Q.C)("/api/events"),k=(null==y||null==(e=y.data)?void 0:e.events)||[];(0,d.useEffect)(()=>{let e=()=>{A()};return window.addEventListener("event-updated",e),()=>window.removeEventListener("event-updated",e)},[A]);let C=d.useMemo(()=>k.filter(e=>{var s;let r=e.title.toLowerCase().includes(a.toLowerCase())||e.game.toLowerCase().includes(a.toLowerCase()),t="PLAYER_TABLE"===e.type||"PLAYER_TABLE"===e.eventType,l="همه"===x||"کافه"===x&&!t||"پلی‌مستر"===x&&t,n="همه"===h?null:(0,es.Tb)(h),i="همه"===h||n&&(null==(s=e.cafe)?void 0:s.city)===n;return r&&l&&i}),[k,a,x,h]),L=["همه",...d.useMemo(()=>{let e=new Set;return k.forEach(s=>{var a;(null==(a=s.cafe)?void 0:a.city)&&e.add((0,es.dM)(s.cafe.city))}),Array.from(e).sort()},[k])];return(0,r.jsxs)("div",{className:"min-h-screen bg-gradient-to-br from-playmo-blue-50 via-white to-playmo-purple-50",children:[(0,r.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,r.jsx)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:(0,r.jsxs)("div",{className:"flex items-center justify-between h-16",children:[(0,r.jsxs)("div",{className:"flex items-center space-x-4 space-x-reverse",children:[(0,r.jsx)(T(),{href:"/",className:"flex items-center transition-transform hover:scale-105",children:(0,r.jsx)("div",{className:"p-2 sm:p-2.5 rounded-xl sm:rounded-2xl",style:{backgroundColor:"#ffa515"},children:(0,r.jsx)(c.W,{className:"h-5 w-auto sm:h-7 text-black"})})}),(0,r.jsx)("div",{className:"h-6 w-px bg-gray-300 hidden sm:block"}),(0,r.jsx)("h1",{className:"text-xl sm:text-2xl font-bold text-gray-900",children:"رویدادها"})]}),(0,r.jsxs)("div",{className:"hidden md:flex items-center space-x-4 space-x-reverse",children:[(0,r.jsxs)(i.E,{variant:"secondary",className:"bg-playmo-purple-100 text-playmo-purple-700",children:[C.length," رویداد"]}),(0,r.jsx)(T(),{href:"/cafes",children:(0,r.jsx)(t.$,{variant:"ghost",size:"sm",children:"کافه‌گیم‌ها"})}),(null==N?void 0:N.user)?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(T(),{href:(()=>{var e;if(!(null==N?void 0:N.user))return"/auth/customer/signin";switch(null==(e=N.user)?void 0:e.role){case"ADMIN":case"SUPER_ADMIN":return"/admin-dashboard";case"CAFE_OWNER":return"/business-dashboard";default:return"/dashboard"}})(),children:(0,r.jsx)(t.$,{variant:"ghost",size:"sm",children:"داشبورد"})}),(0,r.jsx)(T(),{href:(()=>{var e;if(!(null==N?void 0:N.user))return"/auth/customer/signin";switch(null==(e=N.user)?void 0:e.role){case"ADMIN":case"SUPER_ADMIN":return"/admin-dashboard";case"CAFE_OWNER":return"/business-dashboard/settings";default:return"/dashboard/profile"}})(),children:(0,r.jsx)(t.$,{variant:"outline",size:"sm",children:"پروفایل"})})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(T(),{href:(0,J.kk)(),children:(0,r.jsx)(t.$,{variant:"ghost",size:"sm",children:"ورود"})}),(0,r.jsx)(T(),{href:(0,J.Ku)(),children:(0,r.jsx)(t.$,{variant:"outline",size:"sm",children:"ثبت نام"})})]})]}),(null==N?void 0:N.user)&&(null==(s=N.user)?void 0:s.role)==="CAFE_OWNER"?(0,r.jsx)(T(),{href:"/business-dashboard/events/new",className:"block sm:hidden",children:(0,r.jsx)("div",{className:"flex items-center justify-center w-16 h-16",children:(0,r.jsx)(t.$,{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,r.jsx)(O.A,{className:"h-6 w-6"})})})}):(0,r.jsx)("div",{className:"block sm:hidden flex items-center pr-2",children:(0,r.jsxs)(t.$,{onClick:()=>b(!0),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,r.jsx)("span",{className:"text-sm",children:"\uD83D\uDC51"}),"پلی‌مستر شو"]})})]})}),(0,r.jsx)("div",{className:"hidden sm:block border-t border-gray-100 bg-gray-50/50",children:(0,r.jsx)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-3",children:(0,r.jsx)("p",{className:"text-sm text-gray-600 text-center",children:"بهترین رویدادها را پیدا کنید"})})})]}),(0,r.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,r.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,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(Y.A,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-5 w-5"}),(0,r.jsx)(n.p,{placeholder:"جستجو در رویدادها و بازی‌ها...",value:a,onChange:e=>o(e.target.value),className:"pr-10 text-right h-11 rounded-2xl border-gray-200 bg-white/60 focus:bg-white transition-colors"})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-3 pt-1",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("span",{className:"text-xs font-semibold text-gray-500 whitespace-nowrap min-w-[44px] text-right",children:"دسته:"}),(0,r.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,r.jsx)(t.$,{variant:"همه"===x?"default":"outline",size:"sm",onClick:()=>m("همه"),className:"h-7 rounded-lg px-2.5 text-xs font-medium transition-all duration-150 whitespace-nowrap ".concat("همه"===x?"bg-gray-900 text-white hover:bg-gray-800 shadow-sm":"hover:bg-gray-50 hover:text-gray-900 border-gray-200"),children:"همه رویدادها"}),(0,r.jsx)(t.$,{variant:"کافه"===x?"default":"outline",size:"sm",onClick:()=>m("کافه"),className:"h-7 rounded-lg px-2.5 text-xs font-medium transition-all duration-150 whitespace-nowrap ".concat("کافه"===x?"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,r.jsx)(t.$,{variant:"پلی‌مستر"===x?"default":"outline",size:"sm",onClick:()=>m("پلی‌مستر"),className:"h-7 rounded-lg px-2.5 text-xs font-medium transition-all duration-150 whitespace-nowrap ".concat("پلی‌مستر"===x?"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,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("span",{className:"text-xs font-semibold text-gray-500 whitespace-nowrap min-w-[44px] text-right",children:"شهر:"}),(0,r.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:L.map(e=>(0,r.jsx)(t.$,{variant:h===e?"default":"outline",size:"sm",onClick:()=>p(e),className:"h-7 rounded-lg px-2.5 text-xs font-medium transition-all duration-150 whitespace-nowrap ".concat(h===e?"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:e},e))})]})]})]})}),(0,r.jsxs)("div",{className:"flex items-center justify-between mb-6 px-2 sm:px-0 select-none animate-fade-in",children:[(0,r.jsxs)("div",{className:"text-sm text-gray-500 font-medium text-right",children:["تعداد رویدادها: ",(0,r.jsx)("span",{className:"font-bold text-gray-800",children:C.length})]}),(0,r.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,r.jsx)(t.$,{variant:"ghost",size:"sm",onClick:()=>f("grid"),title:"نمای کارت بزرگ",className:"h-8 w-8 p-0 rounded-lg transition-all duration-200 flex items-center justify-center ".concat("grid"===g?"bg-white text-gray-900 shadow-sm":"text-gray-500 hover:text-gray-900 hover:bg-white/40"),children:(0,r.jsx)(F.A,{className:"h-4 w-4"})}),(0,r.jsx)(t.$,{variant:"ghost",size:"sm",onClick:()=>f("compact"),title:"نمای فشرده",className:"h-8 w-8 p-0 rounded-lg transition-all duration-200 flex items-center justify-center ".concat("compact"===g?"bg-white text-gray-900 shadow-sm":"text-gray-500 hover:text-gray-900 hover:bg-white/40"),children:(0,r.jsx)(U.A,{className:"h-4 w-4"})})]})]}),w?"grid"===g?(0,r.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,r.jsxs)(l.Zp,{className:"animate-pulse border-0 shadow-md rounded-3xl mx-2",children:[(0,r.jsx)("div",{className:"aspect-video bg-gray-200 rounded-3xl"}),(0,r.jsxs)(l.Wu,{className:"p-6 space-y-4",children:[(0,r.jsx)("div",{className:"h-5 bg-gray-200 rounded w-1/3 mb-2"}),(0,r.jsx)("div",{className:"h-4 bg-gray-200 rounded w-full"}),(0,r.jsx)("div",{className:"h-4 bg-gray-200 rounded w-5/6"}),(0,r.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,r.jsx)("div",{className:"h-4 bg-gray-200 rounded w-3/4"}),(0,r.jsx)("div",{className:"h-4 bg-gray-200 rounded w-1/2"})]}),(0,r.jsx)("div",{className:"h-10 bg-gray-200 rounded-xl mt-4"})]})]},s))}):(0,r.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,r.jsx)(l.Zp,{className:"animate-pulse border-0 shadow-md rounded-3xl aspect-[4/3] bg-gray-200 mx-1"},s))}):0===C.length?(0,r.jsxs)("div",{className:"text-center py-12",children:[(0,r.jsx)(V.A,{className:"w-16 h-16 mx-auto mb-4 text-gray-300"}),(0,r.jsx)("p",{className:"text-lg text-gray-500",children:"هیچ رویدادی یافت نشد"}),(0,r.jsx)("p",{className:"text-sm text-gray-400 mb-4",children:"لطفاً فیلترهای جستجو را تغییر دهید"}),(0,r.jsx)(t.$,{variant:"outline",onClick:()=>{o(""),m("همه"),p("همه")},children:"پاک کردن فیلترها"})]}):"grid"===g?(0,r.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 px-4 sm:px-0",children:C.map(e=>(0,r.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,r.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,ee.zL)([e.mainImage])[0]:e.images&&e.images.length>0?(0,ee.zL)(e.images)[0]:e.genre?(0,ee.eI)(e.genre):null;return s?(0,r.jsx)(K.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,ee.Vd)(s),onError:e=>{e.currentTarget.style.display="none"}}):(0,r.jsx)("div",{className:"w-full h-full bg-[#ffa515] flex items-center justify-center p-6",children:(0,r.jsx)("div",{className:"relative w-1/3",style:{aspectRatio:"169.26/53.85"},children:(0,r.jsx)(K.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,r.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 via-black/20 to-transparent"}),(0,r.jsx)("div",{className:"absolute bottom-4 left-4 right-4 z-10",children:(0,r.jsxs)("div",{className:"text-white",children:[(0,r.jsx)("div",{className:"text-2xl font-bold mb-1 drop-shadow-lg",children:e.game}),(0,r.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,r.jsxs)("div",{className:"absolute top-3 right-3 flex flex-col gap-2 z-10",children:[e.isRegistered&&(0,r.jsx)(i.E,{className:"bg-green-500/90 text-white border-0 shadow-sm",children:"ثبت نام شده"}),e.registeredPlayers>=e.maxPlayers&&(0,r.jsx)(i.E,{variant:"destructive",className:"bg-red-500/90 text-white border-0",children:"تکمیل ظرفیت"})]}),(0,r.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,r.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,r.jsx)(i.E,{className:"bg-playmo-blue-600/90 text-white border-0 shadow-sm backdrop-blur-sm text-xs font-semibold",children:"☕ کافه"})}),(0,r.jsx)("div",{className:"absolute bottom-3 left-3",children:(0,r.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,r.jsx)(v.A,{className:"h-3 w-3 text-playmo-purple-600"}),(0,r.jsxs)("span",{className:"text-gray-700",children:[e.registeredPlayers,"/",e.maxPlayers]})]})})]}),(0,r.jsxs)(l.Wu,{className:"p-6 space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.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,r.jsx)("p",{className:"text-sm text-gray-600 line-clamp-2 leading-relaxed",children:e.description})]}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[(0,r.jsxs)("div",{className:"flex items-center space-x-2 space-x-reverse",children:[(0,r.jsx)("div",{className:"p-1.5 bg-playmo-blue-50 rounded-lg",children:(0,r.jsx)(V.A,{className:"h-4 w-4 text-playmo-blue-600"})}),(0,r.jsx)("span",{className:"text-gray-700 font-medium",children:(0,X.Or)(e.date)})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2 space-x-reverse",children:[(0,r.jsx)("div",{className:"p-1.5 bg-playmo-purple-50 rounded-lg",children:(0,r.jsx)(Z.A,{className:"h-4 w-4 text-playmo-purple-600"})}),(0,r.jsx)("span",{className:"text-gray-700 font-medium",children:e.time})]})]}),(0,r.jsx)("div",{className:"flex items-center justify-between",children:(0,r.jsxs)("div",{className:"flex items-center space-x-2 space-x-reverse",children:[(0,r.jsx)("div",{className:"p-1.5 bg-green-50 rounded-lg",children:(0,r.jsx)(W.A,{className:"h-4 w-4 text-green-600"})}),(0,r.jsxs)("div",{className:"flex items-center gap-8",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-900",children:e.cafe.name}),(0,r.jsxs)("span",{className:"text-sm text-gray-600",children:[" . ",(0,es.dM)(e.cafe.city)]})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-1 space-x-reverse ml-4",children:[(0,r.jsx)(u.A,{className:"h-3 w-3 text-yellow-400 fill-current"}),(0,r.jsx)("span",{className:"text-xs text-gray-600 font-medium",children:e.cafe.rating>0?e.cafe.rating:"بدون امتیاز"})]})]})]})})]}),(0,r.jsx)("div",{className:"flex items-center justify-between",children:(0,r.jsx)($,{eventId:e.id.toString(),eventTitle:e.title,maxPlayers:e.maxPlayers,registeredPlayers:e.registeredPlayers})}),e.tags&&e.tags.length>0&&(0,r.jsxs)("div",{className:"flex flex-wrap gap-1 mb-4",children:[e.tags.slice(0,3).map((e,s)=>(0,r.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,r.jsxs)(i.E,{variant:"outline",className:"text-xs px-2 py-1 border-gray-200 text-gray-500",children:["+",e.tags.length-3]})]}),(0,r.jsx)("div",{className:"mt-4",children:(0,r.jsx)(T(),{href:"/events/".concat(e.id),children:(0,r.jsx)(t.$,{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,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(v.A,{className:"mr-2 h-4 w-4"}),"ظرفیت تکمیل شده"]}):e.isRegistered?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,r.jsx)("span",{className:"font-medium",children:"مشاهده جزئیات"}),(0,r.jsx)(G.A,{className:"h-4 w-4 group-hover/btn:translate-x-1 transition-transform"})]}),(0,r.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,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,r.jsxs)("span",{className:"font-medium",children:["ثبت نام در رویداد (",0===e.price?"رایگان":"".concat((0,q.$g)(e.price)," تومان"),")"]}),(0,r.jsx)(G.A,{className:"h-4 w-4 group-hover/btn:translate-x-1 transition-transform"})]}),(0,r.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,r.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 px-2 sm:px-0",children:C.map(e=>(0,r.jsx)(ea,{event:e},e.id))}),!w&&(0,r.jsx)("div",{className:"text-center mt-12 text-gray-500",children:(0,r.jsx)("p",{children:C.length>0?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"font-semibold text-playmo-purple-600",children:C.length})," رویداد یافت شد"]}):null})})]}),(0,r.jsx)(H.q,{open:j,onOpenChange:b,baleUrl:"https://ble.ir/".concat(er.env.NEXT_PUBLIC_BALE_BOT_USERNAME||"playmobot"),telegramUrl:"https://t.me/".concat(er.env.NEXT_PUBLIC_TELEGRAM_BOT_USERNAME||"tel_playmobot")})]})}},58779:(e,s,a)=>{"use strict";a.d(s,{Fi:()=>x,Mk:()=>c,NP:()=>o,Or:()=>l,WV:()=>i,aR:()=>d,oC:()=>m,pJ:()=>n});var r=a(4368),t=a.n(r);function l(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"jYYYY/jMM/jDD";try{return t().utc(e).add(3.5,"hours").format(s)}catch(e){return"تاریخ نامشخص"}}function n(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{dateFormat:a="jYYYY/jMM/jDD",timeFormat:r="HH:mm",separator:l=" - "}=s;try{let s=t().utc(e).add(3.5,"hours"),n=s.format(a),i=s.format(r);return"".concat(n).concat(l).concat(i)}catch(e){return"تاریخ نامشخص"}}function i(e){let s=t()(e);return{year:s.jYear(),month:s.jMonth()+1,day:s.jDate()}}function c(e,s,a){return t()("".concat(e,"/").concat(s,"/").concat(a),"jYYYY/jM/jD").toDate()}function d(e){return["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"][e-1]||""}function o(){return["ش","ی","د","س","چ","پ","ج"]}function x(e,s){return t().jDaysInMonth(e,s-1)}function m(e,s){return(t()("".concat(e,"/").concat(s,"/1"),"jYYYY/jM/jD").day()+1)%7}},64269:(e,s,a)=>{"use strict";a.d(s,{cn:()=>l});var r=a(2821),t=a(75889);function l(){for(var e=arguments.length,s=Array(e),a=0;a<e;a++)s[a]=arguments[a];return(0,t.QP)((0,r.$)(s))}},65142:(e,s,a)=>{"use strict";a.d(s,{p:()=>l});var r=a(95155);a(12115);var t=a(64269);function l(e){let{className:s,type:a,...l}=e;return(0,r.jsx)("input",{type:a,"data-slot":"input",className:(0,t.cn)("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",s),...l})}},66091:(e,s,a)=>{"use strict";function r(){return"/auth/customer/signin"}function t(){return"/auth/customer/signup/phone"}function l(){return"/auth/business/signin"}function n(){return"/auth/business/signup/phone"}function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"customer";return"business"===e?"/auth/business/forgot-password":"/auth/customer/forgot-password"}a.d(s,{Ku:()=>t,O$:()=>i,aC:()=>l,al:()=>n,kk:()=>r})},85897:(e,s,a)=>{"use strict";a.d(s,{BK:()=>c,eu:()=>i,q5:()=>d});var r=a(95155),t=a(12115),l=a(46591),n=a(64269);let i=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,r.jsx)(l.bL,{ref:s,className:(0,n.cn)("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",a),...t})});i.displayName=l.bL.displayName;let c=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,r.jsx)(l._V,{ref:s,className:(0,n.cn)("aspect-square h-full w-full",a),...t})});c.displayName=l._V.displayName;let d=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,r.jsx)(l.H4,{ref:s,className:(0,n.cn)("flex h-full w-full items-center justify-center rounded-full bg-muted",a),...t})});d.displayName=l.H4.displayName},86600:(e,s,a)=>{"use strict";a.d(s,{C:()=>l});var r=a(12115);let t={};function l(e,s){let[a,l]=(0,r.useState)(()=>e&&t[e]?t[e].data:null),[n,i]=(0,r.useState)(null),[c,d]=(0,r.useState)(()=>!!e&&!t[e]),[o,x]=(0,r.useState)(!1),m=async function(){let s=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(e){(s||!t[e])&&d(!0),x(!0);try{let s=await fetch(e);if(!s.ok)throw Error("HTTP error! status: ".concat(s.status));let a=await s.json();t[e]={data:a,timestamp:Date.now()},l(a),i(null)}catch(s){console.error("Error fetching URL: ".concat(e),s),i(s)}finally{d(!1),x(!1)}}};return(0,r.useEffect)(()=>{e&&(t[e]?(l(t[e].data),d(!1)):(l(null),d(!0)),m())},[e]),(0,r.useEffect)(()=>{if(!e||(null==s?void 0:s.revalidateOnFocus)===!1)return;let a=()=>{m()};return window.addEventListener("focus",a),()=>{window.removeEventListener("focus",a)}},[e,null==s?void 0:s.revalidateOnFocus]),(0,r.useEffect)(()=>{if(!e||!(null==s?void 0:s.refreshInterval))return;let a=setInterval(()=>{m()},s.refreshInterval);return()=>clearInterval(a)},[e,null==s?void 0:s.refreshInterval]),{data:a,error:n,isLoading:c,isValidating:o,mutate:function(s){let r=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(e){if(void 0!==s){let r="function"==typeof s?s(a):s;t[e]={data:r,timestamp:Date.now()},l(r)}r&&m()}}}}},86948:(e,s,a)=>{"use strict";a.d(s,{BT:()=>c,Wu:()=>d,ZB:()=>i,Zp:()=>l,aR:()=>n});var r=a(95155);a(12115);var t=a(64269);function l(e){let{className:s,...a}=e;return(0,r.jsx)("div",{"data-slot":"card",className:(0,t.cn)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",s),...a})}function n(e){let{className:s,...a}=e;return(0,r.jsx)("div",{"data-slot":"card-header",className:(0,t.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",s),...a})}function i(e){let{className:s,...a}=e;return(0,r.jsx)("div",{"data-slot":"card-title",className:(0,t.cn)("leading-none font-semibold",s),...a})}function c(e){let{className:s,...a}=e;return(0,r.jsx)("div",{"data-slot":"card-description",className:(0,t.cn)("text-muted-foreground text-sm",s),...a})}function d(e){let{className:s,...a}=e;return(0,r.jsx)("div",{"data-slot":"card-content",className:(0,t.cn)("px-6",s),...a})}}},e=>{e.O(0,[7620,8501,6489,3148,8720,1691,5239,6524,8394,9731,8945,4623,7358],()=>e(e.s=27790)),_N_E=e.O()}]);