1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DocumentEditorWrapper-Bz3K5L6h.js","assets/state-vendor-Buwjf3sS.js","assets/AuthModal-KCqWBeh3.js","assets/NewApp-VjsrHMYR.js","assets/index-BIp3iB5I.js","assets/react-vendor-A677Qm9C.js","assets/ui-vendor-Bn3EQY-7.js","assets/index-s3_0YVcA.css","assets/ai-vendor-CoqxFSls.js","assets/NewApp-BAYXmjlq.css","assets/AppPage-B9vm_1y8.js","assets/AppPage-BA-BtK5b.css","assets/app-theme-BIPqrGBj.css","assets/graph-3d-BNxBud-5.js","assets/CSS2DRenderer-D86yg8y-.js","assets/tabs-B_a_SpY3.js","assets/popover-jV2LT_N-.js","assets/AuthModal-CVE2irD_.css","assets/DocumentEditorContent-CAE5EmPH.js","assets/DocumentToolbar-BNrgZv_8.js","assets/DocumentGenerationController-B-fZa5Wd.js","assets/useDocumentAI-Tz-CNCPp.js","assets/AccountPage-DIyucN5l.js"])))=>i.map(i=>d[i]); 2import{x as V,B as w,z as Wt,l as y,U as Yt,V as Qt,W as He,X as qt,Y as Te,Z as Xt,$ as Jt,a0 as Kt,T as Ge,N as Zt,M as es,a1 as ts,a2 as ss,a3 as pt,O as as,a4 as rs,_ as Ct,K as xt,E as Me}from"./index-BIp3iB5I.js";import{i as H,j as e,r as s,m as ns,f as Ie,h as q}from"./state-vendor-Buwjf3sS.js";import{P as le,a as de,b as ue,I as kt,L as We}from"./popover-jV2LT_N-.js";import{u as Ce,e as is,f as os,g as cs,h as ls,D as me,j as he,k as pe,l as xe,m as fe,n as be,i as X,a as Ze,b as St,o as ds,p as us,q as ms,c as _e,d as hs}from"./AppPage-B9vm_1y8.js";import{b as Fe,i as et,G as ce,j as tt,t as O,k as At,a as ke,C as ps,u as xs,g as se,r as Oe,z as fs,A as Tt,B as Pt,v as st,q as at}from"./NewApp-VjsrHMYR.js";import{U as Ne,S as ee,L as gs,y as js,z as vs,B as ws,E as ys,T as je,F as ve,H as we,I as ye,J as Z,K as bs,M as Ns,N as Cs,O as ks,P as Ye,u as rt,w as Ss,A as As,p as Ts,q as Ps,r as Es,s as Ds,t as Pe,v as Ls,C as Ms,o as Is,g as Rs,h as _s,Q as Fs,V as Os,i as Us,j as Bs,k as Vs,X as zs,G as $s,W as Hs,x as Gs}from"./AuthModal-KCqWBeh3.js";import{z as Je,H as Ws,W as Et,U as nt,Y as Ke,M as Qe,f as qe,_ as ft,a3 as Ys,a4 as Qs,a5 as qs,a6 as Xs,F as Re,$ as Js,a7 as Ks,a2 as oe,a8 as gt,a9 as jt,aa as Zs,x as De,Z as ea,a0 as Dt,B as ta,N as sa,L as aa,Q as ra,ab as na,v as vt,ac as ia,ad as oa}from"./ui-vendor-Bn3EQY-7.js";import{T as wt,a as yt,b as Xe,C as Le,d as ca}from"./tabs-B_a_SpY3.js";import{f as Lt,b as la,c as da}from"./react-vendor-A677Qm9C.js";/* empty css */import"./ai-vendor-CoqxFSls.js";import"./graph-3d-BNxBud-5.js";import"./CSS2DRenderer-D86yg8y-.js";const ua=({className:t,variant:r="default"})=>{const f=H(Fe),u=H(et);if(!f&&u)return e.jsx(ma,{className:t,variant:r});if(!f)return null;const{projectCount:C,projectLimit:c,projectsRemaining:l}=f,n=Math.min(C/c*100,100),v=n>=100?ce.GOVERNMENT:n>=75?ce.OWNERSHIP:ce.CONTRACT;return l===0?e.jsx(e.Fragment,{children:e.jsx("div",{className:V("aui-project-limit-indicator",r==="default"?"mt-2 px-1":"px-2 py-1",t),children:e.jsx("div",{className:"rounded-lg border border-border bg-muted/30 p-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-xs font-medium text-foreground",children:"Project limit reached"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:f.isPremium?`You've used all ${c} of your beta projects.`:`You've used all ${c} of your projects.`})]}),!f.isPremium&&e.jsx(Ne,{})]})})})}):e.jsx(e.Fragment,{children:e.jsx("div",{className:V("aui-project-limit-indicator",r==="default"?"mt-2 px-1":"px-2 py-1",t),children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground mb-1",children:[e.jsx("span",{children:"Projects"}),e.jsxs("span",{children:[C,"/",c]})]}),e.jsx("div",{className:V("w-full rounded-full overflow-hidden",r==="default"?"h-1.5 bg-muted":"h-1 bg-muted/50"),children:e.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${n}%`,backgroundColor:v}})})]}),n>=75&&!f.isPremium&&e.jsx(Ne,{})]})})})},ma=({className:t,variant:r="default"})=>e.jsx("div",{className:V("aui-project-limit-indicator-skeleton",r==="default"?"mt-2 px-1":"px-2 py-1",t),children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx(ee,{className:"h-3 w-16"}),e.jsx(ee,{className:"h-3 w-12"})]}),e.jsx(ee,{className:V("w-full rounded-full",r==="default"?"h-1.5":"h-1")})]}),e.jsx(ee,{className:"h-6 w-20 rounded-full shrink-0"})]})});function ha(){const[t,r]=s.useState(!1),[f,u]=s.useState(null),[C,c]=s.useState(""),l=tt(),n=ns(),{isAuthenticated:m}=Ce(),[v]=Ie(At),[,h]=Ie(ke),x=H(Fe),{data:p=[]}=is(),A=os(),M=cs(),I=ls(),[F,R]=s.useState(null),[k,T]=s.useState(!1),_=!!x&&x.projectsRemaining===0,U=async()=>
2{if(_){T(!0);return}const i=new Date().toISOString(),g=v?.ownerId??p[0]?.ownerId??"optimistic-owner",P={id:`optimistic-${Date.now()}`,name:"New Project",userId:g,ownerId:g,workspaceState:{},createdAt:i,updatedAt:i};n.setQueryData(["projects"],(S=[])=>[P,...S]),r(!1);try{const S=await A.mutateAsync({name:P.name});n.setQueryData(["projects"],($=[])=>$.map(D=>D.id===P.id?{...D,...S}:D)),l(`/app/${S.id}`)}catch(S){if(S instanceof Error&&"code"in S&&S.code==="project_limit_exceeded"){T(!0),n.setQueryData(["projects"],($=[])=>$.filter(D=>D.id!==P.id));return}X(S)||(n.setQueryData(["projects"],($=[])=>$.filter(D=>D.id!==P.id)),O({title:"Could not create project",description:S instanceof Error?S.message:"Unknown error",variant:"destructive"}))}},b=i=>{l(`/app/${i}`),r(!1)},L=(i,g)=>{u(i),c(g)},z=async i=>{const g=C.trim(),P=p.find(D=>D.id===i)?.name;if(!g||g===P){u(null),c("");return}const S=new Date().toISOString(),$=P;n.setQueryData(["projects"],(D=[])=>D.map(G=>G.id===i?{...G,name:g,updatedAt:S}:G)),u(null),c("");try{const D=await M.mutateAsync({projectId:i,updates:{name:g}});n.setQueryData(["projects"],(G=[])=>G.map(Y=>Y.id===D.id?{...Y,...D}:Y))}catch(D){X(D)||(n.setQueryData(["projects"],(G=[])=>G.map(Y=>Y.id===i?{...Y,name:$||g}
2:Y)),O({title:"Rename failed",description:D instanceof Error?D.message:"Unknown error",variant:"destructive"}))}},W=()=>{u(null),c("")},d=(i,g)=>{R({id:i,name:g})},N=async()=>{if(!F)return;const i=F.id,g=n.getQueryData(["projects"])??p,P=g.filter(S=>S.id!==i);n.setQueryData(["projects"],P),R(null),r(!1),v?.id===i&&(P.length>0?l(`/app/${P[0].id}`):l("/app"));try{await I.mutateAsync(i)}catch(S){X(S)||(n.setQueryData(["projects"],g),O({title:"Failed to delete project",description:S instanceof Error?S.message:"Unknown error",variant:"destructive"}))}},E=()=>{R(null)};return m?e.jsxs(e.Fragment,{children:[e.jsxs(le,{open:t,onOpenChange:r,children:[e.jsx(de,{asChild:!0,children:e.jsxs(w,{variant:"ghost",className:"gap-1.5 px-2 text-sidebar-foreground hover:text-sidebar-primary hover:bg-sidebar-accent",children:[e.jsx("span",{className:"text-sm font-medium",children:v?.name||"Loading..."}),e.jsx(Je,{className:"w-4 h-4 text-muted-foreground"})]})}),e.jsx(ue,{className:"w-72 p-2 bg-popover border-border",align:"start",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"max-h-64 overflow-y-auto",children:p.map(i=>e.jsx("div",{className:V("flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-accent group",v?.id===i.id&&"bg-accent"),children:f===i.id?e.jsx(e.Fragment,{children:e.jsx(kt,{value:C,onChange:g=>c(g.target.value),onKeyDown:g=>{g.key==="Enter"?z(i.id):g.key==="Escape"&&W()},className:"h-7 text-sm flex-1",autoFocus:!0,onBlur:()=>z(i.id)})}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>b(i.id),className:"flex-1 text-left text-sm truncate",children:i.name}),v?.id===i.id&&e.jsx(Ws,{className:"w-4 h-4 text-primary flex-shrink-0"}),e.jsx("button",{onClick:g=>{g.stopPropagation(),L(i.id,i.name)},className:"opacity-0 group-hover:opacity-100 p-1 hover:bg-background rounded flex-shrink-0",title:"Rename project",children:e.jsx(Et,{className:"w-3 h-3"})}),e.jsx("button",{onClick:g=>{g.stopPropagation(),d(i.id,i.name)},className:"opacity-0 group-hover:opacity-100 p-1 hover:bg-destructive/10 hover:text-destructive rounded flex-shrink-0",title:"Delete project",children:e.jsx(nt,{className:"w-3 h-3"})})]})},i.id))}),e.jsx("div",{className:"border-t border-border my-1"}),e.jsxs(w,{variant:"ghost",size:"sm",onClick:U,disabled:A.isPending||!!_,className:"w-full justify-start gap-2 text-sm",title:_?"Project limit reached":void 0,children:[e.jsx(Ke,{className:"w-4 h-4"}),A.isPending?"Creating...":"Create New Project"]}),e.jsx(ua,{variant:"compact"})]})})]}),e.jsx(me,{open:F!==null,onOpenChange:i=>!i&&E(),children:e.jsxs(he,{className:"sm:max-w-md",children:[e.jsxs(pe,{children:[e.jsx(xe,{children:"Delete Project"}),e.jsxs(fe,{children:['Are you sure you want to delete "',F?.name,'"? This action cannot be undone and all maps within this project will be permanently deleted.']})]}),e.jsxs(be,{className:"gap-2 sm:gap-0",children:[e.jsx(w,{variant:"ghost",onClick:E,disabled:I.isPending,children:"Cancel"}),e.jsx(w,{variant:"destructive",onClick:N,disabled:I.isPending,children:I.isPending?"Deleting...":"Delete"})]})]})}),x&&e.jsx(gs,{open:k,onClose:()=>T(!1),type:"project",currentCount:x.projectCount,limit:x.projectLimit})]}):e.jsxs(le,{open:t,onOpenChange:r,children:[e.jsx(de,{asChild:!0,children:e.jsxs(w,{variant:"ghost",className:"gap-1.5 px-2 text-sidebar-foreground hover:text-sidebar-primary hover:bg-sidebar-accent",children:[e.jsx("span",{className:"text-sm font-medium",children:"Untitled"}),e.jsx(Je,{className:"w-4 h-4 text-muted-foreground"})]})}),e.jsx(ue,{className:"w-72 p-4 bg-popover border-border",align:"start",children:e.jsx("div",{children:e.jsxs("p",{className:"text-sm text-popover-foreground",children:[e.jsx("button",{onClick:()=>{r(!1),h(!0)},className:"text-primary hover:underline font-medium",children:"Sign in"})," ","to save your work and create multiple projects"]})})})]})}function pa(){const[t,r]=s.useState(!1),{theme:f,setTheme:u}=Wt(),C=tt(),{isAuthenticated:c,isLoading:l}=Ce(),n=q(ke),m=q(ps),{data:v}=xs();y.debug("AvatarMenu","sessionData",v);const h=v?.user,x=h?.image,p=h?.name?.trim()||h?.email||"";let A="";p&&(p.includes("@")?A=p[0].toUpperCase():A=p.split(/\s+/).filter(
2Boolean).slice(0,2).map(L=>L[0]).join("").toUpperCase()),y.debug("AvatarMenu","user data:",{user:h,displayName:p,userInitials:A,userImage:x,hasInitials:!!A,initialsLength:A.length});const M=()=>{u(f==="light"?"dark":"light")},U=[{icon:Ys,label:"Account",onClick:()=>{C("/app/account")}},{icon:Qs,label:"Show Tour",onClick:()=>{m(),r(!1)}},{icon:qs,label:"Contact us",onClick:()=>{window.open("/?section=contact","_blank")},divider:!0},{icon:Xs,label:"Privacy",onClick:()=>{window.open("/privacy","_blank")}},{icon:Re,label:"Terms",onClick:()=>{window.open("/terms","_blank")}},{icon:Js,label:"Log out",onClick:async()=>{try{await fetch(se()+"/api/auth/sign-out",{method:"POST",credentials:"include"}),C("/")}catch(b){y.error("AvatarMenu","Logout failed:",b),C("/")}},divider:!0}];return l?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{variant:"ghost",size:"icon",onClick:M,className:"h-10 w-10 rounded-full hover:bg-accent",children:f==="light"?e.jsx(Qe,{className:"h-5 w-5"}):e.jsx(qe,{className:"h-5 w-5"})}),e.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 animate-pulse"})]}):c?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{variant:"ghost",size:"icon",onClick:M,className:"h-10 w-10 rounded-full hover:bg-accent",children:f==="light"?e.jsx(Qe,{className:"h-5 w-5"}):e.jsx(qe,{className:"h-5 w-5"})}),e.jsxs(le,{open:t,onOpenChange:r,children:[e.jsx(de,{asChild:!0,children:e.jsx(w,{size:"icon",className:"h-10 w-10 rounded-full p-0 overflow-hidden hover:ring-2 hover:ring-primary/30 transition-all",children:x?e.jsxs(js,{className:"h-10 w-10",children:[e.jsx(vs,{src:x,alt:p||A||"User"}),e.jsx(ws,{className:"bg-primary text-primary-foreground text-base font-semibold flex items-center justify-center",children:A||e.jsx(ft,{className:"h-5 w-5"})})]}):e.jsx("div",{className:"h-10 w-10 rounded-full bg-primary text-primary-foreground text-base font-semibold flex items-center justify-center",children:A||e.jsx(ft,{className:"h-5 w-5"})})})}),e.jsx(ue,{className:"w-56 p-2 bg-popover border-border",align:"end",children:e.jsx("div",{className:"space-y-1",children:U.map(b=>e.jsxs("div",{children:[b.divider&&e.jsx(ys,{className:"my-1 bg-border"}),e.jsxs(w,{variant:"ghost",onClick:()=>{b.onClick(),r(!1)},className:"w-full justify-start gap-3 px-3 py-2 h-auto font-normal text-popover-foreground hover:text-foreground hover:bg-accent",children:[e.jsx(b.icon,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:b.label})]})]},b.label))})})]})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{variant:"ghost",size:"icon",onClick:M,className:"h-10 w-10 rounded-full hover:bg-accent",children:f==="light"?e.jsx(Qe,{className:"h-5 w-5"}):e.jsx(qe,{className:"h-5 w-5"})}),e.jsx(w,{id:"workspace-signin",onClick:()=>n(!0),className:"bg-primary hover:bg-primary/90 text-primary-foreground",children:"Sign In"})]})}const xa="CONNECTORS_NOT_WHITELISTED";function fa(){const t=tt(),r=H(et),f=q(ke),[u,C]=s.useState(!1),[c,l]=s.useState(null),[n,m]=s.useState("idle"),[v,h]=s.useState(null),[x,p]=s.useState(!1),[A,M]=s.useState(!1),I=d=>{if(!d||typeof d!="object")return null;const N=d;return typeof N.code=="string"?N.code:null},F=d=>{if(!d||typeof d!="object")return null;const N=d;return typeof N.error=="string"?N.error:typeof N.message=="string"?N.message:null},R=d=>I(d)===xa?(M(!0),l(null),m("idle"),!0):!1,k=()=>r?!0:(C(!1),f(!0),!1),T=s.useCallback(async()=>{p(!0);try{const d=await fetch(`${se()}/api/connectors/snaptrade/status`,{method:"GET",credentials:"include"});if(d.status===401){l(null),m("idle"),h(null),M(!1);return}if(d.status===403){let E=null;try{E=await d.json()}catch(i){y.error("AppTopBar","Failed to parse connectors error:",i)}if(R(E))return}if(!d.ok)throw new Error("Failed to fetch SnapTrade status");const N=await d.json();M(!1),l(N),Yt({provider:"snaptrade",status:N.status??(N.registered?"registered":"unregistered")}),N.status==="active"?m("connected"):N.registered&&m("idle")}catch(d){y.error("AppTopBar","Failed to fetch SnapTrade status:",d)}finally{p(!1)}},[]);s.useEffect(()=>{u&&(T(),h(null))},[u,T]),s.useEffect(()=>{new URLSearchParams(window.location.search).get("snaptrade_callback")==="success"&&(C(!0),m("verifying"),fetch(`${se()}/api/connectors/snaptrade/callback`,{method:"POST",credentials:"include"}).then(async E=>{const i=await E.json();if(E.status===403&&R(i)){h("Connectors are available to whitelisted accounts."),m("error");return}if(i&&typeof i=="object"){const g=i;if(g.status==="active"){m("connected");const P=typeof g.brokerName=="string"?g.brokerName:"brokerage";O({title:"Brokerage connected!",description:`Your ${P} account is now linked.`,duration:4e3})}else m("idle")}T()}).catch(()=>{m("error"),h("Failed to verify the brokerage connection.")}).finally(()=>{const E=window.location.pathname;window.history.replaceState({},document.title,E)}))},[T]);const _=async()=>{m("registering"),h(null),He({action:"register",provider:"snaptrade"});try{const d=await fetch(`${se()}/api/connectors/snaptrade/register`,{method:"POST",credentials:"include"}),N=await d.json();if(d.status===403&&R(N)){h("Connectors are available to whitelisted accounts."),m("error");return}if(!d.ok)throw new Error(F(N)??"Registration failed");m("idle"),await T(),O({title:"SnapTrade registered",description:"You can now connect your brokerage account.",duration:3e3})}catch(d){const N=d instanceof Error?d.message:"Registration failed";h(N),m("error"),O({title:"Registration failed",description:N,duration:4e3,variant:"destructive"})}},U=async d=>{m("connecting"),h(null),He({action:d,provider:"snaptrade"});try{const N=`${window.location.origin}${window.location.pathname}?snaptrade_callback=success`,E=await fetch(`${se()}/api/connectors/snaptrade/connect`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({redirectUri:N})}),i=await E.json();if(E.status===403&&R(i)){h("Connectors are available to whitelisted accounts."),m("error");return}if(!E.ok)throw new Error(F(i)??"Failed to get connection URL");
2if(!i||typeof i!="object"||typeof i.redirectUri!="string")throw new Error("No redirect URL received");window.location.href=i.redirectUri}catch(N){const E=N instanceof Error?N.message:"Connection failed";h(E),m("error"),O({title:"Connection failed",description:E,duration:4e3,variant:"destructive"})}},b=async()=>{He({action:"disconnect",provider:"snaptrade"});try{if(!(await fetch(`${se()}/api/connectors/snaptrade`,{method:"DELETE",credentials:"include"})).ok)throw new Error("Failed to disconnect");l(null),m("idle"),h(null),O({title:"Disconnected",description:"Your brokerage connection has been removed.",duration:3e3})}catch(d){const N=d instanceof Error?d.message:"Disconnect failed";O({title:"Disconnect failed",description:N,duration:4e3,variant:"destructive"})}},L=()=>{if(x)return e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"h-4 w-4 animate-spin mr-2"}),"Loading..."]});switch(n){case"registering":return e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"h-4 w-4 animate-spin mr-2"}),"Registering..."]});case"connecting":return e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"h-4 w-4 animate-spin mr-2"}),"Connecting..."]});case"verifying":return e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"h-4 w-4 animate-spin mr-2"}),"Verifying..."]});case"connected":return"Manage connection";default:return c?.registered?e.jsxs(e.Fragment,{children:["Connect brokerage",e.jsx(gt,{className:"h-3 w-3 ml-1"})]}):"Get started"}},z=()=>x?e.jsx(Z,{variant:"outline",children:"Loading"}):n==="connected"||c?.status==="active"?e.jsxs(Z,{variant:"default",className:"bg-emerald-600 hover:bg-emerald-600",children:[e.jsx(Zs,{className:"h-3 w-3 mr-1"}),"Connected"]}):n==="error"?e.jsxs(Z,{variant:"destructive",children:[e.jsx(jt,{className:"h-3 w-3 mr-1"}),"Error"]}):c?.registered?e.jsx(Z,{variant:"secondary",children:"Registered"}):e.jsx(Z,{variant:"outline",children:"Not connected"}),W=()=>{n==="connected"||c?.status==="active"||k()&&(c?.registered?U("connect"):_())};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"w-full flex items-center bg-muted px-4 py-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>t("/"),className:"w-10 h-10 rounded-lg flex items-center justify-center hover:opacity-80 transition-opacity cursor-pointer","aria-label":"Go to home",children:e.jsx("img",{src:"/logo.svg",alt:"Logo",className:"w-10 h-10"})}),e.jsx("div",{"data-tour":"project-switcher",children:e.jsx(ha,{})})]}),e.jsx("div",{className:"flex-1"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(je,{delayDuration:0,children:e.jsxs(ve,{children:[e.jsx(we,{asChild:!0,children:e.jsx(w,{id:"workspace-connectors",variant:"ghost",size:"icon",onClick:()=>{Qt(),C(!0)},className:"h-9 w-9 text-foreground hover:text-primary hover:bg-primary/10",children:e.jsx(Ks,{className:"w-5 h-5"})})}),e.jsx(ye,{side:"bottom",children:e.jsx("p",{children:"Connectors"})})]})}),e.jsx(pa,{})]})]}),e.jsx(me,{open:u,onOpenChange:C,children:e.jsxs(he,{className:"max-w-2xl",children:[e.jsxs(pe,{children:[e.jsx(xe,{children:"Connectors"}),e.jsx(fe,{children:"Connect external investment accounts and services to keep your maps in sync."})]}),e.jsx("div",{className:"space-y-4",children:A?e.jsx("div",{className:"rounded-lg border border-border/60 p-4 space-y-3 bg-muted/40",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:"Upgrade for Connectors"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Connectors are available to whitelisted accounts. Contact us to unlock SnapTrade and other integrations."})]}),e.jsx(Ne,{})]})}):e.jsxs("div",{className:"rounded-lg border border-border/60 p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("img",{src:"/snaptrade.png",alt:"SnapTrade",className:"h-5 w-5"}),e.jsx("h3",{className:"font-semibold",children:"SnapTrade"}),z()]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Connect brokerage accounts via SnapTrade for portfolio sync and holdings updates."}),c?.connections&&c.connections.length>0&&e.jsxs("div",{className:"mt-2 space-y-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground font-medium",children:"Connected brokerages:"}),c.connections.map(d=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[d.brokerLogo?e.jsx("img",{src:d.brokerLogo,alt:d.brokerName,className:"h-5 w-5 rounded object-contain"}):e.jsx("img",{src:"/snaptrade.png",alt:"SnapTrade",className:"h-5 w-5"}),e.jsx("span",{className:"font-medium text-primary",children:d.brokerName}),d.syncStatus==="error"?e.jsx(Z,{variant:"destructive",className:"text-xs px-1.5 py-0",children:"Disconnected"}):d.syncStatus==="syncing"?e.jsxs(Z,{variant:"secondary",className:"text-xs px-1.5 py-0 bg-amber-500/10 text-amber-600 dar
2k:text-amber-400",children:[e.jsx(oe,{className:"h-3 w-3 mr-1 animate-spin"}),"Syncing"]}):e.jsxs(Z,{variant:"secondary",className:"text-xs px-1.5 py-0 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",children:[d.accountCount," account",d.accountCount!==1?"s":""]})]},d.id))]}),!c?.connections?.length&&c?.brokerName&&e.jsxs("p",{className:"text-sm text-primary mt-1",children:["Connected to:"," ",e.jsx("span",{className:"font-medium",children:c.brokerName})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[n!=="connected"&&c?.status!=="active"&&e.jsx(w,{variant:"outline",size:"sm",onClick:W,disabled:x||n==="registering"||n==="connecting"||n==="verifying",children:L()}),(n==="connected"||c?.status==="active")&&e.jsxs(e.Fragment,{children:[e.jsxs(w,{variant:"outline",size:"sm",onClick:()=>{k()&&U("add_account")},children:["Add account",e.jsx(gt,{className:"h-3 w-3 ml-1"})]}),e.jsx(w,{variant:"ghost",size:"sm",onClick:()=>{k()&&b()},className:"text-destructive hover:text-destructive hover:bg-destructive/10",children:"Disconnect"})]})]})]}),v&&e.jsxs("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-sm text-destructive flex items-center gap-2",children:[e.jsx(jt,{className:"h-4 w-4 flex-shrink-0"}),v]}),!v&&n==="verifying"&&e.jsxs("div",{className:"rounded-md border border-primary/40 bg-primary/5 px-3 py-2 text-sm text-primary flex items-center gap-2",children:[e.jsx(oe,{className:"h-4 w-4 animate-spin flex-shrink-0"}),"Verifying your brokerage connection..."]}),!v&&n!=="verifying"&&n!=="connected"&&c?.status!=="active"&&e.jsx("div",{className:"rounded-md border border-border/60 bg-muted/40 px-3 py-2 text-sm text-muted-foreground",children:c?.registered?c?.status==="registered"?"Click 'Connect brokerage' to link your investment accounts through SnapTrade's secure portal.":"Your connection is pending. Click 'Connect brokerage' to complete the setup or add another account.":"Click 'Get started' to register with SnapTrade, then connect your brokerage account."})]})}),e.jsx(be,{className:"gap-2",children:e.jsx(w,{variant:"outline",onClick:()=>C(!1),children:"Close"})})]})})]})}function ga(){return e.jsx("div",{className:"flex-1 flex flex-col w-full bg-card rounded-xl overflow-hidden","data-tour":"chat-pane",children:e.jsx(bs,{})})}const ja=({projectId:t,className:r,variant:f="default"})=>{const u=H(Fe),C=H(et);if(!u&&C)return e.jsx(va,{className:r,variant:f});if(!u)return null;const{artifactCountByProject:c,artifactLimitPerProject:l}=u,n=c[t]??0,m=Math.max(0,l-n),v=Math.min(n/l*100,100),x=v>=100?ce.GOVERNMENT:v>=75?ce.OWNERSHIP:ce.CONTRACT;return m===0?e.jsx(e.Fragment,{children:e.jsx("div",{className:V("aui-artifact-limit-indicator",f==="default"?"mt-2 px-1":"px-2 py-1",r),children:e.jsx("div",{className:"rounded-lg border border-border bg-muted/30 p-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-xs font-medium text-foreground",children:"Artifact limit reached"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:u.isPremium?`You've used all ${l} of your beta artifacts in this project.`:`You've used all ${l} of your artifacts in this project.`})]}),!u.isPremium&&e.jsx(Ne,{})]})})})}):e.jsx(e.Fragment,{children:e.jsx("div",{className:V("aui-artifact-limit-indicator",f==="default"?"mt-2 px-1":"px-2 py-1",r),children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground mb-1",children:[e.jsx("span",{children:"Artifacts"}),e.jsxs("span",{children:[n,"/",l]})]}),e.jsx("div",{className:V("w-full rounded-full overflow-hidden",f==="default"?"h-1.5 bg-muted":"h-1 bg-muted/50"),children:e.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${v}%`,backgroundColor:x}})})]}),v>=75&&!u.isPremium&&e.jsx(Ne,{})]})})})},va=({className:t,variant:r="default"})=>e.jsx("div",{className:V("aui-artifact-limit-indicator-skeleton",r==="default"?"mt-2 px-1":"px-2 py-1",t),children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx(ee,{className:"h-3 w-16"}),e.jsx(ee,{className:"h-3 w-12"})]}),e.jsx(ee,{className:V("w-full rounded-full",r==="default"?"h-1.5":"h-1")})]}),e.jsx(ee,{className:"h-6 w-20 rounded-full shrink-0"})]})}),bt={id:"big-6",name:"Big 6",type:"map"};function wa(){const{projectId:t}=Lt(),[r]=la(),{isAuthenticated:f}=Ce(),{data:u,isLoading:C}=Ze(f&&t||null),[c,l]=Ie(st),n=q(Oe),m=q(ke),v=q(fs),h=St(),x=ds(),p=us(),A=ms(),{clearEntity:M}=Tt(),{clearTrail:I}=Pt(),F=H(Fe),R=t&&F?F.artifactCountByProject[t]??0:0,k=F?.artifactLimitPerProject??0,T=!!F&&R>=k,_=r.get("artifactId"),U=!f&&!!_&&_!=="big-6",{data:b}=_e(U?_:null),[L,z]=s.useState(null),[W,d]=s.useState(!1),[N,E]=s.useState(!1),[i,g]=s.useState(null),[P,S]=s.useState(""),$=u||[],D=o=>{l(o.id),qt({artifact_id:o.id,artifact_type:o.type,project_id:t??void 0}),o.type==="map"&&n(o.id),M(),I()},G=async()=>
2{if(!f){m(!0);return}if(!t)return;M(),I();const o={type:"map",layers:[],settings:{starredEntityIds:[]}};try{const a=await h.mutateAsync({projectId:t,name:"Untitled Map",type:"map",content:o});Te({artifact_id:a.id,project_id:t,artifact_type:"map",source:"empty"}),l(a.id),n(a.id)}catch(a){X(a)||(y.error("ArtifactHeader","Failed to create map:",a),O({title:"Failed to create map",duration:3e3,description:a instanceof Error?a.message:"Unknown error",variant:"destructive"}))}},Y=async()=>{if(!f){m(!0);return}if(!t)return;M(),I();const o={type:"document",content:[{type:"p",children:[{text:""}]}],labels:[]};try{const a=await h.mutateAsync({projectId:t,name:"Untitled Document",type:"document",content:o});Te({artifact_id:a.id,project_id:t,artifact_type:"document",source:"document"}),l(a.id)}catch(a){X(a)||(y.error("ArtifactHeader","Failed to create document:",a),O({title:"Failed to create document",duration:3e3,description:a instanceof Error?a.message:"Unknown error",variant:"destructive"}))}},Ue=o=>{g(o),S(o.name),z(null),d(!0)},j=async()=>{if(!i||!P.trim()||!t)return;const o=i,a=P.trim();d(!1),g(null),S("");try{await x.mutateAsync({artifactId:o.id,projectId:t,name:a}),Jt({artifact_id:o.id,project_id:t,artifact_type:o.type,previous_name:o.name,new_name:a})}catch(K){X(K)||(y.error("ArtifactHeader","Failed to rename artifact:",K),O({title:"Failed to rename",duration:3e3,description:K instanceof Error?K.message:"Unknown error",variant:"destructive"}))}},J=o=>{g(o),z(null),E(!0)},Q=async()=>{if(!i||!t)return;const o=i;if(E(!1),g(null),c===o.id){const a=$.filter(K=>K.id!==o.id);a.length>0?D(a[0]):(l(null),n(null))}try{await p.mutateAsync({artifactId:o.id,projectId:t}),Kt({artifact_id:o.id,project_id:t,artifact_type:o.type})}catch(a){X(a)||(y.error("ArtifactHeader","Failed to delete artifact:",a),O({title:"Failed to delete",duration:3e3,description:a instanceof Error?a.message:"Unknown error",variant:"destructive"}))}},te=async o=>{if(t){z(null);try{const a=await A.mutateAsync({artifactId:o.id,projectId:t});Xt({artifact_id:o.id,project_id:t,artifact_type:o.type,new_artifact_id:a.id}),Te({artifact_id:a.id,project_id:t,artifact_type:a.type,source:"duplicate"}),l(a.id),n(a.id)}catch(a){X(a)||(y.error("ArtifactHeader","Failed to duplicate artifact:",a),O({title:"Failed to duplicate",duration:3e3,description:a instanceof Error?a.message:"Unknown error",variant:"destructive"}))}}},ae=async()=>{if(!f){m(!0);return}if(!t)return;M(),I();const o={type:"map",layers:[],settings:{starredEntityIds:[]}};try{v("choose-portfolio");const a=await h.mutateAsync({projectId:t,name:"Portfolio",type:"map",content:o});Te({artifact_id:a.id,project_id:t,artifact_type:"map",source:"portfolio"}),l(a.id),n(a.id)}catch(a){v("choose"),X(a)||(y.error("ArtifactHeader","Failed to create portfolio map:",a),O({title:"Failed to create map",duration:3e3,description:a instanceof Error?a.message:"Unknown error",variant:"destructive"}))}};if(!f){const o=b||bt,a=b?.name.replace(" (Snapshot)","")||bt.name;return e.jsx("div",{className:"h-11 flex items-center bg-card","data-testid":"artifact-header",children:e.jsxs("div",{className:"flex items-center gap-1 px-6",children:[e.jsx(wt,{value:o.id,className:"h-full",children:e.jsx(yt,{className:"h-9 bg-transparent p-0 gap-1",children:e.jsxs(Xe,{value:o.id,onClick:()=>D(o),className:V("text-muted-foreground data-[state=active]:bg-transparent data-[state=active]:shadow-none data-[state=active]:border-b-2 data-[state=active]:border-primary data-[state=active]:text-primary data-[state=active]:rounded-none","flex items-center gap-1.5 px-3"),children:[e.jsx(De,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-[200px] truncate",children:a})]})})}),e.jsx(w,{variant:"ghost",size:"icon",onClick:G,className:"h-9 w-9 text-muted-foreground hover:text-primary hover:bg-primary/10",title:"Sign in to create maps",children:e.jsx(Ke,{className:"w-4 h-4"})})]})})}return e.jsxs("div",{className:"h-11 flex items-center bg-card","data-testid":"artifact-header",children:[e.jsxs("div",{className:"flex items-center gap-2 px-6 w-full overflow-hidden",children:[e.jsx("div",{className:"flex items-center gap-1 flex-1 min-w-0 overflow-x-auto scrollbar-hide",children:e.jsx(wt,{value:c||void 0,className:"h-full",children:e.jsx(yt,{className:"h-9 bg-transparent p-0 gap-1",children:C?e.jsx("div",{className:"h-9 w-20 animate-pulse bg-muted rounded"}):$.length===0?e.jsx(Xe,{value:"empty",disabled:!0,className:"text-muted-foreground data-[state=active]:bg-transparent data-[state=active]:shadow-none",children:"No artifacts yet"}):$.map(o=>e.jsxs("div",{className:"flex items-center group flex-shrink-0",children:[e.jsxs(Xe,{value:o.id,onClick:()=>D(o),onContextMenu:a=>{a.preventDefault(),z(o.id)},className:V("text-muted-foreground data-[state=active]:bg-transparent data-[state=active]:shadow-none data-[state=active]:border-b-2 data-[state=active]:border-primary data-[state=active]:text-primary data-[state=active]:rounded-none","flex items-center gap-1.5 px-3 pr-1"),children:[o.type==="document"?e.jsx(Re,{className:"h-3 w-3"}):e.jsx(De,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-[120px] truncate",children:o.name})]}),e.jsxs(le,{open:L===o.id,onOpenChange:a=>z(a?o.id:null),children:[e.jsx(de,{asChild:!0,children:e.jsx(w,{variant:"ghost",size:"icon",className:V("h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity",L===o.id&&"opacity-100"),onClick:a=>{a.stopPropagation()},children:e.jsx(ea,{className:"h-3 w-3"})})}),e.jsx(ue,{className:"w-48 p-2",align:"start",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs(w,{variant:"ghost",onClick:()=>
2Ue(o),className:"w-full justify-start gap-3 px-3 py-2 h-auto font-normal",children:[e.jsx(Et,{className:"h-4 w-4"}),e.jsx("span",{children:"Rename"})]}),e.jsxs(w,{variant:"ghost",onClick:()=>te(o),className:"w-full justify-start gap-3 px-3 py-2 h-auto font-normal",children:[e.jsx(Dt,{className:"h-4 w-4"}),e.jsx("span",{children:"Duplicate"})]}),e.jsxs(w,{variant:"ghost",onClick:()=>J(o),className:"w-full justify-start gap-3 px-3 py-2 h-auto font-normal text-destructive hover:text-destructive hover:bg-destructive/10",children:[e.jsx(nt,{className:"h-4 w-4"}),e.jsx("span",{children:"Delete"})]})]})})]})]},o.id))})})}),e.jsxs(Ns,{children:[e.jsx(Cs,{asChild:!0,children:e.jsx(w,{id:"workspace-create-new",variant:"ghost",size:"sm",disabled:h.isPending,className:"h-9 px-2 text-muted-foreground hover:text-primary hover:bg-primary/10 flex-shrink-0",title:"Add new artifact",children:h.isPending?e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary/30 border-t-primary"}):e.jsxs(e.Fragment,{children:[e.jsx(Ke,{className:"w-4 h-4"}),e.jsx(Je,{className:"w-3 h-3 ml-1"})]})})}),e.jsxs(ks,{align:"start",className:"p-0",children:[!T&&e.jsxs(e.Fragment,{children:[e.jsxs(Ye,{onClick:G,children:[e.jsx(De,{className:"h-4 w-4 mr-2"}),"New Map"]}),e.jsxs(Ye,{onClick:Y,children:[e.jsx(Re,{className:"h-4 w-4 mr-2"}),"New Document"]}),e.jsxs(Ye,{onClick:ae,children:[e.jsx(ta,{className:"h-4 w-4 mr-2"}),"Portfolio Map"]}),e.jsx("div",{className:"border-t border-border my-1"})]}),t&&e.jsx("div",{className:"p-2",children:e.jsx(ja,{projectId:t,variant:"compact"})})]})]})]}),e.jsx(me,{open:W,onOpenChange:d,children:e.jsxs(he,{children:[e.jsxs(pe,{children:[e.jsxs(xe,{children:["Rename"," ",i?.type==="document"?"Document":"Map"]}),e.jsxs(fe,{children:["Enter a new name for your"," ",i?.type==="document"?"document":"map","."]})]}),e.jsx(kt,{value:P,onChange:o=>S(o.target.value),placeholder:i?.type==="document"?"Document name":"Map name",onKeyDown:o=>{o.key==="Enter"&&j()}}),e.jsxs(be,{children:[e.jsx(w,{variant:"outline",onClick:()=>d(!1),children:"Cancel"}),e.jsx(w,{onClick:j,disabled:!P.trim(),children:"Rename"})]})]})}),e.jsx(me,{open:N,onOpenChange:E,children:e.jsxs(he,{children:[e.jsxs(pe,{children:[e.jsxs(xe,{children:["Delete"," ",i?.type==="document"?"Document":"Map"]}),e.jsxs(fe,{children:['Are you sure you want to delete "',i?.name,'"? This action cannot be undone.']})]}),e.jsxs(be,{children:[e.jsx(w,{variant:"outline",onClick:()=>E(!1),children:"Cancel"}),e.jsx(w,{variant:"destructive",onClick:Q,children:"Delete"})]})]})})]})}function ya(){return e.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 1200 1227",className:"h-4 w-4",children:e.jsx("path",{fill:"currentColor",d:"M714.2 519.3 1150.3 0H1047L668 458.4 364.9 0H0l457.2 678.2L0 1226.6h103.3l400.5-486 328.1 486h364.1L714.2 519.3ZM538.4 693.2l-47.9-68.4L127.5 79.6h165.6l293.4 420.6 47.9 68.4 381.2 545.9H848.9l-310.5-421.3Z"})})}function ba(){return e.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",className:"h-5 w-5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"})})}function Na({isEmpty:t=!1}){const{graphData:r,setLayers:f,layers:u,emergentSettings:C,setEmergentSettings:c,layoutSettings:l,setLayoutSettings:n}=rt(),m=Ss(),[v,h]=s.useState(!1),[x,p]=s.useState(!1),[A,M]=s.useState(!1),[I,F]=s.useState(!1),R=H(Oe),k=R&&R!=="big-6"?R:null,{data:T}=_e(k),[_,U]=s.useState(""),[b,L]=s.useState(null),[z,W]=s.useState(null),[d,N]=s.useState(null),[E,i]=s.useState(!1);s.useEffect(()=>{const j=T?.name?`Check out "${T.name}" on Money Trail.`:"Check out this Money Trail map.";U(j)},[T?.name,k]),s.useEffect(()=>{x||(L(null),W(null),N(null))},[x]),s.useEffect(()=>{L(null),W(null),N(null)},[k]);const g=s.useMemo(()=>_.trim()?_.trim():"Check out this Money Trail map.",[_]),P=s.useMemo(()=>{const j=b||k;return j?J=>{const Q=new URL(`/share/${j}`,window.location.origin);return Q.searchParams.set("source","share"),Q.searchParams.set("channel",J),Q.toString()}:()=>""},[b,k]),S=s.useMemo(()=>b||k?P("copy"):"",[P,b,k]),$=s.useMemo(()=>
2{if(!S)return"";const j=encodeURIComponent(g),J=encodeURIComponent(P("twitter"));return`https://twitter.com/intent/tweet?text=${j}&url=${J}`},[g,P,S]),D=s.useMemo(()=>S?`https://wa.me/?text=${encodeURIComponent(`${g} ${P("whatsapp")}`)}`:"",[g,P,S]),G=T?.name?`Check out "${T.name}" on Money Trail.`:"Check out this Money Trail map.",Y=async()=>{if(!(!k||!T)){i(!0);try{let j;try{if(m.current){const te=m.current.renderer();te&&te.domElement?(y.debug("ViewControlsBar","Capturing screenshot from THREE.js canvas..."),await new Promise(ae=>{window.requestAnimationFrame(()=>{try{const a=te.getContext().canvas;y.debug("ViewControlsBar","Canvas dimensions:",a.width,"x",a.height);const K=a.toDataURL("image/png"),Se=document.createElement("canvas");Se.width=1200,Se.height=630;const B=Se.getContext("2d");if(B&&m.current){const ge=document.documentElement.classList.contains("dark"),it=ge?"#212830":"#e5e7eb";y.debug("ViewControlsBar","Using background color:",it,"(dark theme:",ge,")"),B.fillStyle=it,B.fillRect(0,0,1200,630);const re=new Image;re.onload=()=>{const Mt=1.9047619047619047,Be=re.width/re.height;let ne=1200,ie=630,Ve=0,ze=0;Be>Mt?(ie=630,ne=ie*Be,Ve=(1200-ne)/2):(ne=1200,ie=ne/Be,ze=(630-ie)/2),B.drawImage(re,Ve,ze,ne,ie);try{const ct=a.parentElement?.parentElement?.querySelector(".absolute.inset-0.pointer-events-none");if(ct){y.debug("ViewControlsBar","Found labels container, drawing labels...");const It=ct.querySelectorAll(".absolute.transition-opacity"),Rt=ne/a.clientWidth,_t=ie/a.clientHeight;B.font='12px Sora, Satoshi, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',B.textAlign="center",B.textBaseline="bottom",It.forEach(Ft=>{const Ae=Ft,lt=Ae.querySelector(".bg-card");if(!lt)return;const $e=lt.textContent||"";if(parseFloat(Ae.style.opacity||"1")===0||!$e)return;const Ot=parseFloat(Ae.style.left)||0,Ut=parseFloat(Ae.style.top)||0,dt=Ve+Ot*Rt,ut=ze+Ut*_t,mt=B.measureText($e).width+8*2,ht=24,Bt=ge?"rgba(28, 34, 43, 0.9)":"rgba(255, 255, 255, 0.9)",Vt=ge?"#f9fafb":"#111827",zt=ge?"rgba(55, 65, 81, 0.5)":"rgba(229, 231, 235, 0.5)";B.fillStyle=Bt,B.strokeStyle=zt,B.lineWidth=1;const $t=dt-mt/2,Ht=ut-ht,Gt=4;B.beginPath(),B.roundRect($t,Ht,mt,ht,Gt),B.fill(),B.stroke(),B.fillStyle=Vt,B.fillText($e,dt,ut-7)}),y.debug("ViewControlsBar","Labels drawn successfully")}else y.debug("ViewControlsBar","No labels container found")}catch(ot){y.error("ViewControlsBar","Error capturing labels:",ot)}j=Se.toDataURL("image/jpeg",.9),y.debug("ViewControlsBar","Screenshot captured successfully"),y.debug("ViewControlsBar","Screenshot length:",j.length),N(j),ae()},re.onerror=()=>{y.error("ViewControlsBar","Failed to load captured image"),ae()},re.src=K}else ae()}catch(o){y.error("ViewControlsBar","Error in requestAnimationFrame:",o),ae()}})})):y.warn("ViewControlsBar","Renderer or canvas not available")}else y.warn("ViewControlsBar","Graph ref not available, proceeding without screenshot")}catch(te){y.error("ViewControlsBar","Failed to capture screenshot:",te)}const J=await fetch(`${se()}/api/projects/${T.projectId}/artifacts/${k}/snapshot`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({screenshot:j})});if(!J.ok)throw new Error("Failed to create snapshot");const Q=await J.json();y.debug("ViewControlsBar","Snapshot created:",Q.snapshot),y.debug("ViewControlsBar","Preview URL:",Q.snapshot.previewImageUrl),L(Q.snapshot.id),W(Q.snapshot.previewImageUrl),rs({map_id:k,snapshot_id:Q.snapshot.id}),O({title:"Link ready to share!"})}catch(j){y.error("ViewControlsBar","Failed to create snapshot:",j),O({title:"Failed to create snapshot",description:"Please try again",variant:"destructive"})}finally{i(!1)}}},Ue=()=>{y.debug("ViewControlsBar","Clearing layers. Current count:",u.length),as({map_id:k,layer_count:u.length}),f([]),h(!1),y.debug("ViewControlsBar","Layers cleared")};return t?e.jsx("div",{className:"h-12 bg-muted rounded-t-lg"}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"h-12 px-6 flex items-center bg-muted rounded-t-lg relative",children:[e.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 w-80 z-50",children:e.jsx(As,{placeholder:"Search in graph or add company...",activeGraphData:r,isEmpty:r.no
2des.length===0})}),e.jsxs("div",{className:"ml-auto relative z-10 flex items-center gap-2",children:[e.jsxs(le,{open:I,onOpenChange:j=>{F(j),Zt({is_open:j})},children:[e.jsx(je,{delayDuration:0,children:e.jsxs(ve,{children:[e.jsx(de,{asChild:!0,children:e.jsx(we,{asChild:!0,children:e.jsx(w,{id:"workspace-layout",variant:I?"secondary":"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(sa,{className:"h-4 w-4"})})})}),e.jsx(ye,{className:"bg-primary text-primary-foreground",children:"Layout"})]})}),e.jsx(ue,{side:"bottom",align:"end",className:"w-72 p-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"font-medium text-sm",children:"Graph Layout"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(We,{className:"text-xs text-muted-foreground",children:"Cluster by"}),e.jsxs(Ts,{value:l.clusterBy,onValueChange:j=>{n({...l,clusterBy:j}),Ge({setting:"cluster_by",value:j})},children:[e.jsx(Ps,{className:"w-full",children:e.jsx(Es,{placeholder:"Select property"})}),e.jsxs(Ds,{children:[e.jsx(Pe,{value:"none",children:"None (default)"}),e.jsx(Pe,{value:"sector",children:"Sector"}),e.jsx(Pe,{value:"industry",children:"Industry"}),e.jsx(Pe,{value:"similar",children:"Similar"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Group nodes by a shared property. Similar clusters by sector, industry, and market cap."})]}),l.clusterBy!=="none"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(We,{className:"text-xs text-muted-foreground",children:"Cluster strength"}),e.jsxs("span",{className:"text-xs text-muted-foreground tabular-nums",children:[Math.round(l.clusterStrength*100),"%"]})]}),e.jsx(Ls,{value:[l.clusterStrength],onValueChange:([j])=>{n({...l,clusterStrength:j}),Ge({setting:"cluster_strength",value:j})},min:.1,max:1,step:.1,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Higher values create tighter clusters"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ms,{id:"showClusterAnchors",checked:l.showClusterAnchors??!1,onCheckedChange:j=>{n({...l,showClusterAnchors:j===!0}
2),Ge({setting:"show_cluster_labels",value:j===!0})}}),e.jsx(We,{htmlFor:"showClusterAnchors",className:"text-sm cursor-pointer",children:"Show cluster labels"})]})]})]})})]}),e.jsxs(le,{open:A,onOpenChange:j=>{M(j),es({is_open:j})},children:[e.jsx(je,{delayDuration:0,children:e.jsxs(ve,{children:[e.jsx(de,{asChild:!0,children:e.jsx(we,{asChild:!0,children:e.jsx(w,{id:"workspace-layers",variant:A?"secondary":"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(aa,{className:"h-4 w-4"})})})}),e.jsx(ye,{className:"bg-primary text-primary-foreground",children:"Layers"})]})}),e.jsx(ue,{side:"bottom",align:"end",className:"w-80 max-h-[28rem] p-0",children:e.jsx(Is,{graphData:r,emergentSettings:C,onUpdateEmergentSettings:c})})]}),e.jsx(je,{delayDuration:0,children:e.jsxs(ve,{children:[e.jsx(we,{asChild:!0,children:e.jsx(w,{id:"workspace-share-map",variant:"ghost",size:"icon",onClick:()=>{ts({map_id:k}),p(!0)},className:"h-8 w-8",disabled:!k,children:e.jsx(ra,{className:"h-4 w-4"})})}),e.jsx(ye,{className:"bg-primary text-primary-foreground",children:"Share"})]})}),e.jsx(je,{delayDuration:0,children:e.jsxs(ve,{children:[e.jsx(we,{asChild:!0,children:e.jsx(w,{variant:"ghost",size:"icon",onClick:()=>h(!0),className:"h-8 w-8",children:e.jsx(nt,{className:"h-4 w-4"})})}),e.jsx(ye,{className:"bg-primary text-primary-foreground",children:"Clear map"})]})})]})]}),e.jsx(me,{open:v,onOpenChange:h,children:e.jsxs(he,{children:[e.jsxs(pe,{children:[e.jsx(xe,{children:"Clear all layers?"}),e.jsx(fe,{children:"This will remove all layers from the current map. This action cannot be undone."})]}),e.jsxs(be,{children:[e.jsx(w,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),e.jsx(w,{variant:"destructive",onClick:Ue,children:"Clear All"})]})]})}),e.jsx(me,{open:x,onOpenChange:p,children:e.jsxs(he,{children:[e.jsxs(pe,{children:[e.jsx(xe,{children:"Share this map"}),e.jsx(fe,{children:"Share your work with others! Use the link below to share this map. You can also customize the"})]}),e.jsx(Le,{className:"bg-muted/50 border-muted overflow-hidden",children:e.jsxs(ca,{className:"p-0",children:[e.jsx("div",{className:"relative w-full h-40 bg-gradient-to-br from-primary/20 to-primary/5 flex items-center justify-center border-b border-muted overflow-hidden",children:z||d?e.jsx("img",{src:z||d||"/logo.svg",alt:"Map preview",className:"absolute inset-0 w-full h-full object-cover",onError:j=>{y.error("ViewControlsBar","Failed to load preview image:",z||d),j.currentTarget.style.display="none"},onLoad:()=>{y.debug("ViewControlsBar","Preview image loaded successfully")}}):e.jsx("img",{src:"/logo.svg",alt:"Money Trail",className:"h-16 w-16 opacity-80"})}),e.jsxs("div",{className:"p-4 space-y-2",children:[e.jsx("div",{className:"text-sm font-semibold text-foreground",children:T?.name||"Money Trail map"}),e.jsx("div",{className:"text-xs text-muted-foreground line-clamp-2",children:g}),e.jsx("div",{className:"text-xs text-muted-foreground/60 truncate",children:"moneytrail.ai"})]})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm font-medium",children:"Share message"}),e.jsx("textarea",{value:_,onChange:j=>U(j.target.value),placeholder:G,rows:3,className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"This text will be included in the share preview and social posts."})]}),!b&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{onClick:Y,disabled:E||!k,className:"w-full",children:E?"Creating snapshot...":"Generate Share Link"}),e.jsx("div",{className:"text-xs text-muted-foreground text-center",children:"Create a frozen snapshot of this map to share. Changes you make later won't affect the shared version."})]}),b&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"text-sm font-medium text-center",children:"Link is ready to share"}),e.jsxs("div",{className:"flex gap-2 justify-center",children:[e.jsx(w,{variant:"outline",size:"icon",className:"h-12 w-12",disabled:!S,onClick:async()=>{try{await navigator.clipboard.writeText(S),k&&ss({map_id:k}),O({title:"Link copied to clipboard"})}
2catch(j){y.error("ViewControlsBar","Failed to copy share link:",j),O({title:"Unable to copy link",variant:"destructive"})}},title:"Copy link",children:e.jsx(Dt,{className:"h-5 w-5"})}),e.jsx(w,{variant:"outline",size:"icon",className:"h-12 w-12",disabled:!$,asChild:!0,children:e.jsx("a",{href:$,target:"_blank",rel:"noreferrer",title:"Share on Twitter",onClick:()=>{k&&pt({map_id:k,channel:"twitter"})},children:e.jsx(ya,{})})}),e.jsx(w,{variant:"outline",size:"icon",className:"h-12 w-12",disabled:!D,asChild:!0,children:e.jsx("a",{href:D,target:"_blank",rel:"noreferrer",title:"Share on WhatsApp",onClick:()=>{k&&pt({map_id:k,channel:"whatsapp"})},children:e.jsx(ba,{})})})]})]})]})})]})}const Ca=s.lazy(()=>Ct(()=>import("./DocumentEditorWrapper-Bz3K5L6h.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])).then(t=>({default:t.DocumentEditorWrapper}))),Ee=[{type:"p",children:[{text:""}]}];function Nt(){return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx("div",{className:"flex items-center justify-between px-1 py-1.5 gap-2 border-b border-muted bg-muted/30 rounded-t-lg",children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"h-7 w-16 bg-muted rounded animate-pulse"}),e.jsx("div",{className:"h-7 w-20 bg-muted rounded animate-pulse"}),e.jsx("div",{className:"h-7 w-24 bg-muted rounded animate-pulse"})]})}),e.jsx("div",{className:"flex-1 flex flex-col overflow-hidden bg-muted rounded-b-lg border-l border-r border-b border-muted",children:e.jsx("div",{className:"flex-1 overflow-auto bg-card p-6",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-4 w-3/4 bg-muted rounded animate-pulse"}),e.jsx("div",{className:"h-4 w-1/2 bg-muted rounded animate-pulse"}),e.jsx("div",{className:"h-4 w-5/6 bg-muted rounded animate-pulse"})]})})})]})}function ka({artifactId:t}){const{data:r}=_e(t),f=hs(),{getTask:u,startTask:C,completeTask:c,failTask:l}=Rs(),n=s.useRef(null),m=s.useRef(""),v=s.useRef(null),h=s.useRef(!1),x=s.useRef(Ee),p=s.useRef(null),A=u(t),M=A?.status==="pending",I=A?.status==="writing",F=s.useCallback(()=>{t&&(n.current&&clearTimeout(n.current),C(t))},[t,C]),R=s.useCallback(b=>{t&&l(t,b)},[t,l]),k=s.useCallback(()=>{if(!r||r.type!=="document")return Ee;const L=r.content.content;return L?.length>0?L:Ee},[r]),T=s.useCallback(b=>{if(!t||!r||r.type!=="document")return;const L=JSON.stringify(b);if(L===m.current)return;m.current=L;const z=r.content,W={type:"document",content:b,labels:z.labels||[]};f.mutate({artifactId:t,updates:{content:W}})},[t,r,f]),_=s.useCallback(()=>{t&&(v.current&&T(v.current),c(t))},[t,c,T]),U=s.useCallback(b=>{v.current=b,!I&&(n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{T(b)},1e3))},[I,T]);return s.useEffect(()=>()=>{n.current&&clearTimeout(n.current)},[]),p.current!==t&&(p.current=t,h.current=!1,x.current=Ee),!h.current&&r&&r.type==="document"&&(x.current=k(),h.current=!0),s.useEffect(()=>{if(r&&r.type==="document"){const b=r.content;m.current=JSON.stringify(b.content)}},[r]),h.current?e.jsxs(s.Suspense,{fallback:e.jsx(Nt,{}),children:[e.jsx(_s,{}),e.jsx(Ca,{initialValue:x.current,onChange:U,generationTask:M?A:void 0,onGenerationStarted:F,onGenerationComplete:_,onGenerationError:R},t)]}):e.jsx(Nt,{})}function Sa({isExpanded:t,onToggle:r,isDisabled:f=!1}){const{entity:u,clearEntity:C}=Tt(),{trail:c,clearTrail:l}=Pt(),n=H(Oe),m=H(At),v=q(Fs),h=q(Os),{data:x}=Ze(m?.id||null),p=x?.find(L=>L.id===n),{graphData:A}=rt(),M=A.nodes.length>0||A.links.length>0,I=f||!M,F=p?.name||m?.name||"Map Overview",R=u?.type==="CompanySearchResult"||u?.type==="Government"?u.data.name:null,k=()=>{C(),l(),v(null),h(null)},T=()=>{l(),h(null)},_=s.useCallback(()=>{xt({is_open:!t,source:"desktop",trigger:"manual"}),r()},[t,r]),U=s.useCallback(L=>{xt({is_open:L,source:"desktop",trigger:"auto"}),r()},[r]);s.useEffect(()=>{!M&&t&&(U(!1),C(),l(),v(null),h(null))},[M,t,C,l,v,h,U]);const b=s.useRef(u);return s.useEffect(()=>{const L=b.current;b.current=u,u&&u!==L&&!t&&!I&&U(!0)},[u,t,I,U]),e.jsxs("div",{className:`flex flex-col overflow-hidden bg-card shadow-sm rounded-xl backdrop-blur-sm transition-all duration-300 ${t?"w-96":"w-14"}`,"data-testid":"right-drilldown-pane","data-tour":"drilldown-panel",children:[e.jsx("div",{className:`bg-muted/20 transition-all duration-300 ${t?"p-3":"pr-3 pl-3 pt-3 pb-3"}`,children:t?e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("div",{className:"flex items-center justify-end",children:e.jsx(w,{id:"workspace-overview-toggle",onClick:_,variant:"ghost",size:"icon","aria-label":"Collapse panel",className:"text-muted-foreground hover:text-foreground hover:bg-accent",children:e.jsx(na,{className:"w-5 h-5"})})}),(u||c)&&e.jsxs("div",{className:"flex items-center gap-1 text-sm flex-1 min-w-0",children:[e.jsx("button",{onClick:k,className:"text-muted-foreground hover:text-foreground transition-colors truncate",children:F}),R&&e.jsxs(e.Fragment,{children:[e.jsx(vt,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),c?e.jsx("button",{onClick:T,className:"text-muted-foreground hover:text-foreground transition-colors font-medium truncate",children:R}):e.jsx("span",{className:"text-foreground font-medium truncate",children:R})]}),c&&e.jsxs(e.Fragment,{children:[e.jsx(vt,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:"text-foreground font-medium truncate",children:"Trail"})]})]})]}):e.jsx("div",{className:"flex flex-col items-center gap-2",children:e.jsx(w,{id:"workspace-overview-toggle",onClick:_,variant:"ghost",size:"icon","aria-label":"Expand panel",disabled:I,className:"text-muted-foreground hover:text-foreground hover:bg-accent disabled:opacity-50 disabled:cursor-not-allowed",children:e.jsx(ia,{className:"w-5 h-5"})})})}),t&&e.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:c?e.jsx(Us,{trail:c}):u?e.jsx("div",{className:"flex h-full flex-col gap-3 overflow-hidden px-3 pb-3",children:e.jsx("div",{className:"min-h-0 flex-1",children:e.jsx(Bs,{baseGraphData:A})})}):e.jsx(Vs,{graphData:A})})]})}function Aa({onFocusChat:t}){const{projectId:r}=Lt(),f=H(at),u=q(st),C=q(Oe),c=St(),l=r||f,n=s.useCallback(()=>{const x=document.querySelector(".aui-composer-input");x&&(x.focus(),x.scrollIntoView({behavior:"smooth",block:"center"})),t?.()},[t]);s.useEffect(()=>{const x=p=>{p.target instanceof HTMLInputElement||p.target instanceof HTMLTextAreaElement||p.target instanceof HTMLElement&&p.target.isContentEditable||p.key==="/"&&(p.preventDefault(),n())};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[n]);const m=()=>
2{if(!l){y.error("NoProjectEmptyState","No project ID available");return}const x={type:"document",content:[{type:"p",children:[{text:""}]}],labels:[]};c.mutate({projectId:l,name:"Untitled Document",type:"document",content:x},{onSuccess:p=>{u(p.id),C(p.id)},onError:p=>{y.error("NoProjectEmptyState","Failed to create document:",p)}})},v=()=>{if(!l){y.error("NoProjectEmptyState","No project ID available");return}const x={type:"map",layers:[],settings:{starredEntityIds:[]}};c.mutate({projectId:l,name:"Untitled Map",type:"map",content:x},{onSuccess:p=>{u(p.id),C(p.id)},onError:p=>{y.error("NoProjectEmptyState","Failed to create map:",p)}})};return c.isPending?e.jsx(zs,{message:"Creating...",className:"bg-card rounded-xl"}):e.jsx("div",{className:"flex-1 flex items-center justify-center p-8 bg-card rounded-xl",children:e.jsx("div",{className:"max-w-4xl w-full",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:"text-2xl font-semibold text-foreground mb-3",children:"Welcome to Your Workspace"}),e.jsx("p",{className:"text-muted-foreground mb-10 max-w-lg mx-auto",children:"Explore company ownership networks, create research documents, and discover insights with AI-powered analysis."}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-5",children:[e.jsxs(Le,{className:V("group flex flex-col items-center gap-5 p-8 cursor-pointer transition-all duration-200","border-2 border-transparent hover:border-primary/30 hover:shadow-lg hover:shadow-primary/5","bg-gradient-to-b from-background to-muted/30"),onClick:n,children:[e.jsx("div",{className:"h-14 w-14 rounded-2xl bg-primary/10 flex items-center justify-center group-hover:bg-primary/20 transition-colors",children:e.jsx(oa,{className:"h-7 w-7 text-primary"})}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"font-semibold text-foreground text-lg mb-2",children:"Chat with AI"}),e.jsx("div",{className:"text-sm text-muted-foreground leading-relaxed",children:"Ask questions, explore companies, and get AI-generated insights"})]})]}),e.jsxs(Le,{className:V("group flex flex-col items-center gap-5 p-8 cursor-pointer transition-all duration-200","border-2 border-transparent hover:border-primary/30 hover:shadow-lg hover:shadow-primary/5","bg-gradient-to-b from-background to-muted/30"),onClick:m,children:[e.jsx("div",{className:"h-14 w-14 rounded-2xl bg-primary/10 flex items-center justify-center group-hover:bg-primary/20 transition-colors",children:e.jsx(Re,{className:"h-7 w-7 text-primary"})}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"font-semibold text-foreground text-lg mb-2",children:"New Document"}),e.jsx("div",{className:"text-sm text-muted-foreground leading-relaxed",children:"Create research notes, reports, and analysis documents"})]})]}),e.jsxs(Le,{className:V("group flex flex-col items-center gap-5 p-8 cursor-pointer transition-all duration-200","border-2 border-transparent hover:border-primary/30 hover:shadow-lg hover:shadow-primary/5","bg-gradient-to-b from-background to-muted/30"),onClick:v,children:[e.jsx("div",{className:"h-14 w-14 rounded-2xl bg-primary/10 flex items-center justify-center group-hover:bg-primary/20 transition-colors",children:e.jsx(De,{className:"h-7 w-7 text-primary"})}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"font-semibold text-foreground text-lg mb-2",children:"New Map"}),e.jsx("div",{className:"text-sm text-muted-foreground leading-relaxed",children:"Visualize ownership networks and company relationships"})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground/60 mt-10",children:["Tip: You can also use keyboard shortcuts â press"," ",e.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-muted text-muted-foreground font-mono text-[10px]",children:"/"})," ","to focus the chat"]})]})})})}function Ta(){const[t,r]=s.useState(!0),{isLoading:f,isAuthenticated:u}=Ce(),{layers:C}=rt(),c=H(at),l=H(st),{data:n}=_e(l),{data:m}=Ze(c),v=n?.type==="document",h=!m||m.length===0,x=u&&h;return f?e.jsxs("div",{className:"flex-1 flex overflow-hidden gap-4 animate-pulse",children:[e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden shadow-sm rounded-xl",children:[e.jsxs("div",{className:"h-14 bg-card rounded-t-xl border-b border-border/50 flex items-center px-4 gap-3",children:[e.jsx("div",{className:"h-5 w-32 bg-muted rounded"}),e.jsx("div",{className:"h-5 w-20 bg-muted rounded"})]}),e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden bg-card px-4 pb-4 pt-2",children:[e.jsx("div",{className:"h-8 flex items-center gap-2 mb-2",children:e.jsx("div",{className:"h-6 w-24 bg-muted rounded"})}),e.jsx("div",{className:"flex-1 bg-muted rounded-b-lg"})]})]}),e.jsx("div",{className:"flex",children:e.jsx("div",{className:"w-14 bg-card rounded-xl"})})]}):x?e.jsx("div",{className:"flex-1 flex overflow-hidden gap-4",children:e.jsx(Aa,{})}):e.jsx($s,{children:e.jsxs("div",{className:"flex-1 flex overflow-hidden gap-4",children:[e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden shadow-sm rounded-xl",children:[e.jsx("div",{"data-tour":"artifacts-header",children:e.jsx(wa,{})}),e.jsx("div",{className:"flex-1 flex flex-col overflow-hidden bg-card px-4 pb-4 pt-2",children:v&&l?e.jsx(Me,{componentName:"DocumentView",level:"feature",children:e.jsx(ka,{artifactId:l})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-tour":"view-controls",children:e.jsx(Na,{isEmpty:C.length===0})}),e.jsx(Me,{componentName:"WorkspaceCanvas",level:"feature",children:e.jsx(Hs,{},c||"default")})]})})]}),!v&&e.jsx("div",{className:"flex",children:e.jsx(Sa,{isExpanded:t,onToggle:()=>r(!t),isDisabled:!1})})]})})}function Pa(){const{isSessionPending:t}=Ce(),r=H(at);return t?e.jsxs("div",{className:"flex-1 flex overflow-hidden gap-4 animate-pulse",children:[e.jsx("div",{className:"w-96 flex flex-col overflow-hidden",children:e.jsx("div",{className:"flex-1 bg-card rounded-xl"})}),e.jsx("div",{className:"flex-1 flex overflow-hidden",children:e.jsx("div",{className:"flex-1 flex flex-col overflow-hidden shadow-sm rounded-xl bg-card"})})]}):e.jsxs("div",{className:"flex-1 flex overflow-hidden gap-4",children:[e.jsx("div",{className:"w-96 flex flex-col overflow-hidden",children:e.jsx(Me,{componentName:"LeftChatPane",level:"feature",children:e.jsx(ga,{},r||"default")})}),e.jsx("div",{className:"flex-1 flex overflow-hidden",children:e.jsx(Ta,{})})]})}const Ea=s.lazy(()=>Ct(()=>import("./AccountPage-DIyucN5l.js"),__vite__mapDeps([22,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17])
2).then(t=>({default:t.AccountPage})));function Qa(){const[t,r]=Ie(ke),u=da().pathname.endsWith("/account");return e.jsxs(Me,{componentName:"AppDesktopPage",level:"page",children:[e.jsxs("div",{className:"app-theme h-screen w-full flex flex-col bg-background overflow-hidden",children:[!u&&e.jsx(fa,{}),e.jsx("div",{className:`flex-1 flex overflow-hidden ${u?"":"bg-muted pl-4 pr-4 pb-4"}`,children:u?e.jsx(s.Suspense,{fallback:e.jsx("div",{className:"flex-1 flex items-center justify-center",children:"Loading..."}),children:e.jsx(Ea,{})}):e.jsx(Pa,{})})]}),e.jsx(Gs,{isOpen:t,onClose:()=>r(!1)})]})}export{Qa as default}; 3//# sourceMappingURL=AppDesktopPage-BTzGcaj1.js.map
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.