1import{o as wt,r as i,j as e,e as kt,a1 as At,ad as Ct,a3 as Ye,m as z,a5 as Pe,a4 as Be,h as H,ar as y,g as J,S as $e,aD as St,v as O,q as It,H as _t,I as Dt,J as Pt,K as Bt,aX as $t,aY as Lt,b as Ft,at as Mt,c as Rt,p as Et,u as zt,aZ as Ut,a_ as Ot,a$ as X,aW as He,d as he,O as ke,b0 as Je,aJ as Tt,a6 as Gt,aL as Wt,b1 as qt,b2 as fe,A as Vt,b3 as Xt,b4 as Ae,b5 as Yt,b6 as Ht}from"./index-CW9Dj55B.js";import{P as Jt}from"./progress-ZMF6FVlc.js";import{l as Kt,c as Zt,s as Ke,B as Qt}from"./brandEnrichment-Hv3cs-u_.js";import{V as es,a as ts,P as ss,A as as,e as rs}from"./VisualRefCard-_KpxnmOn.js";import{C as ns}from"./camera-H4-kIqK0.js";import{B as os}from"./badge-check-C-XbuyiY.js";import{B as is}from"./BrandOnboardingModal-Cs50hKcX.js";import{P as Ze}from"./PageShell-_sqgJEcM.js";import{a as ge}from"./analyze-DafUVQJp.js";import{B as Ce}from"./badge-DsSXgOBc.js";import{I as Se}from"./image-y0zrxBPz.js";import"./tabs-DBViU-M1.js";import"./copy-CS4Oykk4.js";import"./user-C6GJmAfZ.js";import"./scroll-area-uHBd8Nt8.js";import"./index-C72kjZqa.js";import"./type-BppUD2vV.js";import"./search-DzW7S8HI.js";import"./trending-down-Cg-ZWafh.js";import"./heart-BHfkI6s-.js";import"./trending-up-Bnv_SKzn.js";import"./megaphone-DV76tGkZ.js";import"./quote-CAL9R1ZV.js";import"./image-plus-CxBh3MJb.js";import"./upload-B0s5MGtB.js";import"./breadcrumb-C0nepQh3.js";import"./generationQueue-C08xjit7.js";import"./invokeFunction-DvzDsR8D.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const ls=wt("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);let cs=0;const nt=i.forwardRef(({className:r,primaryColor:c,secondaryColor:a,style:C,...v},w)=>{const S=i.useMemo(()=>`gooey-loader-filter-${cs++}`,[]),s={"--gooey-a":c||"hsl(var(--primary))","--gooey-b":a||"hsl(var(--primary-glow))",...C};return e.jsxs("div",{ref:w,className:kt("relative flex h-44 w-44 items-center justify-center",r),style:s,role:"status","aria-label":"Loading",...v,children:[e.jsx("div",{className:"gooey-glow absolute h-36 w-36 rounded-full blur-3xl",style:{background:"var(--gooey-a)",opacity:.08}}),e.jsx("svg",{"aria-hidden":!0,className:"absolute h-0 w-0",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("defs",{children:e.jsxs("filter",{id:S,children:[e.jsx("feGaussianBlur",{in:"SourceGraphic",stdDeviation:"11",result:"blur"}),e.jsx("feColorMatrix",{in:"blur",mode:"matrix",values:"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 19 -9",result:"goo"}),e.jsx("feComposite",{in:"SourceGraphic",in2:"goo",operator:"atop"})]})})}),e.jsx("style",{children:` 7 @keyframes gooey-pulse { 8 0%, 100% { transform: scale(1); } 9 50% { transform: scale(1.12); } 10 } 11 @keyframes gooey-orbit-1 { 12 0% { transform: rotate(0deg) translateX(34px) rotate(0deg); } 13 100% { transform: rotate(360deg) translateX(34px) rotate(-360deg); } 14 } 15 @keyframes gooey-orbit-2 { 16 0% { transform: rotate(120deg) translateX(44px) rotate(-120deg); } 17 100% { transform: rotate(480deg) translateX(44px) rotate(-480deg); } 18 } 19 @keyframes gooey-orbit-3 { 20 0% { transform: rotate(240deg) translateX(38px) rotate(-240deg); } 21 50% { transform: rotate(420deg) translateX(16px) rotate(-420deg); } 22 100% { transform: rotate(600deg) translateX(38px) rotate(-600deg); } 23 } 24 @media (prefers-reduced-motion: reduce) { 25 .gooey-blob, .gooey-glow { animation: none !important; } 26 } 27 `}),e.jsxs("div",{className:"absolute inset-0 flex items-center justify-center overflow-hidden",style:{filter:`url(#${S})`},children:[e.jsx("span",{className:"gooey-blob h-16 w-16 rounded-full",style:{background:"var(--gooey-a)",animation:"gooey-pulse 4s ease-in-out infinite"}}),e.jsx("span",{className:"gooey-blob absolute h-11 w-11 rounded-full",style:{background:"var(--gooey-b)",animation:"gooey-orbit-1 6s cubic-bezier(0.4,0,0.2,1) infinite"}}),e.jsx("span",{className:"gooey-blob absolute h-9 w-9 rounded-full",style:{background:"var(--gooey-a)",animation:"gooey-orbit-2 5s cubic-bezier(0.4,0,0.2,1) infinite"}}),e.jsx("span",{className:"gooey-blob absolute h-7 w-7 rounded-full",style:{background:"var(--gooey-b)",opacity:.7,animation:"gooey-orbit-3 4.5s ease-in-out infinite"}})]})]})});nt.displayName="GooeyLoader";const Qe=[{label:"Scraping website",threshold:30},{label:"Extracting brand voice",threshold:60},{label:"Identifying key themes",threshold:90},{label:"Finalizing analysis",threshold:100}],et=["Sniffing your homepage for vibesâ¦","Decoding your color paletteâ¦","Listening to your brandâs tone of voiceâ¦","Untangling your value propositionâ¦","Asking the AI nicely to focusâ¦","Reading between the linesâ¦","Memorising your hero headlineâ¦","Looking for your target audienceâ¦","Brewing your Brand DNA ââ¦","Polishing the first impressionâ¦","Tasting your taglineâ¦","Mapping your messaging pillarsâ¦","Whispering to the algorithmâ¦","Cross-referencing competitorsâ¦","Sketching your brand mood boardâ¦","Negotiating with the copywriter botâ¦","Fact: consistent branding can lift revenue by up to 23%.","Fact: color improves brand recognition by up to 80%.","Fact: it takes ~50ms for visitors to form an opinion of your site.","Fact: 88% of people trust a brand with a clear, human voice.","Fact: a strong tagline is recalled 2à longer than a logo alone.","Fact: 64% of people cite shared values as their main reason to trust a brand.","Fact: signature brand colors boost recall faster than words.","Fact: brands with a defined personality see higher engagement.","Fact: clarity beats cleverness â simple messaging converts better.","Fact: 46% of consumers will pay more for brands they trust.","Fact: emotional connection drives more loyalty than satisfaction.","Fact: the best taglines are usually under 5 words.","Fact: repeated brand exposure builds familiarity â and trust.","Fact: a consistent tone of voice makes content 33% more memorable.","Tip: y
27our âAboutâ page often reveals your truest brand voice.","Tip: the words you repeat most are your real brand pillars."];function tt(r){const c=[...r];for(let a=c.length-1;a>0;a--){const C=Math.floor(Math.random()*(a+1));[c[a],c[C]]=[c[C],c[a]]}return c}function ds(r){const c=Math.floor(r/60),a=r%60;return`${c}:${a.toString().padStart(2,"0")}`}function us(r){if(!r)return null;try{const c=r.startsWith("http")?r:`https://${r}`;return new URL(c).host.replace(/^www\./,"")}catch{return r}}function ms({progress:r,brandUrl:c,preview:a,onCancel:C}){const v=At(),w=us(c),S=!!(a!=null&&a.screenshot),s=((a==null?void 0:a.colors)||[]).filter(o=>o==null?void 0:o.hex).slice(0,5),P=i.useRef(tt(et)),[b,N]=i.useState(0);i.useEffect(()=>{if(v)return;const o=setInterval(()=>{N(M=>{const B=M+1;return B>=P.current.length?(P.current=tt(et),0):B})},3200);return()=>clearInterval(o)},[v]);const U=P.current[b],[_,g]=i.useState(0);i.useEffect(()=>{const o=Date.now(),M=setInterval(()=>g(Math.floor((Date.now()-o)/1e3)),1e3);return()=>clearInterval(M)},[]);const T=i.useMemo(()=>_>90?"Big site! Still working â you can safely keep this tab open.":_>45?"Taking a little longer than usual â hang tight, weâre being thorough.":"Our AI is processing your visual identity. Takes about 20â40 seconds.",[_]);return e.jsx("div",{className:"flex w-full justify-center animate-fade-in py-4",children:e.jsxs("div",{className:"relative w-full max-w-5xl overflow-hidden rounded-[32px] border border-border/60 bg-card shadow-[0_12px_40px_-12px_hsl(var(--foreground)/0.12)]",children:[e.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:"radial-gradient(hsl(var(--foreground)) 1.5px, transparent 0)",backgroundSize:"24px 24px"}}),e.jsxs("div",{className:"relative flex flex-col md:flex-row",children:[e.jsxs("div",{className:"relative flex flex-col items-center justify-center gap-8 border-b border-border/60 bg-background/40 px-8 py-12 md:w-1/2 md:border-b-0 md:border-r md:px-12 md:py-16",children:[w&&e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-primary/15 bg-primary/10 px-4 py-1.5",children:[e.jsx(Ct,{className:"h-3.5 w-3.5 text-primary"}),e.jsx("span",{className:"max-w-[240px] truncate text-micro font-bold uppercase tracking-widest text-primary",children:w})]}),e.jsxs("div",{className:"relative w-full pb-8",children:[e.jsx(Ye,{mode:"wait",children:S?e.jsxs(z.div,{initial:v?!1:{opacity:0,y:10,scale:.97},animate:{opacity:1,y:0,scale:1},transition:{duration:.5,ease:"easeOut"},className:"relative aspect-video w-full overflow-hidden rounded-2xl border border-primary/20 bg-card shadow-[0_0_44px_-10px_hsl(var(--primary)/0.35)]",children:[e.jsx("img",{src:a.screenshot,alt:`${w||"Website"} homepage`,className:"h-full w-full object-cover object-top",loading:"eager"}),e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-t from-foreground
27/25 to-transparent"})]},"shot"):e.jsxs("div",{className:"relative flex aspect-video w-full items-center justify-center overflow-hidden rounded-2xl border border-border/60 bg-card/60",children:[e.jsx(z.span,{"aria-hidden":!0,className:"absolute h-40 w-40 rounded-full border border-teal/20",animate:v?void 0:{scale:[1,1.12,1],opacity:[.5,.9,.5]},transition:{duration:3.2,repeat:1/0,ease:"easeInOut"}}),e.jsx(z.span,{"aria-hidden":!0,className:"absolute h-64 w-64 rounded-full border border-teal/10",animate:v?void 0:{scale:[1.08,1,1.08],opacity:[.3,.6,.3]},transition:{duration:3.2,repeat:1/0,ease:"easeInOut",delay:.4}}),e.jsx(nt,{}),e.jsx("span",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 whitespace-nowrap text-micro font-bold uppercase tracking-[0.18em] text-primary",children:e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsxs("span",{className:"relative inline-flex h-1.5 w-1.5",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-primary/60"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-primary"})]}),"Capturing live previewâ¦"]})})]},"loader")}),e.jsx("div",{className:"absolute -bottom-1 left-1/2 z-10 -translate-x-1/2",children:e.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-border/60 bg-card px-5 py-3 shadow-[0_10px_30px_-12px_hsl(var(--foreground)/0.25)]",children:[e.jsx("div",{className:"flex -space-x-1.5",children:s.length>0?s.map((o,M)=>e.jsx(z.span,{initial:v?!1:{opacity:0,scale:.6},animate:{opacity:1,scale:1},transition:{delay:.1+M*.07,duration:.24,ease:[.22,1,.36,1]},className:"h-6 w-6 rounded-full border-2 border-card shadow",style:{backgroundColor:o.hex},title:o.hex},o.hex+M)):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"h-6 w-6 animate-pulse rounded-full border-2 border-card bg-muted"}),e.jsx("span",{className:"h-6 w-6 animate-pulse rounded-full border-2 border-card bg-muted/70"}),e.jsx("span",{className:"h-6 w-6 animate-pulse rounded-full border-2 border-card bg-muted/50"})]})}),e.jsxs("div",{className:"flex flex-col whitespace-nowrap",children:[e.jsx("span",{className:"text-micro font-bold uppercase tracking-[0.12em] text-primary",children:s.length>0?"Gathering colors":"Reading your site"}),e.jsx("span",{className:"text-micro text-info",children:s.length>0?"Identifying palettesâ¦":"Capturing screenshotâ¦"})]})]})})]})]}),e.jsxs("div",{className:"flex flex-col px-8 py-10 md:w-1/2 md:px-14 md:py-16",children:[e.jsxs("div",{className:"flex-grow",children:[e.jsx("span",{className:"rounded-full bg-success/10 px-4 py-1 text-micro font-bold uppercase tracking-[0.25em] text-success",children:"Building Brand DNA"}),e.jsxs("h1",{className:"mb-8 mt-4 font-display text-3xl font-bold leading-tight tracking-tight text-foreground sm:text-4xl",children:["Analyzing your ",e.jsx("span",{className:"text-primary",children:"brand"})]}),e.jsxs("div",{className:"mb-10 rounded-2xl border border-border/60 bg-background/50 p-5","aria-live":"polite",children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[e.jsx("span",{className:"text-micro font-bold uppercase tracking-[0.15em] text-info/80",children:"Did you know?"}),e.jsx("div",{className:"h-px flex-1 bg-info/10"})]}),e.jsx("div",{className:"relative min-h-[2.75rem]",children:e.jsx(Ye,{mode:"wait",initial:!1,children:e.jsx(z.p,{initial:v?!1:{opacity:0,y:6},animate:{opacity:1,y:0},exit:v?void 0:{opacity:0,y:-6},transition:{duration:.35,ease:"easeOut"},className:"text-sm italic leading-relaxed text-muted-foreground",children:U},b)})})]}),e.jsx("div",{className:"mb-10 space-y-5",children:Qe.map((o,M)=>{var L;const B=((L=Qe[M-1])==null?void 0:L.threshold)??0,$=r>=o.threshold,R=!$&&r>=B;return e.jsxs("div",{className:`flex items-center justify-between transition-opacity ${$||R?"opacity-100":"opacity-30"}`,children:[e.jsxs("div",{className:"flex items-center gap-3.5",children:[$?e.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-success",children:e.jsx(Pe,{className:"h-3 w-3 text-success-foreground",strokeWidth:4})}):R?e.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full border-2 border-primary",children:e.jsx("span",{className:"h-1.5 w-1.5 animate-ping rounded-full bg-primary"})}):e.jsx("span",{className:"h-5 w-5 rounded-full border border-muted-foreground
27/40"}),e.jsx("span",{className:`text-sm ${R?"font-semibold text-foreground":"font-medium text-muted-foreground"}`,children:o.label})]}),e.jsx("span",{className:`text-micro font-bold uppercase tracking-[0.2em] ${$?"text-success":R?"text-primary":"text-muted-foreground"}`,children:$?"Done":R?"Active":"Pending"})]},o.label)})})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2.5 flex items-end justify-between",children:[e.jsxs("span",{className:"font-display text-3xl font-bold tabular-nums text-foreground",children:[Math.round(r),"%"]}),e.jsxs("span",{className:"mb-1 text-micro font-semibold tabular-nums tracking-wide text-info",children:[ds(_)," elapsed"]})]}),e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted p-[1px]",children:e.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-primary to-primary-glow transition-all duration-700 ease-out",style:{width:`${Math.max(2,Math.min(100,r))}%`}})}),e.jsx("p",{className:"mt-4 text-meta font-medium leading-relaxed text-info",children:T}),e.jsx("div",{className:"mt-8 border-t border-border/60 pt-6",children:e.jsxs("button",{onClick:C,className:"group flex cursor-pointer items-center gap-2 text-info transition-colors hover:text-destructive",children:[e.jsx(Be,{className:"h-3.5 w-3.5 opacity-60 transition-transform duration-500 group-hover:rotate-90",strokeWidth:2.5}),e.jsx("span",{className:"text-micro font-bold uppercase tracking-[0.15em]",children:"Cancel analysis"})]})})]})]})]})]})})}function Ie(r){return r?(Array.isArray(r)?r:r.colors||r.palette||[]).map(a=>typeof a=="string"?a:a==null?void 0:a.hex).filter(a=>typeof a=="string"&&/^#?[0-9a-fA-F]{3,8}$/.test(a.trim())).map(a=>a.startsWith("#")?a:`#${a}`).slice(0,6):[]}function _e(r){if(!r)return[];if(Array.isArray(r))return r.map(a=>typeof a=="string"?a:(a==null?void 0:a.family)||(a==null?void 0:a.name)).filter(a=>!!a);const c=r;return[c.heading,c.body,c.primary].filter(a=>!!a)}function ps(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xs(r,c){if(!r)return"";const a=r.trim(),C=(c||"").trim();if(!C)return a;const v=new RegExp(`^${ps(C)}(?:\\s+(?:is|are|was|were)|'s)\\s+`,"i"),w=a.match(v);if(!w)return a;const S=a.slice(w[0].length).trim();return S.split(/\s+/).length<3?a:S.charAt(0).toUpperCase()+S.slice(1)}const De={visual:{title:"Visual References",sub:"Add product shots & real photos",icon:e.jsx(ns,{className:"h-5 w-5"}),text:"text-primary",bg:"from-primary/10 to-primary/5",hover:"hover:border-primary/40"},voice:{title:"Voice & Tone",sub:"What we should & shouldn't say",icon:e.jsx($t,{className:"h-5 w-5"}),text:"text-accent",bg:"from-accent/10 to-accent/5",hover:"hover:border-accent/40"},proof:{title:"Proof & Specifics",sub:"Real stats, results & testimonials",icon:e.jsx(os,{className:"h-5 w-5"}),text:"text-success",bg:"from-success/10 to-success/5",hover:"hover:border-success/40"},audience:{title:"Audience & Offer",sub:"Who you serve & your main CTA",icon:e.jsx(Lt,{className:"h-5 w-5"}),text:"text-info",bg:"from-info/10 to-info/5",hover:"hover:border-info/40"}},hs=["visual","voice","proof","audience"];function fs({brandProfileId:r,orgId:c,onContinue:a}){var ae,W;const[C,v]=i.useState(!0),[w,S]=i.useState(!1),[s,P]=i.useState(!1),[b,N]=i.useState({}),[U,_]=i.useState(0),[g,T]=i.useState(!1),[o,M]=i.useState(null),[B,$]=i.useState(null),R=i.useCallback(async()=>{const d=await Kt(r);N(d.enrichment),_(d.productPhotoCount),T(d.hasLogo)},[r]);i.useEffect(()=>{let d=!0;return(async()=>{var f,F,Z;v(!0);try{const[{data:A}]=await Promise.all([H.from("brand_profiles").select("brand_name, logo_url, color_palette, fonts, voice, tone, target_audience, brief_data, unique_selling_points").eq("id",r).maybeSingle(),R()]);if(!d)return;if(A){const q=A.brief_data||{},re=q.oneLiner||((f=q.positioning)==null?void 0:f.statement)||(Array.isArray(A.unique_selling_points)?A.unique_selling_points[0]:null)||null;M({brandName:A.brand_name,logoUrl:A.logo_url,colors:Ie(A.color_palette).length?Ie(A.color_palette):Ie((F=q.creative)==null?void 0:F.colorPalette),fonts:_e(A.fonts).length?_e(A.fonts):_e((Z=q.creative)==null?void 0:Z.typography),voice:A.voice,tone:A.tone,audience:A.target_audience,valueProp:re})}}finally{d&&v(!1)}})(),()=>{d=!1}},[r,R]);const L=i.useMemo(()=>Zt(b,{productPhotoCount:U,hasLogo:g}),[b,U,g]),ie=d=>{var f;return((f=L.pillars.find(F=>F.id===d))==null?void 0:f.ratio)??0},ee=d=>{N(d),P(!0)},le=i.useCallback(async(d=!1)=>{S(!0);try{await Ke(r,b,{productPhotoCount:U,hasLogo:g}),P(!1),d||y({title:"Saved",description:"Your brand brain just got sharper."})}catch(f){y({title:"Save failed",description:f.message,variant:"destructive"})}finally{S(!1)}}
27,[r,b,U,g]),E=async()=>{await R();try{await Ke(r,b,{productPhotoCount:U+1,hasLogo:g})}catch{}},G=d=>{const f=De[d].icon;return d==="visual"?e.jsx(es,{icon:f,enrichment:b,onChange:ee,orgId:c,brandProfileId:r,productPhotoCount:U,onPhotoUploaded:E}):d==="voice"?e.jsx(ts,{icon:f,enrichment:b,onChange:ee}):d==="proof"?e.jsx(ss,{icon:f,enrichment:b,onChange:ee}):e.jsx(as,{icon:f,enrichment:b,onChange:ee})};if(C)return e.jsx("div",{className:"flex items-center justify-center py-24",children:e.jsx(J,{className:"h-7 w-7 animate-spin text-primary"})});const ce=((o==null?void 0:o.brandName)||"B").trim().slice(0,2).toUpperCase(),D=(ae=o==null?void 0:o.colors)!=null&&ae.length?o.colors:["#2A6B6B","#C4734F","#5A7A5A","#6B7F99"],j=(W=o==null?void 0:o.fonts)!=null&&W.length?o.fonts.slice(0,2).join(" & "):"â",te=[o==null?void 0:o.voice,o==null?void 0:o.tone].filter(Boolean).join(" · ")||"â",se=xs(o==null?void 0:o.valueProp,o==null?void 0:o.brandName)||"â",I=[.22,.61,.36,1],K=d=>({initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.5,delay:d*.06,ease:I}});return e.jsxs("div",{className:"max-w-4xl w-full mx-auto space-y-8",children:[e.jsxs(z.div,{...K(0),className:"text-center space-y-2",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-full bg-accent/10 text-accent text-xs font-semibold tracking-wide uppercase",children:[e.jsx($e,{className:"h-3.5 w-3.5"}),"Confirm & Enrich"]}),e.jsx("h1",{className:"font-display text-4xl md:text-5xl font-semibold tracking-tight text-primary",children:"Sharpen your Brand DNA"}),e.jsx("p",{className:"text-muted-foreground max-w-lg mx-auto",children:"We've extracted the foundation from your site. Review it below and add a few specifics to maximize AI accuracy."})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-8 items-start",children:[e.jsx(z.div,{...K(1),className:"md:col-span-7",children:e.jsxs("div",{className:"relative overflow-hidden rounded-3xl border border-primary/10 bg-card p-6 sm:p-8 shadow-clay",children:[e.jsx("span",{className:"absolute top-4 right-4 text-micro font-bold uppercase tracking-widest text-success bg-success/10 px-2 py-1 rounded",children:"Extracted by AI"}),e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"flex items-start gap-5",children:[e.jsx("div",{className:"w-20 h-20 sm:w-24 sm:h-24 shrink-0 rounded-2xl bg-background border border-primary/10 flex items-center justify-center shadow-inner overflow-hidden",children:o!=null&&o.logoUrl?e.jsx("img",{src:o.logoUrl,alt:`${o.brandName} logo`,loading:"lazy",className:"w-full h-full object-contain p-2"}):e.jsx("span",{className:"text-primary font-display font-bold text-2xl",children:ce})}),e.jsxs("div",{className:"space-y-3 min-w-0",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-micro font-semibold uppercase tracking-wider text-muted-foreground",children:"Brand"}),e.jsx("p",{className:"font-display text-lg text-foreground truncate",children:(o==null?void 0:o.brandName)||"Your brand"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-micro font-semibold uppercase tracking-wider text-muted-foreground mb-1.5",children:"Color palette"}),e.jsx("div",{className:"flex gap-2",children:D.map((d,f)=>e.jsx("span",{className:"w-8 h-8 rounded-full border-2 border-card shadow-sm ring-1 ring-border/40",style:{backgroundColor:d},title:d},`${d}-${f}`))})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-micro font-semibold uppercase tracking-wider text-muted-foreground",children:"Key brand pillars"}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:[{label:"Brand voice",value:te},{label:"Target audience",value:(o==null?void 0:o.audience)||"â"},{label:"Main value prop",value:se},{label:"Typography",value:j}].map(d=>e.jsxs("div",{className:"p-3 rounded-xl bg-background/60 border border-primary/5",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:d.label}),e.jsx("p",{className:"text-sm font-medium text-foreground line-clamp-3",children:d.value})]},d.label))})]})]})]})}),e.jsxs(z.div,{...K(2),className:"md:col-span-5 flex flex-col",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-end justify-between mb-1",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("h2",{className:"font-display text-xl text-foreground",children:"Enrich the brain"}),e.jsx("p",{className:"text-micro font-medium text-muted-foreground uppercase tracking-wider",children:"Optional · boosts content"})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("div",{className:"text-micro font-bold text-success uppercase tracking-tight mb-1.5",children:["Readiness ",L.score,"%"]}),e.jsx("div",{className:"w-28 h-2 bg-background rounded-full overflow-hidden border border-primary/5",children:e.jsx(z.div,{className:"h-full bg-gradient-to-r from-primary to-success rounded-full",initial:{width:0},animate:{width:`${Math.max(L.score,2)}%`},transition:{duration:1,ease:I}})})]})]}),e.jsx("div",{className:"grid grid-cols-1 gap-3",children:hs.map(d=>{const f=De[d],F=ie(d)>=.6;return e.jsxs(z.button,{type:"button",onClick:()=>$(d),whileTap:{scale:.97},className:`group flex items-center gap-4 p-4 rounded-2xl border text-left transition-all duration-300 ${F?"bg-success/5 border-success/20":`bg-card/70 hover:bg-card border-border ${f.hover} shadow-sm hover:shadow-md`}`,children:[e.jsx("span",{className:`w-11 h-11 shrink-0 rounded-xl flex items-center justify-center ${F?"bg-success/15 text-success":`bg-gradient-to-br ${f.bg} ${f.text}`}`,children:F?e.jsx(Pe,{className:"h-5 w-5"}):f.icon}),e.jsxs("span",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"block text-sm font-semibold text-foreground",children:f.title}),e.jsx("span",{className:"block text-xs text-muted-foreground leading-tight mt-0.5 truncate",children:f.sub})]}),F?e.jsx("span",{className:"text-micro font-bold text-success uppercase tracking-wide",children:"Done"}):e.jsx(St,{className:"h-4 w-4 text-muted-foreground group-hover:translate-x-1 transition-transform"})]},d)})})]}),e.jsx("div",{className:"mt-8 flex items-center justify-end gap-3",children:e.jsxs(O,{onClick:async()=>{s&&await le(!0),a==null||a()},disabled:w,className:"rounded-xl font-bold shadow-clay",children:[w?e.jsx(J,{className:"h-4 w-4 mr-1.5 animate-spin"}):null,"Continue",e.jsx(It,{className:"h-4 w-4 ml-1.5"})]})})]})]}),e.jsx(z.p,{...K(3),className:"text-center text-xs text-muted-foreground italic",children:"Don't overthink it â you can refine any of this later in Brand settings."}),e.jsx(_t,{open:!!B,onOpenChange:d=>{d||$(null)},children:e.jsxs(Dt,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[e.jsx(Pt,{children:e.jsx(Bt,{className:"font-display",children:B?De[B].title:""})}),B&&G(B),e.jsxs("div",{className:"sticky bottom-0 -mx-6 -mb-6 px-6 py-3 bg-card/95 backdrop-blur border-t border-border flex items-center justify-end gap-2",children:[e.jsx(O,{variant:"outline",onClick:()=>$(null),children:"Cancel"}),e.jsxs(O,{onClick:async()=>{await le(),$(null)},disabled:w||!s,children:[w?e.jsx(J,{className:"h-4 w-4 mr-1.5 animate-spin"}):e.jsx(Pe,{className:"h-4 w-4 mr-1.5"}),"Save"]})]})]})})]})}const Le="analyze:manual-inflight",gs=5*60*1e3,be="Couldn't build your profile from the info provided. Try again or add more detail.",bs=15*1024*1024,ys=15e3,st=4e4,vs=[".png",".jpg",".jpeg",".pdf",".docx"],js=[".pdf",".docx",".pptx",".txt",".md"],Ns=[".png",".jpg",".jpeg"];function at(r){const c=r.name.toLowerCase();return Ns.some(a=>c.endsWith(a))}function ws(r){try{const c=sessionStorage.getItem(`${Le}:${r}`);if(!c)return null;const a=Number(c);return!Number.isFinite(a)||Date.now()-a>gs?null:a}catch{return null}}function ks(r){try{sessionStorage.setItem(`${Le}:${r}`,String(Date.now()))}catch{}}function Y(r){try{sessionStorage.removeItem(`${Le}:${r}`)}catch{}}function As(r){const c=(r||"").toLowerCase();return/rate.?limit|too many|429|busy|throttle/.test(c)?{kind:"rate_limited",title:"Our scanner is rate limited",hint:"Give it a moment and retry. No credits were charged."}:/invalid.*url|not a valid|url.*required/.test(c)?{kind:"invalid_url",title:"That URL looks off",hint:"Double check the address and try again."}:/unreachable|timeout|network|dns|refused|404|not found|blocked|forbidden|robots/.test(c)?{kind:"unreachable",title:"We could not reach the site",hint:"The site blocked us or is offline. Retry, edit the URL, or skip and add details manually."}:{kind:"unknown",title:r||"Analysis failed",hint:"You can retry, edit the URL, or skip and add details manually."}}function rt(r){return(r||"").trim().toLowerCase().replace(/^https?:\/\//,"").replace(/^www\./,"").replace(/\/+$/,"")}function ea(){const r=Ft(),{orgId:c,brandId:a}=Mt(),[C]=Rt(),{currentWorkspace:v,isLoading:w}=Et(),{isLoading:S}=zt(),s=c||(v==null?void 0:v.id),P=C.get("reanalyze"),b=C.get("url")||"",N=C.get("onboarding")==="1",U=!a&&!P&&!b,[_,g]=i.useState("input"),[T,o]=i.useState("url"),[M,B]=i.useState(U&&!N),[$,R]=i.useState(!1),[L,ie]=i.useState(b),[ee,le]=i.useState(""),[E,G]=i.useState(!1),[ce,D]=i.useState(0),[j,te]=i.useState(null),[se,I]=i.useState(null),[K,ae]=i.useState(null),W=i.useRef(null),d=i.useRef(null),f=i.useRef(!1),[F,Z]=i.useState(!1),A=i.useRef(null),[q,re]=i.useState(!1),Fe=i.useRef(null),Me=i.useRef(!1),[ye,Re]=i.useState(!1),[de,ot]=i.useState(""),[ue,it]=i.useState(""),[me,lt]=i.useState(""),[pe,ct]=i.useState(""),[Q,ve]=i.useState([]),[ne,je]=i.useState([]),[oe,xe]=i.useState(null),[Ne,dt]=i.useState("");i.useEffect(()=>{if(b&&s&&!f.current&&!E&&_==="input"){const t=N&&!a&&!P?Ut(s):null;if(t&&rt(t.url)===rt(b)){A.current=t.dispatchedAt,f.current=!0,Z(!0),g("analyzing"),D(15);return}const l=setTimeout(()=>{f.current=!0,we()},300);return()=>clearTimeout(l)}},[b,s]),i.useEffect(()=>{if(!N||!s||a||P||b||q||F||E)return;const t=ws(s);t&&(Fe.current=t,o("manual"),re(!0),g("analyzing"),D(15))},[s,N]),i.useEffect(()=>{if(!q||!s)return;const t=Fe.current??Date.now(),l=new Date(t-5e3).toISOString(),u=Date.now();let x=!1;const m=async()=>{try{const{data:n}=await H.from("brand_profiles").select("id, created_at").eq("org_id",s).gte("created_at",l).order("created_at",{ascending:!1}).limit(1).maybeSingle();if(x)return;if(n!=null&&n.id){Y(s),N&&(Ae(s,n.id),fe(s,"loaded")),r(`/c/${c}/brands/${n.id}`);return}if(Date.now()-u>9e4){Y(s),re(!1),g("input"),I(be);return}D(p=>Math.min(p+3,90))}catch{}};m();const h=setInterval(m,3e3);return()=>{x=!0,clearInterval(h)}},[q,s,c,N,r]),i.useEffect(()=>{if(!F||!s)return;const t=A.current??Date.now(),l=new Date(t-5e3).toISOString();let u=!1;const x=async()=>{try{const{data:h}=await H.from("brand_profiles").select("id, brand_name, source_url, created_at").eq("org_id",s).gte("created_at",l).order("created_at",{ascending:!1}).limit(1).maybeSingle();if(u)return;if(h!=null&&h.id){X(s),N&&(Ae(s,h.id),fe(s,"loaded")),r(`/c/${c}/brands/${h.id}`);return}const{data:n}=await H.from("analysis_queue").select("status, last_error").eq("org_id",s).eq("url",b.startsWith("http")?b:`https://${b}`).order("created_at",{ascending:!1}).limit(1).maybeSingle();if(u)return;if((n==null?void 0:n.status)==="failed"){X(s),Z(!1),g("input"),I(n.last_error||"Analysis failed. Please retry."),y({title:"Analysis failed",description:n.last_error||"Please retry the website analysis.",variant:"destructive"});return}D(p=>Math.min(p+3,90))}catch{}};x();const m=setInterval(x,3e3);return()=>{u=!0,clearInterval(m)}},[F,s,c,N,b,r]),i.useEffect(()=>{$&&L.trim()&&s&&!E&&(R(!1),we())},[$,L,s,E]);const ut=({url:t})=>{ie(t),B(!1),R(!0)};if(i.useEffect(()=>{!S&&!w&&!s&&r("/workspace-redirect",{replace:!0})},[s,S,w,r]),S||w||!s)return e.jsx(Ze,{title:"Analyze",description:"AI-powered brand analysis",breadcrumbs:[{label:"Analyze"}],children:e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(J,{className:"h-8 w-8 animate-spin text-primary"})})});const mt=t=>{try{const l=t.startsWith("http")?t:`https://${t}`;return new URL(l),!0}catch{return!1}},we=async()=>{var x;if(!s)return;o("url");const t=L.trim();if(!t){y({title:"URL required",description:"Please enter a website URL to analyze",variant:"destructive"});return}if(!mt(t)){y({title:"Invalid URL",description:"Please enter a valid website URL",variant:"destructive"});return}I(null),G(!0),g("analyzing"),D(0),ae(null),N&&s&&!a&&!P&&Ot(s,t);const l=new AbortController;W.current=l;const u=setInterval(()=>{D(m=>Math.min(m+Math.random()*15,90))},500);d.current=u;try{let m;try{let p=await ge.brandPreview(t);if(l.signal.aborted)return;if((!(p!=null&&p.success)||!(p!=null&&p.screenshot))&&!l.signal.aborted){if(await new Promise(V=>setTimeout(V,1200)),l.signal.aborted)return;const k=await ge.brandPreview(t);k!=null&&k.success&&(k.screenshot||(x=k.colors)!=null&&x.length)&&(p=k)}if(l.signal.aborted)return;p!=null&&p.success&&(ae({screenshot:p.screenshot,logo:p.logo,colors:p.colors,host:p.host}),(p.screenshot||p.branding)&&(m={screenshot:p.screenshot,branding:p.branding}))}catch{}const h=P||a||void 0,n=await ge.analyzeWebsite(t,s,h,m);if(clearInterval(u),n.requiresManualInput){I(n.error||"Failed to scrape website"),G(!1),g("input"),s&&X(s),setTimeout(()=>{var p;(p=document.getElementById("manual-brand-form"))==null||p.scrollIntoView({behavior:"smooth",block:"start"})},50);return}if(n.queued){y({title:"Added to queue",description:n.message||"Our scanner is busy right now. We've queued your brand â you'll see the analysis appear here in a minute or two."}),g("input"),G(!1);return}if(!n.success||!n.brandProfile){const p=n.error||"Analysis failed";if(n.retryable){I(p),g("input"),s&&X(s),y({title:"Analysis unavailable",description:p,variant:"destructive"});return}throw new Error(p)}D(100),te(n.brandProfile),g("result"),s&&X(s),n.firstScanFree&&y({title:"
27ð First scan is on us",description:"Your first Brand DNA scan is free â no credits charged. Future scans cost 5 credits each."}),n.warning&&y({title:"Note",description:n.warning})}catch(m){if(l.signal.aborted)return;clearInterval(u),console.error("Analysis error:",m);const h=m instanceof Error?m.message:"Failed to analyze website";I(h),g("input"),s&&X(s),y({title:"Analysis failed",description:h,variant:"destructive"})}finally{W.current=null,d.current=null,G(!1)}},pt=()=>{const t=[];return de.trim()&&t.push(`Brand Name: ${de.trim()}`),ue.trim()&&t.push(`Products/Services: ${ue.trim()}`),me.trim()&&t.push(`Target Customers: ${me.trim()}`),pe.trim()&&t.push(`Customer Location: ${pe.trim()}`),Ne.trim()&&t.push(`Additional Info: ${Ne.trim()}`),t.join(` 28 29`)},xt=async()=>{const t=[...ne,...Q.filter(x=>!at(x))],l=Q.filter(at),u=[];if(t.length>0){const x=await Promise.allSettled(t.map(async n=>({file:n,extracted:await rs(n)}))),m=[];for(let n=0;n<x.length;n++){const p=x[n],k=t[n].name;if(p.status==="rejected"){const Nt=p.reason instanceof Error?p.reason.message:"Could not read file";y({title:`Couldn't read ${k}`,description:`${Nt} â skipping this file.`,variant:"destructive"});continue}const V=(p.value.extracted.text||"").trim();V&&m.push({name:k,text:V.slice(0,ys)})}let h=m.reduce((n,p)=>n+p.text.length,0);for(;h>st&&m.length>0;){m.sort((k,V)=>V.text.length-k.text.length);const n=m[0],p=h-st;n.text=n.text.slice(0,Math.max(0,n.text.length-p)),h=m.reduce((k,V)=>k+V.text.length,0)}for(const n of m)n.text&&u.push(`--- Uploaded document: ${n.name} --- 30${n.text}`)}if(l.length>0){const x=l.map(m=>m.name).join(", ");u.push(`--- Uploaded visuals (images, kept as visual reference; text/logo reading ships with vision analysis): ${x} ---`)}return u.join(` 31 32`)},ht=Q.length>0||ne.length>0,Ee=de.trim().length>0&&ue.trim().length>0&&me.trim().length>0&&pe.trim().length>0||ht,ft=async(t,l)=>{const u=t.name.replace(/[^a-zA-Z0-9._-]/g,"_"),x=`${s}/${l}/logo/${Date.now()}-${u}`,{error:m}=await H.storage.from("brand-assets").upload(x,t,{upsert:!1});if(m)throw m;const{data:h}=H.storage.from("brand-assets").getPublicUrl(x),{error:n}=await H.from("brand_profiles").update({logo_url:h.publicUrl}).eq("id",l);if(n)throw n;return h.publicUrl},ze=async()=>{if(!s)return;const t=pt();let l="";if(Q.length>0||ne.length>0){Re(!0);try{l=await xt()}finally{Re(!1)}}const u=[t,l].filter(Boolean).join(` 33 34`);if(u.length<50){y({title:"More content needed",description:"Add a bit more detail or upload a brand document so we have something to work with.",variant:"destructive"});return}I(null),o("manual"),G(!0),g("analyzing"),D(0),Me.current=!0,s&&ks(s);const x=new AbortController;W.current=x;const m=setInterval(()=>{D(h=>Math.min(h+Math.random()*15,90))},500);d.current=m;try{const h=P||a||void 0,n=await ge.analyzeContent(u,s,h);if(clearInterval(m),!n.success||!n.brandProfile)throw new Error(n.error||"Analysis failed");let p=n.brandProfile;if(oe&&n.brandProfile.id)try{const k=await ft(oe,n.brandProfile.id);p={...n.brandProfile,logoUrl:k},y({title:"Logo saved",description:"Your logo is now part of the brand profile."})}catch(k){console.error("Logo upload error:",k),y({title:"Logo could not be saved",description:"The Brand DNA was created. You can upload the logo later from Assets.",variant:"destructive"})}D(100),te(p),s&&Y(s),g("review"),window.scrollTo({top:0,behavior:"smooth"})}catch(h){if(x.signal.aborted)return;clearInterval(m),console.error("Analysis error:",h),I(be),g("input"),s&&Y(s),setTimeout(()=>{var n;(n=document.getElementById("manual-brand-form"))==null||n.scrollIntoView({behavior:"smooth",block:"start"})},50),y({title:"Couldn't build your profile",description:be,variant:"destructive"})}finally{W.current=null,d.current=null,G(!1),Me.current=!1}},Ue=(t,l)=>{const u=l==="visuals"?vs:js,x=[];for(const m of t){const h=m.name.toLowerCase();if(!u.some(n=>h.endsWith(n))){h.endsWith(".doc")?y({title:"Legacy .doc not supported",description:`${m.name}: please save it as .docx or PDF and try again.`,variant:"destructive"}):y({title:"Unsupported file type",description:`${m.name}: allowed types are ${u.join(", ")}.`,variant:"destructive"});continue}if(m.size>bs){y({title:"File too large",description:`${m.name} is over 15 MB. Try a smaller version or split it up.`,variant:"destructive"});continue}x.push(m)}return x},Oe=(t,l)=>{t.preventDefault();const u=Ue(Array.from(t.dataTransfer.files),l);l==="visuals"?ve(x=>[...x,...u]):je(x=>[...x,...u])},Te=(t,l)=>{if(!t.target.files)return;const u=Ue(Array.from(t.target.files),l);l==="visuals"?ve(x=>[...x,...u]):je(x=>[...x,...u]),t.target.value=""},Ge=(t,l)=>{t==="visuals"?ve(u=>u.filter((x,m)=>m!==l)):je(u=>u.filter((x,m)=>m!==l))},We=t=>
34["image/png","image/jpeg","image/svg+xml","image/webp","image/gif"].includes(t.type)?t.size>5*1024*1024?(y({title:"Logo too large",description:"Please use a logo under 5 MB.",variant:"destructive"}),!1):!0:(y({title:"Unsupported logo type",description:"Please use PNG, JPG, SVG, WebP or GIF.",variant:"destructive"}),!1),gt=t=>{t.preventDefault();const l=t.dataTransfer.files[0];l&&We(l)&&xe(l)},bt=t=>{var u;const l=(u=t.target.files)==null?void 0:u[0];l&&We(l)&&xe(l),t.target.value=""},yt=()=>{const t=(j==null?void 0:j.id)||a;if(t){if(N&&s){Ae(s,t),fe(s,"loaded"),r(`/c/${c}/brands/${t}`);return}r(`/c/${c}/brands/${t}`)}else y({title:"Error",description:"Brand profile not saved. Please try again.",variant:"destructive"})},vt=()=>{g("input"),o("url"),ie(""),le(""),xe(null),te(null),I(null),D(0),s&&Y(s)},qe=()=>{s&&(X(s),Y(s),N&&(Yt(s),Ht(s))),I(null),y({title:"Analysis skipped",description:"You can add a brand manually anytime from the workspace."}),r(c?`/c/${c}/dashboard`:"/workspace-redirect",{replace:!0})},jt=()=>{I(null),we()},Ve=()=>{var t;(t=W.current)==null||t.abort(),W.current=null,d.current&&(clearInterval(d.current),d.current=null),G(!1),D(0),g("input"),Z(!1),re(!1),o("url"),s&&X(s),s&&Y(s),y({title:"Analysis cancelled."})},Xe=e.jsxs("div",{className:"w-full mx-auto",children:[e.jsx(is,{open:M,onOpenChange:B,onConfirm:ut,initialUrl:L}),_==="input"&&e.jsxs("div",{className:"space-y-8 animate-fade-in",children:[e.jsxs("div",{className:"text-center space-y-3",children:[e.jsx("h1",{className:"text-4xl font-bold tracking-tight",children:"Add your brand manually"}),e.jsx("p",{className:"text-lg text-muted-foreground max-w-md mx-auto",children:"Tell us about your brand and we'll build your profile"})]}),se&&T==="url"&&(()=>{const{title:t,hint:l}=As(se);return e.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-2xl border border-destructive/30 bg-destructive/5",children:[e.jsx(He,{className:"h-5 w-5 text-destructive flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-semibold text-destructive",children:t}),e.jsx("p",{className:"text-sm text-muted-foreground",children:l})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(O,{size:"sm",onClick:jt,disabled:E||!L.trim(),className:"rounded-xl",children:[e.jsx(J,{className:`h-4 w-4 mr-2 ${E?"animate-spin":"hidden"}`}),"Retry"]}),e.jsx(O,{size:"sm",variant:"outline",onClick:()=>{var u,x;I(null),o("manual"),(u=document.getElementById("manual-brand-form"))==null||u.scrollIntoView({behavior:"smooth",block:"start"}),(x=document.getElementById("brandName"))==null||x.focus()},className:"rounded-xl",children:"Add manually instead"}),N&&e.jsx(O,{size:"sm",variant:"ghost",onClick:qe,className:"rounded-xl text-muted-foreground",children:"Skip analysis"})]})]})]})})(),e.jsxs("div",{id:"manual-brand-form",className:"space-y-6 scroll-mt-8",children:[e.jsxs("div",{className:"bg-card border border-border rounded-2xl p-6 space-y-5",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Basics"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(he,{htmlFor:"brandName",className:"text-sm font-medium",children:["What is your brand's name? ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ke,{id:"brandName",value:de,onChange:t=>ot(t.target.value),placeholder:"e.g. LynxUp",className:"bg-background border-border"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(he,{htmlFor:"productsServices",className:"text-sm font-medium",children:["What products or services do you offer? ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ke,{id:"productsServices",value:ue,onChange:t=>it(t.target.value),placeholder:"e.g. Social media marketing software for small businesses",className:"bg-background border-border"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(he,{htmlFor:"customerDescription",className:"text-sm font-medium",children:["Describe your typical customers. Be specific. ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(Je,{id:"customerDescription",value:me,onChange:t=>lt(t.target.value),placeholder:"e.g. Small business owners aged 30-50 who want to grow their online presence without hiring an agency",rows:3,className:"bg-background border-border resize-none"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(he,{htmlFor:"customerLocation",className:"text-sm font-medium",children:["Where are your customers located? ",e.jsx("span",{className:"text-destructive",children:"*"})]}
34),e.jsx(ke,{id:"customerLocation",value:pe,onChange:t=>ct(t.target.value),placeholder:"e.g. United States, or Global",className:"bg-background border-border"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-card border border-border rounded-2xl p-6 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Brand Visuals"}),e.jsx(Ce,{variant:"outline",className:"text-xs text-muted-foreground border-border",children:"Optional"})]}),e.jsxs("div",{className:"border border-dashed border-border rounded-xl px-4 py-4 hover:border-primary/40 transition-colors cursor-pointer",onDragOver:t=>t.preventDefault(),onDrop:gt,onClick:()=>{var t;return(t=document.getElementById("logo-upload"))==null?void 0:t.click()},children:[e.jsx("input",{id:"logo-upload",type:"file",accept:"image/png,image/jpeg,image/svg+xml,image/webp,image/gif",className:"hidden",onChange:bt}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(Se,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Brand logo"}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:oe?oe.name:"Optional · PNG, JPG, SVG, WebP or GIF · up to 5 MB"})]}),oe&&e.jsx(O,{type:"button",size:"sm",variant:"ghost",className:"shrink-0",onClick:t=>{t.stopPropagation(),xe(null)},children:"Remove"})]})]}),e.jsxs("div",{className:"border-2 border-dashed border-border rounded-xl px-6 py-6 text-center hover:border-primary/40 transition-colors cursor-pointer aspect-square flex items-center justify-center",onDragOver:t=>t.preventDefault(),onDrop:t=>Oe(t,"visuals"),onClick:()=>{var t;return(t=document.getElementById("visual-upload"))==null?void 0:t.click()},children:[e.jsx("input",{id:"visual-upload",type:"file",multiple:!0,accept:".png,.jpg,.jpeg,.pdf,.docx",className:"hidden",onChange:t=>Te(t,"visuals")}),e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(Se,{className:"h-5 w-5 text-primary"})}),e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Upload visuals so we can learn your look"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Logo, brochures, lookbooks, product photos, anything that shows your brand style."}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"PNG, JPG, PDF, DOCX · up to 15 MB"}),e.jsx("p",{className:"text-micro text-muted-foreground mt-1 max-w-[240px]",children:"Images are kept for reference â for text, use a PDF or DOCX."})]})]}),Q.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 pt-2",children:Q.map((t,l)=>e.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-muted text-sm text-foreground",children:[e.jsx(Se,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"max-w-[150px] truncate",children:t.name}),e.jsx("button",{onClick:u=>{u.stopPropagation(),Ge("visuals",l)},className:"text-muted-foreground hover:text-destructive",children:e.jsx(Be,{className:"h-3.5 w-3.5"})})]},l))})]}),e.jsxs("div",{className:"bg-card border border-border rounded-2xl p-6 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Brand Documents"}),e.jsx(Ce,{variant:"outline",className:"text-xs text-muted-foreground border-border",children:"Optional"})]}),e.jsxs("div",{className:"border-2 border-dashed border-border rounded-xl px-6 py-6 text-center hover:border-primary/40 transition-colors cursor-pointer aspect-square flex items-center justify-center",onDragOver:t=>t.preventDefault(),onDrop:t=>Oe(t,"documents"),onClick:()=>{var t;return(t=document.getElementById("doc-upload"))==null?void 0:t.click()},children:[e.jsx("input",{id:"doc-upload",type:"file",multiple:!0,accept:".pdf,.docx,.pptx,.txt,.md",className:"hidden",onChange:t=>Te(t,"documents")}),e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(ls,{className:"h-5 w-5 text-primary"})}),e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Upload documents so we can learn your voice"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Business profile, deck, catalogue, brand guidelines, anything that describes what you do."}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"PDF, DOCX, PPTX, TXT, MD · up to 15 MB"})]})]}),ne.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 pt-2",children:ne.map((t,l)=>e.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-muted text-sm text-foreground",children:[e.jsx(Tt,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"max-w-[150px] truncate",children:t.name}),e.jsx("button",{onClick:u=>{u.stopPropagation(),Ge("documents",l)},className:"text-muted-foreground hover:text-destructive",children:e.jsx(Be,{className:"h-3.5 w-3.5"})})]},l))})]})]}),e.jsxs("div",{className:"bg-card border border-border rounded-2xl p-6 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Anything Else"}),e.jsx(Ce,{variant:"outline",className:"text-xs text-muted-foreground border-border",children:"Optional"})]}),e.jsx(Je,{value:Ne,onChange:t=>dt(t.target.value),placeholder:"Paste a tagline, mission statement, brand description, or any other content that represents your brand",rows:5,className:"bg-background border-border resize-none"})]}),se&&T==="manual"&&e.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-2xl border border-destructive/30 bg-destructive/5",children:[e.jsx(He,{className:"h-5 w-5 text-destructive flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-semibold text-destructive",children:"Couldn't build your profile"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:be})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:e.jsxs(O,{size:"sm",onClick:ze,disabled:E||!Ee,className:"rounded-xl",children:[e.jsx(J,{className:`h-4 w-4 mr-2 ${E?"animate-spin":"hidden"}`}),"Retry"]})})]})]}),e.jsx("div",{className:"flex items-center justify-end pt-2 pb-8",children:e.jsxs(O,{onClick:ze,disabled:E||ye||!Ee,className:"bg-primary hover:bg-primary/90 rounded-xl font-semibold px-8",size:"lg",children:[E||ye?e.jsx(J,{className:"h-4 w-4 animate-spin mr-2"}):e.jsx($e,{className:"h-4 w-4 mr-2"}),ye?"Reading documentsâ¦":"Analyze Brand"]})})]})]}),_==="analyzing"&&T==="url"&&e.jsx(ms,{progress:ce,brandUrl:L,preview:K,onCancel:Ve}),_==="analyzing"&&T==="manual"&&e.jsxs("div",{className:"max-w-xl mx-auto py-16 space-y-6 animate-fade-in text-center",children:[e.jsx("div",{className:"inline-flex h-12 w-12 items-center justify-center rounded-full bg-primary/10 mx-auto",children:e.jsx($e,{className:"h-6 w-6 text-primary"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Building your brand profile"}),e.jsx("p",{className:"text-muted-foreground",children:"Using what you told us. No website scan needed."})]}),e.jsx(Jt,{value:ce,className:"h-2"}),e.jsx(O,{variant:"ghost",size:"sm",onClick:Ve,className:"text-muted-foreground",children:"Cancel"})]}),_==="result"&&j&&e.jsxs("div",{className:"space-y-8 animate-fade-in",children:[e.jsxs("div",{className:"text-center space-y-3",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-full bg-success/10 border border-success/20 mb-2",children:[e.jsx(Gt,{className:"h-3.5 w-3.5 text-success"}),e.jsx("span",{className:"text-sm font-medium text-success",children:"Analysis Complete"})]}),e.jsx("h1",{className:"text-4xl font-bold tracking-tight",children:"Your Brand DNA"}),e.jsx("p",{className:"text-lg text-muted-foreground",children:"Here's what we learned about your brand"})]}),e.jsx(Qt,{brandName:j.brandName,briefData:j.briefData||{},logoUrl:j.logoUrl,brandProfileId:j.id||a,onContinue:()=>{g("review"),window.scrollTo({top:0,behavior:"smooth"})},onReanalyze:vt})]}),_==="review"&&((j==null?void 0:j.id)||a)&&s&&e.jsxs("div",{className:"animate-fade-in space-y-4",children:[T==="manual"&&e.jsxs("div",{className:"flex items-start gap-3 rounded-2xl border border-border bg-card/60 p-4",children:[e.jsx(Wt,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.jsx("span",{className:"font-semibold text-foreground",children:"You can refine this anytime."})," ","We drafted this from what you shared. Edit anything now, or tweak it later from your"," ",e.jsx("button",{type:"button",onClick:()=>{const t=(j==null?void 0:j.id)||a;s&&t&&r(`/c/${s}/brands/${t}`)},className:"font-medium text-primary underline underline-offset-2 hover:text-primary",children:"Brand overview"}),"."]})]}),e.jsx(fs,{brandProfileId:(j==null?void 0:j.id)||a,orgId:s,onContinue:yt})]})]});return N?e.jsxs("div",{className:"fixed inset-0 z-[70] overflow-y-auto bg-background drafting-surface",children:[e.jsx(qt,{onClick:qe}),e.jsxs("div",{className:"min-h-full w-full px-4 sm:px-6 lg:px-8 py-10 sm:py-14 max-w-[1080px] mx-auto",children:[e.jsxs("button",{onClick:()=>{s&&(fe(s,"welcome"),r(`/c/${c}/dashboard?onb=welcome`))},className:"absolute left-5 top-5 z-10 inline-flex items-center gap-1.5 rounded-full border border-border bg-card/70 px-3 py-1.5 text-xs font-medium text-muted-foreground backdrop-blur transition-colors hover:text-foreground",children:[e.jsx(Vt,{className:"h-3.5 w-3.5"})," Back"]}),_!=="review"&&e.jsxs(e.Fragment,{children:[e.jsx(Xt,{current:1}),e.jsx("div",{className:"mb-10"})]}),Xe]})]}):e.jsx(Ze,{title:"Analyze Your Brand",description:"Enter your website URL and we'll extract your brand DNA using AI",breadcrumbs:[{label:"Analyze"}],children:Xe})}export{ea 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.