import{m as t,u as a}from"./madar-api-D5dAUylW.js";import"./index-DcNlVx-A.js";async function o(){const[e,n,l]=await Promise.all([t.get("/referral/summary").catch(()=>null),t.get("/gamification/summary").catch(()=>null),t.get("/rewards").catch(()=>null)]),c=e?a(e.data):{},r=n?a(n.data):{},i=l?a(l.data):{};document.getElementById("reward-points").textContent=r.points??i.points??"—",document.getElementById("reward-streak").textContent=r.streak_days??"0",document.getElementById("reward-level").textContent=r.level??"1";const d=document.getElementById("referral-link");d&&c.referral_code&&(d.value=`${location.origin}/register?ref=${c.referral_code}`)}document.getElementById("claim-daily")?.addEventListener("click",async()=>{try{const{data:e}=await t.post("/engagement/daily-reward/claim");alert(a(e)?.message||"تم استلام المكافأة"),o()}catch(e){alert(e.madarMessage||"تعذر الاستلام")}});document.getElementById("copy-referral")?.addEventListener("click",()=>{const e=document.getElementById("referral-link");e?.select(),navigator.clipboard.writeText(e?.value||"")});o();
