import{Db as b,E as i,J as l,R as u,U as c}from"./chunk-OXQYUXXW.js";function S(r,e){let v=!e?.manualCleanup?e?.injector?.get(u)??l(u):null,a=f(e?.equal),n;e?.requireSync?n=c({kind:0},{equal:a}):n=c({kind:1,value:e?.initialValue},{equal:a});let s,d=r.subscribe({next:t=>n.set({kind:1,value:t}),error:t=>{n.set({kind:2,error:t}),s?.()},complete:()=>{s?.()}});if(e?.requireSync&&n().kind===0)throw new i(601,!1);return s=v?.onDestroy(d.unsubscribe.bind(d)),b(()=>{let t=n();switch(t.kind){case 1:return t.value;case 2:throw t.error;case 0:throw new i(601,!1)}},{equal:e?.equal})}function f(r=Object.is){return(e,o)=>e.kind===1&&o.kind===1&&r(e.value,o.value)}export{S as a};
