import{r as b,R as e}from"./index-56c1d501.js";import{c as Ht}from"./clsx-e0889333.js";import{m as p,u as y,A as v,a as w,c as Vt,b as Ft,d as zt,e as Kt,t as qt,Q as Jt,P as Qt}from"./redux-thunk-93cdf4f0.js";import{a as ce,g as qe}from"./ststistic-3f81b54e.js";import{F as E,A as Zt,k as Ye,m as Je,s as en,q as tn,a as Re}from"./index-63998e7b.js";import{u as ne}from"./use-sound.esm-86ef9aee.js";import{a as nn}from"./achievement-bell-6816205c.js";import{a as an,s as cn}from"./sadTrombone-a3e2bf79.js";import{c as on}from"./correct-answer-tone-2b1e449a.js";import{b as sn,c as ln}from"./index-01effd93.js";import{d as rn,p as dn,a as mn,P as gn}from"./index-bdb71453.js";import"./fingerprint-374ab551.js";import{_ as pn}from"./preload-helper-f61836a9.js";import"./recaptcha-v3-f0e7cd4f.js";import"./index-f11686b8.js";const Qe="SET_SETTINGS",ie="SET_GLOBAL_MODAL",Ze="CLOSE_GLOBAL_MODAL",et="INIT_NEW_GAME",tt="START_NEW_GAME",te="SET_GAME_STATE",Pe="PUT_DISC",nt="SET_RECORDED_TIME",Be="SET_GAME_WINNER",A="MODAL/COMPLETED",oe="MODAL/MENU",se="MODAL/SETTING",le="MODAL/HOW_TO_PLAY",re="MODAL/STATICS",un={HOWTOPLAY:"/how-to-play",STATICS:"/stat",MAIN:"/",ALL:"*"},at=document.getElementById("root").getAttribute("data-game-title").replaceAll("\\",""),bn=document.getElementById("root").getAttribute("data-new").replaceAll("\\",""),fn=document.getElementById("root").getAttribute("data-you-win").replaceAll("\\",""),yn=document.getElementById("root").getAttribute("data-bot-win").replaceAll("\\",""),xn=document.getElementById("root").getAttribute("data-game-over").replaceAll("\\",""),_n=document.getElementById("root").getAttribute("data-time").replaceAll("\\",""),kn=document.getElementById("root").getAttribute("data-new-game").replaceAll("\\",""),En=document.getElementById("root").getAttribute("data-easy").replaceAll("\\",""),wn=document.getElementById("root").getAttribute("data-medium").replaceAll("\\",""),hn=document.getElementById("root").getAttribute("data-hard").replaceAll("\\",""),vn=document.getElementById("root").getAttribute("data-expert").replaceAll("\\",""),ct=document.getElementById("root").getAttribute("data-menu").replaceAll("\\",""),jn=document.getElementById("root").getAttribute("data-main").replaceAll("\\",""),pe=document.getElementById("root").getAttribute("data-options").replaceAll("\\",""),Nn=document.getElementById("root").getAttribute("data-how-to-play").replaceAll("\\",""),ot=document.getElementById("root").getAttribute("data-statics").replaceAll("\\",""),An=document.getElementById("root").getAttribute("data-loading").replaceAll("\\",""),In=document.getElementById("root").getAttribute("data-disc-types").replaceAll("\\",""),Tn=document.getElementById("root").getAttribute("data-disc-colors").replaceAll("\\",""),st=document.getElementById("root").getAttribute("data-board").replaceAll("\\",""),Sn=document.getElementById("root").getAttribute("data-background").replaceAll("\\",""),Ln=document.getElementById("root").getAttribute("data-sound").replaceAll("\\",""),Dn=document.getElementById("root").getAttribute("data-total-played").replaceAll("\\",""),On=document.getElementById("root").getAttribute("data-win-ratio").replaceAll("\\",""),$n=document.getElementById("root").getAttribute("data-win-streak").replaceAll("\\",""),Cn=document.getElementById("root").getAttribute("data-highest-win-streak").replaceAll("\\",""),Mn=document.getElementById("root").getAttribute("data-average-win-time").replaceAll("\\",""),Rn=document.getElementById("root").getAttribute("data-fastest-win-time").replaceAll("\\",""),Pn=document.getElementById("root").getAttribute("data-latest-win-time").replaceAll("\\",""),Bn=document.getElementById("root").getAttribute("data-reset").replaceAll("\\",""),Ge=document.getElementById("root").getAttribute("data-cancel").replaceAll("\\",""),We=document.getElementById("root").getAttribute("data-you").replaceAll("\\",""),ue=document.getElementById("root").getAttribute("data-bot").replaceAll("\\",""),Gn=document.getElementById("root").getAttribute("data-how-to-play-description").replaceAll("<game-title>",at).replaceAll("\\",""),Un=document.getElementById("root").getAttribute("data-are-you-sure-you-want-to-reset-stats").replaceAll("\\",""),Yn=document.getElementById("root").getAttribute("data-ok").replaceAll("\\","");document.documentElement.lang;const _={PLAYING:1,LOADING:2,THINKING:3,ENDED:4},I=[En,wn,hn,vn],Wn=[{label:jn,to:un.MAIN},{label:pe,modalName:se},{label:Nn,modalName:le},{label:ot,modalName:re}],Xn=(t=!1)=>{const n=new Date().toLocaleDateString();let a=localStorage.getItem("connect4-browserVisitId");return(t||!(localStorage.getItem("connect4-currentDate")===n&&a))&&(localStorage.removeItem("persist:"+localStorage.getItem("connect4-browserVisitId")),a=Math.random().toString(36).substr(2,9),localStorage.setItem("connect4-currentDate",n),localStorage.setItem("connect4-browserVisitId",a)),a},de=t=>JSON.parse(JSON.stringify(t)),Q=t=>{const n=Math.floor(t/3600),a=Math.floor(t%3600/60),c=t%60,r=`${a.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}`;return n===0?r:`${n.toString().padStart(2,"0")}:${r}`},Hn=t=>{const n=new Date(t);return Q(Math.floor((new Date().getTime()-n.getTime())/1e3))},be={played:0,completed:[],failed:0,streak:0,maxStreak:0},lt=(t,n,a)=>{const c=rt();c.played+=t,c.completed.push(...n),c.failed+=a,a===0?(c.streak+=1,c.maxStreak=Math.max(c.maxStreak,c.streak)):c.streak=0,localStorage.setItem("connect4-state","Completed"),localStorage.setItem("connect4-stats",JSON.stringify(c))},rt=()=>{const t=localStorage.getItem("connect4-stats");return t?JSON.parse(t):be},Vn=()=>(localStorage.setItem("connect4-stats",JSON.stringify(be)),be),Fn=({playedTime:t,difficulty:n})=>{lt(1,[{playedTime:t,difficulty:n}],0)},zn=()=>{lt(1,[],1)},it=t=>{for(let n=t.length-1;n>0;n--){const a=Math.floor(Math.random()*(n+1));[t[n],t[a]]=[t[a],t[n]]}return t},T=6,me=7,Z=1,ee=2,Kn=null,fe=()=>Array.from({length:me},()=>Array.from({length:T}).fill(Kn)),qn=t=>Array.from({length:T},(n,a)=>Array.from({length:me},(c,r)=>t[r][a])),dt=(t,n,a=0,c=0,r,o)=>{const l=mt(t,n,a,c);if(n===0||l===1/0||l===-1/0||pt(t))return[null,l];let s=[null,-1/0];return it(Array.from({length:7},(i,d)=>d)).forEach(i=>{let d=de(t);const u=gt(d,i);if(u>-1&&!d[u][i]){d[u][i]=2;let g=Jn(d,n-1,a,c,r,o);if((s[0]===null||g[1]>s[1])&&(s[0]=i,s[1]=g[1],r=g[1]),r>=o)return s}}),s},Jn=(t,n,a,c=0,r,o)=>{const l=mt(t,n,a,c);if(n===0||l===1/0||l===-1/0||pt(t))return[null,l];let s=[null,1/0];return it(Array.from({length:7},(i,d)=>d)).forEach(i=>{let d=de(t);const u=gt(d,i);if(u>-1&&!d[u][i]){d[u][i]=1;let g=dt(d,n-1,a,c,r,o);if((s[0]==null||g[1]<s[1])&&(s[0]=i,s[1]=g[1],o=g[1]),r>=o)return s}}),s},mt=(t,n,a,c=0)=>{let r=0;const o=[{deltaY:1,deltaX:0,rowInit:0,rowLimit:3,colLimit:me},{deltaY:0,deltaX:1,rowInit:0,rowLimit:T,colLimit:4},{deltaY:1,deltaX:1,rowInit:0,rowLimit:3,colLimit:4},{deltaY:-1,deltaX:1,rowInit:3,rowLimit:T,colLimit:4}],l=(s,m,i,d,u)=>{let g=0,f=0,k=0;for(let N=0;N<4;N++){const L=u[s+N*i][m+N*d];L===Z?g++:L===ee?f++:k++}let h=0;return f===4?h+=1/0:f===3&&k===1?h+=50:a>1&&f===2&&k===2&&(h+=20),g===4?h-=1/0:g===3&&k===1?h-=40:a>1&&g===2&&k===2&&(h-=10),h};for(let{deltaY:s,deltaX:m,rowInit:i,rowLimit:d,colLimit:u}of o)for(let g=i;g<d;g++)for(let f=0;f<u;f++){let k=l(g,f,s,m,t);if(k===1/0||k===-1/0)return k;r+=k}return r+c+n*5},gt=(t,n)=>{let a=0;for(;a<5&&!t[a+1][n];)a++;return a},pt=t=>t[0].every(n=>n),ut=t=>{const n=[{deltaY:1,deltaX:0,rowInit:0,rowLimit:3,colLimit:me},{deltaY:0,deltaX:1,rowInit:0,rowLimit:T,colLimit:4},{deltaY:1,deltaX:1,rowInit:0,rowLimit:3,colLimit:4},{deltaY:-1,deltaX:1,rowInit:3,rowLimit:T,colLimit:4}],a=(c,r,o,l,s)=>{let m=0,i=0;for(let d=0;d<4;d++){const u=s[r+d*l][c+d*o];u===Z?m++:u===ee&&i++}return m===4?Z:i===4?ee:0};for(let{deltaY:c,deltaX:r,rowInit:o,rowLimit:l,colLimit:s}of n)for(let m=o;m<l;m++)for(let i=0;i<s;i++){const d=a(m,i,c,r,t);if(d>0){const u=Array.from({length:4},(g,f)=>[i+f*r,m+f*c]);return{winner:d,matchedDiscs:u}}}return t.every(c=>c[0])?{winner:3,matchedDiscs:[]}:{winner:0,matchedDiscs:[]}},Qn=(t,n=I[0])=>a=>(a({type:te,payload:_.LOADING}),new Promise(async(c,r)=>{try{a({type:et,payload:{difficulty:n,turn:t}}),localStorage.setItem("connect4-state","Running"),c()}catch(o){r(o)}})),Zn=(t,n=I[0])=>a=>(a({type:te,payload:_.LOADING}),new Promise(async(c,r)=>{try{a({type:tt,payload:{difficulty:n,turn:t}}),localStorage.setItem("connect4-state","Running"),c()}catch(o){r(o)}})),ea=()=>t=>{t({type:nt})},ta=(t,n)=>(a,c)=>{const{table:r,status:o,created:l}=c().connect4;if(o===_.ENDED)return;const s=de(r),m=s[t].lastIndexOf(null);if(m<0)return;s[t][m]=Z,a({type:Pe,newTable:s,lastDisc:[t,m]}),n(),a({type:te,payload:_.THINKING});const{winner:i,matchedDiscs:d}=ut(s);i>0?(i===1?ce("connect4","success",l.getTime()):i===2&&ce("connect4","fail",l.getTime()),a({type:Be,payload:{winner:i,matchedDiscs:d}}),a({type:ie,name:A,payload:!0})):setTimeout(()=>{bt(n)(a,c)},300)},bt=t=>async(n,a)=>{const{table:c,difficulty:r,status:o,created:l}=a().connect4;if(o===_.ENDED)return;let s=I.indexOf(r)+2,m=await dt(qn(c),s,I.indexOf(r));if(typeof m<"u"&&m[0]!==null){const i=de(c),d=i[m[0]].lastIndexOf(null);if(d<0)return;i[m[0]][d]=ee,n({type:Pe,newTable:i,lastDisc:[m[0],d]}),t();const{winner:u,matchedDiscs:g}=ut(i);u>0?(u===1?ce("connect4","success",l.getTime()):u===2&&ce("connect4","fail",l.getTime()),n({type:Be,payload:{winner:u,matchedDiscs:g}}),n({type:ie,name:A,payload:!0})):n({type:te,payload:_.PLAYING})}},Xe="/build/assets/board-0-f79f9c1c.png",He="/build/assets/board-1-5fb2522a.png",Ve="/build/assets/board-2-d70a4acd.png",Fe="/build/assets/board-3-af08abf7.png",ze="/build/assets/board-4-d7c0b591.png",Ke="/build/assets/board-5-8de53feb.png",ye="/build/assets/disc-0g-620f904b.png",xe="/build/assets/disc-0o-de2f99fd.png",_e="/build/assets/disc-0r-a51e3b1e.png",ke="/build/assets/disc-0y-3dd81f21.png",Ee="/build/assets/disc-1g-3aeacc04.png",we="/build/assets/disc-1o-d78a7ead.png",he="/build/assets/disc-1r-54504d1d.png",ve="/build/assets/disc-1y-02ae47fe.png",je="/build/assets/disc-2g-c63aaef7.png",Ne="/build/assets/disc-2o-e6142add.png",Ae="/build/assets/disc-2r-c5eec3ec.png",Ie="/build/assets/disc-2y-4961fb2b.png",Te="/build/assets/disc-3g-4917149b.png",Se="/build/assets/disc-3o-a8ae30c7.png",Le="/build/assets/disc-3r-aac75d6e.png",De="/build/assets/disc-3y-6c7e0d03.png",Oe="/build/assets/disc-4g-2ce3daa4.png",$e="/build/assets/disc-4o-e6c4035a.png",Ce="/build/assets/disc-4r-db3828ba.png",Me="/build/assets/disc-4y-41e21578.png",na=b.memo(({discImgSrc:t})=>e.createElement(p.img,{initial:{y:-20,opacity:1},animate:{y:0,opacity:1},exit:{y:0,opacity:0},src:t,alt:"disc",className:"pointer-events-none h-full w-full  select-none  object-contain"})),aa=b.memo(()=>e.createElement(p.span,{initial:{y:-20,opacity:1},animate:{y:0,opacity:1},exit:{y:0,opacity:0},className:"flow-row flex h-full w-full items-center justify-center text-4xl lg:text-6xl min-[1180px]:text-3xl min-[1350px]:text-4xl 2xl:text-6xl"},e.createElement(E,{icon:Zt}))),ca=({data:t=0,index:n=-1,columnId:a=-1,shadow:c=!1,indigator:r=!1})=>{const{discType:o,colors:l}=y(({user:g})=>g.settings),{turn:s,lastDisc:m,matchedDiscs:i}=y(({connect4:g})=>g),d=m&&m[0]===a&&m[1]===n,u=i.findIndex(g=>g[0]===a&&g[1]===n);return e.createElement(v,null,e.createElement("div",{className:`relative aspect-square h-full w-full rounded-full ${c?"opacity-50":""}`,style:{color:l[s-1]}},(t===Z||t===ee)&&e.createElement(b.Fragment,null,e.createElement(p.img,{style:{maxWidth:"100%",maxHeight:"100%"},initial:{y:`${(n+1)*-100}%`},animate:{y:0},transition:{ease:"circInOut"},src:new URL(Object.assign({"../../../../../image/connect4/disc-0g.png":ye,"../../../../../image/connect4/disc-0o.png":xe,"../../../../../image/connect4/disc-0r.png":_e,"../../../../../image/connect4/disc-0y.png":ke,"../../../../../image/connect4/disc-1g.png":Ee,"../../../../../image/connect4/disc-1o.png":we,"../../../../../image/connect4/disc-1r.png":he,"../../../../../image/connect4/disc-1y.png":ve,"../../../../../image/connect4/disc-2g.png":je,"../../../../../image/connect4/disc-2o.png":Ne,"../../../../../image/connect4/disc-2r.png":Ae,"../../../../../image/connect4/disc-2y.png":Ie,"../../../../../image/connect4/disc-3g.png":Te,"../../../../../image/connect4/disc-3o.png":Se,"../../../../../image/connect4/disc-3r.png":Le,"../../../../../image/connect4/disc-3y.png":De,"../../../../../image/connect4/disc-4g.png":Oe,"../../../../../image/connect4/disc-4o.png":$e,"../../../../../image/connect4/disc-4r.png":Ce,"../../../../../image/connect4/disc-4y.png":Me})[`../../../../../image/connect4/disc-${o}${l[t-1][0]}.png`],self.location).href,alt:"disc",className:"pointer-events-none h-full w-full select-none object-contain"}),d&&e.createElement(p.span,{layoutId:"last-disc",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flow-row absolute top-0 z-30 flex h-full w-full items-center justify-center min-[1350px]:text-3xl"},e.createElement(E,{icon:Ye,className:"rounded-full py-1 text-white"})),u>-1&&e.createElement(p.span,{layoutId:`matched-disc-${u}`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flow-row absolute top-0 z-30 flex h-full w-full items-center justify-center min-[1350px]:text-3xl"},e.createElement(E,{icon:Ye,className:"rounded-full py-1 text-white"}))),c?e.createElement(na,{discImgSrc:new URL(Object.assign({"../../../../../image/connect4/disc-0g.png":ye,"../../../../../image/connect4/disc-0o.png":xe,"../../../../../image/connect4/disc-0r.png":_e,"../../../../../image/connect4/disc-0y.png":ke,"../../../../../image/connect4/disc-1g.png":Ee,"../../../../../image/connect4/disc-1o.png":we,"../../../../../image/connect4/disc-1r.png":he,"../../../../../image/connect4/disc-1y.png":ve,"../../../../../image/connect4/disc-2g.png":je,"../../../../../image/connect4/disc-2o.png":Ne,"../../../../../image/connect4/disc-2r.png":Ae,"../../../../../image/connect4/disc-2y.png":Ie,"../../../../../image/connect4/disc-3g.png":Te,"../../../../../image/connect4/disc-3o.png":Se,"../../../../../image/connect4/disc-3r.png":Le,"../../../../../image/connect4/disc-3y.png":De,"../../../../../image/connect4/disc-4g.png":Oe,"../../../../../image/connect4/disc-4o.png":$e,"../../../../../image/connect4/disc-4r.png":Ce,"../../../../../image/connect4/disc-4y.png":Me})[`../../../../../image/connect4/disc-${o}${l[s-1][0]}.png`],self.location).href}):r&&e.createElement(aa,null)))},oa=b.memo(ca),ft=b.createContext(),Ue=()=>b.useContext(ft),sa=({children:t})=>{const n=y(({user:l})=>l.settings.playSound),[a]=ne(nn,{soundEnabled:n,html5:!0}),[c]=ne(an,{soundEnabled:n,html5:!0}),[r]=ne(cn,{soundEnabled:n,html5:!0}),[o]=ne(on,{soundEnabled:n,html5:!0});return e.createElement(ft.Provider,{value:{correctAnswerSound:a,applauseSound:c,sadTromboneSound:r,correctAnswerTone:o}},t)},la=({index:t,data:n})=>{const a=w(),c=b.useRef(),[r,o]=b.useState(!1),{turn:l,status:s}=y(({connect4:i})=>i),{correctAnswerTone:m}=Ue();return e.createElement("div",{className:`relative grid grid-rows-6 gap-2 p-1 ${s===_.PLAYING?"cursor-pointer":"cursor-not-allowed"}`,ref:c,onClick:()=>{l===1&&s===_.PLAYING&&a(ta(t,m))},onPointerEnter:()=>{o(!0)},onPointerLeave:()=>{o(!1)}},n.map((i,d,u)=>e.createElement(oa,{key:`cell-${d}`,index:d,columnId:t,data:i,shadow:s===_.PLAYING&&r&&d===u.lastIndexOf(null),indigator:s===_.PLAYING&&r&&d<u.lastIndexOf(null)})))},ra=()=>{const{table:t,created:n}=y(({connect4:o})=>o),{boardType:a}=y(({user:o})=>o.settings),[c,r]=b.useState(!1);return b.useEffect(()=>{if(!c){let o=!1;t.map((l,s)=>{l.map((m,i)=>{m&&(console.log(m),o=!0)})}),o&&(r(!0),qe("connect4",n.getTime()))}},[t]),e.createElement("div",{className:"relative w-full min-[1350px]:w-[350px] 2xl:w-[500px] min-[1350px]:h-72 2xl:h-96"},e.createElement("img",{className:"w-full opacity-0",src:new URL(Object.assign({"../../../../../image/connect4/board-0.png":Xe,"../../../../../image/connect4/board-1.png":He,"../../../../../image/connect4/board-2.png":Ve,"../../../../../image/connect4/board-3.png":Fe,"../../../../../image/connect4/board-4.png":ze,"../../../../../image/connect4/board-5.png":Ke})[`../../../../../image/connect4/board-${a}.png`],self.location).href}),e.createElement("img",{className:"motion.img pointer-events-none absolute top-0 z-20 w-full",alt:st,src:new URL(Object.assign({"../../../../../image/connect4/board-0.png":Xe,"../../../../../image/connect4/board-1.png":He,"../../../../../image/connect4/board-2.png":Ve,"../../../../../image/connect4/board-3.png":Fe,"../../../../../image/connect4/board-4.png":ze,"../../../../../image/connect4/board-5.png":Ke})[`../../../../../image/connect4/board-${a}.png`],self.location).href}),e.createElement("div",{className:"absolute top-3 w-full px-2 xs:top-3.5 sm:top-4"},e.createElement("div",{className:"grid grid-cols-7"},t.map((o,l)=>e.createElement(la,{key:`column-${l}`,data:o,index:l})))))},ae=({text:t=ue,wins:n=0,playing:a=!0,isRight:c=!1})=>{const[r,o]=b.useState({started:null,duration:0}),{discType:l,colors:s}=y(({user:m})=>m.settings);return b.useEffect(()=>{let m=null;return a?(o({started:new Date,duration:0}),m=setInterval(()=>{o(i=>({...i,duration:parseInt((new Date().getTime()-i.started.getTime())/1e3)}))},500)):o({started:null,duration:0}),()=>{m&&clearInterval(m)}},[a]),e.createElement("div",{className:`relative ${c?"w-32":"w-28"} md:w-48 min-[1350px]:w-28 p-2 min-[1350px]:p-4 ${c?"max-sm:pl-5 max-[1350px]:pl-10":"max-sm:pr-5 max-[1350px]:pr-10"} flex flex-col sm:items-center justify-center rounded-lg border border-black bg-white/90 text-xs font-medium text-black shadow-lg sm:text-lg md:border-4 md:text-lg min-[1350px]:pt-14 ${a?"yellow-pulse":"opacity-60 grayscale-[75%]"} shadow-lg`},e.createElement("img",{className:`absolute aspect-square w-12 sm:w-16 min-[1350px]:w-18 ${c?"max-[1350px]:-left-8 max-xs:-left-4":"max-[1350px]:-right-8 max-xs:-right-4"} drop-shadow-lg min-[1350px]:-top-10`,src:new URL(Object.assign({"../../../../../image/connect4/disc-0g.png":ye,"../../../../../image/connect4/disc-0o.png":xe,"../../../../../image/connect4/disc-0r.png":_e,"../../../../../image/connect4/disc-0y.png":ke,"../../../../../image/connect4/disc-1g.png":Ee,"../../../../../image/connect4/disc-1o.png":we,"../../../../../image/connect4/disc-1r.png":he,"../../../../../image/connect4/disc-1y.png":ve,"../../../../../image/connect4/disc-2g.png":je,"../../../../../image/connect4/disc-2o.png":Ne,"../../../../../image/connect4/disc-2r.png":Ae,"../../../../../image/connect4/disc-2y.png":Ie,"../../../../../image/connect4/disc-3g.png":Te,"../../../../../image/connect4/disc-3o.png":Se,"../../../../../image/connect4/disc-3r.png":Le,"../../../../../image/connect4/disc-3y.png":De,"../../../../../image/connect4/disc-4g.png":Oe,"../../../../../image/connect4/disc-4o.png":$e,"../../../../../image/connect4/disc-4r.png":Ce,"../../../../../image/connect4/disc-4y.png":Me})[`../../../../../image/connect4/disc-${l}${s[c?1:0][0]}.png`],self.location).href,alt:"disc"}),e.createElement("div",{className:"flex flex-col lg:space-y-1"},e.createElement("div",null,e.createElement(E,{icon:sn}),e.createElement("span",{className:"ml-1"},t)),e.createElement("div",null,e.createElement(E,{icon:ln}),e.createElement("span",{className:"ml-1"},n)),e.createElement("div",null,e.createElement(E,{icon:Je}),e.createElement("span",{className:"ml-1"},Q(r.duration)))))},ia=()=>{const{turn:t,difficulty:n}=y(({connect4:c})=>c),a=w();return b.useEffect(()=>{a(Qn(1))},[a]),e.createElement(p.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"relative flex h-full w-full flex-1 flex-col justify-start gap-2 px-2 py-2"},e.createElement("div",{className:"my-2 flex flex-row items-center justify-between min-[1350px]:hidden"},e.createElement(ae,{text:We,wins:0,playing:t===1}),e.createElement(ae,{text:`${ue} (${n})`,wins:0,playing:t===2,isRight:!0})),e.createElement("div",{className:"flex flex-row items-center justify-center max-[1350px]:justify-between"},e.createElement("div",{className:"max-[1350px]:hidden"},e.createElement(ae,{text:We,wins:0,playing:t===1})),e.createElement("div",{className:"w-full flex justify-center"},e.createElement(ra,null)),e.createElement("div",{className:"max-[1350px]:hidden"},e.createElement(ae,{text:`${ue} (${n})`,wins:0,playing:t===2,isRight:!0}))))},yt=()=>{const[t,n]=b.useState(localStorage.getItem("connect4-theme")||"light"),a=t==="dark"?"light":"dark";return b.useEffect(()=>{const c=window.document.documentElement;c.classList.remove(a),c.classList.add(t),localStorage.setItem("connect4-theme",t)},[t,a]),[t,n]},da={settings:{discType:0,boardType:0,backgroundType:-1,colors:["red","green"],playSound:!1,autoMove:!0,language:"en"},modals:{[se]:!1,[le]:!1,[re]:!1,[A]:!1,[oe]:!1},rules:[],solvingTime:0},ma=(t=da,n)=>{switch(n.type){case Qe:return{...t,settings:{...t.settings,...n.payload}};case ie:return{...t,modals:{...t.modals,[n.name]:n.payload}};case Ze:return{...t,modals:{...t.modals,[n.name]:n.payload}};default:return t}},ga={difficulty:I[2],created:new Date,recordedTime:null,status:_.LOADING,winner:0,turn:1,table:fe(),lastDisc:null,matchedDiscs:[]},pa=(t=ga,n)=>{switch(n.type){case et:return{...t,created:new Date,recordedTime:null,status:_.PLAYING,difficulty:n.payload.difficulty,winner:0,turn:n.payload.turn,table:fe(),lastDisc:null,matchedDiscs:[]};case tt:let a=new Date;return qe("connect4",a.getTime()),{...t,created:a,recordedTime:null,status:_.PLAYING,difficulty:n.payload.difficulty,winner:0,turn:n.payload.turn,table:fe(),lastDisc:null,matchedDiscs:[]};case te:return{...t,status:n.payload};case Pe:return{...t,turn:t.turn===1?2:1,table:n.newTable,lastDisc:n.lastDisc};case nt:return{...t,recordedTime:Hn(t.created)};case Be:return{...t,winner:n.payload.winner,matchedDiscs:n.payload.matchedDiscs,status:_.ENDED};default:return t}},ua=Vt({user:ma,connect4:pa}),ba={key:Xn(!1),storage:rn},fa=dn(ba,ua),ya=Kt,xt=Ft(fa,ya(zt(qt))),xa=mn(xt);const _t="/build/assets/background (0)-1a67978e.jpg",kt="/build/assets/background (1)-c873f0b4.jpg",Et="/build/assets/background (10)-18792df9.jpg",wt="/build/assets/background (11)-7363a9f0.jpg",ht="/build/assets/background (12)-10bd1fcc.jpg",vt="/build/assets/background (13)-cb4a1e69.jpg",jt="/build/assets/background (14)-593b26c7.jpg",Nt="/build/assets/background (15)-b0e02a3d.jpg",At="/build/assets/background (16)-6e5e6c5d.jpg",It="/build/assets/background (2)-bb26ed48.jpg",Tt="/build/assets/background (3)-110a715c.jpg",St="/build/assets/background (4)-9a962570.jpg",Lt="/build/assets/background (5)-1f91269e.jpg",Dt="/build/assets/background (6)-a6331943.jpg",Ot="/build/assets/background (7)-da18f6d9.jpg",$t="/build/assets/background (8)-6db32b4f.jpg",Ct="/build/assets/background (9)-acf2c6ca.jpg",Mt="/build/assets/board-0-792c19a3.png",Rt="/build/assets/board-1-1601ed4c.png",Pt="/build/assets/board-2-259667ac.png",Bt="/build/assets/board-3-84d62333.png",Gt="/build/assets/board-4-6211a9e6.png",Ut="/build/assets/board-5-ab1b847c.png",D="/build/assets/disc-0g-9666372b.png",O="/build/assets/disc-0o-e012de01.png",$="/build/assets/disc-0r-228b4b5e.png",C="/build/assets/disc-0y-d1dd41b7.png",M="/build/assets/disc-1g-a2cfa631.png",R="/build/assets/disc-1o-67e37b45.png",P="/build/assets/disc-1r-574a045c.png",B="/build/assets/disc-1y-0136b6ea.png",G="/build/assets/disc-2g-50abd4b0.png",U="/build/assets/disc-2o-8455f16d.png",Y="/build/assets/disc-2r-b2d6710d.png",W="/build/assets/disc-2y-2a447672.png",X="/build/assets/disc-3g-0dae4491.png",H="/build/assets/disc-3o-7f261fa4.png",V="/build/assets/disc-3r-d2b7eea5.png",F="/build/assets/disc-3y-a372cd1f.png",z="/build/assets/disc-4g-38fe87c1.png",K="/build/assets/disc-4o-8fabdbac.png",q="/build/assets/disc-4r-34e6bcb8.png",J="/build/assets/disc-4y-09e4c2a8.png",_a=["disc_1g.png","disc_4r.png","disc_3y.png","disc_2o.png"],ka=()=>e.createElement(p.div,{className:"dark:text-slate fixed left-0 top-0 flex h-screen w-screen items-center justify-center dark:bg-slate-900",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},e.createElement(p.div,{className:"grid grid-cols-2 gap-2",style:{transform:"rotate(var(--rotate))"},initial:{"--rotate":"0deg"},animate:{"--rotate":"360deg"},transition:{duration:2,repeat:1/0,ease:"linear"}},_a.map((t,n)=>e.createElement(p.img,{key:n,src:new URL(Object.assign({"../../../../../image/connect4/96x96/background (0).jpg":_t,"../../../../../image/connect4/96x96/background (1).jpg":kt,"../../../../../image/connect4/96x96/background (10).jpg":Et,"../../../../../image/connect4/96x96/background (11).jpg":wt,"../../../../../image/connect4/96x96/background (12).jpg":ht,"../../../../../image/connect4/96x96/background (13).jpg":vt,"../../../../../image/connect4/96x96/background (14).jpg":jt,"../../../../../image/connect4/96x96/background (15).jpg":Nt,"../../../../../image/connect4/96x96/background (16).jpg":At,"../../../../../image/connect4/96x96/background (2).jpg":It,"../../../../../image/connect4/96x96/background (3).jpg":Tt,"../../../../../image/connect4/96x96/background (4).jpg":St,"../../../../../image/connect4/96x96/background (5).jpg":Lt,"../../../../../image/connect4/96x96/background (6).jpg":Dt,"../../../../../image/connect4/96x96/background (7).jpg":Ot,"../../../../../image/connect4/96x96/background (8).jpg":$t,"../../../../../image/connect4/96x96/background (9).jpg":Ct,"../../../../../image/connect4/96x96/board-0.png":Mt,"../../../../../image/connect4/96x96/board-1.png":Rt,"../../../../../image/connect4/96x96/board-2.png":Pt,"../../../../../image/connect4/96x96/board-3.png":Bt,"../../../../../image/connect4/96x96/board-4.png":Gt,"../../../../../image/connect4/96x96/board-5.png":Ut,"../../../../../image/connect4/96x96/disc-0g.png":D,"../../../../../image/connect4/96x96/disc-0o.png":O,"../../../../../image/connect4/96x96/disc-0r.png":$,"../../../../../image/connect4/96x96/disc-0y.png":C,"../../../../../image/connect4/96x96/disc-1g.png":M,"../../../../../image/connect4/96x96/disc-1o.png":R,"../../../../../image/connect4/96x96/disc-1r.png":P,"../../../../../image/connect4/96x96/disc-1y.png":B,"../../../../../image/connect4/96x96/disc-2g.png":G,"../../../../../image/connect4/96x96/disc-2o.png":U,"../../../../../image/connect4/96x96/disc-2r.png":Y,"../../../../../image/connect4/96x96/disc-2y.png":W,"../../../../../image/connect4/96x96/disc-3g.png":X,"../../../../../image/connect4/96x96/disc-3o.png":H,"../../../../../image/connect4/96x96/disc-3r.png":V,"../../../../../image/connect4/96x96/disc-3y.png":F,"../../../../../image/connect4/96x96/disc-4g.png":z,"../../../../../image/connect4/96x96/disc-4o.png":K,"../../../../../image/connect4/96x96/disc-4r.png":q,"../../../../../image/connect4/96x96/disc-4y.png":J})[`../../../../../image/connect4/96x96/${t}`],self.location).href,alt:t,className:"aspect-square w-16 bg-transparent",style:{transform:"rotate(calc(-1 * var(--rotate)))"}})))),Ea="/build/assets/background (0)-722176f4.jpg",wa="/build/assets/background (1)-7d72ec2f.jpg",ha="/build/assets/background (10)-74ddf42d.jpg",va="/build/assets/background (11)-ccf7d149.jpg",ja="/build/assets/background (12)-05d938d2.jpg",Na="/build/assets/background (13)-ad497f53.jpg",Aa="/build/assets/background (14)-06ce73e3.jpg",Ia="/build/assets/background (15)-24ad1ecf.jpg",Ta="/build/assets/background (16)-61093911.jpg",Sa="/build/assets/background (2)-3b3b9414.jpg",La="/build/assets/background (3)-52a03ad7.jpg",Da="/build/assets/background (4)-6abf9128.jpg",Oa="/build/assets/background (5)-fc369cbd.jpg",$a="/build/assets/background (6)-235b3adb.jpg",Ca="/build/assets/background (7)-f38be9c4.jpg",Ma="/build/assets/background (8)-f981e09b.jpg",Ra="/build/assets/background (9)-1210f111.jpg",x=({className:t="",disabled:n=!1,children:a,onClick:c=()=>{}})=>{const[r,o]=b.useState([]),l=b.useRef(null);return b.useEffect(()=>{const s=i=>{const d=l.current,{left:u,top:g}=d.getBoundingClientRect(),f=i.clientX-u,k=i.clientY-g,N=Math.max(d.clientWidth,d.clientHeight)*2/2,L={x:f,y:k,radius:N,id:Date.now()};o(ge=>[...ge,L]),setTimeout(()=>{o(ge=>ge.filter(Xt=>Xt.id!==L.id))},1e3)},m=l.current;return m.addEventListener("click",s),()=>{m.removeEventListener("click",s)}},[o]),e.createElement(p.button,{ref:l,layout:!0,type:"button",className:`relative overflow-hidden shadow ${t} !outline-none ${n&&"!pointer-events-none"}`,disabled:n,onClick:c,whileHover:{scale:n?1:1.05},whileTap:{scale:n?1:.95}},a,r.map(s=>e.createElement("span",{key:s.id,className:"ripple",style:{left:s.x-s.radius+"px",top:s.y-s.radius+"px",width:s.radius*2+"px",height:s.radius*2+"px"}})))},Pa=t=>n=>{n({type:Qe,payload:t})},Yt=(t,n)=>a=>{a({type:ie,name:t,payload:n})},S=t=>n=>{n({type:Ze,name:t,payload:null})},Wt=({isOpen:t,setIsOpen:n,cb:a=()=>{}})=>{y(({connect4:o})=>o);const c=w(),{correctAnswerTone:r}=Ue();return b.useEffect(()=>{const o=()=>{n(!1)};return t&&document.addEventListener("click",o),()=>{t&&document.removeEventListener("click",o)}},[t,n]),e.createElement(v,null,t&&e.createElement(p.div,{className:"absolute z-[10000] w-screen max-w-60 rounded border border-majky-400 bg-white  px-3 py-4 shadow-md dark:bg-slate-900/80 max-lg:right-0 max-sm:w-60 lg:left-0 lg:top-full lg:mt-2",initial:"closed",animate:"open",exit:"closed",layout:!0,variants:{open:{opacity:1,y:0},closed:{opacity:0,y:-30,transition:{delay:.2,duration:.1}}},onClick:o=>{o.stopPropagation()}},e.createElement(p.div,{className:"flex flex-col items-stretch justify-center rounded text-base font-bold"},I.map((o,l)=>e.createElement(x,{key:`difficulty-${l}`,className:" border-majky-200 bg-majky-50 px-4 text-left leading-10 text-majky-800 hover:border-l-4 hover:border-majky-400  hover:text-majky-400 dark:bg-slate-800 dark:text-white dark:hover:text-majky-400 max-xs:leading-9",onClick:()=>{n(!1),localStorage.setItem("connect4-state","Initialized"),c(Zn(2,o)),c(bt(r)),a()}},e.createElement("img",{src:new URL("/build/assets/checkers-c3f0bbd6.svg",self.location).href,alt:"connect-4.svg",className:"mr-2 inline-block w-6 fill-white"}),o)))))},Ba=({onClick:t=()=>{},icon:n,label:a,disabled:c,children:r})=>e.createElement("div",{className:"relative"},e.createElement(x,{className:"flex flex-col items-center justify-center rounded border border-majky-400 bg-majky-600 px-2 py-1 text-white shadow hover:text-majky-400 disabled:border-slate-800 disabled:text-slate-600 dark:bg-slate-800/80 max-xs:text-sm md:py-2 lg:flex-row lg:justify-between lg:py-1",onClick:t,disabled:c},e.createElement(E,{className:"my-1 lg:my-0 lg:mr-2 ",icon:n}),e.createElement("span",{className:"max-[1350px]:hidden"},a)),r),Ga=()=>{const[t,n]=b.useState(!1);return e.createElement("div",{className:"mb-0 flex w-full justify-end lg:text-sm"},e.createElement(Ba,{label:bn,icon:en,onClick:a=>{n(c=>!c),a.stopPropagation()},disabled:!1},e.createElement(Wt,{isOpen:t,setIsOpen:n})))},Ua=()=>{const t=w();return e.createElement("header",{className:"flex h-16 w-full items-center justify-between border-b-2 border-slate-200 px-3 dark:border-slate-400 max-xs:h-8"},e.createElement("div",{className:"ml-0 md:ml-4"},e.createElement("h1",{className:"flex flex-auto select-none items-center space-x-0 text-2xl font-bold md:space-x-4 md:text-3xl"},e.createElement("img",{className:"aspect-square h-16 object-contain",src:new URL("/build/assets/logo4.png",self.location).href,alt:"logo"}),e.createElement("span",{className:"text-majky-600 dark:text-majky-400"},at))),e.createElement("div",{className:"flex-1 px-2 md:px-4"},e.createElement(Ga,null)),e.createElement("div",{className:"relative"},e.createElement(x,{className:"rounded border border-majky-600 bg-majky-600 px-3 py-2 text-white shadow shadow-white dark:bg-slate-900/50 dark:text-majky-400 max-xs:px-1 max-xs:py-0.5",onClick:()=>{t(Yt(oe,!0))}},e.createElement(E,{icon:tn}),e.createElement("div",{className:"hidden md:pl-2 lg:inline-block"},ct))))},Ya=({id:t,checked:n,onChange:a})=>e.createElement("div",{className:"inline-flex items-center"},e.createElement("div",{className:"relative inline-block h-4 w-8 cursor-pointer rounded-full border dark:border-majky-400"},e.createElement("input",{id:t,type:"checkbox",className:"peer absolute left-0 top-0 h-4 w-8 cursor-pointer appearance-none rounded-full bg-majky-100 transition-colors duration-300 checked:bg-majky-500 peer-checked:border-majky-500 peer-checked:before:bg-majky-500 dark:bg-majky-800 dark:checked:bg-majky-300 dark:peer-checked:border-majky-300 dark:peer-checked:before:bg-majky-300",checked:n,onChange:a}),e.createElement("label",{htmlFor:t,className:"before:content[''] before:bg-blue-slate-500 absolute -left-1  top-2/4 h-5 w-5 -translate-y-2/4 cursor-pointer rounded-full border border-majky-100 bg-white shadow-md transition-all duration-300 before:absolute before:left-2/4 before:top-2/4 before:block before:h-10 before:w-10 before:-translate-x-2/4 before:-translate-y-2/4 before:rounded-full before:opacity-0 before:transition-opacity hover:before:opacity-10 peer-checked:translate-x-full peer-checked:border-majky-500 peer-checked:before:bg-majky-500 dark:border-majky-400"},e.createElement("div",{className:"left-2/4 top-2/4 inline-block -translate-x-2/4 -translate-y-2/4 rounded-full p-5","data-ripple-dark":"true"})))),Wa=()=>{const t=y(({user:o})=>{var l;return((l=o==null?void 0:o.modals)==null?void 0:l[se])||null}),n=w(),{settings:a}=y(({user:o})=>o),c=(o,l)=>{n(Pa({[o]:l}))},r=()=>{n(S(se))};return e.createElement(v,null,t&&e.createElement(p.div,{initial:"closed",animate:"open",exit:"closed",layout:!0,variants:{open:{opacity:1},closed:{opacity:0}},className:"fixed left-0 top-0 z-[10000] flex h-screen w-screen flex-col items-center justify-center bg-black/50 p-4",onClick:r},e.createElement(p.div,{className:"relative max-h-full w-full overflow-y-auto overflow-x-hidden rounded border bg-white pb-4 shadow-md dark:border-majky-400  dark:bg-slate-900/80 max-md:fixed max-md:left-0 max-md:top-0 max-md:h-full max-sm:w-full md:max-w-screen-md",onClick:o=>{o.stopPropagation()}},e.createElement(E,{className:"absolute left-4 top-4 h-6 w-6 cursor-pointer hover:text-majky-600 active:text-majky-500",onClick:r,icon:Re}),e.createElement(p.h2,{layout:!0,className:"border-b border-majky-600 pb-1 pt-7 text-center text-2xl font-bold text-majky-800 shadow dark:text-majky-400"},pe),e.createElement(p.div,{className:"my-4 p-4 text-center shadow"},e.createElement("div",{className:"col-span-3 mb-2 border-b pb-1 text-base font-bold text-gray-600 dark:text-majky-400"},In),e.createElement("div",{className:"grid grid-cols-3 gap-1 md:grid-cols-5"},Array.from({length:5},(o,l)=>e.createElement(x,{key:`options-disc-types-${l}`,onClick:()=>{c("discType",l)},className:`relative aspect-[5/4] w-24 rounded border border-transparent bg-white p-2 font-bold text-gray-600 shadow hover:border-gray-600 hover:bg-gray-100 dark:bg-transparent dark:text-majky-400 dark:hover:border-majky-400 max-xs:py-1 md:w-36 ${a.discType===l&&"!border-majky-400 shadow-majky-400"}`},e.createElement("img",{className:"w-16 object-fill md:w-24",src:new URL(Object.assign({"../../../../../image/connect4/96x96/disc-0g.png":D,"../../../../../image/connect4/96x96/disc-0o.png":O,"../../../../../image/connect4/96x96/disc-0r.png":$,"../../../../../image/connect4/96x96/disc-0y.png":C,"../../../../../image/connect4/96x96/disc-1g.png":M,"../../../../../image/connect4/96x96/disc-1o.png":R,"../../../../../image/connect4/96x96/disc-1r.png":P,"../../../../../image/connect4/96x96/disc-1y.png":B,"../../../../../image/connect4/96x96/disc-2g.png":G,"../../../../../image/connect4/96x96/disc-2o.png":U,"../../../../../image/connect4/96x96/disc-2r.png":Y,"../../../../../image/connect4/96x96/disc-2y.png":W,"../../../../../image/connect4/96x96/disc-3g.png":X,"../../../../../image/connect4/96x96/disc-3o.png":H,"../../../../../image/connect4/96x96/disc-3r.png":V,"../../../../../image/connect4/96x96/disc-3y.png":F,"../../../../../image/connect4/96x96/disc-4g.png":z,"../../../../../image/connect4/96x96/disc-4o.png":K,"../../../../../image/connect4/96x96/disc-4r.png":q,"../../../../../image/connect4/96x96/disc-4y.png":J})[`../../../../../image/connect4/96x96/disc-${l}${a.colors[0][0]}.png`],self.location).href,alt:`disc-${l}${a.colors[0][0]}.png`}),e.createElement("img",{className:"absolute left-6 top-2 w-16 object-fill md:left-8 md:top-4 md:w-24",src:new URL(Object.assign({"../../../../../image/connect4/96x96/disc-0g.png":D,"../../../../../image/connect4/96x96/disc-0o.png":O,"../../../../../image/connect4/96x96/disc-0r.png":$,"../../../../../image/connect4/96x96/disc-0y.png":C,"../../../../../image/connect4/96x96/disc-1g.png":M,"../../../../../image/connect4/96x96/disc-1o.png":R,"../../../../../image/connect4/96x96/disc-1r.png":P,"../../../../../image/connect4/96x96/disc-1y.png":B,"../../../../../image/connect4/96x96/disc-2g.png":G,"../../../../../image/connect4/96x96/disc-2o.png":U,"../../../../../image/connect4/96x96/disc-2r.png":Y,"../../../../../image/connect4/96x96/disc-2y.png":W,"../../../../../image/connect4/96x96/disc-3g.png":X,"../../../../../image/connect4/96x96/disc-3o.png":H,"../../../../../image/connect4/96x96/disc-3r.png":V,"../../../../../image/connect4/96x96/disc-3y.png":F,"../../../../../image/connect4/96x96/disc-4g.png":z,"../../../../../image/connect4/96x96/disc-4o.png":K,"../../../../../image/connect4/96x96/disc-4r.png":q,"../../../../../image/connect4/96x96/disc-4y.png":J})[`../../../../../image/connect4/96x96/disc-${l}${a.colors[1][0]}.png`],self.location).href,alt:`disc-${l}${a.colors[1][0]}.png`})))),e.createElement("div",{className:"col-span-3 mb-2 border-b pb-1 text-base font-bold text-gray-600 dark:text-majky-400"},Tn),e.createElement("div",{className:"grid grid-cols-3 gap-1 md:grid-cols-5"},["yellow","green","red","orange"].flatMap((o,l,s)=>s.filter(m=>o!==m).map((m,i)=>e.createElement(x,{key:`options-disc-colors-${l}-${i}`,onClick:()=>{c("colors",[o,m])},className:`relative aspect-[5/4] w-24 rounded border border-transparent bg-white p-2 font-bold text-gray-600 shadow hover:border-gray-600 hover:bg-gray-100 dark:bg-transparent dark:text-majky-400 dark:hover:border-majky-400 max-xs:py-1 md:w-36 ${a.colors[0]===o&&a.colors[1]===m&&"!border-majky-400 shadow-majky-400"}`},e.createElement("img",{className:"w-16 object-fill md:w-24",src:new URL(Object.assign({"../../../../../image/connect4/96x96/disc-0g.png":D,"../../../../../image/connect4/96x96/disc-0o.png":O,"../../../../../image/connect4/96x96/disc-0r.png":$,"../../../../../image/connect4/96x96/disc-0y.png":C,"../../../../../image/connect4/96x96/disc-1g.png":M,"../../../../../image/connect4/96x96/disc-1o.png":R,"../../../../../image/connect4/96x96/disc-1r.png":P,"../../../../../image/connect4/96x96/disc-1y.png":B,"../../../../../image/connect4/96x96/disc-2g.png":G,"../../../../../image/connect4/96x96/disc-2o.png":U,"../../../../../image/connect4/96x96/disc-2r.png":Y,"../../../../../image/connect4/96x96/disc-2y.png":W,"../../../../../image/connect4/96x96/disc-3g.png":X,"../../../../../image/connect4/96x96/disc-3o.png":H,"../../../../../image/connect4/96x96/disc-3r.png":V,"../../../../../image/connect4/96x96/disc-3y.png":F,"../../../../../image/connect4/96x96/disc-4g.png":z,"../../../../../image/connect4/96x96/disc-4o.png":K,"../../../../../image/connect4/96x96/disc-4r.png":q,"../../../../../image/connect4/96x96/disc-4y.png":J})[`../../../../../image/connect4/96x96/disc-${a.discType}${o[0]}.png`],self.location).href,alt:`disc-${a.discType}${o[0]}.png`}),e.createElement("img",{className:"absolute left-6 top-2 w-16 object-fill md:left-8 md:top-4 md:w-24",src:new URL(Object.assign({"../../../../../image/connect4/96x96/disc-0g.png":D,"../../../../../image/connect4/96x96/disc-0o.png":O,"../../../../../image/connect4/96x96/disc-0r.png":$,"../../../../../image/connect4/96x96/disc-0y.png":C,"../../../../../image/connect4/96x96/disc-1g.png":M,"../../../../../image/connect4/96x96/disc-1o.png":R,"../../../../../image/connect4/96x96/disc-1r.png":P,"../../../../../image/connect4/96x96/disc-1y.png":B,"../../../../../image/connect4/96x96/disc-2g.png":G,"../../../../../image/connect4/96x96/disc-2o.png":U,"../../../../../image/connect4/96x96/disc-2r.png":Y,"../../../../../image/connect4/96x96/disc-2y.png":W,"../../../../../image/connect4/96x96/disc-3g.png":X,"../../../../../image/connect4/96x96/disc-3o.png":H,"../../../../../image/connect4/96x96/disc-3r.png":V,"../../../../../image/connect4/96x96/disc-3y.png":F,"../../../../../image/connect4/96x96/disc-4g.png":z,"../../../../../image/connect4/96x96/disc-4o.png":K,"../../../../../image/connect4/96x96/disc-4r.png":q,"../../../../../image/connect4/96x96/disc-4y.png":J})[`../../../../../image/connect4/96x96/disc-${a.discType}${m[0]}.png`],self.location).href,alt:`disc-${a.discType}${m[0]}.png`}))))),e.createElement("div",{className:"col-span-3 mb-2 mt-4 border-b pb-1 text-base font-bold text-gray-600 dark:text-majky-400"},st),e.createElement("div",{className:"flex w-full flex-row space-x-2 overflow-x-auto overflow-y-hidden px-2 py-4"},Array.from({length:6},(o,l)=>e.createElement(x,{key:`options-boardType-${l}`,onClick:()=>{c("boardType",l)},className:`min-w-24 rounded border border-transparent font-bold text-gray-600 shadow hover:border-gray-600 hover:bg-gray-100 dark:bg-transparent dark:text-majky-400 dark:hover:border-majky-400 md:min-w-28 ${a.boardType===l&&"!border-majky-400 shadow-majky-400"}`},e.createElement("img",{className:"aspect-auto w-full rounded border-2",src:new URL(Object.assign({"../../../../../image/connect4/96x96/board-0.png":Mt,"../../../../../image/connect4/96x96/board-1.png":Rt,"../../../../../image/connect4/96x96/board-2.png":Pt,"../../../../../image/connect4/96x96/board-3.png":Bt,"../../../../../image/connect4/96x96/board-4.png":Gt,"../../../../../image/connect4/96x96/board-5.png":Ut})[`../../../../../image/connect4/96x96/board-${l}.png`],self.location).href,alt:`board-${l}.png`})))),e.createElement("div",{className:"col-span-3 mb-2 mt-4 border-b pb-1 text-base font-bold text-gray-600 dark:text-majky-400"},Sn),e.createElement("div",{className:"flex w-full flex-row space-x-2 overflow-x-auto overflow-y-hidden px-2 py-4"},e.createElement(x,{key:"options-face--1",onClick:()=>{c("backgroundType",-1)},className:`flex min-w-24 flex-col items-center justify-center rounded border border-transparent font-bold text-gray-600 shadow hover:border-gray-600 hover:bg-gray-100 dark:bg-transparent dark:text-majky-400 dark:hover:border-majky-400 md:min-w-28 ${a.backgroundType===-1&&"!border-majky-400 shadow-majky-400"}`},e.createElement("img",{className:"aspect-square w-8 object-contain object-center",src:new URL("/build/assets/none-748f3772.svg",self.location).href,alt:"none.svg"})),Array.from({length:17},(o,l)=>e.createElement(x,{key:`options-face-${l}`,onClick:()=>{c("backgroundType",l)},className:`min-w-24 rounded border border-transparent font-bold text-gray-600 shadow hover:border-gray-600 hover:bg-gray-100 dark:bg-transparent dark:text-majky-400 dark:hover:border-majky-400 md:min-w-28 ${a.backgroundType===l&&"!border-majky-400 shadow-majky-400"}`},e.createElement("img",{className:"aspect-auto w-full rounded border-2 ",src:new URL(Object.assign({"../../../../../image/connect4/96x96/background (0).jpg":_t,"../../../../../image/connect4/96x96/background (1).jpg":kt,"../../../../../image/connect4/96x96/background (10).jpg":Et,"../../../../../image/connect4/96x96/background (11).jpg":wt,"../../../../../image/connect4/96x96/background (12).jpg":ht,"../../../../../image/connect4/96x96/background (13).jpg":vt,"../../../../../image/connect4/96x96/background (14).jpg":jt,"../../../../../image/connect4/96x96/background (15).jpg":Nt,"../../../../../image/connect4/96x96/background (16).jpg":At,"../../../../../image/connect4/96x96/background (2).jpg":It,"../../../../../image/connect4/96x96/background (3).jpg":Tt,"../../../../../image/connect4/96x96/background (4).jpg":St,"../../../../../image/connect4/96x96/background (5).jpg":Lt,"../../../../../image/connect4/96x96/background (6).jpg":Dt,"../../../../../image/connect4/96x96/background (7).jpg":Ot,"../../../../../image/connect4/96x96/background (8).jpg":$t,"../../../../../image/connect4/96x96/background (9).jpg":Ct})[`../../../../../image/connect4/96x96/background (${l}).jpg`],self.location).href,alt:`background (${l}).jpg`})))),e.createElement("div",{className:"col-span-3 mt-4 flex flex-col items-center md:space-y-4"},e.createElement("div",{className:"w-full border-b pb-2 text-base font-bold text-gray-600 dark:text-majky-400"},pe),e.createElement("div",{className:"mt-2 flex w-full max-w-60 cursor-pointer space-x-8 text-base font-bold text-gray-600 dark:text-majky-400 sm:mt-0"},e.createElement(Ya,{id:"options-play-sound",onChange:o=>{c("playSound",o.target.checked)},checked:a.playSound}),e.createElement("label",{className:"text-balance",htmlFor:"options-play-sound"},Ln)))))))},Xa=()=>e.createElement(p.div,{initial:{backdropFilter:"blur(0px)",opacity:0},animate:{backdropFilter:"blur(4px)",opacity:1},exit:{backdropFilter:"blur(0px)",opacity:0},transition:{duration:.6},className:"fixed left-0 top-0 z-[10000] h-screen w-screen bg-black/30"},e.createElement(p.img,{initial:{y:-300},animate:{y:0},exit:{y:-300},transition:{delay:.3,type:"spring"},className:"absolute left-0 top-0 w-1/4",src:new URL("/build/assets/celebration_l1-b15bb7e9.png",self.location).href,alt:"celebration_l1.png"}),e.createElement(p.img,{initial:{y:-400},animate:{y:0},exit:{y:-300},transition:{delay:.4,type:"spring"},className:"absolute left-0 top-0 w-1/4",src:new URL("/build/assets/celebration_l2-25c12ae6.png",self.location).href,alt:"celebration_l2.png"}),e.createElement(p.img,{initial:{y:-500},animate:{y:0},exit:{y:-300},transition:{delay:.1,type:"spring"},className:"absolute left-0 top-0 w-1/4",src:new URL("/build/assets/celebration_l3-24b64409.png",self.location).href,alt:"celebration_l3.png"}),e.createElement(p.img,{initial:{y:-400,scaleX:-1},animate:{y:0,scaleX:-1},exit:{y:-300,scaleX:-1},transition:{delay:.4,type:"spring"},className:"absolute right-0 top-0 w-1/4",src:new URL("/build/assets/celebration_l1-b15bb7e9.png",self.location).href,alt:"celebration_r1.png"}),e.createElement(p.img,{initial:{y:-500,scaleX:-1},animate:{y:0,scaleX:-1},exit:{y:-300,scaleX:-1},transition:{delay:.1,type:"spring"},className:"absolute right-0 top-0 w-1/4",src:new URL("/build/assets/celebration_l2-25c12ae6.png",self.location).href,alt:"celebration_r2.png"}),e.createElement(p.img,{initial:{y:-300,scaleX:-1},animate:{y:0,scaleX:-1},exit:{y:-300,scaleX:-1},transition:{delay:.3,type:"spring"},className:"absolute right-0 top-0 w-1/4",src:new URL("/build/assets/celebration_l3-24b64409.png",self.location).href,alt:"celebration_l3.png"}),e.createElement("div",{className:"absolute left-1/2 top-0 -ml-[25%] w-1/2"},e.createElement(p.img,{initial:{y:-100},animate:{y:0},exit:{y:-100},transition:{delay:.1,type:"spring"},className:"absolute -top-2 ml-[12.5%] w-3/4 origin-top",src:new URL("/build/assets/celebration_c1-27ee5f77.png",self.location).href,alt:"celebration_c1.png"}),e.createElement(p.img,{initial:{y:-300},animate:{y:0},exit:{y:-300},transition:{delay:.5,type:"spring"},className:"absolute top-0 w-full",src:new URL("/build/assets/celebration_c2-33815d62.png",self.location).href,alt:"celebration_c2.png"}))),Ha=()=>{const t=w(),n=y(({user:d})=>{var u;return((u=d==null?void 0:d.modals)==null?void 0:u[A])||null}),{recordedTime:a,created:c,difficulty:r,winner:o}=y(({connect4:d})=>d),{applauseSound:l,sadTromboneSound:s}=Ue();b.useEffect(()=>{n&&o>0&&localStorage.getItem("connect4-state")==="Running"&&(t(ea()),o===1?(l(),Fn({playedTime:Math.floor((new Date().getTime()-c.getTime())/1e3),difficulty:r})):o===2&&(s(),zn()))},[n,o]);const[m,i]=b.useState(!1);return e.createElement(b.Fragment,null,n&&o===1&&e.createElement(Xa,null),e.createElement(v,null,n&&e.createElement(p.div,{initial:"closed",animate:"open",exit:"closed",layout:!0,variants:{open:{opacity:1},closed:{opacity:0}},className:"fixed left-0 top-0 z-[10000] flex h-screen w-screen flex-col items-center justify-center bg-black/50 p-4",onClick:d=>{d.stopPropagation()}},e.createElement(p.div,{className:"max-h-full w-full grid-cols-1 rounded border bg-white p-2 pb-4 shadow-md dark:border-majky-400 dark:bg-slate-900/80 max-sm:w-full md:max-w-screen-xs md:p-4"},e.createElement("div",{className:"flex w-full flex-1 flex-col items-center justify-center"},e.createElement("h2",{className:"w-full max-w-60 text-center text-xl font-bold text-majky-800 dark:text-majky-400 xs:text-2xl"},o===1?fn:o===2?yn:xn),e.createElement(p.div,{layout:!0,className:"mt-6 flex w-full max-w-60 flex-row items-center justify-between rounded-b-lg border border-majky-600 bg-majky-50 px-4 py-1 text-majky-600 dark:bg-slate-900 dark:text-majky-400"},e.createElement(p.span,null,e.createElement(E,{icon:Je,className:"mr-2"}),_n),e.createElement(p.span,null,a)),e.createElement("div",{className:"relative mt-6 grid w-full max-w-60 grid-cols-2 gap-2"},e.createElement(x,{onClick:()=>{t(S(A))},className:"rounded border border-transparent bg-majky-600 py-2 text-base font-bold  text-white  dark:bg-majky-400 dark:text-slate-900  max-xs:py-1"},Ge),e.createElement(x,{onClick:d=>{i(u=>!u),d.stopPropagation()},className:"rounded border border-transparent bg-majky-600 py-2 text-base font-bold  text-white  dark:bg-majky-400 dark:text-slate-900  max-xs:py-1"},kn),e.createElement(Wt,{isOpen:m,setIsOpen:i,cb:()=>{t(S(A))}})))))))},Va=()=>{const t=y(({user:c})=>{var r;return((r=c==null?void 0:c.modals)==null?void 0:r[oe])||null}),n=w(),a=()=>{n(S(oe))};return yt(),e.createElement(v,null,t&&e.createElement(p.div,{initial:"closed",animate:"open",exit:"closed",layout:!0,variants:{open:{opacity:1},closed:{opacity:0}},className:"fixed left-0 top-0 z-[10000] flex h-screen w-screen flex-col items-center justify-center bg-black/50 p-4",onClick:a},e.createElement(p.div,{className:"relative flex max-h-full w-full flex-col overflow-y-auto overflow-x-hidden rounded border bg-white pb-4 shadow-md dark:border-majky-400  dark:bg-slate-800 max-md:fixed max-md:left-0 max-md:top-0 max-md:h-full max-sm:w-full md:max-w-xs",onClick:c=>{c.stopPropagation()}},e.createElement(E,{className:"absolute left-4 top-4 h-6 w-6 cursor-pointer hover:text-majky-600 active:text-majky-500",onClick:a,icon:Re}),e.createElement(p.h2,{layout:!0,className:"border-b  border-majky-600 pb-1 pt-7 text-center text-2xl font-bold text-majky-800 shadow dark:text-majky-400"},ct),e.createElement(p.div,{className:"my-4 grid grid-cols-1 gap-1 text-center"},Wn.map(({label:c,to:r,modalName:o},l)=>e.createElement(p.div,{initial:"closed",animate:"open",exit:"closed",layout:!0,variants:{open:{y:0,opacity:1,transition:{delay:l*.1}},closed:{y:10,opacity:0}},key:`menu-button-${l}`},e.createElement(x,{onClick:()=>{r&&a(),o&&n(Yt(o,!0))},className:"rounded border  border-transparent bg-white px-2 py-2 text-base font-bold text-gray-600 shadow-none hover:border-gray-600 hover:bg-gray-100  dark:bg-slate-800  dark:text-majky-400 dark:hover:border-majky-400 max-xs:py-1"},c)))))))},Fa=()=>{const t=w(),{settings:n,modals:a}=y(({user:i})=>i),c=(a==null?void 0:a[le])||null,r=()=>{t(S(le))},[o,l]=b.useState(null),[s,m]=b.useState(!1);return b.useEffect(()=>{c&&(async()=>{m(!0);try{l(Gn)}catch(d){console.error(d)}finally{m(!1)}})()},[c,o,n.language]),e.createElement(v,null,c&&e.createElement(p.div,{initial:"closed",animate:"open",exit:"closed",layout:!0,variants:{open:{opacity:1},closed:{opacity:0}},className:"fixed left-0 top-0 z-[10000] flex h-screen w-screen flex-col items-center justify-center bg-black/50 p-4",onClick:r},e.createElement(p.div,{className:"relative max-h-full w-full overflow-y-auto overflow-x-hidden rounded border bg-white pb-4 shadow-md dark:border-majky-400  dark:bg-slate-900/80 max-md:fixed max-md:left-0 max-md:top-0 max-md:h-full max-sm:w-full md:max-w-screen-md",onClick:r},s?e.createElement("p",{className:"my-4 text-center"},An):e.createElement("div",{className:"px-4 text-gray-600 dark:text-gray-300",dangerouslySetInnerHTML:{__html:o}}))))},za=({isOpen:t,setIsOpen:n,onOK:a=()=>{}})=>(b.useEffect(()=>{const c=()=>{n(!1)};return t&&document.addEventListener("click",c),()=>{t&&document.removeEventListener("click",c)}},[t,n]),e.createElement(v,null,t&&e.createElement(p.div,{className:"absolute left-0 right-0 z-50 w-60 rounded border  border-majky-400 bg-white   px-3 py-4 shadow-md dark:bg-slate-900 max-sm:w-60 lg:mt-2 mx-auto",initial:"closed",animate:"open",exit:"closed",layout:!0,variants:{open:{opacity:1,y:0},closed:{opacity:0,y:-30,transition:{delay:.2,duration:.1}}},onClick:c=>{c.stopPropagation()}},e.createElement("h2",{className:"relative px-2 text-center font-medium text-majky-800 dark:text-majky-400"},Un,e.createElement(E,{className:"absolute right-0 top-0 cursor-pointer hover:text-majky-600 active:text-majky-500",onClick:()=>{n(!1)},icon:Re})),e.createElement(p.div,{className:"mt-4 grid grid-cols-2 gap-2  font-medium"},e.createElement(x,{className:"rounded border-majky-200 bg-majky-50 py-1 text-center text-majky-800  dark:bg-slate-800 dark:text-majky-400",onClick:()=>{n(!1)}},Ge),e.createElement(x,{className:" rounded border-majky-200  bg-majky-400 py-1 text-center text-white dark:bg-majky-600 dark:text-slate-800",onClick:()=>{a(),n(!1)}},Yn))))),j=({label:t,value:n})=>e.createElement("div",{className:"mt-2 w-full md:max-w-96"},e.createElement("span",{className:"inline-block w-40 text-right "},t),e.createElement("span",{className:"pl-4"},":"),e.createElement("span",{className:" inline-block w-32 md:w-40"},n)),Ka=()=>{var i,d,u;const t=y(({user:g})=>{var f;return((f=g==null?void 0:g.modals)==null?void 0:f[re])||null}),n=w(),[a,c]=b.useState(!1),[r,o]=b.useState(!1),l=()=>{n(S(re))},[s,m]=b.useState(null);return b.useEffect(()=>{t&&m(rt())},[t]),e.createElement(v,null,t&&e.createElement(p.div,{initial:"closed",animate:"open",exit:"closed",layout:!0,variants:{open:{opacity:1},closed:{opacity:0}},className:"fixed left-0 top-0 z-[10000] flex h-screen w-screen flex-col items-center justify-center bg-black/50 p-4",onClick:l},e.createElement("div",{className:"relative flex max-h-full w-full flex-col items-center justify-between overflow-y-auto overflow-x-hidden rounded border bg-white pb-4 shadow-md dark:border-majky-400  dark:bg-slate-900/80 max-md:fixed max-md:left-0 max-md:top-0 max-md:h-full max-sm:w-full md:max-w-screen-md",onClick:g=>{g.stopPropagation()}},e.createElement("h2",{className:"w-full border-b border-majky-600 pb-1 pt-7 text-center text-2xl font-bold text-majky-800 shadow dark:text-majky-400"},ot),e.createElement("div",{className:"mt-4 flex w-full flex-col items-center text-center"},e.createElement(j,{label:Dn,value:s==null?void 0:s.played}),e.createElement(j,{label:On,value:`${(s==null?void 0:s.played)>0?parseInt((1-(s==null?void 0:s.failed)/(s==null?void 0:s.played))*100):0}%`}),e.createElement(j,{label:$n,value:s==null?void 0:s.streak}),e.createElement(j,{label:Cn,value:s==null?void 0:s.maxStreak}),e.createElement(j,{label:Mn,value:Q(((s==null?void 0:s.completed)||[]).reduce((g,{playedTime:f})=>g+f,0)/(((i=s==null?void 0:s.completed)==null?void 0:i.length)||1))}),e.createElement(j,{label:Rn,value:Q(Math.max(...(d=(s==null?void 0:s.completed)||[])==null?void 0:d.map(({playedTime:g})=>g),0))}),e.createElement(j,{label:Pn,value:Q(Math.min(...(u=(s==null?void 0:s.completed)||[])==null?void 0:u.map(({playedTime:g})=>g),0))})),e.createElement("div",{className:"mt-4 grid w-full max-w-80 grid-cols-2 gap-2  font-medium"},e.createElement(x,{className:"rounded border-majky-200  bg-majky-50 py-1 text-center text-majky-800  dark:bg-slate-800 dark:text-majky-400",onClick:g=>{c(!0),o(f=>!f)}},Bn),e.createElement(x,{className:" rounded border-majky-200  bg-majky-400 py-1 text-center text-white dark:bg-majky-600 dark:text-slate-800",onClick:l},Ge))),e.createElement(za,{isOpen:r,setIsOpen:o,onOK:()=>{m(Vn())}})))},qa=({children:t})=>{const{settings:n}=y(({user:a})=>a);return e.createElement(sa,null,e.createElement(Jt,{position:"top-center",newestOnTop:!0,closeOnClick:!0,toastClassName:"bg-white dark:text-slate-100 dark:bg-slate-900"}),e.createElement("div",{className:"relative flex h-full w-full flex-auto !select-none flex-col items-center justify-start overflow-hidden bg-white bg-cover bg-center transition-all dark:bg-slate-900 dark:text-slate-100",style:{backgroundImage:n.backgroundType>-1?`url('${new URL(Object.assign({"../../../../../image/connect4/background (0).jpg":Ea,"../../../../../image/connect4/background (1).jpg":wa,"../../../../../image/connect4/background (10).jpg":ha,"../../../../../image/connect4/background (11).jpg":va,"../../../../../image/connect4/background (12).jpg":ja,"../../../../../image/connect4/background (13).jpg":Na,"../../../../../image/connect4/background (14).jpg":Aa,"../../../../../image/connect4/background (15).jpg":Ia,"../../../../../image/connect4/background (16).jpg":Ta,"../../../../../image/connect4/background (2).jpg":Sa,"../../../../../image/connect4/background (3).jpg":La,"../../../../../image/connect4/background (4).jpg":Da,"../../../../../image/connect4/background (5).jpg":Oa,"../../../../../image/connect4/background (6).jpg":$a,"../../../../../image/connect4/background (7).jpg":Ca,"../../../../../image/connect4/background (8).jpg":Ma,"../../../../../image/connect4/background (9).jpg":Ra})[`../../../../../image/connect4/background (${n.backgroundType}).jpg`],self.location).href}')`:null}},e.createElement("div",{className:"relative flex w-full max-w-screen-xl flex-col items-start justify-start"},e.createElement(Ua,null),t),e.createElement(Va,null),e.createElement(Wa,null),e.createElement(Fa,null),e.createElement(Ka,null),e.createElement(Ha,null)))};function Ja(){return yt(),e.createElement(Qt,{store:xt},e.createElement(gn,{loading:null,persistor:xa},e.createElement(b.Suspense,{fallback:e.createElement(ka,null)},e.createElement(qa,null,e.createElement(ia,null)))))}const Qa=t=>{t&&t instanceof Function&&pn(()=>import("./web-vitals-23d6d37b.js"),[]).then(({getCLS:n,getFID:a,getFCP:c,getLCP:r,getTTFB:o})=>{n(t),a(t),c(t),r(t),o(t)})},Za=Ht.createRoot(document.getElementById("root"));Za.render(e.createElement(e.StrictMode,null,e.createElement(Ja,null)));Qa();