import{aa as _,J as b,ab as k,c9 as p,bn as H,aB as I,a as m,o as i,r as v,b as f,U as A,w as y,F as g,aD as D,B as d}from"./dVzHJMF1.js";var L=_.extend({name:"dynamicdialog"}),B={name:"BaseDynamicDialog",extends:k,props:{},style:L,provide:function(){return{$pcDynamicDialog:this,$parentInstance:this}}},C={name:"DynamicDialog",extends:B,inheritAttrs:!1,data:function(){return{instanceMap:{}}},openListener:null,closeListener:null,currentInstance:null,mounted:function(){var n=this;this.openListener=function(c){var s=c.instance,a=H()+"_dynamic_dialog";s.visible=!0,s.key=a,n.instanceMap[a]=s},this.closeListener=function(c){var s=c.instance,a=c.params,l=s.key,o=n.instanceMap[l];o&&(o.visible=!1,o.options.onClose&&o.options.onClose({data:a,type:"config-close"}),n.currentInstance=o)},p.on("open",this.openListener),p.on("close",this.closeListener)},beforeUnmount:function(){p.off("open",this.openListener),p.off("close",this.closeListener)},methods:{onDialogHide:function(n){!this.currentInstance&&n.options.onClose&&n.options.onClose({type:"dialog-close"})},onDialogAfterHide:function(n){this.currentInstance&&delete this.currentInstance,this.currentInstance=null,delete this.instanceMap[n.key]},getTemplateItems:function(n){return Array.isArray(n)?n:[n]}},components:{DDialog:b}};function x(t,n,c,s,a,l){var o=I("DDialog");return i(!0),m(g,null,v(a.instanceMap,function(e,h){return i(),f(o,d({key:h,visible:e.visible,"onUpdate:visible":function(r){return e.visible=r},_instance:e,ref_for:!0},e.options.props,{onHide:function(r){return l.onDialogHide(e)},onAfterHide:function(r){return l.onDialogAfterHide(e)}}),A({default:y(function(){return[(i(),f(D(e.content),d({ref_for:!0},e.options.emits),null,16))]}),_:2},[e.options.templates&&e.options.templates.header?{name:"header",fn:y(function(){return[(i(!0),m(g,null,v(l.getTemplateItems(e.options.templates.header),function(u,r){return i(),f(D(u),d({key:r+"_header",ref_for:!0},e.options.emits),null,16)}),128))]}),key:"0"}:void 0,e.options.templates&&e.options.templates.footer?{name:"footer",fn:y(function(){return[(i(!0),m(g,null,v(l.getTemplateItems(e.options.templates.footer),function(u,r){return i(),f(D(u),d({key:r+"_footer",ref_for:!0},e.options.emits),null,16)}),128))]}),key:"1"}:void 0]),1040,["visible","onUpdate:visible","_instance","onHide","onAfterHide"])}),128)}C.render=x;export{C as default};
