import{r as c}from"./index-B9zr-vzA.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"8a6db0ac5fe78363b0c97fe458a96ce773bf357c"};var n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="18362e3f-4248-41ca-971c-39dec1b0ec67",e._sentryDebugIdIdentifier="sentry-dbid-18362e3f-4248-41ca-971c-39dec1b0ec67")}catch{}})();const f=c.createContext(new Map);f.Provider;function E(e,{event:n="message",init:r,enabled:u=!0}={}){let o=c.useContext(f),[i,a]=c.useState(null);return c.useEffect(()=>{if(!u)return;let s=[e.toString(),r?.withCredentials].join("::"),t=o.get(s)??{count:0,source:new EventSource(e,r)};++t.count,o.set(s,t),t.source.addEventListener(n,d),a(null);function d(l){a(l.data||"UNKNOWN_EVENT_DATA")}return()=>{t.source.removeEventListener(n,d),--t.count,t.count<=0&&(t.source.close(),o.delete(s))}},[e,n,r,o,u]),i}export{E as u};
//# sourceMappingURL=use-event-source-Dip1vrZy.js.map
