import{a as e,d as t,i as n,o as r}from"./objectSpread2-DtFdQpqy.js";import{n as i}from"./preload-helper-EQ20WQt-.js";import{t as a}from"./prop-types-DdDwMzX7.js";import{i as o}from"./poll-D7UTo6nN.js";import{Ft as s,H as c,U as l,Z as u,tn as d}from"./status_quoted-C2Bl8ONr.js";var f=r(((e,t)=>{function n(){}t.exports=n})),p=t(a()),m=t(o()),h=t(f()),g=i();e();var _=class extends c{constructor(...e){super(...e),n(this,`updateOnProps`,[`status`]),n(this,`renderLoadingMediaGallery`,()=>{let{height:e,width:t}=this.props;return(0,g.jsx)(`div`,{className:`media-gallery`,style:{height:e,width:t}})}),n(this,`renderLoadingVideoPlayer`,()=>{let{height:e,width:t}=this.props;return(0,g.jsx)(`div`,{className:`video-player`,style:{height:e,width:t}})}),n(this,`renderLoadingAudioPlayer`,()=>{let{height:e,width:t}=this.props;return(0,g.jsx)(`div`,{className:`audio-player`,style:{height:e,width:t}})})}render(){let{status:e,width:t,height:n,visible:r}=this.props,i=e.get(`media_attachments`),a=e.getIn([`language`,`translation`])||e.get(`language`)||this.props.lang;if(i.size===0)return null;if(i.getIn([0,`type`])===`audio`){let r=i.get(0),o=r.getIn([`translation`,`description`])||r.get(`description`);return(0,g.jsx)(l,{fetchComponent:u,loading:this.renderLoadingAudioPlayer,children:i=>(0,g.jsx)(i,{src:r.get(`url`),alt:o,lang:a,width:t,height:n,poster:r.get(`preview_url`)||e.getIn([`account`,`avatar_static`]),backgroundColor:r.getIn([`meta`,`colors`,`background`]),foregroundColor:r.getIn([`meta`,`colors`,`foreground`]),accentColor:r.getIn([`meta`,`colors`,`accent`]),duration:r.getIn([`meta`,`original`,`duration`],0)})},`audio`)}else if(i.getIn([0,`type`])===`video`){let o=i.get(0),s=o.getIn([`translation`,`description`])||o.get(`description`);return(0,g.jsx)(l,{fetchComponent:d,loading:this.renderLoadingVideoPlayer,children:i=>(0,g.jsx)(i,{preview:o.get(`preview_url`),frameRate:o.getIn([`meta`,`original`,`frame_rate`]),blurhash:o.get(`blurhash`),src:o.get(`url`),alt:s,lang:a,width:t,height:n,inline:!0,sensitive:e.get(`sensitive`),visible:r,onOpenVideo:h.default})},`video`)}else return(0,g.jsx)(l,{fetchComponent:s,loading:this.renderLoadingMediaGallery,children:o=>(0,g.jsx)(o,{media:i,lang:a,sensitive:e.get(`sensitive`),defaultWidth:t,visible:r,height:n,onOpenMedia:h.default})},`gallery`)}};n(_,`propTypes`,{status:m.default.map.isRequired,lang:p.default.string,height:p.default.number,width:p.default.number,visible:p.default.bool}),n(_,`defaultProps`,{height:110,width:239});export{_ as t};
//# sourceMappingURL=media_attachments-UuQngNk5.js.map