import{d as l,u as o,j as h,aR as n}from"./index.3bfa6a0e.js";var d=l({name:"col-popup",props:{height:{type:String,default:"100%"},destroy:{type:Boolean,default:!1},modelValue:{type:Boolean,default:!1},position:{type:String,default:"bottom"},zIndex:{type:Number,default:2018}},data(){return{popupShow:!1,isDestroy:!1}},watch:{modelValue(e){this.hashState()}},mounted(){this.destroy&&(this.isDestroy=!1),window.addEventListener("hashchange",this.onHash,!1)},unmounted(){window.removeEventListener("hashchange",this.onHash,!1)},methods:{onHash(){this.$emit("update:modelValue",!1),this.isDestroy=!1},onPopupClose(e){this.$emit("update:modelValue",e),this.hashState()},hashState(){if(this.modelValue){this.isDestroy=!1;const e=window.location.hash.slice(1).split("?"),t=o.parse(e[1]);let s=0;for(let r in t)s++;const i=window.location.href,a=s>0?"&cPop="+ +new Date:"?cPop="+ +new Date;history.pushState("","",`${i}${a}`)}else{const e=window.location.hash.slice(1).split("?");o.parse(e[1]).cPop&&window.history.go(-1)}this.$refs.protocolPopup&&(this.$refs.protocolPopup.scrollTop=0)}},render(){return h(n,{ref:"protocolPopup",show:this.modelValue,transitionAppear:!0,position:this.position,style:{height:this.height},zIndex:this.zIndex,onClosed:()=>{this.destroy&&(this.isDestroy=!0)}},{default:()=>[this.$slots.default&&!this.isDestroy&&this.$slots.default()]})}});export{d as C};
