(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8634],{25913:(e,s,t)=>{"use strict";t.d(s,{W:()=>n});var a=t(12115),r=t(16536);let l="playmo_selected_city";function n(e,s,t){let[n,i]=(0,a.useState)("همه");(0,a.useEffect)(()=>{try{let e=localStorage.getItem(l);if(e)i(e);else if(t){let e=(0,r.dM)(t);e&&i(e)}}catch(e){}},[t]),(0,a.useEffect)(()=>{let e=e=>{e.key===l&&e.newValue&&i(e.newValue)};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[]);let o=(0,a.useCallback)(e=>{i(e);try{localStorage.setItem(l,e)}catch(e){}},[]),c=(0,a.useMemo)(()=>{let t={};for(let a of e){let e=s(a);if(!e)continue;let l=(0,r.dM)(e);t[l]=(t[l]||0)+1}return t},[e,s]),d=(0,a.useMemo)(()=>{let s={name:"همه",count:e.length,hasItems:e.length>0},t=[],a=[],l=new Set;for(let e of r.Fq){l.add(e);let s=c[e]||0;s>0?t.push({name:e,count:s,hasItems:!0}):a.push({name:e,count:0,hasItems:!1})}for(let e of Object.keys(c))!l.has(e)&&c[e]>0&&t.push({name:e,count:c[e],hasItems:!0});return t.sort((e,s)=>s.count-e.count),[s,...t,...a]},[e.length,c]),m=(0,a.useCallback)(e=>{if("همه"===n)return!0;if(!e)return!1;let s=(0,r.dM)(e),t=(0,r.Tb)(n);return s===n||e.toLowerCase()===t.toLowerCase()},[n]);return{selectedCity:n,setSelectedCity:o,smartCities:d,matchesCity:m,cityCounts:c}}},27790:(e,s,t)=>{Promise.resolve().then(t.bind(t,62316))},62316:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>ec});var a=t(95155),r=t(3998),l=t(86948),n=t(65142),i=t(11647),o=t(10774),c=t(12115),d=t(85897),m=t(51834),x=t(56154),u=t(39347),h=t(95740),p=t(95322),g=t(68854),f=t(59865),b=t(91169),v=t(83457),j=t(16645),w=t(56210),N=t(18720),y=t(95767),E=t(36489),k=t(52619),A=t.n(k),C=t(96093),S=t(6490);function P(e){var s,t;let{participant:r}=e,[l,n]=(0,c.useState)(!1),[i,o]=(0,c.useState)(!1),m=!r.avatar&&!!r.archetype,x=m?(0,S.Al)(r.archetype):null,u=(0,C.g0)(r.avatar,r.archetype);return(0,a.jsx)(d.eu,{className:"w-16 h-16 sm:w-20 sm:h-20 relative overflow-hidden transition-transform duration-300 group-hover:scale-105",children:u&&!l?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("img",{src:u,alt:r.name||"",className:"w-full h-full object-cover rounded-full ".concat(i?"opacity-100":"opacity-0"),onLoad:()=>o(!0),onError:()=>n(!0)}),!i&&(0,a.jsx)(d.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"}),m&&x&&i&&(0,a.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,a.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:x})})]}):(0,a.jsx)(d.q5,{className:"text-xl font-bold bg-gray-50 text-gray-400",children:(null==(t=r.name)?void 0:t.slice(0,1).toUpperCase())||"U"})})}function L(e){let{isOpen:s,onClose:t,eventId:l,eventTitle:n}=e,{data:i,status:o}=(0,E.useSession)(),[d,k]=(0,c.useState)(null),[C,S]=(0,c.useState)(!1),[L,z]=(0,c.useState)(null),[T,D]=(0,c.useState)(!1),[I,R]=(0,c.useState)(!1);(0,c.useEffect)(()=>{s&&l&&"authenticated"===o&&O()},[s,l,o]);let O=async()=>{try{S(!0);let e=await fetch("/api/events/".concat(l,"/participants"));if(401===e.status)return;let s=await e.json();s.success?k(s.data):N.o.error(s.error||"خطا در دریافت اطلاعات شرکت‌کنندگان")}catch(e){console.error("خطا در دریافت شرکت‌کنندگان:",e),N.o.error("خطا در دریافت اطلاعات")}finally{S(!1)}},B=async e=>{if(I||e.isExternal||!e.id)return;let s={id:e.id,name:e.name,avatar:e.avatar,archetype:e.archetype||null,role:"CUSTOMER",city:null,isPlayMaster:!1};try{R(!0);let t=await fetch("/api/user/profile/".concat(e.id)),a=await t.json();t.ok&&a.success&&a.data?z(a.data):z(s),D(!0)}catch(e){console.error("Error fetching participant profile:",e),z(s),D(!0)}finally{R(!1)}};return C||"loading"===o?(0,a.jsx)(m.lG,{open:s,onOpenChange:t,children:(0,a.jsxs)(m.Cf,{className:"sm:max-w-md rounded-3xl",dir:"rtl",showCloseButton:!1,children:[(0,a.jsx)(m.c7,{children:(0,a.jsx)(m.L3,{className:"text-right mr-4",children:"شرکت‌کنندگان"})}),(0,a.jsx)("div",{className:"flex items-center justify-center p-12",children:(0,a.jsx)(w.LoadingSpinner,{size:"lg"})})]})}):"unauthenticated"===o?(0,a.jsx)(m.lG,{open:s,onOpenChange:t,children:(0,a.jsx)(m.Cf,{className:"sm:max-w-md rounded-3xl p-8",dir:"rtl",showCloseButton:!1,children:(0,a.jsxs)("div",{className:"text-center space-y-6",children:[(0,a.jsx)("div",{className:"w-20 h-20 bg-blue-50 rounded-full flex items-center justify-center mx-auto",children:(0,a.jsx)(f.A,{className:"w-10 h-10 text-blue-500"})}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("h3",{className:"text-xl font-bold text-gray-800",children:"مشاهده شرکت‌کنندگان"}),(0,a.jsx)("p",{className:"text-gray-500 text-sm leading-relaxed",children:"برای مشاهده لیست شرکت‌کنندگان در این رویداد، لطفاً وارد حساب کاربری خود شوید یا ثبت‌نام کنید."})]}),(0,a.jsxs)("div",{className:"grid gap-3",children:[(0,a.jsx)(A(),{href:"/auth/customer/signin",className:"w-full",children:(0,a.jsx)(r.$,{className:"w-full h-11 text-base font-medium bg-playmo-purple-600 hover:bg-playmo-purple-700",children:"ورود به حساب کاربری"})}),(0,a.jsx)(A(),{href:"/auth/customer/signup",className:"w-full",children:(0,a.jsx)(r.$,{variant:"outline",className:"w-full h-11 text-base font-medium border-gray-300 text-gray-700 hover:bg-gray-50",children:"ثبت‌نام در پلیمو"})})]})]})})}):d?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(m.lG,{open:s,onOpenChange:t,children:(0,a.jsxs)(m.Cf,{className:"sm:max-w-lg max-h-[85vh] overflow-y-auto no-scrollbar [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden rounded-[2rem] p-0 !border-0 !ring-0 !outline-none shadow-2xl bg-white/95 backdrop-blur-xl",dir:"rtl",showCloseButton:!1,children:[(0,a.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,a.jsxs)("div",{className:"flex items-center gap-2 text-gray-800",children:[(0,a.jsx)(b.A,{className:"w-5 h-5 text-playmo-purple-600"}),(0,a.jsxs)("span",{className:"font-bold text-lg",children:[d.total," شرکت‌کننده"]})]}),(0,a.jsx)(m.L3,{className:"hidden",children:"لیست شرکت‌کنندگان"})," ",(0,a.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,a.jsx)("div",{className:"p-6",children:(0,a.jsx)("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-y-8 gap-x-4",children:d.allParticipants.length>0?d.allParticipants.map(e=>{var s;return(0,a.jsxs)("div",{className:"flex flex-col items-center group cursor-pointer",onClick:()=>!e.isExternal&&B(e),children:[(0,a.jsxs)("div",{className:"relative mb-2",children:[(0,a.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,a.jsx)(P,{participant:e})}),e.isFriend&&(0,a.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,a.jsx)(v.A,{className:"w-3 h-3 text-white fill-current"})}),!e.isFriend&&e.isTeammate&&(0,a.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,a.jsx)(j.A,{className:"w-3 h-3 text-white hover:rotate-12 transition-transform"})}),!e.isExternal&&(0,a.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,a.jsx)("div",{className:"w-3.5 h-3.5 flex items-center justify-center",children:(e=>{switch(e){case"⚡":return(0,a.jsx)(x.A,{className:"w-full h-full stroke-[1.5]"});case"⭐":return(0,a.jsx)(u.A,{className:"w-full h-full stroke-[1.5]"});case"\uD83D\uDCAB":return(0,a.jsx)(h.A,{className:"w-full h-full stroke-[1.5]"});case"\uD83D\uDC8E":return(0,a.jsx)(p.A,{className:"w-full h-full stroke-[1.5]"});case"\uD83D\uDC51":return(0,a.jsx)(g.A,{className:"w-full h-full stroke-[1.5]"});default:return(0,a.jsx)("span",{className:"text-sm",children:e||"\uD83C\uDF31"})}})(e.currentLevelIcon)})}),e.isExternal&&(0,a.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,a.jsx)("span",{className:"text-[9px] font-bold text-white",children:"خارجی"})})]}),(0,a.jsx)("div",{className:"text-center w-full",children:(0,a.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,a.jsxs)("div",{className:"col-span-full text-center py-16 text-gray-400",children:[(0,a.jsx)("div",{className:"w-20 h-20 bg-gray-50 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,a.jsx)(b.A,{className:"w-10 h-10 text-gray-300"})}),(0,a.jsx)("p",{className:"text-gray-500 font-medium",children:"هنوز کسی ثبت نام نکرده"})]})})})]})}),(0,a.jsx)(y.A,{isOpen:T,user:L,onClose:()=>{D(!1),z(null)},isCurrentUser:!!((null==i?void 0:i.user)&&i.user.id===(null==L?void 0:L.id))})]}):null}var z=t(6132),T=t(52056),D=t(89559),I=t(65993),R=t(20063);function O(){return{handleError:c.useCallback((e,s)=>{console.error("Error in ".concat(s||"component",":"),e),N.o.error("خطایی رخ داد",{description:e.message||"خطای غیرمنتظره‌ای رخ داده است"})},[])}}function B(e){var s;let{participant:t}=e,[r,l]=(0,c.useState)(!1),n=(0,C.g0)(t.avatar,t.archetype);return(0,a.jsx)(d.eu,{className:"w-7 h-7",children:n&&!r?(0,a.jsx)("img",{src:n,alt:t.name||"کاربر",className:"w-full h-full object-cover rounded-full",onError:()=>l(!0)}):(0,a.jsx)(d.q5,{className:"text-[9px]",children:(null==(s=t.name)?void 0:s.slice(0,2).toUpperCase())||"U"})})}function F(e){let{eventId:s,eventTitle:t,maxPlayers:l,registeredPlayers:n}=e,[o,d]=(0,c.useState)(null),[m,x]=(0,c.useState)(!1),[u,h]=(0,c.useState)(null),[p,g]=(0,c.useState)(!1),{handleError:f}=O(),{handleAsyncError:j}=function(){let{handleError:e}=O();return{handleAsyncError:c.useCallback(async(s,t)=>{try{return await s()}catch(s){return e(s instanceof Error?s:Error(String(s)),t),null}},[e])}}(),w=(0,c.useCallback)(async()=>{let e=await j(async()=>{x(!0),h(null);let e=await fetch("/api/events/".concat(s,"/participants"));if(!e.ok)throw Error("HTTP ".concat(e.status,": ").concat(e.statusText));let t=await e.json();if(!t.success){var a;throw Error((null==(a=t.error)?void 0:a.message)||"خطا در دریافت اطلاعات شرکت‌کنندگان")}return t.data},"EventParticipants.fetchParticipants");e?d(e):h("خطا در بارگیری شرکت‌کنندگان"),x(!1)},[s,j]),N=(0,c.useCallback)(()=>{w()},[w]);if((0,c.useEffect)(()=>{w()},[w]),m)return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("div",{className:"animate-pulse flex gap-1",children:[(0,a.jsx)("div",{className:"w-6 h-6 bg-gray-200 rounded-full"}),(0,a.jsx)("div",{className:"w-6 h-6 bg-gray-200 rounded-full"}),(0,a.jsx)("div",{className:"w-6 h-6 bg-gray-200 rounded-full"})]}),(0,a.jsx)("span",{className:"text-sm text-gray-500",children:"در حال بارگذاری..."})]});if(u)return(0,a.jsxs)("div",{className:"flex items-center gap-2 text-red-500",children:[(0,a.jsx)(z.A,{size:16}),(0,a.jsx)("span",{className:"text-sm",children:u}),(0,a.jsx)(r.$,{variant:"ghost",size:"sm",onClick:N,className:"text-xs",children:"تلاش مجدد"})]});if(!o||0===o.total)return"number"==typeof n&&n>0?(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,a.jsx)(b.A,{className:"w-4 h-4 text-gray-500"}),(0,a.jsxs)("span",{className:"text-gray-700",children:[n,"/",l]})]}):(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,a.jsx)(b.A,{className:"w-4 h-4"}),(0,a.jsxs)("span",{children:["0/",l]})]});let y=Math.min(o.participants.length,3);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"flex items-center cursor-pointer hover:scale-105 transition-transform",onClick:()=>{g(!0)},children:o.participants.slice(0,y).map((e,s)=>e&&e.id?(0,a.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,a.jsx)(B,{participant:e})},e.id):null).filter(Boolean)}),(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,a.jsx)(b.A,{className:"w-4 h-4 text-gray-500"}),(0,a.jsxs)("span",{className:"text-gray-700",children:[null!=n?n:o.total,"/",l]}),o.friendsCount>0&&(0,a.jsxs)(i.E,{variant:"secondary",className:"gap-1 px-2 py-0.5 text-xs",children:[(0,a.jsx)(v.A,{className:"w-3 h-3"}),o.friendsCount," دوست"]})]})]}),(0,a.jsx)(L,{isOpen:p,onClose:()=>{g(!1)},eventId:s,eventTitle:t})]})}c.Component;var M=t(6191),_=t(86651),$=t(30940),U=t(94610),V=t(16485),q=t(26983),G=t(78519),Y=t(61362),W=t(21873),H=t(52987),Z=t(15239),K=t(51950),X=t(58779),Q=t(86600),J=t(66091),ee=t(16536);let es=e=>{let{event:s}=e,[t,r]=c.useState(!1),n=function(e){return e.mainImage?(0,C.zL)([e.mainImage])[0]:e.images&&e.images.length>0?(0,C.zL)(e.images)[0]:e.genre?(0,C.eI)(e.genre):null}(s),o=!!(n&&!t),d="PLAYER_TABLE"===s.type||"PLAYER_TABLE"===s.eventType,m=s.registeredPlayers>=s.maxPlayers;return(0,a.jsx)(A(),{href:"/events/".concat(s.id),children:(0,a.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,a.jsx)("div",{className:"absolute inset-0 z-0 bg-gray-950",children:o?(0,a.jsx)(Z.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,C.Vd)(n),onError:()=>r(!0)}):(0,a.jsx)("div",{className:"w-full h-full bg-[#ffa515] flex items-center justify-center p-6",children:(0,a.jsx)("div",{className:"relative w-1/2",style:{aspectRatio:"169.26/53.85"},children:(0,a.jsx)(Z.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,a.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,a.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,a.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(0,a.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(d?"bg-playmo-purple-600/90":"bg-playmo-blue-600/90"),children:(0,a.jsx)("span",{children:d?"\uD83D\uDC51 پلی‌مستر":"☕ کافه"})}),!1===s.requiresApproval&&(0,a.jsxs)(i.E,{className:"h-6 rounded-lg bg-gradient-to-r from-amber-500 to-yellow-500 border border-amber-300/40 text-white text-[10px] sm:text-[11px] font-semibold flex items-center gap-1 px-2 shadow-xs backdrop-blur-md",children:[(0,a.jsx)(h.A,{className:"w-3 h-3 text-yellow-100"}),(0,a.jsx)("span",{children:"⚡ پذیرش فوری"})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1 items-end",children:["PENDING"===s.userBookingStatus?(0,a.jsxs)(i.E,{className:"h-5 rounded-lg bg-amber-500/90 border border-amber-300/40 text-white text-[9px] sm:text-[10px] px-1.5 flex items-center gap-1 shadow-xs",children:[(0,a.jsx)(q.A,{className:"w-2.5 h-2.5"}),(0,a.jsx)("span",{children:"در انتظار تایید"})]}):"PENDING_PAYMENT"===s.userBookingStatus?(0,a.jsxs)(i.E,{className:"h-5 rounded-lg bg-gradient-to-r from-emerald-600/95 to-teal-600/95 border border-emerald-300/40 text-white text-[9px] sm:text-[10px] px-1.5 flex items-center gap-1 shadow-xs animate-pulse",children:[(0,a.jsx)(G.A,{className:"w-2.5 h-2.5"}),(0,a.jsx)("span",{children:"در انتظار پرداخت"})]}):"CONFIRMED"===s.userBookingStatus||"PAID"===s.userBookingStatus||"COMPLETED"===s.userBookingStatus||s.isRegistered&&!s.userBookingStatus?(0,a.jsxs)(i.E,{className:"h-5 rounded-lg bg-green-500/90 border-0 text-white text-[9px] sm:text-[10px] px-1.5 flex items-center gap-1",children:[(0,a.jsx)(Y.A,{className:"w-2.5 h-2.5"}),(0,a.jsx)("span",{children:"ثبت نام شده"})]}):null,m&&(0,a.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,a.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,a.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,a.jsx)("h3",{className:"text-sm sm:text-base font-bold text-white leading-tight line-clamp-1 drop-shadow-sm",children:s.title}),(0,a.jsxs)("div",{className:"flex items-center justify-between text-[10px] sm:text-[11px] text-white/80",children:[(0,a.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,a.jsx)(V.A,{className:"h-3 w-3 text-white/60 ml-0.5 inline"}),(0,a.jsx)("span",{children:(0,X.Or)(s.date)})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(b.A,{className:"h-3 w-3 text-white/60 ml-0.5 inline"}),(0,a.jsxs)("span",{children:[s.registeredPlayers,"/",s.maxPlayers]})]})]})]})]})})};var et=t(85898),ea=t(25913),er=t(99624),el=t(94897),en=t(73618),ei=t(77733),eo=t(41751);function ec(){var e,s,t,d;let[m,x]=(0,c.useState)(""),[p,g]=(0,c.useState)("همه"),[f,v]=(0,c.useState)("grid"),[j,w]=(0,c.useState)(!1),[N,y]=(0,c.useState)(!1),[k,S]=(0,c.useState)(!1),[P,L]=(0,c.useState)(!1),{data:z,update:T}=(0,E.useSession)(),D=(0,R.useRouter)(),{data:I,mutate:O}=(0,Q.C)((null==z?void 0:z.user)?"/api/user/gamification-progress":null),B=null==I?void 0:I.data,ec=(null!=(d=null==B?void 0:B.level)?d:0)>=1,ed=(0,eo.d)(B,null==z?void 0:z.user),em=()=>(null==z?void 0:z.user)?z.user.archetype?ed?void w(!0):void L(!0):void y(!0):void D.push((0,J.kk)()+"?callbackUrl=/events"),ex=()=>{if(!(null==z?void 0:z.user))return void D.push((0,J.kk)()+"?callbackUrl=/events");ec?em():S(!0)},eu=async e=>{T&&await T(e?{archetype:e}:void 0),y(!1),setTimeout(()=>{ed?w(!0):L(!0)},150)},eh=async()=>{try{O&&await O()}catch(e){console.error("Failed to sync gamification cache after username registration",e)}setTimeout(()=>{w(!0)},150)},{data:ep,isLoading:eg,error:ef,mutate:eb}=(0,Q.C)("/api/events"),ev=(null==ep||null==(e=ep.data)?void 0:e.events)||[];(0,c.useEffect)(()=>{let e=()=>{eb()};return window.addEventListener("event-updated",e),()=>window.removeEventListener("event-updated",e)},[eb]);let ej=c.useCallback(e=>{var s;return null==(s=e.cafe)?void 0:s.city},[]),{selectedCity:ew,setSelectedCity:eN,smartCities:ey,matchesCity:eE}=(0,ea.W)(ev,ej,null==z||null==(s=z.user)?void 0:s.city),ek=c.useMemo(()=>ev.filter(e=>{var s;let t=e.title.toLowerCase().includes(m.toLowerCase())||e.game.toLowerCase().includes(m.toLowerCase()),a="PLAYER_TABLE"===e.type||"PLAYER_TABLE"===e.eventType,r="همه"===p||"کافه"===p&&!a||"پلی‌مستر"===p&&a;return t&&r&&eE(null==(s=e.cafe)?void 0:s.city)}),[ev,m,p,eE]);return(0,a.jsxs)("div",{className:"min-h-screen bg-gradient-to-br from-playmo-blue-50 via-white to-playmo-purple-50",children:[(0,a.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,a.jsx)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:(0,a.jsxs)("div",{className:"flex items-center justify-between h-16",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-4 space-x-reverse",children:[(0,a.jsx)(o.U,{}),(0,a.jsx)("div",{className:"h-6 w-px bg-gray-300 hidden sm:block"}),(0,a.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,a.jsx)("h1",{className:"text-xl sm:text-2xl font-bold text-gray-900",children:"رویدادها"}),(0,a.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,K.ub)(ek.length)," رویداد"]})]})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2 sm:space-x-3 space-x-reverse",children:[(0,a.jsxs)("div",{className:"hidden md:flex items-center space-x-4 space-x-reverse",children:[(0,a.jsx)(A(),{href:"/",children:(0,a.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,a.jsx)(Z.default,{src:"/icon-playmo.png",alt:"آرشین‌ها",width:20,height:20,className:"w-5 h-5 object-contain"}),(0,a.jsx)("span",{children:"آرشـین‌ها"})]})}),(0,a.jsx)(A(),{href:"/cafes",children:(0,a.jsx)(r.$,{variant:"ghost",size:"sm",children:"کافه‌گیم‌ها"})}),(0,a.jsx)(r.$,{onClick:ex,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:ec?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-sm",children:"⚡"}),"ارتقای پاداش (۳٪)"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-sm",children:"\uD83D\uDC51"}),"پلی‌مستر شو"]})}),(null==z?void 0:z.user)?(0,a.jsx)(A(),{href:(()=>{var e;if(!(null==z?void 0:z.user))return"/auth/customer/signin";switch(null==(e=z.user)?void 0:e.role){case"ADMIN":case"SUPER_ADMIN":return"/admin-dashboard";case"CAFE_OWNER":return"/business-dashboard";default:return"/dashboard"}})(),children:(0,a.jsx)(r.$,{variant:"ghost",size:"sm",children:"داشبورد"})}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(A(),{href:(0,J.kk)(),children:(0,a.jsx)(r.$,{variant:"ghost",size:"sm",children:"ورود"})}),(0,a.jsx)(A(),{href:(0,J.Ku)(),children:(0,a.jsx)(r.$,{variant:"outline",size:"sm",children:"ثبت نام"})})]})]}),(null==z?void 0:z.user)&&(null==(t=z.user)?void 0:t.role)==="CAFE_OWNER"?(0,a.jsx)(A(),{href:"/business-dashboard/events/new",className:"block sm:hidden",children:(0,a.jsx)("div",{className:"flex items-center justify-center w-16 h-16",children:(0,a.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,a.jsx)(M.A,{className:"h-6 w-6"})})})}):(0,a.jsx)("div",{className:"block sm:hidden flex items-center",children:(0,a.jsx)(r.$,{onClick:ex,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:ec?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-sm",children:"⚡"}),"ارتقای پاداش (۳٪)"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-sm",children:"\uD83D\uDC51"}),"پلی‌مستر شو"]})})}),(0,a.jsx)(et.r,{})]})]})}),(0,a.jsx)("div",{className:"hidden sm:block border-t border-gray-100 bg-gray-50/50",children:(0,a.jsx)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-3",children:(0,a.jsx)("p",{className:"text-sm text-gray-600 text-center",children:"بهترین رویدادها را پیدا کنید"})})})]}),(0,a.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,a.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,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(_.A,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-5 w-5"}),(0,a.jsx)(n.p,{placeholder:"جستجو در رویدادها و بازی‌ها...",value:m,onChange:e=>x(e.target.value),className:"pr-10 text-right h-11 rounded-2xl border-gray-200 bg-white/60 focus:bg-white transition-colors"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 pt-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"text-xs font-semibold text-gray-500 whitespace-nowrap min-w-[44px] text-right",children:"دسته:"}),(0,a.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,a.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,a.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,a.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,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"text-xs font-semibold text-gray-500 whitespace-nowrap min-w-[44px] text-right",children:"شهر:"}),(0,a.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:ey.map(e=>{let s=ew===e.name;return(0,a.jsxs)(r.$,{variant:s?"default":"outline",size:"sm",onClick:()=>eN(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,a.jsx)("span",{children:e.name}),e.count>0&&(0,a.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,K.ub)(e.count)})]},e.name)})})]})]})]})}),(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6 px-2 sm:px-0 select-none animate-fade-in",children:[(0,a.jsxs)("div",{className:"text-sm text-gray-500 font-medium text-right",children:["تعداد رویدادها: ",(0,a.jsx)("span",{className:"font-bold text-gray-800",children:ek.length})]}),(0,a.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,a.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,a.jsx)($.A,{className:"h-4 w-4"})}),(0,a.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,a.jsx)(U.A,{className:"h-4 w-4"})})]})]}),eg?"grid"===f?(0,a.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,a.jsxs)(l.Zp,{className:"animate-pulse border-0 shadow-md rounded-3xl mx-2",children:[(0,a.jsx)("div",{className:"aspect-video bg-gray-200 rounded-3xl"}),(0,a.jsxs)(l.Wu,{className:"p-6 space-y-4",children:[(0,a.jsx)("div",{className:"h-5 bg-gray-200 rounded w-1/3 mb-2"}),(0,a.jsx)("div",{className:"h-4 bg-gray-200 rounded w-full"}),(0,a.jsx)("div",{className:"h-4 bg-gray-200 rounded w-5/6"}),(0,a.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,a.jsx)("div",{className:"h-4 bg-gray-200 rounded w-3/4"}),(0,a.jsx)("div",{className:"h-4 bg-gray-200 rounded w-1/2"})]}),(0,a.jsx)("div",{className:"h-10 bg-gray-200 rounded-xl mt-4"})]})]},s))}):(0,a.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,a.jsx)(l.Zp,{className:"animate-pulse border-0 shadow-md rounded-3xl aspect-[4/3] bg-gray-200 mx-1"},s))}):0===ek.length?(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)(V.A,{className:"w-16 h-16 mx-auto mb-4 text-gray-300"}),(0,a.jsx)("p",{className:"text-lg text-gray-500",children:"هیچ رویدادی یافت نشد"}),(0,a.jsx)("p",{className:"text-sm text-gray-400 mb-4",children:"لطفاً فیلترهای جستجو را تغییر دهید"}),(0,a.jsx)(r.$,{variant:"outline",onClick:()=>{x(""),g("همه"),eN("همه")},children:"پاک کردن فیلترها"})]}):"grid"===f?(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 px-4 sm:px-0",children:ek.map(e=>(0,a.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,a.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,C.zL)([e.mainImage])[0]:e.images&&e.images.length>0?(0,C.zL)(e.images)[0]:e.genre?(0,C.eI)(e.genre):null;return s?(0,a.jsx)(Z.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,C.Vd)(s),onError:e=>{e.currentTarget.style.display="none"}}):(0,a.jsx)("div",{className:"w-full h-full bg-[#ffa515] flex items-center justify-center p-6",children:(0,a.jsx)("div",{className:"relative w-1/3",style:{aspectRatio:"169.26/53.85"},children:(0,a.jsx)(Z.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,a.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 via-black/20 to-transparent"}),(0,a.jsx)("div",{className:"absolute bottom-4 left-4 right-4 z-10",children:(0,a.jsxs)("div",{className:"text-white",children:[(0,a.jsx)("div",{className:"text-2xl font-bold mb-1 drop-shadow-lg",children:e.game}),(0,a.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,a.jsxs)("div",{className:"absolute top-3 right-3 flex flex-col gap-2 z-10",children:["PENDING"===e.userBookingStatus?(0,a.jsxs)(i.E,{className:"bg-amber-500/90 hover:bg-amber-500 text-white border border-amber-300/40 shadow-sm flex items-center gap-1",children:[(0,a.jsx)(q.A,{className:"w-3 h-3"}),(0,a.jsx)("span",{children:"در انتظار تایید"})]}):"PENDING_PAYMENT"===e.userBookingStatus?(0,a.jsxs)(i.E,{className:"bg-gradient-to-r from-emerald-600/95 to-teal-600/95 text-white border border-emerald-300/40 shadow-sm flex items-center gap-1 animate-pulse",children:[(0,a.jsx)(G.A,{className:"w-3 h-3"}),(0,a.jsx)("span",{children:"در انتظار پرداخت"})]}):"CONFIRMED"===e.userBookingStatus||"PAID"===e.userBookingStatus||"COMPLETED"===e.userBookingStatus||e.isRegistered&&!e.userBookingStatus?(0,a.jsxs)(i.E,{className:"bg-green-500/90 text-white border-0 shadow-sm flex items-center gap-1",children:[(0,a.jsx)(Y.A,{className:"w-3 h-3"}),(0,a.jsx)("span",{children:"ثبت نام شده"})]}):null,e.registeredPlayers>=e.maxPlayers&&(0,a.jsx)(i.E,{variant:"destructive",className:"bg-red-500/90 text-white border-0",children:"تکمیل ظرفیت"})]}),(0,a.jsxs)("div",{className:"absolute top-3 left-3 flex flex-col gap-2 z-10",children:["PLAYER_TABLE"===e.type||"PLAYER_TABLE"===e.eventType?(0,a.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,a.jsx)(i.E,{className:"bg-playmo-blue-600/90 text-white border-0 shadow-sm backdrop-blur-sm text-xs font-semibold",children:"☕ کافه"}),!1===e.requiresApproval&&(0,a.jsxs)(i.E,{className:"bg-gradient-to-r from-amber-500 to-yellow-500 text-white border-amber-300/40 shadow-sm backdrop-blur-sm text-xs font-semibold flex items-center gap-1",children:[(0,a.jsx)(h.A,{className:"w-3 h-3 text-yellow-100"}),(0,a.jsx)("span",{children:"⚡ پذیرش فوری"})]})]}),(0,a.jsx)("div",{className:"absolute bottom-3 left-3",children:(0,a.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,a.jsx)(b.A,{className:"h-3 w-3 text-playmo-purple-600"}),(0,a.jsxs)("span",{className:"text-gray-700",children:[e.registeredPlayers,"/",e.maxPlayers]})]})})]}),(0,a.jsxs)(l.Wu,{className:"p-6 space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.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,a.jsx)("p",{className:"text-sm text-gray-600 line-clamp-2 leading-relaxed",children:e.description})]}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2 space-x-reverse",children:[(0,a.jsx)("div",{className:"p-1.5 bg-playmo-blue-50 rounded-lg",children:(0,a.jsx)(V.A,{className:"h-4 w-4 text-playmo-blue-600"})}),(0,a.jsx)("span",{className:"text-gray-700 font-medium",children:(0,X.Or)(e.date)})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2 space-x-reverse",children:[(0,a.jsx)("div",{className:"p-1.5 bg-playmo-purple-50 rounded-lg",children:(0,a.jsx)(q.A,{className:"h-4 w-4 text-playmo-purple-600"})}),(0,a.jsx)("span",{className:"text-gray-700 font-medium",children:e.time})]})]}),(0,a.jsx)("div",{className:"flex items-center justify-between",children:(0,a.jsxs)("div",{className:"flex items-center space-x-2 space-x-reverse",children:[(0,a.jsx)("div",{className:"p-1.5 bg-green-50 rounded-lg",children:(0,a.jsx)(W.A,{className:"h-4 w-4 text-green-600"})}),(0,a.jsxs)("div",{className:"flex items-center gap-8",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-gray-900",children:e.cafe.name}),(0,a.jsxs)("span",{className:"text-sm text-gray-600",children:[" . ",(0,ee.dM)(e.cafe.city)]})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-1 space-x-reverse ml-4",children:[(0,a.jsx)(u.A,{className:"h-3 w-3 text-yellow-400 fill-current"}),(0,a.jsx)("span",{className:"text-xs text-gray-600 font-medium",children:e.cafe.rating>0?e.cafe.rating:"بدون امتیاز"})]})]})]})})]}),(0,a.jsx)("div",{className:"flex items-center justify-between",children:(0,a.jsx)(F,{eventId:e.id.toString(),eventTitle:e.title,maxPlayers:e.maxPlayers,registeredPlayers:e.registeredPlayers})}),e.tags&&e.tags.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-1 mb-4",children:[e.tags.slice(0,3).map((e,s)=>(0,a.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,a.jsxs)(i.E,{variant:"outline",className:"text-xs px-2 py-1 border-gray-200 text-gray-500",children:["+",e.tags.length-3]})]}),(0,a.jsx)("div",{className:"mt-4",children:(0,a.jsx)(A(),{href:"/events/".concat(e.id),children:(0,a.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,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b.A,{className:"mr-2 h-4 w-4"}),"ظرفیت تکمیل شده"]}):e.isRegistered?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,a.jsx)("span",{className:"font-medium",children:"مشاهده جزئیات"}),(0,a.jsx)(H.A,{className:"h-4 w-4 group-hover/btn:translate-x-1 transition-transform"})]}),(0,a.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,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,a.jsxs)("span",{className:"font-medium",children:["ثبت نام در رویداد (",0===e.price?"رایگان":"".concat((0,K.$g)(e.price)," تومان"),")"]}),(0,a.jsx)(H.A,{className:"h-4 w-4 group-hover/btn:translate-x-1 transition-transform"})]}),(0,a.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,a.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 px-2 sm:px-0",children:ek.map(e=>(0,a.jsx)(es,{event:e},e.id))}),!eg&&(0,a.jsx)("div",{className:"text-center mt-12 text-gray-500",children:(0,a.jsx)("p",{children:ek.length>0?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"font-semibold text-playmo-purple-600",children:ek.length})," رویداد یافت شد"]}):null})})]}),(0,a.jsx)(er.k,{open:j,onOpenChange:w,userCity:ew}),(0,a.jsx)(el.A,{isOpen:N,onClose:()=>y(!1),onSelectedSuccess:eu,introTitle:"ابتدا آرکی‌تایپ خودتو کشف کن",resultButtonText:"ثبت و ورود به ساخت میز \uD83D\uDE80"}),(0,a.jsx)(ei.V,{open:k,onOpenChange:S,onOpenCreateTable:em,onOpenQuiz:()=>y(!0),onOpenUsernamePrompt:()=>L(!0)}),(0,a.jsx)(en.s,{open:P,onOpenChange:L,onSuccess:eh})]})}},85897:(e,s,t)=>{"use strict";t.d(s,{BK:()=>o,eu:()=>i,q5:()=>c});var a=t(95155),r=t(12115),l=t(46591),n=t(64269);let i=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(l.bL,{ref:s,className:(0,n.cn)("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...r})});i.displayName=l.bL.displayName;let o=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(l._V,{ref:s,className:(0,n.cn)("aspect-square h-full w-full",t),...r})});o.displayName=l._V.displayName;let c=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(l.H4,{ref:s,className:(0,n.cn)("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...r})});c.displayName=l.H4.displayName},86600:(e,s,t)=>{"use strict";t.d(s,{C:()=>n});var a=t(12115);let r={},l={};function n(e,s){var t,n;let i=null!=(t=null==s?void 0:s.staleTime)?t:6e4,o=null==(n=null==s?void 0:s.revalidateOnFocus)||n,c=null==s?void 0:s.refreshInterval,[d,m]=(0,a.useState)(()=>e&&r[e]?r[e].data:null),[x,u]=(0,a.useState)(null),[h,p]=(0,a.useState)(()=>!!e&&!r[e]),[g,f]=(0,a.useState)(!1),b=(0,a.useCallback)(async function(){let s=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!e)return;let t=r[e],a=!t||Date.now()-t.timestamp>=i;if(!s&&!a)return t.data!==d&&m(t.data),p(!1),t.data;t||p(!0),f(!0);try{l[e]||(l[e]=fetch(e).then(async e=>{if(!e.ok)throw Error("HTTP error! status: ".concat(e.status));return await e.json()}).finally(()=>{delete l[e]}));let s=await l[e];return r[e]={data:s,timestamp:Date.now()},m(s),u(null),s}catch(s){console.error("Error fetching URL: ".concat(e),s),u(s)}finally{p(!1),f(!1)}},[e,i,d]);(0,a.useEffect)(()=>{e&&(r[e]?(m(r[e].data),p(!1)):(m(null),p(!0)),b())},[e,i]),(0,a.useEffect)(()=>{if(!e||!o)return;let s=()=>{b()};return window.addEventListener("focus",s),()=>{window.removeEventListener("focus",s)}},[e,o,b]),(0,a.useEffect)(()=>{if(!e||!c)return;let s=setInterval(()=>{b(!0)},c);return()=>clearInterval(s)},[e,c,b]);let v=(0,a.useCallback)(function(s){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(e){if(void 0!==s){let t="function"==typeof s?s(d):s;r[e]={data:t,timestamp:Date.now()},m(t)}t&&b(!0)}},[e,d,b]);return{data:d,error:x,isLoading:h,isValidating:g,mutate:v}}}},e=>{e.O(0,[9268,586,9017,2619,6489,7173,3171,8720,1691,2387,2377,5239,226,6524,9829,9932,1734,1733,6292,8079,1900,8907,5937,7388,6645,6858,774,3948,8441,1255,7358],()=>e(e.s=27790)),_N_E=e.O()}]);