const e=require("../_util/type.js"),t=require("../_util/classNames.js"),n=require("../_util/props-util/index.js"),r=require("../config-provider/hooks/useConfigInject.js"),i=require("../_util/vue-types/index.js"),a=require("../_util/createContext.js"),o=require("./style/index.js");let s=require("vue"),c=require("lodash-es");var l=()=>({compactSize:String,compactDirection:i.default.oneOf(e.tuple(`horizontal`,`vertical`)).def(`horizontal`),isFirstItem:e.booleanType(),isLastItem:e.booleanType()}),u=a.default(null),d=(e,n)=>{let r=u.useInject(),i=(0,s.computed)(()=>{if(!r||(0,c.isEmpty)(r))return``;let{compactDirection:i,isFirstItem:a,isLastItem:o}=r,s=i===`vertical`?`-vertical-`:`-`;return t.default({[`${e.value}-compact${s}item`]:!0,[`${e.value}-compact${s}first-item`]:a,[`${e.value}-compact${s}last-item`]:o,[`${e.value}-compact${s}item-rtl`]:n.value===`rtl`})});return{compactSize:(0,s.computed)(()=>r?.compactSize),compactDirection:(0,s.computed)(()=>r?.compactDirection),compactItemClassnames:i}},f=(0,s.defineComponent)({name:`NoCompactStyle`,setup(e,{slots:t}){return u.useProvide(null),()=>t.default?.()}}),p=()=>({prefixCls:String,size:{type:String},direction:i.default.oneOf(e.tuple(`horizontal`,`vertical`)).def(`horizontal`),align:i.default.oneOf(e.tuple(`start`,`end`,`center`,`baseline`)),block:{type:Boolean,default:void 0}}),m=(0,s.defineComponent)({name:`CompactItem`,props:l(),setup(e,{slots:t}){return u.useProvide(e),()=>t.default?.()}}),h=(0,s.defineComponent)({name:`ASpaceCompact`,inheritAttrs:!1,props:p(),setup(e,{attrs:i,slots:a}){let{prefixCls:l,direction:d}=r.default(`space-compact`,e),f=u.useInject(),[p,h]=o.default(l),g=(0,s.computed)(()=>t.default(l.value,h.value,{[`${l.value}-rtl`]:d.value===`rtl`,[`${l.value}-block`]:e.block,[`${l.value}-vertical`]:e.direction===`vertical`}));return()=>{let t=n.flattenChildren(a.default?.()||[]);return t.length===0?null:p((0,s.createVNode)(`div`,{...i,class:[g.value,i.class]},[t.map((n,r)=>{let i=n&&n.key||`${l.value}-item-${r}`,a=!f||(0,c.isEmpty)(f);return(0,s.createVNode)(m,{key:i,compactSize:e.size??`middle`,compactDirection:e.direction,isFirstItem:r===0&&(a||f?.isFirstItem),isLastItem:r===t.length-1&&(a||f?.isLastItem)},{default:()=>[n]})})]))}}});exports.NoCompactStyle=f,exports.SpaceCompactItemContext=u,exports.default=h,exports.spaceCompactItemProps=l,exports.spaceCompactProps=p,exports.useCompactItemContext=d;