@mblinkov/whats-missing 20.0.48 → 20.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/whats-missing.cjs.js +2 -2
- package/dist/whats-missing.es.js +195 -179
- package/package.json +1 -1
- package/src/Game.tsx +75 -34
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),d=require("react"),Kn=window.origin+"/cloud/speakid/games/whatsmissing/",
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),d=require("react"),Kn=window.origin+"/cloud/speakid/games/whatsmissing/",dn=(r,f)=>r.map(([g,s])=>({src:`${Kn}${f}/${s.replace(/\s/g,"%20")}.png`,name:s})),Zn=[["apple","apple"],["banana","banana"],["bread","bread"],["burger","burger"],["cake","cake"],["carrot","carrot"],["cheese","cheese"],["chicken","chicken"],["chocolate","chocolate"],["corn","corn"],["donut","donut"],["fish","fish"],["fries","fries"],["grapes","grapes"],["ice_cream","ice cream"],["milk","milk"],["orange","orange"],["pear","pear"],["pizza","pizza"],["rice","rice"],["sandwich","sandwich"],["soup","soup"],["strawberry","strawberry"],["tomato","tomato"],["watermelon","watermelon"]],Jn=[["bear","bear"],["cat","cat"],["crocodile","crocodile"],["dolphin","dolphin"],["elephant","elephant"],["fox","fox"],["giraffe","giraffe"],["horse","horse"],["kangaroo","kangaroo"],["lion","lion"],["monkey","monkey"],["owl","owl"],["panda","panda"],["penguin","penguin"],["squirrel","squirrel"],["tiger","tiger"],["tortoise","tortoise"],["wolf","wolf"],["zebra","zebra"]],Qn=[["ball","ball"],["balloon","balloon"],["blocks","blocks"],["car","car"],["doll","doll"],["drum","drum"],["guitar","guitar"],["jump_rope","jump rope"],["kite","kite"],["paints","paints"],["plane","plane"],["puzzle","puzzle"],["rocket","rocket"],["scooter","scooter"],["skateboard","skateboard"],["slide","slide"],["teddy_bear","teddy bear"],["yo-yo","yo-yo"],["crayons","crayons"]],C={food:dn(Zn,"food"),animals:dn(Jn,"animals"),toys:dn(Qn,"toys")},Xn=`
|
|
2
2
|
@keyframes spin {
|
|
3
3
|
from { transform: rotate(0deg); }
|
|
4
4
|
to { transform: rotate(360deg); }
|
|
@@ -29,4 +29,4 @@
|
|
|
29
29
|
height: 100% !important;
|
|
30
30
|
overflow: hidden !important;
|
|
31
31
|
}
|
|
32
|
-
`;const u=document.getElementById("whats-missing-reset");u&&u.remove(),document.head.appendChild(r)},ei=(r,u)=>{const f=Array.from({length:r.length+1},()=>Array(u.length+1).fill(0));for(let h=0;h<=r.length;h++)f[h][0]=h;for(let h=0;h<=u.length;h++)f[0][h]=h;for(let h=1;h<=r.length;h++)for(let m=1;m<=u.length;m++)f[h][m]=r[h-1]===u[m-1]?f[h-1][m-1]:Math.min(f[h-1][m-1],f[h][m-1],f[h-1][m])+1;return f[r.length][u.length]};function ti({gameCubeSize:r,screenHeight:u,screenWidth:f}){const h=d.useRef(null);d.useEffect(()=>(ii(),()=>{document.documentElement.style.overflow="",document.body.style.overflow="";const e=document.getElementById("whats-missing-reset");e&&e.remove(),S.current&&S.current.abort()}),[]);const[m,wn]=d.useState(null),[T,dn]=d.useState([]),[C,bn]=d.useState(4),[z,on]=d.useState(!1),[A,rn]=d.useState(1),[I,Sn]=d.useState(null),[b,E]=d.useState("ready"),[hn,sn]=d.useState(3),[Y,q]=d.useState(10),[$,gn]=d.useState(20),[jn,N]=d.useState(0),[D,O]=d.useState(!1),[G,an]=d.useState(""),[v,V]=d.useState(!1),[_,pn]=d.useState(!1),[ln,R]=d.useState(null),[In,K]=d.useState([]),[vn,xn]=d.useState([]),[n,Pn]=d.useState(!1),[kn,F]=d.useState(1),[cn,U]=d.useState(null),[y,Tn]=d.useState(!1),[g,zn]=d.useState(!1),[a,Rn]=d.useState(!1),[p,Mn]=d.useState(!1),[l,Ln]=d.useState(!1),[x,Bn]=d.useState(!1),[c,Cn]=d.useState(!1),[H,An]=d.useState(!1),[W,En]=d.useState(!1),[Z,Dn]=d.useState(!1),J=d.useRef(new Set),S=d.useRef(null);d.useEffect(()=>{const e=()=>{const t=f??window.innerWidth,w=u??window.innerHeight,s=t<768||t===926&&w===428||t===932&&w===430,P=w<700,k=t/w>1.8,M=t===768&&w===1024,nn=t===1024&&w===768,L=t===820&&w===1180,j=t===1180&&w===820,mn=t===540&&w===720,un=t===720&&w===540,fn=t===1024&&w===1366,yn=t===1366&&w===1024,Nn=t>=1200&&w>=600&&!s;Tn(Nn),zn(M),Rn(nn),Mn(L),Ln(j),Bn(mn),Cn(un),An(fn),En(yn);const On=s&&t>w||s||w<700||k||t===1366&&w===766||t===1366&&w===768||t===1280&&w===720||t===1440&&w===900||M||nn||L||j||mn||un||fn||yn||y;if(Dn(On),Pn(s),s)U(r&&r>=320?r:null),F(1);else if(P)U(r&&r>=400?r:null),F(1);else if(k){const en=r?Math.max(400,Math.min(1200,r)):Math.min(1e3,Math.min(t,w)*.9);U(en),F(.85)}else{const en=r?Math.max(400,Math.min(1200,r)):Math.min(1e3,Math.min(t,w)*.9);U(en),F(1)}};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[f,u,r]);const Q=e=>[...e].sort(()=>Math.random()-.5).slice(0,6),Gn=e=>new Promise(t=>{const w=new Image;w.onload=()=>t(),w.onerror=()=>t(),w.src=e}),X=async(e,t)=>{const w=e.map(s=>Gn(s));await Promise.allSettled(w)},Fn=e=>{S.current&&S.current.abort(),S.current=new AbortController;const w=B[e].map(s=>s.src);X(w,S.current.signal).then(()=>{w.forEach(s=>J.current.add(s))}).catch(()=>{})},Hn=()=>{if(!m)return;const e=Q(B[m]);dn(e),on(!0),O(!1),rn(1),N(0),K([]),xn([]);const t=e.map(w=>w.src);X(t,S.current?.signal).then(()=>{t.forEach(w=>J.current.add(w))}).catch(()=>{}),Wn(e,[],!0)},Wn=(e=T,t=vn,w=!1)=>{const s=Q(e.length?e:B[m]);let P=Math.floor(Math.random()*s.length),k=s[P].name,M=0;for(;t.includes(k)&&M<20;)P=Math.floor(Math.random()*s.length),k=s[P].name,M++;if(dn(s),Sn(P),xn([...t,k]),V(!1),an(""),gn(20),R(null),m&&!w){const L=Q(B[m].filter(j=>!t.includes(j.name))).map(j=>j.src);X(L,S.current?.signal).then(()=>{L.forEach(j=>J.current.add(j))}).catch(()=>{})}w?(E("ready"),sn(5),q(10)):(E("memorize"),q(10))};d.useEffect(()=>{if(!(!z||D||v)){if(b==="ready")if(hn<=0)E("memorize");else{const e=setTimeout(()=>sn(t=>t-1),1e3);return()=>clearTimeout(e)}if(b==="memorize")if(Y<=0)E("guess");else{const e=setTimeout(()=>q(t=>t-1),1e3);return()=>clearTimeout(e)}if(b==="guess"){if($<=0){V(!0),R("wrong");const t=T[I].name;K(w=>[...w,{round:A,answer:G,correct:t,result:"wrong"}]);return}const e=setTimeout(()=>gn(t=>t-1),1e3);return()=>clearTimeout(e)}}},[b,hn,Y,$,z,D,v,T,I,A,G]);const Un=()=>{if(I===null||_)return;const e=T[I].name,t=G.toLowerCase().trim();let w="wrong";t===e?(N(s=>s+1),R("correct"),w="correct"):ei(t,e)===1?(N(s=>s+.5),R("almost"),w="almost"):(R("wrong"),w="wrong"),K(s=>[...s,{round:A,answer:t,correct:e,result:w}]),pn(!0),setTimeout(()=>{pn(!1),V(!0)},600)},Yn=()=>A<C?(rn(e=>e+1),Wn()):O(!0),qn=()=>{on(!1),O(!1),wn(null)},$n=d.useMemo(()=>n&&window.innerWidth>window.innerHeight||window.innerHeight<700?null:i.jsx("div",{style:{...o.gmLogoFixed,position:"absolute",top:16,left:16,zIndex:30},children:i.jsxs("picture",{children:[i.jsx("source",{srcSet:window.origin+"/cloud/speakid/games/whatsmissing/logo.svg",type:"image/svg+xml"}),i.jsx("img",{src:window.origin+"/cloud/speakid/games/whatsmissing/logo.png",alt:"SPEAKID Logo",style:o.gmLogoImg,loading:"lazy"})]})}),[n]);return i.jsx("div",{ref:h,style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",background:"linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",transition:"background 0.3s ease",overflow:"hidden",position:"absolute",top:0,left:0,right:0,bottom:0},children:i.jsx("div",{style:{width:n?"100%":cn||r||1e3,height:n?"100%":cn||r||1e3,display:"flex",justifyContent:"center",alignItems:"center",overflow:"hidden",borderRadius:n?0:"20px",background:"linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",boxShadow:n?"none":"0 0 40px rgba(0,0,0,0.1)",margin:n?"0 auto":"unset",position:"relative",transform:`scale(${kn})`},children:i.jsx("div",{style:{transform:"none",width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:i.jsxs("div",{id:"whats-missing-root",children:[!n&&$n,!m&&!z&&i.jsxs("div",{style:o.gmCenterScreen,children:[i.jsx("h1",{style:o.gmHeadline1,children:"WHAT'S MISSING?"}),i.jsx("p",{style:o.gmBodyM,children:"Select a theme:"}),i.jsx("div",{style:{display:"flex",gap:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"8px":"16px"},children:["animals","food","toys"].map(e=>i.jsx("button",{style:{...o.gmButton,padding:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"8px 12px":"12px 24px",fontSize:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"12px":"16px",minWidth:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"70px":"auto"},onClick:()=>{wn(e),Fn(e)},children:e==="animals"?"🐶 Animals":e==="food"?"🍎 Food":"🧸 Toys"},e))}),i.jsxs("div",{style:{marginTop:24},children:[i.jsx("p",{style:o.gmBodyS,children:"Choose number of rounds:"}),i.jsx("div",{style:{display:"flex",gap:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"6px":"12px",marginTop:8},children:[3,4,5].map(e=>i.jsx("button",{style:{...o.gmButton,...C===e?o.gmButtonActive:{},padding:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"6px 10px":"12px 24px",fontSize:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"12px":"16px",minWidth:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"40px":"auto"},onClick:()=>bn(e),children:e},e))})]})]}),m&&!z&&i.jsxs("div",{style:o.gmCenterScreen,children:[i.jsxs("h1",{style:o.gmHeadline1,children:["Theme selected: ",m]}),i.jsxs("p",{style:o.gmBodyM,children:["Rounds: ",C]}),i.jsx("button",{style:{...o.gmButton,padding:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"8px 16px":"12px 24px",fontSize:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"14px":"16px",minWidth:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"120px":"auto"},onClick:Hn,children:"▶ Start game"})]}),D&&i.jsxs("div",{style:o.gmCenterScreen,children:[i.jsx("h1",{style:{...o.gmHeadline1,marginTop:n&&window.innerWidth>window.innerHeight||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430||g||a||p||l||x||c||H||W?"0px":o.gmHeadline1.marginTop,marginBottom:n&&window.innerWidth>window.innerHeight||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430||g||a||p||l||x||c||H||W?"2px":o.gmHeadline1.marginBottom},children:"Results"}),i.jsxs("h2",{style:{...o.gmHeadline3,marginTop:n&&window.innerWidth>window.innerHeight||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430||g||a||p||l||x||c||H||W?"0px":o.gmHeadline3.marginTop,marginBottom:n&&window.innerWidth>window.innerHeight||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430||g||a||p||l||x||c||H||W?"2px":o.gmHeadline3.marginBottom},children:["Your score: ",jn," / ",C]}),i.jsx("p",{style:{...o.gmBodyM,color:"#10b981",marginTop:n&&window.innerWidth>window.innerHeight||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430||g||a||p||l||x||c||H||W?"0px":"12px",marginBottom:n&&window.innerWidth>window.innerHeight||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430||g||a||p||l||x||c||H||W?"2px":o.gmBodyM.marginBottom},children:"Yahoo! You did it! 🍬✨"}),i.jsxs("table",{style:{...o.gmTable,marginTop:n&&window.innerWidth>window.innerHeight||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430||g||a||p||l||x||c||H||W?"0px":"20px",marginBottom:n&&window.innerWidth>window.innerHeight||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430||g||a||p||l||x||c||H||W?"4px":"32px"},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Round"}),i.jsx("th",{children:"Your Answer"}),i.jsx("th",{children:"Correct"}),i.jsx("th",{children:"Result"})]})}),i.jsx("tbody",{children:In.map((e,t)=>i.jsxs("tr",{children:[i.jsx("td",{style:o.gmTableCell,children:e.round}),i.jsx("td",{style:o.gmTableCell,children:e.answer||"—"}),i.jsx("td",{style:o.gmTableCell,children:e.correct}),i.jsx("td",{style:o.gmTableCell,children:e.result==="correct"?"✔ Correct":e.result==="almost"?"◐ Almost (0.5)":"✘ Wrong"})]},t))})]}),i.jsxs("div",{style:{display:"flex",gap:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"6px":"12px",marginTop:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"2px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||y?"12px":"24px"},children:[i.jsx("button",{style:{...o.gmButton,padding:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"6px 10px":"12px 24px",fontSize:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"12px":"16px",minWidth:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"80px":"auto"},onClick:Hn,children:"🔁 Play again"}),i.jsx("button",{style:{...o.gmButton,padding:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"6px 10px":"12px 24px",fontSize:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"12px":"16px",minWidth:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"80px":"auto"},onClick:qn,children:"⬅️ Choose theme"})]})]}),z&&!D&&i.jsxs("div",{style:o.gmGameLayout,children:[i.jsxs("div",{style:{minHeight:n&&window.innerWidth<=375&&window.innerHeight<=667||n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"45px":n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"60px":"160px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:n&&window.innerWidth<=375&&window.innerHeight<=667||n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"8px":n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"15px":"40px"},children:[b==="ready"&&i.jsxs(i.Fragment,{children:[i.jsx("h1",{style:{...o.gmHeadline1,color:"#ec4c44"},children:"GET READY"}),i.jsx("div",{style:o.gmHourglass,children:"⏳"})]}),b==="memorize"&&i.jsxs("p",{style:{...o.gmBodyM,color:"#10b981"},children:["MEMORIZE (",Y,")"]}),b==="guess"&&!v&&i.jsxs("p",{style:o.gmBodyM,children:["⏳ Time left: ",$,"s"]})]}),b!=="ready"&&i.jsx("div",{style:{...o.gmGrid,gridTemplateColumns:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667?"repeat(3, 1fr)":n?"repeat(2, 1fr)":window.innerHeight<700?"repeat(3, 1fr)":"repeat(3, 210px)",gridAutoRows:n&&window.innerWidth>window.innerHeight?"120px":n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"100px":n?"150px":window.innerHeight<700?"140px":typeof window<"u"&&window.devicePixelRatio>=1.25&&window.devicePixelRatio<=1.5?"240px":"210px",gap:n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"12px":n||window.innerHeight<700?"8px":typeof window<"u"&&window.devicePixelRatio>=1.25&&window.devicePixelRatio<=1.5?"24px":"20px",justifyItems:"center",maxWidth:n&&window.innerWidth>window.innerHeight?"90%":n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"95%":"100%",padding:n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"8px":typeof window<"u"&&window.devicePixelRatio>=1.25&&window.devicePixelRatio<=1.5?"20px":"16px"},children:T.map((e,t)=>{const w=I===t&&b==="guess"&&!v;return i.jsx("div",{style:{width:"100%",height:"100%",borderRadius:n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"6px":"12px",overflow:"hidden",boxShadow:n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"0 1px 4px rgba(0,0,0,0.1)":"0 4px 12px rgba(0,0,0,0.15)",transition:"all 0.3s ease",cursor:"pointer",...ln==="correct"&&I===t?{boxShadow:n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"0 0 15px #10b981":"0 0 20px #10b981",transform:"scale(1.03)"}:{},...ln==="wrong"&&I===t?{boxShadow:n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"0 0 15px #ef4444":"0 0 20px #ef4444",transform:"scale(1.03)"}:{}},children:!w&&i.jsx("img",{src:e.src,alt:e.name,style:{width:"100%",height:"100%",objectFit:"cover"}})},t)})}),i.jsxs("div",{style:{marginTop:n&&window.innerWidth<=375&&window.innerHeight<=667||n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"1px":n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"4px":"16px",height:n&&window.innerWidth<=375&&window.innerHeight<=667||n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"40px":n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"50px":"80px"},children:[b==="guess"&&!v&&i.jsx("div",{style:{display:"flex",flexDirection:Z?"row":"column",gap:n&&window.innerWidth<=375&&window.innerHeight<=667||n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"3px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||y||g||a||p||l||x||c||H||W?"8px":n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"6px":"12px",alignItems:"center",justifyContent:"center",width:"100%",maxWidth:n&&window.innerWidth<=375&&window.innerHeight<=667||n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"270px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||y||g||a||p||l||x||c||H||W||n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"400px":"300px"},children:i.jsxs(i.Fragment,{children:[i.jsx("input",{type:"text",placeholder:"Type the missing word",value:G,onChange:e=>an(e.target.value),style:{...o.gmInput,width:n&&window.innerWidth<=375&&window.innerHeight<=667||n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"170px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||y||g||a||p||l||x||c||H||W||n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"250px":"auto",padding:n&&window.innerWidth<=375&&window.innerHeight<=667||n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"5px 6px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||y||g||a||p||l||x||c||H||W||n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"10px 12px":"12px 16px",fontSize:n&&window.innerWidth<=375&&window.innerHeight<=667||n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428?"10px":window.innerWidth===896&&window.innerHeight===414?"11px":window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"10px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||y||g||a||p||l||x||c||H||W||n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"14px":"16px",flex:Z?"1":"none"}}),i.jsx("button",{style:{...o.gmButton,marginLeft:Z?"8px":"0",padding:n&&window.innerWidth<=375&&window.innerHeight<=667?"5px 8px":n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"6px 10px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||y||g||a||p||l||x||c||H||W||n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"10px 16px":"12px 24px",fontSize:n&&window.innerWidth<=375&&window.innerHeight<=667?"10px":n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"11px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||y||g||a||p||l||x||c||H||W||n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"14px":"16px",minWidth:n&&window.innerWidth<=375&&window.innerHeight<=667?"45px":n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"55px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||y||g||a||p||l||x||c||H||W||n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"80px":"100px",flexShrink:0},onClick:Un,disabled:_,children:_?"...":"Check"})]})}),v&&i.jsx("button",{style:{...o.gmButton,padding:n&&window.innerWidth<=375&&window.innerHeight<=667?"5px 8px":n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"6px 10px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||y||g||a||p||l||x||c||H||W||n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"10px 16px":"12px 24px",fontSize:n&&window.innerWidth<=375&&window.innerHeight<=667?"10px":n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"11px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||y||g||a||p||l||x||c||H||W||n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"14px":"16px"},onClick:Yn,children:"Next round"})]})]})]})})})})}exports.Game=ti;exports.themes=B;
|
|
32
|
+
`;const f=document.getElementById("whats-missing-reset");f&&f.remove(),document.head.appendChild(r)},ei=(r,f)=>{const g=Array.from({length:r.length+1},()=>Array(f.length+1).fill(0));for(let s=0;s<=r.length;s++)g[s][0]=s;for(let s=0;s<=f.length;s++)g[0][s]=s;for(let s=1;s<=r.length;s++)for(let a=1;a<=f.length;a++)g[s][a]=r[s-1]===f[a-1]?g[s-1][a-1]:Math.min(g[s-1][a-1],g[s][a-1],g[s-1][a])+1;return g[r.length][f.length]},ti=r=>new Promise(f=>{const g=new Image;g.onload=()=>f(g),g.onerror=()=>f(g),g.src=r}),on=async(r,f)=>{const g=new Map,s=r.map(async a=>{const A=await ti(a);g.set(a,A)});return await Promise.allSettled(s),g};function wi({gameCubeSize:r,screenHeight:f,screenWidth:g}){const s=d.useRef(null);d.useEffect(()=>(ii(),()=>{document.documentElement.style.overflow="",document.body.style.overflow="";const e=document.getElementById("whats-missing-reset");e&&e.remove(),j.current&&j.current.abort()}),[]);const[a,A]=d.useState(null),[z,rn]=d.useState([]),[E,Sn]=d.useState(4),[R,hn]=d.useState(!1),[D,sn]=d.useState(1),[v,jn]=d.useState(null),[S,G]=d.useState("ready"),[gn,an]=d.useState(10),[N,O]=d.useState(10),[V,pn]=d.useState(20),[In,_]=d.useState(0),[F,K]=d.useState(!1),[U,ln]=d.useState(""),[k,Z]=d.useState(!1),[J,xn]=d.useState(!1),[cn,M]=d.useState(null),[vn,Q]=d.useState([]),[Pn,Hn]=d.useState([]),[n,kn]=d.useState(!1),[Tn,Y]=d.useState(1),[Wn,$]=d.useState(null),[b,zn]=d.useState(!1),[p,Rn]=d.useState(!1),[l,Mn]=d.useState(!1),[x,Ln]=d.useState(!1),[c,Bn]=d.useState(!1),[H,Cn]=d.useState(!1),[W,An]=d.useState(!1),[m,En]=d.useState(!1),[u,Dn]=d.useState(!1),[X,Gn]=d.useState(!1),[di,oi]=d.useState(!1),nn=d.useRef(new Set),q=d.useRef(new Map),j=d.useRef(null);d.useEffect(()=>{const e=()=>{const t=g??window.innerWidth,w=f??window.innerHeight,h=t<768||t===926&&w===428||t===932&&w===430,y=w<700,T=t/w>1.8,L=t===768&&w===1024,tn=t===1024&&w===768,B=t===820&&w===1180,I=t===1180&&w===820,P=t===540&&w===720,fn=t===720&&w===540,yn=t===1024&&w===1366,bn=t===1366&&w===1024,Nn=t>=1200&&w>=600&&!h;zn(Nn),Rn(L),Mn(tn),Ln(B),Bn(I),Cn(P),An(fn),En(yn),Dn(bn);const On=h&&t>w||h||w<700||T||t===1366&&w===766||t===1366&&w===768||t===1280&&w===720||t===1440&&w===900||L||tn||B||I||P||fn||yn||bn||b;if(Gn(On),kn(h),h)$(r&&r>=320?r:null),Y(1);else if(y)$(r&&r>=400?r:null),Y(1);else if(T){const wn=r?Math.max(400,Math.min(1200,r)):Math.min(1e3,Math.min(t,w)*.9);$(wn),Y(.85)}else{const wn=r?Math.max(400,Math.min(1200,r)):Math.min(1e3,Math.min(t,w)*.9);$(wn),Y(1)}};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[g,f,r]);const en=e=>[...e].sort(()=>Math.random()-.5).slice(0,6),Fn=e=>{j.current&&j.current.abort(),j.current=new AbortController;const w=C[e].map(h=>h.src);on(w,j.current.signal).then(h=>{w.forEach(y=>{nn.current.add(y),h.has(y)&&q.current.set(y,h.get(y))})}).catch(()=>{})},mn=()=>{if(!a)return;const e=en(C[a]);rn(e),hn(!0),K(!1),sn(1),_(0),Q([]),Hn([]);const t=e.map(w=>w.src);on(t,j.current?.signal).then(w=>{t.forEach(h=>{nn.current.add(h),w.has(h)&&q.current.set(h,w.get(h))})}).catch(()=>{}),un(e,[],!0)},un=(e=z,t=Pn,w=!1)=>{const h=en(e.length?e:C[a]);let y=Math.floor(Math.random()*h.length),T=h[y].name,L=0;for(;t.includes(T)&&L<20;)y=Math.floor(Math.random()*h.length),T=h[y].name,L++;if(rn(h),jn(y),Hn([...t,T]),Z(!1),ln(""),pn(20),M(null),a&&!w){const B=en(C[a].filter(I=>!t.includes(I.name))).map(I=>I.src);on(B,j.current?.signal).then(I=>{B.forEach(P=>{nn.current.add(P),I.has(P)&&q.current.set(P,I.get(P))})}).catch(()=>{})}w?(G("ready"),an(10),O(10)):(G("memorize"),O(10))};d.useEffect(()=>{if(!(!R||F||k)){if(S==="ready")if(gn<=0)G("memorize");else{const e=setTimeout(()=>an(t=>t-1),1e3);return()=>clearTimeout(e)}if(S==="memorize")if(N<=0)G("guess");else{const e=setTimeout(()=>O(t=>t-1),1e3);return()=>clearTimeout(e)}if(S==="guess"){if(V<=0){Z(!0),M("wrong");const t=z[v].name;Q(w=>[...w,{round:D,answer:U,correct:t,result:"wrong"}]);return}const e=setTimeout(()=>pn(t=>t-1),1e3);return()=>clearTimeout(e)}}},[S,gn,N,V,R,F,k,z,v,D,U]);const Un=()=>{if(v===null||J)return;const e=z[v].name,t=U.toLowerCase().trim();let w="wrong";t===e?(_(h=>h+1),M("correct"),w="correct"):ei(t,e)===1?(_(h=>h+.5),M("almost"),w="almost"):(M("wrong"),w="wrong"),Q(h=>[...h,{round:D,answer:t,correct:e,result:w}]),xn(!0),setTimeout(()=>{xn(!1),Z(!0)},600)},Yn=()=>D<E?(sn(e=>e+1),un()):K(!0),$n=()=>{j.current&&j.current.abort(),hn(!1),K(!1),A(null)},qn=d.useMemo(()=>n&&window.innerWidth>window.innerHeight||window.innerHeight<700?null:i.jsx("div",{style:{...o.gmLogoFixed,position:"absolute",top:16,left:16,zIndex:30},children:i.jsxs("picture",{children:[i.jsx("source",{srcSet:window.origin+"/cloud/speakid/games/whatsmissing/logo.svg",type:"image/svg+xml"}),i.jsx("img",{src:window.origin+"/cloud/speakid/games/whatsmissing/logo.png",alt:"SPEAKID Logo",style:o.gmLogoImg,loading:"lazy"})]})}),[n]);return i.jsx("div",{ref:s,style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",background:"linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",transition:"background 0.3s ease",overflow:"hidden",position:"absolute",top:0,left:0,right:0,bottom:0},children:i.jsx("div",{style:{width:n?"100%":Wn||r||1e3,height:n?"100%":Wn||r||1e3,display:"flex",justifyContent:"center",alignItems:"center",overflow:"hidden",borderRadius:n?0:"20px",background:"linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",boxShadow:n?"none":"0 0 40px rgba(0,0,0,0.1)",margin:n?"0 auto":"unset",position:"relative",transform:`scale(${Tn})`},children:i.jsx("div",{style:{transform:"none",width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:i.jsxs("div",{id:"whats-missing-root",children:[!n&&qn,!a&&!R&&i.jsxs("div",{style:o.gmCenterScreen,children:[i.jsx("h1",{style:o.gmHeadline1,children:"WHAT'S MISSING?"}),i.jsx("p",{style:o.gmBodyM,children:"Select a theme:"}),i.jsx("div",{style:{display:"flex",gap:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"8px":"16px"},children:["animals","food","toys"].map(e=>i.jsx("button",{style:{...o.gmButton,padding:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"8px 12px":"12px 24px",fontSize:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"12px":"16px",minWidth:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"70px":"auto"},onClick:()=>{A(e),Fn(e)},children:e==="animals"?"🐶 Animals":e==="food"?"🍎 Food":"🧸 Toys"},e))}),i.jsxs("div",{style:{marginTop:24},children:[i.jsx("p",{style:o.gmBodyS,children:"Choose number of rounds:"}),i.jsx("div",{style:{display:"flex",gap:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"6px":"12px",marginTop:8},children:[3,4,5].map(e=>i.jsx("button",{style:{...o.gmButton,...E===e?o.gmButtonActive:{},padding:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"6px 10px":"12px 24px",fontSize:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"12px":"16px",minWidth:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"40px":"auto"},onClick:()=>Sn(e),children:e},e))})]})]}),a&&!R&&i.jsxs("div",{style:o.gmCenterScreen,children:[i.jsxs("h1",{style:o.gmHeadline1,children:["Theme selected: ",a]}),i.jsxs("p",{style:o.gmBodyM,children:["Rounds: ",E]}),i.jsx("button",{style:{...o.gmButton,padding:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"8px 16px":"12px 24px",fontSize:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"14px":"16px",minWidth:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"120px":"auto"},onClick:mn,children:"▶ Start game"})]}),F&&i.jsxs("div",{style:o.gmCenterScreen,children:[i.jsx("h1",{style:{...o.gmHeadline1,marginTop:n&&window.innerWidth>window.innerHeight||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430||p||l||x||c||H||W||m||u?"0px":o.gmHeadline1.marginTop,marginBottom:n&&window.innerWidth>window.innerHeight||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430||p||l||x||c||H||W||m||u?"2px":o.gmHeadline1.marginBottom},children:"Results"}),i.jsxs("h2",{style:{...o.gmHeadline3,marginTop:n&&window.innerWidth>window.innerHeight||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430||p||l||x||c||H||W||m||u?"0px":o.gmHeadline3.marginTop,marginBottom:n&&window.innerWidth>window.innerHeight||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430||p||l||x||c||H||W||m||u?"2px":o.gmHeadline3.marginBottom},children:["Your score: ",In," / ",E]}),i.jsx("p",{style:{...o.gmBodyM,color:"#10b981",marginTop:n&&window.innerWidth>window.innerHeight||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430||p||l||x||c||H||W||m||u?"0px":"12px",marginBottom:n&&window.innerWidth>window.innerHeight||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430||p||l||x||c||H||W||m||u?"2px":o.gmBodyM.marginBottom},children:"Yahoo! You did it! 🍬✨"}),i.jsxs("table",{style:{...o.gmTable,marginTop:n&&window.innerWidth>window.innerHeight||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430||p||l||x||c||H||W||m||u?"0px":"20px",marginBottom:n&&window.innerWidth>window.innerHeight||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430||p||l||x||c||H||W||m||u?"4px":"32px"},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Round"}),i.jsx("th",{children:"Your Answer"}),i.jsx("th",{children:"Correct"}),i.jsx("th",{children:"Result"})]})}),i.jsx("tbody",{children:vn.map((e,t)=>i.jsxs("tr",{children:[i.jsx("td",{style:o.gmTableCell,children:e.round}),i.jsx("td",{style:o.gmTableCell,children:e.answer||"—"}),i.jsx("td",{style:o.gmTableCell,children:e.correct}),i.jsx("td",{style:o.gmTableCell,children:e.result==="correct"?"✔ Correct":e.result==="almost"?"◐ Almost (0.5)":"✘ Wrong"})]},t))})]}),i.jsxs("div",{style:{display:"flex",gap:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"6px":"12px",marginTop:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"2px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||b?"12px":"24px"},children:[i.jsx("button",{style:{...o.gmButton,padding:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"6px 10px":"12px 24px",fontSize:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"12px":"16px",minWidth:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"80px":"auto"},onClick:mn,children:"🔁 Play again"}),i.jsx("button",{style:{...o.gmButton,padding:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"6px 10px":"12px 24px",fontSize:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"12px":"16px",minWidth:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428||window.innerWidth===932&&window.innerHeight===430?"80px":"auto"},onClick:$n,children:"⬅️ Choose theme"})]})]}),R&&!F&&i.jsxs("div",{style:o.gmGameLayout,children:[i.jsxs("div",{style:{minHeight:n&&window.innerWidth<=375&&window.innerHeight<=667||n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"45px":n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"60px":"160px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:n&&window.innerWidth<=375&&window.innerHeight<=667||n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"8px":n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"15px":"40px"},children:[S==="ready"&&i.jsxs(i.Fragment,{children:[i.jsx("h1",{style:{...o.gmHeadline1,color:"#ec4c44"},children:"GET READY"}),i.jsx("div",{style:o.gmHourglass,children:"⏳"})]}),S==="memorize"&&i.jsxs("p",{style:{...o.gmBodyM,color:"#10b981"},children:["MEMORIZE (",N,")"]}),S==="guess"&&!k&&i.jsxs("p",{style:o.gmBodyM,children:["⏳ Time left: ",V,"s"]})]}),S!=="ready"&&i.jsx("div",{style:{...o.gmGrid,gridTemplateColumns:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667?"repeat(3, 1fr)":n?"repeat(2, 1fr)":window.innerHeight<700?"repeat(3, 1fr)":"repeat(3, 210px)",gridAutoRows:n&&window.innerWidth>window.innerHeight?"120px":n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"100px":n?"150px":window.innerHeight<700?"140px":typeof window<"u"&&window.devicePixelRatio>=1.25&&window.devicePixelRatio<=1.5?"240px":"210px",gap:n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"12px":n||window.innerHeight<700?"8px":typeof window<"u"&&window.devicePixelRatio>=1.25&&window.devicePixelRatio<=1.5?"24px":"20px",justifyItems:"center",maxWidth:n&&window.innerWidth>window.innerHeight?"90%":n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"95%":"100%",padding:n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"8px":typeof window<"u"&&window.devicePixelRatio>=1.25&&window.devicePixelRatio<=1.5?"20px":"16px"},children:z.map((e,t)=>{const w=v===t&&S==="guess"&&!k;return i.jsx("div",{style:{width:"100%",height:"100%",borderRadius:n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"6px":"12px",overflow:"hidden",boxShadow:n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"0 1px 4px rgba(0,0,0,0.1)":"0 4px 12px rgba(0,0,0,0.15)",transition:"all 0.3s ease",cursor:"pointer",...cn==="correct"&&v===t?{boxShadow:n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"0 0 15px #10b981":"0 0 20px #10b981",transform:"scale(1.03)"}:{},...cn==="wrong"&&v===t?{boxShadow:n&&window.innerWidth<=375&&window.innerHeight<=667||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"0 0 15px #ef4444":"0 0 20px #ef4444",transform:"scale(1.03)"}:{}},children:!w&&(()=>{const h=q.current.get(e.src),y=h?.complete&&h.src?h.src:e.src;return i.jsx("img",{src:y,alt:e.name,fetchPriority:"high",loading:"eager",decoding:"async",style:{width:"100%",height:"100%",objectFit:"cover"}},`${e.src}-${h?.complete?"loaded":"pending"}`)})()},t)})}),i.jsxs("div",{style:{marginTop:n&&window.innerWidth<=375&&window.innerHeight<=667||n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"1px":n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"4px":"16px",height:n&&window.innerWidth<=375&&window.innerHeight<=667||n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"40px":n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"50px":"80px"},children:[S==="guess"&&!k&&i.jsx("div",{style:{display:"flex",flexDirection:X?"row":"column",gap:n&&window.innerWidth<=375&&window.innerHeight<=667||n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"3px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||b||p||l||x||c||H||W||m||u?"8px":n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"6px":"12px",alignItems:"center",justifyContent:"center",width:"100%",maxWidth:n&&window.innerWidth<=375&&window.innerHeight<=667||n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"270px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||b||p||l||x||c||H||W||m||u||n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"400px":"300px"},children:i.jsxs(i.Fragment,{children:[i.jsx("input",{type:"text",placeholder:"Type the missing word",value:U,onChange:e=>ln(e.target.value),style:{...o.gmInput,width:n&&window.innerWidth<=375&&window.innerHeight<=667||n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"170px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||b||p||l||x||c||H||W||m||u||n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"250px":"auto",padding:n&&window.innerWidth<=375&&window.innerHeight<=667||n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"5px 6px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||b||p||l||x||c||H||W||m||u||n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"10px 12px":"12px 16px",fontSize:n&&window.innerWidth<=375&&window.innerHeight<=667||n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428?"10px":window.innerWidth===896&&window.innerHeight===414?"11px":window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"10px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||b||p||l||x||c||H||W||m||u||n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"14px":"16px",flex:X?"1":"none"}}),i.jsx("button",{style:{...o.gmButton,marginLeft:X?"8px":"0",padding:n&&window.innerWidth<=375&&window.innerHeight<=667?"5px 8px":n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"6px 10px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||b||p||l||x||c||H||W||m||u||n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"10px 16px":"12px 24px",fontSize:n&&window.innerWidth<=375&&window.innerHeight<=667?"10px":n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"11px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||b||p||l||x||c||H||W||m||u||n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"14px":"16px",minWidth:n&&window.innerWidth<=375&&window.innerHeight<=667?"45px":n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"55px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||b||p||l||x||c||H||W||m||u||n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"80px":"100px",flexShrink:0},onClick:Un,disabled:J,children:J?"...":"Check"})]})}),k&&i.jsx("button",{style:{...o.gmButton,padding:n&&window.innerWidth<=375&&window.innerHeight<=667?"5px 8px":n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"6px 10px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||b||p||l||x||c||H||W||m||u||n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"10px 16px":"12px 24px",fontSize:n&&window.innerWidth<=375&&window.innerHeight<=667?"10px":n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390||window.innerWidth===926&&window.innerHeight===428?"11px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||b||p||l||x||c||H||W||m||u||n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"14px":"16px"},onClick:Yn,children:"Next round"})]})]})]})})})})}exports.Game=wi;exports.themes=C;
|
package/dist/whats-missing.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as d, jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
const ni = window.origin + "/cloud/speakid/games/whatsmissing/",
|
|
4
|
-
src: `${ni}${
|
|
5
|
-
name:
|
|
1
|
+
import { jsx as d, jsxs as p, Fragment as Pn } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as V, useEffect as rn, useState as h, useMemo as Xn } from "react";
|
|
3
|
+
const ni = window.origin + "/cloud/speakid/games/whatsmissing/", hn = (o, y) => o.map(([s, g]) => ({
|
|
4
|
+
src: `${ni}${y}/${g.replace(/\s/g, "%20")}.png`,
|
|
5
|
+
name: g
|
|
6
6
|
})), ii = [
|
|
7
7
|
["apple", "apple"],
|
|
8
8
|
["banana", "banana"],
|
|
@@ -69,10 +69,10 @@ const ni = window.origin + "/cloud/speakid/games/whatsmissing/", on = (r, f) =>
|
|
|
69
69
|
["teddy_bear", "teddy bear"],
|
|
70
70
|
["yo-yo", "yo-yo"],
|
|
71
71
|
["crayons", "crayons"]
|
|
72
|
-
],
|
|
73
|
-
food:
|
|
74
|
-
animals:
|
|
75
|
-
toys:
|
|
72
|
+
], _ = {
|
|
73
|
+
food: hn(ii, "food"),
|
|
74
|
+
animals: hn(ei, "animals"),
|
|
75
|
+
toys: hn(ti, "toys")
|
|
76
76
|
}, wi = `
|
|
77
77
|
@keyframes spin {
|
|
78
78
|
from { transform: rotate(0deg); }
|
|
@@ -80,8 +80,8 @@ const ni = window.origin + "/cloud/speakid/games/whatsmissing/", on = (r, f) =>
|
|
|
80
80
|
}
|
|
81
81
|
`;
|
|
82
82
|
if (typeof document < "u" && !document.getElementById("spin-keyframes")) {
|
|
83
|
-
const
|
|
84
|
-
|
|
83
|
+
const o = document.createElement("style");
|
|
84
|
+
o.id = "spin-keyframes", o.innerHTML = wi, document.head.appendChild(o);
|
|
85
85
|
}
|
|
86
86
|
const di = {
|
|
87
87
|
animation: "spin 1.4s linear infinite"
|
|
@@ -221,8 +221,8 @@ const di = {
|
|
|
221
221
|
...di
|
|
222
222
|
}
|
|
223
223
|
}, oi = () => {
|
|
224
|
-
const
|
|
225
|
-
|
|
224
|
+
const o = document.createElement("style");
|
|
225
|
+
o.id = "whats-missing-reset", o.textContent = `
|
|
226
226
|
#whats-missing-root, #whats-missing-root * {
|
|
227
227
|
box-sizing: border-box;
|
|
228
228
|
font-family: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
|
|
@@ -249,128 +249,137 @@ const di = {
|
|
|
249
249
|
overflow: hidden !important;
|
|
250
250
|
}
|
|
251
251
|
`;
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
}, ri = (
|
|
255
|
-
const
|
|
256
|
-
for (let
|
|
257
|
-
for (let
|
|
258
|
-
for (let
|
|
259
|
-
for (let
|
|
260
|
-
|
|
261
|
-
return
|
|
252
|
+
const y = document.getElementById("whats-missing-reset");
|
|
253
|
+
y && y.remove(), document.head.appendChild(o);
|
|
254
|
+
}, ri = (o, y) => {
|
|
255
|
+
const s = Array.from({ length: o.length + 1 }, () => Array(y.length + 1).fill(0));
|
|
256
|
+
for (let g = 0; g <= o.length; g++) s[g][0] = g;
|
|
257
|
+
for (let g = 0; g <= y.length; g++) s[0][g] = g;
|
|
258
|
+
for (let g = 1; g <= o.length; g++)
|
|
259
|
+
for (let a = 1; a <= y.length; a++)
|
|
260
|
+
s[g][a] = o[g - 1] === y[a - 1] ? s[g - 1][a - 1] : Math.min(s[g - 1][a - 1], s[g][a - 1], s[g - 1][a]) + 1;
|
|
261
|
+
return s[o.length][y.length];
|
|
262
|
+
}, hi = (o) => new Promise((y) => {
|
|
263
|
+
const s = new Image();
|
|
264
|
+
s.onload = () => y(s), s.onerror = () => y(s), s.src = o;
|
|
265
|
+
}), gn = async (o, y) => {
|
|
266
|
+
const s = /* @__PURE__ */ new Map(), g = o.map(async (a) => {
|
|
267
|
+
const E = await hi(a);
|
|
268
|
+
s.set(a, E);
|
|
269
|
+
});
|
|
270
|
+
return await Promise.allSettled(g), s;
|
|
262
271
|
};
|
|
263
|
-
function
|
|
264
|
-
gameCubeSize:
|
|
265
|
-
screenHeight:
|
|
266
|
-
screenWidth:
|
|
272
|
+
function li({
|
|
273
|
+
gameCubeSize: o,
|
|
274
|
+
screenHeight: y,
|
|
275
|
+
screenWidth: s
|
|
267
276
|
}) {
|
|
268
|
-
const
|
|
269
|
-
|
|
277
|
+
const g = V(null);
|
|
278
|
+
rn(() => (oi(), () => {
|
|
270
279
|
document.documentElement.style.overflow = "", document.body.style.overflow = "";
|
|
271
280
|
const i = document.getElementById("whats-missing-reset");
|
|
272
|
-
i && i.remove(),
|
|
281
|
+
i && i.remove(), v.current && v.current.abort();
|
|
273
282
|
}), []);
|
|
274
|
-
const [
|
|
275
|
-
|
|
283
|
+
const [a, E] = h(null), [L, sn] = h([]), [j, kn] = h(4), [R, an] = h(!1), [D, pn] = h(1), [k, zn] = h(null), [S, G] = h("ready"), [ln, xn] = h(10), [q, K] = h(10), [O, cn] = h(20), [Tn, Z] = h(0), [F, J] = h(!1), [U, Hn] = h(""), [T, Q] = h(!1), [X, Wn] = h(!1), [mn, B] = h(null), [Mn, nn] = h([]), [Ln, fn] = h([]), [n, Rn] = h(!1), [Bn, Y] = h(1), [un, $] = h(null), [I, Cn] = h(!1), [l, An] = h(!1), [x, En] = h(!1), [c, jn] = h(!1), [H, Dn] = h(!1), [W, Gn] = h(!1), [m, Fn] = h(!1), [f, Un] = h(!1), [u, Yn] = h(!1), [en, $n] = h(!1), [gi, si] = h(!1), tn = V(/* @__PURE__ */ new Set()), N = V(/* @__PURE__ */ new Map()), v = V(null);
|
|
284
|
+
rn(() => {
|
|
276
285
|
const i = () => {
|
|
277
|
-
const e =
|
|
278
|
-
|
|
279
|
-
const Zn =
|
|
280
|
-
t < 700 ||
|
|
281
|
-
e === 1366 && t === 766 || e === 1366 && t === 768 || e === 1280 && t === 720 || e === 1440 && t === 900 ||
|
|
282
|
-
if (
|
|
283
|
-
|
|
284
|
-
else if (
|
|
285
|
-
|
|
286
|
-
else if (
|
|
287
|
-
const
|
|
288
|
-
|
|
286
|
+
const e = s ?? window.innerWidth, t = y ?? window.innerHeight, r = e < 768 || e === 926 && t === 428 || e === 932 && t === 430, b = t < 700, M = e / t > 1.8, C = e === 768 && t === 1024, dn = e === 1024 && t === 768, A = e === 820 && t === 1180, P = e === 1180 && t === 820, z = e === 540 && t === 720, In = e === 720 && t === 540, Sn = e === 1024 && t === 1366, vn = e === 1366 && t === 1024, On = e >= 1200 && t >= 600 && !r;
|
|
287
|
+
Cn(On), An(C), En(dn), jn(A), Dn(P), Gn(z), Fn(In), Un(Sn), Yn(vn);
|
|
288
|
+
const Zn = r && e > t || r || // ✅ ВСЕ мобильные устройства (включая portrait)
|
|
289
|
+
t < 700 || M || // ✅ Широкие экраны
|
|
290
|
+
e === 1366 && t === 766 || e === 1366 && t === 768 || e === 1280 && t === 720 || e === 1440 && t === 900 || C || dn || A || P || z || In || Sn || vn || I;
|
|
291
|
+
if ($n(Zn), Rn(r), r)
|
|
292
|
+
$(o && o >= 320 ? o : null), Y(1);
|
|
293
|
+
else if (b)
|
|
294
|
+
$(o && o >= 400 ? o : null), Y(1);
|
|
295
|
+
else if (M) {
|
|
296
|
+
const on = o ? Math.max(400, Math.min(1200, o)) : Math.min(1e3, Math.min(e, t) * 0.9);
|
|
297
|
+
$(on), Y(0.85);
|
|
289
298
|
} else {
|
|
290
|
-
const
|
|
291
|
-
|
|
299
|
+
const on = o ? Math.max(400, Math.min(1200, o)) : Math.min(1e3, Math.min(e, t) * 0.9);
|
|
300
|
+
$(on), Y(1);
|
|
292
301
|
}
|
|
293
302
|
};
|
|
294
303
|
return i(), window.addEventListener("resize", i), () => window.removeEventListener("resize", i);
|
|
295
|
-
}, [
|
|
296
|
-
const
|
|
297
|
-
|
|
298
|
-
t
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
S.current && S.current.abort(), S.current = new AbortController();
|
|
304
|
-
const t = Y[i].map((g) => g.src);
|
|
305
|
-
nn(t, S.current.signal).then(() => {
|
|
306
|
-
t.forEach((g) => Q.current.add(g));
|
|
304
|
+
}, [s, y, o]);
|
|
305
|
+
const wn = (i) => [...i].sort(() => Math.random() - 0.5).slice(0, 6), Nn = (i) => {
|
|
306
|
+
v.current && v.current.abort(), v.current = new AbortController();
|
|
307
|
+
const t = _[i].map((r) => r.src);
|
|
308
|
+
gn(t, v.current.signal).then((r) => {
|
|
309
|
+
t.forEach((b) => {
|
|
310
|
+
tn.current.add(b), r.has(b) && N.current.set(b, r.get(b));
|
|
311
|
+
});
|
|
307
312
|
}).catch(() => {
|
|
308
313
|
});
|
|
309
|
-
},
|
|
310
|
-
if (!
|
|
311
|
-
const i =
|
|
312
|
-
|
|
314
|
+
}, yn = () => {
|
|
315
|
+
if (!a) return;
|
|
316
|
+
const i = wn(_[a]);
|
|
317
|
+
sn(i), an(!0), J(!1), pn(1), Z(0), nn([]), fn([]);
|
|
313
318
|
const e = i.map((t) => t.src);
|
|
314
|
-
|
|
315
|
-
e.forEach((
|
|
319
|
+
gn(e, v.current?.signal).then((t) => {
|
|
320
|
+
e.forEach((r) => {
|
|
321
|
+
tn.current.add(r), t.has(r) && N.current.set(r, t.get(r));
|
|
322
|
+
});
|
|
316
323
|
}).catch(() => {
|
|
317
|
-
}),
|
|
318
|
-
},
|
|
319
|
-
const
|
|
320
|
-
let
|
|
321
|
-
for (; e.includes(
|
|
322
|
-
|
|
323
|
-
if (
|
|
324
|
-
const
|
|
325
|
-
|
|
326
|
-
|
|
324
|
+
}), bn(i, [], !0);
|
|
325
|
+
}, bn = (i = L, e = Ln, t = !1) => {
|
|
326
|
+
const r = wn(i.length ? i : _[a]);
|
|
327
|
+
let b = Math.floor(Math.random() * r.length), M = r[b].name, C = 0;
|
|
328
|
+
for (; e.includes(M) && C < 20; )
|
|
329
|
+
b = Math.floor(Math.random() * r.length), M = r[b].name, C++;
|
|
330
|
+
if (sn(r), zn(b), fn([...e, M]), Q(!1), Hn(""), cn(20), B(null), a && !t) {
|
|
331
|
+
const A = wn(_[a].filter((P) => !e.includes(P.name))).map((P) => P.src);
|
|
332
|
+
gn(A, v.current?.signal).then((P) => {
|
|
333
|
+
A.forEach((z) => {
|
|
334
|
+
tn.current.add(z), P.has(z) && N.current.set(z, P.get(z));
|
|
335
|
+
});
|
|
327
336
|
}).catch(() => {
|
|
328
337
|
});
|
|
329
338
|
}
|
|
330
|
-
t ? (
|
|
339
|
+
t ? (G("ready"), xn(10), K(10)) : (G("memorize"), K(10));
|
|
331
340
|
};
|
|
332
|
-
|
|
333
|
-
if (!(!
|
|
334
|
-
if (
|
|
335
|
-
if (
|
|
341
|
+
rn(() => {
|
|
342
|
+
if (!(!R || F || T)) {
|
|
343
|
+
if (S === "ready")
|
|
344
|
+
if (ln <= 0) G("memorize");
|
|
336
345
|
else {
|
|
337
|
-
const i = setTimeout(() =>
|
|
346
|
+
const i = setTimeout(() => xn((e) => e - 1), 1e3);
|
|
338
347
|
return () => clearTimeout(i);
|
|
339
348
|
}
|
|
340
|
-
if (
|
|
341
|
-
if (
|
|
349
|
+
if (S === "memorize")
|
|
350
|
+
if (q <= 0) G("guess");
|
|
342
351
|
else {
|
|
343
|
-
const i = setTimeout(() =>
|
|
352
|
+
const i = setTimeout(() => K((e) => e - 1), 1e3);
|
|
344
353
|
return () => clearTimeout(i);
|
|
345
354
|
}
|
|
346
|
-
if (
|
|
347
|
-
if (
|
|
348
|
-
|
|
349
|
-
const e =
|
|
350
|
-
|
|
355
|
+
if (S === "guess") {
|
|
356
|
+
if (O <= 0) {
|
|
357
|
+
Q(!0), B("wrong");
|
|
358
|
+
const e = L[k].name;
|
|
359
|
+
nn((t) => [
|
|
351
360
|
...t,
|
|
352
|
-
{ round:
|
|
361
|
+
{ round: D, answer: U, correct: e, result: "wrong" }
|
|
353
362
|
]);
|
|
354
363
|
return;
|
|
355
364
|
}
|
|
356
|
-
const i = setTimeout(() =>
|
|
365
|
+
const i = setTimeout(() => cn((e) => e - 1), 1e3);
|
|
357
366
|
return () => clearTimeout(i);
|
|
358
367
|
}
|
|
359
368
|
}
|
|
360
|
-
}, [
|
|
369
|
+
}, [S, ln, q, O, R, F, T, L, k, D, U]);
|
|
361
370
|
const Vn = () => {
|
|
362
|
-
if (
|
|
363
|
-
const i =
|
|
371
|
+
if (k === null || X) return;
|
|
372
|
+
const i = L[k].name, e = U.toLowerCase().trim();
|
|
364
373
|
let t = "wrong";
|
|
365
|
-
e === i ? (
|
|
366
|
-
|
|
374
|
+
e === i ? (Z((r) => r + 1), B("correct"), t = "correct") : ri(e, i) === 1 ? (Z((r) => r + 0.5), B("almost"), t = "almost") : (B("wrong"), t = "wrong"), nn((r) => [...r, { round: D, answer: e, correct: i, result: t }]), Wn(!0), setTimeout(() => {
|
|
375
|
+
Wn(!1), Q(!0);
|
|
367
376
|
}, 600);
|
|
368
|
-
}, _n = () =>
|
|
369
|
-
|
|
377
|
+
}, _n = () => D < j ? (pn((i) => i + 1), bn()) : J(!0), qn = () => {
|
|
378
|
+
v.current && v.current.abort(), an(!1), J(!1), E(null);
|
|
370
379
|
}, Kn = Xn(
|
|
371
380
|
() => n && window.innerWidth > window.innerHeight || window.innerHeight < 700 ? null : (
|
|
372
381
|
// ensure logo is positioned inside the square container
|
|
373
|
-
/* @__PURE__ */ d("div", { style: { ...w.gmLogoFixed, position: "absolute", top: 16, left: 16, zIndex: 30 }, children: /* @__PURE__ */
|
|
382
|
+
/* @__PURE__ */ d("div", { style: { ...w.gmLogoFixed, position: "absolute", top: 16, left: 16, zIndex: 30 }, children: /* @__PURE__ */ p("picture", { children: [
|
|
374
383
|
/* @__PURE__ */ d(
|
|
375
384
|
"source",
|
|
376
385
|
{
|
|
@@ -394,7 +403,7 @@ function si({
|
|
|
394
403
|
return /* @__PURE__ */ d(
|
|
395
404
|
"div",
|
|
396
405
|
{
|
|
397
|
-
ref:
|
|
406
|
+
ref: g,
|
|
398
407
|
style: {
|
|
399
408
|
width: "100%",
|
|
400
409
|
height: "100%",
|
|
@@ -414,8 +423,8 @@ function si({
|
|
|
414
423
|
"div",
|
|
415
424
|
{
|
|
416
425
|
style: {
|
|
417
|
-
width: n ? "100%" :
|
|
418
|
-
height: n ? "100%" :
|
|
426
|
+
width: n ? "100%" : un || o || 1e3,
|
|
427
|
+
height: n ? "100%" : un || o || 1e3,
|
|
419
428
|
display: "flex",
|
|
420
429
|
justifyContent: "center",
|
|
421
430
|
alignItems: "center",
|
|
@@ -426,7 +435,7 @@ function si({
|
|
|
426
435
|
margin: n ? "0 auto" : "unset",
|
|
427
436
|
position: "relative",
|
|
428
437
|
// needed so absolute logo is inside the square
|
|
429
|
-
transform: `scale(${
|
|
438
|
+
transform: `scale(${Bn})`
|
|
430
439
|
// ✅ Применяем масштаб для широких экранов
|
|
431
440
|
},
|
|
432
441
|
children: /* @__PURE__ */ d(
|
|
@@ -440,9 +449,9 @@ function si({
|
|
|
440
449
|
justifyContent: "center",
|
|
441
450
|
alignItems: "center"
|
|
442
451
|
},
|
|
443
|
-
children: /* @__PURE__ */
|
|
452
|
+
children: /* @__PURE__ */ p("div", { id: "whats-missing-root", children: [
|
|
444
453
|
!n && Kn,
|
|
445
|
-
!
|
|
454
|
+
!a && !R && /* @__PURE__ */ p("div", { style: w.gmCenterScreen, children: [
|
|
446
455
|
/* @__PURE__ */ d("h1", { style: w.gmHeadline1, children: "WHAT'S MISSING?" }),
|
|
447
456
|
/* @__PURE__ */ d("p", { style: w.gmBodyM, children: "Select a theme:" }),
|
|
448
457
|
/* @__PURE__ */ d("div", { style: { display: "flex", gap: n && window.innerWidth > window.innerHeight || n && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "8px" : "16px" }, children: ["animals", "food", "toys"].map((i) => /* @__PURE__ */ d("button", { style: {
|
|
@@ -451,94 +460,94 @@ function si({
|
|
|
451
460
|
fontSize: n && window.innerWidth > window.innerHeight || n && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "12px" : "16px",
|
|
452
461
|
minWidth: n && window.innerWidth > window.innerHeight || n && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "70px" : "auto"
|
|
453
462
|
}, onClick: () => {
|
|
454
|
-
|
|
463
|
+
E(i), Nn(i);
|
|
455
464
|
}, children: i === "animals" ? "🐶 Animals" : i === "food" ? "🍎 Food" : "🧸 Toys" }, i)) }),
|
|
456
|
-
/* @__PURE__ */
|
|
465
|
+
/* @__PURE__ */ p("div", { style: { marginTop: 24 }, children: [
|
|
457
466
|
/* @__PURE__ */ d("p", { style: w.gmBodyS, children: "Choose number of rounds:" }),
|
|
458
467
|
/* @__PURE__ */ d("div", { style: { display: "flex", gap: n && window.innerWidth > window.innerHeight || n && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "6px" : "12px", marginTop: 8 }, children: [3, 4, 5].map((i) => /* @__PURE__ */ d(
|
|
459
468
|
"button",
|
|
460
469
|
{
|
|
461
470
|
style: {
|
|
462
471
|
...w.gmButton,
|
|
463
|
-
...
|
|
472
|
+
...j === i ? w.gmButtonActive : {},
|
|
464
473
|
padding: n && window.innerWidth > window.innerHeight || n && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "6px 10px" : "12px 24px",
|
|
465
474
|
fontSize: n && window.innerWidth > window.innerHeight || n && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "12px" : "16px",
|
|
466
475
|
minWidth: n && window.innerWidth > window.innerHeight || n && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "40px" : "auto"
|
|
467
476
|
},
|
|
468
|
-
onClick: () =>
|
|
477
|
+
onClick: () => kn(i),
|
|
469
478
|
children: i
|
|
470
479
|
},
|
|
471
480
|
i
|
|
472
481
|
)) })
|
|
473
482
|
] })
|
|
474
483
|
] }),
|
|
475
|
-
|
|
476
|
-
/* @__PURE__ */
|
|
484
|
+
a && !R && /* @__PURE__ */ p("div", { style: w.gmCenterScreen, children: [
|
|
485
|
+
/* @__PURE__ */ p("h1", { style: w.gmHeadline1, children: [
|
|
477
486
|
"Theme selected: ",
|
|
478
|
-
|
|
487
|
+
a
|
|
479
488
|
] }),
|
|
480
|
-
/* @__PURE__ */
|
|
489
|
+
/* @__PURE__ */ p("p", { style: w.gmBodyM, children: [
|
|
481
490
|
"Rounds: ",
|
|
482
|
-
|
|
491
|
+
j
|
|
483
492
|
] }),
|
|
484
493
|
/* @__PURE__ */ d("button", { style: {
|
|
485
494
|
...w.gmButton,
|
|
486
495
|
padding: n && window.innerWidth > window.innerHeight || n && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "8px 16px" : "12px 24px",
|
|
487
496
|
fontSize: n && window.innerWidth > window.innerHeight || n && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "14px" : "16px",
|
|
488
497
|
minWidth: n && window.innerWidth > window.innerHeight || n && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "120px" : "auto"
|
|
489
|
-
}, onClick:
|
|
498
|
+
}, onClick: yn, children: "▶ Start game" })
|
|
490
499
|
] }),
|
|
491
|
-
|
|
500
|
+
F && /* @__PURE__ */ p("div", { style: w.gmCenterScreen, children: [
|
|
492
501
|
/* @__PURE__ */ d("h1", { style: {
|
|
493
502
|
...w.gmHeadline1,
|
|
494
|
-
marginTop: n && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ||
|
|
495
|
-
marginBottom: n && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ||
|
|
503
|
+
marginTop: n && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || l || x || c || H || W || m || f || u ? "0px" : w.gmHeadline1.marginTop,
|
|
504
|
+
marginBottom: n && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || l || x || c || H || W || m || f || u ? "2px" : w.gmHeadline1.marginBottom
|
|
496
505
|
}, children: "Results" }),
|
|
497
|
-
/* @__PURE__ */
|
|
506
|
+
/* @__PURE__ */ p("h2", { style: {
|
|
498
507
|
...w.gmHeadline3,
|
|
499
|
-
marginTop: n && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ||
|
|
500
|
-
marginBottom: n && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ||
|
|
508
|
+
marginTop: n && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || l || x || c || H || W || m || f || u ? "0px" : w.gmHeadline3.marginTop,
|
|
509
|
+
marginBottom: n && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || l || x || c || H || W || m || f || u ? "2px" : w.gmHeadline3.marginBottom
|
|
501
510
|
}, children: [
|
|
502
511
|
"Your score: ",
|
|
503
|
-
|
|
512
|
+
Tn,
|
|
504
513
|
" / ",
|
|
505
|
-
|
|
514
|
+
j
|
|
506
515
|
] }),
|
|
507
516
|
/* @__PURE__ */ d("p", { style: {
|
|
508
517
|
...w.gmBodyM,
|
|
509
518
|
color: "#10b981",
|
|
510
|
-
marginTop: n && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ||
|
|
511
|
-
marginBottom: n && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ||
|
|
519
|
+
marginTop: n && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || l || x || c || H || W || m || f || u ? "0px" : "12px",
|
|
520
|
+
marginBottom: n && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || l || x || c || H || W || m || f || u ? "2px" : w.gmBodyM.marginBottom
|
|
512
521
|
}, children: "Yahoo! You did it! 🍬✨" }),
|
|
513
|
-
/* @__PURE__ */
|
|
522
|
+
/* @__PURE__ */ p("table", { style: {
|
|
514
523
|
...w.gmTable,
|
|
515
|
-
marginTop: n && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ||
|
|
516
|
-
marginBottom: n && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ||
|
|
524
|
+
marginTop: n && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || l || x || c || H || W || m || f || u ? "0px" : "20px",
|
|
525
|
+
marginBottom: n && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || l || x || c || H || W || m || f || u ? "4px" : "32px"
|
|
517
526
|
}, children: [
|
|
518
|
-
/* @__PURE__ */ d("thead", { children: /* @__PURE__ */
|
|
527
|
+
/* @__PURE__ */ d("thead", { children: /* @__PURE__ */ p("tr", { children: [
|
|
519
528
|
/* @__PURE__ */ d("th", { children: "Round" }),
|
|
520
529
|
/* @__PURE__ */ d("th", { children: "Your Answer" }),
|
|
521
530
|
/* @__PURE__ */ d("th", { children: "Correct" }),
|
|
522
531
|
/* @__PURE__ */ d("th", { children: "Result" })
|
|
523
532
|
] }) }),
|
|
524
|
-
/* @__PURE__ */ d("tbody", { children:
|
|
533
|
+
/* @__PURE__ */ d("tbody", { children: Mn.map((i, e) => /* @__PURE__ */ p("tr", { children: [
|
|
525
534
|
/* @__PURE__ */ d("td", { style: w.gmTableCell, children: i.round }),
|
|
526
535
|
/* @__PURE__ */ d("td", { style: w.gmTableCell, children: i.answer || "—" }),
|
|
527
536
|
/* @__PURE__ */ d("td", { style: w.gmTableCell, children: i.correct }),
|
|
528
537
|
/* @__PURE__ */ d("td", { style: w.gmTableCell, children: i.result === "correct" ? "✔ Correct" : i.result === "almost" ? "◐ Almost (0.5)" : "✘ Wrong" })
|
|
529
538
|
] }, e)) })
|
|
530
539
|
] }),
|
|
531
|
-
/* @__PURE__ */
|
|
540
|
+
/* @__PURE__ */ p("div", { style: {
|
|
532
541
|
display: "flex",
|
|
533
542
|
gap: n && window.innerWidth > window.innerHeight || n && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "6px" : "12px",
|
|
534
|
-
marginTop: n && window.innerWidth > window.innerHeight || n && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "2px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 ||
|
|
543
|
+
marginTop: n && window.innerWidth > window.innerHeight || n && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "2px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 || I ? "12px" : "24px"
|
|
535
544
|
}, children: [
|
|
536
545
|
/* @__PURE__ */ d("button", { style: {
|
|
537
546
|
...w.gmButton,
|
|
538
547
|
padding: n && window.innerWidth > window.innerHeight || n && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "6px 10px" : "12px 24px",
|
|
539
548
|
fontSize: n && window.innerWidth > window.innerHeight || n && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "12px" : "16px",
|
|
540
549
|
minWidth: n && window.innerWidth > window.innerHeight || n && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "80px" : "auto"
|
|
541
|
-
}, onClick:
|
|
550
|
+
}, onClick: yn, children: "🔁 Play again" }),
|
|
542
551
|
/* @__PURE__ */ d("button", { style: {
|
|
543
552
|
...w.gmButton,
|
|
544
553
|
padding: n && window.innerWidth > window.innerHeight || n && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "6px 10px" : "12px 24px",
|
|
@@ -547,8 +556,8 @@ function si({
|
|
|
547
556
|
}, onClick: qn, children: "⬅️ Choose theme" })
|
|
548
557
|
] })
|
|
549
558
|
] }),
|
|
550
|
-
|
|
551
|
-
/* @__PURE__ */
|
|
559
|
+
R && !F && /* @__PURE__ */ p("div", { style: w.gmGameLayout, children: [
|
|
560
|
+
/* @__PURE__ */ p(
|
|
552
561
|
"div",
|
|
553
562
|
{
|
|
554
563
|
style: {
|
|
@@ -560,24 +569,24 @@ function si({
|
|
|
560
569
|
paddingTop: n && window.innerWidth <= 375 && window.innerHeight <= 667 || n && window.innerWidth > window.innerHeight && window.innerHeight <= 428 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "8px" : n && window.innerWidth > window.innerHeight || window.innerHeight < 700 ? "15px" : "40px"
|
|
561
570
|
},
|
|
562
571
|
children: [
|
|
563
|
-
|
|
572
|
+
S === "ready" && /* @__PURE__ */ p(Pn, { children: [
|
|
564
573
|
/* @__PURE__ */ d("h1", { style: { ...w.gmHeadline1, color: "#ec4c44" }, children: "GET READY" }),
|
|
565
574
|
/* @__PURE__ */ d("div", { style: w.gmHourglass, children: "⏳" })
|
|
566
575
|
] }),
|
|
567
|
-
|
|
576
|
+
S === "memorize" && /* @__PURE__ */ p("p", { style: { ...w.gmBodyM, color: "#10b981" }, children: [
|
|
568
577
|
"MEMORIZE (",
|
|
569
|
-
|
|
578
|
+
q,
|
|
570
579
|
")"
|
|
571
580
|
] }),
|
|
572
|
-
|
|
581
|
+
S === "guess" && !T && /* @__PURE__ */ p("p", { style: w.gmBodyM, children: [
|
|
573
582
|
"⏳ Time left: ",
|
|
574
|
-
|
|
583
|
+
O,
|
|
575
584
|
"s"
|
|
576
585
|
] })
|
|
577
586
|
]
|
|
578
587
|
}
|
|
579
588
|
),
|
|
580
|
-
|
|
589
|
+
S !== "ready" && /* @__PURE__ */ d(
|
|
581
590
|
"div",
|
|
582
591
|
{
|
|
583
592
|
style: {
|
|
@@ -591,8 +600,8 @@ function si({
|
|
|
591
600
|
maxWidth: n && window.innerWidth > window.innerHeight ? "90%" : n && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "95%" : "100%",
|
|
592
601
|
padding: n && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "8px" : typeof window < "u" && window.devicePixelRatio >= 1.25 && window.devicePixelRatio <= 1.5 ? "20px" : "16px"
|
|
593
602
|
},
|
|
594
|
-
children:
|
|
595
|
-
const t =
|
|
603
|
+
children: L.map((i, e) => {
|
|
604
|
+
const t = k === e && S === "guess" && !T;
|
|
596
605
|
return /* @__PURE__ */ d(
|
|
597
606
|
"div",
|
|
598
607
|
{
|
|
@@ -604,59 +613,66 @@ function si({
|
|
|
604
613
|
boxShadow: n && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "0 1px 4px rgba(0,0,0,0.1)" : "0 4px 12px rgba(0,0,0,0.15)",
|
|
605
614
|
transition: "all 0.3s ease",
|
|
606
615
|
cursor: "pointer",
|
|
607
|
-
...
|
|
616
|
+
...mn === "correct" && k === e ? {
|
|
608
617
|
boxShadow: n && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "0 0 15px #10b981" : "0 0 20px #10b981",
|
|
609
618
|
transform: "scale(1.03)"
|
|
610
619
|
} : {},
|
|
611
|
-
...
|
|
620
|
+
...mn === "wrong" && k === e ? {
|
|
612
621
|
boxShadow: n && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "0 0 15px #ef4444" : "0 0 20px #ef4444",
|
|
613
622
|
transform: "scale(1.03)"
|
|
614
623
|
} : {}
|
|
615
624
|
},
|
|
616
|
-
children: !t &&
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
625
|
+
children: !t && (() => {
|
|
626
|
+
const r = N.current.get(i.src), b = r?.complete && r.src ? r.src : i.src;
|
|
627
|
+
return /* @__PURE__ */ d(
|
|
628
|
+
"img",
|
|
629
|
+
{
|
|
630
|
+
src: b,
|
|
631
|
+
alt: i.name,
|
|
632
|
+
fetchPriority: "high",
|
|
633
|
+
loading: "eager",
|
|
634
|
+
decoding: "async",
|
|
635
|
+
style: {
|
|
636
|
+
width: "100%",
|
|
637
|
+
height: "100%",
|
|
638
|
+
objectFit: "cover"
|
|
639
|
+
}
|
|
640
|
+
},
|
|
641
|
+
`${i.src}-${r?.complete ? "loaded" : "pending"}`
|
|
642
|
+
);
|
|
643
|
+
})()
|
|
628
644
|
},
|
|
629
645
|
e
|
|
630
646
|
);
|
|
631
647
|
})
|
|
632
648
|
}
|
|
633
649
|
),
|
|
634
|
-
/* @__PURE__ */
|
|
650
|
+
/* @__PURE__ */ p("div", { style: {
|
|
635
651
|
marginTop: n && window.innerWidth <= 375 && window.innerHeight <= 667 || n && window.innerWidth > window.innerHeight && window.innerHeight <= 428 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "1px" : n && window.innerWidth > window.innerHeight || window.innerHeight < 700 ? "4px" : "16px",
|
|
636
652
|
height: n && window.innerWidth <= 375 && window.innerHeight <= 667 || n && window.innerWidth > window.innerHeight && window.innerHeight <= 428 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "40px" : n && window.innerWidth > window.innerHeight || window.innerHeight < 700 ? "50px" : "80px"
|
|
637
653
|
}, children: [
|
|
638
|
-
|
|
654
|
+
S === "guess" && !T && /* @__PURE__ */ d("div", { style: {
|
|
639
655
|
display: "flex",
|
|
640
|
-
flexDirection:
|
|
641
|
-
gap: n && window.innerWidth <= 375 && window.innerHeight <= 667 || n && window.innerWidth > window.innerHeight && window.innerHeight <= 428 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "3px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 ||
|
|
656
|
+
flexDirection: en ? "row" : "column",
|
|
657
|
+
gap: n && window.innerWidth <= 375 && window.innerHeight <= 667 || n && window.innerWidth > window.innerHeight && window.innerHeight <= 428 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "3px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 || I || l || x || c || H || W || m || f || u ? "8px" : n && window.innerWidth > window.innerHeight || window.innerHeight < 700 ? "6px" : "12px",
|
|
642
658
|
alignItems: "center",
|
|
643
659
|
justifyContent: "center",
|
|
644
660
|
width: "100%",
|
|
645
|
-
maxWidth: n && window.innerWidth <= 375 && window.innerHeight <= 667 || n && window.innerWidth > window.innerHeight && window.innerHeight <= 428 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "270px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 ||
|
|
646
|
-
}, children: /* @__PURE__ */
|
|
661
|
+
maxWidth: n && window.innerWidth <= 375 && window.innerHeight <= 667 || n && window.innerWidth > window.innerHeight && window.innerHeight <= 428 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "270px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 || I || l || x || c || H || W || m || f || u || n && window.innerWidth > window.innerHeight || window.innerHeight < 700 ? "400px" : "300px"
|
|
662
|
+
}, children: /* @__PURE__ */ p(Pn, { children: [
|
|
647
663
|
/* @__PURE__ */ d(
|
|
648
664
|
"input",
|
|
649
665
|
{
|
|
650
666
|
type: "text",
|
|
651
667
|
placeholder: "Type the missing word",
|
|
652
|
-
value:
|
|
653
|
-
onChange: (i) =>
|
|
668
|
+
value: U,
|
|
669
|
+
onChange: (i) => Hn(i.target.value),
|
|
654
670
|
style: {
|
|
655
671
|
...w.gmInput,
|
|
656
|
-
width: n && window.innerWidth <= 375 && window.innerHeight <= 667 || n && window.innerWidth > window.innerHeight && window.innerHeight <= 428 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "170px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 ||
|
|
657
|
-
padding: n && window.innerWidth <= 375 && window.innerHeight <= 667 || n && window.innerWidth > window.innerHeight && window.innerHeight <= 428 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "5px 6px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 ||
|
|
658
|
-
fontSize: n && window.innerWidth <= 375 && window.innerHeight <= 667 || n && window.innerWidth > window.innerHeight && window.innerHeight <= 428 ? "10px" : window.innerWidth === 896 && window.innerHeight === 414 ? "11px" : window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "10px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 ||
|
|
659
|
-
flex:
|
|
672
|
+
width: n && window.innerWidth <= 375 && window.innerHeight <= 667 || n && window.innerWidth > window.innerHeight && window.innerHeight <= 428 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "170px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 || I || l || x || c || H || W || m || f || u || n && window.innerWidth > window.innerHeight || window.innerHeight < 700 ? "250px" : "auto",
|
|
673
|
+
padding: n && window.innerWidth <= 375 && window.innerHeight <= 667 || n && window.innerWidth > window.innerHeight && window.innerHeight <= 428 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "5px 6px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 || I || l || x || c || H || W || m || f || u || n && window.innerWidth > window.innerHeight || window.innerHeight < 700 ? "10px 12px" : "12px 16px",
|
|
674
|
+
fontSize: n && window.innerWidth <= 375 && window.innerHeight <= 667 || n && window.innerWidth > window.innerHeight && window.innerHeight <= 428 ? "10px" : window.innerWidth === 896 && window.innerHeight === 414 ? "11px" : window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "10px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 || I || l || x || c || H || W || m || f || u || n && window.innerWidth > window.innerHeight || window.innerHeight < 700 ? "14px" : "16px",
|
|
675
|
+
flex: en ? "1" : "none"
|
|
660
676
|
}
|
|
661
677
|
}
|
|
662
678
|
),
|
|
@@ -665,22 +681,22 @@ function si({
|
|
|
665
681
|
{
|
|
666
682
|
style: {
|
|
667
683
|
...w.gmButton,
|
|
668
|
-
marginLeft:
|
|
669
|
-
padding: n && window.innerWidth <= 375 && window.innerHeight <= 667 ? "5px 8px" : n && window.innerWidth > window.innerHeight && window.innerHeight <= 428 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "6px 10px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 ||
|
|
670
|
-
fontSize: n && window.innerWidth <= 375 && window.innerHeight <= 667 ? "10px" : n && window.innerWidth > window.innerHeight && window.innerHeight <= 428 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "11px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 ||
|
|
671
|
-
minWidth: n && window.innerWidth <= 375 && window.innerHeight <= 667 ? "45px" : n && window.innerWidth > window.innerHeight && window.innerHeight <= 428 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "55px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 ||
|
|
684
|
+
marginLeft: en ? "8px" : "0",
|
|
685
|
+
padding: n && window.innerWidth <= 375 && window.innerHeight <= 667 ? "5px 8px" : n && window.innerWidth > window.innerHeight && window.innerHeight <= 428 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "6px 10px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 || I || l || x || c || H || W || m || f || u || n && window.innerWidth > window.innerHeight || window.innerHeight < 700 ? "10px 16px" : "12px 24px",
|
|
686
|
+
fontSize: n && window.innerWidth <= 375 && window.innerHeight <= 667 ? "10px" : n && window.innerWidth > window.innerHeight && window.innerHeight <= 428 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "11px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 || I || l || x || c || H || W || m || f || u || n && window.innerWidth > window.innerHeight || window.innerHeight < 700 ? "14px" : "16px",
|
|
687
|
+
minWidth: n && window.innerWidth <= 375 && window.innerHeight <= 667 ? "45px" : n && window.innerWidth > window.innerHeight && window.innerHeight <= 428 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "55px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 || I || l || x || c || H || W || m || f || u || n && window.innerWidth > window.innerHeight || window.innerHeight < 700 ? "80px" : "100px",
|
|
672
688
|
flexShrink: 0
|
|
673
689
|
},
|
|
674
690
|
onClick: Vn,
|
|
675
|
-
disabled:
|
|
676
|
-
children:
|
|
691
|
+
disabled: X,
|
|
692
|
+
children: X ? "..." : "Check"
|
|
677
693
|
}
|
|
678
694
|
)
|
|
679
695
|
] }) }),
|
|
680
|
-
|
|
696
|
+
T && /* @__PURE__ */ d("button", { style: {
|
|
681
697
|
...w.gmButton,
|
|
682
|
-
padding: n && window.innerWidth <= 375 && window.innerHeight <= 667 ? "5px 8px" : n && window.innerWidth > window.innerHeight && window.innerHeight <= 428 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "6px 10px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 ||
|
|
683
|
-
fontSize: n && window.innerWidth <= 375 && window.innerHeight <= 667 ? "10px" : n && window.innerWidth > window.innerHeight && window.innerHeight <= 428 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "11px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 ||
|
|
698
|
+
padding: n && window.innerWidth <= 375 && window.innerHeight <= 667 ? "5px 8px" : n && window.innerWidth > window.innerHeight && window.innerHeight <= 428 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "6px 10px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 || I || l || x || c || H || W || m || f || u || n && window.innerWidth > window.innerHeight || window.innerHeight < 700 ? "10px 16px" : "12px 24px",
|
|
699
|
+
fontSize: n && window.innerWidth <= 375 && window.innerHeight <= 667 ? "10px" : n && window.innerWidth > window.innerHeight && window.innerHeight <= 428 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 ? "11px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 || I || l || x || c || H || W || m || f || u || n && window.innerWidth > window.innerHeight || window.innerHeight < 700 ? "14px" : "16px"
|
|
684
700
|
}, onClick: _n, children: "Next round" })
|
|
685
701
|
] })
|
|
686
702
|
] })
|
|
@@ -693,6 +709,6 @@ function si({
|
|
|
693
709
|
);
|
|
694
710
|
}
|
|
695
711
|
export {
|
|
696
|
-
|
|
697
|
-
|
|
712
|
+
li as Game,
|
|
713
|
+
_ as themes
|
|
698
714
|
};
|
package/package.json
CHANGED
package/src/Game.tsx
CHANGED
|
@@ -69,6 +69,27 @@ const levenshtein = (a: string, b: string) => {
|
|
|
69
69
|
return dp[a.length][b.length];
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
+
// ✅ Preload utilities
|
|
73
|
+
const preloadImage = (src: string): Promise<HTMLImageElement> => {
|
|
74
|
+
return new Promise((resolve) => {
|
|
75
|
+
// ✅ Проверяем, не загружена ли уже картинка
|
|
76
|
+
const img = new Image();
|
|
77
|
+
img.onload = () => resolve(img);
|
|
78
|
+
img.onerror = () => resolve(img); // Continue even on error, но img все равно создан
|
|
79
|
+
img.src = src;
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const preloadImages = async (urls: string[], signal?: AbortSignal): Promise<Map<string, HTMLImageElement>> => {
|
|
84
|
+
const imageMap = new Map<string, HTMLImageElement>();
|
|
85
|
+
const promises = urls.map(async (url) => {
|
|
86
|
+
const img = await preloadImage(url);
|
|
87
|
+
imageMap.set(url, img);
|
|
88
|
+
});
|
|
89
|
+
await Promise.allSettled(promises);
|
|
90
|
+
return imageMap;
|
|
91
|
+
};
|
|
92
|
+
|
|
72
93
|
export default function Game({
|
|
73
94
|
gameCubeSize,
|
|
74
95
|
screenHeight,
|
|
@@ -107,7 +128,7 @@ export default function Game({
|
|
|
107
128
|
const [currentRound, setCurrentRound] = useState(1);
|
|
108
129
|
const [hiddenIndex, setHiddenIndex] = useState<number | null>(null);
|
|
109
130
|
const [phase, setPhase] = useState<"ready" | "memorize" | "guess">("ready");
|
|
110
|
-
const [readyTime, setReadyTime] = useState(
|
|
131
|
+
const [readyTime, setReadyTime] = useState(10);
|
|
111
132
|
const [memorizeTime, setMemorizeTime] = useState(10);
|
|
112
133
|
const [timeLeft, setTimeLeft] = useState(20);
|
|
113
134
|
const [score, setScore] = useState(0);
|
|
@@ -131,9 +152,11 @@ export default function Game({
|
|
|
131
152
|
const [isIPadProPortrait, setIsIPadProPortrait] = useState(false);
|
|
132
153
|
const [isIPadProLandscape, setIsIPadProLandscape] = useState(false);
|
|
133
154
|
const [isHorizontalLayout, setIsHorizontalLayout] = useState(false);
|
|
155
|
+
const [isWideScreen, setIsWideScreen] = useState(false);
|
|
134
156
|
|
|
135
157
|
// ✅ Система предзагрузки изображений
|
|
136
158
|
const preloadedUrls = useRef<Set<string>>(new Set());
|
|
159
|
+
const preloadedImages = useRef<Map<string, HTMLImageElement>>(new Map());
|
|
137
160
|
const abortController = useRef<AbortController | null>(null);
|
|
138
161
|
|
|
139
162
|
// ✅ адаптив под мобилки, планшеты и десктоп
|
|
@@ -271,21 +294,6 @@ export default function Game({
|
|
|
271
294
|
const getRandomSix = (arr: ImageItem[]) =>
|
|
272
295
|
[...arr].sort(() => Math.random() - 0.5).slice(0, 6);
|
|
273
296
|
|
|
274
|
-
// ✅ Утилиты предзагрузки
|
|
275
|
-
const preloadImage = (src: string): Promise<void> => {
|
|
276
|
-
return new Promise((resolve) => {
|
|
277
|
-
const img = new Image();
|
|
278
|
-
img.onload = () => resolve();
|
|
279
|
-
img.onerror = () => resolve(); // Continue even on error
|
|
280
|
-
img.src = src;
|
|
281
|
-
});
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
const preloadImages = async (urls: string[], signal?: AbortSignal): Promise<void> => {
|
|
285
|
-
const promises = urls.map(url => preloadImage(url));
|
|
286
|
-
await Promise.allSettled(promises);
|
|
287
|
-
};
|
|
288
|
-
|
|
289
297
|
// ✅ Функция предзагрузки темы
|
|
290
298
|
const startThemePreload = (themeName: Theme) => {
|
|
291
299
|
// Cancel previous preload
|
|
@@ -300,9 +308,14 @@ export default function Game({
|
|
|
300
308
|
const themeImages = themes[themeName];
|
|
301
309
|
const urls = themeImages.map(item => item.src);
|
|
302
310
|
|
|
303
|
-
preloadImages(urls, abortController.current.signal).then(() => {
|
|
311
|
+
preloadImages(urls, abortController.current.signal).then((imageMap) => {
|
|
304
312
|
// Mark as preloaded
|
|
305
|
-
urls.forEach(url =>
|
|
313
|
+
urls.forEach(url => {
|
|
314
|
+
preloadedUrls.current.add(url);
|
|
315
|
+
if (imageMap.has(url)) {
|
|
316
|
+
preloadedImages.current.set(url, imageMap.get(url)!);
|
|
317
|
+
}
|
|
318
|
+
});
|
|
306
319
|
}).catch(() => {
|
|
307
320
|
// Ignore abort errors
|
|
308
321
|
});
|
|
@@ -321,8 +334,13 @@ export default function Game({
|
|
|
321
334
|
|
|
322
335
|
// ✅ Preload current round images
|
|
323
336
|
const urls = selected.map(item => item.src);
|
|
324
|
-
preloadImages(urls, abortController.current?.signal).then(() => {
|
|
325
|
-
urls.forEach(url =>
|
|
337
|
+
preloadImages(urls, abortController.current?.signal).then((imageMap) => {
|
|
338
|
+
urls.forEach(url => {
|
|
339
|
+
preloadedUrls.current.add(url);
|
|
340
|
+
if (imageMap.has(url)) {
|
|
341
|
+
preloadedImages.current.set(url, imageMap.get(url)!);
|
|
342
|
+
}
|
|
343
|
+
});
|
|
326
344
|
}).catch(() => {
|
|
327
345
|
// Ignore abort errors
|
|
328
346
|
});
|
|
@@ -352,8 +370,13 @@ export default function Game({
|
|
|
352
370
|
if (theme && !isFirst) {
|
|
353
371
|
const nextPool = getRandomSix(themes[theme].filter(item => !used.includes(item.name)));
|
|
354
372
|
const nextUrls = nextPool.map(item => item.src);
|
|
355
|
-
preloadImages(nextUrls, abortController.current?.signal).then(() => {
|
|
356
|
-
nextUrls.forEach(url =>
|
|
373
|
+
preloadImages(nextUrls, abortController.current?.signal).then((imageMap) => {
|
|
374
|
+
nextUrls.forEach(url => {
|
|
375
|
+
preloadedUrls.current.add(url);
|
|
376
|
+
if (imageMap.has(url)) {
|
|
377
|
+
preloadedImages.current.set(url, imageMap.get(url)!);
|
|
378
|
+
}
|
|
379
|
+
});
|
|
357
380
|
}).catch(() => {
|
|
358
381
|
// Ignore abort errors
|
|
359
382
|
});
|
|
@@ -361,7 +384,7 @@ export default function Game({
|
|
|
361
384
|
|
|
362
385
|
if (isFirst) {
|
|
363
386
|
setPhase("ready");
|
|
364
|
-
setReadyTime(
|
|
387
|
+
setReadyTime(10); // Увеличено до 10 секунд для VPN/медленных соединений
|
|
365
388
|
setMemorizeTime(10);
|
|
366
389
|
} else {
|
|
367
390
|
setPhase("memorize");
|
|
@@ -430,6 +453,11 @@ export default function Game({
|
|
|
430
453
|
currentRound < rounds ? (setCurrentRound((r) => r + 1), startRound()) : setFinished(true);
|
|
431
454
|
|
|
432
455
|
const exitGame = () => {
|
|
456
|
+
// ✅ Cancel any ongoing preloads
|
|
457
|
+
if (abortController.current) {
|
|
458
|
+
abortController.current.abort();
|
|
459
|
+
}
|
|
460
|
+
|
|
433
461
|
setStarted(false);
|
|
434
462
|
setFinished(false);
|
|
435
463
|
setTheme(null);
|
|
@@ -819,17 +847,30 @@ export default function Game({
|
|
|
819
847
|
: {}),
|
|
820
848
|
}}
|
|
821
849
|
>
|
|
822
|
-
{!isHidden && (
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
850
|
+
{!isHidden && (() => {
|
|
851
|
+
// ✅ Используем уже загруженный объект Image чтобы браузер взял из кеша
|
|
852
|
+
const preloadedImg = preloadedImages.current.get(file.src);
|
|
853
|
+
// Используем src из уже загруженного объекта или оригинальный URL
|
|
854
|
+
const imgSrc = preloadedImg?.complete && preloadedImg.src
|
|
855
|
+
? preloadedImg.src
|
|
856
|
+
: file.src;
|
|
857
|
+
|
|
858
|
+
return (
|
|
859
|
+
<img
|
|
860
|
+
key={`${file.src}-${preloadedImg?.complete ? 'loaded' : 'pending'}`}
|
|
861
|
+
src={imgSrc}
|
|
862
|
+
alt={file.name}
|
|
863
|
+
fetchPriority="high"
|
|
864
|
+
loading="eager"
|
|
865
|
+
decoding="async"
|
|
866
|
+
style={{
|
|
867
|
+
width: "100%",
|
|
868
|
+
height: "100%",
|
|
869
|
+
objectFit: "cover",
|
|
870
|
+
}}
|
|
871
|
+
/>
|
|
872
|
+
);
|
|
873
|
+
})()}
|
|
833
874
|
</div>
|
|
834
875
|
);
|
|
835
876
|
})}
|