@mblinkov/whats-missing 20.0.35 → 20.0.36

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.
@@ -1,9 +1,9 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),s=require("react"),he=window.origin+"/cloud/speakid/games/whatsmissing/",Y=(r,a)=>r.map(([l,i])=>({src:`${he}${a}/${i.replace(/\s/g,"%20")}.png`,name:i})),fe=[["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"]],pe=[["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"]],ye=[["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"]],Z={food:Y(fe,"food"),animals:Y(pe,"animals"),toys:Y(ye,"toys")},xe=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),s=require("react"),he=window.origin+"/cloud/speakid/games/whatsmissing/",Y=(l,m)=>l.map(([r,i])=>({src:`${he}${m}/${i.replace(/\s/g,"%20")}.png`,name:i})),fe=[["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"]],pe=[["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"]],ye=[["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"]],P={food:Y(fe,"food"),animals:Y(pe,"animals"),toys:Y(ye,"toys")},xe=`
2
2
  @keyframes spin {
3
3
  from { transform: rotate(0deg); }
4
4
  to { transform: rotate(360deg); }
5
5
  }
6
- `;if(typeof document<"u"&&!document.getElementById("spin-keyframes")){const r=document.createElement("style");r.id="spin-keyframes",r.innerHTML=xe,document.head.appendChild(r)}const be={animation:"spin 1.4s linear infinite"},n={gmCenterScreen:{position:"relative",zIndex:1,minHeight:"100%",width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",textAlign:"center",color:"#1f2937",padding:"24px 16px",boxSizing:"border-box",transform:"translateY(20px)"},gmHeadline1:{fontWeight:700,fontSize:"clamp(28px, 4vw, 40px)",lineHeight:"110%"},gmHeadline3:{fontWeight:600,fontSize:"18px",lineHeight:"130%"},gmBodyM:{fontWeight:400,fontSize:"16px",lineHeight:"140%"},gmBodyS:{fontWeight:400,fontSize:"14px",lineHeight:"140%",color:"#6b7280"},gmButton:{fontFamily:'"Geist", system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans"',fontWeight:600,fontSize:"16px",padding:"10px 16px",borderRadius:"12px",border:"1px solid #e5e7eb",background:"#ec4c44",color:"#ffffff",cursor:"pointer",boxShadow:"0 6px 18px rgba(236, 76, 68, .18)",transition:"transform .06s ease, box-shadow .2s ease, background .2s ease, opacity .2s ease"},gmButtonActive:{background:"#333",color:"#fff"},gmGameLayout:{position:"relative",width:"100%",maxWidth:"none",minHeight:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",color:"#1f2937",padding:"16px 8px",margin:"0 auto"},gmGrid:{width:"100%",maxWidth:"none",margin:"0 auto",display:"grid",gridTemplateColumns:"repeat(3, 210px)",gridAutoRows:"210px",gap:"20px",justifyContent:"center"},gmCard:{border:"1px solid #e5e7eb",borderRadius:"16px",background:"#f9f9f9",aspectRatio:"1 / 1",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",transition:"transform .2s ease, box-shadow .2s ease, border-color .2s ease"},gmCorrect:{border:"2px solid #10b981",boxShadow:"0 0 18px rgba(16,185,129,.45)",background:"#ecfdf5"},gmWrong:{border:"2px solid #ec4c44",boxShadow:"0 0 18px rgba(236,76,68,.35)",background:"#fef2f2"},gmInput:{padding:"6px 10px",borderRadius:"6px",border:"1px solid #ccc",fontSize:"16px",fontFamily:'"Geist", system-ui',width:"160px"},gmTable:{marginTop:"20px",marginBottom:"32px",borderCollapse:"collapse",width:"100%",maxWidth:"520px",tableLayout:"fixed",textAlign:"center"},gmTableCell:{padding:"8px 12px",borderBottom:"1px solid #e5e7eb",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},gmLogoFixed:{position:"absolute",top:"16px",left:"24px",width:"120px",zIndex:10,pointerEvents:"none",background:"transparent",transform:"none",willChange:"auto"},gmLogoImg:{height:"clamp(28px, 5vw, 40px)",width:"auto",background:"transparent",objectFit:"contain",imageRendering:"auto",transform:"translateZ(0)",backfaceVisibility:"hidden",WebkitFontSmoothing:"antialiased"},gmHourglass:{fontSize:"42px",...be}};s.useEffect(()=>{const r=document.body,a=document.documentElement,l=r.style.zoom,i=r.style.transform,m=a.style.zoom,c=a.style.transform;return r.style.zoom="1",r.style.transform="none",a.style.zoom="1",a.style.transform="none",console.log("Zoom and transform neutralized globally."),()=>{r.style.zoom=l,r.style.transform=i,a.style.zoom=m,a.style.transform=c}},[]);const we=()=>{const r=document.createElement("style");r.textContent=`
6
+ `;if(typeof document<"u"&&!document.getElementById("spin-keyframes")){const l=document.createElement("style");l.id="spin-keyframes",l.innerHTML=xe,document.head.appendChild(l)}const be={animation:"spin 1.4s linear infinite"},o={gmCenterScreen:{position:"relative",zIndex:1,minHeight:"100%",width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",textAlign:"center",color:"#1f2937",padding:"24px 16px",boxSizing:"border-box",transform:"translateY(20px)"},gmHeadline1:{fontWeight:700,fontSize:"clamp(28px, 4vw, 40px)",lineHeight:"110%"},gmHeadline3:{fontWeight:600,fontSize:"18px",lineHeight:"130%"},gmBodyM:{fontWeight:400,fontSize:"16px",lineHeight:"140%"},gmBodyS:{fontWeight:400,fontSize:"14px",lineHeight:"140%",color:"#6b7280"},gmButton:{fontFamily:'"Geist", system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans"',fontWeight:600,fontSize:"16px",padding:"10px 16px",borderRadius:"12px",border:"1px solid #e5e7eb",background:"#ec4c44",color:"#ffffff",cursor:"pointer",boxShadow:"0 6px 18px rgba(236, 76, 68, .18)",transition:"transform .06s ease, box-shadow .2s ease, background .2s ease, opacity .2s ease"},gmButtonActive:{background:"#333",color:"#fff"},gmGameLayout:{position:"relative",width:"100%",maxWidth:"none",minHeight:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",color:"#1f2937",padding:"16px 8px",margin:"0 auto"},gmGrid:{width:"100%",maxWidth:"none",margin:"0 auto",display:"grid",gridTemplateColumns:"repeat(3, 210px)",gridAutoRows:"210px",gap:"20px",justifyContent:"center"},gmCard:{border:"1px solid #e5e7eb",borderRadius:"16px",background:"#f9f9f9",aspectRatio:"1 / 1",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",transition:"transform .2s ease, box-shadow .2s ease, border-color .2s ease"},gmCorrect:{border:"2px solid #10b981",boxShadow:"0 0 18px rgba(16,185,129,.45)",background:"#ecfdf5"},gmWrong:{border:"2px solid #ec4c44",boxShadow:"0 0 18px rgba(236,76,68,.35)",background:"#fef2f2"},gmInput:{padding:"6px 10px",borderRadius:"6px",border:"1px solid #ccc",fontSize:"16px",fontFamily:'"Geist", system-ui',width:"160px"},gmTable:{marginTop:"20px",marginBottom:"32px",borderCollapse:"collapse",width:"100%",maxWidth:"520px",tableLayout:"fixed",textAlign:"center"},gmTableCell:{padding:"8px 12px",borderBottom:"1px solid #e5e7eb",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},gmLogoFixed:{position:"absolute",top:"16px",left:"24px",width:"120px",zIndex:10,pointerEvents:"none",background:"transparent",transform:"none",willChange:"auto"},gmLogoImg:{height:"clamp(28px, 5vw, 40px)",width:"auto",background:"transparent",objectFit:"contain",imageRendering:"auto",transform:"translateZ(0)",backfaceVisibility:"hidden",WebkitFontSmoothing:"antialiased"},gmHourglass:{fontSize:"42px",...be}},we=()=>{const l=document.createElement("style");l.textContent=`
7
7
  #whats-missing-root, #whats-missing-root * { box-sizing: border-box; }
8
8
  #whats-missing-root img { max-width:100%; height:auto; display:block; user-select:none; }
9
- `,document.head.appendChild(r)},je=(r,a)=>{const l=Array.from({length:r.length+1},()=>Array(a.length+1).fill(0));for(let i=0;i<=r.length;i++)l[i][0]=i;for(let i=0;i<=a.length;i++)l[0][i]=i;for(let i=1;i<=r.length;i++)for(let m=1;m<=a.length;m++)l[i][m]=r[i-1]===a[m-1]?l[i-1][m-1]:Math.min(l[i-1][m-1],l[i][m-1],l[i-1][m])+1;return l[r.length][a.length]};function Se(r,a={minDesktopWidth:1200,forceResize:!1}){const l=s.useRef(null),i=a.minDesktopWidth??1200,m=!!a.forceResize;s.useLayoutEffect(()=>{if(typeof window>"u"||!r||!r.current)return;const c=r.current,T=()=>{try{const d=document.body,j=getComputedStyle(d),b=parseFloat(d.style&&d.style.zoom||"");if(b&&!isNaN(b)&&b>0)return b;const S=parseFloat(j.zoom||"");if(S&&!isNaN(S)&&S>0)return S;const g=document.createElement("div");g.style.position="absolute",g.style.left="0",g.style.top="0",g.style.width="100px",g.style.height="1px",g.style.visibility="hidden",document.documentElement.appendChild(g);const C=g.getBoundingClientRect();if(document.documentElement.removeChild(g),C&&C.width>0){const p=C.width/100;if(!isNaN(p)&&p>0)return p}}catch{}return 1},I=()=>{if(i&&window.innerWidth<i){y();return}const d=T();if(!d||d===1){y();return}l.current||(l.current={transform:c.style.transform||null,transformOrigin:c.style.transformOrigin||null,width:c.style.width||null,height:c.style.height||null,willChange:c.style.willChange||null});const j=1/d;m&&(c.style.width=`${d*100}%`,c.style.height=`${d*100}%`),c.style.transformOrigin="50% 50%",c.style.transform=`scale(${j})`,c.style.willChange="transform"},y=()=>{if(!l.current)return;const d=l.current;c.style.transform=d.transform??"",c.style.transformOrigin=d.transformOrigin??"",c.style.width=d.width??"",c.style.height=d.height??"",c.style.willChange=d.willChange??"",l.current=null};let z=0;const x=()=>{cancelAnimationFrame(z),z=requestAnimationFrame(I)},R=new MutationObserver(d=>{for(const j of d)if(j.type==="attributes"&&(j.attributeName==="style"||j.attributeName==="class")){x();break}});return R.observe(document.body,{attributes:!0,attributeFilter:["style","class"]}),window.addEventListener("resize",x),x(),()=>{cancelAnimationFrame(z),R.disconnect(),window.removeEventListener("resize",x),y()}},[r,i,m])}function ve({gameCubeSize:r,screenHeight:a,screenWidth:l}){const i=s.useRef(null),m=s.useRef(null),[c,T]=s.useState(null);Se(i,{minDesktopWidth:1024,forceResize:!1});const I=s.useMemo(()=>{const e=r??Math.min(l??1e3,a??1e3),o=l??(typeof window<"u"?window.innerWidth:1e3);return e<600&&o>768?600:o<=768?Math.min(e,o-20):e},[r,l,a]);s.useEffect(()=>(we(),()=>{document.body.style.overflow=""}),[]);const[y,z]=s.useState(null),[x,R]=s.useState([]),[d,j]=s.useState(4),[b,S]=s.useState(!1),[g,C]=s.useState(1),[p,ie]=s.useState(null),[w,H]=s.useState("ready"),[P,U]=s.useState(3),[L,A]=s.useState(10),[W,V]=s.useState(20),[re,F]=s.useState(0),[B,G]=s.useState(!1),[E,_]=s.useState(""),[k,$]=s.useState(!1),[N,K]=s.useState(!1),[J,M]=s.useState(null),[le,O]=s.useState([]),[ae,Q]=s.useState([]),[h,de]=s.useState(!1);s.useEffect(()=>{if(typeof window>"u")return;const e=()=>{const o=l??window.innerWidth,u=window.matchMedia&&window.matchMedia("(pointer: coarse)").matches;de(o<=768||u)};return e(),window.addEventListener("resize",e),window.addEventListener("orientationchange",e),()=>{window.removeEventListener("resize",e),window.removeEventListener("orientationchange",e)}},[l]),s.useLayoutEffect(()=>{const e=m.current;if(!e||typeof window>"u")return;let o=null;try{o=new ResizeObserver(u=>{for(const f of u){const v=f.contentRect;T(Math.round(Math.min(v.width,v.height)))}}),o.observe(e),T(Math.round(Math.min(e.clientWidth,e.clientHeight)))}catch{T(Math.round(Math.min(e.clientWidth,e.clientHeight)))}return()=>o?.disconnect()},[h]);const X=e=>[...e].sort(()=>Math.random()-.5).slice(0,6),ee=()=>{if(!y)return;const e=X(Z[y]);R(e),S(!0),G(!1),C(1),F(0),O([]),Q([]),te(e,[],!0)},te=(e=x,o=ae,u=!1)=>{const f=X(e.length?e:Z[y]);let v=Math.floor(Math.random()*f.length),q=f[v].name,se=0;for(;o.includes(q)&&se<20;)v=Math.floor(Math.random()*f.length),q=f[v].name,se++;R(f),ie(v),Q([...o,q]),$(!1),_(""),V(20),M(null),u?(H("ready"),U(3),A(10)):(H("memorize"),A(10))};s.useEffect(()=>{if(!(!b||B||k)){if(w==="ready")if(P<=0)H("memorize");else{const e=setTimeout(()=>U(o=>o-1),1e3);return()=>clearTimeout(e)}if(w==="memorize")if(L<=0)H("guess");else{const e=setTimeout(()=>A(o=>o-1),1e3);return()=>clearTimeout(e)}if(w==="guess"){if(W<=0){$(!0),M("wrong");const o=x[p].name;O(u=>[...u,{round:g,answer:E,correct:o,result:"wrong"}]);return}const e=setTimeout(()=>V(o=>o-1),1e3);return()=>clearTimeout(e)}}},[w,P,L,W,b,B,k,x,p,g,E]);const ce=()=>{if(p===null||N)return;const e=x[p].name,o=E.toLowerCase().trim();let u="wrong";o===e?(F(f=>f+1),M("correct"),u="correct"):je(o,e)===1?(F(f=>f+.5),M("almost"),u="almost"):(M("wrong"),u="wrong"),O(f=>[...f,{round:g,answer:o,correct:e,result:u}]),K(!0),setTimeout(()=>{K(!1),$(!0)},600)},me=()=>g<d?(C(e=>e+1),te()):G(!0),ue=()=>{S(!1),G(!1),z(null)},ge=s.useMemo(()=>t.jsx("div",{style:{...n.gmLogoFixed,position:"absolute",top:16,left:16,zIndex:30},children:t.jsxs("picture",{children:[t.jsx("source",{srcSet:window.origin+"/cloud/speakid/games/whatsmissing/logo.svg",type:"image/svg+xml"}),t.jsx("img",{src:window.origin+"/cloud/speakid/games/whatsmissing/logo.png",alt:"SPEAKID Logo",style:n.gmLogoImg,loading:"lazy"})]})}),[]),ne=1200,oe=700,D=s.useMemo(()=>{const e=l??(typeof window<"u"?window.innerWidth:ne),o=a??(typeof window<"u"?window.innerHeight:oe),u=Math.min(e/ne,o/oe);return Math.min(1.35,Math.max(1,u))},[l,a,h]);return t.jsx("div",{ref:i,style:{position:"fixed",inset:0,display:"flex",justifyContent:"center",alignItems:"center",background:"linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",overflow:"hidden",zIndex:1,width:"100vw",height:"100vh",transform:"none",zoom:1,scale:"1 !important"},children:t.jsx("div",{ref:m,style:{width:h?"100%":`${I}px`,height:h?"100%":`${I}px`,borderRadius:h?0:"20px",background:"linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",position:"relative",overflow:"hidden",boxShadow:h?"none":"0 0 40px rgba(0,0,0,0.08)",display:"flex",justifyContent:"center",alignItems:"center"},children:t.jsxs("div",{id:"whats-missing-root",style:{transform:`scale(${D})`,transformOrigin:"center center",transition:"transform 0.2s ease-out",width:`${100/D}%`,height:`${100/D}%`,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[!h&&ge,!y&&!b&&t.jsxs("div",{style:n.gmCenterScreen,children:[t.jsx("h1",{style:n.gmHeadline1,children:"WHAT'S MISSING?"}),t.jsx("p",{style:n.gmBodyM,children:"Select a theme:"}),t.jsx("div",{style:{display:"flex",gap:16},children:["animals","food","toys"].map(e=>t.jsx("button",{style:n.gmButton,onClick:()=>z(e),children:e==="animals"?"🐶 Animals":e==="food"?"🍎 Food":"🧸 Toys"},e))}),t.jsxs("div",{style:{marginTop:24},children:[t.jsx("p",{style:n.gmBodyS,children:"Choose number of rounds:"}),t.jsx("div",{style:{display:"flex",gap:12,marginTop:8},children:[3,4,5].map(e=>t.jsx("button",{style:{...n.gmButton,...d===e?n.gmButtonActive:{}},onClick:()=>j(e),children:e},e))})]})]}),y&&!b&&t.jsxs("div",{style:n.gmCenterScreen,children:[t.jsxs("h1",{style:n.gmHeadline1,children:["Theme selected: ",y]}),t.jsxs("p",{style:n.gmBodyM,children:["Rounds: ",d]}),t.jsx("button",{style:n.gmButton,onClick:ee,children:"▶ Start game"})]}),B&&t.jsxs("div",{style:n.gmCenterScreen,children:[t.jsx("h1",{style:n.gmHeadline1,children:"Results"}),t.jsxs("h2",{style:n.gmHeadline3,children:["Your score: ",re," / ",d]}),t.jsx("p",{style:{...n.gmBodyM,color:"#10b981",marginTop:12},children:"Yahoo! You did it! 🍬✨"}),t.jsxs("table",{style:n.gmTable,children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Round"}),t.jsx("th",{children:"Your Answer"}),t.jsx("th",{children:"Correct"}),t.jsx("th",{children:"Result"})]})}),t.jsx("tbody",{children:le.map((e,o)=>t.jsxs("tr",{children:[t.jsx("td",{style:n.gmTableCell,children:e.round}),t.jsx("td",{style:n.gmTableCell,children:e.answer||"—"}),t.jsx("td",{style:n.gmTableCell,children:e.correct}),t.jsx("td",{style:n.gmTableCell,children:e.result==="correct"?"✔ Correct":e.result==="almost"?"◐ Almost (0.5)":"✘ Wrong"})]},o))})]}),t.jsxs("div",{style:{display:"flex",gap:12,marginTop:24},children:[t.jsx("button",{style:n.gmButton,onClick:ee,children:"🔁 Play again"}),t.jsx("button",{style:n.gmButton,onClick:ue,children:"⬅️ Choose theme"})]})]}),b&&!B&&t.jsxs("div",{style:n.gmGameLayout,children:[t.jsxs("div",{style:{minHeight:160,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[w==="ready"&&t.jsxs(t.Fragment,{children:[t.jsx("h1",{style:{...n.gmHeadline1,color:"#ec4c44"},children:"GET READY"}),t.jsx("div",{style:n.gmHourglass,children:"⏳"})]}),w==="memorize"&&t.jsxs("p",{style:{...n.gmBodyM,color:"#10b981"},children:["MEMORIZE (",L,")"]}),w==="guess"&&!k&&t.jsxs("p",{style:n.gmBodyM,children:["⏳ Time left: ",W,"s"]})]}),w!=="ready"&&t.jsx("div",{style:{...n.gmGrid,display:"grid",gridTemplateColumns:`repeat(${h?2:3}, 1fr)`,gridTemplateRows:`repeat(${h?3:2}, 1fr)`,gap:h?12:20,justifyContent:"center",alignContent:"center",padding:h?8:16,width:"100%",height:"100%",maxWidth:h?"100%":600,maxHeight:h?"100%":400,boxSizing:"border-box"},children:x.map((e,o)=>{const u=p===o&&w==="guess"&&!k;return t.jsx("div",{style:{...n.gmCard,width:"100%",height:"100%",...J==="correct"&&p===o?n.gmCorrect:{},...J==="wrong"&&p===o?n.gmWrong:{}},children:!u&&t.jsx("img",{src:e.src,alt:e.name,style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}})},o)})}),t.jsxs("div",{style:{marginTop:16,height:80},children:[w==="guess"&&!k&&t.jsxs("div",{children:[t.jsx("input",{type:"text",placeholder:"Type the missing word",value:E,onChange:e=>_(e.target.value),style:n.gmInput}),t.jsx("button",{style:{...n.gmButton,marginLeft:8},onClick:ce,disabled:N,children:N?"...":"Check"})]}),k&&t.jsx("button",{type:"button",style:n.gmButton,onClick:me,children:"Next round"})]})]})]})})})}exports.Game=ve;exports.themes=Z;
9
+ `,document.head.appendChild(l)},je=(l,m)=>{const r=Array.from({length:l.length+1},()=>Array(m.length+1).fill(0));for(let i=0;i<=l.length;i++)r[i][0]=i;for(let i=0;i<=m.length;i++)r[0][i]=i;for(let i=1;i<=l.length;i++)for(let g=1;g<=m.length;g++)r[i][g]=l[i-1]===m[g-1]?r[i-1][g-1]:Math.min(r[i-1][g-1],r[i][g-1],r[i-1][g])+1;return r[l.length][m.length]};function Se(l,m={minDesktopWidth:1200,forceResize:!1}){const r=s.useRef(null),i=m.minDesktopWidth??1200,g=!!m.forceResize;s.useLayoutEffect(()=>{if(typeof window>"u"||!l||!l.current)return;const c=l.current,T=()=>{try{const a=document.body,j=getComputedStyle(a),b=parseFloat(a.style&&a.style.zoom||"");if(b&&!isNaN(b)&&b>0)return b;const v=parseFloat(j.zoom||"");if(v&&!isNaN(v)&&v>0)return v;const h=document.createElement("div");h.style.position="absolute",h.style.left="0",h.style.top="0",h.style.width="100px",h.style.height="1px",h.style.visibility="hidden",document.documentElement.appendChild(h);const C=h.getBoundingClientRect();if(document.documentElement.removeChild(h),C&&C.width>0){const p=C.width/100;if(!isNaN(p)&&p>0)return p}}catch{}return 1},H=()=>{if(i&&window.innerWidth<i){y();return}const a=T();if(!a||a===1){y();return}r.current||(r.current={transform:c.style.transform||null,transformOrigin:c.style.transformOrigin||null,width:c.style.width||null,height:c.style.height||null,willChange:c.style.willChange||null});const j=1/a;g&&(c.style.width=`${a*100}%`,c.style.height=`${a*100}%`),c.style.transformOrigin="50% 50%",c.style.transform=`scale(${j})`,c.style.willChange="transform"},y=()=>{if(!r.current)return;const a=r.current;c.style.transform=a.transform??"",c.style.transformOrigin=a.transformOrigin??"",c.style.width=a.width??"",c.style.height=a.height??"",c.style.willChange=a.willChange??"",r.current=null};let z=0;const x=()=>{cancelAnimationFrame(z),z=requestAnimationFrame(H)},R=new MutationObserver(a=>{for(const j of a)if(j.type==="attributes"&&(j.attributeName==="style"||j.attributeName==="class")){x();break}});return R.observe(document.body,{attributes:!0,attributeFilter:["style","class"]}),window.addEventListener("resize",x),x(),()=>{cancelAnimationFrame(z),R.disconnect(),window.removeEventListener("resize",x),y()}},[l,i,g])}function ve({gameCubeSize:l,screenHeight:m,screenWidth:r}){const i=s.useRef(null),g=s.useRef(null),[c,T]=s.useState(null);Se(i,{minDesktopWidth:1024,forceResize:!1}),s.useEffect(()=>{const e=document.body,n=document.documentElement,d=e.style.zoom,u=e.style.transform,S=n.style.zoom,I=n.style.transform;return e.style.zoom="1",e.style.transform="none",n.style.zoom="1",n.style.transform="none",()=>{e.style.zoom=d,e.style.transform=u,n.style.zoom=S,n.style.transform=I}},[]);const H=s.useMemo(()=>{const e=l??Math.min(r??1e3,m??1e3),n=r??(typeof window<"u"?window.innerWidth:1e3);return e<600&&n>768?600:n<=768?Math.min(e,n-20):e},[l,r,m]);s.useEffect(()=>(we(),()=>{document.body.style.overflow=""}),[]);const[y,z]=s.useState(null),[x,R]=s.useState([]),[a,j]=s.useState(4),[b,v]=s.useState(!1),[h,C]=s.useState(1),[p,ie]=s.useState(null),[w,B]=s.useState("ready"),[Z,U]=s.useState(3),[A,W]=s.useState(10),[F,V]=s.useState(20),[re,G]=s.useState(0),[E,$]=s.useState(!1),[L,_]=s.useState(""),[k,N]=s.useState(!1),[O,K]=s.useState(!1),[J,M]=s.useState(null),[le,D]=s.useState([]),[ae,Q]=s.useState([]),[f,de]=s.useState(!1);s.useEffect(()=>{if(typeof window>"u")return;const e=()=>{const n=r??window.innerWidth,d=window.matchMedia&&window.matchMedia("(pointer: coarse)").matches;de(n<=768||d)};return e(),window.addEventListener("resize",e),window.addEventListener("orientationchange",e),()=>{window.removeEventListener("resize",e),window.removeEventListener("orientationchange",e)}},[r]),s.useLayoutEffect(()=>{const e=g.current;if(!e||typeof window>"u")return;let n=null;try{n=new ResizeObserver(d=>{for(const u of d){const S=u.contentRect;T(Math.round(Math.min(S.width,S.height)))}}),n.observe(e),T(Math.round(Math.min(e.clientWidth,e.clientHeight)))}catch{T(Math.round(Math.min(e.clientWidth,e.clientHeight)))}return()=>n?.disconnect()},[f]);const X=e=>[...e].sort(()=>Math.random()-.5).slice(0,6),ee=()=>{if(!y)return;const e=X(P[y]);R(e),v(!0),$(!1),C(1),G(0),D([]),Q([]),te(e,[],!0)},te=(e=x,n=ae,d=!1)=>{const u=X(e.length?e:P[y]);let S=Math.floor(Math.random()*u.length),I=u[S].name,se=0;for(;n.includes(I)&&se<20;)S=Math.floor(Math.random()*u.length),I=u[S].name,se++;R(u),ie(S),Q([...n,I]),N(!1),_(""),V(20),M(null),d?(B("ready"),U(3),W(10)):(B("memorize"),W(10))};s.useEffect(()=>{if(!(!b||E||k)){if(w==="ready")if(Z<=0)B("memorize");else{const e=setTimeout(()=>U(n=>n-1),1e3);return()=>clearTimeout(e)}if(w==="memorize")if(A<=0)B("guess");else{const e=setTimeout(()=>W(n=>n-1),1e3);return()=>clearTimeout(e)}if(w==="guess"){if(F<=0){N(!0),M("wrong");const n=x[p].name;D(d=>[...d,{round:h,answer:L,correct:n,result:"wrong"}]);return}const e=setTimeout(()=>V(n=>n-1),1e3);return()=>clearTimeout(e)}}},[w,Z,A,F,b,E,k,x,p,h,L]);const ce=()=>{if(p===null||O)return;const e=x[p].name,n=L.toLowerCase().trim();let d="wrong";n===e?(G(u=>u+1),M("correct"),d="correct"):je(n,e)===1?(G(u=>u+.5),M("almost"),d="almost"):(M("wrong"),d="wrong"),D(u=>[...u,{round:h,answer:n,correct:e,result:d}]),K(!0),setTimeout(()=>{K(!1),N(!0)},600)},me=()=>h<a?(C(e=>e+1),te()):$(!0),ue=()=>{v(!1),$(!1),z(null)},ge=s.useMemo(()=>t.jsx("div",{style:{...o.gmLogoFixed,position:"absolute",top:16,left:16,zIndex:30},children:t.jsxs("picture",{children:[t.jsx("source",{srcSet:window.origin+"/cloud/speakid/games/whatsmissing/logo.svg",type:"image/svg+xml"}),t.jsx("img",{src:window.origin+"/cloud/speakid/games/whatsmissing/logo.png",alt:"SPEAKID Logo",style:o.gmLogoImg,loading:"lazy"})]})}),[]),ne=1200,oe=700,q=s.useMemo(()=>{const e=r??(typeof window<"u"?window.innerWidth:ne),n=m??(typeof window<"u"?window.innerHeight:oe),d=Math.min(e/ne,n/oe);return Math.min(1.35,Math.max(1,d))},[r,m,f]);return t.jsx("div",{ref:i,style:{position:"fixed",inset:0,display:"flex",justifyContent:"center",alignItems:"center",background:"linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",overflow:"hidden",zIndex:1,width:"100vw",height:"100vh",transform:"none",zoom:1,scale:"1 !important"},children:t.jsx("div",{ref:g,style:{width:f?"100%":`${H}px`,height:f?"100%":`${H}px`,borderRadius:f?0:"20px",background:"linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",position:"relative",overflow:"hidden",boxShadow:f?"none":"0 0 40px rgba(0,0,0,0.08)",display:"flex",justifyContent:"center",alignItems:"center"},children:t.jsxs("div",{id:"whats-missing-root",style:{transform:`scale(${q})`,transformOrigin:"center center",transition:"transform 0.2s ease-out",width:`${100/q}%`,height:`${100/q}%`,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[!f&&ge,!y&&!b&&t.jsxs("div",{style:o.gmCenterScreen,children:[t.jsx("h1",{style:o.gmHeadline1,children:"WHAT'S MISSING?"}),t.jsx("p",{style:o.gmBodyM,children:"Select a theme:"}),t.jsx("div",{style:{display:"flex",gap:16},children:["animals","food","toys"].map(e=>t.jsx("button",{style:o.gmButton,onClick:()=>z(e),children:e==="animals"?"🐶 Animals":e==="food"?"🍎 Food":"🧸 Toys"},e))}),t.jsxs("div",{style:{marginTop:24},children:[t.jsx("p",{style:o.gmBodyS,children:"Choose number of rounds:"}),t.jsx("div",{style:{display:"flex",gap:12,marginTop:8},children:[3,4,5].map(e=>t.jsx("button",{style:{...o.gmButton,...a===e?o.gmButtonActive:{}},onClick:()=>j(e),children:e},e))})]})]}),y&&!b&&t.jsxs("div",{style:o.gmCenterScreen,children:[t.jsxs("h1",{style:o.gmHeadline1,children:["Theme selected: ",y]}),t.jsxs("p",{style:o.gmBodyM,children:["Rounds: ",a]}),t.jsx("button",{style:o.gmButton,onClick:ee,children:"▶ Start game"})]}),E&&t.jsxs("div",{style:o.gmCenterScreen,children:[t.jsx("h1",{style:o.gmHeadline1,children:"Results"}),t.jsxs("h2",{style:o.gmHeadline3,children:["Your score: ",re," / ",a]}),t.jsx("p",{style:{...o.gmBodyM,color:"#10b981",marginTop:12},children:"Yahoo! You did it! 🍬✨"}),t.jsxs("table",{style:o.gmTable,children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Round"}),t.jsx("th",{children:"Your Answer"}),t.jsx("th",{children:"Correct"}),t.jsx("th",{children:"Result"})]})}),t.jsx("tbody",{children:le.map((e,n)=>t.jsxs("tr",{children:[t.jsx("td",{style:o.gmTableCell,children:e.round}),t.jsx("td",{style:o.gmTableCell,children:e.answer||"—"}),t.jsx("td",{style:o.gmTableCell,children:e.correct}),t.jsx("td",{style:o.gmTableCell,children:e.result==="correct"?"✔ Correct":e.result==="almost"?"◐ Almost (0.5)":"✘ Wrong"})]},n))})]}),t.jsxs("div",{style:{display:"flex",gap:12,marginTop:24},children:[t.jsx("button",{style:o.gmButton,onClick:ee,children:"🔁 Play again"}),t.jsx("button",{style:o.gmButton,onClick:ue,children:"⬅️ Choose theme"})]})]}),b&&!E&&t.jsxs("div",{style:o.gmGameLayout,children:[t.jsxs("div",{style:{minHeight:160,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[w==="ready"&&t.jsxs(t.Fragment,{children:[t.jsx("h1",{style:{...o.gmHeadline1,color:"#ec4c44"},children:"GET READY"}),t.jsx("div",{style:o.gmHourglass,children:"⏳"})]}),w==="memorize"&&t.jsxs("p",{style:{...o.gmBodyM,color:"#10b981"},children:["MEMORIZE (",A,")"]}),w==="guess"&&!k&&t.jsxs("p",{style:o.gmBodyM,children:["⏳ Time left: ",F,"s"]})]}),w!=="ready"&&t.jsx("div",{style:{...o.gmGrid,display:"grid",gridTemplateColumns:`repeat(${f?2:3}, 1fr)`,gridTemplateRows:`repeat(${f?3:2}, 1fr)`,gap:f?12:20,justifyContent:"center",alignContent:"center",padding:f?8:16,width:"100%",height:"100%",maxWidth:f?"100%":600,maxHeight:f?"100%":400,boxSizing:"border-box"},children:x.map((e,n)=>{const d=p===n&&w==="guess"&&!k;return t.jsx("div",{style:{...o.gmCard,width:"100%",height:"100%",...J==="correct"&&p===n?o.gmCorrect:{},...J==="wrong"&&p===n?o.gmWrong:{}},children:!d&&t.jsx("img",{src:e.src,alt:e.name,style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}})},n)})}),t.jsxs("div",{style:{marginTop:16,height:80},children:[w==="guess"&&!k&&t.jsxs("div",{children:[t.jsx("input",{type:"text",placeholder:"Type the missing word",value:L,onChange:e=>_(e.target.value),style:o.gmInput}),t.jsx("button",{style:{...o.gmButton,marginLeft:8},onClick:ce,disabled:O,children:O?"...":"Check"})]}),k&&t.jsx("button",{type:"button",style:o.gmButton,onClick:me,children:"Next round"})]})]})]})})})}exports.Game=ve;exports.themes=P;
@@ -1,7 +1,7 @@
1
- import { jsx as n, jsxs as d, Fragment as be } from "react/jsx-runtime";
2
- import { useEffect as W, useRef as V, useState as c, useMemo as P, useLayoutEffect as de } from "react";
3
- const xe = window.origin + "/cloud/speakid/games/whatsmissing/", U = (r, l) => r.map(([s, i]) => ({
4
- src: `${xe}${l}/${i.replace(/\s/g, "%20")}.png`,
1
+ import { jsx as o, jsxs as a, Fragment as be } from "react/jsx-runtime";
2
+ import { useRef as V, useState as d, useEffect as j, useMemo as P, useLayoutEffect as de } from "react";
3
+ const xe = window.origin + "/cloud/speakid/games/whatsmissing/", U = (s, u) => s.map(([r, i]) => ({
4
+ src: `${xe}${u}/${i.replace(/\s/g, "%20")}.png`,
5
5
  name: i
6
6
  })), ve = [
7
7
  ["apple", "apple"],
@@ -80,12 +80,12 @@ const xe = window.origin + "/cloud/speakid/games/whatsmissing/", U = (r, l) => r
80
80
  }
81
81
  `;
82
82
  if (typeof document < "u" && !document.getElementById("spin-keyframes")) {
83
- const r = document.createElement("style");
84
- r.id = "spin-keyframes", r.innerHTML = ke, document.head.appendChild(r);
83
+ const s = document.createElement("style");
84
+ s.id = "spin-keyframes", s.innerHTML = ke, document.head.appendChild(s);
85
85
  }
86
86
  const Se = {
87
87
  animation: "spin 1.4s linear infinite"
88
- }, t = {
88
+ }, n = {
89
89
  gmCenterScreen: {
90
90
  position: "relative",
91
91
  zIndex: 1,
@@ -241,77 +241,70 @@ const Se = {
241
241
  fontSize: "42px",
242
242
  ...Se
243
243
  }
244
- };
245
- W(() => {
246
- const r = document.body, l = document.documentElement, s = r.style.zoom, i = r.style.transform, u = l.style.zoom, m = l.style.transform;
247
- return r.style.zoom = "1", r.style.transform = "none", l.style.zoom = "1", l.style.transform = "none", console.log("Zoom and transform neutralized globally."), () => {
248
- r.style.zoom = s, r.style.transform = i, l.style.zoom = u, l.style.transform = m;
249
- };
250
- }, []);
251
- const Te = () => {
252
- const r = document.createElement("style");
253
- r.textContent = `
244
+ }, Te = () => {
245
+ const s = document.createElement("style");
246
+ s.textContent = `
254
247
  #whats-missing-root, #whats-missing-root * { box-sizing: border-box; }
255
248
  #whats-missing-root img { max-width:100%; height:auto; display:block; user-select:none; }
256
- `, document.head.appendChild(r);
257
- }, Re = (r, l) => {
258
- const s = Array.from({ length: r.length + 1 }, () => Array(l.length + 1).fill(0));
259
- for (let i = 0; i <= r.length; i++) s[i][0] = i;
260
- for (let i = 0; i <= l.length; i++) s[0][i] = i;
261
- for (let i = 1; i <= r.length; i++)
262
- for (let u = 1; u <= l.length; u++)
263
- s[i][u] = r[i - 1] === l[u - 1] ? s[i - 1][u - 1] : Math.min(s[i - 1][u - 1], s[i][u - 1], s[i - 1][u]) + 1;
264
- return s[r.length][l.length];
249
+ `, document.head.appendChild(s);
250
+ }, Re = (s, u) => {
251
+ const r = Array.from({ length: s.length + 1 }, () => Array(u.length + 1).fill(0));
252
+ for (let i = 0; i <= s.length; i++) r[i][0] = i;
253
+ for (let i = 0; i <= u.length; i++) r[0][i] = i;
254
+ for (let i = 1; i <= s.length; i++)
255
+ for (let h = 1; h <= u.length; h++)
256
+ r[i][h] = s[i - 1] === u[h - 1] ? r[i - 1][h - 1] : Math.min(r[i - 1][h - 1], r[i][h - 1], r[i - 1][h]) + 1;
257
+ return r[s.length][u.length];
265
258
  };
266
- function Me(r, l = { minDesktopWidth: 1200, forceResize: !1 }) {
267
- const s = V(null), i = l.minDesktopWidth ?? 1200, u = !!l.forceResize;
259
+ function Me(s, u = { minDesktopWidth: 1200, forceResize: !1 }) {
260
+ const r = V(null), i = u.minDesktopWidth ?? 1200, h = !!u.forceResize;
268
261
  de(() => {
269
- if (typeof window > "u" || !r || !r.current) return;
270
- const m = r.current, M = () => {
262
+ if (typeof window > "u" || !s || !s.current) return;
263
+ const m = s.current, M = () => {
271
264
  try {
272
- const a = document.body, z = getComputedStyle(a), x = parseFloat(a.style && a.style.zoom || "");
265
+ const l = document.body, z = getComputedStyle(l), x = parseFloat(l.style && l.style.zoom || "");
273
266
  if (x && !isNaN(x) && x > 0) return x;
274
- const C = parseFloat(z.zoom || "");
275
- if (C && !isNaN(C) && C > 0) return C;
276
- const h = document.createElement("div");
277
- h.style.position = "absolute", h.style.left = "0", h.style.top = "0", h.style.width = "100px", h.style.height = "1px", h.style.visibility = "hidden", document.documentElement.appendChild(h);
278
- const T = h.getBoundingClientRect();
279
- if (document.documentElement.removeChild(h), T && T.width > 0) {
267
+ const k = parseFloat(z.zoom || "");
268
+ if (k && !isNaN(k) && k > 0) return k;
269
+ const f = document.createElement("div");
270
+ f.style.position = "absolute", f.style.left = "0", f.style.top = "0", f.style.width = "100px", f.style.height = "1px", f.style.visibility = "hidden", document.documentElement.appendChild(f);
271
+ const T = f.getBoundingClientRect();
272
+ if (document.documentElement.removeChild(f), T && T.width > 0) {
280
273
  const y = T.width / 100;
281
274
  if (!isNaN(y) && y > 0) return y;
282
275
  }
283
276
  } catch {
284
277
  }
285
278
  return 1;
286
- }, B = () => {
279
+ }, L = () => {
287
280
  if (i && window.innerWidth < i) {
288
281
  w();
289
282
  return;
290
283
  }
291
- const a = M();
292
- if (!a || a === 1) {
284
+ const l = M();
285
+ if (!l || l === 1) {
293
286
  w();
294
287
  return;
295
288
  }
296
- s.current || (s.current = {
289
+ r.current || (r.current = {
297
290
  transform: m.style.transform || null,
298
291
  transformOrigin: m.style.transformOrigin || null,
299
292
  width: m.style.width || null,
300
293
  height: m.style.height || null,
301
294
  willChange: m.style.willChange || null
302
295
  });
303
- const z = 1 / a;
304
- u && (m.style.width = `${a * 100}%`, m.style.height = `${a * 100}%`), m.style.transformOrigin = "50% 50%", m.style.transform = `scale(${z})`, m.style.willChange = "transform";
296
+ const z = 1 / l;
297
+ h && (m.style.width = `${l * 100}%`, m.style.height = `${l * 100}%`), m.style.transformOrigin = "50% 50%", m.style.transform = `scale(${z})`, m.style.willChange = "transform";
305
298
  }, w = () => {
306
- if (!s.current) return;
307
- const a = s.current;
308
- m.style.transform = a.transform ?? "", m.style.transformOrigin = a.transformOrigin ?? "", m.style.width = a.width ?? "", m.style.height = a.height ?? "", m.style.willChange = a.willChange ?? "", s.current = null;
299
+ if (!r.current) return;
300
+ const l = r.current;
301
+ m.style.transform = l.transform ?? "", m.style.transformOrigin = l.transformOrigin ?? "", m.style.width = l.width ?? "", m.style.height = l.height ?? "", m.style.willChange = l.willChange ?? "", r.current = null;
309
302
  };
310
303
  let S = 0;
311
304
  const b = () => {
312
- cancelAnimationFrame(S), S = requestAnimationFrame(B);
313
- }, I = new MutationObserver((a) => {
314
- for (const z of a)
305
+ cancelAnimationFrame(S), S = requestAnimationFrame(L);
306
+ }, I = new MutationObserver((l) => {
307
+ for (const z of l)
315
308
  if (z.type === "attributes" && (z.attributeName === "style" || z.attributeName === "class")) {
316
309
  b();
317
310
  break;
@@ -320,122 +313,127 @@ function Me(r, l = { minDesktopWidth: 1200, forceResize: !1 }) {
320
313
  return I.observe(document.body, { attributes: !0, attributeFilter: ["style", "class"] }), window.addEventListener("resize", b), b(), () => {
321
314
  cancelAnimationFrame(S), I.disconnect(), window.removeEventListener("resize", b), w();
322
315
  };
323
- }, [r, i, u]);
316
+ }, [s, i, h]);
324
317
  }
325
318
  function Be({
326
- gameCubeSize: r,
327
- screenHeight: l,
328
- screenWidth: s
319
+ gameCubeSize: s,
320
+ screenHeight: u,
321
+ screenWidth: r
329
322
  }) {
330
- const i = V(null), u = V(null), [m, M] = c(null);
331
- Me(i, { minDesktopWidth: 1024, forceResize: !1 });
332
- const B = P(() => {
333
- const e = r ?? Math.min(s ?? 1e3, l ?? 1e3), o = s ?? (typeof window < "u" ? window.innerWidth : 1e3);
334
- return e < 600 && o > 768 ? 600 : o <= 768 ? Math.min(e, o - 20) : e;
335
- }, [r, s, l]);
336
- W(() => (Te(), () => {
323
+ const i = V(null), h = V(null), [m, M] = d(null);
324
+ Me(i, { minDesktopWidth: 1024, forceResize: !1 }), j(() => {
325
+ const e = document.body, t = document.documentElement, c = e.style.zoom, g = e.style.transform, C = t.style.zoom, B = t.style.transform;
326
+ return e.style.zoom = "1", e.style.transform = "none", t.style.zoom = "1", t.style.transform = "none", () => {
327
+ e.style.zoom = c, e.style.transform = g, t.style.zoom = C, t.style.transform = B;
328
+ };
329
+ }, []);
330
+ const L = P(() => {
331
+ const e = s ?? Math.min(r ?? 1e3, u ?? 1e3), t = r ?? (typeof window < "u" ? window.innerWidth : 1e3);
332
+ return e < 600 && t > 768 ? 600 : t <= 768 ? Math.min(e, t - 20) : e;
333
+ }, [s, r, u]);
334
+ j(() => (Te(), () => {
337
335
  document.body.style.overflow = "";
338
336
  }), []);
339
- const [w, S] = c(null), [b, I] = c([]), [a, z] = c(4), [x, C] = c(!1), [h, T] = c(1), [y, ce] = c(null), [v, L] = c("ready"), [_, K] = c(3), [j, F] = c(10), [$, J] = c(20), [me, G] = c(0), [A, N] = c(!1), [E, Q] = c(""), [R, D] = c(!1), [O, X] = c(!1), [ee, H] = c(null), [ue, q] = c([]), [ge, te] = c([]), [f, he] = c(!1);
340
- W(() => {
337
+ const [w, S] = d(null), [b, I] = d([]), [l, z] = d(4), [x, k] = d(!1), [f, T] = d(1), [y, ce] = d(null), [v, A] = d("ready"), [_, K] = d(3), [F, $] = d(10), [G, J] = d(20), [me, N] = d(0), [E, D] = d(!1), [W, Q] = d(""), [R, O] = d(!1), [q, X] = d(!1), [ee, H] = d(null), [ue, Y] = d([]), [ge, te] = d([]), [p, he] = d(!1);
338
+ j(() => {
341
339
  if (typeof window > "u") return;
342
340
  const e = () => {
343
- const o = s ?? window.innerWidth, g = window.matchMedia && window.matchMedia("(pointer: coarse)").matches;
344
- he(o <= 768 || g);
341
+ const t = r ?? window.innerWidth, c = window.matchMedia && window.matchMedia("(pointer: coarse)").matches;
342
+ he(t <= 768 || c);
345
343
  };
346
344
  return e(), window.addEventListener("resize", e), window.addEventListener("orientationchange", e), () => {
347
345
  window.removeEventListener("resize", e), window.removeEventListener("orientationchange", e);
348
346
  };
349
- }, [s]), de(() => {
350
- const e = u.current;
347
+ }, [r]), de(() => {
348
+ const e = h.current;
351
349
  if (!e || typeof window > "u") return;
352
- let o = null;
350
+ let t = null;
353
351
  try {
354
- o = new ResizeObserver((g) => {
355
- for (const p of g) {
356
- const k = p.contentRect;
357
- M(Math.round(Math.min(k.width, k.height)));
352
+ t = new ResizeObserver((c) => {
353
+ for (const g of c) {
354
+ const C = g.contentRect;
355
+ M(Math.round(Math.min(C.width, C.height)));
358
356
  }
359
- }), o.observe(e), M(Math.round(Math.min(e.clientWidth, e.clientHeight)));
357
+ }), t.observe(e), M(Math.round(Math.min(e.clientWidth, e.clientHeight)));
360
358
  } catch {
361
359
  M(Math.round(Math.min(e.clientWidth, e.clientHeight)));
362
360
  }
363
- return () => o?.disconnect();
364
- }, [f]);
361
+ return () => t?.disconnect();
362
+ }, [p]);
365
363
  const ne = (e) => [...e].sort(() => Math.random() - 0.5).slice(0, 6), oe = () => {
366
364
  if (!w) return;
367
365
  const e = ne(ae[w]);
368
- I(e), C(!0), N(!1), T(1), G(0), q([]), te([]), ie(e, [], !0);
369
- }, ie = (e = b, o = ge, g = !1) => {
370
- const p = ne(e.length ? e : ae[w]);
371
- let k = Math.floor(Math.random() * p.length), Z = p[k].name, le = 0;
372
- for (; o.includes(Z) && le < 20; )
373
- k = Math.floor(Math.random() * p.length), Z = p[k].name, le++;
374
- I(p), ce(k), te([...o, Z]), D(!1), Q(""), J(20), H(null), g ? (L("ready"), K(3), F(10)) : (L("memorize"), F(10));
366
+ I(e), k(!0), D(!1), T(1), N(0), Y([]), te([]), ie(e, [], !0);
367
+ }, ie = (e = b, t = ge, c = !1) => {
368
+ const g = ne(e.length ? e : ae[w]);
369
+ let C = Math.floor(Math.random() * g.length), B = g[C].name, le = 0;
370
+ for (; t.includes(B) && le < 20; )
371
+ C = Math.floor(Math.random() * g.length), B = g[C].name, le++;
372
+ I(g), ce(C), te([...t, B]), O(!1), Q(""), J(20), H(null), c ? (A("ready"), K(3), $(10)) : (A("memorize"), $(10));
375
373
  };
376
- W(() => {
377
- if (!(!x || A || R)) {
374
+ j(() => {
375
+ if (!(!x || E || R)) {
378
376
  if (v === "ready")
379
- if (_ <= 0) L("memorize");
377
+ if (_ <= 0) A("memorize");
380
378
  else {
381
- const e = setTimeout(() => K((o) => o - 1), 1e3);
379
+ const e = setTimeout(() => K((t) => t - 1), 1e3);
382
380
  return () => clearTimeout(e);
383
381
  }
384
382
  if (v === "memorize")
385
- if (j <= 0) L("guess");
383
+ if (F <= 0) A("guess");
386
384
  else {
387
- const e = setTimeout(() => F((o) => o - 1), 1e3);
385
+ const e = setTimeout(() => $((t) => t - 1), 1e3);
388
386
  return () => clearTimeout(e);
389
387
  }
390
388
  if (v === "guess") {
391
- if ($ <= 0) {
392
- D(!0), H("wrong");
393
- const o = b[y].name;
394
- q((g) => [
395
- ...g,
396
- { round: h, answer: E, correct: o, result: "wrong" }
389
+ if (G <= 0) {
390
+ O(!0), H("wrong");
391
+ const t = b[y].name;
392
+ Y((c) => [
393
+ ...c,
394
+ { round: f, answer: W, correct: t, result: "wrong" }
397
395
  ]);
398
396
  return;
399
397
  }
400
- const e = setTimeout(() => J((o) => o - 1), 1e3);
398
+ const e = setTimeout(() => J((t) => t - 1), 1e3);
401
399
  return () => clearTimeout(e);
402
400
  }
403
401
  }
404
- }, [v, _, j, $, x, A, R, b, y, h, E]);
402
+ }, [v, _, F, G, x, E, R, b, y, f, W]);
405
403
  const fe = () => {
406
- if (y === null || O) return;
407
- const e = b[y].name, o = E.toLowerCase().trim();
408
- let g = "wrong";
409
- o === e ? (G((p) => p + 1), H("correct"), g = "correct") : Re(o, e) === 1 ? (G((p) => p + 0.5), H("almost"), g = "almost") : (H("wrong"), g = "wrong"), q((p) => [...p, { round: h, answer: o, correct: e, result: g }]), X(!0), setTimeout(() => {
410
- X(!1), D(!0);
404
+ if (y === null || q) return;
405
+ const e = b[y].name, t = W.toLowerCase().trim();
406
+ let c = "wrong";
407
+ t === e ? (N((g) => g + 1), H("correct"), c = "correct") : Re(t, e) === 1 ? (N((g) => g + 0.5), H("almost"), c = "almost") : (H("wrong"), c = "wrong"), Y((g) => [...g, { round: f, answer: t, correct: e, result: c }]), X(!0), setTimeout(() => {
408
+ X(!1), O(!0);
411
409
  }, 600);
412
- }, pe = () => h < a ? (T((e) => e + 1), ie()) : N(!0), ye = () => {
413
- C(!1), N(!1), S(null);
410
+ }, pe = () => f < l ? (T((e) => e + 1), ie()) : D(!0), ye = () => {
411
+ k(!1), D(!1), S(null);
414
412
  }, we = P(
415
- () => /* @__PURE__ */ n("div", { style: { ...t.gmLogoFixed, position: "absolute", top: 16, left: 16, zIndex: 30 }, children: /* @__PURE__ */ d("picture", { children: [
416
- /* @__PURE__ */ n(
413
+ () => /* @__PURE__ */ o("div", { style: { ...n.gmLogoFixed, position: "absolute", top: 16, left: 16, zIndex: 30 }, children: /* @__PURE__ */ a("picture", { children: [
414
+ /* @__PURE__ */ o(
417
415
  "source",
418
416
  {
419
417
  srcSet: window.origin + "/cloud/speakid/games/whatsmissing/logo.svg",
420
418
  type: "image/svg+xml"
421
419
  }
422
420
  ),
423
- /* @__PURE__ */ n(
421
+ /* @__PURE__ */ o(
424
422
  "img",
425
423
  {
426
424
  src: window.origin + "/cloud/speakid/games/whatsmissing/logo.png",
427
425
  alt: "SPEAKID Logo",
428
- style: t.gmLogoImg,
426
+ style: n.gmLogoImg,
429
427
  loading: "lazy"
430
428
  }
431
429
  )
432
430
  ] }) }),
433
431
  []
434
- ), re = 1200, se = 700, Y = P(() => {
435
- const e = s ?? (typeof window < "u" ? window.innerWidth : re), o = l ?? (typeof window < "u" ? window.innerHeight : se), g = Math.min(e / re, o / se);
436
- return Math.min(1.35, Math.max(1, g));
437
- }, [s, l, f]);
438
- return /* @__PURE__ */ n(
432
+ ), re = 1200, se = 700, Z = P(() => {
433
+ const e = r ?? (typeof window < "u" ? window.innerWidth : re), t = u ?? (typeof window < "u" ? window.innerHeight : se), c = Math.min(e / re, t / se);
434
+ return Math.min(1.35, Math.max(1, c));
435
+ }, [r, u, p]);
436
+ return /* @__PURE__ */ o(
439
437
  "div",
440
438
  {
441
439
  ref: i,
@@ -456,51 +454,51 @@ function Be({
456
454
  scale: "1 !important"
457
455
  // ✅ на случай если transform тянется сверху
458
456
  },
459
- children: /* @__PURE__ */ n(
457
+ children: /* @__PURE__ */ o(
460
458
  "div",
461
459
  {
462
- ref: u,
460
+ ref: h,
463
461
  style: {
464
- width: f ? "100%" : `${B}px`,
465
- height: f ? "100%" : `${B}px`,
466
- borderRadius: f ? 0 : "20px",
462
+ width: p ? "100%" : `${L}px`,
463
+ height: p ? "100%" : `${L}px`,
464
+ borderRadius: p ? 0 : "20px",
467
465
  background: "linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",
468
466
  position: "relative",
469
467
  overflow: "hidden",
470
- boxShadow: f ? "none" : "0 0 40px rgba(0,0,0,0.08)",
468
+ boxShadow: p ? "none" : "0 0 40px rgba(0,0,0,0.08)",
471
469
  display: "flex",
472
470
  justifyContent: "center",
473
471
  alignItems: "center"
474
472
  },
475
- children: /* @__PURE__ */ d(
473
+ children: /* @__PURE__ */ a(
476
474
  "div",
477
475
  {
478
476
  id: "whats-missing-root",
479
477
  style: {
480
- transform: `scale(${Y})`,
478
+ transform: `scale(${Z})`,
481
479
  transformOrigin: "center center",
482
480
  transition: "transform 0.2s ease-out",
483
- width: `${100 / Y}%`,
484
- height: `${100 / Y}%`,
481
+ width: `${100 / Z}%`,
482
+ height: `${100 / Z}%`,
485
483
  display: "flex",
486
484
  flexDirection: "column",
487
485
  justifyContent: "center",
488
486
  alignItems: "center"
489
487
  },
490
488
  children: [
491
- !f && we,
492
- !w && !x && /* @__PURE__ */ d("div", { style: t.gmCenterScreen, children: [
493
- /* @__PURE__ */ n("h1", { style: t.gmHeadline1, children: "WHAT'S MISSING?" }),
494
- /* @__PURE__ */ n("p", { style: t.gmBodyM, children: "Select a theme:" }),
495
- /* @__PURE__ */ n("div", { style: { display: "flex", gap: 16 }, children: ["animals", "food", "toys"].map((e) => /* @__PURE__ */ n("button", { style: t.gmButton, onClick: () => S(e), children: e === "animals" ? "🐶 Animals" : e === "food" ? "🍎 Food" : "🧸 Toys" }, e)) }),
496
- /* @__PURE__ */ d("div", { style: { marginTop: 24 }, children: [
497
- /* @__PURE__ */ n("p", { style: t.gmBodyS, children: "Choose number of rounds:" }),
498
- /* @__PURE__ */ n("div", { style: { display: "flex", gap: 12, marginTop: 8 }, children: [3, 4, 5].map((e) => /* @__PURE__ */ n(
489
+ !p && we,
490
+ !w && !x && /* @__PURE__ */ a("div", { style: n.gmCenterScreen, children: [
491
+ /* @__PURE__ */ o("h1", { style: n.gmHeadline1, children: "WHAT'S MISSING?" }),
492
+ /* @__PURE__ */ o("p", { style: n.gmBodyM, children: "Select a theme:" }),
493
+ /* @__PURE__ */ o("div", { style: { display: "flex", gap: 16 }, children: ["animals", "food", "toys"].map((e) => /* @__PURE__ */ o("button", { style: n.gmButton, onClick: () => S(e), children: e === "animals" ? "🐶 Animals" : e === "food" ? "🍎 Food" : "🧸 Toys" }, e)) }),
494
+ /* @__PURE__ */ a("div", { style: { marginTop: 24 }, children: [
495
+ /* @__PURE__ */ o("p", { style: n.gmBodyS, children: "Choose number of rounds:" }),
496
+ /* @__PURE__ */ o("div", { style: { display: "flex", gap: 12, marginTop: 8 }, children: [3, 4, 5].map((e) => /* @__PURE__ */ o(
499
497
  "button",
500
498
  {
501
499
  style: {
502
- ...t.gmButton,
503
- ...a === e ? t.gmButtonActive : {}
500
+ ...n.gmButton,
501
+ ...l === e ? n.gmButtonActive : {}
504
502
  },
505
503
  onClick: () => z(e),
506
504
  children: e
@@ -509,47 +507,47 @@ function Be({
509
507
  )) })
510
508
  ] })
511
509
  ] }),
512
- w && !x && /* @__PURE__ */ d("div", { style: t.gmCenterScreen, children: [
513
- /* @__PURE__ */ d("h1", { style: t.gmHeadline1, children: [
510
+ w && !x && /* @__PURE__ */ a("div", { style: n.gmCenterScreen, children: [
511
+ /* @__PURE__ */ a("h1", { style: n.gmHeadline1, children: [
514
512
  "Theme selected: ",
515
513
  w
516
514
  ] }),
517
- /* @__PURE__ */ d("p", { style: t.gmBodyM, children: [
515
+ /* @__PURE__ */ a("p", { style: n.gmBodyM, children: [
518
516
  "Rounds: ",
519
- a
517
+ l
520
518
  ] }),
521
- /* @__PURE__ */ n("button", { style: t.gmButton, onClick: oe, children: "▶ Start game" })
519
+ /* @__PURE__ */ o("button", { style: n.gmButton, onClick: oe, children: "▶ Start game" })
522
520
  ] }),
523
- A && /* @__PURE__ */ d("div", { style: t.gmCenterScreen, children: [
524
- /* @__PURE__ */ n("h1", { style: t.gmHeadline1, children: "Results" }),
525
- /* @__PURE__ */ d("h2", { style: t.gmHeadline3, children: [
521
+ E && /* @__PURE__ */ a("div", { style: n.gmCenterScreen, children: [
522
+ /* @__PURE__ */ o("h1", { style: n.gmHeadline1, children: "Results" }),
523
+ /* @__PURE__ */ a("h2", { style: n.gmHeadline3, children: [
526
524
  "Your score: ",
527
525
  me,
528
526
  " / ",
529
- a
527
+ l
530
528
  ] }),
531
- /* @__PURE__ */ n("p", { style: { ...t.gmBodyM, color: "#10b981", marginTop: 12 }, children: "Yahoo! You did it! 🍬✨" }),
532
- /* @__PURE__ */ d("table", { style: t.gmTable, children: [
533
- /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ d("tr", { children: [
534
- /* @__PURE__ */ n("th", { children: "Round" }),
535
- /* @__PURE__ */ n("th", { children: "Your Answer" }),
536
- /* @__PURE__ */ n("th", { children: "Correct" }),
537
- /* @__PURE__ */ n("th", { children: "Result" })
529
+ /* @__PURE__ */ o("p", { style: { ...n.gmBodyM, color: "#10b981", marginTop: 12 }, children: "Yahoo! You did it! 🍬✨" }),
530
+ /* @__PURE__ */ a("table", { style: n.gmTable, children: [
531
+ /* @__PURE__ */ o("thead", { children: /* @__PURE__ */ a("tr", { children: [
532
+ /* @__PURE__ */ o("th", { children: "Round" }),
533
+ /* @__PURE__ */ o("th", { children: "Your Answer" }),
534
+ /* @__PURE__ */ o("th", { children: "Correct" }),
535
+ /* @__PURE__ */ o("th", { children: "Result" })
538
536
  ] }) }),
539
- /* @__PURE__ */ n("tbody", { children: ue.map((e, o) => /* @__PURE__ */ d("tr", { children: [
540
- /* @__PURE__ */ n("td", { style: t.gmTableCell, children: e.round }),
541
- /* @__PURE__ */ n("td", { style: t.gmTableCell, children: e.answer || "—" }),
542
- /* @__PURE__ */ n("td", { style: t.gmTableCell, children: e.correct }),
543
- /* @__PURE__ */ n("td", { style: t.gmTableCell, children: e.result === "correct" ? "✔ Correct" : e.result === "almost" ? "◐ Almost (0.5)" : "✘ Wrong" })
544
- ] }, o)) })
537
+ /* @__PURE__ */ o("tbody", { children: ue.map((e, t) => /* @__PURE__ */ a("tr", { children: [
538
+ /* @__PURE__ */ o("td", { style: n.gmTableCell, children: e.round }),
539
+ /* @__PURE__ */ o("td", { style: n.gmTableCell, children: e.answer || "—" }),
540
+ /* @__PURE__ */ o("td", { style: n.gmTableCell, children: e.correct }),
541
+ /* @__PURE__ */ o("td", { style: n.gmTableCell, children: e.result === "correct" ? "✔ Correct" : e.result === "almost" ? "◐ Almost (0.5)" : "✘ Wrong" })
542
+ ] }, t)) })
545
543
  ] }),
546
- /* @__PURE__ */ d("div", { style: { display: "flex", gap: 12, marginTop: 24 }, children: [
547
- /* @__PURE__ */ n("button", { style: t.gmButton, onClick: oe, children: "🔁 Play again" }),
548
- /* @__PURE__ */ n("button", { style: t.gmButton, onClick: ye, children: "⬅️ Choose theme" })
544
+ /* @__PURE__ */ a("div", { style: { display: "flex", gap: 12, marginTop: 24 }, children: [
545
+ /* @__PURE__ */ o("button", { style: n.gmButton, onClick: oe, children: "🔁 Play again" }),
546
+ /* @__PURE__ */ o("button", { style: n.gmButton, onClick: ye, children: "⬅️ Choose theme" })
549
547
  ] })
550
548
  ] }),
551
- x && !A && /* @__PURE__ */ d("div", { style: t.gmGameLayout, children: [
552
- /* @__PURE__ */ d(
549
+ x && !E && /* @__PURE__ */ a("div", { style: n.gmGameLayout, children: [
550
+ /* @__PURE__ */ a(
553
551
  "div",
554
552
  {
555
553
  style: {
@@ -560,54 +558,54 @@ function Be({
560
558
  alignItems: "center"
561
559
  },
562
560
  children: [
563
- v === "ready" && /* @__PURE__ */ d(be, { children: [
564
- /* @__PURE__ */ n("h1", { style: { ...t.gmHeadline1, color: "#ec4c44" }, children: "GET READY" }),
565
- /* @__PURE__ */ n("div", { style: t.gmHourglass, children: "⏳" })
561
+ v === "ready" && /* @__PURE__ */ a(be, { children: [
562
+ /* @__PURE__ */ o("h1", { style: { ...n.gmHeadline1, color: "#ec4c44" }, children: "GET READY" }),
563
+ /* @__PURE__ */ o("div", { style: n.gmHourglass, children: "⏳" })
566
564
  ] }),
567
- v === "memorize" && /* @__PURE__ */ d("p", { style: { ...t.gmBodyM, color: "#10b981" }, children: [
565
+ v === "memorize" && /* @__PURE__ */ a("p", { style: { ...n.gmBodyM, color: "#10b981" }, children: [
568
566
  "MEMORIZE (",
569
- j,
567
+ F,
570
568
  ")"
571
569
  ] }),
572
- v === "guess" && !R && /* @__PURE__ */ d("p", { style: t.gmBodyM, children: [
570
+ v === "guess" && !R && /* @__PURE__ */ a("p", { style: n.gmBodyM, children: [
573
571
  "⏳ Time left: ",
574
- $,
572
+ G,
575
573
  "s"
576
574
  ] })
577
575
  ]
578
576
  }
579
577
  ),
580
- v !== "ready" && /* @__PURE__ */ n(
578
+ v !== "ready" && /* @__PURE__ */ o(
581
579
  "div",
582
580
  {
583
581
  style: {
584
- ...t.gmGrid,
582
+ ...n.gmGrid,
585
583
  display: "grid",
586
- gridTemplateColumns: `repeat(${f ? 2 : 3}, 1fr)`,
587
- gridTemplateRows: `repeat(${f ? 3 : 2}, 1fr)`,
588
- gap: f ? 12 : 20,
584
+ gridTemplateColumns: `repeat(${p ? 2 : 3}, 1fr)`,
585
+ gridTemplateRows: `repeat(${p ? 3 : 2}, 1fr)`,
586
+ gap: p ? 12 : 20,
589
587
  justifyContent: "center",
590
588
  alignContent: "center",
591
- padding: f ? 8 : 16,
589
+ padding: p ? 8 : 16,
592
590
  width: "100%",
593
591
  height: "100%",
594
- maxWidth: f ? "100%" : 600,
595
- maxHeight: f ? "100%" : 400,
592
+ maxWidth: p ? "100%" : 600,
593
+ maxHeight: p ? "100%" : 400,
596
594
  boxSizing: "border-box"
597
595
  },
598
- children: b.map((e, o) => {
599
- const g = y === o && v === "guess" && !R;
600
- return /* @__PURE__ */ n(
596
+ children: b.map((e, t) => {
597
+ const c = y === t && v === "guess" && !R;
598
+ return /* @__PURE__ */ o(
601
599
  "div",
602
600
  {
603
601
  style: {
604
- ...t.gmCard,
602
+ ...n.gmCard,
605
603
  width: "100%",
606
604
  height: "100%",
607
- ...ee === "correct" && y === o ? t.gmCorrect : {},
608
- ...ee === "wrong" && y === o ? t.gmWrong : {}
605
+ ...ee === "correct" && y === t ? n.gmCorrect : {},
606
+ ...ee === "wrong" && y === t ? n.gmWrong : {}
609
607
  },
610
- children: !g && /* @__PURE__ */ n(
608
+ children: !c && /* @__PURE__ */ o(
611
609
  "img",
612
610
  {
613
611
  src: e.src,
@@ -621,34 +619,34 @@ function Be({
621
619
  }
622
620
  )
623
621
  },
624
- o
622
+ t
625
623
  );
626
624
  })
627
625
  }
628
626
  ),
629
- /* @__PURE__ */ d("div", { style: { marginTop: 16, height: 80 }, children: [
630
- v === "guess" && !R && /* @__PURE__ */ d("div", { children: [
631
- /* @__PURE__ */ n(
627
+ /* @__PURE__ */ a("div", { style: { marginTop: 16, height: 80 }, children: [
628
+ v === "guess" && !R && /* @__PURE__ */ a("div", { children: [
629
+ /* @__PURE__ */ o(
632
630
  "input",
633
631
  {
634
632
  type: "text",
635
633
  placeholder: "Type the missing word",
636
- value: E,
634
+ value: W,
637
635
  onChange: (e) => Q(e.target.value),
638
- style: t.gmInput
636
+ style: n.gmInput
639
637
  }
640
638
  ),
641
- /* @__PURE__ */ n(
639
+ /* @__PURE__ */ o(
642
640
  "button",
643
641
  {
644
- style: { ...t.gmButton, marginLeft: 8 },
642
+ style: { ...n.gmButton, marginLeft: 8 },
645
643
  onClick: fe,
646
- disabled: O,
647
- children: O ? "..." : "Check"
644
+ disabled: q,
645
+ children: q ? "..." : "Check"
648
646
  }
649
647
  )
650
648
  ] }),
651
- R && /* @__PURE__ */ n("button", { type: "button", style: t.gmButton, onClick: pe, children: "Next round" })
649
+ R && /* @__PURE__ */ o("button", { type: "button", style: n.gmButton, onClick: pe, children: "Next round" })
652
650
  ] })
653
651
  ] })
654
652
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mblinkov/whats-missing",
3
- "version": "20.0.35",
3
+ "version": "20.0.36",
4
4
  "main": "dist/whats-missing.umd.js",
5
5
  "module": "dist/whats-missing.es.js",
6
6
  "types": "dist/index.d.ts",
package/src/Game.tsx CHANGED
@@ -3,29 +3,6 @@ import { themes } from "./themes";
3
3
  import { styles } from "./Game.styles";
4
4
  import type { Theme } from "./themes";
5
5
 
6
- // ✅ глобальная нейтрализация зума с безопасным откатом
7
- useEffect(() => {
8
- const b = document.body;
9
- const h = document.documentElement;
10
-
11
- const oldBodyZoom = b.style.zoom;
12
- const oldBodyTransform = b.style.transform;
13
- const oldHtmlZoom = h.style.zoom;
14
- const oldHtmlTransform = h.style.transform;
15
-
16
- b.style.zoom = "1";
17
- b.style.transform = "none";
18
- h.style.zoom = "1";
19
- h.style.transform = "none";
20
- console.log("Zoom and transform neutralized globally.");
21
-
22
- return () => {
23
- b.style.zoom = oldBodyZoom;
24
- b.style.transform = oldBodyTransform;
25
- h.style.zoom = oldHtmlZoom;
26
- h.style.transform = oldHtmlTransform;
27
- };
28
- }, []);
29
6
 
30
7
  type ImageItem = { src: string; name: string };
31
8
  type RoundResult = {
@@ -183,6 +160,28 @@ export default function Game({
183
160
  const [squareSize, setSquareSize] = useState<number | null>(null);
184
161
  useNeutralizeBodyZoom(containerRef, { minDesktopWidth: 1024, forceResize: false });
185
162
 
163
+ useEffect(() => {
164
+ const b = document.body;
165
+ const h = document.documentElement;
166
+
167
+ const oldBodyZoom = b.style.zoom;
168
+ const oldBodyTransform = b.style.transform;
169
+ const oldHtmlZoom = h.style.zoom;
170
+ const oldHtmlTransform = h.style.transform;
171
+
172
+ b.style.zoom = "1";
173
+ b.style.transform = "none";
174
+ h.style.zoom = "1";
175
+ h.style.transform = "none";
176
+
177
+ return () => {
178
+ b.style.zoom = oldBodyZoom;
179
+ b.style.transform = oldBodyTransform;
180
+ h.style.zoom = oldHtmlZoom;
181
+ h.style.transform = oldHtmlTransform;
182
+ };
183
+ }, []);
184
+
186
185
  // ✅ защита от слишком маленьких размеров игры
187
186
  const effectiveGameCubeSize = useMemo(() => {
188
187
  const baseSize = gameCubeSize ?? Math.min(screenWidth ?? 1000, screenHeight ?? 1000);