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