import{defineComponent as w,shallowRef as A,computed as N,createVNode as e}from"vue";import O from"@ant-design/icons-vue/ArrowLeftOutlined";import S from"@ant-design/icons-vue/ArrowRightOutlined";import j from"../_util/classNames.mjs";import D from"../_util/hooks/useDestroyed.mjs";import{flattenChildren as z,filterEmpty as E,isEmptyContent as F}from"../_util/props-util/index.mjs";import L from"../_util/transButton.mjs";import{withInstall as M,objectType as V,vNodeType as s}from"../_util/type.mjs";import q from"../_util/vue-types/index.mjs";import"../avatar/index.mjs";import"../breadcrumb/index.mjs";import G from"../config-provider/hooks/useConfigInject.mjs";import J from"../locale/LocaleReceiver.mjs";import K from"../space/index.mjs";import Q from"../vc-resize-observer/index.mjs";import U from"./style/index.mjs";import W from"../breadcrumb/Breadcrumb.mjs";import X from"../avatar/Avatar.mjs";const Y=()=>({backIcon:s(),prefixCls:String,title:s(),subTitle:s(),breadcrumb:q.object,tags:s(),footer:s(),extra:s(),avatar:V(),ghost:{type:Boolean,default:void 0},onBack:Function}),Z=w({compatConfig:{MODE:3},name:"APageHeader",inheritAttrs:!1,props:Y(),slots:Object,setup(r,{emit:g,slots:a,attrs:d}){const{prefixCls:n,direction:m,pageHeader:h}=G("page-header",r),[p,$]=U(n),f=A(!1),k=D(),y=({width:t})=>{k.value||(f.value=t<768)},T=N(()=>r.ghost??h?.value?.ghost??!0),x=()=>r.backIcon??a.backIcon?.()??(m.value==="rtl"?e(S,null,null):e(O,null,null)),C=t=>!t||!r.onBack?null:e(J,{componentName:"PageHeader",children:({back:l})=>e("div",{class:`${n.value}-back`},[e(L,{onClick:o=>{g("back",o)},class:`${n.value}-back-button`,"aria-label":l},{default:()=>[t]})])},null),B=()=>r.breadcrumb?e(W,r.breadcrumb,null):a.breadcrumb?.(),I=()=>{const{avatar:t}=r,l=r.title??a.title?.(),o=r.subTitle??a.subTitle?.(),i=r.tags??a.tags?.(),u=r.extra??a.extra?.(),c=`${n.value}-heading`,b=l||o||i||u;if(!b)return null;const P=x(),v=C(P);return e("div",{class:c},[(v||t||b)&&e("div",{class:`${c}-left`},[v,t?e(X,t,null):a.avatar?.(),l&&e("span",{class:`${c}-title`,title:typeof l=="string"?l:void 0},[l]),o&&e("span",{class:`${c}-sub-title`,title:typeof o=="string"?o:void 0},[o]),i&&e("span",{class:`${c}-tags`},[i])]),u&&e("span",{class:`${c}-extra`},[e(K,null,{default:()=>[u]})])])},R=()=>{const t=r.footer??E(a.footer?.());return F(t)?null:e("div",{class:`${n.value}-footer`},[t])},H=t=>e("div",{class:`${n.value}-content`},[t]);return()=>{const t=r.breadcrumb?.routes||a.breadcrumb,l=r.footer||a.footer,o=z(a.default?.()),i=j(n.value,{"has-breadcrumb":t,"has-footer":l,[`${n.value}-ghost`]:T.value,[`${n.value}-rtl`]:m.value==="rtl",[`${n.value}-compact`]:f.value},d.class,$.value);return p(e(Q,{onResize:y},{default:()=>[e("div",{...d,class:i},[B(),I(),o.length?H(o):null,R()])]}))}}}),pe=M(Z);export{pe as default,Y as pageHeaderProps};
