PageSourceSearch

https://www.funnudge.com/_next/static/chunks/6283.154f4d306ec4ad99.js

js funnudge.com collected 2026-10-02 01:31:24 UTC 11,611 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6283],{3557:(e,t,r)=>{r.d(t,{g:()=>a});var n=r(2115);function a(e){let[t,r]=(0,n.useState)(0);return(0,n.useEffect)(()=>{try{let t=window.localStorage.getItem("funnudge:".concat(e));t&&r(Number(t)||0)}catch(e){}},[e]),{best:t,submit:(0,n.useCallback)(t=>{r(r=>{if(t<=r)return r;try{window.localStorage.setItem("funnudge:".concat(e),String(t))}catch(e){}return t})},[e])}}},6283:(e,t,r)=>{r.r(t),r.d(t,{default:()=>p});var n=r(5155),a=r(2115),l=r(1175),s=r(4107),o=r(3557);let c=["♠","♥","♦","♣"],i=["A","2","3","4","5","6","7","8","9","10","J","Q","K"],d=e=>"♥"===e||"♦"===e;function u(){let e=[],t=0;for(let r of c)for(let n=1;n<=13;n++)e.push({id:t++,suit:r,rank:n,faceUp:!1});for(let t=e.length-1;t>0;t--){let r=Math.floor(Math.random()*(t+1));[e[t],e[r]]=[e[r],e[t]]}let r=[],n=0;for(let t=0;t<7;t++){let a=e.slice(n,n+t+1).map((e,r)=>({...e,faceUp:r===t}));r.push(a),n+=t+1}return{stock:e.slice(n).map(e=>({...e,faceUp:!1})),waste:[],found:[[],[],[],[]],tab:r}}let f=e=>({stock:e.stock.map(e=>({...e})),waste:e.waste.map(e=>({...e})),found:e.found.map(e=>e.map(e=>({...e}))),tab:e.tab.map(e=>e.map(e=>({...e})))}),h=(e,t)=>{if(0===t.length)return 1===e.rank;let r=t[t.length-1];return r.suit===e.suit&&e.rank===r.rank+1};function p(){let[e,t]=(0,a.useState)(()=>u()),[r,p]=(0,a.useState)(null),[x,b]=(0,a.useState)(0),[m,g]=(0,a.useState)(0),[w,y]=(0,a.useState)(!1),[j,v]=(0,a.useState)(!1),{best:k,submit:N}=(0,o.g)("solitaire"),S=(0,a.useRef)([]),z=(0,a.useRef)(null),M=(0,a.useRef)(null),C=(0,a.useRef)(null),[U,_]=(0,a.useState)(360);(0,a.useEffect)(()=>{let e=C.current;if(!e)return;let t=new ResizeObserver(()=>_(e.clientWidth));return t.observe(e),_(e.clientWidth),()=>t.disconnect()},[]);let O=Math.max(4,Math.round(.012*U)),I=Math.floor((U-6*O)/7),E=Math.round(1.42*I),D=Math.max(13,Math.round(.3*E)),F={width:I,height:E};(0,a.useEffect)(()=>(w||!(x>0)||z.current||(z.current=setInterval(()=>g(e=>e+1),1e3)),w&&z.current&&(clearInterval(z.current),z.current=null),()=>{z.current&&(clearInterval(z.current),z.current=null)}),[w,x]),(0,a.useEffect)(()=>()=>{M.current&&clearInterval(M.current)},[]);let R=e=>{S.current.push(f(e)),S.current.length>200&&S.current.shift()},A=(0,a.useCallback)(e=>{if(52===e.found.reduce((e,t)=>e+t.length,0)){y(!0),(0,l._O)("win");let e=Math.max(1,1e3-m-x);N(e),(0,s.q7)("solitaire",e)}},[m,x,N]),J=e=>{for(let t of e.tab){let e=t[t.length-1];e&&!e.faceUp&&(e.faceUp=!0)}t(e),p(null),b(e=>e+1),A(e)},T=(e,t)=>{if(!t)return[];if("waste"===t.type)return e.waste.length?[e.waste[e.waste.length-1]]:[];if("found"===t.type){let r=e.found[t.f];return r.length?[r[r.length-1]]:[]}return e.tab[t.col].slice(t.idx)},W=(e,t)=>{t&&("waste"===t.type?e.waste.pop():"found"===t.type?e.found[t.f].pop():e.tab[t.col].splice(t.idx))},q=t=>{let n=T(e,r);if(0===n.length)return!1;if("found"===t.type){if(1!==n.length||!h(n[0],e.found[t.f]))return!1;R(e);let a=f(e);return W(a,r),a.found[t.f].push({...n[0],faceUp:!0}),(0,l._O)("score"),J(a),!0}if(!((e,t)=>{if(0===t.length)return 13===e.rank;let r=t[t.length-1];return r.faceUp&&d(r.suit)!==d(e.suit)&&e.rank===r.rank-1})(n[0],e.tab[t.col])||(null==r?void 0:r.type)==="tab"&&r.col===t.col)return!1;R(e);let a=f(e);return W(a,r),a.tab[t.col].push(...n.map(e=>({...e,faceUp:!0}))),(0,l._O)("tap"),J(a),!0},B=t=>{if(w||j)return;let n=T(e,t);if(0!==n.length&&n[0].faceUp){if(r){if("tab"===t.type&&q({type:"tab",col:t.col})||"found"===t.type&&q({type:"found",f:t.f}))return;let a=JSON.stringify(T(e,r).map(e=>e.id))===JSON.stringify(n.map(e=>e.id));if(p(null),a)return void(t=>{let r=T(e,t);if(1===r.length){for(let n=0;n<4;n++)if(h(r[0],e.found[n])){p(t);let a=r[0];R(e);let s=f(e);return W(s,t),s.found[n].push({...a,faceUp:!0}),(0,l._O)("score"),J(s),!0}}})(t)}p(t),(0,l._O)("tap")}},H=!w&&0===e.stock.length&&0===e.waste.length&&e.tab.every(e=>e.every(e=>e.faceUp));(0,a.useEffect)(()=>{if(j)return M.current=setInterval(()=>{t(e=>{let t=f(e),r=null;for(let e=0;e<7;e++){let n=t.tab[e],a=n[n.length-1];if(a)for(let n=0;n<4;n++)h(a,t.found[n])&&(!r||a.rank<t.tab[r.col].slice(-1)[0].rank)&&(r={col:e,f:n})}if(!r)return v(!1),M.current&&clearInterval(M.current),e;let n=t.tab[r.col].pop();
1if(t.found[r.f].push(n),(0,l._O)("score"),52===t.found.reduce((e,t)=>e+t.length,0)){v(!1),M.current&&clearInterval(M.current),y(!0),(0,l._O)("win");let e=Math.max(1,1e3-m-x);N(e),(0,s.q7)("solitaire",e)}return t})},140),()=>{M.current&&clearInterval(M.current)}},[j]);let K=()=>{M.current&&clearInterval(M.current),v(!1),t(u()),p(null),b(0),g(0),y(!1),S.current=[]},Q=(t,n)=>!!r&&T(e,r).some(e=>e.id===n),Y=e=>"".concat(Math.floor(e/60),":").concat(String(e%60).padStart(2,"0")),G=e=>{let{card:t,selected:r}=e,a=Math.max(11,Math.round(.26*I)),l=t.rank>10;return(0,n.jsxs)("div",{className:"relative flex h-full w-full flex-col rounded-md border bg-gradient-to-br from-white via-zinc-50 to-zinc-200 px-1 py-0.5 leading-none transition-all ".concat(r?"-translate-y-1 border-amber-400 shadow-xl shadow-amber-400/30 ring-2 ring-amber-400":"border-zinc-300 shadow-md"," ").concat(d(t.suit)?"text-rose-600":"text-zinc-900"),children:[(0,n.jsxs)("span",{className:"font-extrabold",style:{fontSize:a},children:[i[t.rank-1],(0,n.jsx)("span",{style:{fontSize:Math.round(.85*a)},children:t.suit})]}),I>=44&&(l?(0,n.jsxs)("span",{className:"m-auto flex flex-col items-center rounded border px-1 pb-0.5 font-serif font-black ".concat(d(t.suit)?"border-rose-300":"border-zinc-300"),style:{fontSize:Math.round(.34*I)},children:[i[t.rank-1],(0,n.jsx)("span",{style:{fontSize:Math.round(.2*I)},children:t.suit})]}):(0,n.jsx)("span",{className:"m-auto",style:{fontSize:Math.round(.42*I)},children:t.suit})),I>=44&&(0,n.jsxs)("span",{className:"absolute bottom-0.5 right-1 rotate-180 font-extrabold",style:{fontSize:Math.round(.8*a)},children:[i[t.rank-1],t.suit]})]})},L=()=>(0,n.jsx)("div",{className:"h-full w-full rounded-md border border-indigo-950 shadow-md",style:{background:"repeating-linear-gradient(45deg, #1e3a8a 0 5px, #1e2b6b 5px 10px)"},children:(0,n.jsx)("div",{className:"m-[3px] flex h-[calc(100%-6px)] items-center justify-center rounded border border-blue-300/30 text-blue-300/40",children:I>=44&&"❖"})});return(0,n.jsxs)("div",{className:"select-none",children:[(0,n.jsxs)("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsxs)("div",{className:"flex gap-2 text-sm",children:[(0,n.jsxs)("span",{className:"rounded-full bg-white/10 px-3 py-1.5 text-zinc-300",children:["⏱ ",Y(m)]}),(0,n.jsxs)("span",{className:"rounded-full bg-white/10 px-3 py-1.5 text-zinc-300",children:["Moves: ",(0,n.jsx)("strong",{className:"text-white",children:x})]}),(0,n.jsxs)("span",{className:"rounded-full px-3 py-1.5 ".concat(e.found.reduce((e,t)=>e+t.length,0)>0?"bg-emerald-500/20 text-emerald-300":"bg-white/10 text-zinc-400"),children:["\uD83C\uDFE0 ",e.found.reduce((e,t)=>e+t.length,0),"/52"]}),k>0&&(0,n.jsxs)("span",{className:"hidden rounded-full bg-white/10 px-3 py-1.5 text-amber-300 sm:block",children:["\uD83C\uDFC6 Best: ",k]})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[H&&(0,n.jsx)("button",{onClick:()=>{H&&!j&&v(!0)},className:"animate-pop rounded-xl bg-gradient-to-r from-amber-500 to-yellow-500 px-4 py-2 font-bold text-zinc-900 transition hover:scale-105",children:"✨ Auto-complete"}),(0,n.jsx)("button",{onClick:()=>{if(w||j)return;let e=S.current.pop();e&&(t(e),p(null),b(e=>e+1),(0,l._O)("tap"))},className:"rounded-xl bg-white/10 px-4 py-2 font-bold text-zinc-200 transition hover:bg-white/20",children:"↩ Undo"}),(0,n.jsx)("button",{onClick:K,className:"rounded-xl bg-gradient-to-r from-emerald-600 to-green-600 px-4 py-2 font-bold text-white transition hover:scale-105",children:"New Deal"})]})]}),(0,n.jsxs)("div",{className:"relative mx-auto max-w-3xl rounded-2xl border-[3px] border-amber-950/80 p-2 shadow-[inset_0_0_70px_rgba(0,0,0,0.55)] sm:p-4",style:{background:"radial-gradient(ellipse at 50% 25%, #08744f 0%, #065f46 45%, #033b2b 100%)"},role:"application","aria-label":"Solitaire table",children:[(0,n.jsxs)("div",{ref:C,children:[(0,n.jsxs)("div",{className:"mb-3 grid grid-cols-7",style:{gap:O},children:[(0,n.jsx)("button",{onClick:()=>{if(w||j)return;R(e);let t=f(e);
1if(t.stock.length>0){let e=t.stock.pop();e.faceUp=!0,t.waste.push(e)}else{if(!(t.waste.length>0))return void S.current.pop();t.stock=t.waste.reverse().map(e=>({...e,faceUp:!1})),t.waste=[]}(0,l._O)("tap"),J(t)},"aria-label":"Stock — draw a card",style:F,className:"relative transition-transform active:scale-95",children:e.stock.length>0?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(L,{}),(0,n.jsx)("span",{className:"absolute -bottom-1 -right-1 rounded-full bg-black/70 px-1.5 text-[10px] font-bold text-zinc-200",children:e.stock.length})]}):(0,n.jsx)("div",{className:"flex h-full w-full items-center justify-center rounded-md border-2 border-dashed border-white/25 text-xl text-white/40",children:"↻"})}),(0,n.jsx)("button",{onClick:()=>e.waste.length&&B({type:"waste"}),"aria-label":"Waste pile",style:F,children:e.waste.length>0?(0,n.jsx)(G,{card:e.waste[e.waste.length-1],selected:Q({type:"waste"},e.waste[e.waste.length-1].id)}):(0,n.jsx)("div",{className:"h-full w-full rounded-md border-2 border-dashed border-white/15"})}),(0,n.jsx)("div",{}),e.found.map((e,t)=>(0,n.jsx)("button",{onClick:()=>{r?q({type:"found",f:t})||p(null):e.length&&B({type:"found",f:t})},"aria-label":"Foundation ".concat(t+1),style:F,children:e.length>0?(0,n.jsx)(G,{card:e[e.length-1],selected:Q({type:"found",f:t},e[e.length-1].id)}):(0,n.jsx)("div",{className:"flex h-full w-full items-center justify-center rounded-md border-2 border-dashed border-white/25 text-white/25",style:{fontSize:Math.round(.45*I)},children:c[t]})},t))]}),(0,n.jsx)("div",{className:"grid grid-cols-7",style:{gap:O},children:e.tab.map((e,t)=>(0,n.jsxs)("div",{className:"relative",style:{minHeight:E+Math.max(e.length-1,0)*D},children:[0===e.length&&(0,n.jsx)("button",{onClick:()=>{r&&!q({type:"tab",col:t})&&p(null)},"aria-label":"Empty column ".concat(t+1),style:F,className:"rounded-md border-2 border-dashed border-white/15"}),e.map((e,r)=>(0,n.jsx)("button",{onClick:()=>{e.faceUp&&B({type:"tab",col:t,idx:r})},style:{...F,top:r*D},className:"absolute left-0 ".concat(e.faceUp&&!w?"transition-transform hover:-translate-y-0.5":""),children:e.faceUp?(0,n.jsx)(G,{card:e,selected:Q({type:"tab",col:t,idx:r},e.id)}):(0,n.jsx)(L,{})},e.id))]},t))})]}),w&&(0,n.jsxs)("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-3 overflow-hidden rounded-2xl bg-black/70 backdrop-blur-sm",children:[Array.from({length:36}).map((e,t)=>(0,n.jsx)("span",{"aria-hidden":!0,className:"pointer-events-none absolute top-0 rounded-sm",style:{left:"".concat(89*t%100,"%"),width:7+t%3*2,height:11+t%4*2,background:["#e879f9","#fbbf24","#34d399","#38bdf8","#fb7185"][t%5],animation:"confetti-fall ".concat(1.5+t%5*.3,"s ease-in ").concat(t%7*.13,"s forwards")}},t)),(0,n.jsx)("p",{className:"animate-bounce-in text-3xl font-extrabold text-white",children:"\uD83C\uDF89 You won!"}),(0,n.jsxs)("p",{className:"text-zinc-300",children:[x," moves \xb7 ",Y(m)]}),(0,n.jsx)("button",{onClick:K,className:"rounded-xl bg-gradient-to-r from-emerald-600 to-green-600 px-6 py-3 font-bold text-white transition hover:scale-105",children:"Deal again"})]})]}),(0,n.jsx)("p",{className:"mt-3 text-center text-sm text-zinc-500",children:"Tap a card, then tap its destination \xb7 Tap twice to auto-send to foundation \xb7 Tap the deck to draw"})]})}}}]);

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.