import{u as V,r as l,e as v,j as p,c as $}from"./iframe-B8FSoBNY.js";import{c as g,m as k}from"./factory-DAJZwK4o.js";import{a as Y}from"./create-recipe-context-BU56IzEo.js";function _(i){const{key:u,recipe:y}=i,s=V();return l.useMemo(()=>{const x=y||(u!=null?s.getSlotRecipe(u):{});return s.sva(structuredClone(x))},[u,y,s])}const A=i=>i.charAt(0).toUpperCase()+i.slice(1),z=i=>{const{key:u,recipe:y}=i,s=A(u||y.className||"Component"),[x,R]=v({name:`${s}StylesContext`,errorMessage:`use${s}Styles returned is 'undefined'. Seems you forgot to wrap the components in "<${s}.Root />" `}),[P,w]=v({name:`${s}ClassNameContext`,errorMessage:`use${s}ClassNames returned is 'undefined'. Seems you forgot to wrap the components in "<${s}.Root />" `,strict:!1}),[E,S]=v({strict:!1,name:`${s}PropsContext`,providerName:`${s}PropsContext`,defaultValue:{}});function h(e){const{unstyled:o,...r}=e,t=_({key:u,recipe:r.recipe||y}),[a,n]=l.useMemo(()=>t.splitVariantProps(r),[r,t]);return{styles:l.useMemo(()=>o?Y:t(a),[o,a,t]),classNames:t.classNameMap,props:n}}function T(e,o={}){const{defaultProps:r}=o,t=a=>{const n=S(),c=l.useMemo(()=>k(r,n,a),[n,a]),{styles:m,classNames:N,props:d}=h(c);return p.jsx(x,{value:m,children:p.jsx(P,{value:N,children:p.jsx(e,{...d})})})};return t.displayName=e.displayName||e.name,t}return{StylesProvider:x,ClassNamesProvider:P,PropsProvider:E,usePropsContext:S,useRecipeResult:h,withProvider:(e,o,r)=>{const{defaultProps:t,...a}=r??{},n=g(e,{},a),c=l.forwardRef((m,N)=>{const d=S(),f=l.useMemo(()=>k(t??{},d,m),[d,m]),{styles:C,props:L,classNames:j}=h(f),O=j[o],M=p.jsx(x,{value:C,children:p.jsx(P,{value:j,children:p.jsx(n,{ref:N,...L,css:[C[o],f.css],className:$(f.className,O)})})});return r?.wrapElement?.(M,f)??M});return c.displayName=e.displayName||e.name,c},withContext:(e,o,r)=>{const t=g(e,{},r),a=l.forwardRef((n,c)=>{const{unstyled:m,...N}=n,d=R(),C=w()?.[o];return p.jsx(t,{...N,css:[!m&&o?d[o]:void 0,n.css],ref:c,className:$(n.className,C)})});return a.displayName=e.displayName||e.name,a},withRootProvider:T,useStyles:R,useClassNames:w}};export{z as c,_ as u};
