import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{$P as t}from"./lucide-C4oWPzu4.js";var n=e(t(),1),r=`64px`,i={},a=({src:e,light:t,oEmbedUrl:a,onClickPreview:o,playIcon:s,previewTabIndex:c,previewAriaLabel:l})=>{let[u,d]=(0,n.useState)(null);(0,n.useEffect)(()=>{!e||!t||!a||f({src:e,light:t,oEmbedUrl:a})},[e,t,a]);let f=async({src:e,light:t,oEmbedUrl:r})=>{if(n.isValidElement(t))return;if(typeof t==`string`){d(t);return}if(i[e]){d(i[e]);return}d(null);let a=await(await fetch(r.replace(`{url}`,e))).json();if(a.thumbnail_url){let t=a.thumbnail_url.replace(`height=100`,`height=480`).replace(`-d_295x166`,`-d_640`);d(t),i[e]=t}},p=e=>{(e.key===`Enter`||e.key===` `)&&o?.(e)},m=e=>{o?.(e)},h=n.isValidElement(t),g={display:`flex`,alignItems:`center`,justifyContent:`center`},_={preview:{width:`100%`,height:`100%`,backgroundImage:u&&!h?`url(${u})`:void 0,backgroundSize:`cover`,backgroundPosition:`center`,cursor:`pointer`,...g},shadow:{background:`radial-gradient(rgb(0, 0, 0, 0.3), rgba(0, 0, 0, 0) 60%)`,borderRadius:r,width:r,height:r,position:h?`absolute`:void 0,...g},playIcon:{borderStyle:`solid`,borderWidth:`16px 0 16px 26px`,borderColor:`transparent transparent transparent white`,marginLeft:`7px`}},v=n.createElement(`div`,{style:_.shadow,className:`react-player__shadow`},n.createElement(`div`,{style:_.playIcon,className:`react-player__play-icon`}));return n.createElement(`div`,{style:_.preview,className:`react-player__preview`,tabIndex:c,onClick:m,onKeyPress:p,...l?{"aria-label":l}:{}},h?t:null,s||v)};export{a as default};