1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3080],{2773:(e,t,r)=>{r.d(t,{GL:()=>s,Gp:()=>u,Nc:()=>a,_y:()=>i,mA:()=>o});var n=r(2115);let l=null,c=new Set;function a(e){if(l!==e)for(let t of(l=e,c))t(e)}function u(e){return c.add(e),()=>c.delete(e)}let i={title:"Leave this game?",body:"You're mid-game â your progress in this round will be lost."},o={title:"Leave the match?",body:"The match is still live â leaving counts as a loss and your opponent takes the win."};function s(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i,{title:r,body:l}=t;(0,n.useEffect)(()=>e?(a({title:r,body:l}),()=>a(null)):void a(null),[e,r,l])}},2932:(e,t,r)=>{function n(e,t,r){let n=window.devicePixelRatio||1,l=Math.max(1,Math.min((e.clientWidth||t)*n/t,4)),c=Math.round(t*l),a=Math.round(r*l);(e.width!==c||e.height!==a)&&(e.width=c,e.height=a);let u=e.getContext("2d");return u&&u.setTransform(l,0,0,l,0,0),u}function l(e,t,r,n,l){let c=r.getBoundingClientRect(),a=Math.min(c.width/n,c.height/l)||1,u=c.left+(c.width-n*a)/2,i=c.top+(c.height-l*a)/2;return{x:(e-u)/a,y:(t-i)/a}}r.d(t,{c:()=>n,f:()=>l})},3080:(e,t,r)=>{r.r(t),r.d(t,{default:()=>f});
1var n=r(5155),l=r(2115),c=r(2932),a=r(1175),u=r(4107),i=r(3557),o=r(2773);let s={wide:{label:"W",color:"#38bdf8"},multi:{label:"\xd73",color:"#a78bfa"},slow:{label:"S",color:"#4ade80"},life:{label:"â¤",color:"#fb7185"}};function d(e){let t=Math.min(4+e,8),r=[];for(let n=0;n<t;n++)for(let t=0;t<10;t++){if(e>1&&(n+t+e)%7==0)continue;let l=e>2&&n<2?2:1;r.push({x:4+63.6*t,y:60+26*n,w:59.6,hp:l,maxHp:l,hue:200+25*n+30*e})}return r}function f(){let e=(0,l.useRef)(null),[t,r]=(0,l.useState)("idle");(0,o.GL)("running"===t);let[f,x]=(0,l.useState)(0),[h,m]=(0,l.useState)(3),[y,v]=(0,l.useState)(1),{best:b,submit:g}=(0,i.g)("brick-breaker"),[p,w]=(0,l.useState)([]),k=(0,l.useRef)(0),M=(0,l.useCallback)((e,t)=>{let r=++k.current;w(n=>[...n.slice(-2),{id:r,text:e,cls:t}]),setTimeout(()=>w(e=>e.filter(e=>e.id!==r)),1100)},[]),S=(0,l.useRef)(M);S.current=M;let D=(0,l.useRef)(265),R=(0,l.useRef)(110),N=(0,l.useRef)(0),j=(0,l.useRef)([]),C=(0,l.useRef)([]),E=(0,l.useRef)([]),L=(0,l.useRef)([]),A=(0,l.useRef)(0),_=(0,l.useRef)(0),P=(0,l.useRef)(0),T=(0,l.useRef)({left:!1,right:!1}),B=(0,l.useRef)(0),O=(0,l.useRef)(3),I=(0,l.useRef)(1),z=(0,l.useRef)("idle"),F=(0,l.useRef)(0),W=(0,l.useRef)(0);z.current=t;let G=function(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10;for(let l=0;l<n;l++){let n=Math.random()*Math.PI*2,l=60+180*Math.random();L.current.push({x:e,y:t,vx:Math.cos(n)*l,vy:Math.sin(n)*l,life:.5+.3*Math.random(),hue:r})}},q=()=>({x:320,y:420,vx:0,vy:0,stuck:!0,trail:[]}),X=()=>{for(let e of j.current){if(!e.stuck)continue;e.stuck=!1;let t=-Math.PI/2+(Math.random()-.5)*.6,r=320+30*I.current;e.vx=Math.cos(t)*r,e.vy=Math.sin(t)*r}},H=e=>{if("wide"===e)N.current=10,S.current("\uD83C\uDFD3 WIDE PADDLE","text-sky-300"),(0,a._O)("combo");else if("multi"===e){var t;let e=null!=(t=j.current.find(e=>!e.stuck))?t:j.current[0],r=Math.max(300,Math.hypot(e.vx,e.vy)||340);for(let t of[-.5,.5]){let n=Math.atan2(e.vy||-1,e.vx||.2)+t;j.current.push({x:e.x,y:e.y,vx:Math.cos(n)*r,vy:Math.min(-80,Math.sin(n)*r),stuck:!1,trail:[]})}S.current("\uD83D\uDFE3 MULTIBALL!","text-violet-300"),(0,a._O)("combo")}else if("slow"===e){for(let e of j.current){if(e.stuck)continue;let t=Math.hypot(e.vx,e.vy),r=Math.max(240,.7*t);e.vx=e.vx/t*r,e.vy=e.vy/t*r}S.current("\uD83D\uDC0C SLOWED","text-green-300"),(0,a._O)("merge")}else O.current=Math.min(5,O.current+1),m(O.current),S.current("â¤ï¸ EXTRA LIFE","text-rose-300"),(0,a._O)("win")},U=(0,l.useCallback)(t=>{let r=e.current;if(!r)return;let n=(0,c.c)(r,640,500);if(!n)return;for(let e of(n.fillStyle="#0d0d1a",n.fillRect(0,0,640,500),n.save(),_.current>0&&n.translate((Math.random()-.5)*_.current*10,(Math.random()-.5)*_.current*8),C.current))n.fillStyle="hsl(".concat(e.hue%360,", 70%, ").concat(2===e.hp?38:52,"%)"),n.beginPath(),n.roundRect(e.x,e.y,e.w,22,4),n.fill(),n.fillStyle="rgba(255,255,255,0.15)",n.fillRect(e.x,e.y,e.w,3),e.maxHp>e.hp&&(n.strokeStyle="rgba(0,0,0,0.4)",n.lineWidth=1.5,n.beginPath(),n.moveTo(e.x+.3*e.w,e.y+3),n.lineTo(e.x+.42*e.w,e.y+12.100000000000001),n.lineTo(e.x+.3*e.w,e.y+22-3),n.moveTo(e.x+.42*e.w,e.y+12.100000000000001),n.lineTo(e.x+.62*e.w,e.y+8.8),n.stroke());for(let e of(L.current=L.current.filter(e=>e.life>0),L.current))e.x+=e.vx*t,e.y+=e.vy*t,e.vy+=400*t,e.life-=t,n.globalAlpha=Math.max(2*e.life,0),n.fillStyle="hsl(".concat(e.hue%360,", 70%, 60%)"),n.fillRect(e.x-2,e.y-2,4,4);for(let e of(n.globalAlpha=1,E.current)){let t=s[e.kind];n.fillStyle=t.color,n.shadowColor=t.color,n.shadowBlur=10,n.beginPath(),n.roundRect(e.x-15,e.y-11,30,22,8),n.fill(),n.shadowBlur=0,n.fillStyle="#0d0d1a",n.font="bold 13px system-ui, sans-serif",n.textAlign="center",n.fillText(t.label,e.x,e.y+4.5)}let l=R.current,a=n.createLinearGradient(D.current,0,D.current+l,0);for(let e of(N.current>0?(a.addColorStop(0,"#38bdf8"),a.addColorStop(1,"#818cf8"),n.shadowColor="#38bdf8",n.shadowBlur=12):(a.addColorStop(0,"#f43f5e"),a.addColorStop(1,"#fb923c")),n.fillStyle=a,n.beginPath(),n.roundRect(D.current,470,l,12,6),n.fill(),n.shadowBlur=0,j.current))e.trail.forEach((t,r)=>{let l=(r+1)/e.trail.length;n.globalAlpha=.35*l,n.fillStyle="#fde68a",n.beginPath(),n.arc(t.x,t.y,7*l*.85,0,2*Math.PI),n.fill()}),n.globalAlpha=1,n.shadowColor="#fbbf24",n.shadowBlur=14,n.fillStyle="#fde68a",n.beginPath(),n.arc(e.x,e.y,7,0,2*Math.PI),n.fill(),n.shadowBlur=0;
1n.restore(),P.current>0&&(n.fillStyle="rgba(255,255,255,".concat(.25*P.current,")"),n.fillRect(0,0,640,500)),n.fillStyle="rgba(255,255,255,0.85)",n.font="bold 15px system-ui, sans-serif",n.textAlign="left",n.fillText("Level ".concat(I.current),12,24),n.textAlign="right",n.fillText("â¤".repeat(Math.max(O.current,0)),628,24),A.current>=3&&(n.fillStyle="#fbbf24",n.textAlign="center",n.fillText("\uD83D\uDD25 combo \xd7".concat(A.current),320,24)),"running"===z.current&&j.current.some(e=>e.stuck)&&(n.fillStyle="rgba(255,255,255,0.7)",n.font="500 15px system-ui, sans-serif",n.textAlign="center",n.fillText("Click / tap / Space to launch",320,430))},[]),V=(0,l.useCallback)(e=>{let t=Math.min((e-W.current)/1e3,.02);if(W.current=e,_.current>0&&(_.current-=3*t),P.current>0&&(P.current-=3*t),"running"===z.current){let e=R.current;for(let r of(T.current.left&&(D.current-=520*t),T.current.right&&(D.current+=520*t),D.current=Math.max(0,Math.min(640-e,D.current)),N.current>0&&(N.current-=t,R.current=170,N.current<=0&&(R.current=110,S.current("paddle back to normal","text-zinc-300"))),E.current))r.y+=r.vy*t,r.vy+=140*t,r.y+11>=470&&r.y-11<=482&&r.x>=D.current-12&&r.x<=D.current+e+12&&(H(r.kind),r.y=1499);for(let r of(E.current=E.current.filter(e=>e.y<540),j.current)){if(r.stuck){r.x=D.current+e/2,r.y=461;continue}if(r.x+=r.vx*t,r.y+=r.vy*t,r.trail.push({x:r.x,y:r.y}),r.trail.length>9&&r.trail.shift(),r.x<7&&(r.x=7,r.vx*=-1),r.x>633&&(r.x=633,r.vx*=-1),r.y<7&&(r.y=7,r.vy*=-1),r.vy>0&&r.y+7>=470&&r.y+7<=490&&r.x>=D.current-7&&r.x<=D.current+e+7){let t=(r.x-(D.current+e/2))/(e/2),n=Math.min(560,Math.hypot(r.vx,r.vy)),l=-Math.PI/2+1.05*t;if(r.vx=Math.cos(l)*n,r.vy=Math.sin(l)*n,r.y=463,A.current>=3){let e=5*A.current*I.current;B.current+=e,S.current("\uD83D\uDD25 COMBO \xd7".concat(A.current," +").concat(e),"text-amber-300"),x(B.current)}A.current=0,(0,a._O)("tap")}for(let e=C.current.length-1;e>=0;e--){let t=C.current[e];if(r.x+7>t.x&&r.x-7<t.x+t.w&&r.y+7>t.y&&r.y-7<t.y+22){if(Math.min(r.x+7-t.x,t.x+t.w-(r.x-7))<Math.min(r.y+7-t.y,t.y+22-(r.y-7))?r.vx*=-1:r.vy*=-1,t.hp-=1,t.hp<=0){if(G(r.x,r.y,t.hue),C.current.splice(e,1),A.current+=1,B.current+=10*I.current,.15>Math.random()){let e=Math.random(),r=e<.35?"wide":e<.65?"multi":e<.85?"slow":"life";E.current.push({x:t.x+t.w/2,y:t.y+11,vy:90,kind:r})}(0,a._O)("score")}else B.current+=5,(0,a._O)("merge");x(B.current),g(B.current);break}}}0===C.current.length&&(I.current+=1,v(I.current),C.current=d(I.current),j.current=[q()],E.current=[],A.current=0,N.current=0,R.current=110,P.current=1,S.current("\uD83C\uDF89 LEVEL ".concat(I.current,"!"),"text-amber-300"),(0,a._O)("clear"));let n=j.current.length;j.current=j.current.filter(e=>e.y<=507),0===j.current.length&&n>0&&(O.current-=1,m(O.current),_.current=1,A.current=0,O.current<=0?((0,a._O)("lose"),r("over"),g(B.current),(0,u.q7)("brick-breaker",B.current)):((0,a._O)("lose"),S.current("\uD83D\uDC94 ".concat(O.current," ").concat(1===O.current?"life":"lives"," left"),"text-rose-400"),j.current=[q()]))}U(t),F.current=requestAnimationFrame(V)},[U,g]);(0,l.useEffect)(()=>(W.current=performance.now(),F.current=requestAnimationFrame(V),()=>cancelAnimationFrame(F.current)),[V]);let Y=(0,l.useCallback)(()=>{I.current=1,O.current=3,B.current=0,A.current=0,C.current=d(1),L.current=[],E.current=[],j.current=[q()],R.current=110,N.current=0,_.current=0,P.current=0,v(1),m(3),x(0),r("running")},[]),J=(e,t)=>{let{x:r}=(0,c.f)(e,0,t,640,500),n=R.current;D.current=Math.max(0,Math.min(640-n,r-n/2))};return(0,l.useEffect)(()=>{let e=e=>{"Space"===e.code&&(e.preventDefault(),"running"===z.current?X():Y()),("ArrowLeft"===e.key||"a"===e.key)&&(T.current.left=!0),("ArrowRight"===e.key||"d"===e.key)&&(T.current.right=!0)},t=e=>{("ArrowLeft"===e.key||"a"===e.key)&&(T.current.left=!1),("ArrowRight"===e.key||"d"===e.key)&&(T.current.right=!1)};return window.addEventListener("keydown",e),window.addEventListener("keyup",t),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",t)}},[Y]),(0,n.jsxs)("div",{className:"select-none",children:[(0,n.jsxs)("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-3",children:[(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsxs)("div",{className:"rounded-xl bg-white/10 px-4 py-2 text-center",children:[(0,n.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-zinc-400",children:"Score"}),(0,n.jsx)("div",{className:"text-xl font-bold text-white",children:f})]}),(0,n.jsxs)("div",{className:"rounded-xl bg-white/10 px-4 py-2 text-center",children:[(0,n.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-zinc-400",children:"Best"}),(0,n.jsx)("div",{className:"text-xl font-bold text-amber-300",children:b})]}),(0,n.jsxs)("div",{className:"hidden rounded-xl bg-white/10 px-4 py-2 text-center sm:block",children:[(0,n.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-zinc-400",children:"Level"}),(0,n.jsx)("div",{className:"text-xl font-bold text-sky-300",children:y})]})]}),(0,n.jsx)("button",{onClick:Y,className:"rounded-xl bg-gradient-to-r from-red-500 to-orange-500 px-4 py-2 font-bold text-white transition hover:scale-105",children:"running"===t?"Restart":"Start"})]}),(0,n.jsxs)("div",{"data-board":!0,className:"relative mx-auto w-full touch-none overflow-hidden rounded-2xl border border-white/10",style:{maxWidth:"min(100%, calc(82vh * 1.28))"},onPointerMove:e=>J(e.clientX,e.currentTarget),onPointerDown:e=>{J(e.clientX,e.currentTarget),"running"===z.current&&X()},role:"application","aria-label":"Brick Breaker game. Move mouse to control paddle, click to launch.",children:[(0,n.jsx)("canvas",{ref:e,width:640,height:500,className:"block h-auto w-full"}),(0,n.jsx)("div",{className:"pointer-events-none absolute inset-x-0 top-[10%] z-10 flex flex-col items-center gap-1",children:p.map(e=>(0,n.jsx)("div",{className:"animate-bounce-in text-lg font-extrabold drop-shadow-[0_2px_4px_rgba(0,0,0,0.8)] sm:text-xl ".concat(e.cls),children:e.text},e.id))}),"running"!==t&&(0,n.jsxs)("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-3 bg-black/60 backdrop-blur-[2px]",children:["over"===t?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"animate-bounce-in text-3xl font-extrabold text-white",children:"\uD83E\uDDE8 Game over"}),(0,n.jsxs)("p",{className:"text-zinc-200",children:["Score: ",(0,n.jsx)("span",{className:"font-bold text-white",children:f})," ","\xb7 Level ",y,f>0&&f>=b&&(0,n.jsx)("span",{className:"ml-2 font-bold text-amber-300",children:"New best
1!"})]})]}):(0,n.jsx)("p",{className:"text-5xl","aria-hidden":!0,children:"\uD83E\uDDE8"}),(0,n.jsx)("button",{onClick:e=>{e.stopPropagation(),Y()},className:"rounded-xl bg-gradient-to-r from-red-500 to-orange-500 px-6 py-3 font-bold text-white transition hover:scale-105",children:"over"===t?"Play again":"â¶ Start game"})]})]}),(0,n.jsx)("p",{className:"mt-4 text-center text-sm text-zinc-500",children:"\uD83D\uDDB1ï¸ Move or ââ to steer \xb7 Space/click to launch \xb7 Catch capsules: \uD83C\uDFD3 wide, \xd73 multiball, \uD83D\uDC0C slow, ⤠life"})]})}},3557:(e,t,r)=>{r.d(t,{g:()=>l});var n=r(2115);function l(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])}}}}]);
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.