1import{j as e}from"./vendor-query-CtIF-MNZ.js";import{i as $,r}from"./vendor-react-BfTl68nP.js";import{s as q,B as I,S as C}from"./index-BfEqxQPi.js";import{S as D}from"./shimmer-image-DO136dW3.js";import{b as J,x as M,D as H,E as Y}from"./vendor-icons-hHTr3Gms.js";import"./vendor-radix-q0rzatl0.js";const l=["sneakers","skincare","furniture","fashion","electronics","jewelry"],K={sneakers:["footwear","sneakers","shoes","fashion"],skincare:["skincare","beauty","cosmetics"],furniture:["furniture","home","interior","lifestyle"],fashion:["fashion","clothing","apparel","lifestyle"],electronics:["electronics","tech","gadgets"],jewelry:["jewelry","accessories","luxury"]},Q={idle:"",scraping:"Scanning websiteâ¦",extracting:"Finding productsâ¦",generating:"Creating product shotsâ¦",done:"Done!",error:"Something went wrong"};function ae(){const{domain:P}=$(),[j,R]=r.useState(P||""),[i,c]=r.useState("idle"),[v,w]=r.useState([]),[N,b]=r.useState(""),[d,O]=r.useState(0),[m,W]=r.useState(""),[h,k]=r.useState(!1),[S,T]=r.useState(0),y=r.useRef(),[o,F]=r.useState([]),[_,V]=r.useState(!0);r.useEffect(()=>{q.from("discover_presets").select("id, title, image_url, category, discover_categories").order("sort_order",{ascending:!0}).limit(40).then(({data:t})=>{F(t??[]),V(!1)})},[]);const z=r.useMemo(()=>o.length?l.map(t=>{var u;const s=K[t]||[],a=o.find(x=>{var n;return((n=x.discover_categories)==null?void 0:n.some(L=>s.includes(L.toLowerCase())))||s.includes(x.category.toLowerCase())});return(a==null?void 0:a.image_url)||((u=o[l.indexOf(t)%o.length])==null?void 0:u.image_url)||""}):l.map(()=>""),[o]),B=r.useMemo(()=>{if(!o.length)return[];const t=["Beauty","Sneakers","Electronics","Skincare","Home & Living","Jewelry"],s={Beauty:["beauty","cosmetics","skincare"],Sneakers:["footwear","sneakers","shoes","fashion"],Electronics:["electronics","tech","gadgets"],Skincare:["skincare","beauty","cosmetics"],"Home & Living":["home","furniture","interior","lifestyle"],Jewelry:["jewelry","accessories","luxury"]},a=new Set;return t.map((u,x)=>{const n=s[u]||[],p=o.find(f=>{var A;return!a.has(f.id)&&(((A=f.discover_categories)==null?void 0:A.some(U=>n.includes(U.toLowerCase())))||n.includes(f.category.toLowerCase()))})||o.filter(f=>!a.has(f.id))[0];return p&&a.add(p.id),{label:u,image:(p==null?void 0:p.image_url)||""}})}
1,[o]);r.useEffect(()=>{const t=l[d];if(!h&&m===t)return y.current=setTimeout(()=>k(!0),2e3),()=>clearTimeout(y.current);if(h&&m===""){k(!1),O(a=>(a+1)%l.length);return}const s=h?40:80;return y.current=setTimeout(()=>{W(h?t.slice(0,m.length-1):t.slice(0,m.length+1))},s),()=>clearTimeout(y.current)},[m,h,d]);const G=l[d].length*120+2e3;r.useEffect(()=>{T(0);const t=requestAnimationFrame(()=>{requestAnimationFrame(()=>T(100))});return()=>cancelAnimationFrame(t)},[d]);const E=async()=>{const t=j.trim().replace(/^https?:\/\//,"").replace(/\/.*$/,"");if(!t||!t.includes(".")){b("Please enter a valid domain like nike.com");return}b(""),w([]),c("scraping");try{const s=setTimeout(()=>c("extracting"),3e3),a=setTimeout(()=>c("generating"),7e3),x=await fetch("https://azwiljtrbtaupofwmpzb.supabase.co/functions/v1/try-website-shot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:t})});clearTimeout(s),clearTimeout(a);const n=await x.json();if(!x.ok||!n.success){c("error"),b(n.error||"Failed to generate. Please try again.");return}w(n.results||[]),c("done")}catch(s){console.error("TryShot error:",s),c("error"),b("Network error. Please try again.")}},g=i==="scraping"||i==="extracting"||i==="generating";return e.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[e.jsxs("nav",{className:"flex items-center justify-between px-6 py-4 max-w-5xl mx-auto",children:[e.jsx("a",{href:"https://vovv.ai",className:"text-xl font-bold tracking-tight text-foreground",children:"VOVV.AI"}),e.jsx("a",{href:"https://vovv.ai/auth",children:e.jsx(I,{size:"sm",className:"bg-foreground text-background hover:bg-foreground
1/90 px-5 text-xs font-semibold",children:"Get Started Free"})})]}),e.jsxs("main",{className:"max-w-3xl mx-auto px-6 pb-12 text-center flex flex-col items-center justify-center min-h-[calc(100vh-64px)]",children:[e.jsxs("h1",{className:"text-4xl sm:text-5xl md:text-[3.5rem] font-bold tracking-tight leading-[1.1] mb-6 text-foreground",children:["Product shots",e.jsx("br",{}),"for"," ",e.jsxs("span",{className:"font-bold",style:{color:"hsl(217, 60%, 35%)"},children:[m,e.jsx("span",{className:"animate-pulse",children:"|"})]})]}),e.jsx("div",{className:"flex flex-col items-center mb-6",children:e.jsxs("div",{className:"relative w-44 sm:w-52 aspect-[3/4] rounded-2xl overflow-hidden shadow-xl ring-2 ring-primary/10",children:[_?e.jsx(C,{className:"w-full h-full"}):z.map((t,s)=>e.jsx(D,{src:t,alt:`${l[s]} product shot`,className:"absolute inset-0 w-full h-full object-cover",wrapperClassName:"absolute inset-0",style:{opacity:s===d?1:0,transition:"opacity 700ms ease-in-out"}},s)),e.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-1 bg-black/20 z-10",children:e.jsx("div",{className:"h-full bg-white/80 rounded-r-full",style:{width:`${S}%`,transition:S===0?"none":`width ${G}ms cubic-bezier(0.4, 0, 0.2, 1)`}},d)})]})}),e.jsx("p",{className:"text-base text-muted-foreground max-w-md mx-auto mb-5",children:"Enter your online store URL to create AI product shots"}),e.jsx("div",{className:"max-w-lg mx-auto mb-3",children:e.jsxs("div",{className:"relative flex items-center bg-secondary rounded-full border border-border overflow-hidden",children:[e.jsx("input",{type:"text",placeholder:"Enter online store URL",value:j,onChange:t=>R(t.target.value),onKeyDown:t=>t.key==="Enter"&&!g&&E(),disabled:g,className:"flex-1 h-14 pl-6 pr-4 bg-transparent text-foreground placeholder:text-muted-foreground text-base outline-none"}),e.jsx("button",{onClick:E,disabled:g||!j.trim(),className:"flex-shrink-0 w-11 h-11 mr-1.5 rounded-full bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-40 transition-colors flex items-center justify-center",children:g?e.jsx(J,{className:"w-4 h-4 animate-spin"}):e.jsx(M,{className:"w-4 h-4"})})]})}),e.jsx("p",{className:"text-[11px] text-muted-foreground/50 mt-1 mb-2",children:"Free · No sign-up required"}),N&&e.jsx("p",{className:"text-sm text-destructive mt-2",children:N}),g&&e.jsxs("div",{className:"mt-10 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-center gap-3",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-primary animate-pulse"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:Q[i]})]}),e.jsx("div",{className:"w-48 mx-auto h-1 bg-secondary rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary rounded-full transition-all duration-1000 ease-out",style:{width:i==="scraping"?"30%":i==="extracting"?"60%":"85%"}})})]}),i==="done"&&v.length>0&&e.jsxs("div",{className:"mt-14 space-y-8",children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Your product shots"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-5",children:v.map((t,s)=>e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-card border border-border",children:[e.jsxs("div",{className:"aspect-square relative group",children:[e.jsx("img",{src:t.generated_image,alt:t.product_name,className:"w-full h-full object-cover"}),e.jsx("a",{href:t.generated_image,download:!0,target:"_blank",rel:"noopener noreferrer",className:"absolute bottom-3 right-3 p-2 rounded-lg bg-black/60 backdrop-blur-sm opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(H,{className:"w-4 h-4 text-white"})})]}),e.jsx("div",{className:"px-4 py-3",children:e.jsx("p",{className:"text-sm font-medium truncate",children:t.product_name})})]},s))}),e.jsxs("div",{className:"pt-8 border-t border-border",children:[e.jsxs("p",{className:"text-muted-foreground mb-4",children:["Want more? Get ",e.jsx("span",{className:"text-foreground font-semibold",children:"20 free credits"})," when you sign up."]}),e.jsx("a",{href:"https://vovv.ai/auth",children:e.jsxs(I,{className:"bg-primary text-primary-foreground hover:bg-primary/90 font-semibold",children:["Start creating for free",e.jsx(Y,{className:"w-4 h-4 ml-2"})]})})]})]}),i==="done"&&v.length===0&&e.jsx("div",{className:"mt-12 text-muted-foreground",children:e.jsx("p",{children:"We couldn't find any product images on this site. Try a different store URL."})})]}),e.jsxs("section",{className:"max-w-5xl mx-auto px-6 py-16",children:[e.jsx("h2",{className:"text-2xl sm:text-3xl font-bold tracking-tight text-center mb-3",children:"Works with most products"}),e.jsx("div",{className:"w-12 h-0.5 bg-primary mx-auto mb-10"}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:_?Array.from({length:6}).map((t,s)=>e.jsx(C,{className:"rounded-2xl aspect-[3/4]"},s)):B.map(t=>e.jsxs("div",{className:"group relative rounded-2xl overflow-hidden aspect-[3/4]",children:[e.jsx(D,{src:t.image,alt:t.label,className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-105",aspectRatio:"3/4"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/40 via-trans
1parent to-transparent"}),e.jsx("span",{className:"absolute bottom-3 left-3 bg-primary text-primary-foreground text-xs font-medium px-3 py-1 rounded-full",children:t.label})]},t.label))})]}),e.jsxs("footer",{className:"text-center py-8 text-xs text-muted-foreground/60",children:["Powered by"," ",e.jsx("a",{href:"https://vovv.ai",className:"text-primary hover:text-primary/80 transition-colors font-medium",children:"VOVV.AI"})," ","· AI product photography"]})]})}export{ae as default};
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.