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