import{g as P,b as h,o as I,P as v,j as k,n as D,d as S,t as y}from"./index.TkDYtvUB.js";import{i as c,d as g,l as b}from"./index.CPcBO1Os.js";import{c as A}from"./compact-item.BK6dH04p.js";import{c as N,d as O,e as T,f as _,g as L,h as w,j as F,k as B}from"./_getTag.5j88QV3u.js";const E=t=>{const{componentCls:o}=t;return{[o]:{display:"inline-flex","&-block":{display:"flex",width:"100%"},"&-vertical":{flexDirection:"column"}}}},H=t=>{const{componentCls:o}=t;return{[o]:{display:"inline-flex","&-rtl":{direction:"rtl"},"&-vertical":{flexDirection:"column"},"&-align":{flexDirection:"column","&-center":{alignItems:"center"},"&-start":{alignItems:"flex-start"},"&-end":{alignItems:"flex-end"},"&-baseline":{alignItems:"baseline"}},["".concat(o,"-item")]:{"&:empty":{display:"none"}}}}},K=P("Space",t=>[H(t),E(t)]);var M="[object Map]",R="[object Set]",V=Object.prototype,q=V.hasOwnProperty;function x(t){if(t==null)return!0;if(N(t)&&(O(t)||typeof t=="string"||typeof t.splice=="function"||T(t)||_(t)||L(t)))return!t.length;var o=w(t);if(o==M||o==R)return!t.size;if(F(t))return!B(t).length;for(var e in t)if(q.call(t,e))return!1;return!0}const G=()=>({compactSize:String,compactDirection:v.oneOf(y("horizontal","vertical")).def("horizontal"),isFirstItem:I(),isLastItem:I()}),i=A(null),Z=(t,o)=>{const e=i.useInject(),a=c(()=>{if(!e||x(e))return"";const{compactDirection:r,isFirstItem:l,isLastItem:n}=e,s=r==="vertical"?"-vertical-":"-";return h({["".concat(t.value,"-compact").concat(s,"item")]:!0,["".concat(t.value,"-compact").concat(s,"first-item")]:l,["".concat(t.value,"-compact").concat(s,"last-item")]:n,["".concat(t.value,"-compact").concat(s,"item-rtl")]:o.value==="rtl"})});return{compactSize:c(()=>e==null?void 0:e.compactSize),compactDirection:c(()=>e==null?void 0:e.compactDirection),compactItemClassnames:a}},tt=g({name:"NoCompactStyle",setup(t,o){let{slots:e}=o;return i.useProvide(null),()=>{var a;return(a=e.default)===null||a===void 0?void 0:a.call(e)}}}),J=()=>({prefixCls:String,size:{type:String},direction:v.oneOf(y("horizontal","vertical")).def("horizontal"),align:v.oneOf(y("start","end","center","baseline")),block:{type:Boolean,default:void 0}}),Q=g({name:"CompactItem",props:G(),setup(t,o){let{slots:e}=o;return i.useProvide(t),()=>{var a;return(a=e.default)===null||a===void 0?void 0:a.call(e)}}}),et=g({name:"ASpaceCompact",inheritAttrs:!1,props:J(),setup(t,o){let{attrs:e,slots:a}=o;const{prefixCls:r,direction:l}=k("space-compact",t),n=i.useInject(),[s,$]=K(r),z=c(()=>h(r.value,$.value,{["".concat(r.value,"-rtl")]:l.value==="rtl",["".concat(r.value,"-block")]:t.block,["".concat(r.value,"-vertical")]:t.direction==="vertical"}));return()=>{var m;const p=D(((m=a.default)===null||m===void 0?void 0:m.call(a))||[]);return p.length===0?null:s(b("div",S(S({},e),{},{class:[z.value,e.class]}),[p.map((u,d)=>{var f;const j=u&&u.key||"".concat(r.value,"-item-").concat(d),C=!n||x(n);return b(Q,{key:j,compactSize:(f=t.size)!==null&&f!==void 0?f:"middle",compactDirection:t.direction,isFirstItem:d===0&&(C||(n==null?void 0:n.isFirstItem)),isLastItem:d===p.length-1&&(C||(n==null?void 0:n.isLastItem))},{default:()=>[u]})})]))}}});export{et as C,tt as N,K as a,Z as u};
