1import{r as oe,_ as ie}from"./adminMarkdown-CS4p9ZYF.js";import{r,X as S,H as ae,aC as ne,f as le,o as n,e as re,d as e,c as l,m as v,J as B,v as u,x as a,K as P,aD as j,F as Q,i as K,n as c,aE as de,y as pe,ad as I,Q as ue,R as ce}from"./main-CKQbcAOR.js";import{u as xe}from"./useVoiceInput-KaMpWdYJ.js";import{_ as he}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./FileSaver.min-CeAOjCzd.js";const o=F=>(ue("data-v-38c11ddd"),F=F(),ce(),F),ge={style:{display:"flex","flex-direction":"column",gap:"20px"}},ve={style:{display:"flex","align-items":"flex-end",gap:"12px"}},ye=o(()=>e("div",null,[e("h1",{style:{margin:"0","font-family":"'Exo',sans-serif","font-weight":"700","font-size":"26px",color:"#304058"}}," AI Analyst "),e("div",{style:{"font-size":"13px",color:"#8893A4","margin-top":"2px"}}," Deep company analysis on your Claude subscription â no API tokens burned ")],-1)),fe=o(()=>e("div",{style:{flex:"1"}},null,-1)),_e={key:0,style:{background:"#FFFFFF",border:"1px solid #EDF1F6","border-radius":"16px","box-shadow":"0 2px 8px rgba(48,64,88,0.06)",padding:"24px"}},me=o(()=>e("div",{style:{"font-family":"'Exo',sans-serif","font-weight":"700","font-size":"16px",color:"#304058"}}," Setup needed ",-1)),be={style:{"font-size":"13.5px",color:"#5B6B84","margin-top":"8px","line-height":"1.7"}},Fe={key:0},ke=o(()=>e("code",{style:{background:"#F1F5F9","border-radius":"4px",padding:"1px 6px"}},"curl -fsSL https://claude.ai/install.sh | bash",-1)),we={key:1},ze=o(()=>e("code",{style:{background:"#F1F5F9","border-radius":"4px",padding:"1px 6px"}},"claude setup-token",-1)),Ee=o(()=>e("code",{style:{background:"#F1F5F9","border-radius":"4px",padding:"1px 6px"}},"CLAUDE_CODE_OAUTH_TOKEN",-1)),Ce=o(()=>e("code",{style:{background:"#F1F5F9","border-radius":"4px",padding:"1px 6px"}},".env",-1)),Ae=o(()=>e("code",{style:{background:"#F1F5F9","border-radius":"4px",padding:"1px 6px"}},"php artisan config:clear",-1)),Te={key:2,style:{color:"#CE2C31","margin-top":"6px"}},De={style:{display:"grid","grid-template-columns":"360px 1fr",gap:"20px","align-items":"start"}},Se={style:{background:"#FFFFFF",border:"1px solid #EDF1F6","border-radius":"16px","box-shadow":"0 2px 8px rgba(48,64,88,0.06)",padding:"20px",display:"flex","flex-direction":"column",gap:"16px"}},Be={style:{position:"relative"}},Ie=o(()=>e("div",{style:{"font-size":"11px","font-weight":"700","letter-spacing":"0.1em","text-transform":"uppercase",color:"#8893A4","margin-bottom":"6px"}}," Company ",-1)),Re={key:0,style:{display:"flex","align-items":"center",gap:"10px",background:"#F8FAFC",border:"1px solid #EDF1F6","border-radius":"10px",padding:"10px 12px"}},Ue={style:{width:"32px",height:"32px","border-radius":"9999px",background:"#79C7E0",color:"#FFFFFF",display:"flex","align-items":"center","justify-content":"center","font-size":"12px","font-weight":"700","flex-shrink":"0"}},$e={style:{"min-width":"0",flex:"1"}},Me={style:{"font-size":"13.5px","font-weight":"600",color:"#304058","white-space":"nowrap",overflow:"hidden","text-overflow":"ellipsis"}},Le={style:{"font-size":"11.5px",color:"#8893A4"}},Pe={key:2,style:{position:"absolute",top:"100%",left:"0",right:"0","z-index":"20",background:"#FFFFFF",border:"1px solid #EDF1F6","border-radius":"12px","box-shadow":"0 8px 24px rgba(48,64,88,0.14)","margin-top":"4px","max-height":"280px","overflow-y":"auto"}},Ve=["onClick"],Oe={style:{"font-size":"13px","font-weight":"600",color:"#304058"}},qe={style:{"font-size":"11.5px",color:"#8893A4"}},He=o(()=>e("div",{style:{"font-size":"11px","font-weight":"700","letter-spacing":"0.1em","text-transform":"uppercase",color:"#8893A4","margin-bottom":"6px"}}," Quick prompts ",-1)),Ne={style:{display:"flex","flex-wrap":"wrap",gap:"6px"}},We=["onClick"],je={style:{display:"flex","align-items":"center","justify-content":"space-between","margin-bottom":"6px"}},Qe=o(()=>e("div",{style:{"font-size":"11px","font-weight":"700","letter-spacing":"0.1em","text-transform":"uppercase",color:"#8893A4"}}," What do you want to know? ",-1)),Ke=["disabled","title"],Ge=o(()=>e("i",{class:"ti ti-microphone",style:{"font-size":"14px"}},null,-1)),Je={key:0,style:{"font-size":"12px",color:"#EC6451","margin-top":"4px"}},Xe={style:{display:"flex","align-items":"center",gap:"10px"}},Ye=o(()=>e("option",{value:"opus"}," Opus â deepest ",-1)),Ze=o(()=>e("option",{value:"sonnet"}," Sonnet â faster ",-1)),et=o(()=>e("option",{value:"haiku"}," Haiku â quick look ",-1)),tt=[Ye,Ze,et],st=["disabled"],ot=o(()=>e("i",{class:"ti ti-sparkles",style:{"font-size":"16px"}},null,-1)),it={key:0,style:{"font-size":"12px",color:"#8893A4","line-height":"1.6"}},at={style:{background:"#FFFFFF",border:"1px solid #EDF1F6","border-radius":"16px","box-shadow":"0 2px 8px rgba(48,64,88,0.06)",padding:"24px","min-height":"320px"}},nt={key:0,style:{"text-align":"center",padding:"40px 20px"}},lt=o(()=>e("i",{class:"ti ti-alert-triangle",style:{"font-size":"34px",color:"#EC6451"}},null,-1)),rt={style:{"font-size":"14px","font-weight":"600",color:"#CE2C31","margin-top":"10px","white-space":"pre-wrap"}},dt={key:1,style:{"text-align":"center",padding:"60px 20px"}},pt=o(()=>e("div",{class:"analystPulse"},[e("i",{class:"ti ti-sparkles",style:{"font-size":"36px",color:"#79C7E0"}})],-1)),ut={style:{"font-family":"'Exo',sans-serif","font-weight":"700","font-size":"16px",color:"#304058","margin-top":"14px"}},ct={style:{"font-size":"13px",color:"#8893A4","margin-top":"4px"}},xt={key:2},ht={style:{display:"flex","align-items":"center",gap:"10px","border-bottom":"1px solid #EDF1F6","padding-bottom":"12px","margin-bottom":"8px"}},gt={style:{"font-size":"12px",color:"#8893A4"}},vt=o(()=>e("div",{style:{flex:"1"}},null,-1)),yt=["innerHTML"],ft={key:3,style:{"text-align":"center",padding:"70px 20px",color:"#8893A4"}},_t=o(()=>e("i",{class:"ti ti-report-analytics",style:{"font-size":"38px",color:"#B9C4D6"}},null,-1)),mt=o(()=>e("div",{style:{"font-size":"13.5px","margin-top":"10px"}}," Pick a company, ask a question, and the full analysis lands here. ",-1)),bt=[_t,mt],Ft={__name:"ai-analyst",setup(F){const p=r(null),R=r(!0),f=S(()=>{var s,t;return((s=p.value)==null?void 0:s.configured)&&((t=p.value)==null?void 0:t.binary_found)});async function G(){var s;R.value=!0;try{p.value=await I("/admin/ai-analyst/status")}catch(t){p.value={configured:!1,binary_found:!1,error:((s=t==null?void 0:t.data)==null?void 0:s.message)??(t==null?void 0:t.message)}}finally{R.value=!1}}const k=r(""),_=r([]),w=r(!1),d=r(null);let V=null;function J(){clearTimeout(V),V=setTimeout(async()=>{const s=k.value.trim();if(!s){_.value=[],w.value=!1;return}try{const t=await I("/admin/ai-analyst/users",{query:{search:s}});_.value=t.users||[],w.value=!0}catch{_.value=[]}},300)}function X(s){d.value=s,k.value="",_.value=[],w.value=!1}const y=r(""),U=r("opus"),z=r(""),{isRecording:E,isTranscribing:C,toggleRecording:O}=xe({getText:()=>y.value,setText:s=>{y.value=s,z.value=""},onError:s=>{z.value=s}}),Y=[{label:"Full health check",text:"Give me a full business health analysis: current state, biggest strengths, biggest risks, and the top 5 highest-impact actions this business owner should take in the next 30 days. Prioritize by expected profit impact."},{label:"Profit opportunities",text:"Analyze the numbers and find the biggest untapped profit opportunities. Where is money being left on the table (pricing, capacity, retention, costs)? Quantify each opportunity where possible."},{label:"Churn risk",text:"Assess how likely this customer is to churn from Uplify. What signals suggest engagement or disengagement, what value have they gotten so far, and what would keep them subscribed?"},{label:"Marketing gaps",text:"Review this business's marketing situation. What channels are they using or missing, what should their positioning be, and what are 3 concrete campaigns they should run next month?"},{label:"Pricing review",text:"Analyze their pricing versus their costs, market and capacity. Are they undercharging? Recommend a specific pricing structure and a plan to migrate existing clients to it."}],x=r(!1),A=r(0),h=r(null),m=r(null);let $=null,M=null;const T=S(()=>f.value&&d.value&&y.value.trim()&&!x.value);function b(){clearInterval($),clearInterval(M),$=null,M=null}async function Z(){var s;if(T.value){x.value=!0,m.value=null,h.value=null,A.value=0,M=setInterval(()=>A.value+=1,1e3);try{const L=(await I("/admin/ai-analyst/analyze",{method:"POST",body:{user_id:d.value.id,question:y.value.trim(),model:U.value}}
1)).analysis_id;$=setInterval(async()=>{try{const g=await I(`/admin/ai-analyst/result/${L}`);g.status==="done"?(b(),x.value=!1,h.value=g):g.status==="error"?(b(),x.value=!1,m.value=g.error||"Analysis failed"):g.status==="not_found"&&(b(),x.value=!1,m.value="Analysis expired or was lost â try again")}catch{}},3e3)}catch(t){b(),x.value=!1,m.value=((s=t==null?void 0:t.data)==null?void 0:s.message)??(t==null?void 0:t.message)??"Failed to start analysis"}}}const D=r(!1);async function ee(){var s;(s=h.value)!=null&&s.analysis&&(await navigator.clipboard.writeText(h.value.analysis),D.value=!0,setTimeout(()=>D.value=!1,1500))}const q=S(()=>{const s=Math.floor(A.value/60),t=A.value%60;return s?`${s}m ${t}s`:`${t}s`}),te=S(()=>{var s;return oe((s=h.value)==null?void 0:s.analysis)});return ae(G),ne(b),(s,t)=>{const L=ie;return n(),le(L,{active:"analyst"},{default:re(()=>{var g,H,N,W;return[e("div",ge,[e("div",ve,[ye,fe,p.value?(n(),l("div",{key:0,style:B([{display:"flex","align-items":"center",gap:"7px","font-size":"12px","font-weight":"600",padding:"6px 12px","border-radius":"9999px"},{background:f.value?"#E9F8F2":"#FDF0EF",color:f.value?"#2E9B77":"#CE2C31"}])},[e("span",{style:B([{width:"8px",height:"8px","border-radius":"9999px"},{background:f.value?"#46BC94":"#EC6451"}])},null,4),u(" "+a(f.value?`Connected ${p.value.version?"· "+p.value.version:""}`:"Not configured"),1)],4)):v("",!0)]),!R.value&&!f.value?(n(),l("div",_e,[me,e("div",be,[(g=p.value)!=null&&g.binary_found?v("",!0):(n(),l("div",Fe,[u(" 1. Install Claude Code on this server: "),ke])),(H=p.value)!=null&&H.configured?v("",!0):(n(),l("div",we,[u(" 2. On your own machine run "),ze,u(", then set "),Ee,u(" in the server's "),Ce,u(" and run "),Ae,u(". ")])),(N=p.value)!=null&&N.error?(n(),l("div",Te,a(p.value.error),1)):v("",!0)])])):v("",!0),e("div",De,[e("div",Se,[e("div",Be,[Ie,d.value?(n(),l("div",Re,[e("div",Ue,a((d.value.name||d.value.email)[0].toUpperCase()),1),e("div",$e,[e("div",Me,a(d.value.name||d.value.email),1),e("div",Le,a(d.value.email)+" · "+a(d.value.plan||"free"),1)]),e("i",{class:"ti ti-x",style:{"font-size":"16px",color:"#8893A4",cursor:"pointer"},onClick:t[0]||(t[0]=i=>d.value=null)})])):P((n(),l("input",{key:1,"onUpdate:modelValue":t[1]||(t[1]=i=>k.value=i),placeholder:"Search by name or emailâ¦",style:{width:"100%",border:"1px solid #E5E7EB","border-radius":"10px",padding:"10px 12px","font-size":"13.5px",color:"#304058",outline:"none",background:"#FFFFFF"},onInput:J},null,544)),[[j,k.value]]),w.value&&_.value.length?(n(),l("div",Pe,[(n(!0),l(Q,null,K(_.value,i=>(n(),l("div",{key:i.id,style:{padding:"10px 14px",cursor:"pointer",display:"flex","flex-direction":"column",gap:"1px"},class:"analystSearchRow",onClick:se=>X(i)},[e("span",Oe,a(i.name||i.email),1),e("span",qe,a(i.email)+" · "+a(i.plan||"free"),1)],8,Ve))),128))])):v("",!0)]),e("div",null,[He,e("div",Ne,[(n(),l(Q,null,K(Y,i=>e("span",{key:i.label,style:{"font-size":"12px","font-weight":"600",color:"#304058",background:"#F1F5F9","border-radius":"9999px",padding:"5px 12px",cursor:"pointer"},onClick:se=>y.value=i.text},a(i.label),9,We)),64))])]),e("div",null,[e("div",je,[Qe,e("button",{type:"button",disabled:c(C),title:c(C)?"Transcribingâ¦":c(E)?"Stop recording":"Voice to text",style:B([{border:"none","border-radius":"8px",padding:"5px 10px","font-size":"12px","font-weight":"600",display:"flex","align-items":"center",gap:"6px",cursor:"pointer"},{background:c(E)?"#EC6451":c(C)?"#B9C4D6":"#EEF2F7",color:c(E)?"#FFFFFF":"#304058"}]),onClick:t[2]||(t[2]=(...i)=>c(O)&&c(O)(...i))},[Ge,u(" "+a(c(C)?"Transcribingâ¦":c(E)?"Listening⦠tap to stop":"Dictate"),1)],12,Ke)]),P(e("textarea",{"onUpdate:modelValue":t[3]||(t[3]=i=>y.value=i),rows:"6",placeholder:"e.g. Where is this business losing money and what should they fix first?",style:{width:"100%",border:"1px solid #E5E7EB","border-radius":"10px",padding:"10px 12px","font-size":"13.5px",color:"#304058",outline:"none",resize:"vertical","line-height":"1.6",background:"#FFFFFF"}},null,512),[[j,y.value]]),z.value?(n(),l("div",Je,a(z.value),1)):v("",!0)]),e("div",Xe,[P(e("select",{"onUpdate:modelValue":t[4]||(t[4]=i=>U.value=i),style:{border:"1px solid #E5E7EB","border-radius":"10px",padding:"9px 10px","font-size":"12.5px","font-weight":"600",color:"#304058",outline:"none",background:"#FFFFFF"}},tt,512),[[de,U.value]]),e("button",{disabled:!T.value,style:B([{flex:"1",border:"none","border-radius":"10px",padding:"11px 16px","font-size":"13.5px","font-weight":"700",color:"#FFFFFF",display:"flex","align-items":"center","justify-content":"center",gap:"8px"},{background:T.value?"#304058":"#B9C4D6",cursor:T.value?"pointer":"default"}]),onClick:Z},[ot,u(" "+a(x.value?`Analyzing⦠${q.value}
1`:"Analyze"),1)],12,st)]),x.value?(n(),l("div",it," Deep analysis usually takes 1â3 minutes. Feel free to keep this tab open â the result appears here when ready. ")):v("",!0)]),e("div",at,[m.value?(n(),l("div",nt,[lt,e("div",rt,a(m.value),1)])):x.value?(n(),l("div",dt,[pt,e("div",ut," Claude is analyzing "+a(((W=d.value)==null?void 0:W.name)||"the company")+"⦠",1),e("div",ct,a(q.value)+" elapsed ",1)])):h.value?(n(),l("div",xt,[e("div",ht,[e("div",gt,a(h.value.model)+" · "+a(Math.round((h.value.duration_ms||0)/1e3))+"s ",1),vt,e("button",{style:{border:"1px solid #E5E7EB",background:"#FFFFFF","border-radius":"8px",padding:"6px 12px","font-size":"12px","font-weight":"600",color:"#304058",cursor:"pointer",display:"flex","align-items":"center",gap:"6px"},onClick:ee},[e("i",{class:pe(["ti",D.value?"ti-check":"ti-copy"]),style:{"font-size":"14px"}},null,2),u(" "+a(D.value?"Copied":"Copy"),1)])]),e("div",{style:{"font-size":"13.5px",color:"#3E4F68"},innerHTML:te.value},null,8,yt)])):(n(),l("div",ft,bt))])])])]}),_:1})}}},At=he(Ft,[["__scopeId","data-v-38c11ddd"]]);export{At 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.