1import{j as e}from"./vendor-framer-e_lHCn70.js";import{r as T}from"./vendor-react-KJNI7MOv.js";import{b as O,u as A,c as B}from"./vendor-query-B0dKBn0F.js";import{B as w,G as F,Y as D,a0 as G,s as y,u as v,g as I}from"./index-fBnR0sxX.js";import{C as a,d as i,a as m,b as d,c as _}from"./card-Cvhc0jcH.js";import{B as l}from"./badge-B__t_d23.js";import{A as q,a as H,b as Q,c as W}from"./accordion-_HhdBWPV.js";import{S as K}from"./skeleton-DxGiVr07.js";import{S as b}from"./search-COqpNKQp.js";import{R as p}from"./refresh-cw-DamgBDd0.js";import{C as j}from"./circle-check-D45-629a.js";import{T as u}from"./triangle-alert-D0j0PxCM.js";import{C as g}from"./circle-x-I3kv6ajG.js";import{j as S}from"./AdminDashboard-CVRDugiK.js";import{C as L}from"./calendar-_-pXcMHv.js";import{T as U}from"./trending-down-DoIL_4vd.js";import{M as Y}from"./minus-I_p30uIG.js";import{a as $,f as X}from"./vendor-date-Cl6Zci4u.js";import"./vendor-radix-core-Dl2pI1uY.js";import"./vendor-utils-MBSoW7Mz.js";import"./vendor-supabase-DEDxcdm9.js";import"./vendor-radix-extended-hypInIJy.js";import"./select-DzOVp7cU.js";import"./useAuditLog-CRsTv0uK.js";import"./shield-CaA2pgGQ.js";import"./circle-check-big-DLHT3tJg.js";import"./key-Ck0Ei6oM.js";import"./upload-CWKhkgUK.js";import"./clock-0xkpKQg3.js";import"./input-u-di5Od2.js";import"./table-of2xIJG2.js";import"./dialog-BMCOagfp.js";import"./download-Cv4gTAR2.js";import"./message-square-BImQX1w3.js";import"./user-C0xYIQF_.js";import"./eye-DyrvKdNw.js";import"./label-nk0y8NZj.js";import"./EmployerLeadsManager-oPugfUrR.js";import"./textarea-M1QvYreX.js";import"./chart-column-Dk8jjr5W.js";import"./external-link-BoqUADpV.js";import"./plus-Bt39yTvS.js";import"./pencil-BflGt8EC.js";import"./copy-Cz3FTjti.js";import"./checkbox-mfwZgroM.js";import"./chevron-left-Cq3aN6Bw.js";import"./arrow-down-CL_8U4YI.js";import"./rotate-ccw-D_peth6a.js";import"./circle-alert-D7VeynuL.js";import"./phone-DxuZzvOG.js";import"./history-BronWrZ8.js";import"./filter-BeIHmpy-.js";import"./user-check-BNsDTDIq.js";import"./user-x-DoCDs0Xl.js";import"./send-Bvd-qYTA.js";import"./types-BSrl28b_.js";import"./brain-BBlwwGUj.js";import"./vendor-charts-BDAdqkMp.js";import"./save-CyRTDZTN.js";import"./slider-TJfRqUwn.js";import"./palette-DecOYwQt.js";import"./map-pin-REDMVgDh.js";import"./eye-off-Cbw7g8d_.js";import"./resume-is-dead-og-v2-DL5aqQw8.js";import"./user-plus-86kienB1.js";import"./bell-BjgzZIDM.js";import"./bell-off-Bo3_ZV32.js";import"./snowflake-B4iNhsIR.js";import"./volume-x-7U7MigTr.js";import"./volume-2-C1iShnmn.js";import"./separator-CDLcxjJf.js";import"./aiVisibilityResources-DAzVeRwt.js";import"./activity-BnqgmcJZ.js";import"./hero-DbDXTZ_8.js";import"./hero-BHJ6__Hx.js";import"./hero-CQe232AX.js";import"./hero-DEFRpSNH.js";import"./hero-DxE2ZWaZ.js";import"./hero-BDRfuerP.js";import"./hero-DJ7MLx8P.js";import"./tenFactorHireFactors-CFoftASq.js";import"./useAdminAuthGuard-BPvi08JJ.js";import"./target-5IQT5fQX.js";import"./handshake-CVQsvcxG.js";import"./link-2-5zVlRRTd.js";const Es=()=>{const C=O(),[f,E]=T.useState(null),{data:c,isLoading:R,error:N}=A({queryKey:["seo-reports"],queryFn:async()=>{const{data:s,error:r}=await y.from("seo_reports").select("*").order("report_date",{ascending:!1}).limit(12);if(r)throw r;return(s||[]).map(n=>({...n,findings:n.findings||[],page_details:n.page_details||[],generated_at:n.generated_at||n.created_at}))}}),o=B({mutationFn:async()=>{const{data:s,error:r}=await y.functions.invoke("generate-seo-report");if(r)throw r;return s},onSuccess:s=>{v.success("SEO report generated successfully"),C.invalidateQueries({queryKey:["seo-reports"]})},onError:s=>{console.error("Error generating report:",s),v.error("Failed to generate SEO report")}}),t=c?.[0],x=c?.[1],h=(s,r)=>r===void 0?null:s>r?e.jsx(I,{className:"w-4 h-4 text-green-500"}):s<r?e.jsx(U,{className:"w-4 h-4 text-red-500"}):e.jsx(Y,{className:"w-4 h-4 text-muted-foreground"}),k=s=>{switch(s){case"healthy":return e.jsxs(l,{variant:"default",className:"bg-green-500",children:[e.jsx(j,{className:"w-3 h-3 mr-1"}),"Healthy"]});case"warning":return e.jsxs(l,{variant:"secondary",className:"bg-yellow-500 text-white",children:[e.jsx(u,{className:"w-3 h-3 mr-1"}),"Warning"]});case"error":return e.jsxs(l,{variant:"destructive",children:[e.jsx(g,{className:"w-3 h-3 mr-1"}),"Error"]})}},P=s=>{switch(s){case"error":return e.jsx(g,{className:"w-4 h-4 text-destructive flex-shrink-0"});case"warning":return e.jsx(u,{className:"w-4 h-4 text-yellow-500 flex-shrink-0"});case"info":return e.jsx(j,{className:"w-4 h-4 text-blue-500 flex-shrink-0"})}};
1return R?e.jsx(a,{children:e.jsx(i,{className:"p-6",children:e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-1/3"}),e.jsx("div",{className:"h-32 bg-muted rounded"})]})})}):N?e.jsx(a,{children:e.jsx(i,{className:"p-6",children:e.jsxs("p",{className:"text-destructive",children:["Error loading SEO reports: ",N.message]})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsx(a,{children:e.jsx(m,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(d,{className:"flex items-center gap-2",children:[e.jsx(b,{className:"w-5 h-5"}),"Weekly SEO Reports"]}),e.jsx(_,{children:"Automated SEO health checks and performance tracking"})]}),e.jsx(w,{onClick:()=>o.mutate(),disabled:o.isPending,children:o.isPending?e.jsxs(e.Fragment,{children:[e.jsx(p,{className:"w-4 h-4 mr-2 animate-spin"}),"Generating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(p,{className:"w-4 h-4 mr-2"}),"Generate Report"]})})]})})}),t&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsx(a,{children:e.jsx(i,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Healthy Pages"}),e.jsx("p",{className:"text-2xl font-bold text-green-500",children:t.pages_healthy})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(j,{className:"w-8 h-8 text-green-500/20"}),h(t.pages_healthy,x?.pages_healthy)]})]})})}),e.jsx(a,{children:e.jsx(i,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Warnings"}),e.jsx("p",{className:"text-2xl font-bold text-yellow-500",children:t.pages_with_warnings})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(u,{className:"w-8 h-8 text-yellow-500/20"}),h(x?.pages_with_warnings??0,t.pages_with_warnings)]})]})})}),e.jsx(a,{children:e.jsx(i,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Errors"}),e.jsx("p",{className:"text-2xl font-bold text-destructive",children:t.pages_with_errors})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(g,{className:"w-8 h-8 text-destructive/20"}),h(x?.pages_with_errors??0,t.pages_with_errors)]})]})})}),e.jsx(a,{children:e.jsx(i,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Sitemap URLs"}),e.jsx("p",{className:"text-2xl font-bold",children:t.sitemap_total_urls})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(F,{className:"w-8 h-8 text-muted-foreground/20"}),h(t.sitemap_total_urls,x?.sitemap_total_urls)]})]})})})]}),t&&e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(a,{children:[e.jsx(m,{children:e.jsxs(d,{className:"text-lg flex items-center gap-2",children:[e.jsx(D,{className:"w-5 h-5"}),"Content Overview"]})}),e.jsxs(i,{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-muted-foreground",children:"Total Blog Posts"}),e.jsx("span",{className:"font-medium",children:t.total_blog_posts})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-muted-foreground",children:"Published Posts"}),e.jsx("span",{className:"font-medium",children:t.published_blog_posts})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-muted-foreground",children:"Static Pages"}),e.jsx("span",{className:"font-medium",children:t.sitemap_static_pages})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-muted-foreground",children:"Blog Posts in Sitemap"}),e.jsx("span",{className:"font-medium",children:t.sitemap_blog_posts})]})]})]}),e.jsxs(a,{children:[e.jsx(m,{children:e.jsxs(d,{className:"text-lg flex items-center gap-2",children:[e.jsx(S,{className:"w-5 h-5"}),"Structured Data"]})}),e.jsxs(i,{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-muted-foreground",children:"Pages with Schema"}),e.jsx("span",{className:"font-medium text-green-500",children:t.pages_with_schema})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-muted-foreground",children:"Pages Missing Schema"}),e.jsx("span",{className:"font-medium text-yellow-500",children:t.schema_errors})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-muted-foreground",children:"Schema Coverage"}),e.jsxs("span",{className:"font-medium",children:[t.pages_with_schema+t.schema_errors>0?Math.round(t.pages_with_schema/(t.pages_with_schema+t.schema_errors)*100):0,"%"]})]})]})]})]}),t&&t.findings&&t.findings.length>0&&e.jsxs(a,{children:[e.jsxs(m,{children:[e.jsx(d,{className:"text-lg",children:"Issues & Recommendations"}),e.jsxs(_,{children:[t.findings.filter(s=>s.type==="error").length," errors, "," ",t.findings.filter(s=>s.type==="warning").length," warnings"]})]}),e.jsx(i,{children:e.jsx(K,{className:"h-[400px] pr-4",children:e.jsx("div",{className:"space-y-3",children:t.findings.sort((s,r)=>{const n={error:0,warning:1,info:2};return n[s.type]-n[r.type]}).map((s,r)=>e.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg bg-muted/50",children:[P(s.type),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.page&&e.jsx(l,{variant:"outline",className:"text-xs",children:s.page}),e.jsx("span",{className:"text-sm",children:s.message})]}),s.recommendation&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["ð¡ ",s.recommendation]})]})]},r))})})})]}),t&&t.page_details&&t.page_details.length>0&&e.jsxs(a,{children:[e.jsx(m,{children:e.jsx(d,{className:"text-lg",children:"Page-by-Page Analysis"})}),e.jsx(i,{children:e.jsx(q,{type:"single",collapsible:!0,className:"w-full",children:t.page_details.map((s,r)=>e.jsxs(H,{value:`page-${r}`,children:[e.jsx(Q,{className:"hover:no-underline",children:e.jsxs("div",{className:"flex items-center gap-3 text-left",children:[k(s.status),e.jsx("span",{className:"text-sm truncate max-w-[300px]",children:s.url.replace("https://vetano.lovable.app","")}),s.hasSchema&&e.jsxs(l,{variant:"outline",className:"text-xs",children:[e.jsx(S,{className:"w-3 h-3 mr-1"}),"Schema"]})]})}),e.jsx(W,{children:e.jsxs("div",{className:"space-y-3 pl-4",children:[s.title&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Title:"}),e.jsx("p",{className:"text-sm",children:s.title})]}),s.description&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Description:"}),e.jsx("p",{className:"text-sm",children:s.description})]}),s.issues.length>0?e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Issues:"}),e.jsx("ul",{className:"list-disc list-inside text-sm space-y-1 mt-1",children:s.issues.map((n,M)=>e.jsx("li",{className:"text-yellow-600 dark:text-yellow-400",children:n},M))})]}):e.jsx("p",{className:"text-sm text-green-500",children:"â No issues found"})]})})]},r))})})]}),c&&c.length>1&&e.jsxs(a,{children:[e.jsx(m,{children:e.jsxs(d,{className:"text-lg flex items-center gap-2",children:[e.jsx(L,{className:"w-5 h-5"}),"Report History"]})}),e.jsx(i,{children:e.jsx("div",{className:"space-y-2",children:c.map(s=>e.jsxs("div",{className:`flex items-center justify-between p-3 rounded-lg cursor-pointer transition-colors ${f===s.id?"bg-primary/10":"bg-muted/50 hover:bg-muted"}`,onClick:()=>E(f===s.id?null:s.id),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(G,{className:"w-4 h-4 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:$(new Date(s.report_date),"MMMM d, yyyy")}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Generated ",X(new Date(s.generated_at),{addSuffix:!0})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(l,{variant:"outline",className:"text-xs",children:[s.pages_healthy," healthy"]}),s.pages_with_errors>0&&e.jsxs(l,{variant:"destructive",className:"text-xs",children:[s.pages_with_errors," errors"]}),s.pages_with_warnings>0&&e.jsxs(l,{variant:"secondary",className:"text-xs bg-yellow-500 text-white",children:[s.pages_with_warnings," warnings"]})]})]},s.id))})})]}),(!c||c.length===0)&&e.jsx(a,{children:e.jsxs(i,{className:"p-12 text-center",children:[e.jsx(b,{className:"w-12 h-12 mx-auto text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"No SEO Reports Yet"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Generate your first SEO report to start tracking your site's search health."}),e.jsxs(w,{onClick:()=>o.mutate(),disabled:o.isPending,children:[e.jsx(p,{className:"w-4 h-4 mr-2"}),"Generate First Report"]})]})})]})};export{Es 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.