@mblinkov/whats-missing 20.0.2 → 20.0.3

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,30 +1,9 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react");var ee={exports:{}},G={};/**
2
- * @license React
3
- * react-jsx-runtime.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var ae;function ce(){if(ae)return G;ae=1;var a=Symbol.for("react.transitional.element"),g=Symbol.for("react.fragment");function m(s,i,h){var x=null;if(h!==void 0&&(x=""+h),i.key!==void 0&&(x=""+i.key),"key"in i){h={};for(var v in i)v!=="key"&&(h[v]=i[v])}else h=i;return i=h.ref,{$$typeof:a,type:s,key:x,ref:i!==void 0?i:null,props:h}}return G.Fragment=g,G.jsx=m,G.jsxs=m,G}var D={};/**
10
- * @license React
11
- * react-jsx-runtime.development.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var ie;function de(){return ie||(ie=1,process.env.NODE_ENV!=="production"&&(function(){function a(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===H?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S:return"Fragment";case L:return"Profiler";case M:return"StrictMode";case A:return"Suspense";case F:return"SuspenseList";case R:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case V:return"Portal";case te:return e.displayName||"Context";case J:return(e._context.displayName||"Context")+".Consumer";case W:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case O:return n=e.displayName||null,n!==null?n:a(e.type)||"Memo";case P:n=e._payload,e=e._init;try{return a(e(n))}catch{}}return null}function g(e){return""+e}function m(e){try{g(e);var n=!1}catch{n=!0}if(n){n=console;var l=n.error,u=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return l.call(n,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",u),g(e)}}function s(e){if(e===S)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===P)return"<...>";try{var n=a(e);return n?"<"+n+">":"<...>"}catch{return"<...>"}}function i(){var e=E.A;return e===null?null:e.getOwner()}function h(){return Error("react-stack-top-frame")}function x(e){if(Y.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function v(e,n){function l(){Z||(Z=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",n))}l.isReactWarning=!0,Object.defineProperty(e,"key",{get:l,configurable:!0})}function C(){var e=a(this.type);return I[e]||(I[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function U(e,n,l,u,z,$){var f=l.ref;return e={$$typeof:N,type:e,key:n,props:l,_owner:u},(f!==void 0?f:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:C}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:z}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:$}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function y(e,n,l,u,z,$){var f=n.children;if(f!==void 0)if(u)if(X(f)){for(u=0;u<f.length;u++)q(f[u]);Object.freeze&&Object.freeze(f)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else q(f);if(Y.call(n,"key")){f=a(e);var k=Object.keys(n).filter(function(c){return c!=="key"});u=0<k.length?"{key: someKey, "+k.join(": ..., ")+": ...}":"{key: someKey}",_[f+u]||(k=0<k.length?"{"+k.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
- let props = %s;
19
- <%s {...props} />
20
- React keys must be passed directly to JSX without using spread:
21
- let props = %s;
22
- <%s key={someKey} {...props} />`,u,f,k,f),_[f+u]=!0)}if(f=null,l!==void 0&&(m(l),f=""+l),x(n)&&(m(n.key),f=""+n.key),"key"in n){l={};for(var r in n)r!=="key"&&(l[r]=n[r])}else l=n;return f&&v(l,typeof e=="function"?e.displayName||e.name||"Unknown":e),U(e,f,l,i(),z,$)}function q(e){p(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===P&&(e._payload.status==="fulfilled"?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e=="object"&&e!==null&&e.$$typeof===N}var T=d,N=Symbol.for("react.transitional.element"),V=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),J=Symbol.for("react.consumer"),te=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),F=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),H=Symbol.for("react.client.reference"),E=T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,X=Array.isArray,j=console.createTask?console.createTask:function(){return null};T={react_stack_bottom_frame:function(e){return e()}};var Z,I={},Q=T.react_stack_bottom_frame.bind(T,h)(),B=j(s(h)),_={};D.Fragment=S,D.jsx=function(e,n,l){var u=1e4>E.recentlyCreatedOwnerStacks++;return y(e,n,l,!1,u?Error("react-stack-top-frame"):Q,u?j(s(e)):B)},D.jsxs=function(e,n,l){var u=1e4>E.recentlyCreatedOwnerStacks++;return y(e,n,l,!0,u?Error("react-stack-top-frame"):Q,u?j(s(e)):B)}})()),D}var le;function ue(){return le||(le=1,process.env.NODE_ENV==="production"?ee.exports=ce():ee.exports=de()),ee.exports}var t=ue();const me=window.origin+"/cloud/speakid/games/whatsmissing/",ne=(a,g)=>a.map(([m,s])=>({src:`${me}${g}/${s.replace(/\s/g,"%20")}.png`,name:s})),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"]],ge=[["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"]],pe=[["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"]],oe={food:ne(fe,"food"),animals:ne(ge,"animals"),toys:ne(pe,"toys")},he=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),se=window.origin+"/cloud/speakid/games/whatsmissing/",B=(r,c)=>r.map(([l,s])=>({src:`${se}${c}/${s.replace(/\s/g,"%20")}.png`,name:s})),ne=[["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"]],re=[["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"]],ie=[["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"]],M={food:B(ne,"food"),animals:B(re,"animals"),toys:B(ie,"toys")},le=`
23
2
  @keyframes spin {
24
3
  from { transform: rotate(0deg); }
25
4
  to { transform: rotate(360deg); }
26
5
  }
27
- `;if(typeof document<"u"&&!document.getElementById("spin-keyframes")){const a=document.createElement("style");a.id="spin-keyframes",a.innerHTML=he,document.head.appendChild(a)}const xe={animation:"spin 1.4s linear infinite"},o={gmCenterScreen:{position:"relative",zIndex:1,minHeight:"100vh",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:"600px",minHeight:"100vh",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",color:"#1f2937",padding:"16px 8px",margin:"0 auto"},gmGrid:{width:"100%",maxWidth:"calc(210px * 3 + 20px * 2)",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:"sticky",top:"16px",left:"20px",zIndex:9999,background:"white",padding:"4px 8px",borderRadius:"8px"},gmLogoImg:{height:"clamp(28px, 5vw, 40px)",width:"auto"},gmHourglass:{fontSize:"42px",...xe}},be=window.origin+"/cloud/speakid/games/whatsmissing/logo.png",ye=()=>{const a=document.createElement("style");a.textContent=`
6
+ `;if(typeof document<"u"&&!document.getElementById("spin-keyframes")){const r=document.createElement("style");r.id="spin-keyframes",r.innerHTML=le,document.head.appendChild(r)}const ae={animation:"spin 1.4s linear infinite"},o={gmCenterScreen:{position:"relative",zIndex:1,minHeight:"100vh",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:"600px",minHeight:"100vh",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",color:"#1f2937",padding:"16px 8px",margin:"0 auto"},gmGrid:{width:"100%",maxWidth:"calc(210px * 3 + 20px * 2)",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:"sticky",top:"16px",left:"20px",zIndex:9999,background:"white",padding:"4px 8px",borderRadius:"8px"},gmLogoImg:{height:"clamp(28px, 5vw, 40px)",width:"auto"},gmHourglass:{fontSize:"42px",...ae}},de=window.origin+"/cloud/speakid/games/whatsmissing/logo.png",ce=()=>{const r=document.createElement("style");r.textContent=`
28
7
  html, body, #root {
29
8
  margin: 0;
30
9
  padding: 0;
@@ -54,4 +33,4 @@ React keys must be passed directly to JSX without using spread:
54
33
  from { transform: rotate(0deg); }
55
34
  to { transform: rotate(360deg); }
56
35
  }
57
- `,document.head.appendChild(a)},we=(a,g)=>{const m=Array.from({length:a.length+1},()=>Array(g.length+1).fill(0));for(let s=0;s<=a.length;s++)m[s][0]=s;for(let s=0;s<=g.length;s++)m[0][s]=s;for(let s=1;s<=a.length;s++)for(let i=1;i<=g.length;i++)m[s][i]=a[s-1]===g[i-1]?m[s-1][i-1]:Math.min(m[s-1][i-1],m[s][i-1],m[s-1][i])+1;return m[a.length][g.length]};function Te(){d.useEffect(()=>{ye()},[]);const[a,g]=d.useState(null),[m,s]=d.useState([]),[i,h]=d.useState(4),[x,v]=d.useState(!1),[C,U]=d.useState(1),[y,q]=d.useState(null),[p,T]=d.useState("ready"),[N,V]=d.useState(3),[S,M]=d.useState(7),[L,J]=d.useState(20),[te,W]=d.useState(0),[A,F]=d.useState(!1),[O,P]=d.useState(""),[R,H]=d.useState(!1),[E,Y]=d.useState(!1),[X,j]=d.useState(null),[Z,I]=d.useState([]),[Q,B]=d.useState([]),[_,e]=d.useState(!1);d.useEffect(()=>{const r=()=>e(window.innerWidth<768);return r(),window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]);const n=r=>[...r].sort(()=>Math.random()-.5).slice(0,6),l=()=>{if(!a)return;const r=n(oe[a]);s(r),v(!0),F(!1),U(1),W(0),I([]),B([]),u(r,[],!0)},u=(r=m,c=Q,w=!1)=>{const b=n(r.length?r:oe[a]);let K=Math.floor(Math.random()*b.length),re=b[K].name,se=0;for(;c.includes(re)&&se<20;)K=Math.floor(Math.random()*b.length),re=b[K].name,se++;s(b),q(K),B([...c,re]),H(!1),P(""),J(20),j(null),w?(T("ready"),V(3),M(7)):(T("memorize"),M(7))};d.useEffect(()=>{if(!(!x||A||R)){if(p==="ready")if(N<=0)T("memorize");else{const r=setTimeout(()=>V(c=>c-1),1e3);return()=>clearTimeout(r)}if(p==="memorize")if(S<=0)T("guess");else{const r=setTimeout(()=>M(c=>c-1),1e3);return()=>clearTimeout(r)}if(p==="guess"){if(L<=0){H(!0),j("wrong");const c=m[y].name;I(w=>[...w,{round:C,answer:O,correct:c,result:"wrong"}]);return}const r=setTimeout(()=>J(c=>c-1),1e3);return()=>clearTimeout(r)}}},[p,N,S,L,x,A,R,m,y,C,O]);const z=()=>{if(y===null||E)return;const r=m[y].name,c=O.toLowerCase().trim();let w="wrong";c===r?(W(b=>b+1),j("correct"),w="correct"):we(c,r)===1?(W(b=>b+.5),j("almost"),w="almost"):(j("wrong"),w="wrong"),I(b=>[...b,{round:C,answer:c,correct:r,result:w}]),Y(!0),setTimeout(()=>{Y(!1),H(!0)},600)},$=()=>C<i?(U(r=>r+1),u()):F(!0),f=()=>{v(!1),F(!1),g(null)},k=()=>t.jsx("div",{style:o.gmLogoFixed,children:t.jsx("img",{src:be,alt:"SPEAKID Logo",style:o.gmLogoImg})});return t.jsxs(t.Fragment,{children:[!_&&t.jsx(k,{}),!a&&!x&&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(r=>t.jsx("button",{style:o.gmButton,onClick:()=>g(r),children:r==="animals"?"🐶 Animals":r==="food"?"🍎 Food":"🧸 Toys"},r))}),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(r=>t.jsx("button",{style:{...o.gmButton,...i===r?o.gmButtonActive:{}},onClick:()=>h(r),children:r},r))})]})]}),a&&!x&&t.jsxs("div",{style:o.gmCenterScreen,children:[t.jsxs("h1",{style:o.gmHeadline1,children:["Theme selected: ",a]}),t.jsxs("p",{style:o.gmBodyM,children:["Rounds: ",i]}),t.jsx("button",{style:o.gmButton,onClick:l,children:"▶ Start game"})]}),A&&t.jsxs("div",{style:o.gmCenterScreen,children:[t.jsx("h1",{style:o.gmHeadline1,children:"Results"}),t.jsxs("h2",{style:o.gmHeadline3,children:["Your score: ",te," / ",i]}),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:Z.map((r,c)=>t.jsxs("tr",{children:[t.jsx("td",{style:o.gmTableCell,children:r.round}),t.jsx("td",{style:o.gmTableCell,children:r.answer||"—"}),t.jsx("td",{style:o.gmTableCell,children:r.correct}),t.jsx("td",{style:o.gmTableCell,children:r.result==="correct"?"✔ Correct":r.result==="almost"?"◐ Almost (0.5)":"✘ Wrong"})]},c))})]}),t.jsxs("div",{style:{display:"flex",gap:12,marginTop:24},children:[t.jsx("button",{style:o.gmButton,onClick:l,children:"🔁 Play again"}),t.jsx("button",{style:o.gmButton,onClick:f,children:"⬅️ Choose theme"})]})]}),x&&!A&&t.jsxs("div",{style:o.gmGameLayout,children:[t.jsxs("div",{style:{minHeight:160,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[p==="ready"&&t.jsxs(t.Fragment,{children:[t.jsx("h1",{style:{...o.gmHeadline1,color:"#ec4c44"},children:"GET READY"}),t.jsx("div",{style:o.gmHourglass,children:"⏳"})]}),p==="memorize"&&t.jsxs("p",{style:{...o.gmBodyM,color:"#10b981"},children:["MEMORIZE (",S,")"]}),p==="guess"&&!R&&t.jsxs("p",{style:o.gmBodyM,children:["⏳ Time left: ",L,"s"]})]}),p!=="ready"&&t.jsx("div",{style:{...o.gmGrid,gridTemplateColumns:_?"repeat(2, 1fr)":"repeat(3, 210px)",gridAutoRows:_?"150px":"210px",gap:_?"12px":"20px",justifyItems:"center",...window.innerWidth>2e3?{gridTemplateColumns:"repeat(3, 260px)",gridAutoRows:"260px",gap:"28px"}:{},...window.innerWidth>2560?{gridTemplateColumns:"repeat(3, 300px)",gridAutoRows:"300px",gap:"32px"}:{}},children:m.map((r,c)=>{const w=y===c&&p==="guess"&&!R;return t.jsx("div",{style:{...o.gmCard,...X==="correct"&&y===c?o.gmCorrect:{},...X==="wrong"&&y===c?o.gmWrong:{}},children:!w&&t.jsx("img",{src:r.src,alt:r.name,style:{width:"100%",height:"100%",objectFit:"cover"}})},c)})}),t.jsxs("div",{style:{marginTop:16,height:80},children:[p==="guess"&&!R&&t.jsxs("div",{children:[t.jsx("input",{type:"text",placeholder:"Type the missing word",value:O,onChange:r=>P(r.target.value),style:o.gmInput}),t.jsx("button",{style:{...o.gmButton,marginLeft:8},onClick:z,disabled:E,children:E?"...":"Check"})]}),R&&t.jsx("button",{style:o.gmButton,onClick:$,children:"Next round"})]})]})]})}exports.Game=Te;exports.themes=oe;
36
+ `,document.head.appendChild(r)},me=(r,c)=>{const l=Array.from({length:r.length+1},()=>Array(c.length+1).fill(0));for(let s=0;s<=r.length;s++)l[s][0]=s;for(let s=0;s<=c.length;s++)l[0][s]=s;for(let s=1;s<=r.length;s++)for(let a=1;a<=c.length;a++)l[s][a]=r[s-1]===c[a-1]?l[s-1][a-1]:Math.min(l[s-1][a-1],l[s][a-1],l[s-1][a])+1;return l[r.length][c.length]};function ge(){n.useEffect(()=>{ce()},[]);const[r,c]=n.useState(null),[l,s]=n.useState([]),[a,$]=n.useState(4),[h,L]=n.useState(!1),[f,W]=n.useState(1),[u,K]=n.useState(null),[m,y]=n.useState("ready"),[E,G]=n.useState(3),[k,C]=n.useState(7),[T,F]=n.useState(20),[V,v]=n.useState(0),[b,R]=n.useState(!1),[w,D]=n.useState(""),[p,z]=n.useState(!1),[I,q]=n.useState(!1),[P,x]=n.useState(null),[Z,A]=n.useState([]),[J,U]=n.useState([]),[j,Q]=n.useState(!1);n.useEffect(()=>{const t=()=>Q(window.innerWidth<768);return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const Y=t=>[...t].sort(()=>Math.random()-.5).slice(0,6),N=()=>{if(!r)return;const t=Y(M[r]);s(t),L(!0),R(!1),W(1),v(0),A([]),U([]),O(t,[],!0)},O=(t=l,i=J,g=!1)=>{const d=Y(t.length?t:M[r]);let S=Math.floor(Math.random()*d.length),H=d[S].name,_=0;for(;i.includes(H)&&_<20;)S=Math.floor(Math.random()*d.length),H=d[S].name,_++;s(d),K(S),U([...i,H]),z(!1),D(""),F(20),x(null),g?(y("ready"),G(3),C(7)):(y("memorize"),C(7))};n.useEffect(()=>{if(!(!h||b||p)){if(m==="ready")if(E<=0)y("memorize");else{const t=setTimeout(()=>G(i=>i-1),1e3);return()=>clearTimeout(t)}if(m==="memorize")if(k<=0)y("guess");else{const t=setTimeout(()=>C(i=>i-1),1e3);return()=>clearTimeout(t)}if(m==="guess"){if(T<=0){z(!0),x("wrong");const i=l[u].name;A(g=>[...g,{round:f,answer:w,correct:i,result:"wrong"}]);return}const t=setTimeout(()=>F(i=>i-1),1e3);return()=>clearTimeout(t)}}},[m,E,k,T,h,b,p,l,u,f,w]);const X=()=>{if(u===null||I)return;const t=l[u].name,i=w.toLowerCase().trim();let g="wrong";i===t?(v(d=>d+1),x("correct"),g="correct"):me(i,t)===1?(v(d=>d+.5),x("almost"),g="almost"):(x("wrong"),g="wrong"),A(d=>[...d,{round:f,answer:i,correct:t,result:g}]),q(!0),setTimeout(()=>{q(!1),z(!0)},600)},ee=()=>f<a?(W(t=>t+1),O()):R(!0),te=()=>{L(!1),R(!1),c(null)},oe=()=>e.jsx("div",{style:o.gmLogoFixed,children:e.jsx("img",{src:de,alt:"SPEAKID Logo",style:o.gmLogoImg})});return e.jsxs(e.Fragment,{children:[!j&&e.jsx(oe,{}),!r&&!h&&e.jsxs("div",{style:o.gmCenterScreen,children:[e.jsx("h1",{style:o.gmHeadline1,children:"WHAT'S MISSING?"}),e.jsx("p",{style:o.gmBodyM,children:"Select a theme:"}),e.jsx("div",{style:{display:"flex",gap:16},children:["animals","food","toys"].map(t=>e.jsx("button",{style:o.gmButton,onClick:()=>c(t),children:t==="animals"?"🐶 Animals":t==="food"?"🍎 Food":"🧸 Toys"},t))}),e.jsxs("div",{style:{marginTop:24},children:[e.jsx("p",{style:o.gmBodyS,children:"Choose number of rounds:"}),e.jsx("div",{style:{display:"flex",gap:12,marginTop:8},children:[3,4,5].map(t=>e.jsx("button",{style:{...o.gmButton,...a===t?o.gmButtonActive:{}},onClick:()=>$(t),children:t},t))})]})]}),r&&!h&&e.jsxs("div",{style:o.gmCenterScreen,children:[e.jsxs("h1",{style:o.gmHeadline1,children:["Theme selected: ",r]}),e.jsxs("p",{style:o.gmBodyM,children:["Rounds: ",a]}),e.jsx("button",{style:o.gmButton,onClick:N,children:"▶ Start game"})]}),b&&e.jsxs("div",{style:o.gmCenterScreen,children:[e.jsx("h1",{style:o.gmHeadline1,children:"Results"}),e.jsxs("h2",{style:o.gmHeadline3,children:["Your score: ",V," / ",a]}),e.jsxs("table",{style:o.gmTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Round"}),e.jsx("th",{children:"Your Answer"}),e.jsx("th",{children:"Correct"}),e.jsx("th",{children:"Result"})]})}),e.jsx("tbody",{children:Z.map((t,i)=>e.jsxs("tr",{children:[e.jsx("td",{style:o.gmTableCell,children:t.round}),e.jsx("td",{style:o.gmTableCell,children:t.answer||"—"}),e.jsx("td",{style:o.gmTableCell,children:t.correct}),e.jsx("td",{style:o.gmTableCell,children:t.result==="correct"?"✔ Correct":t.result==="almost"?"◐ Almost (0.5)":"✘ Wrong"})]},i))})]}),e.jsxs("div",{style:{display:"flex",gap:12,marginTop:24},children:[e.jsx("button",{style:o.gmButton,onClick:N,children:"🔁 Play again"}),e.jsx("button",{style:o.gmButton,onClick:te,children:"⬅️ Choose theme"})]})]}),h&&!b&&e.jsxs("div",{style:o.gmGameLayout,children:[e.jsxs("div",{style:{minHeight:160,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[m==="ready"&&e.jsxs(e.Fragment,{children:[e.jsx("h1",{style:{...o.gmHeadline1,color:"#ec4c44"},children:"GET READY"}),e.jsx("div",{style:o.gmHourglass,children:"⏳"})]}),m==="memorize"&&e.jsxs("p",{style:{...o.gmBodyM,color:"#10b981"},children:["MEMORIZE (",k,")"]}),m==="guess"&&!p&&e.jsxs("p",{style:o.gmBodyM,children:["⏳ Time left: ",T,"s"]})]}),m!=="ready"&&e.jsx("div",{style:{...o.gmGrid,gridTemplateColumns:j?"repeat(2, 1fr)":"repeat(3, 210px)",gridAutoRows:j?"150px":"210px",gap:j?"12px":"20px",justifyItems:"center",...window.innerWidth>2e3?{gridTemplateColumns:"repeat(3, 260px)",gridAutoRows:"260px",gap:"28px"}:{},...window.innerWidth>2560?{gridTemplateColumns:"repeat(3, 300px)",gridAutoRows:"300px",gap:"32px"}:{}},children:l.map((t,i)=>{const g=u===i&&m==="guess"&&!p;return e.jsx("div",{style:{...o.gmCard,...P==="correct"&&u===i?o.gmCorrect:{},...P==="wrong"&&u===i?o.gmWrong:{}},children:!g&&e.jsx("img",{src:t.src,alt:t.name,style:{width:"100%",height:"100%",objectFit:"cover"}})},i)})}),e.jsxs("div",{style:{marginTop:16,height:80},children:[m==="guess"&&!p&&e.jsxs("div",{children:[e.jsx("input",{type:"text",placeholder:"Type the missing word",value:w,onChange:t=>D(t.target.value),style:o.gmInput}),e.jsx("button",{style:{...o.gmButton,marginLeft:8},onClick:X,disabled:I,children:I?"...":"Check"})]}),p&&e.jsx("button",{style:o.gmButton,onClick:ee,children:"Next round"})]})]})]})}exports.Game=ge;exports.themes=M;
@@ -1,286 +1,9 @@
1
- import de, { useEffect as ne, useState as f } from "react";
2
- var ee = { exports: {} }, D = {};
3
- /**
4
- * @license React
5
- * react-jsx-runtime.production.js
6
- *
7
- * Copyright (c) Meta Platforms, Inc. and affiliates.
8
- *
9
- * This source code is licensed under the MIT license found in the
10
- * LICENSE file in the root directory of this source tree.
11
- */
12
- var ae;
13
- function ue() {
14
- if (ae) return D;
15
- ae = 1;
16
- var a = Symbol.for("react.transitional.element"), p = Symbol.for("react.fragment");
17
- function u(s, i, h) {
18
- var x = null;
19
- if (h !== void 0 && (x = "" + h), i.key !== void 0 && (x = "" + i.key), "key" in i) {
20
- h = {};
21
- for (var v in i)
22
- v !== "key" && (h[v] = i[v]);
23
- } else h = i;
24
- return i = h.ref, {
25
- $$typeof: a,
26
- type: s,
27
- key: x,
28
- ref: i !== void 0 ? i : null,
29
- props: h
30
- };
31
- }
32
- return D.Fragment = p, D.jsx = u, D.jsxs = u, D;
33
- }
34
- var G = {};
35
- /**
36
- * @license React
37
- * react-jsx-runtime.development.js
38
- *
39
- * Copyright (c) Meta Platforms, Inc. and affiliates.
40
- *
41
- * This source code is licensed under the MIT license found in the
42
- * LICENSE file in the root directory of this source tree.
43
- */
44
- var ie;
45
- function me() {
46
- return ie || (ie = 1, process.env.NODE_ENV !== "production" && (function() {
47
- function a(e) {
48
- if (e == null) return null;
49
- if (typeof e == "function")
50
- return e.$$typeof === H ? null : e.displayName || e.name || null;
51
- if (typeof e == "string") return e;
52
- switch (e) {
53
- case E:
54
- return "Fragment";
55
- case L:
56
- return "Profiler";
57
- case M:
58
- return "StrictMode";
59
- case A:
60
- return "Suspense";
61
- case F:
62
- return "SuspenseList";
63
- case R:
64
- return "Activity";
65
- }
66
- if (typeof e == "object")
67
- switch (typeof e.tag == "number" && console.error(
68
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
69
- ), e.$$typeof) {
70
- case V:
71
- return "Portal";
72
- case te:
73
- return e.displayName || "Context";
74
- case J:
75
- return (e._context.displayName || "Context") + ".Consumer";
76
- case W:
77
- var n = e.render;
78
- return e = e.displayName, e || (e = n.displayName || n.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
79
- case O:
80
- return n = e.displayName || null, n !== null ? n : a(e.type) || "Memo";
81
- case P:
82
- n = e._payload, e = e._init;
83
- try {
84
- return a(e(n));
85
- } catch {
86
- }
87
- }
88
- return null;
89
- }
90
- function p(e) {
91
- return "" + e;
92
- }
93
- function u(e) {
94
- try {
95
- p(e);
96
- var n = !1;
97
- } catch {
98
- n = !0;
99
- }
100
- if (n) {
101
- n = console;
102
- var l = n.error, d = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
103
- return l.call(
104
- n,
105
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
106
- d
107
- ), p(e);
108
- }
109
- }
110
- function s(e) {
111
- if (e === E) return "<>";
112
- if (typeof e == "object" && e !== null && e.$$typeof === P)
113
- return "<...>";
114
- try {
115
- var n = a(e);
116
- return n ? "<" + n + ">" : "<...>";
117
- } catch {
118
- return "<...>";
119
- }
120
- }
121
- function i() {
122
- var e = _.A;
123
- return e === null ? null : e.getOwner();
124
- }
125
- function h() {
126
- return Error("react-stack-top-frame");
127
- }
128
- function x(e) {
129
- if (Y.call(e, "key")) {
130
- var n = Object.getOwnPropertyDescriptor(e, "key").get;
131
- if (n && n.isReactWarning) return !1;
132
- }
133
- return e.key !== void 0;
134
- }
135
- function v(e, n) {
136
- function l() {
137
- Z || (Z = !0, console.error(
138
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
139
- n
140
- ));
141
- }
142
- l.isReactWarning = !0, Object.defineProperty(e, "key", {
143
- get: l,
144
- configurable: !0
145
- });
146
- }
147
- function C() {
148
- var e = a(this.type);
149
- return I[e] || (I[e] = !0, console.error(
150
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
151
- )), e = this.props.ref, e !== void 0 ? e : null;
152
- }
153
- function U(e, n, l, d, z, $) {
154
- var m = l.ref;
155
- return e = {
156
- $$typeof: N,
157
- type: e,
158
- key: n,
159
- props: l,
160
- _owner: d
161
- }, (m !== void 0 ? m : null) !== null ? Object.defineProperty(e, "ref", {
162
- enumerable: !1,
163
- get: C
164
- }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
165
- configurable: !1,
166
- enumerable: !1,
167
- writable: !0,
168
- value: 0
169
- }), Object.defineProperty(e, "_debugInfo", {
170
- configurable: !1,
171
- enumerable: !1,
172
- writable: !0,
173
- value: null
174
- }), Object.defineProperty(e, "_debugStack", {
175
- configurable: !1,
176
- enumerable: !1,
177
- writable: !0,
178
- value: z
179
- }), Object.defineProperty(e, "_debugTask", {
180
- configurable: !1,
181
- enumerable: !1,
182
- writable: !0,
183
- value: $
184
- }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
185
- }
186
- function y(e, n, l, d, z, $) {
187
- var m = n.children;
188
- if (m !== void 0)
189
- if (d)
190
- if (X(m)) {
191
- for (d = 0; d < m.length; d++)
192
- q(m[d]);
193
- Object.freeze && Object.freeze(m);
194
- } else
195
- console.error(
196
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
197
- );
198
- else q(m);
199
- if (Y.call(n, "key")) {
200
- m = a(e);
201
- var k = Object.keys(n).filter(function(c) {
202
- return c !== "key";
203
- });
204
- d = 0 < k.length ? "{key: someKey, " + k.join(": ..., ") + ": ...}" : "{key: someKey}", S[m + d] || (k = 0 < k.length ? "{" + k.join(": ..., ") + ": ...}" : "{}", console.error(
205
- `A props object containing a "key" prop is being spread into JSX:
206
- let props = %s;
207
- <%s {...props} />
208
- React keys must be passed directly to JSX without using spread:
209
- let props = %s;
210
- <%s key={someKey} {...props} />`,
211
- d,
212
- m,
213
- k,
214
- m
215
- ), S[m + d] = !0);
216
- }
217
- if (m = null, l !== void 0 && (u(l), m = "" + l), x(n) && (u(n.key), m = "" + n.key), "key" in n) {
218
- l = {};
219
- for (var r in n)
220
- r !== "key" && (l[r] = n[r]);
221
- } else l = n;
222
- return m && v(
223
- l,
224
- typeof e == "function" ? e.displayName || e.name || "Unknown" : e
225
- ), U(
226
- e,
227
- m,
228
- l,
229
- i(),
230
- z,
231
- $
232
- );
233
- }
234
- function q(e) {
235
- g(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === P && (e._payload.status === "fulfilled" ? g(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
236
- }
237
- function g(e) {
238
- return typeof e == "object" && e !== null && e.$$typeof === N;
239
- }
240
- var T = de, N = Symbol.for("react.transitional.element"), V = Symbol.for("react.portal"), E = Symbol.for("react.fragment"), M = Symbol.for("react.strict_mode"), L = Symbol.for("react.profiler"), J = Symbol.for("react.consumer"), te = Symbol.for("react.context"), W = Symbol.for("react.forward_ref"), A = Symbol.for("react.suspense"), F = Symbol.for("react.suspense_list"), O = Symbol.for("react.memo"), P = Symbol.for("react.lazy"), R = Symbol.for("react.activity"), H = Symbol.for("react.client.reference"), _ = T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Y = Object.prototype.hasOwnProperty, X = Array.isArray, j = console.createTask ? console.createTask : function() {
241
- return null;
242
- };
243
- T = {
244
- react_stack_bottom_frame: function(e) {
245
- return e();
246
- }
247
- };
248
- var Z, I = {}, Q = T.react_stack_bottom_frame.bind(
249
- T,
250
- h
251
- )(), B = j(s(h)), S = {};
252
- G.Fragment = E, G.jsx = function(e, n, l) {
253
- var d = 1e4 > _.recentlyCreatedOwnerStacks++;
254
- return y(
255
- e,
256
- n,
257
- l,
258
- !1,
259
- d ? Error("react-stack-top-frame") : Q,
260
- d ? j(s(e)) : B
261
- );
262
- }, G.jsxs = function(e, n, l) {
263
- var d = 1e4 > _.recentlyCreatedOwnerStacks++;
264
- return y(
265
- e,
266
- n,
267
- l,
268
- !0,
269
- d ? Error("react-stack-top-frame") : Q,
270
- d ? j(s(e)) : B
271
- );
272
- };
273
- })()), G;
274
- }
275
- var le;
276
- function fe() {
277
- return le || (le = 1, process.env.NODE_ENV === "production" ? ee.exports = ue() : ee.exports = me()), ee.exports;
278
- }
279
- var t = fe();
280
- const pe = window.origin + "/cloud/speakid/games/whatsmissing/", oe = (a, p) => a.map(([u, s]) => ({
281
- src: `${pe}${p}/${s.replace(/\s/g, "%20")}.png`,
282
- name: s
283
- })), ge = [
1
+ import { jsxs as s, Fragment as O, jsx as o } from "react/jsx-runtime";
2
+ import { useEffect as M, useState as l } from "react";
3
+ const ie = window.origin + "/cloud/speakid/games/whatsmissing/", W = (r, m) => r.map(([a, n]) => ({
4
+ src: `${ie}${m}/${n.replace(/\s/g, "%20")}.png`,
5
+ name: n
6
+ })), se = [
284
7
  ["apple", "apple"],
285
8
  ["banana", "banana"],
286
9
  ["bread", "bread"],
@@ -306,7 +29,7 @@ const pe = window.origin + "/cloud/speakid/games/whatsmissing/", oe = (a, p) =>
306
29
  ["strawberry", "strawberry"],
307
30
  ["tomato", "tomato"],
308
31
  ["watermelon", "watermelon"]
309
- ], he = [
32
+ ], le = [
310
33
  ["bear", "bear"],
311
34
  ["cat", "cat"],
312
35
  ["crocodile", "crocodile"],
@@ -326,7 +49,7 @@ const pe = window.origin + "/cloud/speakid/games/whatsmissing/", oe = (a, p) =>
326
49
  ["tortoise", "tortoise"],
327
50
  ["wolf", "wolf"],
328
51
  ["zebra", "zebra"]
329
- ], xe = [
52
+ ], ae = [
330
53
  ["ball", "ball"],
331
54
  ["balloon", "balloon"],
332
55
  ["blocks", "blocks"],
@@ -346,23 +69,23 @@ const pe = window.origin + "/cloud/speakid/games/whatsmissing/", oe = (a, p) =>
346
69
  ["teddy_bear", "teddy bear"],
347
70
  ["yo-yo", "yo-yo"],
348
71
  ["crayons", "crayons"]
349
- ], ce = {
350
- food: oe(ge, "food"),
351
- animals: oe(he, "animals"),
352
- toys: oe(xe, "toys")
353
- }, be = `
72
+ ], V = {
73
+ food: W(se, "food"),
74
+ animals: W(le, "animals"),
75
+ toys: W(ae, "toys")
76
+ }, de = `
354
77
  @keyframes spin {
355
78
  from { transform: rotate(0deg); }
356
79
  to { transform: rotate(360deg); }
357
80
  }
358
81
  `;
359
82
  if (typeof document < "u" && !document.getElementById("spin-keyframes")) {
360
- const a = document.createElement("style");
361
- a.id = "spin-keyframes", a.innerHTML = be, document.head.appendChild(a);
83
+ const r = document.createElement("style");
84
+ r.id = "spin-keyframes", r.innerHTML = de, document.head.appendChild(r);
362
85
  }
363
- const ye = {
86
+ const ce = {
364
87
  animation: "spin 1.4s linear infinite"
365
- }, o = {
88
+ }, t = {
366
89
  gmCenterScreen: {
367
90
  position: "relative",
368
91
  zIndex: 1,
@@ -502,11 +225,11 @@ const ye = {
502
225
  },
503
226
  gmHourglass: {
504
227
  fontSize: "42px",
505
- ...ye
228
+ ...ce
506
229
  }
507
- }, we = window.origin + "/cloud/speakid/games/whatsmissing/logo.png", Te = () => {
508
- const a = document.createElement("style");
509
- a.textContent = `
230
+ }, me = window.origin + "/cloud/speakid/games/whatsmissing/logo.png", ge = () => {
231
+ const r = document.createElement("style");
232
+ r.textContent = `
510
233
  html, body, #root {
511
234
  margin: 0;
512
235
  padding: 0;
@@ -536,154 +259,154 @@ const ye = {
536
259
  from { transform: rotate(0deg); }
537
260
  to { transform: rotate(360deg); }
538
261
  }
539
- `, document.head.appendChild(a);
540
- }, je = (a, p) => {
541
- const u = Array.from({ length: a.length + 1 }, () => Array(p.length + 1).fill(0));
542
- for (let s = 0; s <= a.length; s++) u[s][0] = s;
543
- for (let s = 0; s <= p.length; s++) u[0][s] = s;
544
- for (let s = 1; s <= a.length; s++)
545
- for (let i = 1; i <= p.length; i++)
546
- u[s][i] = a[s - 1] === p[i - 1] ? u[s - 1][i - 1] : Math.min(u[s - 1][i - 1], u[s][i - 1], u[s - 1][i]) + 1;
547
- return u[a.length][p.length];
262
+ `, document.head.appendChild(r);
263
+ }, pe = (r, m) => {
264
+ const a = Array.from({ length: r.length + 1 }, () => Array(m.length + 1).fill(0));
265
+ for (let n = 0; n <= r.length; n++) a[n][0] = n;
266
+ for (let n = 0; n <= m.length; n++) a[0][n] = n;
267
+ for (let n = 1; n <= r.length; n++)
268
+ for (let d = 1; d <= m.length; d++)
269
+ a[n][d] = r[n - 1] === m[d - 1] ? a[n - 1][d - 1] : Math.min(a[n - 1][d - 1], a[n][d - 1], a[n - 1][d]) + 1;
270
+ return a[r.length][m.length];
548
271
  };
549
- function Re() {
550
- ne(() => {
551
- Te();
272
+ function ye() {
273
+ M(() => {
274
+ ge();
552
275
  }, []);
553
- const [a, p] = f(null), [u, s] = f([]), [i, h] = f(4), [x, v] = f(!1), [C, U] = f(1), [y, q] = f(null), [g, T] = f("ready"), [N, V] = f(3), [E, M] = f(7), [L, J] = f(20), [te, W] = f(0), [A, F] = f(!1), [O, P] = f(""), [R, H] = f(!1), [_, Y] = f(!1), [X, j] = f(null), [Z, I] = f([]), [Q, B] = f([]), [S, e] = f(!1);
554
- ne(() => {
555
- const r = () => e(window.innerWidth < 768);
556
- return r(), window.addEventListener("resize", r), () => window.removeEventListener("resize", r);
276
+ const [r, m] = l(null), [a, n] = l([]), [d, Z] = l(4), [f, j] = l(!1), [x, G] = l(1), [u, J] = l(null), [g, b] = l("ready"), [E, F] = l(3), [v, S] = l(7), [z, D] = l(20), [Q, R] = l(0), [w, I] = l(!1), [k, U] = l(""), [h, A] = l(!1), [H, Y] = l(!1), [N, y] = l(null), [X, B] = l([]), [ee, P] = l([]), [C, te] = l(!1);
277
+ M(() => {
278
+ const e = () => te(window.innerWidth < 768);
279
+ return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
557
280
  }, []);
558
- const n = (r) => [...r].sort(() => Math.random() - 0.5).slice(0, 6), l = () => {
559
- if (!a) return;
560
- const r = n(ce[a]);
561
- s(r), v(!0), F(!1), U(1), W(0), I([]), B([]), d(r, [], !0);
562
- }, d = (r = u, c = Q, w = !1) => {
563
- const b = n(r.length ? r : ce[a]);
564
- let K = Math.floor(Math.random() * b.length), re = b[K].name, se = 0;
565
- for (; c.includes(re) && se < 20; )
566
- K = Math.floor(Math.random() * b.length), re = b[K].name, se++;
567
- s(b), q(K), B([...c, re]), H(!1), P(""), J(20), j(null), w ? (T("ready"), V(3), M(7)) : (T("memorize"), M(7));
281
+ const _ = (e) => [...e].sort(() => Math.random() - 0.5).slice(0, 6), $ = () => {
282
+ if (!r) return;
283
+ const e = _(V[r]);
284
+ n(e), j(!0), I(!1), G(1), R(0), B([]), P([]), q(e, [], !0);
285
+ }, q = (e = a, i = ee, p = !1) => {
286
+ const c = _(e.length ? e : V[r]);
287
+ let T = Math.floor(Math.random() * c.length), L = c[T].name, K = 0;
288
+ for (; i.includes(L) && K < 20; )
289
+ T = Math.floor(Math.random() * c.length), L = c[T].name, K++;
290
+ n(c), J(T), P([...i, L]), A(!1), U(""), D(20), y(null), p ? (b("ready"), F(3), S(7)) : (b("memorize"), S(7));
568
291
  };
569
- ne(() => {
570
- if (!(!x || A || R)) {
292
+ M(() => {
293
+ if (!(!f || w || h)) {
571
294
  if (g === "ready")
572
- if (N <= 0)
573
- T("memorize");
295
+ if (E <= 0)
296
+ b("memorize");
574
297
  else {
575
- const r = setTimeout(() => V((c) => c - 1), 1e3);
576
- return () => clearTimeout(r);
298
+ const e = setTimeout(() => F((i) => i - 1), 1e3);
299
+ return () => clearTimeout(e);
577
300
  }
578
301
  if (g === "memorize")
579
- if (E <= 0)
580
- T("guess");
302
+ if (v <= 0)
303
+ b("guess");
581
304
  else {
582
- const r = setTimeout(() => M((c) => c - 1), 1e3);
583
- return () => clearTimeout(r);
305
+ const e = setTimeout(() => S((i) => i - 1), 1e3);
306
+ return () => clearTimeout(e);
584
307
  }
585
308
  if (g === "guess") {
586
- if (L <= 0) {
587
- H(!0), j("wrong");
588
- const c = u[y].name;
589
- I((w) => [
590
- ...w,
591
- { round: C, answer: O, correct: c, result: "wrong" }
309
+ if (z <= 0) {
310
+ A(!0), y("wrong");
311
+ const i = a[u].name;
312
+ B((p) => [
313
+ ...p,
314
+ { round: x, answer: k, correct: i, result: "wrong" }
592
315
  ]);
593
316
  return;
594
317
  }
595
- const r = setTimeout(() => J((c) => c - 1), 1e3);
596
- return () => clearTimeout(r);
318
+ const e = setTimeout(() => D((i) => i - 1), 1e3);
319
+ return () => clearTimeout(e);
597
320
  }
598
321
  }
599
322
  }, [
600
323
  g,
601
- N,
602
324
  E,
603
- L,
604
- x,
605
- A,
606
- R,
325
+ v,
326
+ z,
327
+ f,
328
+ w,
329
+ h,
330
+ a,
607
331
  u,
608
- y,
609
- C,
610
- O
332
+ x,
333
+ k
611
334
  ]);
612
- const z = () => {
613
- if (y === null || _) return;
614
- const r = u[y].name, c = O.toLowerCase().trim();
615
- let w = "wrong";
616
- c === r ? (W((b) => b + 1), j("correct"), w = "correct") : je(c, r) === 1 ? (W((b) => b + 0.5), j("almost"), w = "almost") : (j("wrong"), w = "wrong"), I((b) => [
617
- ...b,
618
- { round: C, answer: c, correct: r, result: w }
335
+ const oe = () => {
336
+ if (u === null || H) return;
337
+ const e = a[u].name, i = k.toLowerCase().trim();
338
+ let p = "wrong";
339
+ i === e ? (R((c) => c + 1), y("correct"), p = "correct") : pe(i, e) === 1 ? (R((c) => c + 0.5), y("almost"), p = "almost") : (y("wrong"), p = "wrong"), B((c) => [
340
+ ...c,
341
+ { round: x, answer: i, correct: e, result: p }
619
342
  ]), Y(!0), setTimeout(() => {
620
- Y(!1), H(!0);
343
+ Y(!1), A(!0);
621
344
  }, 600);
622
- }, $ = () => C < i ? (U((r) => r + 1), d()) : F(!0), m = () => {
623
- v(!1), F(!1), p(null);
624
- }, k = () => /* @__PURE__ */ t.jsx("div", { style: o.gmLogoFixed, children: /* @__PURE__ */ t.jsx("img", { src: we, alt: "SPEAKID Logo", style: o.gmLogoImg }) });
625
- return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
626
- !S && /* @__PURE__ */ t.jsx(k, {}),
627
- !a && !x && /* @__PURE__ */ t.jsxs("div", { style: o.gmCenterScreen, children: [
628
- /* @__PURE__ */ t.jsx("h1", { style: o.gmHeadline1, children: "WHAT'S MISSING?" }),
629
- /* @__PURE__ */ t.jsx("p", { style: o.gmBodyM, children: "Select a theme:" }),
630
- /* @__PURE__ */ t.jsx("div", { style: { display: "flex", gap: 16 }, children: ["animals", "food", "toys"].map((r) => /* @__PURE__ */ t.jsx("button", { style: o.gmButton, onClick: () => p(r), children: r === "animals" ? "🐶 Animals" : r === "food" ? "🍎 Food" : "🧸 Toys" }, r)) }),
631
- /* @__PURE__ */ t.jsxs("div", { style: { marginTop: 24 }, children: [
632
- /* @__PURE__ */ t.jsx("p", { style: o.gmBodyS, children: "Choose number of rounds:" }),
633
- /* @__PURE__ */ t.jsx("div", { style: { display: "flex", gap: 12, marginTop: 8 }, children: [3, 4, 5].map((r) => /* @__PURE__ */ t.jsx(
345
+ }, ne = () => x < d ? (G((e) => e + 1), q()) : I(!0), re = () => {
346
+ j(!1), I(!1), m(null);
347
+ };
348
+ return /* @__PURE__ */ s(O, { children: [
349
+ !C && /* @__PURE__ */ o(() => /* @__PURE__ */ o("div", { style: t.gmLogoFixed, children: /* @__PURE__ */ o("img", { src: me, alt: "SPEAKID Logo", style: t.gmLogoImg }) }), {}),
350
+ !r && !f && /* @__PURE__ */ s("div", { style: t.gmCenterScreen, children: [
351
+ /* @__PURE__ */ o("h1", { style: t.gmHeadline1, children: "WHAT'S MISSING?" }),
352
+ /* @__PURE__ */ o("p", { style: t.gmBodyM, children: "Select a theme:" }),
353
+ /* @__PURE__ */ o("div", { style: { display: "flex", gap: 16 }, children: ["animals", "food", "toys"].map((e) => /* @__PURE__ */ o("button", { style: t.gmButton, onClick: () => m(e), children: e === "animals" ? "🐶 Animals" : e === "food" ? "🍎 Food" : "🧸 Toys" }, e)) }),
354
+ /* @__PURE__ */ s("div", { style: { marginTop: 24 }, children: [
355
+ /* @__PURE__ */ o("p", { style: t.gmBodyS, children: "Choose number of rounds:" }),
356
+ /* @__PURE__ */ o("div", { style: { display: "flex", gap: 12, marginTop: 8 }, children: [3, 4, 5].map((e) => /* @__PURE__ */ o(
634
357
  "button",
635
358
  {
636
359
  style: {
637
- ...o.gmButton,
638
- ...i === r ? o.gmButtonActive : {}
360
+ ...t.gmButton,
361
+ ...d === e ? t.gmButtonActive : {}
639
362
  },
640
- onClick: () => h(r),
641
- children: r
363
+ onClick: () => Z(e),
364
+ children: e
642
365
  },
643
- r
366
+ e
644
367
  )) })
645
368
  ] })
646
369
  ] }),
647
- a && !x && /* @__PURE__ */ t.jsxs("div", { style: o.gmCenterScreen, children: [
648
- /* @__PURE__ */ t.jsxs("h1", { style: o.gmHeadline1, children: [
370
+ r && !f && /* @__PURE__ */ s("div", { style: t.gmCenterScreen, children: [
371
+ /* @__PURE__ */ s("h1", { style: t.gmHeadline1, children: [
649
372
  "Theme selected: ",
650
- a
373
+ r
651
374
  ] }),
652
- /* @__PURE__ */ t.jsxs("p", { style: o.gmBodyM, children: [
375
+ /* @__PURE__ */ s("p", { style: t.gmBodyM, children: [
653
376
  "Rounds: ",
654
- i
377
+ d
655
378
  ] }),
656
- /* @__PURE__ */ t.jsx("button", { style: o.gmButton, onClick: l, children: "▶ Start game" })
379
+ /* @__PURE__ */ o("button", { style: t.gmButton, onClick: $, children: "▶ Start game" })
657
380
  ] }),
658
- A && /* @__PURE__ */ t.jsxs("div", { style: o.gmCenterScreen, children: [
659
- /* @__PURE__ */ t.jsx("h1", { style: o.gmHeadline1, children: "Results" }),
660
- /* @__PURE__ */ t.jsxs("h2", { style: o.gmHeadline3, children: [
381
+ w && /* @__PURE__ */ s("div", { style: t.gmCenterScreen, children: [
382
+ /* @__PURE__ */ o("h1", { style: t.gmHeadline1, children: "Results" }),
383
+ /* @__PURE__ */ s("h2", { style: t.gmHeadline3, children: [
661
384
  "Your score: ",
662
- te,
385
+ Q,
663
386
  " / ",
664
- i
387
+ d
665
388
  ] }),
666
- /* @__PURE__ */ t.jsxs("table", { style: o.gmTable, children: [
667
- /* @__PURE__ */ t.jsx("thead", { children: /* @__PURE__ */ t.jsxs("tr", { children: [
668
- /* @__PURE__ */ t.jsx("th", { children: "Round" }),
669
- /* @__PURE__ */ t.jsx("th", { children: "Your Answer" }),
670
- /* @__PURE__ */ t.jsx("th", { children: "Correct" }),
671
- /* @__PURE__ */ t.jsx("th", { children: "Result" })
389
+ /* @__PURE__ */ s("table", { style: t.gmTable, children: [
390
+ /* @__PURE__ */ o("thead", { children: /* @__PURE__ */ s("tr", { children: [
391
+ /* @__PURE__ */ o("th", { children: "Round" }),
392
+ /* @__PURE__ */ o("th", { children: "Your Answer" }),
393
+ /* @__PURE__ */ o("th", { children: "Correct" }),
394
+ /* @__PURE__ */ o("th", { children: "Result" })
672
395
  ] }) }),
673
- /* @__PURE__ */ t.jsx("tbody", { children: Z.map((r, c) => /* @__PURE__ */ t.jsxs("tr", { children: [
674
- /* @__PURE__ */ t.jsx("td", { style: o.gmTableCell, children: r.round }),
675
- /* @__PURE__ */ t.jsx("td", { style: o.gmTableCell, children: r.answer || "—" }),
676
- /* @__PURE__ */ t.jsx("td", { style: o.gmTableCell, children: r.correct }),
677
- /* @__PURE__ */ t.jsx("td", { style: o.gmTableCell, children: r.result === "correct" ? "✔ Correct" : r.result === "almost" ? "◐ Almost (0.5)" : "✘ Wrong" })
678
- ] }, c)) })
396
+ /* @__PURE__ */ o("tbody", { children: X.map((e, i) => /* @__PURE__ */ s("tr", { children: [
397
+ /* @__PURE__ */ o("td", { style: t.gmTableCell, children: e.round }),
398
+ /* @__PURE__ */ o("td", { style: t.gmTableCell, children: e.answer || "—" }),
399
+ /* @__PURE__ */ o("td", { style: t.gmTableCell, children: e.correct }),
400
+ /* @__PURE__ */ o("td", { style: t.gmTableCell, children: e.result === "correct" ? "✔ Correct" : e.result === "almost" ? "◐ Almost (0.5)" : "✘ Wrong" })
401
+ ] }, i)) })
679
402
  ] }),
680
- /* @__PURE__ */ t.jsxs("div", { style: { display: "flex", gap: 12, marginTop: 24 }, children: [
681
- /* @__PURE__ */ t.jsx("button", { style: o.gmButton, onClick: l, children: "🔁 Play again" }),
682
- /* @__PURE__ */ t.jsx("button", { style: o.gmButton, onClick: m, children: "⬅️ Choose theme" })
403
+ /* @__PURE__ */ s("div", { style: { display: "flex", gap: 12, marginTop: 24 }, children: [
404
+ /* @__PURE__ */ o("button", { style: t.gmButton, onClick: $, children: "🔁 Play again" }),
405
+ /* @__PURE__ */ o("button", { style: t.gmButton, onClick: re, children: "⬅️ Choose theme" })
683
406
  ] })
684
407
  ] }),
685
- x && !A && /* @__PURE__ */ t.jsxs("div", { style: o.gmGameLayout, children: [
686
- /* @__PURE__ */ t.jsxs(
408
+ f && !w && /* @__PURE__ */ s("div", { style: t.gmGameLayout, children: [
409
+ /* @__PURE__ */ s(
687
410
  "div",
688
411
  {
689
412
  style: {
@@ -694,31 +417,31 @@ function Re() {
694
417
  alignItems: "center"
695
418
  },
696
419
  children: [
697
- g === "ready" && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
698
- /* @__PURE__ */ t.jsx("h1", { style: { ...o.gmHeadline1, color: "#ec4c44" }, children: "GET READY" }),
699
- /* @__PURE__ */ t.jsx("div", { style: o.gmHourglass, children: "⏳" })
420
+ g === "ready" && /* @__PURE__ */ s(O, { children: [
421
+ /* @__PURE__ */ o("h1", { style: { ...t.gmHeadline1, color: "#ec4c44" }, children: "GET READY" }),
422
+ /* @__PURE__ */ o("div", { style: t.gmHourglass, children: "⏳" })
700
423
  ] }),
701
- g === "memorize" && /* @__PURE__ */ t.jsxs("p", { style: { ...o.gmBodyM, color: "#10b981" }, children: [
424
+ g === "memorize" && /* @__PURE__ */ s("p", { style: { ...t.gmBodyM, color: "#10b981" }, children: [
702
425
  "MEMORIZE (",
703
- E,
426
+ v,
704
427
  ")"
705
428
  ] }),
706
- g === "guess" && !R && /* @__PURE__ */ t.jsxs("p", { style: o.gmBodyM, children: [
429
+ g === "guess" && !h && /* @__PURE__ */ s("p", { style: t.gmBodyM, children: [
707
430
  "⏳ Time left: ",
708
- L,
431
+ z,
709
432
  "s"
710
433
  ] })
711
434
  ]
712
435
  }
713
436
  ),
714
- g !== "ready" && /* @__PURE__ */ t.jsx(
437
+ g !== "ready" && /* @__PURE__ */ o(
715
438
  "div",
716
439
  {
717
440
  style: {
718
- ...o.gmGrid,
719
- gridTemplateColumns: S ? "repeat(2, 1fr)" : "repeat(3, 210px)",
720
- gridAutoRows: S ? "150px" : "210px",
721
- gap: S ? "12px" : "20px",
441
+ ...t.gmGrid,
442
+ gridTemplateColumns: C ? "repeat(2, 1fr)" : "repeat(3, 210px)",
443
+ gridAutoRows: C ? "150px" : "210px",
444
+ gap: C ? "12px" : "20px",
722
445
  justifyItems: "center",
723
446
  // 🔹 увеличение только при >2000px
724
447
  ...window.innerWidth > 2e3 ? {
@@ -732,21 +455,21 @@ function Re() {
732
455
  gap: "32px"
733
456
  } : {}
734
457
  },
735
- children: u.map((r, c) => {
736
- const w = y === c && g === "guess" && !R;
737
- return /* @__PURE__ */ t.jsx(
458
+ children: a.map((e, i) => {
459
+ const p = u === i && g === "guess" && !h;
460
+ return /* @__PURE__ */ o(
738
461
  "div",
739
462
  {
740
463
  style: {
741
- ...o.gmCard,
742
- ...X === "correct" && y === c ? o.gmCorrect : {},
743
- ...X === "wrong" && y === c ? o.gmWrong : {}
464
+ ...t.gmCard,
465
+ ...N === "correct" && u === i ? t.gmCorrect : {},
466
+ ...N === "wrong" && u === i ? t.gmWrong : {}
744
467
  },
745
- children: !w && /* @__PURE__ */ t.jsx(
468
+ children: !p && /* @__PURE__ */ o(
746
469
  "img",
747
470
  {
748
- src: r.src,
749
- alt: r.name,
471
+ src: e.src,
472
+ alt: e.name,
750
473
  style: {
751
474
  width: "100%",
752
475
  height: "100%",
@@ -755,39 +478,39 @@ function Re() {
755
478
  }
756
479
  )
757
480
  },
758
- c
481
+ i
759
482
  );
760
483
  })
761
484
  }
762
485
  ),
763
- /* @__PURE__ */ t.jsxs("div", { style: { marginTop: 16, height: 80 }, children: [
764
- g === "guess" && !R && /* @__PURE__ */ t.jsxs("div", { children: [
765
- /* @__PURE__ */ t.jsx(
486
+ /* @__PURE__ */ s("div", { style: { marginTop: 16, height: 80 }, children: [
487
+ g === "guess" && !h && /* @__PURE__ */ s("div", { children: [
488
+ /* @__PURE__ */ o(
766
489
  "input",
767
490
  {
768
491
  type: "text",
769
492
  placeholder: "Type the missing word",
770
- value: O,
771
- onChange: (r) => P(r.target.value),
772
- style: o.gmInput
493
+ value: k,
494
+ onChange: (e) => U(e.target.value),
495
+ style: t.gmInput
773
496
  }
774
497
  ),
775
- /* @__PURE__ */ t.jsx(
498
+ /* @__PURE__ */ o(
776
499
  "button",
777
500
  {
778
- style: { ...o.gmButton, marginLeft: 8 },
779
- onClick: z,
780
- disabled: _,
781
- children: _ ? "..." : "Check"
501
+ style: { ...t.gmButton, marginLeft: 8 },
502
+ onClick: oe,
503
+ disabled: H,
504
+ children: H ? "..." : "Check"
782
505
  }
783
506
  )
784
507
  ] }),
785
- R && /* @__PURE__ */ t.jsx("button", { style: o.gmButton, onClick: $, children: "Next round" })
508
+ h && /* @__PURE__ */ o("button", { style: t.gmButton, onClick: ne, children: "Next round" })
786
509
  ] })
787
510
  ] })
788
511
  ] });
789
512
  }
790
513
  export {
791
- Re as Game,
792
- ce as themes
514
+ ye as Game,
515
+ V as themes
793
516
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mblinkov/whats-missing",
3
- "version": "20.0.2",
3
+ "version": "20.0.3",
4
4
  "main": "dist/whats-missing.umd.js",
5
5
  "module": "dist/whats-missing.es.js",
6
6
  "types": "dist/index.d.ts",
package/vite.config.ts CHANGED
@@ -17,11 +17,12 @@ export default defineConfig({
17
17
  lib: {
18
18
  entry: "src/index.ts",
19
19
  name: "WhatsMissing",
20
- formats: ["es", "cjs"], // ✅ добавлено — теперь Webpack поймет
20
+ formats: ["es", "cjs"], // ✅ поддержка Webpack
21
21
  fileName: (format) => `whats-missing.${format}.js`,
22
22
  },
23
23
  rollupOptions: {
24
- external: ["react", "react-dom"],
24
+ // 🔥 добавлено "react/jsx-runtime"
25
+ external: ["react", "react-dom", "react/jsx-runtime"],
25
26
  output: {
26
27
  globals: {
27
28
  react: "React",