import{a as R}from"/build/_shared/chunk-PMXDGK5F.js";import{a as F}from"/build/_shared/chunk-XVO3VIZK.js";import{a as k}from"/build/_shared/chunk-FG3QFUQI.js";import{b}from"/build/_shared/chunk-LVS3CPUI.js";import{a as I}from"/build/_shared/chunk-FQ5GTBD3.js";import{a as D}from"/build/_shared/chunk-NWMLBIVY.js";import{a as d,b as m}from"/build/_shared/chunk-DXCI4MEV.js";import{a as _}from"/build/_shared/chunk-PGOH7JLP.js";import{a as y,d as L,g as T,j as N,l as P,r as w,w as c}from"/build/_shared/chunk-ZDVEJ5LT.js";import{c as s}from"/build/_shared/chunk-Q3IECNXJ.js";var U=s(_());var u=s(y());var g=s(y());var e=s(c());function f(t){let{_:n}=(0,g.useContext)(d),h=(0,g.useRef)(null),a=P(),i=b(a,500),p=()=>{};return(0,e.jsxs)("div",{style:{maxWidth:"800px"},className:"full",children:[(0,e.jsx)("h1",{className:"h2 m-b-l",children:n`Your favorite song, our AI's playlist magic. Discover similar tunes you'll love!`}),(0,e.jsxs)("div",{className:"m-b-m full center",children:[(0,e.jsxs)(N,{ref:h,method:"get",id:"songSearchForm",onChange:r=>{p(),i(r.currentTarget)},children:[(0,e.jsx)("label",{htmlFor:"songSearch",style:{display:"none"},children:n`Search for song`}),(0,e.jsxs)("div",{className:"async-search ",children:[(0,e.jsx)("input",{id:"songSearch",name:"song",autoComplete:"off",type:"text",placeholder:n`I want to find similar songs to`,defaultValue:t.searchTerm,className:"search input"}),(0,e.jsx)("div",{className:"decor loader",children:(0,e.jsx)("div",{className:`loadingReset ${t.isPending?"":"loadingHidden"}`})}),(0,e.jsxs)("label",{className:"decor icn-search",children:[(0,e.jsx)("svg",{children:(0,e.jsx)("use",{href:"/assets.svg#icn-search"})}),(0,e.jsx)("input",{type:"submit",className:"hidden",value:"Search"})]})]})]}),t.match.length?(0,e.jsxs)("ul",{className:"song-results left pad-m",children:[" ",t.match.map(r=>(0,e.jsx)("li",{className:"song",children:(0,e.jsxs)(m,{onClick:()=>t.itemClick(r),to:r.url,children:[(0,e.jsx)("span",{children:r.fullName}),(0,e.jsx)("svg",{className:"svg-icon",children:(0,e.jsx)("use",{href:"/assets.svg#icn-arrow-right"})})]})},r.id))," "]}):null]}),(0,e.jsx)("div",{children:t.searchTerm&&t.match.length===0?(0,e.jsx)("div",{className:"h3",children:n`No results found`}):null}),(0,e.jsx)("p",{className:"sec center",children:n`All lists are randomly generated. Better save it or you will miss it!`}),(0,e.jsx)("div",{className:"spacer two"}),(0,e.jsx)(R,{isPro:t.isPro,showButton:!0}),(0,e.jsx)("div",{className:"spacer two"})]})}var A=s(F());var S=s(D());var o=s(c());function X(){return[{rel:"preload",as:"image",href:"/assets/home-bg-small.webp",type:"image/webp"}]}function $(){let t=L(),n=T(),a=w()||{searchTerm:"",list:[],origin:"/",isLoggedIn:!1},{_:i}=(0,u.useContext)(d);(0,u.useEffect)(()=>{var l;a.searchTerm&&((l=window==null?void 0:window.gtag)==null||l.call(window,"event","search_started",{typed_song:a.searchTerm}))},[a.searchTerm]);let p=a.list,r=n.state==="loading",x=l=>{var v;(v=window==null?void 0:window.gtag)==null||v.call(window,"event","search",{song_title:l.track,artist:l.artists})},C=t.pathname.includes("/login-modal")?(0,o.jsx)(I,{origin:a.origin,searchTerm:a.searchTerm}):null;return(0,o.jsx)(k,{className:"front-page",modal:C,topBar:(0,o.jsxs)("div",{className:"",style:{display:"flex",alignItems:"stretch"},children:[(0,o.jsxs)(m,{to:a.isLoggedIn?"/profile":"/login-modal?song="+a.searchTerm,className:"button small sec",title:a.isLoggedIn?i`My Profile`:i`Login`,children:[(0,o.jsx)("svg",{children:(0,o.jsx)("use",{href:"/assets.svg#icn-profile"})}),(0,o.jsx)("span",{className:"loginText",children:a.isLoggedIn?i`My Profile`:i`Login`})]}),!a.isPro&&(0,o.jsxs)(m,{to:"/plans?source=index-offer",className:"button small sec",title:i`Limited offer`,style:{marginLeft:"8px"},children:[(0,o.jsx)("span",{style:{fontSize:"18px",fontWeight:"300",lineHeight:"12px"},children:"%"}),(0,o.jsx)("span",{className:"loginText",children:i`Limited offer`})]})]}),children:(0,o.jsx)(f,{isPending:r,itemClick:x,match:p,searchTerm:a.searchTerm,loggedIn:a.isLoggedIn,isPro:a.isPro})})}export{X as a,$ as b};
