import{ba as G,bb as R,d as j,bc as E,v as w,bd as _,F as I,J as C,be as M,a as P,bf as T,bg as A,bh as S}from"./index-DGnN4tUo.js";import{g as F}from"./get-slot-Bk_rJcZu.js";function L(){return G}const O={name:"Space",self:L};let h;function W(){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 D=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=j({name:"Space",props:D,setup(e){const{mergedClsPrefixRef:n,mergedRtlRef:u}=I(e),d=C("Space","-space",void 0,O,e,n),t=M("Space",u,n);return{useGap:W(),rtlEnabled:t,mergedClsPrefix:n,margin:P(()=>{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:{[T("gap",r)]:f}}=d.value,{row:a,col:g}=A(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:b,rtlEnabled:v,useGap:o,wrapItem:B,internalUseGap:$}=this,p=E(F(this),!1);if(!p.length)return null;const x=`${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:[`${b}-space`,v&&`${b}-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===_?y:w("div",{role:"none",class:r,style:[f,{maxWidth:"100%"},o?"":e?{marginBottom:s!==l?z:""}:v?{marginLeft:m?t==="space-between"&&s===l?"":c:s!==l?x:"",marginRight:m?t==="space-between"&&s===0?"":c:"",paddingTop:i,paddingBottom:i}:{marginRight:m?t==="space-between"&&s===l?"":c:s!==l?x:"",marginLeft:m?t==="space-between"&&s===0?"":c:"",paddingTop:i,paddingBottom:i}]},y)))}});export{U as _,O as s};
