import{s as m}from"./chunk-DZLz74EQ.js";import{t as x}from"./react-BcIddLXZ.js";import{n as b,t as j}from"./jsx-runtime-DvsdsEjx.js";var o=m(x(),1);function h(r,e){if(typeof r=="function")return r(e);r!=null&&(r.current=e)}function y(...r){return e=>{let t=!1,l=r.map(n=>{let i=h(n,e);return!t&&typeof i=="function"&&(t=!0),i});if(t)return()=>{for(let n=0;n<l.length;n++){let i=l[n];typeof i=="function"?i():h(r[n],null)}}}}function C(...r){return o.useCallback(y(...r),r)}var d=m(j(),1);function g(r){let e=_(r),t=o.forwardRef((l,n)=>{let{children:i,...a}=l,u=o.Children.toArray(i),c=u.find(w);if(c){let f=c.props.children,s=u.map(p=>p===c?o.Children.count(f)>1?o.Children.only(null):o.isValidElement(f)?f.props.children:null:p);return(0,d.jsx)(e,{...a,ref:n,children:o.isValidElement(f)?o.cloneElement(f,void 0,s):null})}return(0,d.jsx)(e,{...a,ref:n,children:i})});return t.displayName=`${r}.Slot`,t}var R=g("Slot");function _(r){let e=o.forwardRef((t,l)=>{let{children:n,...i}=t;if(o.isValidElement(n)){let a=O(n),u=N(i,n.props);return n.type!==o.Fragment&&(u.ref=l?y(l,a):a),o.cloneElement(n,u)}return o.Children.count(n)>1?o.Children.only(null):null});return e.displayName=`${r}.SlotClone`,e}var v=Symbol("radix.slottable");function S(r){let e=({children:t})=>(0,d.jsx)(d.Fragment,{children:t});return e.displayName=`${r}.Slottable`,e.__radixId=v,e}function w(r){return o.isValidElement(r)&&typeof r.type=="function"&&"__radixId"in r.type&&r.type.__radixId===v}function N(r,e){let t={...e};for(let l in e){let n=r[l],i=e[l];/^on[A-Z]/.test(l)?n&&i?t[l]=(...a)=>{let u=i(...a);return n(...a),u}:n&&(t[l]=n):l==="style"?t[l]={...n,...i}:l==="className"&&(t[l]=[n,i].filter(Boolean).join(" "))}return{...r,...t}}function O(r){var l,n;let e=(l=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:l.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?r.ref:(e=(n=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:n.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?r.props.ref:r.props.ref||r.ref)}var V=m(b(),1);function W(r){return typeof r=="object"&&!!r&&"current"in r}function I(r,e,t,l){let n=(0,V.c)(8),i=(0,o.useRef)(t),a,u;n[0]===t?(a=n[1],u=n[2]):(a=()=>{i.current=t},u=[t],n[0]=t,n[1]=a,n[2]=u),(0,o.useEffect)(a,u);let c,f;n[3]!==l||n[4]!==r||n[5]!==e?(c=()=>{let s=W(r)?r.current:r;if(!s)return;let p=E=>i.current(E);return s.addEventListener(e,p,l),()=>{s.removeEventListener(e,p,l)}},f=[e,r,l],n[3]=l,n[4]=r,n[5]=e,n[6]=c,n[7]=f):(c=n[6],f=n[7]),(0,o.useEffect)(c,f)}export{y as a,S as i,R as n,C as o,g as r,I as t};
