import"./rolldown-runtime-BM3Ffeng.js";import{F as e,a as t,mt as n,ot as r}from"./element-plus-vendor-BF9PNysW.js";import{A as i,At as a,D as o,E as s,I as c,N as l,O as u,P as d,Pt as f,St as p,Tt as m,W as h,Xt as g,ct as _,dt as v,et as y,gt as b,ht as x,j as S,k as C,pt as w,qt as T,rt as E,x as D,y as O}from"./vue-vendor-DMUmTARL.js";import{Fo as k,No as A,Po as j,Ro as M}from"./icons-vendor-Db5MGAkr.js";function N(e){let{visible:t,enabled:n,close:r}=e,i=!1,a=!1,o=!1,s=()=>{i=!0,r()},c=()=>{a||=(window.addEventListener(`popstate`,s),!0)},l=()=>{a&&=(window.removeEventListener(`popstate`,s),!1)};w(t,(e,t)=>{if(e&&!t){if(!n())return;history.pushState({zfDialogBack:!0},``,location.href),o=!0,c()}else !e&&t&&(l(),o&&!i&&history.back(),o=!1,i=!1)}),p(()=>{l()})}var P={class:`zf-dialog`},F=[`id`],I={class:`zf-dialog__title-btns`},L=[`aria-label`],R={key:0,class:`zf-dialog__footer`},z=c({__name:`ZDialog`,props:{title:{default:``},modelValue:{type:Boolean,default:!1},dialogClass:{default:``},titleClass:{default:``},hiddenFullBtn:{type:Boolean,default:!1},showMinimizeBtn:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},confirmText:{default:`确认`},cancelText:{default:`关闭`},destroyOnClose:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},autoFullScreen:{type:Boolean,default:!1},onClose:{type:[Function,null],default:null},showFooter:{type:Boolean,default:!0},showHeader:{type:Boolean,default:!0},closeOnBack:{type:Boolean,default:!1},headerPaddingX:{default:`var(--el-dialog-padding-primary)`},contentPaddingX:{default:`var(--el-dialog-padding-primary)`},contentPaddingTop:{default:`1rem`}},emits:[`update:modelValue`,`confirm`,`close`,`minimize`],setup(c,{expose:p,emit:w}){let z=_(),B=v(),V=c,H=w,U=m(V.autoFullScreen?window.innerWidth<768:!1),W=s(()=>z?.fullscreen??U.value),G=s(()=>V.showFooter||!!B.footer),K=s(()=>V.showHeader||!!B.header),q=s(()=>({"zf-dialog--fullscreen":W.value,"zf-dialog--with-footer":G.value,"zf-dialog--without-footer":!G.value,"zf-dialog--with-header":K.value,"zf-dialog--without-header":!K.value})),J=s(()=>z?.fullscreen?!1:!V.hiddenFullBtn),Y=(e,t)=>e===``||e==null?t:typeof e==`number`?`${e}px`:e,X=s(()=>({"--z-dialog-header-padding-x":Y(V.headerPaddingX,`var(--el-dialog-padding-primary)`),"--z-dialog-content-padding-x":Y(V.contentPaddingX,`var(--el-dialog-padding-primary)`),"--z-dialog-content-padding-top":Y(V.contentPaddingTop,`1rem`)})),Z=()=>{z?.fullscreen||(U.value=!U.value)},Q=()=>{$(`close`)},$=e=>{Reflect.has(z,`before-close`)&&typeof z[`before-close`]==`function`&&z[`before-close`](),H(`close`,e),H(`update:modelValue`,!1)},ee=()=>{H(`minimize`)};N({visible:()=>V.modelValue,enabled:()=>V.closeOnBack,close:()=>$(`close`)});let te=()=>{H(`confirm`)};return p({isVisible:a(V,`modelValue`)}),(a,s)=>{let p=t;return y(),i(`div`,P,[d(f(e),h(f(z),{"model-value":c.modelValue,class:[q.value,c.dialogClass],style:X.value,draggable:c.draggable,"show-close":!1,"destroy-on-close":c.destroyOnClose,fullscreen:W.value,"before-close":Q}),S({default:x(()=>[b((y(),i(`div`,{class:T([`zf-dialog__content`,{"pb-4":!G.value}])},[E(a.$slots,`default`,{fullscreen:W.value})],2)),[[p,c.loading]])]),_:2},[K.value?{name:`header`,fn:x(({titleId:e,titleClass:t})=>[o(`div`,{id:e,class:T([`zf-dialog__title`,[t,c.titleClass]])},[f(B).header?E(a.$slots,`header`,{key:0}):(y(),i(D,{key:1},[l(g(c.title),1)],64))],10,F),o(`div`,I,[c.showMinimizeBtn?(y(),i(`button`,{key:0,type:`button`,class:`zf-dialog__header-btn`,"aria-label":`最小化`,onMousedown:s[0]||=O(()=>{},[`stop`]),onClick:O(ee,[`stop`])},[d(f(n),{size:`18`},{default:x(()=>[d(f(A))]),_:1})],32)):C(``,!0),J.value?(y(),i(`button`,{key:1,type:`button`,class:`zf-dialog__header-btn`,"aria-label":W.value?`退出全屏`:`切换全屏`,onMousedown:s[1]||=O(()=>{},[`stop`]),onClick:O(Z,[`stop`])},[d(f(n),{size:`18`},{default:x(()=>[W.value?(y(),u(f(k),{key:0})):(y(),u(f(j),{key:1}))]),_:1})],40,L)):C(``,!0),o(`button`,{type:`button`,class:`zf-dialog__header-btn`,"aria-label":`关闭弹窗`,onMousedown:s[2]||=O(()=>{},[`stop`]),onClick:s[3]||=O(e=>$(`close`),[`stop`])},[d(f(n),{size:`18`},{default:x(()=>[d(f(M))]),_:1})],32)])]),key:`0`}:void 0,G.value?{name:`footer`,fn:x(()=>[!f(B).footer&&c.showFooter?(y(),i(`span`,R,[d(f(r),{type:`primary`,onClick:te},{default:x(()=>[l(g(c.confirmText),1)]),_:1}),d(f(r),{onClick:s[4]||=e=>$(`cancel`)},{default:x(()=>[l(g(c.cancelText),1)]),_:1})])):E(a.$slots,`footer`,{key:1})]),key:`1`}:void 0]),1040,[`model-value`,`class`,`style`,`draggable`,`destroy-on-close`,`fullscreen`])])}}});export{z as t};