1import{r as o,j as e}from"./react-vendor-8mPB3iJo.js";import{a as _e,b as Me,c as De,d as Fe,e as Oe,u as Re,S as $e,P as le,l as qe}from"./select-BhONSSSo.js";import{B as Be,I as Ge}from"./BrandSelector-Coe8Gilz.js";import{k as he,L as g,h as u,X as ge,b as C,d as A,e as S,S as U,f as Ve,g as k,I as J,E as ze,u as de,j as Ke,T as Y,B as Ue,G as Qe,V as H,l as ie,W as X,s as We,a as ce,r as me}from"./index-DenJ_HeG.js";import{u as Ye,a as He}from"./useAEOAudits-DCdumjkt.js";import{A as Xe}from"./AuditListTable-CglHcT22.js";import{P as Je}from"./PageGuideModal-Bq36S0gE.js";import{A as Z,a as ee}from"./alert-Bah6qc8N.js";import{C as ue}from"./checkbox-DpS-oxIS.js";import{C as xe}from"./combobox-WYle0-3c.js";import{T as Ze,a as es,b as ss,c as ts}from"./tabs-BoqZ-k7L.js";import{a as fe}from"./query-vendor-bXSwaDSG.js";import{A as rs}from"./aeoGeoService-BsEWKYcI.js";import{u as as,a as os}from"./useLocationsAndLanguages-BoN014Cz.js";import{A as pe}from"./activity-CD9iPPer.js";import"./router-vendor-88MizFUS.js";import"./table-B5MIv_3I.js";import"./alert-dialog-C1VXWVEk.js";import"./index-bVDHAO6a.js";import"./trash-2-BL7BZNW5.js";import"./circle-x-C4yUCWAD.js";import"./formatDistanceToNow-DAaEYBoB.js";import"./en-US-CyrGnweX.js";import"./dialog-CIJVLDyG.js";import"./index-D9wHm-kH.js";import"./index-DTPzycHw.js";import"./axios-2s9xPmg-.js";const ns=()=>fe({queryKey:["prompt-templates"],queryFn:async()=>{const i=await fetch(`${rs}/api/aeo-geo/prompt-templates`,{credentials:"include"});if(!i.ok)throw new Error("Failed to fetch prompt templates");return(await i.json()).data||[]},staleTime:5*60*1e3}),ls=(i,r)=>{let d=i;return Object.entries(r).forEach(([p,f])=>{const n=new RegExp(`\\{${p}\\}`,"g");d=d.replace(n,f)}),d},ds=({domain:i,onPromptSelect:r,currentPrompt:d})=>{const{data:p,isLoading:f}=ns(),[n,j]=o.useState(null),[N,b]=o.useState({}),[P,w]=o.useState(""),[x,h]=o.useState(!1),T=p?.reduce((t,a)=>(t[a.category]||(t[a.category]=[]),t[a.category].push(a),t),{})||{},I=Object.keys(T);o.useEffect(()=>{i&&b(t=>({...t,domain:i}))},[i]),o.useEffect(()=>{if(n){const t=ls(n.prompt_template,N);w(t)}},[n,N]);const G=t=>{const a=p?.find(c=>c.id===parseInt(t));if(a){j(a);const c={};
1a.variables.forEach(M=>{M==="domain"?c[M]=i:c[M]=""}),b(c),h(!1)}},v=(t,a)=>{b(c=>({...c,[t]:a}))},O=()=>{P&&(r(P),j(null),b({}),h(!1))},R=()=>{j(null),b({}),h(!1),r("")},_=n?.variables.every(t=>N[t]?.trim());return f?e.jsxs("div",{className:"flex items-center justify-center p-4",children:[e.jsx(he,{className:"h-5 w-5 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading templates..."})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(g,{className:"text-foreground",children:"Use a Prompt Template (Optional)"}),d&&e.jsxs(u,{type:"button",variant:"ghost",size:"sm",onClick:R,className:"text-muted-foreground hover:text-foreground",children:[e.jsx(ge,{className:"h-4 w-4 mr-1"}),"Clear Template"]})]}),e.jsxs(Ze,{defaultValue:I[0],className:"w-full",children:[e.jsx(es,{className:"bg-muted/50 border-border grid grid-cols-4 w-full",children:I.map(t=>e.jsx(ss,{value:t,className:"text-xs data-[state=active]:bg-accent data-[state=active]:text-accent-foreground",children:t},t))}),I.map(t=>e.jsxs(ts,{value:t,className:"space-y-3 mt-4",children:[e.jsxs(_e,{onValueChange:G,children:[e.jsx(Me,{className:"bg-input border-input text-foreground",children:e.jsx(De,{placeholder:"Select a template..."})}),e.jsx(Fe,{className:"bg-popover border-border",children:T[t]?.map(a=>e.jsx(Oe,{value:a.id.toString(),className:"text-popover-foreground hover:bg-accent hover:text-accent-foreground",children:a.name},a.id))})]}),n&&e.jsxs(C,{className:"bg-muted/50 border-border",children:[e.jsxs(A,{className:"pb-3",children:[e.jsxs(S,{className:"text-sm text-foreground flex items-center gap-2",children:[e.jsx(U,{className:"h-4 w-4 text-orange-400"}),n.name]}),e.jsx(Ve,{className:"text-muted-foreground text-xs",children:n.description})]}),e.jsxs(k,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(g,{className:"text-xs text-foreground",children:"Fill in the variables:"}),n.variables.map(a=>e.jsxs("div",{className:"space-y-1",children:[e.jsx(g,{htmlFor:a,className:"text-xs text-muted-foreground capitalize",children:a.replace(/_/g," ")}),e.jsx(J,{id:a,value:N[a]||"",onChange:c=>v(a,c.target.value),placeholder:`Enter ${a.replace(/_/g," ")}...`,className:"bg-input border-input text-foreground placeholder:text-muted-foreground text-sm",disabled:a==="domain"})]},a))]}),_&&e.jsxs(u,{type:"button",variant:"outline",size:"sm",onClick:()=>h(!x),className:"w-full border-border text-muted-foreground hover:bg-accent hover:text-accent-foreground",children:[e.jsx(ze,{className:"h-4 w-4 mr-2"}),x?"Hide Preview":"Preview Prompt"]}),x&&_&&e.jsx(Z,{className:"bg-muted border-border",children:e.jsx(ee,{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:P})}),_&&e.jsxs(u,{type:"button",onClick:O,className:"w-full bg-orange-500 hover:bg-orange-600 text-white",children:[e.jsx(U,{className:"h-4 w-4 mr-2"}),"Apply Template"]}),n.example_output&&e.jsxs("div",{className:"pt-2 border-t border-border",children:[e.jsx(g,{className:"text-xs text-muted-foreground",children:"Expected Output:"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n.example_output})]})]})]})]},t))]})]})},is="https://adcoon.ai";function K(i,r=!0){return fe({queryKey:["llm-models",i],queryFn:async()=>{const d=await fetch(`${is}/api/aeo-geo/llm-models/${i}`,{credentials:"include"});if(!d.ok)throw new Error(`Failed to fetch models for ${i}`);const p=await d.json();return p.success&&p.data&&p.data.models?p.data.models.map(f=>typeof f=="string"?f:f.model_name):[]},enabled:r,staleTime:1/0,gcTime:7*24*60*60*1e3,refetchOnWindowFocus:!1,refetchOnReconnect:!1,refetchOnMount:!1})}function cs(i,r=!0){const d=K("chatgpt",r),p=K("claude",r),f=K("gemini",r),n=K("perplexity",r),j=[d,p,f,n],N=["chatgpt","claude","gemini","perplexity"],b=j.some(x=>x.isLoading),P=j.some(x=>x.isError);return{modelsMap:N.reduce((x,h,T)=>(x[h]=j[T].data||[],x),{}),isLoading:b,isError:P}}const Bs=()=>{o.useEffect(()=>{document.title="AEO/GEO Audits | AdCoon.ai"},[]);const i=[{id:1,name:"Basics",icon:Y},{id:2,name:"Keywords & Scope",icon:pe},{id:3,name:"Prompt & Providers",icon:ce},{id:4,name:"Review & Run",icon:me}
1],[r,d]=o.useState(0),[p,f]=o.useState(!1),[n,j]=o.useState(!1),{selectedBrand:N}=de(),{data:b,isLoading:P}=Ye(N?.id?Number(N.id):void 0),[w,x]=o.useState(""),[h,T]=o.useState(""),[I,G]=o.useState(""),[v,O]=o.useState(""),[R,_]=o.useState(!1),[t,a]=o.useState(["chatgpt","claude","gemini","perplexity"]),[c,M]=o.useState({}),[V,je]=o.useState(!1),{defaultCountry:Ne}=os(),[se,be]=o.useState(Ne),[ve,ye]=o.useState("US"),[we,Ce]=o.useState(!1),{mutate:Ae,isPending:z}=He(),{subscriptionInfo:Se}=Re(),{toast:D}=Ke(),{selectedBrand:ke}=de(),{data:te,isLoading:Pe}=as(we),Te=["chatgpt","claude","gemini","perplexity"],{modelsMap:Le,isLoading:ms}=cs(Te,V),y=I.split(` 2`).map(s=>s.trim()).filter(s=>s.length>0),L=t.length*2,$=Se?.user?.aiCredits||0,q=$>=L,Ee="llm_responses",Q=()=>{r<i.length&&d(r+1)},W=()=>{r>1&&d(r-1)},re=s=>{if(s.preventDefault(),!h){D({title:"Validation Error",description:"Audit name is required",variant:"destructive"});return}if(!w){D({title:"Validation Error",description:"Domain is required for Deep Audit",variant:"destructive"});return}if(!q){D({title:"Insufficient Credits",description:`You need ${L} credits but only have ${$}`,variant:"destructive"});return}const l={domain:w.trim(),auditName:h.trim(),brandProfileId:ke?.id,auditMethod:Ee,locationCode:se,languageCode:"en",countryIsoCode:ve};y.length>0&&!n&&(l.keywords=y),v.trim()&&(l.customPrompt=v.trim()),t.length>0&&(l.selectedProviders=t),Object.keys(c).length>0&&(l.customModels=c),Ae(l,{onSuccess:m=>{D({title:"Audit Created",description:"Your audit has been started. This may take a few minutes."}),d(0),x(""),T(""),G(""),O(""),j(!1)},onError:m=>{D({title:"Error",description:m?.response?.data?.error||"Failed to create audit",variant:"destructive"})}})},Ie=[{number:1,title:"Set Up Your Audit",description:"Enter your domain, select target country, and choose which AI models to query (ChatGPT, Claude, Gemini, Perplexity)"},{number:2,title:"Customize Your Prompt",description:"Use a template or write a custom prompt. The AI models will search the web and provide answers with citations"},{number:3,title:"Analyze Live Results",description:"Get real-time responses from AI assistants, track how often your domain is cited, and compare against competitors"},{number:4,title:"Monitor & Optimize",description:"Review citation patterns, market share, and visibility scores to improve your AI optimization strategy"}],F=(b?.data||[]).filter(s=>s.audit_method==="llm_responses"||!s.audit_method),ae=F.filter(s=>s.status==="completed"),oe=F.filter(s=>s.status==="processing"||s.status==="pending");return e.jsxs("div",{className:"min-h-screen bg-background text-foreground flex w-full",children:[e.jsx($e,{}),e.jsxs("div",{className:"flex-1 flex flex-col",children:[e.jsx(Be,{}),e.jsxs("div",{className:"flex-1 p-6 space-y-8",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Y,{className:"h-6 w-6 text-orange-500"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-foreground",children:"Deep Audit"}),e.jsx("p",{className:"text-muted-foreground",children:"Real-time AI queries with custom prompts"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Je,{guideTitle:"AEO/GEO Audit Guide",guideDescription:"Understand how often AI assistants reference your domain and benchmark against competitors.",steps:Ie,modalIcon:e.jsx(Y,{className:"h-5 w-5"}),triggerAriaLabel:"How AEO/GEO audits work",cta:{heading:"Ready to launch a new audit?",description:"Capture the latest AI overview results in under a minute.",actionLabel:"New Audit",actionIcon:e.jsx(le,{className:"h-4 w-4"}),onAction:()=>{d(1)}}}),e.jsx(u,{onClick:()=>{r>0?d(0):d(1)},className:"bg-orange-500 hover:bg-orange-600 text-white",children:r>0?e.jsxs(e.Fragment,{children:[e.jsx(ge,{className:"h-4 w-4 mr-2"}),"Cancel"]}):e.jsxs(e.Fragment,{children:[e.jsx(le,{className:"h-4 w-4 mr-2"}),"New Audit"]})})]})]}),r>0&&e.jsx("div",{className:"grid grid-cols-4 gap-2",children:i.map((s,l)=>{const m=s.icon,E=r===s.id,B=r>s.id,ne=B||E;return e.jsxs("button",{onClick:()=>ne&&d(s.id),disabled:!ne,className:`p-3 rounded-lg border-2 transition-all text-left ${E?"border-orange-500 bg-orange-500/10":B?"border-green-500/50 bg-green-500/5 hover:bg-green-500/10 cursor-pointer":"border-border bg-muted/50 cursor-not-allowed opacity-50"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(m,{className:`h-4 w-4 ${E?"text-orange-500":
2B?"text-green-500":"text-muted-foreground"}`}),e.jsxs("span",{className:`text-xs font-medium ${E?"text-orange-500":B?"text-green-400":"text-muted-foreground"}`,children:["Step ",s.id]})]}),e.jsx("div",{className:`text-xs ${E?"text-foreground":B?"text-muted-foreground":"text-muted-foreground/50"}`,children:s.name})]},s.id)})}),r>0&&e.jsxs("div",{className:"space-y-6",children:[r===1&&e.jsxs(C,{className:"bg-card border-border",children:[e.jsxs(A,{children:[e.jsx(S,{className:"text-2xl text-foreground",children:"Create AEO/GEO Audit"}),e.jsx("p",{className:"text-muted-foreground",children:"Track your domain's visibility across ChatGPT, Claude, Gemini, and Perplexity with custom prompts"})]}),e.jsx(k,{children:e.jsxs("form",{onSubmit:re,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{htmlFor:"auditName",className:"text-foreground",children:"Audit Name *"}),e.jsx(J,{id:"auditName",type:"text",placeholder:"Q4 2024 Audit",value:h,onChange:s=>T(s.target.value),className:"bg-input border-input text-foreground placeholder:text-muted-foreground",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{htmlFor:"domain",className:"text-foreground",children:"Domain (Optional)"}),e.jsx(J,{id:"domain",type:"text",placeholder:"example.com (optional for keyword-only audits)",value:w,onChange:s=>x(s.target.value),className:"bg-input border-input text-foreground placeholder:text-muted-foreground"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter your domain without http:// or www. Leave empty for keyword-only audits."})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(Z,{className:"bg-blue-500/10 border-blue-500/30",children:[e.jsx(Ue,{className:"h-4 w-4 text-blue-400"}),e.jsxs(ee,{className:"text-sm text-muted-foreground",children:[e.jsx("strong",{className:"text-blue-400",children:"Deep Audit"})," queries AI models in real-time with your custom prompts. Takes 2-5 minutes but allows full customization of prompts and AI providers.",e.jsx("strong",{className:"text-blue-400",children:"2 credits per provider"}),"."]})]}),e.jsxs("div",{className:"space-y-4 mt-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Target Country"}),e.jsx("div",{className:"flex-1 h-px bg-border"})]}),e.jsxs("div",{className:"space-y-2",onClick:()=>Ce(!0),children:[e.jsxs(g,{htmlFor:"country",className:"flex items-center gap-2 text-card-foreground",children:[e.jsx(Qe,{className:"h-4 w-4"}),"Country for Web Search"]}),e.jsx(xe,{options:(te?.countries||[]).map(s=>({value:s.code.toString(),label:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs bg-muted px-1.5 py-0.5 rounded text-muted-foreground",children:s.country_iso_code}),s.name]}),searchLabel:`${s.name} ${s.country_iso_code}`})),value:se.toString(),onValueChange:s=>{const l=parseInt(s);be(l);const m=te?.countries.find(E=>E.code===l);m&&ye(m.country_iso_code)},placeholder:"Select country",searchPlaceholder:"Search countries...",emptyText:"No country found.",disabled:z||Pe}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ð Web search results will be from this country (e.g., FR for France)"})]})]})]})]}),e.jsxs("div",{className:"flex justify-between pt-6",children:[e.jsx(u,{type:"button",variant:"outline",onClick:()=>f(!1),className:"border-border text-muted-foreground hover:bg-accent",disabled:z,children:"Cancel"}),e.jsxs(u,{type:"button",onClick:Q,className:"bg-orange-500 hover:bg-orange-600 text-white",disabled:!h,children:["Next: Keywords & Scope",e.jsx(H,{className:"h-4 w-4 ml-2"})]})]})]})})]}),r===2&&e.jsxs(C,{className:"bg-card border-border",children:[e.jsxs(A,{children:[e.jsx(S,{className:"text-2xl text-foreground",children:"Keywords & Scope"}),e.jsx("p",{className:"text-muted-foreground",children:"Define what you want to track across AI assistants"})]}),e.jsx(k,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(g,{htmlFor:"keywords",className:"text-foreground",children:["Keywords (Optional) ",y.length>0&&`(${y.length})`]}),e.jsx(ie,{id:"keywords",placeholder:`Enter keywords (one per line) 3keyword 1 4keyword 2 5keyword 3 6 7Leave empty for domain-only audit`,value:I,onChange:s=>G(s.target.value),className:"bg-input border-input text-foreground placeholder:text-muted-foreground min-h-[150px]",disabled:n}),e.jsx("p",{className:"text-xs text-muted-foreground",children:y.length>0?"Enter one keyword per line. Each keyword will be tracked across all AI models.":"ð¡ Leave empty to track ALL mentions of your domain (domain-only audit)"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{className:"text-foreground",children:"Tracking Scope"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ue,{id:"track-all",checked:n,onCheckedChange:s=>j(!!s)}),e.jsx("label",{htmlFor:"track-all",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"Track all brand/domain mentions (ignore keywords)"})]}),e.jsx("p",{className:"text-xs text-muted-foreground ml-6",children:"When enabled, we'll track ALL mentions of your brand or domain across providers, regardless of specific keywords. This gives you a complete visibility picture."})]})]}),e.jsxs("div",{className:"flex justify-between gap-3 pt-4",children:[e.jsxs(u,{type:"button",variant:"outline",onClick:W,className:"border-border text-muted-foreground hover:bg-accent",children:[e.jsx(X,{className:"h-4 w-4 mr-2"}),"Back to Basics"]}),e.jsxs(u,{type:"button",onClick:Q,className:"bg-orange-500 hover:bg-orange-600 text-white",children:["Next: Prompt & Providers",e.jsx(H,{className:"h-4 w-4 ml-2"})]})]})]})})]}),r===3&&e.jsxs(C,{className:"bg-card border-border",children:[e.jsxs(A,{children:[e.jsx(S,{className:"text-2xl text-foreground",children:"Custom Prompt & Providers"}),e.jsx("p",{className:"text-muted-foreground",children:"Configure your custom prompt and choose which AI providers to query"})]}),e.jsx(k,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(g,{htmlFor:"customPrompt",className:"text-foreground",children:"Custom Prompt (Optional)"}),e.jsxs(u,{type:"button",variant:"outline",onClick:()=>_(!R),className:"border-orange-500/50 text-orange-400 hover:text-orange-300 hover:bg-orange-500/10 hover:border-orange-400 transition-all",children:[e.jsx(U,{className:"h-4 w-4 mr-2"}),R?"Hide Templates":"Use Template"]})]}),R&&e.jsx("div",{className:"mb-4",children:e.jsx(ds,{domain:w,onPromptSelect:s=>{O(s),_(!1)},currentPrompt:v})}),e.jsx(ie,{id:"customPrompt",placeholder:`Example: 'What are the best tools for digital marketing?' 8 9Use custom prompts to track mentions in specific contexts instead of the default domain+keyword query.`,value:v,onCh
9ange:s=>O(s.target.value),className:"bg-input border-input text-foreground placeholder:text-muted-foreground min-h-[200px]"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ð¡ Add a custom prompt to track mentions in specific contexts instead of the default domain+keyword query"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"LLM Providers"}),e.jsx("div",{className:"flex-1 h-px bg-border"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(g,{className:"text-sm font-medium text-foreground",children:"Select Providers"}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:[{id:"chatgpt",label:"ChatGPT",note:null},{id:"claude",label:"Claude",note:null},{id:"gemini",label:"Gemini",note:null},{id:"perplexity",label:"Perplexity",note:null}].map(s=>e.jsxs("div",{className:"flex flex-col space-y-1",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ue,{id:s.id,checked:t.includes(s.id),onCheckedChange:l=>{l?a([...t,s.id]):t.length>1?a(t.filter(m=>m!==s.id)):D({title:"At least one provider required",description:"You must select at least one LLM provider",variant:"destructive"})}}),e.jsx("label",{htmlFor:s.id,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:s.label})]}),s.note&&e.jsx("p",{className:"text-xs text-yellow-400 ml-6",children:s.note})]},s.id))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Select which AI models to query. Cost: 2 credits per provider"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(u,{type:"button",variant:"ghost",onClick:()=>je(!V),className:"w-full flex items-center justify-between p-3 hover:bg-accent rounded-lg border border-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(qe,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:"Advanced Model Selection"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"(Optional)"})]}),e.jsx(We,{className:`h-4 w-4 text-muted-foreground transition-transform ${V?"rotate-180":""}`})]}),V&&e.jsxs("div",{className:"space-y-3 p-4 bg-muted/50 rounded-lg border border-border",children:[e.jsx(g,{className:"text-sm font-medium text-foreground",children:"Custom Models"}),e.jsx("div",{className:"space-y-2",children:t.map(s=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"w-24 text-sm capitalize text-muted-foreground",children:[s,":"]}),e.jsx(xe,{options:[{value:"__default__",label:"Default model"},...(Le[s]||[]).map(l=>({value:l,label:l}))],value:c[s]||"__default__",onValueChange:l=>{if(l==="__default__"){const m={...c};delete m[s],M(m)}else M(m=>({...m,[s]:l}))},placeholder:"Default model",searchPlaceholder:"Search models...",emptyText:"No models found.",triggerClassName:"bg-input border-input text-foreground flex-1",className:"w-[300px]"})]},s))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'Leave as "Default model" to use recommended models for each provider'})]})]})]}),e.jsxs("div",{className:"flex justify-between gap-3 pt-4",children:[e.jsxs(u,{type:"button",variant:"outline",onClick:W,className:"border-border text-muted-foreground hover:bg-accent",children:[e.jsx(X,{className:"h-4 w-4 mr-2"}),"Back to Keywords"]}),e.jsxs(u,{type:"button",onClick:Q,className:"bg-orange-500 hover:bg-orange-600 text-white",disabled:t.length===0,children:["Next: Review & Run",e.jsx(H,{className:"h-4 w-4 ml-2"})]})]})]})})]}),r===4&&e.jsxs(C,{className:"bg-card border-border",children:[e.jsxs(A,{children:[e.jsx(S,{className:"text-2xl text-foreground",children:"Review & Run"}),e.jsx("p",{className:"text-muted-foreground",children:"Review your audit configuration and start the analysis"})]}),e.jsx(k,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-sm font-medium text-foreground",children:"Audit Details"}),e.jsxs("div",{className:"space-y-1 text-sm",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Name:"})," ",e.jsx("span",{className:"text-foreground",children:h})]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Domain:"})," ",e.jsx("span",{className:"text-foreground",children:w})]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Method:"}),e.jsx("span",{className:"text-blue-400 font-medium",children:"ð¬ Deep Audit (LLM Responses)"})]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Scope:"})," ",e.jsx("span",{className:"text-foreground",children:n?"All brand/domain mentions":y.length>0?`${y.length} keywords`:"Domain-only"})]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Prompt:"})," ",e.jsx("span",{className:"text-foreground",children:v.trim()?"Custom"
9:"Default"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-sm font-medium text-foreground",children:"Providers"}),e.jsxs("div",{className:"space-y-1 text-sm",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Selected:"})," ",e.jsxs("span",{className:"text-foreground",children:[t.length," providers"]})]}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:t.map(s=>e.jsx("span",{className:"px-2 py-1 bg-indigo-500/20 text-indigo-400 rounded text-xs capitalize",children:s},s))})]})]})]}),!n&&y.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-sm font-medium text-foreground",children:"Keywords to Track"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:y.map((s,l)=>e.jsx("span",{className:"px-3 py-1 bg-muted text-muted-foreground rounded-full text-sm",children:s},l))})]}),v.trim()&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-sm font-medium text-foreground",children:"Custom Prompt"}),e.jsx("div",{className:"p-3 bg-muted rounded-lg",children:e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-3",children:v})})]})]}),e.jsxs(Z,{className:`${q?"bg-orange-900/30 border-orange-500/40":"bg-red-900/30 border-red-500/40"}`,children:[e.jsx(Ge,{className:"h-4 w-4"}),e.jsx(ee,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"font-medium text-lg",children:["Total Cost: ",L," ",L===1?"credit":"credits"]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm text-blue-400 font-medium",children:"ð¬ Deep Audit (Live AI Queries)"}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[t.length," ",t.length===1?"provider":"providers"," à 2 credits = ",L," credits",e.jsx("br",{}),"⢠Real-time AI model queries",e.jsx("br",{}),"⢠Custom prompt support",e.jsx("br",{}),"⢠Takes 2-5 minutes to complete"]})]}),e.jsxs("div",{className:"text-sm pt-2 border-t border-border",children:["Available: ",e.jsxs("span",{className:q?"text-green-400":"text-red-400",children:[$," credits"]})]}),!q&&e.jsxs("div",{className:"text-sm text-red-400 mt-2",children:["You need ",L-$," more ",L-$===1?"credit":"credits"," to run this audit."]})]})})]}),e.jsxs("div",{className:"flex justify-between gap-3 pt-4",children:[e.jsxs(u,{type:"button",variant:"outline",onClick:W,className:"border-border text-muted-foreground hover:bg-accent",children:[e.jsx(X,{className:"h-4 w-4 mr-2"}),"Back to Providers"]}),e.jsx(u,{type:"submit",className:"bg-orange-500 hover:bg-orange-600 text-white",disabled:z||!q,onClick:re,children:z?e.jsxs(e.Fragment,{children:[e.jsx(he,{className:"h-4 w-4 mr-2 animate-spin"}),"Creating Audit..."]}):e.jsxs(e.Fragment,{children:[e.jsx(U,{className:"h-4 w-4 mr-2"}),"Create Audit"]})})]})]})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs(C,{className:"bg-card border-border",children:[e.jsxs(A,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsx(S,{className:"text-sm font-medium text-foreground",children:"Total Audits"}),e.jsx(pe,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(k,{children:[e.jsx("div",{className:"text-2xl font-bold text-foreground",children:F.length}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"All time"})]})]}),e.jsxs(C,{className:"bg-card border-border",children:[e.jsxs(A,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsx(S,{className:"text-sm font-medium text-foreground",children:"Completed"}),e.jsx(ce,{className:"h-4 w-4 text-green-400"})]}),e.jsxs(k,{children:[e.jsx("div",{className:"text-2xl font-bold text-foreground",children:ae.length}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:F.length>0?`${Math.round(ae.length/F.length*100)}% success rate`:"No audits yet"})]})]}),e.jsxs(C,{className:"bg-card border-border",children:[e.jsxs(A,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsx(S,{className:"text-sm font-medium text-foreground",children:"Processing"}),e.jsx(me,{className:"h-4 w-4 text-yellow-400"})]}),e.jsxs(k,{children:[e.jsx("div",{className:"text-2xl font-bold text-foreground",children:oe.length}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:oe.length>0?"In progress":"None active"})]})]})]}),e.jsx(Xe,{audits:F,isLoading:P})]})]})]})};export{Bs 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.