import{d as e,a2 as l,X as a,c as t,a9 as s,j as r,a as n,U as i,af as u,b2 as o,p as c,l as p,b1 as f,cj as d,bu as y,aa as v,ak as h,ap as m}from"./index-ip5gDR6L.js";import{P as S,i as g,a as x}from"./vnode-6FKeug3R.js";const b=e({name:"ElSpaceItem",props:l({prefixCls:{type:String}}),setup(e,{slots:l}){const n=a("space"),i=t(()=>`${e.prefixCls||n.b()}__item`);return()=>s("div",{class:i.value},r(l,"default"))}}),E={small:8,default:12,large:16};const C=m(e({name:"ElSpace",props:l({direction:{type:String,values:["horizontal","vertical"],default:"horizontal"},class:{type:h([String,Object,Array]),default:""},style:{type:h([String,Array,Object]),default:""},alignment:{type:h(String),default:"center"},prefixCls:{type:String},spacer:{type:h([Object,String,Number,Array]),default:null,validator:e=>f(e)||o(e)||v(e)},wrap:Boolean,fill:Boolean,fillRatio:{type:Number,default:100},size:{type:[String,Array,Number],values:y,validator:e=>o(e)||u(e)&&2===e.length&&e.every(o)}}),setup(e,{slots:l}){const{classes:s,containerStyle:y,itemStyle:v}=function(e){const l=a("space"),s=t(()=>[l.b(),l.m(e.direction),e.class]),r=n(0),c=n(0),p=t(()=>[e.wrap||e.fill?{flexWrap:"wrap"}:{},{alignItems:e.alignment},{rowGap:`${c.value}px`,columnGap:`${r.value}px`},e.style]),f=t(()=>e.fill?{flexGrow:1,minWidth:`${e.fillRatio}%`}:{});return i(()=>{const{size:l="small",wrap:a,direction:t,fill:s}=e;if(u(l)){const[e=0,a=0]=l;r.value=e,c.value=a}else{let e;e=o(l)?l:E[l||"small"]||E.small,(a||s)&&"horizontal"===t?r.value=c.value=e:"horizontal"===t?(r.value=e,c.value=0):(c.value=e,r.value=0)}}),{classes:s,containerStyle:p,itemStyle:f}}(e);function h(l,a="",t=[]){const{prefixCls:s}=e;return l.forEach((e,l)=>{g(e)?u(e.children)&&e.children.forEach((e,l)=>{g(e)&&u(e.children)?h(e.children,`${a+l}-`,t):f(e)&&(null==e?void 0:e.type)===d?t.push(e):t.push(c(b,{style:v.value,prefixCls:s,key:`nested-${a+l}`},{default:()=>[e]},S.PROPS|S.STYLE,["style","prefixCls"]))}):x(e)&&t.push(c(b,{style:v.value,prefixCls:s,key:`LoopKey${a+l}`},{default:()=>[e]},S.PROPS|S.STYLE,["style","prefixCls"]))}),t}return()=>{var a;const{spacer:t,direction:n}=e,i=r(l,"default",{key:0},()=>[]);if(0===(null!=(a=i.children)?a:[]).length)return null;if(u(i.children)){let e=h(i.children);if(t){const l=e.length-1;e=e.reduce((e,a,s)=>{const r=[...e,a];return s!==l&&r.push(c("span",{style:[v.value,"vertical"===n?"width: 100%":null],key:s},[f(t)?t:p(t,S.TEXT)],S.STYLE)),r},[])}return c("div",{class:s.value,style:y.value},e,S.STYLE|S.CLASS)}return i.children}}}));export{C as E};
