import*as r from"react";import{useCallbackRef as t}from"./use-callback-ref.js";import{runIfFn as a}from"../../../utils/dist/esm/function.js";function e(r,t){var a=void 0!==r;return[a,a&&void 0!==r?r:t]}function o(e){var{value:o,defaultValue:u,onChange:i,shouldUpdate:n=((r,t)=>r!==t)}=e,s=t(i),l=t(n),[f,c]=r.useState(u),d=void 0!==o,m=d?o:f,v=r.useCallback((r=>{var t=a(r,m);l(m,t)&&(d||c(t),s(t))}),[d,s,m,l]);return[m,v]}export{e as useControllableProp,o as useControllableState};
//# sourceMappingURL=use-controllable.js.map
