(()=>{if(globalThis.__nte_username_lookup_guard)return;globalThis.__nte_username_lookup_guard=!0;const t=globalThis.fetch.bind(globalThis),e="nte_username_lookup:",r=3e5,n=new Map,a=new Map;function s(t){return String(t||"").trim().toLowerCase()}function o(t,r,a){let s={status:200,body:r||{data:[]},expires_at:Date.now()+a};n.set(t,s);try{sessionStorage.setItem(e+t,JSON.stringify(s))}catch{}return s}function i(t){return new Response(JSON.stringify(t.body||{data:[]}),{status:t.status||200,headers:{"Content-Type":"application/json"}})}globalThis.fetch=function(u,l){let c=function(t,e){let r="string"==typeof t?t:t?.url||"";if("POST"!==String(e?.method||t?.method||"GET").toUpperCase()||!/^https:\/\/users\.roblox\.com\/v1\/usernames\/users(?:\?|$)/i.test(r))return"";let n=e?.body;if("string"!=typeof n)return"";try{let t=JSON.parse(n),e=Array.isArray(t?.usernames)?t.usernames.map(s).filter(Boolean):[];return e.length?e.sort().join("|"):""}catch{return""}}(u,l);if(!c)return t(u,l);let f=function(t){let r=Date.now(),a=n.get(t);if(a&&a.expires_at>r)return a;a&&n.delete(t);try{if(a=JSON.parse(sessionStorage.getItem(e+t)||"null"),a&&a.expires_at>r)return n.set(t,a),a;sessionStorage.removeItem(e+t)}catch{}return null}(c);if(f)return Promise.resolve(i(f));let g=a.get(c);return g||(g=async function(e,n,a){try{let s=await t(e,n);if(!s.ok)return o(a,{data:[]},r);let i=await s.clone().json().catch(()=>({data:[]}));return o(a,i&&"object"==typeof i?i:{data:[]},Array.isArray(i?.data)&&i.data.length>0?216e5:r)}catch{return o(a,{data:[]},r)}}(u,l,c).finally(()=>a.delete(c)),a.set(c,g)),g.then(i)}})();