import{aK as te,aL as O,br as se,b9 as ne,d as A,bq as oe,aM as ie,a_ as re,dB as ce,r as c,e as u,ci as m,w as ue,b as de,o as i,c as d,aN as x,C as T,G as ve,a,ac as g,F as $,m as pe,D as f,A as me,B as fe,aG as ye,aO as ge,n as we,dC as he,ba as be,dD as _e,bS as D,dE as ke,dF as Se,aP as xe,__tla as ze}from"./index-92ad187a.js";import{E as Ee,__tla as Be}from"./el-image-viewer-d472c5a2.js";let M,Ce=Promise.all([(()=>{try{return ze}catch{}})(),(()=>{try{return Be}catch{}})()]).then(async()=>{const P=te({hideOnClickModal:Boolean,src:{type:String,default:""},fit:{type:String,values:["","contain","cover","fill","none","scale-down"],default:""},loading:{type:String,values:["eager","lazy"]},lazy:Boolean,scrollContainer:{type:O([String,Object])},previewSrcList:{type:O(Array),default:()=>se([])},previewTeleported:Boolean,zIndex:{type:Number},initialIndex:{type:Number,default:0},infinite:{type:Boolean,default:!0},closeOnPressEscape:{type:Boolean,default:!0},zoomRate:{type:Number,default:1.2},minScale:{type:Number,default:.2},maxScale:{type:Number,default:7}}),j={load:n=>n instanceof Event,error:n=>n instanceof Event,switch:n=>ne(n),close:()=>!0,show:()=>!0},q=["src","loading"],F={key:0},G=A({name:"ElImage",inheritAttrs:!1});M=xe(ge(A({...G,props:P,emits:j,setup(n,{emit:v}){const l=n;let z="";const{t:K}=oe(),o=ie("image"),R=re(),Y=ce(),w=c(),p=c(!1),r=c(!0),h=c(!1),y=c(),s=c(),H=m&&"loading"in HTMLImageElement.prototype;let b,_;const J=u(()=>[o.e("inner"),k.value&&o.e("preview"),r.value&&o.is("loading")]),Q=u(()=>R.style),U=u(()=>{const{fit:e}=l;return m&&e?{objectFit:e}:{}}),k=u(()=>{const{previewSrcList:e}=l;return Array.isArray(e)&&e.length>0}),V=u(()=>{const{previewSrcList:e,initialIndex:t}=l;let N=t;return t>e.length-1&&(N=0),N}),E=u(()=>l.loading!=="eager"&&(!H&&l.loading==="lazy"||l.lazy)),S=()=>{m&&(r.value=!0,p.value=!1,w.value=l.src)};function W(e){r.value=!1,p.value=!1,v("load",e)}function X(e){r.value=!1,p.value=!0,v("error",e)}function B(){ke(y.value,s.value)&&(S(),I())}const C=Se(B,200,!0);async function L(){var e;if(!m)return;await we();const{scrollContainer:t}=l;he(t)?s.value=t:be(t)&&t!==""?s.value=(e=document.querySelector(t))!=null?e:void 0:y.value&&(s.value=_e(y.value)),s.value&&(b=D(s,"scroll",C),setTimeout(()=>B(),100))}function I(){m&&s.value&&C&&(b==null||b(),s.value=void 0)}function Z(e){if(e.ctrlKey)return e.deltaY<0||e.deltaY>0?(e.preventDefault(),!1):void 0}function ee(){k.value&&(_=D("wheel",Z,{passive:!1}),z=document.body.style.overflow,document.body.style.overflow="hidden",h.value=!0,v("show"))}function ae(){_==null||_(),document.body.style.overflow=z,h.value=!1,v("close")}function le(e){v("switch",e)}return ue(()=>l.src,()=>{E.value?(r.value=!0,p.value=!1,I(),L()):S()}),de(()=>{E.value?L():S()}),(e,t)=>(i(),d("div",{ref_key:"container",ref:y,class:g([a(o).b(),e.$attrs.class]),style:ye(a(Q))},[p.value?x(e.$slots,"error",{key:0},()=>[T("div",{class:g(a(o).e("error"))},ve(a(K)("el.image.error")),3)]):(i(),d($,{key:1},[w.value!==void 0?(i(),d("img",pe({key:0},a(Y),{src:w.value,loading:e.loading,style:a(U),class:a(J),onClick:ee,onLoad:W,onError:X}),null,16,q)):f("v-if",!0),r.value?(i(),d("div",{key:1,class:g(a(o).e("wrapper"))},[x(e.$slots,"placeholder",{},()=>[T("div",{class:g(a(o).e("placeholder"))},null,2)])],2)):f("v-if",!0)],64)),a(k)?(i(),d($,{key:2},[h.value?(i(),me(a(Ee),{key:0,"z-index":e.zIndex,"initial-index":a(V),infinite:e.infinite,"zoom-rate":e.zoomRate,"min-scale":e.minScale,"max-scale":e.maxScale,"url-list":e.previewSrcList,"hide-on-click-modal":e.hideOnClickModal,teleported:e.previewTeleported,"close-on-press-escape":e.closeOnPressEscape,onClose:ae,onSwitch:le},{default:fe(()=>[e.$slots.viewer?(i(),d("div",F,[x(e.$slots,"viewer")])):f("v-if",!0)]),_:3},8,["z-index","initial-index","infinite","zoom-rate","min-scale","max-scale","url-list","hide-on-click-modal","teleported","close-on-press-escape"])):f("v-if",!0)],64)):f("v-if",!0)],6))}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/image/src/image.vue"]]))});export{M as E,Ce as __tla};
