import{b as F,i as V,K as U,m as c,c as B,F as g,E as _,s as $,O as Z,X as j,ai as D,ae as q}from"./index-6f5315ad.js";import{i as G,a as K}from"./base-60afcd29.js";import{U as I,j as x}from"./el-button-c8e39703.js";import{d as X,e as H}from"./config-provider-338f87a0.js";import{a as J}from"./el-overlay-85aa3a46.js";const Q=F({center:{type:Boolean,default:!1},alignCenter:{type:Boolean,default:!1},closeIcon:{type:G},customClass:{type:String,default:""},draggable:{type:Boolean,default:!1},fullscreen:{type:Boolean,default:!1},showClose:{type:Boolean,default:!0},title:{type:String,default:""}}),te={close:()=>!0},ne=F({...Q,appendToBody:{type:Boolean,default:!1},beforeClose:{type:V(Function)},destroyOnClose:{type:Boolean,default:!1},closeOnClickModal:{type:Boolean,default:!0},closeOnPressEscape:{type:Boolean,default:!0},lockScroll:{type:Boolean,default:!0},modal:{type:Boolean,default:!0},openDelay:{type:Number,default:0},closeDelay:{type:Number,default:0},top:{type:String},modelValue:{type:Boolean,default:!1},modalClass:String,width:{type:[String,Number]},zIndex:{type:Number},trapFocus:{type:Boolean,default:!1}}),ae={open:()=>!0,opened:()=>!0,close:()=>!0,closed:()=>!0,[I]:e=>U(e),openAutoFocus:()=>!0,closeAutoFocus:()=>!0},se=(e,a)=>{const l=Z().emit,{nextZIndex:v}=X();let p="";const P=x(),E=x(),t=c(!1),f=c(!1),i=c(!1),d=c(e.zIndex||v());let s,u;const O=H("namespace",j),T=B(()=>{const o={},n=`--${O.value}-dialog`;return e.fullscreen||(e.top&&(o[`${n}-margin-top`]=e.top),e.width&&(o[`${n}-width`]=K(e.width))),o}),h=B(()=>e.alignCenter?{display:"flex"}:{});function S(){l("opened")}function k(){l("closed"),l(I,!1),e.destroyOnClose&&(i.value=!1)}function A(){l("close")}function C(){u==null||u(),s==null||s(),e.openDelay&&e.openDelay>0?{stop:s}=D(()=>b(),e.openDelay):b()}function r(){s==null||s(),u==null||u(),e.closeDelay&&e.closeDelay>0?{stop:u}=D(()=>m(),e.closeDelay):m()}function y(){function o(n){n||(f.value=!0,t.value=!1)}e.beforeClose?e.beforeClose(o):r()}function w(){e.closeOnClickModal&&y()}function b(){q&&(t.value=!0)}function m(){t.value=!1}function N(){l("openAutoFocus")}function M(){l("closeAutoFocus")}function z(o){var n;((n=o.detail)==null?void 0:n.focusReason)==="pointer"&&o.preventDefault()}e.lockScroll&&J(t);function L(){e.closeOnPressEscape&&y()}return g(()=>e.modelValue,o=>{o?(f.value=!1,C(),i.value=!0,d.value=e.zIndex?d.value++:v(),_(()=>{l("open"),a.value&&(a.value.scrollTop=0)})):t.value&&r()}),g(()=>e.fullscreen,o=>{a.value&&(o?(p=a.value.style.transform,a.value.style.transform=""):a.value.style.transform=p)}),$(()=>{e.modelValue&&(t.value=!0,i.value=!0,C())}),{afterEnter:S,afterLeave:k,beforeLeave:A,handleClose:y,onModalClick:w,close:r,doClose:m,onOpenAutoFocus:N,onCloseAutoFocus:M,onCloseRequested:L,onFocusoutPrevented:z,titleId:P,bodyId:E,closed:f,style:T,overlayDialogStyle:h,rendered:i,visible:t,zIndex:d}};export{ae as a,Q as b,te as c,ne as d,se as u};
