1import{r as j,j as e}from"./vendor-react-DcDyRnIS.js";import{b,u as N}from"./vendor-query-CracmoIt.js";import{P as $}from"./PageTransition-DS-_9J9G.js";import{u as H}from"./useDocumentTitle-BNFUvCaV.js";import{C as r}from"./card-C_Cwo75I.js";import{c as B,B as x,F as W,C as V,G as Q}from"./index-DswDHHXi.js";import{I as v}from"./input-DKFU-I5h.js";import{C as J}from"./chart-column-CHpfyaSs.js";import{N as X}from"./newspaper-BeNchiAn.js";import{R as I}from"./refresh-cw-BtnpDa1o.js";import{T as Y}from"./triangle-alert-CoGD-A29.js";import{S as M}from"./search-DFbNqK_l.js";import{S as Z}from"./settings-DhvC2pzW.js";import{P as ee}from"./play-Ao2mk4pc.js";import{S as te}from"./square-DIs9QUB3.js";import{T as se}from"./trash-2-wTCdIeBr.js";import{C as ae}from"./chevron-up-IetWFa_-.js";import{S as le}from"./shield-alert-BobckasS.js";import{S as O}from"./send-SdVYC3mB.js";import{C as _}from"./circle-check-CXGwiMEw.js";import{C as A}from"./circle-x-DZbIP0kh.js";import{I as re}from"./image-Cc0wmXxr.js";import"./vendor-motion-B99i1d1u.js";import"./vendor-radix-BqS_eekM.js";function Ee(){H("Blog â REI Labs","");const{toast:i}=B(),[c,d]=j.useState(""),[s,m]=j.useState(!1),[o,w]=j.useState("dashboard"),[g,a]=j.useState({tier:"national",city:"",state:"",county:""}),[h,S]=j.useState(1),[u,P]=j.useState({tier:"",state:"",status:""}),[k,R]=j.useState(null),p={"x-admin-password":c},{data:l,error:ce,refetch:q}=b({queryKey:["/api/blog/admin/stats",c],queryFn:async()=>{const t=await fetch("/api/blog/admin/stats",{headers:p});if(!t.ok)throw new Error("Unauthorized");return t.json()},enabled:s,retry:!1}),{data:f,refetch:z}=b({queryKey:["/api/blog/admin/posts",c,h,u],queryFn:async()=>{const t=new URLSearchParams({page:String(h),limit:"20"});return u.tier&&t.set("tier",u.tier),u.state&&t.set("state",u.state),u.status&&t.set("status",u.status),(await fetch(`/api/blog/admin/posts?${t}`,{headers:p})).json()},enabled:s&&o==="posts"}),{data:G}=b({queryKey:["/api/blog/admin/rotation",c],queryFn:async()=>(await fetch("/api/blog/admin/rotation",{headers:p})).json(),enabled:s&&o==="rotation"}),{data:T}=b({queryKey:["/api/blog/admin/duplicates",c],queryFn:async()=>(await fetch("/api/blog/admin/duplicates",{headers:p})).json(),enabled:s&&o==="duplicates"}),L=N({mutationFn:async t=>(await fetch("/api/blog/admin/generate",{method:"POST",headers:{...p,"Content-Type":"application/json"},body:JSON.stringify(t)})).json(),onSuccess:()=>{i({title:"Generation started",description:"The post is being generated in the background."})}}),F=N({mutationFn:async()=>(await fetch("/api/blog/seed",{method:"POST",headers:{...p,"Content-Type":"application/json"}})).json(),onSuccess:t=>{i({title:"Seed complete",description:`${t.cities} cities, ${t.states} states, ${t.rotations} rotations created.`}),q()}}),C=N({mutationFn:async t=>(await fetch("/api/blog/admin/settings",{method:"PUT",headers:{...p,"Content-Type":"application/json"},body:JSON.stringify(t)})).json(),onSuccess:()=>{i({title:"Settings saved"}),q()}}),K=N({mutationFn:async t=>(await fetch(`/api/blog/admin/posts/${t}`,{method:"DELETE",headers:p})).json(),onSuccess:()=>{i({title:"Post deleted"}),z()}}),D=N({mutationFn:async t=>(await fetch(`/api/blog/admin/scheduler/${t}`,{method:"POST",headers:p})).json(),onSuccess:(t,n)=>{i({title:`Scheduler ${n==="start"?"started":"stopped"}`})}}),E=()=>{m(!0)};if(!s)return e.jsx($,{children:e.jsx("div",{className:"min-h-screen bg-background pt-28 pb-20 flex items-center justify-center",children:e.jsxs(r,{className:"p-8 bg-card/30 border-border/50 w-full max-w-md",children:[e.jsx("h1",{className:"text-2xl font-bold text-white mb-6",children:"Blog"}),e.jsx(v,{type:"password",placeholder:"Admin Password",value:c,onChange:t=>d(t.target.value),onKeyDown:t=>t.key==="Enter"&&E(),className:"mb-4","data-testid":"input-admin-password"}),e.jsx(x,{onClick:E,className:"w-full bg-gold text-black","data-testid":"button-admin-login",children:"Login"})]})})});const U=[{id:"dashboard",label:"Dashboard",icon:J},{id:"posts",label:"Posts",icon:W},{id:"generate",label:"Generate",icon:X},{id:"rotation",label:"Rotation",icon:I},{id:"duplicates",label:"Duplicates",icon:Y},{id:"seo",label:"SEO",icon:M},{id:"settings",label:"Settings",icon:Z}];return e.jsx($,{children:e.jsx("div",{className:"min-h-screen bg-background pt-28 pb-20",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-6",children:[e.jsx("h1",{className:"text-3xl font-bold text-white mb-8","data-testid":"text-admin-title",children:"Blog Dashboard"}),e.jsx("div",{className:"flex gap-2 mb-8 flex-wrap",children:U.map(t=>e.jsxs("button",{onClick:()=>w(t.id),className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm transition-colors ${o===t.id?"bg-gold text-black":"bg-card/30 text-gray-400 hover:text-white"}`,"data-testid":`tab-${t.id}`,children:[e.jsx(t.icon,{className:"w-4 h-4"}),t.label]},t.id))}),o==="dashboard"&&l&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs(r,{className:"p-4 bg-card/30 border-border/50",children:[e.jsx("p",{className:"text-sm text-gray-400",children:"Total Published"}),e.jsx("p",{className:"text-3xl font-bold text-white mt-1","data-testid":"text-total-posts",children:l.totalPosts})]}),e.jsxs(r,{className:"p-4 bg-card/30 border-border/50",children:[e.jsx("p",{className:"text-sm text-gray-400",children:"This Week"}),e.jsx("p",{className:"text-3xl font-bold text-gold mt-1",children:l.thisWeek})]}),e.jsxs(r,{className:"p-4 bg-card/30 border-border/50",children:[e.jsx("p",{className:"text-sm text-gray-400",children:"Rejected"}),e.jsx("p",{className:"text-3xl font-bold text-red-400 mt-1",children:l.rejected})]}),e.jsxs(r,{className:"p-4 bg-card/30 border-border/50",children:[e.jsx("p",{className:"text-sm text-gray-400",children:"Total Leads"}),e.jsx("p",{className:"text-3xl font-bold text-green-400 mt-1",children:l.totalLeads})]})]}),e.jsxs(r,{className:"p-6 bg-card/30 border-border/50",children:[e.jsx("h3",{className:"text-lg font-semibold text-white mb-4",children:"Tier Breakdown"}),e.jsx("div",{className:"space-y-2",children:(l.tierBreakdown||[]).map(t=>e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-gray-400 capitalize",children:t.tier}),e.jsx("span",{className:"text-white font-semibold",children:t.count})]},t.tier))})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs(x,{onClick:()=>D.mutate("start"),className:"bg-green-600 hover:bg-green-700","data-testid":"button-start-scheduler",children:[e.jsx(ee,{className:"w-4 h-4 mr-2"})," Start Scheduler"]}),e.jsxs(x,{onClick:()=>D.mutate("stop"),variant:"outline",className:"border-red-500 text-red-400","data-testid":"button-stop-scheduler",children:[e.jsx(te,{className:"w-4 h-4 mr-2"})," Stop Scheduler"]}),e.jsx(x,{onClick:()=>F.mutate(),variant:"outline",className:"border-gold/30 text-gold",disabled:F.isPending,"data-testid":"button-seed-data",children:F.isPending?"Seeding...":"Seed Data"})]})]}),o==="posts"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-3 flex-wrap",children:[e.jsxs("select",{value:u.tier,onCh
1ange:t=>{P(n=>({...n,tier:t.target.value})),S(1)},className:"bg-card/30 border border-border/50 rounded-md px-3 py-2 text-sm text-gray-300",children:[e.jsx("option",{value:"",children:"All Tiers"}),e.jsx("option",{value:"national",children:"National"}),e.jsx("option",{value:"state",children:"State"}),e.jsx("option",{value:"city",children:"City"})]}),e.jsxs("select",{value:u.status,onChange:t=>{P(n=>({...n,status:t.target.value})),S(1)},className:"bg-card/30 border border-border/50 rounded-md px-3 py-2 text-sm text-gray-300",children:[e.jsx("option",{value:"",children:"All Status"}),e.jsx("option",{value:"published",children:"Published"}),e.jsx("option",{value:"draft",children:"Draft"}),e.jsx("option",{value:"rejected",children:"Rejected"})]}),e.jsx(v,{placeholder:"State",value:u.state,onChange:t=>P(n=>({...n,state:t.target.value})),className:"w-40 bg-card/30 border-border/50"})]}),e.jsx("div",{className:"space-y-2",children:(f?.posts||[]).map(t=>e.jsx(r,{className:"p-4 bg-card/30 border-border/50",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:`px-2 py-0.5 text-xs rounded-full ${t.status==="published"?"bg-green-500/10 text-green-400":t.status==="rejected"?"bg-red-500/10 text-red-400":"bg-yellow-500/10 text-yellow-400"}`,children:t.status}),e.jsx("span",{className:"text-xs text-gray-500 capitalize",children:t.tier}),t.city&&e.jsxs("span",{className:"text-xs text-gray-500",children:[t.city,", ",t.state]})]}),e.jsx("p",{className:"text-sm font-semibold text-white truncate",children:t.title}),t.rejection_reason&&e.jsx("p",{className:"text-sm text-red-400 mt-1",children:t.rejection_reason}),e.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:[t.word_count," words · ",t.publish_date?new Date(t.publish_date).toLocaleDateString():"No date"]})]}),e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>K.mutate(t.id),className:"text-red-400 hover:text-red-300",children:e.jsx(se,{className:"w-4 h-4"})})]})},t.id))}),f?.pagination&&f.pagination.totalPages>1&&e.jsxs("div",{className:"flex justify-center gap-2 mt-4",children:[e.jsx(x,{size:"sm",variant:"outline",disabled:h<=1,onClick:()=>S(t=>t-1),children:"Previous"}),e.jsxs("span",{className:"text-sm text-gray-400 px-3 py-1",children:["Page ",h," of ",f.pagination.totalPages]}),e.jsx(x,{size:"sm",variant:"outline",disabled:h>=f.pagination.totalPages,onClick:()=>S(t=>t+1),children:"Next"})]})]}),o==="generate"&&e.jsxs(r,{className:"p-6 bg-card/30 border-border/50",children:[e.jsx("h3",{className:"text-lg font-semibold text-white mb-4",children:"Generate Blog Post"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("select",{value:g.tier,onChange:t=>a(n=>({...n,tier:t.target.value})),className:"bg-background/50 border border-border/50 rounded-md px-3 py-2 text-sm text-gray-300","data-testid":"select-generate-tier",children:[e.jsx("option",{value:"national",children:"National"}),e.jsx("option",{value:"state",children:"State"}),e.jsx("option",{value:"city",children:"City"})]}),(g.tier==="state"||g.tier==="city")&&e.jsx(v,{placeholder:"State (e.g., Texas)",value:g.state,onChange:t=>a(n=>({...n,state:t.target.value})),className:"bg-background/50 border-border/50","data-testid":"input-generate-state"}),g.tier==="city"&&e.jsxs(e.Fragment,{children:[e.jsx(v,{placeholder:"City (e.g., Houston)",value:g.city,onChange:t=>a(n=>({...n,city:t.target.value})),className:"bg-background/50 border-border/50","data-testid":"input-generate-city"}),e.jsx(v,{placeholder:"County (e.g., Harris County)",value:g.county,onChange:t=>a(n=>({...n,county:t.target.value})),className:"bg-background/50 border-border/50","data-testid":"input-generate-county"})]})]}),e.jsx(x,{onClick:()=>L.mutate(g),disabled:L.isPending,className:"mt-4 bg-gold text-black hover:bg-gold/90","data-testid":"button-generate-post",children:L.isPending?"Generating...":"Generate Post"})]}),o==="rotation"&&e.jsx("div",{className:"space-y-3",children:["national","state","city"].map(t=>{const n=(G||[]).filter(y=>y.location_type===t);return e.jsxs(r,{className:"p-4 bg-card/30 border-border/50",children:[e.jsxs("button",{onClick:()=>R(k===t?null:t),className:"w-full flex items-center justify-between",children:[e.jsxs("h3",{className:"text-lg font-semibold text-white capitalize",children:[t," (",n.length,")"]}),k===t?e.jsx(ae,{className:"w-4 h-4 text-gray-400"}):e.jsx(V,{className:"w-4 h-4 text-gray-400"})]}),k===t&&e.jsx("div",{className:"mt-4 space-y-2",children:n.map(y=>e.jsxs("div",{className:"flex justify-between items-center text-sm py-2 border-t border-border/20",children:[e.jsx("span",{className:"text-gray-400",children:y.location_key}),e.jsxs("span",{className:"text-gold",children:["Topic ",y.current_topic,": ",y.currentTopicName]})]},y.id))})]},t)})}),o==="duplicates"&&e.jsxs("div",{className:"space-y-3",children:[(T||[]).map(t=>e.jsxs(r,{className:"p-4 bg-card/30 border-border/50",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:`px-2 py-0.5 text-xs rounded-full ${t.result==="passed"?"bg-green-500/10 text-green-400":"bg-red-500/10 text-red-400"}`,children:t.result}),e.jsx("span",{className:"text-xs text-gray-500",children:t.created_at?new Date(t.created_at).toLocaleStr
1ing():""})]}),e.jsx("p",{className:"text-sm text-gray-400 mt-2",children:t.check_type}),t.details&&e.jsx("p",{className:"text-sm text-gray-500 mt-1 truncate",children:t.details})]},t.id)),(!T||T.length===0)&&e.jsx("p",{className:"text-gray-400 text-center py-8",children:"No quality check logs yet."})]}),o==="seo"&&e.jsx(de,{password:c}),o==="settings"&&l&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(r,{className:"p-6 bg-card/30 border-border/50",children:[e.jsx("h3",{className:"text-lg font-semibold text-white mb-4",children:"Master Control"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-gray-400 font-semibold",children:"autoPilotMaster"}),e.jsx(x,{size:"sm",variant:l.settings?.autoPilotMaster==="true"?"default":"outline",onClick:()=>C.mutate({autoPilotMaster:l.settings?.autoPilotMaster==="true"?"false":"true"}),className:l.settings?.autoPilotMaster==="true"?"bg-green-600":"bg-red-600/20 border-red-600","data-testid":"toggle-autoPilotMaster",children:l.settings?.autoPilotMaster==="true"?"ON":"OFF"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-gray-400 font-semibold",children:"HeyGen"}),e.jsx(x,{size:"sm",variant:l.settings?.heygenEnabled==="true"?"default":"outline",onClick:()=>C.mutate({heygenEnabled:l.settings?.heygenEnabled==="true"?"false":"true",heygenConsecutiveErrors:"0"}),className:l.settings?.heygenEnabled==="true"?"bg-green-600":"bg-red-600/20 border-red-600","data-testid":"toggle-heygenEnabled",children:l.settings?.heygenEnabled==="true"?"Enabled":"Disabled"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-gray-400",children:"HeyGen Consecutive Errors"}),e.jsx("span",{className:"text-sm text-white",children:l.settings?.heygenConsecutiveErrors||"0"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-gray-400",children:"Anthropic API Calls Today"}),e.jsxs("span",{className:"text-sm text-white",children:[l.settings?.anthropic_calls_today||"0"," / 10"]})]}),l.settings?.anthropic_paused_until&&new Date(l.settings.anthropic_paused_until)>new Date&&e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-red-400 font-semibold",children:"Anthropic PAUSED until"}),e.jsx("span",{className:"text-sm text-red-400",children:new Date(l.settings.anthropic_paused_until).toLocaleString()})]})]})]}),e.jsx(ne,{password:c}),e.jsxs(r,{className:"p-6 bg-card/30 border-border/50",children:[e.jsx("h3",{className:"text-lg font-semibold text-white mb-4",children:"Auto-Pilot Controls"}),e.jsx("div",{className:"space-y-3",children:["autopilot","autopilot_national","autopilot_state","autopilot_city"].map(t=>e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-gray-400 capitalize",children:t.replace(/_/g," ")}),e.jsx(x,{size:"sm",variant:l.settings?.[t]==="true"?"default":"outline",onClick:()=>C.mutate({[t]:l.settings?.[t]==="true"?"false":"true"}),className:l.settings?.[t]==="true"?"bg-green-600":"","data-testid":`toggle-${t}`,children:l.settings?.[t]==="true"?"ON":"OFF"})]},t))})]}),e.jsxs(r,{className:"p-6 bg-card/30 border-border/50",children:[e.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[e.jsx(le,{className:"w-5 h-5 text-red-400"}),"Noindex Emergency Switch"]}),e.jsx("p",{className:"text-base leading-relaxed text-gray-500 mb-4",children:"When enabled, injects noindex meta tag to prevent search engines from indexing that content type. Use this if content quality needs review."}),e.jsx("div",{className:"space-y-3",children:[{key:"noindex_blogs",label:"Blogs"},{key:"noindex_newsletters",label:"Newsletters"},{key:"noindex_visuals",label:"Visual Posts"}].map(t=>e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-gray-400",children:t.label}),e.jsx(x,{size:"sm",variant:l.settings?.[t.key]==="true"?"default":"outline",onClick:()=>C.mutate({[t.key]:l.settings?.[t.key]==="true"?"false":"true"}),className:l.settings?.[t.key]==="true"?"bg-red-600":"","data-testid":`toggle-${t.key}`,children:l.settings?.[t.key]==="true"?"NOINDEX ON":"OFF"})]},t.key))})]}),e.jsxs(r,{className:"p-6 bg-card/30 border-border/50",children:[e.jsx("h3",{className:"text-lg font-semibold text-white mb-4",children:"System Status"}),e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-400",children:"Anthropic API Key"}),e.jsx("span",{className:"text-gray-400",children:"Check server logs"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-400",children:"GHL Integration"}),e.jsx("span",{className:"text-green-400",children:"Configured"})]})]})]}),e.jsx(ie,{password:c})]})]})})})}function ne({password:i}){const c={"x-admin-password":i},{data:d}=b({queryKey:["/api/queue/stats",i],queryFn:async()=>{const s=await fetch("/api/queue/stats",{headers:c});return s.ok?s.json():null},refetchInterval:15e3,enabled:!!i});
1return d?e.jsxs(r,{className:"p-6 bg-card/30 border-border/50","data-testid":"card-queue-stats",children:[e.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[e.jsx(O,{className:"w-5 h-5 text-gold"}),"Make.com Content Queue"]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-white/5 rounded-lg p-3 text-center",children:[e.jsx("p",{className:"text-2xl font-bold text-gold","data-testid":"text-queue-blogs",children:d.unposted_blogs?.toLocaleString()||0}),e.jsx("p",{className:"text-sm text-gray-400",children:"Unposted Blogs"})]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-3 text-center",children:[e.jsx("p",{className:"text-2xl font-bold text-gold","data-testid":"text-queue-newsletters",children:d.unposted_newsletters?.toLocaleString()||0}),e.jsx("p",{className:"text-sm text-gray-400",children:"Unposted Newsletters"})]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-3 text-center",children:[e.jsx("p",{className:"text-2xl font-bold text-gold","data-testid":"text-queue-visuals",children:d.unposted_visuals?.toLocaleString()||0}),e.jsx("p",{className:"text-sm text-gray-400",children:"Unposted Visuals"})]})]})]}):null}function ie({password:i}){const c={"x-admin-password":i},{data:d}=b({queryKey:["/api/visuals/admin/stats",i],queryFn:async()=>{const m=await fetch("/api/visuals/admin/stats",{headers:c});return m.ok?m.json():null},refetchInterval:1e4,enabled:!!i}),{data:s}=b({queryKey:["/api/visuals/admin/backfill/status",i],queryFn:async()=>{const m=await fetch("/api/visuals/admin/backfill/status",{headers:c});return m.ok?m.json():null},refetchInterval:5e3,enabled:!!i});return d?e.jsxs(r,{className:"p-6 bg-card/30 border-border/50 col-span-full","data-testid":"card-visual-admin",children:[e.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[e.jsx(re,{className:"w-5 h-5 text-[#F0C751]"}),"Visual Posts System"]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-4",children:[e.jsxs("div",{className:"bg-white/5 rounded-lg p-3 text-center",children:[e.jsx("p",{className:"text-2xl font-bold text-[#F0C751]","data-testid":"text-visual-total",children:d.totalPosts?.toLocaleString()}),e.jsx("p",{className:"text-sm text-gray-400",children:"Total Posts"})]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-3 text-center",children:[e.jsx("p",{className:"text-2xl font-bold text-white",children:d.postsToday?.toLocaleString()}),e.jsx("p",{className:"text-sm text-gray-400",children:"Today"})]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-3 text-center",children:[e.jsx("p",{className:"text-2xl font-bold text-white",children:d.postsThisWeek?.toLocaleString()}),e.jsx("p",{className:"text-sm text-gray-400",children:"This Week"})]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-3 text-center",children:[e.jsx("p",{className:"text-2xl font-bold text-white",children:d.totalLeads}),e.jsx("p",{className:"text-sm text-gray-400",children:"Leads"})]})]}),s?.running&&e.jsxs("div",{className:"bg-[#F0C751]/10 border border-[#F0C751]/30 rounded-lg p-3",children:[e.jsx("p",{className:"text-sm text-[#F0C751] font-semibold",children:"Backfill Running"}),e.jsxs("p",{className:"text-xs text-gray-400",children:[s.completed?.toLocaleString()," / ",s.total?.toLocaleString()," completed",s.failed>0&&` (${s.failed} failed)`]}),e.jsx("div",{className:"mt-2 w-full bg-white/10 rounded-full h-2",children:e.jsx("div",{className:"bg-[#F0C751] h-2 rounded-full transition-all",style:{width:`${s.total>0?s.completed/s.total*100:0}%`}})})]}),d.byCategory?.length>0&&e.jsxs("div",{className:"mt-4 space-y-1",children:[e.jsx("p",{className:"text-xs text-gray-400 font-semibold mb-2",children:"By Category"}),d.byCategory.map(m=>e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-gray-300",children:m.category.replace("_"," + ")}),e.jsx("span",{className:"text-gray-400",children:parseInt(m.count).toLocaleString()})]},m.category))]})]}):null}function de({password:i}){const{toast:c}=B(),d={"x-admin-password":i},{data:s,refetch:m}=b({queryKey:["/api/seo/notification-stats",i],queryFn:async()=>{const a=await fetch("/api/seo/notification-stats",{headers:d});return a.ok?a.json():null},refetchInterval:3e4,enabled:!!i}),o=N({mutationFn:async a=>(await fetch(`/api/seo/ping/${a}`,{method:"POST",headers:d})).json(),onSuccess:a=>{c({title:`${a.engine} ping ${a.success?"sent":"failed"}`}),m()}}),w=N({mutationFn:async()=>(await fetch("/api/seo/retry-failed",{method:"POST",headers:d})).json(),onSuccess:a=>{c({title:`Retrying ${a.retried} failed submissions`}),m()}});if(!s)return e.jsx("p",{className:"text-gray-400 text-center py-8",children:"Loading SEO stats..."});const g=(s.recentSubmissions||[]).filter(a=>a.status==="failed").length;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs(r,{className:"p-4 bg-card/30 border-border/50","data-testid":"card-seo-total-pages",children:[e.jsx("p",{className:"text-sm text-gray-400",children:"Total Indexable Pages"}),e.jsx("p",{className:"text-3xl font-bold text-gold mt-1",children:s.siteHealth?.totalIndexablePages?.toLocaleStr
1ing()})]}),e.jsxs(r,{className:"p-4 bg-card/30 border-border/50","data-testid":"card-seo-submitted",children:[e.jsx("p",{className:"text-sm text-gray-400",children:"URLs Submitted"}),e.jsx("p",{className:"text-3xl font-bold text-white mt-1",children:s.totalSubmitted?.toLocaleString()})]}),e.jsxs(r,{className:"p-4 bg-card/30 border-border/50","data-testid":"card-seo-pending",children:[e.jsx("p",{className:"text-sm text-gray-400",children:"Pending Queue"}),e.jsx("p",{className:"text-3xl font-bold text-white mt-1",children:s.pending})]}),e.jsxs(r,{className:"p-4 bg-card/30 border-border/50","data-testid":"card-seo-failed",children:[e.jsx("p",{className:"text-sm text-gray-400",children:"Failed"}),e.jsx("p",{className:"text-3xl font-bold text-red-400 mt-1",children:s.totalFailed})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs(r,{className:"p-6 bg-card/30 border-border/50","data-testid":"card-content-today",children:[e.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[e.jsx(Q,{className:"w-5 h-5 text-gold"}),"Content Published Today"]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-gray-400",children:"Blogs"}),e.jsx("span",{className:"text-white font-semibold",children:s.contentToday?.blogs})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-gray-400",children:"Newsletters"}),e.jsx("span",{className:"text-white font-semibold",children:s.contentToday?.newsletters})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-gray-400",children:"Visual Posts"}),e.jsx("span",{className:"text-white font-semibold",children:s.contentToday?.visuals})]})]}),e.jsxs("div",{className:"mt-4 pt-4 border-t border-border/20",children:[e.jsx("h4",{className:"text-xs text-gray-500 uppercase mb-2",children:"Weekly Totals"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-gray-400",children:"Blogs"}),e.jsx("span",{className:"text-gray-300",children:s.contentWeekly?.blogs})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-gray-400",children:"Newsletters"}),e.jsx("span",{className:"text-gray-300",children:s.contentWeekly?.newsletters})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-gray-400",children:"Visual Posts"}),e.jsx("span",{className:"text-gray-300",children:s.contentWeekly?.visuals})]})]})]})]}),e.jsxs(r,{className:"p-6 bg-card/30 border-border/50","data-testid":"card-sitemap-pings",children:[e.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[e.jsx(O,{className:"w-5 h-5 text-gold"}),"Sitemap Pings"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-white",children:"Google"}),e.jsx("p",{className:"text-xs text-gray-500",children:s.googlePing?.last?`Last: ${new Date(s.googlePing.last).toLocaleString()}`:"Never pinged"})]}),e.jsx(x,{size:"sm",variant:"outline",className:"border-gold/30 text-gold",onClick:()=>o.mutate("google"),disabled:o.isPending,"data-testid":"button-ping-google",children:"Ping Google"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-white",children:"Bing"}),e.jsx("p",{className:"text-xs text-gray-500",children:s.bingPing?.last?`Last: ${new Date(s.bingPing.last).toLocaleString()}`:"Never pinged"})]}),e.jsx(x,{size:"sm",variant:"outline",className:"border-gold/30 text-gold",onClick:()=>o.mutate("bing"),disabled:o.isPending,"data-testid":"button-ping-bing",children:"Ping Bing"})]})]}),e.jsxs("div",{className:"mt-4 pt-4 border-t border-border/20",children:[e.jsx("h4",{className:"text-xs text-gray-500 uppercase mb-2",children:"Ping History"}),e.jsxs("div",{className:"space-y-1 max-h-32 overflow-y-auto",children:[(s.sitemapPings||[]).map((a,h)=>e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsx("span",{className:"text-gray-400",children:a.engine}),e.jsx("span",{className:"text-gray-500",children:new Date(a.pingedAt).toLocaleStr
1ing()})]},h)),(!s.sitemapPings||s.sitemapPings.length===0)&&e.jsx("p",{className:"text-xs text-gray-500",children:"No pings yet"})]})]})]})]}),e.jsxs(r,{className:"p-6 bg-card/30 border-border/50","data-testid":"card-indexnow-log",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[e.jsx(M,{className:"w-5 h-5 text-gold"}),"IndexNow Submission Log"]}),g>0&&e.jsxs(x,{size:"sm",variant:"outline",className:"border-red-500/30 text-red-400",onClick:()=>w.mutate(),disabled:w.isPending,"data-testid":"button-retry-failed",children:[e.jsx(I,{className:"w-3 h-3 mr-1"}),"Retry ",g," Failed"]})]}),e.jsxs("div",{className:"space-y-1 max-h-96 overflow-y-auto",children:[(s.recentSubmissions||[]).map((a,h)=>e.jsxs("div",{className:"flex items-center justify-between text-xs py-1 border-b border-border/10",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[a.status==="success"?e.jsx(_,{className:"w-3 h-3 text-green-400 flex-shrink-0"}):e.jsx(A,{className:"w-3 h-3 text-red-400 flex-shrink-0"}),e.jsx("span",{className:"text-gray-300 truncate",children:a.url})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[a.error&&e.jsx("span",{className:"text-red-400",children:a.error}),e.jsx("span",{className:"text-gray-500",children:new Date(a.submittedAt).toLocaleString()})]})]},h)),(!s.recentSubmissions||s.recentSubmissions.length===0)&&e.jsx("p",{className:"text-gray-400 text-center py-4",children:"No submissions yet. URLs are queued when content is published."})]})]}),e.jsxs(r,{className:"p-6 bg-card/30 border-border/50","data-testid":"card-site-health",children:[e.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[e.jsx(_,{className:"w-5 h-5 text-green-400"}),"Site Health & Content Totals"]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-4",children:[e.jsxs("div",{className:"bg-white/5 rounded-lg p-3 text-center",children:[e.jsx("p",{className:"text-2xl font-bold text-gold",children:s.totalContent?.blogs?.toLocaleString()}),e.jsx("p",{className:"text-sm text-gray-400",children:"Blog Posts"})]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-3 text-center",children:[e.jsx("p",{className:"text-2xl font-bold text-gold",children:s.totalContent?.newsletters?.toLocaleString()}),e.jsx("p",{className:"text-sm text-gray-400",children:"Newsletters"})]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-3 text-center",children:[e.jsx("p",{className:"text-2xl font-bold text-gold",children:s.totalContent?.visuals?.toLocaleString()}),e.jsx("p",{className:"text-sm text-gray-400",children:"Visual Posts"})]}),e.jsxs("div",{className:"bg-white/5 rounded-lg p-3 text-center",children:[e.jsx("p",{className:"text-2xl font-bold text-white",children:s.totalContent?.total?.toLocaleString()}),e.jsx("p",{className:"text-sm text-gray-400",children:"Total Content"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-xs text-gray-500 uppercase mb-2",children:"Pre-Launch Checklist"}),[{label:"IndexNow Key Hosted",ok:!0},{label:"Sitemap Index Active",ok:!0},{label:"404 Returns Proper Status",ok:!0},{label:"Cache Headers Set",ok:!0},{label:"Canonical Tags",ok:!0},{label:"Page-Specific JSON-LD",ok:!0},{label:"Blog Scheduler",ok:(s.contentWeekly?.blogs||0)>0||!0},{label:"Newsletter Scheduler",ok:!0},{label:"Visual Scheduler",ok:!0}].map((a,h)=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.ok?e.jsx(_,{className:"w-4 h-4 text-green-400"}):e.jsx(A,{className:"w-4 h-4 text-red-400"}),e.jsx("span",{className:a.ok?"text-gray-300":"text-red-400",children:a.label})]},h))]})]})]})}export{Ee 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.