1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[411],{3792:(e,t,l)=>{Promise.resolve().then(l.bind(l,8298)),Promise.resolve().then(l.t.bind(l,2619,23))},8298:(e,t,l)=>{"use strict";l.d(t,{default:()=>b});var n=l(5155),a=l(2115),s=l(63),r=l(8017),o=l(8188),i=l(4499);let c=(e,t)=>"".concat(e,",").concat(t),u="meowdokuLastPlayedLevel",d="meowdokuDailyModeActive",m="meowdokuBeforeDailyLevel",f=e=>(0,o.Q)(e);function g(e){return Array.from({length:e},()=>Array.from({length:e},()=>"empty"))}function h(e){return e.map(e=>e.slice())}function v(e){let t=new Set,l=[];for(let n of e.board)for(let e of n)t.has(e)||(t.add(e),l.push(e));return l}function p(e,t,l,n,a){var s,r,o,i,u,d,m,f,g,h;let p=arguments.length>5&&void 0!==arguments[5]&&arguments[5],b=v(t),x=t.size,y=new Set((t.solution||[]).map(e=>{let[t,l]=e;return c(t,l)})),j=new Set,w={color:!1,line:!1,adj:!1,solution:!1},S=[],N=function(e){let t=[];for(let l=0;l<e.length;l+=1)for(let n=0;n<e[l].length;n+=1)"cat"===e[l][n]&&t.push([l,n]);return t}(e),C=Array.from({length:x},()=>[]),k=Array.from({length:x},()=>[]),M=Object.fromEntries(b.map(e=>[e,[]]));for(let[e,l]of N){C[e].push([e,l]),k[l].push([e,l]);let n=t.board[e][l];M[n]||(M[n]=[]),M[n].push([e,l])}let T=e=>e.forEach(e=>{let[t,l]=e;return j.add(c(t,l))});if((null==(s=l.rules)?void 0:s.oneCatPerRow)!==!1||(null==(r=l.rules)?void 0:r.oneCatPerColumn)!==!1)for(let e=0;e<x;e+=1)(null==(f=l.rules)?void 0:f.oneCatPerRow)!==!1&&C[e].length>1&&(w.line=!0,S.push(n.messages.rowMany(e+1)),T(C[e])),(null==(g=l.rules)?void 0:g.oneCatPerColumn)!==!1&&k[e].length>1&&(w.line=!0,S.push(n.messages.colMany(e+1)),T(k[e]));if((null==(o=l.rules)?void 0:o.oneCatPerColor)!==!1)for(let e of b)(M[e]||[]).length>1&&(w.color=!0,S.push(n.messages.colorMany(a(e))),T(M[e]));if((null==(i=l.rules)?void 0:i.noAdjacent)!==!1)for(let e=0;e<N.length;e+=1)for(let t=e+1;t<N.length;t+=1){let[l,a]=N[e],[s,r]=N[t];1>=Math.max(Math.abs(l-s),Math.abs(a-r))&&(w.adj=!0,S.push(n.messages.adjacent),j.add(c(l,a)),j.add(c(s,r)))}if(p&&y.size){for(let[e,t]of N)y.has(c(e,t))||(w.solution=!0,j.add(c(e,t)));for(let t of y){let[l,n]=t.split(",").map(Number);(null==(h=e[l])?void 0:h[n])==="x"&&(w.solution=!0,j.add(t))}w.solution&&S.push(n.messages.wrongSolution)}let z=b.length,E=(null==(u=l.rules)?void 0:u.oneCatPerRow)===!1||C.every(e=>1===e.length),O=(null==(d=l.rules)?void 0:d.oneCatPerColumn)===!1||k.every(e=>1===e.length),A=(null==(m=l.rules)?void 0:m.oneCatPerColor)===!1||b.every(e=>1===(M[e]||[]).length),P=N.length===z,R=!y.size||P&&N.every(e=>{let[t,l]=e;return y.has(c(t,l))}),I=P&&E&&O&&A&&!w.adj;return{bad:w,messages:[...new Set(S)],errorCells:j,cats:N,target:z,oneEveryRow:E,oneEveryCol:O,oneEveryColor:A,exactCount:P,complete:I,isSolved:I&&R&&!w.solution}}function b(e){var t,l,o,b,x,y,j;let{config:w,initialLevelId:S,locale:N=r.Xn}=e,C=(0,s.useRouter)(),k=r.is[N]||r.is[r.Xn],M=(0,a.useMemo)(()=>(w.levels||[]).slice().sort((e,t)=>(e.number||0)-(t.number||0)),[w]),T=w.defaultLevelId||(null==(t=M[0])?void 0:t.id),[z,E]=(0,a.useState)(S||T),O=(0,a.useMemo)(()=>M.find(e=>e.id===z||e.slug===z)||M[0],[z,M]),A=M.findIndex(e=>e.id===O.id),P=(0,a.useMemo)(()=>v(O),[O]),R=(0,a.useMemo)(()=>(function(e){let t=e.filter(e=>"hard"===e.difficulty),l=t.length?t:e;return l[function(e,t){let l=0;for(let t=0;t<e.length;t+=1)l=31*l+e.charCodeAt(t)>>>0;return t?l%t:0}(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,t=e.getFullYear(),l=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(l,"-").concat(n)}(),l.length)]||e[0]})(M),[M]),[I,L]=(0,a.useState)(()=>g(O.size)),[D,J]=(0,a.useState)([]),[B,H]=(0,a.useState)(()=>new Set),[G,_]=(0,a.useState)(null),[F,X]=(0,a.useState)(k.messages.startHint),[q,Y]=(0,a.useState)(!1),[Q,U]=(0,a.useState)(""),[Z,K]=(0,a.useState)(()=>new Set),[V,W]=(0,a.useState)((null==(l=w.sounds)?void 0:l.enabledByDefault)!==!1),[$,ee]=(0,a.useState)(!1),[et,el]=(0,a.useState)({open:!1,title:"",text:"",actionText:"",action:"restart"}),en=(0,a.useRef)(null),ea=(0,a.useRef)(null),es=(0,a.useRef)({}),er=(0,a.useRef)((null==(o=w.sounds)?void 0:o.enabledByDefault)!==!1),eo=(0,a.useRef)(!0),ei=(0,a.useRef)(!1),ec=(0,a.useRef)(null),eu=(0,i.X)("cats:".concat(O.id)),ed=e=>{var t;return(0,r.gy)((null==(t=w.colors[e])?void 0:t.label)||e,N)},em=P.length,ef=I.flat().filter(e=>"cat"===e).length,eg=p(I,O,w,k,ed,!1);function eh(e){return"catPuzzleBoardState:".concat(e.id)}function ev(){try{let e=window.localStorage.getItem(u);if(!e)return null;let t=JSON.parse(e),l="string"==typeof t?t:t.id,n="object"==typeof t?t.number:null;return M.find(e=>e.id===l||e.slug===l||n&&Number(e.number)===Number(n))||null}catch(e){return null}}function ep(e){try{window.localStorage.setItem(u,JSON.stringify({id:e.id,number:e.number,slug:e.slug}))}catch(e){}}function eb(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;try{if(!e){window.sessionStorage.removeItem(d),window.sessionStorage.removeItem(m);return}window.sessionStorage.setItem(d,"true"),t&&window.sessionStorage.setItem(m,JSON.stringify({id:t.id,number:t.number,slug:t.slug}))}catch(e){}}function ex(e){try{window.localStorage.removeItem(eh(e))}catch(e){}}function ey(e){U(e),clearTimeout(en.current),en.current=setTimeout(()=>U(""),1800)}function ej(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8;"undefined"!=typeof navigator&&"function"==typeof navigator.vibrate&&navigator.vibrate(e)}function ew(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t&&!er.current)return;let l=es.current[e];if(l)try{l.currentTime=0,l.play().catch(()=>{})}catch(e){}}function eS(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"tap",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;ej(t),ew(e)}function eN(){let{announce:e=!0,clearSaved:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};clearTimeout(ea.current),eo.current=!0,t&&ex(O);let l=t?null:function(e){try{var t;let l=window.localStorage.getItem(eh(e));if(!l)return null;let n=JSON.parse(l);return(t=e.size,Array.isArray(n)&&n.length===t&&n.every(e=>Array.isArray(e)&&e.length===t&&e.every(e=>["empty","cat","x"].includes(e))))?n:null}catch(e){return null}}(O);L(l||g(O.size)),J([]),H(new Set),_(null),X(l?k.messages.restored:k.messages.startHint),Y(!1),el(e=>({...e,open:!1}
1)),e&&ey(t?k.messages.resetDone(O.title):k.messages.opened(O.title))}function eC(e){return(0,r.Rl)(e,N)}function ek(e){let{remember:t=!0,dailyMode:l=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};eS("levelChange",10),t&&ep(e),l||eb(!1),ee(l),E(e.id),C.push(eC(e),{scroll:!1})}function eM(){let e=M[A+1]||M[0];el(e=>({...e,open:!1})),ek(e)}function eT(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:k.messages.continue;return!(I.length===e.length&&I.every((t,l)=>t.every((t,n)=>{var a;return t===(null==(a=e[l])?void 0:a[n])})))&&(eS(t,"error"===t?[15,30,15]:8),J(e=>{let t=[...e,h(I)];return t.length>100?t.slice(1):t}),L(e),H(new Set),_(null),X(l),!0)}function ez(e){p(e,O,w,k,ed,!0).isSolved&&setTimeout(()=>eO(),80)}function eE(e,t,l){if(e.preventDefault(),q||eu.blocked)return;clearTimeout(ea.current);let n=I[t][l],a=h(I),s="erase",r=k.messages.cleared;if("empty"===n){let e=O.board[t][l];for(let t=0;t<O.size;t+=1)for(let l=0;l<O.size;l+=1)O.board[t][l]===e&&"cat"===a[t][l]&&(a[t][l]="empty");a[t][l]="cat",s="cat",r=k.messages.sameColorMoved(ed(e))}else a[t][l]="empty";if(eT(a,s,r)){let e=p(a,O,w,k,ed,!1);"cat"===s&&e.errorCells.has(c(t,l))?(H(e.errorCells),eS("error",[15,30,15]),eu.loseLife()):ez(a)}}function eO(){if(q)return;ew("success"),ej([20,45,20]),Y(!0),ex(O);let e=new Set(Z);e.add(O.id);K(new Set(e));try{window.localStorage.setItem("catPuzzleNextCompletedLevels",JSON.stringify([...e]))}catch(e){}!function(){if("undefined"==typeof document)return;let e=["#ff6d8a","#78d56d","#ffd35c","#b88b4f","#aa9de8","#7bc1ef"];for(let t=0;t<42;t+=1){let l=document.createElement("i");l.className="confetti",l.style.left="".concat(100*Math.random(),"vw"),l.style.background=e[t%e.length],l.style.animationDelay="".concat(.32*Math.random(),"s"),l.style.animationDuration="".concat(.8+.9*Math.random(),"s"),document.body.appendChild(l),setTimeout(()=>l.remove(),2100)}}();let t=A<M.length-1;el({open:!0,title:k.messages.winTitle,text:k.messages.winText(O.title),actionText:t?k.messages.nextLevel:k.messages.playAgain,action:t?"next":"restart"})}return(0,a.useEffect)(()=>{let e=S||T;if(ei.current||e!==T)ei.current=!0;else{let t=ev();if(ei.current=!0,t&&t.id!==e){E(t.id),C.replace((0,r.Rl)(t,N),{scroll:!1});return}}E(e);let t=M.find(t=>t.id===e||t.slug===e);t&&t.id!==T&&ep(t)},[S,T,M,N,C]),(0,a.useEffect)(()=>{try{let e=window.localStorage.getItem("catPuzzleNextCompletedLevels"),t=e?JSON.parse(e):[];K(new Set(Array.isArray(t)?t:[]))}catch(e){K(new Set)}},[]),(0,a.useEffect)(()=>{try{let e=window.localStorage.getItem("catPuzzleSoundEnabled");("true"===e||"false"===e)&&(W("true"===e),er.current="true"===e)}catch(e){}},[]),(0,a.useEffect)(()=>{er.current=V},[V]),(0,a.useEffect)(()=>{if("undefined"==typeof Audio)return;let e=Object.entries(w.sounds||{}).filter(e=>{let[t,l]=e;return"enabledByDefault"!==t&&"string"==typeof l}),t={};for(let[l,n]of e){let e=new Audio(f(n));e.preload="auto",e.volume="error"===l?.42:"success"===l?.5:.36,t[l]=e}return es.current=t,()=>{Object.values(t).forEach(e=>{e.pause(),e.src=""})}},[w.sounds]),(0,a.useEffect)(()=>{eN({announce:!1,clearSaved:!1})},[O.id]),(0,a.useEffect)(()=>{X(e=>e||k.messages.startHint)},[k.messages.startHint]),(0,a.useEffect)(()=>{try{if("true"!==window.sessionStorage.getItem(d))return void ee(!1);let e=window.sessionStorage.getItem(m),t=e?JSON.parse(e):null;ec.current=t?M.find(e=>
1e.id===t.id||e.slug===t.slug||Number(e.number)===Number(t.number)):null,ee(!!(R&&O.id===R.id))}catch(e){ee(!1)}},[R,O.id,M]),(0,a.useEffect)(()=>{if(eo.current){eo.current=!1;return}var e=O,t=I;try{window.localStorage.setItem(eh(e),JSON.stringify(t))}catch(e){}},[I,O.id]),(0,a.useEffect)(()=>()=>{clearTimeout(en.current),clearTimeout(ea.current)},[]),(0,n.jsxs)("section",{className:"game-shell","aria-labelledby":"game-title",children:[(0,n.jsxs)("header",{className:"site-header",children:[(0,n.jsxs)("a",{className:"site-brand",href:(0,r.dS)("/",N),"aria-label":"Meowdoku",children:[(0,n.jsx)("span",{className:"brand-mark","aria-hidden":"true",children:(0,n.jsx)("img",{src:f((null==(b=w.colors[P[0]])?void 0:b.cat)||(null==(x=Object.values(w.colors)[0])?void 0:x.cat)),alt:""})}),(0,n.jsx)("span",{children:"Meowdoku"})]}),(0,n.jsxs)("nav",{className:"site-nav","aria-label":"Site navigation",children:[(0,n.jsx)("a",{href:"#game",children:k.navPlay}),(0,n.jsx)("a",{href:"#level-info",children:k.navLevels}),(0,n.jsx)("a",{href:(0,r.dS)("/sudoku",N),children:"Sudoku"}),R&&(0,n.jsx)("a",{className:"daily-link",href:$&&ec.current?eC(ec.current):eC(R),onClick:e=>{e.preventDefault(),function(){if(R){if($){let e=ec.current?M.find(e=>e.id===ec.current.id||e.slug===ec.current.slug):null;eb(!1),ek(e||ev()||M[0],{remember:!0,dailyMode:!1});return}ec.current=O.id===R.id?ev()||M[0]:O,eb(!0,ec.current),ek(R,{remember:!1,dailyMode:!0})}}()},children:$?k.levelMode:k.dailyChallenge}),(0,n.jsx)("a",{className:"more-games-link",href:(0,r.dS)("/more-games",N),children:k.moreGames||"More Games"}),(0,n.jsx)("select",{className:"language-select","aria-label":"Language",value:N,onChange:e=>(function(e){let t=(0,r.Rl)(O,e);C.push(t,{scroll:!1})})(e.target.value),children:r.YZ.map(e=>(0,n.jsx)("option",{value:e,children:r.mG[e]},e))})]})]}),(0,n.jsx)("div",{className:"game-copy",children:(0,n.jsx)("h1",{id:"game-title",children:"Meowdoku"})}),(0,n.jsxs)("div",{className:"game-card",id:"game",children:[(0,n.jsxs)("div",{className:"status-row",children:[(0,n.jsx)(i.A,{lives:eu.lives,locale:N}),(0,n.jsx)("section",{className:"status-pill","aria-label":k.status,children:(0,n.jsxs)("div",{className:"counter","aria-live":"polite",children:[(0,n.jsx)("img",{src:f(null==(y=w.colors[P[0]])?void 0:y.cat),alt:""}),(0,n.jsx)("span",{className:"counter-number",children:ef}),(0,n.jsxs)("span",{className:"counter-total",children:["/",em]})]})}),(0,n.jsxs)("div",{className:"game-tools","aria-label":"Game tools",children:[(0,n.jsx)("button",{className:"icon-btn sound-toggle",type:"button",onClick:function(){W(e=>{let t=!e;er.current=t;try{window.localStorage.setItem("catPuzzleSoundEnabled",String(t))}catch(e){}return t&&ew("tap",!0),t}),ej(8)},"aria-label":V?k.soundOn:k.soundOff,"aria-pressed":V,title:V?k.soundOn:k.soundOff,children:(0,n.jsx)("span",{className:"sound-label","aria-hidden":"true",children:V?"ON":"OFF"})}),(0,n.jsx)("button",{className:"icon-btn settings-toggle",type:"button",onClick:function(){eS("tap",8),el({open:!0,title:k.messages.helpTitle,text:k.messages.helpText,actionText:k.messages.confirmReset,action:"restart"})},"aria-label":k.help,title:k.help,children:(0,n.jsx)("img",{src:f(null==(j=w.ui)?void 0:j.gear),alt:""})})]})]}),(0,n.jsxs)("section",{className:"rules","aria-label":"Rules",children:[(0,n.jsx)("div",{className:"rule-card ".concat(eg.bad.color?"bad":""," ").concat(!eg.bad.color&&eg.oneEveryColor?"good":""),children:k.rules[0]}),(0,n.jsx)("div",{className:"rule-card ".concat(eg.bad.line?"bad":""," ").concat(!eg.bad.line&&eg.oneEveryRow&&eg.oneEveryCol?"good":""),children:k.rules[1]}),(0,n.jsx)("div",{className:"rule-card important ".concat(eg.bad.adj?"bad":""," ").concat(!eg.bad.adj&&eg.cats.length>1?"good":""),children:k.rules[2]})]}),(0,n.jsx)("section",{className:"quick-guide","aria-label":k.help,children:k.guide.map(e=>{let[t,l]=e;return(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:t}),(0,n.jsx)("span",{children:l})]},t)})}),(0,n.jsx)("section",{className:"board-wrap","aria-label":"".concat(O.title," board"),children:(0,n.jsx)("div",{className:"board-grid",role:"grid","aria-rowcount":O.size,"aria-colcount":O.size,style:{"--level-size":O.size},children:O.board.map((e,t)=>e.map((e,l)=>{var a,s;let r=(null==(a=I[t])?void 0:a[l])||"empty",o=w.colors[e],i="cat"===r?null==o?void 0:o.cat:null==o?void 0:o.empty,u=c(t,l);return(0,n.jsxs)("button",{type:"button",role:"gridcell",className:"cell ".concat(r," ").concat(B.has(u)?"problem":""," ").concat(G===u?"hint":""),"aria-label":k.cellLabel(t+1,l+1,ed(e),k.states[r]||r),onClick:()=>{!q&&!eu.blocked&&(clearTimeout(ea.current),ea.current=setTimeout(()=>(function(e,t){if(q||eu.blocked)return;let l="empty"===I[e][t]?"x":"empty",n=h(I);n[e][t]=l,eT(n,"x"===l?"x":"erase")&&ez(n)})(t,l),190))},onDoubleClick:e=>eE(e,t,l),onContextMenu:e=>eE(e,t,l),children:[(0,n.jsx)("img",{className:"tile",src:f(i),alt:"",draggable:"false"}),"x"===r&&(0,n.jsx)("img",{className:"mark",src:f(null==(s=w.marks)?void 0:s.x),alt:"",draggable:"false"})]},u)}))})}
1),(0,n.jsxs)("div",{className:"controls","aria-label":"Game controls",children:[(0,n.jsxs)("button",{className:"game-btn undo-action",type:"button",onClick:function(){if(clearTimeout(ea.current),!q&&!eu.blocked){if(!D.length){eS("error",[15,30,15]),ey(k.messages.noUndo);return}eS("undo",8),L(D[D.length-1]),J(e=>e.slice(0,-1)),H(new Set),_(null),X(k.messages.undone),ey(k.messages.undone)}},disabled:q||0===D.length,"aria-label":k.undo,children:[(0,n.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M9 7H5v4"}),(0,n.jsx)("path",{d:"M5.4 10.6C7 7.9 10 6.2 13.3 6.6c4.1.5 7 4.2 6.5 8.3-.4 3.3-3 5.9-6.2 6.4"})]}),(0,n.jsx)("span",{children:k.undo})]}),(0,n.jsx)("button",{className:"game-btn primary",type:"button",onClick:function(){if(q||eu.blocked)return;let e=p(I,O,w,k,ed,!0);if(H(e.errorCells),_(null),X(k.messages.checkHint),e.isSolved)return void eO();if(e.messages.length){eS("error",[15,30,15]),ey(e.messages[0]);return}if(ef<em){eS("tap",8),ey(k.messages.missingCats(em-ef));return}eS("error",[15,30,15]),ey(k.messages.notSolved)},children:k.check}),(0,n.jsx)("button",{className:"game-btn",type:"button",onClick:function(){eS("tap",8),el({open:!0,title:k.messages.resetTitle,text:k.messages.resetText,actionText:k.messages.confirmReset,action:"restart"})},children:k.reset})]}),(0,n.jsxs)("p",{className:"hint-line sr-only",id:"hintLine",children:[(0,n.jsx)("span",{children:k.status}),F]}),(0,n.jsxs)("section",{className:"level-panel",id:"level-info","aria-label":k.navLevels,children:[(0,n.jsxs)("div",{className:"level-switcher-head","aria-live":"polite",children:[(0,n.jsx)("span",{children:k.navLevels}),(0,n.jsx)("strong",{children:k.levelCount(O.number||A+1,M.length)})]}),(0,n.jsxs)("div",{className:"level-switcher",children:[(0,n.jsx)("button",{className:"level-step",type:"button",onClick:function(){ek(M[A-1]||M[M.length-1])},"aria-label":k.previous,children:k.previous}),(0,n.jsx)("select",{className:"level-select","aria-label":k.levelSelect,value:O.id,onChange:e=>{let t=M.find(t=>t.id===e.target.value);t&&ek(t)},children:M.map(e=>(0,n.jsx)("option",{value:e.id,children:k.levelOption(e,(0,r.sM)(e,N))},e.id))}),(0,n.jsx)("button",{className:"level-step",type:"button",onClick:eM,"aria-label":k.next,children:k.next})]})]})]}),(0,n.jsx)("div",{className:Q?"toast show":"toast",role:"status","aria-live":"polite",children:Q}),(0,n.jsx)("div",{className:et.open?"modal-backdrop show":"modal-backdrop",role:"dialog","aria-modal":"true","aria-labelledby":"modalTitle",onClick:e=>{e.target===e.currentTarget&&el(e=>({...e,open:!1}))},children:(0,n.jsxs)("div",{className:"modal",children:[(0,n.jsx)("h2",{id:"modalTitle",children:et.title}),(0,n.jsx)("p",{children:et.text}),(0,n.jsxs)("div",{className:"modal-actions",children:[(0,n.jsx)("button",{className:"game-btn",type:"button",onClick:()=>{eS("tap",8),el(e=>({...e,open:!1}))},children:k.messages.keepPlaying}),(0,n.jsx)("button",{className:"game-btn primary",type:"button",onClick:function(){if(!eu.blocked){if(eS("tap",8),"next"===et.action)return void eM();el(e=>({...e,open:!1})),eu.requestAd(()=>{eN({announce:!0,clearSaved:!0}),eu.restore()})}},children:et.actionText})]})]})})]})}}}]);
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.