import{d as V,q,P as j,H,J as i,k as B,m as J,y as L,B as m,A as M,g as p,F as W,z as F,aj as G}from"./app-D7zH3Nl5.js";import{r as K,s as Q,C as z}from"./useFlexGapSupport-CpBR-RD-.js";const U={small:8,middle:16,large:24},X=()=>({prefixCls:String,size:{type:[String,Number,Array]},direction:j.oneOf(G("horizontal","vertical")).def("horizontal"),align:j.oneOf(G("start","end","center","baseline")),wrap:q()});function Y(e){return typeof e=="string"?U[e]:e||0}const d=V({compatConfig:{MODE:3},name:"ASpace",inheritAttrs:!1,props:X(),slots:Object,setup(e,I){let{slots:o,attrs:f}=I;const{prefixCls:l,space:g,direction:x}=H("space",e),[P,k]=K(l),h=Q(),n=i(()=>{var a,t,s;return(s=(a=e.size)!==null&&a!==void 0?a:(t=g==null?void 0:g.value)===null||t===void 0?void 0:t.size)!==null&&s!==void 0?s:"small"}),y=B(),r=B();J(n,()=>{[y.value,r.value]=(Array.isArray(n.value)?n.value:[n.value,n.value]).map(a=>Y(a))},{immediate:!0});const C=i(()=>e.align===void 0&&e.direction==="horizontal"?"center":e.align),D=i(()=>L(l.value,k.value,`${l.value}-${e.direction}`,{[`${l.value}-rtl`]:x.value==="rtl",[`${l.value}-align-${C.value}`]:C.value})),E=i(()=>x.value==="rtl"?"marginLeft":"marginRight"),R=i(()=>{const a={};return h.value&&(a.columnGap=`${y.value}px`,a.rowGap=`${r.value}px`),m(m({},a),e.wrap&&{flexWrap:"wrap",marginBottom:`${-r.value}px`})});return()=>{var a,t;const{wrap:s,direction:T="horizontal"}=e,b=(a=o.default)===null||a===void 0?void 0:a.call(o),w=M(b),A=w.length;if(A===0)return null;const c=(t=o.split)===null||t===void 0?void 0:t.call(o),_=`${l.value}-item`,N=y.value,S=A-1;return p("div",F(F({},f),{},{class:[D.value,f.class],style:[R.value,f.style]}),[w.map((O,u)=>{let $=b.indexOf(O);$===-1&&($=`$$space-${u}`);let v={};return h.value||(T==="vertical"?u<S&&(v={marginBottom:`${N/(c?2:1)}px`}):v=m(m({},u<S&&{[E.value]:`${N/(c?2:1)}px`}),s&&{paddingBottom:`${r.value}px`})),P(p(W,{key:$},[p("div",{class:_,style:v},[O]),u<S&&c&&p("span",{class:`${_}-split`,style:v},[c])]))})])}}});d.Compact=z;d.install=function(e){return e.component(d.name,d),e.component(z.name,z),e};export{d as S};
