import{a as e,t}from"./react-DK-MTtD8.js";import{o as n}from"./utils-CXcsdpX-.js";var r=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,i=n,a=(e,t)=>n=>{if(t?.variants==null)return i(e,n?.class,n?.className);let{variants:a,defaultVariants:o}=t,s=Object.keys(a).map(e=>{let t=n?.[e],i=o?.[e];if(t===null)return null;let s=r(t)||r(i);return a[e][s]}),c=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return i(e,s,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...i}=t;return Object.entries(i).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...o,...c}[t]):{...o,...c}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},o=e(t(),1),s=Object.defineProperty,c=(e,t)=>s(e,`name`,{value:t,configurable:!0});function l(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}c(l,`setRef`);function u(...e){return t=>{let n=!1,r=e.map(e=>{let r=l(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():l(e[t],null)}}}}c(u,`composeRefs`);function d(...e){return o.useCallback(u(...e),e)}c(d,`useComposedRefs`);var f=Object.defineProperty,p=(e,t)=>f(e,`name`,{value:t,configurable:!0});function m(e){let t=o.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,s=!1,c=[];C(r)&&typeof D==`function`&&(r=D(r._payload)),o.Children.forEach(r,e=>{if(x(e)){s=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;C(n)&&typeof D==`function`&&(n=D(n._payload)),a=v(t,n),c.push(a?.props?.children)}else c.push(e)}),a?a=o.cloneElement(a,void 0,c):!s&&o.Children.count(r)===1&&o.isValidElement(r)&&(a=r);let l=a?b(a):void 0,u=d(n,l);if(!a){if(r||r===0)throw Error(s?E(e):T(e));return r}let f=y(i,a.props??{});return a.type!==o.Fragment&&(f.ref=n?u:l),o.cloneElement(a,f)});return t.displayName=`${e}.Slot`,t}p(m,`createSlot`);var h=m(`Slot`),g=Symbol.for(`radix.slottable`);function _(e){let t=p(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=g,t}p(_,`createSlottable`);var v=p((e,t)=>{if(`child`in e.props){let t=e.props.child;return o.isValidElement(t)?o.cloneElement(t,void 0,e.props.children(t.props.children)):null}return o.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function y(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}p(y,`mergeProps`);function b(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}p(b,`getElementRef`);function x(e){return o.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===g}p(x,`isSlottable`);var S=Symbol.for(`react.lazy`);function C(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===S&&`_payload`in e&&w(e._payload)}p(C,`isLazyComponent`);function w(e){return typeof e==`object`&&!!e&&`then`in e}p(w,`isPromiseLike`);var T=p(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),E=p(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),D=o.use;export{a,d as i,m as n,_ as r,h as t};