1import{r as i,j as e,P as V,z as oe,A as P,t as zt,v as Kt,E as Y,x as J,y as qt,a7 as Vt,a8 as Ht,a9 as Yt,aa as Oe,ab as Qt,ac as Wt,ad as Xt,ae as Jt,af as $e,ag as Zt,ah as es,ai as Fe,u as ts,S as ss,a as q,aj as Be,ak as Q,al as Ue,am as as,an as rs,ao as os,ap as _e,J as ns,C as L,d as G,D as is,I as ze,B as T,T as Ke,W as qe,L as Z,aq as ls,ar as ds,K as Ve,as as cs,Q as W,at as pe,e as xe,au as us,av as ms,aw as ps,ax as xs,q as hs,X as fs,ay as gs,az as bs,aA as vs,aB as js,aC as ys,aD as Ns,aE as ws}from"./index-CbHoMDdL.js";import{T as ks}from"./tool-hero-Cdip8y96.js";import{C as he,a as Cs,b as De}from"./trackerUpgradeCta-CSZdUtCA.js";import{R as Ps,c as He,I as Ss}from"./index-BxcHBYLg.js";import{C as As,L as Rs,T as Ts}from"./tactics-panel-B6tCo55t.js";import{g as _s,B as X,X as ee,Y as te,f as Ds,T as Is,R as fe,C as ge,a as be,d as Es,b as Ms,L as Ls,c as Gs}from"./tracker-scorecard-DpVfm_dw.js";import{P as Os}from"./plus-C8MuuEzH.js";var Ie=_s({chartName:"BarChart",GraphicalChild:X,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:ee},{axisType:"yAxis",AxisComp:te}],formatAxisMap:Ds}),Ne="Progress",we=100,[$s]=oe(Ne),[Fs,Bs]=$s(Ne),Ye=i.forwardRef((t,s)=>{const{__scopeProgress:a,value:r=null,max:o,getValueLabel:l=Us,...m}=t;(o||o===0)&&!Ee(o)&&console.error(zs(`${o}`,"Progress"));const p=Ee(o)?o:we;r!==null&&!Me(r,p)&&console.error(Ks(`${r}`,"Progress"));const n=Me(r,p)?r:null,u=se(n)?l(n,p):void 0;return e.jsx(Fs,{scope:a,value:n,max:p,children:e.jsx(V.div,{"aria-valuemax":p,"aria-valuemin":0,"aria-valuenow":se(n)?n:void 0,"aria-valuetext":u,role:"progressbar","data-state":Xe(n,p),"data-value":n??void 0,"data-max":p,...m,ref:s})})});Ye.displayName=Ne;var Qe="ProgressIndicator",We=i.forwardRef((t,s)=>{const{__scopeProgress:a,...r}=t,o=Bs(Qe,a);return e.jsx(V.div,{"data-state":Xe(o.value,o.max),"data-value":o.value??void 0,"data-max":o.max,...r,ref:s})});We.displayName=Qe;function Us(t,s){return`${Math.round(t/s*100)}%`}function Xe(t,s){return t==null?"indeterminate":t===s?"complete":"loading"}function se(t){return typeof t=="number"}function Ee(t){return se(t)&&!isNaN(t)&&t>0}function Me(t,s){return se(t)&&!isNaN(t)&&t<=s&&t>=0}function zs(t,s){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${s}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${we}\`.`}function Ks(t,s){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${s}\`. The \`value\` prop must be: 2 - a positive number 3 - less than the value passed to \`max\` (or ${we} if no \`max\` prop is set) 4 - \`null\` or \`undefined\` if the progress is indeterminate. 5 6Defaulting to \`null\`.`}var Je=Ye,qs=We;const Ze=i.forwardRef(({className:t,value:s,...a},r)=>e.jsx(Je,{ref:r,className:P("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...a,children:e.jsx(qs,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(s||0)}%)`}})}));Ze.displayName=Je.displayName;var ke="Radio",[Vs,et]=oe(ke),[Hs,ne]=Vs(ke);function tt(t){const{__scopeRadio:s,checked:a=!1,children:r,disabled:o,form:l,name:m,onCheck:p,required:n,value:u="on",internal_do_not_use_render:h}=t,[g,j]=i.useState(null),[w,S]=i.useState(null),R=i.useRef(!1),M=g?!!l||!!g.closest("form"):!0,k={checked:a,disabled:o,required:n,name:m,form:l,value:u,control:g,setControl:j,hasConsumerStoppedPropagationRef:R,isFormControl:M,bubbleInput:w,setBubbleInput:S,onCheck:()=>p?.()};return e.jsx(Hs,{scope:s,...k,children:Qs(h)?h(k):r})}var st="RadioTrigger",Ce=i.forwardRef(({__scopeRadio:t,onClick:s,...a},r)=>{const{checked:o,disabled:l,value:m,setControl:p,onCheck:n,hasConsumerStoppedPropagationRef:u,isFormControl:h,bubbleInput:g}=ne(st,t),j=Y(r,p);return e.jsx(V.button,{type:"button",role:"radio","aria-checked":o,"data-state":nt(o),"data-disabled":l?"":void 0,disabled:l,value:m,...a,ref:j,onClick:J(s,w=>{o||n(),g&&h&&(u.current=w.isPropagationStopped(),u.current||w.stopPropagation())})})});Ce.displayName=st;var Ys=i.forwardRef((t,s)=>{const{__scopeRadio:a,name:r,checked:o,required:l,disabled:m,value:p,onCheck:n,form:u,...h}=t;return e.jsx(tt,{__scopeRadio:a,checked:o,disabled:m,required:l,onCheck:n,name:r,form:u,value:p,internal_do_not_use_render:({isFormControl:g})=>e.jsxs(e.Fragment,{children:[e.jsx(Ce,{...h,ref:s,__scopeRadio:a}),g&&e.jsx(Pe,{__scopeRadio:a})]})})});Ys.displayName=ke;var at="RadioIndicator",rt=i.forwardRef((t,s)=>{const{__scopeRadio:a,forceMount:r,...o}=t,l=ne(at,a);return e.jsx(qt,{present:r||l.checked,children:e.jsx(V.span,{"data-state":nt(l.checked),"data-disabled":l.disabled?"":void 0,...o,ref:s})})});rt.displayName=at;var ot="RadioBubbleInput",Pe=i.forwardRef(({__scopeRadio:t,...s},a)=>{const{control:r,checked:o,required:l,disabled:m,name:p,value:n,form:u,bubbleInput:h,setBubbleInput:g,hasConsumerStoppedPropagationRef:j}=ne(ot,t),w=Y(a,g),S=Vt(o),R=Ht(r);i.useEffect(()=>{const k=h;if(!k)return;const y=window.HTMLInputElement.prototype,I=Object.getOwnPropertyDescriptor(y,"checked").set,_=!j.current;if(S!==o&&I){const O=new Event("click",{bubbles:_});I.call(k,o),k.dispatchEvent(O)}},[h,S,o,j]);const M=i.useRef(o);return e.jsx(V.input,{type:"radio","aria-hidden":!0,defaultChecked:M.current,required:l,disabled:m,name:p,value:n,form:u,...s,tabIndex:-1,ref:w,style:{...s.style,...R,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Pe.displayName=ot;function Qs(t){return typeof t=="function"}function nt(t){return t?"checked":"unchecked"}var Ws=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],ie="RadioGroup",[Xs]=oe(ie,[He,et]),it=He(),le=et(),[Js,Zs]=Xs(ie),Se=i.forwardRef((t,s)=>{const{__scopeRadioGroup:a,name:r,defaultValue:o,value:l,required:m=!1,disabled:p=!1,orientation:n,dir:u,loop:h=!0,onValueChange:g,...j}=t,w=it(a),S=zt(u),[R,M]=Kt({prop:l,defaultProp:o??null,onChange:g,caller:ie});return e.jsx(Js,{scope:a,name:r,required:m,disabled:p,value:R,onValueChange:M,children:e.jsx(Ps,{asChild:!0,...w,orientation:n,dir:S,loop:h,children:e.jsx(V.div,{role:"radiogroup","aria-required":m,"aria-orientation":n,"data-disabled":p?"":void 0,dir:S,...j,ref:s})})})});Se.displayName=ie;var ea="RadioGroupItem",ta="RadioGroupItemProvider",lt="RadioGroupItemTrigger",sa="RadioGroupItemBubbleInput";function aa(t){const{__scopeRadioGroup:s,value:a,disabled:r,children:o,internal_do_not_use_render:l}=t,m=Zs(ta,s),p=le(s),n=m.disabled||r;return e.jsx(tt,{...p,checked:m.value===a,disabled:n,required:m.required,name:m.name,value:a,onCheck:()=>m.onValueChange(a),internal_do_not_use_render:l,children:o})}var dt=i.forwardRef((t,s)=>{const{__scopeRadioGroup:a,...r}=t,o=it(a),l=le(a),{checked:m,disabled:p}=ne(lt,l.__scopeRadio),n=i.useRef(null),u=Y(s,n),h=i.useRef(!1);return i.useEffect(()=>{const g=w=>{Ws.includes(w.key)&&(h.current=!0)},j=()=>h.current=!1;return document.addEventListener("keydown",g),document.addEventListener("keyup",j),()=>{document.removeEventListener("keydown",g),document.removeEventListener("keyup",j)}},[]),e.jsx(Ss,{asChild:!0,...o,focusable:!p,active:m,children:e.jsx(Ce,{...l,...r,ref:u,onKeyDown:J(r.onKeyDown,g=>{g.key==="Enter"&&g.preventDefault()}
6),onFocus:J(r.onFocus,()=>{h.current&&n.current?.click()})})})});dt.displayName=lt;var Ae=i.forwardRef((t,s)=>{const{__scopeRadioGroup:a,value:r,disabled:o,...l}=t;return e.jsx(aa,{__scopeRadioGroup:a,value:r,disabled:o,internal_do_not_use_render:({isFormControl:m})=>e.jsxs(e.Fragment,{children:[e.jsx(dt,{...l,ref:s,__scopeRadioGroup:a}),m&&e.jsx(ct,{__scopeRadioGroup:a})]})})});Ae.displayName=ea;var ct=i.forwardRef((t,s)=>{const{__scopeRadioGroup:a,...r}=t,o=le(a);return e.jsx(Pe,{...o,...r,ref:s})});ct.displayName=sa;var ra="RadioGroupIndicator",ut=i.forwardRef((t,s)=>{const{__scopeRadioGroup:a,...r}=t,o=le(a);return e.jsx(rt,{...o,...r,ref:s})});ut.displayName=ra;const mt=i.forwardRef(({className:t,...s},a)=>e.jsx(Se,{className:P("grid gap-2",t),...s,ref:a}));mt.displayName=Se.displayName;const ve=i.forwardRef(({className:t,...s},a)=>e.jsx(Ae,{ref:a,className:P("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),...s,children:e.jsx(ut,{className:"flex items-center justify-center",children:e.jsx(As,{className:"h-3.5 w-3.5 fill-primary"})})}));ve.displayName=Ae.displayName;var pt="AlertDialog",[oa]=oe(pt,[Oe]),$=Oe(),xt=t=>{const{__scopeAlertDialog:s,...a}=t,r=$(s);return e.jsx(Yt,{...r,...a,modal:!0})};xt.displayName=pt;var na="AlertDialogTrigger",ia=i.forwardRef((t,s)=>{const{__scopeAlertDialog:a,...r}=t,o=$(a);return e.jsx(es,{...o,...r,ref:s})});ia.displayName=na;var la="AlertDialogPortal",ht=t=>{const{__scopeAlertDialog:s,...a}=t,r=$(s);return e.jsx(Qt,{...r,...a})};ht.displayName=la;var da="AlertDialogOverlay",ft=i.forwardRef((t,s)=>{const{__scopeAlertDialog:a,...r}=t,o=$(a);return e.jsx(Zt,{...o,...r,ref:s})});ft.displayName=da;var gt="AlertDialogContent",[ca,ua]=oa(gt),bt=i.forwardRef((t,s)=>{const{__scopeAlertDialog:a,children:r,...o}=t,l=$(a),m=i.useRef(null),p=Y(s,m),n=i.useRef(null);return e.jsx(ca,{scope:a,cancelRef:n,children:e.jsx(Wt,{role:"alertdialog",...l,...o,ref:p,onOpenAutoFocus:J(o.onOpenAutoFocus,u=>{u.preventDefault(),n.current?.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:r})})});bt.displayName=gt;var ma="AlertDialogTitle",vt=i.forwardRef((t,s)=>{const{__scopeAlertDialog:a,...r}=t,o=$(a);return e.jsx(Xt,{...o,...r,ref:s})});vt.displayName=ma;var pa="AlertDialogDescription",jt=i.forwardRef((t,s)=>{const{__scopeAlertDialog:a,...r}=t,o=$(a);return e.jsx(Jt,{...o,...r,ref:s})});jt.displayName=pa;var xa="AlertDialogAction",yt=i.forwardRef((t,s)=>{const{__scopeAlertDialog:a,...r}=t,o=$(a);return e.jsx($e,{...o,...r,ref:s})});yt.displayName=xa;var Nt="AlertDialogCancel",wt=i.forwardRef((t,s)=>{const{__scopeAlertDialog:a,...r}=t,{cancelRef:o}=ua(Nt,a),l=$(a),m=Y(s,o);return e.jsx($e,{...l,...r,ref:m})});wt.displayName=Nt;var ha=xt,fa=ht,kt=ft,Ct=bt,Pt=yt,St=wt,At=vt,Rt=jt;const ga=ha,ba=fa,Tt=i.forwardRef(({className:t,...s},a)=>e.jsx(kt,{className:P("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s,ref:a}));Tt.displayName=kt.displayName;const _t=i.forwardRef(({className:t,...s},a)=>e.jsxs(ba,{children:[e.jsx(Tt,{}),e.jsx(Ct,{ref:a,className:P("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...s})]}));_t.displayName=Ct.displayName;const Dt=({className:t,...s})=>e.jsx("div",{className:P("flex flex-col space-y-2 text-center sm:text-left",t),...s});Dt.displayName="AlertDialogHeader";const It=({className:t,...s})=>e.jsx("div",{className:P("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s});It.displayName="AlertDialogFooter";const Et=i.forwardRef(({className:t,...s},a)=>e.jsx(At,{ref:a,className:P("text-lg font-semibold",t),...s}));Et.displayName=At.displayName;const Mt=i.forwardRef(({className:t,...s},a)=>e.jsx(Rt,{ref:a,className:P("text-sm text-muted-foreground",t),...s}));Mt.displayName=Rt.displayName;const Lt=i.forwardRef(({className:t,...s},a)=>e.jsx(Pt,{ref:a,className:P(Fe(),t),...s}));Lt.displayName=Pt.displayName;const Gt=i.forwardRef(({className:t,...s},a)=>e.jsx(St,{ref:a,className:P(Fe({variant:"outline"}),"mt-2 sm:mt-0",t),...s}));Gt.displayName=St.displayName;function va(){const t=new Date;t.setDate(t.getDate()-90);const s=t.toISOString().slice(0,10);return s<"2025-08-01"?"2025-08-01":s}function Le(){return new Date().toISOString().slice(0,10)}function ue({label:t,value:s,valueColor:a}){return e.jsxs("div",{className:"rounded-lg border bg-muted/30 px-4 py-3 text-center",children:[e.jsx("p",{className:P("text-2xl font-bold tabular-nums",a),children:s}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t})]})}function ja({brandHint:t}){const[s,a]=i.useState(!1),[r,o]=i.useState(""),[l,m]=i.useState("keyword"),[p,n]=i.useState(va()),[u,h]=i.useState(Le()),[g,j]=i.useState("week"),[w,S]=i.useState(""),[R,M]=i.useState(!1),k=cs();i.useEffect(()=>{t&&!R&&(o(t),M(!0))},[t,R]);const y=()=>{r.trim()&&k.mutate({data:{target:r.trim(),target_type:l,date_from:p,date_to:u,group_range:g,...w?{platform:w}:{}}})},f=k.data,I=k.isPending,_=k.error,O=_?.status,b=_?.data?.error,D=f?.new_lost.reduce((d,A)=>d+A.new_mentions,0)??0,C=f?.new_lost.reduce((d,A)=>d+A.lost_mentions,0)??0,E=f?.delta.reduce((d,A)=>d+A.delta_mentions,0)??0;return e.jsx(L,{className:"mb-8",children:e.jsxs(G,{className:"pt-6",children:[e.jsxs("button",{type:"button",className:"flex w-full items-center justify-between text-left",onClick:()=>a(d=>!d),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{className:"h-5 w-5 text-primary"}),e.jsx("h2",{className:"text-lg font-semibold",children:"AI Visibility Trends"})]}),s?e.jsx(pe,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(xe,{className:"h-4 w-4 text-muted-foreground"})]}),s&&e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"See how often your brand is mentioned in AI responses over time, and which periods had the most new or lost citations."}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-sm font-medium",children:"Brand or domain"}),e.jsx(ze,{value:r,onChange:d=>o(d.target.value),placeholder:"yoursite.com or Your Brand",maxLength:500})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-sm font-medium",children:"Type"}),e.jsx("div",{className:"flex gap-2",children:["keyword","domain"].map(d=>e.jsx("button",{type:"button",onClick:()=>m(d),className:P("flex-1 rounded-md border px-3 py-2 text-sm font-medium transition-colors",l===d?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-input hover:bg-accent"),children:d==="keyword"?"Brand name":"Domain"},d))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-sm font-medium",children:"From"}),e.jsx("input",{type:"date",className:"h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm r
6ing-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",min:"2025-08-01",max:u,value:p,onChange:d=>n(d.target.value)})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-sm font-medium",children:"To"}),e.jsx("input",{type:"date",className:"h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",min:p,max:Le(),value:u,onChange:d=>h(d.target.value)})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-sm font-medium",children:"Group by"}),e.jsx("div",{className:"flex gap-2",children:["day","week","month"].map(d=>e.jsx("button",{type:"button",onClick:()=>j(d),className:P("flex-1 rounded-md border px-3 py-2 text-sm font-medium capitalize transition-colors",g===d?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-input hover:bg-accent"),children:d},d))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-sm font-medium",children:"Platform"}),e.jsx("div",{className:"flex gap-2",children:[{value:"",label:"Both"},{value:"google",label:"Google AI"},{value:"chat_gpt",label:"ChatGPT"}].map(d=>e.jsx("button",{type:"button",onClick:()=>S(d.value),className:P("flex-1 rounded-md border px-3 py-2 text-sm font-medium transition-colors",w===d.value?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-input hover:bg-accent"),children:d.label},d.value))}),w==="chat_gpt"&&e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"ChatGPT data is US/English only."})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[e.jsxs(T,{onClick:y,disabled:!r.trim()||I,children:[e.jsx(W,{className:"h-4 w-4"}),I?"Fetchingâ¦":"Fetch trends"]}),I&&e.jsx("span",{className:"text-sm text-muted-foreground",children:"This can take up to 2 minutes for large date ranges."}),f&&!I&&f.cache_hit&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"Cached result, refreshes every 24 hours."})]}),k.error&&e.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-destructive/50 bg-destructive/10 px-4 py-3",children:[e.jsx(Ve,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),e.jsx("p",{className:"text-sm text-destructive",children:O===402?"Daily data budget exceeded. Try again tomorrow.":O===503?"Trend data requires DataForSEO credentials. Contact support.":O===504?b??"Request timed out. Try a shorter date range or month-level grouping.":b??"Could not fetch trend data. Please try again."})]}),f&&!I&&e.jsxs("div",{className:"space-y-6 pt-2",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsx(ue,{label:"Net change",value:E===0?"0":E>0?`+${E.toLocaleString()}`:E.toLocaleString(),valueColor:E>0?"text-green-600":E<0?"text-red-600":void 0}),e.jsx(ue,{label:"New mentions",value:D>0?`+${D.toLocaleString()}`:"0",valueColor:D>0?"text-green-600":void 0}),e.jsx(ue,{label:"Lost mentions",value:C>0?`-${C.toLocaleString()}`:"0",valueColor:C>0?"text-red-600":void 0})]}),f.delta.length===0&&f.new_lost.length===0?e.jsxs("div",{className:"py-10 text-center text-muted-foreground",children:[e.jsx(W,{className:"mx-auto mb-2 h-8 w-8 opacity-30"}),e.jsx("p",{className:"text-sm",children:"No mention data found for this target and date range."}),e.jsx("p",{className:"mt-1 text-xs",children:"Try a broader date range, or switch between brand name and domain type."})]}):e.jsxs("div",{className:"space-y-8",children:[f.delta.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"mb-1 text-sm font-semibold",children:"Mention change per period"}),e.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Green bars show periods where AI citation counts went up; red bars show periods where they fell."}),e.jsx(fe,{width:"100%",height:200,children:e.jsxs(Ie,{data:f.delta,margin:{top:4,right:4,left:-16,bottom:0},children:[e.jsx(ge,{strokeDasharray:"3 3",vertical:!1}),e.jsx(ee,{dataKey:"date_from",tick:{fontSize:11}
6,tickFormatter:K}),e.jsx(te,{tick:{fontSize:11}}),e.jsx(be,{formatter:d=>[d>=0?`+${d.toLocaleString()}`:d.toLocaleString(),"Change"],labelFormatter:K}),e.jsx(X,{dataKey:"delta_mentions",radius:[3,3,0,0],children:f.delta.map((d,A)=>e.jsx(Es,{fill:d.delta_mentions>=0?"#16a34a":"#dc2626",fillOpacity:.85},A))})]})})]}),f.new_lost.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"mb-1 text-sm font-semibold",children:"New vs lost mentions per period"}),e.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Pages where AI assistants newly cited your brand vs pages where they stopped."}),e.jsx(fe,{width:"100%",height:220,children:e.jsxs(Ie,{data:f.new_lost,margin:{top:4,right:4,left:-16,bottom:0},children:[e.jsx(ge,{strokeDasharray:"3 3",vertical:!1}),e.jsx(ee,{dataKey:"date_from",tick:{fontSize:11},tickFormatter:K}),e.jsx(te,{tick:{fontSize:11}}),e.jsx(be,{formatter:(d,A)=>[d.toLocaleString(),A==="new_mentions"?"New":"Lost"],labelFormatter:K}),e.jsx(Ms,{formatter:d=>d==="new_mentions"?"New":"Lost",iconType:"circle",iconSize:8}),e.jsx(X,{dataKey:"new_mentions",fill:"#16a34a",fillOpacity:.85,radius:[3,3,0,0]}),e.jsx(X,{dataKey:"lost_mentions",fill:"#dc2626",fillOpacity:.85,radius:[3,3,0,0]})]})})]})]})]})]})]})})}const ya=[{value:"chatgpt",label:"ChatGPT"},{value:"claude",label:"Claude"},{value:"gemini",label:"Gemini"},{value:"perplexity",label:"Perplexity"}],Na={chatgpt:"ChatGPT",claude:"Claude",gemini:"Gemini",perplexity:"Perplexity"},me=[{value:"chatgpt",label:"ChatGPT",color:"#10a37f"},{value:"gemini",label:"Gemini",color:"#3138F6"},{value:"perplexity",label:"Perplexity",color:"#7c3aed"},{value:"claude",label:"Claude",color:"#d97706"}],Ot=5,ae=50,re=100,$t="$27",Ft="$37";function wa(t){return t==="ultra"?"Ultra Pro":t==="pro"?"Pro":"Free"}function Bt(t){return t>=67?"text-emerald-600":t>=34?"text-amber-600":"text-rose-600"}function ka(t){return t.length>0?t[0].toUpperCase()+t.slice(1):t}function Ge(t){return t.length<=1?t.join(""):t.length===2?`${t[0]} and ${t[1]}`:`${t.slice(0,-1).join(", ")}, and ${t[t.length-1]}`}function je(t){return t?new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}):"Never checked"}function ye(t){const s=t.latestResults.filter(a=>a.status==="ok");return s.length>0&&s.every(a=>!a.mentioned)}function Ca(t){switch(t.status){case"ok":return t.mentioned?{label:"Mentioned",tone:"text-emerald-600",icon:"yes"}:{label:"Not mentioned",tone:"text-muted-foreground",icon:"no"};case"not_configured":return{label:"Not configured",tone:"text-muted-foreground",icon:"muted"};case"budget_exceeded":return{label:"At capacity",tone:"text-amber-600",icon:"muted"};default:return{label:"Check failed",tone:"text-rose-600",icon:"muted"}}}function Ka({tool:t}){const{isLoaded:s,isSignedIn:a}=ts();return e.jsxs(e.Fragment,{children:[e.jsx(ss,{path:`/tools/${t.slug}`}),e.jsxs("div",{className:"container mx-auto px-4 py-12 max-w-5xl",children:[e.jsx(ks,{tool:t}
6),s?a?e.jsx(Ra,{}):e.jsx(Sa,{}):e.jsx(Pa,{}),e.jsx(La,{})]})]})}function Pa(){return e.jsxs("div",{className:"space-y-4 max-w-3xl",children:[e.jsx(q,{className:"h-24 w-full rounded-xl"}),e.jsx(q,{className:"h-40 w-full rounded-xl"}),e.jsx(q,{className:"h-40 w-full rounded-xl"})]})}function Sa(){return e.jsxs("div",{className:"max-w-3xl",children:[e.jsx(L,{className:"mb-10 border-primary/20 bg-primary/5",children:e.jsxs(G,{className:"py-8 px-6 sm:px-8",children:[e.jsxs("div",{className:"flex items-center gap-2 text-primary mb-3",children:[e.jsx(qe,{className:"h-5 w-5"}),e.jsx("span",{className:"text-sm font-semibold uppercase tracking-wide",children:"Free account required"})]}),e.jsx("h2",{className:"text-2xl font-bold mb-3",children:"Start tracking your brand across AI assistants"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:"Save the prompts your customers ask, and see whether ChatGPT, Claude, Gemini, and Perplexity name your brand. Track up to 5 prompts free, no credit card needed. Checks run automatically every 7 days."}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx(T,{asChild:!0,size:"lg",children:e.jsx(Z,{href:"/sign-up",children:"Create a free account"})}),e.jsx(T,{asChild:!0,variant:"outline",size:"lg",children:e.jsx(Z,{href:"/sign-in",children:"Sign in"})})]})]})}),e.jsx("div",{className:"grid gap-4 sm:grid-cols-3 mb-12",children:[{title:"Add your prompts",body:"List the questions your customers ask AI, and name the brand you want to watch for."},{title:"Check across 4 models",body:"Run each prompt through ChatGPT, Claude, Gemini, and Perplexity. We check automatically every 7 days, or you can run a manual check any time."},{title:"Watch the trend",body:"Every check is saved, so you can see your AI visibility rise or fall over time."}].map(t=>e.jsx(L,{children:e.jsxs(G,{className:"pt-6",children:[e.jsx("h3",{className:"font-semibold mb-1.5",children:t.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t.body})]})},t.title))}),e.jsx(Aa,{})]})}function Aa(){return e.jsxs("div",{className:"grid gap-4 sm:grid-cols-3 max-w-4xl",children:[e.jsx(L,{children:e.jsxs(G,{className:"pt-6",children:[e.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[e.jsx("h3",{className:"font-semibold text-lg",children:"Free"}),e.jsx("span",{className:"text-2xl font-bold",children:"$0"})]}),e.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1.5",children:[e.jsxs("li",{children:["Track up to ",Ot," prompts"]}),e.jsx("li",{children:"All 4 AI assistants"}),e.jsx("li",{children:"Checked weekly"}),e.jsx("li",{children:"Full check history and trends"})]})]})}),e.jsx(L,{className:"border-primary/30",children:e.jsxs(G,{className:"pt-6",children:[e.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[e.jsx("h3",{className:"font-semibold text-lg",children:"Pro"}),e.jsxs("span",{className:"text-2xl font-bold",children:[$t,e.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"/mo"})]})]}),e.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1.5",children:[e.jsxs("li",{children:["Track up to ",ae," prompts"]}),e.jsx("li",{children:"All 4 AI assistants"}),e.jsx("li",{children:"Checked weekly"}),e.jsx("li",{children:"Full check history and trends"})]})]})}),e.jsx(L,{className:"border-primary/50",children:e.jsxs(G,{className:"pt-6",children:[e.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[e.jsx("h3",{className:"font-semibold text-lg",children:"Ultra Pro"}),e.jsxs("span",{className:"text-2xl font-bold",children:[Ft,e.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"/mo"})]})]}),e.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1.5",children:[e.jsxs("li",{children:["Track up to ",re," prompts"]}),e.jsx("li",{children:"All 4 AI assistants"}),e.jsx("li",{children:"Option to check daily"}),e.jsx("li",{children:"Full check history and trends"})]})]})})]})}function Ra(){const t=Be(),{toast:s}=Q(),a=Ue(),r=as(),o=rs(),l=os(),[m,p]=i.useState(""),[n,u]=i.useState(""),[h,g]=i.useState(["chatgpt","claude","gemini","perplexity"]),[j,w]=i.useState(!1),[S,R]=i.useState(new Set),[M,k]=i.useState(!1),y=a.data,f=r.data??[],I=i.useMemo(()=>["chatgpt","claude","gemini","perplexity"].map(x=>{let v=0,N=0,U=0;for(const H of f){H.models.includes(x)&&v++;const z=H.latestResults.find(Te=>Te.platform===x&&Te.status==="ok");z&&(N++,z.mentioned&&U++)}return{platform:x,tracked:v,checked:N,appeared:U}}),[f]),_=f.filter(c=>S.has(c.id)).length,O=f.length>0&&_===f.length,b=(c,x)=>{R(v=>{const N=new Set(v);return x?N.add(c):N.delete(c),N})},D=c=>{R(c?new Set(f.map(x=>x.id)):new Set)},C=()=>{w(!1),R(new Set)},E=()=>{const c=f.filter(x=>S.has(x.id)).map(x=>x.id);c.length!==0&&l.mutate({data:{promptIds:c}},{onSuccess:x=>{k(!1),C(),ce(),s({title:x.deleted===1?"1 prompt removed":`${x.deleted} prompts removed`})},onError:()=>{s({title:"Could not remove prompts",description:"Something went wrong. Please try again.",variant:"destructive"})}})},d=y?y.used>=y.limit:!1,A=y&&y.limit>0?Math.min(100,Math.round(y.used/y.limit*100)):0;i.useEffect(()=>{const c=new URLSearchParams(window.location.search),x=c.get("upgrade");if(x){if(x==="success"){t.invalidateQueries({queryKey:_e()});const v=c.get("plan"),N=v==="ultra"?re:v==="pro"?ae:null;s({title:"Your plan is active",description:N?`You can now track up to ${N} prompts.`:"Your upgraded plan is now active."})}
6else x==="cancelled"&&s({title:"Checkout cancelled",description:"No changes were made to your plan."});window.history.replaceState({},"",window.location.pathname)}},[]);const F=(c,x)=>{g(v=>x?[...new Set([...v,c])]:v.filter(N=>N!==c))},B=(()=>{const c=new Set,x=[];for(const v of m.split(` 7`)){const N=v.trim();!N||c.has(N)||(c.add(N),x.push(N))}return x})(),de=y?Math.max(0,y.limit-y.used):null,Re=B.length>0&&n.trim().length>0&&h.length>0&&!d&&!o.isPending,ce=()=>{t.invalidateQueries({queryKey:vs()}),t.invalidateQueries({queryKey:_e()})},Ut=()=>{Re&&o.mutate({data:{promptTexts:B,brandName:n.trim(),models:h}},{onSuccess:c=>{const x=c.created.length,v=c.alreadyTracked.length,N=c.skippedForLimit;if(ce(),x===0){const z=[];v>0&&z.push(`${v} already on your list`),N>0&&z.push(`${N} skipped because you reached your limit`),s({title:"Nothing added",description:z.length>0?ka(Ge(z))+".":"No new prompts to add.",variant:"destructive"});return}p(""),u(""),g(["chatgpt","claude","gemini","perplexity"]);const U=[];v>0&&U.push(`${v} already tracked`),N>0&&U.push(`${N} skipped because you reached your limit`);const H=x===1?"1 prompt added":`${x} prompts added`;s({title:U.length>0?`${H}, ${Ge(U)}`:H,description:x===1?"Run a check to see how AI answers it.":"We're checking them across your selected assistants now."})},onError:()=>{s({title:"Could not add prompts",description:"Something went wrong. Please try again.",variant:"destructive"})}})};return e.jsxs("div",{className:"max-w-3xl",children:[f.length>0&&e.jsx(Is,{platforms:I,showReportLink:!0}
7),y&&e.jsxs("div",{className:"mb-8",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm font-medium",children:[y.used," of ",y.limit," prompts tracked"]}),e.jsx(ns,{variant:y.tier==="free"?"secondary":"default",children:wa(y.tier)})]}),y.tier!=="free"&&e.jsx(_a,{})]}),e.jsx(Ze,{value:A,className:"h-2"})]}),d&&y?.tier==="free"&&e.jsx(Ta,{}),e.jsx(ja,{brandHint:f[0]?.brandName??""}),e.jsx(L,{className:"mb-10",children:e.jsxs(G,{className:"pt-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-1.5 block",children:"Prompts to track"}),e.jsx(is,{value:m,onChange:c=>p(c.target.value),placeholder:`best project management tools for small teams 8project management software for agencies 9top tools to manage client projects`,rows:4,disabled:d}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["One prompt per line. Write each the way a customer would ask an AI assistant.",B.length>0&&e.jsxs("span",{className:"text-foreground font-medium",children:[" ",B.length===1?"1 prompt will be added":`${B.length} prompts will be added`,de!==null&&B.length>de?` (${de} will fit, the rest are over your limit).`:"."]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-1.5 block",children:"Brand to watch for"}),e.jsx(ze,{value:n,onChange:c=>u(c.target.value),placeholder:"Your brand name",maxLength:120,disabled:d})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"AI assistants"}),e.jsx("div",{className:"flex flex-wrap gap-4",children:ya.map(c=>e.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[e.jsx(he,{checked:h.includes(c.value),onCheckedChange:x=>F(c.value,x===!0),disabled:d}),c.label]},c.value))})]}),e.jsxs("div",{className:"flex items-center gap-3 pt-1",children:[e.jsxs(T,{onClick:Ut,disabled:!Re,children:[e.jsx(Os,{className:"h-4 w-4"}),o.isPending?"Addingâ¦":B.length>1?"Add prompts":"Add prompt"]}),h.length===0&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"Pick at least one assistant."})]})]})}),e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-xl font-bold",children:"Your tracked prompts"}),f.length>0&&(j?e.jsx(T,{variant:"ghost",size:"sm",onClick:C,children:"Cancel"}):e.jsxs(T,{variant:"outline",size:"sm",onClick:()=>w(!0),children:[e.jsx(Rs,{className:"h-4 w-4"}),"Select"]}))]}),j&&f.length>0&&e.jsxs("div",{className:"flex items-center justify-between mb-4 rounded-lg border bg-muted/40 px-4 py-2",children:[e.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[e.jsx(he,{checked:O,onCheckedChange:c=>D(c===!0)}),"Select all"]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[_," selected"]}),e.jsxs(T,{variant:"destructive",size:"sm",disabled:_===0||l.isPending,onClick:()=>k(!0),children:[e.jsx(Ke,{className:"h-4 w-4"}),"Delete selected"]})]})]}),r.isLoading?e.jsxs("div",{className:"space-y-4",children:[e.jsx(q,{className:"h-40 w-full rounded-xl"}),e.jsx(q,{className:"h-40 w-full rounded-xl"})]}):f.length===0?e.jsx(L,{children:e.jsx(G,{className:"py-12 text-center text-muted-foreground",children:"No prompts yet. Add your first one above to start tracking your AI visibility."})}):e.jsx("div",{className:"space-y-4",children:f.map(c=>e.jsx(Da,{prompt:c,onChanged:ce,selectable:j,selected:S.has(c.id),onToggleSelected:x=>b(c.id,x)},c.id))}),e.jsx(ga,{open:M,onOpenChange:k,children:e.jsxs(_t,{children:[e.jsxs(Dt,{children:[e.jsxs(Et,{children:["Remove ",_===1?"this prompt":`${_} prompts`,"?"]}),e.jsxs(Mt,{children:["This permanently deletes the selected ",_===1?"prompt":"prompts"," and their check history. This cannot be undone."]})]}),e.jsxs(It,{children:[e.jsx(Gt,{disabled:l.isPending,children:"Cancel"}),e.jsx(Lt,{onClick:c=>{c.preventDefault(),E()},disabled:l.isPending,children:l.isPending?"Removingâ¦":"Delete"})]})]})}),e.jsx(Ts,{tool:"ai-prompt-tracker",contextData:f.length>0&&f.some(c=>
9c.latestResults.some(x=>x.status==="ok"))?{brandName:f[0]?.brandName??"",totalPrompts:f.length,mentionRate:(()=>{const c=f.filter(v=>v.latestResults.some(N=>N.status==="ok")),x=c.filter(v=>!ye(v)).length;return c.length>0?Math.round(x/c.length*100):0})(),gapPrompts:f.filter(ye).map(c=>({promptText:c.promptText})),successPrompts:f.filter(c=>{const x=c.latestResults.filter(v=>v.status==="ok");return x.length>0&&x.some(v=>v.mentioned)}).map(c=>({promptText:c.promptText}))}:null})]})}function Ta(){const{toast:t}=Q(),s=ds(),[a,r]=i.useState(null),[o,l]=i.useState(!1),m=p=>{r(p),l(!1),s.mutate({data:{plan:p}},{onSuccess:n=>{if(n?.url){window.location.href=n.url;return}r(null),l(!0),t(De)},onError:()=>{r(null),l(!0),t(De)}})};return e.jsx(L,{className:"mb-8 border-primary/30 bg-primary/5",children:e.jsxs(G,{className:"py-6 px-6",children:[e.jsxs("h3",{className:"font-semibold mb-1",children:["You've reached your free limit of ",Ot," prompts"]}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:["Upgrade to track more prompts. Pick Pro for up to ",ae," prompts checked weekly, or Ultra Pro for up to ",re," prompts with the option to check daily."]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"rounded-lg border bg-background p-4",children:[e.jsxs("div",{className:"flex items-baseline justify-between mb-1",children:[e.jsx("span",{className:"font-semibold",children:"Pro"}),e.jsxs("span",{className:"font-bold",children:[$t,e.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"/mo"})]})]}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-3",children:["Up to ",ae," prompts, checked weekly."]}),e.jsx(T,{className:"w-full",onClick:()=>m("pro"),disabled:s.isPending,children:s.isPending&&a==="pro"?"Starting checkoutâ¦":"Upgrade to Pro"})]}),e.jsxs("div",{className:"rounded-lg border border-primary/40 bg-background p-4",children:[e.jsxs("div",{className:"flex items-baseline justify-between mb-1",children:[e.jsx("span",{className:"font-semibold",children:"Ultra Pro"}),e.jsxs("span",{className:"font-bold",children:[Ft,e.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"/mo"})]})]}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-3",children:["Up to ",re," prompts, with the option to check daily."]}),e.jsx(T,{className:"w-full",onClick:()=>m("ultra"),disabled:s.isPending,children:s.isPending&&a==="ultra"?"Starting checkoutâ¦":"Upgrade to Ultra Pro"})]})]}),o&&e.jsxs("div",{role:"alert",className:"mt-4 flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:[e.jsx(Ve,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsx("span",{children:Cs})]})]})})}function _a(){const{toast:t}=Q(),s=ls(),a=()=>{s.mutate(void 0,{onSuccess:r=>{if(r?.url){window.location.href=r.url;return}t({title:"Could not open billing",description:"Please try again in a moment.",variant:"destructive"})},onError:()=>{t({title:"Could not open billing",description:"Please try again in a moment.",variant:"destructive"})}})};return e.jsx(T,{variant:"outline",size:"sm",onClick:a,disabled:s.isPending,children:s.isPending?"Openingâ¦":"Manage billing"})}function Da({prompt:t,onChanged:s,selectable:a=!1,selected:r=!1,onToggleSelected:o}){const l=Be(),{toast:m}=Q(),[p,n]=i.useState(!1),[u,h]=i.useState(new Set),g=b=>{h(D=>{const C=new Set(D);return C.has(b)?C.delete(b):C.add(b),C})},j=us(),w=ms(),S=ps(),R=xs(),{data:M}=Ue(),k=M?.tier==="ultra",y=k?t.checkIntervalDays:7,f=b=>{S.mutate({promptId:t.id,data:{enabled:b}},{onSuccess:()=>{s()},onError:()=>{m({title:"Could not update auto-check",description:"Please try again.",variant:"destructive"})}})},I=b=>{b!==y&&R.mutate({promptId:t.id,data:{intervalDays:b}},{onSuccess:()=>{s()},onError:()=>{m({title:"Could not update cadence",description:"Please try again.",variant:"destructive"})}})},_=()=>{j.mutate({promptId:t.id},{onSuccess:()=>{s(),l.invalidateQueries({queryKey:Ns(t.id)})},onError:()=>{m({title:"Check failed",description:"Could not run this check right now. Please try again.",variant:"destructive"})}})},O=()=>{w.mutate({promptId:t.id},{onSuccess:s,onError:()=>{m({title:"Could not remove prompt",description:"Please try again.",variant:"destructive"})}})};return e.jsx(L,{className:a&&r?"ring-2 ring-primary":void 0,children:e.jsxs(G,{className:"pt-6",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 mb-4",children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[a&&e.jsx(he,{className:"mt-1 shrink-0",checked:r,onCheckedChange:b=>o?.(b===!0),"aria-label":"Select prompt"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium break-words",children:t.promptText}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-0.5",children:["Watching for ",e.jsx("span",{className:"font-medium text-foreground",children:t.brandName})]})]})]}),e.jsx("div",{className:"text-right shrink-0",children:t.visibilityScore!==null?e.jsxs("div",{className:`text-3xl font-bold leading-none ${Bt(t.visibilityScore)}`,children:[t.visibilityScore,e.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"/100"})]}):e.jsx("div",{className:"text-sm text-muted-foreground",children:"Not checked yet"})})]}),e.jsx("div",{className:"grid gap-2 sm:grid-cols-2 mb-4",children:t.models.map(b=>{const D=t.latestResults.find(F=>F.platform===b),C=D?Ca(D):null,E=D?.answer??null,d=E!==null&&E.length>0,A=u.has(b);return e.jsxs("div",{className:`rounded-lg border p-3 ${d?"cursor-pointer transition-colors hover:bg-muted/50":""}`,role:d?"button":void 0,tabIndex:d?0:void 0,"aria-expanded":d?A:void 0,onClick:d?()=>g(b):void 0,onKeyDown:d?F=>{(F.key==="Enter"||F.key===" ")&&(F.preventDefault(),g(b))}:void 0,children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-sm font-medium",children:Na[b]}
9),C?e.jsxs("span",{className:`flex items-center gap-1 text-xs font-medium ${C.tone}`,children:[C.icon==="yes"&&e.jsx(hs,{className:"h-3.5 w-3.5"}),C.icon==="no"&&e.jsx(fs,{className:"h-3.5 w-3.5"}),C.label]}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"Not checked"})]}),d&&A?e.jsx("p",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:E}):D?.snippet&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-3",children:D.snippet}),d&&e.jsxs("span",{className:"mt-2 inline-flex items-center gap-1 text-xs font-medium text-primary",children:[A?"Show less":"Show full answer",A?e.jsx(pe,{className:"h-3 w-3"}):e.jsx(xe,{className:"h-3 w-3"})]})]},b)})}),ye(t)&&e.jsx(Ia,{promptId:t.id,brandName:t.brandName}),e.jsxs("div",{className:"space-y-2 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(gs,{checked:t.autoCheckEnabled,onCheckedChange:f,disabled:S.isPending,className:"scale-75 origin-left"}),e.jsxs("span",{children:[t.autoCheckEnabled?"Auto-check on":"Auto-check off",t.nextCheckAt&&t.autoCheckEnabled&&e.jsxs("span",{className:"ml-1",children:["(next: ",je(t.nextCheckAt),")"]})]})]}),t.autoCheckEnabled&&e.jsxs(mt,{value:String(y),onValueChange:b=>I(b==="1"?1:7),className:"gap-1 pl-1",disabled:R.isPending,children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(ve,{value:"7",id:`weekly-${t.id}`,className:"h-3.5 w-3.5"}),e.jsx("label",{htmlFor:`weekly-${t.id}`,className:"cursor-pointer",children:"Auto-check every 7 days"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(ve,{value:"1",id:`daily-${t.id}`,disabled:!k,className:"h-3.5 w-3.5"}),e.jsx("label",{htmlFor:`daily-${t.id}`,className:P(k?"text-muted-foreground cursor-pointer":"text-muted-foreground/60 cursor-not-allowed"),children:"Auto-check every 1 day"}),!k&&e.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"Ultra Pro required"})]})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs(T,{size:"sm",onClick:_,disabled:j.isPending,children:[e.jsx(bs,{className:`h-4 w-4 ${j.isPending?"animate-spin":""}`}),j.isPending?"Checkingâ¦":"Check now"]}),e.jsxs(T,{size:"sm",variant:"outline",onClick:()=>n(b=>!b),children:[e.jsx(W,{className:"h-4 w-4"}),"History",p?e.jsx(pe,{className:"h-4 w-4"}):e.jsx(xe,{className:"h-4 w-4"})]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last checked: ",je(t.lastCheckedAt)]}),e.jsxs(T,{size:"sm",variant:"ghost",className:"ml-auto text-muted-foreground hover:text-destructive",onClick:O,disabled:w.isPending,children:[e.jsx(Ke,{className:"h-4 w-4"}),"Remove"]})]}),p&&e.jsx(Ma,{promptId:t.id})]})})}function Ia({promptId:t,brandName:s}){const{toast:a}=Q(),[r,o]=i.useState(!1),[l,m]=i.useState(null),p=js(),n=()=>
9{if(l){o(u=>!u);return}p.mutate({promptId:t},{onSuccess:u=>{m(u.tactics),o(!0)},onError:()=>{a({title:"Could not generate recommendations",description:"Please try again in a moment.",variant:"destructive"})}})};return e.jsx("div",{className:"rounded-lg border bg-muted/30 p-3 mb-4",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ys,{className:"h-4 w-4 text-amber-600 shrink-0 mt-0.5"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("p",{className:"text-sm font-medium",children:[s," isn't showing up in this answer yet"]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"That's an opportunity, not a dead end. See what would help close the gap."}),e.jsxs(T,{size:"sm",variant:"outline",className:"mt-2",onClick:n,disabled:p.isPending,children:[e.jsx(qe,{className:"h-3.5 w-3.5"}),p.isPending?"Finding tacticsâ¦":l?r?"Hide tactics":"Show tactics again":"How do I close this gap?"]}),r&&l&&e.jsx("div",{className:"mt-3 space-y-2",children:l.map((u,h)=>e.jsxs("div",{className:"rounded-md border bg-background p-3",children:[e.jsx("p",{className:"text-sm font-semibold",children:u.title}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:u.description})]},h))})]})]})})}function K(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Ea({checks:t,trackedModels:s}){const[a,r]=i.useState(new Set),o=i.useMemo(()=>{const n=new Set(s);for(const h of t)for(const g of h.results)g.status==="ok"&&n.add(g.platform);const u=me.filter(h=>n.has(h.value));return u.length>0?u:me},[t,s]),l=i.useMemo(()=>t.map(n=>{const u={date:n.checkedAt};for(const h of me){const g=n.results.find(j=>j.platform===h.value);u[h.value]=g&&g.status==="ok"?g.mentioned?1:0:null}return u}),[t]),m=n=>r(u=>{const h=new Set(u);return h.has(n)?h.delete(n):h.add(n),h}),p=o.some(n=>!a.has(n.value));return e.jsxs("div",{children:[e.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:o.map(n=>{const u=!a.has(n.value);return e.jsxs("button",{type:"button",onClick:()=>m(n.value),"aria-pressed":u,className:P("inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-medium transition-colors",u?"text-white":"bg-transparent text-muted-foreground hover:bg-muted"),style:u?{backgroundColor:n.color,borderColor:n.color}:{borderColor:"hsl(214, 32%, 88%)"},children:[e.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:u?"#ffffff":n.color}}),n.label]},n.value)})}),e.jsx("div",{className:"h-64 w-full",children:p?e.jsx(fe,{width:"100%",height:"100%",children:e.jsxs(Ls,{data:l,margin:{top:8,right:12,bottom:8,left:0},children:[e.jsx(ge,{strokeDasharray:"3 3",stroke:"hsl(214, 32%, 91%)"}),e.jsx(ee,{dataKey:"date",tickFormatter:K,tick:{fontSize:11},stroke:"hsl(215, 16%, 47%)"}),e.jsx(te,{domain:[-.08,1.08],ticks:[0,1],tickFormatter:n=>n===1?"Yes":"No",tick:{fontSize:11},stroke:"hsl(215, 16%, 47%)",width:36}),e.jsx(be,{labelFormatter:n=>K(String(n)),formatter:(n,u)=>[n===1?"Mentioned":n===0?"Not mentioned":"Not checked",u],contentStyle:{fontSize:12,borderRadius:8}}),o.map(n=>e.jsx(Gs,{type:"stepAfter",dataKey:n.value,name:n.label,stroke:n.color,strokeWidth:2,dot:{r:3},activeDot:{r:5},hide:a.has(n.value),connectNulls:!0},n.value))]})}):e.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"Select an assistant above to see its trend."})})]})}function Ma({promptId:t}){const s=ws(t),a=s.data?.checks??[];if(s.isLoading)return e.jsx(q,{className:"h-24 w-full rounded-lg mt-4"});if(a.length===0)return e.jsx("p",{className:"text-sm text-muted-foreground mt-4 border-t pt-4",children:"No checks yet. Press Check now to record your first data point."});const r=[...a].reverse(),o=s.data?.prompt.models??[];return e.jsxs("div",{className:"mt-4 border-t pt-4",children:[e.jsx("p",{className:"text-sm font-medium mb-3",children:"Visibility over time"}),e.jsx(Ea,{checks:r,trackedModels:o}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Each line shows whether that assistant mentioned your brand on each check. Toggle assistants above to compare one or more at a time."}),e.jsx("div",{className:"mt-4 space-y-1.5",children:a.slice(0,8).map(l=>e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:je(l.checkedAt)}),e.jsxs("span",{className:"text-muted-foreground",children:[l.mentionedCount," of ",l.modelsChecked," mentioned"]}),e.jsxs("span",{className:`font-medium ${Bt(l.visibilityScore)}`,children:[l.visibilityScore,"/100"]})]},l.id))})]})}function La(){return e.jsx("div",{className:"mt-24 max-w-3xl",children:e.jsxs("div",{className:"prose prose-slate dark:prose-invert max-w-none",children:[e.jsx("h2",{children:"Why track how AI answers about your brand?"}),e.jsx("p",{children:"More and more people ask ChatGPT, Claude, Gemini, and Perplexity for recommendations instead of typing into a search box. If those assistants never mention your brand for the prompts your customers care about, you are invisible in the fastest-growing part of search. The AI Prompt Tracker lets you watch that visibility over time, one prompt at a time."}),e.jsx("h2",{children:"How it works"}),e.jsx("p",{children:"Add the prompts your customers are likely to ask, tell the tracker which brand to wat
9ch for, and pick the assistants you want to monitor. Each time you run a check, the tool sends your prompt to every selected model, records whether your brand was mentioned, and saves a short snippet of the answer. Your visibility score for that check is simply the share of assistants that named you, on a 0â100 scale, and every check is stored so you can see the trend."}),e.jsx("h2",{children:"Where to go next"}),e.jsxs("p",{children:["Once you know where you stand, use the"," ",e.jsx(Z,{href:"/tools/ai-recommendation",className:"text-primary underline",children:"AI Recommendation Checker"})," ","to see which competitors get named instead, and run your site through the"," ",e.jsx(Z,{href:"/tools/ai-visibility-score",className:"text-primary underline",children:"AI Visibility Score"})," ","for a prioritized list of fixes that make your business easier for AI to find and cite."]})]})})}export{Ka 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.