import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{$P as t}from"./lucide-C4oWPzu4.js";import{t as n}from"./dist-dVVC74St.js";var r=e(t(),1),i=r.useInsertionEffect||n;function a({prop:e,defaultProp:t,onChange:n=()=>{},caller:i}){let[a,c,l]=o({defaultProp:t,onChange:n}),u=e!==void 0,d=u?e:a;{let t=r.useRef(e!==void 0);r.useEffect(()=>{let e=t.current;if(e!==u){let t=e?`controlled`:`uncontrolled`,n=u?`controlled`:`uncontrolled`;console.warn(`${i} is changing from ${t} to ${n}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=u},[u,i])}return[d,r.useCallback(t=>{if(u){let n=s(t)?t(e):t;n!==e&&l.current?.(n)}else c(t)},[u,e,c,l])]}function o({defaultProp:e,onChange:t}){let[n,a]=r.useState(e),o=r.useRef(n),s=r.useRef(t);return i(()=>{s.current=t},[t]),r.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,a,s]}function s(e){return typeof e==`function`}export{a as t};