import{getTransitionProps as e}from"../_util/transition.mjs";import t from"./IDialogPropTypes.mjs";import{offset as n}from"./util.mjs";import{Transition as r,computed as i,createVNode as a,defineComponent as o,nextTick as s,ref as c,vShow as l,withDirectives as u}from"vue";var d={width:0,height:0,overflow:`hidden`,outline:`none`},f={outline:`none`},p=o({compatConfig:{MODE:3},name:`DialogContent`,inheritAttrs:!1,props:{...t(),motionName:String,ariaId:String,onVisibleChanged:Function,onMousedown:Function,onMouseup:Function},setup(t,{expose:o,slots:p,attrs:m}){let h=c(),g=c(),_=c();o({focus:()=>{h.value?.focus({preventScroll:!0})},changeActive:e=>{let{activeElement:t}=document;e&&t===g.value?h.value.focus({preventScroll:!0}):!e&&t===h.value&&g.value.focus({preventScroll:!0})}});let v=c(),y=i(()=>{let{width:e,height:n}=t,r={};return e!==void 0&&(r.width=typeof e==`number`?`${e}px`:e),n!==void 0&&(r.height=typeof n==`number`?`${n}px`:n),v.value&&(r.transformOrigin=v.value),r}),b=()=>{s(()=>{if(_.value){let e=n(_.value);v.value=t.mousePosition?`${t.mousePosition.x-e.left}px ${t.mousePosition.y-e.top}px`:``}})},x=e=>{t.onVisibleChanged(e)};return()=>{let{prefixCls:n,footer:i=p.footer?.(),title:o=p.title?.(),ariaId:s,closable:c,closeIcon:v=p.closeIcon?.(),onClose:S,bodyStyle:C,bodyProps:w,onMousedown:T,onMouseup:E,visible:D,modalRender:O=p.modalRender,destroyOnClose:k,motionName:A}=t,j;i&&(j=a(`div`,{class:`${n}-footer`},[i]));let M;o&&(M=a(`div`,{class:`${n}-header`},[a(`div`,{class:`${n}-title`,id:s},[o])]));let N;c&&(N=a(`button`,{type:`button`,onClick:S,"aria-label":`Close`,class:`${n}-close`},[v||a(`span`,{class:`${n}-close-x`},null)]));let P=a(`div`,{class:`${n}-content`},[N,M,a(`div`,{class:`${n}-body`,style:C,...w},[p.default?.()]),j]);return a(r,{...e(A),onBeforeEnter:b,onAfterEnter:()=>x(!0),onAfterLeave:()=>x(!1)},{default:()=>[D||!k?u(a(`div`,{...m,ref:_,key:`dialog-element`,role:`document`,style:[y.value,m.style],class:[n,m.class],onMousedown:T,onMouseup:E},[a(`div`,{tabindex:0,ref:h,style:f},[O?O({originVNode:P}):P]),a(`div`,{tabindex:0,ref:g,style:d},null)]),[[l,D]]):null]})}}});export{p as default};