1var $s=Object.defineProperty;var Ls=(t,s,n)=>s in t?$s(t,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[s]=n;var Mt=(t,s,n)=>Ls(t,typeof s!="symbol"?s+"":s,n);import{o as xe,s as ne,S as Y,e as ht,j as e,g as Xe,U as Se,bt as st,E as Oe,bu as Es,r as y,$ as _t,ao as Ds,a2 as Rs,aA as Ie,bv as Ms,t as V,b2 as St,ab as $e,aj as kt,aM as ss,b4 as Re,aO as ns,aK as qs,d as Be,m as ke,Z as Hs,aB as lt,bw as zs,bo as qt,a0 as Os,W as Te,bg as Ws,bf as De,ba as Ht,bn as dt,aH as Tt,b3 as It,aF as Bt,R as ee,bi as nt,bx as Gs,bb as Ge,a$ as Fs,aI as Vs,aC as Pe,by as Ys,aE as ut,k as mt,aY as At,aX as Us,b8 as bt,bz as Qs,bA as zt,a5 as Fe,bB as jt,a_ as Ks,O as as,b5 as Xs,b1 as is,bc as wt,a9 as Js,aS as Zs}from"./vendor-BNYS6O0P.js";import{B as b,S as se,a as ye,T as en,l as tn,m as sn,n as nn,o as an,u as rs,p as rn,q as on,i as cn,G as ln}from"./index-Cz5nqbOF.js";import{u as Pt,a as dn,b as un,p as mn,c as os}from"./whos-reading_GET.schema-BoJ68sZC.js";import{S as pn,A as hn,u as $t,a as gt,b as xt,c as Lt,d as Et,e as Dt,f as Rt,C as _n,P as gn,g as xn,h as fn,W as yn,i as vn,p as jn,j as bn}from"./companyFeatureGating-D9UDSHKH.js";import{I as Je}from"./Input-DeO5_FHm.js";import{C as cs}from"./Checkbox-D6n6KZ_o.js";import{P as wn,R as Nn,I as Cn}from"./Progress-BG3n-GMw.js";import{C as Ze,c as et,a as tt}from"./track-upgrade_POST.schema-CmfcpC40.js";import{A as ls}from"./Alert-DJwJMaUi.js";import{u as Sn,a as ft,b as kn,c as Tn}from"./distributionQueries-DfxX7mvZ.js";import{S as pt}from"./Spinner-rZ3rPfTC.js";import{T as ds}from"./Textarea-CiALNPLo.js";import{u as us,a as In}from"./articleImpactQueries-DtA5vGn9.js";import{R as ms,T as ps,C as hs}from"./index-G5Dlxm2X.js";import{u as Bn,A as An}from"./AgentChat-BjIPe29N.js";import{u as Pn}from"./useEngagementHooks-Di4zXSeA.js";import{T as $n,a as Ln,b as Ot,c as Wt}from"./Tabs-PYoc5Jta.js";import{F as En}from"./FileDropzone-B8uX2SlI.js";import{u as Dn}from"./useCredentialStatus-DYit0anT.js";import{A as Rn}from"./AutoComplete-Bilrzzm-.js";import{P as Z}from"./index-CzHFL2Ar.js";import{C as Mn}from"./bookingConfig-CrT8H8EY.js";import{u as qn}from"./useEmailVerification-l00FNg9P.js";import"./list_GET.schema-CRFsuwqm.js";import"./update_POST.schema-B2Jrn7C7.js";import"./Dialog-ljeldCbq.js";import"./Form-BfXFNinA.js";import"./MarkdownToolbar-Dq0EtSHy.js";import"./sanitizeHtml-BIoLLaSn.js";import"./Select-RxvDqAVw.js";import"./Switch-Ck5qAHOy.js";import"./Popover-DuJoDZee.js";const Hn=xe({profileId:ne().uuid("Invalid Profile ID format")}),zn=async(t,s)=>{const n=Hn.parse(t),a=new URLSearchParams({profileId:n.profileId}),i=await fetch(`/_api/subscription/usage?${a.toString()}`,{method:"GET",...s,headers:{"Content-Type":"application/json"}});if(!i.ok){const r=Y.parse(await i.text());throw new Error(r.error)}return Y.parse(await i.text())},On=t=>["usage",t.profileId],Wn=(t,s)=>ht({queryKey:On(t),queryFn:()=>zn(t),enabled:!!t.profileId&&!0,staleTime:60*1e3}),Gn="_bannerContainer_gjy0e_1",Fn="_header_gjy0e_11",Vn="_warningIcon_gjy0e_18",Yn="_title_gjy0e_22",Un="_subtext_gjy0e_29",Qn="_reviewCard_gjy0e_38",Kn="_factGrid_gjy0e_47",Xn="_factItem_gjy0e_54",Jn="_fullWidth_gjy0e_60",Zn="_factLabel_gjy0e_64",ea="_factValue_gjy0e_72",ta="_viewFullLink_gjy0e_79",sa="_linkIcon_gjy0e_96",na="_actions_gjy0e_100",aa="_publishButton_gjy0e_107",ia="_editButton_gjy0e_118",ra="_footerNote_gjy0e_122",X={bannerContainer:Gn,header:Fn,warningIcon:Vn,title:Yn,subtext:Un,reviewCard:Qn,factGrid:Kn,factItem:Xn,fullWidth:Jn,factLabel:Zn,factValue:ea,viewFullLink:ta,linkIcon:sa,actions:na,publishButton:aa,editButton:ia,footerNote:ra},oa=({profile:t,onPublish:s,isPublishing:n=!1,className:a=""})=>{if(t.isPublished)return null;const i=t.experience,r=t.primaryCompany||(i&&i.length>0?i[0].company:"Not specified"),o=t.contactInfo?.location||"Not specified",c=t.bio||t.summaryStatement||"No summary available.",N=c.length>200?`${c.substring(0,200)}...`:c,_=`/profile/${t.slug}`;return e.jsxs("div",{className:`${X.bannerContainer} ${a}`,children:[e.jsxs("div",{className:X.header,children:[e.jsx(Xe,{className:X.warningIcon,size:24}),e.jsx("h2",{className:X.title,children:"Your Profile Draft Needs Review"})]}),e.jsx("p",{className:X.subtext,children:"We built this from public data â before we submit it to Google, ChatGPT, Perplexity, and other AI platforms, please confirm the information below is correct. We may have pulled data about a different person with the same name."}),e.jsxs("div",{className:X.reviewCard,children:[e.jsxs("div",{className:X.factGrid,children:[e.jsxs("div",{className:X.factItem,children:[e.jsx("span",{className:X.factLabel,children:"Name"}),e.jsx("span",{className:X.factValue,children:t.name})]}),e.jsxs("div",{className:X.factItem,children:[e.jsx("span",{className:X.factLabel,children:"Title"}),e.jsx("span",{className:X.factValue,children:t.title||"Not specified"})]}),e.jsxs("div",{className:X.factItem,children:[e.jsx("span",{className:X.factLabel,children:"Primary Company"}),e.jsx("span",{className:X.factValue,children:r})]}),e.jsxs("div",{className:X.factItem,children:[e.jsx("span",{className:X.factLabel,children:"Location"}),e.jsx("span",{className:X.factValue,children:o})]}),e.jsxs("div",{className:`${X.factItem} ${X.fullWidth}`,children:[e.jsx("span",{className:X.factLabel,children:"Bio"}),e.jsx("span",{className:X.factValue,children:N})]})]}),e.jsxs(Se,{to:_,className:X.viewFullLink,children:["View full profile ",e.jsx(st,{size:14,className:X.linkIcon})]})]}),e.jsxs("div",{className:X.actions,children:[e.jsxs(b,{onClick:s,disabled:n,className:X.publishButton,size:"lg",children:[e.jsx(Oe,{size:18}),n?"Publishing...":"This Is Correct â Publish My Profile"]}),e.jsx(b,{asChild:!0,variant:"outline",size:"lg",className:X.editButton,disabled:n,children:e.jsxs(Se,{to:_,children:[e.jsx(Es,{size:18}),"Edit Profile First"]})})]}),e.jsx("p",{className:X.footerNote,children:"Your profile won't appear in search results or AI responses until you publish."})]})},ca="_container_154gf_2",la="_header_154gf_14",da="_title_154gf_20",ua="_subtitle_154gf_28",ma="_list_154gf_34",pa="_stepItem_154gf_40",ha="_stepHighlighted_154gf_51",_a="_stepComplete_154gf_57",ga="_stepIndicator_154gf_68",xa="_numberBadge_154gf_76",fa="_numberBadgeActive_154gf_89",ya="_checkIcon_154gf_94",va="_stepContent_154gf_100",ja="_stepHeader_154gf_107",ba="_stepIcon_154gf_113",wa="_stepTitle_154gf_121",Na="_stepDescription_154gf_128",Ca="_stepAction_154gf_135",Sa="_questionInputContainer_154gf_142",ka="_questionInput_154gf_142",Ta="_completedQuestion_154gf_157",Ia="_completedQuestionText_154gf_167",Ba="_completedQuestionIcon_154gf_173",Aa="_allDoneState_154gf_178",Pa="_celebrationIcon_154gf_190",$a="_celebrationTitle_154gf_195",La="_celebrationText_154gf_202",J={container:ca,header:la,title:da,subtitle:ua,list:ma,stepItem:pa,stepHighlighted:ha,stepComplete:_a,stepIndicator:ga,numberBadge:xa,numberBadgeActive:fa,checkIcon:ya,stepContent:va,stepHeader:ja,stepIcon:ba,stepTitle:wa,stepDescription:Na,stepAction:Ca,questionInputContainer:Sa,questionInput:ka,completedQuestion:Ta,completedQuestionText:Ia,completedQuestionIcon:Ba,allDoneState:Aa,celebrationIcon:Pa,celebrationTitle:$a,celebrationText:La},Ea=({profileSlug:t,profileId:s,profileName:n,isClaimed:a,articleCount:i,hasReviewedArticles:r,targetQuestions:d,hasSubmittedSuccessStory:o,hasImportedContent:c=!1,hasCheckedVisitors:N=!1,onSaveTargetQuestion:_,onSeeArticles:g,onSeeVisitors:m,onClaimProfile:h,onRunAgent:v,onImportContent:w,onShareComplete:T,className:P=""})=>{const[l,x]=y.useState(!1),[j,E]=y.useState(!1),[u,C]=y.useState(""),[O,A]=y.useState(!1);y.useEffect(()=>{s&&(x(localStorage.getItem(`visipage_shared_${s}`)==="true"),E(localStorage.getItem(`visipage_agent_run_${s}`)==="true"))},[s]);const ie=async()=>{const D=`${window.location.origin}/profile/${t}`;if(navigator.share)try{await navigator.share({title:`${n} - Professional Profile`,text:`Check out ${n}'s AI-optimized professional page.`,url:D}),$()}catch{}else try{await navigator.clipboard.writeText(D),V.success("Link copied to clipboard!"),$()}catch{V.error("Failed to copy link.")}},$=()=>{localStorage.setItem(`visipage_shared_${s}`,"true"),x(!0),T?.()},F=()=>{v(),localStorage.setItem(`visipage_agent_run_${s}`,"true"),E(!0)},ae=async()=>
1{if(!(!u.trim()||!_)){A(!0);try{await _(u),C("")}catch{V.error("Failed to save question.")}finally{A(!1)}}},U=[{id:"live",title:"Your page is live!",description:"Your professional page is up and running on the internet.",isComplete:!0,action:e.jsx(b,{asChild:!0,variant:"outline",size:"sm",children:e.jsx(Se,{to:`/profile/${t}`,children:"See Your Page â"})}),icon:_t},{id:"target_questions",title:"ð¯ Tell us the questions you want to own",description:"What are the questions you want people to ask AI â and get YOUR company as the answer?",isComplete:!!d&&d.length>0,action:d&&d.length>0?e.jsxs("div",{className:J.completedQuestion,children:[e.jsx(Ie,{className:J.completedQuestionIcon,size:16}),e.jsxs("span",{className:J.completedQuestionText,children:['"',d[0].question,'"']})]}):e.jsxs("div",{className:J.questionInputContainer,children:[e.jsx(Je,{value:u,onChange:D=>C(D.target.value),placeholder:"e.g. What are the best jobs in software engineering?",className:J.questionInput,onKeyDown:D=>{D.key==="Enter"&&(D.preventDefault(),ae())}}),e.jsx(b,{onClick:ae,variant:"primary",size:"sm",disabled:!u.trim()||O,children:O?"Saving...":"Save"})]}),icon:Ds},{id:"read",title:"Read what we wrote about you",description:"We wrote some articles to show your expertise. Take a look!",isComplete:r,action:e.jsx(b,{onClick:g,variant:r?"outline":"primary",size:"sm",disabled:i===0,children:i===0?"Writing articles...":"Read Articles"}),icon:Rs}];a||U.push({id:"claim",title:"Claim your profile",description:"This tells Google and AI that this page is really yours.",isComplete:!1,action:e.jsx(b,{onClick:h,variant:"primary",size:"sm",children:"Claim Profile"}),icon:St}),U.push({id:"import_content",title:"Import your own bio or content",description:"Have a polished bio? Upload a PDF or paste your text to use your own words.",isComplete:c,action:c?e.jsx(b,{disabled:!0,variant:"outline",size:"sm",children:"Content Imported â"}):e.jsx(b,{onClick:w,variant:"primary",size:"sm",children:"Import Content"}),icon:$e}),U.push({id:"share",title:"Share your page with someone",description:"The more people see your page, the faster Google learns about you.",isComplete:l,action:e.jsx(b,{onClick:ie,variant:l?"outline":"primary",size:"sm",children:"Share Page"}),icon:kt}),U.push({id:"visitors",title:"See who's visiting your profile and articles",description:"We track who reads your profile and articles. You can reveal their identity and send them a personalized email.",isComplete:N,action:e.jsx(b,{onClick:m,variant:N?"outline":"primary",size:"sm",children:"See Visitors"}),icon:ss}),U.push({id:"agent",title:"Let your agent keep working",description:"Your AI agent can write more articles and put you on more websites. Just click the button!",isComplete:j,action:e.jsx(b,{onClick:F,variant:j?"outline":"primary",size:"sm",children:"Run Agent"}),icon:Re}),U.push({id:"featured",title:"Get featured â share your story",description:"Tell us how Visipage helped you and earn 50 free credits!",isComplete:!!o,action:o?e.jsx(b,{disabled:!0,variant:"outline",size:"sm",children:"Story Submitted â"}):e.jsx(b,{asChild:!0,variant:"primary",size:"sm",children:e.jsx(Se,{to:"/dashboard/success-story",children:"Share Your Story"})}),icon:ns});const k=U.every(D=>D.isComplete),L=U.findIndex(D=>!D.isComplete);return e.jsxs("div",{className:`${J.container} ${P}`,children:[e.jsxs("div",{className:J.header,children:[e.jsx("h2",{className:J.title,children:"Here's your game plan ð¯"}),e.jsx("p",{className:J.subtitle,children:"Just follow these steps â we'll do the hard part."})]}),k?e.jsxs("div",{className:J.allDoneState,children:[e.jsx("div",{className:J.celebrationIcon,children:e.jsx(Ms,{size:48})}),e.jsx("h3",{className:J.celebrationTitle,children:"You're all set! ð"}),e.jsx("p",{className:J.celebrationText,children:"Your agent is working behind the scenes. You can come back anytime to check on your progress."})]}):e.jsx("div",{className:J.list,children:U.map((D,W)=>{const pe=W===L,z=D.icon;return e.jsxs("div",{className:` 2 ${J.stepItem} 3 ${D.isComplete?J.stepComplete:""} 4 ${pe?J.stepHighlighted:""} 5 `,children:[e.jsx("div",{className:J.stepIndicator,children:D.isComplete?e.jsx(Ie,{className:J.checkIcon}):e.jsx("div",{className:`${J.numberBadge} ${pe?J.numberBadgeActive:""}`,children:W+1})}),e.jsxs("div",{className:J.stepContent,children:[e.jsxs("div",{className:J.stepHeader,children:[e.jsx(z,{className:J.stepIcon,size:18}),e.jsx("h4",{className:J.stepTitle,children:D.title})]}),e.jsx("p",{className:J.stepDescription,children:D.description})]}),e.jsx("div",{className:J.stepAction,children:D.action})]},D.id)})})]})},Da=xe({profileId:ne().uuid("Invalid profile ID")}),Ra=async(t,s)=>{const n=Da.parse(t),a=new URLSearchParams({profileId:n.profileId}),i=await fetch(`/_api/profiles/identity-checklist?${a.toString()}`,{method:"GET",...s,headers:{"Content-Type":"application/json"}}),r=await i.text();if(!i.ok){let d="Failed to fetch identity checklist";try{const o=Y.parse(r);o.error&&(d=o.error)}catch{}throw new Error(d)}return Y.parse(r)},Ma=xe({profileId:ne().uuid("Invalid profile ID"),itemKey:ne().min(1,"Item key cannot be empty"),completed:qs()}),qa=async(t,s)=>{const n=Ma.parse(t),a=await fetch("/_api/profiles/identity-checklist/update",{method:"POST",body:Y.stringify(n),...s,headers:{"Content-Type":"application/json"}}),i=await a.text();if(!a.ok){let r="Failed to update identity checklist";try{const d=Y.parse(i);d.error&&(r=d.error)}catch{}throw new Error(r)}return Y.parse(i)},Ha=t=>ht({queryKey:["identity-checklist",t],queryFn:()=>
5{if(!t)throw new Error("Profile ID is required");return Ra({profileId:t})},enabled:!!t}),za=t=>{const s=Be();return ke({mutationFn:n=>{if(!t)throw new Error("Profile ID is required");return qa({profileId:t,itemKey:n.itemKey,completed:n.completed})},onSuccess:()=>{t&&s.invalidateQueries({queryKey:["identity-checklist",t]})},onError:n=>{console.error("Failed to update checklist item:",n),V.error(n instanceof Error?n.message:"An unknown error occurred while updating the checklist.")}})},Oa="_container_pthf4_2",Wa="_header_pthf4_13",Ga="_headerTop_pthf4_19",Fa="_headerContent_pthf4_26",Va="_title_pthf4_32",Ya="_subtitle_pthf4_40",Ua="_expandTrigger_pthf4_46",Qa="_chevron_pthf4_50",Ka="_chevronOpen_pthf4_56",Xa="_progressContainer_pthf4_60",Ja="_progressInfo_pthf4_66",Za="_progressLabel_pthf4_74",ei="_progressValue_pthf4_78",ti="_progressBar_pthf4_83",si="_checklistContent_pthf4_87",ni="_section_pthf4_94",ai="_sectionTitle_pthf4_100",ii="_sectionSubtitle_pthf4_109",ri="_divider_pthf4_115",oi="_stepList_pthf4_121",ci="_stepItem_pthf4_127",li="_stepComplete_pthf4_138",di="_stepTitleLabel_pthf4_143",ui="_stepDescription_pthf4_144",mi="_stepIndicator_pthf4_158",pi="_autoCheckIcon_pthf4_166",hi="_autoCircleIcon_pthf4_172",_i="_stepDetails_pthf4_179",gi="_stepDetailsHeader_pthf4_186",xi="_stepIcon_pthf4_201",fi="_howToContainer_pthf4_214",yi="_howToTrigger_pthf4_218",vi="_howToChevron_pthf4_237",ji="_howToChevronOpen_pthf4_243",bi="_howToContent_pthf4_247",wi="_howToList_pthf4_258",Ni="_howToText_pthf4_270",M={container:Oa,header:Wa,headerTop:Ga,headerContent:Fa,title:Va,subtitle:Ya,expandTrigger:Ua,chevron:Qa,chevronOpen:Ka,progressContainer:Xa,progressInfo:Ja,progressLabel:Za,progressValue:ei,progressBar:ti,checklistContent:si,section:ni,sectionTitle:ai,sectionSubtitle:ii,divider:ri,stepList:oi,stepItem:ci,stepComplete:li,stepTitleLabel:di,stepDescription:ui,stepIndicator:mi,autoCheckIcon:pi,autoCircleIcon:hi,stepDetails:_i,stepDetailsHeader:gi,stepIcon:xi,howToContainer:fi,howToTrigger:yi,howToChevron:vi,howToChevronOpen:ji,howToContent:bi,howToList:wi,howToText:Ni},Ci=({profileId:t,profileName:s,profileType:n,className:a=""})=>{const[i,r]=y.useState(!1),{data:d,isLoading:o,isError:c}=Ha(t),N=za(t);if(o)return e.jsx("div",{className:`${M.container} ${a}`,children:e.jsxs("div",{className:M.header,children:[e.jsx(se,{style:{width:"60%",height:"1.5rem"}}),e.jsx(se,{style:{width:"80%",height:"1rem"}}),e.jsx("div",{className:M.progressContainer,children:e.jsx(se,{style:{width:"100%",height:"0.5rem"}})})]})});if(c||!d)return null;const _=d.autoDetected,g=d.manualProgress,m=[{id:"website",title:"Link your official website",description:"Your official website helps search engines verify your identity.",howTo:"Go to your profile settings and add your website URL.",isCompleted:!!_.hasOfficialWebsite,icon:_t},{id:"social",title:"Connect your social profiles",description:"Social profiles create a web of identity signals.",howTo:"Add your LinkedIn, Twitter/X, and other social profiles to your page.",isCompleted:!!_.hasSocialLinks,icon:Hs},{id:"claim",title:"Claim your Visipage profile",description:"Claiming tells Google this page is officially yours.",howTo:"Visit your public profile page and click the 'Claim' button.",isCompleted:!!_.isClaimed,icon:St},{id:"disambiguation",title:"Add a disambiguation statement",description:"This helps AI distinguish you from others with similar names.",howTo:"Your agent can create this for you â just ask in the chat.",isCompleted:!!_.hasDisambiguation,icon:$e},{id:"articles",title:`Publish at least 3 knowledge articles (${Math.min(_.articleCount||0,3)} of 3 published)`,description:"Articles build authoritative content signals.",howTo:void 0,isCompleted:(_.articleCount||0)>=3,icon:$e}],h=[{itemKey:"sharedOnSocial",title:"Share your profile on social media",description:"Social shares create backlinks that boost your authority.",howTo:void 0,isCompleted:!!g.sharedOnSocial,icon:kt},{itemKey:"searchedGoogle",title:"Search for yourself on Google",description:"Check if Google shows the right information about you.",howTo:"Search your full name on Google. Look at the results â is the information accurate? If not, your Visipage agent can help fix this.",isCompleted:!!g.searchedGoogle,icon:lt},{itemKey:"knowledgePanelClaimed",title:"Claim your Google Knowledge Panel",description:"A Knowledge Panel is the box Google shows about you on the right side of search results.",howTo:["Search your name on Google while logged into your Google account.","If you see a Knowledge Panel (a box on the right side), click the three dots menu.","Select 'Claim this knowledge panel'.","Verify your identity by connecting an official account (your website via Search Console, YouTube, LinkedIn, etc.).","You may need to provide a government-issued ID.","Once approved, you can suggest edits to your description and photo."],isCompleted:!!g.knowledgePanelClaimed,icon:zs}];n==="person"?h.push({itemKey:"wikidataCreated",title:"Create a Wikidata entry",description:"Google uses Wikidata to populate Knowledge Panels â this is one of the most powerful steps.",howTo:["Go to wikidata.org and create a free account.","Click 'Create a new Item'.","Set the label to your full name and add a de
5scription like 'American entrepreneur and founder of [Company]'.","Add properties: occupation, employer, official website, notable works.","Every claim needs a reference â use published articles, books, or press mentions.","Important: Do NOT use your own website as the only source. Use independent, reliable sources like news articles or book listings."],isCompleted:!!g.wikidataCreated,icon:qt}):n==="company"&&(h.push({itemKey:"googleBusinessProfile",title:"Set up your Google Business Profile",description:"A Google Business Profile can trigger Google to create a Knowledge Panel for your company.",howTo:["Go to business.google.com.","Click 'Add your business'.","Enter your company name and address.","Choose the right category (e.g., 'Research Organization' or 'Business Consulting').","Verify ownership â Google will send a postcard, call, or use Search Console.","Once verified, fill in your description, hours, website, and add photos."],isCompleted:!!g.googleBusinessProfile,icon:Os}),h.push({itemKey:"wikidataOrgCreated",title:"Create a Wikidata entry for your organization",description:"Wikidata feeds directly into Google's Knowledge Graph.",howTo:["Go to wikidata.org and create a free account.","Click 'Create a new Item'.","Set the label to your organization name.","Add a description like 'American [industry] organization founded by [founder name]'.","Add properties: official website, founder, headquarters location, industry.","Back each claim with reliable, independent sources (press coverage, business registrations, news articles)."],isCompleted:!!g.wikidataOrgCreated,icon:qt}));const v=m.length+h.length,w=m.filter(l=>l.isCompleted).length+h.filter(l=>l.isCompleted).length,T=Math.round(w/v*100),P=(l,x)=>{N.mutate({itemKey:l,completed:x})};return e.jsx("div",{className:`${M.container} ${a}`,children:e.jsxs(Ze,{open:i,onOpenChange:r,children:[e.jsxs("div",{className:M.header,children:[e.jsxs("div",{className:M.headerTop,children:[e.jsxs("div",{className:M.headerContent,children:[e.jsx("h2",{className:M.title,children:"Strengthen Your Identity Across the Web"}),e.jsx("p",{className:M.subtitle,children:"Complete these steps to help Google and AI platforms recognize you correctly."})]}),e.jsx(et,{asChild:!0,children:e.jsxs(b,{variant:"outline",size:"sm",className:M.expandTrigger,children:[i?"Hide checklist":"View checklist",e.jsx(Te,{className:`${M.chevron} ${i?M.chevronOpen:""}`})]})})]}),e.jsxs("div",{className:M.progressContainer,children:[e.jsxs("div",{className:M.progressInfo,children:[e.jsxs("span",{className:M.progressLabel,children:[w," of ",v," steps complete"]}),e.jsxs("span",{className:M.progressValue,children:[T,"%"]})]}),e.jsx(wn,{value:T,className:M.progressBar})]})]}),e.jsx(tt,{children:e.jsxs("div",{className:M.checklistContent,children:[e.jsxs("div",{className:M.section,children:[e.jsx("h3",{className:M.sectionTitle,children:"Auto-detected"}),e.jsx("p",{className:M.sectionSubtitle,children:"We track these automatically based on your profile completion."}),e.jsx("div",{className:M.stepList,children:m.map(l=>e.jsx(Gt,{isAuto:!0,step:l},l.id))})]}),e.jsx("div",{className:M.divider}),e.jsxs("div",{className:M.section,children:[e.jsx("h3",{className:M.sectionTitle,children:"Manual Actions"}),e.jsx("p",{className:M.sectionSubtitle,children:"Check these off once you've completed them outside of Visipage."}),e.jsx("div",{className:M.stepList,children:h.map(l=>e.jsx(Gt,{isAuto:!1,step:l,onToggle:x=>P(l.itemKey,x),disabled:N.isPending},l.itemKey))})]})]})})]})})},Gt=({isAuto:t,step:s,onToggle:n,disabled:a})=>{const[i,r]=y.useState(!1),d=s.icon;return e.jsxs("div",{className:`${M.stepItem} ${s.isCompleted?M.stepComplete:""}`,children:[e.jsx("div",{className:M.stepIndicator,children:t?s.isCompleted?e.jsx(Ie,{className:M.autoCheckIcon}):e.jsx(Ws,{className:M.autoCircleIcon}):e.jsx(cs,{id:`step-${s.itemKey}`,checked:s.isCompleted,onChange:o=>n?.(o.target.checked),disabled:a})}),e.jsxs("div",{className:M.stepDetails,children:[e.jsxs("div",{className:M.stepDetailsHeader,children:[e.jsx("label",{htmlFor:t?void 0:`step-${s.itemKey}`,className:M.stepTitleLabel,children:s.title}),d&&e.jsx(d,{className:M.stepIcon,size:16})]}),e.jsx("p",{className:M.stepDescription,children:s.description}),s.howTo&&e.jsxs(Ze,{open:i,onOpenChange:r,className:M.howToContainer,children:[e.jsxs(et,{className:M.howToTrigger,type:"button",children:["How to do this",e.jsx(Te,{className:`${M.howToChevron} ${i?M.howToChevronOpen:""}`})]}),e.jsx(tt,{children:e.jsx("div",{className:M.howToContent,children:Array.isArray(s.howTo)?e.jsx("ol",{className:M.howToList,children:s.howTo.map((o,c)=>e.jsx("li",{children:o},c))}):e.jsx("p",{className:M.howToText,children:s.howTo})})})]})]})]})};function Si(t){return t>80?{zone:"gold",statusText:"Visipage made you visible! ð",heading:"
5ð Visipage did it! Here's how we keep you on top:",steps:[{title:"ð¡ï¸ Protecting your visibility",desc:"We make sure you stay visible and don't slip."},{title:"ð° Publishing fresh content",desc:"New articles keep search engines paying attention to you. (you can read and change them)"},{title:"ð Staying ahead of competitors",desc:"We monitor who else is showing up and keep you in front."}],reassurance:"Sit back â Visipage has this covered.",ctaText:"Keep Visipage Working For Me â"}:t>60?{zone:"green",statusText:"Visipage is working! â
",heading:"Visipage got you here! Want to go even higher?",steps:[{title:"ð Targeting bigger websites",desc:"We're now aiming for the most popular sites in your industry."},{title:"ð¤ Getting more AI assistants to recommend you",desc:"We're working on making every smart assistant know your name."},{title:"ð Keeping everything fresh",desc:"We update your articles so you always look current. (you can read and change them)"}],reassurance:"You're doing great â Visipage keeps working for you automatically.",ctaText:"Keep Visipage Working For Me â"}:t>30?{zone:"yellow",statusText:"Visipage is building your presence â¡",heading:"Visipage is making progress! Here's what's next:",steps:[{title:"ð Writing more articles about you",desc:"More articles = more chances for people to find you. (you can read and change them)"},{title:"ð Spreading your name to more websites",desc:"We're adding you to even more popular websites."},{title:"ð Boosting your visibility higher",desc:"Every week, we push your name higher in search results."}],reassurance:"You're on the right track. One click and your agent keeps going.",ctaText:"Let Visipage Fix This For Me â"}:{zone:"red",statusText:"We're getting started ð§",heading:"Here's what Visipage is doing for you right now:",steps:[{title:"ð Writing expert articles about you",desc:"We write articles that make you look great online. (you can read and change them)"},{title:"ð Putting your name on trusted websites",desc:"We place your articles on popular sites so Google notices you."},{title:"ð¤ Teaching AI assistants about you",desc:"We make sure ChatGPT and other smart tools know who you are."}],reassurance:"You don't have to do anything. Just click the button below and we handle everything.",ctaText:"Let Visipage Fix This For Me â"}}const ki="_container_1truo_2",Ti="_goalBanner_1truo_13",Ii="_goalText_1truo_25",Bi="_goalBadge_1truo_35",Ai="_goalPrompt_1truo_45",Pi="_question_1truo_51",$i="_scoreDisplay_1truo_59",Li="_progressBarWrapper_1truo_65",Ei="_progressRoot_1truo_69",Di="_progressIndicator_1truo_79",Ri="_zoneRed_1truo_86",Mi="_zoneYellow_1truo_87",qi="_zoneGreen_1truo_88",Hi="_zoneGold_1truo_89",zi="_statusLabel_1truo_92",Oi="_statusTextWrapper_1truo_97",Wi="_scoreNumber_1truo_104",Gi="_stepsContainer_1truo_114",Fi="_stepsHeading_1truo_120",Vi="_stepList_1truo_127",Yi="_stepItem_1truo_133",Ui="_stepContent_1truo_142",Qi="_stepTitle_1truo_148",Ki="_stepDesc_1truo_155",Xi="_reassurance_1truo_162",Ji="_bossReassurance_1truo_172",Zi="_ctaWrapper_1truo_178",er="_noChargeText_1truo_186",tr="_workingPanel_1truo_191",sr="_workingHeader_1truo_199",nr="_workingSpinner_1truo_208",ar="_simulatedStepList_1truo_212",ir="_simulatedStep_1truo_212",rr="_completePanel_1truo_237",or="_completeHeader_1truo_252",cr="_completeTitle_1truo_259",lr="_statusBadge_1truo_266",dr="_resultSteps_1truo_270",ur="_resultStepItem_1truo_276",mr="_resultStepMessage_1truo_284",pr="_articleCandidatesSection_1truo_288",hr="_candidatesTitle_1truo_294",_r="_candidatesList_1truo_301",gr="_dismissButton_1truo_311",xr="_errorPanel_1truo_315",fr="_errorHeader_1truo_331",yr="_errorTitle_1truo_337",vr="_errorMessageText_1truo_344",jr="_successIcon_1truo_350",br="_warningIcon_1truo_351",wr="_errorIcon_1truo_352",I={container:ki,goalBanner:Ti,goalText:Ii,goalBadge:Bi,goalPrompt:Ai,question:Pi,scoreDisplay:$i,progressBarWrapper:Li,progressRoot:Ei,progressIndicator:Di,zoneRed:Ri,zoneYellow:Mi,zoneGreen:qi,zoneGold:Hi,statusLabel:zi,statusTextWrapper:Oi,scoreNumber:Wi,stepsContainer:Gi,stepsHeading:Fi,stepList:Vi,stepItem:Yi,stepContent:Ui,stepTitle:Qi,stepDesc:Ki,reassurance:Xi,bossReassurance:Ji,ctaWrapper:Zi,noChargeText:er,workingPanel:tr,workingHeader:sr,workingSpinner:nr,simulatedStepList:ar,
5simulatedStep:ir,completePanel:rr,completeHeader:or,completeTitle:cr,statusBadge:lr,resultSteps:dr,resultStepItem:ur,resultStepMessage:mr,articleCandidatesSection:pr,candidatesTitle:hr,candidatesList:_r,dismissButton:gr,errorPanel:xr,errorHeader:fr,errorTitle:yr,errorMessageText:vr,successIcon:jr,warningIcon:br,errorIcon:wr},Nr=({score:t,primaryTargetQuestion:s,additionalGoalsCount:n=0,onFixThis:a,className:i=""})=>{const[r,d]=y.useState("idle"),[o,c]=y.useState(null),[N,_]=y.useState(null),g=async()=>{d("running"),_(null);try{const j=await a();c(j),d("complete")}catch(j){_(j instanceof Error?j.message:"An unknown error occurred."),d("error")}},m=Si(t),v={red:I.zoneRed,yellow:I.zoneYellow,green:I.zoneGreen,gold:I.zoneGold}[m.zone]||I.zoneRed,{statusText:w,heading:T,steps:P,reassurance:l,ctaText:x}=m;return e.jsxs("div",{className:`${I.container} ${i}`,children:[s?e.jsxs("div",{className:I.goalBanner,children:[e.jsxs("span",{className:I.goalText,children:["ð¯ Your primary visibility goal: Be the answer when people ask: ",e.jsxs("em",{children:['"',s,'"']})]}),n>0&&e.jsxs("span",{className:I.goalBadge,children:["+",n," more goals"]})]}):e.jsx("div",{className:I.goalPrompt,children:"Set the questions you want to be THE answer for â"}),e.jsx("h2",{className:I.question,children:"How easy is it for people to find you online?"}),e.jsxs("div",{className:I.scoreDisplay,children:[e.jsx("div",{className:I.progressBarWrapper,children:e.jsx(Nn,{className:I.progressRoot,value:t,children:e.jsx(Cn,{className:`${I.progressIndicator} ${v}`,style:{transform:`translateX(-${100-t}%)`}})})}),e.jsxs("div",{className:I.statusTextWrapper,children:[e.jsxs("span",{className:I.scoreNumber,children:[t,"/100"]}),e.jsx("span",{className:`${I.statusLabel} ${v}`,children:w})]})]}),e.jsxs("div",{className:I.stepsContainer,children:[e.jsx("h3",{className:I.stepsHeading,children:T}),e.jsx("div",{className:I.stepList,children:P.map((j,E)=>e.jsx("div",{className:I.stepItem,children:e.jsxs("div",{className:I.stepContent,children:[e.jsx("h4",{className:I.stepTitle,children:j.title}),e.jsx("p",{className:I.stepDesc,children:j.desc})]})},E))}),e.jsx("div",{className:I.reassurance,children:l}),e.jsx("p",{className:I.bossReassurance,children:"ð Remember: you can review and edit everything we do. You're the boss."}),(r==="idle"||r==="running")&&e.jsxs("div",{className:I.ctaWrapper,children:[e.jsx(b,{onClick:g,size:"lg",className:I.fixButton,disabled:r==="running",children:r==="running"?e.jsxs(e.Fragment,{children:[e.jsx(De,{className:"animate-spin",size:16})," Working..."]}):x}),e.jsx("span",{className:I.noChargeText,children:"No extra charge â this is part of your plan."})]}),r==="running"&&e.jsxs("div",{className:I.workingPanel,children:[e.jsxs("div",{className:I.workingHeader,children:[e.jsx(De,{className:`animate-spin ${I.workingSpinner}`,size:18}),"Your agent is working..."]}),e.jsxs("div",{className:I.simulatedStepList,children:[e.jsxs("div",{className:I.simulatedStep,children:[e.jsx(De,{className:"animate-spin",size:14})," Publishing your profile..."]}),e.jsxs("div",{className:I.simulatedStep,children:[e.jsx(De,{className:"animate-spin",size:14})," Discovering visibility opportunities..."]}),e.jsxs("div",{className:I.simulatedStep,children:[e.jsx(De,{className:"animate-spin",size:14})," Finding article topics to write..."]})]})]}),r==="complete"&&o&&e.jsxs("div",{className:I.completePanel,children:[e.jsxs("div",{className:I.completeHeader,children:[o.summary.overallStatus==="success"&&e.jsx(Ht,{className:I.successIcon,size:20}),o.summary.overallStatus==="partial"&&e.jsx(Xe,{className:I.warningIcon,size:20}),o.summary.overallStatus==="failed"&&e.jsx(dt,{className:I.errorIcon,size:20}),e.jsx("h4",{className:I.completeTitle,children:"Agent update complete"}),e.jsx(ye,{variant:o.summary.overallStatus==="success"?"success":o.summary.overallStatus==="partial"?"warning":"destructive",className:I.statusBadge,children:o.summary.overallStatus==="success"?"All done â":o.summary.overallStatus==="partial"?"Partially complete":"Issues encountered"})]}),e.jsx("div",{className:I.resultSteps,children:o.steps.map((j,E)=>e.jsxs("div",{className:I.resultStepItem,children:[j.status==="completed"&&e.jsx(Ht,{className:I.successIcon,size:16}),j.status==="skipped"&&e.jsx(Tt,{className:I.warningIcon,size:16}),j.status==="failed"&&e.jsx(dt,{className:I.errorIcon,size:16}),e.jsx("span",{className:I.resultStepMessage,children:j.message})]},E))}),o.articleCandidates&&o.articleCandidates.length>0&&e.jsxs("div",{className:I.articleCandidatesSection,children:[e.jsxs("p",{className:I.candidatesTitle,children:["Found ",o.articleCandidates.length," article topics:"]}),e.jsx("ul",{className:I.candidatesList,children:o.articleCandidates.map(j=>e.jsx("li",{children:j.question},j.id))})]}
5),e.jsx(b,{className:I.dismissButton,variant:"outline",onClick:()=>d("idle"),children:"Got it"})]}),r==="error"&&e.jsxs("div",{className:I.errorPanel,children:[e.jsxs("div",{className:I.errorHeader,children:[e.jsx(Xe,{className:I.errorIcon,size:20}),e.jsx("h4",{className:I.errorTitle,children:"Something went wrong"})]}),e.jsx("p",{className:I.errorMessageText,children:N}),e.jsx(b,{variant:"outline",onClick:()=>d("idle"),children:"Try Again"})]})]})]})},Cr="_container_minhy_2",Sr="_heading_minhy_12",kr="_grid_minhy_20",Tr="_card_minhy_38",Ir="_cardHeader_minhy_48",Br="_platformName_minhy_54",Ar="_infoButton_minhy_60",Pr="_infoIcon_minhy_74",$r="_statusRow_minhy_79",Lr="_dot_minhy_85",Er="_dotGreen_minhy_92",Dr="_dotYellow_minhy_97",Rr="_dotRed_minhy_102",Mr="_statusText_minhy_107",qr="_mechanismText_minhy_112",Hr="_appearanceRate_minhy_119",zr="_snippet_minhy_125",Or="_actionButton_minhy_141",Wr="_actionLink_minhy_146",Gr="_summaryLine_minhy_164",ce={container:Cr,heading:Sr,grid:kr,card:Tr,cardHeader:Ir,platformName:Br,infoButton:Ar,infoIcon:Pr,statusRow:$r,dot:Lr,dotGreen:Er,dotYellow:Dr,dotRed:Rr,statusText:Mr,mechanismText:qr,appearanceRate:Hr,snippet:zr,actionButton:Or,actionLink:Wr,summaryLine:Gr},Fr={chatgpt:"The AI assistant millions use daily. It can now recommend you when asked.",claude:"An AI assistant popular with professionals and researchers.",perplexity:"A popular AI search tool that people use for research.",gemini:"Google's AI assistant built into Search and Android.",grok:"The AI on X (formerly Twitter).",google_ai_overview:"Google's AI-generated summaries that appear at the top of search results."},Vr={chatgpt:"ChatGPT",claude:"Claude",perplexity:"Perplexity",gemini:"Gemini",grok:"Grok",google_ai_overview:"Google AI Overviews"},Yr={chatgpt:"ChatGPT recognizes you but needs more corroborating sources indexed by Bing. Distributing your articles creates the cross-references it uses to build citation confidence.",claude:"Claude has seen your name but needs more high-authority references. Publishing structured content across professional platforms strengthens its confidence.",perplexity:"Perplexity found you but needs more real-time web signals. Distributing articles to news sites and authoritative blogs improves your search visibility.",gemini:"Gemini recognizes you but needs more signals from Google-indexed sources. Sharing your articles across Google-crawled platforms creates the citation paths Gemini relies on.",grok:"Grok has partial data on you. Distributing content to real-time web sources and social platforms increases your entity signals.",google_ai_overview:"Google AI Overviews has seen your name but needs stronger web signals. Publishing authoritative content that ranks well in Google Search increases your chance of being featured."},Ur={chatgpt:"ChatGPT hasn't encountered enough of your content yet. Your agent can publish articles to Bing-indexed sites to establish your entity.",claude:"Claude hasn't indexed your entity yet. Publishing structured content across high-authority domains will put you on its radar.",perplexity:"Perplexity hasn't found enough about you yet. Distributing articles to authoritative blogs and news sources will build your presence.",gemini:"Gemini hasn't picked up your entity yet. Publishing to Google-indexed platforms and submitting URLs for indexing will establish your presence.",grok:"Grok doesn't have enough data on you yet. Publishing to real-time web sources and social platforms will create the signals it needs.",google_ai_overview:"Google AI Overviews hasn't picked up your entity yet. Publishing high-quality content and improving your search rankings will help Google feature you."},Qr="This platform recognizes you but needs more corroborating sources. Distributing your articles strengthens citation confidence.",Kr="This platform hasn't encountered enough of your content yet. Publishing articles across the web will establish your entity.",Xr=["chatgpt","claude","perplexity","gemini","grok","google_ai_overview"],Jr=({profileId:t,latestArticleId:s,bySource:n,recentChecks:a=[],onWriteArticle:i,
5className:r="",googleOverviewAppearanceRate:d})=>{const o=Sn(),c=Object.keys(n).length>0?Object.keys(n):Xr,N=c.filter(_=>n[_]?.status==="good").length;return e.jsxs("div",{className:`${ce.container} ${r}`,children:[e.jsx("h3",{className:ce.heading,children:"Where People Can Find You Now"}),e.jsx("div",{className:ce.grid,children:e.jsx(en,{children:c.map(_=>{const g=n[_],m=g?.status||"bad",h=g?.rate,v=_==="google_ai_overview"?d??g?.overviewAppearanceRate:void 0,w=Fr[_]||"A popular platform where people can discover you.",T=Vr[_]||_;let P="Not yet recognized",l=ce.dotRed,x=Ur[_]||Kr;m==="good"?(P="Can recommend you â
",l=ce.dotGreen,x="Actively cites your content when people ask about your expertise."):(m==="warning"||m==="pending")&&(_==="google_ai_overview"&&h!==void 0?P=`Mentioned in ${h}% of overviews`:P="Needs more signals",l=ce.dotYellow,x=Yr[_]||Qr);const j=a.find(C=>C.source===T&&C.mentioned),E=j?.responseText?j.responseText.length>80?j.responseText.substring(0,80)+"...":j.responseText:null,u=o.isPending&&o.variables?.platformDisplayName===T;return e.jsxs("div",{className:ce.card,children:[e.jsxs("div",{className:ce.cardHeader,children:[e.jsx("span",{className:ce.platformName,children:T}),e.jsxs(tn,{children:[e.jsx(sn,{asChild:!0,children:e.jsx("button",{className:ce.infoButton,"aria-label":`Info about ${T}`,children:e.jsx(Tt,{className:ce.infoIcon})})}),e.jsx(nn,{side:"top",children:w})]})]}),e.jsxs("div",{className:ce.statusRow,children:[e.jsx("span",{className:`${ce.dot} ${l}`}),e.jsx("span",{className:ce.statusText,children:P})]}),e.jsx("div",{className:ce.mechanismText,children:x}),v!==void 0&&_==="google_ai_overview"&&e.jsxs("div",{className:ce.appearanceRate,children:["Google shows AI Overviews for ",v,"% of queries about you"]}),m==="good"&&E&&e.jsxs("div",{className:ce.snippet,children:['"',E,'"']}),(m==="warning"||m==="pending")&&e.jsx(b,{variant:"outline",size:"sm",className:ce.actionButton,disabled:!s||o.isPending,onClick:()=>{s&&o.mutate({profileId:t,articleId:s,platformDisplayName:T})},children:u?e.jsx(pt,{size:"sm"}):`Boost ${T} Visibility`}),m==="bad"&&e.jsx(e.Fragment,{children:s?e.jsx(b,{variant:"primary",size:"sm",className:ce.actionButton,disabled:o.isPending,onClick:()=>{o.mutate({profileId:t,articleId:s,platformDisplayName:T})},children:u?e.jsx(pt,{size:"sm"}):`Boost ${T}`}):i&&e.jsx("button",{className:ce.actionLink,onClick:i,type:"button",children:"ð Write an article first"})})]},_)})})}),e.jsxs("div",{className:ce.summaryLine,children:[N," out of ",c.length," platforms can recommend you."]})]})},Zr="_container_h56pr_1",eo="_skeletonScore_h56pr_7",to="_skeletonMap_h56pr_12",it={container:Zr,skeletonScore:eo,skeletonMap:to},so=({profileId:t,profileName:s,profileTitle:n,profileLocation:a,targetQuestions:i,latestArticleId:r,onFixThis:d,className:o})=>{const{data:c,isLoading:N,isError:_,error:g}=Pt(t);let m=null,h=0;if(Array.isArray(i)&&i.length>0){const l=[...i].sort((x,j)=>x.priority-j.priority);m=l[0].question,h=l.length-1}if(_)return e.jsx(ls,{variant:"error",title:"Oops! We couldn't check what AI knows.",className:o,children:g instanceof Error?g.message:"Something went wrong."});if(N||!c)return e.jsxs("section",{className:`${it.container} ${o||""}`,children:[e.jsx(se,{className:it.skeletonScore}),e.jsx(se,{className:it.skeletonMap})]});const{mentionRate:v,bySource:w,recentChecks:T}=c,P=()=>{d().catch(()=>{})};return e.jsxs("section",{className:`${it.container} ${o||""}`,children:[e.jsx(Nr,{score:Math.round(v),profileTitle:n||null,profileLocation:a||null,primaryTargetQuestion:m,additionalGoalsCount:h,onFixThis:d}),e.jsx(Jr,{profileId:t,latestArticleId:r,bySource:w,recentChecks:T,onWriteArticle:P,googleOverviewAppearanceRate:w.google_ai_overview?.overviewAppearanceRate})]})},no="_container_16aya_2",ao="_line_16aya_12",io="_emptyText_16aya_19",ro="_trendText_16aya_26",Ee={container:no,line:ao,emptyText:io,trendText:ro},oo=({profileId:t,className:s})=>{const{data:n,isLoading:a,isError:i}=us({profileId:t});if(a)return e.jsxs("div",{className:`${Ee.container} ${s||""}`,children:[e.jsx(se,{style:{height:"1.5rem",width:"80%"}}
5),e.jsx(se,{style:{height:"1.5rem",width:"60%"}}),e.jsx(se,{style:{height:"1.25rem",width:"40%"}})]});if(i||!n)return null;const{aggregated:r}=n,d=r.viewsCurrent30Days||0,o=r.viewsPrevious30Days||0;if(d===0&&o===0)return e.jsx("div",{className:`${Ee.container} ${s||""}`,children:e.jsx("p",{className:Ee.emptyText,children:"ð Your articles are brand new â numbers show up in a few days"})});let c="";if(o>0){const N=Math.round((d-o)/o*100);N>0?c=`â ${N}% from last month`:N<0&&(c=`â ${Math.abs(N)}% from last month`)}return e.jsxs("div",{className:`${Ee.container} ${s||""}`,children:[e.jsxs("p",{className:Ee.line,children:["ð ",e.jsxs("strong",{children:[d," people"]})," read your articles this month"]}),r.topPerformingArticleTitle&&e.jsxs("p",{className:Ee.line,children:["ð Best one: '",r.topPerformingArticleTitle,"'"]}),c&&e.jsx("p",{className:Ee.trendText,children:c})]})},co="_container_w5wji_2",lo="_headerButton_w5wji_9",uo="_content_w5wji_19",mo="_line_w5wji_27",po="_emptyText_w5wji_34",ho="_trendText_w5wji_41",Ne={container:co,headerButton:lo,content:uo,line:mo,emptyText:po,trendText:ho},_o=({profileId:t,className:s})=>{const{data:n,isLoading:a,isError:i}=In({profileId:t});if(a)return e.jsx("div",{className:`${Ne.container} ${s||""}`,children:e.jsx(se,{style:{height:"2.5rem",width:"100%"}})});if(i||!n)return null;const{totalCtaClicks:r,totalInterestsCaptured:d,interestTrendPercent:o}=n;if(r===0&&d===0)return e.jsx("div",{className:`${Ne.container} ${s||""}`,children:e.jsxs(Ze,{defaultOpen:!0,children:[e.jsx(et,{asChild:!0,children:e.jsx(b,{variant:"ghost",className:Ne.headerButton,children:"ð Your Talent Impact"})}),e.jsx(tt,{children:e.jsx("div",{className:Ne.content,children:e.jsx("p",{className:Ne.emptyText,children:"This shows up once people start reading"})})})]})});let c="";return o&&(o>0?c=`â ${o}% from last month`:o<0&&(c=`â ${Math.abs(o)}% from last month`)),e.jsx("div",{className:`${Ne.container} ${s||""}`,children:e.jsxs(Ze,{defaultOpen:!0,children:[e.jsx(et,{asChild:!0,children:e.jsx(b,{variant:"ghost",className:Ne.headerButton,children:"ð Your Talent Impact"})}),e.jsx(tt,{children:e.jsxs("div",{className:Ne.content,children:[e.jsxs("p",{className:Ne.line,children:["ðï¸ ",e.jsxs("strong",{children:[r," people"]})," clicked to your careers page"]}),e.jsxs("p",{className:Ne.line,children:["ð¼ ",e.jsxs("strong",{children:[d," people"]})," said 'I want to work here'"]}),c&&e.jsx("p",{className:Ne.trendText,children:c})]})})]})})},go="_container_1wb24_1",xo="_adminBanner_1wb24_7",fo="_requestSection_1wb24_16",yo="_requestHeading_1wb24_26",vo="_requestTextarea_1wb24_33",jo="_requestActions_1wb24_37",bo="_writeButton_1wb24_44",wo="_requestHint_1wb24_54",No="_typeYourOwnLink_1wb24_60",Co="_generationStatus_1wb24_75",So="_step_1wb24_84",ko="_stepPending_1wb24_91",To="_stepActive_1wb24_96",Io="_stepDone_1wb24_102",Bo="_header_1wb24_112",Ao="_heading_1wb24_118",Po="_subheading_1wb24_125",$o="_emptyState_1wb24_131",Lo="_list_1wb24_141",Eo="_card_1wb24_147",Do="_cardContent_1wb24_170",Ro="_cardTitle_1wb24_177",Mo="_articleImpact_1wb24_185",qo="_impactPrimary_1wb24_192",Ho="_shareNudgeButton_1wb24_197",zo="_cardPreview_1wb24_215",Oo="_cardMeta_1wb24_226",Wo="_cardDate_1wb24_232",Go="_cardActions_1wb24_238",Fo="_deleteLink_1wb24_252",Vo="_showMoreButton_1wb24_273",Yo="_placementsLine_1wb24_278",Uo="_placementsLabel_1wb24_287",Qo="_placementsList_1wb24_291",Ko="_placementItem_1wb24_297",Xo="_placementLink_1wb24_302",Jo="_placementText_1wb24_313",Zo="_statusDot_1wb24_320",ec="_dotGreen_1wb24_327",tc="_dotYellow_1wb24_328",sc="_dotGray_1wb24_329",nc="_comma_1wb24_331",q={container:go,adminBanner:xo,requestSection:fo,requestHeading:yo,requestTextarea:vo,requestActions:jo,writeButton:bo,requestHint:wo,typeYourOwnLink:No,generationStatus:Co,step:So,stepPending:ko,stepActive:To,stepDone:Io,header:Bo,heading:Ao,subheading:Po,emptyState:$o,list:Lo,card:Eo,cardContent:Do,cardTitle:Ro,articleImpact:Mo,impactPrimary:qo,shareNudgeButton:Ho,cardPreview:zo,cardMeta:Oo,cardDate:Wo,cardActions:Go,deleteLink:Fo,showMoreButton:Vo,placementsLine:Yo,placementsLabel:Uo,placementsList:Qo,placementItem:Ko,placementLink:Xo,placementText:Jo,statusDot:Zo,dotGreen:ec,dotYellow:tc,dotGray:sc,comma:nc},ac=t=>t?t.replace(/[#_*\[\]()<>`~]/g,"").trim():"",ic=t=>{if(!t)return"";const s=new Date(t);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric"}).format(s)},rc=["Reading your input","Researching the topic","Writing the article...","Optimizing for search","Publishing"],oc=({articles:t,placements:s,profileSlug:n,className:a,profileId:i,profileName:r,isManaging:d=!1,managedProfileName:o})=>{const[c,N]=y.useState(!1),[_,g]=y.useState(!1),[m,h]=y.useState(null),[v,w]=y.useState(null),[T,P]=It(),[l,x]=y.useState(""),[j,E]=y.useState(!1),[u,C]=y.useState(0),O=dn(),A=un(),{data:ie}=us({profileId:i||""});y.useEffect(()=>{const L=T.get("suggestedTopic");
5L&&(x(decodeURIComponent(L)),P(D=>(D.delete("suggestedTopic"),D),{replace:!0}))},[T,P]),y.useEffect(()=>{if(!j)return;const L=setInterval(()=>{C(D=>D<4?D+1:D)},6e3);return()=>clearInterval(L)},[j]);const $=()=>{!l.trim()||!i||(E(!0),C(0),A.mutate({profileId:i,topic:l,contentType:"supporting"},{onSuccess:L=>{E(!1),h(L.id),g(!0),x("")},onError:()=>{E(!1)}}))},F=L=>{window.confirm("Are you sure you want to delete this article? This action cannot be undone.")&&O.mutate({id:L})},ae=L=>{h(L),g(!0)},U=c?t:t.slice(0,5),k=t.length>5;return e.jsxs("div",{className:`${q.container} ${a||""}`,children:[d&&o&&e.jsxs("div",{className:q.adminBanner,children:["ð You're writing on behalf of ",o]}),e.jsxs("div",{className:q.requestSection,children:[e.jsx("h3",{className:q.requestHeading,children:"ð Tell us what to write about"}),e.jsx(ds,{value:l,onChange:L=>x(L.target.value),placeholder:"Example: We just opened a new office in Miami",disabled:j,className:q.requestTextarea}),j?e.jsx("div",{className:q.generationStatus,children:rc.map((L,D)=>{let W="â",pe=q.stepPending;return D<u?(W="â
",pe=q.stepDone):D===u&&(W="â³",pe=q.stepActive),e.jsxs("div",{className:`${q.step} ${pe}`,children:[e.jsx("span",{className:q.stepIcon,children:W}),e.jsx("span",{children:L})]},D)})}):e.jsxs("div",{className:q.requestActions,children:[e.jsx(b,{variant:"primary",size:"lg",className:q.writeButton,onClick:$,disabled:!l.trim()||!i,children:"Write It â¨"}),e.jsx("p",{className:q.requestHint,children:"Takes about 30 seconds. You can edit it after."}),e.jsx("button",{onClick:()=>ae(null),className:q.typeYourOwnLink,children:"or type your own â"})]})]}),i&&e.jsx(oo,{profileId:i}),e.jsxs("div",{className:q.header,children:[e.jsx("h2",{className:q.heading,children:"ð Everything Visipage Wrote About You"}),e.jsx("p",{className:q.subheading,children:"You can read, edit, or delete any article. You're the boss."})]}),t.length===0?e.jsx("div",{className:q.emptyState,children:e.jsx("p",{children:"Your agent hasn't written any articles yet. They will soon!"})}):e.jsxs("div",{className:q.list,children:[U.map(L=>{const D=ac(L.content||""),W=D.length>150?D.substring(0,150)+"...":D,z=ie?.articles.find(he=>he.id===L.id)?.totalViews||0;let de="",ue="",be=!1;z===0?(de="â
Published & live",ue="ð£ Share it to get readers â",be=!0):z<=5?(de=`ð ${z} people read this`,ue="ð£ Share to reach more â",be=!0):z<=20?(de=`ð ${z} readers so far`,ue="ð£ Keep sharing â",be=!0):de=`ð¥ ${z} people read this!`;const re=s?.filter(he=>he.articleId===L.id)||[];return e.jsxs("div",{className:q.card,children:[e.jsxs("div",{className:q.cardContent,children:[e.jsx("h3",{className:q.cardTitle,children:L.title}),e.jsxs("div",{className:q.articleImpact,children:[e.jsx("span",{className:q.impactPrimary,children:de}),be&&e.jsx("button",{className:q.shareNudgeButton,onClick:()=>w(L),children:ue})]}),e.jsx("p",{className:q.cardPreview,children:W}),re.length>0&&e.jsxs("div",{className:q.placementsLine,children:[e.jsx("span",{className:q.placementsLabel,children:"Published on:"}),e.jsx("div",{className:q.placementsList,children:re.map((he,Me)=>{const Ye=Me===re.length-1;let Ae=q.dotGray;he.status==="live"&&(Ae=q.dotGreen),he.status==="draft"&&(Ae=q.dotYellow);const Ue=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:`${q.statusDot} ${Ae}`,title:he.status}),he.platformName]});return e.jsxs("span",{className:q.placementItem,children:[he.externalUrl?e.jsx("a",{href:he.externalUrl,target:"_blank",rel:"noopener noreferrer",className:q.placementLink,children:Ue}):e.jsx("span",{className:q.placementText,children:Ue}),!Ye&&e.jsx("span",{className:q.comma,children:", "})]},he.id)})})]}),e.jsx("div",{className:q.cardMeta,children:e.jsxs("span",{className:q.cardDate,children:["Written on ",ic(L.createdAt)]})})]}),e.jsxs("div",{className:q.cardActions,children:[e.jsx(b,{onClick:()=>ae(L.id),variant:"primary",size:"sm",children:"Read & Edit â"}),e.jsx("button",{onClick:()=>F(L.id),className:q.deleteLink,disabled:O.isPending,children:"Delete"})]})]},L.id)}),k&&!c&&e.jsx(b,{variant:"outline",onClick:()=>N(!0),className:q.showMoreButton,children:"Show more articles"})]}),i&&e.jsx(_o,{profileId:i}),e.jsx(pn,{isOpen:_,onClose:()=>g(!1),articleId:m,profileId:i}),v&&e.jsx(hn,{isOpen:!!v,onClose:()=>w(null),articleTitle:v.title,articleSlug:v.slug,profileSlug:n||"",profileName:r||""})]})},cc=xe({placementId:ne().uuid()}),lc=async(t,s)=>{const n=cc.parse(t),a=await fetch("/_api/distribution/mark-posted",{method:"POST",body:Y.stringify(n),...s,headers:{"Content-Type":"application/json"}}),i=await a.text();if(!a.ok){const r=Y.parse(i);throw new Error(r.error)}return Y.parse(i)},_s=()=>{const t=Be();return ke({mutationFn:async s=>await lc(s),onSuccess:()=>{t.invalidateQueries({queryKey:["placements"]}),V.success("Placement marked as posted.")},onError:s=>{V.error(`Failed to mark placement as posted: ${s.message}`)}})},dc="_container_1n8do_2",uc="_trigger_1n8do_8",mc="_icon_1n8do_28",pc="_content_1n8do_33",hc="_explanationBox_1n8do_45",He={container:dc,trigger:uc,icon:mc,content:pc,explanationBox:hc},We=({explanation:t,className:s=""})=>{const[n,a]=y.useState(!1);
5return e.jsxs(ms,{open:n,onOpenChange:a,className:`${He.container} ${s}`,children:[e.jsxs(ps,{className:He.trigger,children:["Why does this matter?",n?e.jsx(Bt,{className:He.icon}):e.jsx(Te,{className:He.icon})]}),e.jsx(hs,{className:He.content,children:e.jsx("div",{className:He.explanationBox,children:t})})]})},_c="_container_1xqux_2",gc="_headerGroup_1xqux_12",xc="_heading_1xqux_18",fc="_articleSummary_1xqux_26",yc="_timeline_1xqux_32",vc="_feedItem_1xqux_39",jc="_timelineLine_1xqux_48",bc="_feedContent_1xqux_76",wc="_feedHeader_1xqux_82",Nc="_feedDate_1xqux_87",Cc="_feedText_1xqux_95",Sc="_readLink_1xqux_106",kc="_expandButton_1xqux_118",Tc="_expandIcon_1xqux_136",Ic="_expandableList_1xqux_141",Bc="_placementLink_1xqux_157",Ac="_externalIcon_1xqux_171",Pc="_whyMattersWrapper_1xqux_176",$c="_draftsList_1xqux_180",Lc="_showMoreDraftsButton_1xqux_189",Ec="_draftItem_1xqux_194",Dc="_draftTitle_1xqux_205",Rc="_emptyState_1xqux_214",Mc="_pagination_1xqux_221",qc="_paginationText_1xqux_230",H={container:_c,headerGroup:gc,heading:xc,articleSummary:fc,timeline:yc,feedItem:vc,timelineLine:jc,feedContent:bc,feedHeader:wc,feedDate:Nc,feedText:Cc,readLink:Sc,expandButton:kc,expandIcon:Tc,expandableList:Ic,placementLink:Bc,externalIcon:Ac,whyMattersWrapper:Pc,draftsList:$c,showMoreDraftsButton:Lc,draftItem:Ec,draftTitle:Dc,emptyState:Rc,pagination:Mc,paginationText:qc},Hc=({articles:t,livePlacements:s,draftPlacements:n,isPublished:a,onPostDraft:i,profileSlug:r,className:d=""})=>{const[o,c]=y.useState(!1),[N,_]=y.useState(!1),[g,m]=y.useState(1),h=5,v=Math.ceil(t.length/h),w=y.useMemo(()=>{const T=[];if(t.slice((g-1)*h,g*h).forEach(l=>{T.push({id:`article-${l.id}`,timestamp:new Date(l.createdAt).getTime(),render:()=>e.jsxs("div",{className:H.feedItem,children:[e.jsx("div",{className:H.timelineLine}),e.jsxs("div",{className:H.feedContent,children:[e.jsx("div",{className:H.feedHeader,children:e.jsx("span",{className:H.feedDate,children:Ft(l.createdAt)})}),e.jsxs("p",{className:H.feedText,children:["ð Your agent wrote an article: ",e.jsxs("strong",{children:['"',l.title,'"']})]}),r&&l.slug&&e.jsx(Se,{to:`/profile/${r}/knowledge/${l.slug}`,className:H.readLink,children:"Read this article â"}),e.jsx(We,{explanation:"This article shows search engines and smart assistants that you're an expert. You can read and change this article anytime â it's yours."})]})]})})}),s.length>0){const l=Math.max(...s.map(x=>new Date(x.createdAt).getTime()));T.push({id:"grouped-placements",timestamp:l,render:()=>e.jsxs("div",{className:H.feedItem,children:[e.jsx("div",{className:H.timelineLine}),e.jsxs("div",{className:H.feedContent,children:[e.jsx("div",{className:H.feedHeader,children:e.jsx("span",{className:H.feedDate,children:Ft(new Date(l).toISOString())})}),e.jsxs("p",{className:H.feedText,children:["ð¤ Your articles were published on ",e.jsxs("strong",{children:[s.length," websites"]})]}),e.jsxs(ms,{open:o,onOpenChange:c,children:[e.jsxs(ps,{className:H.expandButton,children:["View websites",o?e.jsx(Bt,{className:H.expandIcon}):e.jsx(Te,{className:H.expandIcon})]}),e.jsx(hs,{className:H.expandableList,children:s.map(x=>e.jsxs("a",{href:x.externalUrl,target:"_blank",rel:"noopener noreferrer",className:H.placementLink,children:[x.platformName," ",e.jsx(st,{className:H.externalIcon})]},x.id))})]}),e.jsx("div",{className:H.whyMattersWrapper,children:e.jsx(We,{explanation:"Each website is like putting your business card in a different coffee shop. The more places your name appears, the more people discover you. If you ever want to remove your name from a site, just tell your agent."})})]})]})})}if(a){const l=t.length>0?new Date(t[0].createdAt).getTime()+1e3:Date.now();T.push({id:"published-status",timestamp:l,render:()=>e.jsxs("div",{className:H.feedItem,children:[e.jsx("div",{className:H.timelineLine}),e.jsxs("div",{className:H.feedContent,children:[e.jsxs("p",{className:H.feedText,children:["ð ",e.jsx("strong",{children:"Google and Bing can now find your articles"})]}),e.jsx(We,{explanation:"When someone types your specialty into Google, your articles can now appear in the results. If you ever want to pause, just tell your agent."})]})]})})}if(n.length>0){const l=Math.max(...n.map(E=>new Date(E.createdAt).getTime())),x=N?n:n.slice(0,3),j=n.length-3;T.push({id:"drafts",timestamp:l+2e3,render:()=>e.jsxs("div",{className:H.feedItem,children:[e.jsx("div",{className:H.timelineLine}),e.jsxs("div",{className:H.feedContent,children:[e.jsx("div",{className:H.feedHeader,children:e.jsx("span",{className:H.feedDate,children:"Action Needed"})}),e.jsxs("p",{className:H.feedText,children:["â ",e.jsxs("strong",{children:[n.length," posts are ready for you to share"]})]}),e.jsx("div",{className:H.draftsList,children:x.map(E=>e.jsxs("div",{className:H.draftItem,children:[e.jsxs("span",{className:H.draftTitle,children:['"',E.title,'"']}),e.jsx(b,{size:"sm",onClick:()=>i(E),children:"Post Now"})]},E.id))}),!N&&j>0&&e.jsxs(b,{variant:"outline",size:"sm",onClick:()=>_(!0),className:H.showMoreDraftsButton,children:["Show ",j," more drafts"]})]})]})})}
5return T.sort((l,x)=>x.timestamp-l.timestamp)},[t,s,n,a,i,o,N,g,r]);return w.length===0?e.jsx("div",{className:`${H.container} ${d}`,children:e.jsx("p",{className:H.emptyState,children:"Your agent is just getting started. Check back soon!"})}):e.jsxs("div",{className:`${H.container} ${d}`,children:[e.jsxs("div",{className:H.headerGroup,children:[e.jsx("h3",{className:H.heading,children:"Your Agent's Activity"}),t.length>0&&e.jsxs("p",{className:H.articleSummary,children:["Showing ",(g-1)*h+1,"â",Math.min(g*h,t.length)," of ",t.length," ","expert articles"]})]}),e.jsx("div",{className:H.timeline,children:w.map(T=>e.jsx(ee.Fragment,{children:T.render()},T.id))}),v>1&&e.jsxs("div",{className:H.pagination,children:[e.jsx(b,{variant:"outline",size:"sm",onClick:()=>m(T=>Math.max(1,T-1)),disabled:g===1,children:"â Newer articles"}),e.jsxs("span",{className:H.paginationText,children:["Page ",g," of ",v]}),e.jsx(b,{variant:"outline",size:"sm",onClick:()=>m(T=>Math.min(v,T+1)),disabled:g===v,children:"Older articles â"})]})]})};function Ft(t){try{const s=new Date(t);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(s)}catch{return""}}const zc="_container_1ytcm_2",Oc="_reassurance_1ytcm_12",Wc="_reassuranceTitle_1ytcm_21",Gc="_reassuranceText_1ytcm_27",Fc="_seeArticlesBtn_1ytcm_34",Vc="_header_1ytcm_39",Yc="_icon_1ytcm_46",Uc="_title_1ytcm_52",Qc="_list_1ytcm_60",Kc="_listItem_1ytcm_69",Xc="_tipBox_1ytcm_88",Jc="_tipPrefix_1ytcm_98",we={container:zc,reassurance:Oc,reassuranceTitle:Wc,reassuranceText:Gc,seeArticlesBtn:Fc,header:Vc,icon:Yc,title:Uc,list:Qc,listItem:Kc,tipBox:Xc,tipPrefix:Jc},Zc=({profileTitle:t,articleCount:s,onSeeArticles:n,className:a=""})=>{let i="";return s===0?i="Your agent is getting ready to write your first expert article!":s<5?i="Your agent is planning more articles to build your reputation.":i="Visipage will write another article about you and post it on a popular website. You can read it and change anything you want. This is included in your plan â no extra charge.",e.jsxs("div",{className:`${we.container} ${a}`,children:[e.jsxs("div",{className:we.reassurance,children:[e.jsx("div",{className:we.reassuranceTitle,children:"ð You're always in control"}),e.jsx("p",{className:we.reassuranceText,children:"Everything we write is based on public facts about you. Nothing is made up. You can read, change, or delete anything anytime."}),n&&e.jsx(b,{onClick:n,variant:"outline",className:we.seeArticlesBtn,children:"ð See Everything We Wrote About You"})]}),e.jsxs("div",{className:we.header,children:[e.jsx(nt,{className:we.icon}),e.jsx("h3",{className:we.title,children:"Here's What Happens Next (You Don't Have to Do Anything)"})]}),e.jsxs("ul",{className:we.list,children:[e.jsx("li",{className:we.listItem,children:i}),e.jsx("li",{className:we.listItem,children:"We'll keep telling Google, ChatGPT, and other smart tools about you â so when someone searches for what you do, your name comes up."})]}),e.jsxs("div",{className:we.tipBox,children:[e.jsx("span",{className:we.tipPrefix,children:"ð¡ Want to help?"})," Share your profile link with a friend. That's it!"]})]})},el="_card_1d2jl_2",tl="_iconWrapper_1d2jl_12",sl="_icon_1d2jl_12",nl="_content_1d2jl_29",al="_heading_1d2jl_35",il="_text_1d2jl_43",ze={card:el,iconWrapper:tl,icon:sl,content:nl,heading:al,text:il},rl=({tips:t,className:s=""})=>{const n=y.useMemo(()=>{if(!t||t.length===0)return null;const i=Math.floor(Date.now()/864e5)%t.length;return t[i]},[t]);return n?e.jsxs("div",{className:`${ze.card} ${s}`,children:[e.jsx("div",{className:ze.iconWrapper,children:e.jsx(Gs,{className:ze.icon})}),e.jsxs("div",{className:ze.content,children:[e.jsx("h4",{className:ze.heading,children:"Did you know?"}),e.jsx("p",{className:ze.text,children:n})]})]}):null},ol="_container_1q1c9_1",cl="_banner_1q1c9_7",ll="_bannerRunning_1q1c9_16",dl="_bannerIcon_1q1c9_22",ul="_bannerAction_1q1c9_32",ml="_bannerSuccess_1q1c9_38",pl="_bannerText_1q1c9_44",hl="_actionFooter_1q1c9_48",_l="_runAgentButton_1q1c9_58",gl="_runAgentExplainer_1q1c9_63",xl="_sheetBody_1q1c9_74",fl="_instructionsList_1q1c9_83",yl="_contentBox_1q1c9_97",vl="_contentBoxHeader_1q1c9_106",jl="_textContent_1q1c9_116",bl="_sheetFooter_1q1c9_126",wl="_fullWidthBtn_1q1c9_133",me={container:ol,banner:cl,bannerRunning:ll,bannerIcon:dl,bannerAction:ul,bannerSuccess:ml,bannerText:pl,actionFooter:hl,runAgentButton:_l,runAgentExplainer:gl,
5sheetBody:xl,instructionsList:fl,contentBox:yl,contentBoxHeader:vl,textContent:jl,sheetFooter:bl,fullWidthBtn:wl},Nl=["Consistent posting helps AI connect the dots between your name and your expertise.","When you share drafts to your own accounts, it tells search engines you are active.","Your agent learns what works best over time as more articles get published.","You can read, edit, or delete any article Visipage wrote about you. You're always in control.","Everything Visipage writes comes from public information about you. We never make things up.","Your Visipage plan covers everything â there are no surprise charges.","If you're ever unsure about something, just ask your agent. It's like texting a helpful friend."],Cl=t=>{const s=t.toLowerCase();return s.includes("linkedin")?"https://www.linkedin.com/post/new":s.includes("substack")?"https://substack.com":s.includes("reddit")?"https://www.reddit.com/submit":s.includes("pinterest")?"https://www.pinterest.com/pin-creation-tool/":`https://${s.replace(/\s+/g,"")}.com`},Sl=({profileId:t,profileSlug:s,profileTitle:n,isPublished:a,articles:i,onRunAgent:r,onSeeArticles:d,className:o})=>{const{data:c}=ft(t),{runAutopilotAsync:N,isRunning:_}=$t(),g=_s(),[m,h]=y.useState(null),v=()=>{m?.spokeContent&&(navigator.clipboard.writeText(m.spokeContent),V.success("Copied to clipboard!"))},w=()=>{m&&g.mutate({placementId:m.id},{onSuccess:()=>{h(null)}})},T=async()=>{await N({profileId:t}),r()},P=y.useMemo(()=>c?.filter(u=>u.status==="live")||[],[c]),l=y.useMemo(()=>c?.filter(u=>u.status==="draft")||[],[c]),x=i.map(u=>({id:u.id,title:u.title,createdAt:u.createdAt})),j=P.map(u=>({id:u.id,platformName:u.platformName,externalUrl:u.externalUrl||"",createdAt:u.createdAt instanceof Date?u.createdAt.toISOString():u.createdAt||new Date().toISOString()})),E=l.map(u=>({id:u.id,title:u.spokeTitle||u.platformName,createdAt:u.createdAt instanceof Date?u.createdAt.toISOString():u.createdAt||new Date().toISOString(),_original:u}));return e.jsxs("section",{className:`${me.container} ${o||""}`,children:[e.jsxs("div",{className:`${me.banner} ${_?me.bannerRunning:l.length>0?me.bannerAction:me.bannerSuccess}`,children:[e.jsx(Re,{size:24,className:me.bannerIcon}),e.jsx("div",{className:me.bannerText,children:_?"Your Visipage agent is working right now...":"Here's everything your Visipage agent did for you recently. You can review it all below."})]}),e.jsx(Hc,{articles:x,livePlacements:j,draftPlacements:E,isPublished:a,onPostDraft:u=>{const C=u._original;h(C)},profileSlug:s}),e.jsx(rl,{tips:Nl}),e.jsx(Zc,{profileTitle:n||null,articleCount:i.length,onSeeArticles:d}),e.jsxs("div",{className:me.actionFooter,children:[e.jsx(b,{size:"lg",onClick:T,disabled:_,className:me.runAgentButton,children:_?"Agent is working... ðª":"ð Run Agent Again"}),e.jsx("p",{className:me.runAgentExplainer,children:"This tells your agent to keep working â writing articles, posting them, and making you more visible. It won't change anything you've already approved."})]}),e.jsx(gt,{open:!!m,onOpenChange:u=>!u&&h(null),children:e.jsxs(xt,{side:"right",children:[e.jsxs(Lt,{children:[e.jsxs(Et,{children:["Post this on ",m?.platformName]}),e.jsx(Dt,{children:"We wrote the text. You just paste it! Follow these simple steps."})]}),e.jsxs("div",{className:me.sheetBody,children:[e.jsxs("ol",{className:me.instructionsList,children:[e.jsxs("li",{children:["Open ",m?.platformName," in a new tab"]}),e.jsx("li",{children:"Click to create a new post"}),e.jsx("li",{children:"Copy the text below and paste it"}),e.jsx("li",{children:"Hit Publish!"})]}),e.jsxs("div",{className:me.contentBox,children:[e.jsxs("div",{className:me.contentBoxHeader,children:[e.jsx("strong",{children:"Your Post Content"}),e.jsxs(b,{variant:"ghost",size:"sm",onClick:v,children:[e.jsx(Ge,{size:14})," Copy"]})]}),e.jsx("div",{className:me.textContent,children:m?.spokeContent||m?.spokeTitle||"No content generated."})]})]}),e.jsxs(Rt,{className:me.sheetFooter,children:[e.jsx(b,{variant:"outline",asChild:!0,className:me.fullWidthBtn,children:e.jsxs("a",{href:Cl(m?.platformName||""),target:"_blank",rel:"noopener noreferrer",children:["ð Open ",m?.platformName]})}),e.jsx(b,{className:me.fullWidthBtn,onClick:w,disabled:g.isPending,children:"â
I Posted It!"})]})]})})]})},kl=xe({profileId:ne().uuid()}),Tl=async(t,s)=>{const n=kl.parse(t),a=new URLSearchParams({profileId:n.profileId}),i=await fetch(`/_api/share-challenge/active?${a.toString()}`,{method:"GET",...s,headers:{"Content-Type":"application/json"}});if(!i.ok){const r=Y.parse(await i.text());throw new Error(r.error)}return Y.parse(await i.text())},Il=xe({challengeId:ne().uuid(),linkedinUrl:ne().url().refine(t=>t.includes("linkedin.com"),{message:"Must be a valid LinkedIn URL"})}),Bl=async(t,s)=>{const n=Il.parse(t),a=await fetch("/_api/share-challenge/submit",{method:"POST",body:Y.stringify(n),...s,headers:{"Content-Type":"application/json"}});if(!a.ok){const i=Y.parse(await a.text());throw new Error(i.error)}return Y.parse(await a.text())},gs=t=>["share-challenge",t];function xs(t){return ht({queryKey:gs(t),queryFn:()=>Tl({profileId:t}),enabled:!!t})}function fs(t){const s=Be();return ke({mutationFn:n=>Bl(n),onSuccess:n=>{V.success(`Challenge completed! You've been awarded ${n.creditsAwarded} credits.`),t&&(s.invalidateQueries({queryKey:gs(t)}),s.invalidateQueries({queryKey:_n(t)}))},onError:n=>{V.error(n instanceof Error?n.message:"Failed to submit challenge")}})}const Al="_heroContainer_1djuu_2",Pl="_header_1djuu_8",$l="_title_1djuu_14",Ll="_subtitle_1djuu_23",El="_statsGrid_1djuu_30",Dl="_statCard_1djuu_43",Rl="_statCardClickable_1djuu_57",Ml="_statHeaderWrapper_1djuu_67",ql="_statHeader_1djuu_67",Hl="_chevron_1djuu_80",zl="_chevronOpen_1djuu_87",Ol="_iconWrapper_1djuu_91",Wl="_icon_1djuu_91",Gl="_iconArticles_1djuu_105",Fl="_iconWebsites_1djuu_110",Vl="_iconBots_1djuu_115",Yl="_statHeadline_1djuu_120",Ul="_reassurance_1
5djuu_128",Ql="_subtleLink_1djuu_134",Kl="_expandPanel_1djuu_156",Xl="_websiteList_1djuu_176",Jl="_websiteItem_1djuu_184",Zl="_mutedText_1djuu_191",ed="_platformList_1djuu_196",td="_platformItem_1djuu_202",sd="_successIcon_1djuu_210",nd="_warningIcon_1djuu_214",ad="_actionCardsContainer_1djuu_218",id="_actionCard_1djuu_218",rd="_mechanismText_1djuu_240",od="_actionInput_1djuu_247",cd="_targetQuestionsList_1djuu_253",B={heroContainer:Al,header:Pl,title:$l,subtitle:Ll,statsGrid:El,statCard:Dl,statCardClickable:Rl,statHeaderWrapper:Ml,statHeader:ql,chevron:Hl,chevronOpen:zl,iconWrapper:Ol,icon:Wl,iconArticles:Gl,iconWebsites:Fl,iconBots:Vl,statHeadline:Yl,reassurance:Ul,subtleLink:Ql,expandPanel:Kl,websiteList:Xl,websiteItem:Jl,mutedText:Zl,platformList:ed,platformItem:td,successIcon:sd,warningIcon:nd,actionCardsContainer:ad,actionCard:id,mechanismText:rd,actionInput:od,targetQuestionsList:cd},ld=({profileId:t,profileSlug:s,onSeeArticles:n})=>{const{data:a}=xs(t),i=fs(t),[r,d]=y.useState(""),o=a?.challenge;if(o?.status==="active"){const c=`https://visipage.ai/profile/${s||""}/knowledge/${o.articleSlug}`,N=()=>{navigator.clipboard.writeText(c),V.success("Copied!")};return e.jsxs("div",{children:[e.jsxs("p",{style:{margin:"0 0 8px 0",fontSize:"0.875rem"},children:[e.jsx("strong",{children:"Article:"})," ",o.articleTitle]}),e.jsxs(b,{onClick:N,size:"sm",variant:"secondary",children:[e.jsx(Ge,{size:14})," Copy Link"]}),e.jsxs("div",{className:B.actionInput,children:[e.jsx(Je,{placeholder:"Paste LinkedIn URL...",value:r,onChange:_=>d(_.target.value)}),e.jsx(b,{disabled:!r||i.isPending,onClick:()=>i.mutate({challengeId:o.id,linkedinUrl:r}),children:"Verify"})]})]})}return e.jsxs("div",{children:[e.jsx("p",{style:{margin:"0 0 8px 0",fontSize:"0.875rem",color:"var(--foreground)"},children:"Share any of your articles on social media to build authority signals"}),n&&e.jsx("button",{type:"button",className:B.subtleLink,onClick:n,children:"See your articles â"})]})},dd=({targetQuestions:t,onSaveTargetQuestion:s})=>{const[n,a]=y.useState(""),[i,r]=y.useState(!1),d=async()=>{if(!(!n||!s)){r(!0);try{await s(n),a(""),V.success("Target question saved")}catch{V.error("Failed to save")}r(!1)}};return e.jsxs("div",{children:[Array.isArray(t)&&t.length>0&&e.jsxs("div",{className:B.targetQuestionsList,children:[e.jsx("strong",{children:"Current targets:"}),e.jsx("ul",{children:t.map((o,c)=>e.jsx("li",{children:o.question},c))})]}),e.jsxs("div",{className:B.actionInput,children:[e.jsx(Je,{placeholder:"E.g. Who is the best AI consultant in NYC?",value:n,onChange:o=>a(o.target.value)}),e.jsx(b,{onClick:d,disabled:!n||i,children:"Set Question"})]})]})},ud=({profileName:t,lastVisitDate:s,articleCount:n,websiteCount:a,platformsKnowingCount:i,totalPlatforms:r,onSeeArticles:d,onSeePlacements:o,className:c="",placements:N,aiMentionData:_,profileId:g,profileSlug:m,targetQuestions:h,onSaveTargetQuestion:v})=>{const[w,T]=y.useState(null),P=y.useMemo(()=>{if(!s)return"recently";try{const A=new Date(s);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric"}).format(A)}catch{return"recently"}},[s]),l=y.useMemo(()=>N?.filter(A=>A.status==="live")||[],[N]),x=y.useMemo(()=>N?.filter(A=>A.status==="draft")||[],[N]),j=N?l.length:a||0,E=_?Object.values(_.bySource).filter(A=>A.status==="good"||A.status==="warning").length:i||0,u=_?5:r||5,C=A=>{T(ie=>ie===A?null:A)},O=(A,ie)=>{const $=A.target;$.closest("button")||$.closest("a")||$.closest("input")||C(ie)};return e.jsxs("div",{className:`${B.heroContainer} ${c}`,children:[e.jsxs("div",{className:B.header,children:[e.jsxs("h1",{className:B.title,children:["ð Welcome back, ",t,"!"]}),e.jsxs("p",{className:B.subtitle,children:["Here's what your Visipage agent has been doing for you since"," ",P,":"]})]}),e.jsxs("div",{className:B.statsGrid,children:[e.jsxs("div",{className:`${B.statCard} ${B.statCardClickable}`,onClick:A=>O(A,"articles"),children:[e.jsxs("div",{className:B.statHeaderWrapper,children:[e.jsxs("div",{className:B.statHeader,children:[e.jsx("div",{className:`${B.iconWrapper} ${B.iconArticles}`,children:e.jsx($e,{className:B.icon})}),e.jsxs("h3",{className:B.statHeadline,children:["Visipage wrote ",n," expert articles about you"]})]}),e.jsx(Te,{className:`${B.chevron} ${w==="articles"?B.chevronOpen:""}`})]}),e.jsx("p",{className:B.reassurance,children:"You can read and edit every article."}),e.jsx(We,{explanation:"Visipage wrote articles that make you look like an expert. It's like having someone write a newspaper column about you â we did all the work. You can read and change any article anytime."}),w==="articles"&&e.jsx("div",{className:B.expandPanel,children:d&&e.jsx("button",{onClick:d,className:B.subtleLink,children:"See what we wrote â"})})]}),e.jsxs("div",{className:`${B.statCard} ${B.statCardClickable}`,onClick:A=>O(A,"websites"),children:[e.jsxs("div",{className:B.statHeaderWrapper,children:[e.jsxs("div",{className:B.statHeader,children:[e.jsx("div",{className:`${B.iconWrapper} ${B.iconWebsites}`,children:e.jsx(_t,{className:B.icon})}),e.jsxs("h3",{className:B.statHeadline,children:["Visipage put you on ",j," websites"]})]}),e.jsx(Te,{className:`${B.chevron} ${w==="websites"?B.chevronOpen:""}`})]}),e.jsx(We,{explanation:"Visipage put your name on different popular websites. It's like putting up signs in different towns so more people see you. Want to see them? Click below."}),w==="websites"&&e.jsxs("div",{className:B.expandPanel,children:[l.length>0&&e.jsxs("div",{className:B.websiteList,children:[l.slice(0,8).map(A=>e.jsx("div",{className:B.websiteItem,children:A.externalUrl?e.jsxs("a",{href:A.externalUrl,target:"_blank",rel:"noreferrer",className:B.subtleLink,children:[A.platformName," ",e.jsx(st,{size:14,style:{marginLeft:4}})]}):e.jsx("span",{children:A.platformName})},A.id)),l.length>8&&e.jsxs("div",{className:B.mutedText,style:{marginTop:"0.25rem"},children:["and ",l.length-8," more on your dashboard below..."]})]}),x.length>0&&e.jsxs("div",{className:B.mutedText,children:[x.length," more ready â we wrote them, you just need to paste them"]}),o&&e.jsx("button",{onClick:o,className:B.subtleLink,children:"See full placement details â"})]})]}),e.jsxs("div",{className:`${B.statCard} ${B.statCardClickable}`,onClick:A=>O(A,"assistants"),children:[e.jsxs("div",{className:B.statHeaderWrapper,children:[e.jsxs("div",{className:B.statHeader,children:[e.jsx("div",{className:`${B.iconWrapper} ${B.iconBots}`,children:e.jsx(Re,{className:B.icon})}),e.jsxs("h3",{className:B.statHeadline,children:["Thanks to Visi
5page, ",E," out of ",u," smart assistants know you"]})]}),e.jsx(Te,{className:`${B.chevron} ${w==="assistants"?B.chevronOpen:""}`})]}),e.jsx(We,{explanation:"Because of Visipage, when people ask smart assistants like ChatGPT or Siri for help in your field, they might say your name."}),w==="assistants"&&e.jsxs("div",{className:B.expandPanel,children:[e.jsx("div",{className:B.platformList,children:[{id:"chatgpt",name:"ChatGPT"},{id:"perplexity",name:"Perplexity"},{id:"claude",name:"Claude"},{id:"grok",name:"Grok"},{id:"gemini",name:"Gemini"}].map(A=>{const ie=_?.bySource[A.id]?.status,$=ie==="good"||ie==="warning";return e.jsxs("div",{className:B.platformItem,children:[$?e.jsx(Ie,{size:16,className:B.successIcon}):e.jsx(Xe,{size:16,className:B.warningIcon}),e.jsx("span",{children:A.name})]},A.id)})}),(!_||Object.values(_.bySource).some(A=>A.status==="bad"||A.status==="pending"))&&g&&e.jsxs("div",{className:B.actionCardsContainer,children:[e.jsxs("div",{className:B.actionCard,children:[e.jsx("h4",{children:"Drive traffic to your articles"}),e.jsx("p",{className:B.mechanismText,children:"When you share an article and people click it, AI platforms register that traffic as an authority signal. Pasting the URL back lets us verify the backlink."}),e.jsx(ld,{profileId:g,profileSlug:m,onSeeArticles:d})]}),e.jsxs("div",{className:B.actionCard,children:[e.jsx("h4",{children:"Tell us what question you want to own"}),e.jsx("p",{className:B.mechanismText,children:"Your agent writes articles specifically structured to make AI platforms cite you when people ask this question."}),e.jsx(dd,{targetQuestions:h,onSaveTargetQuestion:v})]})]})]})]})]})]})},md=xe({placementId:ne().uuid()}),pd=async(t,s)=>{const n=md.parse(t),a=await fetch("/_api/distribution/delete",{method:"POST",body:Y.stringify(n),...s,headers:{"Content-Type":"application/json"}}),i=await a.text();if(!a.ok){const r=Y.parse(i);throw new Error(r.error)}return Y.parse(i)},hd=()=>{const t=Be();return ke({mutationFn:s=>pd(s),onSuccess:()=>{t.invalidateQueries({queryKey:["contentPlacements"]}),t.invalidateQueries({queryKey:["profile"]})}})},_d="_container_52a8s_1",gd="_heroSkeleton_52a8s_8",xd="_grid_52a8s_13",fd="_cardSkeleton_52a8s_19",yd="_listSkeleton_52a8s_24",vd="_hero_52a8s_8",jd="_heroContent_52a8s_48",bd="_heroIcon_52a8s_54",wd="_heroText_52a8s_60",Nd="_educationalCallout_52a8s_66",Cd="_heroTitle_52a8s_77",Sd="_heroSubtitle_52a8s_85",kd="_heroActions_52a8s_92",Td="_spin_52a8s_98",Id="_summaryGrid_52a8s_107",Bd="_summaryCard_52a8s_119",Ad="_summaryHeader_52a8s_130",Pd="_summaryValue_52a8s_136",$d="_textSuccess_52a8s_143",Ld="_textWarning_52a8s_144",Ed="_textError_52a8s_145",Dd="_textInfo_52a8s_146",Rd="_comparisonSection_52a8s_148",Md="_placementsSection_52a8s_148",qd="_sectionTitle_52a8s_154",Hd="_comparisonGrid_52a8s_161",zd="_comparisonBox_52a8s_175",Od="_comparisonBoxHighlight_52a8s_188",Wd="_comparisonLabel_52a8s_193",Gd="_comparisonNumber_52a8s_201",Fd="_comparisonSub_52a8s_212",Vd="_comparisonArrow_52a8s_217",Yd="_placementsList_52a8s_230",Ud="_platformGroup_52a8s_236",Qd="_platformHeader_52a8s_244",Kd="_platformHeaderLeft_52a8s_262",Xd="_platformNameCompact_52a8s_269",Jd="_platformStats_52a8s_275",Zd="_statBadge_52a8s_283",eu="_statLive_52a8s_292",tu="_statDraft_52a8s_297",su="_platformHeaderRight_52a8s_302",nu="_chevron_52a8s_308",au="_platformContent_52a8s_316",iu="_compactRow_52a8s_324",ru="_rowMain_52a8s_337",ou="_statusDot_52a8s_345",cu="_live_52a8s_352",lu="_draft_52a8s_353",du="_pending_52a8s_354",uu="_error_52a8s_355",mu="_rowTitle_52a8s_357",pu="_daBadge_52a8s_365",hu="_rowMeta_52a8s_375",_u="_rowDate_52a8s_382",gu="_rowActions_52a8s_389",xu="_actionBtn_52a8s_395",fu="_deleteBtnCompact_52a8s_402",yu="_filterRow_52a8s_411",vu="_filterTabs_52a8s_420",ju="_summaryText_52a8s_426",bu="_emptyState_52a8s_431",wu="_sheetBody_52a8s_441",Nu="_instructionsList_52a8s_450",Cu="_contentBox_52a8s_464",Su="_contentBoxHeader_52a8s_473",ku="_textContent_52a8s_483",Tu="_sheetFooter_52a8s_493",Iu="_fullWidthMobileBtn_52a8s_500",f={container:_d,heroSkeleton:gd,grid:xd,cardSkeleton:fd,listSkeleton:yd,hero:vd,heroContent:jd,heroIcon:bd,heroText:wd,educationalCallout:Nd,heroTitle:Cd,heroSubtitle:Sd,heroActions:kd,spin:Td,summaryGrid:Id,summaryCard:Bd,summaryHeader:Ad,summaryValue:Pd,textSuccess:$d,textWarning:Ld,textError:Ed,textInfo:Dd,c
5omparisonSection:Rd,placementsSection:Md,sectionTitle:qd,comparisonGrid:Hd,comparisonBox:zd,comparisonBoxHighlight:Od,comparisonLabel:Wd,comparisonNumber:Gd,comparisonSub:Fd,comparisonArrow:Vd,placementsList:Yd,platformGroup:Ud,platformHeader:Qd,platformHeaderLeft:Kd,platformNameCompact:Xd,platformStats:Jd,statBadge:Zd,statLive:eu,statDraft:tu,platformHeaderRight:su,chevron:nu,platformContent:au,compactRow:iu,rowMain:ru,statusDot:ou,live:cu,draft:lu,pending:du,error:uu,rowTitle:mu,daBadge:pu,rowMeta:hu,rowDate:_u,rowActions:gu,actionBtn:xu,deleteBtnCompact:fu,filterRow:yu,filterTabs:vu,summaryText:ju,emptyState:bu,sheetBody:wu,instructionsList:Nu,contentBox:Cu,contentBoxHeader:Su,textContent:ku,sheetFooter:Tu,fullWidthMobileBtn:Iu},Bu=t=>{const s=t.toLowerCase();return s.includes("linkedin")?"https://www.linkedin.com/post/new":s.includes("substack")?"https://substack.com":s.includes("reddit")?"https://www.reddit.com/submit":s.includes("pinterest")?"https://www.pinterest.com/pin-creation-tool/":`https://${s.replace(/\s+/g,"")}.com`},Au=({profileId:t,articleId:s,className:n})=>{const{data:a,isLoading:i,isError:r,error:d}=ft(t),o=kn(),c=Tn(),N=_s(),_=hd(),[g,m]=y.useState(null),[h,v]=y.useState("all"),w=y.useMemo(()=>a?a.filter(C=>h==="all"?!0:h==="live"?C.status==="live":h==="draft"?C.status==="draft":h==="needs_action"?C.status==="error"||C.status==="pending":!0):[],[a,h]),T=y.useMemo(()=>{const C={};return w.forEach(O=>{C[O.platformName]||(C[O.platformName]=[]),C[O.platformName].push(O)}),Object.entries(C).sort((O,A)=>A[1].length-O[1].length)},[w]),P=y.useMemo(()=>a?{total:a.length,live:a.filter(C=>C.status==="live").length,pending:a.filter(C=>C.status==="pending").length,draft:a.filter(C=>C.status==="draft").length,error:a.filter(C=>C.status==="error").length,highDa:a.filter(C=>C.status==="live"&&C.domainAuthority&&C.domainAuthority>=70).length}:{total:0,live:0,pending:0,draft:0,error:0,highDa:0},[a]),l=()=>{s&&o.mutate({profileId:t,articleId:s})},x=()=>{c.mutate({profileId:t})},j=()=>{g?.spokeContent&&(navigator.clipboard.writeText(g.spokeContent),V.success("Copied to clipboard!"))},E=()=>{g&&N.mutate({placementId:g.id},{onSuccess:()=>{m(null)}})},u=(C,O)=>{window.confirm(`Remove this placement from ${O}?`)&&_.mutate({placementId:C},{onSuccess:()=>{V.success("Placement removed successfully.")},onError:A=>{V.error(A instanceof Error?A.message:"Failed to remove placement.")}})};return r?e.jsx(ls,{variant:"error",title:"Failed to load placements",className:n,children:d instanceof Error?d.message:"Unknown error occurred"}):i||!a?e.jsxs("div",{className:`${f.container} ${n||""}`,children:[e.jsx(se,{className:f.heroSkeleton}),e.jsxs("div",{className:f.grid,children:[e.jsx(se,{className:f.cardSkeleton}),e.jsx(se,{className:f.cardSkeleton}),e.jsx(se,{className:f.cardSkeleton}),e.jsx(se,{className:f.cardSkeleton})]}),e.jsx(se,{className:f.listSkeleton})]}):e.jsxs("div",{className:`${f.container} ${n||""}`,children:[e.jsxs("div",{className:f.hero,children:[e.jsxs("div",{className:f.heroContent,children:[e.jsx(St,{className:f.heroIcon,size:32}),e.jsxs("div",{className:f.heroText,children:[e.jsxs("div",{className:f.educationalCallout,children:["ð¡ ",e.jsx("strong",{children:"What is this page?"})," This shows you everywhere on the internet where we've placed your articles. Each 'placement' is a real website that now shows your content â which helps Google, ChatGPT, and other AI tools learn about you!"]}),e.jsxs("h2",{className:f.heroTitle,children:["ð Your articles are live on ",P.live," websites across the internet!"]}),e.jsx("p",{className:f.heroSubtitle,children:"We placed your articles on popular websites across the internet. The more places they appear, the more Google and AI tools notice you!"})]})]}),e.jsxs("div",{className:f.heroActions,children:[e.jsxs(b,{onClick:x,variant:"secondary",disabled:c.isPending||a.length===0,children:[e.jsx(Fs,{size:16,className:c.isPending?f.spin:""}),"ð Check Status"]}),e.jsx("div",{title:s?void 0:"Create an article first to amplify it",style:s?void 0:{cursor:"not-allowed"},children:e.jsxs(b,{onClick:l,disabled:o.isPending||!s,style:s?void 0:{pointerEvents:"none"},children:[e.jsx(Vs,{size:16}),"â¡ Amplify Article"]})})]})]}),e.jsxs("div",{className:f.summaryGrid,children:[e.jsxs("div",{className:f.summaryCard,children:[e.jsx("div",{className:f.summaryHeader,children:"ð Places Your Articles Appear"}),e.jsx("div",{className:f.summaryValue,children:P.total})]}),e.jsxs("div",{className:f.summaryCard,children:[e.jsx("div",{className:f.summaryHeader,children:"â
Already Showing"}),e.jsx("div",{className:`${f.summaryValue} ${f.textSuccess}`,children:P.live})]}),e.jsxs("div",{className:f.summaryCard,children:[e.jsx("div",{className:f.summaryHeader,children:"ð Ready for You"}),e.jsx("div",{className:`${f.summaryValue} ${f.textInfo}`,children:P.draft})]}),e.jsxs("div",{className:f.summaryCard,children:[e.jsx("div",{className:f.summaryHeader,children:"â³ Processing"}),e.jsx("div",{className:`${f.summaryValue} ${f.textWarning}`,children:P.pending})]}),e.jsxs("div",{className:f.summaryCard,children:[e.jsx("div",{className:f.summaryHeader,children:"â ï¸ Need Attention"}),e.jsx("div",{className:`${f.summaryValue} ${f.textError}`,children:P.error})]})]}),e.jsxs("div",{className:f.comparisonSection,children:[e.jsx("h3",{className:f.sectionTitle,children:"Look How Far You've Come! ð"}),e.jsxs("div",{className:f.comparisonGrid,children:[e.jsxs("div",{className:f.comparisonBox,children:[e.jsx("div",{className:f.comparisonLabel,children:"Before We Started"}),e.jsx("div",{className:f.comparisonNumber,children:"0"}),e.jsx("div",{className:f.comparisonSub,children:"Trusted websites showing your content"})]}),e.jsx("div",{className:f.comparisonArrow,children:"â"}),e.jsxs("div",{className:`${f.comparisonBox} ${f.comparisonBoxHighlight}`,children:[e.jsx("div",{className:f.comparisonLabel,children:"After Our Work"}),e.jsx("div",{className:f.comparisonNumber,children:P.live}),e.jsx("div",{className:f.comparisonSub,children:"Trusted websites showing your content"})]})]})]}),e.jsxs("div",{className:f.placementsSection,children:[e.jsx("h3",{className:f.sectionTitle,children:"Where Your Articles Appear"}),a.length===0?e.jsx("div",{className:f.emptyState,children:e.jsx("p",{children:"No websites yet! Go back to your articles and click 'Amplify' to start spreading your content across the internet. ð"})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:f.filterRow,children:[e.jsxs("div",{className:f.filterTabs,children:[e.jsx(b,{variant:h==="all"?"primary":"outline",size:"sm",onClick:()=>v("all"),children:"All"}),e.jsx(b,{variant:h==="live"?"primary":"outline",size:"sm",onClick:()=>v("live"),children:"Live"}),e.jsx(b,{variant:h==="draft"?"primary":"outline",size:"sm",onClick:()=>v("draft"),children:"Draft"}),e.jsx(b,{variant:h==="needs_action"?"primary":"outline",size:"sm",onClick:()=>v("needs_action"),children:"Needs Action"})]}),e.jsxs("div",{className:f.summaryText,children:[w.length," placements across ",T.length," platforms"]})]}),e.jsx("div",{className:f.placementsList,children:T.map(([C,O],A)=>{const ie=O.filter(F=>F.status==="live").length,$=O.filter(F=>F.status==="draft").length;return e.jsxs(Ze,{defaultOpen:A===0,className:f.platformGroup,children:[e.jsxs(et,{className:f.platformHeader,children:[e.jsxs("div",{className:f.platformHeaderLeft,children:[e.jsx("span",{className:f.platformNameCompact,children:C}),e.jsxs("div",{className:f.platformStats,children:[e.jsxs("span",{className:f.statBadge,children:[O.length," articles"]}),ie>0&&e.jsxs("span",{className:`${f.statBadge} ${f.statLive}`,children:[ie," live"]}),$>0&&e.jsxs("span",{className:`${f.statBadge} ${f.statDraft}`,children:[$," draft"]})]})]}),e.jsx("div",{className:f.platformHeaderRight,children:e.jsx(Te,{size:16,className:f.chevron})})]}),e.jsx(tt,{children:e.jsx("div",{className:f.platformContent,children:O.map(F=>e.jsxs("div",{className:f.compactRow,children:[e.jsxs("div",{className:f.rowMain,children:[e.jsx("span",{className:`${f.statusDot} ${f[F.status]}`,title:F.status}),e.jsx("span",{className:f.rowTitle,title:F.spokeTitle||F.articleTitle||"Untitled",children:F.spokeTitle||F.articleTitle||"Untitled"}),F.domainAuthority&&F.domainAuthority>=70&&e.jsx("span",{className:f.daBadge,children:"High DA"})]}),e.jsxs("div",{className:f.rowMeta,children:[e.jsx("span",{className:f.rowDate,children:F.publishedAt?new Intl.DateTimeFormat("en-US",{dateStyle:"short"}).format(new Date(F.publishedAt)):"-"}),e.jsxs("div",{className:f.rowActions,children:[F.status==="draft"&&e.jsxs(b,{variant:"link",size:"sm",onClick:ae=>{ae.preventDefault(),ae.stopPropagation(),m(F)},className:f.actionBtn,children:["Post ",e.jsx(Pe,{size:14})]}),F.externalUrl&&F.status==="live"&&e.jsx(b,{asChild:!0,variant:"ghost",size:"icon-sm",title:"View Post",children:e.jsx("a",{href:F.externalUrl,target:"_blank",rel:"noopener noreferrer",children:e.jsx(st,{size:14})})}),e.jsx(b,{variant:"ghost",size:"icon-sm",onClick:ae=>{ae.preventDefault(),ae.stopPropagation(),u(F.id,F.platformName)},disabled:_.isPending,className:f.deleteBtnCompact,title:"Remove Placement",children:e.jsx(Ys,{size:14})})]})]})]},F.id))})})]},C)})})]})]}),e.jsx(gt,{open:!!g,onOpenChange:C=>!C&&m(null),children:e.jsxs(xt,{side:"right",children:[e.jsxs(Lt,{children:[e.jsxs(Et,{children:["Post this on ",g?.platformName]}),e.jsxs(Dt,{children:["We've written the content for you. Just follow these simple steps to post it on your ",g?.platformName," account."]})]}),e.jsxs("div",{className:f.sheetBody,children:[e.jsxs("ol",{className:f.instructionsList,children:[e.jsxs("li",{children:["Open ",g?.platformName," in a new tab"]}),e.jsx("li",{children:"Click to create a new post or article"}),e.jsx("li",{children:"Copy the text below and paste it"}),e.jsx("li",{children:"Hit Publish!"})]}),e.jsxs("div",{className:f.contentBox,children:[e.jsxs("div",{className:f.contentBoxHeader,children:[e.jsx("strong",{children:"Your Post Content"}),e.jsxs(b,{variant:"ghost",size:"sm",onClick:j,children:[e.jsx(Ge,{size:14})," Copy"]})]}),e.jsx("div",{className:f.textContent,children:g?.spokeContent||g?.spokeTitle||"No content generated."})]})]}),e.jsxs(Rt,{className:f.sheetFooter,children:[e.jsx(b,{variant:"outline",asChild:!0,className:f.fullWidthMobileBtn,children:e.jsxs("a",{href:Bu(g?.platformName||""),target:"_blank",rel:"noopener noreferrer",children:["ð Open ",g?.platformName]})}),e.jsx(b,{className:f.fullWidthMobileBtn,onClick:E,disabled:N.isPending,children:"â
I Posted It!"})]})]})})]})},Pu="_container_riccu_2",$u="_iconWrapper_riccu_12",Lu="_content_riccu_19",Eu="_title_riccu_26",Du="_description_riccu_33",Ru="_action_riccu_40",Mu="_cta_riccu_45",qu="_trophyIcon_riccu_63",Hu="_submitted_riccu_69",zu="_successIcon_riccu_75",_e={container:Pu,iconWrapper:$u,content:Lu,title:Eu,description:Du,action:Ru,cta:Mu,trophyIcon:qu,submitted:Hu,successIcon:zu},Ou=({profileId:t,profileName:s,hasSubmitted:n,className:a=""})=>n?e.jsxs("div",{className:`${_e.container} ${_e.submitted} ${a}`,children:[e.jsx("div",{className:_e.iconWrapper,children:e.jsx(Ie,{className:_e.successIcon,size:20})}),e.jsxs("div",{className:_e.content,children:[e.jsx("h3",{className:_e.title,children:"Your story is under review"}
5),e.jsxs("p",{className:_e.description,children:["Thank you for sharing your growth journey, ",s,". We'll be in touch soon!"]})]})]}):e.jsxs("div",{className:`${_e.container} ${_e.cta} ${a}`,children:[e.jsx("div",{className:_e.iconWrapper,children:e.jsx(ns,{className:_e.trophyIcon,size:24})}),e.jsxs("div",{className:_e.content,children:[e.jsx("h3",{className:_e.title,children:"Get Featured on Visipage"}),e.jsxs("p",{className:_e.description,children:["Share your growth story and earn ",e.jsx("strong",{children:"50 free credits"}),". Your experience could inspire others!"]})]}),e.jsx("div",{className:_e.action,children:e.jsx(b,{asChild:!0,variant:"primary",size:"sm",children:e.jsx(Se,{to:"/dashboard/success-story",children:"Share Your Story â"})})})]}),Wu=xe({sectionName:ne(),content:Us(),confidence:At(),label:ne()}),Gu=xe({profileId:ne().uuid("Invalid profile ID"),text:ne().optional(),documentBase64:ne().optional(),mode:mt(["preview","apply"]),selectedSections:ut(ne()).optional(),parsedSections:ut(Wu).optional()}),Fu=async(t,s)=>{const n=Gu.parse(t),a=await fetch("/_api/profiles/import-content",{method:"POST",body:Y.stringify(n),...s,headers:{"Content-Type":"application/json"}}),i=await a.text();if(!a.ok){let r="An error occurred";try{r=Y.parse(i).error}catch{r=i||a.statusText}throw new Error(r)}return Y.parse(i)};function Vu(){const t=Be();return ke({mutationFn:s=>Fu(s),onSuccess:(s,n)=>{n.mode==="apply"&&(t.invalidateQueries({queryKey:["profiles"]}),t.invalidateQueries({queryKey:["profile",n.profileId]}))},onError:s=>{V.error("Import failed",{description:s.message})}})}const Yu="_sheetContent_1lye7_2",Uu="_mainContent_1lye7_9",Qu="_inputStep_1lye7_17",Ku="_tabTrigger_1lye7_23",Xu="_tabContent_1lye7_27",Ju="_fileSelectedState_1lye7_35",Zu="_fileIcon_1lye7_49",em="_fileName_1lye7_53",tm="_textArea_1lye7_60",sm="_previewStep_1lye7_66",nm="_previewHeaderRow_1lye7_72",am="_backButton_1lye7_80",im="_selectedCount_1lye7_84",rm="_sectionsList_1lye7_90",om="_sectionCard_1lye7_96",cm="_selected_1lye7_84",lm="_sectionHeader_1lye7_110",dm="_sectionCheckbox_1lye7_117",um="_sectionTitleArea_1lye7_121",mm="_sectionTitleRow_1lye7_130",pm="_sectionLabel_1lye7_137",hm="_sectionSnippet_1lye7_144",_m="_expandButton_1lye7_153",gm="_sectionContentBody_1lye7_157",xm="_codeBlock_1lye7_163",fm="_footer_1lye7_176",ym="_actionButton_1lye7_181",Q={sheetContent:Yu,mainContent:Uu,inputStep:Qu,tabTrigger:Ku,tabContent:Xu,fileSelectedState:Ju,fileIcon:Zu,fileName:em,textArea:tm,previewStep:sm,previewHeaderRow:nm,backButton:am,selectedCount:im,sectionsList:rm,sectionCard:om,selected:cm,sectionHeader:lm,sectionCheckbox:dm,sectionTitleArea:um,sectionTitleRow:mm,sectionLabel:pm,sectionSnippet:hm,expandButton:_m,sectionContentBody:gm,codeBlock:xm,footer:fm,actionButton:ym},vm=({open:t,onOpenChange:s,profileId:n,profileName:a,onImportComplete:i})=>{const[r,d]=y.useState("input"),[o,c]=y.useState("upload"),[N,_]=y.useState(""),[g,m]=y.useState(null),[h,v]=y.useState(null),[w,T]=y.useState([]),[P,l]=y.useState([]),[x,j]=y.useState({}),E=Vu();y.useEffect(()=>{t||setTimeout(()=>{d("input"),c("upload"),_(""),m(null),v(null),T([]),l([]),j({})},300)},[t]);const u=y.useCallback(k=>{const L=k[0];if(!L)return;v(L.name);const D=new FileReader;D.onload=W=>{const pe=W.target?.result;m(pe)},D.readAsDataURL(L)},[]),C=y.useCallback(()=>{m(null),v(null)},[]),O=()=>{if(o==="upload"&&!g){V.error("Please upload a file first");return}if(o==="paste"&&!N.trim()){V.error("Please paste some content first");return}E.mutate({profileId:n,mode:"preview",text:o==="paste"?N:void 0,documentBase64:o==="upload"?g??void 0:void 0},{onSuccess:k=>{if(!k.sections||k.sections.length===0){V.error("Could not find any relevant profile sections in this content.");return}T(k.sections),l(k.sections.map(L=>L.sectionName)),d("preview")}})},A=()=>{if(P.length===0){V.error("Please select at least one section to apply");return}E.mutate({profileId:n,mode:"apply",selectedSections:P,parsedSections:w},{onSuccess:k=>{V.success("Content imported successfully",{description:k.message}),i?.(),s(!1)}})},ie=k=>{l(L=>L.includes(k)?L.filter(D=>D!==k):[...L,k])},$=k=>{j(L=>({...L,[k]:!L[k]}))},F=k=>k>=.8?e.jsx(ye,{variant:"success",children:"High Confidence"}):k>=.5?e.jsx(ye,{variant:"warning",children:"Medium Confidence"}):e.jsx(ye,{variant:"destructive",children:"Low Confidence"}),ae=k=>typeof k=="string"?k:JSON.stringify(k,null,2),U=E.isPending;return e.jsx(gt,{open:t,onOpenChange:s,children:e.jsxs(xt,{side:"right",className:Q.sheetContent,children:[e.jsxs(Lt,{children:[e.jsx(Et,{children:"Import Content"}),e.jsx(Dt,{children:r==="input"?`Provide existing resumes, biographies, or web profiles to instantly build ${a}'s profile.`:"Review the extracted information below before applying it to the profile."})]}),e.jsx("div",{className:Q.mainContent,children:r==="input"?e.jsx("div",{className:Q.inputStep,children:e.jsxs($n,{value:o,onValueChange:c,children:[e.jsxs(Ln,{children:[e.jsx(Ot,{value:"upload",className:Q.tabTrigger,children:"Upload Document"}),e.jsx(Ot,{value:"paste",className:Q.tabTrigger,children:"Paste Text"})]}),e.jsx(Wt,{value:"upload",className:Q.tabContent,children:g?e.jsxs("div",{className:Q.fileSelectedState,children:[e.jsx($e,{size:48,className:Q.fileIcon}),e.jsx("p",{className:Q.fileName,children:h}),e.jsx(b,{variant:"outline",size:"sm",onClick:C,disabled:U,children:"Choose different file"})]}):e.jsx(En,{accept:".pdf",maxSize:4*1024*1024,onFilesSelected:u,title:"Drop PDF file here",subtitle:"Maximum size: 4MB",disabled:U})}),e.jsx(Wt,{value:"paste",className:Q.tabContent,children:e.jsx(ds,{placeholder:`Paste ${a}'s bio, LinkedIn about section, or full resume here...`,value:N,onChange:k=>_(k.target.value),disabled:U,className:Q.textArea})})]})}):e.jsxs("div",{className:Q.previewStep,children:[e.jsxs("div",{className:Q.previewHeaderRow,children:[e.jsxs(b,{variant:"ghost",size:"sm",onClick:()=>d("input"),disabled:U,className:Q.backButton,children:[e.jsx(bt,{size:16})," Back to Edit"]}),e.jsxs("div",{className:Q.selectedCount,children:[P.length," of ",w.length," selected"]})]}),e.jsx("div",{className:Q.sectionsList,children:w.map(k=>
5{const L=P.includes(k.sectionName),D=x[k.sectionName];return e.jsxs("div",{className:`${Q.sectionCard} ${L?Q.selected:""}`,children:[e.jsxs("div",{className:Q.sectionHeader,children:[e.jsx("div",{className:Q.sectionCheckbox,children:e.jsx(cs,{id:`check-${k.sectionName}`,checked:L,onChange:()=>ie(k.sectionName),disabled:U})}),e.jsxs("div",{className:Q.sectionTitleArea,onClick:()=>$(k.sectionName),children:[e.jsxs("div",{className:Q.sectionTitleRow,children:[e.jsx("label",{htmlFor:`check-${k.sectionName}`,className:Q.sectionLabel,onClick:W=>W.stopPropagation(),children:k.label}),F(k.confidence)]}),!D&&e.jsxs("p",{className:Q.sectionSnippet,children:[ae(k.content).substring(0,100),"..."]})]}),e.jsx(b,{variant:"ghost",size:"icon-sm",onClick:()=>$(k.sectionName),className:Q.expandButton,children:D?e.jsx(Bt,{size:16}):e.jsx(Te,{size:16})})]}),D&&e.jsx("div",{className:Q.sectionContentBody,children:e.jsx("pre",{className:Q.codeBlock,children:ae(k.content)})})]},k.sectionName)})})]})}),e.jsx(Rt,{className:Q.footer,children:r==="input"?e.jsxs(b,{onClick:O,disabled:U||o==="upload"&&!g||o==="paste"&&!N.trim(),className:Q.actionButton,children:[U?e.jsx(pt,{size:"sm"}):e.jsx(Qs,{size:16}),"Preview Import"]}):e.jsxs(b,{onClick:A,disabled:U||P.length===0,className:Q.actionButton,children:[U?e.jsx(pt,{size:"sm"}):e.jsx(Oe,{size:16}),"Apply ",P.length," Selected"]})})]})})};class jm{constructor(){Mt(this,"listeners",{})}subscribe(s,n){return this.listeners[s]||(this.listeners[s]=new Set),this.listeners[s].add(n),()=>{this.listeners[s]?.delete(n)}}emit(s){this.listeners[s]?.forEach(n=>n())}}const Vt=new jm,Yt={MOVED_TO_SELECTED:"MOVED_TO_SELECTED",REQUEST_VIEW_SELECTED:"REQUEST_VIEW_SELECTED"},bm=xe({profileId:ne().uuid(),topic:ne().min(3,"Topic must be at least 3 characters"),keywords:ut(ne()).optional()}),wm=async(t,s)=>{const n=bm.parse(t),a=await fetch("/_api/questions/discover",{method:"POST",body:Y.stringify(n),...s,headers:{"Content-Type":"application/json"}}),i=await a.text();if(!a.ok){const r=Y.parse(i);throw new Error(r.error)}return Y.parse(i)},Nm=xe({profileId:ne().uuid(),status:mt(["discovered","selected","article_created","dismissed"]).optional(),sortBy:mt(["opportunity_score","created_at"]).default("opportunity_score").optional()}),Cm=async(t,s)=>{const n=Nm.parse(t),a=new URLSearchParams;a.set("profileId",n.profileId),n.status&&a.set("status",n.status),n.sortBy&&a.set("sortBy",n.sortBy);const i=await fetch(`/_api/questions/list?${a.toString()}`,{method:"GET",...s,headers:{"Content-Type":"application/json"}}),r=await i.text();if(!i.ok){const d=Y.parse(r);throw new Error(d.error)}return Y.parse(r)},Sm=xe({id:ne().uuid(),status:mt(["discovered","selected","article_created","dismissed"]).optional(),linkedArticleId:ne().uuid().optional()}).refine(t=>t.status||t.linkedArticleId,{message:"Either status or linkedArticleId must be provided."}),km=async(t,s)=>{const n=Sm.parse(t),a=await fetch("/_api/questions/update-status",{method:"POST",body:Y.stringify(n),...s,headers:{"Content-Type":"application/json"}}),i=await a.text();if(!a.ok){const r=Y.parse(i);throw new Error(r.error)}return Y.parse(i)},yt={all:t=>["questionOpportunities",t],list:(t,s)=>[...yt.all(t),s]},Tm=t=>ht({queryKey:yt.list(t.profileId,{status:t.status,sortBy:t.sortBy}),queryFn:()=>Cm(t),enabled:!!t.profileId}),Im=()=>{const t=Be();return ke({mutationFn:s=>wm(s),onSuccess:(s,n)=>{V.success(`${s.length} new question opportunities discovered!`),t.invalidateQueries({queryKey:yt.all(n.profileId)})},onError:s=>{V.error(s.message||"Failed to discover questions.")}})},Bm=()=>{const t=Be();return ke({mutationFn:s=>km(s),onSuccess:(s,n)=>{t.invalidateQueries({queryKey:yt.all(s.profileId)}),n.status==="selected"?(V.success("Question saved to Selected tab",{action:{label:"View Selected",onClick:()=>Vt.emit(Yt.REQUEST_VIEW_SELECTED)}}),Vt.emit(Yt.MOVED_TO_SELECTED)):n.linkedArticleId?V.success("Article linked successfully"):V.success("Question updated successfully")},onError:s=>{V.error(s.message||"Failed to update question status.")}})},Am="_panel_1av3x_2",Pm="_header_1av3x_12",$m="_headerText_1av3x_22",Lm="_title_1av3x_28",Em="_titleIcon_1av3x_38",Dm="_subtitle_1
5av3x_42",Rm="_content_1av3x_48",Mm="_loadingList_1av3x_53",qm="_skeletonRow_1av3x_60",Hm="_emptyState_1av3x_65",zm="_emptyIconWrapper_1av3x_75",Om="_emptyMessage_1av3x_87",Wm="_emptyButton_1av3x_94",Gm="_list_1av3x_98",Fm="_item_1av3x_105",Vm="_scoreCol_1av3x_122",Ym="_mainCol_1av3x_129",Um="_questionWrapper_1av3x_137",Qm="_questionText_1av3x_144",Km="_mlwBadge_1av3x_151",Xm="_meta_1av3x_157",Jm="_actionsCol_1av3x_165",Zm="_statusBadge_1av3x_172",ep="_dismissBtn_1av3x_178",tp="_linkBtn_1av3x_187",K={panel:Am,header:Pm,headerText:$m,title:Lm,titleIcon:Em,subtitle:Dm,content:Rm,loadingList:Mm,skeletonRow:qm,emptyState:Hm,emptyIconWrapper:zm,emptyMessage:Om,emptyButton:Wm,list:Gm,item:Fm,scoreCol:Vm,mainCol:Ym,questionWrapper:Um,questionText:Qm,mlwBadge:Km,meta:Xm,actionsCol:Jm,statusBadge:Zm,dismissBtn:ep,linkBtn:tp},sp=t=>{switch(t){case"google_paa":return"Google (People Also Ask)";case"google_related":return"Google (Related Searches)";case"reddit":return"Reddit";case"openai":return"AI Generated";default:return t}},np=t=>t===null?"default":t>=70?"success":t>=40?"warning":"destructive",ap=({profileId:t,profileSlug:s,profileName:n,profileType:a,profileSkills:i,profileTitle:r,className:d})=>{const o=Be(),{data:c,isLoading:N}=Tm({profileId:t}),{mutate:_,isPending:g}=Im(),{mutate:m,isPending:h}=Bm(),{mutate:v,isPending:w,variables:T}=ke({mutationFn:async({questionId:u,topic:C})=>{const O=await mn({profileId:t,topic:C,contentType:"faq"});return{questionId:u,article:O}},onSuccess:u=>{m({id:u.questionId,status:"article_created",linkedArticleId:u.article.id}),V.success("Article successfully generated!"),o.invalidateQueries({queryKey:["questionOpportunities",t]})},onError:u=>{V.error(u instanceof Error?u.message:"Failed to generate article")}}),P=()=>{const C=[n,r||(a==="company"?"Company":"Professional")].filter(Boolean).join(" - ");_({profileId:t,topic:C,keywords:i||void 0})},l=u=>{m({id:u,status:"selected"})},x=u=>{m({id:u,status:"dismissed"})},j=(u,C)=>{v({questionId:u,topic:C})},E=c?.filter(u=>u.status!=="dismissed")||[];return e.jsxs("div",{className:`${K.panel} ${d||""}`,children:[e.jsxs("div",{className:K.header,children:[e.jsxs("div",{className:K.headerText,children:[e.jsxs("h2",{className:K.title,children:[e.jsx(lt,{className:K.titleIcon,size:20}),"Discovered Questions"]}),e.jsx("p",{className:K.subtitle,children:a==="company"?`Questions candidates and leaders are asking about working at ${n}`:"Questions people are asking that you should answer"})]}),e.jsx(b,{onClick:P,disabled:g,variant:"secondary",size:"sm",children:g?"Discovering...":e.jsxs(e.Fragment,{children:[e.jsx(nt,{size:16})," Discover More"]})})]}),e.jsx("div",{className:K.content,children:N?e.jsxs("div",{className:K.loadingList,children:[e.jsx(se,{className:K.skeletonRow}),e.jsx(se,{className:K.skeletonRow}),e.jsx(se,{className:K.skeletonRow})]}):E.length===0?e.jsxs("div",{className:K.emptyState,children:[e.jsx("div",{className:K.emptyIconWrapper,children:e.jsx(lt,{size:32})}),e.jsx("p",{className:K.emptyMessage,children:"No questions discovered yet. Click 'Discover More' to find opportunities."}),e.jsx(b,{onClick:P,disabled:g,className:K.emptyButton,children:g?"Discovering...":"Discover Questions"})]}):e.jsx("div",{className:K.list,children:E.map(u=>{const C=u.opportunityScore,O=a==="company"&&(u.question.includes("Most Loved Workplace")||u.question.includes("MLW")),A=w&&T?.questionId===u.id;return e.jsxs("div",{className:K.item,children:[e.jsx("div",{className:K.scoreCol,children:e.jsx(ye,{variant:np(C),children:C!==null?C:"N/A"})}),e.jsxs("div",{className:K.mainCol,children:[e.jsxs("div",{className:K.questionWrapper,children:[e.jsx("span",{className:K.questionText,children:u.question}),O&&e.jsx(ye,{variant:"warning",className:K.mlwBadge,children:"MLW"})]}),e.jsxs("div",{className:K.meta,children:[e.jsxs("span",{className:K.sourceText,children:["Source: ",sp(u.source)]}),u.searchVolume!==null&&e.jsxs("span",{className:K.volumeText,children:["⢠Vol: ",u.searchVolume]})]})]}),e.jsxs("div",{className:K.actionsCol,children:[u.status==="article_created"||u.linkedArticleId?e.jsxs(ye,{variant:"success",className:K.statusBadge,children:[e.jsx(Oe,{size:12})," Article Created"]}):u.status==="selected"?e.jsxs(e.Fragment,{children:[e.jsxs(ye,{variant:"outline",className:K.statusBadge,children:[e.jsx(Oe,{size:12})," Selected"]}),e.jsxs(b,{variant:"primary",size:"sm",onClick:()=>j(u.id,u.question),disabled:A,children:[e.jsx(zt,{size:14}),A?"Writing...":"Write Article"]})]}):e.jsxs(e.Fragment,{children:[e.jsxs(b,{variant:"outline",size:"sm",onClick:()=>l(u.id),disabled:h,children:[e.jsx(Oe,{size:14})," Select"]}),e.jsxs(b,{variant:"primary",size:"sm",onClick:()=>j(u.id,u.question),disabled:A,children:[e.jsx(zt,{size:14}),A?"Writing...":"Write Article"]}),e.jsx(b,{variant:"ghost",size:"icon-sm",onClick:()=>x(u.id),disabled:h,"aria-label":"Dismiss question",className:K.dismissBtn,children:e.jsx(Fe,{size:16})})]}),u.articleSlug&&e.jsx(b,{variant:"link",size:"icon-sm",asChild:!0,className:K.linkBtn,children:e.jsx(Se,{to:`/profile/${s}/knowledge/${u.articleSlug}`,target:"_blank",children:e.jsx(st,{size:16})})})]})]},u.id)})})})]})},ip="_container_2s7qy_2",rp="_educationalBanner_2s7qy_13",op="_bannerIcon_2s7qy_25",cp="_inlineIcon_2s7qy_31",lp="_header_2s7qy_39",dp="_title_2s7qy_47",up="_subtitle_2s7qy_55",mp="_generateButton_2s7qy_61",pp="_pipeline_2s7qy_65",hp="_connector_2s7qy_79",_p="_connectorDesktop_2s7qy_87",gp="_connectorMobile_2s7qy_91",xp="_stage_2s7qy_111",fp="_stageActive_2s7qy_124",yp="_stageEmpty_2s7qy_129",vp="_stageHeader_2s7qy_134",jp="_stageIconWrapper_2s7qy_140",bp="_stageTitle_2s7qy_156",wp="_stageBody_2s7qy_163",Np="_metricBig_2s7qy_170",Cp="_metricLabel_2s7qy_177",Sp="_subMetrics_2s7qy_185",kp="_subMetric_2s7qy_185",Tp="_dot_2s7qy_199",Ip="_articleList_2s7qy_213",Bp="_articleListMore_2s7qy_232",Ap="_platformList_2s7qy_237",Pp="_platformItem_2s7qy_243",$p="_platformInfo_2s7qy_250",Lp="_platformRate_2s7qy_257",Ep="_iconSuccess_2s7qy_263",Dp="_iconMuted_2s7qy_267",Rp="_iconError_2s7qy_272",Mp="_responsesSection_2s7qy_277",qp="_responsesTitle_2s7qy_282",Hp="_responsesGrid_2s7qy_289",zp="_responseCard_2s7qy_301",Op="_responseHeader_2s7qy_311",Wp="_responsePlatform_2s7qy_319",Gp="_responseTime_2s7qy_327",Fp="_responseQuery_2s7qy_332",Vp="_queryLabel_2s7qy_341",Yp="_responseContent_2s7qy_346",Up="_highlight_2s7qy_352",Qp="_citedBadges_2s7qy_363",Kp="_citedLabel_2s7qy_373",Xp="_badgeMicro_2s7qy_378",p={container:ip,educationalBanner:rp,bannerIcon:op,inlineIcon:cp,header:lp,title:dp,subtitle:up,generateButton:mp,pipeline:pp,connector:hp,connectorDesktop:_p,connectorMobile:gp,stage:xp,stageActive:fp,stageEmpty:yp,stageHeader:vp,stageIconWrapper:jp,stageTitle:bp,stageBody:wp,metricBig:Np,metricLabel:Cp,subMetrics:Sp,subMetric:kp,dot:Tp,articleList:Ip,articleListMore:Bp,platformList:Ap,platformItem:Pp,platformInfo:$p,platformRate:Lp,iconSuccess:Ep,iconMuted:Dp,iconError:Rp,responsesSection:Mp,responsesTitle:qp,responsesGrid:Hp,responseCard:zp,responseHeader:Op,responsePlatform:Wp,responseTime:Gp,responseQuery:Fp,queryLabel:Vp,responseContent:Yp,highlight:Up,citedBadges:Qp,citedLabel:Kp,badgeMicro:Xp},Ut=["ChatGPT","Claude","Perplexity","Grok","Gemini"],Jp=t=>t?t.split(/(most loved workplace|best practice institute|certcheck|visipage)/i).map((n,a)=>{const i=n.toLowerCase();return i==="most loved workplace"||i==="best practice institute"||i==="certcheck"||i==="visipage"?e.jsx("span",{className:p.highlight,children:n},a):e.jsx("span",{children:n},a)}):null,Zp=({profileId:t,profileName:s,className:n=""})=>{const{data:a,isLoading:i}=os({profileId:t}),{data:r,isLoading:d}=ft(t),{data:o,isLoading:c}=Pt(t),{runAutopilot:N,isRunning:_}=$t(),g=y.useMemo(()=>
5{if(!a)return{total:0,bpiPublished:0,titles:[]};const l=a.filter(x=>x.bpiPublished).length;return{total:a.length,bpiPublished:l,titles:a.slice(0,3).map(x=>x.title)}},[a]),m=y.useMemo(()=>{if(!r)return{visipage:0,bpi:0,telegraph:0,other:0};let l=0,x=0,j=0,E=0;return r.forEach(u=>{const C=u.platformName?.toLowerCase()||"";C.includes("visipage")||u.source==="auto"?l++:C.includes("bpi")||C.includes("workplace report")||C.includes("best practice institute")?x++:C.includes("telegraph")?j++:E++}),{visipage:l,bpi:x,telegraph:j,other:E}},[r]),h=y.useMemo(()=>{const l={visipage:0,mlw:0,certcheck:0,bpi:0};return o?.recentChecks&&o.recentChecks.forEach(x=>{const j=[];x.citedUrl&&j.push(x.citedUrl),x.citedDomain&&j.push(x.citedDomain),Array.isArray(x.citedUrls)&&j.push(...x.citedUrls);const E=j.join(" ").toLowerCase();E.includes("visipage.ai")&&l.visipage++,E.includes("certcheck.mostlovedworkplace.com")?l.certcheck++:E.includes("mostlovedworkplace.com")&&l.mlw++,(E.includes("bestpracticeinstitute.org")||E.includes("bpi"))&&l.bpi++}),l},[o]),v=y.useMemo(()=>o?.recentChecks?Ut.map(l=>{const x=o.recentChecks.find(j=>j.source===l);return{platform:l,check:x}}).filter(l=>l.check!==void 0):[],[o]),w=()=>{N({profileId:t,options:{maxArticles:1}})};if(i||d||c)return e.jsx("div",{className:`${p.container} ${n}`,children:e.jsx(se,{style:{height:"400px"}})});const P=l=>{if(!o?.bySource)return;const x=l.toLowerCase().replace(/ /g,"_");return o.bySource[x]};return e.jsxs("div",{className:`${p.container} ${n}`,children:[e.jsxs("div",{className:p.educationalBanner,children:[e.jsx("div",{className:p.bannerIcon,children:e.jsx(Tt,{size:20})}),e.jsxs("p",{children:[e.jsx("strong",{children:"The Visibility Proof Chain:"})," We create structured articles ",e.jsx(Pe,{size:14,className:p.inlineIcon}),"distribute them to trusted domain authorities ",e.jsx(Pe,{size:14,className:p.inlineIcon}),"AI engines crawl those networks ",e.jsx(Pe,{size:14,className:p.inlineIcon}),"they build certainty and cite our domains as the factual source."]})]}),e.jsxs("div",{className:p.header,children:[e.jsxs("div",{children:[e.jsx("h2",{className:p.title,children:"Citation Proof Chain"}),e.jsxs("p",{className:p.subtitle,children:["Tracking knowledge syndication for ",s]})]}),e.jsxs(b,{onClick:w,disabled:_,variant:"primary",className:p.generateButton,children:[_?e.jsx(se,{style:{width:"16px",height:"16px",borderRadius:"50%",marginRight:"8px"}}):e.jsx(nt,{size:16}),_?"Running Autopilot...":"Generate Citation Article"]})]}),e.jsxs("div",{className:p.pipeline,children:[e.jsxs("div",{className:`${p.stage} ${g.total>0?p.stageActive:p.stageEmpty}`,children:[e.jsxs("div",{className:p.stageHeader,children:[e.jsx("div",{className:p.stageIconWrapper,children:e.jsx($e,{size:20})}),e.jsx("h3",{className:p.stageTitle,children:"1. Articles Created"})]}),e.jsxs("div",{className:p.stageBody,children:[e.jsx("div",{className:p.metricBig,children:g.total}),e.jsx("p",{className:p.metricLabel,children:"Total knowledge articles"}),e.jsx("div",{className:p.subMetrics,children:e.jsxs("div",{className:p.subMetric,children:[e.jsx("span",{className:p.dot,"data-active":g.bpiPublished>0}),"BPI Published: ",e.jsx("strong",{children:g.bpiPublished})]})}),g.titles.length>0&&e.jsxs("ul",{className:p.articleList,children:[g.titles.map((l,x)=>e.jsx("li",{children:l},x)),g.total>3&&e.jsxs("li",{className:p.articleListMore,children:["+ ",g.total-3," more"]})]})]})]}),e.jsxs("div",{className:p.connector,children:[e.jsx(Pe,{className:p.connectorDesktop}),e.jsx(jt,{className:p.connectorMobile})]}),e.jsxs("div",{className:`${p.stage} ${r&&r.length>0?p.stageActive:p.stageEmpty}`,children:[e.jsxs("div",{className:p.stageHeader,children:[e.jsx("div",{className:p.stageIconWrapper,children:e.jsx(_t,{size:20})}),e.jsx("h3",{className:p.stageTitle,children:"2. Distributed To"})]}),e.jsx("div",{className:p.stageBody,children:e.jsxs("div",{className:p.subMetrics,children:[e.jsxs("div",{className:p.subMetric,children:[e.jsx("span",{className:p.dot,"data-active":m.visipage>0}),"Visipage Profile: ",e.jsx("strong",{children:m.visipage})]}),e.jsxs("div",{className:p.subMetric,children:[e.jsx("span",{className:p.dot,"data-active":m.bpi>0}),"BPI / Workplace Rpt: ",e.jsx("strong",{children:m.bpi})]}),e.jsxs("div",{className:p.subMetric,children:[e.jsx("span",{className:p.dot,"data-active":m.telegraph>0}),"Telegraph: ",e.jsx("strong",{children:m.telegraph})]}),e.jsxs("div",{className:p.subMetric,children:[e.jsx("span",{className:p.dot,"data-active":m.other>0}),"Other Syndicates: ",e.jsx("strong",{children:m.other})]})]})})]}),e.jsxs("div",{className:p.connector,children:[e.jsx(Pe,{className:p.connectorDesktop}),e.jsx(jt,{className:p.connectorMobile})]}),e.jsxs("div",{className:`${p.stage} ${o?.totalChecks?p.stageActive:p.stageEmpty}`,children:[e.jsxs("div",{className:p.stageHeader,children:[e.jsx("div",{className:p.stageIconWrapper,children:e.jsx(Re,{size:20})}),e.jsx("h3",{className:p.stageTitle,children:"3. AI Understanding"})]}
5),e.jsx("div",{className:p.stageBody,children:e.jsx("div",{className:p.platformList,children:Ut.map(l=>{const x=P(l),j=x?.rate&&x.rate>0;return e.jsxs("div",{className:p.platformItem,children:[e.jsxs("div",{className:p.platformInfo,children:[j?e.jsx(Ie,{size:16,className:p.iconSuccess}):e.jsx(dt,{size:16,className:p.iconMuted}),e.jsx("span",{children:l})]}),e.jsxs("span",{className:p.platformRate,children:[x?.rate||0,"%"]})]},l)})})})]}),e.jsxs("div",{className:p.connector,children:[e.jsx(Pe,{className:p.connectorDesktop}),e.jsx(jt,{className:p.connectorMobile})]}),e.jsxs("div",{className:`${p.stage} ${h.visipage+h.mlw+h.certcheck+h.bpi>0?p.stageActive:p.stageEmpty}`,children:[e.jsxs("div",{className:p.stageHeader,children:[e.jsx("div",{className:p.stageIconWrapper,children:e.jsx(Ks,{size:20})}),e.jsx("h3",{className:p.stageTitle,children:"4. Target Domain Cites"})]}),e.jsx("div",{className:p.stageBody,children:e.jsxs("div",{className:p.subMetrics,children:[e.jsxs("div",{className:p.subMetric,children:[e.jsx("span",{className:p.dot,"data-active":h.mlw>0}),"MostLovedWorkplace: ",e.jsx("strong",{children:h.mlw>0?h.mlw:"Not yet"})]}),e.jsxs("div",{className:p.subMetric,children:[e.jsx("span",{className:p.dot,"data-active":h.bpi>0}),"BestPracticeInst: ",e.jsx("strong",{children:h.bpi>0?h.bpi:"Not yet"})]}),e.jsxs("div",{className:p.subMetric,children:[e.jsx("span",{className:p.dot,"data-active":h.certcheck>0}),"CertCheck: ",e.jsx("strong",{children:h.certcheck>0?h.certcheck:"Not yet"})]}),e.jsxs("div",{className:p.subMetric,children:[e.jsx("span",{className:p.dot,"data-active":h.visipage>0}),"Visipage.ai: ",e.jsx("strong",{children:h.visipage>0?h.visipage:"Not yet"})]})]})})]})]}),v.length>0&&e.jsxs("div",{className:p.responsesSection,children:[e.jsx("h3",{className:p.responsesTitle,children:"Latest Engine Responses"}),e.jsx("div",{className:p.responsesGrid,children:v.map(({platform:l,check:x})=>{if(!x)return null;const j=[x.citedDomain,...x.citedUrls||[],x.citedUrl].join(" ").toLowerCase(),E=j.includes("mostlovedworkplace"),u=j.includes("bestpracticeinstitute")||j.includes("bpi"),C=j.includes("certcheck"),O=j.includes("visipage.ai");return e.jsxs("div",{className:p.responseCard,children:[e.jsxs("div",{className:p.responseHeader,children:[e.jsxs("div",{className:p.responsePlatform,children:[x.mentioned?e.jsx(Ie,{size:16,className:p.iconSuccess}):e.jsx(dt,{size:16,className:p.iconError}),e.jsx("strong",{children:l})]}),e.jsx("span",{className:p.responseTime,children:new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(x.timestamp))})]}),e.jsxs("div",{className:p.responseQuery,children:[e.jsx("span",{className:p.queryLabel,children:"Query:"}),' "',x.queryText,'"']}),e.jsxs("div",{className:p.responseContent,children:[Jp(x.responseText.slice(0,200)),x.responseText.length>200?"...":""]}),(E||u||C||O)&&e.jsxs("div",{className:p.citedBadges,children:[e.jsx("span",{className:p.citedLabel,children:"Citations detected:"}),E&&e.jsx(ye,{variant:"success",className:p.badgeMicro,children:"MostLovedWorkplace"}),u&&e.jsx(ye,{variant:"success",className:p.badgeMicro,children:"BPI"}),C&&e.jsx(ye,{variant:"success",className:p.badgeMicro,children:"CertCheck"}),O&&e.jsx(ye,{variant:"success",className:p.badgeMicro,children:"Visipage"})]})]},l)})})]})]})},eh=xe({question:ne(),priority:At()});function th(t){if(t==null)return null;let s=t;if(typeof t=="string")try{s=JSON.parse(t)}catch{return null}const a=ut(eh).safeParse(s);return a.success?a.data:null}const sh="_container_13yve_2",nh="_agentHeroCard_13yve_12",ah="_agentHeroHeader_13yve_31",ih="_agentHeroIcon_13yve_37",rh="_agentHeroTitleRow_13yve_48",oh="_agentHeroTitle_13yve_48",ch="_agentHeroStatus_13yve_61",lh="_agentHeroSubtitle_13yve_69",dh="_agentHeroStatusDot_13yve_75",uh="_commandBarContainer_13yve_82",mh="_commandBarBotIcon_13yve_99",ph="_commandBarInput_13yve_104",hh="_commandBarButton_13yve_119",_h="_suggestionChipsContainer_13yve_124",gh="_suggestionChip_13yve_124",xh="_recentActivityContainer_13yve_158",fh="_recentActivityTitle_13yve_164",yh="_recentActivityList_13yve_172",vh="_recentActivityItem_13yve_178",jh="_recentActivityDot_13yve_186",bh="_recentActivityText_13yve_190",wh="_recentActivityTime_13yve_197",Nh="_recentActivityEmpty_13yve_202",Ch="_credentialsSection_13yve_208",Sh="_credentialSection_13yve_212",kh="_linkedinCredentialButton_13yve_216",Th="_checklistSection_13yve_238",Ih="_identityChecklistSection_13yve_242",Bh="_teamMembersSection_13yve_246",Ah="_visitorsSection_13yve_250",Ph="_importBanner_13yve_254",$h="_importBannerContent_13yve_266",Lh="_importBannerIconWrapper_13yve_272",Eh="_importBannerIcon_13yve_272",Dh="_importBannerText_13yve_288",Rh="_importBannerTitle_13yve_293",Mh="_importBannerDescription_13yve_300",qh="_bannerSection_13yve_306",Hh="_sections_13yve_310",zh="_floatingChatButton_13yve_317",Oh="_chatSheet_13yve_333",Wh="_agentChatOverride_13yve_339",R={container:sh,agentHeroCard:nh,agentHeroHeader:ah,agentHeroIcon:ih,agentHeroTitleRow:rh,agentHeroTitle:oh,agentHeroStatus:ch,agentHeroSubtitle:lh,agentHeroStatusDot:dh,commandBarContainer:uh,commandBarBotIcon:mh,commandBarInput:ph,commandBarButton:hh,suggestionChipsContainer:_h,suggestionChip:gh,recentActivityContainer:xh,recentActivityTitle:fh,recentActivityList:yh,recentActivityItem:vh,recentActivityDot:jh,recentActivityText:bh,recentActivityTime:wh,recentActivityEmpty:Nh,credentialsSection:Ch,credentialSection:Sh,linkedinCredentialButton:kh,checklistSection:Th,identityChecklistSection:Ih,teamMembersSection:Bh,visitorsSection:Ah,importBanner:Ph,importBannerContent:$h,importBannerIconWrapper:Lh,importBannerIcon:Eh,importBannerText:Dh,importBannerTitle:Rh,importBannerDescription:Mh,bannerSection:qh,sections:Hh,floatingChatButton:zh,chatSheet:Oh,agentChatOverride:Wh},Gh=({profile:t,articles:s,aiMentionData:n,subscription:a,lastVisitDate:i,profileLocation:r,isManaging:d,managedProfileId:o,className:c,initialAction:N,actionArticleSlug:_})=>{const[g,m]=y.useState(!1),[h,v]=y.useState(!1),[w,T]=y.useState(""),[P,l]=y.useState(""),[x,j]=y.useState(!1),[E,u]=y.useState(!1),C=y.useRef(null),O=y.useRef(null),A=y.useRef(null),ie=y.useRef(null),$=y.useRef(null),[F,ae]=It();y.useEffect(()=>
5{t.id&&(j(localStorage.getItem(`visipage_imported_${t.id}`)==="true"),u(localStorage.getItem(`visipage_visitors_checked_${t.id}`)==="true"))},[t.id]);const U=as(),{runAutopilotAsync:k}=$t(),{data:L}=ft(t.id),D=Be(),{data:W}=Pn(t.id),{data:pe}=Bn(t.id),{data:z}=Dn(t.slug||void 0);L?.filter(G=>G.status==="live").length,n&&Object.values(n.bySource).filter(G=>G.status==="good"||G.status==="warning").length;const de=y.useMemo(()=>{const G={};if(s&&s.length>=1&&(G.first_article=!0),L&&L.filter(fe=>fe.status==="live").length>=5&&(G.multi_platform=!0),n?.bySource){const fe=n.bySource;fe.chatgpt?.status==="good"&&(G.chatgpt_verified=!0),fe.perplexity?.status==="good"&&(G.perplexity_indexed=!0),fe.claude?.status==="good"&&(G.claude_cited=!0),fe.grok?.status==="good"&&(G.grok_recognized=!0),fe.gemini?.status==="good"&&(G.gemini_confirmed=!0),Object.values(fe).filter(Ps=>Ps.status==="good").length>=5&&(G.full_ai_coverage=!0)}s&&s.length>=3&&(G.question_authority=!0);const Le=n?.bySource?Object.values(n.bySource).filter(fe=>fe.status==="good").length:0;return s&&s.length>=5&&Le>=5&&(G.ai_authority=!0),G},[s,L,n]),ue=async()=>await k({profileId:t.id}),be=()=>{O.current?.scrollIntoView({behavior:"smooth",block:"start"})},re=()=>{A.current?.scrollIntoView({behavior:"smooth",block:"start"})},he=()=>{ie.current?.scrollIntoView({behavior:"smooth",block:"start"}),localStorage.setItem(`visipage_visitors_checked_${t.id}`,"true"),u(!0)},Me=()=>{localStorage.setItem(`visipage_imported_${t.id}`,"true"),j(!0),D.invalidateQueries()},Ye=async G=>{await jn({profileId:t.id,section:"targetQuestions",data:[{question:G,priority:1}]}),D.invalidateQueries()},Ae=th(t.targetQuestions),Ue=an(),Bs=G=>{G?.preventDefault(),P.trim()&&(T(P),l(""),m(!0))},qe=G=>{T(G),m(!0)},As=G=>{const Le=Date.now()-new Date(G).getTime(),fe=Math.max(0,Math.floor(Le/6e4));if(fe<60)return`${fe}m ago`;const at=Math.floor(fe/60);return at<24?`${at}h ago`:`${Math.floor(at/24)}d ago`};return y.useEffect(()=>{if(N){const G=setTimeout(()=>{N==="create-article"||N==="share"?be():N==="score"?$.current?.scrollIntoView({behavior:"smooth",block:"start"}):N==="visitors"&&he(),ae(Le=>(Le.delete("action"),Le.delete("articleSlug"),Le),{replace:!0})},500);return()=>clearTimeout(G)}},[N,ae]),e.jsxs("div",{className:`${R.container} ${c||""}`,children:[!t.isPublished&&e.jsx(oa,{profile:t,onPublish:()=>Ue.mutate({profileId:t.id}),isPublishing:Ue.isPending}),e.jsx(ud,{profileName:t.name,lastVisitDate:i,articleCount:s?.length||0,profileId:t.id,profileSlug:t.slug||"",placements:L||[],aiMentionData:n,targetQuestions:Ae,onSaveTargetQuestion:Ye,onSeeArticles:be,onSeePlacements:re}),e.jsxs("div",{className:R.agentHeroCard,children:[e.jsxs("div",{className:R.agentHeroHeader,children:[e.jsx("div",{className:R.agentHeroIcon,children:e.jsx(Re,{size:20})}),e.jsxs("div",{children:[e.jsxs("div",{className:R.agentHeroTitleRow,children:[e.jsx("h3",{className:R.agentHeroTitle,children:"Your AI Agent"}),e.jsxs("div",{className:R.agentHeroStatus,children:[e.jsx("div",{className:R.agentHeroStatusDot}),e.jsx("span",{children:"Online"})]})]}),e.jsx("p",{className:R.agentHeroSubtitle,children:"It doesn't just answer questions â it takes action on your behalf."})]})]}),e.jsxs("form",{className:R.commandBarContainer,onSubmit:Bs,children:[e.jsx(Re,{size:20,className:R.commandBarBotIcon}),e.jsx("input",{className:R.commandBarInput,placeholder:"Tell your agent what to do...",value:P,onChange:G=>l(G.target.value)}),e.jsx(b,{type:"submit",size:"icon",className:R.commandBarButton,children:e.jsx(Xs,{size:18})})]}),e.jsxs("div",{className:R.suggestionChipsContainer,children:[e.jsxs("button",{type:"button",className:R.suggestionChip,onClick:()=>qe("Check my AI visibility"),children:[e.jsx(ss,{size:14})," Check my AI visibility"]}),e.jsxs("button",{type:"button",className:R.suggestionChip,onClick:()=>qe("Generate authority articles"),children:[e.jsx($e,{size:14})," Generate authority articles"]}),e.jsxs("button",{type:"button",className:R.suggestionChip,onClick:()=>qe("Submit to search engines"),children:[e.jsx(lt,{size:14})," Submit to search engines"]}),e.jsxs("button",{type:"button",className:R.suggestionChip,onClick:()=>qe("What should I improve?"),children:[e.jsx(nt,{size:14})," What should I improve?"]}),e.jsxs("button",{type:"button",className:R.suggestionChip,onClick:()=>qe("Show my latest results"),children:[e.jsx(is,{size:14})," Show my latest results"]}),e.jsxs("button",{type:"button",className:R.suggestionChip,onClick:()=>qe("Distribute my content"),children:[e.jsx(kt,{size:14})," Distribute my content"]})]}),e.jsxs("div",{className:R.recentActivityContainer,children:[e.jsx("h4",{className:R.recentActivityTitle,children:"Recent Activity"}),pe&&pe.length>0?e.jsx("div",{className:R.recentActivityList,children:pe.slice(0,3).map(G=>e.jsxs("div",{className:R.recentActivityItem,children:[e.jsx("span",{className:R.recentActivityDot,children:"â¢"}),e.jsx("span",{className:R.recentActivityText,children:G.title||G.lastMessagePreview||"New Conversation"}),e.jsx("span",{className:R.recentActivityTime,children:As(G.updatedAt)})]},G.id))}):e.jsx("div",{className:R.recentActivityEmpty,children:"No recent activity â start a conversation above!"})]})]}),e.jsx("div",{className:R.credentialsSection,children:e.jsx(gn,{credentialsEarned:de,isOwner:!0,isPublicView:!1})}),t.slug&&z?.qualifies&&xn(t.companyPlanTier,"linkedin_credential").allowed&&z.linkedInAddUrl&&e.jsx("div",{className:R.credentialSection,children:e.jsxs("a",{href:z.linkedInAddUrl,target:"_blank",rel:"noopener noreferrer",className:R.linkedinCredentialButton,children:[e.jsx(wt,{size:20}),"Add Credential to LinkedIn"]})}),e.jsx("div",{className:R.checklistSection,children:e.jsx(Ea,{profileSlug:t.slug||"",profileId:t.id,profileName:t.name,isClaimed:t.claimed,articleCount:s?.length||0,hasReviewedArticles:!1,targetQuestions:Ae,hasImportedContent:x,hasCheckedVisitors:E,onImportContent:()=>v(!0),onSaveTargetQuestion:Ye,onSeeArticles:be,onSeeVisitors:he,onClaimProfile:()=>U(`/profile/${t.slug}`),onRunAgent:()=>k({profileId:t.id}),hasSubmittedSuccessStory:W?.hasSubmitted})}),e.jsx("div",{className:R.identityChecklistSection,children:e.jsx(Ci,{profileId:t.id,profileName:t.name,profileType:t.profileType})}),e.jsx("div",{className:R.teamMembersSection,children:e.jsx(fn,{profileId:t.id,compact:!0,alwaysOpen:!0,isClaimed:t.claimed})}),e.jsx("div",{ref:ie,className:R.visitorsSection,children:e.jsx(yn,{profileId:t.id,subscriptionTier:a?.tier||"free",articles:s?.map(G=>({id:G.id,title:G.title,slug:G.slug}))})}),e.jsxs("div",{className:R.importBanner,children:[e.jsxs("div",{className:R.importBannerContent,children:[e.jsx("div",{className:R.importBannerIconWrapper,children:e.jsx($e,{className:R.importBannerIcon})}),e.jsxs("div",{className:R.importBannerText,children:[e.jsx("h3",{className:R.importBannerTitle,children:"Have your own bio?"}),e.jsx("p",{className:R.importBannerDescription,children:"Import it"})]})]}),e.jsx(b,{onClick:()=>v(!0),variant:"outline",size:"sm",children:"Import Content"})]}),e.jsx("div",{className:R.bannerSection,children:e.jsx(Ou,{profileId:t.id,profileName:t.name,hasSubmitted:W?.hasSubmitted??!1})}),e.jsxs("div",{className:R.sections,children:[e.jsx("div",{children:e.jsx(ap,{profileId:t.id,profileSlug:t.slug||"",profileName:t.name,profileType:t.profileType,profileSkills:Array.isArray(t.skills)?t.skills:null,profileTitle:t.title})}),e.jsx("div",{ref:$,children:e.jsx(so,{profileId:t.id,profileName:t.name,profileTitle:t.title,profileLocation:r,targetQuestions:Ae,latestArticleId:s?.[0]?.id||null,onFixThis:ue})}),e.jsx("div",{ref:A,children:e.jsx(Au,{profileId:t.id,articleId:s?.[0]?.id})}),e.jsx("div",{ref:C,children:e.jsx(Sl,{profileId:t.id,profileName:t.name,profileSlug:t.slug||"",profileTitle:t.title,profileLocation:r,isPublished:t.isPublished,articles:s||[],aiMentionData:n,targetQuestions:Ae,onSaveTargetQuestion:Ye,onRunAgent:()=>k({profileId:t.id}),onSeeArticles:be})}),e.jsx("div",{ref:O,children:e.jsx(oc,{articles:s||[],placements:L||[],profileSlug:t.slug||null,profileId:t.id,profileName:t.name,profileTitle:t.title,profileSkills:Array.isArray(t.skills)?t.skills:null,isManaging:d,managedProfileName:d?t.name:void 0})}),e.jsx("div",{children:e.jsx(Zp,{profileId:t.id,profileName:t.name})})]}),e.jsxs(gt,{open:g,onOpenChange:m,children:[e.jsx(vn,{asChild:!0,children:e.jsx(b,{className:R.floatingChatButton,size:"icon-lg","aria-label":"Open Agent Chat",children:e.jsx(Re,{size:24})})}),e.jsx(xt,{side:"right",className:R.chatSheet,children:e.jsx(An,{profileId:t.id,className:R.agentChatOverride,initialMessage:w,onInitialMessageSent:()=>T("")})})]}),e.jsx(vm,{open:h,onOpenChange:v,profileId:t.id,profileName:t.name,onImportComplete:Me})]})};function Qt(t,s){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);
vendor: 11,611 bytes, lines 5-6
5s&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,a)}return n}function Kt(t){for(var s=1;s<arguments.length;s++){var n=arguments[s]!=null?arguments[s]:{};s%2?Qt(Object(n),!0).forEach(function(a){ys(t,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Qt(Object(n)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(n,a))})}return t}function ct(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ct=function(s){return typeof s}:ct=function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},ct(t)}function ys(t,s,n){return s in t?Object.defineProperty(t,s,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[s]=n,t}function Fh(t,s){if(t==null)return{};var n={},a=Object.keys(t),i,r;for(r=0;r<a.length;r++)i=a[r],!(s.indexOf(i)>=0)&&(n[i]=t[i]);return n}function Vh(t,s){if(t==null)return{};var n=Fh(t,s),a,i;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(i=0;i<r.length;i++)a=r[i],!(s.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(t,a)&&(n[a]=t[a])}return n}function vs(t,s){return Yh(t)||Uh(t,s)||Qh(t,s)||Kh()}function Yh(t){if(Array.isArray(t))return t}function Uh(t,s){var n=t&&(typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"]);if(n!=null){var a=[],i=!0,r=!1,d,o;try{for(n=n.call(t);!(i=(d=n.next()).done)&&(a.push(d.value),!(s&&a.length===s));i=!0);}catch(c){r=!0,o=c}finally{try{!i&&n.return!=null&&n.return()}finally{if(r)throw o}}return a}}function Qh(t,s){if(t){if(typeof t=="string")return Xt(t,s);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xt(t,s)}}function Xt(t,s){(s==null||s>t.length)&&(s=t.length);for(var n=0,a=new Array(s);n<s;n++)a[n]=t[n];return a}function Kh(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 6In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var ge=function(s,n,a){var i=!!a,r=ee.useRef(a);ee.useEffect(function(){r.current=a},[a]),ee.useEffect(function(){if(!i||!s)return function(){};var d=function(){r.current&&r.current.apply(r,arguments)};return s.on(n,d),function(){s.off(n,d)}},[i,n,s,r])},Nt=function(s){var n=ee.useRef(s);return ee.useEffect(function(){n.current=s},[s]),n.current},Ve=function(s){return s!==null&&ct(s)==="object"},Xh=function(s){return Ve(s)&&typeof s.then=="function"},Jh=function(s){return Ve(s)&&typeof s.elements=="function"&&typeof s.createToken=="function"&&typeof s.createPaymentMethod=="function"&&typeof s.confirmCardPayment=="function"},Jt="[object Object]",Zh=function t(s,n){if(!Ve(s)||!Ve(n))return s===n;var a=Array.isArray(s),i=Array.isArray(n);if(a!==i)return!1;var r=Object.prototype.toString.call(s)===Jt,d=Object.prototype.toString.call(n)===Jt;if(r!==d)return!1;if(!r&&!a)return s===n;var o=Object.keys(s),c=Object.keys(n);if(o.length!==c.length)return!1;for(var N={},_=0;_<o.length;_+=1)N[o[_]]=!0;for(var g=0;g<c.length;g+=1)N[c[g]]=!0;var m=Object.keys(N);if(m.length!==o.length)return!1;var h=s,v=n,w=function(P){return t(h[P],v[P])};return m.every(w)},js=function(s,n,a){return Ve(s)?Object.keys(s).reduce(function(i,r){var d=!Ve(n)||!Zh(s[r],n[r]);return a.includes(r)?(d&&console.warn("Unsupported prop change: options.".concat(r," is not a mutable property.")),i):d?Kt(Kt({},i||{}),{},ys({},r,s[r])):i},null):null},bs="Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.",Zt=function(s){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:bs;if(s===null||Jh(s))return s;throw new Error(n)},e_=function(s){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:bs;if(Xh(s))return{tag:"async",stripePromise:Promise.resolve(s).then(function(i){return Zt(i,n)})};var a=Zt(s,n);return a===null?{tag:"empty"}:{tag:"sync",stripe:a}},t_=function(s){!s||!s._registerWrapper||!s.registerAppInfo||(s._registerWrapper({name:"react-stripe-js",version:"5.2.0"}),s.registerAppInfo({name:"react-stripe-js",version:"5.2.0",url:"https://stripe.com/docs/stripe-js/react"}))},vt=ee.createContext(null);vt.displayName="ElementsContext";var ws=function(s,n){if(!s)throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(n," in an <Elements> provider."));return s},Ns=function(s){var n=s.stripe,a=s.options,i=s.children,r=ee.useMemo(function(){return e_(n)},[n]),d=ee.useState(function(){return{stripe:r.tag==="sync"?r.stripe:null,elements:r.tag==="sync"?r.stripe.elements(a):null}}),o=vs(d,2),c=o[0],N=o[1];ee.useEffect(function(){var m=!0,h=function(w){N(function(T){return T.stripe?T:{stripe:w,elements:w.elements(a)}})};return r.tag==="async"&&!c.stripe?r.stripePromise.then(function(v){v&&m&&h(v)}):r.tag==="sync"&&!c.stripe&&h(r.stripe),function(){m=!1}},[r,c,a]);var _=Nt(n);ee.useEffect(function(){_!==null&&_!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[_,n]);var g=Nt(a);return ee.useEffect(function(){if(c.elements){var m=js(a,g,["clientSecret","fonts"]);m&&c.elements.update(m)}},[a,g,c.elements]),ee.useEffect(function(){t_(c.stripe)},[c.stripe]),ee.createElement(vt.Provider,{value:c},i)};Ns.propTypes={stripe:Z.any,options:Z.object};var s_=function(s){var n=ee.useContext(vt);return ws(n,s)},n_=function(){var s=s_("calls useElements()"),n=s.elements;return n};Z.func.isRequired;var Cs=ee.createContext(null);Cs.displayName="CheckoutContext";Z.any,Z.shape({clientSecret:Z.oneOfType([Z.string,Z.instanceOf(Promise)]).isRequired,elementsOptions:Z.object}).isRequired;var Ct=function(s){var n=ee.useContext(Cs),a=ee.useContext(vt);if(n){if(a)throw new Error("You cannot wrap the part of your app that ".concat(s," in both <CheckoutProvider> and <Elements> providers."));return n}else return ws(a,s)},a_=["mode"],i_=function(s){return s.charAt(0).toUpperCase()+s.slice(1)},ve=function(s,n){var a="".concat(i_(s),"Element"),i=function(c){var N=c.id,_=c.className,g=c.options,m=g===void 0?{}:g,h=c.onBlur,v=c.onFocus,w=c.onReady,T=c.onChange,P=c.onEscape,l=c.onClick,x=c.onLoadError,j=c.onLoaderStart,E=c.onNetworksChange,u=c.onConfirm,C=c.onCancel,O=c.onShippingAddressChange,A=c.onShippingRateChange,ie=c.onSavedPaymentMethodRemove,$=c.onSavedPaymentMethodUpdate,F=Ct("mounts <".concat(a,">")),ae="elements"in F?F.elements:null,U="checkoutState"in F?F.checkoutState:null,k=U?.type==="success"||U?.type==="loading"?U.sdk:null,L=ee.useState(null),D=vs(L,2),W=D[0],pe=D[1],z=ee.useRef(null),de=ee.useRef(null);ge(W,"blur",h),ge(W,"focus",v),ge(W,"escape",P),ge(W,"click",l),ge(W,"loaderror",x),ge(W,"loaderstart",j),ge(W,"networkschange",E),ge(W,"confirm",u),ge(W,"cancel",C),ge(W,"shippingaddresschange",O),ge(W,"shippingratechange",A),ge(W,"savedpaymentmethodremove",ie),ge(W,"savedpaymentmethodupdate",$),ge(W,"change",T);var ue;w&&(s==="expressCheckout"?ue=w:ue=function(){w(W)}),ge(W,"ready",ue),ee.useLayoutEffect(function(){if(z.current===null&&de.current!==null&&(ae||k)){var re=null;if(k)switch(s){case"payment":re=k.createPaymentElement(m);break;case"address":if("mode"in m){var he=m.mode,Me=Vh(m,a_);if(he==="shipping")re=k.createShippingAddressElement(Me);else if(he==="billing")re=k.createBillingAddressElement(Me);else throw new Error("Invalid options.mode. mode must be 'billing' or 'shipping'.")}else throw new Error("You must supply options.mode. mode must be 'billing' or 'shipping'.");break;case"expressCheckout":re=k.createExpressCheckoutElement(m);break;case"currencySelector":re=k.createCurrencySelectorElement();break;case"taxId":re=k.createTaxIdElement(m);break;default:throw new Error("Invalid Element type ".concat(a,". You must use either the <PaymentElement />, <AddressElement options={{mode: 'shipping'}} />, <AddressElement options={{mode: 'billing'}} />, or <ExpressCheckoutElement />."))}else ae&&(re=ae.create(s,m));z.current=re,pe(re),re&&re.mount(de.current)}},[ae,k,m]);var be=Nt(m);return ee.useEffect(function(){if(z.current){var re=js(m,be,["paymentRequest"]);re&&"update"in z.current&&z.current.update(re)}},[m,be]),ee.useLayoutEffect(function(){return function(){if(z.current&&typeof z.current.destroy=="function")try{z.current.destroy(),z.current=null}catch{}}},[]),ee.createElement("div",{id:N,className:_,ref:de})},r=function(c){Ct("mounts <".concat(a,">"));var N=c.id,_=c.className;return ee.createElement("div",{id:N,className:_})},d=n?r:i;return d.propTypes={id:Z.string,className:Z.string,onChange:Z.func,onBlur:Z.func,onFocus:Z.func,onReady:Z.func,onEscape:Z.func,onClick:Z.func,onLoadError:Z.func,onLoaderStart:Z.func,onNetworksChange:Z.func,onConfirm:Z.func,onCancel:Z.func,onShippingAddressChange:Z.func,onShippingRateChange:Z.func,onSavedPaymentMethodRemove:Z.func,onSavedPaymentMethodUpdate:Z.func,options:Z.object},d.displayName=a,d.__elementType=s,d},je=typeof window>"u",r_=ee.createContext(null);r_.displayName="EmbeddedCheckoutProviderContext";var o_=function(){var s=Ct("calls useStripe()"),n=s.stripe;return n};ve("auBankAccount",je);ve("card",je);ve("cardNumber",je);ve("cardExpiry",je);ve("cardCvc",je);ve("iban",je);var c_=ve("payment",je);ve("expressCheckout",je);ve("paymentRequestButton",je);ve("linkAuthentication",je);ve("address",je);ve("shippingAddress",je);ve("paymentMethodMessaging",je);ve("taxId",je);var Ss="clover",l_=function(s){return s===3?"v3":s},ks="https://js.stripe.com",d_="".concat(ks,"/").concat(Ss,"/stripe.js"),u_=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,m_=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/;var p_=function(s){return u_.test(s)||m_.test(s)},h_=function(){for(var s=document.querySelectorAll('script[src^="'.concat(ks,'"]')),n=0;n<s.length;n++){var a=s[n];if(p_(a.src))return a}return null},es=function(s){var n="",a=document.createElement("script");a.src="".concat(d_).concat(n);var i=document.head||document.body;if(!i)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return i.appendChild(a),a},__=function(s,n){!s||!s._registerWrapper||s._registerWrapper({name:"stripe-js",version:"8.0.0",startTime:n})},Qe=null,rt=null,ot=null,g_=function(s){return function(n){s(new Error("Failed to load Stripe.js",{cause:n}))}},x_=function(s,n){return function(){window.Stripe?s(window.Stripe):n(new Error("Stripe.js not available"))}},f_=function(s){return Qe!==null?Qe:(Qe=new Promise(function(n,a){if(typeof window>"u"||typeof document>"u"){n(null);return}if(window.Stripe){n(window.Stripe);return}try{var i=h_();if(!(i&&s)){if(!i)i=es(s);else if(i&&ot!==null&&rt!==null){var r;i.removeEventListener("load",ot),i.removeEventListener("error",rt),(r=i.parentNode)===null||r===void 0||r.removeChild(i),i=es(s)}}ot=x_(n,a),rt=g_(a),i.addEventListener("load",ot),i.addEventListener("error",rt)}catch(d){a(d);return}}),Qe.catch(function(n){return Qe=null,Promise.reject(n)}))},y_=function(s,n,a){if(s===null)return null;var i=n[0],r=i.match(/^pk_test/),d=l_(s.version),o=Ss;r&&d!==o&&console.warn("Stripe.js@".concat(d," was loaded on the page, but @stripe/stripe-js@").concat("8.0.0"," expected Stripe.js@").concat(o,". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));var c=s.apply(void 0,n);return __(c,a),c}
6,Ke,Ts=!1,Is=function(){return Ke||(Ke=f_(null).catch(function(s){return Ke=null,Promise.reject(s)}),Ke)};Promise.resolve().then(function(){return Is()}).catch(function(t){Ts||console.warn(t)});var v_=function(){for(var s=arguments.length,n=new Array(s),a=0;a<s;a++)n[a]=arguments[a];Ts=!0;var i=Date.now();return Is().then(function(r){return y_(r,n,i)})};const j_=xe({profileId:ne().uuid(),quantity:At().int().min(1,"Must purchase at least 1 credit")}),b_=async(t,s)=>{const n=j_.parse(t),a=await fetch("/_api/credits/purchase-intent",{method:"POST",body:Y.stringify(n),...s,headers:{"Content-Type":"application/json"}});if(!a.ok){const i=Y.parse(await a.text());throw new Error(i.error)}return Y.parse(await a.text())},w_=xe({profileId:ne().uuid(),intentId:ne().min(1,"Stripe PaymentIntent ID is required")}),N_=async(t,s)=>{const n=w_.parse(t),a=await fetch("/_api/credits/purchase-complete",{method:"POST",body:Y.stringify(n),...s,headers:{"Content-Type":"application/json"}});if(!a.ok){const i=Y.parse(await a.text());throw new Error(i.error)}return Y.parse(await a.text())},C_="pk_test_wcf6jF6s50icgZNfLg1FUN7a",S_="_overlay_wltqa_1",k_="_modal_wltqa_12",T_="_closeButton_wltqa_24",I_="_title_wltqa_41",B_="_subtitle_wltqa_48",A_="_loading_wltqa_54",P_="_spinner_wltqa_63",$_="_form_wltqa_76",L_="_summary_wltqa_82",E_="_summaryRow_wltqa_88",D_="_summaryValue_wltqa_96",R_="_summaryDivider_wltqa_101",M_="_summaryLabel_wltqa_107",q_="_summaryTotal_wltqa_112",H_="_paymentElement_wltqa_118",z_="_actions_wltqa_122",le={overlay:S_,modal:k_,closeButton:T_,title:I_,subtitle:B_,loading:A_,spinner:P_,form:$_,summary:L_,summaryRow:E_,summaryValue:D_,summaryDivider:R_,summaryLabel:M_,summaryTotal:q_,paymentElement:H_,actions:z_},O_=v_(C_),W_=({profileId:t,quantity:s,totalPrice:n,unitPrice:a,intentId:i,onClose:r,onSuccess:d})=>{const o=o_(),c=n_(),[N,_]=y.useState(!1),g=ke({mutationFn:()=>N_({profileId:t,intentId:i}),onSuccess:h=>{console.log("Purchase completed:",h),V.success(`ð ${h.creditsAdded} credits added! New balance: ${h.newBalance}`),d(),r()},onError:h=>{console.error("Failed to complete purchase:",h),V.error(h.message||"Payment failed. Please try again."),_(!1)}}),m=async h=>{if(h.preventDefault(),!(!o||!c)){_(!0);try{const{error:v}=await c.submit();if(v)throw new Error(v.message);const{error:w}=await o.confirmPayment({elements:c,confirmParams:{return_url:window.location.origin+"/pricing?success=true"},redirect:"if_required"});if(w)throw new Error(w.message);g.mutate()}catch(v){console.error("Payment error:",v),V.error(v instanceof Error?v.message:"Payment failed"),_(!1)}}};return e.jsxs("form",{onSubmit:m,className:le.form,children:[e.jsxs("div",{className:le.summary,children:[e.jsxs("div",{className:le.summaryRow,children:[e.jsx("span",{children:"Credits"}),e.jsx("span",{className:le.summaryValue,children:s})]}),e.jsxs("div",{className:le.summaryRow,children:[e.jsx("span",{children:"Unit Price"}),e.jsxs("span",{className:le.summaryValue,children:["$",(a/100).toFixed(2)]})]}),e.jsx("div",{className:le.summaryDivider}),e.jsxs("div",{className:le.summaryRow,children:[e.jsx("span",{className:le.summaryLabel,children:"Total"}),e.jsxs("span",{className:le.summaryTotal,children:["$",(n/100).toFixed(2)]})]})]}),e.jsx("div",{className:le.paymentElement,children:e.jsx(c_,{})}),e.jsxs("div",{className:le.actions,children:[e.jsx(b,{type:"button",variant:"outline",onClick:r,disabled:N,children:"Cancel"}),e.jsx(b,{type:"submit",disabled:!o||N,children:N?e.jsxs(e.Fragment,{children:[e.jsx(De,{className:le.spinner}),"Processing..."]}):`Pay $${(n/100).toFixed(2)}`})]})]})},G_=({profileId:t,quantity:s,onClose:n,onSuccess:a})=>{const[i,r]=y.useState(null),[d,o]=y.useState(""),[c,N]=y.useState(0),[_,g]=y.useState(0),m=ke({mutationFn:()=>b_({profileId:t,quantity:s}),onSuccess:h=>{console.log("Payment intent created:",h.intentId),r(h.clientSecret),o(h.intentId),N(h.totalPrice),g(h.unitPrice)},onError:h=>{console.error("Failed to create payment intent:",h),V.error(h.message||"Failed to initialize payment"),n()}});return y.useEffect(()=>{m.mutate()},[]),e.jsx("div",{className:le.overlay,onClick:n,children:e.jsxs("div",{className:le.modal,onClick:h=>h.stopPropagation(),children:[e.jsx("button",{className:le.closeButton,onClick:n,"aria-label":"Close",children:e.jsx(Fe,{size:20})}),e.jsx("h2",{className:le.title,children:"Complete Your Purchase"}),e.jsxs("p",{className:le.subtitle,children:["Buy ",s," credits for your Visipage account"]}),m.isPending&&e.jsxs("div",{className:le.loading,children:[e.jsx(De,{className:le.spinner}),e.jsx("p",{children:"Initializing payment..."})]}),i&&e.jsx(Ns,{stripe:O_,options:{clientSecret:i,appearance:{theme:"stripe",variables:{colorPrimary:"#4A90E2",colorBackgroun
6d:"#ffffff",colorText:"#1a1a1a",colorDanger:"#df1b41",fontFamily:"Inter, system-ui, sans-serif",spacingUnit:"4px",borderRadius:"8px"}}},children:e.jsx(W_,{profileId:t,quantity:s,totalPrice:c,unitPrice:_,intentId:d,onClose:n,onSuccess:a})})]})})},F_="_skeleton_wgen8_2",V_="_container_wgen8_9",Y_="_activeBanner_wgen8_17",U_="_rewardedBanner_wgen8_27",Q_="_content_wgen8_36",K_="_iconBox_wgen8_44",X_="_rewardIconBox_wgen8_56",J_="_successIcon_wgen8_68",Z_="_textSection_wgen8_72",eg="_badge_wgen8_79",tg="_headline_wgen8_93",sg="_headlinePersonal_wgen8_101",ng="_rewardSubtext_wgen8_109",ag="_goalIndicator_wgen8_116",ig="_goalText_wgen8_124",rg="_platformTags_wgen8_133",og="_platformTag_wgen8_133",cg="_articleTitle_wgen8_145",lg="_mutedNote_wgen8_151",dg="_rewardText_wgen8_157",ug="_actions_wgen8_164",mg="_closeButton_wgen8_172",pg="_formWrapper_wgen8_180",hg="_inlineForm_wgen8_188",_g="_inputField_wgen8_196",gg="_formActions_wgen8_200",xg="_focusedContainer_wgen8_218",fg="_focusedHeader_wgen8_232",yg="_focusedHeadline_wgen8_240",vg="_focusedHeadlinePersonal_wgen8_241",jg="_focusedRewardRow_wgen8_249",bg="_focusedRewardText_wgen8_257",wg="_focusedArticleCard_wgen8_263",Ng="_focusedSteps_wgen8_273",Cg="_focusedMutedNote_wgen8_279",Sg="_focusedStep_wgen8_273",kg="_stepNumber_wgen8_296",Tg="_stepContent_wgen8_309",Ig="_stepTitle_wgen8_316",Bg="_focusedForm_wgen8_323",Ag="_skipLink_wgen8_329",Pg="_focusedSuccessCard_wgen8_346",$g="_successIconLarge_wgen8_355",Lg="_dashboardButton_wgen8_360",Eg="_actionButton_wgen8_376",S={skeleton:F_,container:V_,activeBanner:Y_,rewardedBanner:U_,content:Q_,iconBox:K_,rewardIconBox:X_,successIcon:J_,textSection:Z_,badge:eg,headline:tg,headlinePersonal:sg,rewardSubtext:ng,goalIndicator:ag,goalText:ig,platformTags:rg,platformTag:og,articleTitle:cg,mutedNote:lg,rewardText:dg,actions:ug,closeButton:mg,formWrapper:pg,inlineForm:hg,inputField:_g,formActions:gg,focusedContainer:xg,focusedHeader:fg,focusedHeadline:yg,focusedHeadlinePersonal:vg,focusedRewardRow:jg,focusedRewardText:bg,focusedArticleCard:wg,focusedSteps:Ng,focusedMutedNote:Cg,focusedStep:Sg,stepNumber:kg,stepContent:Tg,stepTitle:Ig,focusedForm:Bg,skipLink:Ag,focusedSuccessCard:Pg,successIconLarge:$g,dashboardButton:Lg,actionButton:Eg},ts=({profileId:t,profileSlug:s,className:n="",focusedMode:a=!1,onComplete:i})=>{const{data:r,isLoading:d}=xs(t),o=fs(t),[c,N]=y.useState(!1),[_,g]=y.useState(!1),[m,h]=y.useState(""),v=r?.challenge,w=r?.personalGoal;if(y.useEffect(()=>{if(v?.id){const j=localStorage.getItem(`visipage_share_reward_dismissed_${v.id}`)==="true";N(j)}},[v?.id]),d)return e.jsx(se,{className:S.skeleton});if(!v||v.status==="rewarded"&&c)return null;const T=`https://visipage.ai/profile/${s||""}/knowledge/${v.articleSlug}`,P=()=>{navigator.clipboard.writeText(T),V.success("Article link copied!")},l=()=>{N(!0),localStorage.setItem(`visipage_share_reward_dismissed_${v.id}`,"true")},x=j=>{if(j.preventDefault(),!m.includes("linkedin.com")){V.error("Please enter a valid LinkedIn URL");return}o.mutate({challengeId:v.id,linkedinUrl:m},{onSuccess:()=>{g(!1),h("")}})};if(v.status==="rewarded")return a?e.jsx("div",{className:`${S.focusedContainer} ${n}`,children:e.jsxs("div",{className:S.focusedSuccessCard,children:[e.jsx(Ie,{className:S.successIconLarge,size:48}),e.jsx("h3",{className:S.focusedHeadline,children:"Action Verified!"}),e.jsxs("p",{className:S.rewardText,children:["Backlink created. Your article is now linked from LinkedIn.",w?` You've taken a key step toward ${w.title}.`:""]}),e.jsxs("p",{className:S.rewardSubtext,children:["You've unlocked ",v.creditsAwarded||3," credits + ",v.articlesGenerated||3," bonus articles to keep the momentum going."]}),e.jsx(b,{onClick:()=>i?.(),className:S.dashboardButton,children:"Go to Dashboard"})]})}):e.jsx("div",{className:`${S.container} ${S.rewardedBanner} ${n}`,children:e.jsxs("div",{className:S.content,children:[e.jsx("div",{className:S.rewardIconBox,children:e.jsx(Ie,{className:S.successIcon,size:20})}),e.jsxs("div",{className:S.textSection,children:[e.jsxs("p",{className:S.rewardText,children:["Backlink created. Your article is now linked from LinkedIn.",w?` You've taken a key step toward ${w.title}.`:""]}),e.jsxs("p",{className:S.rewardSubtext,style:{marginTop:"0.25rem",marginBottom:0},children:["You've unlocked ",v.creditsAwarded||3," credits + ",v.articlesGenerated||3," bonus articles to keep the momentum going."]})]}),e.jsx(b,{variant:"ghost",size:"icon-sm",onClick:l,className:S.closeButton,children:e.jsx(Fe,{size:16})})]})});if(v.status==="active"){if(a){const E=`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(T)}`;return e.jsxs("div",{className:`${S.focusedContainer} ${n}
6`,children:[e.jsxs("div",{className:S.focusedHeader,children:[w?e.jsx("h2",{className:S.focusedHeadlinePersonal,children:w.actionSummary}):e.jsx("h2",{className:S.focusedHeadline,children:"Share your article on LinkedIn"}),e.jsxs("div",{className:S.focusedRewardRow,children:[e.jsx("div",{className:S.badge,children:"AI Visibility Action"}),e.jsx("span",{className:S.focusedRewardText,children:"Creates a verified backlink from LinkedIn"})]}),w&&e.jsxs("div",{className:S.goalIndicator,children:[e.jsxs("span",{className:S.goalText,children:["ð¯ Goal: Close ",w.gap.difference," ",w.gap.metric]}),w.platformsAffected&&w.platformsAffected.length>0&&!w.platformsAffected.some(u=>u.toLowerCase()==="all")&&e.jsx("div",{className:S.platformTags,children:w.platformsAffected.map(u=>e.jsx(ye,{variant:"secondary",className:S.platformTag,children:u},u))})]})]}),e.jsxs("div",{className:S.focusedArticleCard,children:[e.jsx("strong",{children:"Article to share:"})," ",v.articleTitle]}),e.jsxs("div",{className:S.focusedSteps,children:[e.jsxs("div",{className:S.focusedStep,children:[e.jsx("div",{className:S.stepNumber,children:"1"}),e.jsxs("div",{className:S.stepContent,children:[e.jsx("h4",{className:S.stepTitle,children:"Copy your article link"}),e.jsx("div",{children:e.jsxs(b,{variant:"secondary",onClick:P,children:[e.jsx(Ge,{size:16})," Copy Article Link"]})})]})]}),e.jsxs("div",{className:S.focusedStep,children:[e.jsx("div",{className:S.stepNumber,children:"2"}),e.jsxs("div",{className:S.stepContent,children:[e.jsx("h4",{className:S.stepTitle,children:"Share it on LinkedIn"}),e.jsx("div",{children:e.jsx(b,{asChild:!0,variant:"outline",children:e.jsxs("a",{href:E,target:"_blank",rel:"noreferrer",children:[e.jsx(wt,{size:16})," Share on LinkedIn"]})})})]})]}),e.jsxs("div",{className:S.focusedStep,children:[e.jsx("div",{className:S.stepNumber,children:"3"}),e.jsxs("div",{className:S.stepContent,children:[e.jsx("h4",{className:S.stepTitle,children:"Paste your LinkedIn post URL"}),e.jsxs("form",{className:S.focusedForm,onSubmit:x,children:[e.jsx(Je,{placeholder:"https://www.linkedin.com/posts/...",value:m,onChange:u=>h(u.target.value)}),e.jsx("div",{children:e.jsx(b,{type:"submit",disabled:o.isPending||!m.includes("linkedin.com"),children:o.isPending?"Claiming...":"Confirm & Track My Backlink"})})]})]})]})]}),e.jsxs("p",{className:S.focusedMutedNote,children:["You'll unlock ",v.creditsAwarded||3," credits + ",v.articlesGenerated||3," bonus articles to keep the momentum going."]}),e.jsx("button",{type:"button",className:S.skipLink,onClick:()=>i?.(),children:"Skip to dashboard â"})]})}return e.jsxs("div",{className:`${S.container} ${S.activeBanner} ${n}`,children:[e.jsxs("div",{className:S.content,children:[e.jsx("div",{className:S.iconBox,children:e.jsx(wt,{size:28})}),e.jsxs("div",{className:S.textSection,children:[e.jsx("div",{className:S.badge,children:"AI Visibility Action"}),w?e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:S.headlinePersonal,children:w.actionSummary}),e.jsx("p",{className:S.rewardSubtext,children:"Share on LinkedIn to strengthen your AI authority signal"})]}):e.jsx("h3",{className:S.headline,children:"Share your article on LinkedIn to strengthen your AI authority signal"}),e.jsxs("p",{className:S.articleTitle,children:[e.jsx("strong",{children:"Article to share:"})," ",v.articleTitle]}),e.jsxs("p",{className:S.mutedNote,style:{marginTop:"0.25rem",marginBottom:0},children:["You'll unlock ",v.creditsAwarded||3," credits + ",v.articlesGenerated||3," bonus articles to keep the momentum going."]}),w&&e.jsxs("div",{className:S.goalIndicator,children:[e.jsxs("span",{className:S.goalText,children:["ð¯ Goal: Close ",w.gap.difference," ",w.gap.metric]}),w.platformsAffected&&w.platformsAffected.length>0&&!w.platformsAffected.some(j=>j.toLowerCase()==="all")&&e.jsx("div",{className:S.platformTags,children:w.platformsAffected.map(j=>e.jsx(ye,{variant:"secondary",className:S.platformTag,children:j},j))})]})]}),e.jsxs("div",{className:S.actions,children:[e.jsxs(b,{variant:"secondary",onClick:P,className:S.actionButton,children:[e.jsx(Ge,{size:16})," Copy Article Link"]}),e.jsxs(b,{onClick:()=>g(!0),disabled:_,className:S.actionButton,children:["I Shared It â Track My Progress ",e.jsx(Pe,{size:16})]})]})]}),_&&e.jsx("form",{className:S.formWrapper,onSubmit:x,children:e.jsxs("div",{className:S.inlineForm,children:[e.jsx(Je,{placeholder:"Paste your LinkedIn post URL here...",value:m,onChange:j=>h(j.target.value),autoFocus:!0,className:S.inputField}),e.jsxs("div",{className:S.formActions,children:[e.jsx(b,{type:"submit",disabled:o.isPending||!m.includes("linkedin.com"),children:o.isPending?"Claiming...":"Confirm & Track My Backlink"}),e.jsx(b,{type:"button",variant:"ghost",onClick:()=>g(!1),disabled:o.isPending,children:"Cancel"})]})]})})]})}return null},Dg="_banner_kplhw_1",Rg="_active_kplhw_14",Mg="_expired_kplhw_23",qg="_header_kplhw_32",Hg="_title_kplhw_38",zg="_titleSuffix_kplhw_46",Og="_activeIcon_kplhw_51",Wg="_expiredIcon_kplhw_56",Gg="_description_kplhw_61",Fg="_actions_kplhw_69",Vg="_actionLink_kplhw_76",Yg="_closeButton_kplhw_91",Ug="_codeChip_kplhw_117",Qg="_codeChipText_kplhw_143",Kg="_copySuccess_kplhw_147",Xg="_copyIcon_kplhw_151",oe={banner:Dg,active:Rg,expired:Mg,header:qg,title:Hg,titleSuffix:zg,activeIcon:Og,expiredIcon:Wg,description:Gg,actions:Fg,actionLink:Vg,closeButton:Yg,codeChip:Ug,codeChipText:Qg,copySuccess:Kg,copyIcon:Xg},Jg=({isOnChatGptTrial:t,chatGptTrialDaysRemaining:s,chatGptTrialDiscountCode:n,trialExpired:a=!1})=>{const[i,r]=y.useState(!1),[d,o]=y.useState(()=>{if(typeof window>"u")return!1;const _=`visipage_trial_banner_dismissed_${n||"default"}`;return localStorage.getItem(_)==="true"});y.useEffect(()=>{const _=`visipage_trial_banner_dismissed_${n||"default"}`,g=localStorage.getItem(_)==="true";o(g)},[n]);const c=()=>{const _=`visipage_trial_banner_dismissed_${n||"default"}`;localStorage.setItem(_,"true"),o(!0)},N=()=>{n&&(navigator.clipboard.writeText(n),r(!0),setTimeout(()=>r(!1),2e3))};return d?null:t?e.jsxs("div",{className:`${oe.banner} ${oe.active}`,role:"alert",children:[e.jsx("button",{onClick:c,className:oe.closeButton,"aria-label":"Dismiss banner",children:e.jsx(Fe,{size:18})}),e.jsxs("div",{className:oe.header,children:[e.jsx(nt,{className:oe.activeIcon,size:20}),e.jsxs("h3",{className:oe.title,children:["Gold Access Active",s!==null&&e.jsxs("span",{className:oe.titleSuffix,children:[" ","â ",s," day",s===1?"":"s"," remaining"]})]})]}),e.jsx("p",{className:oe.description,children:"You have full access to all Visipage features. Explore AI monitoring, content distribution, visitor intelligence, and unlimited article generation."}),e.jsx("div",{className:oe.actions,children:e.jsx(Se,{to:"/pricing",className:oe.actionLink,children:"See all features â"})})]}):a?e.jsxs("div",{className:`${oe.banner} ${oe.expired}`,role:"alert",children:[e.jsx("button",{onClick:c,className:oe.closeButton,"aria-label":"Dismiss banner",children:e.jsx(Fe,{size:18})}),e.jsxs("div",{className:oe.header,children:[e.jsx(Js,{className:oe.expiredIcon,size:20}),e.jsx("h3",{className:oe.title,children:"Your 7-day Gold trial has ended"})]}),e.jsxs("p",{className:oe.description,children:["Use code"," ",n?e.jsxs("button",{className:oe.codeChip,onClick:N,title:"Copy discount code",type:"button",children:[e.jsx("span",{className:oe.codeChipText,children:n}),i?e.jsx(Oe,{size:14,className:oe.copySuccess}):e.jsx(Ge,{size:14,className:oe.copyIcon})]}):null," ","to get a special rate on any plan. Without a paid plan, article generation is limited to 1/month and AI monitoring is disabled."]}),e.jsx("div",{className:oe.actions,children:e.jsx(b,{asChild:!0,size:"sm",children:e.jsx("a",{href:Mn,target:"_blank",rel:"noopener noreferrer",children:"Talk to our team"})})})]}):null},Zg="_bannerWrapper_19a4c_1",ex="_bannerContainer_19a4c_8",tx="_content_19a4c_19",sx="_icon_19a4c_26",nx="_textContainer_19a4c_31",ax="_message_19a4c_39",ix="_successMessage_19a4c_43",rx="_errorMessage_19a4c_48",ox="_actions_19a4c_53",cx="_resendButton_19a4c_60",lx="_dism
6issButton_19a4c_69",Ce={bannerWrapper:Zg,bannerContainer:ex,content:tx,icon:sx,textContainer:nx,message:ax,successMessage:ix,errorMessage:rx,actions:ox,resendButton:cx,dismissButton:lx},dx=()=>{const{authState:t}=rs(),[s,n]=y.useState(!1),a=qn();if(t.type!=="authenticated"||s||t.user.emailVerifiedAt)return null;const r=()=>{a.mutate({})};return e.jsx("div",{className:Ce.bannerWrapper,children:e.jsxs("div",{className:Ce.bannerContainer,children:[e.jsxs("div",{className:Ce.content,children:[e.jsx(Xe,{size:18,className:Ce.icon}),e.jsxs("div",{className:Ce.textContainer,children:[e.jsx("span",{className:Ce.message,children:"Please verify your email address to keep your account secure."}),a.isSuccess&&e.jsx("span",{className:Ce.successMessage,children:"A new confirmation link has been sent."}),a.isError&&e.jsx("span",{className:Ce.errorMessage,children:a.error.message})]})]}),e.jsxs("div",{className:Ce.actions,children:[!a.isSuccess&&e.jsx(b,{variant:"outline",size:"sm",onClick:r,disabled:a.isPending,className:Ce.resendButton,children:a.isPending?"Sending...":"Resend email"}),e.jsx("button",{onClick:()=>n(!0),className:Ce.dismissButton,"aria-label":"Dismiss banner",children:e.jsx(Fe,{size:16})})]})]})})},ux="_main_n0r70_1",mx="_backgroundGradient_n0r70_9",px="_topBanner_n0r70_20",hx="_container_n0r70_25",_x="_dashboardLayout_n0r70_35",gx="_emptyState_n0r70_43",xx="_emptyStateIcon_n0r70_56",fx="_emptyStateTitle_n0r70_61",yx="_emptyStateText_n0r70_68",vx="_profileSwitcher_n0r70_75",jx="_profileSwitcherLabel_n0r70_86",bx="_profileSwitcherCount_n0r70_93",wx="_profileSelectTrigger_n0r70_99",Nx="_profileOption_n0r70_104",Cx="_profileTypeBadge_n0r70_110",Sx="_skeletonContainer_n0r70_121",kx="_skeletonHeader_n0r70_127",Tx="_managementBanner_n0r70_134",Ix="_managementBannerContent_n0r70_148",Bx="_managementIcon_n0r70_154",Ax="_managementText_n0r70_158",Px="_managementSubtext_n0r70_163",$x="_backButton_n0r70_168",te={main:ux,backgroundGradient:mx,topBanner:px,container:hx,dashboardLayout:_x,emptyState:gx,emptyStateIcon:xx,emptyStateTitle:fx,emptyStateText:yx,profileSwitcher:vx,profileSwitcherLabel:jx,profileSwitcherCount:bx,profileSelectTrigger:wx,profileOption:Nx,profileTypeBadge:Cx,skeletonContainer:Sx,skeletonHeader:kx,managementBanner:Tx,managementBannerContent:Ix,managementIcon:Bx,managementText:Ax,managementSubtext:Px,backButton:$x},Lx=()=>e.jsxs("div",{className:te.skeletonContainer,children:[e.jsxs("div",{className:te.skeletonHeader,children:[e.jsx(se,{style:{height:"2.5rem",width:"250px"}}),e.jsx(se,{style:{height:"2.5rem",width:"150px"}})]}),e.jsx(se,{style:{height:"400px",width:"100%"}}),e.jsx(se,{style:{height:"600px",width:"100%"}})]});function _f(){const[t,s]=y.useState(!1),[n,a]=y.useState(1),[i,r]=y.useState(null),[d,o]=y.useState(()=>localStorage.getItem("visipage_dashboard_profile")),[c,N]=y.useState(""),[_,g]=It(),m=_.get("action"),h=_.get("articleSlug");y.useEffect(()=>{const z=localStorage.getItem("visipage_last_visit");r(z),localStorage.setItem("visipage_last_visit",new Date().toISOString())},[]);const{authState:v}=rs(),w=_.get("profileId"),T=v.type==="authenticated"?v.user:null,P=T?.role==="admin"||T?.role==="agency",l=!!(w&&P),{data:x,isFetching:j,error:E}=rn(),{data:u,isFetching:C,error:O}=on(l?w:null),A=l?C:j,ie=l?O:E;let $=null;if(l)$=u||null;else if(x&&x.length>0){if(d){const z=x.find(de=>de.id===d);z&&($=z)}$||($=[...x].sort((z,de)=>{const ue=z.updatedAt?new Date(z.updatedAt).getTime():0;return(de.updatedAt?new Date(de.updatedAt).getTime():0)-ue})[0])}y.useEffect(()=>{$&&$.name&&N($.name)},[$?.id,$?.name]);const F=z=>{o(z),localStorage.setItem("visipage_dashboard_profile",z)},{data:ae}=os({profileId:$?.id||""}),{data:U}=Pt($?.id||""),{data:k}=cn({profileId:$?.id||""}),{data:L}=Wn({profileId:$?.id||""}),{data:D}=bn($?.id);as();const W=x?x.map(z=>({value:z.id,label:e.jsxs("div",{className:te.profileOption,children:[e.jsx("span",{children:z.name}),e.jsx("span",{className:te.profileTypeBadge,children:z.profileType==="person"?"Person":"Company"})]}),displayText:z.name})):[],pe=()=>{if(A&&!$)return e.jsx(Lx,{});if(ie)return e.jsxs("div",{className:te.emptyState,children:[e.jsx("h2",{className:te.emptyStateTitle,children:"Error Loading Profile"}),e.jsx("p",{className:te.emptyStateText,children:"There was an issue fetching your profile data. Please try again later."}),e.jsx(b,{asChild:!0,children:e.jsxs(Se,{to:"/",children:[e.jsx(bt,{size:16})," Go Back Home"]})})]});if(!$)return e.jsxs("div",{className:te.emptyState,children:[e.jsx(is,{size:48,className:te.emptyStateIcon}),e.jsx("h2",{className:te.emptyStateTitle,children:"Create Your First Profile"}),e.jsx("p",{className:te.emptyStateText,children:"Get started by creating your AI-optimized profile. It takes less than a minute."}),e.jsx(b,{asChild:!0,children:e.jsx(Se,{to:"/",children:"Create Your Profile"})})]});const z=m==="share-challenge",de=!!(k?.chatGptTrialDiscountCode&&!k?.isOnChatGptTrial);return z?e.jsx(ts,{profileId:$.id,profileSlug:$.slug||void 0,focusedMode:!0,onComplete:()=>{g(ue=>(ue.delete("action"),ue),{replace:!0})}}):e.jsxs("div",{className:te.dashboardLayout,children:[!l&&$&&e.jsx(ts,{profileId:$.id,profileSlug:$.slug||void 0}),l&&$&&e.jsxs("div",{className:te.managementBanner,children:[e.jsxs("div",{className:te.managementBannerContent,children:[e.jsx(Zs,{size:20,className:te.managementIcon}),e.jsxs("div",{className:te.managementText,children:[e.jsxs("strong",{children:["Managing profile for ",$.name]}),e.jsx("span",{className:te.managementSubtext,children:"You are viewing this dashboard as an administrator."})]})]}),e.jsx(b,{asChild:!0,variant:"outline",size:"sm",className:te.backButton,children:e.jsxs(Se,{to:"/admin/profiles",children:[e.jsx(bt,{size:14})," Back to List"]})})]}),$&&k&&(k.isOnChatGptTrial||de)&&e.jsx(Jg,{isOnChatGptTrial:k.isOnChatGptTrial,chatGptTrialDaysRemaining:k.chatGptTrialDaysRemaining,chatGptTrialDiscountCode:k.chatGptTrialDiscountCode,trialExpired:de}),!l&&x&&x.length>1&&$&&e.jsxs("div",{className:te.profileSwitcher,children:[e.jsx("span",{className:te.profileSwitcherLabel,children:"Viewing:"}),e.jsx("div",{className:te.profileSelectTrigger,children:e.jsx(Rn,{options:W,value:W.find(ue=>ue.value===$.id),onValueChange:ue=>F(ue.value),inputValue:c,onInputValueChange:N,placeholder:"Search profiles...",emptyMessage:"No profiles found",allowFreeForm:!1})}),e.jsxs("span",{className:te.profileSwitcherCount,children:[x.length," profiles available"]})]}),e.jsx(Gh,{profile:$,articles:ae,aiMentionData:U,subscription:k,usage:L,
6creditWallet:D,isManaging:l,managedProfileId:w,lastVisitDate:i,profileLocation:$.geoPlacename||$.geoRegion||null,initialAction:m,actionArticleSlug:h})]})};return e.jsxs(e.Fragment,{children:[e.jsx("title",{children:"Dashboard | Visipage.io"}),e.jsx("meta",{name:"description",content:"View analytics and manage your Visipage profile."}),e.jsx("meta",{name:"robots",content:"noindex, nofollow"}),e.jsx(ln,{currentPage:"dashboard"}),e.jsxs("main",{className:te.main,children:[e.jsx("div",{className:te.backgroundGradient}),e.jsx("div",{className:te.topBanner,children:e.jsx(dx,{})}),e.jsx("div",{className:te.container,children:pe()})]}),!1,t&&$&&e.jsx(G_,{profileId:$.id,quantity:n,onClose:()=>s(!1),onSuccess:()=>{s(!1)}})]})}export{_f 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.