import{o as e}from"./rolldown-runtime.DAXXjFlN.js";import{r as t}from"./emotion-is-prop-valid.esm.CygBv61C.js";import{c as n,l as r,t as i}from"./emotion-styled.browser.esm.DmHEQgFq.js";import{t as a}from"./loglevel.BJBYxGId.js";import{r as o}from"./StreamlitMarkdown.CwaSe4JX.js";import{t as s}from"./useCrossOriginAttribute.BtRvgKAM.js";import{f as c}from"./ErrorElement.BlvlqstC.js";import{At as l,Kt as u}from"./index.BfkDCGNp.js";import{n as d,t as f}from"./withFullScreenWrapper.3RxFhc7X.js";var p=e(t(),1),m=e(a(),1),h=i(`div`,{target:`ehg91i90`})(({theme:e,shouldStretch:t})=>({display:`flex`,flexDirection:`row`,flexWrap:`wrap`,rowGap:e.spacing.lg,maxWidth:`100%`,width:t?`100%`:`fit-content`})),g=i(`div`,{target:`ehg91i91`})(({theme:e,shouldStretch:t})=>({display:`flex`,flexDirection:`column`,alignItems:`stretch`,width:t?`100%`:`auto`,flexGrow:+!!t,">img":{borderRadius:e.radii.default}})),_=i(`div`,{target:`ehg91i92`})(({theme:e})=>({textAlign:`center`,marginTop:e.spacing.xs,wordWrap:`break-word`,padding:e.spacing.threeXS})),v=i(`a`,{target:`ehg91i93`})(({theme:e})=>({display:`block`,borderRadius:e.radii.default,overflow:`hidden`,"&:hover":{opacity:.85},"&:focus-visible":{boxShadow:e.shadows.focusRing}})),y=(0,m.getLogger)(`ImageList`);function b(e,t){if(e){if(e.useStretch)return t;if(e.useContent)return;if(e.pixelWidth)return e.pixelWidth}}var x=({itemKey:e,image:t,imgStyle:i,buildMediaURL:a,handleImageError:c,shouldStretch:l,link:u})=>{let d=s(t.url),f=n(`img`,{style:i,src:a(t.url),alt:e,onError:c,crossOrigin:d});return r(g,{"data-testid":`stImageContainer`,shouldStretch:l,children:[u?n(v,{href:u,target:`_blank`,rel:`noreferrer`,"aria-label":t.caption||u,"data-testid":`stImageLink`,children:f}):f,t.caption&&n(_,{"data-testid":`stImageCaption`,style:i,children:n(o,{source:t.caption,allowHTML:!1,isCaption:!0,isLabel:!0})})]})};function S({element:e,endpoints:t,widthConfig:i,disableFullscreenMode:a}){let{expanded:o,width:s,height:f,expand:p,collapse:m}=u(d),g=s||0,_=b(i,g),v=i?.useStretch??!1,S={};f&&o?(S.maxHeight=f,S.objectFit=`contain`,S.width=`100%`):(S.width=_??`100%`,S.maxWidth=`100%`);let C=e=>{let n=e.currentTarget.src;y.error(`Client Error: Image source error - ${n}`),t.sendClientErrorToHost(`Image`,`Image source failed to load`,`onerror triggered`,n)};return r(c,{width:g,height:f,useContainerWidth:o,topCentered:!0,children:[n(l,{target:c,isFullScreen:o,onExpand:p,onCollapse:m,disableFullscreenMode:a}),n(h,{className:`stImage`,"data-testid":`stImage`,shouldStretch:v,children:e.imgs.map((r,i)=>n(x,{itemKey:i.toString(),image:r,imgStyle:S,buildMediaURL:e=>t.buildMediaURL(e),handleImageError:C,shouldStretch:v,link:e.imgs.length===1?e.link:void 0},i))})]})}var C=f(S),w=(0,p.memo)(C);export{w as default};