PageSourceSearch

https://lynxup.ai/assets/Competitors-C-Rb-qet.js

js lynxup.ai collected 2026-10-05 14:55:46 UTC 24,140 bytes, 1 lines download raw bytes

1import{h as M,j as e,aP as v,by as w,aV as E,aY as Z,bx as b,a6 as ee,aB as se,a9 as j,bz as R,aK as ae,q as te,r as o,d as C,O,v as F,g as U,S as re,B as q,ad as W,ay as D,bB as Q,aQ as ne,aR as ie,aS as le,aT as ce,ar as Y,a7 as oe,b as de,at as me,p as xe,u as ue}from"./index-CW9Dj55B.js";import{P as he}from"./PageShell-_sqgJEcM.js";import{B as m}from"./badge-DsSXgOBc.js";import{T as pe,a as ge,b as $,c as I}from"./tabs-DBViU-M1.js";import{S as V}from"./shield-BQcZgaCm.js";import{S as je}from"./star-BdmSGbkh.js";import{P as fe}from"./phone-Br6gNDvc.js";import{C as Ne}from"./clock-6vmVuDMD.js";import{S as ve}from"./settings-2-B_E5vuBX.js";import{a as be}from"./analyze-DafUVQJp.js";import"./breadcrumb-C0nepQh3.js";import"./generationQueue-C08xjit7.js";import"./invokeFunction-DvzDsR8D.js";const K={async runAnalysis(t,a,s){const{data:l,error:n}=await M.functions.invoke("analyze-competitors",{body:{brandProfileId:t,orgId:a,scopeOverride:s==null?void 0:s.scopeOverride,scopes:s==null?void 0:s.scopes,locationOverride:s==null?void 0:s.locationOverride,radiusKm:s==null?void 0:s.radiusKm,serviceArea:s==null?void 0:s.serviceArea}});if(n)throw n;return l},async getLatestAudit(t){const{data:a}=await M.from("competitor_audits").select("*").eq("brand_profile_id",t).eq("status","completed").order("created_at",{ascending:!1}).limit(1).maybeSingle();return a??null},async getCompetitors(t){const{data:a}=await M.from("competitors").select("*").eq("brand_profile_id",t).order("threat_score",{ascending:!1});return a??[]}};function ye(t){return t==null?"bg-muted text-muted-foreground":t>=75?"bg-destructive/15 text-destructive border-destructive/30":t>=50?"bg-warning/15 text-warning border-warning/30":"bg-success/15 text-success border-success/30"}function G({competitor:t}){var s,l;const a=t;return e.jsxs(v,{className:"overflow-hidden border-border/70",children:[e.jsx(w,{className:"pb-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:"font-semibold text-base truncate",children:a.name}),a.type&&e.jsx(m,{variant:"outline",className:"text-micro uppercase tracking-wide",children:a.type}),a.geography&&e.jsx(m,{variant:"secondary",className:"text-micro",children:a.geography})]}),a.website&&e.jsxs("a",{href:a.website,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-primary inline-flex items-center gap-1 mt-1",children:[a.website.replace(/^https?:\/\//,"")," ",e.jsx(E,{className:"h-3 w-3"})]})]}),e.jsxs("div",{className:"flex flex-col items-end gap-1 shrink-0",children:[e.jsxs(m,{className:`${ye(a.threat_score)} border`,children:[e.jsx(V,{className:"h-3 w-3 mr-1"})," Threat ",a.threat_score??"—"]}),a.similarity_score!=null&&e.jsxs("span",{className:"text-micro text-muted-foreground inline-flex items-center gap-1",children:[e.jsx(Z,{className:"h-3 w-3"})," ",a.similarity_score,"% similar"]})]})]})}),e.jsxs(b,{className:"space-y-3 pt-0",children:[a.value_prop&&e.jsxs("p",{className:"text-sm text-foreground/80 italic leading-snug",children:['"',a.value_prop,'"']}),a.summary&&e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:a.summary}),a.target_audience&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium text-foreground/70",children:"Audience:"})," ",a.target_audience]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[!!((s=a.strengths)!=null&&s.length)&&e.jsxs("div",{children:[e.jsxs("div",{className:"text-micro font-medium text-success mb-1.5 flex items-center gap-1",children:[e.jsx(ee,{className:"h-3 w-3"})," Strengths"]}),e.jsx("ul",{className:"space-y-1",children:a.strengths.slice(0,4).map((n,c)=>e.jsxs("li",{className:"text-xs text-foreground/70 leading-snug",children:["• ",n]},c))})]}),!!((l=a.weaknesses)!=null&&l.length)&&e.jsxs("div",{children:[e.jsxs("div",{className:"text-micro font-medium text-warning mb-1.5 flex items-center gap-1",children:[e.jsx(se,{className:"h-3 w-3"})," Weaknesses"]}),e.jsx("ul",{className:"space-y-1",children:a.weaknesses.slice(0,4).map((n,c)=>
1e.jsxs("li",{className:"text-xs text-foreground/70 leading-snug",children:["• ",n]},c))})]})]}),a.pricing_signal&&a.pricing_signal!=="unknown"&&e.jsx("div",{className:"pt-2 border-t border-border/60",children:e.jsxs("span",{className:"text-micro text-muted-foreground",children:["Pricing: ",e.jsx("span",{className:"font-medium text-foreground/80 capitalize",children:a.pricing_signal})]})})]})]})}function we(t){return t==null?"bg-muted text-muted-foreground":t>=75?"bg-destructive/15 text-destructive border-destructive/30":t>=50?"bg-warning/15 text-warning border-warning/30":"bg-success/15 text-success border-success/30"}function _e({competitor:t}){var c;const a=t,s=a.local_signals||{},l=[a.city,a.region].filter(Boolean).join(", "),n=encodeURIComponent([a.name,s.address,a.city,a.region,a.country].filter(Boolean).join(" "));return e.jsxs(v,{className:"overflow-hidden border-border/70 bg-gradient-to-br from-background to-secondary/10",children:[e.jsx(w,{className:"pb-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:"font-semibold text-base truncate",children:a.name}),e.jsxs(m,{variant:"secondary",className:"text-micro uppercase",children:[e.jsx(j,{className:"h-3 w-3 mr-1"}),"Local"]}),a.type&&e.jsx(m,{variant:"outline",className:"text-micro uppercase",children:a.type})]}),l&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 inline-flex items-center gap-1",children:[e.jsx(j,{className:"h-3 w-3"})," ",l,a.distance_km!=null&&e.jsxs("span",{className:"text-foreground/70",children:["· ~",a.distance_km," km"]})]}),a.website&&e.jsxs("a",{href:a.website,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-primary inline-flex items-center gap-1 mt-1",children:[a.website.replace(/^https?:\/\//,"")," ",e.jsx(E,{className:"h-3 w-3"})]})]}),e.jsxs(m,{className:`${we(a.threat_score)} border shrink-0`,children:[e.jsx(V,{className:"h-3 w-3 mr-1"})," ",a.threat_score??"—"]})]})}),e.jsxs(b,{className:"space-y-2.5 pt-0",children:[a.value_prop&&e.jsxs("p",{className:"text-sm text-foreground/85 italic leading-snug",children:['"',a.value_prop,'"']}),a.summary&&e.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:a.summary}),e.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1.5 pt-1 text-xs text-muted-foreground",children:[s.avg_rating!=null&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(je,{className:"h-3 w-3 fill-warning text-warning"}),e.jsx("span",{className:"font-medium text-foreground/80",children:s.avg_rating}),s.review_count!=null&&e.jsxs("span",{children:["(",s.review_count,")"]})]}),s.phone&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(fe,{className:"h-3 w-3"}),s.phone]}),s.hours&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Ne,{className:"h-3 w-3"}),s.hours]})]}),s.address&&e.jsxs("a",{href:`https://www.google.com/maps/search/?api=1&query=${n}`,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[e.jsx(j,{className:"h-3 w-3"}),s.address," ",e.jsx(E,{className:"h-3 w-3"})]}),!!((c=s.neighborhoods)!=null&&c.length)&&e.jsx("div",{className:"flex flex-wrap gap-1 pt-1",children:s.neighborhoods.slice(0,5).map((d,f)=>e.jsx(m,{variant:"outline",className:"text-micro",children:d},f))})]})]})}function Ce({map:t}){var a;return(a=t==null?void 0:t.points)!=null&&a.length?e.jsxs(v,{children:[e.jsx(w,{children:e.jsx(R,{className:"text-base",children:"Positioning Map"})}),e.jsxs(b,{children:[e.jsxs("div",{className:"relative aspect-square w-full max-w-xl mx-auto border border-border/60 rounded-lg bg-muted/20",children:[e.jsx("div",{className:"absolute -top-1 left-1/2 -translate-x-1/2 -translate-y-full text-xs text-muted-foreground font-medium",children:t.axis_y.high}),e.jsx("div",{className:"absolute -bottom-1 left-1/2 -translate-x-1/2 translate-y-full text-xs text-muted-foreground font-medium",children:t.axis_y.low}),e.jsx("div",{className:"absolute top-1/2 -left-2 -translate-y-1/2 -translate-x-full text-xs text-muted-foreground font-medium whitespace-nowrap",children:t.axis_x.low}),e.jsx("div",{className:"absolute top-1/2 -right-2 -translate-y-1/2 translate-x-full text-xs text-muted-foreground font-medium whitespace-nowrap",children:t.axis_x.high}),e.jsx("div",{className:"absolute left-0 right-0 top-1/2 border-t border-dashed border-border/50"}),e.jsx("div",{className:"absolute top-0 bottom-0 left-1/2 border-l border-dashed border-border/50"}),t.points.map((s,l)=>{const n=Math.max(2,Math.min(98,s.x)),c=Math.max(2,Math.min(98,100-s.y)),d=s.is_us;return e.jsxs("div",{className:"absolute -translate-x-1/2 -translate-y-1/2 group",style:{left:`${n}%`,top:`${c}%`},children:[e.jsx("div",{className:`rounded-full ${d?"bg-primary ring-4 ring-primary/30 h-4 w-4":"bg-foreground
1/70 h-3 w-3"}`}),e.jsx("div",{className:`absolute left-1/2 -translate-x-1/2 mt-1 text-micro whitespace-nowrap px-1.5 py-0.5 rounded ${d?"bg-primary-ink text-primary-foreground font-semibold":"text-foreground/80 bg-background/80 backdrop-blur-sm"}`,children:s.name})]},l)})]}),e.jsxs("p",{className:"text-xs text-muted-foreground text-center mt-8",children:["X: ",t.axis_x.label," · Y: ",t.axis_y.label]})]})]}):null}const ke={low:"secondary",medium:"outline",high:"destructive"};function H({items:t}){return e.jsxs(v,{children:[e.jsx(w,{children:e.jsxs(R,{className:"text-base flex items-center gap-2",children:[e.jsx(ae,{className:"h-4 w-4 text-primary"})," Whitespace Opportunities"]})}),e.jsx(b,{className:"space-y-3",children:t.map((a,s)=>e.jsxs("div",{className:"rounded-lg border border-border/60 p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-sm",children:a.title}),a.difficulty&&e.jsx(m,{variant:ke[a.difficulty]??"outline",className:"capitalize text-micro",children:a.difficulty})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1 leading-relaxed",children:a.description}),a.evidence&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-2 italic",children:["Evidence: ",a.evidence]})]},s))})]})}const Se={high:"destructive",medium:"outline",low:"secondary"};function X({items:t}){const a=[...t].sort((s,l)=>{const n={high:0,medium:1,low:2};return(n[s.priority]??3)-(n[l.priority]??3)});return e.jsxs(v,{children:[e.jsx(w,{children:e.jsxs(R,{className:"text-base flex items-center gap-2",children:[e.jsx(Z,{className:"h-4 w-4 text-primary"})," Action Plan"]})}),e.jsx(b,{className:"space-y-3",children:a.map((s,l)=>{var n;return e.jsx("div",{className:"rounded-lg border border-border/60 p-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-medium text-sm",children:s.title}),e.jsx(m,{variant:"outline",className:"capitalize text-micro",children:s.type})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1 leading-relaxed",children:s.rationale}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-foreground/80 mt-2",children:[e.jsx(te,{className:"h-3 w-3 text-primary"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-medium",children:"First step:"})," ",s.first_step]})]}),!!((n=s.target_competitors)!=null&&n.length)&&e.jsx("div",{className:"flex items-center gap-1 flex-wrap mt-2",children:s.target_competitors.map(c=>e.jsx(m,{variant:"secondary",className:"text-micro",children:c},c))})]}),e.jsx(m,{variant:Se[s.priority]??"outline",className:"capitalize text-micro",children:s.priority})]})},l)})})]})}const Ae=[{id:"local",label:"Local",icon:j,hint:"Same city / region"},{id:"national",label:"National",icon:q,hint:"Same country"},{id:"international",label:"International",icon:W,hint:"Worldwide"}],Le=[5,10,25,50];function J({initial:t,running:a,onRun:s,ctaLabel:l="Run analysis"}){var A,L,P;const[n,c]=o.useState((t==null?void 0:t.scopes)??["local","national","international"]),[d,f]=o.useState(((A=t==null?void 0:t.location)==null?void 0:A.city)??""),[h,k]=o.useState(((L=t==null?void 0:t.location)==null?void 0:L.region)??""),[_,N]=o.useState(((P=t==null?void 0:t.location)==null?void 0:P.country)??""),[p,S]=o.useState((t==null?void 0:t.serviceArea)??""),[T,u]=o.useState((t==null?void 0:t.radiusKm)??25),z=i=>{c(r=>r.includes(i)?r.filter(x=>x!==i):[...r,i])},B=n.includes("local");return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-xs uppercase tracking-wide text-muted-foreground mb-2 block",children:"Geographic tiers"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Ae.map(i=>{const r=i.icon,x=n.includes(i.id);return e.jsxs("button",{type:"button",onClick:()=>z(i.id),className:`group inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-xs font-medium transition ${x?"bg-primary-ink text-primary-foreground border-primary":"bg-background text-muted-foreground border-border hover:border-primary/40"}`,children:[e.jsx(r,{className:"h-3.5 w-3.5"})," ",i.label,e.jsx("span",{className:`text-micro ml-1 ${x?"text-primary-foreground
1/80":"text-muted-foreground"}`,children:i.hint})]},i.id)})})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx(C,{htmlFor:"cmp-city",className:"text-xs",children:"City"}),e.jsx(O,{id:"cmp-city",value:d,onChange:i=>f(i.target.value),placeholder:"Brooklyn",className:"h-9 mt-1"})]}),e.jsxs("div",{children:[e.jsx(C,{htmlFor:"cmp-region",className:"text-xs",children:"Region / State"}),e.jsx(O,{id:"cmp-region",value:h,onChange:i=>k(i.target.value),placeholder:"NY",className:"h-9 mt-1"})]}),e.jsxs("div",{children:[e.jsx(C,{htmlFor:"cmp-country",className:"text-xs",children:"Country"}),e.jsx(O,{id:"cmp-country",value:_,onChange:i=>N(i.target.value),placeholder:"USA",className:"h-9 mt-1"})]})]}),B&&e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(C,{htmlFor:"cmp-area",className:"text-xs",children:"Service area (optional)"}),e.jsx(O,{id:"cmp-area",value:p,onChange:i=>S(i.target.value),placeholder:"Brooklyn + Lower Manhattan",className:"h-9 mt-1"})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-xs",children:"Local radius"}),e.jsx("div",{className:"flex gap-1.5 mt-1.5",children:Le.map(i=>e.jsxs(m,{variant:T===i?"default":"outline",className:"cursor-pointer select-none",onClick:()=>u(i),children:[i," km"]},i))})]})]}),e.jsx(F,{onClick:()=>s({scopes:n,location:{city:d||void 0,region:h||void 0,country:_||void 0},serviceArea:p||void 0,radiusKm:B?T:void 0}),disabled:a||n.length===0,size:"lg",children:a?e.jsxs(e.Fragment,{children:[e.jsx(U,{className:"h-4 w-4 mr-2 animate-spin"}),"Analyzing…"]}):e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"h-4 w-4 mr-2"}),l]})})]})}function Pe({brandProfileId:t,orgId:a}){var A,L,P,i;const[s,l]=o.useState(null),[n,c]=o.useState([]),[d,f]=o.useState(!0),[h,k]=o.useState(!1),[_,N]=o.useState(!1),p=async()=>{f(!0);const[r,x]=await Promise.all([K.getLatestAudit(t),K.getCompetitors(t)]);l(r),c(x),f(!1)};o.useEffect(()=>{p()},[t]);const S=async r=>{var x,y;k(!0),N(!1);try{const g=await K.runAnalysis(t,a,r?{scopes:r.scopes,locationOverride:r.location,radiusKm:r.radiusKm,serviceArea:r.serviceArea}:void 0);if(!(g!=null&&g.success))throw new Error((g==null?void 0:g.error)||"Analysis failed");Y({title:"Competitor analysis complete",description:`Found ${((y=(x=g.audit)==null?void 0:x.competitors)==null?void 0:y.length)||0} competitors.`}),await p()}catch(g){Y({title:"Analysis failed",description:oe(g),variant:"destructive"})}finally{k(!1)}},T=o.useMemo(()=>{if(s)return{scopes:s.scopes||(s.scope?[s.scope]:["local","national","international"]),location:s.location||{},serviceArea:s.service_area??void 0,radiusKm:s.radius_km??void 0}},[s]),u=o.useMemo(()=>{const r={local:[],national:[],international:[]};for(const x of n){const y=x.geography||"national";y in r?r[y].push(x):r.national.push(x)}return r},[n]);if(d)return e.jsxs("div",{className:"space-y-4",children:[e.jsx(D,{className:"h-32 w-full"}),e.jsx(D,{className:"h-64 w-full"})]});if(!s)return e.jsx(v,{className:"border-dashed",children:e.jsxs(b,{className:"py-12 flex flex-col items-center text-center gap-5 max-w-2xl mx-auto",children:[e.jsx("div",{className:"h-14 w-14 rounded-2xl bg-primary/10 flex items-center justify-center",children:e.jsx(Q,{className:"h-7 w-7 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Competitor Analysis"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Discover competitors across local, national, and international tiers. Choose your geographic radius below — we'll classify, position-map, and produce an actionable plan per tier."})]}),e.jsx("div",{className:"w-full text-left bg-card/50 rounded-xl border border-border/60 p-5",children:e.jsx(J,{onRun:S,running:h,ctaLabel:"Run competitor analysis"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Takes ~60–90 seconds. Saves insights to Brand Brain."})]})});const z=new Date(s.created_at).toLocaleString(),B=s.scopes&&s.scopes.length?s.scopes:s.scope?[s.scope]:[];return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(v,{children:[e.jsx(w,{children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs(R,{className:"flex items-center gap-2 text-xl",children:[e.jsx(Q,{className:"h-5 w-5 text-primary"})," Competitive Landscape"]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-2",children:[B.map(r=>e.jsxs(m,{variant:"outline",className:"capitalize",children:[r==="local"?e.jsx(j,{className:"h-3 w-3 mr-1"}):r==="national"?e.jsx(q,{className:"h-3 w-3 mr-1"}):e.jsx(W,{className:"h-3 w-3 mr-1"}),r]},r)),s.business_archetype&&e.jsx(m,{variant:"secondary",className:"capitalize",children:s.business_archetype.replace(/_/g," ")}),s.location&&(s.location.city||s.location.country)&&e.jsxs(m,{variant:"outline",children:[e.jsx(j,{className:"h-3 w-3 mr-1"}
1),[s.location.city,s.location.country].filter(Boolean).join(", ")]}),s.service_area&&e.jsx(m,{variant:"outline",children:s.service_area}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last run: ",z]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[s.threat_level!=null&&e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-micro uppercase tracking-wide text-muted-foreground",children:"Threat level"}),e.jsxs("div",{className:"text-2xl font-bold flex items-center gap-1.5",children:[e.jsx(V,{className:"h-5 w-5 text-primary"}),s.threat_level]})]}),e.jsxs(ne,{open:_,onOpenChange:N,children:[e.jsx(ie,{asChild:!0,children:e.jsxs(F,{disabled:h,variant:"outline",size:"sm",children:[h?e.jsx(U,{className:"h-4 w-4 animate-spin"}):e.jsx(ve,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-1.5",children:"Re-run"})]})}),e.jsx(le,{align:"end",className:"w-[420px] p-4",children:e.jsx(J,{initial:T,running:h,onRun:S,ctaLabel:"Re-run analysis"})})]}),e.jsx(F,{onClick:()=>S(),disabled:h,variant:"ghost",size:"sm",title:"Quick re-run with same settings",children:e.jsx(ce,{className:"h-4 w-4"})})]})]})}),s.overall_summary&&e.jsx(b,{children:e.jsx("p",{className:"text-sm text-foreground/85 leading-relaxed",children:s.overall_summary})})]}),s.positioning_map&&e.jsx(Ce,{map:s.positioning_map}),!!n.length&&e.jsxs(pe,{defaultValue:u.local.length?"local":u.national.length?"national":"international",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 mb-3",children:[e.jsxs("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:["Competitors (",n.length,")"]}),e.jsxs(ge,{className:"h-auto gap-1.5 rounded-2xl bg-cream/80 border border-border p-1.5 shadow-paper",children:[e.jsxs($,{value:"local",disabled:!u.local.length,className:"rounded-xl text-muted-foreground transition-all data-[state=active]:bg-primary-ink data-[state=active]:text-primary-foreground data-[state=active]:shadow-paper",children:[e.jsx(j,{className:"h-3.5 w-3.5 mr-1"}),"Local ",e.jsx("span",{className:"ml-1.5 text-micro opacity-70",children:u.local.length})]}),e.jsxs($,{value:"national",disabled:!u.national.length,className:"rounded-xl text-muted-foreground transition-all data-[state=active]:bg-primary-ink data-[state=active]:text-primary-foreground data-[state=active]:shadow-paper",children:[e.jsx(q,{className:"h-3.5 w-3.5 mr-1"}),"National ",e.jsx("span",{className:"ml-1.5 text-micro opacity-70",children:u.national.length})]}),e.jsxs($,{value:"international",disabled:!u.international.length,className:"rounded-xl text-muted-foreground transition-all data-[state=active]:bg-primary-ink data-[state=active]:text-primary-foreground data-[state=active]:shadow-paper",children:[e.jsx(W,{className:"h-3.5 w-3.5 mr-1"}),"International ",e.jsx("span",{className:"ml-1.5 text-micro opacity-70",children:u.international.length})]})]})]}),e.jsx(I,{value:"local",className:"mt-0",children:e.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:u.local.map(r=>e.jsx(_e,{competitor:r},r.id))})}),e.jsx(I,{value:"national",className:"mt-0",children:e.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:u.national.map(r=>e.jsx(G,{competitor:r},r.id))})}),e.jsx(I,{value:"international",className:"mt-0",children:e.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:u.international.map(r=>e.jsx(G,{competitor:r},r.id))})})]}),s.swot&&e.jsxs(v,{children:[e.jsx(w,{children:e.jsx(R,{className:"text-base",children:"SWOT"})}),e.jsx(b,{className:"grid gap-4 sm:grid-cols-2",children:["strengths","weaknesses","opportunities","threats"].map(r=>e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground mb-2",children:r}),e.jsx("ul",{className:"space-y-1",children:(s.swot[r]||[]).map((x,y)=>e.jsxs("li",{className:"text-sm text-foreground/80",children:["• ",x]},y))})]},r))})]}),!!((A=s.local_whitespace)!=null&&A.length)&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(j,{className:"h-4 w-4 text-primary"}),e.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-muted-foreground",children:"Local opportunities"})]}),e.jsx(H,{items:s.local_whitespace})]}),!!((L=s.whitespace)!=null&&L.length)&&e.jsx(H,{items:s.whitespace}),!!((P=s.local_action_plan)!=null&&P.length)&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(j,{className:"h-4 w-4 text-primary"}),e.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-muted-foreground",children:"Local action plan"})]}),e.jsx(X,{items:s.local_action_plan})]}),!!((i=s.action_plan)!=null&&i.length)&&e.jsx(X,{items:s.action_plan})]})}function Ue(){const t=de(),{brandId:a,orgId:s}=me(),{currentWorkspace:l,isLoading:n}=xe(),{isLoading:c}
1=ue(),d=s||(l==null?void 0:l.id),[f,h]=o.useState(!0),[k,_]=o.useState(null);return o.useEffect(()=>{if(!a||!d)return;let N=!1;return(async()=>{h(!0);try{const p=await be.getBrandProfile(a);N||_(p)}catch(p){console.error("Competitors load error:",p)}finally{N||h(!1)}})(),()=>{N=!0}},[a,d]),o.useEffect(()=>{!c&&!n&&!d&&t("/workspace-redirect",{replace:!0})},[d,c,n,t]),e.jsx(he,{breadcrumbs:[{label:"Competitors"}],children:e.jsx("div",{className:"w-full mx-auto",children:f||c||n?e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(U,{className:"h-8 w-8 animate-spin text-primary"})}):a&&d&&e.jsx(Pe,{brandProfileId:a,orgId:d})})})}export{Ue 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.