import{r as e}from"./index-BMcVAjQW.js";import{s}from"./client-BVfsVemL.js";const n={whatsappNumber:"6282312715218",whatsappNumber2:"",instagramUrl:"https://instagram.com/rental.pergamff",tiktokUrl:"",whatsappChannelUrl:""};function u(){const[p,i]=e.useState(n),[l,o]=e.useState(!0),a=async()=>{const{data:t}=await s.from("site_settings").select("whatsapp_number, instagram_url, tiktok_url, whatsapp_channel_url, whatsapp_number_2").maybeSingle();t&&i({whatsappNumber:t.whatsapp_number??n.whatsappNumber,whatsappNumber2:t.whatsapp_number_2??"",instagramUrl:t.instagram_url??n.instagramUrl,tiktokUrl:t.tiktok_url??"",whatsappChannelUrl:t.whatsapp_channel_url??""}),o(!1)};return e.useEffect(()=>{a();const h=`site-settings-realtime-${`${Date.now()}-${Math.random().toString(36).slice(2,9)}`}`,r=s.channel(h);return r.on("postgres_changes",{event:"*",schema:"public",table:"site_settings"},()=>{a()}).subscribe(),()=>{s.removeChannel(r)}},[]),{settings:p,loading:l,refetch:a}}export{u};
