PageSourceSearch

https://arabicmc.lovable.app/assets/Games-CbaA6KSj.js

js arabicmc.lovable.app collected 2026-10-03 03:22:37 UTC 14,903 bytes, 11 lines download raw bytes

1import{c as B,u as S,j as e,G,r as n,R as L,Z as D,a as Y,e as q,S as I,X,C as z,s as W}from"./index-BUT6XmLp.js";import{B as w}from"./BlockCard-gbJBVTqc.js";import{B as Z}from"./AIWidgets-CCsMo1SN.js";import{T as M}from"./trophy-W537OGLs.js";import{L as F}from"./loader-circle-DdoNN_zl.js";import"./calendar-BT8YwAVF.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Q=B("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const J=B("Pickaxe",[["path",{d:"M14.531 12.469 6.619 20.38a1 1 0 1 1-3-3l7.912-7.912",key:"we99rg"}],["path",{d:"M15.686 4.314A12.5 12.5 0 0 0 5.461 2.958 1 1 0 0 0 5.58 4.71a22 22 0 0 1 6.318 3.393",key:"1w6hck"}],["path",{d:"M17.7 3.7a1 1 0 0 0-1.4 0l-4.6 4.6a1 1 0 0 0 0 1.4l2.6 2.6a1 1 0 0 0 1.4 0l4.6-4.6a1 1 0 0 0 0-1.4z",key:"15hgfx"}],["path",{d:"M19.686 8.314a12.501 12.501 0 0 1 1.356 10.225 1 1 0 0 1-1.751-.119 22 22 0 0 0-3.393-6.319",key:"452b4h"}]]),O=["🟢","🟫","💎","🟥","🪨","🌳","⚒️","🔥"],K=t=>t.map(s=>[Math.random(),s]).sort((s,l)=>s[0]-l[0]).map(([,s])=>s),H=()=>{const{isRTL:t}=S(),[s,l]=n.useState([]),[i,p]=n.useState(null),[o,b]=n.useState(0),[g,c]=n.useState(!1),m=()=>{const a=K([...O,...O]).map((f,h)=>({id:h,icon:f,flipped:!1,matched:!1}));l(a),p(null),b(0),c(!1)};n.useEffect(m,[]);const x=s.length>0&&s.every(a=>a.matched),y=a=>{if(g||s[a].flipped||s[a].matched)return;const f=s.map((h,j)=>j===a?{...h,flipped:!0}:h);if(l(f),i===null){p(a);return}b(h=>h+1),c(!0),f[i].icon===f[a].icon?setTimeout(()=>{l(h=>h.map((j,N)=>N===i||N===a?{...j,matched:!0}:j)),p(null),c(!1)},400):setTimeout(()=>{l(h=>h.map((j,N)=>N===i||N===a?{...j,flipped:!1}:j)),p(null),c(!1)},800)};return e.jsxs(w,{className:"text-center",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"font-pixel text-primary text-lg flex items-center gap-2",children:[e.jsx(J,{className:"w-5 h-5"})," ",t?"لعبة الذاكرة":"Memory Game"]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[t?"محاولات":"Moves",": ",o]})]}),e.jsx("div",{className:"grid grid-cols-4 gap-2 mb-4",children:s.map((a,f)=>e.jsx("button",{onClick:()=>y(f),className:`aspect-square border-4 text-2xl md:text-3xl font-bold transition-all ${a.flipped||a.matched?"border-primary bg-primary/10":"border-border bg-card hover:border-primary"} ${a.matched?"opacity-60":""}`,children:a.flipped||a.matched?a.icon:"?"},a.id))}),x&&e.jsxs("div",{className:"mb-4 p-3 border-4 border-emerald bg-emerald/10 font-pixel text-emerald flex items-center justify-center gap-2",children:[e.jsx(M,{className:"w-5 h-5"})," ",t?`أحسنت! ${o} محاولة`:`Won in ${o} moves!`]}),e.jsxs("button",{onClick:m,className:"inline-flex items-center gap-2 px-4 py-2 border-4 border-border bg-card font-bold hover:border-primary",children:[e.jsx(L,{className:"w-4 h-4"})," ",t?"إعادة":"Reset"]})]})},U=()=>{const{isRTL:t}=S(),[s,l]=n.useState(Array(9).fill(null)),[i,p]=n.useState("X"),o=n.useMemo(()=>{const c=[[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]];for(const[m,x,y]of c)if(s[m]&&s[m]===s[x]&&s[x]===s[y])return s[m];return s.every(Boolean)?"D":null},[s]);n.useEffect(()=>{if(i==="O"&&!o){const c=s.map((x,y)=>x?null:y).filter(x=>x!==null);if(!c.length)return;const m=setTimeout(()=>{const x=c[Math.floor(Math.random()*c.length)];l(y=>{const a=[...y];return a[x]="O",a}),p("X")},500);return()=>clearTimeout(m)}}
11,[i,s,o]);const b=c=>{s[c]||o||i!=="X"||(l(m=>{const x=[...m];return x[c]="X",x}),p("O"))},g=()=>{l(Array(9).fill(null)),p("X")};return e.jsxs(w,{className:"text-center",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"font-pixel text-primary text-lg flex items-center gap-2",children:[e.jsx(Q,{className:"w-5 h-5"})," ",t?"إكس أو":"Tic-Tac-Toe"]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:t?"أنت X":"You: X"})]}),e.jsx("div",{className:"grid grid-cols-3 gap-2 mb-4 max-w-xs mx-auto",children:s.map((c,m)=>e.jsx("button",{onClick:()=>b(m),className:"aspect-square border-4 border-border bg-card font-pixel text-3xl hover:border-primary",children:e.jsx("span",{className:c==="X"?"text-primary":"text-destructive",children:c})},m))}),o&&e.jsx("div",{className:"mb-4 p-3 border-4 border-emerald bg-emerald/10 font-pixel",children:o==="D"?t?"تعادل":"Draw":o==="X"?t?"فزت!":"You Win!":t?"خسرت":"You Lose"}),e.jsxs("button",{onClick:g,className:"inline-flex items-center gap-2 px-4 py-2 border-4 border-border bg-card font-bold hover:border-primary",children:[e.jsx(L,{className:"w-4 h-4"})," ",t?"إعادة":"Reset"]})]})},V=()=>{const{isRTL:t}=S(),[s,l]=n.useState("idle"),[i,p]=n.useState(0),o=n.useRef(0),b=n.useRef(null),g=()=>{l("wait"),p(0);const m=1e3+Math.random()*3e3;b.current=window.setTimeout(()=>{o.current=Date.now(),l("go")},m)},c=()=>{if(s==="wait"){b.current&&clearTimeout(b.current),l("idle");return}s==="go"&&(p(Date.now()-o.current),l("done"))};return e.jsxs(w,{className:"text-center",children:[e.jsxs("h3",{className:"font-pixel text-primary text-lg flex items-center justify-center gap-2 mb-4",children:[e.jsx(D,{className:"w-5 h-5"})," ",t?"سرعة الرد":"Reaction Time"]}),e.jsxs("button",{onClick:s==="idle"||s==="done"?g:c,className:`w-full py-12 border-4 font-pixel text-xl transition-all ${s==="wait"?"border-destructive bg-destructive/20 text-destructive":s==="go"?"border-emerald bg-emerald/20 text-emerald":"border-primary bg-primary/10 text-primary hover:bg-primary/20"}`,children:[s==="idle"&&(t?"ابدأ":"Start"),s==="wait"&&(t?"انتظر...":"Wait..."),s==="go"&&(t?"اضغط الآن!":"CLICK NOW!"),s==="done"&&(t?`${i} مللي ث - حاول مجدداً`:`${i} ms - Try again`)]})]})},$="mc_quiz_state_v2",T=3,ee=()=>{const{isRTL:t,language:s}=S(),{toast:l}=Y(),[i,p]=n.useState([]),[o,b]=n.useState(0),[g,c]=n.useState(0),[m,x]=n.useState(null),[y,a]=n.useState(!1),[f,h]=n.useState(!1),[j,N]=n.useState(T),[k,E]=n.useState(!1);n.useEffect(()=>{var r;try{const u=localStorage.getItem($);if(u){const d=JSON.parse(u);(r=d.questions)!=null&&r.length&&(p(d.questions),b(d.idx||0),c(d.score||0),h(d.finished||!1),N(d.lives??T),E(d.failed||!1))}}catch{}},[]),n.useEffect(()=>{i.length&&localStorage.setItem($,JSON.stringify({questions:i,idx:o,score:g,finished:f,lives:j,failed:k}))},[i,o,g,f,j,k]),n.useEffect(()=>{if(!i.length||f||k)return;const r=()=>{document.visibilityState==="hidden"&&N(u=>{const d=u-1;return d<=0?(E(!0),l({title:t?"انتهت المحاولات!":"No lives left!",description:t?"غادرت التبويب كثيراً":"You switched tabs too many times",variant:"destructive"})):l({title:t?`فقدت محاولة! تبقى ${d}`:`Lost a life! ${d} left`,variant:"destructive"}),Math.max(0,d)})};return document.addEventListener("visibilitychange",r),window.addEventListener("blur",r),()=>{document.removeEventListener("visibilitychange",r),window.removeEventListener("blur",r)}},[i.length,f,k,t,l]);const R=async()=>{a(!0),p([]),b(0),c(0),x(null),h(!1),N(T),E(!1),localStorage.removeItem($);try{const{data:r,error:u}=await W.functions.invoke("quiz-generator",{body:{count:20,lang:s}});if(u)throw u;if((r==null?void 0:r.error)==="rate_limit"){l({title:t?"محاولات كثيرة":"Rate limited",variant:"destructive"});return}if((r==null?void 0:r.error)==="payment_required"){l({title:t?"الرصيد نفد":"Credits exhausted",variant:"destructive"});return}const d=((r==null?void 0:r.questions)||[]).filter(v=>{var A;return((A=v==null?void 0:v.options)==null?void 0:A.length)===4&&typeof v.answer=="number"});if(!d.length)throw new Error("no questions");p(d.slice(0,20))}catch(r){l({title:t?"فشل التحميل":"Failed to load",description:String(r.message),variant:"destructive"})}finally{a(!1)}},P=r=>{if(m!==null||!i[o])return;x(r),r===i[o].answer&&c(d=>d+1),setTimeout(()=>{o+1>=i.length?(h(!0),x(null)):(b(d=>d+1),x(null))},900)},_=r=>r>=20?{label:t?"محترف":"Pro",icon:e.jsx(q,{className:"w-5 h-5"}),color:"text-gold border-gold bg-gold/10"}:r>=15?{label:t?"نص محترف":"Semi-Pro",icon:e.jsx(I,{className:"w-5 h-5"}),color:"text-diamond border-diamond bg-diamond/10"}:r>=10?{label:t?"مبتدئ + هاوي":"Novice + Amateur",icon:e.jsx(M,{className:"w-5 h-5"}),color:"text-emerald border-emerald bg-emerald/10"}:r>=5?{label:t?"هاوي":"Amateur",icon:e.jsx(M,{className:"w-5 h-5"}),color:"text-primary border-primary bg-primary/10"}:null;if(!i.length)return e.jsxs(w,{className:"md:col-span-2 text-center",children:[e.jsxs("h3",{className:"font-pixel text-primary text-xl flex items-center justify-center gap-2 mb-3",children:[e.jsx(q,{className:"w-6 h-6 text-gold"})," ",t?"مسابقة الموسوعة - 20 سؤال":"Encyclopedia Challenge - 20Q"]}),e.jsx("p",{className:"text-muted-foreground mb-6",children:t?"أسئلة تُولّد بالذكاء الاصطناعي من موسوعة ماين كرافت. اربح شارات حسب نتيجتك!":"AI-generated Minecraft encyclopedia questions. Earn badges by score!"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 mb-6 text-xs",children:[e.jsxs("div",{className:"border-2 border-primary p-2",children:[e.jsx("strong",{children:"5+"}),e.jsx("br",{}),t?"هاوي":"Amateur"]}),e.jsxs("div",{className:"border-2 border-emerald p-2",children:[e.jsx("strong",{children:"10+"}),e.jsx("br",{}),t?"مبتدئ":"Novice"]}),e.jsxs("div",{className:"border-2 border-diamond p-2",children:[e.jsx("strong",{children:"15+"}),e.jsx("br",{}),t?"نص محترف":"Semi-Pro"]}),e.jsxs("div",{className:"border-2 border-gold p-2",children:[e.jsx("strong",{children:"20"}),e.jsx("br",{}),t?"محترف":"Pro"]})]}),e.jsxs("button",{onClick:R,disabled:y,className:"inline-flex items-center gap-2 px-6 py-3 border-4 border-primary bg-primary text-primary-foreground font-bold disabled:opacity-50",children:[y?e.jsx(F,{className:"w-4 h-4 animate-spin"}):e.jsx(I,{className:"w-4 h-4"}),t?"ابدأ المسابقة":"Start Challenge"]})]});if(f){const r=_(g);return e.jsxs(w,{className:"md:col-span-2 text-center",children:[e.jsx(M,{className:"mx-auto w-16 h-16 text-gold mb-3"}),e.jsxs("p",{className:"font-pixel text-2xl text-primary mb-2",children:[g,"/20"]}),r&&e.jsxs("div",{className:`inline-flex items-center gap-2 px-4 py-2 border-4 font-pixel mb-4 ${r.color}`,children:[r.icon," ",t?`حصلت على شارة: ${r.label}`:`Earned badge: ${r.label}`]}),!r&&e.jsx("p",{className:"text-muted-foreground mb-4",children:t?"حاول مرة أخرى لكسب شارة!":"Try again to earn a badge!"}),e.jsx("div",{children:e.jsxs("button",{onClick:R,className:"inline-flex items-center gap-2 px-6 py-3 border-4 border-primary bg-primary text-primary-foreground font-bold",children:[e.jsx(L,{className:"w-4 h-4"})," ",t?"مسابقة جديدة":"New Challenge"]})})]})}if(k)return e.jsxs(w,{className:"md:col-span-2 text-center",children:[e.jsx(X,{className:"mx-auto w-16 h-16 text-destructive mb-3"}),e.jsx("p",{className:"font-pixel text-2xl text-destructive mb-2",children:t?"انتهت المحاولات":"Game Over"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:t?"غادرت التبويب 3 مرات. ابدأ مسابقة جديدة.":"You left the tab 3 times. Start a new challenge."}),e.jsxs("button",{onClick:R,className:"inline-flex items-center gap-2 px-6 py-3 border-4 border-primary bg-primary text-primary-foreground font-bold",children:[e.jsx(L,{className:"w-4 h-4"})," ",t?"مسابقة جديدة":"New Challenge"]})]});const C=i[o];return e.jsxs(w,{className:"md:col-span-2",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4 gap-2 flex-wrap",children:[e.jsxs("h3",{className:"font-pixel text-primary text-lg flex items-center gap-2",children:[e.jsx(q,{className:"w-5 h-5 text-gold"})," ",t?"مسابقة الموسوعة":"Encyclopedia"]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm flex items-center gap-1",title:t?"محاولات":"Lives",children:Array.from({length:T}).map((r,u)=>e.jsx("span",{className:u<j?"text-destructive":"text-muted-foreground
11/30",children:"♥"},u))}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[o+1,"/20 · ",t?"النقاط":"Score",": ",g]})]})]}),e.jsx("div",{className:"w-full h-2 bg-muted mb-4",children:e.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${o/20*100}%`}})}),e.jsx("p",{className:"font-bold text-base mb-4",children:C.question}),e.jsx("div",{className:"grid gap-2",children:C.options.map((r,u)=>{const d=m!==null&&u===C.answer,v=m===u&&u!==C.answer;return e.jsxs("button",{onClick:()=>P(u),disabled:m!==null,className:`w-full text-start p-3 border-4 font-bold transition-all flex items-center justify-between ${d?"border-emerald bg-emerald/10 text-emerald":v?"border-destructive bg-destructive/10 text-destructive":"border-border bg-card hover:border-primary"}`,children:[e.jsx("span",{children:r}),d&&e.jsx(z,{className:"w-5 h-5"}),v&&e.jsx(X,{className:"w-5 h-5"})]},u)})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-3 text-center",children:t?"لا تغادر التبويب! 3 محاولات فقط":"Don't leave the tab! Only 3 lives"})]})},ie=()=>{const{isRTL:t,t:s}=S();return e.jsx("main",{className:"min-h-screen pt-20 minecraft-bg",children:e.jsx("section",{className:"py-16",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-10",children:[e.jsx(G,{className:"mx-auto w-14 h-14 text-primary mb-4"}),e.jsx("h1",{className:"font-pixel text-3xl md:text-4xl text-primary pixel-shadow mb-3",children:s("games.title")}),e.jsx("p",{className:"text-muted-foreground",children:t?"العب وتحدى نفسك واكسب شارات!":"Play, challenge yourself, earn badges!"})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-6 max-w-5xl mx-auto",children:[e.jsx(ee,{}),e.jsx(Z,{}),e.jsx(H,{}),e.jsx(U,{}),e.jsx(V,{})]})]})})})};export{ie as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.