import{r as o,ae as b,ai as l,gk as u,j as c,bZ as m,a9 as E}from"./index-cc84e56a.js";function g(r){return typeof r=="function"?r():r}const v=o.forwardRef(function(f,s){const{children:t,container:i,disablePortal:n=!1}=f,[e,a]=o.useState(null),d=b(o.isValidElement(t)?t.ref:null,s);if(l(()=>{n||a(g(i)||document.body)},[i,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&&m.createPortal(t,e)})}),j=({theme:r,ownerState:f},s)=>{let t={};function i(n){if(typeof n=="function"){const e=n(r);i(e)}else Array.isArray(n)?n.forEach(e=>{typeof e!="boolean"&&i(e)}):typeof n=="object"&&(t=E({},t,n))}return f.sx&&(i(f.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{v as P,j as r};
