(globalThis.webpackChunkacademy=globalThis.webpackChunkacademy||[]).push([[353],{6734:(e,t,a)=>{var r,i=Object.create,l=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,p=(e,t,a,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of o(t))c.call(e,i)||i===a||l(e,i,{get:()=>t[i],enumerable:!(r=n(t,i))||r.enumerable});return e},d=(e,t,a)=>(((e,t,a)=>{t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a})(e,"symbol"!=typeof t?t+"":t,a),a),h={};((e,t)=>{for(var a in t)l(e,a,{get:t[a],enumerable:!0})})(h,{default:()=>g}),e.exports=(r=h,p(l({},"__esModule",{value:!0}),r));var u=((e,t,a)=>(a=null!=e?i(s(e)):{},p(e&&e.__esModule?a:l(a,"default",{value:e,enumerable:!0}),e)))(a(1609));const m="64px",b={};class g extends u.Component{constructor(){super(...arguments),d(this,"mounted",!1),d(this,"state",{image:null}),d(this,"handleKeyPress",e=>{"Enter"!==e.key&&" "!==e.key||this.props.onClick()})}componentDidMount(){this.mounted=!0,this.fetchImage(this.props)}componentDidUpdate(e){const{url:t,light:a}=this.props;e.url===t&&e.light===a||this.fetchImage(this.props)}componentWillUnmount(){this.mounted=!1}fetchImage({url:e,light:t,oEmbedUrl:a}){if(!u.default.isValidElement(t))if("string"!=typeof t){if(!b[e])return this.setState({image:null}),window.fetch(a.replace("{url}",e)).then(e=>e.json()).then(t=>{if(t.thumbnail_url&&this.mounted){const a=t.thumbnail_url.replace("height=100","height=480").replace("-d_295x166","-d_640");this.setState({image:a}),b[e]=a}});this.setState({image:b[e]})}else this.setState({image:t})}render(){const{light:e,onClick:t,playIcon:a,previewTabIndex:r,previewAriaLabel:i}=this.props,{image:l}=this.state,n=u.default.isValidElement(e),o={display:"flex",alignItems:"center",justifyContent:"center"},s={preview:{width:"100%",height:"100%",backgroundImage:l&&!n?`url(${l})`:void 0,backgroundSize:"cover",backgroundPosition:"center",cursor:"pointer",...o},shadow:{background:"radial-gradient(rgb(0, 0, 0, 0.3), rgba(0, 0, 0, 0) 60%)",borderRadius:m,width:m,height:m,position:n?"absolute":void 0,...o},playIcon:{borderStyle:"solid",borderWidth:"16px 0 16px 26px",borderColor:"transparent transparent transparent white",marginLeft:"7px"}},c=u.default.createElement("div",{style:s.shadow,className:"react-player__shadow"},u.default.createElement("div",{style:s.playIcon,className:"react-player__play-icon"}));return u.default.createElement("div",{style:s.preview,className:"react-player__preview",onClick:t,tabIndex:r,onKeyPress:this.handleKeyPress,...i?{"aria-label":i}:{}},n?e:null,a||c)}}}}]);