import{r}from"./index-BoRhKTB8.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"28ce3948dcef68c9e8b5be7c5619a3bd17c18150"}}catch{}})();const f=r.createContext(new Map);f.Provider;function p(t,{event:n="message",init:u,enabled:a=!0}={}){let o=r.useContext(f),[l,s]=r.useState(null);return r.useEffect(()=>{if(!a)return;let c=[t.toString(),u?.withCredentials].join("::"),e=o.get(c)??{count:0,source:new EventSource(t,u)};++e.count,o.set(c,e),e.source.addEventListener(n,d),s(null);function d(i){s(i.data||"UNKNOWN_EVENT_DATA")}return()=>{e.source.removeEventListener(n,d),--e.count,e.count<=0&&(e.source.close(),o.delete(c))}},[t,n,u,o,a]),l}export{p as u};
//# sourceMappingURL=use-event-source-ZDun4YKa.js.map
