"use strict";const i=require("../common/src/instantiationDecorator.js"),s=require("./props.js"),e=require("../common/config.js"),o=require("../common/utils.js"),a=require("../common/version.js"),t=require("../common/utils.wxs.js"),r=require("../../../../common/vendor.js"),n=`${e.prefix}-image`,l=i.uniComponent({name:n,options:{styleIsolation:"shared"},externalClasses:[`${e.prefix}-class`,`${e.prefix}-class-load`,`${e.prefix}-class-image`,`${e.prefix}-class-error`],components:{TLoading:()=>"../loading/loading.js",TIcon:()=>"../icon/icon.js"},props:{...s.ImageProps},emits:["click"],data:()=>({prefix:e.prefix,isLoading:!0,isFailed:!1,innerStyle:"",classPrefix:n,tools:t.tools,preSrc:""}),watch:{src(){this.preSrc!==this.src&&this.update()},width:"calcSize",height:"calcSize"},mounted(){this.calcSize(this.width,this.height)},methods:{onLoaded(i){const s=o.appBaseInfo.SDKVersion,{mode:e,tId:t}=this,r=a.compareVersion(s,"2.10.3")<0;"heightFix"===e&&r&&o.getRect(this,`#${t||"image"}`).then((i=>{const{height:s,width:e}=i;this.innerStyle=`height: ${o.addUnit(s)}; width: ${e}px;`})).catch((()=>{})),this.isLoading=!1,this.isFailed=!1,this.$emit("load",{e:i})},onLoadError(i){this.isLoading=!1,this.isFailed=!0,this.$emit("error",{e:i})},calcSize(i=this.width,s=this.height){let e="";i&&(e+=`width: ${o.addUnit(i)};`),s&&(e+=`height: ${o.addUnit(s)};`),this.innerStyle=e},update(){const{src:i}=this;this.preSrc=i,i?(this.isLoading=!0,this.isFailed=!1):this.onLoadError({errMsg:"图片链接为空"})},onClick(i){this.$emit("click",i)}}});if(!Array){(r.resolveComponent("t-loading")+r.resolveComponent("t-icon"))()}Math||((()=>"../loading/loading.js")+(()=>"../icon/icon.js"))();const d=r._export_sfc(l,[["render",function(i,s,e,o,a,t){return r.e({a:i.isLoading},i.isLoading?r.e({b:"default"===i.loading},"default"===i.loading?{c:r.p({theme:"dots",size:"44rpx",loading:!0,"inherit-color":!0,"t-class":i.tClassLoad,"t-class-text":i.classPrefix+"--loading-text"})}:""!==i.loading&&"slot"!==i.loading?{e:r.t(i.loading),f:r.n(i.classPrefix+"__common "+i.tClassLoad)}:{},{d:""!==i.loading&&"slot"!==i.loading,g:r.s(i.tools._style([i.innerStyle])),h:r.n(i.classPrefix+"__mask "+i.classPrefix+"--loading "+i.classPrefix+"--shape-"+i.shape),i:i.ariaHidden}):i.isFailed?r.e({k:"default"===i.error},"default"===i.error?{l:r.p({name:"close","aria-role":"img","aria-label":"加载失败"}),m:r.n(i.tClassLoad)}:i.error&&"slot"!==i.error?{o:r.t(i.error),p:r.n(i.classPrefix+"__common "),q:r.n(i.tClassLoad)}:{},{n:i.error&&"slot"!==i.error,r:r.s(i.tools._style([i.innerStyle])),s:r.n(i.classPrefix+"__mask "+i.classPrefix+"--failed "+i.classPrefix+"--shape-"+i.shape),t:r.n(i.tClassError),v:i.ariaHidden}):{},{j:i.isFailed,w:!i.isFailed},i.isFailed?{}:{x:i.tId||"image",y:r.s(i.tools._style([i.innerStyle])),z:r.n(i.classPrefix+"__img "+i.classPrefix+"--shape-"+i.shape+" "),A:r.n((i.isLoading?i.classPrefix+"--lazy":"")+" "),B:r.n(i.tClassImage),C:i.src,D:i.mode,E:i.webp,F:i.lazy,G:i.showMenuByLongpress,H:i.ariaHidden||i.isLoading||i.isFailed,I:i.ariaLabel,J:r.o(((...s)=>i.onClick&&i.onClick(...s))),K:r.o(((...s)=>i.onLoaded&&i.onLoaded(...s))),L:r.o(((...s)=>i.onLoadError&&i.onLoadError(...s)))},{M:r.s(i.tools._style([i.customStyle])),N:r.n(i.tClass),O:r.n(i.classPrefix)})}],["__scopeId","data-v-4372ccb7"]]);wx.createComponent(d);
