import{d as N,a as I,I as C,h as $,j as S,b as A,a1 as j,a6 as m,ak as v,y as x,s as d,an as g,x as P,bF as k,aj as V,J as B,R as h,l as G}from"./index-BKKvzUDD.js";import{i as z,a as O}from"./vnode-78qeDweP.js";const R=A({prefixCls:{type:String}}),w=N({name:"ElSpaceItem",props:R,setup(e,{slots:u}){const f=I("space"),i=S(()=>`${e.prefixCls||f.b()}__item`);return()=>C("div",{class:i.value},$(u,"default"))}}),E={small:8,default:12,large:16};function _(e){const u=I("space"),f=S(()=>[u.b(),u.m(e.direction),e.class]),i=x(0),n=x(0),y=S(()=>[e.wrap||e.fill?{flexWrap:"wrap"}:{},{alignItems:e.alignment},{rowGap:`${n.value}px`,columnGap:`${i.value}px`},e.style]),o=S(()=>e.fill?{flexGrow:1,minWidth:`${e.fillRatio}%`}:{});return j(()=>{const{size:t="small",wrap:a,direction:r,fill:c}=e;if(m(t)){const[s=0,l=0]=t;i.value=s,n.value=l}else{let s;v(t)?s=t:s=E[t||"small"]||E.small,(a||c)&&r==="horizontal"?i.value=n.value=s:r==="horizontal"?(i.value=s,n.value=0):(n.value=s,i.value=0)}}),{classes:f,containerStyle:y,itemStyle:o}}const F=A({direction:{type:String,values:["horizontal","vertical"],default:"horizontal"},class:{type:h([String,Object,Array]),default:""},style:{type:h([String,Array,Object,Boolean]),default:""},alignment:{type:h(String),default:"center"},prefixCls:{type:String},spacer:{type:h([Object,String,Number,Array]),default:null,validator:e=>g(e)||v(e)||B(e)},wrap:Boolean,fill:Boolean,fillRatio:{type:Number,default:100},size:{type:[String,Array,Number],values:V,validator:e=>v(e)||m(e)&&e.length===2&&e.every(v)}}),T=N({name:"ElSpace",props:F,setup(e,{slots:u}){const{classes:f,containerStyle:i,itemStyle:n}=_(e);function y(o,t="",a=[]){const{prefixCls:r}=e;return o.forEach((c,s)=>{z(c)?m(c.children)&&c.children.forEach((l,p)=>{z(l)&&m(l.children)?y(l.children,`${t+p}-`,a):g(l)&&(l==null?void 0:l.type)===k?a.push(l):a.push(d(w,{style:n.value,prefixCls:r,key:`nested-${t+p}`},{default:()=>[l]},12,["style","prefixCls"]))}):O(c)&&a.push(d(w,{style:n.value,prefixCls:r,key:`LoopKey${t+s}`},{default:()=>[c]},12,["style","prefixCls"]))}),a}return()=>{const{spacer:o,direction:t}=e,a=$(u,"default",{key:0},()=>[]);if((a.children??[]).length===0)return null;if(m(a.children)){let r=y(a.children);if(o){const c=r.length-1;r=r.reduce((s,l,p)=>{const b=[...s,l];return p!==c&&b.push(d("span",{style:[n.value,t==="vertical"?"width: 100%":null],key:p},[g(o)?o:P(o,1)],4)),b},[])}return d("div",{class:f.value,style:i.value},r,6)}return a.children}}}),L=G(T);export{L as E};
