import{filterEmptyWithUndefined as e,flattenChildren as t,isEmptyElement as n}from"../_util/props-util/index.mjs";import r from"../config-provider/hooks/useConfigInject.mjs";import i from"../_util/vue-types/index.mjs";import a from"../vc-util/devWarning.mjs";import{customRenderSlot as o}from"../_util/vnode.mjs";import s from"../skeleton/index.mjs";import c from"../tabs/index.mjs";import l from"./style/index.mjs";import{createVNode as u,defineComponent as d,isVNode as f}from"vue";import p from"lodash-es/isPlainObject";var{TabPane:m}=c,h=()=>({prefixCls:String,title:i.any,extra:i.any,bordered:{type:Boolean,default:!0},bodyStyle:{type:Object,default:void 0},headStyle:{type:Object,default:void 0},loading:{type:Boolean,default:!1},hoverable:{type:Boolean,default:!1},type:{type:String},size:{type:String},actions:i.any,tabList:{type:Array},tabBarExtraContent:i.any,activeTabKey:String,defaultActiveTabKey:String,cover:i.any,onTabChange:{type:Function}}),g=d({compatConfig:{MODE:3},name:`ACard`,inheritAttrs:!1,props:h(),slots:Object,setup(i,{slots:d,attrs:h}){let{prefixCls:g,direction:_,size:v}=r(`card`,i),[y,b]=l(g),x=e=>e.map((t,r)=>f(t)&&!n(t)||!f(t)?u(`li`,{style:{width:`${100/e.length}%`},key:`action-${r}`},[u(`span`,null,[t])]):null),S=e=>{i.onTabChange?.(e)},C=(e=[])=>{let t;return e.forEach(e=>{e&&p(e.type)&&e.type.__ANT_CARD_GRID&&(t=!0)}),t};return()=>{let{headStyle:n={},bodyStyle:r={},loading:l,bordered:f=!0,type:p,tabList:w,hoverable:T,activeTabKey:E,defaultActiveTabKey:D,tabBarExtraContent:O=e(d.tabBarExtraContent?.()),title:k=e(d.title?.()),extra:A=e(d.extra?.()),actions:j=e(d.actions?.()),cover:M=e(d.cover?.())}=i,N=t(d.default?.()),P=g.value,F={[`${P}`]:!0,[b.value]:!0,[`${P}-loading`]:l,[`${P}-bordered`]:f,[`${P}-hoverable`]:!!T,[`${P}-contain-grid`]:C(N),[`${P}-contain-tabs`]:w&&w.length,[`${P}-${v.value}`]:v.value,[`${P}-type-${p}`]:!!p,[`${P}-rtl`]:_.value===`rtl`},I=u(s,{loading:!0,active:!0,paragraph:{rows:4},title:!1},{default:()=>[N]}),L=E!==void 0,R={size:`large`,[L?`activeKey`:`defaultActiveKey`]:L?E:D,onChange:S,class:`${P}-head-tabs`},z,B=w&&w.length?u(c,R,{default:()=>[w.map(e=>{let{tab:t,slots:n}=e,r=n?.tab;a(!n,`Card`,"tabList slots is deprecated, Please use `customTab` instead.");let i=t===void 0?d[r]?d[r](e):null:t;return i=o(d,`customTab`,e,()=>[i]),u(m,{tab:i,key:e.key,disabled:e.disabled},null)})],rightExtra:O?()=>O:null}):null;(k||A||B)&&(z=u(`div`,{class:`${P}-head`,style:n},[u(`div`,{class:`${P}-head-wrapper`},[k&&u(`div`,{class:`${P}-head-title`},[k]),A&&u(`div`,{class:`${P}-extra`},[A])]),B]));let V=M?u(`div`,{class:`${P}-cover`},[M]):null,H=u(`div`,{class:`${P}-body`,style:r},[l?I:N]),U=j&&j.length?u(`ul`,{class:`${P}-actions`},[x(j)]):null;return y(u(`div`,{ref:`cardContainerRef`,...h,class:[F,h.class]},[z,V,N&&N.length?H:null,U]))}}});export{h as cardProps,g as default};