PageSourceSearch

https://app.rankauthority.com/assets/RankFastBeatYourCompetitor-DpDFrR1p.js

js rankauthority.com collected 2026-09-25 14:11:58 UTC 52,352 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-motion-DUZozfy1.js";import{a as n,f as lt}from"./vendor-charts-CHn1wSbK.js";import{X as ws,R as H,U as it,f as ot,a7 as Qe,T as ct,Z as Ns,a as vs,S as Ke,D as ie,r as oe,s as ye,v as we,w as Ne,x as He,d as g,e7 as be,aI as dt,y as ut,be as mt,N as ht,ao as xt,k as pt,u as gt,ac as ft,bC as bt,bu as jt,L as k,l as se,m as te,g as ms,as as le,a0 as hs,a1 as xs,i as yt,a2 as ps,a3 as L,e as Le,aj as gs,aA as wt,a9 as fs,p as Nt,a4 as vt,bg as kt,cn as Ct,a6 as St,a5 as Pt,aH as Rt,M as je,$ as _t}from"./index-Bb8a9cml.js";import{S as At}from"./search-input-CF-Y1y0q.js";import{l as ks,m as Dt,n as Ft,d as It,e as Tt,c as Mt,f as Et,g as $t,k as Lt,o as Ut,p as Ot}from"./rankFastHooks-Ids02Xmw.js";import{u as Bt}from"./useGoogleSearchConsole-A_gHMCuy.js";import{C as Gt}from"./CMSConnectionBanner-BwHvGbhb.js";import{u as zt}from"./usePublishErrorHandler-lK7yDnFP.js";import{P as qt}from"./ProgressBanner-C8RWEpJ5.js";import{u as Yt}from"./useRankFastProgress-PAPCHq1d.js";import{u as Qt}from"./queueHooks-DOfA4VZI.js";import{P as Kt,a as Ht,b as bs,c as Wt,d as Jt,e as Zt}from"./pagination-emVFJKlt.js";import{T as Xt,a as Vt,b as Ue,c as z,d as ea,e as U}from"./table-CdmCdqO4.js";import{C as js}from"./checkbox-ELS1sVik.js";import{C as sa}from"./calendar-B08u_o41.js";import{T as We}from"./target-D4FHiEVS.js";import{u as ta}from"./useTrialActivation-D4D6GD1P.js";import{L as ys}from"./link-BmSgRgNm.js";import"./RankFastContentTabs-BM5sdeOp.js";import{P as aa}from"./PageLayout-CNh5Cs5f.js";import{S as ra}from"./ScheduleResultModal-I_Mziedj.js";import{B as na,a as Oe,b as la}from"./BulkPublishWarningDialog-DyxC7pkK.js";import{P as ia}from"./PageLinksButton-CCUDYv7a.js";import{C as Be}from"./calendar-C35cV26U.js";import{A as Ge}from"./archive-CZsukdM4.js";import{U as oa}from"./undo-2-d9YVv7-K.js";import{A as ze}from"./arrow-up-down-2ZZmT4gM.js";import{E as ca}from"./ellipsis-vertical-WADWKqhQ.js";import"./vendor-sentry-RcVmeTqv.js";import"./vendor-radix-c9D4YKig.js";import"./useGoogleConsent-D7ViCJKH.js";import"./googleSearchConsoleHooks-BajqQBM1.js";import"./gscPermissions-CmbukKF8.js";import"./index.esm-Dfs_rq7k.js";import"./en-US-dVR5b0_k.js";import"./format-BAaKANpQ.js";import"./purify.es-C_j36M7A.js";import"./vendor-quill-DFIm4VVe.js";import"./AIVisibilityReportContent-BISgsd6P.js";import"./SchemaMarkupTabs-Bhzvzfjf.js";import"./earth-CeCv-D8S.js";import"./PageLinksDialog-AoYjEm9Y.js";import"./skeleton-D5297Fry.js";(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};i.SENTRY_RELEASE={id:"82232f0163efc9ba5bbf9cf2945540a486567b75"};var c=new i.Error().stack;c&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[c]="4eea1928-be3d-4481-89c4-59021fd91b14",i._sentryDebugIdIdentifier="sentry-dbid-4eea1928-be3d-4481-89c4-59021fd91b14")}catch{}})();const da=({isOpen:i,onClose:c})=>i?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50",onClick:c,children:e.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl max-w-3xl w-full max-h-[90vh] overflow-y-auto",onClick:x=>x.stopPropagation(),children:[e.jsx("button",{onClick:c,className:"absolute right-4 top-4 roun
1ded-sm opacity-70 hover:opacity-100",children:e.jsx(ws,{className:"h-5 w-5"})}),e.jsxs("div",{className:"p-8",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"w-16 h-16 bg-gradient-to-br from-purple-500 to-pink-600 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(H,{className:"w-8 h-8 text-white"})}),e.jsx("h2",{className:"text-3xl font-bold text-slate-900 mb-2",children:"RankFast Guide"}),e.jsx("p",{className:"text-slate-600 text-lg",children:"AI-powered competitive content optimization"})]}),e.jsx("div",{className:"bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 rounded-xl p-8 mb-8 text-white",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-8 h-8 bg-purple-500 rounded-full flex items-center justify-center text-sm font-bold flex-shrink-0",children:"1"}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-xl font-semibold mb-2 flex items-center gap-2",children:[e.jsx(We,{className:"w-5 h-5"}),"What is RankFast?"]}),e.jsx("p",{className:"text-slate-300 leading-relaxed",children:"RankFast is your AI-powered competitive analysis tool. Select any page on your site, and our AI will analyze top-ranking competitors to generate content suggestions that help you outrank them quickly."})]})]}),e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-8 h-8 bg-pink-500 rounded-full flex items-center justify-center text-sm font-bold flex-shrink-0",children:"2"}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-xl font-semibold mb-2 flex items-center gap-2",children:[e.jsx(it,{className:"w-5 h-5"}),"Select Your Page & Competitor"]}),e.jsx("p",{className:"text-slate-300 leading-relaxed",children:"Choose a page from your website, then review the AI-recommended competitor that's currently outranking you. You can also select different competitors to analyze their strategies."})]})]}),e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-8 h-8 bg-blue-500 rounded-full flex items-center justify-center text-sm font-bold flex-shrink-0",children:"3"}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-xl font-semibold mb-2 flex items-center gap-2",children:[e.jsx(ot,{className:"w-5 h-5"}),"Competitor Analysis"]}),e.jsx("p",{className:"text-slate-300 leading-relaxed",children:"The comparison shows your page vs. the competitor, including rankings, word count, and primary keywords. Use this data to understand what makes them rank higher."})]})]}),e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-8 h-8 bg-green-500 rounded-full flex items-center justify-center text-sm font-bold flex-shrink-0",children:"4"}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-xl font-semibold mb-2 flex items-center gap-2",children:[e.jsx(Qe,{className:"w-5 h-5"}),"AI-Generated Responses"]}),e.jsx("p",{className:"text-slate-300 leading-relaxed",children:"Our AI analyzes the competitor's content and generates strategic content suggestions. Review each response, accept the ones you like, and implement them on your page."})]})]}),e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-8 h-8 bg-orange-500 rounded-full flex items-center justify-center text-sm font-bold flex-shrink-0",children:"5"}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-xl font-semibold mb-2 flex items-center gap-2",children:[e.jsx(ct,{className:"w-5 h-5"}),"Track Your Progress"]}),e.jsx("p",{className:"text-slate-300 leading-relaxed",children:`After implementing the AI suggestions, use the "Track Results" section to monitor your ranking improvements and see how you're gaining on your competitors.`})]})]})]})}),e.jsxs("div",{className:"bg-gradient-to-r from-purple-50 to-pink-50 rounded-xl p-6 mb-6",children:[e.jsxs("h3",{className:"text-xl font-bold text-slate-900 mb-4 flex items-center gap-2",children:[e.jsx(Ns,{className:"w-5 h-5 text-purple-600"}),"Pro Tips for Fast Rankings"]}),e.jsxs("ul",{className:"space-y-2 text-slate-700",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-purple-600",children:"•"}),e.jsx("span",{children:"Focus on pages ranking 4-15 for the quickest ranking improvements"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-purple-600",children:"•"}),e.jsx("span",{children:"Analyze multiple competitors to get a comprehensive content strategy"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-purple-600",children:"•"}),e.jsx("span",{children:"Accept multiple AI responses and combine them for maximum content value"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-purple-600",children:"•"}),e.jsx("span",{children:"Target competitors with similar word counts but higher rankings for easier wins"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-purple-600",children:"•"}),e.jsx("span",{children:'Use the "Publish New Content" feature for rapid content optimization'})]})]})]}),e.jsx("div",{className:"text-center",children:e.jsx("button",{onClick:c,className:"bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700 text-white px-8 py-3 text-lg font-semibold rounded-md",children:"Start Ranking Fast"})})]})]})}):null,ua=({isOpen:i,onClose:c,googleConsoleConnected:x,canConnectGoogle:r,onConnectGoogle:m,rankFastLimit:w,activeSubscription:j=null})=>{const{selectedProject:ve,selectedProjectId:ke,projects:Je,projectsLoading:Ce,projectsError:I}=vs(),C=ke||ve?.id,Ze=ks(),{data:Se,isLoading:q,error:ce}
1=Dt(C),[R,W]=n.useState({id:"",page_url:"",keyword:""}),[Pe,h]=n.useState(!1),[_,N]=n.useState(!1),{canActivate:de,openActivate:J,activateDialog:f}=ta(j);if(!i)return null;const u=()=>{W({id:"",page_url:"",keyword:""}),h(!1),N(!1),c()},Re=async()=>{if(!x){h(!0);return}if(w<=0){N(!0);return}if(!R.page_url||!R.keyword){alert("Please select a page and enter a keyword");return}try{await Ze.mutateAsync({website_id:C,page_id:R.id,keyword:R.keyword}),u()}catch(d){const A=dt(d,"Failed to start RankFast analysis.");A.toLowerCase().includes("limit")||A.toLowerCase().includes("upgrade")?N(!0):alert(A)}},T=d=>{const A=d.target.value,M=Se?.pages?.find(Z=>Z.page_url===A);W({...R,page_url:M?M.page_url:"",id:M?M.id:""})},p=d=>{W({...R,keyword:d.target.value})},S=()=>{r&&(h(!1),u(),m())},P=()=>{N(!1),u(),window.location.href="/billing"};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50",onClick:u,children:e.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl max-w-[525px] w-full",onClick:d=>d.stopPropagation(),children:[e.jsx("button",{onClick:u,className:"absolute right-4 top-4 roun
1ded-sm opacity-70 hover:opacity-100 transition-opacity",children:e.jsx(ws,{className:"h-4 w-4"})}),e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex flex-col space-y-1.5 mb-4",children:[e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2 text-slate-800",children:[e.jsx(Ke,{className:"w-5 h-5 text-[var(--brand-primary)]"}),"Add a Page to Beat Your Competitor"]}),e.jsx("p",{className:"text-sm text-slate-600",children:"Enter your page details and the primary keyword you want to rank for. Our AI will then find a competitor to analyze."})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx("label",{htmlFor:"title",className:"text-sm font-medium text-right",children:"Page Url"}),e.jsxs("select",{id:"title",className:"col-span-3 flex h-10 w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-[var(--brand-primary)] focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed",value:R.url,onChange:T,disabled:q,children:[e.jsx("option",{value:"",children:q?"Loading pages...":ce?"Error loading pages":"Select a page..."}),!q&&!ce&&Se?.pages?.map(d=>e.jsx("option",{value:d.page_url,children:d.page_url},d.id))]})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx("label",{htmlFor:"keyword",className:"text-sm font-medium text-right",children:"Keyword"}),e.jsx("input",{id:"keyword",className:"col-span-3 flex h-10 w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-[var(--brand-primary)] focus:border-transparent",placeholder:"e.g., best seo services",value:R.keyword,onChange:p})]})]}),e.jsxs("div",{className:"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",children:[e.jsx("button",{onClick:u,className:"mt-2 sm:mt-0 px-4 py-2 border border-slate-300 rounded-md hover:bg-slate-50 transition-colors",children:"Cancel"}),e.jsx("button",{onClick:Re,className:"px-4 py-2 bg-[var(--brand-primary)] hover:bg-[var(--brand-primary)]/90 text-white rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed",disabled:q,children:q?"Loading...":"Add Page for Analysis"})]})]})]})]})}),e.jsx(ie,{open:Pe,onOpenChange:h,children:e.jsxs(oe,{children:[e.jsxs(ye,{children:[e.jsxs(we,{className:"flex items-center gap-2",children:[e.jsx(ys,{className:"w-5 h-5 text-[var(--brand-primary)]"}),"Connect Google Search Console"]}),e.jsx(Ne,{className:"pt-4",children:r?"To add pages for competitor comparison, connect this project to Google Search Console first.":"This project is not connected to Google Search Console. Ask a project editor or owner to connect it before adding a page."})]}),e.jsxs(He,{className:"gap-2",children:[e.jsx(g,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r&&e.jsxs(g,{onClick:S,children:[e.jsx(ys,{className:"w-4 h-4 mr-2"}),"Connect Now"]})]})]})}),e.jsx(ie,{open:_,onOpenChange:N,children:e.jsxs(oe,{children:[e.jsxs(ye,{children:[e.jsxs(we,{className:"flex items-center gap-2",children:[e.jsx(H,{className:`w-5 h-5 ${be(j)?"text-[var(--brand-primary)]":"text-orange-600"}`}),be(j)?"RankFast Limit Reached":"Upgrade Your RankFast Plan"]}),e.jsx(Ne,{className:"pt-4",children:de?"You've used your full plan allowance of RankFast comparisons for this period. Activate now to start your subscription, or upgrade to a higher plan for more.":be(j)?"You've used your full plan allowance of RankFast comparisons for this period. Upgrade to a higher plan for more.":"You've reached your limit for page comparisons this period. Upgrade your RankFast plan to analyze more competitors and accelerate your SEO growth."})]}),e.jsxs("div",{className:"py-4",children:[e.jsx("div",{className:"bg-slate-50 rounded-lg p-4 mb-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Current Limit:"}),e.jsxs("span",{className:"text-lg font-bold text-slate-900",children:[w," remaining"]})]})}),!be(j)&&e.jsx("p",{className:"text-sm text-slate-600",children:"Upgrade now to get more comparisons per week and unlock advanced competitor analysis features."})]}),e.jsx(He,{className:"gap-2",children:de?e.jsxs(e.Fragment,{children:[e.jsx(g,{variant:"outline",onClick:()=>N(!1),children:"Got It"}),e.jsxs(g,{onClick:()=>{N(!1),J()},className:"bg-green-600 hover:bg-green-700",children:[e.jsx(Ns,{className:"w-4 h-4 mr-2"}),"Activate now"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(g,{variant:"outline",onClick:()=>N(!1),children:"Maybe Later"}),e.jsxs(g,{onClick:P,className:"bg-orange-600 hover:bg-orange-700",children:[e.jsx(H,{className:"w-4 h-4 mr-2"}),"Upgrade Plan"]})]})})]})}),f]})};function qe(i){if(i==null||i==="")return null;const c=r=>
1{if(typeof r!="number"||Number.isNaN(r))return null;const m=new Date(r);return Number.isNaN(m.getTime())?null:m};if(typeof i=="number")return c(i);if(typeof i=="string"){const r=i.trim();if(!r)return null;if(/^-?\d+(\.\d+)?$/.test(r))return c(Number(r));const m=new Date(r);return Number.isNaN(m.getTime())?null:m}const x=new Date(i);return Number.isNaN(x.getTime())?null:x}function Ye(i,c){const x=_t(i);return!i||x.formattedDate==="—"?e.jsx("span",{className:"text-sm text-slate-400",children:"—"}):e.jsxs("div",{className:"flex items-center justify-start gap-3",children:[e.jsxs("div",{className:`flex-shrink-0 w-10 h-10 rounded-full flex flex-col items-center justify-center gap-0 ${c}`,children:[e.jsx("div",{className:"text-white text-sm font-bold leading-tight",children:x.dayNumber}),e.jsx("div",{className:"text-white text-[10px] font-medium leading-tight",children:x.dayAbbrev})]}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"text-sm font-medium text-slate-900",children:x.dayFull}),e.jsx("div",{className:"text-sm text-slate-500",children:x.formattedDate})]})]})}function ma(i,c){return c==="scheduled"?i.status==="scheduled"&&i.scheduledAt?Ye(i.scheduledAt,"bg-green-600"):e.jsx("span",{className:"text-sm text-slate-400",children:"—"}):c==="published"?i.approvedAt?Ye(i.approvedAt,"bg-[var(--brand-primary)]"):e.jsx("span",{className:"text-sm text-slate-400",children:"—"}):i.createdAt?Ye(i.createdAt,"bg-slate-400"):e.jsx("span",{className:"text-sm text-slate-400",children:"—"})}const ha={theirs:"competitor_url",yours:"id_page",date:"created_at"},or=()=>{const i=ut(),[c,x]=n.useState(""),[r,m]=n.useState("published"),[w,j]=n.useState(null),[ve,ke]=n.useState(!1),[Je,Ce]=n.useState(!1),[I,C]=n.useState(1),[Ze,Se]=n.useState(!1),[q,ce]=n.useState(!1),[R,W]=n.useState(!1),[Pe,h]=n.useState(!1),[_,N]=n.useState(null),[de,J]=n.useState("asc"),[f,u]=n.useState(new Set),[Re,T]=n.useState(!1),[p,S]=n.useState(null),[P,d]=n.useState(null),[A,M]=n.useState(null),[Z,_e]=n.useState(null),[ue,Xe]=n.useState(!1),[Ae,Ve]=n.useState(!1),[me,es]=n.useState(!1),De=25,Fe=s=>{_===s?J(t=>t==="asc"?"desc":"asc"):(N(s),J("asc")),C(1)},Cs=n.useCallback(s=>{x(s),C(1)},[]),{user:xa,isPending:pa}=mt(),{isCMSConnected:D}=ht(),{publishError:Ss,clearPublishError:Ps,handlePublishError:ss,handlePublishResult:ts}=zt(),y=xt();Ft();const{toast:X}=pt(),V=gt(),{selectedProject:he,selectedProjectId:E,projects:ga,projectsLoading:Rs,projectsError:fa}=vs(),as=n.useRef(E);n.useEffect(()=>{as.current!==E&&(as.current=E,u(new Set),C(1),x(""),d(null),S(null),T(!1),j(null),Ce(!1))},[E]);const F=E||he?.id,{connect:_s,isConnected:As,canManage:Ds}=Bt(F,he?.my_role),v=Yt(),Fs=r==="new"?"new":r==="scheduled"?"scheduled":r,Is=n.useCallback(s=>{const t=s.state.data?.rank_fast;return t&&(t.some(l=>l.status==="publishing"||l.status==="restoring"||!l.is_content_generated)||v.show)?1e4:!1},[v.show]),rs=n.useMemo(()=>{if(_)return _==="date"?r==="scheduled"?"scheduled_date":r==="published"?"approved_date":"created_at":ha[_]},[_,r]),{data:ae,isLoading:ns,isPlaceholderData:Ts}=It(E,I,{page_size:De,status:Fs,sort_by:rs,sort_order:rs?de:void 0,q:c||void 0,refetchOnMount:!0,refetchInterval:Is,placeholderData:Rt}),Ms=n.useMemo(()=>{const s=ae?.rank_fast;return s?s.some(t=>t.status==="publishing"||t.status==="restoring"||!t.is_content_generated)||v.show:!1},[ae,v.show]),{data:re}=Tt(E,{refetchInterval:Ms?1e4:!1}),Es=Mt(),ne=Et(),xe=$t();ks();const{mutateAsync:ls}=Lt(),$s=Ut(),Ls=Ot(),Us=ne.isPending||xe.isPending,Os=ft(E,{enabled:!1}),{data:Ie,isPending:ba}=bt({enabled:!1}),Y=Os.data?.find(s=>s.status==="active"&&(s.type==="bundle"||s.type==="rankfast")),Bs=Y?.remaining_rankfast_limit||0,is=n.useMemo(()=>{if(!Y?.end_date)return null;const s=typeof Y.end_date=="string"?parseInt(Y.end_date,10):Y.end_date,t=new Date(s*1e3);return t.setHours(0,0,0,0),t},[Y]),Te=Y?.id??null,Me=n.useCallback(s=>{const t=String(s??"").toLowerCase();return t==="completed"||t==="failed"},[]),{data:O}=Qt(Te,{enabled:!!Te,refetchInterval:s=>{const t=s.state.data;return t?(Array.isArray(t)?t:t.items||t.data||[]).some(l=>!Me(l.status))?1e4:!1:Te?1e4:!1}}),os=n.useMemo(()=>O?Array.isArray(O)?O:Array.isArray(O.items)?O.items:Array.isArray(O.data)?O.data:[]:[],[O]),Q=n.useMemo(()=>os.filter(s=>!Me(s.status)),[os,Me]),B=Q.length>0;n.useMemo(()=>
1{if(!Ie?.response?.result?.data)return null;const s=Ie.response.result.data.find(l=>l.active&&l.metadata.type==="rankfast"&&l.metadata.name==="Trial");if(!s)return null;const t=s.unit_amount/100,a=s.metadata.comparisons_per_week||"0";return{name:s.metadata.name||"RankFast Trial",price:t,comparisonsPerWeek:a,features:[`${a} competitor comparisons per week`,"AI-powered content recommendations","Google Search Console integration","Real-time ranking analysis"],priceId:s.id,interval:s.recurring?.interval||"month"}},[Ie]);const K=ae?.rank_fast?.map(s=>{let t="";if(s.competitor_url)try{t=new URL(s.competitor_url).hostname}catch{t=""}const a=s.status||"new",l=qe(s.created_at),o=a==="published"||a==="restoring"?qe(s.approved_date):null,b=a==="scheduled"?qe(s.scheduled_date):null;return{id:s.id,pageId:s.page_id,rank:Math.round(s.current_rank||0),title:s.page_content?.page_title||s.id_page,url:s.id_page,competitorUrl:s.competitor_url,competitorTitle:t,competitorRank:s.competitor_data?.rank_absolute??0,primaryKeyword:s.primary_keyword,status:a,is_content_generated:s.is_content_generated||!1,createdAt:l,approvedAt:o,scheduledAt:b}})||[],Gs=async s=>{if(!D){h(!0);return}try{const t=await ne.mutateAsync({rank_fast_id:s,website_id:F});if(!ts(t))return;X({title:"Success",description:"New content published successfully!"})}catch(t){je(t,{title:"Publish failed"})}},zs=async s=>{if(!D){h(!0);return}try{await xe.mutateAsync({rank_fast_id:s,website_id:F}),X({title:"Success",description:"Old content restored successfully!"})}catch(t){je(t,{title:"Restore failed"})}},qs=async(s,t)=>{if(t?.stopPropagation?.(),!D){h(!0);return}j(s);try{await Gs(s)}finally{j(null)}},Ys=async(s,t)=>{if(t?.stopPropagation?.(),!D){h(!0);return}j(s);try{await zs(s)}finally{j(null)}},Qs=async(s,t=!1)=>{const a=t?"new":"archived",l=y.getQueriesData({queryKey:["getAllRankFastScans"]});y.setQueriesData({queryKey:["getAllRankFastScans"]},o=>o?.rank_fast?{...o,rank_fast:o.rank_fast.map(b=>b.id===s?{...b,status:a}:b)}:o);try{await Es.mutateAsync({rank_fast_id:s,status:a}),X({title:t?"Unarchived":"Archived",description:t?"Content has been unarchived successfully.":"Content has been archived successfully."})}catch(o){l.forEach(([b,$e])=>y.setQueryData(b,$e)),je(o,{title:t?"Unarchive failed":"Archive failed"})}},ee=n.useMemo(()=>({new:re?.new??0,scheduled:re?.scheduled??0,archived:re?.archived??0,published:re?.published??0,generating:Q.length}),[re,Q.length]),Ks=s=>({new:"bg-purple-100 text-purple-700",pending:"bg-purple-100 text-purple-700",approved:"bg-purple-100 text-purple-700",publishing:"bg-[rgb(var(--brand-primary-rgb)/0.08)] text-[var(--brand-primary)] animate-pulse",restoring:"bg-[rgb(var(--brand-primary-rgb)/0.08)] text-[var(--brand-primary)] animate-pulse",scheduled:"bg-green-100 text-green-700",archived:"bg-yellow-100 text-yellow-700",declined:"bg-gray-100 text-gray-700",published:"bg-[rgb(var(--brand-primary-rgb)/0.12)] text-[var(--brand-primary)]"})[s]||"bg-gray-100 text-gray-700",Hs=s=>({new:"Draft",pending:"Draft",approved:"Draft",publishing:"Publishing…",restoring:"Restoring…",scheduled:"Scheduled",archived:"Archived",declined:"Declined",published:"Published"})[s]||s&&s.charAt(0).toUpperCase()+s.slice(1),G=K,cs=ae?.pagination?.itemsTotal??G.length,pe=ae?.pagination?.pageTotal??Math.ceil(cs/De),ge=n.useMemo(()=>[...f].filter(s=>{const t=K.find(a=>a.id===s);return t&&(t.status==="new"||t.status==="pending"||t.status==="approved"||t.status==="scheduled")&&t.status!=="publishing"&&t.is_content_generated}),[f,K]),$=n.useMemo(()=>[...f].filter(s=>{const t=K.find(a=>a.id===s);return t&&(t.status==="new"||t.status==="pending"||t.status==="approved"||t.status==="scheduled")&&t.is_content_generated}),[f,K]),fe=n.useMemo(()=>[...f].filter(s=>{const t=K.find(a=>a.id===s);return t&&t.status==="published"}),[f,K]),Ws=n.useCallback(s=>{u(t=>{const a=new Set(t);return a.has(s)?a.delete(s):a.add(s),a})},[]),Js=n.useCallback(()=>{f.size===G.length?u(new Set):u(new Set(G.map(s=>s.id)))},[f,G]),Zs=(s,t,a)=>{t>=Oe?_e({action:s,count:t,onConfirm:a}):a()},Xs=async()=>{if(!D){h(!0);return}if(ge.length===0)return;const s=[...ge],t=async()=>{const a=new Set(s);y.setQueriesData({queryKey:["getAllRankFastScans"]},l=>l?.rank_fast?{...l,rank_fast:l.rank_fast.map(o=>a.has(o.id)?{...o,status:"publishing"}:o)}:l),u(new Set),Xe(!0);try{const l=await $s.mutateAsync({rank_fast_ids:s,website_id:F}),o=l?.publish_pacing?.deferred_estimate||0,b=`${l.total} item${l.total!==1?"s":""} are being published. Status will update automatically.`,$e=o>0?` ${o} of them reached today's publish limit and will be scheduled over the coming days.`:"";X({title:"Publishing Started",description:b+$e})}catch(l){y.invalidateQueries({queryKey:["getAllRankFastScans"]}),ss(l)}finally{Xe(!1)}};Zs("publish",s.length,t)},Vs=async()=>
1{if(!D){h(!0);return}if(fe.length===0)return;const s=[...fe],t=new Set(s);y.setQueriesData({queryKey:["getAllRankFastScans"]},a=>a?.rank_fast?{...a,rank_fast:a.rank_fast.map(l=>t.has(l.id)?{...l,status:"restoring"}:l)}:a),u(new Set),Ve(!0);try{const a=await Ls.mutateAsync({rank_fast_ids:s,website_id:F});X({title:"Restoring Started",description:`${a.total} item${a.total!==1?"s":""} are being restored. Status will update automatically.`})}catch(a){y.invalidateQueries({queryKey:["getAllRankFastScans"]}),ss(a)}finally{Ve(!1)}},et=async()=>{if(!D){h(!0);return}$.length!==0&&(S(null),d(null),T(!0))},st=n.useCallback(s=>{T(s),s||(S(null),d(null))},[]),tt=n.useCallback(()=>{S("even")},[]),at=n.useCallback(()=>{S("date")},[]),Ee=n.useCallback(async(s,t)=>{const a=[...$];if(!a.length||!F)return;const l=r==="scheduled";es(!0);try{const o=await ls({ids:a,website_id:F,mode:s,scheduled_at:t});y.invalidateQueries({queryKey:["getAllRankFastScans"]}),y.invalidateQueries({queryKey:["rankFastCounts"]});const b=o?.total??a.length;u(new Set),M({status:"success",title:l?"Reschedule Updated":"Schedule Updated",description:`${b} item${b!==1?"s":""} ${l?"rescheduled":"scheduled"} successfully.`})}catch(o){M({status:"error",title:l?"Reschedule Failed":"Schedule Failed",description:o?.response?.data?.detail||"There was an error scheduling the selected items. Please try again."})}finally{es(!1)}},[$,F,r,ls,y]),rt=n.useCallback(()=>{if(p==="even"){T(!1),S(null),Ee("even",null);return}if(p!=="date"||!P)return;const s=Math.floor(new Date(P.getFullYear(),P.getMonth(),P.getDate()).getTime()/1e3);T(!1),S(null),Ee("date",s).finally(()=>d(null))},[p,P,Ee]),nt=async(s,t)=>{if(t&&t.stopPropagation(),!D){h(!0);return}j(s);try{const a=await ne.mutateAsync({rank_fast_id:s,website_id:F});if(!ts(a))return;X({title:"Published",description:"Item published successfully."})}catch(a){je(a,{title:"Publish failed"})}finally{j(null)}};n.useEffect(()=>{C(1),u(new Set)},[c,r]),n.useEffect(()=>{r==="scheduled"||r==="published"?(N("date"),J("desc")):(N(null),J("asc"))},[r]),n.useEffect(()=>{u(new Set)},[I]);const ds=n.useRef(!1);n.useEffect(()=>{B&&!ds.current&&m("generating"),ds.current=B},[B]);const us=n.useRef(0);return n.useEffect(()=>{const s=us.current,t=Q.length;s>0&&t===0&&(r==="generating"&&m("new"),y.invalidateQueries({queryKey:["getAllRankFastScans"]}),y.invalidateQueries({queryKey:["rankFastCounts"]})),us.current=t},[Q.length,r,y]),n.useEffect(()=>{r==="generating"&&!B&&m("new")},[r,B]),n.useEffect(()=>{if(i.state?.expandedPageId){const{expandedPageId:s}=i.state;V(`/rankfast/rankfastpreview/${s}`,{replace:!0,state:{origin:"beatcompetitors"}})}},[i.state,V]),!F&&!Rs?e.jsx("div",{className:"px-4 py-6 lg:px-8 bg-[#f4f5fe]",children:e.jsx("div",{className:"max-w-[1800px] mx-auto",children:e.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-8 text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-[rgb(var(--brand-primary-rgb)/0.12)] rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(We,{className:"w-8 h-8 text-[var(--brand-primary)]"})}),e.jsx("h2",{className:"text-2xl font-semibold text-slate-900 mb-2",children:"No Project Selected"}),e.jsx("p",{className:"text-slate-600 mb-6",children:"To use RankFast, you need to create a project first. A project represents the website you want to analyze and improve."}),e.jsxs(g,{onClick:()=>V("/projects"),children:[e.jsx(jt,{className:"w-4 h-4 mr-2"}),"Create New Project"]})]})})}):e.jsxs(e.Fragment,{children:[e.jsxs(aa,{title:"Step-2: Beat Competitors",description:"AI-powered GEO, AEO & SEO acceleration tools",children:[e.jsx(Gt,{redirectPath:"/rankfast/beatcompetitors",testId:"cms-connection-banner-beat-competitor"}),e.jsxs("div",{className:"space-y-8",children:[v.ready&&e.jsx(qt,{show:v.show,progress:v.progress,title:v.title,description:v.description,iconRight:e.jsx(Ke,{className:"w-5 h-5 text-blue-300 animate-pulse",style:{animationDelay:"0.5s"}}),messages:v.messages,enableTypingAnimation:!0,footerLeftMessage:"You can check back later or continue browsing while we complete the analysis",footerRightMessage:"Browse freely while we analyze",footerRightIcon:e.jsx(Ke,{className:"w-3 h-3 text-cyan-300"}),testId:"rankfast-scan-progress-banner",currentCount:v.currentCount,totalCount:v.totalCount}),e.jsx(ie,{open:Us,onOpenChange:()=>{},children:e.jsx(oe,{className:"sm:max-w-md",onPointerDownOutside:s=>s.preventDefault(),onEscapeKeyDown:s=>s.preventDefault(),children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-6 px-4 gap-4",children:[e.jsx(k,{className:"w-12 h-12 text-[var(--brand-primary)] animate-spin"}),e.jsxs("div",{className:"text-center space-y-1",children:[e.jsx("p",{className:"font-semibold text-slate-900",children:xe.isPending?"Restoring content":"Publishing content"}),e.jsx("p",{className:"text-sm text-slate-600",children:"Please wait till job is done."})]})]})})}),e.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-8 mb-6",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{className:"text-base font-semibold text-gray-900",children:"Competitor Analysis Overview"}),e.jsx("p",{className:"text-sm text-gray-500 mb-3",children:"Track your competitor comparisons by status"})]}),e.jsxs("div",{className:`grid grid-cols-1 gap-6 ${B?"md:grid-cols-5":"md:grid-cols-4"}`,children:[B&&e.jsx(se,{onClick:()=>m("generating"),className:`border-2 shadow-lg cursor-pointer transition-all ${r==="generating"?"border-orange-200 ring-2 ring-orange-100":"border-transparent hover:border-orange-100"}`,"data-testid":"card-generating-beatcompetitor",children:e.jsxs(te,{className:"p-6 text-center",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-orange-50 flex items-center justify-center mx-auto mb-3",children:e.jsx(k,{className:"w-6 h-6 text-orange-500 animate-spin"})}),e.jsx("h3",{className:"text-2xl font-bold text-slate-900",children:ee.generating}),e.jsx("p",{className:"text-sm text-slate-600",children:"Generating"})]})}),e.jsx(se,{onClick:()=>m("new"),className:`border-2 shadow-lg cursor-pointer transition-all ${r==="new"?"border-purple-200 ring-2 ring-purple-100":"border-transparent hover:border-purple-100"}`,"data-testid":"card-new-beatcompetitor",children:e.jsxs(te,{className:"p-6 text-center",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-purple-50 flex items-center justify-center mx-auto mb-3",children:e.jsx(ms,{className:"w-6 h-6 text-purple-400"})}),e.jsx("h3",{className:"text-2xl font-bold text-slate-900",children:ee.new}),e.jsx("p",{className:"text-sm text-slate-600",children:"Draft"})]})}),e.jsx(se,{onClick:()=>m("scheduled"),className:`border-2 shadow-lg cursor-pointer transition-all ${r==="scheduled"?"border-green-200 ring-2 ring-green-100":"border-transparent hover:border-green-100"}`,"data-testid":"card-scheduled-beatcompetitor",children:e.jsxs(te,{className:"p-6 text-center",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-green-50 flex items-center justify-center mx-auto mb-3",children:e.jsx(Be,{className:"w-6 h-6 text-green-400"})}),e.jsx("h3",{className:"text-2xl font-bold text-slate-900",children:ee.scheduled}),e.jsx("p",{className:"text-sm text-slate-600",children:"Scheduled"})]})}),e.jsx(se,{onClick:()=>m("published"),className:`border-2 shadow-lg cursor-pointer transition-all ${r==="published"?"border-[var(--brand-primary)]/30 ring-2 ring-[var(--brand-primary)]/20":"border-transparent hover:border-[var(--brand-primary)]/20"}`,"data-testid":"card-published-beatcompetitor",children:e.jsxs(te,{className:"p-6 text-center",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-[rgb(var(--brand-primary-rgb)/0.08)] flex items-center justify-center mx-auto mb-3",children:e.jsx(Qe,{className:"w-6 h-6 text-[var(--brand-primary)]"})}),e.jsx("h3",{className:"text-2xl font-bold text-slate-900",children:ee.published}),e.jsx("p",{className:"text-sm text-slate-600",children:"Published"})]})}),e.jsx(se,{onClick:()=>m("archived"),className:`border-2 shadow-lg cursor-pointer transition-all ${r==="archived"?"border-yellow-200 ring-2 ring-yellow-100":"border-transparent hover:border-yellow-100"}`,"data-testid":"card-archived-beatcompetitor",children:e.jsxs(te,{className:"p-6 text-center",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-yellow-50 flex items-center justify-center mx-auto mb-3",children:e.jsx(Ge,{className:"w-6 h-6 text-yellow-400"})}),e.jsx("h3",{className:"text-2xl font-bold text-slate-900",children:ee.archived}),e.jsx("p",{className:"text-sm text-slate-600",children:"Archived"})]})})]})]}),e.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-6 mb-6 mt-12",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 mb-6",children:[e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:e.jsx("div",{className:"flex items-center border border-gray-200 rounded-lg overflow-hidden",children:(()=>{const s=[...B?[{key:"generating",label:"Generating",icon:k}]:[],{key:"new",label:"Draft",icon:ms},{key:"scheduled",label:"Scheduled",icon:Be},{key:"published",label:"Published",icon:le},{key:"archived",label:"Archived",icon:Ge}],t=s.length-1;return s.map(({key:a,label:l,icon:o},b)=>e.jsxs("button",{onClick:()=>m(a),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium transition-colors ${b<t?"border-r border-gray-200":""} ${r===a?"bg-[var(--brand-primary)] text-white":"bg-white text-gray-700 hover:bg-gray-50"}`,"data-testid":`filter-tab-${a}`,children:[e.jsx(o,{className:`w-4 h-4 ${a==="generating"&&r!=="generating"?"animate-spin":""}`}),l," (",ee[a],")"]},a))})()})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(At,{onSearch:Cs,resetKey:E,loading:Ts,placeholder:"Search by URL",ariaLabel:"Search content",borderClassName:"border-gray-200",className:"w-64 sm:w-80",inputClassName:"text-sm"}
1),(r==="new"||r==="scheduled")&&e.jsxs("div",{className:"flex items-center",children:[e.jsxs(g,{onClick:Xs,disabled:ge.length===0||ue||me,className:"rounded-r-none text-white text-sm px-4 h-9",children:[ue?e.jsx(k,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(H,{className:"w-4 h-4 mr-2"}),ue?"Publishing...":`Publish${f.size>0?` (${ge.length})`:""}`]}),e.jsxs(hs,{children:[e.jsx(xs,{asChild:!0,children:e.jsx(g,{disabled:$.length===0||ue||me,className:"rounded-l-none border-l border-[var(--brand-primary)]/60 text-white px-2 h-9",children:e.jsx(yt,{className:"w-4 h-4"})})}),e.jsx(ps,{align:"end",children:e.jsxs(L,{onClick:et,children:[e.jsx(Le,{className:"w-4 h-4 mr-2"}),r==="scheduled"?"Reschedule":"Schedule"]})})]})]}),r==="published"&&e.jsxs(g,{onClick:Vs,disabled:fe.length===0||Ae,className:"text-white text-sm px-4 h-9",children:[Ae?e.jsx(k,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(oa,{className:"w-4 h-4 mr-2"}),Ae?"Restoring...":`Restore${f.size>0?` (${fe.length})`:""}`]})]})]}),r==="generating"?Q.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-6 bg-white rounded-xl border border-slate-200",children:[e.jsx("div",{className:"w-16 h-16 bg-slate-100 rounded-xl flex items-center justify-center mb-6",children:e.jsx(k,{className:"w-8 h-8 text-slate-400"})}),e.jsx("h3",{className:"text-xl font-semibold text-slate-900 mb-2",children:"No content currently generating"}),e.jsx("p",{className:"text-slate-600 text-center max-w-md",children:"There are no RankFast content jobs in the queue. New drafts will appear here while AI is generating them."})]}):e.jsx("div",{className:"space-y-4",children:Q.map(s=>{const t=s.rankfast_data||{},a=t.url||t.page_url||t.target_url,l=t.keyword||t.target_keyword||t.query;return e.jsx(se,{className:"border border-slate-200 shadow-sm bg-white",children:e.jsx(te,{className:"p-6",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 flex items-center justify-center shrink-0",children:e.jsx(gs,{size:40})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-base font-semibold text-slate-900 truncate",children:l||a||"RankFast content"}),e.jsx("p",{className:"text-sm text-slate-500 truncate",children:a||"AI is rewriting this page to outrank competitors. It will appear under Draft once ready."})]}),e.jsx("span",{className:"px-3 py-1 rounded-full text-xs font-medium bg-orange-50 text-orange-600 capitalize shrink-0",children:String(s.status||"pending").toLowerCase()})]})})},s.id||`${s.rank_fast_id||"job"}-${s.created_at||""}`)})}):ns?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-6 bg-white rounded-xl border border-slate-200",children:[e.jsx("div",{className:"w-16 h-16 bg-slate-100 rounded-xl flex items-center justify-center mb-6",children:e.jsx(k,{className:"w-8 h-8 text-[var(--brand-primary)] animate-spin"})}),e.jsx("h3",{className:"text-xl font-semibold text-slate-900 mb-2",children:"Loading competitor comparisons"}),e.jsx("p",{className:"text-slate-600 text-center max-w-md",children:"Our AI engine is analyzing your domain to identify pages where competitors are outranking you. This may take a few moments..."})]}):G.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-6 bg-white rounded-xl border border-slate-200",children:[e.jsx("div",{className:"w-16 h-16 bg-slate-100 rounded-xl flex items-center justify-center mb-6",children:e.jsx(We,{className:"w-8 h-8 text-slate-400"})}),e.jsx("h3",{className:"text-xl font-semibold text-slate-900 mb-2",children:"No competitor comparisons found"}),e.jsxs("p",{className:"text-slate-600 text-center max-w-md",children:[r==="archived"&&"You haven't archived any competitor comparisons yet.",r==="published"&&"No published content yet. Publish content from the Draft tab to see it here.",r==="scheduled"&&"No scheduled items yet. Schedule content from the Draft tab to see it here.",r==="new"&&"Our AI engine is analyzing your domain to identify pages where competitors are outranking you. Results will appear here once the analysis is complete."]})]}):e.jsx("div",{className:"rounded-lg border border-gray-200 overflow-hidden",children:e.jsxs(Xt,{children:[e.jsx(Vt,{children:e.jsxs(Ue,{children:[e.jsx(z,{className:"pl-4 w-10",children:e.jsx(js,{checked:G.length>0&&f.size===G.length,onCheckedChange:Js,"aria-label":"Select all"})}),e.jsx(z,{className:"w-10 px-1"}),r!=="published"&&r!=="scheduled"&&e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"min-w-[80px] max-w-[130px]",children:e.jsxs("button",{type:"button",onClick:()=>Fe("theirs"),className:"flex items-center gap-1 hover:text-gray-900 transition-colors",children:[e.jsx("span",{children:"Theirs"}),e.jsx(ze,{className:`w-4 h-4 text-gray-400 ${_==="theirs"?"text-gray-600":""}`})]})}),e.jsx(z,{className:"w-10 text-center px-1"})]}),e.jsx(z,{className:"min-w-[80px] max-w-[130px]",children:e.jsxs("button",{type:"button",onClick:()=>Fe("yours"),className:"flex items-center gap-1 hover:text-gray-900 transition-colors",children:[e.jsx("span",{children:"Yours"}),e.jsx(ze,{className:`w-4 h-4 text-gray-400 ${_==="yours"?"text-gray-600":""}`})]})}),e.jsx(z,{className:"w-24 pr-6 text-center",children:"Status"}),e.jsx(z,{className:"w-40 min-w-[9.5rem] pl-2 text-left whitespace-nowrap",children:e.jsxs("button",{type:"button",onClick:()=>Fe("date"),className:"flex items-center justify-start gap-1 hover:text-gray-900 transition-colors",children:[e.jsx("span",{children:r==="scheduled"?"Scheduled Date":r==="published"?"Date Published":"Date Created"}),e.jsx(ze,{className:`w-4 h-4 text-gray-400 ${_==="date"?"text-gray-600":""}`})]})}),e.jsx(z,{className:"w-[1%] text-center pr-4",children:"Actions"})]})}),e.jsx(ea,{children:G.map(s=>e.jsx(lt.Fragment,{children:s.status==="publishing"||s.status==="restoring"?e.jsx(Ue,{id:`page-${s.id}`,className:"bg-[rgb(var(--brand-primary-rgb)/0.04)]",children:e.jsx(U,{colSpan:r==="published"||r==="scheduled"?6:8,className:"py-4",children:e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(gs,{size:20,strokeWidth:3}),e.jsx("span",{className:"font-semibold text-slate-700 text-sm",children:s.status==="publishing"?"Publishing content...":"Restoring content..."})]})})}):e.jsxs(Ue,{id:`page-${s.id}
1`,className:`cursor-pointer hover:bg-gray-50 transition-colors ${s.status==="archived"?"bg-slate-50/50":""}`,onClick:()=>{V(`/rankfast/rankfastpreview/${s.id}`,{state:{origin:"beatcompetitors"}})},children:[e.jsx(U,{className:"pl-4 py-2 align-middle w-10",onClick:t=>t.stopPropagation(),children:e.jsx(js,{checked:f.has(s.id),onCheckedChange:()=>Ws(s.id),"aria-label":`Select row ${s.id}`})}),e.jsx(U,{className:"py-2 align-middle w-10 px-1",onClick:t=>t.stopPropagation(),children:e.jsx("button",{onClick:()=>{V(`/rankfast/rankfastpreview/${s.id}`,{state:{origin:"beatcompetitors"}})},className:"p-1 hover:bg-slate-100 rounded",children:e.jsx(wt,{className:"w-5 h-5"})})}),r!=="published"&&r!=="scheduled"&&e.jsxs(e.Fragment,{children:[e.jsx(U,{className:"py-2 align-middle max-w-[130px]",children:e.jsxs("div",{className:"h-[56px] flex items-center gap-2.5 overflow-hidden",children:[e.jsxs("div",{className:"bg-gray-100 px-2 py-1.5 rounded-md text-center min-w-[34px] flex-shrink-0 border border-gray-200",children:[e.jsx("div",{className:"text-[8px] text-gray-500 font-semibold uppercase tracking-wide",children:"Rank"}),e.jsx("div",{className:"text-sm font-bold text-gray-700 leading-tight",children:s.competitorRank!=null?Math.round(s.competitorRank):"—"})]}),e.jsx("div",{className:"min-w-0 flex-1 overflow-hidden space-y-0.5",children:s.competitorUrl?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[10px] font-medium text-slate-500 truncate",title:s.competitorTitle,children:s.competitorTitle||"—"}),e.jsxs("a",{href:s.competitorUrl,target:"_blank",rel:"noopener noreferrer",className:"group inline-flex items-center gap-1 text-[11px] text-[var(--brand-primary)] hover:text-[var(--brand-primary)]/90 truncate block max-w-full",onClick:t=>t.stopPropagation(),title:s.competitorUrl,children:[e.jsx("span",{className:"truncate",children:s.competitorUrl}),e.jsx(fs,{className:"w-3 h-3 flex-shrink-0 opacity-60 group-hover:opacity-100"})]})]}):e.jsx("span",{className:"text-slate-400 text-xs",children:"—"})})]})}),e.jsx(U,{className:"py-2 align-middle text-center px-1",children:e.jsx("span",{className:"text-base font-bold text-gray-500",children:"VS"})})]}),e.jsx(U,{className:"py-2 align-middle max-w-[130px]",children:e.jsxs("div",{className:"h-[56px] flex items-center gap-2.5 overflow-hidden",children:[e.jsxs("div",{className:"bg-[var(--brand-primary)] px-2 py-1.5 rounded-md text-center min-w-[34px] flex-shrink-0",children:[e.jsx("div",{className:"text-[8px] text-white font-semibold uppercase tracking-wide",children:"Rank"}),e.jsx("div",{className:"text-sm font-bold text-white leading-tight",children:s.rank})]}),e.jsx("div",{className:"min-w-0 flex-1 overflow-hidden space-y-0.5",children:s.url?(()=>{let t="—";try{t=new URL(s.url.startsWith("http")?s.url:`https://${s.url}`).hostname}catch{}return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[10px] font-medium text-slate-500 truncate",title:t,children:t}),e.jsxs("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"group inline-flex items-center gap-1 text-[11px] text-[var(--brand-primary)] hover:text-[var(--brand-primary)]/90 truncate block max-w-full",onClick:a=>a.stopPropagation(),title:s.url,children:[e.jsx("span",{className:"truncate",children:s.url}),e.jsx(fs,{className:"w-3 h-3 flex-shrink-0 opacity-60 group-hover:opacity-100"})]})]})})():e.jsx("span",{className:"text-slate-400 text-xs",children:"—"})})]})}),e.jsx(U,{className:"py-2 align-middle pr-6 text-center",children:e.jsx(Nt,{className:`${Ks(s.status)} text-xs`,children:Hs(s.status)})}),e.jsx(U,{className:"py-2 align-middle whitespace-nowrap pl-2 text-left",children:ma(s,r)}),e.jsx(U,{className:"py-2 pr-4 align-middle whitespace-nowrap w-[1%] text-center",onClick:t=>t.stopPropagation(),children:e.jsxs("div",{className:"flex justify-center gap-2",children:[s.status==="published"&&e.jsx(ia,{pageId:s.pageId,pageTitle:s.title,pageUrl:s.url}),e.jsxs(hs,{children:[e.jsx(xs,{asChild:!0,children:e.jsx(g,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(ca,{className:"w-4 h-4"})})}),e.jsxs(ps,{align:"end",children:[(s.status==="new"||s.status==="pending"||s.status==="approved")&&s.is_content_generated&&e.jsxs(e.Fragment,{children:[e.jsxs(L,{onClick:t=>qs(s.id,t),disabled:w===s.id||ne.isPending,children:[w===s.id?e.jsx(k,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(H,{className:"w-4 h-4 mr-2"}),w===s.id?"Publishing...":"Publish"]}),e.jsxs(L,{onClick:t=>{if(t.stopPropagation(),!D){h(!0);return}u(new Set([s.id])),S(null),d(null),T(!0)},children:[e.jsx(Le,{className:"w-4 h-4 mr-2"}),"Schedule"]})]}),s.status==="scheduled"&&e.jsxs(e.Fragment,{children:[e.jsxs(L,{onClick:t=>nt(s.id,t),disabled:w===s.id||ne.isPending,children:[w===s.id?e.jsx(k,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(H,{className:"w-4 h-4 mr-2"}),w===s.id?"Publishing...":"Publish Now"]}),e.jsxs(L,{onClick:t=>{if(t.stopPropagation(),!D){h(!0);return}u(new Set([s.id])),S(null),d(null),T(!0)},children:[e.jsx(Le,{className:"w-4 h-4 mr-2"}),"Reschedule"]})]}),s.status==="publishing"&&e.jsxs(L,{disabled:!0,children:[e.jsx(k,{className:"w-4 h-4 mr-2 animate-spin"}),"Publishing..."]}),s.status==="published"&&e.jsxs(L,{onClick:t=>Ys(s.id,t),disabled:w===s.id||xe.isPending,children:[w===s.id?e.jsx(k,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(vt,{className:"w-4 h-4 mr-2"}),w===s.id?"Restoring...":"Restore"]}),e.jsxs(L,{onClick:()=>{V(`/rankfast/rankfastpreview/${s.id}`,{state:{origin:"beatcompetitors"}})},children:[e.jsx(Qe,{className:"w-4 h-4 mr-2"}),"View"]}
1),e.jsxs(L,{onClick:()=>Qs(s.id,r==="archived"),children:[e.jsx(Ge,{className:"w-4 h-4 mr-2"}),r==="archived"?"Unarchive":"Archive"]})]})]})]})})]})},s.id))})]})}),r!=="generating"&&!ns&&pe>1&&e.jsx(Kt,{totalItems:cs,totalPages:pe,currentPage:I,itemsPerPage:De,onPageChange:s=>C(s),className:"mt-6",children:e.jsxs(Ht,{children:[e.jsx(bs,{children:e.jsx(Wt,{disabled:I===1,onClick:()=>C(I-1)})}),e.jsx(Jt,{totalPages:pe,currentPage:I,onPageChange:s=>C(s)}),e.jsx(bs,{children:e.jsx(Zt,{disabled:I===pe,onClick:()=>C(I+1)})})]})})]})]})]}),e.jsx(da,{isOpen:ve,onClose:()=>ke(!1)}),e.jsx(ua,{isOpen:Je,onClose:()=>Ce(!1),googleConsoleConnected:As,canConnectGoogle:Ds,onConnectGoogle:_s,rankFastLimit:Bs}),e.jsx(kt,{isOpen:q,onClose:()=>ce(!1),serviceType:"rankfast",returnUrl:"/rankfast/beatcompetitors"}),e.jsx(ie,{open:R,onOpenChange:W,children:e.jsxs(oe,{children:[e.jsxs(ye,{children:[e.jsxs(we,{className:"flex items-center gap-2 text-2xl",children:[e.jsx(le,{className:"w-6 h-6 text-green-600"}),"Purchase Successful!"]}),e.jsx(Ne,{className:"pt-4",children:"Your RankFast trial subscription has been activated successfully. You can now start analyzing competitors and improving your rankings!"})]}),e.jsx("div",{className:"py-6",children:e.jsxs("div",{className:"bg-green-50 rounded-lg p-6 border border-green-200",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-12 h-12 bg-green-100 rounded-full flex items-center justify-center",children:e.jsx(H,{className:"w-6 h-6 text-green-600"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-slate-900",children:"You're all set!"}),e.jsx("p",{className:"text-sm text-slate-600",children:"Your trial plan is now active"})]})]}),e.jsxs("div",{className:"space-y-2 text-sm text-slate-700",children:[e.jsxs("p",{className:"flex items-center gap-2",children:[e.jsx(le,{className:"w-4 h-4 text-green-600"}),"Start comparing your pages with competitors"]}),e.jsxs("p",{className:"flex items-center gap-2",children:[e.jsx(le,{className:"w-4 h-4 text-green-600"}),"Get AI-powered content recommendations"]}),e.jsxs("p",{className:"flex items-center gap-2",children:[e.jsx(le,{className:"w-4 h-4 text-green-600"}),"Track your ranking improvements"]})]})]})}),e.jsx(He,{children:e.jsx(g,{onClick:()=>{W(!1),window.location.reload()},className:"bg-green-600 hover:bg-green-700 w-full",children:"Get Started"})})]})}),e.jsx(ie,{open:Re,onOpenChange:st,children:e.jsxs(oe,{className:"max-w-lg mx-auto bg-white rounded-lg shadow-xl border-0 p-0 max-h-[90vh] overflow-y-auto",children:[e.jsxs(ye,{className:"px-8 pt-8 pb-4",children:[e.jsx(we,{className:"text-2xl font-bold text-gray-900",children:r==="scheduled"?"Reschedule Publishing":"Schedule Publishing"}),e.jsx(Ne,{className:"text-gray-600 text-base mt-2",children:$.length===1?"1 item is ready to be scheduled for publishing.":`${$.length} items are ready to be scheduled for publishing.`})]}),e.jsxs("div",{className:"px-8 pb-6",children:[e.jsx("div",{className:"bg-[rgb(var(--brand-primary-rgb)/0.08)] border border-[var(--brand-primary)]/20 rounded-lg p-4 mb-6",children:e.jsx("p",{className:"text-sm text-[var(--brand-primary)]",children:"Choose how to schedule your content. Even Distribution spreads all selected pages across your remaining billing cycle automatically, or you can pick one specific date for all of them."})}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs(g,{onClick:tt,variant:p==="even"?"default":"outline",className:p==="even"?"flex-1 bg-[var(--brand-primary)] hover:bg-[var(--brand-primary)]/90 text-white h-auto py-4 flex flex-col items-center gap-2":"flex-1 border-2 border-[var(--brand-primary)]/20 text-[var(--brand-primary)] hover:bg-[rgb(var(--brand-primary-rgb)/0.08)] h-auto py-4 flex flex-col items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed","data-testid":"button-even-scheduler",children:[e.jsx(Ct,{className:"w-6 h-6"}),e.jsx("span",{className:"font-semibold",children:"Even Distribution"}),e.jsx("span",{className:"text-xs opacity-90",children:"Spread across billing cycle"})]}),e.jsxs(g,{onClick:at,variant:p==="date"?"default":"outline",className:p==="date"?"flex-1 bg-[var(--brand-primary)] hover:bg-[var(--brand-primary)]/90 text-white h-auto py-4 flex flex-col items-center gap-2":"flex-1 border-2 border-[var(--brand-primary)]/20 text-[var(--brand-primary)] hover:bg-[rgb(var(--brand-primary-rgb)/0.08)] h-auto py-4 flex flex-col items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed","data-testid":"button-manual-scheduler",children:[e.jsx(Be,{className:"w-6 h-6"}),e.jsx("span",{className:"font-semibold",children:"Specific Date"}),e.jsx("span",{className:"text-xs opacity-90",children:"Pick one date for all"})]})]}),p==="date"&&e.jsx("div",{className:"mt-6 pt-6 border-t border-gray-200",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(sa,{mode:"single",selected:P,onSelect:d,disabled:s=>{const t=new Date;t.setHours(0,0,0,0);const a=new Date(s);if(a.setHours(0,0,0,0),a<t)return!0;
1if(is){const l=new Date(is);return l.setHours(0,0,0,0),a>l}return!1},className:"rounded-md border border-gray-200","data-testid":"calendar-manual-schedule"})})}),e.jsx(na,{count:$.length,scheduleMode:p,entityLabel:"pages"}),p&&e.jsx(g,{onClick:rt,disabled:p==="date"&&!P||me,className:p==="date"&&$.length>=Oe?"w-full mt-6 bg-amber-600 hover:bg-amber-700 text-white disabled:opacity-50":"w-full mt-6 bg-[var(--brand-primary)] hover:bg-[var(--brand-primary)]/90 text-white disabled:opacity-50","data-testid":"button-confirm-schedule",children:me?e.jsxs(e.Fragment,{children:[e.jsx(k,{className:"w-4 h-4 mr-2 animate-spin"}),"Scheduling..."]}):p==="date"&&$.length>=Oe?"Schedule anyway":p==="date"?`Schedule for ${P?P.toLocaleDateString("en-US",{month:"short",day:"numeric"}):"Selected Date"}`:r==="scheduled"?"Confirm Reschedule":"Confirm Schedule"})]})]})}),e.jsx(ra,{open:!!A,onClose:()=>M(null),status:A?.status||"success",title:A?.title||"",description:A?.description||""}),e.jsx(la,{open:!!Z,onOpenChange:s=>!s&&_e(null),onConfirm:()=>{const s=Z?.onConfirm;_e(null),s?.()},count:Z?.count??0,action:Z?.action??"publish",entityLabel:"pages"}),e.jsx(St,{isOpen:Pe,onClose:()=>h(!1),projectName:he?.url||he?.name}),e.jsx(Pt,{error:Ss,onClose:Ps})]})};export{or 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.