PageSourceSearch

https://www.funnudge.com/_next/static/chunks/4179.d3c44aec1cdd19eb.js

js funnudge.com collected 2026-10-02 01:31:10 UTC 16,099 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4179],{98:(e,t,n)=>{n.d(t,{EB:()=>c,ER:()=>d,cC:()=>i,sD:()=>h});var l=n(7548),a=n(2006),o=n(3464),s=n(6170),r=n(6451);function i(e,t){var n,i,d,c,h;let u=new l.Z58,p=new l.ubm(null!=(n=null==t?void 0:t.fov)?n:60,4/3,.1,500),f=new l.JeP({antialias:!0});f.setPixelRatio(Math.min(window.devicePixelRatio||1,1.5)),f.setClearColor(null!=(i=null==t?void 0:t.clear)?i:657940),(null==t?void 0:t.shadows)&&(f.shadowMap.enabled=!0,f.shadowMap.type=l.Wk7);let m=f.domElement;m.style.width="100%",m.style.height="100%",m.style.display="block",e.appendChild(m);let g=null;(null==t?void 0:t.bloom)&&((g=new a.s(f)).addPass(new s.A(u,p)),g.addPass(new r.C(new l.I9Y(256,256),null!=(d=t.bloom.strength)?d:.5,null!=(c=t.bloom.radius)?c:.5,null!=(h=t.bloom.threshold)?h:.7)),g.addPass(new o.X));let w=()=>{let t=e.clientWidth||1,n=e.clientHeight||1;f.setSize(t,n,!1),g&&(g.setPixelRatio(f.getPixelRatio()),g.setSize(t,n)),p.aspect=t/n,p.updateProjectionMatrix()};w();let x=new ResizeObserver(w);return x.observe(e),{scene:u,camera:p,renderer:f,render:()=>{g?g.render():f.render(u,p)},dispose:()=>{x.disconnect(),null==g||g.dispose(),u.traverse(e=>{e.geometry&&e.geometry.dispose();let t=e.material;Array.isArray(t)?t.forEach(e=>
1e.dispose()):null==t||t.dispose()}),f.dispose(),m.parentElement===e&&e.removeChild(m)}}}function d(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,s=document.createElement("canvas");s.width=e,s.height=t,n(s.getContext("2d"),e,t);let r=new l.GOR(s);return r.colorSpace=l.er$,r.wrapS=l.GJx,r.wrapT=l.GJx,r.repeat.set(a,o),r.anisotropy=4,r}function c(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:128,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#808080",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:26;return d(e,e,l=>{l.fillStyle=t,l.fillRect(0,0,e,e);for(let t=0;t<e*e*.35;t++){let t=128+Math.floor((Math.random()-.5)*2*n);l.fillStyle="rgb(".concat(t,",").concat(t,",").concat(t,")"),l.fillRect(Math.random()*e,Math.random()*e,1.5,1.5)}})}function h(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0xffffff,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.6,o=new Float32Array(3*e);for(let n=0;n<e;n++){let e=t*(.5+.5*Math.random()),l=Math.random()*Math.PI*2,a=(Math.random()-.5)*Math.PI;o[3*n]=Math.cos(l)*Math.cos(a)*e,o[3*n+1]=Math.sin(a)*e,o[3*n+2]=Math.sin(l)*Math.cos(a)*e}let s=new l.LoY;s.setAttribute("position",new l.THS(o,3));let r=new l.BH$({color:n,size:a,sizeAttenuation:!0,transparent:!0,opacity:.8,blending:l.EZo,depthWrite:!1});return new l.ONl(s,r)}},2773:(e,t,n)=>{n.d(t,{GL:()=>c,Gp:()=>r,Nc:()=>s,_y:()=>i,mA:()=>d});var l=n(2115);let a=null,o=new Set;function s(e){if(a!==e)for(let t of(a=e,o))t(e)}function r(e){return o.add(e),()=>o.delete(e)}let i={title:"Leave this game?",body:"You're mid-game — your progress in this round will be lost."},d={title:"Leave the match?",body:"The match is still live — leaving counts as a loss and your opponent takes the win."};function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i,{title:n,body:a}=t;(0,l.useEffect)(()=>e?(s({title:n,body:a}),()=>s(null)):void s(null),[e,n,a])}},3557:(e,t,n)=>{n.d(t,{g:()=>a});var l=n(2115);function a(e){let[t,n]=(0,l.useState)(0);return(0,l.useEffect)(()=>{try{let t=window.localStorage.getItem("funnudge:".concat(e));t&&n(Number(t)||0)}catch(e){}},[e]),{best:t,submit:(0,l.useCallback)(t=>{n(n=>{if(t<=n)return n;try{window.localStorage.setItem("funnudge:".concat(e),String(t))}catch(e){}return t})},[e])}}},4179:(e,t,n)=>{n.r(t),n.d(t,{default:()=>f});var l=n(5155),a=n(2115),o=n(7548),s=n(5833),r=n(8213),i=n(1175),d=n(4107),c=n(98),h=n(3557),u=n(2773);let p=[0xef4444,3900150,2278750,0xeab308,0xa855f7,0xf97316,440020,0xec4899,8702998,0xffffff];function f(){let e=(0,a.useRef)(null),[t,n]=(0,a.useState)("idle");(0,u.GL)("playing"===t);let[f,m]=(0,a.useState)(0),[g,w]=(0,a.useState)(0),{best:x,submit:b}=(0,h.g)("ball-sort-3d"),y=(0,a.useRef)(t),v=(0,a.useRef)(0),M=(0,a.useRef)(()=>{}),S=(0,a.useRef)(()=>{});return y.current=t,(0,a.useEffect)(()=>{let t=e.current;if(!t)return;let l=(0,c.cC)(t,{fov:42,clear:856608,shadows:!0,bloom:{strength:.25,radius:.6,threshold:.8}}
1),{scene:a,camera:h}=l;a.fog=new o.jUj(0xcae7d4,16,46),a.add(new o.dth(0xdff2ff,5208634,1));let u=new o.ZyN(0xfff3d8,1.7);u.position.set(9,16,7),u.castShadow=!0,u.shadow.mapSize.set(2048,2048),u.shadow.camera.left=-16,u.shadow.camera.right=16,u.shadow.camera.top=16,u.shadow.camera.bottom=-16,u.shadow.camera.near=.5,u.shadow.camera.far=60,u.shadow.bias=-4e-4,a.add(u);let f=new o.ZyN(0x9bffb0,.35);f.position.set(-8,5,-6),a.add(f);let g=(0,c.ER)(8,256,(e,t,n)=>{let l=e.createLinearGradient(0,0,0,n);l.addColorStop(0,"#5f9fd8"),l.addColorStop(.55,"#bfe0ec"),l.addColorStop(1,"#d8efc6"),e.fillStyle=l,e.fillRect(0,0,t,n)}),x=new o.eaF(new o.Gu$(120,24,16),new o.V9B({map:g,side:o.hsX,fog:!1}));a.add(x);let j=(0,c.ER)(256,256,(e,t,n)=>{e.fillStyle="#3f8f3a",e.fillRect(0,0,t,n);for(let l=0;l<6e3;l++)e.fillStyle=Math.random()>.5?"rgba(90,170,75,0.5)":"rgba(28,90,40,0.5)",e.fillRect(Math.random()*t,Math.random()*n,2,2)},14,14);j.anisotropy=8;let E=new o.eaF(new o.bdM(220,220),new o._4j({map:j,roughness:1}));E.rotation.x=-Math.PI/2,E.position.y=-.6,E.receiveShadow=!0,a.add(E);let N=(0,c.ER)(256,64,(e,t,n)=>{e.fillStyle="#8a5a30",e.fillRect(0,0,t,n);for(let l=0;l<70;l++)e.strokeStyle="rgba(".concat(60+45*Math.random(),",").concat(34+26*Math.random(),",14,0.4)"),e.lineWidth=1+Math.random(),e.beginPath(),e.moveTo(0,Math.random()*n),e.bezierCurveTo(.4*t,Math.random()*n,.6*t,Math.random()*n,t,Math.random()*n),e.stroke()},3,1),R=new o.eaF(new o.iNn(24,.6,4.6),new o._4j({map:N,roughness:.7}));R.position.set(0,-.3,0),R.castShadow=!0,R.receiveShadow=!0,a.add(R);let C=new o._4j({color:7029795,roughness:1}),P=[3112250,3505971,2584372].map(e=>new o._4j({color:e,roughness:1})),k=new o.Ho_(.18,.26,1.6,7),F=new o.qFE(1.1,2.4,9);for(let e=0;e<18;e++){let t=new o.YJl,n=new o.eaF(k,C);n.position.y=.2,n.castShadow=!0,t.add(n);let l=P[e%P.length],s=new o.eaF(F,l);s.position.y=1.7,s.castShadow=!0,t.add(s);let r=new o.eaF(F,l);r.position.y=2.7,r.scale.setScalar(.7),r.castShadow=!0,t.add(r);let i=.8+1.1*Math.random();t.scale.setScalar(i),t.position.set(-28+56*Math.random(),-.6,-13-22*Math.random()),a.add(t)}let _=new s.N(h,l.renderer.domElement);_.enablePan=!1,_.enableDamping=!0,_.dampingFactor=.08,_.rotateSpeed=.7,_.minDistance=8,_.maxDistance=28,_.minPolarAngle=.5,_.maxPolarAngle=1.5,_.target.set(0,2.2,0);let A=0,Y=document.createElement("canvas");Y.width=512,Y.height=128;let B=Y.getContext("2d"),z=new o.GOR(Y);z.colorSpace=o.er$;let D=e=>{B.clearRect(0,0,512,128),B.textAlign="center",B.textBaseline="middle",B.font="bold 62px system-ui, sans-serif",B.fillStyle="rgba(38,22,8,0.9)",B.fillText("MOVES   ".concat(e),256,70),B.fillStyle="rgba(255,238,205,0.22)",B.fillText("MOVES   ".concat(e),256,66),z.needsUpdate=!0};D(0);let I=new o.eaF(new o.bdM(4.6,1.15),new o.V9B({map:z,transparent:!0,depthWrite:!1}));I.rotation.x=-Math.PI/2,I.position.set(0,.02,1.55),a.add(I);let L=new o.YJl;a.add(L);let O=new o.uSd({color:0xe2eeff,transparent:!0,opacity:.36,roughness:.05,metalness:0,transmission:.32,ior:1.45,thickness:.6,clearcoat:1,clearcoatRoughness:.06,side:o.$EB}),T=new o._4j({color:0xf2f8ff,roughness:.2,metalness:.2,transparent:!0,opacity:.65}),G=new o.O3Y(.62,.05,8,30),q=new o._4j({color:0xd7e2f0,roughness:.5,metalness:.05}),W=(0,c.ER)(64,64,(e,t,n)=>{let l=e.createRadialGradient(t/2,n/2,2,t/2,n/2,t/2);l.addColorStop(0,"rgba(0,0,0,0.45)"),l.addColorStop(1,"rgba(0,0,0,0)"),e.fillStyle=l,e.fillRect(0,0,t,n)}),X=new o.bdM(1.8,1.8),H=new o.V9B({map:W,transparent:!0,depthWrite:!1}),J=new o.Gu$(.46,24,24),V=new Map,$=[],Z=[],U=-1,Q=!1,K=[],ee=null,et=null,en=e=>{let t=new o.YJl;t.position.x=e;let n=new o.eaF(new o.Ho_(.62,.62,4.26,28,1,!0),O);n.position.y=2.13,t.add(n);let l=new o.eaF(G,T);l.rotation.x=Math.PI/2,l.position.y=4.26,t.add(l);let a=new o.eaF(new o.Ho_(.6,.6,.2,28),q);a.position.y=.12,a.receiveShadow=!0,t.add(a);let s=new o.eaF(new o.Ho_(.7,.7,4.96,8),new o.V9B({visible:!1}));s.position.y=2.48,t.add(s),Z.push(s);let r=new o.eaF(X,H);return r.rotation.x=-Math.PI/2,r.position.y=.015,t.add(r),L.add(t),{balls:[],x:e,group:t}},el=(e,t,n)=>{let l,a=new o.eaF(J,(!(l=V.get(t))&&(l=new o.uSd({color:t,roughness:.25,metalness:0,
1clearcoat:.8,clearcoatRoughness:.2}),V.set(t,l)),l));a.castShadow=!0,a.position.set(0,.55+.94*n,0),e.group.add(a),e.balls.push({color:t,mesh:a})},ea=e=>e.balls.length?e.balls[e.balls.length-1].color:-1,eo=(e,t)=>{let n=$[e],l=n&&n.balls.length?n.balls[n.balls.length-1].mesh:null;if(ee&&ee.mesh!==l&&(ee.mesh.position.y=ee.baseY,ee=null),!n||!n.balls.length)return;let a=n.balls[n.balls.length-1],o=.55+.94*(n.balls.length-1);ee={mesh:a.mesh,baseY:o,t:ee&&ee.mesh===a.mesh?ee.t:0,target:+!!t}},es=function(e,t){let l=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=$[e],s=$[t],c=a.balls.pop();if(!c)return;ee=null,Q=!0;let h=new o.Pq0;c.mesh.getWorldPosition(h),s.group.add(c.mesh);let u=.55+.94*s.balls.length,p=s.group.worldToLocal(h.clone());c.mesh.position.copy(p);let f=performance.now(),g=a=>{let o=Math.min((a-f)/420,1),h=o<.5?2*o*o:1-Math.pow(-2*o+2,2)/2,x=p.x*(1-h),S=p.y+(u-p.y)*h,j=Math.sin(h*Math.PI)*(5.81-Math.max(p.y,u));c.mesh.position.set(x,S+Math.max(j,0),0),o<1?requestAnimationFrame(g):(c.mesh.position.set(0,u,0),s.balls.push(c),Q=!1,l&&(K.push([e,t]),w(A+=1),D(A)),(0,i._O)("tap"),$.every(e=>0===e.balls.length||4===e.balls.length&&e.balls.every(t=>t.color===e.balls[0].color))&&((0,i._O)("win"),v.current+=1,m(v.current),b(v.current),(0,d.q7)("ball-sort-3d",v.current),n("won"),(0,r.Q)(),setTimeout(()=>{"won"===y.current&&M.current(v.current)},1100)))};requestAnimationFrame(g)};M.current=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;v.current=e,m(e),A=0,w(0),D(0),(e=>{var t,n;L.traverse(e=>{e.geometry&&e.geometry!==J&&e.geometry!==X&&e.geometry!==G&&e.geometry.dispose()}),L.clear(),$=[],Z.length=0,U=-1,K.length=0;let l=Math.min(4+e,p.length),a=e<=1?2:1,o=e=>e.every(e=>0===e.length||4===e.length&&e.every(t=>t===e[0])),s=e=>{let t=e=>e.map(e=>e.join(".")).sort().join("|"),n=new Set,l=[e.map(e=>e.slice())],a=0;for(;l.length&&!(++a>5e4);){let e=l.pop();if(o(e))return!0;let a=t(e);if(!n.has(a)){n.add(a);for(let t=0;t<e.length;t++){let n=e[t];if(!n.length)continue;let a=n[n.length-1],o=0;for(let e=n.length-1;e>=0&&n[e]===a;e--)o++;if(o!==n.length||4!==n.length)for(let s=0;s<e.length;s++){if(t===s)continue;let r=e[s],i=4-r.length;if(i<=0)continue;if(0===r.length){if(o===n.length)continue}else if(r[r.length-1]!==a)continue;let d=Math.min(o,i),c=e.map(e=>e.slice());for(let e=0;e<d;e++)c[s].push(c[t].pop());l.push(c)}}}}return!1},r=e=>{let t=[];for(let e=0;e<l;e++)for(let n=0;n<4;n++)t.push(p[e]);for(let e=t.length-1;e>0;e--){let n=Math.random()*(e+1)|0;[t[e],t[n]]=[t[n],t[e]]}let n=[],a=0;for(let e=0;e<l;e++){let e=[];for(let n=0;n<4;n++)e.push(t[a++]);n.push(e)}for(let t=0;t<e;t++)n.push([]);return n},i=e=>{for(let t=0;t<40;t++){let t=r(e);if(!o(t)&&s(t))return t}return null},d=null!=(n=null!=(t=i(a))?t:i(a+1))?n:r(a+1),c=d.length;for(let e=0;e<c;e++)$.push(en(0));let u=(c-1)*1.7;$.forEach((e,t)=>{let n=1.7*t-u/2;e.x=n,e.group.position.x=n});let f=Math.max(11,.9*u+7);h.position.set(0,3.6,f),_.target.set(0,2.2,0),_.update();for(let e=0;e<d.length;e++)for(let t=0;t<d[e].length;t++)el($[e],d[e][t],t)})(e),n("playing")},S.current=()=>{if(Q||!K.length||"playing"!==y.current)return;let[e,t]=K.pop();-1!==U&&(eo(U,!1),U=-1),es(t,e,!1),w(A=Math.max(0,A-1)),D(A)};let er=new o.tBo,ei=new o.I9Y,ed=0,ec=0,eh=0,eu=e=>{ed=e.clientX,ec=e.clientY,eh=performance.now()},ep=e=>{if(Math.hypot(e.clientX-ed,e.clientY-ec)>6||performance.now()-eh>500)return;let n=t.getBoundingClientRect();ei.set((e.clientX-n.left)/n.width*2-1,-(2*((e.clientY-n.top)/n.height))+1),er.setFromCamera(ei,h);let l=er.intersectObjects(Z,!1);if(l.length){let e=Z.indexOf(l[0].object);-1!==e&&(e=>{if(!Q&&"playing"===y.current)if(-1===U){if(0===$[e].balls.length)return;U=e,eo(e,!0)}else if(U===e)eo(e,!1),U=-1;else{let t=$[U],n=$[e];if(t===n||0===t.balls.length||n.balls.length>=4?1:0!==n.balls.length&&ea(n)!==ea(t))et={group:n.group,baseX:n.x,t:0},(0,i._O)("tap");else{eo(U,!1);let t=U;U=-1,es(t,e)}}})(e)}};t.addEventListener("pointerdown",eu),t.addEventListener("pointerup",ep);let ef=0,em=performance.now(),eg=e=>{let t=Math.min((e-em)/1e3,.05);
1if(em=e,_.update(),ee&&(ee.t+=(ee.target-ee.t)*Math.min(12*t,1),ee.mesh.position.y=ee.baseY+ +ee.t,0===ee.target&&ee.t<.02&&(ee.mesh.position.y=ee.baseY,ee=null)),et){et.t+=t;let e=et.t/.35;et.group.position.x=et.baseX+.07*Math.sin(e*Math.PI*6)*(1-e),e>=1&&(et.group.position.x=et.baseX,et=null)}l.render(),ef=requestAnimationFrame(eg)};return ef=requestAnimationFrame(eg),()=>{cancelAnimationFrame(ef),t.removeEventListener("pointerdown",eu),t.removeEventListener("pointerup",ep),_.dispose(),O.dispose(),T.dispose(),G.dispose(),q.dispose(),z.dispose(),J.dispose(),V.forEach(e=>e.dispose()),g.dispose(),j.dispose(),N.dispose(),k.dispose(),F.dispose(),W.dispose(),X.dispose(),H.dispose(),l.dispose()}},[]),(0,l.jsxs)("div",{className:"select-none",children:[(0,l.jsxs)("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-3",children:[(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsxs)("div",{className:"rounded-xl bg-white/10 px-4 py-2 text-center",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-zinc-400",children:"Level"}),(0,l.jsx)("div",{className:"text-xl font-bold text-white",children:f+1})]}),(0,l.jsxs)("div",{className:"rounded-xl bg-white/10 px-4 py-2 text-center",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-zinc-400",children:"Moves"}),(0,l.jsx)("div",{className:"text-xl font-bold text-sky-300",children:g})]}),(0,l.jsxs)("div",{className:"rounded-xl bg-white/10 px-4 py-2 text-center",children:[(0,l.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-zinc-400",children:"Best"}),(0,l.jsx)("div",{className:"text-xl font-bold text-amber-300",children:x})]})]}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)("button",{onClick:()=>S.current(),className:"rounded-xl bg-white/10 px-3 py-2 font-bold text-zinc-200 transition hover:bg-white/20",children:"↩ Undo"}),(0,l.jsx)("button",{onClick:()=>M.current(v.current),className:"rounded-xl bg-gradient-to-r from-sky-500 to-blue-600 px-4 py-2 font-bold text-white transition hover:scale-105",children:"idle"===t?"Start":"Restart"})]})]}),(0,l.jsx)("div",{"data-board":!0,ref:e,className:"relative mx-auto aspect-square w-full touch-none overflow-hidden rounded-2xl border border-white/10 sm:aspect-[4/3]",style:{maxWidth:"min(100%, calc(82vh * 1.333))"},role:"application","aria-label":"Ball Sort 3D. Tap a tube to pick up its top balls, tap another to pour. Sort each tube to one color.",children:"playing"!==t&&(0,l.jsxs)("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-3 bg-black/55 backdrop-blur-[2px]",children:["won"===t?(0,l.jsx)("p",{className:"animate-bounce-in text-3xl font-extrabold text-white",children:"✅ Solved! Next level…"}):(0,l.jsx)("p",{className:"text-5xl","aria-hidden":!0,children:"\uD83E\uDDEA"}),(0,l.jsxs)("button",{onClick:e=>{e.stopPropagation(),M.current("won"===t?v.current:0)},className:"rounded-xl bg-gradient-to-r from-sky-500 to-blue-600 px-6 py-3 font-bold text-white transition hover:scale-105",children:["▶ ","idle"===t?"Start sorting":"C
1ontinue"]})]})}),(0,l.jsx)("p",{className:"mt-4 text-center text-sm text-zinc-500",children:"\uD83D\uDDB1️ Tap a tube to lift its top ball \xb7 Tap another to pour \xb7 A ball only stacks on the same color \xb7 Sort every tube to win"})]})}},8213:(e,t,n)=>{n.d(t,{P:()=>l,Q:()=>a});let l="funnudge:celebrate";function a(){try{window.dispatchEvent(new CustomEvent(l))}catch(e){}}}}]);

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.