import{a as f}from"/build/_shared/chunk-IYEHZB2Y.js";import{d as E}from"/build/_shared/chunk-4AMCPB2Y.js";var e=E(f(),1),l=(0,e.createContext)(new Map),v=l.Provider;function m(r,{event:o="message",init:u}={}){let n=(0,e.useContext)(l),[d,s]=(0,e.useState)(null);return(0,e.useEffect)(()=>{let c=[r.toString(),o,u?.withCredentials].join("::"),t=n.get(c)??{count:0,source:new EventSource(r,u)};++t.count,n.set(c,t),t.source.addEventListener(o,a),s(null);function a(i){s(i.data||"UNKNOWN_EVENT_DATA")}return()=>{t.source.removeEventListener(o,a),--t.count,t.count<=0&&(t.source.close(),n.delete(c))}},[r,o,u,n]),d}export{m as a};
//# sourceMappingURL=/build/_shared/chunk-3HCBGCGM.js.map
