/* esm.sh - @radix-ui/react-slot@1.0.1 */
function c(){return c=Object.assign?Object.assign.bind():function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var r in e)({}).hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n},c.apply(null,arguments)}import{forwardRef as m,Children as a,isValidElement as f,createElement as $,cloneElement as d,Fragment as h}from"../../../../react@19.3.1/es2022/react.mjs";import{composeRefs as j}from"../../../react-compose-refs@1.0.0/X-ZHJlYWN0QDE5LjMuMQ/es2022/react-compose-refs.mjs";var b=m((n,t)=>{let{children:e,...r}=n,o=a.toArray(e),l=o.find(g);if(l){let s=l.props.children,i=o.map(p=>p===l?a.count(s)>1?a.only(null):f(s)?s.props.children:null:p);return $(u,c({},r,{ref:t}),f(s)?d(s,void 0,i):null)}return $(u,c({},r,{ref:t}),e)});b.displayName="Slot";var u=m((n,t)=>{let{children:e,...r}=n;return f(e)?d(e,{...I(r,e.props),ref:j(t,e.ref)}):a.count(e)>1?a.only(null):null});u.displayName="SlotClone";var y=({children:n})=>$(h,null,n);function g(n){return f(n)&&n.type===y}function I(n,t){let e={...t};for(let r in t){let o=n[r],l=t[r];/^on[A-Z]/.test(r)?o&&l?e[r]=(...i)=>{l(...i),o(...i)}:o&&(e[r]=o):r==="style"?e[r]={...o,...l}:r==="className"&&(e[r]=[o,l].filter(Boolean).join(" "))}return{...n,...e}}var S=b;export{S as Root,b as Slot,y as Slottable};
//# sourceMappingURL=react-slot.mjs.map