1import{j as e,m as t}from"./index-CfHooNjQ.js";import{a as i,d as o}from"./react-vendor-QaboSCKR.js";import{R as n}from"./_RouteShell-CJHR8Ga1.js";import{p as a,u as s,W as r,P as l}from"./useWelcomeProgress-9E0RMv5J.js";import{getDoc as d,doc as c,getDocs as p,query as m,collection as u,limit as f,where as g}from"./firebase-firestore-9imLgH6W.js";import{auth as y}from"./firebase-C59sj7zD.js";import{db as h}from"./firestore-DsC8L1pI.js";import{u as x}from"./useTenantId-BAzpvh6v.js";import{u as b,n as v,i as w,l as j,a as k,s as S,m as M,b as T}from"./routes-aN95rY8g.js";import{P as I}from"./ProgressArc-DT_G0brB.js";import{T as z}from"./TruncateReveal-Bet-pl87.js";import{s as D}from"./ArrowRight.es-DjNaLBFR.js";import{n as A}from"./Broadcast.es-C47bo1lo.js";import{c as C}from"./Megaphone.es-DFKvNZ8c.js";import{p as F}from"./Receipt.es-BDnIwMAt.js";import{H as B}from"./Hero-_H0rS6wZ.js";import{C as E}from"./CockpitPanel-CrSKjRfq.js";import"./lenis-CYZ9w2j8.js";import"./framer-vv-CY5AZ.js";import"./gsap-CvrrfOyh.js";import"./PageHeader-RZbfuVkt.js";import"./useFirestoreSnapshot-DnG3vPBf.js";import"./firebase-app-NszzeGgl.js";import"./useAuth-CGdeD6Lm.js";import"./toast-UW4uwVCl.js";import"./use-reduced-motion-CiAw0R6O.js";import"./livekit-UlB0541D.js";import"./nadia-CbP0KdC-.js";import"./priya-chat-Cooaxzza.js";import"./ops-v4-routes-D6xdeB8x.js";import"./index-COVke7E_.js";import"./x-BnI8hONJ.js";import"./CaretDown.es-Dab2ouKr.js";import"./CaretUp.es-D9NmRo9f.js";const P=new Map([["bold",i.createElement(i.Fragment,null,i.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Z"}))],["duotone",i.createElement(i.Fragment,null,i.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),i.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Z"}))],["fill",i.createElement(i.Fragment,null,i.createElement("path",{d:"M232,128A104,104,0,1,1,128,24,104.13,104.13,0,0,1,232,128Z"}))],["light",i.createElement(i.Fragment,null,i.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Z"}))],["regular",i.createElement(i.Fragment,null,i.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Z"}))],["thin",i.createElement(i.Fragment,null,i.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Z"}))]]),$=i.forwardRef((e,t)=>i.createElement(a,{ref:t,...e,weights:P}));$.displayName="CircleIcon";const O=$,N=[{id:"brand-kit",title:"Confirm your brand kit",description:"Your visual identity: logo, colors, domain, and the powered-by toggle. This is how the studio LOOKS. It feeds every email, every published post, and every white-labeled tenant view.",icon:v,action:{label:"Open Brand Kit",target:"/v4/admin/brand-kit",operatorTarget:"/v4/manage/setup"}},{id:"brand-voice",title:"Set your brand voice",description:"How your agents write and speak: voice guide, offers, calls to action, and channel rules. Every agent reads this Brand Profile before it drafts a word. Distinct from the Brand Kit above, which is the visual look.",icon:C,action:{label:"Open Brand Profile",target:"/v4/brand-profile"}},{id:"industry-pack",title:"Pick your active industry pack",description:"Industry packs auto-inject sector-specific phrasing, prospect heuristics, and proof points into every agent prompt. Default for Beonbrand: Professional Services.",icon:w,action:{label:"Open Brand Kit",target:"/v4/admin/brand-kit",operatorTarget:"/v4/manage/setup"}},{id:"autonomy",title:"Set autonomy per agent",description:"Each agent runs at one of 4 tiers: Observer (watch only) · Assist (suggest, you act) · Act-with-Review (draft, you approve) · Act-Autonomously (ship, you audit). Start safe â graduate as trust grows.",icon:j,action:{label:"Review agents",target:"/v4/agents"}},{id:"spend-caps",title:"Set spend caps",description:"Daily and monthly $ caps per agent and per tenant. Defaults: $5/agent/day, $50/tenant/day. Hard circuit breaker â agents stop calling tools when capped.",icon:F,action:{label:"Open Control",target:"/v4/admin/control",operatorTarget:"/v4/manage/setup"}},{id:"first-scan",title:"Run your first scan",description:"Open the in-dashboard scan runner. Drop in any prospect URL â the result lands in /v4/leads with a 4-category scorecard, an AI biggest-gap call, and an intake score so Atlas + Mason can pick it up immediately.",icon:k,action:{label:"Open scan runner",target:"/v4/admin/scan-runner",operatorTarget:"/v4/leads"}}];function W({step:i,index:o,done:n,source:a,autoDetectedReason:s,delay:r,onMark:d,onAction:c}){const p="server"===a,m="client"===a,u=p?s?`Auto-detected: ${s}`:"Auto-detected by the platform":m?"Detected locally from tenant state":"",f=n?T:O,g=i.icon,y=n?l.yellowDim:l.yellow;return e.jsxs(t.article,{"data-testid":`welcome-step-${i.id}`,"data-done":n?"true":"false","data-source":a,"data-auto-detected":s?"true":"false",initial:{opacity:0,y:6}
1,animate:{opacity:1,y:0},transition:{duration:.45,delay:r,ease:[.22,1,.36,1]},style:{display:"grid",gridTemplateColumns:"44px 32px 1fr auto",alignItems:"center",gap:14,padding:"16px 20px",background:l.black1,border:`1px solid ${l.hairline2}`,borderLeft:`2px solid ${n?l.yellowDim:l.hairline2}`},children:[e.jsx("span",{"aria-hidden":"true",style:{fontFamily:"Cinzel, serif",fontSize:22,fontWeight:500,color:y,letterSpacing:"-0.01em",opacity:n?.55:1},children:String(o).padStart(2,"0")}),e.jsx("button",{type:"button","data-testid":`welcome-step-mark-${i.id}`,onClick:()=>d(!n),"aria-label":n?`Mark ${i.title} as todo`:`Mark ${i.title} as done`,"aria-pressed":n,className:"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-beon-yellow focus-visible:ring-offset-2 focus-visible:ring-offset-beon-black",style:{width:28,height:28,background:"transparent",border:"none",padding:0,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:y},children:e.jsx(f,{size:22,weight:n?"fill":"duotone"})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:10,flexWrap:"wrap",fontFamily:"IBM Plex Mono, monospace",fontSize:11,letterSpacing:"0.18em",textTransform:"uppercase",color:n?l.ink3:l.ink1,textDecoration:n?"line-through":"none"},children:[e.jsx(g,{size:16,weight:"duotone",color:y}),i.title,p&&e.jsx("span",{"data-testid":`welcome-step-auto-${i.id}`,"data-source":"server",title:u,"aria-label":u,style:{fontFamily:"IBM Plex Mono, monospace",fontSize:8,letterSpacing:".22em",textTransform:"uppercase",padding:"2px 7px",color:l.yellow,border:`1px solid ${l.yellowDim}`,background:l.yellowSoft,cursor:"help"},children:"Auto-detected"}),m&&e.jsx("span",{"data-testid":`welcome-step-client-${i.id}`,"data-source":"client",title:u,"aria-label":u,style:{fontFamily:"IBM Plex Mono, monospace",fontSize:8,letterSpacing:".22em",textTransform:"uppercase",padding:"2px 7px",color:l.ink2,border:`1px solid ${l.hairline2}`,background:"transparent",cursor:"help"},children:"Detected locally"})]}),e.jsx("p",{style:{margin:0,fontSize:12.5,color:l.ink2,lineHeight:1.55},children:i.description})]}),e.jsx("span",{"data-testid-wrap":`welcome-step-action-wrap-${i.id}`,style:{display:"inline-flex",alignItems:"center"},children:e.jsxs("button",{type:"button","data-testid":`welcome-step-action-${i.id}`,onClick:c,className:"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-beon-yellow focus-visible:ring-offset-2 focus-visible:ring-offset-beon-black",style:{display:"inline-flex",alignItems:"center",gap:8,padding:"10px 16px",background:n?"transparent":l.yellow,color:n?l.ink1:l.black0,border:`1px solid ${n?l.hairline2:l.yellow}`,fontFamily:"IBM Plex Mono, monospace",fontSize:10,letterSpacing:"0.2em",textTransform:"uppercase",cursor:"pointer",transition:"all 200ms"},children:[i.action.label,e.jsx(D,{size:14,weight:"bold","aria-hidden":"true"})]})})]})}function H(){const t=o(),a=b(),{progress:v,loading:w,error:j,completeStep:k,uncompleteStep:C,dismiss:F,autoDetected:P}=s(),{autoDone:$}=function(){const e=x(),[t,o]=i.useState(()=>new Set),[n,a]=i.useState(!0);return i.useEffect(()=>{let t=!1;return async function(){var i,n;if(!h||!e)return void a(!1);const s=new Set;try{const t=await d(c(h,"tenants",e,"branding","config"));if(t.exists()){const e=t.data();e&&"string"==typeof e.appName&&e.appName.trim().length>0&&s.add("brand-kit")}}catch{}try{(await p(m(u(h,"tenants",e,"brandProfiles"),f(1)))).empty||s.add("brand-voice")}catch{}try{const t=await d(c(h,"tenants",e,"settings","industry"));if(t.exists()){const e=t.data();"string"==typeof(null==e?void 0:e.industryId)&&e.industryId&&s.add("industry-pack")}}catch{}try{const t=await p(m(u(h,"tenants",e,"agents"),f(1)));if(!t.empty){const i=t.docs[0];(await d(c(h,"tenants",e,"agents",i.id,"autonomy","default"))).exists()&&s.add("autonomy")}}catch{}try{const e=null==(n=null==(i=y)?void 0:i.currentUser)?void 0:n.uid;if(e){const t=await d(c(h,"opsSettings",e));if(t.exists()){const e=t.data();"number"==typeof(null==e?void 0:e.budgetDaily)&&e.budgetDaily>0&&s.add("spend-caps")}}}catch{}if(!s.has("spend-caps"))try{const t=await d(c(h,"tenants",e,"settings","spendCap"));if(t.exists()){const e=t.data();"number"==typeof(null==e?void 0:e.dailyUsd)&&e.dailyUsd>0&&s.add("spend-caps")}}catch{}try{(await p(m(u(h,"chainRuns"),g("tenantId","==",e),f(1)))).empty||s.add("first-scan")}catch{}if(!s.has("first-scan"))try{"undefined"!=typeof sessionStorage&&sessionStorage.getItem("beon.scan.completed_during_setup")&&s.add("first-scan")}catch{}t||(o(s),a(!1))}(),()=>{t=!0}},[e]),{autoDone:t,loading:n}}(),O=i.useMemo(()=>{const e=("undefined"!=typeof globalThis?globalThis.__welcome_source__:void 0)??null,t=(null==e?void 0:e.sourceByStep)??{},i=new Set(v.stepsCompleted),o={};for(const n of r){const e=t[n];e?o[n]=e:i.has(n)?o[n]="manual":P.steps.has(n)?o[n]="server":$.has(n)?o[n]="client":o[n]="none"}return o},[v.stepsCompleted,$,P.steps]),H=i.useMemo(()=>{const e=new Set;for(const t of r)"none"!==O[t]&&e.add(t);return e},[O]),R=r.length,Z=H.size,U=Z>=R,_=Math.round(Z/R*100),L=i.useMemo(()=>N.find(e=>"none"===O[e.id]),[O]),K=e=>{const i=!a&&e.action.operatorTarget?e.action.operatorTarget:e.action.target;i.startsWith("http")?window.location.assign(i):t(i)};return e.jsx(n,{hideHeader:!0,routeId:"command",titleOverride:"WELCOME",subtitleOverride:"6-step founder setup: confirm brand kit, set brand voice, pick pack, set autonomy, set caps, run first scan",testId:"welcome-route",children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14,padding:"14px 22px",maxWidth:1280},children:[e.jsx(B,{icon:S,mission:"ONBOARDING",title:"Welcome",sub:e.jsxs(e.Fragment,{children:["Three steps. Five minutes. You'll be running. ·"," ",e.jsxs("span",{"data-testid":"welcome-setup-count",children:["Setup · ",Z," of ",R]})]})}),j&&e.jsx("div",{role:"alert","data-testid":"welcome-error",style:{padding:10,border:"1px solid rgba(255,120,120,.32)",color:"rgba(255,120,120,.92)",fontFamily:"var(--mono)",fontSize:11},children:j.message}),w&&!j&&e.jsx("div",{"data-testid":"welcome-loading",className:"mono",style:{fontSize:10,
1color:"var(--fg-4)"},children:"Loading setup stateâ¦"}),!w&&!j&&e.jsx("div",{"data-testid":"welcome-progress-bar","aria-label":"Setup progress",role:"progressbar","aria-valuenow":Z,"aria-valuemin":0,"aria-valuemax":R,style:{height:4,background:"var(--line-2)",position:"relative",overflow:"hidden"},children:e.jsx("div",{style:{position:"absolute",left:0,top:0,width:Z/R*100+"%",height:"100%",background:"var(--y)",transition:"width 320ms var(--ease, ease)"}})}),!w&&!j&&e.jsxs("div",{className:"v4-welcome-grid","data-testid":"welcome-grid",children:[e.jsx(E,{label:"SETUP CHECKLIST",icon:M,right:e.jsxs("span",{style:{fontFamily:"IBM Plex Mono, monospace",fontSize:10,letterSpacing:"0.22em",color:l.yellow},children:[Z," / ",R]}),padding:"20px",delay:.05,children:e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8,marginTop:14},children:N.map((t,i)=>{const o=O[t.id],n="server"===o?P.reasonByStep[t.id]??"detected from tenant state":null;return e.jsx(W,{step:t,index:i+1,done:"none"!==o,source:o,autoDetectedReason:n,delay:.1+.06*i,onMark:e=>{e?k(t.id):C(t.id)},onAction:()=>K(t)},t.id)})})}),e.jsx("aside",{className:"v4-welcome-summary","data-testid":"welcome-summary","aria-label":"Setup status summary",children:e.jsxs(E,{label:"STATUS",icon:A,accent:"yellow",padding:"22px 24px",delay:.12,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:18,marginTop:16,marginBottom:18},children:[e.jsx(I,{value:_,size:96,stroke:7,tone:"yellow",label:"SETUP",testId:"welcome-summary-arc"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[e.jsx("span",{style:{fontFamily:"IBM Plex Mono, monospace",fontSize:9,letterSpacing:"0.22em",color:l.ink3,textTransform:"uppercase"},children:U?"Studio is live":"On air"}),e.jsx("span",{style:{fontFamily:"Cinzel, serif",fontSize:22,fontWeight:500,color:l.ink1,letterSpacing:"-0.005em",lineHeight:1.1},children:U?"Studio is live":`${Z} of ${R} done`})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,paddingTop:16,borderTop:`1px solid ${l.hairline2}`},children:[e.jsx("span",{style:{fontFamily:"IBM Plex Mono, monospace",fontSize:9,letterSpacing:"0.22em",color:l.ink3,textTransform:"uppercase"},children:U?"Next":"What's next"}),L?e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{margin:0,fontSize:13,color:l.ink1,lineHeight:1.45},children:L.title}),e.jsx("div",{"data-testid":"welcome-summary-next-cta-wrap",children:e.jsxs("button",{type:"button","data-testid":"welcome-summary-next-cta",onClick:()=>K(L),className:"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-beon-yellow focus-visible:ring-offset-2 focus-visible:ring-offset-beon-black",style:{display:"inline-flex",alignItems:"center",gap:8,padding:"10px 16px",background:l.yellow,color:l.black0,border:`1px solid ${l.yellow}`,fontFamily:"IBM Plex Mono, monospace",fontSize:10,letterSpacing:"0.2em",textTransform:"uppercase",cursor:"pointer",transition:"all 200ms"},children:[L.action.label,e.jsx(D,{size:14,weight:"bold","aria-hidden":"true"})]})})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{margin:0,fontSize:13,color:l.ink1,lineHeight:1.45},children:"Your studio is live. Open the Command Deck and let the team do work."}),e.jsx("div",{"data-testid":"welcome-summary-deck-cta-wrap",children:e.jsxs("button",{type:"button","data-testid":"welcome-summary-deck-cta",onClick:()=>t("/v4/bridge"),className:"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-beon-yellow focus-visible:ring-offset-2 focus-visible:ring-offset-beon-black",style:{display:"inline-flex",alignItems:"center",gap:8,padding:"10px 16px",background:l.yellow,color:l.black0,border:`1px solid ${l.yellow}`,fontFamily:"IBM Plex Mono, monospace",fontSize:10,letterSpacing:"0.2em",textTransform:"uppercase",cursor:"pointer",transition:"all 200ms"},children:["Go to Command Deck",e.jsx(D,{size:14,weight:"bold","aria-hidden":"true"})]})})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,paddingTop:16,marginTop:16,borderTop:`1px solid ${l.hairline2}`},children:[e.jsx("span",{style:{fontFamily:"IBM Plex Mono, monospace",fontSize:9,letterSpacing:"0.22em",color:l.ink3,textTransform:"uppercase"},children:"Why these 6?"}),e.jsx(z,{lines:3,testId:"welcome-summary-why",children:e.jsx("p",{style:{margin:0,fontSize:12,color:l.ink2,lineHeight:1.55},children:"Brand kit sets how the studio looks and feeds every email and published post. Brand voice sets how the agents write and speak, so every draft reads like you. The industry pack tunes prospect heuristics so Atlas and Mason score leads the way you would. Autonomy tiers gate trust so agents only act once you say so. Spend caps are hard circuit breakers in dollars. The first scan proves the loop end to end so the next lead arrives already enriched."})})]})]})})]}),U&&e.jsx("div",{"data-testid":"welcome-complete",children:e.jsx(E,{label:"STUDIO IS LIVE",icon:T,accent:"yellow",padding:"20px 24px",delay:.18,children:e.jsxs("div",{role:"status",style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:18,marginTop:12,flexWrap:"wrap"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:240},children:[e.jsx("span",{style:{fontFamily:"IBM Plex Mono, monospace",fontSize:9,letterSpacing:"0.22em",color:l.yellow,textTransform:"uppercase"},children:"All systems go"}),e.jsx("span",{style:{fontFamily:"Cinzel, serif",fontSize:20,fontWeight:500,color:l.ink1,lineHeight:1.25}
1,children:"Your studio is live. Open the Command Deck and let the team do work."})]}),e.jsxs("button",{type:"button","data-testid":"welcome-go-to-deck",onClick:()=>t("/v4/bridge"),className:"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-beon-yellow focus-visible:ring-offset-2 focus-visible:ring-offset-beon-black",style:{display:"inline-flex",alignItems:"center",gap:8,padding:"10px 16px",background:l.yellow,color:l.black0,border:`1px solid ${l.yellow}`,fontFamily:"IBM Plex Mono, monospace",fontSize:10,letterSpacing:"0.2em",textTransform:"uppercase",cursor:"pointer",transition:"all 200ms"},children:["Go to Command Deck",e.jsx(D,{size:14,weight:"bold","aria-hidden":"true"})]})]})})}),!w&&!j&&!U&&!v.dismissed&&e.jsx("button",{type:"button","data-testid":"welcome-dismiss",onClick:()=>{F(),t("/v4/bridge")},className:"mono focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-beon-yellow",style:{alignSelf:"flex-start",padding:0,background:"transparent",border:"none",color:"var(--fg-4)",fontSize:10,letterSpacing:".18em",textTransform:"uppercase",textDecoration:"underline",cursor:"pointer"},children:"Skip for now (you can come back any time)"})]})})}export{H as WelcomeRoute};
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.