import{n,s as t}from"./index-0d9f0c09.js";const e=[];function s(s,o=n){let c;const f=new Set;function i(n){if(t(s,n)&&(s=n,c)){const n=!e.length;for(const n of f)n[1](),e.push(n,s);if(n){for(let n=0;n<e.length;n+=2)e[n][0](e[n+1]);e.length=0}}}return{set:i,update:function(n){i(n(s))},subscribe:function(t,e=n){const r=[t,e];return f.add(r),1===f.size&&(c=o(i)||n),t(s),()=>{f.delete(r),0===f.size&&(c(),c=null)}}}}export{s as w};
