import{r as a,j as p}from"./index-CHN8jahE.js";import{a as V,c as k}from"./utils-CkSf8FUe.js";const y=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,b=V,E=(t,n)=>e=>{var i;if(n?.variants==null)return b(t,e?.class,e?.className);const{variants:r,defaultVariants:s}=n,u=Object.keys(r).map(o=>{const c=e?.[o],d=s?.[o];if(c===null)return null;const v=y(c)||y(d);return r[o][v]}),l=e&&Object.entries(e).reduce((o,c)=>{let[d,v]=c;return v===void 0||(o[d]=v),o},{}),f=n==null||(i=n.compoundVariants)===null||i===void 0?void 0:i.reduce((o,c)=>{let{class:d,className:v,...x}=c;return Object.entries(x).every(C=>{let[m,g]=C;return Array.isArray(g)?g.includes({...s,...l}[m]):{...s,...l}[m]===g})?[...o,d,v]:o},[]);return b(t,u,f,e?.class,e?.className)};function h(t,n){if(typeof t=="function")return t(n);t!=null&&(t.current=n)}function S(...t){return n=>{let e=!1;const i=t.map(r=>{const s=h(r,n);return!e&&typeof s=="function"&&(e=!0),s});if(e)return()=>{for(let r=0;r<i.length;r++){const s=i[r];typeof s=="function"?s():h(t[r],null)}}}}function j(t){const n=_(t),e=a.forwardRef((i,r)=>{const{children:s,...u}=i,l=a.Children.toArray(s),f=l.find(R);if(f){const o=f.props.children,c=l.map(d=>d===f?a.Children.count(o)>1?a.Children.only(null):a.isValidElement(o)?o.props.children:null:d);return p.jsx(n,{...u,ref:r,children:a.isValidElement(o)?a.cloneElement(o,void 0,c):null})}return p.jsx(n,{...u,ref:r,children:s})});return e.displayName=`${t}.Slot`,e}var z=j("Slot");function _(t){const n=a.forwardRef((e,i)=>{const{children:r,...s}=e;if(a.isValidElement(r)){const u=w(r),l=O(s,r.props);return r.type!==a.Fragment&&(l.ref=i?S(i,u):u),a.cloneElement(r,l)}return a.Children.count(r)>1?a.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}var N=Symbol("radix.slottable");function R(t){return a.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===N}function O(t,n){const e={...n};for(const i in n){const r=t[i],s=n[i];/^on[A-Z]/.test(i)?r&&s?e[i]=(...l)=>{const f=s(...l);return r(...l),f}:r&&(e[i]=r):i==="style"?e[i]={...r,...s}:i==="className"&&(e[i]=[r,s].filter(Boolean).join(" "))}return{...t,...e}}function w(t){let n=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,e=n&&"isReactWarning"in n&&n.isReactWarning;return e?t.ref:(n=Object.getOwnPropertyDescriptor(t,"ref")?.get,e=n&&"isReactWarning"in n&&n.isReactWarning,e?t.props.ref:t.props.ref||t.ref)}const P=E("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function I({className:t,variant:n="default",size:e="default",asChild:i=!1,...r}){const s=i?z:"button";return p.jsx(s,{"data-slot":"button","data-variant":n,"data-size":e,className:k(P({variant:n,size:e,className:t})),...r})}export{I as B};
