@mblinkov/whats-missing 20.0.43 → 20.0.44

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,34 +1,32 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),s=require("react"),pe=require("react-dom"),ye=window.origin+"/cloud/speakid/games/whatsmissing/",P=(d,m)=>d.map(([r,i])=>({src:`${ye}${m}/${i.replace(/\s/g,"%20")}.png`,name:i})),xe=[["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"]],we=[["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"]],be=[["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"]],Y={food:P(xe,"food"),animals:P(we,"animals"),toys:P(be,"toys")},je=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),o=require("react"),xn=window.origin+"/cloud/speakid/games/whatsmissing/",F=(d,p)=>d.map(([g,r])=>({src:`${xn}${p}/${r.replace(/\s/g,"%20")}.png`,name:r})),cn=[["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"]],mn=[["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"]],Hn=[["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"]],D={food:F(cn,"food"),animals:F(mn,"animals"),toys:F(Hn,"toys")},un=`
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 d=document.createElement("style");d.id="spin-keyframes",d.innerHTML=je,document.head.appendChild(d)}const Se={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",...Se}},ve=(d,m)=>{const r=Array.from({length:d.length+1},()=>Array(m.length+1).fill(0));for(let i=0;i<=d.length;i++)r[i][0]=i;for(let i=0;i<=m.length;i++)r[0][i]=i;for(let i=1;i<=d.length;i++)for(let g=1;g<=m.length;g++)r[i][g]=d[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[d.length][m.length]};function ze(d,m={minDesktopWidth:1200,forceResize:!1}){const r=s.useRef(null),i=m.minDesktopWidth??1200,g=!!m.forceResize;s.useLayoutEffect(()=>{if(typeof window>"u"||!d||!d.current)return;const c=d.current,T=()=>{try{const l=document.body,y=getComputedStyle(l),w=parseFloat(l.style&&l.style.zoom||"");if(w&&!isNaN(w)&&w>0)return w;const z=parseFloat(y.zoom||"");if(z&&!isNaN(z)&&z>0)return z;const u=document.createElement("div");u.style.position="absolute",u.style.left="0",u.style.top="0",u.style.width="100px",u.style.height="1px",u.style.visibility="hidden",document.documentElement.appendChild(u);const C=u.getBoundingClientRect();if(document.documentElement.removeChild(u),C&&C.width>0){const j=C.width/100;if(!isNaN(j)&&j>0)return j}}catch{}return 1},B=()=>{if(i&&window.innerWidth<i){R();return}const l=T();if(!l||l===1){R();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 y=1/l;g&&(c.style.width=`${l*100}%`,c.style.height=`${l*100}%`),c.style.transformOrigin="50% 50%",c.style.transform=`scale(${y})`,c.style.willChange="transform"},R=()=>{if(!r.current)return;const l=r.current;c.style.transform=l.transform??"",c.style.transformOrigin=l.transformOrigin??"",c.style.width=l.width??"",c.style.height=l.height??"",c.style.willChange=l.willChange??"",r.current=null};let v=0;const p=()=>{cancelAnimationFrame(v),v=requestAnimationFrame(B)},M=new MutationObserver(l=>{for(const y of l)if(y.type==="attributes"&&(y.attributeName==="style"||y.attributeName==="class")){p();break}});return M.observe(document.body,{attributes:!0,attributeFilter:["style","class"]}),window.addEventListener("resize",p),p(),()=>{cancelAnimationFrame(v),M.disconnect(),window.removeEventListener("resize",p),R()}},[d,i,g])}function Ce({gameCubeSize:d,screenHeight:m,screenWidth:r}){const i=s.useRef(null),g=s.useRef(null),[c,T]=s.useState(null),[B,R]=s.useState(null);ze(i,{minDesktopWidth:1024,forceResize:!1}),s.useLayoutEffect(()=>{const e=i.current;if(!e)return;let n=e.shadowRoot;n||(n=e.attachShadow({mode:"open"})),e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100vw",e.style.height="100vh",e.style.zIndex="9999",e.style.background="linear-gradient(to bottom, #fff8f8, #f9fafb)",e.style.margin="0",e.style.padding="0",e.style.transform="none",e.style.zoom="1",n.innerHTML="";const a=document.createElement("style");a.textContent=`
7
- :host {
8
- display: flex;
9
- justify-content: center;
10
- align-items: center;
11
- overflow: hidden;
12
- }
13
-
14
- #whats-missing-root, #whats-missing-root * {
15
- box-sizing: border-box;
16
- }
17
-
18
- #whats-missing-root img {
19
- max-width: 100%;
20
- height: auto;
21
- display: block;
22
- user-select: none;
23
- }
24
-
25
- #whats-missing-root {
26
- position: relative;
27
- width: 100%;
28
- height: 100%;
29
- max-width: 1200px;
30
- display: flex;
31
- justify-content: center;
32
- align-items: center;
33
- }
34
- `,n.appendChild(a),R(n)},[]),s.useEffect(()=>{const e=document.body,n=document.documentElement,a=e.style.zoom,h=e.style.transform,b=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=a,e.style.transform=h,n.style.zoom=b,n.style.transform=I}},[]);const v=s.useMemo(()=>{const e=d??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},[d,r,m]);s.useEffect(()=>()=>{document.body.style.overflow=""},[]);const[p,M]=s.useState(null),[l,y]=s.useState([]),[w,z]=s.useState(4),[u,C]=s.useState(!1),[j,Z]=s.useState(1),[S,re]=s.useState(null),[x,E]=s.useState("ready"),[U,V]=s.useState(3),[W,F]=s.useState(10),[G,_]=s.useState(20),[le,N]=s.useState(0),[L,D]=s.useState(!1),[A,K]=s.useState(""),[k,O]=s.useState(!1),[$,J]=s.useState(!1),[Q,H]=s.useState(null),[ae,q]=s.useState([]),[de,X]=s.useState([]),[f,ce]=s.useState(!1);s.useEffect(()=>{if(typeof window>"u")return;const e=()=>{const n=r??window.innerWidth,a=window.matchMedia&&window.matchMedia("(pointer: coarse)").matches;ce(n<=768||a)};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(a=>{for(const h of a){const b=h.contentRect;T(Math.round(Math.min(b.width,b.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 ee=e=>[...e].sort(()=>Math.random()-.5).slice(0,6),te=()=>{if(!p)return;const e=ee(Y[p]);y(e),C(!0),D(!1),Z(1),N(0),q([]),X([]),ne(e,[],!0)},ne=(e=l,n=de,a=!1)=>{const h=ee(e.length?e:Y[p]);let b=Math.floor(Math.random()*h.length),I=h[b].name,ie=0;for(;n.includes(I)&&ie<20;)b=Math.floor(Math.random()*h.length),I=h[b].name,ie++;y(h),re(b),X([...n,I]),O(!1),K(""),_(20),H(null),a?(E("ready"),V(3),F(10)):(E("memorize"),F(10))};s.useEffect(()=>{if(!(!u||L||k)){if(x==="ready")if(U<=0)E("memorize");else{const e=setTimeout(()=>V(n=>n-1),1e3);return()=>clearTimeout(e)}if(x==="memorize")if(W<=0)E("guess");else{const e=setTimeout(()=>F(n=>n-1),1e3);return()=>clearTimeout(e)}if(x==="guess"){if(G<=0){O(!0),H("wrong");const n=l[S].name;q(a=>[...a,{round:j,answer:A,correct:n,result:"wrong"}]);return}const e=setTimeout(()=>_(n=>n-1),1e3);return()=>clearTimeout(e)}}},[x,U,W,G,u,L,k,l,S,j,A]);const me=()=>{if(S===null||$)return;const e=l[S].name,n=A.toLowerCase().trim();let a="wrong";n===e?(N(h=>h+1),H("correct"),a="correct"):ve(n,e)===1?(N(h=>h+.5),H("almost"),a="almost"):(H("wrong"),a="wrong"),q(h=>[...h,{round:j,answer:n,correct:e,result:a}]),J(!0),setTimeout(()=>{J(!1),O(!0)},600)},ue=()=>j<w?(Z(e=>e+1),ne()):D(!0),he=()=>{C(!1),D(!1),M(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"})]})}),[]),oe=1200,se=700,fe=s.useMemo(()=>{const e=r??(typeof window<"u"?window.innerWidth:oe),n=m??(typeof window<"u"?window.innerHeight:se),a=Math.min(e/oe,n/se);return Math.min(1.35,Math.max(1,a))},[r,m,f]);return t.jsx("div",{ref:i,style:{width:"100%",height:"100%"},children:B&&pe.createPortal(t.jsx("div",{id:"whats-missing-root",style:{all:"unset"},children:t.jsx("div",{ref:g,style:{width:f?"100%":`${v}px`,height:f?"100%":`${v}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",{style:{transform:`scale(${fe})`,transformOrigin:"center center",transition:"transform 0.2s ease-out",width:"100%",height:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[!f&&ge,!p&&!u&&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:()=>M(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,...w===e?o.gmButtonActive:{}},onClick:()=>z(e),children:e},e))})]})]}),p&&!u&&t.jsxs("div",{style:o.gmCenterScreen,children:[t.jsxs("h1",{style:o.gmHeadline1,children:["Theme selected: ",p]}),t.jsxs("p",{style:o.gmBodyM,children:["Rounds: ",w]}),t.jsx("button",{style:o.gmButton,onClick:te,children:"▶ Start game"})]}),L&&t.jsxs("div",{style:o.gmCenterScreen,children:[t.jsx("h1",{style:o.gmHeadline1,children:"Results"}),t.jsxs("h2",{style:o.gmHeadline3,children:["Your score: ",le," / ",w]}),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:ae.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:te,children:"🔁 Play again"}),t.jsx("button",{style:o.gmButton,onClick:he,children:"⬅️ Choose theme"})]})]}),u&&!L&&t.jsxs("div",{style:o.gmGameLayout,children:[t.jsxs("div",{style:{minHeight:160,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[x==="ready"&&t.jsxs(t.Fragment,{children:[t.jsx("h1",{style:{...o.gmHeadline1,color:"#ec4c44"},children:"GET READY"}),t.jsx("div",{style:o.gmHourglass,children:"⏳"})]}),x==="memorize"&&t.jsxs("p",{style:{...o.gmBodyM,color:"#10b981"},children:["MEMORIZE (",W,")"]}),x==="guess"&&!k&&t.jsxs("p",{style:o.gmBodyM,children:["⏳ Time left: ",G,"s"]})]}),x!=="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:l.map((e,n)=>{const a=S===n&&x==="guess"&&!k;return t.jsx("div",{style:{...o.gmCard,width:"100%",height:"100%",...Q==="correct"&&S===n?o.gmCorrect:{},...Q==="wrong"&&S===n?o.gmWrong:{}},children:!a&&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:[x==="guess"&&!k&&t.jsxs("div",{children:[t.jsx("input",{type:"text",placeholder:"Type the missing word",value:A,onChange:e=>K(e.target.value),style:o.gmInput}),t.jsx("button",{style:{...o.gmButton,marginLeft:8},onClick:me,disabled:$,children:$?"...":"Check"})]}),k&&t.jsx("button",{type:"button",style:o.gmButton,onClick:ue,children:"Next round"})]})]})]})})}),B)})}exports.Game=Ce;exports.themes=Y;
6
+ `;if(typeof document<"u"&&!document.getElementById("spin-keyframes")){const d=document.createElement("style");d.id="spin-keyframes",d.innerHTML=un,document.head.appendChild(d)}const Wn={animation:"spin 1.4s linear infinite"},t={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"},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",...Wn}},fn=()=>{const d=document.createElement("style");d.textContent=`
7
+ #whats-missing-root, #whats-missing-root * {
8
+ box-sizing: border-box;
9
+ font-family: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
10
+ }
11
+ #whats-missing-root img {
12
+ max-width: 100%;
13
+ height: auto;
14
+ display: block;
15
+ user-select: none;
16
+ }
17
+ html, body {
18
+ margin: 0 !important;
19
+ padding: 0 !important;
20
+ width: 100% !important;
21
+ height: 100% !important;
22
+ overflow: hidden !important;
23
+ zoom: 1 !important; /* ✅ защита от подзума */
24
+ }
25
+ #root {
26
+ margin: 0 !important;
27
+ padding: 0 !important;
28
+ width: 100% !important;
29
+ height: 100% !important;
30
+ overflow: hidden !important;
31
+ }
32
+ `,document.head.appendChild(d)},yn=(d,p)=>{const g=Array.from({length:d.length+1},()=>Array(p.length+1).fill(0));for(let r=0;r<=d.length;r++)g[r][0]=r;for(let r=0;r<=p.length;r++)g[0][r]=r;for(let r=1;r<=d.length;r++)for(let h=1;h<=p.length;h++)g[r][h]=d[r-1]===p[h-1]?g[r-1][h-1]:Math.min(g[r-1][h-1],g[r][h-1],g[r-1][h])+1;return g[d.length][p.length]};function bn({gameCubeSize:d,screenHeight:p,screenWidth:g}){const r=o.useRef(null);o.useEffect(()=>(fn(),()=>{document.body.style.overflow=""}),[]);const[h,Y]=o.useState(null),[u,q]=o.useState([]),[b,en]=o.useState(4),[W,P]=o.useState(!1),[j,U]=o.useState(1),[c,tn]=o.useState(null),[x,S]=o.useState("ready"),[N,O]=o.useState(3),[T,z]=o.useState(10),[C,V]=o.useState(20),[on,I]=o.useState(0),[k,R]=o.useState(!1),[v,_]=o.useState(""),[m,M]=o.useState(!1),[A,$]=o.useState(!1),[K,f]=o.useState(null),[dn,B]=o.useState([]),[wn,Z]=o.useState([]),[n,rn]=o.useState(!1),[jn,L]=o.useState(1),[J,E]=o.useState(null),[l,hn]=o.useState(!1);o.useEffect(()=>{const e=()=>{const w=g??window.innerWidth,a=p??window.innerHeight,s=w<768,H=a<700,y=w>=1200&&a>=600&&!s;if(hn(y),rn(s),s)E(d&&d>=320?d:null),L(1);else if(H)E(d&&d>=400?d:null),L(1);else{const pn=d?Math.max(400,Math.min(1200,d)):Math.min(1e3,Math.min(w,a)*.9);E(pn),L(1)}};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[g,p,d]);const Q=e=>[...e].sort(()=>Math.random()-.5).slice(0,6),X=()=>{if(!h)return;const e=Q(D[h]);q(e),P(!0),R(!1),U(1),I(0),B([]),Z([]),nn(e,[],!0)},nn=(e=u,w=wn,a=!1)=>{const s=Q(e.length?e:D[h]);let H=Math.floor(Math.random()*s.length),y=s[H].name,G=0;for(;w.includes(y)&&G<20;)H=Math.floor(Math.random()*s.length),y=s[H].name,G++;q(s),tn(H),Z([...w,y]),M(!1),_(""),V(20),f(null),a?(S("ready"),O(3),z(10)):(S("memorize"),z(10))};o.useEffect(()=>{if(!(!W||k||m)){if(x==="ready")if(N<=0)S("memorize");else{const e=setTimeout(()=>O(w=>w-1),1e3);return()=>clearTimeout(e)}if(x==="memorize")if(T<=0)S("guess");else{const e=setTimeout(()=>z(w=>w-1),1e3);return()=>clearTimeout(e)}if(x==="guess"){if(C<=0){M(!0),f("wrong");const w=u[c].name;B(a=>[...a,{round:j,answer:v,correct:w,result:"wrong"}]);return}const e=setTimeout(()=>V(w=>w-1),1e3);return()=>clearTimeout(e)}}},[x,N,T,C,W,k,m,u,c,j,v]);const sn=()=>{if(c===null||A)return;const e=u[c].name,w=v.toLowerCase().trim();let a="wrong";w===e?(I(s=>s+1),f("correct"),a="correct"):yn(w,e)===1?(I(s=>s+.5),f("almost"),a="almost"):(f("wrong"),a="wrong"),B(s=>[...s,{round:j,answer:w,correct:e,result:a}]),$(!0),setTimeout(()=>{$(!1),M(!0)},600)},an=()=>j<b?(U(e=>e+1),nn()):R(!0),gn=()=>{P(!1),R(!1),Y(null)},ln=o.useMemo(()=>n&&window.innerWidth>window.innerHeight||window.innerHeight<700?null:i.jsx("div",{style:{...t.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:t.gmLogoImg,loading:"lazy"})]})}),[n]);return i.jsx("div",{ref:r,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%":J||d||1e3,height:n?"100%":J||d||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"},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&&ln,!h&&!W&&i.jsxs("div",{style:t.gmCenterScreen,children:[i.jsx("h1",{style:t.gmHeadline1,children:"WHAT'S MISSING?"}),i.jsx("p",{style:t.gmBodyM,children:"Select a theme:"}),i.jsx("div",{style:{display:"flex",gap:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667?"8px":"16px"},children:["animals","food","toys"].map(e=>i.jsx("button",{style:{...t.gmButton,padding:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667?"8px 12px":"12px 24px",fontSize:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667?"12px":"16px",minWidth:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667?"70px":"auto"},onClick:()=>Y(e),children:e==="animals"?"🐶 Animals":e==="food"?"🍎 Food":"🧸 Toys"},e))}),i.jsxs("div",{style:{marginTop:24},children:[i.jsx("p",{style:t.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?"6px":"12px",marginTop:8},children:[3,4,5].map(e=>i.jsx("button",{style:{...t.gmButton,...b===e?t.gmButtonActive:{},padding:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667?"6px 10px":"12px 24px",fontSize:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667?"12px":"16px",minWidth:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667?"40px":"auto"},onClick:()=>en(e),children:e},e))})]})]}),h&&!W&&i.jsxs("div",{style:t.gmCenterScreen,children:[i.jsxs("h1",{style:t.gmHeadline1,children:["Theme selected: ",h]}),i.jsxs("p",{style:t.gmBodyM,children:["Rounds: ",b]}),i.jsx("button",{style:{...t.gmButton,padding:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667?"8px 16px":"12px 24px",fontSize:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667?"14px":"16px",minWidth:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667?"120px":"auto"},onClick:X,children:"▶ Start game"})]}),k&&i.jsxs("div",{style:t.gmCenterScreen,children:[i.jsx("h1",{style:t.gmHeadline1,children:"Results"}),i.jsxs("h2",{style:t.gmHeadline3,children:["Your score: ",on," / ",b]}),i.jsx("p",{style:{...t.gmBodyM,color:"#10b981",marginTop:12},children:"Yahoo! You did it! 🍬✨"}),i.jsxs("table",{style:t.gmTable,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:dn.map((e,w)=>i.jsxs("tr",{children:[i.jsx("td",{style:t.gmTableCell,children:e.round}),i.jsx("td",{style:t.gmTableCell,children:e.answer||"—"}),i.jsx("td",{style:t.gmTableCell,children:e.correct}),i.jsx("td",{style:t.gmTableCell,children:e.result==="correct"?"✔ Correct":e.result==="almost"?"◐ Almost (0.5)":"✘ Wrong"})]},w))})]}),i.jsxs("div",{style:{display:"flex",gap:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667?"6px":"12px",marginTop:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667?"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||l?"12px":"24px"},children:[i.jsx("button",{style:{...t.gmButton,padding:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667?"6px 10px":"12px 24px",fontSize:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667?"12px":"16px",minWidth:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667?"80px":"auto"},onClick:X,children:"🔁 Play again"}),i.jsx("button",{style:{...t.gmButton,padding:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667?"6px 10px":"12px 24px",fontSize:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667?"12px":"16px",minWidth:n&&window.innerWidth>window.innerHeight||n&&window.innerWidth<=375&&window.innerHeight<=667?"80px":"auto"},onClick:gn,children:"⬅️ Choose theme"})]})]}),W&&!k&&i.jsxs("div",{style:t.gmGameLayout,children:[i.jsxs("div",{style:{minHeight: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?"50px":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?"8px":n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"15px":"40px"},children:[x==="ready"&&i.jsxs(i.Fragment,{children:[i.jsx("h1",{style:{...t.gmHeadline1,color:"#ec4c44"},children:"GET READY"}),i.jsx("div",{style:t.gmHourglass,children:"⏳"})]}),x==="memorize"&&i.jsxs("p",{style:{...t.gmBodyM,color:"#10b981"},children:["MEMORIZE (",T,")"]}),x==="guess"&&!m&&i.jsxs("p",{style:t.gmBodyM,children:["⏳ Time left: ",C,"s"]})]}),x!=="ready"&&i.jsx("div",{style:{...t.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?"100px":n?"150px":window.innerHeight<700?"140px":"210px",gap:n&&window.innerWidth<=375&&window.innerHeight<=667?"12px":n||window.innerHeight<700?"8px":"20px",justifyItems:"center",maxWidth:n&&window.innerWidth>window.innerHeight?"90%":n&&window.innerWidth<=375&&window.innerHeight<=667?"95%":"100%",padding:n&&window.innerWidth<=375&&window.innerHeight<=667?"8px":"16px"},children:u.map((e,w)=>{const a=c===w&&x==="guess"&&!m;return i.jsx("div",{style:{width:"100%",height:"100%",borderRadius:n&&window.innerWidth<=375&&window.innerHeight<=667?"6px":"12px",overflow:"hidden",boxShadow:n&&window.innerWidth<=375&&window.innerHeight<=667?"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",...K==="correct"&&c===w?{boxShadow:n&&window.innerWidth<=375&&window.innerHeight<=667?"0 0 15px #10b981":"0 0 20px #10b981",transform:"scale(1.03)"}:{},...K==="wrong"&&c===w?{boxShadow:n&&window.innerWidth<=375&&window.innerHeight<=667?"0 0 15px #ef4444":"0 0 20px #ef4444",transform:"scale(1.03)"}:{}},children:!a&&i.jsx("img",{src:e.src,alt:e.name,style:{width:"100%",height:"100%",objectFit:"cover"}})},w)})}),i.jsxs("div",{style:{marginTop:n&&window.innerWidth<=375&&window.innerHeight<=667?"1px":n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390?"2px":n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"4px":"16px",height:n&&window.innerWidth<=375&&window.innerHeight<=667?"40px":n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390?"45px":n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"50px":"80px"},children:[x==="guess"&&!m&&i.jsx("div",{style:{display:"flex",flexDirection:n&&window.innerWidth>window.innerHeight||window.innerHeight<700||window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||l?"row":"column",gap:n&&window.innerWidth<=375&&window.innerHeight<=667?"3px":n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390?"4px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||l?"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?"270px":n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390?"350px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||l||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:v,onChange:e=>_(e.target.value),style:{...t.gmInput,width:n&&window.innerWidth<=375&&window.innerHeight<=667?"170px":n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390?"220px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||l||n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"250px":"auto",padding:n&&window.innerWidth<=375&&window.innerHeight<=667?"5px 6px":n&&window.innerWidth>window.innerHeight&&window.innerHeight<=428||window.innerWidth===896&&window.innerHeight===414||window.innerWidth===844&&window.innerHeight===390?"6px 8px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||l||n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"10px 12px":"12px 16px",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?"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||l||n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"14px":"16px",flex:n&&window.innerWidth>window.innerHeight||window.innerHeight<700||window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||l?"1":"none"}}),i.jsx("button",{style:{...t.gmButton,marginLeft:n&&window.innerWidth>window.innerHeight||window.innerHeight<700||window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||window.innerWidth===1280&&window.innerHeight===720||window.innerWidth===1440&&window.innerHeight===900||l?"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?"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||l||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?"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||l||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?"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||l||n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"80px":"100px",flexShrink:0},onClick:sn,disabled:A,children:A?"...":"Check"})]})}),m&&i.jsx("button",{style:{...t.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?"6px 10px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||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?"11px":window.innerWidth===1366&&window.innerHeight===766||window.innerWidth===1366&&window.innerHeight===768||n&&window.innerWidth>window.innerHeight||window.innerHeight<700?"14px":"16px"},onClick:an,children:"Next round"})]})]})]})})})})}exports.Game=bn;exports.themes=D;