import{i as o}from"./app-core.82d0a9b8.js";import{_ as a}from"./_plugin-vue_export-helper.eefbdd86.js";import{f as i,i as c,M as u}from"./vendor-vue-ui.02763c14.js";const h={emits:["can-show","images"],props:{src:String,tag:{type:String,default(){return"img"}},debounce:{type:Boolean,default(){return!0}}},data(){return{canShow:!1,images:{}}},watch:{src(){if(this.debounce){o(this.maybeShowImage,50);return}this.maybeShowImage()},canShow(t){this.$emit("can-show",t)},images:{handler:function(){this.$emit("images",this.images)},deep:!0}},methods:{async maybeShowImage(){if(this.canShow=!1,!this.src)return;if(this.images[this.src]){this.canShow=!0;return}const t=new Image;t.onload=await(()=>{this.canShow=!0;let s=0;const e=t.width,n=t.height;e&&n&&(s=e/n),!this.images[this.src]&&(this.images[this.src]={image:t,ratio:s,vertical:e>n})}),t.onerror=await(()=>{this.canShow=!1}),t.src=this.src}},mounted(){this.maybeShowImage()}},m=["src"];function l(t,s,e,n,r,f){return r.canShow?(i(),c("img",{key:0,src:e.src},null,8,m)):u("",!0)}const w=a(h,[["render",l]]);export{w as B};
