PageSourceSearch

https://tour.thenbhd.com/assets/supabaseApi-D7LRh7SY.js

js thenbhd.com collected 2026-10-02 11:00:30 UTC 2,282 bytes, 1 lines download raw bytes

1import{S as m,a as i}from"./index-DtmQrRDo.js";async function c(e,o,r=3){console.log("[supabaseApi] Making request:",e);let n=null;for(let t=0;t<r;t++)try{const s=await fetch(`${m.replace(/\/$/,"")}/rest/v1/${e}`,{...o,headers:{apikey:i,Authorization:`Bearer ${i}`,"Content-Type":"application/json",Prefer:"return=representation",...(o==null?void 0:o.headers)||{}}});if(!s.ok){const a=await s.text();if(console.error("[supabaseApi] Error response:",{status:s.status,statusText:s.statusText,body:a,attempt:t+1}),s.status>=400&&s.status<500)throw new Error(`Supabase error ${s.status}: ${a}`);if(n=new Error(`Supabase error ${s.status}: ${a}`),t<r-1){const l=Math.min(1e3*Math.pow(2,t),5e3);console.log(`[supabaseApi] Retrying in ${l}ms...`),await new Promise(u=>setTimeout(u,l));continue}throw n}return s.status===204?null:s.json()}catch(s){if(n=s instanceof Error?s:new Error(String(s)),t<r-1){const a=Math.min(1e3*Math.pow(2,t),5e3);console.log(`[supabaseApi] Network error, retrying in ${a}ms...`,s),await new Promise(l=>setTimeout(l,a));continue}throw n}throw n||new Error("All retry attempts failed")}async function f(e){const o=[{email:e.email,phone:e.phone,username:e.username??null,country:e.country??null,postal_code:e.postal_code??null,instagram:e.instagram??null,tiktok:e.tiktok??null}],r=await c("players?on_conflict=email",{method:"POST",body:JSON.stringify(o)});return r&&r[0]?r[0]:null}async function y(e,o){await c("scores",{method:"POST",body:JSON.stringify([{player_id:e,score:o}])})}async function w(e=10){return await c(`public_leaderboard?select=id,username,best_score&order=best_score.desc&limit=${e}`)}async function b(e){console.log("[supabaseApi] Upserting email signup:",e.email);const o=[{email:e.email,first_name:e.first_name??null,last_name:e.last_name??null,phone:e.phone??null,city:e.city??null,state_province:e.state_province??null,country:e.country??null,username:e.username??null,consent_marketing:e.consent_marketing??!1,consent_sms:e.consent_sms??!1}];console.log("[supabaseApi] Request body:",o);const r=await c("email_signups?on_conflict=email",{method:"POST",body:JSON.stringify(o)});return console.log("[supabaseApi] Response rows:",r),r&&r[0]?r[0]:null}export{w as fetchLeaderboard,y as insertScore,b as upsertEmailSignup,f as upsertPlayer};

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.