1import{o as c,p as m,k as u,r as f,V as h}from"./index-IxvR3ybE.js";const b=e=>{const s=c(),{data:r,isLoading:n,error:o}=m({queryKey:["live-stream",e],queryFn:async()=>{if(!e)return null;const{data:i,error:t}=await u.from("events").select("live_stream_url, is_live").eq("id",e).single();if(t)throw console.error("Error fetching live stream data:",t),t;return i},enabled:!!e,staleTime:3e4});f.useEffect(()=>{if(!e)return;const i=u.channel(`live-stream-${e}`).on("postgres_changes",{event:"UPDATE",schema:"public",table:"events",filter:`id=eq.${e}`},t=>{const a=t.new;s.setQueryData(["live-stream",e],{live_stream_url:a.live_stream_url,is_live:a.is_live})}).subscribe();return()=>{u.removeChannel(i)}},[e,s]);const l=h({mutationFn:async({url:i,isLive:t})=>{if(!e)throw new Error("No event ID");const{error:a}=await u.from("events").update({live_stream_url:i,is_live:t}).eq("id",e);if(a)throw a},onSuccess:()=>{s.invalidateQueries({queryKey:["live-stream",e]})}});return{liveStreamUrl:(r==null?void 0:r.live_stream_url)??null,isLive:(r==null?void 0:r.is_live)??!1,isLoading:n,error:o,updateLiveStream:l.mutate,isUpdating:l.isPending}},v=e=>{if(!e)return null;const s=e.match(/[?&]v=([^&]+)/);if(s)return s[1];const r=e.match(/youtu\.be\/([^?&]+)/);if(r)return r[1];const n=e.match(/youtube\.com\/embed\/([^?&]+)/);if(n)return n[1];const o=e.match(/youtube\.com\/live\/([^?&]+)/);return o?o[1]:null},_=e=>e?!!v(e):!1,p=e=>e?!_(e):!1;export{v as e,p as i,b as u};
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.