import{r as n,j as e}from"./index-DEjMkqlI.js";import{u,S as m,a as x}from"./useDynamicSeo-B7hRU84W.js";import{s as f}from"./client-DXODAVLv.js";import{P as d}from"./play-DpYafbZr.js";import{X as h}from"./x--GkJcARo.js";import"./createLucideIcon-DqYrWYDW.js";function p(s,r){if(r==="youtube"){const l=s.match(/(?:youtu\.be\/|youtube\.com\/(?:watch\?v=|embed\/|shorts\/))([\w-]+)/);if(l)return`https://www.youtube.com/embed/${l[1]}?autoplay=1`}if(r==="vimeo"){const l=s.match(/vimeo\.com\/(\d+)/);if(l)return`https://player.vimeo.com/video/${l[1]}?autoplay=1`}return s}function i(s){if(s.thumbnail_url)return s.thumbnail_url;if(s.video_type==="youtube"){const r=s.video_url.match(/(?:youtu\.be\/|youtube\.com\/(?:watch\?v=|embed\/|shorts\/))([\w-]+)/);if(r)return`https://i.ytimg.com/vi/${r[1]}/maxresdefault.jpg`}return null}function N(){u("/luxxen-tv");const[s,r]=n.useState([]),[l,a]=n.useState(null);n.useEffect(()=>{f.from("tv_releases").select("*").eq("published",!0).order("featured",{ascending:!1}).order("release_date",{ascending:!1,nullsFirst:!1}).then(({data:t})=>r(t??[]))},[]);const o=s.find(t=>t.featured)??s[0],c=o?s.filter(t=>t.id!==o.id):[];return e.jsxs(m,{children:[e.jsx("section",{className:"py-20 md:py-28",children:e.jsxs("div",{className:"container mx-auto px-5 md:px-10",children:[e.jsx(x,{eyebrow:"Luxxen TV",title:e.jsxs(e.Fragment,{children:["Originals, releases & ",e.jsx("span",{className:"italic text-gradient-gold",children:"behind the lens."})]}),description:"Press play. Our in-house channel features short films, branded content and the stories behind our productions."}),!o&&e.jsx("div",{className:"py-32 text-center text-muted-foreground",children:"New releases dropping soon. Stay tuned."}),o&&e.jsxs("button",{onClick:()=>a(o),className:"block w-full mt-16 group relative aspect-video overflow-hidden bg-onyx hover-lift",children:[i(o)?e.jsx("img",{src:i(o),alt:o.title,className:"w-full h-full object-cover transition-transform duration-700 group-hover:scale-105"}):e.jsx("div",{className:"w-full h-full bg-gradient-to-br from-onyx to-background"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-background via-background/40 to-transparent"}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"w-20 h-20 md:w-24 md:h-24 rounded-full bg-gold/90 backdrop-blur flex items-center justify-center group-hover:scale-110 transition-transform duration-500 shadow-gold",children:e.jsx(d,{className:"w-8 h-8 md:w-10 md:h-10 text-primary-foreground ml-1",fill:"currentColor"})})}),e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-6 md:p-10 text-left",children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-gold mb-2",children:"Featured Release"}),e.jsx("h3",{className:"font-display text-3xl md:text-5xl text-foreground",children:o.title}),o.description&&e.jsx("p",{className:"mt-3 text-muted-foreground max-w-2xl line-clamp-2",children:o.description})]})]}),c.length>0&&e.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6 mt-12",children:c.map(t=>e.jsxs("button",{onClick:()=>a(t),className:"group text-left",children:[e.jsxs("div",{className:"relative aspect-video overflow-hidden bg-onyx hover-lift",children:[i(t)?e.jsx("img",{src:i(t),alt:t.title,className:"w-full h-full object-cover transition-transform duration-700 group-hover:scale-105",loading:"lazy"}):e.jsx("div",{className:"w-full h-full bg-gradient-to-br from-onyx to-background"}),e.jsx("div",{className:"absolute inset-0 bg-background/30 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:e.jsx(d,{className:"w-12 h-12 text-gold",fill:"currentColor"})})]}),e.jsx("h3",{className:"font-display text-xl mt-4 text-foreground group-hover:text-gold transition-colors",children:t.title}),t.release_date&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:new Date(t.release_date).toLocaleDateString("en-US",{month:"long",year:"numeric"})})]},t.id))})]})}),l&&e.jsxs("div",{className:"fixed inset-0 z-[60] bg-background/95 backdrop-blur-md flex items-center justify-center p-4",onClick:()=>a(null),children:[e.jsx("button",{className:"absolute top-6 right-6 w-10 h-10 border border-border hover:border-gold text-foreground flex items-center justify-center",onClick:()=>a(null),"aria-label":"Close",children:e.jsx(h,{})}),e.jsx("div",{className:"w-full max-w-6xl aspect-video bg-onyx",onClick:t=>t.stopPropagation(),children:l.video_type==="uploaded"?e.jsx("video",{src:l.video_url,controls:!0,autoPlay:!0,className:"w-full h-full"}):e.jsx("iframe",{src:p(l.video_url,l.video_type),title:l.title,allow:"autoplay; encrypted-media; fullscreen",allowFullScreen:!0,className:"w-full h-full"})})]})]})}export{N as component};
