1import{e as d,s as n}from"./main-DUKblHcf.js";const c=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M20 11v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8",key:"1sqzm4"}],["path",{d:"M7.5 7a1 1 0 0 1 0-5A4.8 8 0 0 1 12 7a4.8 8 0 0 1 4.5-5 1 1 0 0 1 0 5",key:"kc0143"}],["rect",{x:"3",y:"7",width:"18",height:"4",rx:"1",key:"1hberx"}]],m=d("gift",c),f="ABCDEFGHJKLMNPQRSTUVWXYZ",l="23456789";function u(r=4){const e=f+l;let t="";for(let a=0;a<r;a++)t+=e[Math.floor(Math.random()*e.length)];return t}function w(r){return(r||"FRIEND").toUpperCase().replace(/[^A-Z]/g,"").slice(0,6)||"FRIEND"}async function p(r){const{data:e}=await n.from("referral_codes").select("code").eq("user_id",r.userId).maybeSingle();if(e?.code)return e.code;const t=w(r.displayName);for(let a=0;a<6;a++){const s=`${t}-${u(4)}`,{error:o}=await n.from("referral_codes").insert({user_id:r.userId,code:s});if(!o)return s;if(!String(o.message||"").toLowerCase().includes("duplicate"))throw o}throw new Error("Could not generate a unique referral code. Please try again.")}async function _(r){const e=r.trim().toUpperCase();if(!e)return null;const{data:t,error:a}=await n.rpc("lookup_referral_code",{_code:e});return a||!t?null:{code:e,referrerUserId:t}}async function y(r){const{data:e}=await n.from("referrals").select("id, referral_code, reward_status, created_at, paddle_subscription_id").eq("referrer_user_id",r).order("created_at",{ascending:!1});return e??[]}const i="ww:pendingReferralCode";function I(r){if(typeof window>"u")return;const e=r.trim().toUpperCase();e&&window.localStorage.setItem(i,e)}function R(){return typeof window>"u"?null:window.localStorage.getItem(i)}function h(){typeof window>"u"||window.localStorage.removeItem(i)}export{m as G,I as a,y as b,h as c,p as g,_ as l,R as r};
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.