import{c as a}from"./473784ee-8723-4dfd-ae44-ea2054eb59f9.0Z0pQ5H2.js";const S=t=>{let e;const n=new Set,o=(s,u)=>{const c=typeof s=="function"?s(e):s;if(!Object.is(c,e)){const g=e;e=u??(typeof c!="object"||c===null)?c:Object.assign({},e,c),n.forEach(f=>f(e,g))}},i=()=>e,r={setState:o,getState:i,getInitialState:()=>l,subscribe:s=>(n.add(s),()=>n.delete(s))},l=e=t(o,i,r);return r},d=t=>t?S(t):S,I=t=>t;function j(t,e=I){const n=a.useSyncExternalStore(t.subscribe,()=>e(t.getState()),()=>e(t.getInitialState()));return a.useDebugValue(n),n}const b=t=>{const e=d(t),n=o=>j(e,o);return Object.assign(n,e),n},x=t=>t?b(t):b;export{x as c};
