import{d as y,g as z}from"./vendor-react-DX7tU9aY.js";import{bu as b}from"./vendor-ux-Dl3wVbv_.js";var i={},m;function h(){if(m)return i;m=1,Object.defineProperty(i,"__esModule",{value:!0});var f=y(),c=b(),S=function(o,s,r){if(!c.isBrowser)return[s,c.noop,c.noop];if(!o)throw new Error("useLocalStorage key may not be falsy");var n=r?r.raw?function(t){return t}:r.deserializer:JSON.parse,l=f.useRef(function(t){try{var a=r?r.raw?String:r.serializer:JSON.stringify,e=localStorage.getItem(t);return e!==null?n(e):(s&&localStorage.setItem(t,a(s)),s)}catch{return s}}),g=f.useState(function(){return l.current(o)}),d=g[0],u=g[1];f.useLayoutEffect(function(){return u(l.current(o))},[o]);var v=f.useCallback(function(t){try{var a=typeof t=="function"?t(d):t;if(typeof a>"u")return;var e=void 0;r?r.raw?typeof a=="string"?e=a:e=JSON.stringify(a):r.serializer?e=r.serializer(a):e=JSON.stringify(a):e=JSON.stringify(a),localStorage.setItem(o,e),u(n(e))}catch{}},[o,u]),L=f.useCallback(function(){try{localStorage.removeItem(o),u(void 0)}catch{}},[o,u]);return[d,v,L]};return i.default=S,i}var J=h();const E=z(J);export{E as u};
