1import{f as ne,t as ce,u as de,r as y,j as e,C as d,h as o,B as N,S as oe,o as g,q as j,w as k,k as q,ad as D,l as me,T as xe}from"./index-C_G8bwJw.js";import{A as he}from"./admin-layout-CPk39p-8.js";import{B as x}from"./badge-BOUyWCSY.js";import{T as pe,a as ge,b as T,c as A}from"./tabs-DWo9WcPz.js";import{S as je,a as ue,b as Ne,c as fe,d as be}from"./select-BVUoEiHn.js";import{S as ye,E as we,C as ve}from"./tooltip-CfW2tvfo.js";import{u as L}from"./useMutation-CmgK9wS4.js";import{a as Q}from"./trending-up-BMD8m9wy.js";import{G as V}from"./globe-BPgwaSEb.js";import{L as O}from"./loader-circle-DfySyHJP.js";import{F as X}from"./refresh-cw-BWzN_9Fe.js";import{S as Se}from"./shield-BtU0SLd4.js";import{Z as W}from"./zap-Bm6p22Oq.js";import{C as Z}from"./chart-column-CMgczRI5.js";import{S as z}from"./sparkles-CvAv-Ztz.js";import{S as H}from"./save-dHQJXsTI.js";import{L as J}from"./link-2-Kvj20mYu.js";import{I as Y}from"./users-BefVpGxL.js";import{C as P}from"./copy-RwTUjktP.js";import{L as se}from"./lightbulb-BVi9m4gk.js";import{C as w}from"./circle-check-BZU22hbq.js";import{C as Ce}from"./chevron-right-B7qaoIRQ.js";import"./dropdown-menu-DDuXlFUR.js";import"./index-DNWIFX0r.js";import"./index-BoyN0j6l.js";import"./index-CcHRnXRk.js";import"./check-Lu_KwLlP.js";import"./circle-TpIA1aJ-.js";import"./share-2-CS4QwLcI.js";import"./map-pin-rsipgJKs.js";import"./scan-search-BomGlj5C.js";import"./upload-DcaInO92.js";import"./calendar-sqMmW7_o.js";import"./circle-check-big-BfASsl-Q.js";import"./index-6xd5wRHC.js";import"./chevron-up-DNicAiku.js";const ke=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],F=ne("code-xml",ke),n="#1a3a5c",Te=Object.keys(D);function ee({score:a,size:i="lg"}){const c=a>=80?"#22c55e":a>=50?"#f59e0b":"#ef4444",h=a>=80?"Good":a>=50?"Needs Work":"Poor",u=i==="sm"?"w-20 h-20":"w-36 h-36",p=i==="sm"?30:55,m=i==="sm"?6:10,R=i==="sm"?"0 0 80 80":"0 0 130 130",r=i==="sm"?40:65,v=2*Math.PI*p,f=v-a/100*v;return e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:`relative ${u} mx-auto`,children:[e.jsxs("svg",{className:`${u} transform -rotate-90`,viewBox:R,children:[e.jsx("circle",{cx:r,cy:r,r:p,stroke:"#e5e7eb",strokeWidth:m,fill:"none"}),e.jsx("circle",{cx:r,cy:r,r:p,stroke:c,strokeWidth:m,fill:"none",strokeDasharray:v,strokeDashoffset:f,strokeLinecap:"round",className:"transition-all duration-1000 ease-out"})]}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[e.jsx("span",{className:`font-bold ${i==="sm"?"text-lg":"text-4xl"}`,style:{color:c},children:a}),i==="lg"&&e.jsx("span",{className:"text-sm text-muted-foreground mt-1",children:h})]})]}),i==="sm"&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:h})]})}function I({label:a,score:i,icon:c}){const h=i>=80?"text-green-600":i>=50?"text-yellow-600":"text-red-600",u=i>=80?"bg-green-50 border-green-200":i>=50?"bg-yellow-50 border-yellow-200":"bg-red-50 border-red-200";return e.jsx(d,{className:`border ${u}`,"data-testid":`card-dimension-${a.toLowerCase().replace(/\s+/g,"-")}`,children:e.jsxs(o,{className:"p-4 flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-white rounded-lg shadow-sm",children:e.jsx(c,{className:`h-5 w-5 ${h}`})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-slate-700",children:a}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx("div",{className:"flex-1 h-2 bg-white rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full transition-all duration-700",style:{width:`${i}%`,backgroundColor:i>=80?"#22c55e":i>=50?"#f59e0b":"#ef4444"}})}),e.jsx("span",{className:`text-sm font-bold ${h}`,children:i})]})]})]})})}function Ae({status:a}){return a==="good"?e.jsx(w,{className:"h-5 w-5 text-green-600"}):a==="warning"?e.jsx(xe,{className:"h-5 w-5 text-yellow-600"}):e.jsx(ve,{className:"h-5 w-5 text-red-600"})}function Oe({section:a}){const[i,c]=y.useState(!1),h=a.status==="good"?"border-green-200":a.status==="warning"?"border-yellow-200":"border-red-200";return e.jsxs(d,{className:`border ${h} mb-3`,"data-testid":`card-section-${a.section.toLowerCase().replace(/\s+/g,"-")}`,children:[e.jsx("div",{className:"p-4 cursor-pointer hover:bg-slate-50 transition-colors",onClick:()=>c(!i),children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ae,{status:a.status}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-sm text-slate-900",children:a.section}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a.findings[0]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(x,{variant:"outline",className:a.score>=80?"bg-green-100 text-green-700 border-green-200":a.score>=50?"bg-yellow-100 text-yellow-700 border-yellow-200":"bg-red-100 text-red-700 border-red-200",children:[a.score,"/100"]}),i?e.jsx(me,{className:"h-4 w-4 text-slate-400"}):e.jsx(Ce,{className:"h-4 w-4 text-slate-400"})]})]})}),i&&e.jsxs("div",{className:"px-4 pb-4 border-t bg-slate-50",children:[a.findings.length>1&&e.jsxs("div",{className:"mt-3",children:[e.jsx("h5",{className:"text-xs font-semibold text-slate-500 uppercase mb-2",children:"Findings"}),e.jsx("ul",{className:"space-y-1",children:a.findings.map((u,p)=>e.jsxs("li",{className:"text-sm text-slate-700 flex items-start gap-2",children:[e.jsx("span",{className:"text-slate-400 mt-0.5",children:"â¢"})," ",u]},p))})]}),a.recommendations.length>0&&e.jsxs("div",{className:"mt-3",children:[e.jsx("h5",{className:"text-xs font-semibold text-slate-500 uppercase mb-2",children:"Recommendations"}),e.jsx("ul",{className:"space-y-1",children:a.recommendations.map((u,p)=>e.jsxs("li",{className:"text-sm text-slate-700 flex items-start gap-2",children:[e.jsx(se,{className:"h-3.5 w-3.5 text-yellow-500 mt-0.5 shrink-0"})," ",u]},p))})]})]})]})}function K({label:a,current:i,recommended:c}){const h=i!==c;return e.jsxs("div",{className:"mb-4","data-testid":`diff-${a.toLowerCase().replace(/\s+/g,"-")}`,children:[e.jsx("h4",{className:"text-sm font-semibold text-slate-700 mb-2",children:a}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg",children:[e.jsx("p",{className:"text-xs font-medium text-red-600 mb-1",children:"Current"}),e.jsx("p",{className:"text-sm text-slate-700",children:i||e.jsx("span",{className:"italic text-slate-400",children:"Not set"})})]}),e.jsxs("div",{className:`p-3 ${h?"bg-green-50 border-green-200":"bg-slate-50 border-slate-200"} border rounded-lg`,children:[e.jsx("p",{className:`text-xs font-medium ${h?"text-green-600":"text-slate-500"} mb-1`,children:h?"Recommended":"No Change"}),e.jsx("p",{className:"text-sm text-slate-700",children:c})]})]})]})}function hs(){const{toast:a}=ce(),i=de(),[c,h]=y.useState(""),[u,p]=y.useState("scorecard"),[m,R]=y.useState(null),[r,v]=y.useState(null),[f,B]=y.useState(null),[l,te]=y.useState(null),U=L({mutationFn:async s=>{const t=await fetch("/api/page-optimizer/crawl",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pagePath:s})});let b=null;t.ok&&(b=await t.json());const C=D[s],_=await fetch("/api/page-optimizer/analyze",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pagePath:s,currentTitle:b?.title||C?.title||"",currentDescription:b?.metaDescription||C?.description||"",currentKeywords:b?.metaKeywords||C?.keywords||"",crawlData:b||void 0})});if(!_.ok)throw new Error("Failed to analyze page");return{analysisData:await _.json(),liveCrawl:b}}
1,onSuccess:({analysisData:s,liveCrawl:t})=>{R(s),te(t),p("scorecard"),a({title:"Analysis Complete",description:`SEO score: ${s.scores.overall}/100 â ${t?"Live page data crawled":"Using stored data"}`})},onError:()=>{a({title:"Error",description:"Failed to analyze page",variant:"destructive"})}}),$=L({mutationFn:async s=>{const t=await fetch("/api/page-optimizer/ai-recommendations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pagePath:s,currentTitle:l?.title||D[s]?.title||"",currentDescription:l?.metaDescription||D[s]?.description||"",currentKeywords:l?.metaKeywords||D[s]?.keywords||""})});if(!t.ok)throw new Error("Failed to generate AI recommendations");return t.json()},onSuccess:s=>{v(s),a({title:"AI Recommendations Ready",description:"Review and apply optimized SEO settings"})},onError:()=>{a({title:"Error",description:"Failed to generate recommendations",variant:"destructive"})}}),M=L({mutationFn:async s=>{const t=await fetch("/api/page-optimizer/schema-preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pagePath:s})});if(!t.ok)throw new Error("Failed to generate schema");return t.json()},onSuccess:s=>{B(s)},onError:()=>{a({title:"Error",description:"Failed to generate schema markup",variant:"destructive"})}}),G=L({mutationFn:async s=>{const t=await fetch("/api/page-optimizer/apply",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!t.ok)throw new Error("Failed to apply recommendations");return t.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["page-seo"]}),a({title:"Applied Successfully",description:"SEO settings have been updated"})},onError:()=>{a({title:"Error",description:"Failed to apply SEO settings",variant:"destructive"})}}),ae=()=>{if(!c){a({title:"Error",description:"Please select a page to analyze",variant:"destructive"});return}v(null),B(null),U.mutate(c)},le=()=>{c&&$.mutate(c)},re=()=>{c&&M.mutate(c)},ie=()=>{!c||!r||G.mutate({pagePath:c,ogTitle:r.optimizedTitle,ogDescription:r.optimizedDescription,structuredData:f?.jsonLd})},E=(s,t)=>{navigator.clipboard.writeText(s),a({title:"Copied",description:`${t} copied to clipboard`})},S=U.isPending;return e.jsx(he,{children:e.jsxs("div",{className:"space-y-6","data-testid":"page-optimizer-page",children:[e.jsx("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center gap-4 border-b pb-6",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold tracking-tight flex items-center gap-2",style:{color:n},"data-testid":"text-page-title",children:[e.jsx(Q,{className:"h-6 w-6"}),"Page Optimizer"]}),e.jsx("p",{className:"text-slate-500 mt-1",children:"AI-powered SEO analysis and optimization for ConnectionsPlus Healthcare + Hospice"})]})}),e.jsx(d,{children:e.jsx(o,{className:"pt-6",children:e.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[e.jsx("div",{className:"flex-1",children:e.jsxs(je,{value:c,onValueChange:h,children:[e.jsx(ue,{className:"h-12","data-testid":"select-page",children:e.jsx(Ne,{placeholder:"Select a page to optimize..."})}),e.jsx(fe,{children:e.jsx(ye,{className:"h-80",children:Te.map(s=>e.jsx(be,{value:s,"data-testid":`option-page-${s}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(V,{className:"h-3.5 w-3.5 text-slate-400"}),e.jsx("span",{children:s})]})},s))})})]})}),e.jsx(N,{onClick:ae,disabled:S||!c,className:"h-12 px-6",style:{backgroundColor:n},"data-testid":"button-analyze",children:S?e.jsxs(e.Fragment,{children:[e.jsx(O,{className:"h-4 w-4 animate-spin mr-2"})," Analyzing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"h-4 w-4 mr-2"})," Analyze Page"]})})]})})}),S&&e.jsx(d,{children:e.jsx(o,{className:"p-12",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-4",children:[e.jsx(O,{className:"h-12 w-12 animate-spin",style:{color:n}}),e.jsx("p",{className:"text-lg font-medium",children:"Analyzing page SEO..."}),e.jsx("p",{className:"text-muted-foreground",children:"Evaluating content, technical SEO, UX, and authority signals"})]})})}),m&&!S&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-5 ga
1p-6",children:[e.jsxs(d,{className:"md:col-span-1",children:[e.jsx(g,{className:"pb-2",children:e.jsx(j,{className:"text-center text-sm font-medium text-slate-500",children:"Overall Score"})}),e.jsx(o,{children:e.jsx(ee,{score:m.scores.overall})})]}),e.jsxs("div",{className:"md:col-span-4 grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsx(I,{label:"Content",score:m.scores.content,icon:X}),e.jsx(I,{label:"Technical SEO",score:m.scores.technical,icon:Se}),e.jsx(I,{label:"UX & Conversion",score:m.scores.uxConversion,icon:W}),e.jsx(I,{label:"Authority",score:m.scores.authority,icon:Z})]})]}),e.jsxs(pe,{value:u,onValueChange:p,children:[e.jsxs(ge,{className:"grid grid-cols-5 w-full",children:[e.jsxs(T,{value:"scorecard","data-testid":"tab-scorecard",children:[e.jsx(Z,{className:"h-4 w-4 mr-1.5"})," Scorecard"]}),e.jsxs(T,{value:"ai-recs","data-testid":"tab-ai-recs",children:[e.jsx(z,{className:"h-4 w-4 mr-1.5"})," AI Recommendations"]}),e.jsxs(T,{value:"apply","data-testid":"tab-apply",children:[e.jsx(H,{className:"h-4 w-4 mr-1.5"})," Apply Changes"]}),e.jsxs(T,{value:"schema","data-testid":"tab-schema",children:[e.jsx(F,{className:"h-4 w-4 mr-1.5"})," Schema Markup"]}),e.jsxs(T,{value:"links","data-testid":"tab-links",children:[e.jsx(J,{className:"h-4 w-4 mr-1.5"})," Internal Links"]})]}),e.jsxs(A,{value:"scorecard",className:"space-y-4 mt-4",children:[l&&e.jsxs(d,{className:"border-blue-200 bg-blue-50/30",children:[e.jsxs(g,{className:"pb-3",children:[e.jsxs(j,{className:"text-lg flex items-center gap-2",style:{color:n},children:[e.jsx(V,{className:"h-5 w-5"})," Live Page Data"]}),e.jsxs(k,{children:["Real-time data crawled from ",e.jsx("strong",{children:l.url})," at ",new Date(l.crawledAt).toLocaleTimeString(),l.wordCount>0&&e.jsxs("span",{className:"ml-2",children:["â ",l.wordCount," words"]})]})]}),e.jsxs(o,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"p-3 bg-white border rounded-lg","data-testid":"crawl-title",children:[e.jsx("p",{className:"text-xs font-semibold text-slate-500 uppercase mb-1",children:"Title Tag"}),e.jsx("p",{className:"text-sm text-slate-800",children:l.title||e.jsx("span",{className:"italic text-slate-400",children:"Not found"})}),l.title&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[l.title.length," characters ",l.title.length>60?"(too long)":l.title.length<30?"(too short)":"(good length)"]})]}),e.jsxs("div",{className:"p-3 bg-white border rounded-lg","data-testid":"crawl-meta-description",children:[e.jsx("p",{className:"text-xs font-semibold text-slate-500 uppercase mb-1",children:"Meta Description"}),e.jsx("p",{className:"text-sm text-slate-800",children:l.metaDescription||e.jsx("span",{className:"italic text-slate-400",children:"Not found"})}),l.metaDescription&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[l.metaDescription.length," characters ",l.metaDescription.length>160?"(too long)":l.metaDescription.length<70?"(too short)":"(good length)"]})]})]}),l.headings.length>0&&e.jsxs("div",{className:"p-3 bg-white border rounded-lg","data-testid":"crawl-headings",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("p",{className:"text-xs font-semibold text-slate-500 uppercase",children:"Heading Structure"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(x,{variant:"outline",className:"text-xs",children:["H1: ",l.headingStats.h1Count]}),e.jsxs(x,{variant:"outline",className:"text-xs",children:["H2: ",l.headingStats.h2Count]}),e.jsxs(x,{variant:"outline",className:"text-xs",children:["H3: ",l.headingStats.h3Count]})]})]}),e.jsx("div",{className:"space-y-1 max-h-48 overflow-y-auto",children:l.headings.map((s,t)=>e.jsxs("div",{className:"flex items-center gap-2",style:{paddingLeft:`${(parseInt(s.tag.replace("H",""))-1)*12}px`},children:[e.jsx(x,{variant:"outline",className:`text-xs font-mono shrink-0 ${s.tag==="H1"?"bg-blue-100 text-blue-700 border-blue-300":""}`,children:s.tag}),e.jsx("span",{className:"text-sm text-slate-700 truncate",children:s.text})]},t))})]}),l.images.length>0&&e.jsxs("div",{className:"p-3 bg-white border rounded-lg","data-testid":"crawl-images",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("p",{className:"text-xs font-semibold text-slate-500 uppercase",children:"Image Alt Tags"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(x,{variant:"outline",className:"text-xs bg-green-50 text-green-700",children:[l.imageStats.withAlt," with alt"]}),l.imageStats.withoutAlt>0&&e.jsxs(x,{variant:"outline",className:"text-xs bg-red-50 text-red-700",children:[l.imageStats.withoutAlt," missing alt"]})]})]}),e.jsx("div",{className:"space-y-1.5 max-h-48 overflow-y-auto",children:l.images.slice(0,15).map((s,t)=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Y,{className:`h-3.5 w-3.5 shrink-0 ${s.hasAlt?"text-green-500":"text-red-500"}`}),e.jsx("span",{className:"text-slate-500 truncate max-w-[200px]",children:s.src.split("/").pop()||s.src}),s.hasAlt?e.jsxs("span",{className:"text-slate-700 truncate",children:["â ",s.alt]}
1):e.jsx("span",{className:"text-red-500 italic",children:"No alt text"})]},t))})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsxs("div",{className:"p-2 bg-white border rounded-lg text-center",children:[e.jsx("p",{className:"text-xs text-slate-500",children:"Canonical"}),e.jsx("p",{className:"text-sm font-medium",children:l.canonicalUrl?"Set":"Not Set"})]}),e.jsxs("div",{className:"p-2 bg-white border rounded-lg text-center",children:[e.jsx("p",{className:"text-xs text-slate-500",children:"Robots"}),e.jsx("p",{className:"text-sm font-medium",children:l.robotsMeta||"Not Set"})]}),e.jsxs("div",{className:"p-2 bg-white border rounded-lg text-center",children:[e.jsx("p",{className:"text-xs text-slate-500",children:"Schema Markup"}),e.jsx("p",{className:"text-sm font-medium",children:l.schemaMarkup.length>0?`${l.schemaMarkup.length} found`:"None"})]}),e.jsxs("div",{className:"p-2 bg-white border rounded-lg text-center",children:[e.jsx("p",{className:"text-xs text-slate-500",children:"OG Title"}),e.jsx("p",{className:"text-sm font-medium",children:l.ogTitle?"Set":"Not Set"})]})]})]})]}),e.jsxs(d,{children:[e.jsxs(g,{children:[e.jsx(j,{className:"text-lg",style:{color:n},children:"Detailed SEO Scorecard"}),e.jsxs(k,{children:["Analysis across all SEO framework sections for ",e.jsx("strong",{children:m.pagePath})]})]}),e.jsx(o,{children:m.sections.map((s,t)=>e.jsx(Oe,{section:s},t))})]})]}),e.jsx(A,{value:"ai-recs",className:"space-y-4 mt-4",children:r?e.jsxs("div",{className:"space-y-4",children:[e.jsxs(d,{children:[e.jsx(g,{children:e.jsxs(j,{className:"text-lg flex items-center gap-2",style:{color:n},children:[e.jsx(Q,{className:"h-5 w-5"})," Keyword Strategy"]})}),e.jsxs(o,{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-slate-500 uppercase mb-1",children:"Primary Keyword"}),e.jsx(x,{className:"text-sm",style:{backgroundColor:n},children:r.keywordStrategy.primary})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-slate-500 uppercase mb-1",children:"Secondary Keywords"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:r.keywordStrategy.secondary.map((s,t)=>e.jsx(x,{variant:"outline",children:s},t))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-slate-500 uppercase mb-1",children:"Long-Tail Keywords"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:r.keywordStrategy.longTail.map((s,t)=>e.jsx(x,{variant:"secondary",className:"text-xs",children:s},t))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-slate-500 uppercase mb-1",children:"LSI Keywords"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:r.keywordStrategy.lsi.map((s,t)=>e.jsx(x,{variant:"secondary",className:"text-xs bg-blue-50 text-blue-700",children:s},t))})]})]})]}),e.jsxs(d,{children:[e.jsx(g,{children:e.jsxs(j,{className:"text-lg flex items-center gap-2",style:{color:n},children:[e.jsx(X,{className:"h-5 w-5"})," Optimized Meta Tags"]})}),e.jsxs(o,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("p",{className:"text-xs font-semibold text-slate-500 uppercase",children:"Title Tag"}),e.jsxs(N,{variant:"ghost",size:"sm",onClick:()=>E(r.optimizedTitle,"Title"),"data-testid":"button-copy-title",children:[e.jsx(P,{className:"h-3.5 w-3.5 mr-1"})," Copy"]})]}),e.jsx("p",{className:"text-sm p-3 bg-green-50 border border-green-200 rounded-lg",children:r.optimizedTitle}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[r.optimizedTitle.length," characters"]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("p",{className:"text-xs font-semibold text-slate-500 uppercase",children:"Meta Description"}),e.jsxs(N,{variant:"ghost",size:"sm",onClick:()=>E(r.optimizedDescription,"Description"),"data-testid":"button-copy-description",children:[e.jsx(P,{className:"h-3.5 w-3.5 mr-1"})," Copy"]})]}),e.jsx("p",{className:"text-sm p-3 bg-green-50 border border-green-200 rounded-lg",children:r.optimizedDescription}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[r.optimizedDescription.length," characters"]})]})]})]}),e.jsxs(d,{children:[e.jsx(g,{children:e.jsxs(j,{className:"text-lg flex items-center gap-2",style:{color:n},children:[e.jsx(se,{className:"h-5 w-5"})," Content Structure"]})}),e.jsxs(o,{children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-xs font-semibold text-slate-500 uppercase mb-2",children:"Recommended Header Hierarchy"}),e.jsx("div",{className:"space-y-1 bg-slate-50 p-4 rounded-lg",children:r.headerStructure.map((s,t)=>e.jsxs("div",{className:"flex items-center gap-2",style:{paddingLeft:`${(parseInt(s.tag.replace("H",""))-1)*16}px`},children:[e.jsx(x,{variant:"outline",className:"text-xs font-mono",children:s.tag}),e.jsx("span",{className:"text-sm",children:s.text})]},t))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-slate-500 uppercase mb-2",children:"Content Outline (Problem â Solution â Outcome)"}),e.jsx("div",{className:"space-y-3",children:r.contentOutline.map((s,t)=>e.jsxs("div",{className:"border rounded-lg p-3",children:[e.jsx("h5",{className:"font-semibold text-sm text-slate-800 mb-1",children:s.heading}),e.jsx("ul",{className:"space-y-1",children:s.points.map((b,C)=>e.jsxs("li",{className:"text-xs text-slate-600 flex items-start gap-1.5",children:[e.jsx(q,{className:"h-3 w-3 mt-0.5 text-slate-400 shrink-0"})," ",b]},C))})]},t))})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs(d,{children:[e.jsx(g,{children:e.jsxs(j,{className:"text-lg flex items-center gap-2",style:{color:n},children:[e.jsx(W,{className:"h-5 w-5"})," CTA Suggestions"]})}),e.jsx(o,{children:e.jsx("div",{className:"space-y-2",children:r.ctaSuggestions.map((s,t)=>e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-slate-50 rounded-lg",children:[e.jsx(x,{className:"shrink-0",style:{backgroundColor:n},children:t+1}),e.jsx("span",{className:"text-sm",children:s}),e.jsx(N,{variant:"ghost",size:"sm",className:"ml-auto",onClick:()=>E(s,"CTA"),children:e.jsx(P,{className:"h-3.5 w-3.5"})})]},t))})})]}),e.jsxs(d,{children:[e.jsx(g,{children:e.jsxs(j,{className:"text-lg flex items-center gap-2",style:{color:n},children:[e.jsx(Y,{className:"h-5 w-5"})," Image SEO Tips"]})}),e.jsx(o,{children:e.jsx("ul",{className:"space-y-2",children:r.imageSeoTips.map((s,t)=>e.jsxs("li",{className:"text-sm flex items-start gap-2",children:[e.jsx(w,{className:"h-4 w-4 text-green-600 mt-0.5 shrink-0"})," ",s]},t))})})]})]}),e.jsxs(d,{children:[e.jsx(g,{children:e.jsxs(j,{className:"text-lg flex items-center gap-2",style:{color:n},children:[e.jsx(we,{className:"h-5 w-5"})," FAQ Suggestions"]})}),e.jsx(o,{children:e.jsx("div",{className:"space-y-3",children:r.faqSuggestions.map((s,t)=>e.jsxs("div",{className:"border rounded-lg p-3",children:[e.jsxs("h5",{className:"font-semibold text-sm text-slate-800 mb-1",children:["Q: ",s.question]}),e.jsxs("p",{className:"text-sm text-slate-600",children:["A: ",s.answer]})]},t))})})]})]}):e.jsx(d,{children:e.jsxs(o,{className:"p-8 text-center",children:[e.jsx(z,{className:"h-12 w-12 mx-auto mb-4",style:{color:n}}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Generate AI Recommendations"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Get AI-powered optimization suggestions including keyword strategy, content outline, and CTA suggestions"}),e.jsx(N,{onClick:le,disabled:$.isPending,style:{backgroundColor:n},"data-testid":"button-get-ai-recs",children:$.isPending?e.jsxs(e.Fragment,{children:[e.jsx(O,{className:"h-4 w-4 animate-spin mr-2"})," Generating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"h-4 w-4 mr-2"})," Generate Recommendations"]})})]})})}
1),e.jsx(A,{value:"apply",className:"space-y-4 mt-4",children:e.jsxs(d,{children:[e.jsxs(g,{children:[e.jsxs(j,{className:"text-lg flex items-center gap-2",style:{color:n},children:[e.jsx(H,{className:"h-5 w-5"})," Apply Recommended SEO Settings"]}),e.jsx(k,{children:"Review the before/after comparison and apply changes to the database"})]}),e.jsx(o,{children:r?e.jsxs(e.Fragment,{children:[e.jsx(K,{label:"Meta Title (og:title)",current:m.currentMeta.title,recommended:r.optimizedTitle}),e.jsx(K,{label:"Meta Description (og:description)",current:m.currentMeta.description,recommended:r.optimizedDescription}),f&&e.jsx(K,{label:"Structured Data (JSON-LD)",current:"Not configured",recommended:`${f.type} schema configured`}),e.jsx(N,{onClick:ie,disabled:G.isPending,className:"w-full mt-4",style:{backgroundColor:n},"data-testid":"button-apply-changes",children:G.isPending?e.jsxs(e.Fragment,{children:[e.jsx(O,{className:"h-4 w-4 animate-spin mr-2"})," Applying..."]}):e.jsxs(e.Fragment,{children:[e.jsx(H,{className:"h-4 w-4 mr-2"})," Apply Recommended Changes"]})})]}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx(z,{className:"h-8 w-8 mx-auto mb-2 text-slate-300"}),e.jsx("p",{className:"text-muted-foreground",children:"Generate AI recommendations first to see the diff preview"}),e.jsx(N,{variant:"outline",className:"mt-3",onClick:()=>p("ai-recs"),"data-testid":"button-go-to-recs",children:"Go to AI Recommendations"})]})})]})}),e.jsx(A,{value:"schema",className:"space-y-4 mt-4",children:e.jsxs(d,{children:[e.jsxs(g,{children:[e.jsxs(j,{className:"text-lg flex items-center gap-2",style:{color:n},children:[e.jsx(F,{className:"h-5 w-5"})," Schema Markup Preview"]}),e.jsxs(k,{children:["JSON-LD structured data for ",e.jsx("strong",{children:m.pagePath})]})]}),e.jsx(o,{children:f?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx(x,{style:{backgroundColor:n},children:f.type}),e.jsxs(N,{variant:"outline",size:"sm",onClick:()=>E(f.jsonLd,"Schema JSON-LD"),"data-testid":"button-copy-schema",children:[e.jsx(P,{className:"h-3.5 w-3.5 mr-1"})," Copy JSON-LD"]})]}),e.jsx("pre",{className:"bg-slate-900 text-green-400 p-4 rounded-lg overflow-x-auto text-xs leading-relaxed","data-testid":"code-schema-preview",children:f.jsonLd})]}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx(F,{className:"h-12 w-12 mx-auto mb-4 text-slate-300"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Generate the appropriate JSON-LD structured data for this page"}),e.jsx(N,{onClick:re,disabled:M.isPending,style:{backgroundColor:n},"data-testid":"button-generate-schema",children:M.isPending?e.jsxs(e.Fragment,{children:[e.jsx(O,{className:"h-4 w-4 animate-spin mr-2"})," Generating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(F,{className:"h-4 w-4 mr-2"})," Generate Schema Markup"]})})]})})]})}),e.jsx(A,{value:"links",className:"space-y-4 mt-4",children:e.jsxs(d,{children:[e.jsxs(g,{children:[e.jsxs(j,{className:"text-lg flex items-center gap-2",style:{color:n},children:[e.jsx(J,{className:"h-5 w-5"})," Internal Link Suggestions"]}),e.jsxs(k,{children:["AI-recommended internal linking strategy for ",e.jsx("strong",{children:m.pagePath})]})]}),e.jsx(o,{children:r?e.jsx("div",{className:"space-y-3",children:r.internalLinkSuggestions.map((s,t)=>e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-slate-50 rounded-lg border","data-testid":`link-suggestion-${t}`,children:[e.jsx("div",{className:`p-1.5 rounded ${s.direction==="to"?"bg-blue-100":"bg-green-100"}`,children:e.jsx(q,{className:`h-4 w-4 ${s.direction==="to"?"text-blue-600":"text-green-600 rotate-180"}`})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[e.jsx(x,{variant:"outline",className:"text-xs",children:s.direction==="to"?"Link TO":"Link FROM"}),e.jsx("span",{className:"text-sm font-medium text-slate-800",children:s.page})]}),e.jsxs("p",{className:"text-xs text-slate-500",children:["Anchor text: ",e.jsxs("span",{className:"font-medium text-slate-700",children:['"',s.anchorText,'"']})]})]})]},t))}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx(J,{className:"h-8 w-8 mx-auto mb-2 text-slate-300"}),e.jsx("p",{className:"text-muted-foreground",children:"Generate AI recommendations first to see link suggestions"}),e.jsx(N,{variant:"outline",className:"mt-3",onClick:()=>p("ai-recs"),"data-testid":"button-go-to-recs-links",children:"Go to AI Recommendations"})]})})]})})]})]}),!m&&!S&&e.jsx(d,{className:"overflow-hidden",children:e.jsxs("div",{className:"grid md:grid-cols-2 gap-0",children:[e.jsxs(o,{className:"p-8 flex flex-col justify-center",children:[e.jsx("h2",{className:"text-2xl font-bold mb-2",style:{color:n},children:"Optimize Any Page's SEO"}),e.jsx("p",{className:"text-lg text-muted-foreground mb-4",children:"Comprehensive SEO scoring and AI-powered recommendations"}),e.jsxs("ul",{className:"space-y-2 text-sm text-slate-600",children:[e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(w,{className:"h-4 w-4 text-green-600"})," SEO scorecard across 4 dimensions"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(w,{className:"h-4 w-4 text-green-600"})," AI keyword strategy and content outlines"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(w,{className:"h-4 w-4 text-green-600"})," One-click meta tag optimization"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(w,{className:"h-4 w-4 text-green-600"})," Schema markup preview and generation"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(w,{className:"h-4 w-4 text-green-600"})," Internal link strategy suggestions"]})]})]}),e.jsx("div",{className:"bg-gradient-to-br from-slate-100 to-slate-200 p-8 flex items-center justify-center min-h-[240px]",children:e.jsxs("div",{className:"bg-white rounded-xl shadow-lg p-6 w-full max-w-xs",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx(ee,{score:87,size:"sm"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold",style:{color:n},children:"SEO Score"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Analyze any page"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-slate-500",children:"Content"}),e.jsx("div",{className:"w-24 h-1.5 bg-slate-200 rounded-full",children:e.jsx("div",{className:"h-full bg-green-500 rounded-full",style:{width:"90%"}})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-slate-500",children:"Technical"}),e.jsx("div",{className:"w-24 h-1.5 bg-slate-200 rounded-full",children:e.jsx("div",{className:"h-full bg-yellow-500 rounded-full",style:{width:"72%"}})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-slate-500",children:"UX"}),e.jsx("div",{className:"w-24 h-1.5 bg-slate-200 rounded-full",children:e.jsx("div",{className:"h-full bg-green-500 rounded-full",style:{width:"85%"}})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-slate-500",children:"Authority"}),e.jsx("div",{className:"w-24 h-1.5 bg-slate-200 rounded-full",children:e.jsx("div",{className:"h-full bg-green-500 rounded-full",style:{width:"80%"}}
1)})]})]})]})})]})})]})})}export{hs 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.