1import{n as e}from"./client-MUfdoZuW.js";import{t}from"./active-slug-2KIRuGus.js";async function n(n){let{data:{user:r},error:i}=await e.auth.getUser();if(i)throw i;if(!r)throw Error(`Unauthorized: sign in required`);if(n){let[{data:t,error:i},{data:a,error:o}]=await Promise.all([e.rpc(`is_super_admin`,{_user:r.id}),e.from(`clinic_members`).select(`id`).eq(`clinic_id`,n).eq(`user_id`,r.id).maybeSingle()]);if(i)throw i;if(o)throw o;if(!t&&!a)throw Error(`Forbidden: clinic not found / not a member`);return n}let a=t();if(!a)throw Error(`Forbidden: no clinic context`);let{data:o,error:s}=await e.from(`clinics`).select(`id`).eq(`slug`,a).maybeSingle();if(s)throw s;if(!o)throw Error(`Forbidden: clinic not found / not a member`);return o.id}export{n 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.