import{defineComponent as O,createVNode as u,cloneVNode as L}from"vue";import{LoadingOutlined as j}from"@antsoo-lib/icons";import $ from"../_util/classNames.mjs";import{filterEmpty as A}from"../_util/props-util/index.mjs";import E from"../_util/props-util/initDefaultProps.mjs";import{tuple as V,booleanType as w}from"../_util/type.mjs";import p from"../_util/vue-types/index.mjs";import x from"../config-provider/hooks/useConfigInject.mjs";import M from"./TimelineItem.mjs";import R from"./style/index.mjs";const k=()=>({prefixCls:String,pending:p.any,pendingDot:p.any,reverse:w(),mode:p.oneOf(V("left","alternate","right",""))}),W=O({compatConfig:{MODE:3},name:"ATimeline",inheritAttrs:!1,props:E(k(),{reverse:!1,mode:""}),slots:Object,setup(i,{slots:r,attrs:f}){const{prefixCls:e,direction:C}=x("timeline",i),[y,b]=R(e),I=(t,l)=>{const n=t.props||{};return i.mode==="alternate"?n.position==="right"?`${e.value}-item-right`:n.position==="left"?`${e.value}-item-left`:l%2===0?`${e.value}-item-left`:`${e.value}-item-right`:i.mode==="left"?`${e.value}-item-left`:i.mode==="right"?`${e.value}-item-right`:n.position==="right"?`${e.value}-item-right`:""};return()=>{const{pending:t=r.pending?.(),pendingDot:l=r.pendingDot?.(),reverse:n,mode:c}=i,D=typeof t=="boolean"?null:t,s=A(r.default?.()),d=t?u(M,{pending:!!t,dot:l||u(j,null,null)},{default:()=>[D]}):null;d&&s.push(d);const a=n?s.reverse():s,g=a.length,v=`${e.value}-item-last`,P=a.map((o,m)=>{const T=m===g-2?v:"",N=m===g-1?v:"";return L(o,{class:$([!n&&t?T:N,I(o,m)])})}),h=a.some(o=>!!(o.props?.label||o.children?.label)),S=$(e.value,{[`${e.value}-pending`]:!!t,[`${e.value}-reverse`]:!!n,[`${e.value}-${c}`]:!!c&&!h,[`${e.value}-label`]:h,[`${e.value}-rtl`]:C.value==="rtl"},f.class,b.value);return y(u("ul",{...f,class:S},[P]))}}});export{W as default,k as timelineProps};
