1import{n as e}from"./client-DVSqKt4u.js";var t=new Set;function n(e){return t.add(e),()=>{t.delete(e)}}function r(){for(let e of t)e()}async function i(t,n){if(!t||!n)return{isFollowing:!1,error:null};let{data:r,error:i}=await e.from(`shop_follows`).select(`id`).eq(`user_id`,t).eq(`shop_id`,n).eq(`status`,`active`).maybeSingle();return i?{isFollowing:!1,error:i.message}:{isFollowing:!!r,error:null}}async function a(t){if(!t)return{ids:[],error:null};let{data:n,error:r}=await e.from(`shop_follows`).select(`shop_id`).eq(`user_id`,t).eq(`status`,`active`);return r?{ids:[],error:r.message}:{ids:(n??[]).map(e=>e.shop_id).filter(e=>typeof e==`string`&&e.length>0),error:null}}async function o(t,n=12){if(!t)return{items:[],error:null};let{data:r,error:i}=await e.from(`shop_follows`).select(`shop_id, updated_at`).eq(`user_id`,t).eq(`status`,`active`).order(`updated_at`,{ascending:!1}).limit(n);if(i)return{items:[],error:i.message};let a=(r??[]).filter(e=>typeof e.shop_id==`string`&&e.shop_id.length>0);if(!a.length)return{items:[],error:null};let o=new Map(a.map(e=>[e.shop_id,e.updated_at??null])),s=a.map(e=>e.shop_id),{data:c,error:l}=await e.from(`shops`).select(`id, shop_name, slug, logo_url, shop_description, average_rating, total_reviews, verified, shop_currency`).in(`id`,s);if(l)return{items:[],error:l.message};let u=new Map((c??[]).map(e=>[e.id,e]));return{items:s.map(e=>{let t=u.get(e);return t?{id:t.id,shop_name:t.shop_name??`Shop`,slug:t.slug??null,logo_url:t.logo_url??null,shop_description:t.shop_description??null,average_rating:t.average_rating??null,total_reviews:t.total_reviews??null,verified:t.verified??!1,shop_currency:t.shop_currency??null,followed_at:o.get(t.id)??null}:null}).filter(e=>!!e),error:null}}async function s(t,n){let{error:i}=await e.from(`shop_follows`).upsert({user_id:t,shop_id:n,status:`active`,updated_at:new Date().toISOString()},{onConflict:`user_id,shop_id`});return i||r(),{error:i?.message??null}}async function c(t,n){let{error:i}=await e.from(`shop_follows`).delete().eq(`user_id`,t).eq(`shop_id`,n);return i||r(),{error:i?.message??null}}export{n as a,s as i,o as n,c as o,i as r,a as t};
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.