PageSourceSearch

https://answersocrates.com/_next/static/chunks/835-26ea892b5ed141be.js?dpl=dpl_2M1J3dcq4GrN7iJQpe37e7ZbMVD6

js answersocrates.com collected 2026-10-02 03:45:14 UTC 41,742 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[835],{16455:(e,t,s)=>{s.d(t,{r:()=>i});var a=s(30955),r=s(48219),l=s(10139),n=s(9667),c=s(95659);function i(e){let{onSaved:t,variant:s}=e,i=(0,c.c)("brandTrackerApp.brandForm"),o=(0,c.c)("brandTrackerApp.common"),[d,x]=(0,r.useState)("enter"),[h,m]=(0,r.useState)(""),[u,p]=(0,r.useState)(""),[b,f]=(0,r.useState)(""),[j,g]=(0,r.useState)(!1),[v,w]=(0,r.useState)(null);async function N(e){e.preventDefault(),w(null);let a=u.trim();if(!a)return void w(i("errors.nameRequired"));g(!0);try{let e=await fetch("/api/llm-tracker/brands",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a,website:b.trim()||void 0})}),l=await e.json();if(!e.ok){var r;w(null!=(r=l.error)?r:i("errors.saveFailed")),g(!1);return}t(l),g(!1),"inline"===s&&(x("enter"),m(""),p(""),f(""),w(null))}catch(e){w(i("errors.connection")),g(!1)}}let y=(0,a.jsxs)("form",{onSubmit:function(e){e.preventDefault();let t=h.trim();if(t){if(/[./]/.test(t)){let e=t.startsWith("http")?t:"https://".concat(t);try{var s;let t=null!=(s=new URL(e).hostname.replace(/^www\./,"").split(".")[0])?s:"";p(t.charAt(0).toUpperCase()+t.slice(1)),f(e)}catch(e){p(t),f("")}}else p(t),f("");x("verify")}},className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{value:h,onChange:e=>m(e.target.value),placeholder:i("enterPlaceholder"),className:"h-11 flex-1 rounded-lg border border-socrates-650 bg-socrates-700 px-3 text-sm text-white transition-colors placeholder:text-white/50 focus:border-socrates-100 focus:outline-none",autoFocus:"enter"===d}),(0,a.jsxs)("button",{type:"submit",disabled:!h.trim(),className:"inline-flex h-11 shrink-0 items-center gap-2 rounded-lg bg-socrates-100 px-4 text-sm font-semibold text-socrates-900 transition-colors hover:bg-socrates-100/90 disabled:opacity-40",children:[i("go")," ",(0,a.jsx)(l.A,{className:"h-4 w-4"})]})]}),"onboarding"===s&&(0,a.jsx)("p",{className:"text-center text-xs text-white/60",children:i("onboardingNote")})]}),k=(0,a.jsx)("form",{onSubmit:N,className:"space-y-4",children:(0,a.jsxs)("div",{className:"space-y-3 rounded-xl border border-socrates-650 bg-socrates-700 p-4",children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-white",children:i("verifyTitle")}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1.5 block text-xs text-white",children:i("nameLabel")}),(0,a.jsx)("input",{value:u,onChange:e=>p(e.target.value),placeholder:i("namePlaceholder"),className:"h-10 w-full rounded-lg border border-socrates-650 bg-socrates-750 px-3 text-sm text-white transition-colors placeholder:text-white/50 focus:border-socrates-100 focus:outline-none",autoFocus:!0})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"mb-1.5 block text-xs text-white",children:[i("websiteLabel")," ",(0,a.jsx)("span",{className:"text-white/50",children:o("optional")})]}),(0,a.jsx)("input",{value:b,onChange:e=>f(e.target.value),placeholder:"https://yoursite.com",className:"h-10 w-full rounded-lg border border-socrates-650 bg-socrates-750 px-3 text-sm text-white transition-colors placeholder:text-white/50 focus:border-socrates-100 focus:outline-none"})]}),v&&(0,a.jsx)("p",{className:"text-sm text-bad",children:v})]}),(0,a.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,a.jsx)("button",{type:"button",onClick:()=>x("enter"),disabled:j,className:"h-10 flex-1 rounded-lg border border-socrates-650 text-sm text-neutral-200 transition-colors hover:border-socrates-600 hover:text-accent2 disabled:opacity-40",children:i("back")}),(0,a.jsx)("button",{type:"submit",disabled:j||!u.trim(),className:"inline-flex h-10 flex-1 items-center justify-center gap-2 rounded-lg bg-socrates-100 text-sm font-semibold text-socrates-900 transition-colors hover:bg-socrates-100/90 disabled:opacity-40",children:j?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.A,{className:"h-4 w-4 animate-spin"})," ",i("saving")]}):(0,a.jsxs)(a.Fragment,{children:["onboarding"===s?i("startTracking"):i("save")," ",(0,a.jsx)(l.A,{className:"h-4 w-4"})]})})]})]})});return"onboarding"===s?(0,a.jsx)("div",{className:"flex flex-col items-center justify-center px-4 py-12",children:(0,a.jsxs)("div",{className:"w-full max-w-lg space-y-8",children:[(0,a.jsxs)("div",{className:"space-y-2 text-center",children:[(0,a.jsx)("p",{className:"text-xs font-medium uppercase tracking-widest text-white",children:i("onboarding.eyebrow")}),(0,a.jsx)("h2",{className:"font-serif text-3xl font-semibold leading-tight text-white",children:i("onboarding.title")}),(0,a.jsx)("p",{className:"mt-2 text-sm text-white",children:i("onboarding.subtitle")})]}
1),"enter"===d?(0,a.jsx)("div",{className:"space-y-4 [&_button]:h-12 [&_input]:h-12 [&_input]:px-4 [&_input]:text-base",children:y}):k]})}):"enter"===d?y:k}},45461:(e,t,s)=>{s.d(t,{cn:()=>l});var a=s(70047),r=s(75981);function l(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return(0,r.QP)((0,a.$)(t))}},80835:(e,t,s)=>{s.r(t),s.d(t,{default:()=>Q});var a=s(30955),r=s(95659),l=s(48219),n=s(9667),c=s(67450),i=s(9311),o=s(73572),d=s(61246),x=s(44429),h=s(33602),m=s(54567),u=s(64498),p=s(48381),b=s(11396),f=s(88776),j=s(72488),g=s(61971),v=s(45461);let w={light:"",dark:".dark"},N=l.createContext(null);function y(){let e=l.useContext(N);if(!e)throw Error("useChart must be used within a <ChartContainer />");return e}let k=l.forwardRef((e,t)=>{let{id:s,className:r,children:n,config:c,...i}=e,o=l.useId(),d="chart-".concat(s||o.replace(/:/g,""));return(0,a.jsx)(N.Provider,{value:{config:c},children:(0,a.jsxs)("div",{"data-chart":d,ref:t,className:(0,v.cn)("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",r),...i,children:[(0,a.jsx)(S,{id:d,config:c}
1),(0,a.jsx)(f.u,{children:n})]})})});k.displayName="Chart";let S=e=>{let{id:t,config:s}=e,r=Object.entries(s).filter(e=>{let[,t]=e;return t.theme||t.color});return r.length?(0,a.jsx)("style",{dangerouslySetInnerHTML:{__html:Object.entries(w).map(e=>{let[s,a]=e;return"\n".concat(a," [data-chart=").concat(t,"] {\n").concat(r.map(e=>{var t;let[a,r]=e,l=(null==(t=r.theme)?void 0:t[s])||r.color;return l?"  --color-".concat(a,": ").concat(l,";"):null}).join("\n"),"\n}\n")}).join("\n")}}):null},C=j.m,T=l.forwardRef((e,t)=>{let{active:s,payload:r,className:n,indicator:c="dot",hideLabel:i=!1,hideIndicator:o=!1,label:d,labelFormatter:x,labelClassName:h,formatter:m,color:u,nameKey:p,labelKey:b}=e,{config:f}=y(),j=l.useMemo(()=>{var e;if(i||!(null==r?void 0:r.length))return null;let[t]=r,s="".concat(b||(null==t?void 0:t.dataKey)||(null==t?void 0:t.name)||"value"),l=L(f,t,s),n=b||"string"!=typeof d?null==l?void 0:l.label:(null==(e=f[d])?void 0:e.label)||d;return x?(0,a.jsx)("div",{className:(0,v.cn)("font-medium",h),children:x(n,r)}):n?(0,a.jsx)("div",{className:(0,v.cn)("font-medium",h),children:n}):null},[d,x,r,i,h,f,b]);if(!s||!(null==r?void 0:r.length))return null;let g=1===r.length&&"dot"!==c;return(0,a.jsxs)("div",{ref:t,className:(0,v.cn)("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[g?null:j,(0,a.jsx)("div",{className:"grid gap-1.5",children:r.filter(e=>"none"!==e.type).map((e,t)=>{let s="".concat(p||e.name||e.dataKey||"value"),r=L(f,e,s),l=u||e.payload.fill||e.color;return(0,a.jsx)("div",{className:(0,v.cn)("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground","dot"===c&&"items-center"),children:m&&(null==e?void 0:e.value)!==void 0&&e.name?m(e.value,e.name,e,t,e.payload):(0,a.jsxs)(a.Fragment,{children:[(null==r?void 0:r.icon)?(0,a.jsx)(r.icon,{}):!o&&(0,a.jsx)("div",{className:(0,v.cn)("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":"dot"===c,"w-1":"line"===c,"w-0 border-[1.5px] border-dashed bg-transparent":"dashed"===c,"my-0.5":g&&"dashed"===c}),style:{"--color-bg":l,"--color-border":l}}),(0,a.jsxs)("div",{className:(0,v.cn)("flex flex-1 justify-between leading-none",g?"items-end":"items-center"),children:[(0,a.jsxs)("div",{className:"grid gap-1.5",children:[g?j:null,(0,a.jsx)("span",{className:"text-muted-foreground",children:(null==r?void 0:r.label)||e.name})]}),e.value&&(0,a.jsx)("span",{className:"font-mono font-medium tabular-nums text-foreground",children:e.value.toLocaleString()})]})]})},e.dataKey)})})]})});function L(e,t,s){if("object"!=typeof t||null===t)return;let a="payload"in t&&"object"==typeof t.payload&&null!==t.payload?t.payload:void 0,r=s;return s in t&&"string"==typeof t[s]?r=t[s]:a&&s in a&&"string"==typeof a[s]&&(r=a[s]),r in e?e[r]:e[s]}T.displayName="ChartTooltip",g.s,l.forwardRef((e,t)=>{let{className:s,hideIcon:r=!1,payload:l,verticalAlign:n="bottom",nameKey:c}=e,{config:i}=y();return(null==l?void 0:l.length)?(0,a.jsx)("div",{ref:t,className:(0,v.cn)("flex items-center justify-center gap-4","top"===n?"pb-3":"pt-3",s),children:l.filter(e=>"none"!==e.type).map(e=>{let t="".concat(c||e.dataKey||"value"),s=L(i,e,t);return(0,a.jsxs)("div",{className:(0,v.cn)("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[(null==s?void 0:s.icon)&&!r?(0,a.jsx)(s.icon,{}):(0,a.jsx)("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:e.color}}),null==s?void 0:s.label]},e.value)})}):null}).displayName="ChartLegend";let _={"Tool/SaaS":"#1a1a2e",Blog:"#f59e0b",Editorial:"#10b981",UGC:"#8b5cf6",Directory:"#38bdf8"};function M(e){let{text:t}=e,[s,r]=(0,l.useState)(!1),[n,o]=(0,l.useState)(null);return(0,a.jsxs)("span",{className:"inline-flex items-center",onMouseEnter:function(e){let t=e.currentTarget.getBoundingClientRect();o({x:t.left+t.width/2,y:t.top}),r(!0)},onMouseLeave:()=>r(!1),children:[(0,a.jsx)(i.A,{className:"h-3 w-3 text-neutral-200/40 hover:text-accent2 cursor-default shrink-0"}),s&&n&&(0,c.createPortal)((0,a.jsx)("span",{className:"fixed w-52 px-3 py-2 rounded-lg bg-socrates-700 border border-socrates-650 text-[11px] text-white leading-relaxed shadow-xl z-[100] pointer-events-none -translate-x-1/2",style:{left:n.x,top:n.y-8,transform:"translate(-50%, -100%)"},children:t}),document.body)]})}function D(e){var t,s;let{active:r,payload:l,label:n,brands:c,suffix:i}=e;if(!r||!(null==l?void 0:l.length))return null;let o=null==(t=l[0])?void 0:t.payload,d=null!=(s=null==o?void 0:o.fullDate)?s:n,x=c.map((e,t)=>{var s;return{brand:e,value:null!=(s=null==o?void 0:o["b".concat(t).concat(i)])?s:0}}).sort((e,t)=>
1"_sov"===i?t.value-e.value:e.value-t.value);return(0,a.jsxs)("div",{className:"rounded-lg border border-socrates-650 bg-socrates-700 px-3 py-2.5 shadow-xl text-xs min-w-[11rem]",children:[(0,a.jsx)("p",{className:"text-white text-xs mb-2",children:d}),(0,a.jsx)("div",{className:"space-y-1.5",children:x.map((e,t)=>{let{brand:s,value:r}=e;return(0,a.jsxs)("div",{className:"flex items-center justify-between gap-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:s.color}}),(0,a.jsx)("span",{className:"text-white text-sm",children:s.name})]}),(0,a.jsx)("span",{className:"text-white text-sm font-medium tabular-nums",children:"_sov"===i?"".concat(r,"%"):"#".concat(Number(r).toFixed(1))})]},t)})})]})}function B(e){let{data:t,brands:s,tab:n}=e,c=(0,r.c)("trackerShared.charts"),i="position"===n?"_pos":"_sov",p=(0,l.useMemo)(()=>{let e={};for(let t=0;t<s.length;t++){let a=s[t];a&&(e["b".concat(t).concat(i)]={label:a.name,color:a.color})}return e},[s,i]),b=(0,l.useMemo)(()=>t.map((e,a)=>{let r={...e};for(let e=0;e<s.length;e++){let s="b".concat(e).concat(i);null==r[s]&&(r[s]=function(e,t,s,a){let r="b".concat(t).concat(a),l=-1;for(let t=s-1;t>=0;t--){let s=e[t];if(null!=s&&null!=s[r]){l=t;break}}let n=-1;for(let t=s+1;t<e.length;t++){let s=e[t];if(null!=s&&null!=s[r]){n=t;break}}if(l>=0&&n>=0){let t=e[l],a=e[n];if(null==t||null==a)return 0;let c=(s-l)/(n-l);return Math.round(t[r]+c*(a[r]-t[r]))}if(l>=0){let t=e[l];return null!=t?t[r]:0}if(n>=0){let t=e[n];return null!=t?t[r]:0}return 0}(t,e,a,i))}return r}),[t,s,i]);if(0===s.length||0===t.length)return(0,a.jsx)("p",{className:"px-4 py-6 text-center text-sm text-white",children:c("noTrendData")});let f=[0,100],j=e=>"".concat(e,"%"),g=40,v=c("axis.sov"),w=!1;if("position"===n){let e=5;for(let a of t)for(let t=0;t<s.length;t++){var N;let s=null!=(N=a["b".concat(t,"_pos")])?N:0;s>e&&(e=s)}f=[1,Math.ceil(e+1)],j=e=>"#".concat(e),g=32,v=c("axis.rank"),w=!0}let y=s.map((e,t)=>({...e,idx:t}));return(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"px-2 py-4",children:(0,a.jsx)(k,{config:p,className:"aspect-auto h-[220px] w-full [&_.recharts-wrapper]:outline-none [&_svg]:outline-none [&_*:focus]:outline-none",children:(0,a.jsxs)(o.b,{data:b,margin:{left:0,right:16,top:8,bottom:0},children:[(0,a.jsx)("defs",{children:(0,a.jsxs)("filter",{id:"glow",children:[(0,a.jsx)("feGaussianBlur",{stdDeviation:"3",result:"blur"}),(0,a.jsxs)("feMerge",{children:[(0,a.jsx)("feMergeNode",{in:"blur"}),(0,a.jsx)("feMergeNode",{in:"SourceGraphic"})]})]})}),(0,a.jsx)(d.d,{strokeDasharray:"3 3",stroke:"#2d3f58"}),(0,a.jsx)(x.W,{dataKey:"date",tick:{fill:"#a0aec0",fontSize:10},axisLine:!1,tickLine:!1,interval:0}
1),(0,a.jsx)(h.h,{domain:f,reversed:w,tick:{fill:"#a0aec0",fontSize:11},axisLine:!1,tickLine:!1,tickFormatter:j,width:g,children:(0,a.jsx)(m.J,{value:v,angle:-90,position:"insideLeft",offset:10,style:{fill:"#64748b",fontSize:10,textAnchor:"middle"}})}),(0,a.jsx)(C,{cursor:{stroke:"#3b5070"},content:(0,a.jsx)(D,{brands:s,suffix:i})}),y.map(e=>(0,a.jsx)(u.N,{type:"monotone",dataKey:"b".concat(e.idx).concat(i),stroke:"var(--color-b".concat(e.idx).concat(i,")"),strokeWidth:e.isTracked?3:2,dot:{fill:e.color,r:3,strokeWidth:0},activeDot:{r:4,strokeWidth:0,fill:e.color},connectNulls:!0,filter:e.isTracked?"url(#glow)":void 0},"b".concat(e.idx).concat(i)))]})})})})}function R(e){let{sources:t}=e,s=(0,r.c)("trackerShared.charts");return 0===t.length?(0,a.jsx)("p",{className:"px-4 py-6 text-sm text-white text-center",children:s("noSourceData")}):(0,a.jsx)("div",{className:"overflow-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-socrates-650",children:[(0,a.jsx)("th",{className:"px-4 py-2 text-xs font-medium text-white text-left w-8",children:"#"}),(0,a.jsx)("th",{className:"px-4 py-2 text-xs font-medium text-white text-left",children:s("topSources.domain")}),(0,a.jsx)("th",{className:"px-4 py-2 text-xs font-medium text-white text-right",children:s("topSources.mentions")}),(0,a.jsx)("th",{className:"px-4 py-2 text-xs font-medium text-white text-right",children:s("topSources.citeRate")})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-socrates-650",children:t.map((e,t)=>(0,a.jsxs)("tr",{className:"hover:bg-socrates-650/30",children:[(0,a.jsx)("td",{className:"px-4 py-2.5 text-xs text-white tabular-nums",children:t+1}),(0,a.jsx)("td",{className:"px-4 py-2.5",children:(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,a.jsx)("img",{src:"https://www.google.com/s2/favicons?domain=".concat(e.sourceDomain,"&sz=32"),alt:"",width:16,height:16,className:"shrink-0"}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("span",{className:"text-sm text-white truncate block",children:e.sourceDomain}),e.sourceTitle&&(0,a.jsx)("span",{className:"text-[11px] text-white/60 truncate block",children:e.sourceTitle})]})]})}),(0,a.jsx)("td",{className:"px-4 py-2.5 text-right tabular-nums",children:(0,a.jsx)("span",{className:"text-sm text-white",children:e.appearances})}),(0,a.jsx)("td",{className:"px-4 py-2.5 text-right tabular-nums",children:(0,a.jsxs)("span",{className:"text-sm text-white",children:[e.avgMentionRate.toFixed(0),"%"]})})]},e.sourceDomain))})]})})}function F(e){let{data:t}=e,s=(0,r.c)("trackerShared.charts");if(0===t.length)return(0,a.jsx)("p",{className:"px-4 py-6 text-sm text-white text-center",children:s("noSourceData")});let l=t.reduce((e,t)=>e+t.count,0),n={},c=t.map(e=>{let t=e.type.toLowerCase().replace(/\s+/g,"-");return n[t]={label:e.type,color:_[e.type]},{name:t,type:e.type,count:e.count,fill:"var(--color-".concat(t,")")}});return(0,a.jsxs)("div",{className:"px-4 py-4 flex items-center gap-5",children:[(0,a.jsx)(k,{config:n,className:"shrink-0 aspect-square h-[140px]",children:(0,a.jsxs)(p.r,{children:[(0,a.jsx)(C,{cursor:!1,content:(0,a.jsx)(T,{hideLabel:!0,nameKey:"name"})}),(0,a.jsx)(b.F,{data:c,dataKey:"count",nameKey:"name",innerRadius:42,outerRadius:64,strokeWidth:0,children:(0,a.jsx)(m.J,{content:e=>{let{viewBox:t}=e;if(t&&"cx"in t&&"cy"in t)return(0,a.jsxs)("text",{x:t.cx,y:t.cy,textAnchor:"middle",dominantBaseline:"middle",children:[(0,a.jsx)("tspan",{x:t.cx,y:t.cy,className:"fill-socrates-10 text-xl font-semibold",children:l}),(0,a.jsx)("tspan",{x:t.cx,y:(t.cy||0)+16,className:"fill-socrates-25 text-[10px]",children:s("domainsByType.sources")})]})}})})]})}),(0,a.jsx)("div",{className:"flex-1 space-y-2.5 min-w-0",children:t.map(e=>{let t=l>0?Math.round(e.count/l*100):0;return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-2 h-2 rounded-sm shrink-0",style:{backgroundColor:_[e.type]}}),(0,a.jsx)("span",{className:"text-xs text-white w-16 shrink-0 truncate",children:e.type}),(0,a.jsx)("div",{className:"flex-1 h-1.5 bg-socrates-650 rounded-full overflow-hidden",children:(0,a.jsx)("div",{className:"h-full rounded-full",style:{width:"".concat(t,"%"),backgroundColor:_[e.type]}})}),(0,a.jsxs)("span",{className:"text-xs text-white tabular-nums w-8 text-right",children:[t,"%"]})]},e.type)})})]})}function A(e){let{platforms:t}=e,s=(0,r.c)("trackerShared.charts");return 0===t.length?(0,a.jsx)("p",{className:"px-4 py-6 text-sm text-white text-center",children:s("noPlatformData")}):(0,a.jsx)("div",{className:"px-4 py-3 space-y-3",children:t.map(e=>{let t=e.totalScans>0?Math.round(e.mentions/e.totalScans*100):0;return(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("img",{src:e.logo,alt:e.label,width:20,height:20,className:"shrink-0 object-contain"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,a.jsx)("span",{className:"text-xs text-white",children:e.label}),(0,a.jsxs)("span",{className:"text-xs text-white tabular-nums",children:[e.mentions,"/",e.totalScans]})]}),(0,a.jsx)("div",{className:"h-1.5 bg-socrates-650 rounded-full overflow-hidden",children:(0,a.jsx)("div",{className:"h-full rounded-full transition-all bg-socrates-25/40",style:{width:"".concat(t,"%")}})})]}),(0,a.jsxs)("span",{className:"text-xs font-medium text-white tabular-nums w-8 text-right",children:[t,"%"]})]},e.id)})})}function P(e){let{winRates:t,trackedBrand:s,allMentions:l,completedScans:n}=e,c=(0,r.c)("trackerShared.charts");if(!s)return null;let i=new Set;for(let e of l)(e.brandName.toLowerCase().includes(s.toLowerCase())||s.toLowerCase().includes(e.brandName.toLowerCase()))&&i.add(e.scanId);let o=new Map;for(let e of l){let t=e.brandName.toLowerCase();if(!(t.includes(s.toLowerCase())||s.toLowerCase().includes(t))&&i.has(e.scanId)){var d;o.set(e.brandName,(null!=(d=o.get(e.brandName))?d:0)+1)}}let x=[...o.entries()].sort((e,t)=>
1t[1]-e[1]).slice(0,8).map(e=>{let[t,s]=e;return{name:t,count:s,pct:Math.round(s/i.size*100)}});return 0===t.length&&0===x.length?null:(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-[3fr_2fr] gap-5",children:[t.length>0&&(0,a.jsxs)("div",{className:"rounded-lg border border-socrates-650 bg-socrates-750 overflow-hidden",children:[(0,a.jsxs)("div",{className:"px-4 py-3 border-b border-socrates-650",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-white",children:c("headToHead.title")}),(0,a.jsx)(M,{text:c("headToHead.tooltip")})]}),(0,a.jsx)("p",{className:"text-xs text-white mt-0.5",children:c("headToHead.subtitle")})]}),(0,a.jsx)("div",{className:"overflow-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-socrates-650",children:[(0,a.jsx)("th",{className:"px-4 py-2 text-xs font-medium text-white text-left",children:c("headToHead.competitor")}),(0,a.jsx)("th",{className:"px-4 py-2 text-xs font-medium text-white text-center",children:(0,a.jsxs)("div",{className:"inline-flex items-center gap-1",children:[c("headToHead.record")," ",(0,a.jsx)(M,{text:c("headToHead.recordTooltip")})]})}),(0,a.jsx)("th",{className:"px-4 py-2 text-xs font-medium text-white text-right w-16",children:(0,a.jsxs)("div",{className:"inline-flex items-center gap-1 justify-end",children:[c("headToHead.winPct")," ",(0,a.jsx)(M,{text:c("headToHead.winPctTooltip")})]})}),(0,a.jsx)("th",{className:"px-4 py-2 text-xs font-medium text-white text-left w-28"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-socrates-650",children:t.map(e=>{let t=Math.round(e.wins/e.total*100);return(0,a.jsxs)("tr",{className:"hover:bg-socrates-650/30",children:[(0,a.jsx)("td",{className:"px-4 py-2.5 text-sm text-white",children:e.competitor}),(0,a.jsx)("td",{className:"px-4 py-2.5 text-center",children:(0,a.jsxs)("span",{className:"text-xs tabular-nums",children:[(0,a.jsx)("span",{className:"text-green-300",children:c("headToHead.wins",{count:e.wins})}),(0,a.jsx)("span",{className:"text-white mx-0.5",children:"/"}),(0,a.jsx)("span",{className:"text-red-300",children:c("headToHead.losses",{count:e.losses})}),e.ties>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-white mx-0.5",children:"/"}),(0,a.jsx)("span",{className:"text-white",children:c("headToHead.ties",{count:e.ties})})]})]})}),(0,a.jsx)("td",{className:"px-4 py-2.5 text-right",children:(0,a.jsxs)("span",{className:"text-sm font-medium tabular-nums ".concat(t>=50?"text-green-300":"text-red-300"),children:[t,"%"]})}),(0,a.jsx)("td",{className:"px-4 py-2.5",children:(0,a.jsxs)("div",{className:"flex h-1.5 rounded-full overflow-hidden bg-socrates-650",children:[(0,a.jsx)("div",{className:"bg-green-400 h-full",style:{width:"".concat(e.wins/e.total*100,"%")}}),e.ties>0&&(0,a.jsx)("div",{className:"bg-socrates-25/20 h-full",style:{width:"".concat(e.ties/e.total*100,"%")}}),(0,a.jsx)("div",{className:"bg-red-400 h-full",style:{width:"".concat(e.losses/e.total*100,"%")}})]})})]},e.competitor)})})]})})]}),x.length>0&&(0,a.jsxs)("div",{className:"rounded-lg border border-socrates-650 bg-socrates-750 overflow-hidden",children:[(0,a.jsxs)("div",{className:"px-4 py-3 border-b border-socrates-650",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-white",children:c("coOccurrence.title")}),(0,a.jsx)(M,{text:c("coOccurrence.tooltip")})]}),(0,a.jsx)("p",{className:"text-xs text-white mt-0.5",children:c("coOccurrence.subtitle")})]}),(0,a.jsx)("div",{className:"px-4 py-3 space-y-2.5",children:x.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm text-white w-28 truncate shrink-0",children:e.name}),(0,a.jsx)("div",{className:"flex-1 h-1.5 bg-socrates-650 rounded-full overflow-hidden",children:(0,a.jsx)("div",{className:"h-full bg-socrates-100/60 rounded-full",style:{width:"".concat(e.pct,"%")}})}),(0,a.jsxs)("span",{className:"text-xs text-white tabular-nums w-12 text-right shrink-0",children:[e.count,"/",i.size]})]},e.name))})]})]})}function H(e){var t,s;let{brand:l,trackedBrand:n,allMentions:c,completedScans:i}=e,o=(0,r.c)("trackerShared.charts"),d=l.brandName.toLowerCase(),x=c.filter(e=>e.brandName.toLowerCase()===d),h=new Map;for(let e of x)for(let s of JSON.parse(e.platforms)){let a=null!=(t=h.get(s))?t:{total:0,n:0};a.total+=e.shareOfVoice,a.n++,h.set(s,a)}let m=[...h.entries()].map(e=>{let[t,s]=e;return{id:t,avg:s.total/s.n}}).sort((e,t)=>
1t.avg-e.avg),u=new Map;for(let e of x){let t=i.find(t=>t.id===e.scanId);if(t){let a=null!=(s=u.get(t.keyword))?s:{total:0,n:0};a.total+=e.shareOfVoice,a.n++,u.set(t.keyword,a)}}let p=[...u.entries()].map(e=>{let[t,s]=e;return{keyword:t,avg:s.total/s.n}}).sort((e,t)=>t.avg-e.avg).slice(0,5);return(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:5,className:"px-4 py-3 bg-socrates-700/50",children:(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-[11px] text-white uppercase tracking-wide mb-2",children:o("drillDown.sovByPlatform")}),(0,a.jsx)("div",{className:"space-y-1.5",children:m.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-white w-16 truncate",children:e.id}),(0,a.jsx)("div",{className:"flex-1 h-1 bg-socrates-650 rounded-full overflow-hidden",children:(0,a.jsx)("div",{className:"h-full bg-socrates-100 rounded-full",style:{width:"".concat(e.avg,"%")}})}),(0,a.jsxs)("span",{className:"text-xs text-white tabular-nums w-8 text-right",children:[e.avg.toFixed(0),"%"]})]},e.id))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-[11px] text-white uppercase tracking-wide mb-2",children:o("drillDown.topKeywords")}),(0,a.jsx)("div",{className:"space-y-1.5",children:p.map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-xs text-white truncate",children:e.keyword}),(0,a.jsxs)("span",{className:"text-xs text-white tabular-nums shrink-0 ml-2",children:[e.avg.toFixed(0),"%"]})]},e.keyword))})]})]})})})}function K(e){let{brands:t,trackedBrand:s,allMentions:n,completedScans:c}=e,i=(0,r.c)("trackerShared.charts"),[o,d]=(0,l.useState)(!1),[x,h]=(0,l.useState)(null);if(0===t.length)return(0,a.jsx)("p",{className:"px-4 py-6 text-sm text-white text-center",children:i("noCompetitorData")});let m=o?t:t.slice(0,5);return(0,a.jsxs)("div",{className:"overflow-auto",children:[(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-socrates-650",children:[(0,a.jsx)("th",{className:"px-4 py-2 text-xs font-medium text-white text-left w-8",children:"#"}),(0,a.jsx)("th",{className:"px-4 py-2 text-xs font-medium text-white text-left",children:i("competitors.brand")}),(0,a.jsx)("th",{className:"pl-4 pr-0 py-2 text-xs font-medium text-white text-right",children:i("competitors.visibility")}),(0,a.jsx)("th",{className:"w-4"}),(0,a.jsx)("th",{className:"pl-2 pr-4 py-2 text-xs font-medium text-white text-right",children:i("competitors.position")})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-socrates-650",children:m.map((e,t)=>{let r=!!s&&(e.brandName.toLowerCase().includes(s.toLowerCase())||s.toLowerCase().includes(e.brandName.toLowerCase())),i=x===t;return(0,a.jsxs)(l.Fragment,{children:[(0,a.jsxs)("tr",{className:"cursor-pointer transition-colors ".concat(r?"bg-primary/10":i?"bg-socrates-700/50":"hover:bg-socrates-650/30"),onClick:()=>h(i?null:t),children:[(0,a.jsx)("td",{className:"px-4 py-2.5 text-xs text-white tabular-nums",children:t+1}),(0,a.jsx)("td",{className:"px-4 py-2.5",children:(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[e.brandDomain?(0,a.jsx)("img",{src:"https://www.google.com/s2/favicons?domain=".concat(e.brandDomain,"&sz=32"),alt:"",width:16,height:16,className:"shrink-0 rounded-sm",onError:e=>{e.target.style.display="none"}}):(0,a.jsx)("div",{className:"w-4 h-4 rounded-sm bg-socrates-650 flex items-center justify-center shrink-0",children:(0,a.jsx)("span",{className:"text-[7px] text-white font-bold uppercase",children:e.brandName[0]})}),(0,a.jsx)("span",{className:"truncate text-sm ".concat(r?"text-white font-medium":"text-white"),children:e.brandName})]})}),(0,a.jsx)("td",{className:"pl-4 pr-0 py-2.5 text-right tabular-nums",children:(0,a.jsxs)("span",{className:"text-sm font-medium text-green-300",children:[e.avgSov.toFixed(0),"%"]})}),(0,a.jsx)("td",{className:"w-4 py-2.5 text-center",children:"flat"!==e.trend&&(0,a.jsx)("span",{className:"text-[10px] ".concat("up"===e.trend?"text-green-300":"text-red-300"),children:"up"===e.trend?"▲":"▼"})}),(0,a.jsx)("td",{className:"pl-2 pr-4 py-2.5 text-right tabular-nums",children:(0,a.jsx)("span",{className:"text-sm text-white",children:e.avgRank.toFixed(1)})})]}),i&&(0,a.jsx)(H,{brand:e,trackedBrand:s,allMentions:n,completedScans:c})]},t)})})]}),t.length>5&&(0,a.jsx)("button",{onClick:()=>d(e=>!e),className:"w-full py-2 text-xs text-neutral-200 hover:text-accent2 transition-colors border-t border-socrates-650",children:o?i("competitors.showLess"):i("competitors.showAll",{count:t.length})})]})}function O(e){let{trendData:t,trendBrands:s,topBrands:n,topSources:c,domainTypeCounts:i,trackedBrand:o,platformStats:d,winRates:x,keywordGaps:h,allMentions:m,completedScans:u}=e,p=(0,r.c)("trackerShared.charts"),[b,f]=(0,l.useState)("visibility");return(0,a.jsxs)("div",{className:"space-y-5",children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-[3fr_2fr] gap-5",children:[(0,a.jsxs)("div",{className:"rounded-lg border border-socrates-650 bg-socrates-750",children:[(0,a.jsxs)("div",{className:"px-4 py-3 border-b border-socrates-650 flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-white",children:p("trend.title")}),(0,a.jsx)("p",{className:"text-xs text-white mt-0.5",children:p("trend.subtitle")})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 bg-socrates-700 rounded-lg p-0.5",children:[(0,a.jsx)("button",{onClick:()=>f("visibility"),className:"px-3 py-1 text-xs rounded-md transition-colors ".concat("visibility"===b?"bg-socrates-650 text-white font-medium":"text-neutral-200 hover:text-accent2"),children:p("trend.tabVisibility")}),(0,a.jsx)("button",{onClick:()=>f("position"),className:"px-3 py-1 text-xs rounded-md transition-colors ".concat("position"===b?"bg-socrates-650 text-white font-medium":"text-neutral-200 hover:text-accent2"),children:p("trend.tabPosition")})]})]}),(0,a.jsx)(B,{data:t,brands:s,tab:b})]}),(0,a.jsxs)("div",{className:"rounded-lg border border-socrates-650 bg-socrates-750 overflow-hidden",children:[(0,a.jsxs)("div",{className:"px-4 py-3 border-b border-socrates-650",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-white",children:p("competitors.title")}),(0,a.jsx)("p",{className:"text-xs text-white mt-0.5",children:p("competitors.subtitle")})]}),(0,a.jsx)(K,{brands:n,trackedBrand:o,allMentions:m,completedScans:u})]})]}),(0,a.jsx)(P,{winRates:x,keywordGaps:h,trackedBrand:o,allMentions:m,completedScans:u}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-[3fr_2fr] gap-5",children:[(0,a.jsxs)("div",{className:"rounded-lg border border-socrates-650 bg-socrates-750 overflow-hidden",children:[(0,a.jsxs)("div",{className:"px-4 py-3 border-b border-socrates-650",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-white",children:p("topSources.title")}),(0,a.jsx)("p",{className:"text-xs text-white mt-0.5",children:p("topSources.subtitle")})]}),(0,a.jsx)(R,{sources:c})]}),(0,a.jsxs)("div",{className:"rounded-lg border border-socrates-650 bg-socrates-750 overflow-hidden space-y-0",children:[(0,a.jsxs)("div",{className:"px-4 py-3 border-b border-socrates-650",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-white",children:p("domainsByType.title")}),(0,a.jsx)("p",{className:"text-xs text-white mt-0.5",children:p("domainsByType.subtitle")})]}),(0,a.jsx)(F,{data:i}),d.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"px-4 py-3 border-t border-socrates-650",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-white",children:p("platformRate.title")}),(0,a.jsx)("p",{className:"text-xs text-white mt-0.5",children:p("platformRate.subtitle")})]}),(0,a.jsx)(A,{platforms:d})]})]})]})]})}
1var I=s(48580),z=s(33615),E=s(16455);function G(e){let{onSaved:t}=e;return(0,a.jsx)(E.r,{variant:"onboarding",onSaved:t})}let W=[{value:"chatgpt",label:"ChatGPT"},{value:"perplexity",label:"Perplexity"},{value:"claude",label:"Claude"},{value:"gemini",label:"Gemini"},{value:"deepseek",label:"DeepSeek"},{value:"grok",label:"Grok"}];function V(e){let{options:t,filters:s,onChange:n}=e,c=(0,r.c)("brandTrackerApp.dashboard.filters"),[i,o]=(0,l.useState)(!1),d=Object.values(s).filter(Boolean).length,x="h-8 bg-socrates-700 border border-socrates-600 text-white text-xs rounded-lg px-2.5 pr-7 outline-none focus:border-socrates-100 transition-colors cursor-pointer";return(0,a.jsxs)("div",{children:[(0,a.jsxs)("button",{onClick:()=>o(e=>!e),className:"inline-flex items-center gap-2 rounded-lg border border-socrates-650 bg-socrates-750 px-3 py-1.5 transition-colors hover:border-socrates-600",children:[(0,a.jsx)("svg",{className:"h-3.5 w-3.5 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),(0,a.jsx)("span",{className:"text-xs font-medium text-white",children:c("button")}),d>0&&(0,a.jsx)("span",{className:"rounded-full bg-socrates-100/20 px-1.5 py-0.5 text-[10px] font-medium text-white",children:d}),(0,a.jsx)("svg",{className:"h-3 w-3 text-white transition-transform ".concat(i?"rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m6 9 6 6 6-6"})})]}),i&&(0,a.jsx)("div",{className:"mt-2 rounded-lg border border-socrates-650 bg-socrates-750 px-4 py-3",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("select",{value:s.days,onChange:e=>n({...s,days:e.target.value}),className:x,children:[(0,a.jsx)("option",{value:"",children:c("dateRange")}),(0,a.jsx)("option",{value:"7",children:c("last7")}),(0,a.jsx)("option",{value:"30",children:c("last30")}),(0,a.jsx)("option",{value:"90",children:c("last90")})]}),(0,a.jsxs)("select",{value:s.keyword,onChange:e=>n({...s,keyword:e.target.value}),className:"".concat(x," max-w-[180px]"),children:[(0,a.jsx)("option",{value:"",children:c("keyword")}),t.keywords.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]}),(0,a.jsxs)("select",{value:s.platform,onChange:e=>n({...s,platform:e.target.value}),className:x,children:[(0,a.jsx)("option",{value:"",children:c("aiModel")}),W.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))]}),t.locations.length>0&&(0,a.jsxs)("select",{value:s.location,onChange:e=>n({...s,location:e.target.value}),className:x,children:[(0,a.jsx)("option",{value:"",children:c("location")}),t.locations.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]}),d>0&&(0,a.jsx)("button",{onClick:()=>n({days:"",keyword:"",platform:"",location:""}),className:"px-2 py-1.5 text-[11px] text-neutral-200 transition-colors hover:text-accent2",children:c("clearAll")})]})})]})}function J(e){let{label:t,value:s,sub:r}=e;return(0,a.jsxs)("div",{className:"rounded-lg border border-socrates-650 bg-socrates-750 px-4 py-3",children:[(0,a.jsx)("p",{className:"text-xs uppercase tracking-wide text-white",children:t}),(0,a.jsx)("div",{className:"mt-1 text-2xl font-semibold text-white",children:s}),r&&(0,a.jsx)("p",{className:"mt-0.5 text-xs text-white/60",children:r})]})}function U(){let e=(0,r.c)("brandTrackerApp.dashboard"),{totalCreditsAvailable:t,llmLimit:s}=(0,z.R)();return s===1/0?null:(0,a.jsxs)("div",{className:"flex flex-col items-end leading-tight",children:[(0,a.jsx)("span",{className:"text-xl font-bold tabular-nums text-white",children:t}),(0,a.jsx)("span",{className:"text-xs text-white",children:e("creditsRemaining")})]})}function q(e){let{refreshKey:t,onBrandSet:s,brandScopeId:c}=e,i=(0,r.c)("brandTrackerApp.dashboard"),[o,d]=(0,l.useState)(null),[x,h]=(0,l.useState)(!0),[m,u]=(0,l.useState)(null),[p,b]=(0,l.useState)({days:"",keyword:"",platform:"",location:""}),f=(0,l.useCallback)(async(e,t)=>{h(!0),u(null);try{let s=new URLSearchParams;c&&s.set("brandId",c),e.days&&s.set("days",e.days),e.keyword&&s.set("keyword",e.keyword),e.platform&&s.set("platform",e.platform),e.location&&s.set("location",e.location);let a=await fetch("/api/llm-tracker/dashboard?".concat(s.toString()),{signal:t});if(null==t?void 0:t.aborted)return;if(401===a.status)return void u("signIn");if(!a.ok)return void u("loadFailed");d(await a.json())}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;(null==t?void 0:t.aborted)||u("loadFailed")}finally{(null==t?void 0:t.aborted)||h(!1)}},[c]);return((0,l.useEffect)(()=>{let e=new AbortController,t=setTimeout(()=>{f(p,e.signal)},0);return()=>{clearTimeout(t),e.abort()}},[f,p,t,c]),x)?(0,a.jsxs)("div",{className:"flex items-center justify-center py-20 text-white",children:[(0,a.jsx)(n.A,{className:"mr-2 h-5 w-5 animate-spin"}),i("loading")]}):m?(0,a.jsxs)("div",{className:"rounded-lg border border-dashed border-socrates-650 p-10 text-center",children:[(0,a.jsx)("p",{className:"font-medium text-white",children:i("errors.".concat(m))}),"signIn"===m&&(0,a.jsx)("p",{className:"mt-2 text-sm text-white",children:i("errors.signInDetail")})]}):o?o.brand?(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0 space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h2",{className:"font-serif text-xl font-semibold text-white",children:i("header.dashboard")}),(0,a.jsx)("h3",{className:"font-bold text-white",children:"|"}),(0,a.jsx)("h1",{className:"text-lg font-semibold text-white",children:"LLM Brand Tracker"})]}),(0,a.jsxs)("p",{className:"text-sm text-white",children:[i("header.tracking")," ",(0,a.jsx)("span",{className:"font-medium text-white",children:o.brand.name}),o.brand.domain&&(0,a.jsxs)("span",{className:"text-white/50",children:[" \xb7 ",o.brand.domain]})]})]}),(0,a.jsx)("div",{className:"flex shrink-0 flex-wrap items-center gap-3",children:(0,a.jsx)(U,{})})]}),(0,a.jsx)(V,{options:{keywords:o.allKeywords,locations:o.allLocations},filters:p,onChange:e=>{b(e)}}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-5",children:[(0,a.jsx)(J,{label:i("stats.totalScans"),value:o.totalScans,sub:"".concat(i("stats.completed",{count:o.completedCount})).concat(o.pendingCount>0?", ".concat(i("stats.pending",{count:o.pendingCount})):"")}),(0,a.jsx)(J,{label:i("stats.totalMentions"),value:o.totalMentions,sub:" "}),(0,a.jsx)(J,{label:i("stats.avgSov"),value:null!==o.avgSov?"".concat(o.avgSov.toFixed(0),"%"):"0%",sub:i("stats.inScans",{tracked:o.trackedMentionCount,completed:o.completedCount})}),(0,a.jsx)(J,{label:i("stats.bestRank"),value:null!==o.bestRank?"#".concat(o.bestRank):"—",sub:i("stats.highestPosition")}),(0,a.jsxs)("div",{className:"rounded-lg border border-socrates-650 bg-socrates-750 px-4 py-3",children:[(0,a.jsx)("p",{className:"text-xs uppercase tracking-wide text-white",children:i("stats.mentionedBy")}),(0,a.jsx)("div",{className:"mt-1.5 flex items-center",children:o.topPlatforms.length>
10?(0,a.jsx)("div",{className:"flex -space-x-1.5",children:o.topPlatforms.map(e=>{let{id:t}=e,s=I.Lh[t];return s?(0,a.jsx)("div",{className:"flex h-7 w-7 items-center justify-center rounded-full border-2 border-socrates-750 bg-socrates-650",title:s.label,children:(0,a.jsx)("img",{src:s.logo,alt:s.label,width:16,height:16,className:"object-contain"})},t):null})}):(0,a.jsx)("span",{className:"text-2xl font-semibold text-white",children:"—"})}),(0,a.jsx)("p",{className:"mt-1 text-xs text-white/60",children:o.topPlatforms.length>0?i("stats.ofPlatforms",{count:o.topPlatforms.length}):i("stats.noDataYet")})]})]}),o.completedCount>0?(0,a.jsx)(O,{trendData:o.trendData,trendBrands:o.trendBrands,topBrands:o.topBrands,topSources:o.topSources,domainTypeCounts:o.domainTypeCounts,trackedBrand:o.trackedBrand,platformStats:o.platformStats,winRates:o.winRates,keywordGaps:o.keywordGaps,allMentions:o.allMentions,completedScans:o.completedScans}):(0,a.jsxs)("div",{className:"space-y-3 rounded-lg border border-dashed border-socrates-650 p-10 text-center",children:[(0,a.jsx)("p",{className:"font-medium text-white",children:i("empty.title")}),(0,a.jsx)("p",{className:"text-sm text-white",children:i.rich("empty.body",{b:e=>(0,a.jsx)("strong",{children:e})})})]})]}):(0,a.jsx)(G,{onSaved:e=>{d({...o,brand:e,trackedBrand:e.name}),null==s||s(e)}}):null}function Q(){var e;let t=(0,r.c)("brandTrackerApp.common"),{dashboardKey:s,activeBrand:l,brandsReady:n,notifyBrandCreated:c}=(0,z.R)();return n?(0,a.jsx)(q,{refreshKey:s,brandScopeId:null!=(e=null==l?void 0:l.id)?e:null,onBrandSet:e=>{c({id:e.id,name:e.name,website:e.website,domain:e.domain})}}):(0,a.jsx)("div",{className:"py-20 text-center text-sm text-white",children:t("loading")})}}}]);

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.