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