1import{j as e}from"./ui-components-CrH3hhmI.js";import{e as U,r as O,f as ae,d as se}from"./react-core-Df-1f7lZ.js";import{C as u,a7 as T,a8 as P,be as I,a9 as y,N as $,J as M,a1 as R,Z as le,bc as ie,f as L,R as oe,bf as V,m as x,Y as de,b as ne,i as ce,d as H,as as xe,bA as me,by as ge,bb as he,ab as pe,bz as ue,A as X}from"./index-baCrhAE7.js";import"./separator-R5SP9WNk.js";import{u as B}from"./index-D53xcyRy.js";import{f as j,a as N,g as ye}from"./keywordAnalysisDetector-tuziZfA4.js";import{E as be}from"./eye-DshnV75E.js";import{E as fe}from"./eye-off-CrXqULuM.js";import{R as K,U as je,a as Y,V as Q,X as Z,Y as q,T as z,W as ke,f as Ne,b as ve,d as te,P as we,c as Ce,Z as _e,n as Se,e as Oe,L as Te}from"./charts-DACaTPEh.js";import{D as F}from"./dollar-sign-J8bSMMfI.js";import{C as G}from"./chart-pie-mWUhJ_RG.js";import{S as Pe,B as De,C as Fe,a as Me,L as Ae,P as $e,e as Be,p as Le,c as Re,d as Ke,f as ze,g as Ve,b as Ee,A as Ie,h as He}from"./index-Dgwr6AzC.js";import{S as Ge,a as We,b as Ue,c as Je,d as Ye}from"./select-Ble92Qbb.js";import{T as E}from"./trending-down-B2twnPVM.js";import{T as Ze,a as qe,b as W,c as Xe}from"./tabs-o7ng_1Xx.js";import{C as Qe}from"./calculator-M2L-wcF4.js";import{G as et}from"./git-branch-CEGzbOi7.js";import{W as tt,G as J}from"./wallet-BexcAufF.js";import{C as rt}from"./chart-line-WrYezGkh.js";import"./utils-BZSOOpUI.js";import"./editor-wwdhYSyT.js";const ee=()=>{const m=document.documentElement.classList.contains("dark");return{text:m?"#ffffff":"#374151",textSecondary:m?"#9ca3af":"#6b7280",textMuted:m?"#6b7280":"#9ca3af",background:m?"#1f2937":"#ffffff",backgroundSecondary:m?"#374151":"#f9fafb",border:m?"#4b5563":"#e5e7eb",axisText:m?"#d1d5db":"#374151",gridLine:m?"#374151":"#e5e7eb",tooltipBackground:m?"#374151":"#ffffff",tooltipBorder:m?"#4b5563":"#e5e7eb",legendText:m?"#d1d5db":"#374151"}},A=()=>{const[m,r]=U.useState(ee());return U.useEffect(()=>{const c=()=>r(ee()),l=new MutationObserver(c);return l.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>l.disconnect()},[]),m},at=({active:m,payload:r})=>{const c=A();if(m&&r?.length){const l=r[0].payload;return e.jsx("div",{className:"rounded-xl border p-5 shadow-2xl backdrop-blur-sm max-w-xs dark:bg-gray-800/80 dark:border-gray-700",style:{backgroundColor:c.tooltipBackground,borderColor:c.tooltipBorder},children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`w-3 h-3 rounded-full mt-1 shadow-sm ${l.isOpportunity?"bg-gradient-to-r from-orange-400 to-red-500 dark:from-orange-300 dark:to-red-400":"bg-gradient-to-r from-blue-400 to-indigo-500 dark:from-blue-300 dark:to-indigo-400"}`}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"font-bold text-gray-900 dark:text-gray-100 mb-3 leading-tight",children:[l.keyword,l.isOpportunity&&" ð"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(M,{className:"w-4 h-4 text-blue-500 dark:text-blue-400"}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Volume:"}),e.jsx("span",{className:"font-bold text-blue-600 dark:text-blue-400",children:j(l.volume)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{className:"w-4 h-4 text-green-500 dark:text-green-400"}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:"CPC:"}),e.jsx("span",{className:"font-bold text-green-600 dark:text-green-400",children:N(l.cpc)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($,{className:"w-4 h-4 text-purple-500 dark:text-purple-400"}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Score:"}),e.jsx("span",{className:"font-bold text-purple-600 dark:text-purple-400",children:(l.score||0).toFixed(3)})]})]}),l.isOpportunity&&e.jsx("div",{className:"mt-3 px-2 py-1 bg-orange-100 dark:bg-orange-900/50 rounded-lg border border-orange-200 dark:border-orange-700",children:e.jsx("span",{className:"text-xs font-medium text-orange-700 dark:text-orange-300",children:"High Opportunity Keyword"})})]})]})})}return null},st=({cx:m,cy:r,payload:c})=>{if(!c)return null;const l=A();return e.jsx("circle",{cx:m,cy:r,r:Math.max(4,Math.min(10,c.size/15)),fill:c.color,fillOpacity:c.isOpportunity?.9:.7,stroke:c.isOpportunity?l.opportunityStroke:l.regularStroke,strokeWidth:c.isOpportunity?2:1,strokeOpacity:.8,className:"hover:stroke-[3px] transition-all cursor-pointer",style:{filter:c.isOpportunity?"drop-shadow(0 2px 4px rgba(255, 107, 53, 0.3))":"drop-shadow(0 1px 2px rgba(79, 70, 229, 0.2))"}})},lt=({jsonData:m})=>{const r=A(),[c,l]=O.useState(!1),g=m?.visualizations_data?.scatter_plot_data,b=m?.filtered_keywords||[];if(!g&&b.length===0)return e.jsxs(u,{className:"border-0 shadow-xl bg-white dark:bg-gray-900/80 backdrop-blur-md border border-gray-200 dark:border-gray-700",children:[e.jsx(T,{className:"pb-6 bg-white dark:bg-gray-800/50 rounded-t-lg border-b border-gray-100 dark:border-gray-700",children:e.jsxs(P,{className:"flex items-center gap-3 text-xl",children:[e.jsx("div",{className:"p-3 bg-blue-600 dar
1k:bg-gray-800/70 backdrop-blur-sm rounded-xl shadow-lg",children:e.jsx(I,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{children:[e.jsx("span",{className:"bg-gradient-to-r from-purple-600 to-blue-600 dark:from-purple-400 dark:to-blue-500 bg-clip-text text-transparent font-bold",children:"Keyword Opportunity Matrix"}),e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-400 font-normal mt-1",children:"Volume vs. Cost analysis"})]})]})}),e.jsx(y,{children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-gray-700 dark:text-gray-400",children:[e.jsx("div",{className:"w-20 h-20 mb-6 bg-gray-100 dark:bg-gray-700 rounded-full flex items-center justify-center",children:e.jsx(I,{className:"w-10 h-10 text-gray-600 dark:text-gray-500"})}),e.jsx("p",{className:"text-lg font-semibold mb-2 text-gray-900 dark:text-white",children:"No scatter plot data available"}),e.jsx("p",{className:"text-sm text-center max-w-sm text-gray-600 dark:text-gray-400",children:"Upload keyword data to visualize the relationship between search volume and cost-per-click"})]})})]});const a=O.useMemo(()=>{let d=[];return g&&g.x_values?d=g.x_values.map((s,n)=>({volume:s||0,cpc:g.y_values[n]||0,keyword:g.keywords[n]||`Keyword ${n+1}`,color:g.colors[n]==="Opportunity"?"#FF6B35":"#4F46E5",size:Math.max((g.sizes[n]||50)*3,40),isOpportunity:g.colors[n]==="Opportunity",score:g.sizes[n]||.5})):d=b.slice(0,100).map((s,n)=>({volume:s["Avg. monthly searches"]||0,cpc:s["Top of page bid (low range)"]||0,keyword:s.Keyword||`Keyword ${n+1}`,color:s._is_opportunity?"#FF6B35":"#4F46E5",size:Math.max((s.Score||.5)*120,40),isOpportunity:s._is_opportunity,score:s.Score||.5})),d.filter(s=>s.volume>0&&s.cpc>0)},[g,b]),o=c?a.filter(d=>d.isOpportunity):a,t=a.filter(d=>d.isOpportunity),h=a.reduce((d,s)=>d+s.volume,0)/a.length,C=a.reduce((d,s)=>d+s.cpc,0)/a.length;return e.jsxs(u,{className:"border-0 shadow-xl bg-white dark:bg-gray-900/80 backdrop-blur-md border border-gray-200 dark:border-gray-700",children:[e.jsx(T,{className:"pb-6 bg-white dark:bg-gray-800/50 rounded-t-lg border-b border-gray-100 dark:border-gray-700",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(P,{className:"flex items-center gap-3 text-xl",children:[e.jsx("div",{className:"p-3 bg-purple-600 dark:bg-gray-800/70 backdrop-blur-sm rounded-xl shadow-lg",children:e.jsx(I,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{children:[e.jsx("span",{className:"bg-gradient-to-r from-purple-600 to-blue-600 dark:from-purple-400 dark:to-blue-500 bg-clip-text text-transparent font-bold",children:"Keyword Opportunity Matrix"}),e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400 font-normal mt-1",children:["Volume vs. Cost analysis ⢠",t.length," opportunities"]})]})]}),e.jsxs("button",{onClick:()=>l(!c),className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-all ${c?"bg-gradient-to-r from-orange-500 to-red-500 dark:from-orange-400 dark:to-red-400 text-white shadow-lg":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-600"}`,children:[c?e.jsx(be,{className:"w-4 h-4"}):e.jsx(fe,{className:"w-4 h-4"}),c?"Show All":"Opportunities Only"]})]})}),e.jsxs(y,{className:"p-6",children:[e.jsx("div",{className:"h-[450px] -mx-2",children:e.jsx(K,{width:"100%",height:"100%",children:e.jsxs(je,{data:o,margin:{top:30,right:30,left:30,bottom:30},children:[e.jsxs("defs",{children:[e.jsxs("radialGradient",{id:"opportunityGradient",cx:"50%",cy:"50%",children:[e.jsx("stop",{offset:"0%",stopColor:"#FF6B35",stopOpacity:.9}),e.jsx("stop",{offset:"100%",stopColor:"#FF6B35",stopOpacity:.6})]}),e.jsxs("radialGradient",{id:"regularGradient",cx:"50%",cy:"50%",children:[e.jsx("stop",{offset:"0%",stopColor:"#4F46E5",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"#4F46E5",stopOpacity:.5})]})]}),e.jsx(Y,{strokeDasharray:"2 4",stroke:r.gridLine,strokeOpacity:.6}),e.jsx(Q,{x:h,stroke:r.referenceLine,strokeDasharray:"5 5",strokeOpacity:.7,label:{value:"Avg Volume",position:"topRight",fill:r.axisText,fontSize:11}}),e.jsx(Q,{y:C,stroke:r.referenceLine,strokeDasharray:"5 5",strokeOpacity:.7,label:{value:"Avg CPC",position:"topLeft",fill:r.axisText,fontSize:11}}),e.jsx(Z,{type:"number",dataKey:"volume",name:"Search Volume",tickFormatter:d=>
1j(d),tick:{fill:r.axisText,fontSize:12,fontWeight:500},tickLine:{stroke:r.axisText,strokeWidth:1},axisLine:{stroke:r.axisLine,strokeWidth:1},domain:["dataMin","dataMax"]}),e.jsx(q,{type:"number",dataKey:"cpc",name:"CPC",tickFormatter:d=>`$${d.toFixed(2)}`,tick:{fill:r.axisText,fontSize:12,fontWeight:500},tickLine:{stroke:r.axisText,strokeWidth:1},axisLine:{stroke:r.axisLine,strokeWidth:1},domain:["dataMin","dataMax"]}),e.jsx(z,{content:e.jsx(at,{}),cursor:{stroke:r.cursorStroke,strokeWidth:2,strokeDasharray:"4 4"}}),e.jsx(ke,{name:"Keywords",dataKey:"cpc",shape:e.jsx(st,{})})]})})}),e.jsxs("div",{className:"mt-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-center gap-8 p-4 bg-gray-50 dark:bg-gray-800/50 rounded-xl border border-gray-100 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 rounded-full bg-gradient-to-r from-orange-400 to-red-500 dark:from-orange-300 dark:to-red-400 shadow-lg"}),e.jsxs("span",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:["ð Opportunities (",t.length,")"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 rounded-full bg-gradient-to-r from-blue-400 to-indigo-500 dark:from-blue-300 dark:to-indigo-400 shadow-lg"}),e.jsxs("span",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:["Regular Keywords (",a.length-t.length,")"]})]}),e.jsx("div",{className:"h-6 w-px bg-gray-300 dark:bg-gray-600"}),e.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:[e.jsx("span",{className:"font-medium",children:"Bubble size:"})," Keyword score"]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"text-center p-4 bg-blue-50 dark:bg-blue-900/50 rounded-xl border border-blue-100 dark:border-blue-800",children:[e.jsx("div",{className:"flex items-center justify-center mb-2",children:e.jsx($,{className:"w-5 h-5 text-blue-600 dark:text-blue-300"})}),e.jsx("div",{className:"text-xl font-bold text-blue-600 dark:text-blue-300",children:o.length}),e.jsx("div",{className:"text-sm text-blue-700/80 dark:text-blue-300/80 font-medium",children:c?"Opportunities":"Total Keywords"})]}),e.jsxs("div",{className:"text-center p-4 bg-green-50 dark:bg-green-900/50 rounded-xl border border-green-100 dark:border-green-800",children:[e.jsx("div",{className:"flex items-center justify-center mb-2",children:e.jsx(M,{className:"w-5 h-5 text-green-600 dark:text-green-300"})}),e.jsx("div",{className:"text-xl font-bold text-green-600 dark:text-green-300",children:j(Math.round(o.reduce((d,s)=>d+s.volume,0)/o.length))}),e.jsx("div",{className:"text-sm text-green-700/80 dark:text-green-300/80 font-medium",children:"Avg. Volume"})]}),e.jsxs("div",{className:"text-center p-4 bg-purple-50 dark:bg-purple-900/50 rounded-xl border border-purple-100 dark:border-purple-800",children:[e.jsx("div",{className:"flex items-center justify-center mb-2",children:e.jsx(F,{className:"w-5 h-5 text-purple-600 dark:text-purple-300"})}),e.jsxs("div",{className:"text-xl font-bold text-purple-600 dark:text-purple-300",children:["$",(o.reduce((d,s)=>d+s.cpc,0)/o.length).toFixed(2)]}),e.jsx("div",{className:"text-sm text-purple-700/80 dark:text-purple-300/80 font-medium",children:"Avg. CPC"})]})]})]})]})]})},it=O.memo(lt),ot=({active:m,payload:r,label:c})=>{const l=A();if(m&&r?.length){const g=r[0].payload;return e.jsx("div",{className:"rounded-lg border p-4 shadow-xl backdrop-blur-sm dark:bg-gray-800/80 dark:border-gray-700",style:{backgroundColor:l.tooltipBackground,borderColor:l.tooltipBorder},children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-semibold text-gray-900 dark:text-gray-100 text-base",children:g.fullKeyword}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(M,{className:"w-4 h-4 text-blue-500 dark:text-blue-400"}),e.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"Volume:"}),e.jsx("span",{className:"font-bold text-blue-600 dark:text-blue-400",children:j(g.volume)})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-green-600 dark:text-green-400",children:"ð°"}),e.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"CPC:"}),e.jsxs("span",{className:"font-bold text-green-600 dark:text-green-400",children:["$",g.cpc.toFixed(2)]})]})]})})}return null},dt=({x:m=0,y:r=0,payload:c})=>{const l=A();return e.jsx("g",{transform:`translate(${m},${r})`,children:e.jsx("text",{x:0,y:0,dy:16,textAnchor:"end",fill:l.axisText,fontSize:"11",fontWeight:"500",transform:"rotate(-45)",children:c?.value})})},nt=({jsonData:m})=>{const r=A(),c=m?.visualizations_data?.top_keywords;
1if(!c?.length)return e.jsxs(u,{className:"border-0 shadow-lg bg-gradient-to-br from-white to-gray-50 dark:from-gray-900 dark:to-gray-800 border border-gray-200 dark:border-gray-700",children:[e.jsx(T,{className:"pb-4 border-b border-gray-100 dark:border-gray-700",children:e.jsxs(P,{className:"flex items-center gap-3 text-xl",children:[e.jsx("div",{className:"p-2 bg-gradient-to-r from-blue-500 to-purple-600 dark:from-blue-600 dark:to-purple-700 rounded-lg",children:e.jsx(R,{className:"w-6 h-6 text-white"})}),e.jsx("span",{className:"bg-gradient-to-r from-blue-600 to-purple-600 dark:from-blue-400 dark:to-purple-500 bg-clip-text text-transparent",children:"Top Keywords by Volume"})]})}),e.jsx(y,{children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"w-16 h-16 mb-4 bg-gray-100 dark:bg-gray-700 rounded-full flex items-center justify-center border border-gray-200 dark:border-gray-600",children:e.jsx(R,{className:"w-8 h-8 text-gray-400 dark:text-gray-500"})}),e.jsx("p",{className:"text-lg font-medium text-gray-700 dark:text-gray-300",children:"No data available"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Upload keyword data to see volume analysis"})]})})]});const l=U.useMemo(()=>c.slice(0,15).map((a,o)=>{const t=a.keyword||a.Keyword||a.Keyword||`Keyword ${o+1}`,h=Number(a.volume||a["Avg. monthly searches"]||a.Volume||0),C=Number(a.cpc||a["Top of page bid (low range)"]||a.CPC||0);return{keyword:t.length>18?`${t.substring(0,18)}...`:t,fullKeyword:t,volume:h,cpc:C,color:o<3?"#FF6B35":o<8?"#4F46E5":"#6B7280",o
1pacity:o<3?1:o<8?.9:.7}}).sort((a,o)=>o.volume-a.volume),[c]),g=Math.max(...l.map(a=>a.volume)),b=l.filter(a=>a.volume>g*.3).length;return e.jsxs(u,{className:"border-0 shadow-xl bg-white dark:bg-gray-900/80 backdrop-blur-md border-gray-200 dark:border-gray-700",children:[e.jsx(T,{className:"pb-6 bg-white dark:bg-gray-800/50 rounded-t-lg border-b border-gray-100 dark:border-gray-700",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(P,{className:"flex items-center gap-3 text-xl",children:[e.jsx("div",{className:"p-3 bg-blue-600 dark:bg-gray-800/70 backdrop-blur-sm rounded-xl shadow-lg",children:e.jsx(R,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{children:[e.jsx("span",{className:"bg-gradient-to-r from-blue-600 to-purple-600 dark:from-blue-400 dark:to-purple-500 bg-clip-text text-transparent font-bold",children:"Top Keywords by Volume"}),e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400 font-normal mt-1",children:["Analyzing ",l.length," highest performing keywords"]})]})]}),e.jsx("div",{className:"flex items-center gap-3 text-sm",children:e.jsxs("div",{className:"flex items-center gap-1 px-3 py-1 bg-orange-100 dark:bg-orange-900/50 text-orange-800 dark:text-orange-300 rounded-full border border-orange-200 dark:border-orange-700",children:[e.jsx(le,{className:"w-4 h-4"}),e.jsxs("span",{className:"font-medium",children:[b," High Potential"]})]})})]})}),e.jsxs(y,{className:"p-6",children:[e.jsx("div",{className:"h-[420px] -mx-2",children:e.jsx(K,{width:"100%",height:"100%",children:e.jsxs(Ne,{data:l,margin:{top:30,right:30,left:20,bottom:90},barCategoryGap:"20%",children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"topGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#FF6B35",stopOpacity:.9}),e.jsx("stop",{offset:"100%",stopColor:"#FF6B35",stopOpacity:.6})]}),e.jsxs("linearGradient",{id:"secondGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#4F46E5",stopOpacity:.9}),e.jsx("stop",{offset:"100%",stopColor:"#4F46E5",stopOpacity:.6})]}),e.jsxs("linearGradient",{id:"otherGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#6B7280",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"#6B7280",stopOpacity:.5})]})]}),e.jsx(Y,{strokeDasharray:"3 3",stroke:r.gridLine,strokeOpacity:.6,vertical:!1}),e.jsx(Z,{dataKey:"keyword",tick:e.jsx(dt,{}),interval:0,tickLine:{stroke:r.axisText,strokeWidth:1},axisLine:{stroke:r.axisLine,strokeWidth:1},height:80}),e.jsx(q,{tickFormatter:j,tick:{fill:r.axisText,fontSize:12,fontWeight:500},tickLine:{stroke:r.axisText,strokeWidth:1},axisLine:{stroke:r.axisLine,strokeWidth:1},width:80}),e.jsx(z,{content:e.jsx(ot,{}),cursor:{fill:r.cursorFill,stroke:r.cursorStroke,strokeWidth:1,radius:4}}),e.jsx(ve,{dataKey:"volume",radius:[6,6,0,0],stroke:r.barStroke,strokeWidth:1,animationDuration:600,children:l.map((a,o)=>e.jsx(te,{fill:o<3?"url(#topGradient)":o<8?"url(#secondGradient)":"url(#otherGradient)"},`cell-${o}`))})]})})}),e.jsxs("div",{className:"flex items-center justify-center gap-8 mt-6 p-4 bg-gray-50 dark:bg-gray-800/50 rounded-xl border border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-b from-orange-500 to-orange-600 dark:from-orange-400 dark:to-orange-500 shadow-sm border border-orange-200 dark:border-orange-300"}),e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Top 3 Keywords"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-b from-indigo-500 to-indigo-600 dark:from-indigo-400 dark:to-indigo-500 shadow-sm border border-indigo-200 dark:border-indigo-300"}),e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"High Volume (4-8)"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-b from-gray-500 to-gray-600 dark:from-gray-400 dark:to-gray-500 shadow-sm border border-gray-300 dark:border-gray-400"}),e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Moderate Volume"})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4 mt-6",children:[e.jsxs("div",{className:"text-center p-4 bg-blue-50 dark:bg-blue-900/50 rounded-xl border border-blue-200 dark:border-blue-800",children:[e.jsx("div",{className:"text-2xl font-bold text-blue-700 dark:text-blue-300",children:l.length}
1),e.jsx("div",{className:"text-sm text-blue-600 dark:text-blue-300/80 font-medium",children:"Keywords Analyzed"})]}),e.jsxs("div",{className:"text-center p-4 bg-green-50 dark:bg-green-900/50 rounded-xl border border-green-200 dark:border-green-800",children:[e.jsx("div",{className:"text-2xl font-bold text-green-700 dark:text-green-300",children:j(l.reduce((a,o)=>a+o.volume,0))}),e.jsx("div",{className:"text-sm text-green-600 dark:text-green-300/80 font-medium",children:"Total Volume"})]}),e.jsxs("div",{className:"text-center p-4 bg-orange-50 dark:bg-orange-900/50 rounded-xl border border-orange-200 dark:border-orange-800",children:[e.jsxs("div",{className:"text-2xl font-bold text-orange-700 dark:text-orange-300",children:["$",(l.reduce((a,o)=>a+o.cpc,0)/l.length).toFixed(2)]}),e.jsx("div",{className:"text-sm text-orange-600 dark:text-orange-300/80 font-medium",children:"Avg. CPC"})]})]})]})]})},ct=O.memo(nt),xt=({jsonData:m})=>{A();const[r,c]=O.useState(null),l=m?.visualizations_data?.opportunity_distribution;if(!l||Object.keys(l).length===0)return e.jsxs(u,{className:"border-0 shadow-xl bg-gradient-to-br from-white via-orange-50/30 to-yellow-50/30 dark:from-gray-900 dark:via-orange-950/20 dark:to-yellow-950/20 backdrop-blur-sm",children:[e.jsx(T,{className:"pb-6 bg-gradient-to-r from-orange-600/5 to-yellow-600/5 dark:from-orange-600/10 dark:to-yellow-600/10 rounded-t-lg",children:e.jsxs(P,{className:"flex items-center gap-3 text-xl",children:[e.jsx("div",{className:"p-3 bg-gradient-to-r from-orange-500 to-yellow-600 rounded-xl shadow-lg",children:e.jsx(G,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{children:[e.jsx("span",{className:"bg-gradient-to-r from-orange-600 to-yellow-600 bg-clip-text text-transparent font-bold",children:"Opportunity Distribution"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 font-normal mt-1",children:"Keyword portfolio composition analysis"})]})]})}),e.jsx(y,{children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"w-20 h-20 mb-6 bg-gradient-to-br from-gray-100 to-gray-200 dark:from-gray-800 dark:to-gray-700 rounded-full flex items-center justify-center",children:e.jsx(G,{className:"w-10 h-10 text-gray-400 dark:text-gray-500"})}),e.jsx("p",{className:"text-lg font-semibold mb-2 dark:text-gray-300",children:"No distribution data available"}),e.jsx("p",{className:"text-sm text-center max-w-sm",children:"Upload keyword data to see the breakdown of opportunities vs regular keywords"})]})})]});const g=Object.entries(l).map(([s,n])=>{const p=s==="true"||s===!0;return{name:p?"Opportunities":"Regular Keywords",value:Number(n)||0,color:p?"#FF6B35":"#4F46E5",gradient:p?"opportunityGradient":"regularGradient",isOpportunity:p}}).filter(s=>s.value>0),b=g.reduce((s,n)=>s+n.value,0),a=g.find(s=>s.isOpportunity)?.value||0,o=(a/b*100).toFixed(1),t=({active:s,payload:n})=>{if(s&&n&&n.length){const p=n[0],v=(p.value/b*100).toFixed(1);return e.jsx("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl shadow-2xl p-5 backdrop-blur-sm",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-4 h-4 rounded-full mt-1 shadow-lg",style:{backgroundColor:p.payload.color}}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"font-bold text-gray-900 dark:text-gray-100 mb-3 text-base",children:[p.name,p.payload.isOpportunity&&" ð"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Count:"}),e.jsx("span",{className:"font-bold text-blue-600 dark:text-blue-400",children:p.value.toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($,{className:"w-4 h-4 text-purple-500"}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Share:"}
1),e.jsxs("span",{className:"font-bold text-purple-600 dark:text-purple-400",children:[v,"%"]})]})]})]})]})})}return null},h=({cx:s,cy:n,midAngle:p,innerRadius:v,outerRadius:w,percent:_,index:S})=>{const f=v+(w-v)*.5,D=s+f*Math.cos(-p*Math.PI/180),i=n+f*Math.sin(-p*Math.PI/180);return _<.05?null:e.jsx("text",{x:D,y:i,fill:"white",textAnchor:D>s?"start":"end",dominantBaseline:"central",fontSize:"16",fontWeight:"bold",style:{filter:"drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5))"},children:`${(_*100).toFixed(0)}%`})},C=(s,n)=>{c(n)},d=()=>{c(null)};return e.jsxs(u,{className:"border-0 shadow-xl bg-gradient-to-br from-white via-orange-50/30 to-yellow-50/30 dark:from-gray-900 dark:via-orange-950/20 dark:to-yellow-950/20 backdrop-blur-sm",children:[e.jsx(T,{className:"pb-6 bg-gradient-to-r from-orange-600/5 to-yellow-600/5 dark:from-orange-600/10 dark:to-yellow-600/10 rounded-t-lg",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(P,{className:"flex items-center gap-3 text-xl",children:[e.jsx("div",{className:"p-3 bg-gradient-to-r from-orange-500 to-yellow-600 rounded-xl shadow-lg",children:e.jsx(G,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{children:[e.jsx("span",{className:"bg-gradient-to-r from-orange-600 to-yellow-600 bg-clip-text text-transparent font-bold",children:"Opportunity Distribution"}),e.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400 font-normal mt-1",children:["Portfolio composition ⢠",o,"% opportunities"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-gradient-to-r from-orange-100 to-yellow-100 dark:from-orange-900/30 dark:to-yellow-900/30 rounded-lg border border-orange-200 dark:border-orange-800",children:[e.jsx(ie,{className:"w-4 h-4 text-orange-600 dark:text-orange-400"}),e.jsxs("span",{className:"text-sm font-semibold text-orange-700 dark:text-orange-300",children:[a," Opportunities"]})]})]})}),e.jsxs(y,{className:"p-6",children:[e.jsx("div",{className:"h-[400px] -mx-2",children:e.jsx(K,{width:"100%",height:"100%",children:e.jsxs(we,{children:[e.jsxs("defs",{children:[e.jsxs("radialGradient",{id:"opportunityGradient",cx:"50%",cy:"50%",children:[e.jsx("stop",{offset:"0%",stopColor:"#FF6B35",stopOpacity:1}),e.jsx("stop",{offset:"70%",stopColor:"#FF6B35",stopOpacity:.9}),e.jsx("stop",{offset:"100%",stopColor:"#DC2626",stopOpacity:.8})]}),e.jsxs("radialGradient",{id:"regularGradient",cx:"50%",cy:"50%",children:[e.jsx("stop",{offset:"0%",stopColor:"#4F46E5",stopOpacity:1}),e.jsx("stop",{offset:"70%",stopColor:"#4F46E5",stopOpacity:.9}),e.jsx("stop",{offset:"100%",stopColor:"#3730A3",stopOpacity:.8})]}),e.jsxs("filter",{id:"glow",children:[e.jsx("feGaussianBlur",{stdDeviation:"3",result:"coloredBlur"}),e.jsxs("feMerge",{children:[e.jsx("feMergeNode",{in:"coloredBlur"}),e.jsx("feMergeNode",{in:"SourceGraphic"})]})]})]}),e.jsx(Ce,{data:g,cx:"50%",cy:"50%",labelLine:!1,label:h,outerRadius:140,innerRadius:50,paddingAngle:2,dataKey:"value",onMouseEnter:C,onMouseLeave:d,animationBegin:0,animationDuration:800,children:g.map((s,n)=>e.jsx(te,{fill:`url(#${s.gradient})`,stroke:s.color,strokeWidth:r===n?3:1,strokeOpacity:.8,style:{filter:r===n?"url(#glow)":"none",transform:r===n?"scale(1.05)":"scale(1)",transformOrigin:"center",transition:"all 0.2s ease"}},`cell-${n}`))}),e.jsx(z,{content:e.jsx(t,{}),cursor:{fill:"transparent"}})]})})}),e.jsx("div",{className:"mt-6 space-y-4",children:e.jsx("div",{className:"flex items-center justify-center gap-8 p-4 bg-gradient-to-r from-gray-50 via-orange-50/30 to-yellow-50/30 dark:from-gray-800/50 dark:via-orange-950/20 dark:to-yellow-950/20 rounded-xl border border-gray-100 dark:border-gray-700",children:g.map((s,n)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 rounded-full shadow-lg",style:{background:`linear-gradient(135deg, ${s.color}, ${s.color}dd)`}}),e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:[s.isOpportunity?"ð ":"ð ",s.name]}),e.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:[s.value.toLocaleStr
1ing()," keywords"]})]})]},n))})})]})]})},mt=({jsonData:m})=>{A();const r=m?.visualizations_data?.volume_buckets;if(!r||!Array.isArray(r)||r.length===0)return e.jsxs(u,{className:"bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700",children:[e.jsx(T,{children:e.jsxs(P,{className:"flex items-center gap-2 text-gray-900 dark:text-gray-100",children:[e.jsx(M,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"}),"Volume Distribution"]})}),e.jsx(y,{children:e.jsx("p",{className:"text-center text-gray-500 dark:text-gray-400 py-8",children:"No volume bucket data available"})})]});const c=r.reduce((a,o)=>{const t=o.volume_bucket||"Unknown";return a[t]||(a[t]={name:t,keywords:[],totalVolume:0,count:0}),a[t].keywords.push(o),a[t].totalVolume+=Number(o.volume)||0,a[t].count+=1,a},{}),l=Object.values(c).map(a=>{let o,t;return a.name.includes("Very High")?(o="#8B5CF6",t="#A78BFA"):a.name.includes("High")?(o="#3B82F6",t="#60A5FA"):a.name.includes("Medium")?(o="#10B981",t="#34D399"):a.name.includes("Low")?(o="#F59E0B",t="#FBBF24"):(o="#EF4444",t="#F87171"),{name:a.name,size:a.count,volume:a.totalVolume,count:a.count,fill:o,fillDark:t}}).sort((a,o)=>o.size-a.size),g=({active:a,payload:o})=>{if(a&&o&&o.length){const t=o[0].payload;return e.jsxs("div",{className:"p-3 border rounded-lg shadow-lg bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-600",children:[e.jsx("p",{className:"font-semibold text-gray-900 dark:text-gray-100",children:t.name}),e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:["Keywords: ",t.count.toLocaleString()]}),e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:["Total Volume: ",j(t.volume)]}),e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:["Avg Volume: ",j(Math.round(t.volume/t.count))]})]})}return null},b=({root:a,depth:o,x:t,y:h,width:C,height:d,index:s,colors:n,name:p,size:v,volume:w,fillDark:_})=>{if(o===1)return e.jsxs("g",{children:[e.jsx("rect",{x:t,y:h,width:C,height:d,style:{fill:n,stroke:"var(--treemap-stroke, #fff)",strokeWidth:2,fillOpacity:.9},className:"transition-opacity hover:opacity-80"}),C>60&&d>40&&e.jsxs(e.Fragment,{children:[e.jsx("text",{x:t+C/2,y:h+d/2-12,textAnchor:"middle",fill:"#fff",fontSize:"12",fontWeight:"bold",children:p.length>15?p.substring(0,15)+"...":p}),e.jsxs("text",{x:t+C/2,y:h+d/2+2,textAnchor:"middle",fill:"#fff",fontSize:"10",opacity:"0.9",children:[v," keywords"]}),e.jsxs("text",{x:t+C/2,y:h+d/2+15,textAnchor:"middle",fill:"#fff",fontSize:"10",opacity:"0.9",children:[j(w)," vol"]})]}),C>30&&d>20&&C<=60&&e.jsx("text",{x:t+C/2,y:h+d/2,textAnchor:"middle",fill:"#fff",fontSize:"10",fontWeight:"bold",children:v})]})};return e.jsxs(u,{className:"bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700",children:[e.jsx(T,{children:e.jsxs(P,{className:"flex items-center gap-2 text-gray-900 dark:text-gray-100",children:[e.jsx(M,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"}),"Volume Distribution by Category"]})}),e.jsxs(y,{children:[e.jsx("div",{className:"h-96 relative",children:e.jsx(K,{width:"100%",height:"100%",children:e.jsx(_e,{data:l,dataKey:"size",aspectRatio:4/3,stroke:"#fff",fill:"#8884d8",content:e.jsx(b,{}),children:e.jsx(z,{content:e.jsx(g,{}),cursor:{fill:"transparent"}})})})}),e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-2 mt-4 pt-4 border-t border-gray-200 dark:border-gray-600",children:l.map((a,o)=>e.jsxs("div",{className:"flex items-center gap-2 group",children:[e.jsx("div",{className:"w-3 h-3 rounded flex-shrink-0 transition-transform group-hover:scale-110",style:{backgroundColor:a.fill}}),e.jsxs("span",{className:"text-xs text-gray-700 dark:text-gray-300 truncate",children:[a.name," (",a.count,")"]})]},o))}),e.jsx("div",{className:"mt-4 p-3 rounded-lg bg-gray-50 dark:bg-gray-700/50 border border-gray-200 dark:border-gray-600",children:e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2 text-sm",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"font-semibold text-gray-900 dark:text-gray-100",children:l.length}),e.jsx("div",{className:"text-gray-600 dark:text-gray-400 text-xs",children:"Categories"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"font-semibold text-gray-900 dark:text-gray-100",children:l.reduce((a,o)=>
1a+o.count,0).toLocaleString()}),e.jsx("div",{className:"text-gray-600 dark:text-gray-400 text-xs",children:"Total Keywords"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"font-semibold text-gray-900 dark:text-gray-100",children:j(l.reduce((a,o)=>a+o.volume,0))}),e.jsx("div",{className:"text-gray-600 dark:text-gray-400 text-xs",children:"Total Volume"})]})]})})]})]})};Fe.register(Me,Ae,$e,Be,Le,Re,Ke,ze,Ve,Ee,Ie,He);const gt=({jsonData:m,data:r,onRefresh:c,loading:l=!1})=>{const[g,b]=O.useState(0),[a,o]=O.useState(r||m?.cluster_analysis),[t,h]=O.useState(!1),[C,d]=O.useState(new Date().toISOString());O.useEffect(()=>{r?o(r):m?.cluster_analysis&&o(m.cluster_analysis)},[r,m]);const s=async()=>{if(c){h(!0);try{await c(),d(new Date().toISOString())}catch(i){console.error("Error refreshing cluster data:",i)}finally{h(!1)}}},n=m?.configuration?.currency||"USD",p=m?.configuration?.roi_parameters||{};if(!a||!a.clusters||a.clusters.length===0)return e.jsxs(u,{className:"col-span-2",children:[e.jsx(T,{children:e.jsxs(P,{className:"flex items-center gap-2",children:[e.jsx($,{className:"w-5 h-5 text-purple-600"}),"Advanced Keyword Clusters: Volume vs CPC"]})}),e.jsx(y,{children:e.jsx("p",{className:"text-center text-gray-500 py-8",children:"No cluster analysis data available"})})]});const v=a.clusters||[],w=v[g]||v[0],_=a.clusters.slice(0,20).map((i,k)=>({x:i.total_volume||0,y:i.avg_cpc||0,z:i.cluster_value||0,cluster_term:i.cluster_term,cluster_type:i.cluster_type,seo_priority:i.seo_priority,keyword_count:i.keyword_count,opportunity_count:i.opportunity_count||0,color:S(i.seo_priority)}));function S(i){return{"Very High":"#e74c3c",High:"#f39c12",Medium:"#f1c40f",Low:"#95a5a6"}[i]||"#95a5a6"}Math.max(..._.map(i=>i.x)),Math.max(..._.map(i=>i.y));const f={datasets:[{label:"Keyword Clusters",data:_.map(i=>({x:i.x,y:i.y,cluster_term:i.cluster_term,keyword_count:i.keyword_count,seo_priority:i.seo_priority,color:i.color})),backgroundColor:_.map(i=>i.color),borderColor:_.map(i=>i.color),borderWidth:2,pointRadius:_.map(i=>Math.max(6,Math.min(25,i.z/Math.max(..._.map(k=>k.z))*25))),pointHoverRadius:_.map(i=>Math.max(8,Math.min(30,i.z/Math.max(..._.map(k=>k.z))*30)))}]},D={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{callbacks:{label:function(i){const k=i.raw;return[`Cluster: ${k.cluster_term}`,`Keywords: ${k.keyword_count}`,`Volume: ${j(k.x)}`,`CPC: ${N(k.y)}`,`Priority: ${k.seo_priority}`]}},backgroundColor:"rgba(0, 0, 0, 0.8)",titleColor:"white",bodyColor:"white",borderColor:"white",borderWidth:1,cornerRadius:8,displayColors:!1},title:{display:!0,text:"Advanced Keyword Clusters: Volume vs CPC Analysis",font:{size:18,weight:"bold",family:"Inter, sans-serif"},color:"#1f2937",padding:{bottom:20}}},scales:{x:{title:{display:!0,text:"Total Volume",font:{size:14,weight:"600"},color:"#6b7280"},ticks:{callback:function(i){return j(i)},font:{size:12},color:"#6b7280"},grid:{color:"#e5e7eb"}},y:{title:{display:!0,text:"Average CPC",font:{size:14,weight:"600"},color:"#6b7280"},ticks:{callback:function(i){return`$${i.toFixed(0)}`},font:{size:12},color:"#6b7280"},grid:{color:"#e5e7eb"}}},onClick:(i,k)=>{if(k.length>0){const re=k[0].index;b(re)}}};return e.jsxs("div",{className:"space-y-6 bg-white dark:bg-black",children:[e.jsxs(u,{className:"bg-white dark:bg-gray-900 shadow-lg border-0",children:[e.jsx(T,{className:"pb-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs(P,{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2 flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-black/80 dark:bg-gray-800/80 backdrop-blur-sm rounded-xl flex items-center justify-center",children:e.jsx($,{className:"w-6 h-6 text-white"})}),"SEO Cluster Intelligence"]}),e.jsx("p",{className:"text-base text-gray-700 dark:text-gray-300 font-medium",children:"Interactive visualization of keyword clusters by volume and cost efficiency"}),e.jsxs("div",{className:"flex items-center gap-4 mt-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-700 dark:text-gray-500",children:[e.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"}
1),e.jsx("span",{children:"Size = Cluster Value"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-700 dark:text-gray-500",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),e.jsx("span",{children:"Color = SEO Priority"})]}),e.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-400 ml-auto",children:["Updated: ",new Date(C).toLocaleString()]})]})]}),e.jsxs(L,{variant:"outline",size:"sm",onClick:s,disabled:t||l,className:"border-gray-300 dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700 ml-4",children:[e.jsx(oe,{className:`w-4 h-4 mr-2 ${t?"animate-spin":""}`}),t?"Refreshing...":"Refresh"]})]})}),e.jsxs(y,{children:[e.jsx("div",{className:"h-[500px] bg-gradient-to-br from-gray-50 to-white dark:from-gray-900 dark:to-gray-800 rounded-xl p-4",children:e.jsx(Pe,{data:f,options:D})}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-6",children:[e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800",children:[e.jsx("div",{className:"w-4 h-4 bg-red-500 rounded-full"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-red-700 dark:text-red-300 text-sm",children:"ð¥ Very High"}),e.jsx("div",{className:"text-xs text-red-600 dark:text-red-400",children:"Critical opportunities"})]})]}),e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-orange-50 dark:bg-orange-900/20 rounded-lg border border-orange-200 dark:border-orange-800",children:[e.jsx("div",{className:"w-4 h-4 bg-orange-500 rounded-full"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-orange-700 dark:text-orange-300 text-sm",children:"â High"}),e.jsx("div",{className:"text-xs text-orange-600 dark:text-orange-400",children:"Strong potential"})]})]}),e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-yellow-50 dark:bg-yellow-900/20 rounded-lg border border-yellow-200 dark:border-yellow-800",children:[e.jsx("div",{className:"w-4 h-4 bg-yellow-500 rounded-full"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-yellow-700 dark:text-yellow-300 text-sm",children:"ð Medium"}),e.jsx("div",{className:"text-xs text-yellow-600 dark:text-yellow-400",children:"Moderate value"})]})]}),e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-gray-50 dark:bg-gray-900/20 rounded-lg border border-gray-200 dark:border-gray-800",children:[e.jsx("div",{className:"w-4 h-4 bg-gray-500 rounded-full"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-gray-700 dark:text-gray-300 text-sm",children:"ð Low"}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Limited potential"})]})]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 md:gap-6 bg-white dark:bg-black",children:[e.jsx(u,{className:" bg-gradient-to-br from-blue-50 to-blue-100 dark:from-blue-900/20 dark:to-blue-800/20 dark:border-blue-800 backdrop-blur-md",children:e.jsx(y,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-3xl font-bold text-gray-900 dark:text-purple-400 mb-1",children:a.total_clusters}),e.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-purple-300",children:"Total Clusters"}),e.jsx("p",{className:"text-xs text-gray-600 dark:text-purple-400 mt-1",children:"Active keyword groups"})]}),e.jsx("div",{className:"w-12 h-12 bg-purple-500 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-white text-xl",children:"ð¯"})})]})})}),e.jsx(u,{className:" bg-gradient-to-br from-blue-50 to-blue-100 dark:from-blue-900/20 dark:to-blue-800/20 border-blue-200 dark:border-blue-800",children:e.jsx(y,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-3xl font-bold text-gray-900 dark:text-blue-400 mb-1",children:a.cluster_summary?.avg_keywords_per_cluster?.toFixed(1)||"â"}),e.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-blue-300",children:"Avg Keywords/Cluster"}),e.jsx("p",{className:"text-xs text-gray-600 dark:text-blue-400 mt-1",children:"Average group size"})]}),e.jsx("div",{className:"w-12 h-12 bg-blue-500 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-white text-xl",children:"ð"})})]})})}),e.jsx(u,{className:"bg-gradient-to-br from-green-50 to-green-100 dark:from-green-900/20 dark:to-green-800/20 border-green-200 dark:border-green-800 sm:col-span-2 lg:col-span-1",children:e.jsx(y,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-3xl font-bold text-gray-900 dark:text-green-400 mb-1",children:a.cluster
1s.filter(i=>i.seo_priority==="Very High"||i.seo_priority==="High").length}),e.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-green-300",children:"High Priority"}),e.jsx("p",{className:"text-xs text-gray-600 dark:text-green-400 mt-1",children:"Priority clusters"})]}),e.jsx("div",{className:"w-12 h-12 bg-green-500 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-white text-xl",children:"â"})})]})})})]}),e.jsxs(u,{className:"bg-gradient-to-br from-slate-50 to-gray-50 dark:from-gray-900/50 dark:to-slate-900/50",children:[e.jsx(T,{children:e.jsxs(P,{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-blue-500 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-white text-sm",children:"ð"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Detailed Cluster Analysis"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Deep dive into
1individual cluster performance"})]})]})}),e.jsxs(y,{className:"space-y-6",children:[e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-4 border border-gray-200 dark:border-gray-700",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-2 block",children:"Select Cluster for Analysis"}),e.jsxs(Ge,{value:g.toString(),onValueChange:i=>b(parseInt(i)),children:[e.jsx(We,{className:"w-full bg-gray-50 dark:bg-gray-700 border-gray-300 dark:border-gray-600",children:e.jsx(Ue,{})}),e.jsx(Je,{children:v.slice(0,10).map((i,k)=>e.jsx(Ye,{value:k.toString(),children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:i.cluster_term}),e.jsxs("span",{className:"text-xs text-gray-500",children:["(",i.keyword_count," keywords)"]})]})},k))})]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600 dark:text-gray-400",children:[e.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),e.jsxs("span",{children:[v.length," clusters available"]})]})]})}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 md:gap-6",children:[e.jsx(u,{className:"bg-gradient-to-br from-blue-50 to-blue-100 dark:from-blue-900/20 dark:to-blue-800/20 border-blue-200 dark:border-blue-800",children:e.jsxs(y,{className:"p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("div",{className:"w-10 h-10 bg-blue-500 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-white text-sm",children:"ð"})}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-2xl font-bold text-blue-600 dark:text-blue-400",children:w.keyword_count}),e.jsx("p",{className:"text-xs text-blue-700 dark:text-blue-300 font-medium",children:"Keywords"})]})]}),e.jsx("div",{className:"text-xs text-blue-600 dark:text-blue-400",children:"Total keywords in cluster"})]})}),e.jsx(u,{className:"bg-gradient-to-br from-green-50 to-green-100 dark:from-green-900/20 dark:to-green-800/20 border-green-200 dark:border-green-800",children:e.jsxs(y,{className:"p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("div",{className:"w-10 h-10 bg-green-500 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-white text-sm",children:"ð"})}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-2xl font-bold text-green-600 dark:text-green-400",children:j(w.total_volume)}),e.jsx("p",{className:"text-xs text-green-700 dark:text-green-300 font-medium",children:"Total Volume"})]})]}),e.jsx("div",{className:"text-xs text-green-600 dark:text-green-400",children:"Monthly search volume"})]})}),e.jsx(u,{className:"bg-gradient-to-br from-yellow-50 to-yellow-100 dark:from-yellow-900/20 dark:to-yellow-800/20 border-yellow-200 dark:border-yellow-800",children:e.jsxs(y,{className:"p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("div",{className:"w-10 h-10 bg-yellow-500 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-white text-sm",children:"ð°"})}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-2xl font-bold text-yellow-600 dark:text-yellow-400",children:N(w.avg_cpc,n)}),e.jsx("p",{className:"text-xs text-yellow-700 dark:text-yellow-300 font-medium",children:"Avg CPC"})]})]}),e.jsx("div",{className:"text-xs text-yellow-600 dark:text-yellow-400",children:"Average cost per click"})]})}),e.jsx(u,{className:"bg-gradient-to-br from-orange-50 to-orange-100 dark:from-orange-900/20 dark:to-orange-800/20 border-orange-200 dark:border-orange-800",children:e.jsxs(y,{className:"p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("div",{className:"w-10 h-10 bg-orange-500 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-white text-sm",children:"ð"})}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-2xl font-bold text-orange-600 dar
1k:text-orange-400",children:w.opportunity_count||0}),e.jsx("p",{className:"text-xs text-orange-700 dark:text-orange-300 font-medium",children:"Opportunities"})]})]}),e.jsx("div",{className:"text-xs text-orange-600 dark:text-orange-400",children:"High-value opportunities"})]})})]}),w&&e.jsx(ht,{cluster:w,currency:n,jsonData:m}),w&&w.revenue_analysis&&e.jsx(pt,{cluster:w,revenueAnalysis:w.revenue_analysis,currency:n,roiParams:p}),w&&e.jsx(ut,{cluster:w,currency:n,jsonData:m})]})]}),e.jsxs(u,{className:"bg-gradient-to-br from-slate-50 to-gray-50 dark:from-gray-900/50 dark:to-slate-900/50",children:[e.jsx(T,{children:e.jsxs(P,{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-yellow-500 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-white text-sm",children:"ð"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Top Keyword Clusters by SEO Value"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Phrase and Intent clusters prioritized for better SEO targeting"})]})]})}),e.jsxs(y,{children:[e.jsx("div",{className:"block md:hidden space-y-4",children:a.clusters.slice(0,10).map((i,k)=>e.jsx(u,{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700",children:e.jsxs(y,{className:"p-4",children:[e.jsx("div",{className:"flex items-start justify-between mb-3",children:e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:S(i.seo_priority)}}),e.jsxs("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-400",children:[i.seo_priority==="Very High"&&"ð¥",i.seo_priority==="High"&&"â",i.seo_priority==="Medium"&&"ð",i.seo_priority==="Low"&&"ð",i.seo_priority]}),e.jsx(V,{variant:"outline",className:"text-xs",children:i.cluster_type})]}),e.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:i.cluster_term}),e.jsxs("p",{className:"text-xs text-gray-500 mb-3",children:["(",i.keyword_count," keywords)"]})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-2 rounded",children:[e.jsx("p",{className:"text-blue-700 dark:text-blue-300 font-medium",children:"Volume"}),e.jsx("p",{className:"text-blue-600 dark:text-blue-400 text-lg font-bold",children:j(i.total_volume)})]}),e.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-2 rounded",children:[e.jsx("p",{className:"text-green-700 dark:text-green-300 font-medium",children:"Avg CPC"}),e.jsx("p",{className:"text-green-600 dark:text-green-400 text-lg font-bold",children:N(i.avg_cpc)})]}),e.jsxs("div",{className:"bg-purple-50 dark:bg-purple-900/20 p-2 rounded",children:[e.jsx("p",{className:"text-purple-700 dark:text-purple-300 font-medium",children:"Value"}),e.jsx("p",{className:"text-purple-600 dark:text-purple-400 text-lg font-bold",children:j(i.cluster_value)})]}),e.jsxs("div",{className:"bg-orange-50 dark:bg-orange-900/20 p-2 rounded",children:[e.jsx("p",{className:"text-orange-700 dark:text-orange-300 font-medium",children:"Opportunities"}),e.jsx("p",{className:"text-orange-600 dark:text-orange-400 text-lg font-bold",children:i.opportunity_count>0?i.opportunity_count:"â"})]})]})]})},k))}),e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-700",children:[e.jsx("th",{className:"text-left p-3 font-semibold text-gray-900 dark:text-white",children:"Priority"}),e.jsx("th",{className:"text-left p-3 font-semibold text-gray-900 dark:text-white",children:"Cluster"}),e.jsx("th",{className:"text-left p-3 font-semibold text-gray-900 dark:text-white",children:"Type"}),e.jsx("th",{className:"text-right p-3 font-semibold text-gray-900 dark:text-white",children:"Volume"}),e.jsx("th",{className:"text-right p-3 font-semibold text-gray-900 dark:text-white",children:"Avg CPC"}),e.jsx("th",{className:"text-right p-3 font-semibold text-gray-900 dark:text-white",children:"Value"}),e.jsx("th",{className:"text-right p-3 font-semibold text-gray-900 dark:text-white",children:"Opportunities"})]})}
1),e.jsx("tbody",{children:a.clusters.slice(0,15).map((i,k)=>e.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800 hover:bg-blue-50/50 dark:hover:bg-blue-900/20 transition-colors",children:[e.jsx("td",{className:"p-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:S(i.seo_priority)}}),e.jsxs("span",{className:"text-xs font-medium",children:[i.seo_priority==="Very High"&&"ð¥",i.seo_priority==="High"&&"â",i.seo_priority==="Medium"&&"ð",i.seo_priority==="Low"&&"ð"," "+i.seo_priority]})]})}),e.jsx("td",{className:"p-3",children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:i.cluster_term}),e.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:["(",i.keyword_count," keywords)"]})]})}),e.jsx("td",{className:"p-3",children:e.jsx(V,{variant:"outline",className:"text-xs font-medium",children:i.cluster_type})}),e.jsx("td",{className:"p-3 text-right font-medium text-blue-600 dark:text-blue-400",children:j(i.total_volume)}),e.jsx("td",{className:"p-3 text-right font-medium text-green-600 dark:text-green-400",children:N(i.avg_cpc)}),e.jsx("td",{className:"p-3 text-right font-medium text-purple-600 dark:text-purple-400",children:j(i.cluster_value)}),e.jsx("td",{className:"p-3 text-right",children:i.opportunity_count>0?e.jsxs("div",{className:"inline-flex items-center gap-2 px-2 py-1 bg-orange-100 dark:bg-orange-900/30 rounded-full",children:[e.jsx("span",{className:"text-orange-600 dark:text-orange-400 text-sm",children:"ð"}),e.jsx("span",{className:"text-orange-700 dark:text-orange-300 font-medium text-sm",children:i.opportunity_count})]}):e.jsx("span",{className:"text-gray-400 font-medium",children:"â"})})]},k))})]})})]})]})]})},ht=({cluster:m,currency:r,jsonData:c})=>{const l=m.keywords||[],g=c?.raw_data?.processed_keywords||[],b=m.cluster_data||[],a={};g.forEach(t=>{t.Keyword&&(a[t.Keyword]=t)});let o=[];return b.length>0?o=b.slice(0,20).map(t=>({keyword:t.Keyword||"Unknown",volume:t["Avg. monthly searches"]||0,cpc:t["Top of page bid (low range)"]||0,score:t.Score||0,isOpportunity:t._is_opportunity||!1})):o=l.slice(0,20).map(t=>{const h=a[t];return h?{keyword:h.Keyword,volume:h["Avg. monthly searches"]||0,cpc:h["Top of page bid (low range)"]||0,score:h.Score||0,isOpportunity:h._is_opportunity||!1}:{keyword:t,volume:0,cpc:0,score:0,isOpportunity:!1}}),o.sort((t,h)=>h.score-t.score),e.jsxs(u,{className:"bg-gradient-to-br from-slate-50 to-gray-50 dark:from-gray-900/50 dark:to-slate-900/50",children:[e.jsx(T,{children:e.jsxs(P,{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-blue-500 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-white text-sm",children:"ð"})}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-lg font-semibold",children:["Keywords in '",m.cluster_term,"' cluster"]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Top performing keywords with their metrics"})]})]})}),e.jsxs(y,{children:[e.jsx("div",{className:"block md:hidden space-y-3",children:o.map((t,h)=>e.jsx(u,{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700",children:e.jsx(y,{className:"p-4",children:e.jsx("div",{className:"flex items-start justify-between mb-3",children:e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:t.keyword}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-gray-500",children:"Volume:"}),e.jsx("span",{className:"font-medium text-blue-600",children:j(t.volume)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-gray-500",children:"CPC:"}),e.jsx("span",{className:"font-medium text-green-600",children:N(t.cpc,r)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-gray-500",children:"Score:"}),e.jsx("span",{className:"font-medium text-purple-600",children:t.score.toFixed(3)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-gray-500",children:"Opportunity:"}),t.isOpportunity?e.jsxs("span",{className:"text-orange-600 font-medium flex items-center gap-1",children:[e.jsx("span",{children:"ð"})," Yes"]}):e.jsx("span",{className:"text-gray-500",children:"No"})]})]})]})})})},h))}),e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-700",children:[e.jsx("th",{className:"text-left p-3 font-semibold text-gray-900 dark:text-white",children:"Keyword"}),e.jsx("th",{className:"text-right p-3 font-semibold text-gray-900 dark:text-white",children:"Volume"}),e.jsx("th",{className:"text-right p-3 font-semibold text-gray-900 dark:text-white",children:"CPC"}),e.jsx("th",{className:"text-right p-3 font-semibold text-gray-900 dark:text-white",children:"Score"}),e.jsx("th",{className:"text-center p-3 font-semibold text-gray-900 dark:text-white",children:"Opportunity"})]})}),e.jsx("tbody",{children:o.map((t,h)=>e.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800 hover:bg-blue-50/50 dark:hover:bg-blue-900/20 transition-colors",children:[e.jsx("td",{className:"p-3 font-medium text-gray-900 dark:text-white",children:t.keyword}),e.jsx("td",{className:"p-3 text-right font-medium text-blue-600 dar
1k:text-blue-400",children:j(t.volume)}),e.jsx("td",{className:"p-3 text-right font-medium text-green-600 dark:text-green-400",children:N(t.cpc,r)}),e.jsx("td",{className:"p-3 text-right font-medium text-purple-600 dark:text-purple-400",children:t.score.toFixed(3)}),e.jsx("td",{className:"p-3 text-center",children:t.isOpportunity?e.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 bg-orange-100 dark:bg-orange-900/30 rounded-full",children:[e.jsx("span",{className:"text-orange-600 dark:text-orange-400",children:"ð"}),e.jsx("span",{className:"text-orange-700 dark:text-orange-300 font-medium text-sm",children:"Yes"})]}):e.jsx("span",{className:"text-gray-500 font-medium",children:"No"})})]},h))})]})})]})]})},pt=({cluster:m,revenueAnalysis:r,currency:c,roiParams:l})=>{const g=r?.monthly_roi||0,b=(r?.monthly_profit||0)>0,o=(t=>t>300?{status:"success",title:"Scale up campaigns - This cluster is highly profitable",recommendations:["ð¯ **Scale up campaigns** - This cluster is highly profitable","ð **Expand keyword list** - Look for similar high-performing terms","ð° **Increase daily budget** by 50-100% to capture more volume","ð **Add negative keywords** to improve quality score","ð± **Test different ad formats** to maximize conversions"]}:t>200?{status:"info",title:"Good performance cluster worth investing in",recommendations:["ð **Moderate budget increase** - 25-50% budget boost recommended","ð¯ **Optimize ad copy** for better CTR and conversion rates","ð **Monitor performance closely** - Track weekly metrics","ð **Refine targeting** to focus on highest-converting terms","ð¡ **A/B test landing pages** for this keyword cluster"]}:t>100?{status:"warning",title:"Moderate performance, monitor closely",recommendations:["âï¸ **Maintain current spend** while optimizing performance","ð **Improve Quality Score** to reduce CPCs","ð **Enhance ad relevance** with keyword-specific ad copy","ð **Track conversion attribution** more closely","ð¡ **Test different match types** to improve efficiency"]}:{status:"error",title:"Low performance, needs optimization",recommendations:["â ï¸ **Reduce spend immediately** or pause low-performing keywords","ð **Audit keyword relevance** - remove irrelevant terms","ð **Rewrite ad copy** to improve CTR and relevance","ð **Check landing page experience** for conversion issues","ð¡ **Consider different bidding strategies** or campaign restructuring"]})(g);return e.jsxs(u,{children:[e.jsx(T,{children:e.jsx(P,{className:"flex items-center gap-2",children:"ð° Revenue Projections & Spending Recommendations"})}),e.jsxs(y,{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 md:gap-6",children:[e.jsx(u,{className:"bg-gradient-to-br from-green-50 to-emerald-100 dark:from-green-900/20 dark:to-emerald-900/20 border-green-200 dark:border-green-800",children:e.jsxs(y,{className:"p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("div",{className:"w-10 h-10 bg-green-500 rounded-full flex items-center justify-center",children:e.jsx(F,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-lg font-medium text-green-700 dark:text-green-300 mb-1",children:"Monthly Revenue"}),e.jsx("p",{className:"text-2xl font-bold text-green-600 dark:text-green-400",children:N(r?.projected_revenue||0,c)})]})]}),e.jsx("div",{className:"text-xs text-green-600 dark:text-green-400",children:"Projected monthly earnings"})]})}),e.jsx(u,{className:"bg-gradient-to-br from-red-50 to-rose-100 dark:from-red-900/20 dark:to-rose-900/20 border-red-200 dark:border-red-800",children:e.jsxs(y,{className:"p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("div",{className:"w-10 h-10 bg-red-500 rounded-full flex items-center justify-center",children:e.jsx(F,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-lg font-medium text-red-700 dark:text-red-300 mb-1",children:"Ad Spend"}),e.jsx("p",{className:"text-2xl font-bold text-red-600 dark:text-red-400",children:N(r?.estimated_spend||0,c)})]})]}),e.jsx("div",{className:"text-xs text-red-600 dark:text-red-400",children:"Monthly advertising cost"})]})}),e.jsx(u,{className:"bg-gradient-to-br from-blue-50 to-indigo-100 dark:from-blue-900/20 dark:to-indigo-900/20 border-blue-200 dark:border-blue-800",children:e.jsxs(y,{className:"p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("div",{className:"w-10 h-10 bg-blue-500 rounded-full flex items-center justify-center",children:b?e.jsx(M,{className:"w-5 h-5 text-white"}):e.jsx(E,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-lg font-medium text-blue-700 dark:text-blue-300 mb-1",children:"Monthly Profit"}),e.jsx("p",{className:`text-2xl font-bold ${b?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"}`,children:N(r?.monthly_profit||0,c)})]})]}),e.jsx("div",{className:`text-xs ${b?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"}`,children:"Net monthly earnings"})]})}),e.jsx(u,{className:"bg-pink-50 dark:bg-gray-900/80 backdrop-blur-md border-pink-50 dark:border-gray-700",children:e.jsxs(y,{className:"p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("div",{className:"w-10 h-10 bg-purple-500 rounded-full flex items-center justify-center",children:e.jsx($,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-lg font-medium text-purple-700 dark:text-purple-300 mb-1",children:"ROI"}),e.jsxs("p",{className:`text-2xl font-bold ${b?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"}`,children:[g.toFixed(0),"%"]})]})]}),e.jsx("div",{className:`text-xs ${b?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"}`,children:"Return on investment"})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 md:gap-6",children:[e.jsx(u,{className:"bg-gradient-to-br from-cyan-50 to-teal-100 dar
1k:from-cyan-900/20 dark:to-teal-900/20 border-cyan-200 dark:border-cyan-800",children:e.jsxs(y,{className:"p-4 text-center",children:[e.jsx("div",{className:"flex items-center justify-center mb-2",children:e.jsx("div",{className:"w-8 h-8 bg-cyan-500 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-white text-xs",children:"ð"})})}),e.jsx("p",{className:"text-xl font-bold text-cyan-600 dark:text-cyan-400 mb-1",children:j(r?.estimated_clicks||0)}),e.jsx("p",{className:"text-sm font-medium text-cyan-700 dark:text-cyan-300",children:"Clicks/Month"}),e.jsx("p",{className:"text-xs text-cyan-600 dark:text-cyan-400",children:"Estimated traffic"})]})}),e.jsx(u,{className:"bg-gradient-to-br from-pink-50 to-rose-100 dark:from-pink-900/20 dark:to-rose-900/20 border-pink-200 dark:border-pink-800",children:e.jsxs(y,{className:"p-4 text-center",children:[e.jsx("div",{className:"flex items-center justify-center mb-2",children:e.jsx("div",{className:"w-8 h-8 bg-pink-500 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-white text-xs",children:"ð¯"})})}),e.jsx("p",{className:"text-xl font-bold text-pink-600 dark:text-pink-400 mb-1",children:(r?.estimated_conversions||0).toFixed(1)}),e.jsx("p",{className:"text-sm font-medium text-pink-700 dark:text-pink-300",children:"Conversions"}),e.jsx("p",{className:"text-xs text-pink-600 dark:text-pink-400",children:"Monthly conversions"})]})}),e.jsx(u,{className:"bg-gradient-to-br from-amber-50 to-orange-100 dark:from-amber-900/20 dark:to-orange-900/20 border-amber-200 dark:border-amber-800",children:e.jsxs(y,{className:"p-4 text-center",children:[e.jsx("div",{className:"flex items-center justify-center mb-2",children:e.jsx("div",{className:"w-8 h-8 bg-amber-500 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-white text-xs",children:"ð°"})})}),e.jsx("p",{className:"text-xl font-bold text-amber-600 dark:text-amber-400 mb-1",children:N(r?.clv_revenue||0,c)}),e.jsx("p",{className:"text-sm font-medium text-amber-700 dark:text-amber-300",children:"CLV Revenue"}),e.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:"Customer lifetime value"})]})}),e.jsx(u,{className:"bg-gradient-to-br from-indigo-50 to-blue-100 dark:from-indigo-900/20 dark:to-blue-900/20 border-indigo-200 dark:border-indigo-800",children:e.jsxs(y,{className:"p-4 text-center",children:[e.jsx("div",{className:"flex items-center justify-center mb-2",children:e.jsx("div",{className:"w-8 h-8 bg-indigo-500 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-white text-xs",children:"ð"})})}),e.jsxs("p",{className:"text-xl font-bold text-indigo-600 dark:text-indigo-400 mb-1",children:[(r?.clv_roi||0).toFixed(0),"%"]}),e.jsx("p",{className:"text-sm font-medium text-indigo-700 dark:text-indigo-300",children:"CLV ROI"}),e.jsx("p",{className:"text-xs text-indigo-600 dark:text-indigo-400",children:"Lifetime ROI"})]})})]}),e.jsxs("div",{className:"space-y-4 md:space-y-6",children:[e.jsx(u,{className:`border-l-4 ${o.status==="success"?"bg-gradient-to-r from-green-50 to-emerald-50 dark:from-green-900/20 dark:to-emerald-900/20 border-green-500":o.status==="info"?"bg-gradient-to-r from-blue-50 to-cyan-50 dark:from-blue-900/20 dark:to-cyan-900/20 border-blue-500":o.status==="warning"?"bg-gradient-to-r from-yellow-50 to-orange-50 dark:from-yellow-900/20 dark:to-orange-900/20 border-yellow-500":"bg-gradient-to-r from-red-50 to-rose-50 dark:from-red-900/20 dark:to-rose-900/20 border-red-500"}`,children:e.jsx(y,{className:"p-5",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center ${o.status==="success"?"bg-green-500":o.status==="info"?"bg-blue-500":o.status==="warning"?"bg-yellow-500":"bg-red-500"}`,children:e.jsx("span",{className:"text-white text-sm",children:"ð"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-semibold text-lg mb-2",children:"Spending Recommendation"}),e.jsx("p",{className:`font-medium text-base ${o.status==="success"?"text-green-800 dark:text-green-200":o.status==="info"?"text-blue-800 dark:text-blue-200":o.status==="warning"?"text-yellow-800 dark:text-yellow-200":"text-red-800 dark:text-red-200"}`,children:o.title})]})]})})}),e.jsxs(u,{className:"bg-gradient-to-br from-slate-50 to-gray-50 dark:from-gray-900/50 dark:to-slate-900/50",children:[e.jsx(T,{children:e.jsxs(P,{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-purple-500 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-white text-sm",children:"ð¡"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Strategic Recommendations"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Actionable insights for optimization"})]})]})}),e.jsx(y,{children:e.jsx("div",{className:"grid gap-3 sm:gap-4",children:o.recommendations.map((t,h)=>e.jsxs("div",{className:"flex items-start gap-3 p-3 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[e.jsx("div",{className:"w-6 h-6 bg-purple-100 dar
1k:bg-purple-900 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx("span",{className:"text-purple-600 dark:text-purple-400 text-xs font-bold",children:h+1})}),e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 leading-relaxed",children:t})]},h))})})]})]})]})]})},ut=({cluster:m,currency:r,jsonData:c})=>{const l=m.keywords||[],g=c?.raw_data?.processed_keywords||[],b=m.cluster_data||[],a={};g.forEach(d=>{d.Keyword&&(a[d.Keyword]=d)});let o=[];b.length>0?o=b.slice(0,10).map(d=>({keyword:d.Keyword||"Unknown",volume:d["Avg. monthly searches"]||0,score:d.Score||0})):o=l.slice(0,10).map(d=>{const s=a[d];return s?{keyword:s.Keyword,volume:s["Avg. monthly searches"]||0,score:s.Score||0}:{keyword:d,volume:0,score:0}});const t=o.sort((d,s)=>s.volume-d.volume),h={labels:t.map(d=>d.keyword.length>15?d.keyword.substring(0,15)+"...":d.keyword),datasets:[{label:"Search Volume",data:t.map(d=>d.volume),backgroundColor:"rgba(59, 130, 246, 0.8)",borderColor:"rgba(59, 130, 246, 1)",borderWidth:2,borderRadius:8,borderSkipped:!1}]},C={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{callbacks:{label:function(d){const s=d.dataIndex,n=t[s];return[`Keyword: ${n.keyword}`,`Volume: ${j(n.volume)}`,`Score: ${n.score.toFixed(3)}`]}},backgroundColor:"rgba(0, 0, 0, 0.8)",titleColor:"white",bodyColor:"white",borderColor:"white",borderWidth:1,cornerRadius:8,displayColors:!1}
1,title:{display:!0,text:`Top Keywords in '${m.cluster_term}' Cluster`,font:{size:16,weight:"bold",family:"Inter, sans-serif"},color:"#1f2937",padding:{bottom:20}}},scales:{y:{beginAtZero:!0,ticks:{callback:function(d){return j(d)},font:{size:12},color:"#6b7280"},grid:{color:"#e5e7eb"}},x:{ticks:{maxRotation:45,minRotation:45,font:{size:11},color:"#6b7280"},grid:{color:"#e5e7eb"}}}};return e.jsxs(u,{className:"bg-gradient-to-br from-slate-50 to-gray-50 dark:from-gray-900/50 dark:to-slate-900/50",children:[e.jsx(T,{children:e.jsxs(P,{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-green-500 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-white text-sm",children:"ð"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Top Keywords Performance"}),e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Keyword volume analysis for '",m.cluster_term,"' cluster"]})]})]})}),e.jsxs(y,{children:[e.jsx("div",{className:"block md:hidden",children:e.jsx("div",{className:"space-y-3",children:t.slice(0,5).map((d,s)=>e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium text-gray-900 dark:text-white text-sm truncate",children:d.keyword}),e.jsxs("p",{className:"text-xs text-gray-500",children:["Volume: ",j(d.volume)]})]}),e.jsx("div",{className:"w-16 bg-gray-200 dark:bg-gray-700 rounded-full h-2",children:e.jsx("div",{className:"bg-blue-500 h-2 rounded-full",style:{width:`${d.volume/Math.max(...t.map(n=>n.volume))*100}%`}})})]},s))})}),e.jsx("div",{className:"hidden md:block h-80",children:e.jsx(De,{data:h,options:C})})]})]})},yt=({jsonData:m})=>{const r=A(),c=m?.budget_scenario_analysis;if(!c||!c.time_series_projections||c.time_series_projections.length===0)return e.jsxs(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"col-span-2 bg-gradient-to-br from-gray-500/10 to-gray-600/10 backdrop-blur-sm border border-gray-500/20 rounded-2xl p-8 text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-gradient-to-br from-gray-500/20 to-gray-600/20 rounded-2xl flex items-center justify-center mx-auto mb-4",children:e.jsx(F,{className:"w-8 h-8 text-gray-400"})}),e.jsx("h3",{className:"text-xl font-bold text-white mb-2",children:"Budget Scenario Analysis"}),e.jsx("p",{className:"text-gray-400",children:"No budget scenario data available"})]});const l=["Low","Base","High"],g=["Conservative","Realistic","Optimistic"],b={Conservative:"#E74C3C",Realistic:"#4162FF",Optimistic:"#27AE60"},a=l.map(d=>{const s=c.time_series_projections.filter(v=>v.budget_scenario===d).sort((v,w)=>v.month-w.month),n=[];return[...new Set(s.map(v=>v.month))].sort().forEach(v=>{const w={month:v};g.forEach(_=>{const S=s.find(f=>f.month===v&&f.performance_scenario===_);S&&(w[`${_}_revenue`]=S.cumulative_revenue||0,w[`${_}_profit`]=S.monthly_profit||0,w[`${_}_spend`]=S.cumulative_spend||0)}),n.push(w)}),{budgetScenario:d,data:n}}),o=({active:d,payload:s,label:n})=>d&&s&&s.length>0?e.jsxs("div",{className:"border rounded-lg shadow-lg p-4",style:{backgroundColor:r.tooltipBackground,color:r.text,borderColor:r.tooltipBorder},children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"font-semibold",children:["Month ",n]}),e.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 bg-gradient-to-r from-blue-500/20 to-purple-500/20 rounded-full border border-blue-400/30",children:[e.jsx(F,{className:"w-3 h-3 text-blue-400"}),e.jsx("span",{className:"text-xs font-bold text-blue-400 uppercase tracking-wide",children:"Monthly Profits"})]})]}),e.jsx("div",{className:"space-y-2 text-sm",children:s.map((p,v)=>e.jsxs("div",{className:"flex justify-between items-center p-2 rounded-lg bg-white/5 dark:bg-gray-800/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-3 h-3 rounded-full shadow-sm",style:{backgroundColor:p.color}}),e.jsx("span",{className:"font-medium",children:p.name})]}),e.jsx("span",{className:"font-bold text-lg",children:N(p.value,"USD")})]},v))})]}):null,t=c.time_series_projections.map(d=>d.cumulative_revenue||0),C=Math.max(...t)*1.2;return e.jsxs(x.div,{initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},className:"col-span-2 space-y-8",children:[e.jsxs(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-gradient-to-br from-blue-500/20 to-blue-600/20 rounded-2xl flex items-center justify-center mx-auto mb-4",children:e.jsx(F,{className:"w-8 h-8 text-blue-400"})}),e.jsxs("div",{className:"flex items-center justify-center gap-4 mb-4",children:[e.jsx("h2",{className:"text-2xl sm:text-3xl font-bold text-black dark:text-white",children:"Budget Scenario Analysis"}),e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-gradient-to-r from-blue-500/20 to-purple-500/20 rounded-full border border-blue-400/50 shadow-lg",children:[e.jsx(F,{className:"w-5 h-5 text-blue-400"}),e.jsx("span",{className:"text-sm font-bold text-blue-400 uppercase tracking-wide",children:"Monthly Profits"})]})]}),e.jsx("p",{className:"text-lg sm:text-xl text-gray-700 dark:text-gray-400",children:"Compare different budget strategies and their monthly profit projections"})]}),c.final_comparison&&e.jsx(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:"grid grid-cols-1 md:grid-cols-3 gap-8",children:[{key:"low_budget_final",name:"Low Budget",color:"from-red-500/10 to-red-600/10",borderColor:"border-red-500/20",iconColor:"text-red-400"},{key:"base_budget_final",name:"Base Budget",color:"from-blue-500/10 to-blue-600/10",borderColor:"border-blue-500/20",iconColor:"text-blue-400"},{key:"high_budget_final",name:"High Budget",color:"from-green-500/10 to-green-600/10",borderColor:"border-green-500/20",iconColor:"text-green-400"}].map((d,s)=>{const n=c.final_comparison[d.key],p=n?.is_profitable;return e.jsx(x.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{delay:.3+s*.1},whileHover:{scale:1.02,y:-2},className:`bg-gradient-to-br ${d.color} backdrop-blur-sm border ${d.borderColor} rounded-2xl p-8 group cursor-pointer`,children:e.jsxs("div",{className:"text-center space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-center gap-3",children:[e.jsx("div",{className:`w-10 h-10 bg-gradient-to-br ${d.color.replace("/10","/20")} rounded-xl flex items-center justify-center group-hover:scale-110 transition-transform`,children:p?e.jsx(M,{className:`w-5 h-5 ${d.iconColor}`}):e.jsx(E,{className:`w-5 h-5 ${d.iconColor}`})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg sm:text-xl font-bold text-black dark:text-white group-hover:text-gray-800 dark:group-hover:text-white/90 transition-colors",children:d.name}),e.jsx("p",{className:"text-gray-700 dark:text-gray-400 text-sm",children:"Strategy Analysis"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-gradient-to-r from-white/5 to-white/10 rounded-xl p-4",children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-400 mb-1",children:"Final ROI"}),e.jsxs("p",{className:`text-xl sm:text-2xl font-bold ${p?"text-green-400":"text-red-400"}`,children:[n?.final_roi?.toFixed(1),"%"]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"bg-gradient-to-r from-white/5 to-white/10 rounded-lg p-3",children:[e.jsx("p",{className:"text-xs text-gray-700 dark:text-gray-400 mb-1",children:"Revenue"}),e.jsx("p",{className:"text-sm font-bold text-green-400",children:N(n?.cumulative_revenue)})]}),e.jsxs("div",{className:"bg-gradient-to-r from-white/5 to-white/10 rounded-lg p-3",children:[e.jsx("p",{className:"text-xs text-gray-700 dark:text-gray-400 mb-1",children:"Spend"}),e.jsx("p",{className:"text-sm font-bold text-blue-400",children:N(n?.cumulative_spend)})]})]})]}),e.jsx(V,{variant:p?"default":"destructive",className:"px-6 py-2 text-sm font-medium",children:p?"Profitable":"Not Profitable"})]})},d.key)})}),e.jsxs(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.4},className:"bg-white/95 dark:bg-black/80 backdrop-blur-md border border-gray-200/50 dark:border-gray-800/50 rounded-2xl p-8",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsxs("div",{className:"w-16 h-16 bg-gray-100/80 dark:bg-black/70 backdrop-blur-sm rounded-2xl flex items-center justify-center mx-auto mb-4 relative",children:[e.jsx(M,{className:"w-8 h-8 text-purple-500 dark:text-purple-400"}),e.jsx("div",{className:"absolute -top-2 -right-2 w-6 h-6 bg-gradient-to-r from-blue-500 to-purple-600 rounded-full flex items-center justify-center shadow-lg",children:e.jsx(F,{className:"w-3 h-3 text-white"})})]}),e.jsxs("div",{className:"flex items-center justify-center gap-3 mb-3",children:[e.jsx("h3",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Monthly Profit Projections"}),e.jsxs("div",{className:"flex items-center gap-1 px-3 py-1 bg-gradient-to-r from-blue-500/20 to-purple-500/20 rounded-full border border-blue-400/50",children:[e.jsx(F,{className:"w-4 h-4 text-blue-500 dark:text-blue-400"}),e.jsx("span",{className:"text-sm font-bold text-blue-500 dark:text-blue-400 uppercase tracking-wide",children:"Monthly Profits"})]})]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Interactive timeline showing monthly profit growth potential across different budget scenarios"})]}),e.jsxs(Ze,{defaultValue:"Base",className:"w-full",children:[e.jsxs(qe,{className:"grid w-full grid-cols-3 bg-gradient-to-r from-gray-100/40 to-gray-200/60 dark:from-black/20 dark:to-black/40 backdrop-blur-sm border border-gray-300/30 dark:border-white/10 mb-8",children:[e.jsxs(W,{value:"Low",className:"flex items-center gap-2 text-gray-700 dark:text-gray-300 data-[state=active]:bg-gradient-to-r data-[state=active]:from-red-500/20 data-[state=active]:to-red-600/20 data-[state=active]:text-red-600 dark:data-[state=active]:text-red-300",children:[e.jsx("div",{className:"w-2 h-2 bg-red-500 dark:bg-red-400 rounded-full"}),"Low Budget"]}
1),e.jsxs(W,{value:"Base",className:"flex items-center gap-2 text-gray-700 dark:text-gray-300 data-[state=active]:bg-gradient-to-r data-[state=active]:from-blue-500/20 data-[state=active]:to-blue-600/20 data-[state=active]:text-blue-600 dark:data-[state=active]:text-blue-300",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 dark:bg-blue-400 rounded-full"}),"Base Budget"]}),e.jsxs(W,{value:"High",className:"flex items-center gap-2 text-gray-700 dark:text-gray-300 data-[state=active]:bg-gradient-to-r data-[state=active]:from-green-500/20 data-[state=active]:to-green-600/20 data-[state=active]:text-green-600 dark:data-[state=active]:text-green-300",children:[e.jsx("div",{className:"w-2 h-2 bg-green-500 dark:bg-green-400 rounded-full"}),"High Budget"]})]}),a.map(({budgetScenario:d,data:s})=>e.jsxs(Xe,{value:d,className:"space-y-6",children:[e.jsx(x.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.5},className:"bg-gradient-to-br from-gray-50/80 to-gray-100/60 dark:from-black/20 dark:to-black/40 backdrop-blur-sm border border-gray-200/30 dark:border-white/10 rounded-2xl p-6",children:e.jsx("div",{className:"h-96",children:e.jsx(K,{width:"100%",height:"100%",children:e.jsxs(Se,{data:s,margin:{top:20,right:30,left:20,bottom:20},children:[e.jsx(Y,{strokeDasharray:"3 3",stroke:r.gridLine}),e.jsx(Z,{dataKey:"month",type:"number",domain:[1,12],tick:{fontSize:12,fill:r.axisText},tickLine:{stroke:r.axisText},axisLine:{stroke:r.axisText}}),e.jsx(q,{domain:[0,C],tickFormatter:n=>N(n,"USD"),tick:{fontSize:12,fill:r.axisText},tickLine:{stroke:r.axisText},axisLine:{stroke:r.axisText},label:{value:"Monthly Profit ($)",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:r.axisText,fontSize:"14px",fontWeight:"bold"}}}),e.jsx(z,{content:e.jsx(o,{}),contentStyle:{backgroundColor:r.tooltipBackground,color:r.text,borderColor:r.tooltipBorder,borderRadius:"8px"}}),e.jsx(Oe,{wrapperStyle:{paddingTop:"20px",color:r.legendText},iconType:"line"}),g.map(n=>e.jsx(Te,{type:"monotone",dataKey:`${n}_profit`,stroke:b[n],strokeWidth:4,name:`${n} Monthly Profit`,connectNulls:!1,dot:{r:4,fill:b[n]},activeDot:{r:6,fill:b[n]}},n))]})})})}),e.jsx(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[{label:"Monthly Profit (12mo)",sublabel:"Realistic Scenario",value:N(s[s.length-1]?.Realistic_profit||0),color:"text-blue-400",bgColor:"from-blue-500/10 to-blue-600/10",icon:M,highlight:!0},{label:"Best Case Monthly Profit",sublabel:"Optimistic Scenario",value:N(s[s.length-1]?.Optimistic_profit||0),color:"text-green-400",bgColor:"from-green-500/10 to-green-600/10",icon:M,highlight:!0},{label:"Conservative Monthly Profit",sublabel:"Worst Case Scenario",value:N(s[s.length-1]?.Conservative_profit||0),color:"text-red-400",bgColor:"from-red-500/10 to-red-600/10",icon:E,highlight:!0}].map((n,p)=>e.jsxs(x.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{delay:.3+p*.1},whileHover:{scale:1.02},className:`bg-gradient-to-br ${n.bgColor} backdrop-blur-sm border border-gray-200/30 dark:border-white/20 rounded-2xl p-6 text-center group`,children:[e.jsxs("div",{className:"relative",children:[e.jsx(n.icon,{className:`w-6 h-6 ${n.color} mx-auto mb-3 group-hover:scale-110 transition-transform`}),n.highlight&&e.jsx("div",{className:"absolute -top-1 -right-1 w-4 h-4 bg-gradient-to-r from-blue-500 to-purple-600 rounded-full flex items-center justify-center shadow-lg",children:e.jsx(F,{className:"w-2 h-2 text-white"})})]}),e.jsx("p",{className:`text-2xl font-bold ${n.color} mb-1`,children:n.value}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm font-medium mb-1",children:n.label}),e.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-xs",children:n.sublabel})]},n.label))}),e.jsxs(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.4},className:"bg-gradient-to-r from-gray-100/20 to-gray-200/30 dark:from-white/5 dark:to-white/10 backdrop-blur-sm border border-gray-200/30 dark:border-white/10 rounded-2xl p-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-200/80 dark:bg-black/70 backdrop-blur-sm rounded-xl flex items-center justify-center",children:e.jsx(de,{className:"w-5 h-5 text-purple-500 dark:text-purple-400"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-lg font-bold text-gray-900 dark:text-white",children:"Scenario Insights"}),e.jsxs("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:["Key takeaways for ",d.toLowerCase()," budget strategy"]}
1)]})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-gradient-to-r from-green-500/10 to-transparent rounded-lg",children:[e.jsx("div",{className:"w-2 h-2 bg-green-500 dark:bg-green-400 rounded-full"}),e.jsxs("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Best case shows ",((s[s.length-1]?.Optimistic_profit||0)/(s[s.length-1]?.Realistic_profit||1)*100-100).toFixed(0),"% upside in monthly profit potential"]})]}),e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-gradient-to-r from-blue-500/10 to-transparent rounded-lg",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 dark:bg-blue-400 rounded-full"}),e.jsxs("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Realistic monthly profit trajectory provides steady ",d.toLowerCase()," returns"]})]}),e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-gradient-to-r from-orange-500/10 to-transparent rounded-lg",children:[e.jsx("div",{className:"w-2 h-2 bg-orange-500 dark:bg-orange-400 rounded-full"}),e.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Conservative monthly profit estimates help manage risk effectively"})]})]})]})]},d))]})]})]})},bt=({jsonData:m})=>{A();const r=m?.analysis_results?.revenue_projections,c=m?.configuration?.roi_parameters;if(!r)return e.jsxs(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"col-span-2 bg-gradient-to-br from-gray-100/60 to-gray-200/40 dark:from-gray-500/10 dark:to-gray-600/10 backdrop-blur-sm border border-gray-300/40 dark:border-gray-500/20 rounded-2xl p-8 text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-gradient-to-br from-gray-200/60 to-gray-300/40 dark:from-gray-500/20 dark:to-gray-600/20 rounded-2xl flex items-center justify-center mx-auto mb-4",children:e.jsx(F,{className:"w-8 h-8 text-gray-600 dark:text-gray-400"})}),e.jsx("h3",{className:"text-xl font-bold text-gray-900 dark:text-white mb-2",children:"Revenue Projections"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"No revenue projection data available"})]});const l=r.enhanced_metrics||{},g=l.monthly_profit>0,b=l.monthly_roi>
10,a=m?.summary_metrics?.budget_recommendations||{},o=[{name:"Conservative",amount:a.conservative||0,color:"#E74C3C",description:"Risk-averse approach"},{name:"Balanced",amount:a.balanced||0,color:"#4162FF",description:"Recommended strategy"},{name:"Aggressive",amount:a.aggressive||0,color:"#27AE60",description:"Growth-focused approach"}];return Math.abs(l.monthly_revenue||0),Math.abs(l.monthly_ad_spend||c?.monthly_spend_budget||0),Math.abs(l.monthly_operational_costs||c?.monthly_fixed_costs||0),e.jsxs(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"col-span-2 space-y-8",children:[e.jsxs(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[e.jsxs(x.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{delay:.2},whileHover:{scale:1.02},className:"bg-gradient-to-br from-green-50/80 to-green-100/60 dark:from-green-500/10 dark:to-green-600/10 backdrop-blur-sm border border-green-200/50 dark:border-green-500/20 rounded-3xl p-8 text-center group",children:[e.jsx("div",{className:"w-16 h-16 bg-gradient-to-br from-green-100/80 to-green-200/60 dark:from-green-500/20 dark:to-green-600/20 rounded-2xl flex items-center justify-center mx-auto mb-6 group-hover:scale-110 transition-transform",children:e.jsx(M,{className:"w-8 h-8 text-green-600 dark:text-green-400"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 font-medium uppercase tracking-wide",children:"Monthly Profit"}),e.jsx("p",{className:"text-3xl sm:text-4xl lg:text-5xl xl:text-6xl font-bold text-green-600 dark:text-green-400 group-hover:text-green-700 dark:group-hover:text-green-300 transition-colors",children:N(l.monthly_profit||0)}),e.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${g?"bg-green-500 dark:bg-green-400":"bg-red-500 dark:bg-red-400"}`}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:g?"Projected earnings":"Loss projection"})]})]})]}),e.jsxs(x.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{delay:.3},whileHover:{scale:1.02},className:"bg-gradient-to-br from-blue-50/80 to-blue-100/60 dark:from-blue-500/10 dark:to-blue-600/10 backdrop-blur-sm border border-blue-200/50 dark:border-blue-500/20 rounded-3xl p-8 text-center group",children:[e.jsx("div",{className:"w-16 h-16 bg-gradient-to-br from-blue-100/80 to-blue-200/60 dark:from-blue-500/20 dark:to-blue-600/20 rounded-2xl flex items-center justify-center mx-auto mb-6 group-hover:scale-110 transition-transform",children:e.jsx(F,{className:"w-8 h-8 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 font-medium uppercase tracking-wide",children:"Average CPC"}),e.jsx("p",{className:"text-3xl sm:text-4xl lg:text-5xl xl:text-6xl font-bold text-blue-600 dark:text-blue-400 group-hover:text-blue-700 dark:group-hover:text-blue-200 transition-colors",children:N(r.average_cpc)}),e.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 dark:bg-blue-400 rounded-full"}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Cost per click"})]})]})]})]}),e.jsx(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.4},className:"grid grid-cols-2 lg:grid-cols-4 gap-6",children:[{icon:F,label:"Monthly Revenue",value:N(l.monthly_revenue||0),color:"text-green-600 dark:text-green-400",bgColor:"from-green-50/60 to-green-100/40 dark:from-green-500/10 dark:to-green-600/10"},{icon:$,label:"Monthly ROI",value:l.monthly_roi?`${l.monthly_roi.toFixed(1)}%`:"â",color:b?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400",bgColor:b?"from-green-50/60 to-green-100/40 dark:from-green-500/10 dark:to-green-600/10":"from-red-50/60 to-red-100/40 dark:from-red-500/10 dark:to-red-600/10"},{icon:Qe,label:"Cost per Acquisition",value:N(l.cost_per_acquisition||0),color:"text-orange-600 dar
1k:text-orange-400",bgColor:"from-orange-50/60 to-orange-100/40 dark:from-orange-500/10 dark:to-orange-600/10"},{icon:g?M:E,label:"Performance",value:g?"Profitable":"Needs Optimization",color:g?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400",bgColor:g?"from-green-50/60 to-green-100/40 dark:from-green-500/10 dark:to-green-600/10":"from-red-50/60 to-red-100/40 dark:from-red-500/10 dark:to-red-600/10"}].map((t,h)=>e.jsxs(x.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{delay:.5+h*.1},whileHover:{scale:1.02},className:`bg-gradient-to-br ${t.bgColor} backdrop-blur-sm border border-gray-200/40 dark:border-white/20 rounded-2xl p-6 text-center group`,children:[e.jsx(t.icon,{className:`w-6 h-6 ${t.color} mx-auto mb-3 group-hover:scale-110 transition-transform`}),e.jsx("p",{className:`text-lg sm:text-xl lg:text-2xl font-bold ${t.color} mb-1`,children:t.value}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm font-medium",children:t.label})]},t.label))}),e.jsxs(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.6},className:"bg-gradient-to-r from-gray-50 to-gray-100 dark:from-gray-800/50 dark:to-gray-900/50 backdrop-blur-sm border border-gray-200/20 dark:border-gray-700/20 rounded-2xl p-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-100 dark:bg-gray-800 rounded-xl flex items-center justify-center",children:e.jsx(F,{className:"w-5 h-5 text-gray-600 dark:text-gray-400"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-bold text-gray-900 dark:text-white",children:"Budget Strategy"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Recommended monthly spend"})]})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4",children:o.map((t,h)=>e.jsxs(x.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.7+h*.05},className:"text-center p-4 bg-white dark:bg-gray-800/50 rounded-xl border border-gray-100 dark:border-gray-700",children:[e.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-1",children:t.name}),e.jsx("p",{className:"text-lg font-bold text-gray-900 dark:text-white",children:N(t.amount)}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:t.description})]},t.name))})]}),e.jsxs(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.8},className:"bg-gradient-to-r from-gray-50 to-gray-100 dark:from-gray-800/50 dark:to-gray-900/50 backdrop-blur-sm border border-gray-200/20 dark:border-gray-700/20 rounded-2xl p-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx("div",{className:"w-10 h-10 bg-gray-100 dark:bg-gray-800 rounded-xl flex items-center justify-center",children:e.jsx(M,{className:"w-5 h-5 text-gray-600 dark:text-gray-400"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-bold text-gray-900 dark:text-white",children:"Performance Summary"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Key metrics and status"})]})]}),e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[{label:"Status",value:g?"Profitable":"Needs Work",color:g?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"},{label:"Gross Margin",value:l.gross_margin?`${l.gross_margin.toFixed(1)}%`:"â",color:"text-gray-900 dark:text-white"},{label:"Break-even CPA",value:N(l.break_even_cpa||0),color:"text-gray-900 dark:text-white"},{label:"Total Volume",value:j(r.total_volume),color:"text-gray-900 dark:text-white"}].map((t,h)=>e.jsxs(x.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.9+h*.05},className:"text-center p-4 bg-white dark:bg-gray-800/50 rounded-xl border border-gray-100 dark:border-gray-700",children:[e.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-1",children:t.label}),e.jsx("p",{className:`text-sm font-bold ${t.color}`,children:t.value})]},t.label))})]})]})},ft=({tabs:m,defaultValue:r})=>{const[c,l]=O.useState(r);return e.jsxs("div",{className:"w-full",children:[e.jsx("div",{className:"flex flex-wrap justify-center gap-3 mb-6 border-b border-gray-200 dark:border-gray-700 pb-4",children:m.map(g=>e.jsxs(x.button,{onClick:()=>l(g.id),className:`relative flex items-center gap-2 px-4 py-3 rounded-xl font-medium transition-all duration-300 overflow-hidden ${c===g.id?"bg-blue-600 text-white shadow-lg transform scale-105 min-w-[120px]":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 hover:shadow-md min-w-[60px]"}`,whileHover:{scale:c===g.id?1.05:1.02},whileTap:{scale:.98},children:[e.jsx("div",{className:`flex-shrink-0 ${c===g.id?"text-white":"text-gray-500 dark:text-gray-400"}`,children:g.icon}),e.jsx(X,{mode:"wait",children:c===g.id?e.jsx(x.span,{className:"whitespace-nowrap",initial:{opacity:0,width:0}
1,animate:{opacity:1,width:"auto"},exit:{opacity:0,width:0},transition:{duration:.2},children:g.label},"full"):e.jsx(x.span,{className:"whitespace-nowrap font-bold",initial:{opacity:0,scale:.8},animate:{opacity:.8,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.2},children:g.label.charAt(0).toUpperCase()},"compact")})]},g.id))}),e.jsx(X,{mode:"wait",children:e.jsx(x.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:m.find(g=>g.id===c)?.content},c)})]})},Et=()=>{const{fileId:m}=ae(),r=se(),{theme:c}=ne(),[l,g]=O.useState(null),[b,a]=O.useState(!0),[o,t]=O.useState(null),[h,C]=O.useState(!1),[d,s]=O.useState(0),[n,p]=O.useState("Initializing...");O.useEffect(()=>{v()},[m]);const v=async()=>{try{a(!0),s(0),p("Connecting to server..."),await new Promise(D=>setTimeout(D,300)),s(15),p("Fetching file data..."),await new Promise(D=>setTimeout(D,400)),s(40),p("Processing JSON data...");const f=await ce(m);console.log("ð KeywordAnalysisViewPage - API response:",{hasData:!!f,hasJsonData:!!f?.jsonData,dataKeys:f?Object.keys(f):null}),s(70),p("Analyzing content..."),await new Promise(D=>setTimeout(D,300)),s(90),p("Preparing dashboard..."),g(f),s(100),p("Complete! ð"),setTimeout(()=>{a(!1),s(0),p("")},500)}catch(f){console.error("Error loading file:",f),p("Error loading file"),t("Failed to load analysis file"),B.error("Failed to load analysis file"),setTimeout(()=>{a(!1),s(0),p("")},2e3)}},w=async()=>{try{const f=await ue(m),D=new Blob([JSON.stringify(f.data,null,2)],{type:"application/json"}),i=URL.createObjectURL(D),k=document.createElement("a");k.href=i,k.download=`${l.displayName}.json`,document.body.appendChild(k),k.click(),document.body.removeChild(k),URL.revokeObjectURL(i),B.success("File downloaded!")}catch{B.error("Failed to download file")}},_=async()=>{try{const f=window.location.href;if(navigator.share){await navigator.share({title:`${l.displayName} - Keyword Analysis`,text:`Check out this keyword analysis: ${l.displayName}`,url:f}),B.success("Shared successfully!");return}await navigator.clipboard.writeText(f),C(!0),B.success("Link copied to clipboard!"),setTimeout(()=>C(!1),2e3)}catch(f){console.error("Share failed:",f),B.error("Failed to share")}};if(b)return e.jsxs(x.div,{initial:{opacity:0}
1,animate:{opacity:1},className:"min-h-screen bg-gradient-to-br from-gray-50 to-white dark:from-black dark:to-gray-900 flex items-center justify-center relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 pointer-events-none",children:Array.from({length:25}).map((f,D)=>e.jsx(x.div,{animate:{x:[Math.random()*100+"%",Math.random()*100+"%"],y:[Math.random()*100+"%",Math.random()*100+"%"],opacity:[0,.4,0],scale:[.3,1,.3]},transition:{duration:5+Math.random()*3,repeat:1/0,ease:"easeInOut",delay:Math.random()*2},className:"absolute w-1 h-1 bg-gradient-to-r from-blue-400 to-purple-400 rounded-full blur-sm",style:{left:Math.random()*100+"%",top:Math.random()*100+"%"}},D))}),e.jsxs(x.div,{initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.6,type:"spring",stiffness:100},className:"text-center relative z-10",children:[e.jsx(x.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},className:"w-8 h-8 border-2 border-gray-300 border-t-blue-500 rounded-full mx-auto mb-6"}),e.jsx(x.p,{initial:{opacity:0}
1,animate:{opacity:1},transition:{duration:.2},className:"text-sm text-gray-600 dark:text-gray-300 font-medium mb-3",children:n},n),e.jsx("div",{className:"w-64 mx-auto",children:e.jsx(x.div,{className:"h-4 bg-black dark:bg-gray-900 rounded-full overflow-hidden shadow-lg",initial:{width:0},animate:{width:"100%"},transition:{delay:.2,duration:.4},children:e.jsxs(x.div,{className:"h-full bg-gradient-to-r from-blue-500 to-blue-600 rounded-full relative overflow-hidden",initial:{width:"0%"},animate:{width:`${d}%`},transition:{duration:.8,ease:"easeOut"},children:[e.jsx(x.div,{animate:{x:["-100%","200%"]},transition:{duration:2,repeat:1/0,ease:"easeInOut",delay:.5},className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/30 to-transparent"}),e.jsx(x.div,{animate:{opacity:[.3,.6,.3],scale:[1,1.02,1]},transition:{duration:1.5,repeat:1/0,ease:"easeInOut"},className:"absolute inset-0 bg-blue-400 rounded-full blur-sm"})]})})})]})]});if(o||!l)return e.jsx(x.div,{initial:{opacity:0},animate:{opacity:1},className:"min-h-screen bg-gray-50 dark:bg-black flex items-center justify-center",children:e.jsxs(x.div,{initial:{scale:.8,opacity:0}
1,animate:{scale:1,opacity:1},transition:{duration:.5},className:"text-center",children:[e.jsx(x.p,{initial:{y:20,opacity:0},animate:{y:0,opacity:1},transition:{delay:.1},className:"text-red-500 dark:text-red-400 mb-4",children:o||"File not found"}),e.jsx(x.div,{initial:{y:20,opacity:0},animate:{y:0,opacity:1},transition:{delay:.2},children:e.jsxs(L,{onClick:()=>r(-1),children:[e.jsx(H,{className:"w-4 h-4 mr-2"}),"Go Back"]})})]})});const S=ye(l.jsonData);return S?e.jsxs(x.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.3},className:"min-h-screen bg-white dark:bg-black transition-colors duration-300 flex flex-col",children:[e.jsx(x.div,{initial:{y:-20,opacity:0},animate:{y:0,opacity:1},transition:{duration:.5,delay:.1},className:"bg-white dark:bg-black border-b border-gray-200 dark:border-gray-800 transition-colors duration-200",children:e.jsx("div",{className:"container mx-auto px-4 sm:px-6 py-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[e.jsxs(x.div,{initial:{x:-20,opacity:0},animate:{x:0,opacity:1},transition:{duration:.5,delay:.2},className:"flex items-center gap-4 w-full sm:w-auto",children:[e.jsx(x.div,{whileHover:{scale:1.05},whileTap:{scale:.95},children:e.jsxs(L,{variant:"ghost",size:"sm",onClick:()=>r(-1),className:"hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white",children:[e.jsx(H,{className:"w-4 h-4 mr-2"}),"Back"]})}),e.jsxs(x.div,{initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.5,delay:.3},className:"flex items-center gap-3",children:[e.jsx(x.div,{animate:{rotate:[0,10,-10,0]},transition:{duration:2,repeat:1/0,repeatDelay:3},children:e.jsx(R,{className:"w-6 h-6 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{children:[e.jsx(x.h1,{initial:{y:10,opacity:0},animate:{y:0,opacity:1},transition:{duration:.5,delay:.4},className:"text-xl font-semibold text-gray-900 dark:text-white",children:l.displayName}),e.jsxs(x.div,{initial:{y:10,opacity:0},animate:{y:0,opacity:1},transition:{duration:.5,delay:.5},className:"flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300",children:[e.jsx(V,{variant:"outline",className:"border-gray-700 dark:border-gray-600 text-gray-900 dark:text-gray-300 bg-white/80 dark:bg-gray-800/50",children:"ð Keyword Analysis"}),e.jsx("span",{children:"â¢"}),e.jsx("span",{children:new Date(S.timestamp).toLocaleDateString()})]})]})]})]}),e.jsxs(x.div,{initial:{x:20,opacity:0},animate:{x:0,opacity:1},transition:{duration:.5,delay:.3},className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(x.div,{whileHover:{scale:1.05},whileTap:{scale:.95},children:e.jsxs(L,{variant:"outline",size:"sm",onClick:_,className:"border-gray-600 dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white",children:[h?e.jsx(xe,{className:"w-4 h-4 mr-2 text-green-600"}):e.jsx(me,{className:"w-4 h-4 mr-2"}),h?"Copied!":"Share"]})}),e.jsx(x.div,{whileHover:{scale:1.05},whileTap:{scale:.95},children:e.jsxs(L,{variant:"outline",size:"sm",onClick:w,className:"border-gray-300 dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700",children:[e.jsx(ge,{className:"w-4 h-4 mr-2"}),"Download"]})})]})]})})}),e.jsxs(x.div,{initial:{opacity:0}
1,animate:{opacity:1},transition:{duration:.5,delay:.2},className:"container mx-auto px-4 sm:px-6 py-8 pb-16 flex-grow",children:[e.jsx(x.div,{initial:{y:20,opacity:0},animate:{y:0,opacity:1},transition:{duration:.6,delay:.3},className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-6",children:[{icon:he,label:"Total Keywords",value:j(S.totalKeywords),color:"text-blue-600 dark:text-blue-400",delay:.4},{icon:M,label:"Total Volume",value:j(S.totalVolume),color:"text-green-600 dark:text-green-400",delay:.5},{icon:F,label:"Avg CPC",value:N(S.avgCpc,S.currency),color:"text-yellow-600 dark:text-yellow-400",delay:.6},{icon:$,label:"Opportunities",value:S.opportunitiesCount,color:"text-orange-600 dark:text-orange-400",delay:.7}].map((f,D)=>e.jsx(x.div,{initial:{scale:.8,opacity:0,y:20},animate:{scale:1,opacity:1,y:0},transition:{duration:.5,delay:f.delay,type:"spring",stiffness:100},whileHover:{scale:1.02,transition:{duration:.2}},whileTap:{scale:.98},children:e.jsx(u,{className:"bg-white dark:bg-gray-900 border-gray-200 dark:border-gray-700 transition-colors duration-200 shadow-sm hover:shadow-md",children:e.jsx(y,{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(x.div,{animate:{rotate:[0,5,-5,0]},transition:{duration:2,repeat:1/0,repeatDelay:5},children:e.jsx(f.icon,{className:`w-5 h-5 ${f.color}`})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-400",children:f.label}),e.jsx(x.p,{initial:{scale:.9},animate:{scale:1},transition:{duration:.3,delay:f.delay+.2},className:"text-xl font-bold text-gray-900 dark:text-white",children:f.value})]})]})})})},D))}),e.jsx(x.div,{initial:{y:20,opacity:0},animate:{y:0,opacity:1},transition:{duration:.6,delay:.8},children:e.jsx(ft,{defaultValue:"overview",tabs:[{id:"overview",label:"Overview",icon:e.jsx(R,{className:"w-4 h-4"}),content:e.jsxs(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.5},className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsx(x.div,{initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.5,delay:.1},whileHover:{scale:1.02},className:"min-h-[320px] sm:min-h-[384px]",children:e.jsx(it,{jsonData:l.jsonData})}),e.jsx(x.div,{initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.5,delay:.2},whileHover:{scale:1.02},className:"min-h-[320px] sm:min-h-[384px]",children:e.jsx(ct,{jsonData:l.jsonData})}),e.jsx(x.div,{initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.5,delay:.3},whileHover:{scale:1.02},className:"min-h-[320px] sm:min-h-[384px]",children:e.jsx(xt,{jsonData:l.jsonData})}),e.jsx(x.div,{initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.5,delay:.4},whileHover:{scale:1.02},className:"min-h-[320px] sm:min-h-[384px]",children:e.jsx(mt,{jsonData:l.jsonData})})]})},{id:"clusters",label:"Clusters",icon:e.jsx(et,{className:"w-4 h-4"}),content:e.jsx(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.5},className:"h-80 sm:h-96",children:e.jsx(gt,{jsonData:l.jsonData})})},{id:"budget",label:"Budget",icon:e.jsx(tt,{className:"w-4 h-4"}),content:e.jsx(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.5},className:"h-80 sm:h-96",children:e.jsx(yt,{jsonData:l.jsonData})})},{id:"revenue",label:"Revenue",icon:e.jsx(rt,{className:"w-4 h-4"}),content:e.jsx(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.5},className:"h-80 sm:h-96",children:e.jsx(bt,{jsonData:l.jsonData})})},...S.hasOpportunities?[{id:"opportunities",label:"Opportunities",icon:e.jsx(J,{className:"w-4 h-4"}),content:e.jsx(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.5},className:"space-y-4 mt-6",children:e.jsx(jt,{jsonData:l.jsonData})})}]:[],{id:"data",label:"Raw Data",icon:e.jsx(pe,{className:"w-4 h-4"}),content:e.jsx(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.5}
1,className:"space-y-4 mt-6",children:e.jsxs(u,{className:"bg-white dark:bg-gray-900 border-gray-200 dark:border-gray-700",children:[e.jsx(T,{children:e.jsx(P,{className:"text-gray-900 dark:text-white",children:"Complete Analysis Data"})}),e.jsx(y,{children:e.jsx("pre",{className:"text-xs bg-gray-100 dark:bg-gray-800 rounded p-4 overflow-auto max-h-96 text-gray-800 dark:text-gray-200 border border-gray-200 dark:border-gray-700",children:JSON.stringify(l.jsonData,null,2)})})]})})}]})})]})]}):e.jsx(x.div,{initial:{opacity:0},animate:{opacity:1},className:"min-h-screen bg-gray-50 dark:bg-black flex items-center justify-center",children:e.jsxs(x.div,{initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.5},className:"text-center",children:[e.jsx(x.p,{initial:{y:20,opacity:0},animate:{y:0,opacity:1},transition:{delay:.1},className:"text-gray-500 dark:text-gray-400 mb-4",children:"This file is not a valid keyword analysis export."}),e.jsx(x.div,{initial:{y:20,opacity:0},animate:{y:0,opacity:1},transition:{delay:.2},children:e.jsxs(L,{onClick:()=>r(-1),children:[e.jsx(H,{className:"w-4 h-4 mr-2"}),"Go Back"]})})]})})},jt=({jsonData:m})=>
1{const r=m.opportunities_analysis;return e.jsxs(u,{className:"bg-white dark:bg-gray-900 border-gray-200 dark:border-gray-700 shadow-sm",children:[e.jsx(T,{className:"border-b border-gray-100 dark:border-gray-700",children:e.jsxs(P,{className:"text-gray-900 dark:text-white flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-gradient-to-r from-orange-500 to-red-500 dark:from-orange-600 dark:to-red-600 rounded-lg",children:e.jsx(J,{className:"w-5 h-5 text-white"})}),"Keyword Opportunity Matrix"]})}),e.jsxs(y,{className:"pt-6",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-6",children:[e.jsxs("div",{className:"text-center p-4 bg-orange-50 dark:bg-orange-900/50 rounded-xl border border-orange-200 dark:border-orange-800",children:[e.jsx("p",{className:"text-2xl font-bold text-orange-700 dark:text-orange-400",children:r?.total_opportunities||0}),e.jsx("p",{className:"text-sm text-orange-600 dark:text-orange-300 font-medium",children:"Total Opportunities"})]}),e.jsxs("div",{className:"text-center p-4 bg-blue-50 dark:bg-blue-900/50 rounded-xl border border-blue-200 dark:border-blue-800",children:[e.jsx("p",{className:"text-2xl font-bold text-blue-700 dark:text-blue-300",children:j(r?.potential_volume||0)}),e.jsx("p",{className:"text-sm text-blue-600 dark:text-blue-300 font-medium",children:"Potential Volume"})]}),e.jsxs("div",{className:"text-center p-4 bg-green-50 dark:bg-green-900/50 rounded-xl border border-green-200 dark:border-green-800",children:[e.jsx("p",{className:"text-2xl font-bold text-green-700 dark:text-green-300",children:N(r?.avg_available_cpc||0)}),e.jsx("p",{className:"text-sm text-green-600 dark:text-green-300 font-medium",children:"Avg Available CPC"})]})]}),r?.opportunity_keywords&&r.opportunity_keywords.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h4",{className:"font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx("span",{children:"Volume vs. Cost analysis"}),e.jsxs("span",{className:"text-sm font-normal text-gray-600 dark:text-gray-400",children:["⢠",r.opportunity_keywords.length," opportunities"]})]}),r.opportunity_keywords.slice(0,10).map((c,l)=>e.jsxs("div",{className:"flex justify-between items-center p-4 bg-gradient-to-r from-orange-50 to-red-50 dark:from-orange-900/20 dark:to-red-900/20 rounded-lg border border-orange-200 dark:border-orange-800 hover:shadow-md transition-shadow",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium text-gray-900 dark:text-white text-base",children:c.keyword||c.Keyword}),e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"High opportunity keyword"})]}),e.jsxs("div",{className:"flex gap-6 text-sm",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"font-bold text-blue-700 dark:text-blue-300",children:j(c.volume||c["Avg. monthly searches"]||0)}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Volume"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"font-bold text-green-700 dark:text-green-300",children:N(c.cpc||c["Top of page bid (low range)"]||0)}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:"CPC"})]})]})]},l))]}),(!r?.opportunity_keywords||r.opportunity_keywords.length===0)&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-700 rounded-full flex items-center justify-center border border-gray-200 dark:border-gray-600",children:e.jsx(J,{className:"w-8 h-8 text-gray-400 dark:text-gray-500"})}),e.jsx("p",{className:"text-lg font-medium text-gray-700 dark:text-gray-300",children:"No opportunities found"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Run analysis to discover keyword opportunities"})]})]})]})};export{Et 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.