const e=require("../../_util/hooks/useMergedState.js"),t=require("./Preview.js"),n=require("./Image.js");let r=require("vue");var i=Symbol(`previewGroupContext`),a={provide:e=>{(0,r.provide)(i,e)},inject:()=>(0,r.inject)(i,{isPreviewGroup:(0,r.shallowRef)(!1),previewUrls:(0,r.computed)(()=>new Map),setPreviewUrls:()=>{},current:(0,r.ref)(null),setCurrent:()=>{},setShowPreview:()=>{},setMousePosition:()=>{},registerImage:null,rootClassName:``})},o=()=>({previewPrefixCls:String,preview:{type:[Boolean,Object],default:!0},icons:{type:Object,default:()=>({})}}),s=(0,r.defineComponent)({compatConfig:{MODE:3},name:`PreviewGroup`,inheritAttrs:!1,props:o(),setup(i,{slots:o}){let s=(0,r.computed)(()=>{let e={visible:void 0,onVisibleChange:()=>{},getContainer:void 0,current:0};return typeof i.preview==`object`?n.mergeDefaultValue(i.preview,e):e}),c=(0,r.reactive)(new Map),l=(0,r.ref)(),u=(0,r.computed)(()=>s.value.visible),d=(0,r.computed)(()=>s.value.getContainer),[f,p]=e.default(!!u.value,{value:u,onChange:(e,t)=>{s.value.onVisibleChange?.(e,t)}}),m=(0,r.ref)(null),h=(0,r.computed)(()=>u.value!==void 0),g=(0,r.computed)(()=>Array.from(c.keys())),_=(0,r.computed)(()=>g.value[s.value.current]),v=(0,r.computed)(()=>new Map(Array.from(c).filter(([,{canPreview:e}])=>!!e).map(([e,{url:t}])=>[e,t]))),y=(e,t,n=!0)=>{c.set(e,{url:t,canPreview:n})},b=e=>{l.value=e},x=e=>{m.value=e},S=(e,t,n=!0)=>(c.set(e,{url:t,canPreview:n}),()=>{c.delete(e)}),C=e=>{e?.stopPropagation(),p(!1),x(null)};return(0,r.watch)(_,e=>{b(e)},{immediate:!0,flush:`post`}),(0,r.watchEffect)(()=>{f.value&&h.value&&b(_.value)},{flush:`post`}),a.provide({isPreviewGroup:(0,r.shallowRef)(!0),previewUrls:v,setPreviewUrls:y,current:l,setCurrent:b,setShowPreview:p,setMousePosition:x,registerImage:S}),()=>{let{...e}=s.value;return(0,r.createVNode)(r.Fragment,null,[o.default&&o.default(),(0,r.createVNode)(t.default,{...e,"ria-hidden":!f.value,visible:f.value,prefixCls:i.previewPrefixCls,onClose:C,mousePosition:m.value,src:v.value.get(l.value),icons:i.icons,getContainer:d.value},null)])}}});exports.context=a,exports.default=s,exports.imageGroupProps=o;