speakid-hangman 1.0.8 → 1.0.11
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HangmanLobbyGame.d.ts","sourceRoot":"","sources":["../../src/components/HangmanLobbyGame.tsx"],"names":[],"mappings":"AA+MA,MAAM,WAAW,qBAAqB;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,YAAkB,EAClB,YAAkB,EAClB,WAAiB,EACjB,OAAO,EACP,QAAe,EACf,OAAO,GACR,GAAE,qBAA0B,
|
|
1
|
+
{"version":3,"file":"HangmanLobbyGame.d.ts","sourceRoot":"","sources":["../../src/components/HangmanLobbyGame.tsx"],"names":[],"mappings":"AA+MA,MAAM,WAAW,qBAAqB;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,YAAkB,EAClB,YAAkB,EAClB,WAAiB,EACjB,OAAO,EACP,QAAe,EACf,OAAO,GACR,GAAE,qBAA0B,2CA0kC5B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),a=require("react"),i={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",fontFamily:'"Onest", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif',background:"transparent"},gmHeadline1:{fontWeight:600,fontSize:"clamp(30px, 4vw, 32px)",lineHeight:"110%",marginBottom:"24px",color:"#1f2937",fontFamily:'"Onest", system-ui, sans-serif'},gmHeadline3:{fontWeight:500,fontSize:"clamp(16px, 2vw, 24px)",lineHeight:"110%",marginBottom:"12px",color:"#1f2937",fontFamily:'"Onest", system-ui, sans-serif'},gmBodyL:{fontWeight:400,fontSize:"18px",lineHeight:"120%",marginBottom:"12px",color:"#1f2937",fontFamily:'"Onest", system-ui, sans-serif'},gmBodyM:{fontWeight:400,fontSize:"clamp(14px, 1.5vw, 16px)",lineHeight:"120%",marginBottom:"8px",color:"#1f2937",fontFamily:'"Onest", system-ui, sans-serif'},gmBodyS:{fontWeight:400,fontSize:"clamp(12px, 1.5vw, 14px)",lineHeight:"120%",color:"#6b7280",marginBottom:"8px",fontFamily:'"Onest", system-ui, sans-serif'},gmButton:{fontFamily:'"Onest", system-ui, sans-serif',fontWeight:400,fontSize:"16px",lineHeight:"100%",padding:"10px 16px",borderRadius:"8px",border:"1px solid #e5e7eb",background:"#ec4c44",color:"#ffffff",cursor:"pointer",boxShadow:"none",transition:"background-color 0.2s ease, opacity 0.2s ease, transform 0.1s ease",margin:"4px"},gmButtonSecondary:{background:"#f9f9f9",color:"#1f2937",border:"1px solid #e5e7eb",boxShadow:"none"},gmButtonGroup:{display:"flex",flexWrap:"wrap",gap:"8px",justifyContent:"center",marginBottom:"24px"},gmWordDisplay:{fontSize:"clamp(20px, 5vw, 28px)",fontWeight:500,letterSpacing:"6px",margin:"32px 0",color:"#1f2937",fontFamily:'"Onest", system-ui, sans-serif',lineHeight:"120%"},gmGuessedLetters:{fontSize:"clamp(12px, 1.5vw, 16px)",color:"#6b7280",marginTop:"16px",minHeight:"24px",fontFamily:'"Onest", system-ui, sans-serif',lineHeight:"120%"},gmStatusWin:{color:"#10b981",fontWeight:500,fontSize:"clamp(14px, 1.5vw, 18px)",lineHeight:"120%",margin:"16px 0",fontFamily:'"Onest", system-ui, sans-serif'},gmStatusLose:{color:"#ec4c44",fontWeight:500,fontSize:"clamp(14px, 1.5vw, 18px)",lineHeight:"120%",margin:"16px 0",fontFamily:'"Onest", system-ui, sans-serif'},gmInfoBox:{background:"#f9f9f9",border:"1px solid #e5e7eb",borderRadius:"8px",padding:"16px",marginBottom:"24px",maxWidth:"500px",width:"100%",boxShadow:"none"},gmLogoFixed:{position:"absolute",top:"24px",left:"24px",width:"auto",zIndex:30,pointerEvents:"none",background:"transparent",transform:"none",willChange:"auto"},gmLogoImg:{height:"28px",width:"auto",background:"transparent",objectFit:"contain",imageRendering:"auto",transform:"translateZ(0)",backfaceVisibility:"hidden",WebkitFontSmoothing:"antialiased",display:"block"}};function Te({mistakes:s,maxMistakes:U,size:D=200}){const d=D,u=D*1.25,b=Math.max(3,D/100),z=10*(d/200),x=240*(u/250),f=150*(d/200),y=80*(d/200),q=20*(u/250),G=240*(u/250),w=80*(d/200),Q=20*(u/250),v=150*(d/200),W=150*(d/200),$=20*(u/250),C=50*(u/250),j=150*(d/200),H=70*(u/250),_=20*(d/200),F=150*(d/200),K=90*(u/250),Y=150*(u/250),h=150*(d/200),L=110*(u/250),p=130*(d/200),A=130*(u/250),J=150*(d/200),R=110*(u/250),ge=170*(d/200),T=130*(u/250),ee=150*(d/200),N=150*(u/250),g=130*(d/200),te=190*(u/250),I=150*(d/200),ne=150*(u/250),m=170*(d/200),oe=190*(u/250),k=s===0||s<=U*.5?"#1f2937":s<=U*.75?"#f59e0b":"#ec4c44";return t.jsxs("svg",{width:d,height:u,viewBox:"0 0 200 250",style:{display:"block",margin:"0 auto",overflow:"visible",WebkitFontSmoothing:"antialiased",transform:"translateZ(0)"},children:[s>0&&t.jsx("line",{x1:z,y1:x,x2:f,y2:x,stroke:k,strokeWidth:b}),s>1&&t.jsx("line",{x1:y,y1:q,x2:y,y2:G,stroke:k,strokeWidth:b}),s>2&&t.jsx("line",{x1:w,y1:Q,x2:v,y2:Q,stroke:k,strokeWidth:b}),s>3&&t.jsx("line",{x1:W,y1:$,x2:W,y2:C,stroke:k,strokeWidth:b}),s>4&&t.jsx("circle",{cx:j,cy:H,r:_,stroke:k,fill:"none",strokeWidth:b}),s>5&&t.jsx("line",{x1:F,y1:K,x2:F,y2:Y,stroke:k,strokeWidth:b}),s>6&&t.jsx("line",{x1:h,y1:L,x2:p,y2:A,stroke:k,strokeWidth:b}),s>7&&t.jsx("line",{x1:J,y1:R,x2:ge,y2:T,stroke:k,strokeWidth:b}),s>8&&t.jsx("line",{x1:ee,y1:N,x2:g,y2:te,stroke:k,strokeWidth:b}),s>9&&t.jsx("line",{x1:I,y1:ne,x2:m,y2:oe,stroke:k,strokeWidth:b})]})}function de({gameCubeSize:s=400,screenHeight:U=800,screenWidth:D=800,logoUrl:d,showLogo:u=!0,baseURL:b}={}){const z={Professions:["teacher","doctor","nurse","driver","police","firefighter","cook","waiter","farmer","builder","singer","actor","dentist","pilot","vet","artist","cleaner","student","baker","mechanic"],Family:["mother","father","sister","brother","grandmother","grandfather","aunt","uncle","cousin","baby","parents","children","wife","husband","son","daughter","family","twins","relatives"],"Farm animals":["cow","pig","horse","sheep","goat","duck","chicken","rooster","turkey","goose","rabbit","mouse","donkey","bee","hen","lamb","bull","pony"],Food:["apple","banana","bread","cheese","milk","egg","rice","soup","fish","meat","potato","carrot","tomato","cucumber","butter","cake","salad","pasta","pizza","juice"],Hobbies:["reading","drawing","painting","dancing","singing","cooking","swimming","fishing","running","cycling","skating","writing","camping","photography","hiking","games"],Christmas:["tree","present","gift","santa","snow","snowman","bell","star","lights","card","cookies","elf","sleigh","reindeer","candle","stocking"],Halloween:["pumpkin","costume","candy","ghost","witch","spider","bat","skeleton","mask","monster","mummy","cat","broom","zombie","trick","treat","candle","night","party"],Sport:["football","basketball","tennis","swimming","running","baseball","skiing","skating","volleyball","hockey","golf","boxing","cycling","rugby","karate","yoga","surfing","climbing","dancing","gym","chess"],"Body parts":["head","hair","eyes","ears","nose","mouth","teeth","tongue","neck","shoulder","arm","hand","finger","leg","knee","foot","toe","back","stomach","heart","legs","nails","chin","beard"],"School subjects":["math","english","history","geography","art","music","science","biology","chemistry","physics","pe","literature","drama","design","economics"],Animals:["cat","dog","rabbit","elephant","lion","tiger","monkey","bear","fox","wolf","giraffe","zebra","crocodile","dolphin","whale","shark","frog","parrot","mouse","penguin","deer","lizard","turtle","snake"],Countries:["russia","canada","china","japan","france","germany","italy","spain","brazil","india","australia","america","england","korea","mexico","egypt","turkey","vietnam","norway","finland","thailand","georgia","kazakhstan"],Clothes:["shirt","dress","skirt","trousers","jeans","coat","jacket","sweater","socks","shoes","boots","hat","scarf","gloves","shorts","cap","belt","tie","uniform","pants","underwear"],Traveling:["ticket","luggage","suitcase","airport","flight","passport","visa","map","guide","hotel","reservation","bus","train","taxi","tourist","sightseeing","backpack","journey","adventure","beach","tour","souvenir"],Environment:["tree","forest","air","water","pollution","recycle","nature","clean","waste","plastic","energy","animal","climate","earth","ocean","river","planet","save","green","environment","litter","organic"],Space:["planet","star","sun","moon","astronaut","rocket","space","galaxy","universe","telescope","comet","asteroid","orbit","gravity","alien","spaceship","mars","satellite","sky","eclipse"],Devices:["computer","laptop","phone","tablet","tv","keyboard","mouse","printer","camera","headphones","charger","screen","watch","microphone","speaker","console","router","battery","cable","remote"]},[x,f]=a.useState("lobby"),[y,q]=a.useState(""),[G]=a.useState("Normal"),[w,Q]=a.useState(0),[v,W]=a.useState(1),[$,C]=a.useState(""),[j,H]=a.useState([]),[_,F]=a.useState(0),[K,Y]=a.useState(0),[h,L]=a.useState(null),[p,A]=a.useState(null),[J,R]=a.useState(1),[ge,T]=a.useState([]),ee=G==="Easy"?8:G==="Normal"?6:4,N=b||(typeof window<"u"&&window.origin?`${window.origin}/cloud/speakid/games/hangman`:"/cloud/speakid/games/hangman"),[g,te]=a.useState(!1),[I,ne]=a.useState(!1),[m,oe]=a.useState(!1),[M,k]=a.useState(!1),l=a.useMemo(()=>{const e=(p||s||1e3)/400,n=m?.8:1,r=M?.9:1,c=n*r;return{headline1:g?Math.max(24,Math.min(30,30*e*c)):Math.max(28,Math.min(32,32*e*r)),headline2:Math.max(20,Math.min(28,24*e*c)),headline3:g?Math.max(14,Math.min(18,16*e*c)):Math.max(20,Math.min(26,24*e*c)),bodyL:Math.max(14,Math.min(20,18*e*c)),bodyM:g?Math.max(12,Math.min(16,14*e*c)):Math.max(14,Math.min(18,16*e*c)),bodyS:g?Math.max(10,Math.min(14,12*e*c)):Math.max(12,Math.min(16,14*e*c)),wordDisplay:Math.max(18,Math.min(32,26*e*c)),button:Math.max(12,Math.min(18,16*e*c))}},[g,p,s,m,M]),ue=a.useMemo(()=>{const e=(p||s||1e3)/400,n=m?.65:1,r=M?.85:1;return I?Math.max(8,Math.min(12,10*e)):Math.max(12,Math.min(24,16*e))*n*r},[I,p,s,m,M]),o=a.useMemo(()=>{const e=(p||s||1e3)/400,n=m?.65:1,r=M?.85:1;return I?Math.max(3,Math.min(6,5*e)):Math.max(4,Math.min(12,8*e))*n*r},[I,p,s,m,M]),S=a.useMemo(()=>{const e=(p||s||1e3)/400,n=M?.9:1;return Math.max(6,Math.min(10,8*e*n))},[p,s,M]),xe=(e,n)=>e.split("").every(r=>n.includes(r)),fe=(e,n)=>e.split("").map(r=>n.includes(r)?r:"_").join(" "),ye=e=>"abcdefghijklmnopqrstuvwxyz".split("").filter(r=>!e.includes(r)),P=(e,n=[])=>{var Z;if(!e||!z[e]){const B=Object.keys(z)[0];return((Z=z[B])==null?void 0:Z[0])||""}const r=z[e];if(!r||r.length===0)return"";const c=r.filter(B=>!n.includes(B)),E=c.length>0?c:r;if(E.length===0)return"";let X;if(typeof crypto<"u"&&crypto.getRandomValues){const B=new Uint32Array(1);crypto.getRandomValues(B);const le=B[0]/4294967295;X=Math.floor(le*E.length)}else X=Math.floor(Math.random()*E.length);return E[X]},be=()=>{if(!y)return;T([]);const e=P(y,[]);if(!e){f("category");return}C(e),T([e]),H([]),F(0),W(1),Y(0),L(null),f("game")},re=a.useCallback(e=>{if(x!=="game"||h!==null)return;const n=e.toLowerCase();/^[a-z]$/.test(n)&&(H(r=>r.includes(n)?r:[...r,n]),C(r=>(r&&!r.includes(n)&&F(c=>c+1),r)))},[x,h]),se=a.useCallback(e=>{re(e.key)},[re]);a.useEffect(()=>{if(x==="game")return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[x,se]);const ke=$?fe($,j):"",pe=$?xe($,j):!1,me=_>=10,we=ye(j),ie=a.useCallback(()=>{if(!y||v>=w){f("result");return}W(e=>e+1),T(e=>{const n=P(y,e);return n?(C(n),[...e,n]):e}),H([]),F(0),L(null)},[y,v,w]);a.useEffect(()=>{if(pe&&h===null){L("win"),Y(n=>n+1);const e=setTimeout(()=>{ie()},2e3);return()=>clearTimeout(e)}if(me&&h===null){L("lose");const e=setTimeout(()=>{ie()},2e3);return()=>clearTimeout(e)}},[pe,me,h,ie]);const Me=()=>{if(!y||v>=w){f("result");return}W(e=>e+1),T(e=>{const n=P(y,e);return n?(C(n),[...e,n]):e}),H([]),F(0),L(null)};a.useEffect(()=>{const e=()=>{const n=window.innerWidth,r=window.innerHeight,c=n<768||n===926&&r===428||n===932&&r===430,E=r<700,X=n/r>1.8,Z=n===1024&&r===600,B=c&&n>r,le=n>=1200&&n<=1400;if(te(c),ne(Z),oe(B),k(le),c)A(null),R(1);else if(E)A(null),R(1);else{const je=n-80,Fe=r-80,he=Math.min(je,Fe);let ce;s&&s>=320?ce=Math.min(s,he):ce=Math.min(1e3,he*.9);const Le=Math.max(400,Math.min(1200,ce));A(Le),R(X?.85:1)}};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[s]);const V=`
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),i=require("react"),a={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",fontFamily:'"Onest", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif',background:"transparent"},gmHeadline1:{fontWeight:600,fontSize:"clamp(30px, 4vw, 32px)",lineHeight:"110%",marginBottom:"24px",color:"#1f2937",fontFamily:'"Onest", system-ui, sans-serif'},gmHeadline3:{fontWeight:500,fontSize:"clamp(16px, 2vw, 24px)",lineHeight:"110%",marginBottom:"12px",color:"#1f2937",fontFamily:'"Onest", system-ui, sans-serif'},gmBodyL:{fontWeight:400,fontSize:"18px",lineHeight:"120%",marginBottom:"12px",color:"#1f2937",fontFamily:'"Onest", system-ui, sans-serif'},gmBodyM:{fontWeight:400,fontSize:"clamp(14px, 1.5vw, 16px)",lineHeight:"120%",marginBottom:"8px",color:"#1f2937",fontFamily:'"Onest", system-ui, sans-serif'},gmBodyS:{fontWeight:400,fontSize:"clamp(12px, 1.5vw, 14px)",lineHeight:"120%",color:"#6b7280",marginBottom:"8px",fontFamily:'"Onest", system-ui, sans-serif'},gmButton:{fontFamily:'"Onest", system-ui, sans-serif',fontWeight:400,fontSize:"16px",lineHeight:"100%",padding:"10px 16px",borderRadius:"8px",border:"1px solid #e5e7eb",background:"#ec4c44",color:"#ffffff",cursor:"pointer",boxShadow:"none",transition:"background-color 0.2s ease, opacity 0.2s ease, transform 0.1s ease",margin:"4px"},gmButtonSecondary:{background:"#f9f9f9",color:"#1f2937",border:"1px solid #e5e7eb",boxShadow:"none"},gmButtonGroup:{display:"flex",flexWrap:"wrap",gap:"8px",justifyContent:"center",marginBottom:"24px"},gmWordDisplay:{fontSize:"clamp(20px, 5vw, 28px)",fontWeight:500,letterSpacing:"6px",margin:"32px 0",color:"#1f2937",fontFamily:'"Onest", system-ui, sans-serif',lineHeight:"120%"},gmGuessedLetters:{fontSize:"clamp(12px, 1.5vw, 16px)",color:"#6b7280",marginTop:"16px",minHeight:"24px",fontFamily:'"Onest", system-ui, sans-serif',lineHeight:"120%"},gmStatusWin:{color:"#10b981",fontWeight:500,fontSize:"clamp(14px, 1.5vw, 18px)",lineHeight:"120%",margin:"16px 0",fontFamily:'"Onest", system-ui, sans-serif'},gmStatusLose:{color:"#ec4c44",fontWeight:500,fontSize:"clamp(14px, 1.5vw, 18px)",lineHeight:"120%",margin:"16px 0",fontFamily:'"Onest", system-ui, sans-serif'},gmInfoBox:{background:"#f9f9f9",border:"1px solid #e5e7eb",borderRadius:"8px",padding:"16px",marginBottom:"24px",maxWidth:"500px",width:"100%",boxShadow:"none"},gmLogoFixed:{position:"absolute",top:"24px",left:"24px",width:"auto",zIndex:30,pointerEvents:"none",background:"transparent",transform:"none",willChange:"auto"},gmLogoImg:{height:"28px",width:"auto",background:"transparent",objectFit:"contain",imageRendering:"auto",transform:"translateZ(0)",backfaceVisibility:"hidden",WebkitFontSmoothing:"antialiased",display:"block"}};function Te({mistakes:r,maxMistakes:Z,size:X=200}){const d=X,u=X*1.25,b=Math.max(3,X/100),W=10*(d/200),x=240*(u/250),f=150*(d/200),y=80*(d/200),q=20*(u/250),G=240*(u/250),w=80*(d/200),Q=20*(u/250),v=150*(d/200),C=150*(d/200),$=20*(u/250),z=50*(u/250),j=150*(d/200),H=70*(u/250),_=20*(d/200),F=150*(d/200),K=90*(u/250),A=150*(u/250),h=150*(d/200),L=110*(u/250),p=130*(d/200),Y=130*(u/250),J=150*(d/200),R=110*(u/250),ge=170*(d/200),T=130*(u/250),ee=150*(d/200),N=150*(u/250),g=130*(d/200),te=190*(u/250),I=150*(d/200),ne=150*(u/250),m=170*(d/200),oe=190*(u/250),k=r===0||r<=Z*.5?"#1f2937":r<=Z*.75?"#f59e0b":"#ec4c44";return t.jsxs("svg",{width:d,height:u,viewBox:"0 0 200 250",style:{display:"block",margin:"0 auto",overflow:"visible",WebkitFontSmoothing:"antialiased",transform:"translateZ(0)"},children:[r>0&&t.jsx("line",{x1:W,y1:x,x2:f,y2:x,stroke:k,strokeWidth:b}),r>1&&t.jsx("line",{x1:y,y1:q,x2:y,y2:G,stroke:k,strokeWidth:b}),r>2&&t.jsx("line",{x1:w,y1:Q,x2:v,y2:Q,stroke:k,strokeWidth:b}),r>3&&t.jsx("line",{x1:C,y1:$,x2:C,y2:z,stroke:k,strokeWidth:b}),r>4&&t.jsx("circle",{cx:j,cy:H,r:_,stroke:k,fill:"none",strokeWidth:b}),r>5&&t.jsx("line",{x1:F,y1:K,x2:F,y2:A,stroke:k,strokeWidth:b}),r>6&&t.jsx("line",{x1:h,y1:L,x2:p,y2:Y,stroke:k,strokeWidth:b}),r>7&&t.jsx("line",{x1:J,y1:R,x2:ge,y2:T,stroke:k,strokeWidth:b}),r>8&&t.jsx("line",{x1:ee,y1:N,x2:g,y2:te,stroke:k,strokeWidth:b}),r>9&&t.jsx("line",{x1:I,y1:ne,x2:m,y2:oe,stroke:k,strokeWidth:b})]})}function de({gameCubeSize:r=400,screenHeight:Z=800,screenWidth:X=800,logoUrl:d,showLogo:u=!0,baseURL:b}={}){const W={Professions:["teacher","doctor","nurse","driver","police","firefighter","cook","waiter","farmer","builder","singer","actor","dentist","pilot","vet","artist","cleaner","student","baker","mechanic"],Family:["mother","father","sister","brother","grandmother","grandfather","aunt","uncle","cousin","baby","parents","children","wife","husband","son","daughter","family","twins","relatives"],"Farm animals":["cow","pig","horse","sheep","goat","duck","chicken","rooster","turkey","goose","rabbit","mouse","donkey","bee","hen","lamb","bull","pony"],Food:["apple","banana","bread","cheese","milk","egg","rice","soup","fish","meat","potato","carrot","tomato","cucumber","butter","cake","salad","pasta","pizza","juice"],Hobbies:["reading","drawing","painting","dancing","singing","cooking","swimming","fishing","running","cycling","skating","writing","camping","photography","hiking","games"],Christmas:["tree","present","gift","santa","snow","snowman","bell","star","lights","card","cookies","elf","sleigh","reindeer","candle","stocking"],Halloween:["pumpkin","costume","candy","ghost","witch","spider","bat","skeleton","mask","monster","mummy","cat","broom","zombie","trick","treat","candle","night","party"],Sport:["football","basketball","tennis","swimming","running","baseball","skiing","skating","volleyball","hockey","golf","boxing","cycling","rugby","karate","yoga","surfing","climbing","dancing","gym","chess"],"Body parts":["head","hair","eyes","ears","nose","mouth","teeth","tongue","neck","shoulder","arm","hand","finger","leg","knee","foot","toe","back","stomach","heart","legs","nails","chin","beard"],"School subjects":["math","english","history","geography","art","music","science","biology","chemistry","physics","pe","literature","drama","design","economics"],Animals:["cat","dog","rabbit","elephant","lion","tiger","monkey","bear","fox","wolf","giraffe","zebra","crocodile","dolphin","whale","shark","frog","parrot","mouse","penguin","deer","lizard","turtle","snake"],Countries:["russia","canada","china","japan","france","germany","italy","spain","brazil","india","australia","america","england","korea","mexico","egypt","turkey","vietnam","norway","finland","thailand","georgia","kazakhstan"],Clothes:["shirt","dress","skirt","trousers","jeans","coat","jacket","sweater","socks","shoes","boots","hat","scarf","gloves","shorts","cap","belt","tie","uniform","pants","underwear"],Traveling:["ticket","luggage","suitcase","airport","flight","passport","visa","map","guide","hotel","reservation","bus","train","taxi","tourist","sightseeing","backpack","journey","adventure","beach","tour","souvenir"],Environment:["tree","forest","air","water","pollution","recycle","nature","clean","waste","plastic","energy","animal","climate","earth","ocean","river","planet","save","green","environment","litter","organic"],Space:["planet","star","sun","moon","astronaut","rocket","space","galaxy","universe","telescope","comet","asteroid","orbit","gravity","alien","spaceship","mars","satellite","sky","eclipse"],Devices:["computer","laptop","phone","tablet","tv","keyboard","mouse","printer","camera","headphones","charger","screen","watch","microphone","speaker","console","router","battery","cable","remote"]},[x,f]=i.useState("lobby"),[y,q]=i.useState(""),[G]=i.useState("Normal"),[w,Q]=i.useState(0),[v,C]=i.useState(1),[$,z]=i.useState(""),[j,H]=i.useState([]),[_,F]=i.useState(0),[K,A]=i.useState(0),[h,L]=i.useState(null),[p,Y]=i.useState(null),[J,R]=i.useState(1),[ge,T]=i.useState([]),ee=G==="Easy"?8:G==="Normal"?6:4,N=b||(typeof window<"u"&&window.origin?`${window.origin}/cloud/speakid/games/hangman`:"/cloud/speakid/games/hangman"),[g,te]=i.useState(!1),[I,ne]=i.useState(!1),[m,oe]=i.useState(!1),[M,k]=i.useState(!1),l=i.useMemo(()=>{const e=(p||r||1e3)/400,n=m?.8:1,s=M?.9:1,c=n*s;return{headline1:g?Math.max(24,Math.min(30,30*e*c)):Math.max(28,Math.min(32,32*e*s)),headline2:Math.max(20,Math.min(28,24*e*c)),headline3:g?Math.max(14,Math.min(18,16*e*c)):Math.max(20,Math.min(26,24*e*c)),bodyL:Math.max(14,Math.min(20,18*e*c)),bodyM:g?Math.max(12,Math.min(16,14*e*c)):Math.max(14,Math.min(18,16*e*c)),bodyS:g?Math.max(10,Math.min(14,12*e*c)):Math.max(12,Math.min(16,14*e*c)),wordDisplay:Math.max(18,Math.min(32,26*e*c)),button:Math.max(12,Math.min(18,16*e*c))}},[g,p,r,m,M]),ue=i.useMemo(()=>{const e=(p||r||1e3)/400,n=m?.65:1,s=M?.85:1;return I?Math.max(8,Math.min(12,10*e)):Math.max(12,Math.min(24,16*e))*n*s},[I,p,r,m,M]),o=i.useMemo(()=>{const e=(p||r||1e3)/400,n=m?.65:1,s=M?.85:1;return I?Math.max(3,Math.min(6,5*e)):Math.max(4,Math.min(12,8*e))*n*s},[I,p,r,m,M]),S=i.useMemo(()=>{const e=(p||r||1e3)/400,n=M?.9:1;return Math.max(6,Math.min(10,8*e*n))},[p,r,M]),xe=(e,n)=>e.split("").every(s=>n.includes(s)),fe=(e,n)=>e.split("").map(s=>n.includes(s)?s:"_").join(" "),ye=e=>"abcdefghijklmnopqrstuvwxyz".split("").filter(s=>!e.includes(s)),P=(e,n=[])=>{var V;if(!e||!W[e]){const B=Object.keys(W)[0];return((V=W[B])==null?void 0:V[0])||""}const s=W[e];if(!s||s.length===0)return"";const c=s.filter(B=>!n.includes(B)),E=c.length>0?c:s;if(E.length===0)return"";let D;if(typeof crypto<"u"&&crypto.getRandomValues){const B=new Uint32Array(1);crypto.getRandomValues(B);const le=B[0]/4294967295;D=Math.floor(le*E.length)}else D=Math.floor(Math.random()*E.length);return E[D]},be=()=>{if(!y)return;T([]);const e=P(y,[]);if(!e){f("category");return}z(e),T([e]),H([]),F(0),C(1),A(0),L(null),f("game")},re=i.useCallback(e=>{if(x!=="game"||h!==null)return;const n=e.toLowerCase();/^[a-z]$/.test(n)&&(H(s=>s.includes(n)?s:[...s,n]),z(s=>(s&&!s.includes(n)&&F(c=>c+1),s)))},[x,h]),se=i.useCallback(e=>{re(e.key)},[re]);i.useEffect(()=>{if(x==="game")return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[x,se]);const ke=$?fe($,j):"",pe=$?xe($,j):!1,me=_>=10,we=ye(j),ie=i.useCallback(()=>{if(!y||v>=w){f("result");return}C(e=>e+1),T(e=>{const n=P(y,e);return n?(z(n),[...e,n]):e}),H([]),F(0),L(null)},[y,v,w]);i.useEffect(()=>{if(pe&&h===null){L("win"),A(n=>n+1);const e=setTimeout(()=>{ie()},2e3);return()=>clearTimeout(e)}if(me&&h===null){L("lose");const e=setTimeout(()=>{ie()},2e3);return()=>clearTimeout(e)}},[pe,me,h,ie]);const Me=()=>{if(!y||v>=w){f("result");return}C(e=>e+1),T(e=>{const n=P(y,e);return n?(z(n),[...e,n]):e}),H([]),F(0),L(null)};i.useEffect(()=>{const e=()=>{const n=window.innerWidth,s=window.innerHeight,c=n<768||n===926&&s===428||n===932&&s===430,E=s<700,D=n/s>1.8,V=n===1024&&s===600,B=c&&n>s,le=n>=1200&&n<=1400;if(te(c),ne(V),oe(B),k(le),c)Y(null),R(1);else if(E)Y(null),R(1);else{const je=n-80,Fe=s-80,he=Math.min(je,Fe);let ce;r&&r>=320?ce=Math.min(r,he):ce=Math.min(1e3,he*.9);const Le=Math.max(400,Math.min(1200,ce));Y(Le),R(D?.85:1)}};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[r]);const U=`
|
|
2
2
|
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" style="position: absolute; top: 0; left: 0; pointer-events: none; opacity: 0.2;">
|
|
3
3
|
<!-- Каракули мелками и фломастерами -->
|
|
4
4
|
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
<path d="M 35% 85% Q 37% 83%, 39% 85% T 43% 85% T 47% 85%"
|
|
43
43
|
fill="none" stroke="#FF4500" stroke-width="3.5" stroke-linecap="round"/>
|
|
44
44
|
</svg>
|
|
45
|
-
`,Se=!g&&typeof window<"u"&&window.innerWidth>=768&&window.innerWidth<1024,ae=!g&&u&&(x!=="game"||Se),$e={...i.gmCenterScreen,width:"100%",height:"100%",padding:`${ue}px`,paddingTop:ae?"80px":`${ue}px`,overflow:M?"hidden":"auto",position:"relative",boxSizing:"border-box",background:"transparent"},O=a.useMemo(()=>{const e=window.innerWidth,n=window.innerHeight;if(g&&e>n||n<700||!ae)return null;const r=d||(typeof window<"u"&&window.origin?`${window.origin}/cloud/speakid/games/hangman/logo`:"/cloud/speakid/games/hangman/logo");return t.jsx("div",{style:i.gmLogoFixed,children:t.jsxs("picture",{children:[t.jsx("source",{srcSet:`${r}.svg`,type:"image/svg+xml"}),t.jsx("img",{src:`${r}.png`,alt:"SPEAKID Logo",style:i.gmLogoImg,loading:"lazy"})]})})},[g,ae,d,x]),ve=()=>x==="lobby"?t.jsxs(t.Fragment,{children:[O,t.jsx("div",{dangerouslySetInnerHTML:{__html:V}}),t.jsx("h1",{style:{...i.gmHeadline1,fontSize:`${l.headline1}px`,marginBottom:`${o*3}px`,position:"relative",zIndex:1},children:"HANGMAN"}),t.jsxs("button",{onClick:()=>f("category"),style:{fontFamily:'"Onest", system-ui, sans-serif',fontWeight:500,fontSize:`${l.button}px`,padding:`${o*1.2}px ${o*3}px`,borderRadius:`${S*1.5}px`,position:"relative",zIndex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"#ec4c44",color:"#ffffff",border:"none",cursor:"pointer",transition:"background 0.2s ease, transform 0.1s ease",boxShadow:"0 2px 8px rgba(236, 76, 68, 0.2)",minWidth:"120px"},onMouseEnter:e=>{e.currentTarget.style.background="#d43a32",e.currentTarget.style.transform="translateY(-2px)",e.currentTarget.style.boxShadow="0 4px 12px rgba(236, 76, 68, 0.3)"},onMouseLeave:e=>{e.currentTarget.style.background="#ec4c44",e.currentTarget.style.transform="translateY(0)",e.currentTarget.style.boxShadow="0 2px 8px rgba(236, 76, 68, 0.2)"},onMouseDown:e=>{e.currentTarget.style.transform="translateY(0)"},children:[t.jsx("svg",{width:`${l.button*1.3}px`,height:`${l.button*1.3}px`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"block",marginRight:`${o}px`},children:t.jsx("path",{d:"M8 5V19L19 12L8 5Z",fill:"#ffffff",stroke:"none"})}),t.jsx("span",{style:{fontWeight:500},children:"PLAY"})]}),t.jsxs("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",height:"100%",pointerEvents:"none",zIndex:0},children:[t.jsx("img",{src:`${N}/sun.png`,alt:"Sun",style:{position:"absolute",left:g?"-10%":"5%",top:"20%",width:"auto",height:g?`${Math.min(window.innerHeight*.33,200)}px`:`${Math.min((p||s||1e3)*.33,300)}px`,maxHeight:"33vh",objectFit:"contain",opacity:.6}}),t.jsx("img",{src:`${N}/character.png`,alt:"Hangman character",style:{position:"absolute",right:g?"5%":"10%",bottom:"10%",width:"auto",height:g?`${Math.min(window.innerHeight*.33,200)}px`:`${Math.min((p||s||1e3)*.33,300)}px`,maxHeight:"33vh",objectFit:"contain",opacity:.6}})]})]}):x==="category"?t.jsxs(t.Fragment,{children:[O,t.jsx("div",{dangerouslySetInnerHTML:{__html:V}}),t.jsx("button",{onClick:()=>f("lobby"),onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#e5e7eb"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#f9f9f9"},style:{...i.gmButton,...i.gmButtonSecondary,fontSize:`${l.button}px`,padding:`${o}px ${o*1.5}px`,borderRadius:`${S}px`,position:"absolute",top:"60px",left:"24px",zIndex:10},children:"←"}),t.jsx("div",{style:{...i.gmButtonGroup,gap:`${o}px`,marginBottom:`${o*3}px`,marginTop:`${o*4}px`,position:"relative",zIndex:1},children:Object.keys(z).map(e=>t.jsx("button",{onClick:()=>{q(e),f("rounds")},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="#f0f0f0",n.currentTarget.style.borderColor="#1f2937",n.currentTarget.style.transform="scale(1.05)"},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="transparent",n.currentTarget.style.borderColor="#e5e7eb",n.currentTarget.style.transform="scale(1)"},style:{fontFamily:'"Onest", system-ui, sans-serif',fontWeight:500,fontSize:`${l.button}px`,padding:`${o*1.2}px ${o*2}px`,borderRadius:`${S*2}px`,margin:`${o/2}px`,background:"transparent",border:"2px solid #e5e7eb",color:"#1f2937",cursor:"pointer",transition:"background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease",boxShadow:"none"},children:e},e))})]}):x==="rounds"?t.jsxs(t.Fragment,{children:[O,t.jsx("div",{dangerouslySetInnerHTML:{__html:V}}),t.jsx("button",{onClick:()=>f("category"),onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#e5e7eb"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#f9f9f9"},style:{...i.gmButton,...i.gmButtonSecondary,fontSize:`${l.button}px`,padding:`${o}px ${o*1.5}px`,borderRadius:`${S}px`,position:"absolute",top:"60px",left:"24px",zIndex:10},children:"←"}),t.jsx("h1",{style:{...i.gmHeadline1,fontSize:`${l.headline1}px`,marginBottom:`${o*2}px`,position:"relative",zIndex:1},children:"Choose rounds"}),t.jsx("div",{style:{...i.gmButtonGroup,gap:`${o}px`,marginBottom:`${o*3}px`,position:"relative",zIndex:1},children:[1,3,5].map(e=>t.jsx("button",{onClick:()=>{Q(e),be()},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="#f0f0f0",n.currentTarget.style.borderColor="#1f2937",n.currentTarget.style.transform="scale(1.05)"},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="transparent",n.currentTarget.style.borderColor="#e5e7eb",n.currentTarget.style.transform="scale(1)"},style:{fontFamily:'"Onest", system-ui, sans-serif',fontWeight:500,fontSize:`${l.button}px`,padding:`${o*1.2}px ${o*2}px`,borderRadius:`${S*2}px`,margin:`${o/2}px`,background:"transparent",border:"2px solid #e5e7eb",color:"#1f2937",cursor:"pointer",transition:"background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease",boxShadow:"none"},children:e},e))})]}):x==="game"?t.jsxs(t.Fragment,{children:[O,!m&&t.jsx("div",{dangerouslySetInnerHTML:{__html:V}})," ",t.jsxs("div",{style:{...i.gmInfoBox,padding:`${m?o*.6:o*.8}px`,marginBottom:`${m?o*.3:o*.5}px`,maxWidth:`${(p||s)*.9}px`},children:[t.jsxs("h3",{style:{...i.gmHeadline3,fontSize:`${l.headline3}px`,marginBottom:`${o*.5}px`},children:["Category: ",y]}),t.jsxs("p",{style:{...i.gmBodyM,fontSize:`${l.bodyM}px`,marginBottom:"0px"},children:["Round ",v," of ",w]})]}),$&&t.jsxs("p",{style:{...i.gmBodyS,fontSize:`${l.bodyS}px`,marginTop:`${m?o*.3:o*.5}px`,marginBottom:`${m?o*.5:o}px`},children:["I am thinking of a word that is ",t.jsx("strong",{children:$.length})," letters long"]}),t.jsx("div",{style:{margin:`${m?o*.5:o}px 0`,display:"flex",justifyContent:"center",alignItems:"center"},children:t.jsx(Te,{mistakes:_,maxMistakes:ee,size:I?Math.max(80,Math.min(110,(p||s)*.16)):g?m?Math.max(70,Math.min(120,Math.min(window.innerWidth*.25,window.innerHeight*.15))):Math.max(100,Math.min(150,Math.min(window.innerWidth*.3,window.innerHeight*.2))):Math.max(100,Math.min(150,(p||s)*.2))})}),t.jsx("div",{style:{...i.gmWordDisplay,fontSize:`${Math.max(16,Math.min(24,l.wordDisplay*.9))}px`,margin:`${m?o*.5:o}px 0`,letterSpacing:`${o*.8}px`,minHeight:`${Math.max(16,Math.min(24,l.wordDisplay*.9))*1.2}px`},children:ke||"Loading..."}),t.jsxs("div",{style:{...i.gmInfoBox,padding:`${m?o*.6:o}px`,marginTop:`${m?o*.5:o}px`,marginBottom:`${m?o*.5:o}px`,maxWidth:`${(p||s)*.95}px`},children:[t.jsx("p",{style:{...i.gmBodyS,fontSize:`${l.bodyS}px`,marginBottom:`${o}px`,fontWeight:500},children:"Available letters:"}),t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:`${o/3}px`,justifyContent:"center",fontSize:`${Math.max(9,Math.min(12,l.bodyS*.75))}px`,fontFamily:'"Onest", system-ui, sans-serif'},children:we.map(e=>t.jsx("button",{onClick:()=>re(e),disabled:h!==null,onMouseEnter:n=>{h===null&&(n.currentTarget.style.backgroundColor="#e5e7eb",n.currentTarget.style.cursor="pointer")},onMouseLeave:n=>{h===null&&(n.currentTarget.style.backgroundColor="#f9f9f9",n.currentTarget.style.cursor="pointer")},style:{padding:`${o/4}px ${o/3}px`,borderRadius:`${S*.5}px`,background:"#f9f9f9",color:"#1f2937",border:"1px solid #e5e7eb",minWidth:`${Math.max(o*1.5,(p||s)*.04)}px`,textAlign:"center",display:"inline-block",cursor:h===null?"pointer":"default",fontFamily:'"Onest", system-ui, sans-serif',fontSize:`${Math.max(9,Math.min(12,l.bodyS*.75))}px`,transition:"background-color 0.2s ease"},children:e},e))})]}),j.length>0&&t.jsx("div",{style:{...i.gmGuessedLetters,fontSize:`${Math.max(10,Math.min(12,l.bodyS*.85))}px`,marginTop:`${o*.5}px`,marginBottom:"2px"},children:t.jsxs("span",{style:{color:"#6b7280"},children:["Guessed letters: ",t.jsx("strong",{children:j.join(", ")})]})}),h==="win"&&t.jsx("div",{style:{...i.gmStatusWin,fontSize:`${l.bodyL}px`,margin:"2px 0"},children:"🎉 You won this round!"}),h==="lose"&&t.jsxs("div",{style:{...i.gmStatusLose,fontSize:`${l.bodyL}px`,margin:"2px 0"},children:["The hangman is complete! The word was: ",t.jsx("strong",{children:$})]}),h!==null&&v<w&&t.jsx("div",{style:{marginTop:"2px",marginBottom:`${o}px`},children:t.jsx("button",{onClick:Me,onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#d43a32"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#ec4c44"},style:{...i.gmButton,fontSize:`${Math.max(11,Math.min(14,l.button*.85))}px`,padding:`${o*.6}px ${o*1.2}px`,borderRadius:`${S}px`},children:"NEXT"})}),h!==null&&v>=w&&t.jsx("div",{style:{marginTop:"2px",marginBottom:`${o}px`},children:t.jsx("button",{onClick:()=>f("result"),onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#d43a32"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#ec4c44"},style:{...i.gmButton,fontSize:`${l.button}px`,padding:`${o}px ${o*1.5}px`,borderRadius:`${S}px`},children:"View results"})}),h===null&&j.length===0&&t.jsx("p",{style:{...i.gmBodyS,fontSize:`${l.bodyS}px`,marginTop:`${o}px`,marginBottom:`${o}px`},children:"Type a letter on your keyboard"})]}):x==="result"?t.jsxs(t.Fragment,{children:[O,t.jsx("h1",{style:{...i.gmHeadline1,fontSize:`${l.headline1}px`,marginBottom:`${o*2}px`},children:"🎊 Game Finished!"}),t.jsxs("p",{style:{...i.gmBodyL,fontSize:`${l.bodyL}px`,marginBottom:`${o*2}px`},children:["You guessed ",t.jsx("strong",{children:K})," out of ",t.jsx("strong",{children:w})," words correctly."]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:`${o}px`,alignItems:"center"},children:[t.jsx("button",{onClick:()=>{if(!y||w===0){f("lobby");return}T([]);const e=P(y,[]);e&&(C(e),T([e]),H([]),F(0),W(1),Y(0),L(null),f("game"))},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#d43a32"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#ec4c44"},style:{...i.gmButton,fontSize:`${l.button}px`,padding:`${o}px ${o*1.5}px`,borderRadius:`${S}px`,minWidth:"200px"},children:"Play again"}),t.jsx("button",{onClick:()=>f("lobby"),onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#e5e7eb"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#f9f9f9"},style:{...i.gmButton,...i.gmButtonSecondary,fontSize:`${l.button}px`,padding:`${o}px ${o*1.5}px`,borderRadius:`${S}px`,minWidth:"200px"},children:"Exit"})]})]}):null;return t.jsx("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",background:"transparent",overflow:"hidden",position:"absolute",top:0,left:0,right:0,bottom:0},children:t.jsx("div",{style:{width:g?"100%":p||s||1e3,height:g?"100%":p||s||1e3,display:"flex",justifyContent:"center",alignItems:"center",overflow:"hidden",borderRadius:g?0:"20px",background:"#ffffff",boxShadow:g?"none":"0 0 40px rgba(0,0,0,0.1)",margin:g?"0 auto":"unset",position:"relative",transform:`scale(${J})`},children:t.jsx("div",{style:{transform:"translateZ(0)",width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:t.jsx("div",{style:$e,children:ve()})})})})}exports.Game=de;exports.HangmanLobbyGame=de;exports.default=de;
|
|
45
|
+
`,Se=!g&&typeof window<"u"&&window.innerWidth>=768&&window.innerWidth<1024,ae=!g&&u&&(x!=="game"||Se),$e={...a.gmCenterScreen,width:"100%",height:"100%",padding:`${ue}px`,paddingTop:ae?"80px":`${ue}px`,overflow:M?"hidden":"auto",position:"relative",boxSizing:"border-box",background:"transparent"},O=i.useMemo(()=>{if(!ae)return null;const e=window.innerWidth;if(g&&e>window.innerHeight)return null;const n=d||(typeof window<"u"&&window.origin?`${window.origin}/cloud/speakid/games/hangman/logo`:"/cloud/speakid/games/hangman/logo");return t.jsx("div",{style:a.gmLogoFixed,children:t.jsxs("picture",{children:[t.jsx("source",{srcSet:`${n}.svg`,type:"image/svg+xml"}),t.jsx("img",{src:`${n}.png`,alt:"SPEAKID Logo",style:a.gmLogoImg,loading:"lazy"})]})})},[g,ae,d,x]),ve=()=>x==="lobby"?t.jsxs(t.Fragment,{children:[O,t.jsx("div",{dangerouslySetInnerHTML:{__html:U}}),t.jsx("h1",{style:{...a.gmHeadline1,fontSize:`${l.headline1}px`,marginBottom:`${o*3}px`,position:"relative",zIndex:1},children:"HANGMAN"}),t.jsxs("button",{onClick:()=>f("category"),style:{fontFamily:'"Onest", system-ui, sans-serif',fontWeight:500,fontSize:`${l.button}px`,padding:`${o*1.2}px ${o*3}px`,borderRadius:`${S*1.5}px`,position:"relative",zIndex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"#ec4c44",color:"#ffffff",border:"none",cursor:"pointer",transition:"background 0.2s ease, transform 0.1s ease",boxShadow:"0 2px 8px rgba(236, 76, 68, 0.2)",minWidth:"120px"},onMouseEnter:e=>{e.currentTarget.style.background="#d43a32",e.currentTarget.style.transform="translateY(-2px)",e.currentTarget.style.boxShadow="0 4px 12px rgba(236, 76, 68, 0.3)"},onMouseLeave:e=>{e.currentTarget.style.background="#ec4c44",e.currentTarget.style.transform="translateY(0)",e.currentTarget.style.boxShadow="0 2px 8px rgba(236, 76, 68, 0.2)"},onMouseDown:e=>{e.currentTarget.style.transform="translateY(0)"},children:[t.jsx("svg",{width:`${l.button*1.3}px`,height:`${l.button*1.3}px`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"block",marginRight:`${o}px`},children:t.jsx("path",{d:"M8 5V19L19 12L8 5Z",fill:"#ffffff",stroke:"none"})}),t.jsx("span",{style:{fontWeight:500},children:"PLAY"})]}),t.jsxs("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",height:"100%",pointerEvents:"none",zIndex:0},children:[t.jsx("img",{src:`${N}/sun.png`,alt:"Sun",style:{position:"absolute",left:g?"-10%":"5%",top:"20%",width:"auto",height:g?`${Math.min(window.innerHeight*.33,200)}px`:`${Math.min((p||r||1e3)*.33,300)}px`,maxHeight:"33vh",objectFit:"contain",opacity:.6}}),t.jsx("img",{src:`${N}/character.png`,alt:"Hangman character",style:{position:"absolute",right:g?"5%":"10%",bottom:"10%",width:"auto",height:g?`${Math.min(window.innerHeight*.33,200)}px`:`${Math.min((p||r||1e3)*.33,300)}px`,maxHeight:"33vh",objectFit:"contain",opacity:.6}})]})]}):x==="category"?t.jsxs(t.Fragment,{children:[O,t.jsx("div",{dangerouslySetInnerHTML:{__html:U}}),t.jsx("button",{onClick:()=>f("lobby"),onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#e5e7eb"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#f9f9f9"},style:{...a.gmButton,...a.gmButtonSecondary,fontSize:`${l.button}px`,padding:`${o}px ${o*1.5}px`,borderRadius:`${S}px`,position:"absolute",top:"60px",left:"24px",zIndex:10},children:"←"}),t.jsx("div",{style:{...a.gmButtonGroup,gap:`${o}px`,marginBottom:`${o*3}px`,marginTop:`${o*4}px`,position:"relative",zIndex:1},children:Object.keys(W).map(e=>t.jsx("button",{onClick:()=>{q(e),f("rounds")},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="#f0f0f0",n.currentTarget.style.borderColor="#1f2937",n.currentTarget.style.transform="scale(1.05)"},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="transparent",n.currentTarget.style.borderColor="#e5e7eb",n.currentTarget.style.transform="scale(1)"},style:{fontFamily:'"Onest", system-ui, sans-serif',fontWeight:500,fontSize:`${l.button}px`,padding:`${o*1.2}px ${o*2}px`,borderRadius:`${S*2}px`,margin:`${o/2}px`,background:"transparent",border:"2px solid #e5e7eb",color:"#1f2937",cursor:"pointer",transition:"background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease",boxShadow:"none"},children:e},e))})]}):x==="rounds"?t.jsxs(t.Fragment,{children:[O,t.jsx("div",{dangerouslySetInnerHTML:{__html:U}}),t.jsx("button",{onClick:()=>f("category"),onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#e5e7eb"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#f9f9f9"},style:{...a.gmButton,...a.gmButtonSecondary,fontSize:`${l.button}px`,padding:`${o}px ${o*1.5}px`,borderRadius:`${S}px`,position:"absolute",top:"60px",left:"24px",zIndex:10},children:"←"}),t.jsx("h1",{style:{...a.gmHeadline1,fontSize:`${l.headline1}px`,marginBottom:`${o*2}px`,position:"relative",zIndex:1},children:"Choose rounds"}),t.jsx("div",{style:{...a.gmButtonGroup,gap:`${o}px`,marginBottom:`${o*3}px`,position:"relative",zIndex:1},children:[1,3,5].map(e=>t.jsx("button",{onClick:()=>{Q(e),be()},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="#f0f0f0",n.currentTarget.style.borderColor="#1f2937",n.currentTarget.style.transform="scale(1.05)"},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="transparent",n.currentTarget.style.borderColor="#e5e7eb",n.currentTarget.style.transform="scale(1)"},style:{fontFamily:'"Onest", system-ui, sans-serif',fontWeight:500,fontSize:`${l.button}px`,padding:`${o*1.2}px ${o*2}px`,borderRadius:`${S*2}px`,margin:`${o/2}px`,background:"transparent",border:"2px solid #e5e7eb",color:"#1f2937",cursor:"pointer",transition:"background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease",boxShadow:"none"},children:e},e))})]}):x==="game"?t.jsxs(t.Fragment,{children:[O,!m&&t.jsx("div",{dangerouslySetInnerHTML:{__html:U}})," ",t.jsxs("div",{style:{...a.gmInfoBox,padding:`${m?o*.6:o*.8}px`,marginBottom:`${m?o*.3:o*.5}px`,maxWidth:`${(p||r)*.9}px`,textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:[t.jsxs("h3",{style:{...a.gmHeadline3,fontSize:`${l.headline3}px`,marginBottom:`${o*.2}px`,textAlign:"center"},children:["Category: ",y]}),t.jsxs("p",{style:{...a.gmBodyM,fontSize:`${l.bodyM}px`,marginBottom:"0px",textAlign:"center"},children:["Round ",v," of ",w]})]}),$&&t.jsxs("p",{style:{...a.gmBodyS,fontSize:`${l.bodyS}px`,marginTop:`${m?o*.3:o*.5}px`,marginBottom:`${m?o*.5:o}px`},children:["I am thinking of a word that is ",t.jsx("strong",{children:$.length})," letters long"]}),t.jsx("div",{style:{margin:`${m?o*.5:o}px 0`,display:"flex",justifyContent:"center",alignItems:"center"},children:t.jsx(Te,{mistakes:_,maxMistakes:ee,size:I?Math.max(80,Math.min(110,(p||r)*.16)):g?m?Math.max(70,Math.min(120,Math.min(window.innerWidth*.25,window.innerHeight*.15))):Math.max(100,Math.min(150,Math.min(window.innerWidth*.3,window.innerHeight*.2))):Math.max(100,Math.min(150,(p||r)*.2))})}),t.jsx("div",{style:{...a.gmWordDisplay,fontSize:`${Math.max(16,Math.min(24,l.wordDisplay*.9))}px`,margin:`${m?o*.5:o}px 0`,letterSpacing:`${o*.8}px`,minHeight:`${Math.max(16,Math.min(24,l.wordDisplay*.9))*1.2}px`},children:ke||"Loading..."}),t.jsx("div",{style:{...a.gmInfoBox,padding:`${m?o*.6:o}px`,marginTop:`${m?o*.5:o}px`,marginBottom:`${m?o*.5:o}px`,maxWidth:`${(p||r)*.95}px`},children:t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:`${o/3}px`,justifyContent:"center",alignItems:"center",fontFamily:'"Onest", system-ui, sans-serif'},children:we.map(e=>t.jsx("button",{onClick:()=>re(e),disabled:h!==null,onMouseEnter:n=>{h===null&&(n.currentTarget.style.backgroundColor="#e5e7eb",n.currentTarget.style.cursor="pointer")},onMouseLeave:n=>{h===null&&(n.currentTarget.style.backgroundColor="#f9f9f9",n.currentTarget.style.cursor="pointer")},style:{flex:"1 1 auto",padding:`${o*.5}px ${o*.4}px`,borderRadius:`${S*.5}px`,background:"#f9f9f9",color:"#1f2937",border:"1px solid #e5e7eb",minWidth:`${Math.max((p||r)*.06,o*2)}px`,maxWidth:`${Math.max((p||r)*.12,o*3)}px`,textAlign:"center",display:"flex",alignItems:"center",justifyContent:"center",cursor:h===null?"pointer":"default",fontFamily:'"Onest", system-ui, sans-serif',fontSize:`${Math.max(14,Math.min(20,l.bodyS*1.2))}px`,fontWeight:500,transition:"background-color 0.2s ease"},children:e.toUpperCase()},e))})}),j.length>0&&t.jsx("div",{style:{...a.gmGuessedLetters,fontSize:`${Math.max(10,Math.min(12,l.bodyS*.85))}px`,marginTop:`${o*.5}px`,marginBottom:"2px"},children:t.jsxs("span",{style:{color:"#6b7280"},children:["Guessed letters: ",t.jsx("strong",{children:j.join(", ")})]})}),h==="win"&&t.jsx("div",{style:{...a.gmStatusWin,fontSize:`${l.bodyL}px`,margin:"2px 0"},children:"🎉 You won this round!"}),h==="lose"&&t.jsxs("div",{style:{...a.gmStatusLose,fontSize:`${l.bodyL}px`,margin:"2px 0"},children:["The hangman is complete! The word was: ",t.jsx("strong",{children:$})]}),h!==null&&v<w&&t.jsx("div",{style:{marginTop:"2px",marginBottom:`${o}px`},children:t.jsx("button",{onClick:Me,onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#d43a32"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#ec4c44"},style:{...a.gmButton,fontSize:`${Math.max(11,Math.min(14,l.button*.85))}px`,padding:`${o*.6}px ${o*1.2}px`,borderRadius:`${S}px`},children:"NEXT"})}),h!==null&&v>=w&&t.jsx("div",{style:{marginTop:"2px",marginBottom:`${o}px`},children:t.jsx("button",{onClick:()=>f("result"),onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#d43a32"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#ec4c44"},style:{...a.gmButton,fontSize:`${l.button}px`,padding:`${o}px ${o*1.5}px`,borderRadius:`${S}px`},children:"View results"})}),h===null&&j.length===0&&t.jsx("p",{style:{...a.gmBodyS,fontSize:`${l.bodyS}px`,marginTop:`${o}px`,marginBottom:`${o}px`},children:"Type a letter on your keyboard"})]}):x==="result"?t.jsxs(t.Fragment,{children:[O,t.jsx("h1",{style:{...a.gmHeadline1,fontSize:`${l.headline1}px`,marginBottom:`${o*2}px`},children:"🎊 Game Finished!"}),t.jsxs("p",{style:{...a.gmBodyL,fontSize:`${l.bodyL}px`,marginBottom:`${o*2}px`},children:["You guessed ",t.jsx("strong",{children:K})," out of ",t.jsx("strong",{children:w})," words correctly."]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:`${o}px`,alignItems:"center"},children:[t.jsx("button",{onClick:()=>{if(!y||w===0){f("lobby");return}T([]);const e=P(y,[]);e&&(z(e),T([e]),H([]),F(0),C(1),A(0),L(null),f("game"))},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#d43a32"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#ec4c44"},style:{...a.gmButton,fontSize:`${l.button}px`,padding:`${o}px ${o*1.5}px`,borderRadius:`${S}px`,minWidth:"200px"},children:"Play again"}),t.jsx("button",{onClick:()=>f("lobby"),onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#e5e7eb"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#f9f9f9"},style:{...a.gmButton,...a.gmButtonSecondary,fontSize:`${l.button}px`,padding:`${o}px ${o*1.5}px`,borderRadius:`${S}px`,minWidth:"200px"},children:"Exit"})]})]}):null;return t.jsx("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",background:"transparent",overflow:"hidden",position:"absolute",top:0,left:0,right:0,bottom:0},children:t.jsx("div",{style:{width:g?"100%":p||r||1e3,height:g?"100%":p||r||1e3,display:"flex",justifyContent:"center",alignItems:"center",overflow:"hidden",borderRadius:g?0:"20px",background:"#ffffff",boxShadow:g?"none":"0 0 40px rgba(0,0,0,0.1)",margin:g?"0 auto":"unset",position:"relative",transform:`scale(${J})`},children:t.jsx("div",{style:{transform:"translateZ(0)",width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:t.jsx("div",{style:$e,children:ve()})})})})}exports.Game=de;exports.HangmanLobbyGame=de;exports.default=de;
|
|
46
46
|
//# sourceMappingURL=speakid-hangman.cjs.js.map
|