import{r as m,j as a}from"./vendor-CT-JknSv.chunk.js";import{aA as h,u as V,cK as F,cL as P,cM as y,cN as I,cO as A}from"./index-DDZqnj79.js";import{I as L,F as E,Y as x}from"./Placards-BcYZqK06.chunk.js";import{V as M,r as k,s as R}from"./NebulaLessonPlayer-C2l8O21i.chunk.js";function C({video:e,children:l,className:t}){const{user:i,isInitialLoading:u}=h(),o=V(),s=i==null?void 0:i.is_subscribed,c=F(),[r,n]=P("freeVideoFriendlySlug",{listen:!0}),d=m.useCallback(()=>{n(e.slug)},[n,e.slug]),b=!r,g=r===e.slug,f=y(e),p=I(e),S=g;return u?a(M,{thumbnail:e.images.thumbnail,title:e.title,isProxy:!0,className:t}):s||p||S?a("div",{css:{position:"relative"},className:t,children:l}):o?a(L,{thumbnail:e.images.thumbnail,title:e.title,duration:e.duration,className:t}):b&&f&&!c?a(E,{thumbnail:e.images.thumbnail,title:e.title,duration:e.duration,redeemFreeSampleOnVideo:d,className:t}):a(x,{thumbnail:e.images.thumbnail,title:e.title,duration:e.duration,className:t})}function O({video:e,store:l,className:t,customManifestURL:i}){const{manifestURL:u}=k({id:e.id,type:"video_episode",enabled:!i}),o=i||u,{saveVideoProgress:s}=A({id:e.id}),c=m.useMemo(()=>{if(e)return{title:e.title,thumbnail:e.images.thumbnail,trackIdentifier:e.id,artist:e.channel_title}},[e]),r=m.useCallback(n=>{s({progress:n})},[e.id,s]);return a(R,{manifestURL:o,video:e,autoPlay:!0,store:l,mediaSessionMetadata:c,onProgress:r,className:t})}export{O as N,C as V};