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