speakid-hangman 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { default } from "./components/HangmanLobbyGame";
2
2
  export { default as HangmanLobbyGame } from "./components/HangmanLobbyGame";
3
+ export { default as Game } from "./components/HangmanLobbyGame";
3
4
  export type { HangmanLobbyGameProps } from "./components/HangmanLobbyGame";
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAG5E,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAE5E,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAGhE,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC"}
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),g=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:"16px",left:"16px",width:"auto",zIndex:10,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 ht({mistakes:r,maxMistakes:h,size:y=200}){const l=y,c=y*1.25,b=Math.max(2,y/100),z=10*(l/200),w=240*(c/250),x=150*(l/200),f=80*(l/200),q=20*(c/250),_=240*(c/250),v=80*(l/200),N=20*(c/250),S=150*(l/200),C=150*(l/200),j=20*(c/250),W=50*(c/250),F=150*(l/200),H=70*(c/250),P=20*(l/200),L=150*(l/200),Z=90*(c/250),A=150*(c/250),p=150*(l/200),T=110*(c/250),m=130*(l/200),E=130*(c/250),rt=150*(l/200),B=110*(c/250),K=170*(l/200),V=130*(c/250),a=150*(l/200),$=150*(c/250),u=130*(l/200),s=190*(c/250),R=150*(l/200),n=150*(c/250),k=170*(l/200),J=190*(c/250),M=r===0||r<=h*.5?"#1f2937":r<=h*.75?"#f59e0b":"#ec4c44";return e.jsxs("svg",{width:l,height:c,style:{display:"block",margin:"0 auto"},children:[r>0&&e.jsx("line",{x1:z,y1:w,x2:x,y2:w,stroke:M,strokeWidth:b}),r>1&&e.jsx("line",{x1:f,y1:q,x2:f,y2:_,stroke:M,strokeWidth:b}),r>2&&e.jsx("line",{x1:v,y1:N,x2:S,y2:N,stroke:M,strokeWidth:b}),r>3&&e.jsx("line",{x1:C,y1:j,x2:C,y2:W,stroke:M,strokeWidth:b}),r>4&&e.jsx("circle",{cx:F,cy:H,r:P,stroke:M,fill:"none",strokeWidth:b}),r>5&&e.jsx("line",{x1:L,y1:Z,x2:L,y2:A,stroke:M,strokeWidth:b}),r>6&&e.jsx("line",{x1:p,y1:T,x2:m,y2:E,stroke:M,strokeWidth:b}),r>7&&e.jsx("line",{x1:rt,y1:B,x2:K,y2:V,stroke:M,strokeWidth:b}),r>8&&e.jsx("line",{x1:a,y1:$,x2:u,y2:s,stroke:M,strokeWidth:b}),r>9&&e.jsx("line",{x1:R,y1:n,x2:k,y2:J,stroke:M,strokeWidth:b})]})}function ct({gameCubeSize:r=400,screenHeight:h=800,screenWidth:y=800,logoUrl:l,showLogo:c=!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"]},[w,x]=g.useState("lobby"),[f,q]=g.useState(""),[_]=g.useState("Normal"),[v,N]=g.useState(0),[S,C]=g.useState(1),[j,W]=g.useState(""),[F,H]=g.useState([]),[P,L]=g.useState(0),[Z,A]=g.useState(0),[p,T]=g.useState(null),[m,E]=g.useState(null),[rt,B]=g.useState([]),K=_==="Easy"?8:_==="Normal"?6:4,V=b||(typeof window<"u"&&window.origin?`${window.origin}/cloud/speakid/games/hangman`:"/cloud/speakid/games/hangman"),a=(y??(typeof window<"u"?window.innerWidth:800))<768||(y??(typeof window<"u"?window.innerWidth:800))===926&&(h??(typeof window<"u"?window.innerHeight:800))===428||(y??(typeof window<"u"?window.innerWidth:800))===932&&(h??(typeof window<"u"?window.innerHeight:800))===430||r<600,$=(y??(typeof window<"u"?window.innerWidth:800))===1024&&(h??(typeof window<"u"?window.innerHeight:800))===600,u=r/400,s={headline1:a?Math.max(24,Math.min(30,30*u)):Math.max(28,Math.min(32,32*u)),headline3:a?Math.max(14,Math.min(18,16*u)):Math.max(20,Math.min(26,24*u)),bodyL:Math.max(14,Math.min(20,18*u)),bodyM:a?Math.max(12,Math.min(16,14*u)):Math.max(14,Math.min(18,16*u)),bodyS:a?Math.max(10,Math.min(14,12*u)):Math.max(12,Math.min(16,14*u)),wordDisplay:Math.max(18,Math.min(32,26*u)),button:Math.max(12,Math.min(18,16*u))},R=$?Math.max(8,Math.min(12,10*u)):Math.max(12,Math.min(24,16*u)),n=$?Math.max(3,Math.min(6,5*u)):Math.max(4,Math.min(12,8*u)),k=Math.max(6,Math.min(10,8*u)),J=(t,o)=>t.split("").every(d=>o.includes(d)),st=(t,o)=>t.split("").map(d=>o.includes(d)?d:"_").join(" "),M=t=>"abcdefghijklmnopqrstuvwxyz".split("").filter(d=>!t.includes(d)),U=(t,o=[])=>{var dt;if(!t||!z[t]){const Y=Object.keys(z)[0];return((dt=z[Y])==null?void 0:dt[0])||""}const d=z[t];if(!d||d.length===0)return"";const I=d.filter(Y=>!o.includes(Y)),G=I.length>0?I:d;if(G.length===0)return"";let Q;if(typeof crypto<"u"&&crypto.getRandomValues){const Y=new Uint32Array(1);crypto.getRandomValues(Y);const mt=Y[0]/4294967295;Q=Math.floor(mt*G.length)}else Q=Math.floor(Math.random()*G.length);return G[Q]},gt=()=>{if(!f)return;B([]);const t=U(f,[]);if(!t){x("category");return}W(t),B([t]),H([]),L(0),C(1),A(0),T(null),x("game")},tt=g.useCallback(t=>{if(w!=="game"||p!==null)return;const o=t.toLowerCase();/^[a-z]$/.test(o)&&(H(d=>d.includes(o)?d:[...d,o]),W(d=>(d&&!d.includes(o)&&L(I=>I+1),d)))},[w,p]),et=g.useCallback(t=>{tt(t.key)},[tt]);g.useEffect(()=>{if(w==="game")return window.addEventListener("keydown",et),()=>window.removeEventListener("keydown",et)},[w,et]);const ut=j?st(j,F):"",it=j?J(j,F):!1,at=P>=10,pt=M(F),nt=g.useCallback(()=>{if(!f||S>=v){x("result");return}C(t=>t+1),B(t=>{const o=U(f,t);return o?(W(o),[...t,o]):t}),H([]),L(0),T(null)},[f,S,v]);g.useEffect(()=>{if(it&&p===null){T("win"),A(o=>o+1);const t=setTimeout(()=>{nt()},2e3);return()=>clearTimeout(t)}if(at&&p===null){T("lose");const t=setTimeout(()=>{nt()},2e3);return()=>clearTimeout(t)}},[it,at,p,nt]);const xt=()=>{if(!f||S>=v){x("result");return}C(t=>t+1),B(t=>{const o=U(f,t);return o?(W(o),[...t,o]):t}),H([]),L(0),T(null)};g.useEffect(()=>{const t=y??window.innerWidth,o=h??window.innerHeight,d=o<700;if(a)E(r&&r>=320?r:null);else if($){const I=r?Math.max(400,Math.min(950,r)):Math.min(950,Math.min(t*.92,o*.92));E(I)}else if(d)E(r&&r>=400?r:null);else{const Q=r?Math.max(400,Math.min(1200,r)):Math.min(1e3,Math.min(t,o)*.9);E(Q)}},[y,h,r,a,$]);const O={width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",background:"transparent",overflow:"hidden",position:"absolute",top:0,left:0,right:0,bottom:0},ot=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),g=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:"16px",left:"16px",width:"auto",zIndex:10,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 ht({mistakes:r,maxMistakes:h,size:y=200}){const l=y,c=y*1.25,b=Math.max(2,y/100),z=10*(l/200),w=240*(c/250),x=150*(l/200),f=80*(l/200),q=20*(c/250),_=240*(c/250),v=80*(l/200),N=20*(c/250),S=150*(l/200),C=150*(l/200),j=20*(c/250),W=50*(c/250),F=150*(l/200),H=70*(c/250),P=20*(l/200),L=150*(l/200),Z=90*(c/250),A=150*(c/250),p=150*(l/200),T=110*(c/250),m=130*(l/200),E=130*(c/250),st=150*(l/200),B=110*(c/250),K=170*(l/200),V=130*(c/250),a=150*(l/200),$=150*(c/250),u=130*(l/200),s=190*(c/250),R=150*(l/200),n=150*(c/250),k=170*(l/200),J=190*(c/250),M=r===0||r<=h*.5?"#1f2937":r<=h*.75?"#f59e0b":"#ec4c44";return e.jsxs("svg",{width:l,height:c,style:{display:"block",margin:"0 auto"},children:[r>0&&e.jsx("line",{x1:z,y1:w,x2:x,y2:w,stroke:M,strokeWidth:b}),r>1&&e.jsx("line",{x1:f,y1:q,x2:f,y2:_,stroke:M,strokeWidth:b}),r>2&&e.jsx("line",{x1:v,y1:N,x2:S,y2:N,stroke:M,strokeWidth:b}),r>3&&e.jsx("line",{x1:C,y1:j,x2:C,y2:W,stroke:M,strokeWidth:b}),r>4&&e.jsx("circle",{cx:F,cy:H,r:P,stroke:M,fill:"none",strokeWidth:b}),r>5&&e.jsx("line",{x1:L,y1:Z,x2:L,y2:A,stroke:M,strokeWidth:b}),r>6&&e.jsx("line",{x1:p,y1:T,x2:m,y2:E,stroke:M,strokeWidth:b}),r>7&&e.jsx("line",{x1:st,y1:B,x2:K,y2:V,stroke:M,strokeWidth:b}),r>8&&e.jsx("line",{x1:a,y1:$,x2:u,y2:s,stroke:M,strokeWidth:b}),r>9&&e.jsx("line",{x1:R,y1:n,x2:k,y2:J,stroke:M,strokeWidth:b})]})}function rt({gameCubeSize:r=400,screenHeight:h=800,screenWidth:y=800,logoUrl:l,showLogo:c=!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"]},[w,x]=g.useState("lobby"),[f,q]=g.useState(""),[_]=g.useState("Normal"),[v,N]=g.useState(0),[S,C]=g.useState(1),[j,W]=g.useState(""),[F,H]=g.useState([]),[P,L]=g.useState(0),[Z,A]=g.useState(0),[p,T]=g.useState(null),[m,E]=g.useState(null),[st,B]=g.useState([]),K=_==="Easy"?8:_==="Normal"?6:4,V=b||(typeof window<"u"&&window.origin?`${window.origin}/cloud/speakid/games/hangman`:"/cloud/speakid/games/hangman"),a=(y??(typeof window<"u"?window.innerWidth:800))<768||(y??(typeof window<"u"?window.innerWidth:800))===926&&(h??(typeof window<"u"?window.innerHeight:800))===428||(y??(typeof window<"u"?window.innerWidth:800))===932&&(h??(typeof window<"u"?window.innerHeight:800))===430||r<600,$=(y??(typeof window<"u"?window.innerWidth:800))===1024&&(h??(typeof window<"u"?window.innerHeight:800))===600,u=r/400,s={headline1:a?Math.max(24,Math.min(30,30*u)):Math.max(28,Math.min(32,32*u)),headline3:a?Math.max(14,Math.min(18,16*u)):Math.max(20,Math.min(26,24*u)),bodyL:Math.max(14,Math.min(20,18*u)),bodyM:a?Math.max(12,Math.min(16,14*u)):Math.max(14,Math.min(18,16*u)),bodyS:a?Math.max(10,Math.min(14,12*u)):Math.max(12,Math.min(16,14*u)),wordDisplay:Math.max(18,Math.min(32,26*u)),button:Math.max(12,Math.min(18,16*u))},R=$?Math.max(8,Math.min(12,10*u)):Math.max(12,Math.min(24,16*u)),n=$?Math.max(3,Math.min(6,5*u)):Math.max(4,Math.min(12,8*u)),k=Math.max(6,Math.min(10,8*u)),J=(t,o)=>t.split("").every(d=>o.includes(d)),it=(t,o)=>t.split("").map(d=>o.includes(d)?d:"_").join(" "),M=t=>"abcdefghijklmnopqrstuvwxyz".split("").filter(d=>!t.includes(d)),U=(t,o=[])=>{var ct;if(!t||!z[t]){const Y=Object.keys(z)[0];return((ct=z[Y])==null?void 0:ct[0])||""}const d=z[t];if(!d||d.length===0)return"";const I=d.filter(Y=>!o.includes(Y)),G=I.length>0?I:d;if(G.length===0)return"";let Q;if(typeof crypto<"u"&&crypto.getRandomValues){const Y=new Uint32Array(1);crypto.getRandomValues(Y);const mt=Y[0]/4294967295;Q=Math.floor(mt*G.length)}else Q=Math.floor(Math.random()*G.length);return G[Q]},gt=()=>{if(!f)return;B([]);const t=U(f,[]);if(!t){x("category");return}W(t),B([t]),H([]),L(0),C(1),A(0),T(null),x("game")},tt=g.useCallback(t=>{if(w!=="game"||p!==null)return;const o=t.toLowerCase();/^[a-z]$/.test(o)&&(H(d=>d.includes(o)?d:[...d,o]),W(d=>(d&&!d.includes(o)&&L(I=>I+1),d)))},[w,p]),et=g.useCallback(t=>{tt(t.key)},[tt]);g.useEffect(()=>{if(w==="game")return window.addEventListener("keydown",et),()=>window.removeEventListener("keydown",et)},[w,et]);const ut=j?it(j,F):"",at=j?J(j,F):!1,lt=P>=10,pt=M(F),nt=g.useCallback(()=>{if(!f||S>=v){x("result");return}C(t=>t+1),B(t=>{const o=U(f,t);return o?(W(o),[...t,o]):t}),H([]),L(0),T(null)},[f,S,v]);g.useEffect(()=>{if(at&&p===null){T("win"),A(o=>o+1);const t=setTimeout(()=>{nt()},2e3);return()=>clearTimeout(t)}if(lt&&p===null){T("lose");const t=setTimeout(()=>{nt()},2e3);return()=>clearTimeout(t)}},[at,lt,p,nt]);const xt=()=>{if(!f||S>=v){x("result");return}C(t=>t+1),B(t=>{const o=U(f,t);return o?(W(o),[...t,o]):t}),H([]),L(0),T(null)};g.useEffect(()=>{const t=y??window.innerWidth,o=h??window.innerHeight,d=o<700;if(a)E(r&&r>=320?r:null);else if($){const I=r?Math.max(400,Math.min(950,r)):Math.min(950,Math.min(t*.92,o*.92));E(I)}else if(d)E(r&&r>=400?r:null);else{const Q=r?Math.max(400,Math.min(1200,r)):Math.min(1e3,Math.min(t,o)*.9);E(Q)}},[y,h,r,a,$]);const O={width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",background:"transparent",overflow:"hidden",position:"absolute",top:0,left:0,right:0,bottom:0},ot=`
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
- `,X={...i.gmCenterScreen,width:a?"100%":$?m||r||950:m||r||1e3,height:a?"100%":$?"auto":m||r||1e3,minHeight:a?"100%":$?"auto":m||r||1e3,maxHeight:a?"100%":$?"92vh":m||r||1e3,padding:`${R}px`,overflow:"auto",borderRadius:a?0:"20px",position:"relative",boxSizing:"border-box",background:"#ffffff",boxShadow:a?"none":"0 0 40px rgba(0,0,0,0.1)",margin:a?"0 auto":"unset"},lt=!a&&c,D=g.useMemo(()=>{if(a&&(y??window.innerWidth)>(h??window.innerHeight)||(h??window.innerHeight)<700||!lt)return null;const t=l||(typeof window<"u"&&window.origin?`${window.origin}/cloud/speakid/games/hangman/logo`:"/cloud/speakid/games/hangman/logo");return e.jsx("div",{style:{...i.gmLogoFixed,position:"absolute",top:16,left:16,zIndex:30},children:e.jsxs("picture",{children:[e.jsx("source",{srcSet:`${t}.svg`,type:"image/svg+xml"}),e.jsx("img",{src:`${t}.png`,alt:"SPEAKID Logo",style:i.gmLogoImg,loading:"lazy"})]})})},[a,lt,l,y,h]);return w==="lobby"?e.jsx("div",{style:O,children:e.jsxs("div",{style:X,children:[D,e.jsx("div",{dangerouslySetInnerHTML:{__html:ot}}),e.jsx("h1",{style:{...i.gmHeadline1,fontSize:`${s.headline1}px`,marginBottom:`${n*3}px`,position:"relative",zIndex:1},children:"HANGMAN"}),e.jsxs("button",{onClick:()=>x("category"),style:{fontFamily:'"Onest", system-ui, sans-serif',fontWeight:500,fontSize:`${s.button}px`,padding:`${n*1.2}px ${n*3}px`,borderRadius:`${k*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:t=>{t.currentTarget.style.background="#d43a32",t.currentTarget.style.transform="translateY(-2px)",t.currentTarget.style.boxShadow="0 4px 12px rgba(236, 76, 68, 0.3)"},onMouseLeave:t=>{t.currentTarget.style.background="#ec4c44",t.currentTarget.style.transform="translateY(0)",t.currentTarget.style.boxShadow="0 2px 8px rgba(236, 76, 68, 0.2)"},onMouseDown:t=>{t.currentTarget.style.transform="translateY(0)"},children:[e.jsx("svg",{width:`${s.button*1.3}px`,height:`${s.button*1.3}px`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"block",marginRight:`${n}px`},children:e.jsx("path",{d:"M8 5V19L19 12L8 5Z",fill:"#ffffff",stroke:"none"})}),e.jsx("span",{style:{fontWeight:500},children:"PLAY"})]}),e.jsxs("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",height:"100%",pointerEvents:"none",zIndex:0},children:[e.jsx("img",{src:`${V}/sun.png`,alt:"Sun",style:{position:"absolute",left:a?"-10%":"5%",top:"20%",width:"auto",height:a?`${Math.min(h*.33,200)}px`:`${Math.min((m||r)*.33,300)}px`,maxHeight:"33vh",objectFit:"contain",opacity:.6}}),e.jsx("img",{src:`${V}/character.png`,alt:"Hangman character",style:{position:"absolute",right:a?"5%":"10%",bottom:"10%",width:"auto",height:a?`${Math.min(h*.33,200)}px`:`${Math.min((m||r)*.33,300)}px`,maxHeight:"33vh",objectFit:"contain",opacity:.6}})]})]})}):w==="category"?e.jsx("div",{style:O,children:e.jsxs("div",{style:X,children:[D,e.jsx("div",{dangerouslySetInnerHTML:{__html:ot}}),e.jsx("button",{onClick:()=>x("lobby"),onMouseEnter:t=>{t.currentTarget.style.backgroundColor="#e5e7eb"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="#f9f9f9"},style:{...i.gmButton,...i.gmButtonSecondary,fontSize:`${s.button}px`,padding:`${n}px ${n*1.5}px`,borderRadius:`${k}px`,position:"absolute",top:`${R}px`,left:`${R}px`,zIndex:10},children:"←"}),e.jsx("div",{style:{...i.gmButtonGroup,gap:`${n}px`,marginBottom:`${n*3}px`,marginTop:`${n*4}px`,position:"relative",zIndex:1},children:Object.keys(z).map(t=>e.jsx("button",{onClick:()=>{q(t),x("rounds")},onMouseEnter:o=>{o.currentTarget.style.backgroundColor="#f0f0f0",o.currentTarget.style.borderColor="#1f2937",o.currentTarget.style.transform="scale(1.05)"},onMouseLeave:o=>{o.currentTarget.style.backgroundColor="transparent",o.currentTarget.style.borderColor="#e5e7eb",o.currentTarget.style.transform="scale(1)"},style:{fontFamily:'"Onest", system-ui, sans-serif',fontWeight:500,fontSize:`${s.button}px`,padding:`${n*1.2}px ${n*2}px`,borderRadius:`${k*2}px`,margin:`${n/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:t},t))})]})}):w==="rounds"?e.jsx("div",{style:O,children:e.jsxs("div",{style:X,children:[D,e.jsx("div",{dangerouslySetInnerHTML:{__html:ot}}),e.jsx("button",{onClick:()=>x("category"),onMouseEnter:t=>{t.currentTarget.style.backgroundColor="#e5e7eb"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="#f9f9f9"},style:{...i.gmButton,...i.gmButtonSecondary,fontSize:`${s.button}px`,padding:`${n}px ${n*1.5}px`,borderRadius:`${k}px`,position:"absolute",top:`${R}px`,left:`${R}px`,zIndex:10},children:"←"}),e.jsx("h1",{style:{...i.gmHeadline1,fontSize:`${s.headline1}px`,marginBottom:`${n*2}px`,position:"relative",zIndex:1},children:"Choose rounds"}),e.jsx("div",{style:{...i.gmButtonGroup,gap:`${n}px`,marginBottom:`${n*3}px`,position:"relative",zIndex:1},children:[1,3,5].map(t=>e.jsx("button",{onClick:()=>{N(t),gt()},onMouseEnter:o=>{o.currentTarget.style.backgroundColor="#f0f0f0",o.currentTarget.style.borderColor="#1f2937",o.currentTarget.style.transform="scale(1.05)"},onMouseLeave:o=>{o.currentTarget.style.backgroundColor="transparent",o.currentTarget.style.borderColor="#e5e7eb",o.currentTarget.style.transform="scale(1)"},style:{fontFamily:'"Onest", system-ui, sans-serif',fontWeight:500,fontSize:`${s.button}px`,padding:`${n*1.2}px ${n*2}px`,borderRadius:`${k*2}px`,margin:`${n/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:t},t))})]})}):w==="game"?e.jsx("div",{style:O,children:e.jsxs("div",{style:X,children:[D,e.jsxs("div",{style:{...i.gmInfoBox,padding:`${n*.8}px`,marginBottom:`${n*.5}px`,maxWidth:`${(m||r)*.9}px`},children:[e.jsxs("h3",{style:{...i.gmHeadline3,fontSize:`${s.headline3}px`,marginBottom:`${n*.5}px`},children:["Category: ",f]}),e.jsxs("p",{style:{...i.gmBodyM,fontSize:`${s.bodyM}px`,marginBottom:"0px"},children:["Round ",S," of ",v]})]}),j&&e.jsxs("p",{style:{...i.gmBodyS,fontSize:`${s.bodyS}px`,marginTop:`${n*.5}px`,marginBottom:`${n}px`},children:["I am thinking of a word that is ",e.jsx("strong",{children:j.length})," letters long"]}),e.jsx("div",{style:{margin:`${n}px 0`,display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsx(ht,{mistakes:P,maxMistakes:K,size:$?Math.max(80,Math.min(110,(m||r)*.16)):Math.max(100,Math.min(150,(m||r)*.2))})}),e.jsx("div",{style:{...i.gmWordDisplay,fontSize:`${Math.max(16,Math.min(24,s.wordDisplay*.9))}px`,margin:`${n}px 0`,letterSpacing:`${n*.8}px`,minHeight:`${Math.max(16,Math.min(24,s.wordDisplay*.9))*1.2}px`},children:ut||"Loading..."}),e.jsxs("div",{style:{...i.gmInfoBox,padding:`${n}px`,marginTop:`${n}px`,marginBottom:`${n}px`,maxWidth:`${(m||r)*.95}px`},children:[e.jsx("p",{style:{...i.gmBodyS,fontSize:`${s.bodyS}px`,marginBottom:`${n}px`,fontWeight:500},children:"Available letters:"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:`${n/3}px`,justifyContent:"center",fontSize:`${Math.max(9,Math.min(12,s.bodyS*.75))}px`,fontFamily:'"Onest", system-ui, sans-serif'},children:pt.map(t=>e.jsx("button",{onClick:()=>tt(t),disabled:p!==null,onMouseEnter:o=>{p===null&&(o.currentTarget.style.backgroundColor="#e5e7eb",o.currentTarget.style.cursor="pointer")},onMouseLeave:o=>{p===null&&(o.currentTarget.style.backgroundColor="#f9f9f9",o.currentTarget.style.cursor="pointer")},style:{padding:`${n/4}px ${n/3}px`,borderRadius:`${k*.5}px`,background:"#f9f9f9",color:"#1f2937",border:"1px solid #e5e7eb",minWidth:`${Math.max(n*1.5,(m||r)*.04)}px`,textAlign:"center",display:"inline-block",cursor:p===null?"pointer":"default",fontFamily:'"Onest", system-ui, sans-serif',fontSize:`${Math.max(9,Math.min(12,s.bodyS*.75))}px`,transition:"background-color 0.2s ease"},children:t},t))})]}),F.length>0&&e.jsx("div",{style:{...i.gmGuessedLetters,fontSize:`${Math.max(10,Math.min(12,s.bodyS*.85))}px`,marginTop:`${n*.5}px`,marginBottom:"2px"},children:e.jsxs("span",{style:{color:"#6b7280"},children:["Guessed letters: ",e.jsx("strong",{children:F.join(", ")})]})}),p==="win"&&e.jsx("div",{style:{...i.gmStatusWin,fontSize:`${s.bodyL}px`,margin:"2px 0"},children:"🎉 You won this round!"}),p==="lose"&&e.jsxs("div",{style:{...i.gmStatusLose,fontSize:`${s.bodyL}px`,margin:"2px 0"},children:["The hangman is complete! The word was: ",e.jsx("strong",{children:j})]}),p!==null&&S<v&&e.jsx("div",{style:{marginTop:"2px",marginBottom:`${n}px`},children:e.jsx("button",{onClick:xt,onMouseEnter:t=>{t.currentTarget.style.backgroundColor="#d43a32"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="#ec4c44"},style:{...i.gmButton,fontSize:`${Math.max(11,Math.min(14,s.button*.85))}px`,padding:`${n*.6}px ${n*1.2}px`,borderRadius:`${k}px`},children:"NEXT"})}),p!==null&&S>=v&&e.jsx("div",{style:{marginTop:"2px",marginBottom:`${n}px`},children:e.jsx("button",{onClick:()=>x("result"),onMouseEnter:t=>{t.currentTarget.style.backgroundColor="#d43a32"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="#ec4c44"},style:{...i.gmButton,fontSize:`${s.button}px`,padding:`${n}px ${n*1.5}px`,borderRadius:`${k}px`},children:"View Results →"})}),p===null&&F.length===0&&e.jsx("p",{style:{...i.gmBodyS,fontSize:`${s.bodyS}px`,marginTop:`${n}px`,marginBottom:`${n}px`},children:"Type a letter on your keyboard"})]})}):w==="result"?e.jsx("div",{style:O,children:e.jsxs("div",{style:X,children:[D,e.jsx("h1",{style:{...i.gmHeadline1,fontSize:`${s.headline1}px`,marginBottom:`${n*2}px`},children:"🎊 Game Finished!"}),e.jsxs("p",{style:{...i.gmBodyL,fontSize:`${s.bodyL}px`,marginBottom:`${n*2}px`},children:["You guessed ",e.jsx("strong",{children:Z})," out of ",e.jsx("strong",{children:v})," words correctly."]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:`${n}px`,alignItems:"center"},children:[e.jsx("button",{onClick:()=>{if(!f||v===0){x("lobby");return}B([]);const t=U(f,[]);t&&(W(t),B([t]),H([]),L(0),C(1),A(0),T(null),x("game"))},onMouseEnter:t=>{t.currentTarget.style.backgroundColor="#d43a32"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="#ec4c44"},style:{...i.gmButton,fontSize:`${s.button}px`,padding:`${n}px ${n*1.5}px`,borderRadius:`${k}px`,minWidth:"200px"},children:"Play again"}),e.jsx("button",{onClick:()=>x("lobby"),onMouseEnter:t=>{t.currentTarget.style.backgroundColor="#e5e7eb"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="#f9f9f9"},style:{...i.gmButton,...i.gmButtonSecondary,fontSize:`${s.button}px`,padding:`${n}px ${n*1.5}px`,borderRadius:`${k}px`,minWidth:"200px"},children:"Exit"})]})]})}):null}exports.HangmanLobbyGame=ct;exports.default=ct;
45
+ `,X={...i.gmCenterScreen,width:a?"100%":$?m||r||950:m||r||1e3,height:a?"100%":$?"auto":m||r||1e3,minHeight:a?"100%":$?"auto":m||r||1e3,maxHeight:a?"100%":$?"92vh":m||r||1e3,padding:`${R}px`,overflow:"auto",borderRadius:a?0:"20px",position:"relative",boxSizing:"border-box",background:"#ffffff",boxShadow:a?"none":"0 0 40px rgba(0,0,0,0.1)",margin:a?"0 auto":"unset"},dt=!a&&c,D=g.useMemo(()=>{if(a&&(y??window.innerWidth)>(h??window.innerHeight)||(h??window.innerHeight)<700||!dt)return null;const t=l||(typeof window<"u"&&window.origin?`${window.origin}/cloud/speakid/games/hangman/logo`:"/cloud/speakid/games/hangman/logo");return e.jsx("div",{style:{...i.gmLogoFixed,position:"absolute",top:16,left:16,zIndex:30},children:e.jsxs("picture",{children:[e.jsx("source",{srcSet:`${t}.svg`,type:"image/svg+xml"}),e.jsx("img",{src:`${t}.png`,alt:"SPEAKID Logo",style:i.gmLogoImg,loading:"lazy"})]})})},[a,dt,l,y,h]);return w==="lobby"?e.jsx("div",{style:O,children:e.jsxs("div",{style:X,children:[D,e.jsx("div",{dangerouslySetInnerHTML:{__html:ot}}),e.jsx("h1",{style:{...i.gmHeadline1,fontSize:`${s.headline1}px`,marginBottom:`${n*3}px`,position:"relative",zIndex:1},children:"HANGMAN"}),e.jsxs("button",{onClick:()=>x("category"),style:{fontFamily:'"Onest", system-ui, sans-serif',fontWeight:500,fontSize:`${s.button}px`,padding:`${n*1.2}px ${n*3}px`,borderRadius:`${k*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:t=>{t.currentTarget.style.background="#d43a32",t.currentTarget.style.transform="translateY(-2px)",t.currentTarget.style.boxShadow="0 4px 12px rgba(236, 76, 68, 0.3)"},onMouseLeave:t=>{t.currentTarget.style.background="#ec4c44",t.currentTarget.style.transform="translateY(0)",t.currentTarget.style.boxShadow="0 2px 8px rgba(236, 76, 68, 0.2)"},onMouseDown:t=>{t.currentTarget.style.transform="translateY(0)"},children:[e.jsx("svg",{width:`${s.button*1.3}px`,height:`${s.button*1.3}px`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"block",marginRight:`${n}px`},children:e.jsx("path",{d:"M8 5V19L19 12L8 5Z",fill:"#ffffff",stroke:"none"})}),e.jsx("span",{style:{fontWeight:500},children:"PLAY"})]}),e.jsxs("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",height:"100%",pointerEvents:"none",zIndex:0},children:[e.jsx("img",{src:`${V}/sun.png`,alt:"Sun",style:{position:"absolute",left:a?"-10%":"5%",top:"20%",width:"auto",height:a?`${Math.min(h*.33,200)}px`:`${Math.min((m||r)*.33,300)}px`,maxHeight:"33vh",objectFit:"contain",opacity:.6}}),e.jsx("img",{src:`${V}/character.png`,alt:"Hangman character",style:{position:"absolute",right:a?"5%":"10%",bottom:"10%",width:"auto",height:a?`${Math.min(h*.33,200)}px`:`${Math.min((m||r)*.33,300)}px`,maxHeight:"33vh",objectFit:"contain",opacity:.6}})]})]})}):w==="category"?e.jsx("div",{style:O,children:e.jsxs("div",{style:X,children:[D,e.jsx("div",{dangerouslySetInnerHTML:{__html:ot}}),e.jsx("button",{onClick:()=>x("lobby"),onMouseEnter:t=>{t.currentTarget.style.backgroundColor="#e5e7eb"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="#f9f9f9"},style:{...i.gmButton,...i.gmButtonSecondary,fontSize:`${s.button}px`,padding:`${n}px ${n*1.5}px`,borderRadius:`${k}px`,position:"absolute",top:`${R}px`,left:`${R}px`,zIndex:10},children:"←"}),e.jsx("div",{style:{...i.gmButtonGroup,gap:`${n}px`,marginBottom:`${n*3}px`,marginTop:`${n*4}px`,position:"relative",zIndex:1},children:Object.keys(z).map(t=>e.jsx("button",{onClick:()=>{q(t),x("rounds")},onMouseEnter:o=>{o.currentTarget.style.backgroundColor="#f0f0f0",o.currentTarget.style.borderColor="#1f2937",o.currentTarget.style.transform="scale(1.05)"},onMouseLeave:o=>{o.currentTarget.style.backgroundColor="transparent",o.currentTarget.style.borderColor="#e5e7eb",o.currentTarget.style.transform="scale(1)"},style:{fontFamily:'"Onest", system-ui, sans-serif',fontWeight:500,fontSize:`${s.button}px`,padding:`${n*1.2}px ${n*2}px`,borderRadius:`${k*2}px`,margin:`${n/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:t},t))})]})}):w==="rounds"?e.jsx("div",{style:O,children:e.jsxs("div",{style:X,children:[D,e.jsx("div",{dangerouslySetInnerHTML:{__html:ot}}),e.jsx("button",{onClick:()=>x("category"),onMouseEnter:t=>{t.currentTarget.style.backgroundColor="#e5e7eb"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="#f9f9f9"},style:{...i.gmButton,...i.gmButtonSecondary,fontSize:`${s.button}px`,padding:`${n}px ${n*1.5}px`,borderRadius:`${k}px`,position:"absolute",top:`${R}px`,left:`${R}px`,zIndex:10},children:"←"}),e.jsx("h1",{style:{...i.gmHeadline1,fontSize:`${s.headline1}px`,marginBottom:`${n*2}px`,position:"relative",zIndex:1},children:"Choose rounds"}),e.jsx("div",{style:{...i.gmButtonGroup,gap:`${n}px`,marginBottom:`${n*3}px`,position:"relative",zIndex:1},children:[1,3,5].map(t=>e.jsx("button",{onClick:()=>{N(t),gt()},onMouseEnter:o=>{o.currentTarget.style.backgroundColor="#f0f0f0",o.currentTarget.style.borderColor="#1f2937",o.currentTarget.style.transform="scale(1.05)"},onMouseLeave:o=>{o.currentTarget.style.backgroundColor="transparent",o.currentTarget.style.borderColor="#e5e7eb",o.currentTarget.style.transform="scale(1)"},style:{fontFamily:'"Onest", system-ui, sans-serif',fontWeight:500,fontSize:`${s.button}px`,padding:`${n*1.2}px ${n*2}px`,borderRadius:`${k*2}px`,margin:`${n/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:t},t))})]})}):w==="game"?e.jsx("div",{style:O,children:e.jsxs("div",{style:X,children:[D,e.jsxs("div",{style:{...i.gmInfoBox,padding:`${n*.8}px`,marginBottom:`${n*.5}px`,maxWidth:`${(m||r)*.9}px`},children:[e.jsxs("h3",{style:{...i.gmHeadline3,fontSize:`${s.headline3}px`,marginBottom:`${n*.5}px`},children:["Category: ",f]}),e.jsxs("p",{style:{...i.gmBodyM,fontSize:`${s.bodyM}px`,marginBottom:"0px"},children:["Round ",S," of ",v]})]}),j&&e.jsxs("p",{style:{...i.gmBodyS,fontSize:`${s.bodyS}px`,marginTop:`${n*.5}px`,marginBottom:`${n}px`},children:["I am thinking of a word that is ",e.jsx("strong",{children:j.length})," letters long"]}),e.jsx("div",{style:{margin:`${n}px 0`,display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsx(ht,{mistakes:P,maxMistakes:K,size:$?Math.max(80,Math.min(110,(m||r)*.16)):Math.max(100,Math.min(150,(m||r)*.2))})}),e.jsx("div",{style:{...i.gmWordDisplay,fontSize:`${Math.max(16,Math.min(24,s.wordDisplay*.9))}px`,margin:`${n}px 0`,letterSpacing:`${n*.8}px`,minHeight:`${Math.max(16,Math.min(24,s.wordDisplay*.9))*1.2}px`},children:ut||"Loading..."}),e.jsxs("div",{style:{...i.gmInfoBox,padding:`${n}px`,marginTop:`${n}px`,marginBottom:`${n}px`,maxWidth:`${(m||r)*.95}px`},children:[e.jsx("p",{style:{...i.gmBodyS,fontSize:`${s.bodyS}px`,marginBottom:`${n}px`,fontWeight:500},children:"Available letters:"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:`${n/3}px`,justifyContent:"center",fontSize:`${Math.max(9,Math.min(12,s.bodyS*.75))}px`,fontFamily:'"Onest", system-ui, sans-serif'},children:pt.map(t=>e.jsx("button",{onClick:()=>tt(t),disabled:p!==null,onMouseEnter:o=>{p===null&&(o.currentTarget.style.backgroundColor="#e5e7eb",o.currentTarget.style.cursor="pointer")},onMouseLeave:o=>{p===null&&(o.currentTarget.style.backgroundColor="#f9f9f9",o.currentTarget.style.cursor="pointer")},style:{padding:`${n/4}px ${n/3}px`,borderRadius:`${k*.5}px`,background:"#f9f9f9",color:"#1f2937",border:"1px solid #e5e7eb",minWidth:`${Math.max(n*1.5,(m||r)*.04)}px`,textAlign:"center",display:"inline-block",cursor:p===null?"pointer":"default",fontFamily:'"Onest", system-ui, sans-serif',fontSize:`${Math.max(9,Math.min(12,s.bodyS*.75))}px`,transition:"background-color 0.2s ease"},children:t},t))})]}),F.length>0&&e.jsx("div",{style:{...i.gmGuessedLetters,fontSize:`${Math.max(10,Math.min(12,s.bodyS*.85))}px`,marginTop:`${n*.5}px`,marginBottom:"2px"},children:e.jsxs("span",{style:{color:"#6b7280"},children:["Guessed letters: ",e.jsx("strong",{children:F.join(", ")})]})}),p==="win"&&e.jsx("div",{style:{...i.gmStatusWin,fontSize:`${s.bodyL}px`,margin:"2px 0"},children:"🎉 You won this round!"}),p==="lose"&&e.jsxs("div",{style:{...i.gmStatusLose,fontSize:`${s.bodyL}px`,margin:"2px 0"},children:["The hangman is complete! The word was: ",e.jsx("strong",{children:j})]}),p!==null&&S<v&&e.jsx("div",{style:{marginTop:"2px",marginBottom:`${n}px`},children:e.jsx("button",{onClick:xt,onMouseEnter:t=>{t.currentTarget.style.backgroundColor="#d43a32"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="#ec4c44"},style:{...i.gmButton,fontSize:`${Math.max(11,Math.min(14,s.button*.85))}px`,padding:`${n*.6}px ${n*1.2}px`,borderRadius:`${k}px`},children:"NEXT"})}),p!==null&&S>=v&&e.jsx("div",{style:{marginTop:"2px",marginBottom:`${n}px`},children:e.jsx("button",{onClick:()=>x("result"),onMouseEnter:t=>{t.currentTarget.style.backgroundColor="#d43a32"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="#ec4c44"},style:{...i.gmButton,fontSize:`${s.button}px`,padding:`${n}px ${n*1.5}px`,borderRadius:`${k}px`},children:"View Results →"})}),p===null&&F.length===0&&e.jsx("p",{style:{...i.gmBodyS,fontSize:`${s.bodyS}px`,marginTop:`${n}px`,marginBottom:`${n}px`},children:"Type a letter on your keyboard"})]})}):w==="result"?e.jsx("div",{style:O,children:e.jsxs("div",{style:X,children:[D,e.jsx("h1",{style:{...i.gmHeadline1,fontSize:`${s.headline1}px`,marginBottom:`${n*2}px`},children:"🎊 Game Finished!"}),e.jsxs("p",{style:{...i.gmBodyL,fontSize:`${s.bodyL}px`,marginBottom:`${n*2}px`},children:["You guessed ",e.jsx("strong",{children:Z})," out of ",e.jsx("strong",{children:v})," words correctly."]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:`${n}px`,alignItems:"center"},children:[e.jsx("button",{onClick:()=>{if(!f||v===0){x("lobby");return}B([]);const t=U(f,[]);t&&(W(t),B([t]),H([]),L(0),C(1),A(0),T(null),x("game"))},onMouseEnter:t=>{t.currentTarget.style.backgroundColor="#d43a32"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="#ec4c44"},style:{...i.gmButton,fontSize:`${s.button}px`,padding:`${n}px ${n*1.5}px`,borderRadius:`${k}px`,minWidth:"200px"},children:"Play again"}),e.jsx("button",{onClick:()=>x("lobby"),onMouseEnter:t=>{t.currentTarget.style.backgroundColor="#e5e7eb"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="#f9f9f9"},style:{...i.gmButton,...i.gmButtonSecondary,fontSize:`${s.button}px`,padding:`${n}px ${n*1.5}px`,borderRadius:`${k}px`,minWidth:"200px"},children:"Exit"})]})]})}):null}exports.Game=rt;exports.HangmanLobbyGame=rt;exports.default=rt;
46
46
  //# sourceMappingURL=speakid-hangman.cjs.js.map
@@ -381,18 +381,18 @@ function Mt({
381
381
  const d = W[t];
382
382
  if (!d || d.length === 0)
383
383
  return "";
384
- const Y = d.filter((A) => !o.includes(A)), G = Y.length > 0 ? Y : d;
385
- if (G.length === 0)
384
+ const Y = d.filter((A) => !o.includes(A)), Q = Y.length > 0 ? Y : d;
385
+ if (Q.length === 0)
386
386
  return "";
387
387
  let N;
388
388
  if (typeof crypto < "u" && crypto.getRandomValues) {
389
389
  const A = new Uint32Array(1);
390
390
  crypto.getRandomValues(A);
391
391
  const yt = A[0] / 4294967295;
392
- N = Math.floor(yt * G.length);
392
+ N = Math.floor(yt * Q.length);
393
393
  } else
394
- N = Math.floor(Math.random() * G.length);
395
- return G[N];
394
+ N = Math.floor(Math.random() * Q.length);
395
+ return Q[N];
396
396
  }, ut = () => {
397
397
  if (!y) return;
398
398
  C([]);
@@ -536,7 +536,7 @@ function Mt({
536
536
  boxShadow: s ? "none" : "0 0 40px rgba(0,0,0,0.1)",
537
537
  // Легкая тень для десктопа
538
538
  margin: s ? "0 auto" : "unset"
539
- }, gt = !s && c, Q = xt(
539
+ }, gt = !s && c, G = xt(
540
540
  () => {
541
541
  if (s && (x ?? window.innerWidth) > (f ?? window.innerHeight) || (f ?? window.innerHeight) < 700 || !gt)
542
542
  return null;
@@ -563,7 +563,7 @@ function Mt({
563
563
  [s, gt, l, x, f]
564
564
  );
565
565
  return w === "lobby" ? /* @__PURE__ */ e("div", { style: X, children: /* @__PURE__ */ p("div", { style: D, children: [
566
- Q,
566
+ G,
567
567
  /* @__PURE__ */ e("div", { dangerouslySetInnerHTML: { __html: rt } }),
568
568
  /* @__PURE__ */ e("h1", { style: {
569
569
  ...a.gmHeadline1,
@@ -675,7 +675,7 @@ function Mt({
675
675
  )
676
676
  ] })
677
677
  ] }) }) : w === "category" ? /* @__PURE__ */ e("div", { style: X, children: /* @__PURE__ */ p("div", { style: D, children: [
678
- Q,
678
+ G,
679
679
  /* @__PURE__ */ e("div", { dangerouslySetInnerHTML: { __html: rt } }),
680
680
  /* @__PURE__ */ e(
681
681
  "button",
@@ -733,7 +733,7 @@ function Mt({
733
733
  t
734
734
  )) })
735
735
  ] }) }) : w === "rounds" ? /* @__PURE__ */ e("div", { style: X, children: /* @__PURE__ */ p("div", { style: D, children: [
736
- Q,
736
+ G,
737
737
  /* @__PURE__ */ e("div", { dangerouslySetInnerHTML: { __html: rt } }),
738
738
  /* @__PURE__ */ e(
739
739
  "button",
@@ -792,7 +792,7 @@ function Mt({
792
792
  t
793
793
  )) })
794
794
  ] }) }) : w === "game" ? /* @__PURE__ */ e("div", { style: X, children: /* @__PURE__ */ p("div", { style: D, children: [
795
- Q,
795
+ G,
796
796
  /* @__PURE__ */ p("div", { style: {
797
797
  ...a.gmInfoBox,
798
798
  padding: `${n * 0.8}px`,
@@ -958,7 +958,7 @@ function Mt({
958
958
  marginBottom: `${n}px`
959
959
  }, children: "Type a letter on your keyboard" })
960
960
  ] }) }) : w === "result" ? /* @__PURE__ */ e("div", { style: X, children: /* @__PURE__ */ p("div", { style: D, children: [
961
- Q,
961
+ G,
962
962
  /* @__PURE__ */ e("h1", { style: {
963
963
  ...a.gmHeadline1,
964
964
  fontSize: `${i.headline1}px`,
@@ -1034,6 +1034,7 @@ function Mt({
1034
1034
  ] }) }) : null;
1035
1035
  }
1036
1036
  export {
1037
+ Mt as Game,
1037
1038
  Mt as HangmanLobbyGame,
1038
1039
  Mt as default
1039
1040
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speakid-hangman",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Hangman Game - Interactive word guessing game for SPEAKID platform",
5
5
  "main": "dist/speakid-hangman.cjs.js",
6
6
  "module": "dist/speakid-hangman.es.js",