import{cA as G,aU as j,d as _,aH as E,r as S,cB as P,s as A,a as w,v as z,bj as I,L,cC as M,ae as C}from"./index-BJD7BFLS.js";import{g as T}from"./get-slot-Bk_rJcZu.js";function H(){return G}const O={self:H};let x;function U(){if(!j)return!0;if(x===void 0){const e=document.createElement("div");e.style.display="flex",e.style.flexDirection="column",e.style.rowGap="1px",e.appendChild(document.createElement("div")),e.appendChild(document.createElement("div")),document.body.appendChild(e);const r=e.scrollHeight===1;return document.body.removeChild(e),x=r}return x}const W=Object.assign(Object.assign({},z.props),{align:String,justify:{type:String,default:"start"},inline:Boolean,vertical:Boolean,reverse:Boolean,size:[String,Number,Array],wrapItem:{type:Boolean,default:!0},itemClass:String,itemStyle:[String,Object],wrap:{type:Boolean,default:!0},internalUseGap:{type:Boolean,default:void 0}}),V=_({name:"Space",props:W,setup(e){const{mergedClsPrefixRef:r,mergedRtlRef:g,mergedComponentPropsRef:s}=A(e),n=w(()=>{var t,a;return e.size||((a=(t=s?.value)===null||t===void 0?void 0:t.Space)===null||a===void 0?void 0:a.size)||"medium"}),v=z("Space","-space",void 0,O,e,r),y=I("Space",g,r);return{useGap:U(),rtlEnabled:y,mergedClsPrefix:r,margin:w(()=>{const t=n.value;if(Array.isArray(t))return{horizontal:t[0],vertical:t[1]};if(typeof t=="number")return{horizontal:t,vertical:t};const{self:{[L("gap",t)]:a}}=v.value,{row:c,col:u}=M(a);return{horizontal:C(u),vertical:C(c)}})}},render(){const{vertical:e,reverse:r,align:g,inline:s,justify:n,itemClass:v,itemStyle:y,margin:t,wrap:a,mergedClsPrefix:c,rtlEnabled:u,useGap:l,wrapItem:B,internalUseGap:$}=this,m=E(T(this),!1);if(!m.length)return null;const b=`${t.horizontal}px`,d=`${t.horizontal/2}px`,R=`${t.vertical}px`,o=`${t.vertical/2}px`,p=m.length-1,f=n.startsWith("space-");return S("div",{role:"none",class:[`${c}-space`,u&&`${c}-space--rtl`],style:{display:s?"inline-flex":"flex",flexDirection:e&&!r?"column":e&&r?"column-reverse":!e&&r?"row-reverse":"row",justifyContent:["start","end"].includes(n)?`flex-${n}`:n,flexWrap:!a||e?"nowrap":"wrap",marginTop:l||e?"":`-${o}`,marginBottom:l||e?"":`-${o}`,alignItems:g,gap:l?`${t.vertical}px ${t.horizontal}px`:""}},!B&&(l||$)?m:m.map((h,i)=>h.type===P?h:S("div",{role:"none",class:v,style:[y,{maxWidth:"100%"},l?"":e?{marginBottom:i!==p?R:""}:u?{marginLeft:f?n==="space-between"&&i===p?"":d:i!==p?b:"",marginRight:f?n==="space-between"&&i===0?"":d:"",paddingTop:o,paddingBottom:o}:{marginRight:f?n==="space-between"&&i===p?"":d:i!==p?b:"",marginLeft:f?n==="space-between"&&i===0?"":d:"",paddingTop:o,paddingBottom:o}]},h)))}});export{V as _};
