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