import{r as o,a2 as m,a6 as l,fv as u,j as c,aN as b,Y as E}from"./index-ca24af84.js";function g(r){return typeof r=="function"?r():r}const x=o.forwardRef(function(i,s){const{children:t,container:f,disablePortal:n=!1}=i,[e,a]=o.useState(null),d=m(o.isValidElement(t)?t.ref:null,s);if(l(()=>{n||a(g(f)||document.body)},[f,n]),l(()=>{if(e&&!n)return u(s,e),()=>{u(s,null)}},[s,e,n]),n){if(o.isValidElement(t)){const p={ref:d};return o.cloneElement(t,p)}return c(o.Fragment,{children:t})}return c(o.Fragment,{children:e&&b.createPortal(t,e)})}),j=({theme:r,ownerState:i},s)=>{let t={};function f(n){if(typeof n=="function"){const e=n(r);f(e)}else Array.isArray(n)?n.forEach(e=>{typeof e!="boolean"&&f(e)}):typeof n=="object"&&(t=E({},t,n))}return i.sx&&(f(i.sx),s.forEach(n=>{const e=t[n];if(typeof e=="string"||typeof e=="number")if(n==="borderRadius")if(typeof e=="number")t[n]=`${e}px`;else{var a;t[n]=((a=r.vars)==null?void 0:a.radius[e])||e}else["p","padding","m","margin"].indexOf(n)!==-1&&typeof e=="number"?t[n]=r.spacing(e):t[n]=e;else typeof e=="function"?t[n]=e(r):t[n]=void 0})),t};export{x as P,j as r};
