1import{r as x,t as f,b as _,j as e}from"./index-C3Qps0S4.js";import{B as le}from"./button-xdpkFraK.js";import{I as ce}from"./input-Dj8udylZ.js";import{P as re}from"./progress-hz6bKT0N.js";import{D as q,a as Z,b as H,c as z,d as J}from"./dialog-BY1FISUw.js";import{P as K}from"./plus-BLlLQSZn.js";import{F as ne}from"./folder-open-BFhfsFp9.js";import{Z as ie}from"./zap-Dg3Ucl6s.js";import{T as de}from"./trending-up-Dq4_iocl.js";import{F as V}from"./flame-ClgW77Uq.js";import{U as oe}from"./undo-2-BQMFSJ40.js";import{T as ge}from"./trash-2-DOBLe4Vk.js";import"./index-Jol-UBUv.js";import"./index-BKUanX19.js";import"./index-Dr02_Kwf.js";const j=6,M=7,xe=4;function Ce(){const[a,E]=x.useState(null),[F,B]=x.useState(""),[X,T]=x.useState(!1),[Y,$]=x.useState(!1),G=x.useRef(null),m=f.useUtils(),{data:k}=f.sessions.list.useQuery(),{data:I}=f.sessions.get.useQuery({id:a},{enabled:!!a}),A=f.sessions.create.useMutation({onSuccess:s=>{E(s.id),T(!1),B(""),m.sessions.list.invalidate(),_.success("สรà¹à¸²à¸à¹à¸à¸ªà¸à¸±à¸à¹à¸«à¸¡à¹à¹à¸¥à¹à¸§")}}),N=f.rounds.add.useMutation({onSuccess:()=>{m.sessions.get.invalidate({id:a}),m.sessions.list.invalidate()}}),ee=f.rounds.undo.useMutation({onSuccess:()=>{m.sessions.get.invalidate({id:a}),m.sessions.list.invalidate(),_.success("ลà¸à¸à¸±à¸§à¸¥à¹à¸²à¸ªà¸¸à¸à¹à¸¥à¹à¸§")}}),ae=f.rounds.clear.useMutation({onSuccess:()=>{m.sessions.get.invalidate({id:a}),m.sessions.list.invalidate(),_.success("ลà¸à¸à¸±à¹à¸à¸«à¸¡à¸à¹à¸¥à¹à¸§")}}),t=I?.rounds??[],C=s=>{if(!a){_.error("à¸à¸£à¸¸à¸à¸²à¸ªà¸£à¹à¸²à¸à¸«à¸£à¸·à¸à¹à¸¥à¸·à¸à¸à¹à¸à¸ªà¸à¸±à¸à¸à¹à¸à¸");return}N.mutate({sessionId:a,result:s})},{gridData:se,gridCols:S}=x.useMemo(()=>{const r=Math.max(M,Math.ceil(t.length/j)),n=Array.from({length:j},()=>Array(r).fill(null));return t.forEach((p,v)=>{const d=Math.floor(v/j),i=v%j;d<r&&(n[i][d]=p.result)}),{gridData:n,gridCols:r}},[t]);x.useEffect(()=>{G.current&&t.length>j*M&&(G.current.scrollLeft=G.current.scrollWidth)},[t.length]);const l=x.useMemo(()=>{const s=t.length,r=xe,n=Math.min(s,r),p=s>=r,v=n/r*100;let d=null,i=0,h="à¸à¸³à¸¥à¸±à¸à¸§à¸´à¹à¸à¸£à¸²à¸°à¸«à¹...",O=0,U=0;if(p&&s>0){const o=t.map(b=>b.result).filter(b=>b!=="tie"),u=o.length;if(u>=3){let b=0,y=0,w=0,g=1;for(let c=u-2;c>=0&&o[c]===o[u-1];c--)g++;g>=3?(b=30,h=`มัà¸à¸à¸£ ${o[u-1]==="banker"?"à¹à¸à¸":"à¸à¹à¸³à¹à¸à¸´à¸"} (${g} à¸à¸²)`):g>=2&&(b=15,h=`Streak ${g} à¸à¸²`);const P=o.slice(-6);let L=0;for(let c=1;c<P.length;c++)P[c]!==P[c-1]&&L++;const Q=P.length>1?L/(P.length-1):0;Q>.7?(y=25,h="à¸à¸´à¸à¸à¸à¸ (สลัà¸)"):Q>.5&&(y=10);const W=o.slice(-10),D=W.filter(c=>c==="player").length,R=W.filter(c=>c==="banker").length,te=Math.abs(D-R);w=Math.min(te*5,25),b>=30?(d=o[u-1],i=55+g*5+w):y>=25?(d=o[u-1]==="banker"?"player":"banker",i=55+y):(R>D?(d="banker",i=50+w):D>R?(d="player",i=50+w):(d=o[u-1]==="banker"?"player":"banker",i=50),!h.includes("มัà¸à¸à¸£")&&!h.includes("à¸à¸´à¸à¸à¸à¸")&&(h="Mixed Pattern")),i=Math.min(i,95),O=Math.min(g,5),U=Math.max(0,3-g)}}return{currentCount:n,roundsNeeded:r,isReady:p,progress:v,prediction:d,confidence:Math.round(i),pattern:h,winStreak:O,loseStreak:U}},[t]);return e.jsxs("div",{"data-loc":"client/src/pages/GamePage.tsx:197",className:"space-y-3",children:[e.jsxs("div",{"data-loc":"client/src/pages/GamePage.tsx:199",className:"flex items-center justify-between",children:[e.jsx("h1",{"data-loc":"client/src/pages/GamePage.tsx:200",className:"text-lg font-bold text-gold-gradient",children:"à¹à¸¥à¹à¸à¸ªà¸¹à¸à¸£à¸à¸²à¸à¸²à¸£à¹à¸²"}),e.jsxs("div",{"data-loc":"client/src/pages/GamePage.tsx:201",className:"flex gap-1.5",children:[e.jsxs(q,{"data-loc":"client/src/pages/GamePage.tsx:202",open:X,onOpenChange:T,children:[e.jsx(Z,{"data-loc":"client/src/pages/GamePage.tsx:203",asChild:!0,children:e.jsxs("button",{"data-loc":"client/src/pages/GamePage.tsx:204",className:"relative flex items-center gap-1.5 px-4 py-2 rounded-full bg-gradient-to-r from-orange-500 to-amber-500 border border-orange-400/60 text-xs font-bold text-white shadow-[0_0_14px_rgba(249,115,22,0.4)] hover:shadow-[0_0_20px_rgba(249,115,22,0.6)] hover:scale-105 active:scale-95 transition-all",children:[e.jsx("span",{"data-loc":"client/src/pages/GamePage.tsx:205",className:"absolute inset-0 rounded-full animate-pulse bg-orange-400/10"}),e.jsx(K,{"data-loc":"client/src/pages/GamePage.tsx:206",className:"h-3.5 w-3.5 relative"}),e.jsx("span",{"data-loc":"client/src/pages/GamePage.tsx:207",className:"relative",children:"à¹à¸«à¸¡à¹"})]})}),e.jsxs(H,{"data-loc":"client/src/pages/GamePage.tsx:210",className:"bg-[#0D0D0D] border-red-500/20",children:[e.jsx(z,{"data-loc":"client/src/pages/GamePage.tsx:211",children:e.jsx(J,{"data-loc":"client/src/pages/GamePage.tsx:212",className:"text-white",children:"สรà¹à¸²à¸à¹à¸à¸ªà¸à¸±à¸à¹à¸«à¸¡à¹"})}),e.jsxs("div",{"data-loc":"client/src/pages/GamePage.tsx:214",className:"space-y-4 pt-4",children:[e.jsx(ce,{"data-loc":"client/src/pages/GamePage.tsx:215",placeholder:"à¸à¸·à¹à¸à¹à¸à¸ªà¸à¸±à¸ à¹à¸à¹à¸ à¹à¸à¹à¸° 1 รà¸à¸à¹à¸à¹à¸²",value:F,onChange:s=>B(s.target.value),className:"bg-black/60 border-red-500/20"}),e.jsx(le,{"data-loc":"client/src/pages/GamePage.tsx:221",onClick:()=>A.mutate({name:F||"à¹à¸à¸ªà¸à¸±à¸à¹à¸«à¸¡à¹"}),className:"w-full bg-gradient-to-r from-red-500 to-orange-500 text-white border-0",disabled:A.isPending,children:"สรà¹à¸²à¸"})]})]})]}),e.jsxs(q,{"data-loc":"client/src/pages/GamePage.tsx:232",open:Y,onOpenChange:$,children:[e.jsx(Z,{"data-loc":"client/src/pages/GamePage.tsx:233",asChild:!0,children:e.jsxs("button",{"data-loc":"client/src/pages/GamePage.tsx:234",className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg bg-black/40 border border-red-500/20 text-xs text-gray-300",children:[e.jsx(ne,{"data-loc":"client/src/pages/GamePage.tsx:235",className:"h-3 w-3"}),"à¹à¸«à¸¥à¸"]})}),e.jsxs(H,{"data-loc":"client/src/pages/GamePage.tsx:239",className:"bg-[#0D0D0D] border-red-500/20",children:[e.jsx(z,{"data-loc":"client/src/pages/GamePage.tsx:240",children:e.jsx(J,{"data-loc":"client/src/pages/GamePage.tsx:241",className:"text-white",children:"à¹à¸¥à¸·à¸à¸à¹à¸à¸ªà¸à¸±à¸"})}),e.jsxs("div",{"data-loc":"client/src/pages/GamePage.tsx:243",className:"space-y-2 pt-4 max-h-60 overflow-y-auto",children:[k?.map(s=>e.jsx("div",{"data-loc":"client/src/pages/GamePage.tsx:245",className:"flex items-center justify-between p-3 rounded-lg bg-black/40 border border-red-500/10 hover:border-orange-500/30 cursor-pointer transition-all",onClick:()=>
1{E(s.id),$(!1)},children:e.jsxs("div",{"data-loc":"client/src/pages/GamePage.tsx:250",children:[e.jsx("p",{"data-loc":"client/src/pages/GamePage.tsx:251",className:"font-medium text-sm text-white",children:s.name}),e.jsxs("p",{"data-loc":"client/src/pages/GamePage.tsx:252",className:"text-xs text-gray-500",children:[s.totalRounds," à¸à¸²"]})]})},s.id)),(!k||k.length===0)&&e.jsx("p",{"data-loc":"client/src/pages/GamePage.tsx:257",className:"text-center text-gray-500 text-sm py-4",children:"ยัà¸à¹à¸¡à¹à¸¡à¸µà¹à¸à¸ªà¸à¸±à¸"})]})]})]})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/GamePage.tsx:266",className:"glass-card-orange rounded-2xl overflow-hidden",children:[e.jsx("div",{"data-loc":"client/src/pages/GamePage.tsx:267",className:"p-3 min-h-[200px]",children:t.length===0?e.jsxs("div",{"data-loc":"client/src/pages/GamePage.tsx:269",className:"flex flex-col items-center justify-center h-[180px] text-gray-500",children:[e.jsx(ie,{"data-loc":"client/src/pages/GamePage.tsx:270",className:"w-8 h-8 mb-2 opacity-30"}),e.jsx("p",{"data-loc":"client/src/pages/GamePage.tsx:271",className:"text-sm",children:"à¸à¹à¸à¸à¸ªà¸à¸´à¸à¸´à¸¥à¹à¸²à¸ªà¸¸à¸à¸à¸à¸à¸«à¹à¸à¸à¸à¸µà¹à¹à¸¥à¹à¸"}),e.jsx("p",{"data-loc":"client/src/pages/GamePage.tsx:272",className:"text-xs mt-1 text-gray-600",children:"à¸à¸à¸à¸¸à¹à¸¡à¸à¹à¸²à¸à¸¥à¹à¸²à¸à¹à¸à¸·à¹à¸à¸à¸±à¸à¸à¸¶à¸à¸à¸¥"})]}):e.jsx("div",{"data-loc":"client/src/pages/GamePage.tsx:275",ref:G,className:"overflow-x-auto pb-1",style:{scrollBehavior:"smooth"},children:e.jsx("div",{"data-loc":"client/src/pages/GamePage.tsx:280",className:"grid gap-1.5",style:{gridTemplateColumns:`repeat(${S}, minmax(36px, 1fr))`,gridTemplateRows:`repeat(${j}, 1fr)`,minWidth:S>M?`${S*42}px`:void 0},children:se.map((s,r)=>s.map((n,p)=>e.jsx("div",{"data-loc":"client/src/pages/GamePage.tsx:290",className:"aspect-square flex items-center justify-center",style:{gridRow:r+1,gridColumn:p+1},children:n?e.jsx("div",{"data-loc":"client/src/pages/GamePage.tsx:296",className:`w-full h-full max-w-[36px] max-h-[36px] rounded-full flex items-center justify-center text-xs font-bold text-white animate-token-enter ${n==="banker"?"bg-[#EF4444] shadow-[0_0_8px_rgba(239,68,68,0.5)]":n==="player"?"bg-[#3B82F6] shadow-[0_0_8px_rgba(59,130,246,0.5)]":"bg-[#22C55E] shadow-[0_0_8px_rgba(34,197,94,0.5)]"}`,children:n==="banker"?"B":n==="player"?"P":"T"}):e.jsx("div",{"data-loc":"client/src/pages/GamePage.tsx:308",className:"w-full h-full max-w-[36px] max-h-[36px] rounded-full border border-white/5"})},`${r}-${p}`)))})})}),t.length>0&&e.jsxs("div",{"data-loc":"client/src/pages/GamePage.tsx:319",className:"px-3 pb-2 flex justify-between items-center",children:[e.jsxs("span",{"data-loc":"client/src/pages/GamePage.tsx:320",className:"text-[10px] text-gray-500",children:["à¸à¸±à¹à¸à¸«à¸¡à¸ ",t.length," à¸à¸²"]}),e.jsx("span",{"data-loc":"client/src/pages/GamePage.tsx:321",className:"text-[10px] text-gray-500",children:a&&I?.session?.name||""})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/GamePage.tsx:329",className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{"data-loc":"client/src/pages/GamePage.tsx:331",className:"glass-card rounded-xl p-3 text-center",children:[e.jsx("p",{"data-loc":"client/src/pages/GamePage.tsx:332",className:"text-[10px] text-gray-500 mb-1",children:"à¸à¸³à¸à¸§à¸à¹à¸¡à¹"}),e.jsxs("p",{"data-loc":"client/src/pages/GamePage.tsx:333",className:"text-2xl font-bold text-white",children:[l.currentCount,e.jsxs("span",{"data-loc":"client/src/pages/GamePage.tsx:334",className:"text-sm text-gray-500",children:["/",l.roundsNeeded]})]}),e.jsx(re,{"data-loc":"client/src/pages/GamePage.tsx:336",value:l.progress,className:"h-1 mt-2 bg-black/40"})]}),e.jsxs("div",{"data-loc":"client/src/pages/GamePage.tsx:340",className:"glass-card rounded-xl p-3 text-center",children:[e.jsx("p",{"data-loc":"client/src/pages/GamePage.tsx:341",className:"text-[10px] text-gray-500 mb-1",children:"à¸à¸²à¸à¸±à¸à¹à¸"}),l.isReady?l.prediction?e.jsx("div",{"data-loc":"client/src/pages/GamePage.tsx:349",className:"flex items-center justify-center h-[40px]",children:e.jsx("div",{"data-loc":"client/src/pages/GamePage.tsx:350",className:`w-10 h-10 rounded-full flex items-center justify-center text-sm font-bold text-white animate-pulse-glow ${l.prediction==="banker"?"bg-[#EF4444] shadow-[0_0_12px_rgba(239,68,68,0.6)]":"bg-[#3B82F6] shadow-[0_0_12px_rgba(59,130,246,0.6)]"}`,children:l.prediction==="banker"?"B":"P"})}):e.jsx("span",{"data-loc":"client/src/pages/GamePage.tsx:361",className:"text-lg font-bold text-gray-500",children:"-"}):e.jsx("div",{"data-loc":"client/src/pages/GamePage.tsx:343",className:"flex items-center justify-center h-[40px]",children:e.jsx("span",{"data-loc":"client/src/pages/GamePage.tsx:344",className:"text-sm font-bold text-gray-500 bg-black/40 rounded-full px-3 py-1",children:"รà¸à¸ªà¸¹à¸à¸£"})})]})]}),l.isReady&&l.prediction&&e.jsxs("div",{"data-loc":"client/src/pages/GamePage.tsx:368",className:"glass-card-orange rounded-xl p-3",children:[e.jsxs("div",{"data-loc":"client/src/pages/GamePage.tsx:369",className:"flex items-center justify-between",children:[e.jsxs("div",{"data-loc":"client/src/pages/GamePage.tsx:370",className:"flex items-center gap-2",children:[e.jsx(de,{"data-loc":"client/src/pages/GamePage.tsx:371",className:"w-4 h-4 text-orange-400"}),e.jsx("span",{"data-loc":"client/src/pages/GamePage.tsx:372",className:"text-xs text-gray-300",children:l.pattern})]}),e.jsx("div",{"data-loc":"client/src/pages/GamePage.tsx:374",className:"flex items-center gap-1",children:e.jsxs("span",{"data-loc":"client/src/pages/GamePage.tsx:375",className:"text-xl font-bold text-orange-400",children:[l.confidence,"%"]})})]}),e.jsxs("div",{"data-loc":"client/src/pages/GamePage.tsx:379",className:"flex items-center gap-3 mt-2",children:[e.jsxs("div",{"data-loc":"client/src/pages/GamePage.tsx:380",className:"flex items-center gap-1",children:[e.jsx(V,{"data-loc":"client/src/pages/GamePage.tsx:381",className:"w-3 h-3 text-green-400"}),e.jsxs("span",{"data-loc":"client/src/pages/GamePage.tsx:382",className:"text-[10px] text-green-400",children:["à¸à¸à¸° ",l.winStreak]})]}),e.jsxs("div",{"data-loc":"client/src/pages/GamePage.tsx:384",className:"flex items-center gap-1",children:[e.jsx(V,{"data-loc":"client/src/pages/GamePage.tsx:385",className:"w-3 h-3 text-red-400"}),e.jsxs("span",{"data-loc":"client/src/pages/GamePage.tsx:386",className:"text-[10px] text-red-400",children:["à¹à¸à¹ ",l.loseStreak]})]})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/GamePage.tsx:393",className:"grid grid-cols-3 gap-2",children:[e.jsx("button",{"data-loc":"client/src/pages/GamePage.tsx:394",onClick:()=>C("player"),disabled:!a||N.isPending,className:"h-14 text-base font-bold bg-[#3B82F6] hover:bg-[#2563EB] disabled:opacity-40 text-white rounded-xl transition-all active:scale-[0.95] shadow-[0_0_15px_rgba(59,130,246,0.3)] border-0",children:"Player"}),e.jsx("button",{"data-loc":"client/src/pages/GamePage.tsx:401",onClick:()=>C("tie"),disabled:!a||N.isPending,className:"h-14 text-base font-bold bg-[#22C55E] hover:bg-[#16A34A] disabled:opacity-40 text-white rounded-xl transition-all active:scale-[0.95] shadow-[0_0_15px_rgba(34,197,94,0.3)] border-0",children:"Tie"}),e.jsx("button",{"data-loc":"client/src/pages/GamePage.tsx:408",onClick:()=>C("banker"),disabled:!a||N.isPending,className:"h-14 text-base font-bold bg-[#EF4444] hover:bg-[#DC2626] disabled:opacity-40 text-white rounded-xl transition-all active:scale-[0.95] shadow-[0_0_15px_rgba(239,68,68,0.3)] border-0",children:"Banker"})]}),e.jsxs("div",{"data-loc":"client/src/pages/GamePage.tsx:418",className:"grid grid-cols-2 gap-2",children:[e.jsxs("button",{"data-loc":"client/src/pages/GamePage.tsx:419",onClick:()=>a&&ee.mutate({sessionId:a}),disabled:!a||t.length===0,className:"h-11 text-sm font-medium rounded-xl border border-red-500/20 bg-black/40 text-gray-300 hover:bg-red-500/10 disabled:opacity-30 transition-all active:scale-[0.95] flex items-center justify-center gap-1.5",children:[e.jsx(oe,{"data-loc":"client/src/pages/GamePage.tsx:424",className:"h-4 w-4"}),"ลà¸à¸à¸±à¸§à¸¥à¹à¸²à¸ªà¸¸à¸"]}),e.jsxs("button",{"data-loc":"client/src/pages/GamePage.tsx:427",onClick:()=>{a&&confirm("à¸à¹à¸à¸à¸à¸²à¸£à¸¥à¸à¸à¸±à¹à¸à¸«à¸¡à¸?")&&ae.mutate({sessionId:a})},disabled:!a||t.length===0,className:"h-11 text-sm font-medium rounded-xl border border-red-500/20 bg-black/40 text-gray-300 hover:bg-red-500/10 disabled:opacity-30 transition-all active:scale-[0.95] flex items-center justify-center gap-1.5",children:[e.jsx(ge,{"data-loc":"client/src/pages/GamePage.tsx:432",className:"h-4 w-4"}),"ลà¸à¸à¸±à¹à¸à¸«à¸¡à¸"]})]}
1),!a&&e.jsxs("div",{"data-loc":"client/src/pages/GamePage.tsx:439",className:"glass-card rounded-xl p-5 text-center border border-orange-500/20 bg-gradient-to-b from-orange-500/5 to-transparent",children:[e.jsx("div",{"data-loc":"client/src/pages/GamePage.tsx:440",className:"flex justify-center mb-3",children:e.jsx("div",{"data-loc":"client/src/pages/GamePage.tsx:441",className:"w-10 h-10 rounded-full bg-orange-500/20 flex items-center justify-center shadow-[0_0_12px_rgba(249,115,22,0.2)]",children:e.jsx(K,{"data-loc":"client/src/pages/GamePage.tsx:442",className:"w-5 h-5 text-orange-400"})})}),e.jsxs("p",{"data-loc":"client/src/pages/GamePage.tsx:445",className:"text-sm text-white font-medium",children:["à¸à¸à¸à¸¸à¹à¸¡ ",e.jsx("span",{"data-loc":"client/src/pages/GamePage.tsx:445",className:"text-orange-400 font-bold",children:'"à¹à¸«à¸¡à¹"'})," à¹à¸à¸·à¹à¸à¹à¸£à¸´à¹à¸¡à¹à¸à¸ªà¸à¸±à¸"]}),e.jsxs("p",{"data-loc":"client/src/pages/GamePage.tsx:446",className:"text-xs text-gray-500 mt-1",children:["หรืภ",e.jsx("span",{"data-loc":"client/src/pages/GamePage.tsx:446",className:"text-gray-400",children:'"à¹à¸«à¸¥à¸"'})," à¹à¸à¸·à¹à¸à¹à¸à¸´à¸à¹à¸à¸ªà¸à¸±à¸à¹à¸à¸´à¸¡"]})]}),e.jsx("div",{"data-loc":"client/src/pages/GamePage.tsx:451",className:"rounded-lg border border-red-500/10 bg-red-500/5 p-2",children:e.jsx("p",{"data-loc":"client/src/pages/GamePage.tsx:452",className:"text-[10px] text-red-400/60 text-center",children:"สูà¸à¸£à¸à¸µà¹à¹à¸à¹à¸à¹à¸à¸µà¸¢à¸à¸à¸²à¸£à¸§à¸´à¹à¸à¸£à¸²à¸°à¸«à¹à¸à¸²à¸à¸ªà¸à¸´à¸à¸´à¹à¸à¸·à¹à¸à¸à¸§à¸²à¸¡à¸à¸±à¸à¹à¸à¸´à¸à¹à¸à¹à¸²à¸à¸±à¹à¸ à¹à¸¡à¹à¹à¸à¹à¸à¸³à¹à¸à¸°à¸à¸³à¸à¸²à¸à¸à¸²à¸£à¹à¸à¸´à¸ à¹à¸¡à¹à¸ªà¸²à¸¡à¸²à¸£à¸à¸£à¸±à¸à¸à¸£à¸°à¸à¸±à¸à¸à¸¥à¸¥à¸±à¸à¸à¹à¹à¸à¹"})})]})}export{Ce as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.