1import{r as i,s as v,j as e,L as x,t as N,M as B,a6 as H,P as F,H as D,a7 as T}from"./index-BNrdOJig.js";import{S as $}from"./SiteNav-BcGgqsav.js";import{S as q}from"./SiteFooter-dnnZxriw.js";import{D as k}from"./drum-nhBEtyuZ.js";import{P as _}from"./plus-BewcIKll.js";import{A as R}from"./arrow-right-CRCU77cw.js";import{C as S}from"./crown-CPZs1SwB.js";import{F as V}from"./flame-DnNxxGET.js";import{S as I}from"./star-5Or_XEAT.js";import{T as O}from"./tag-Bcn_qsQe.js";import"./dropdown-menu-KsqIXfPg.js";import"./index-Dc9JXvma.js";import"./index-xFoOlCOp.js";import"./index-BgFHfwbL.js";import"./chevron-down-Bsk54EUt.js";import"./globe-BA4Wl8PS.js";import"./input-CwAqzCK4.js";import"./mail-Dg76bAst.js";const U=["Hip-Hop","R&B","Pop","Trap","Afrobeats","Latin","Electronic","Drill","Lo-Fi"],z=["Dark","Chill","Hype","Smooth","Sad","Bouncy"],l=["https://images.unsplash.com/photo-1598488035139-bdbb2231ce04?auto=format&fit=crop&w=600&q=80","https://images.unsplash.com/photo-1511671782779-c97d3d27a1d4?auto=format&fit=crop&w=600&q=80","https://images.unsplash.com/photo-1520523839897-bd0b52f945a0?auto=format&fit=crop&w=600&q=80","https://images.unsplash.com/photo-1493225457124-a3eb161ffa5f?auto=format&fit=crop&w=600&q=80","https://images.unsplash.com/photo-1485579149621-3123dd979885?auto=format&fit=crop&w=600&q=80","https://images.unsplash.com/photo-1471478331149-c72f17e33c73?auto=format&fit=crop&w=600&q=80"],P=[{id:"demo-b1",title:"Midnight Drill",cover_url:l[0],bpm:142,music_key:"F#m",price_cents:4999,genres:["Drill","Hip-Hop"],featured:!0},{id:"demo-b2",title:"Golden Hour",cover_url:l[1],bpm:88,music_key:"C",price_cents:2999,genres:["R&B","Lo-Fi"],featured:!1},{id:"demo-b3",title:"King Street",cover_url:l[2],bpm:140,music_key:"Am",price_cents:6999,genres:["Trap","Hip-Hop"],featured:!0},{id:"demo-b4",title:"Bailar",cover_url:l[3],bpm:102,music_key:"Em",price_cents:3999,genres:["Latin"],featured:!1},{id:"demo-b5",title:"After Hours",cover_url:l[4],bpm:124,music_key:"Gm",price_cents:5499,genres:["Electronic"],featured:!1},{id:"demo-b6",title:"Lagos Bounce",cover_url:l[5],bpm:108,music_key:"D",price_cents:4499,genres:["Afrobeats"],featured:!0}],G=[{name:"MP3 Lease",desc:"Mixed/mastered MP3, 10k streams",from:29},{name:"WAV Lease",desc:"WAV + trackouts, 50k streams",from:79},{name:"Unlimited Lease",desc:"Unlimited streams, no expiry",from:199},{name:"Exclusive",desc:"Beat removed from store, full rights",from:999}];function me(){const[m,L]=i.useState([]),[p,M]=i.useState({}),[c,f]=i.useState(""),[h,g]=i.useState(""),[A,b]=i.useState(!0),[y,n]=i.useState(null),j=i.useRef(null);i.useEffect(()=>{let r=!1;return(async()=>{b(!0);const{data:a}=await v.from("beats").select("id, title, cover_url, bpm, music_key, price_cents, genres, featured, producer_id").eq("status","published").order("featured",{ascending:!1}).order("created_at",{ascending:!1}).limit(60),t=a??[],s=Array.from(new Set(t.map(o=>o.producer_id).filter(Boolean)));let d={};if(s.length){const{data:o}=await v.from("profiles").select("id, display_name, handle, avatar_url").in("id",s);(o??[]).forEach(w=>{d[w.id]=w})}r||(M(d),L(t.length?[...t,...P]:P),b(!1))})(),()=>{r=!0}},[]);const u=i.useMemo(()=>m.filter(r=>!(c&&!(r.genres??[]).includes(c))),[m,c]),C=i.useMemo(()=>{const r=new Map;for(const t of m){const s=t.producer_id??null;if(!s)continue;const d=p[s]??{id:s,display_name:null,handle:null},o=r.get(s)??{producer:d,beats:0,featured:0};o.beats+=1,t.featured&&(o.featured+=1),r.set(s,o)}const a=Array.from(r.values()).sort((t,s)=>s.featured-t.featured||s.beats-t.beats).slice(0,6);return a.length>=3?a:[{producer:{id:"demo-p1",display_name:"Metro Drill",handle:"metrodrill",avatar_url:null},beats:24,featured:5},{producer:{id:"demo-p2",display_name:"808 Maven",handle:"808maven",avatar_url:null},beats:41,featured:8},{producer:{id:"demo-p3",display_name:"Lagos Pulse",handle:"lagospulse",avatar_url:null},beats:19,featured:3},{producer:{id:"demo-p4",display_name:"Crate Kid",handle:"cratekid",avatar_url:null},beats:33,featured:6},{producer:{id:"demo-p5",display_name:"Velour Keys",handle:"velourkeys",avatar_url:null},beats:12,featured:2},{producer:{id:"demo-p6",display_name:"Sunset Studio",handle:"sunsetstudio",avatar_url:null},beats:28,featured:4}]},[m,p]),E=r=>{const a=j.current;if(a){if(y===r.id){a.pause(),n(null);return}if(!r.audio_url){n(r.id),setTimeout(()=>n(t=>t===r.id?null:t),1500);return}a.src=r.audio_url,a.currentTime=0,a.play().then(()=>
1n(r.id)).catch(()=>n(null))}};return e.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[e.jsx($,{}),e.jsxs("main",{className:"pt-28 md:pt-32 pb-20",children:[e.jsxs("div",{className:"max-w-7xl mx-auto px-6 space-y-12",children:[e.jsx("section",{className:"relative overflow-hidden rounded-3xl border border-border bg-gradient-to-br from-orange-500/15 via-fuchsia-500/10 to-background p-8 md:p-12",children:e.jsxs("div",{className:"flex flex-col md:flex-row md:items-end md:justify-between gap-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"inline-flex items-center gap-2 text-primary text-[11px] font-bold uppercase tracking-wider mb-3",children:[e.jsx(k,{className:"w-3.5 h-3.5"})," Beats & Instrumentals Marketplace"]}),e.jsx("h1",{className:"font-display text-4xl md:text-5xl tracking-tight",children:"A storefront built for producers."}),e.jsx("p",{className:"text-sm text-muted-foreground mt-3 max-w-2xl",children:"Showcase your sound, your artwork, your prices. Artists worldwide browse, preview, and license â you keep 100% of every sale."})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs(x,{to:"/login/$role",params:{role:"producer"},search:{redirect:"/marketplace/upload"},className:"btn-gradient inline-flex items-center gap-2 px-5 py-2.5 rounded-full text-xs font-bold uppercase tracking-wider",children:[e.jsx(_,{className:"w-4 h-4"})," List your beat"]}),e.jsxs("a",{href:"#how-it-works",className:"inline-flex items-center gap-1.5 px-4 py-2.5 rounded-full text-xs font-bold uppercase tracking-wider border border-border hover:border-primary/50",children:["How it works ",e.jsx(R,{className:"w-3.5 h-3.5"})]})]})]})}),e.jsxs("section",{children:[e.jsxs("div",{className:"flex items-end justify-between mb-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"text-primary text-[11px] font-bold uppercase tracking-wider inline-flex items-center gap-2",children:[e.jsx(S,{className:"w-3.5 h-3.5"})," Producer Spotlight"]}),e.jsx("h2",{className:"font-display text-2xl md:text-3xl tracking-tight",children:"Top producers on the platform"})]}),e.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:"Curated weekly"})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:C.map((r,a)=>{const t=r.producer,s=(t.display_name??t.handle??"P").slice(0,2).toUpperCase();return e.jsxs("div",{className:"rounded-2xl border border-border bg-card/60 p-4 hover:border-primary/50 transition",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-gradient-to-br from-orange-500 to-fuchsia-500 flex items-center justify-center text-white text-sm font-extrabold overflow-hidden",children:t.avatar_url?e.jsx("img",{src:N(t.avatar_url,960),alt:t.display_name??"",className:"w-full h-full object-cover",loading:"lazy",decoding:"async"}):s}),a===0&&e.jsx("span",{className:"absolute -top-1 -right-1 w-5 h-5 rounded-full bg-primary text-primary-foreground text-[10px] font-black flex items-center justify-center",children:e.jsx(S,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-bold truncate",children:t.display_name??t.handle??"Producer"}),e.jsxs("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:[r.beats," beats · ",r.featured," featured"]})]})]}),e.jsx("button",{type:"button",className:"mt-3 w-full rounded-full border border-border hover:border-primary text-[11px] font-bold uppercase tracking-wider py-1.5",children:"View storefront"})]},t.id)})})]}),e.jsxs("section",{children:[e.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[e.jsx("button",{onClick:()=>f(""),className:`px-4 py-2 rounded-full text-xs font-bold uppercase tracking-wider border ${c?"border-border":"bg-primary/15 border-primary/40 text-primary"}`,children:"All genres"}),U.map(r=>e.jsx("button",{onClick:()=>f(r),className:`px-4 py-2 rounded-full text-xs font-bold uppercase tracking-wider border ${c===r?"bg-primary/15 border-primary/40 text-primary":"border-border"}`,children:r},r))]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("span",{className:"px-2 py-2 text-[11px] uppercase tracking-wider text-muted-foreground",children:"Mood:"}),e.jsx("button",{onClick:()=>g(""),className:`px-3 py-1.5 rounded-full text-[11px] font-bold uppercase tracking-wider border ${h?"border-border":"bg-primary/15 border-primary/40 text-primary"}`,children:"Any"}),z.map(r=>e.jsx("button",{onClick:()=>g(r),className:`px-3 py-1.5 rounded-full text-[11px] font-bold uppercase tracking-wider border ${h===r?"bg-primary/15 border-primary/40 text-primary":"border-border"}`,children:r},r))]})]}),e.jsxs("section",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"font-display text-2xl md:text-3xl tracking-tight inline-flex items-center gap-2",children:[e.jsx(V,{className:"w-5 h-5 text-orange-500"})," Fresh in the marketplace"]}),e.jsxs("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:[u.length," beats"]})]}),A?e.jsx("div",{className:"rounded-3xl border border-border bg-card p-16 text-center text-muted-foreground",children:"Loading beatsâ¦"}):u.length===0?e.jsxs("div",{className:"rounded-3xl border border-border bg-card p-16 text-center text-muted-foreground",children:[e.jsx(B,{className:"w-12 h-12 mx-auto mb-3 opacity-40"}),"No beats match those filters yet."]}):e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:u.map(r=>{const a=r.producer_id?p[r.producer_id]:null,t=r.cover_url??l[Math.abs(r.id.charCo
1deAt(0)??0)%l.length],s=y===r.id;return e.jsxs("div",{className:"group rounded-2xl border border-border bg-card overflow-hidden hover:border-primary/50 transition relative flex flex-col",children:[e.jsxs("div",{className:"aspect-square bg-secondary overflow-hidden relative",children:[e.jsx("img",{decoding:"async",src:N(t,960),alt:r.title,loading:"lazy",className:"w-full h-full object-cover transition group-hover:scale-105"}),r.featured&&e.jsxs("span",{className:"absolute top-2 left-2 z-10 inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[9px] font-bold uppercase tracking-wider bg-primary text-primary-foreground",children:[e.jsx(I,{className:"w-2.5 h-2.5 fill-current"})," Featured"]}),r.price_cents!=null&&e.jsxs("span",{className:"absolute top-2 right-2 z-10 px-2 py-0.5 rounded-full text-[10px] font-bold bg-background/80 backdrop-blur border border-border",children:["$",(r.price_cents/100).toFixed(0)]}),e.jsx("button",{type:"button",onClick:()=>E(r),"aria-label":s?"Pause preview":"Play preview",className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition bg-black/40",children:e.jsx("span",{className:"w-14 h-14 rounded-full bg-orange-500 flex items-center justify-center shadow-xl",children:s?e.jsx(H,{className:"w-5 h-5 fill-white text-white"}):e.jsx(F,{className:"w-5 h-5 fill-white text-white ml-0.5"})})})]}),e.jsxs("div",{className:"p-3 flex-1 flex flex-col gap-1.5",children:[e.jsx("div",{className:"font-bold truncate",children:r.title}),e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:a?.display_name??a?.handle??"MO Streams Producer"}),e.jsxs("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground inline-flex items-center gap-1",children:[e.jsx(D,{className:"w-3 h-3"}),r.bpm?`${r.bpm} BPM`:"â",r.music_key?` · ${r.music_key}`:""]}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:(r.genres??[]).slice(0,2).map(d=>e.jsx("span",{className:"px-1.5 py-0.5 rounded-full text-[9px] font-bold uppercase tracking-wider bg-secondary text-muted-foreground",children:d},d))}),e.jsxs(x,{to:"/marketplace/$id",params:{id:r.id},className:"mt-2 inline-flex items-center justify-center gap-1 rounded-full bg-primary/15 text-primary text-[11px] font-bold uppercase tracking-wider py-1.5 hover:bg-primary hover:text-primary-foreground transition",children:[e.jsx(O,{className:"w-3 h-3"})," View licenses"]})]})]},r.id)})})]}),e.jsxs("section",{id:"how-it-works",children:[e.jsx("div",{className:"flex items-end justify-between mb-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"text-primary text-[11px] font-bold uppercase tracking-wider inline-flex items-center gap-2",children:[e.jsx(T,{className:"w-3.5 h-3.5"})," Standard License Tiers"]}),e.jsx("h2",{className:"font-display text-2xl md:text-3xl tracking-tight",children:"Every producer ships these by default"})]})}),e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-4 gap-3",children:G.map(r=>e.jsxs("div",{className:"rounded-2xl border border-border bg-card/60 p-4",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:"License"}),e.jsx("div",{className:"font-display text-xl mt-1",children:r.name}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:r.desc}),e.jsxs("div",{className:"mt-3 text-sm font-bold text-primary",children:["From $",r.from]})]},r.name))})]}),e.jsxs("section",{className:"rounded-3xl border border-border bg-gradient-to-r from-primary/10 via-fuchsia-500/5 to-background p-8 md:p-10 text-center",children:[e.jsx(k,{className:"w-10 h-10 text-primary mx-auto mb-3"}),e.jsx("h2",{className:"font-display text-2xl md:text-3xl tracking-tight",children:"Producers â claim your storefront"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2 max-w-xl mx-auto",children:"Upload your beats, set lease & exclusive prices, get featured in Producer Spotlight."}),e.jsxs(x,{to:"/signup",search:{role:"producer"},className:"btn-gradient inline-flex items-center gap-2 px-6 py-3 rounded-full text-xs font-bold uppercase tracking-wider mt-5",children:[e.jsx(_,{className:"w-4 h-4"})," Start 7-day free trial"]}),e.jsx("div",{className:"text-[11px] uppercase tracking-wider text-muted-foreground mt-3",children:"No card required · Cancel anytime"})]})]}),e.jsx("audio",{ref:j,preload:"metadata",onEnded:()=>n(null),className:"hidden"})]}),e.jsx(q,{})]})}
1export{me as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.