import{_ as d}from"./extends-dGVwEr9R.js";import{r as n}from"./index-4g5l5LRQ.js";function $(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function u(...e){return t=>e.forEach(r=>$(r,t))}function C(...e){return n.useCallback(u(...e),e)}const p=n.forwardRef((e,t)=>{const{children:r,...l}=e,c=n.Children.toArray(r),o=c.find(h);if(o){const i=o.props.children,s=c.map(f=>f===o?n.Children.count(i)>1?n.Children.only(null):n.isValidElement(i)?i.props.children:null:f);return n.createElement(a,d({},l,{ref:t}),n.isValidElement(i)?n.cloneElement(i,void 0,s):null)}return n.createElement(a,d({},l,{ref:t}),r)});p.displayName="Slot";const a=n.forwardRef((e,t)=>{const{children:r,...l}=e;return n.isValidElement(r)?n.cloneElement(r,{...E(l,r.props),ref:t?u(t,r.ref):r.ref}):n.Children.count(r)>1?n.Children.only(null):null});a.displayName="SlotClone";const m=({children:e})=>n.createElement(n.Fragment,null,e);function h(e){return n.isValidElement(e)&&e.type===m}function E(e,t){const r={...t};for(const l in t){const c=e[l],o=t[l];/^on[A-Z]/.test(l)?c&&o?r[l]=(...s)=>{o(...s),c(...s)}:c&&(r[l]=c):l==="style"?r[l]={...c,...o}:l==="className"&&(r[l]=[c,o].filter(Boolean).join(" "))}return{...e,...r}}export{C as $,p as a,u as b,m as c};
