"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6552],{7420:(e,t,s)=>{s.d(t,{W:()=>r});var a=s(95155);function r(e){let{className:t,variant:s="short",...r}=e;return"full"===s?(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 169.26 53.85",className:t,...r,children:(0,a.jsx)("g",{id:"Layer_2","data-name":"Layer 2",children:(0,a.jsxs)("g",{id:"Layer_1-2","data-name":"Layer 1",children:[(0,a.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,a.jsx)("circle",{cx:"143.34",cy:"27.93",r:"25.92",fill:"currentColor"}),(0,a.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,a.jsx)("ellipse",{cx:"72.81",cy:"30.22",rx:"7.44",ry:"2.29",fill:"#ffffff"}),(0,a.jsx)("circle",{cx:"93.25",cy:"30.22",r:"6.18",fill:"#ffffff"})]})})}):(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 57.26 52.41",className:t,...r,children:(0,a.jsx)("g",{id:"Layer_2","data-name":"Layer 2",children:(0,a.jsxs)("g",{id:"Layer_1-2","data-name":"Layer 1",children:[(0,a.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,a.jsx)("ellipse",{cx:"19.04",cy:"30.22",rx:"7.44",ry:"2.29",fill:"#ffffff"}),(0,a.jsx)("circle",{cx:"39.48",cy:"30.22",r:"6.18",fill:"#ffffff"})]})})})}s(12115)},11647:(e,t,s)=>{s.d(t,{E:()=>d});var a=s(95155);s(12115);var r=s(32467),l=s(83101),n=s(64269);let i=(0,l.F)("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-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 transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function d(e){let{className:t,variant:s,asChild:l=!1,...d}=e,o=l?r.DX:"span";return(0,a.jsx)(o,{"data-slot":"badge",className:(0,n.cn)(i({variant:s}),t),...d})}},44254:(e,t,s)=>{s.d(t,{oT:()=>r,u5:()=>a});let a={xs:12,sm:16,md:24,lg:32,xl:48},r={spinner:"animate-spin rounded-full border-2 border-current border-t-transparent",pulse:"animate-pulse bg-gray-200 rounded",skeleton:"animate-pulse bg-gray-200 rounded",dots:"flex space-x-1"}},44846:(e,t,s)=>{s.d(t,{d:()=>n});var a=s(95155);s(12115);var r=s(27599),l=s(64269);function n(e){let{className:t,...s}=e;return(0,a.jsx)(r.bL,{"data-slot":"switch",className:(0,l.cn)("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors outline-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-gray-200 dark:data-[state=unchecked]:bg-gray-700",t),...s,children:(0,a.jsx)(r.zi,{"data-slot":"switch-thumb",className:(0,l.cn)("pointer-events-none block h-5 w-5 rounded-full bg-white shadow-md ring-0 transition-transform data-[state=unchecked]:translate-x-0 data-[state=checked]:translate-x-5 rtl:data-[state=checked]:-translate-x-5")})})}},51834:(e,t,s)=>{s.d(t,{Cf:()=>x,Es:()=>u,L3:()=>h,c7:()=>m,lG:()=>i,rr:()=>p,zM:()=>d});var a=s(95155);s(12115);var r=s(89511),l=s(65229),n=s(64269);function i(e){let{...t}=e;return(0,a.jsx)(r.bL,{"data-slot":"dialog",...t})}function d(e){let{...t}=e;return(0,a.jsx)(r.l9,{"data-slot":"dialog-trigger",...t})}function o(e){let{...t}=e;return(0,a.jsx)(r.ZL,{"data-slot":"dialog-portal",...t})}function c(e){let{className:t,...s}=e;return(0,a.jsx)(r.hJ,{"data-slot":"dialog-overlay",className:(0,n.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/60 backdrop-blur-sm",t),...s})}function x(e){let{className:t,children:s,showCloseButton:i=!0,...d}=e;return(0,a.jsxs)(o,{"data-slot":"dialog-portal",children:[(0,a.jsx)(c,{}),(0,a.jsxs)(r.UC,{"data-slot":"dialog-content",className:(0,n.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...d,children:[s,i&&(0,a.jsxs)(r.bm,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 left-4 rtl:left-4 rtl:right-auto ltr:right-4 ltr:left-auto rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[(0,a.jsx)(l.A,{}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function m(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"dialog-header",className:(0,n.cn)("flex flex-col gap-2 text-center sm:text-left",t),...s})}function u(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"dialog-footer",className:(0,n.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...s})}function h(e){let{className:t,...s}=e;return(0,a.jsx)(r.hE,{"data-slot":"dialog-title",className:(0,n.cn)("text-lg leading-none font-semibold",t),...s})}function p(e){let{className:t,...s}=e;return(0,a.jsx)(r.VY,{"data-slot":"dialog-description",className:(0,n.cn)("text-muted-foreground text-sm",t),...s})}},51950:(e,t,s)=>{function a(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];var s=(t?e:Math.round(e/10)).toLocaleString("fa-IR");let a=["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"],r=["0","1","2","3","4","5","6","7","8","9"];return String(s).replace(/[0-9]/g,e=>a[r.indexOf(e)]).replace(/[٠١٢٣٤٥٦٧٨٩]/g,e=>a[["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"].indexOf(e)])}function r(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],s=a(e);return t?"".concat(s," تومان"):s}s.d(t,{$g:()=>a,dy:()=>r})},56210:(e,t,s)=>{s.d(t,{LoadingSpinner:()=>n});var a=s(95155),r=s(64269),l=s(44254);function n(e){let{size:t="md",type:s="spinner",color:n,message:i,showMessage:d=!1,rtl:o=!0,className:c,show:x=!0,...m}=e;if(!x)return null;let u=l.u5[t],h=(0,a.jsx)("div",{className:(0,r.cn)(l.oT[s],"inline-block flex-shrink-0",n&&"text-".concat(n),c),style:{width:u,height:u,..."spinner"===s&&{borderWidth:"xs"===t?1:2}},...m});return d&&i?(0,a.jsxs)("div",{className:(0,r.cn)("flex items-center gap-2",o&&"flex-row-reverse"),children:[h,(0,a.jsx)("span",{className:"text-sm text-gray-600",children:i})]}):h}},58036:(e,t,s)=>{s.d(t,{k:()=>Y});var a=s(95155),r=s(12115),l=s(51834),n=s(3998),i=s(27937),d=s(90368),o=s(35299),c=s(95740);let x=["10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00","22:00","23:00"],m=["تهران","مشهد","اصفهان","شیراز","کرج","تبریز"],u=["یکشنبه","دوشنبه","سه‌شنبه","چهارشنبه","پنج‌شنبه","جمعه","شنبه"],h=[{num:1,label:"ژانر",emoji:"\uD83E\uDDE9"},{num:2,label:"بازی",emoji:"\uD83C\uDFB2"},{num:3,label:"زمان",emoji:"⏰"},{num:4,label:"هم‌بازی",emoji:"\uD83D\uDC65"},{num:5,label:"کافه",emoji:"☕"}];var p=s(20063),b=s(36489),f=s(18720);let g=(0,r.createContext)(null);function j(e){let{children:t,open:s,onOpenChange:l,userCity:n,initialCafeId:i}=e,d=function(e){var t;let{open:s,onOpenChange:a,userCity:l="همه",initialCafeId:n}=e,i=(0,p.useRouter)(),{data:d,status:o}=(0,b.useSession)(),c=(null==d||null==(t=d.user)?void 0:t.city)||("همه"!==l?l:"تهران"),[x,m]=(0,r.useState)(c),[h,g]=(0,r.useState)(1),[j,v]=(0,r.useState)([]),[w,N]=(0,r.useState)(new Set),[y,k]=(0,r.useState)("ALL"),[C,S]=(0,r.useState)(n?"همه بازی‌های این کافه":"همه بازی‌ها"),[A,D]=(0,r.useState)(null),[T,L]=(0,r.useState)([]),[E,P]=(0,r.useState)(""),[I,R]=(0,r.useState)(null),[F,O]=(0,r.useState)(!1),[U,z]=(0,r.useState)(!1),[M,$]=(0,r.useState)(null),_=(0,r.useMemo)(()=>(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,t=new Date(e.getTime()+126e5);return[{label:"امروز",offsetDays:0,emoji:"⚡"},{label:"فردا",offsetDays:1,emoji:"\uD83D\uDCC5"},{label:"پس‌فردا",offsetDays:2,emoji:"\uD83D\uDCC6"}].map(e=>{let s=new Date(t.getTime()+24*e.offsetDays*36e5),a=u[s.getUTCDay()],r=s.getUTCFullYear(),l=String(s.getUTCMonth()+1).padStart(2,"0"),n=String(s.getUTCDate()).padStart(2,"0"),i="".concat(r,"-").concat(l,"-").concat(n);return{...e,dateStr:i,weekdayName:a,displayLabel:"".concat(e.label," (").concat(a,")")}})})(),[]),V=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date;try{let t=new Intl.DateTimeFormat("en-US",{timeZone:"Asia/Tehran",hour:"numeric",hourCycle:"h23"});return parseInt(t.format(e),10)}catch(t){return new Date(e.getTime()+126e5).getUTCHours()}}(),G=+(V>=22),[B,J]=(0,r.useState)(G),[Y,Z]=(0,r.useState)(new Set),W=(0,r.useMemo)(()=>{if(0===G){let e=Math.min(Math.max(10,V+1),23);return"".concat(String(e).padStart(2,"0"),":00")}return"17:00"},[V,G]),[H,X]=(0,r.useState)(W),[q,K]=(0,r.useState)(3),[Q,ee]=(0,r.useState)(!0),[et,es]=(0,r.useState)(""),[ea,er]=(0,r.useState)([]),[el,en]=(0,r.useState)(c),[ei,ed]=(0,r.useState)(null),[eo,ec]=(0,r.useState)(!1),[ex,em]=(0,r.useState)(null),[eu,eh]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(!s)return;let e=!0;return(async()=>{var t,s,a,r,l;let n=null==d||null==(t=d.user)?void 0:t.city;if(n&&""!==n.trim()){e&&(m(n),en(e=>"همه"===e||"تهران"===e?n:e));return}if("authenticated"===o)try{let t=await fetch("/api/user/profile");if(t.ok){let n=await t.json(),i=(null==n||null==(a=n.data)||null==(s=a.user)?void 0:s.city)||(null==n||null==(l=n.profile)||null==(r=l.user)?void 0:r.city);i&&""!==i.trim()&&e&&(m(i),en(e=>"همه"===e||"تهران"===e?i:e))}}catch(e){}})(),()=>{e=!1}},[s,d,o]);let ep=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/user/tables");if(e.ok){let t=await e.json();if(t.success&&t.data&&Array.isArray(t.data.hosted)){let e=new Set;t.data.hosted.forEach(t=>{if(t.startTime&&"UPCOMING"===t.status){let s=new Date(new Date(t.startTime).getTime()+126e5),a=s.getUTCFullYear(),r=String(s.getUTCMonth()+1).padStart(2,"0"),l=String(s.getUTCDate()).padStart(2,"0");e.add("".concat(a,"-").concat(r,"-").concat(l))}}),Z(e),J(t=>{let s=_[t];if(s&&e.has(s.dateStr)){let s=_.findIndex(t=>!e.has(t.dateStr));return -1!==s?s:t}return t})}}}catch(e){}},[_]),eb=(0,r.useCallback)(async()=>{z(!0),$(null);try{if(n){let[e,t]=await Promise.all([fetch("/api/cafes/".concat(n,"/games")),fetch("/api/cafes/".concat(n))]),s=await e.json();if(s.success&&s.data){let e=s.data.cafeName||"این کافه";D(e);let t=(s.data.games||[]).map(e=>({id:e.id,title:e.nameFa||e.name,englishTitle:e.name!==e.nameFa?e.name:void 0,genre:e.genre||(e.genres&&e.genres.length>0?e.genres[0].name:void 0),genreId:e.genreId||(e.genres&&e.genres.length>0?e.genres[0].id:e.genreIds&&e.genreIds[0]),genreIds:e.genreIds||(e.genres?e.genres.map(e=>e.id):[]),minPlayers:e.minPlayers||2,maxPlayers:e.maxPlayers||6,isPopular:!!e.isPopular,imageUrl:e.imageUrl}));L(t);let a=(s.data.genres||[]).map(e=>({id:e.id,name:e.name,cleanName:e.cleanName||e.name}));v(a)}else $(s.error||"خطا در دریافت لیست بازی‌های کافه");if(t.ok){let e=await t.json();if(e.success&&e.data){let t=e.data,s={id:t.id,name:t.name,address:t.address,city:t.city,district:t.district,hourlyRate:t.hourlyRate||0,isFree:0===t.hourlyRate||"FREE"===t.pricingType,pricingType:t.pricingType,logo:t.logo,images:t.images};ed(s),er([s]),t.city&&en(t.city),t.name&&D(t.name)}}}else{let e=await fetch("/api/games"),t=await e.json();if(t.success&&t.data){let e=(t.data.games||[]).map(e=>({id:e.id,title:e.nameFa||e.name,englishTitle:e.name!==e.nameFa?e.name:void 0,genre:e.genre||(e.genres&&e.genres.length>0?e.genres[0].name:void 0),genreId:e.genreId||(e.genres&&e.genres.length>0?e.genres[0].id:e.genreIds&&e.genreIds[0]),genreIds:e.genreIds||(e.genres?e.genres.map(e=>e.id):[]),minPlayers:e.minPlayers||2,maxPlayers:e.maxPlayers||6,isPopular:!!e.isPopular,imageUrl:e.imageUrl}));L(e);let s=(t.data.genres||[]).map(e=>({id:e.id,name:e.name,cleanName:e.cleanName||e.name}));v(s)}else $(t.error||"خطا در بارگذاری لیست بازی‌ها")}}catch(e){$("خطا در برقراری ارتباط با سرور کاتالوگ بازی‌ها")}finally{z(!1)}},[n]),ef=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/user/game-preferences");if(e.ok){let t=await e.json();if(t.success&&Array.isArray(t.data)){let e=new Set(t.data.map(e=>e.gameTitle));N(e)}}}catch(e){}},[]),eg=(0,r.useCallback)(async(e,t,s)=>{if(!n){ec(!0),em(null);try{let a=new URLSearchParams;(null==e?void 0:e.id)?a.set("gameId",e.id):(null==e?void 0:e.title)&&a.set("game",e.title),y&&"ALL"!==y&&"FAVORITES"!==y&&"POPULAR"!==y?a.set("genreId",y):t&&"ALL"!==t&&"همه بازی‌ها"!==t&&"FAVORITES"!==t&&"POPULAR"!==t&&a.set("genre",t),s&&"همه"!==s&&a.set("city",s);let r=await fetch("/api/cafes/by-game?".concat(a.toString())),l=await r.json();l.success&&Array.isArray(l.data)?(er(l.data),l.data.length>0?ed(e=>e&&l.data.some(t=>String(t.id)===String(e.id))?e:l.data[0]):ed(null)):em(l.error||"خطا در دریافت لیست کافه‌ها")}catch(e){em("خطا در برقراری ارتباط با سرور برای دریافت کافه‌ها")}finally{ec(!1)}}},[n,y]);(0,r.useEffect)(()=>{s&&(g(1),k("ALL"),S(n?"همه بازی‌های این کافه":"همه بازی‌ها"),P(""),R(null),O(!1),n||(ed(null),D(null)),J(+(V>=22)),X(W),K(3),ee(!0),es(""),eb(),ef(),ep())},[s,n,V,W,eb,ef,ep]),(0,r.useEffect)(()=>{5===h&&eg(I,C,el)},[h,I,C,el,eg]);let ej=(0,r.useMemo)(()=>T.filter(e=>{let t=!0;if("FAVORITES"===y)t=w.has(e.title);else if("POPULAR"===y)t=!!e.isPopular;else if("ALL"!==y){var s;t=e.genreId===y||e.genre===C||!!(null==(s=e.genreIds)?void 0:s.includes(y))}let a=E.trim().toLowerCase(),r=!a||e.title.toLowerCase().includes(a)||e.englishTitle&&e.englishTitle.toLowerCase().includes(a)||e.genre&&e.genre.toLowerCase().includes(a);return t&&r}),[T,y,C,w,E]),ev=async(e,t)=>{t.stopPropagation();let s=e.title,a=w.has(s);N(e=>{let t=new Set(e);return a?t.delete(s):t.add(s),t});try{if(a){if(!(await fetch("/api/user/game-preferences?gameTitle=".concat(encodeURIComponent(s)),{method:"DELETE"})).ok)throw Error("خطا در حذف از علاقه‌مندی‌ها");f.o.success("\xab".concat(s,"\xbb از لیست علاقه‌مندی‌های شما حذف شد"))}else{let t=await fetch("/api/user/game-preferences",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gameTitle:s,category:function(e){if(!e)return"STRATEGY";let t=e.toLowerCase();return t.includes("استراتژیک")||t.includes("strategy")?"STRATEGY":t.includes("خانوادگی")||t.includes("family")?"FAMILY":t.includes("مخفی")||t.includes("استنتاجی")||t.includes("deduction")?"DEDUCTION":t.includes("مهمانی")||t.includes("پارتی")||t.includes("دورهمی")||t.includes("party")?"PARTY":t.includes("جنگی")||t.includes("war")?"WAR":t.includes("دو نفره")||t.includes("دونفره")||t.includes("duel")?"DUEL":t.includes("کارتی")||t.includes("card")?"CARD":t.includes("اقتصادی")||t.includes("مدیریتی")||t.includes("economic")?"ECONOMIC":t.includes("ماجراجویی")||t.includes("تعاونی")||t.includes("همکاری")||t.includes("adventure")?"ADVENTURE":t.includes("انتزاعی")||t.includes("فکری")||t.includes("abstract")?"ABSTRACT":"STRATEGY"}(e.genre),skillLevel:"ALL_LEVELS"})});if(!t.ok){if(401===t.status)throw Error("برای ذخیره بازی‌های موردعلاقه لطفاً ابتدا وارد حساب کاربری شوید");throw Error("خطا در افزودن به علاقه‌مندی‌ها")}f.o.success("\xab".concat(s,"\xbb به لیست علاقه‌مندی‌های شما افزوده شد ⭐️"))}}catch(e){N(e=>{let t=new Set(e);return a?t.add(s):t.delete(s),t}),f.o.error(e.message||"خطا در بروزرسانی علاقه‌مندی")}},ew=async()=>{if(!I&&!F&&(!C||"ALL"===y)){f.o.error("لطفاً یک بازی یا ژانر مشخص را انتخاب کنید"),g(1);return}if(!ei)return void f.o.error("لطفاً کافه‌گیم مورد نظر خود را انتخاب کنید");let e=_[B];if(!e||!H){f.o.error("لطفاً تاریخ و ساعت معتبر انتخاب کنید"),g(3);return}if(0===B&&parseInt(H.split(":")[0],10)<=V){f.o.error("ساعت انتخابی برای امروز سپری شده است. لطفاً ساعت آینده را انتخاب کنید."),g(3);return}eh(!0);try{let t="".concat(e.dateStr,"T").concat(H,":00+03:30"),s=new Date(t),r={gameTitle:(null==I?void 0:I.title)||void 0,genre:(null==I?void 0:I.genre)||("همه بازی‌ها"!==C?C:"عمومی"),cafeId:ei.id,startTime:s.toISOString(),playersNeeded:q,isPublic:Q},l=await fetch("/api/tables/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),n=await l.json();if(!l.ok||!n.success)throw Error(n.error||"خطا در ثبت میز بازی");let d=n.data;a(!1),"UPCOMING"===d.status?(f.o.success("\uD83C\uDF89 میز بازی شما با موفقیت ثبت و منتشر شد!"),window.dispatchEvent(new CustomEvent("event-updated")),i.push("/events/".concat(d.id))):"PENDING_PAYMENT"===d.status?(f.o.info("میز با موفقیت ایجاد شد. در حال انتقال به درگاه پرداخت..."),i.push("/checkout/table/".concat(d.id))):i.push("/events")}catch(e){f.o.error(e.message||"خطا در برقراری ارتباط با سرور")}finally{eh(!1)}};return{step:h,setStep:g,open:s,onOpenChange:a,initialCafeId:n,genres:j,favoriteGames:w,selectedGenreId:y,selectedGenreName:C,cafeScopeName:A,isLoadingGames:U,gamesError:M,handleSelectGenre:(e,t)=>{k(e),S(t),P(""),R(null),O(!1),g(2)},loadGames:eb,games:T,filteredGames:ej,gameSearch:E,setGameSearch:P,selectedGame:I,isContinuingWithGenre:F,handleSelectGame:e=>{R(e),O(!1),e.maxPlayers&&e.maxPlayers>1&&K(Math.max(1,Math.min(6,e.maxPlayers-1))),g(3)},handleContinueWithGenre:()=>{R(null),O(!0),g(3)},toggleFavorite:ev,dayOptions:_,selectedDayIndex:B,setSelectedDayIndex:J,selectedTime:H,setSelectedTime:X,currentIranHour:V,activeTableDates:Y,neededPlayers:q,setNeededPlayers:K,isPublic:Q,setIsPublic:ee,description:et,setDescription:es,cafes:ea,selectedCafeCity:el,setSelectedCafeCity:en,profileCity:x,selectedCafe:ei,setSelectedCafe:ed,isLoadingCafes:eo,cafesError:ex,isSubmitting:eu,loadCafes:eg,handleSubmit:ew}}({open:s,onOpenChange:l,userCity:n,initialCafeId:i});return(0,a.jsx)(g.Provider,{value:d,children:t})}function v(){let e=(0,r.useContext)(g);if(!e)throw Error("useCreateTableContext must be used within a CreateTableProvider");return e}function w(){let{step:e,setStep:t,selectedGenreId:s,selectedGame:r,isContinuingWithGenre:l}=v();return(0,a.jsx)("div",{className:"grid grid-cols-5 gap-1 pt-1 w-full box-border",children:h.map(n=>{let i=e===n.num,d=e>n.num,o=n.num<e||2===n.num&&!!s||3===n.num&&!!(r||l);return(0,a.jsxs)("button",{type:"button",disabled:!o&&!i,onClick:()=>{o&&t(n.num)},className:"flex flex-col items-center justify-center py-1.5 px-0.5 sm:px-1 rounded-xl text-[10px] sm:text-[11px] font-bold transition-all min-w-0 ".concat(i?"bg-emerald-600 text-white shadow-sm shadow-emerald-600/30":d?"bg-emerald-50 text-emerald-700 hover:bg-emerald-100 border border-emerald-200":"bg-slate-100 text-slate-400 opacity-60"),children:[(0,a.jsx)("span",{className:"text-xs leading-none mb-0.5",children:d?"✓":n.emoji}),(0,a.jsx)("span",{className:"truncate w-full text-center",children:n.label})]},n.num)})})}var N=s(11647),y=s(16645),k=s(39347),C=s(8198),S=s(89559);function A(){let{initialCafeId:e,cafeScopeName:t,favoriteGames:s,genres:r,isLoadingGames:l,gamesError:i,loadGames:o,handleSelectGenre:x}=v();return(0,a.jsxs)("div",{className:"space-y-4",children:[e&&(0,a.jsxs)("div",{className:"flex items-center gap-2 p-2.5 rounded-2xl bg-purple-50/80 border border-purple-200/80 text-purple-900 text-xs font-semibold",children:[(0,a.jsx)("span",{className:"text-base",children:"☕"}),(0,a.jsxs)("span",{className:"truncate",children:["نمایش بازی‌ها و ژانرهای موجود در کافه ",(0,a.jsx)("strong",{className:"font-black text-purple-950",children:t||"انتخابی"})]})]}),(0,a.jsx)("div",{className:"flex items-center",children:(0,a.jsxs)("span",{className:"text-xs font-bold text-slate-700 flex items-center gap-1.5",children:[(0,a.jsx)(y.A,{className:"w-4 h-4 text-purple-600"})," سبک یا ژانر بازی را مشخص کن:"]})}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>x("FAVORITES","علاقه‌های من"),className:"flex items-center justify-center gap-2 p-3 rounded-2xl border border-amber-200 bg-amber-50/70 hover:bg-amber-100/80 text-amber-900 font-bold text-xs transition-all text-center shadow-sm",children:[(0,a.jsx)(k.A,{className:"w-4 h-4 text-amber-500 fill-amber-500 shrink-0"}),(0,a.jsx)("span",{children:"علاقه‌های من"}),(0,a.jsx)(N.E,{variant:"outline",className:"bg-white/80 border-amber-300 text-amber-800 text-[10px] px-1.5 py-0 font-mono",children:s.size})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>x("POPULAR","محبوب‌ترین‌ها"),className:"flex items-center justify-center gap-2 p-3 rounded-2xl border border-rose-200 bg-rose-50/70 hover:bg-rose-100/80 text-rose-900 font-bold text-xs transition-all text-center shadow-sm",children:[(0,a.jsx)(C.A,{className:"w-4 h-4 text-rose-500 fill-rose-500 shrink-0"}),(0,a.jsx)("span",{children:"محبوب‌ترین‌ها"})]})]}),(0,a.jsxs)("div",{className:"pt-2 border-t border-slate-100 space-y-2.5",children:[(0,a.jsx)("span",{className:"text-[11px] font-semibold text-slate-500 block",children:e?"ژانرهای موجود در این کافه:":"دسته‌بندی‌ها و ژانرهای بردگیم:"}),l?(0,a.jsx)("div",{className:"grid grid-cols-2 gap-2",children:Array.from({length:6}).map((e,t)=>(0,a.jsx)("div",{className:"h-11 bg-slate-100 rounded-xl animate-pulse"},t))}):i?(0,a.jsxs)("div",{className:"p-4 bg-rose-50 border border-rose-200 rounded-2xl text-center space-y-2",children:[(0,a.jsx)("p",{className:"text-xs text-rose-700",children:i}),(0,a.jsxs)(n.$,{size:"sm",variant:"outline",onClick:o,className:"text-xs border-rose-300 text-rose-700 hover:bg-rose-100",children:[(0,a.jsx)(S.A,{className:"w-3.5 h-3.5 ml-1.5"})," تلاش دوباره"]})]}):0===r.length?(0,a.jsxs)("div",{className:"p-4 bg-slate-50 border border-slate-200 rounded-2xl text-center space-y-1.5",children:[(0,a.jsx)("p",{className:"text-xs font-bold text-slate-700",children:"ژانری برای این کافه ثبت نشده است"}),(0,a.jsx)("p",{className:"text-[11px] text-slate-500",children:"می‌توانید کاتالوگ را به صورت مستقیم مشاهده کنید."})]}):(0,a.jsx)("div",{className:"grid grid-cols-2 gap-2 max-h-[260px] overflow-y-auto px-1 py-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:r.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>x(e.id,e.name),className:"flex items-center justify-between p-3 rounded-2xl border border-slate-200 bg-white hover:bg-emerald-50 hover:border-emerald-300 text-slate-800 font-semibold text-xs transition-all text-right shadow-sm group",children:[(0,a.jsx)("span",{className:"truncate group-hover:text-emerald-700",children:e.name}),(0,a.jsx)(d.A,{className:"w-3.5 h-3.5 text-slate-400 group-hover:text-emerald-600 shrink-0"})]},e.id))}),(0,a.jsxs)("button",{type:"button",onClick:()=>x("ALL",e?"همه بازی‌های این کافه":"همه بازی‌ها"),className:"w-full flex items-center justify-center gap-2 p-2.5 rounded-2xl border border-slate-200 bg-slate-50/80 hover:bg-emerald-50 hover:border-emerald-300 text-slate-800 font-bold text-xs transition-all text-center shadow-sm",children:[(0,a.jsx)(c.A,{className:"w-4 h-4 text-emerald-600"}),(0,a.jsx)("span",{children:e?"نمایش همه بازی‌های این کافه بدون فیلتر ژانر":"نمایش کاتالوگ همه بازی‌ها بدون فیلتر ژانر"})]})]})]})}var D=s(65142),T=s(5917),L=s(86651),E=s(91169);function P(){let{setStep:e,selectedGenreId:t,selectedGenreName:s,selectedGame:r,favoriteGames:l,filteredGames:i,gameSearch:o,setGameSearch:c,handleSelectGame:x,handleContinueWithGenre:m,toggleFavorite:u}=v();return(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between bg-emerald-50/80 border border-emerald-200 rounded-2xl p-2.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm",children:"\uD83E\uDDE9"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[10px] text-emerald-600 font-semibold block",children:"ژانر انتخابی:"}),(0,a.jsx)("span",{className:"text-xs font-bold text-emerald-900",children:s})]})]}),(0,a.jsx)(n.$,{variant:"ghost",size:"sm",onClick:()=>e(1),className:"h-8 text-xs text-emerald-700 hover:bg-emerald-100 rounded-xl px-2.5 font-bold",children:"تغییر ژانر"})]}),"ALL"!==t&&"FAVORITES"!==t&&"POPULAR"!==t&&(0,a.jsxs)("button",{type:"button",onClick:m,className:"w-full flex items-center justify-between p-3 rounded-2xl bg-gradient-to-r from-purple-600 to-indigo-600 hover:from-purple-700 hover:to-indigo-700 text-white font-bold text-xs shadow-md shadow-purple-600/20 transition-all",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(T.A,{className:"w-4 h-4"}),(0,a.jsxs)("span",{children:["ادامه با کل ژانر \xab",s,"\xbb (بدون تعیین بازی خاص)"]})]}),(0,a.jsx)(d.A,{className:"w-4 h-4"})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(L.A,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-slate-400 h-4 w-4"}),(0,a.jsx)(D.p,{placeholder:"جستجوی نام بازی (مثلاً Catan, استوژیت)...",value:o,onChange:e=>c(e.target.value),className:"pr-9 bg-slate-50 border-slate-200 text-slate-900 text-xs h-10 rounded-xl focus:border-emerald-500 focus:bg-white"})]}),0===i.length?(0,a.jsxs)("div",{className:"p-8 text-center bg-slate-50 border border-slate-200 rounded-2xl space-y-2",children:[(0,a.jsx)("p",{className:"text-xs font-bold text-slate-600",children:"FAVORITES"===t?"هنوز بازی‌ای به لیست علاقه‌مندی‌های خود اضافه نکرده‌اید.":"بازی‌ای با این نام در این بخش یافت نشد."}),(0,a.jsx)("p",{className:"text-[11px] text-slate-400",children:"FAVORITES"===t?"می‌توانید با کلیک روی ستاره ⭐️ در کنار هر بازی، آن را به علایق خود اضافه کنید.":"می‌توانید عبارت جستجو را تغییر دهید یا به ژانر دیگری بروید."})]}):(0,a.jsx)("div",{className:"space-y-2 max-h-[320px] overflow-y-auto pr-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:i.map(e=>{let t=(null==r?void 0:r.title)===e.title,s=l.has(e.title);return(0,a.jsxs)("div",{onClick:()=>x(e),className:"flex items-center justify-between p-3 rounded-2xl border transition-all cursor-pointer ".concat(t?"bg-emerald-50/80 border-emerald-500 ring-2 ring-emerald-500/20 text-emerald-950 shadow-sm":"bg-slate-50/70 hover:bg-emerald-50/30 border-slate-200 hover:border-emerald-200"),children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0 pr-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h4",{className:"font-bold text-xs text-slate-900 truncate",children:e.title}),e.englishTitle&&(0,a.jsxs)("span",{className:"text-[10px] text-slate-400 font-mono truncate dir-ltr text-right",children:["(",e.englishTitle,")"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[e.genre&&(0,a.jsx)("span",{className:"text-[10px] bg-slate-200/80 text-slate-700 px-1.5 py-0.2 rounded-md font-medium",children:e.genre}),(0,a.jsxs)("span",{className:"text-[10px] text-slate-500 flex items-center gap-0.5",children:[(0,a.jsx)(E.A,{className:"w-3 h-3 text-slate-400"}),e.minPlayers||2,"-",e.maxPlayers||6," نفر"]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 shrink-0 mr-2",children:[(0,a.jsx)("button",{type:"button",title:s?"حذف از علاقه‌مندی‌ها":"افزودن به علاقه‌مندی‌ها",onClick:t=>u(e,t),className:"p-1.5 rounded-lg hover:bg-slate-200/60 transition-colors",children:(0,a.jsx)(k.A,{className:"w-4 h-4 transition-colors ".concat(s?"text-amber-500 fill-amber-500":"text-slate-300 hover:text-amber-400")})}),(0,a.jsx)("div",{className:"w-5 h-5 rounded-full border flex items-center justify-center transition-all ".concat(t?"bg-emerald-600 border-emerald-600 text-white":"border-slate-300 text-transparent"),children:(0,a.jsx)(T.A,{className:"w-3 h-3"})})]})]},e.title)})})]})}var I=s(76444),R=s(10383),F=s(26983);function O(){let{setStep:e,selectedGame:t,selectedGenreName:s,dayOptions:r,selectedDayIndex:l,setSelectedDayIndex:i,activeTableDates:d,currentIranHour:o,selectedTime:c,setSelectedTime:m}=v();return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between bg-emerald-50/80 border border-emerald-200 rounded-2xl p-2.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm",children:"\uD83C\uDFB2"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[10px] text-emerald-600 font-semibold block",children:"بازی تعیین‌شده:"}),(0,a.jsx)("span",{className:"text-xs font-bold text-emerald-900",children:t?t.title:"کل ژانر ".concat(s)})]})]}),(0,a.jsx)(n.$,{variant:"ghost",size:"sm",onClick:()=>e(2),className:"h-8 text-xs text-emerald-700 hover:bg-emerald-100 rounded-xl px-2.5 font-bold",children:"تغییر بازی"})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(I.J,{className:"text-xs font-bold text-slate-700 mb-2 block flex items-center gap-1.5",children:[(0,a.jsx)(R.A,{className:"w-4 h-4 text-emerald-600"})," روز برگزاری میز:"]}),(0,a.jsx)("div",{className:"grid grid-cols-3 gap-2",children:r.map((e,t)=>{let s=l===t,r=d.has(e.dateStr);return(0,a.jsxs)("button",{type:"button",disabled:r,onClick:()=>i(t),className:"py-2 px-1.5 rounded-2xl text-xs font-bold transition-all text-center border flex flex-col items-center justify-center min-h-[56px] ".concat(r?"bg-slate-100/90 text-slate-400 border-slate-200 cursor-not-allowed opacity-60":s?"bg-emerald-600 border-emerald-600 text-white shadow-md shadow-emerald-600/20 ring-2 ring-emerald-500/20":"bg-slate-50 hover:bg-emerald-50/50 hover:border-emerald-200 border-slate-200 text-slate-700"),children:[(0,a.jsx)("span",{className:"text-xs font-bold ".concat(r?"line-through opacity-80":""),children:e.label}),(0,a.jsxs)("span",{className:"text-[11px] ".concat(s&&!r?"text-emerald-100 font-semibold":"text-slate-500 font-medium"," mt-0.5"),children:["(",e.weekdayName,")"]}),r&&(0,a.jsx)("span",{className:"text-[9px] text-rose-500 font-bold mt-0.5 whitespace-nowrap",children:"میز فعال دارید"})]},e.dateStr)})}),r.every(e=>d.has(e.dateStr))&&(0,a.jsxs)("div",{className:"mt-2.5 p-3 rounded-2xl bg-amber-50 border border-amber-200 text-amber-900 text-xs flex items-start gap-2",children:[(0,a.jsx)("span",{className:"text-base leading-none",children:"⚠️"}),(0,a.jsx)("span",{children:"شما در تمامی روزهای مجاز (امروز، فردا و پس‌فردا) میز فعال دارید. طبق قوانین، امکان ایجاد بیش از یک میز فعال در یک روز وجود ندارد."})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(I.J,{className:"text-xs font-bold text-slate-700 mb-2 block flex items-center gap-1.5",children:[(0,a.jsx)(F.A,{className:"w-4 h-4 text-emerald-600"})," ساعت شروع بازی (۱۰:۰۰ الی ۲۳:۰۰):"]}),(0,a.jsx)("div",{className:"grid grid-cols-4 sm:grid-cols-7 gap-1.5",children:x.map(e=>{let t=parseInt(e.split(":")[0],10),s=0===l&&t<=o,r=c===e;return(0,a.jsx)("button",{type:"button",disabled:s,onClick:()=>m(e),className:"py-2 rounded-xl text-xs font-mono font-bold transition-all border ".concat(s?"bg-slate-100 text-slate-300 border-slate-200 cursor-not-allowed opacity-50":r?"bg-emerald-600 border-emerald-600 text-white shadow-sm ring-2 ring-emerald-500/20":"bg-slate-50 hover:bg-emerald-50/50 hover:border-emerald-200 border-slate-200 text-slate-700"),children:e},e)})}),0===l&&(0,a.jsx)("p",{className:"text-[10px] text-slate-400 mt-1.5",children:"* ساعت‌های گذشته برای روز جاری غیرفعال هستند."})]})]})}var U=s(44846),z=s(39068),M=s(99708);function $(){let{neededPlayers:e,setNeededPlayers:t,isPublic:s,setIsPublic:r,description:l,setDescription:n}=v();return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("div",{className:"bg-slate-50 border border-slate-200 rounded-2xl p-4",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(I.J,{className:"text-xs font-bold text-slate-800 block",children:"\uD83D\uDC65 چند نفر هم‌بازی نیاز داری؟ (غیر از خودت)"}),(0,a.jsxs)("span",{className:"text-[11px] text-slate-500 mt-0.5 block",children:["ظرفیت کل میز:"," ",(0,a.jsxs)("span",{className:"font-bold text-emerald-700",children:[e+1," نفر"]})," (شما + ",e," هم‌بازی)"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 bg-white px-2 py-1 rounded-xl border border-slate-200 shadow-sm",children:[(0,a.jsx)("button",{type:"button",onClick:()=>t(e=>Math.min(10,e+1)),className:"w-8 h-8 rounded-lg bg-slate-100 hover:bg-slate-200 text-slate-700 font-black text-base flex items-center justify-center transition-colors disabled:opacity-40",disabled:e>=10,title:"افزایش هم‌بازی",children:"+"}),(0,a.jsx)("span",{className:"w-8 text-center font-bold text-base text-emerald-700 font-mono",children:e}),(0,a.jsx)("button",{type:"button",onClick:()=>t(e=>Math.max(1,e-1)),className:"w-8 h-8 rounded-lg bg-slate-100 hover:bg-slate-200 text-slate-700 font-black text-base flex items-center justify-center transition-colors disabled:opacity-40",disabled:e<=1,title:"کاهش هم‌بازی",children:"-"})]})]})}),(0,a.jsxs)("div",{className:"flex items-center justify-between bg-slate-50 border border-slate-200 rounded-2xl p-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5",children:[s?(0,a.jsx)(z.A,{className:"w-5 h-5 text-emerald-600 shrink-0"}):(0,a.jsx)(M.A,{className:"w-5 h-5 text-amber-600 shrink-0"}),(0,a.jsxs)("div",{children:[(0,a.jsx)(I.J,{className:"text-xs font-bold text-slate-800 block",children:s?"میز عمومی (نمایش برای همه کاربران)":"میز خصوصی (فقط با لینک اختصاصی)"}),(0,a.jsx)("span",{className:"text-[10px] text-slate-500",children:s?"تمام بازیکنان پلیمو می‌توانند میز شما را در لیست ببینند و ملحق شوند.":"فقط افرادی که لینک میز را دارند امکان مشاهده و عضویت دارند."})]})]}),(0,a.jsx)(U.d,{checked:s,onCheckedChange:r,className:"data-[state=checked]:bg-emerald-600"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(I.J,{className:"text-xs font-medium text-slate-600 mb-1.5 block",children:"یادداشت یا توضیحات برای هم‌بازی‌ها (اختیاری):"}),(0,a.jsx)(D.p,{placeholder:"مثال: بازی رو آموزش میدم، لطفاً سر وقت بیاید...",value:l,onChange:e=>n(e.target.value),maxLength:150,className:"bg-slate-50 border-slate-200 text-xs text-slate-900 rounded-xl focus:border-emerald-500 focus:bg-white"})]})]})}var _=s(15239),V=s(21873),G=s(51950);function B(){var e;let{setStep:t,initialCafeId:s,cafeScopeName:r,selectedCafe:l,setSelectedCafe:i,cafes:d,selectedCafeCity:o,setSelectedCafeCity:c,profileCity:x,isLoadingCafes:u,cafesError:h,loadCafes:p,selectedGame:b,selectedGenreName:f,dayOptions:g,selectedDayIndex:j,selectedTime:w,neededPlayers:y}=v();return(0,a.jsxs)("div",{className:"space-y-3.5 w-full box-border",children:[s?(0,a.jsxs)("div",{className:"flex items-center justify-between bg-emerald-50/80 border border-emerald-200 rounded-2xl p-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-base",children:"\uD83D\uDD12"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[10px] text-emerald-600 font-semibold block",children:"مکان برگزاری (قفل‌شده روی کافه انتخابی):"}),(0,a.jsx)("span",{className:"text-xs font-bold text-emerald-900",children:(null==l?void 0:l.name)||r})]})]}),(0,a.jsx)(N.E,{className:"bg-emerald-600 text-white border-0 text-[10px] px-2.5 py-1 rounded-xl font-bold",children:"کافه انتخاب‌شده"})]}):(0,a.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-2 bg-emerald-50/60 border border-emerald-100 rounded-2xl p-2.5 w-full box-border",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-xs font-bold text-slate-800 min-w-0",children:[(0,a.jsx)(V.A,{className:"w-3.5 h-3.5 text-emerald-600 shrink-0"}),(0,a.jsxs)("span",{className:"truncate",children:["کافه‌های شهر ",(0,a.jsx)("span",{className:"text-emerald-700 font-black",children:o}),":"]})]}),(0,a.jsxs)("select",{value:o,onChange:e=>c(e.target.value),className:"text-[11px] font-semibold bg-white border border-emerald-200 text-emerald-900 rounded-xl px-2.5 py-1 focus:outline-none focus:ring-1 focus:ring-emerald-500 cursor-pointer shadow-sm shrink-0",children:[(0,a.jsxs)("option",{value:x,children:["شهر من (",x,")"]}),m.filter(e=>e!==x).map(e=>(0,a.jsx)("option",{value:e,children:e},e)),(0,a.jsx)("option",{value:"همه",children:"همه شهرها"})]})]}),u&&!l?(0,a.jsx)("div",{className:"space-y-2 py-2 w-full box-border",children:Array.from({length:3}).map((e,t)=>(0,a.jsx)("div",{className:"h-16 bg-slate-100 rounded-2xl animate-pulse w-full"},t))}):h&&!l?(0,a.jsxs)("div",{className:"p-4 bg-rose-50 border border-rose-200 rounded-2xl text-center space-y-2 w-full box-border",children:[(0,a.jsx)("p",{className:"text-xs text-rose-700",children:h}),(0,a.jsxs)(n.$,{size:"sm",variant:"outline",onClick:()=>p(b,f,o),className:"text-xs border-rose-300 text-rose-700 hover:bg-rose-100",children:[(0,a.jsx)(S.A,{className:"w-3.5 h-3.5 ml-1.5"})," تلاش مجدد"]})]}):0!==d.length||l?(0,a.jsx)("div",{className:"space-y-2 max-h-[230px] overflow-y-auto px-1 py-1 w-full box-border [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:(s&&l?[l]:d).map(e=>{let t=(null==l?void 0:l.id)===e.id,r=0===e.hourlyRate||e.isFree;return(0,a.jsxs)("div",{onClick:()=>!s&&i(e),className:"rounded-2xl border p-2.5 sm:p-3 transition-all flex items-center justify-between gap-2 w-full box-border ".concat(s?"bg-emerald-50/80 border-emerald-500 ring-2 ring-emerald-500/20 text-emerald-950 shadow-sm cursor-default":t?"bg-emerald-50/80 border-emerald-500 ring-2 ring-emerald-500/20 text-emerald-950 shadow-sm cursor-pointer":"bg-slate-50/70 hover:bg-emerald-50/30 border-slate-200 hover:border-emerald-200 cursor-pointer"),children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5 flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"w-9 h-9 sm:w-10 sm:h-10 rounded-xl bg-white border border-slate-200 flex items-center justify-center text-lg shrink-0 overflow-hidden relative shadow-sm",children:e.logo?(0,a.jsx)(_.default,{src:e.logo,alt:e.name,fill:!0,className:"object-cover",sizes:"40px"}):"☕"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("h4",{className:"font-bold text-xs text-slate-900 truncate",children:e.name}),e.city&&(0,a.jsx)("span",{className:"text-[9px] bg-slate-200 text-slate-700 px-1.5 py-0.2 rounded shrink-0",children:e.city})]}),(0,a.jsx)("p",{className:"text-[10px] sm:text-[11px] text-slate-400 truncate mt-0.5",children:e.address||"آدرس ثبت نشده"})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[r?(0,a.jsx)("span",{className:"bg-emerald-50 text-emerald-700 border border-emerald-200 text-[10px] font-bold px-2 py-0.5 rounded-lg whitespace-nowrap",children:"\uD83D\uDFE2 رایگان"}):(0,a.jsxs)("span",{className:"bg-purple-50 text-purple-700 border border-purple-200 text-[10px] font-bold px-2 py-0.5 rounded-lg whitespace-nowrap",children:["\uD83D\uDCB0 ",(0,G.$g)(e.hourlyRate)," ت/ساعت"]}),(0,a.jsx)("div",{className:"w-5 h-5 rounded-full border flex items-center justify-center shrink-0 transition-all ".concat(t||s?"bg-emerald-600 border-emerald-600 text-white":"border-slate-300 text-transparent"),children:(0,a.jsx)(T.A,{className:"w-3 h-3"})})]})]},e.id)})}):(0,a.jsxs)("div",{className:"p-5 bg-amber-50/70 border border-amber-200 rounded-2xl text-center space-y-3 w-full box-border",children:[(0,a.jsx)("div",{className:"w-10 h-10 mx-auto rounded-full bg-amber-100 flex items-center justify-center text-xl",children:"\uD83C\uDFB2"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs font-bold text-amber-900 leading-relaxed",children:b?"متأسفانه بازی \xab".concat(b.title,"\xbb در حال حاضر در هیچ کافه‌ای در شهر \xab").concat(o,"\xbb موجود نیست."):f&&"همه بازی‌ها"!==f?"متأسفانه بازی‌های ژانر \xab".concat(f,"\xbb در حال حاضر در هیچ کافه‌ای در شهر \xab").concat(o,"\xbb موجود نیست."):"کافه‌ای با شرایط انتخابی در شهر \xab".concat(o,"\xbb یافت نشد.")}),(0,a.jsx)("p",{className:"text-[11px] text-amber-700 mt-1",children:"برای ادامه می‌توانید بازی/ژانر را تغییر دهید یا شهر دیگری را انتخاب کنید."})]}),(0,a.jsxs)("div",{className:"flex items-center justify-center gap-2 pt-1",children:[(0,a.jsxs)(n.$,{type:"button",size:"sm",variant:"outline",onClick:()=>t(b?2:1),className:"text-xs border-amber-300 text-amber-900 hover:bg-amber-100 rounded-xl h-8 px-3 font-bold",children:["\uD83D\uDD04 تغییر ",b?"بازی":"ژانر"]}),(0,a.jsx)(n.$,{type:"button",size:"sm",variant:"outline",onClick:()=>c("همه"),className:"text-xs border-amber-300 text-amber-900 hover:bg-amber-100 rounded-xl h-8 px-3 font-bold",children:"\uD83C\uDF0D نمایش همه شهرها"})]})]}),l&&(0,a.jsxs)("div",{className:"bg-emerald-50/70 border border-emerald-200 rounded-2xl p-3 space-y-2 text-xs w-full box-border",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-slate-700",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("span",{className:"text-slate-400 text-[10px] block",children:"بازی:"}),(0,a.jsx)("span",{className:"font-bold text-slate-900 truncate block",children:b?b.title:"ژانر ".concat(f)})]}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("span",{className:"text-slate-400 text-[10px] block",children:"زمان:"}),(0,a.jsxs)("span",{className:"font-bold text-slate-900 truncate block",children:[null==(e=g[j])?void 0:e.label," - ساعت ",w]})]}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("span",{className:"text-slate-400 text-[10px] block",children:"کافه:"}),(0,a.jsx)("span",{className:"font-bold text-slate-900 truncate block",children:l.name})]}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("span",{className:"text-slate-400 text-[10px] block",children:"ظرفیت:"}),(0,a.jsxs)("span",{className:"font-bold text-slate-900 truncate block",children:[y+1," نفر (",y," هم‌بازی)"]})]})]}),(0,a.jsxs)("div",{className:"pt-2 border-t border-emerald-200/60 flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-slate-600 font-medium",children:"هزینه انتشار میز:"}),(0,a.jsx)("span",{className:"font-black text-sm",children:0===l.hourlyRate||l.isFree?(0,a.jsx)("span",{className:"text-emerald-700",children:"رایگان"}):(0,a.jsxs)("span",{className:"text-emerald-700 font-bold",children:[(0,G.$g)(l.hourlyRate)," تومان"]})})]})]})]})}function J(){var e;let{step:t,setStep:s,onOpenChange:r,selectedGame:x,isContinuingWithGenre:m,selectedTime:u,activeTableDates:h,dayOptions:p,selectedDayIndex:b,isSubmitting:f,selectedCafe:g,handleSubmit:j}=v();return(0,a.jsxs)(l.Cf,{className:"w-[calc(100vw-2rem)] sm:w-full sm:max-w-lg max-h-[88vh] flex flex-col bg-white/95 backdrop-blur-xl border border-slate-100/90 text-slate-900 rounded-3xl shadow-2xl p-0 gap-0 overflow-hidden box-border [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",dir:"rtl",showCloseButton:!0,children:[(0,a.jsxs)("div",{className:"p-4 sm:p-5 pb-3 border-b border-slate-100 bg-gradient-to-b from-purple-50/50 via-white to-white shrink-0 w-full box-border",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-2.5",children:[(0,a.jsx)("div",{className:"w-9 h-9 sm:w-10 sm:h-10 rounded-2xl bg-purple-600 text-white flex items-center justify-center text-lg sm:text-xl shadow-md shadow-purple-600/20 shrink-0",children:"\uD83D\uDC51"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)(l.L3,{className:"text-sm sm:text-base font-black text-slate-900 truncate",children:"ایجاد میز بازی جدید"}),(0,a.jsxs)(l.rr,{className:"text-[11px] sm:text-xs font-bold text-purple-600 mt-0.5 truncate",children:[1===t&&"انتخاب ژانر یا سبک بازی",2===t&&"انتخاب عنوان بازی یا کل ژانر",3===t&&"تعیین روز و ساعت شروع بازی",4===t&&"تعداد هم‌بازی و حریم خصوصی میز",5===t&&"انتخاب کافه‌گیم و انتشار نهایی"]})]})]}),(0,a.jsx)(w,{})]}),(0,a.jsxs)("div",{className:"p-4 sm:p-5 overflow-y-auto flex-1 w-full box-border [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[1===t&&(0,a.jsx)(A,{}),2===t&&(0,a.jsx)(P,{}),3===t&&(0,a.jsx)(O,{}),4===t&&(0,a.jsx)($,{}),5===t&&(0,a.jsx)(B,{})]}),(0,a.jsxs)("div",{className:"p-4 border-t border-slate-100 bg-slate-50/90 backdrop-blur-sm flex items-center justify-between shrink-0",children:[t>1?(0,a.jsxs)(n.$,{variant:"ghost",size:"sm",onClick:()=>s(t-1),className:"text-xs text-slate-600 hover:text-slate-900 rounded-xl flex items-center gap-1",children:[(0,a.jsx)(i.A,{className:"w-4 h-4"}),"مرحله قبل"]}):(0,a.jsx)(n.$,{variant:"ghost",size:"sm",onClick:()=>r(!1),className:"text-xs text-slate-500 hover:text-slate-800 rounded-xl",children:"انصراف"}),t<5?(0,a.jsxs)(n.$,{size:"sm",disabled:2===t&&!x&&!m||3===t&&(!u||h.has(null==(e=p[b])?void 0:e.dateStr)),onClick:()=>s(t+1),className:"bg-gradient-to-r from-purple-600 to-indigo-600 hover:from-purple-700 hover:to-indigo-700 text-white font-bold text-xs px-5 py-2 rounded-xl shadow-md shadow-purple-600/20 flex items-center gap-1.5 disabled:opacity-50",children:["ادامه",(0,a.jsx)(d.A,{className:"w-4 h-4"})]}):(0,a.jsx)(n.$,{size:"sm",disabled:f||!g,onClick:j,className:"bg-gradient-to-r from-purple-600 to-indigo-600 hover:from-purple-700 hover:to-indigo-700 text-white font-black text-xs px-6 py-2.5 rounded-xl shadow-lg shadow-purple-600/30 flex items-center gap-2 disabled:opacity-50 active:scale-95 transition-transform",children:f?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.A,{className:"w-4 h-4 animate-spin"}),"در حال ثبت میز..."]}):(null==g?void 0:g.hourlyRate)===0||(null==g?void 0:g.isFree)?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c.A,{className:"w-4 h-4"}),"\uD83D\uDE80 انتشار رایگان میز بازی"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{children:"\uD83D\uDCB3"}),"تایید و پرداخت هزینه انتشار"]})})]})]})}function Y(e){return(0,a.jsx)(l.lG,{open:e.open,onOpenChange:e.onOpenChange,children:(0,a.jsx)(j,{...e,children:(0,a.jsx)(J,{})})})}},65142:(e,t,s)=>{s.d(t,{p:()=>l});var a=s(95155);s(12115);var r=s(64269);function l(e){let{className:t,type:s,...l}=e;return(0,a.jsx)("input",{type:s,"data-slot":"input",className:(0,r.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",t),...l})}},76444:(e,t,s)=>{s.d(t,{J:()=>n});var a=s(95155);s(12115);var r=s(10489),l=s(64269);function n(e){let{className:t,...s}=e;return(0,a.jsx)(r.b,{"data-slot":"label",className:(0,l.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...s})}},81703:(e,t,s)=>{s.d(t,{G:()=>o});var a=s(95155),r=s(52619),l=s.n(r),n=s(51834),i=s(3998),d=s(7420);function o(e){let{isOpen:t,onClose:s,title:r="ورود به حساب کاربری",description:o="برای استفاده از این امکانات و حضور در دنیای پلیمو، لطفاً ابتدا وارد حساب کاربری خود شوید یا ثبت‌نام کنید."}=e;return(0,a.jsx)(n.lG,{open:t,onOpenChange:e=>!e&&s(),children:(0,a.jsx)(n.Cf,{className:"sm:max-w-md w-[95%] rounded-3xl p-6 sm:p-8 bg-white",dir:"rtl",showCloseButton:!1,children:(0,a.jsxs)("div",{className:"text-center space-y-6",children:[(0,a.jsxs)("div",{className:"flex flex-col items-center",children:[(0,a.jsx)("div",{className:"p-4 rounded-2xl shadow-md",style:{backgroundColor:"#ffa515"},children:(0,a.jsx)(d.W,{className:"h-10 w-auto text-black"})}),(0,a.jsx)("div",{className:"text-[10px] font-bold text-gray-400 mt-2 uppercase tracking-wider",children:"Playmo.ir"})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("h3",{className:"text-lg sm:text-xl font-bold text-playmo-purple-700",children:r}),(0,a.jsx)("p",{className:"text-gray-600 text-xs sm:text-sm leading-relaxed px-2",children:o})]}),(0,a.jsxs)("div",{className:"grid gap-3 pt-2",children:[(0,a.jsx)(l(),{href:"/auth/customer/signin",className:"w-full",children:(0,a.jsx)(i.$,{className:"w-full h-11.5 py-2.5 text-sm sm:text-base font-medium bg-playmo-purple-600 hover:bg-playmo-purple-700 text-white rounded-2xl shadow-lg transition-all flex items-center justify-center gap-2",children:(0,a.jsx)("span",{children:"ورود به حساب کاربری"})})}),(0,a.jsx)(l(),{href:"/auth/customer/signup",className:"w-full",children:(0,a.jsx)(i.$,{variant:"outline",className:"w-full h-11.5 py-2.5 text-sm sm:text-base font-bold border-amber-300 text-amber-500 hover:bg-amber-50 hover:text-amber-600 hover:border-amber-400 rounded-2xl transition-all flex items-center justify-center gap-2",children:(0,a.jsx)("span",{children:"ثبت‌نام در پلیمو"})})}),(0,a.jsx)(i.$,{variant:"ghost",onClick:s,className:"w-full h-10 text-xs sm:text-sm text-playmo-purple-600 hover:text-playmo-purple-700 hover:bg-transparent mt-1",children:"بازگشت"})]})]})})})}},86948:(e,t,s)=>{s.d(t,{BT:()=>d,Wu:()=>o,ZB:()=>i,Zp:()=>l,aR:()=>n});var a=s(95155);s(12115);var r=s(64269);function l(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card",className:(0,r.cn)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...s})}function n(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-header",className:(0,r.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",t),...s})}function i(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-title",className:(0,r.cn)("leading-none font-semibold",t),...s})}function d(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-description",className:(0,r.cn)("text-muted-foreground text-sm",t),...s})}function o(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-content",className:(0,r.cn)("px-6",t),...s})}}}]);