"use strict";const e=require("react");var l;const E=typeof document<"u"?(l=e.useInsertionEffect)!==null&&l!==void 0?l:e.useLayoutEffect:()=>{};function R(r,d,n){let[f,i]=e.useState(r||d),o=e.useRef(f),s=e.useRef(r!==void 0),c=r!==void 0;e.useEffect(()=>{let t=s.current;t!==c&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${t?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}.`),s.current=c},[c]);let a=c?r:f;E(()=>{o.current=a});let[,$]=e.useReducer(()=>({}),{}),b=e.useCallback((t,...p)=>{let u=typeof t=="function"?t(o.current):t;Object.is(o.current,u)||(o.current=u,i(u),$(),n?.(u,...p))},[n]);return[a,b]}exports.$458b0a5536c1a7cf$export$40bfa8c7b0832715=R;
//# sourceMappingURL=useControlledState-DLAEsTLd.cjs.js.map
