PageSourceSearch

https://vegaestimating.ai/assets/OSCore-BQTo7HKx.js

js vegaestimating.ai collected 2026-10-05 13:11:56 UTC 37,689 bytes, 6 lines download raw bytes

1import{a as z,j as t}from"./vendor-query-DCEy32gT.js";import{u as K,a as N,L as x}from"./vendor-react-DQQd_tv7.js";import{c as q,bt as C,bu as R,bv as T,bw as W,bx as Q,Z as O,as as j,m as S,o as k,v as F,q as H,ad as f,bj as Y,X as Z,bp as J,y as L,a2 as M,aY as B,H as X,ag as ee,bs as te,A as _,bf as b,ac as se,bi as $,F as G,a3 as ae,br as ie,by as re,n as ne,bh as oe,N as le,h as ce}from"./index-BLMWtrsz.js";import{G as v}from"./git-branch-DUbDykIk.js";import{B as de}from"./boxes-jZIJJR0g.js";import{E as me}from"./external-link-CT4Rf7-o.js";import{S as D}from"./server-BqlkZI6s.js";import{G as ue}from"./globe-ILcaarep.js";import{D as U}from"./database-GpWWMRDi.js";import{C as ge}from"./cpu-C2E5VpHa.js";import{W as he}from"./workflow-s-mvpR0Q.js";import"./vendor-pdf-Bs2G1MsY.js";import"./vendor-charts-DQlLoY8T.js";import"./vendor-dnd-CEOzIhnA.js";import"./vendor-cmdk-DZOUNnSX.js";import"./vendor-date-DvNbr4u3.js";import"./vendor-canvas-BALaVOQn.js";import"./vendor-panels-BoPcG2Ma.js";/**
2 * @license lucide-react v0.475.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const pe=[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]],xe=q("ChartPie",pe);class be{constructor(e){this.base44=e,this.modules=new Map,this.schemas={},this.config={},this.initialized=!1,this.version="2.0"}async init(e={}){if(!this.initialized)return this.config={appName:"VegaEstimating.AI",version:"2.0",...e},await this.loadCoreSchemas(),await this.loadModules(),await this.verifySystems(),this.initialized=!0,this}async loadCoreSchemas(){var s,a;const e=["Project","Room","Estimate","EstimateLineItem","PricingStandard","Organization","User"];for(const i of e)try{const r=await((a=(s=this.base44.entities[i]).schema)==null?void 0:a.call(s));this.schemas[i]=r}catch{console.warn(`Failed to load schema for ${i}`)}}async loadModules(){const e=await this.base44.entities.TradeModule.filter({is_enabled:!0});for(const s of e)this.modules.set(s.slug,{id:s.id,slug:s.slug,name:s.name,icon:s.icon,color:s.color,status:s.status,version:s.version,features:s.features})}async verifySystems(){const e={authentication:await this.base44.auth.me().then(()=>!0).catch(()=>!1),database:this.schemas&&Object.keys(this.schemas).length>0,modules:this.modules.size>0};return{healthy:Object.values(e).every(a=>a===!0),checks:e}}getModule(e){return this.modules.get(e)}getModules(){return Array.from(this.modules.values())}getAvailableTrades(){return Array.from(this.modules.values()).map(e=>({id:e.id,slug:e.slug,label:e.name,color:e.color,icon:e.icon}))}getSchema(e){return this.schemas[e]}async getOrganizations(){return this.base44.entities.Organization.list("-updated_date",100)}async getProjects(e=100){return this.base44.entities.Project.list("-updated_date",e)}async getAllEstimates(e={}){return this.base44.entities.Estimate.filter(e,"-updated_date",500)}async getSystemReport(){var m,c;const[e,s,a,i]=await Promise.all([this.base44.entities.Project.list(),this.base44.entities.Estimate.list(),this.base44.entities.Organization.list(),(c=(m=this.base44.entities.User).list)==null?void 0:c.call(m).catch(()=>[])]),r={};let l=0;for(const d of s){const g=d.trade_module||"general";r[g]||(r[g]={count:0,value:0}),r[g].count++,r[g].value+=d.grand_total||0,l+=d.grand_total||0}return{timestamp:new Date().toISOString(),version:this.version,organizations:a.length,projects:e.length,estimates:s.length,totalValue:Math.round(l*100)/100,estimatesByTrade:r,activeUsers:(i==null?void 0:i.length)||0}}async exportSystemData(){const e=await this.base44.entities.Project.list("-updated_date",1e3),s=await this.base44.entities.Estimate.list("-updated_date",2e3),a=await this.base44.entities.Room.list("-updated_date",5e3),i=await this.base44.entities.PricingStandard.list();return{exportedAt:new Date().toISOString(),version:this.version,projects:e,estimates:s,rooms:a,pricingStandards:i,moduleInfo:Array.from(this.modules.values())}}async getStatus(){const e=await this.verifySystems();return{name:this.config.appName,version:this.version,initialized:this.initialized,modules:this.modules.size,schemas:Object.keys(this.schemas).length,health:e}}}class fe{constructor(e){this.base44=e,this.registry=new C(e)}async generateMasterEstimate(e,s){const{name:a,rooms:i=[],trades:r=[],scope_description:l,assumptions:m=[],exclusions:c=[]}=s,d=await this.base44.entities.Estimate.create({name:a,project_id:e,trade_module:"master",status:"draft",scope_description:l,assumptions:m,exclusions:c,estimate_ids:[],schema_version:"2.0"}),g=[];let u=0,h=0;for(const p of r){const y=await(await this.registry.initEngine(p,e)).generateEstimate({estimate_name:`${a} - ${p}`,rooms:i,scope_description:`${p} scope`,assumptions:m,exclusions:c});g.push(y.id),u+=y.labor_subtotal||0,h+=y.material_subtotal||0}return await this.base44.entities.Estimate.update(d.id,{estimate_ids:g,labor_subtotal:Math.round(u*100)/100,material_subtotal:Math.round(h*100)/100,direct_cost_subtotal:Math.round((u+h)*100)/100}),d}async aggregateByTrade(e){const s=await this.base44.entities.Estimate.filter({project_id:e}),a={};for(const r of s)r.trade_module!=="master"&&(a[r.trade_module]||(a[r.trade_module]=[]),a[r.trade_module].push(r));const i={};for(const[r,l]of Object.entries(a)){const m=l.reduce((d,g)=>d+(g.labor_subtotal||0),0),c=l.reduce((d,g)=>d+(g.material_subtotal||0),0);i[r]={count:l.length,labor:Math.round(m*100)/100,material:Math.round(c*100)/100,total:Math.round((m+c)*100)/100,estimates:l}}return i}async getBidLevelingData(e,s){const a=await this.base44.entities.Estimate.filter({project_id:e,trade_module:s}),i=await this.registry.getEngine(s),r=a.map(u=>u.id),l=await i.getComparisonMetrics(r),m=l.map(u=>u.total),c=m.reduce((u,h)=>u+h,0)/m.length,d=Math.sqrt(m.reduce((u,h)=>u+Math.pow(h-c,2),0)/m.length);return{metrics:l.map(u=>({...u,isOutlier:Math.abs(u.total-c)>d*1.5,variance:Math.round((u.total-c)/c*100*100)/100})),average:Math.round(c*100)/100,stdDev:d}}async createBidPackage(e,s,a){return await this.base44.entities.BidPackage.create({project_id:e,trade_module:s,name:`${s} Bid Package`,status:"open",scope_description:`Bid package for ${s}`,bids:a.map(r=>({estimate_id:r}))})}async syncProjectData(e){const a=(await this.base44.entities.Project.get(e)).active_trade_modules||[],i={};for(const r of a)try{const l=await this.registry.initEngine(r,e);i[r]={synced:!0,timestamp:new Date}}catch(l){i[r]={synced:!1,error:l.message}}return i}async generateConsolidatedReport(e){const s=await this.base44.entities.Project.get(e),a=await this.base44.entities.Estimate.filter({project_id:e,trade_module:"master"}),i=await this.aggregateByTrade(e),r={projectId:e,projectName:s.name,generatedAt:new Date().toISOString(),masterEstimates:a,tradeMetrics:i,totalLabor:Object.values(i).reduce((l,m)=>l+m.labor,0),totalMaterial:Object.values(i).reduce((l,m)=>l+m.material,0)};return r.grandTotal=r.totalLabor+r.totalMaterial,r}}class ye{constructor(e){this.registry=e}async createEstimate(e,s,a={}){return await this.registry.getEngine(e).createEstimate(s,a)}async getEstimate(e,s){return await this.registry.getEngine(e).base44.entities.Estimate.get(s)}async updateEstimate(e,s,a){return await this.registry.getEngine(e).updateEstimate(s,a)}async generateEstimate(e,s,a=[]){return await this.registry.getEngine(e).generateEstimate(s,a)}async validateEstimate(e,s){return await this.registry.getEngine(e).validateEstimate(s)}async submitEstimate(e,s,a=""){return await this.registry.getEngine(e).submitEstimateForApproval(s,a)}async getProjectEstimates(e){return await this.registry.getProjectEstimates(e)}async getMasterEstimate(e){return await this.registry.getMasterEstimate(e)}listTrades(){return this.registry.listEngines()}getTrade(e){const s=this.registry.getEngine(e);return{slug:s.slug,name:s.name,version:s.version,features:s.getFeatures()}}async exportProject(e,s="json"){return await this.registry.exportProject(e,s)}async validateProject(e){return await this.registry.validateProjectEstimates(e)}async createRevision(e,s,a,i,r=0){return await this.registry.getEngine(e).createRevision(s,a,i,r)}async getVersionHistory(e,s){return await this.registry.getEngine(e).getVersionHistory(s)}async getConfidence(e,s,a=[]){const i=this.registry.getEngine(e),r=await this.registry._base44Client.entities.Estimate.get(s);return i.calculateConfidence(r,a)}async aiGenerateEstimate(e,s,a,i){return await this.registry.getEngine(e).generateAIEstimate(s,a,i)}async getMasterReport(e){const s=await this.registry.getMasterEstimate(e),{all:a}=await this.registry.getProjectEstimates(e),i=a.filter(l=>l.status==="approved").length,r=a.filter(l=>["review","pending_approval"].includes(l.status)).length;return{...s,approvedCount:i,pendingCount:r,draftCount:a.length-i-r,completionPct:a.length>0?Math.round(i/a.length*100):0}}getSystemStatus(){const e=this.listTrades();return{registered_engines:e.length,trades:e,schema_version:"3.0",api_version:"3.0.0"}}}class je{constructor(e,s=null){this.base44=e,this.organizationId=s,this.registry=new C,this.api=new ye(this.registry),this._initialized=!1,this._user=null}async initialize(){var e;if(this._initialized)return this;if(this._user=await this.base44.auth.me(),!this._user)throw new Error("VegaTradeOrchestrator: authentication required");if(!this.organizationId){const s=await this.base44.entities.Organization.list("-created_date",1).catch(()=>[]);this.organizationId=((e=s[0])==null?void 0:e.id)||null}return await this.registry.initialize(this.base44,this.organizationId).catch(s=>{console.warn("TradeRegistry DB init failed, falling back to static engines:",s.message);for(const a of R())this.registry.registerTrade(a.slug,{name:a.name,slug:a.slug,version:a.version,features:[],supportedRoomTypes:[],pricingCategories:[],status:"active"});this.registry.isInitialized=!0,this.registry._base44Client=this.base44,this.registry._organizationId=this.organizationId}),this._initialized=!0,this}async ensureInit(){this._initialized||await this.initialize()}async generateEstimate(e,s,a=[],i={}){return await this.ensureInit(),this.api.generateEstimate(e,s,a)}async generateAllEstimates(e,s={}){await this.ensureInit();const a={},i={};return await Promise.allSettled(T.map(async r=>{const l=await this.api.generateEstimate(r,e,[],s);a[r]=l})).then(r=>{r.forEach((l,m)=>{var c;l.status==="rejected"&&(i[T[m]]=(c=l.reason)==null?void 0:c.message)})}),{estimates:a,errors:i,projectId:e}}async generateAIEstimate(e,s,a=[]){await this.ensureInit();const i=this.registry.getEngine(e),{project:r,rooms:l}=await i.getProject(s),m=a.length>0?l.filter(p=>a.includes(p.id)):l,c=p=>this.base44.integrations.Core.InvokeLLM(p),d=await i.generateAIEstimate(r,m,c),g={overhead:r.markup_overhead||10,profit:r.markup_profit||10,contingency:r.markup_contingency||5,tax:r.tax_rate||0},u=i.calculateTotals(d.lineItems,g),h=await i.createEstimate(s,{name:`${i.name} AI Estimate — ${r.name}`,ai_generated:!0,ai_confidence_score:d.confidence_score||0,ai_confidence_notes:d.notes||"",assumptions:d.assumptions||[],labor_subtotal:u.labor,material_subtotal:u.material,grand_total:u.grand_total,...g});for(const p of d.lineItems)await i.createLineItem(h.id,{...p,ai_generated:!0,source:"ai",project_id:s});return{estimate:h,totals:u,confidence:d.confidence_score}}async getMasterEstimate(e){return await this.ensureInit(),this.api.getMasterEstimate(e)}async getMasterReport(e){return await this.ensureInit(),this.api.getMasterReport(e)}async getProjectEstimates(e){return await this.ensureInit(),this.api.getProjectEstimates(e)}async validateProject(e){return await this.ensureInit(),this.api.validateProject(e)}async exportProject(e,s="json"){return await this.ensureInit(),this.api.exportProject(e,s)}async updateEstimate(e,s,a){return await this.ensureInit(),this.api.updateEstimate(e,s,a)}async submitEstimate(e,s,a=""){return await this.ensureInit(),this.api.submitEstimate(e,s,a)}async createRevision(e,s,a,i,r=0){return await this.ensureInit(),this.api.createRevision(e,s,a,i,r)}async getVersionHistory(e,s){return await this.ensureInit(),this.api.getVersionHistory(e,s)}async getSystemStatus(){var s;return await this.ensureInit(),{...this.api.getSystemStatus(),user:(s=this._user)==null?void 0:s.email,organization_id:this.organizationId,schema_version:Q,engine_version:W,registry_stats:this.registry.getStats()}}listTrades(){return R()}getEngine(e){return this.registry.getEngine(e)}}function ve(o,e=null){return new je(o,e)}class we{constructor(e){this.base44=e,this.os=new be(e),this.tradeRegistry=new C(e),this.tradeOrchestrator=new fe(e),this.trades=ve(e),this.version="3.0",this.initialized=!1}async init(e={}){if(!this.initialized)return await this.os.init(e),await this.tradeRegistry.init(),this.initialized=!0,this}async getMe(){return this.base44.auth.me()}async updateMe(e){return this.base44.auth.updateMe(e)}async logout(e){return this.base44.auth.logout(e)}async getProject(e){return this.base44.entities.Project.get(e)}async listProjects(e=50){return this.base44.entities.Project.list("-updated_date",e)}async createProject(e){return this.base44.entities.Project.create(e)}async updateProject(e,s){return this.base44.entities.Project.update(e,s)}async getRoom(e){return this.base44.entities.Room.get(e)}async getRoomsByProject(e){return this.base44.entities.Room.filter({project_id:e})}async createRoom(e){return this.base44.entities.Room.create(e)}async updateRoom(e,s){return this.base44.entities.Room.update(e,s)}async getEstimate(e){return this.base44.entities.Estimate.get(e)}async listEstimates(e={}){return this.base44.entities.Estimate.filter(e,"-updated_date",100)}async createEstimate(e){return this.base44.entities.Estimate.create(e)}async updateEstimate(e,s){return this.base44.entities.Estimate.update(e,s)}async getLineItems(e){const s=await this.getEstimate(e);return Promise.all(s.line_item_ids.map(a=>this.base44.entities.EstimateLineItem.get(a)))}async getPricingStandards(e,s=null){const a={trade_module:e,is_active:!0};return s&&(a.region=s),this.base44.entities.PricingStandard.filter(a)}async listAllPricingStandards(){return this.base44.entities.PricingStandard.list("-updated_date",500)}async initTradeEngine(e,s,a=null){return this.tradeRegistry.initEngine(e,s,a)}async getTradeModule(e){return this.os.getModule(e)}async getAvailableTrades(){return this.os.getAvailableTrades()}async generateMasterEstimate(e,s){return this.tradeOrchestrator.generateMasterEstimate(e,s)}async generateTradeEstimate(e,s,a=[],i={}){return await this.trades.initialize(),this.trades.generateEstimate(e,s,a,i)}async generateAllTradeEstimates(e,s={}){return await this.trades.initialize(),this.trades.generateAllEstimates(e,s)}async generateAITradeEstimate(e,s,a=[]){return await this.trades.initialize(),this.trades.generateAIEstimate(e,s,a)}async getTradeSystemStatus(){return await this.trades.initialize(),this.trades.getSystemStatus()}async aggregateByTrade(e){return this.tradeOrchestrator.aggregateByTrade(e)}async getBidLevelingData(e,s){return this.tradeOrchestrator.getBidLevelingData(e,s)}async getSystemReport(){return this.os.getSystemReport()}async getConsolidatedReport(e){return this.tradeOrchestrator.generateConsolidatedReport(e)}async exportSystemData(){return this.os.exportSystemData()}async exportProjectData(e){const s=await this.getProject(e),a=await this.base44.entities.Estimate.filter({project_id:e}),i=await this.getRoomsByProject(e);return{exportedAt:new Date().toISOString(),project:s,estimates:a,rooms:i}}getSchema(e){return this.os.getSchema(e)}async getStatus(){return this.os.getStatus()}isInitialized(){return this.initialized}}let P=null;const Ne=()=>(P||(P=new we(ce)),P),w=[{id:"auth",label:"Authentication",icon:se,color:"from-slate-600 to-slate-800",de
6sc:"JWT, RBAC, SSO",status:"active"},{id:"org",label:"Organization Mgmt",icon:ue,color:"from-blue-600 to-blue-800",desc:"Multi-tenant, branding",status:"active"},{id:"project",label:"Project Management",icon:j,color:"from-violet-600 to-violet-800",desc:"Shared across all trades",status:"active"},{id:"schema",label:"Universal Schema",icon:U,color:"from-teal-600 to-teal-800",desc:"Rooms, levels, openings",status:"active"},{id:"engine",label:"Trade Engines",icon:ge,color:"from-emerald-600 to-emerald-800",desc:"Pluggable per trade",status:"active"},{id:"ai",label:"AI Orchestration",icon:$,color:"from-purple-600 to-purple-800",desc:"Multi-agent estimation",status:"active"},{id:"pricing",label:"Pricing Engine",icon:M,color:"from-amber-600 to-amber-800",desc:"Standards & live data",status:"active"},{id:"reporting",label:"Reporting Layer",icon:xe,color:"from-rose-600 to-rose-800",desc:"Cross-trade analytics",status:"active"},{id:"proposal",label:"Proposal Generation",icon:G,color:"from-cyan-600 to-cyan-800",desc:"Client-ready exports",status:"active"},{id:"files",label:"File Storage",icon:ae,color:"from-indigo-600 to-indigo-800",desc:"Plans, specs, photos",status:"active"},{id:"notify",label:"Notifications",icon:ie,color:"from-orange-600 to-orange-800",desc:"Multi-channel alerts",status:"beta"},{id:"workflow",label:"Workflow Automation",icon:he,color:"from-pink-600 to-pink-800",desc:"Approval chains, tasks",status:"active"},{id:"api",label:"API Integration",icon:v,color:"from-lime-600 to-lime-800",desc:"Webhooks, REST, SDK",status:"active"},{id:"audit",label:"Audit & Versioning",icon:re,color:"from-red-600 to-red-800",desc:"Immutable change log",status:"active"}],A=[{slug:"painting",label:"Painting",icon:"🎨",color:"from-rose-500 to-pink-600",path:"/trades",status:"active"},{slug:"flooring",label:"Flooring",icon:"🪵",color:"from-amber-500 to-orange-600",path:"/trades",status:"active"},{slug:"electrical",label:"Electrical",icon:"⚡",color:"from-yellow-500 to-amber-600",path:"/trades",status:"active"},{slug:"plumbing",label:"Plumbing",icon:"🔧",color:"from-blue-500 to-cyan-600",path:"/trades",status:"active"},{slug:"hvac",label:"HVAC",icon:"❄️",color:"from-sky-500 to-blue-600",path:"/trades",status:"active"},{slug:"drywall",label:"Drywall",icon:"🧱",color:"from-slate-500 to-slate-700",path:"/trades",status:"active"},{slug:"roofing",label:"Roofing",icon:"🏠",color:"from-stone-500 to-stone-700",path:"/trades",status:"beta"},{slug:"framing",label:"Framing",icon:"🔨",color:"from-brown-500 to-amber-800",path:"/trades",status:"beta"},{slug:"concrete",label:"Concrete",icon:"🏗️",color:"from-zinc-500 to-zinc-700",path:"/trades",status:"coming"},{slug:"insulation",label:"Insulation",icon:"🌡️",color:"from-teal-500 to-teal-700",path:"/trades",status:"coming"}],Ee=[{id:"gc",label:"General Contractor",icon:F,desc:"Multi-trade coordination, bid leveling, subcontractor management, proposals",path:"/gc",color:"from-blue-600 to-indigo-700",actions:["Bid Leveling","Trade Coordination","Proposals","Markup Control"]},{id:"estimator",label:"Estimator",icon:S,desc:"Full estimating workflows, trade engines, AI assistance, master estimates",path:"/estimates",color:"from-violet-600 to-purple-700",actions:["Trade Engines","AI Estimation","Master Estimates","Pricing Standards"]},{id:"homeowner",label:"Homeowner",icon:H,desc:"Plain-language costs, material guides, contractor vetting, budget planning",path:"/homeowner",color:"from-emerald-600 to-teal-700",actions:["Cost Breakdown","Material Guide","Budget Planner","Find Contractors"]},{id:"subcontractor",label:"Subcontractor",icon:X,desc:"Bid submission, scope review, project tracking, proposal acceptance",path:"/subcontractors",color:"from-amber-600 to-orange-700",actions:["Bid Packages","Project Scope","Subcontractor Portal","Schedule"]}],V=[{label:"Projects",path:"/projects",icon:j},{label:"Estimates",path:"/estimates",icon:S},{label:"Hub",path:"/hub/dashboard",icon:k},{label:"GC Portal",path:"/gc",icon:F},{label:"Homeowner",path:"/homeowner",icon:H},{label:"Architecture",path:"/architecture",icon:v}];function E({icon:o,label:e,value:s,sub:a,gradient:i}){return t.jsxs("div",{className:"bg-card border border-border rounded-2xl p-5 relative overflow-hidden",children:[t.jsx("div",{className:b("absolute top-0 right-0 w-24 h-24 rounded-full opacity-5 -translate-y-4 translate-x-4 bg-gradient-to-br",i)}),t.jsx("div",{className:b("w-10 h-10 rounded-xl bg-gradient-to-br flex items-center justify-center mb-3",i),children:t.jsx(o,{className:"w-5 h-5 text-white"})}),t.jsx("p",{className:"text-2xl font-bold",children:s}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:e}),a&&t.jsx("p",{className:"text-[10px] text-primary/70 mt-1 font-medium",children:a})]})}function _e({layer:o}){const e=o.icon;return t.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-xl bg-muted/30 hover:bg-muted/60 border border-border/50 hover:border-border transition-all cursor-default group",children:[t.jsx("div",{className:b("w-8 h-8 rounded-lg bg-gradient-to-br flex items-center justify-center shrink-0",o.color),children:t.jsx(e,{className:"w-3.5 h-3.5 text-white"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-xs font-semibold truncate",children:o.label}),t.jsx("p",{className:"text-[10px] text-muted-foreground truncate",children:o.desc})]}),t.jsx("span",{className:b("shrink-0 text-[9px] font-bold uppercase px-1.5 py-0.5 rounded-full",o.status==="active"?"bg-emerald-100 text-emerald-700":o.status==="beta"?"bg-purple-100 text-purple-700":"bg-muted text-muted-foreground"),children:o.status})]})}function Se({trade:o}){return t.jsxs(x,{to:o.path,className:"group flex items-center gap-2.5 p-2.5 rounded-xl border border-border hover:border-primary/40 hover:shadow-sm bg-card transition-all",children:[t.jsx("div",{className:b("w-9 h-9 rounded-lg bg-gradient-to-br flex items-center justify-center text-base",o.color),children:o.icon}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-xs font-semibold group-hover:text-primary transition-colors",children:o.label}),t.jsx("p",{className:b("text-[9px] font-bold uppercase",o.status==="active"?"text-emerald-600":o.status==="beta"?"text-purple-600":"text-muted-foreground"),children:o.status==="coming"?"Coming Soon":o.status})]})]})}function Pe({portal:o}){const e=o.icon;return t.jsx(x,{to:o.path,className:"group block",children:t.jsxs("div",{className:"bg-card border border-border rounded-2xl overflow-hidden hover:shadow-lg hover:border-primary/20 transition-all",children:[t.jsx("div",{className:b("h-1.5 bg-gradient-to-r",o.
6color)}),t.jsxs("div",{className:"p-5",children:[t.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[t.jsx("div",{className:b("w-10 h-10 rounded-xl bg-gradient-to-br flex items-center justify-center shrink-0",o.color),children:t.jsx(e,{className:"w-5 h-5 text-white"})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"font-bold text-sm group-hover:text-primary transition-colors",children:o.label}),t.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5 leading-relaxed",children:o.desc})]})]}),t.jsx("div",{className:"flex flex-wrap gap-1.5",children:o.actions.map(s=>t.jsx("span",{className:"text-[10px] bg-muted px-2 py-0.5 rounded-full font-medium text-muted-foreground",children:s},s))}),t.jsxs("div",{className:"mt-3 flex items-center gap-1 text-primary text-xs font-semibold opacity-0 group-hover:opacity-100 transition-opacity",children:["Enter Portal ",t.jsx(_,{className:"w-3.5 h-3.5"})]})]})]})})}function Ke(){var h,p;const o=Ne(),e=K(),[s,a]=N.useState(null),[i,r]=N.useState(!1),[l,m]=N.useState(!1),{data:c}=z({queryKey:["systemReport"],queryFn:()=>o.getSystemReport()}),{data:d,isLoading:g}=z({queryKey:["projects"],queryFn:()=>o.listProjects(6)});N.useEffect(()=>{o.getMe().then(a).catch(()=>{})},[o]);const u=l?w:w.slice(0,8);return t.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-blue-50/20 to-white flex flex-col",children:[t.jsxs("header",{className:"sticky top-0 z-50 bg-white/95 backdrop-blur-sm border-b border-border shadow-sm",children:[t.jsxs("div",{className:"max-w-screen-2xl mx-auto px-4 h-14 flex items-center gap-3",children:[t.jsxs(x,{to:"/",className:"flex items-center gap-2.5 font-bold shrink-0",children:[t.jsx("div",{className:"w-8 h-8 rounded-lg bg-gradient-to-br from-primary to-blue-700 flex items-center justify-center shadow-sm",children:t.jsx(O,{className:"w-4 h-4 text-white"})}),t.jsxs("div",{className:"hidden sm:block",children:[t.jsx("p",{className:"text-sm font-bold leading-none",children:"VegaEstimating.AI"}),t.jsx("p",{className:"text-[9px] text-muted-foreground leading-none mt-0.5 font-normal",children:"Modular Construction OS"})]})]}),t.jsx("nav",{className:"hidden lg:flex items-center gap-0.5 ml-4",children:V.map(n=>t.jsxs(x,{to:n.path,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-all",children:[t.jsx(n.icon,{className:"w-3.5 h-3.5"}),n.label]},n.path))}),t.jsx("div",{className:"flex-1"}),t.jsxs("div",{className:"hidden md:flex items-center gap-1.5 text-[10px] font-semibold bg-emerald-50 text-emerald-700 border border-emerald-200 px-3 py-1.5 rounded-full",children:[t.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse"}),"All Systems Operational"]}),s&&t.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5 rounded-lg bg-muted/50 text-xs",children:[t.jsx("div",{className:"w-6 h-6 rounded-full bg-primary text-primary-foreground flex items-center justify-center font-bold text-[10px]",children:((h=s.full_name)==null?void 0:h[0])||"?"}),t.jsx("span",{className:"hidden sm:block font-medium",children:(p=s.full_name)==null?void 0:p.split(" ")[0]})]}),t.jsx(x,{to:"/settings",children:t.jsx(f,{variant:"ghost",size:"sm",className:"hidden md:flex h-8 w-8 p-0",children:t.jsx(Y,{className:"w-4 h-4"})})}),t.jsx(f,{variant:"ghost",size:"sm",className:"lg:hidden",onClick:()=>r(!i),children:i?t.jsx(Z,{className:"w-4 h-4"}):t.jsx(J,{className:"w-4 h-4"})})]}),i&&t.jsx("div",{className:"lg:hidden border-t border-border bg-card px-4 py-3 grid grid-cols-2 gap-1",children:V.map(n=>t.jsxs(x,{to:n.path,className:"flex items-center gap-2 px-3 py-2.5 rounded-lg text-sm font-medium text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",onClick:()=>r(!1),children:[t.jsx(n.icon,{className:"w-4 h-4"}),n.label]},n.path))})]}),t.jsxs("main",{className:"flex-1 max-w-screen-2xl mx-auto w-full px-4 md:px-6 lg:px-8 py-6 lg:py-8 space-y-8",children:[t.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-br from-vega-nav
6y via-slate-800 to-blue-900 rounded-2xl p-6 md:p-8 lg:p-10 text-white",children:[t.jsxs("div",{className:"relative z-10 max-w-3xl",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-3 text-blue-300/80 text-xs font-semibold uppercase tracking-widest",children:[t.jsx(L,{className:"w-3.5 h-3.5"}),"Construction Estimating Operating System"]}),t.jsx("h1",{className:"text-3xl md:text-4xl font-extrabold leading-tight mb-3",children:"VegaEstimating.AI"}),t.jsx("p",{className:"text-white/75 text-sm md:text-base leading-relaxed max-w-2xl mb-6",children:"One unified platform. Every trade. Every user type. Shared projects, pricing, AI, and reporting — with independently deployable trade engines that plug into a single modular ecosystem."}),t.jsxs("div",{className:"flex flex-wrap gap-3",children:[t.jsxs(f,{className:"bg-primary hover:bg-primary/90 font-bold gap-2 h-10",onClick:()=>e("/projects"),children:[t.jsx(j,{className:"w-4 h-4"})," Open Projects"]}),t.jsxs(f,{variant:"outline",className:"bg-white/10 border-white/20 text-white hover:bg-white/20 gap-2 h-10",onClick:()=>e("/architecture"),children:[t.jsx(v,{className:"w-4 h-4"})," View Architecture"]}),t.jsxs(f,{variant:"outline",className:"bg-white/10 border-white/20 text-white hover:bg-white/20 gap-2 h-10",onClick:()=>e("/hub/dashboard"),children:[t.jsx(k,{className:"w-4 h-4"})," Vega Hub"]})]})]}),t.jsx("div",{className:"absolute inset-0 opacity-5",style:{backgroundImage:"linear-gradient(rgba(255,255,255,0.1) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.1) 1px, transparent 1px)",backgroundSize:"32px 32px"}}),t.jsx("div",{className:"absolute right-0 top-0 w-96 h-96 bg-primary/20 rounded-full blur-3xl -translate-y-1/2 translate-x-1/3"}),t.jsx("div",{className:"absolute right-32 bottom-0 w-64 h-64 bg-blue-400/10 rounded-full blur-2xl translate-y-1/2"})]}),t.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[t.jsx(E,{icon:j,label:"Active Projects",value:(c==null?void 0:c.projects)||0,gradient:"from-blue-500 to-blue-700",sub:"Across all trades"}),t.jsx(E,{icon:S,label:"Total Estimates",value:(c==null?void 0:c.estimates)||0,gradient:"from-violet-500 to-violet-700",sub:"All trade modules"}),t.jsx(E,{icon:k,label:"Trade Modules",value:`${A.filter(n=>n.status==="active").length} active`,gradient:"from-emerald-500 to-teal-700",sub:`${A.filter(n=>n.status!=="active").length} in pipeline`}),t.jsx(E,{icon:M,label:"Pipeline Value",value:c!=null&&c.totalValue?`$${(c.totalValue/1e6).toFixed(1)}M`:"$0",gradient:"from-amber-500 to-orange-700",sub:"Estimate total"})]}),t.jsxs("div",{className:"grid xl:grid-cols-3 gap-6",children:[t.jsxs("div",{className:"xl:col-span-2 space-y-6",children:[t.jsxs("section",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("h2",{className:"font-bold text-base flex items-center gap-2",children:[t.jsx(B,{className:"w-4 h-4 text-primary"})," User Portals"]}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"Role-based entry points"})]}),t.jsx("div",{className:"grid sm:grid-cols-2 gap-4",children:Ee.map(n=>t.jsx(Pe,{portal:n},n.id))})]}),t.jsxs("section",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("h2",{className:"font-bold text-base flex items-center gap-2",children:[t.jsx(de,{className:"w-4 h-4 text-primary"})," Trade Module Registry"]}),t.jsxs(x,{to:"/my-trades",className:"text-xs text-primary font-medium hover:underline flex items-center gap-1",children:["Manage ",t.jsx(me,{className:"w-3 h-3"})]})]}),t.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-5 gap-3",children:A.map(n=>t.jsx(Se,{trade:n},n.slug))}),t.jsxs("div",{className:"mt-3 flex items-center gap-2 text-xs text-muted-foreground p-3 bg-muted/30 rounded-xl border border-border/50",children:[t.jsx(ee,{className:"w-3.5 h-3.5 shrink-0"}),"All trade engines share authentication, projects, rooms, pricing standards, and reporting. Each is independently deployable and maintainable."]})]}),t.jsxs("section",{className:"bg-card border border-border rounded-2xl p-5",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsxs("h2",{className:"font-bold text-base flex items-center gap-2",children:[t.jsx(te,{className:"w-4 h-4 text-primary"})," Recent Projects"]}),t.jsxs(x,{to:"/projects",className:"text-xs text-primary font-medium hover:underline flex items-center gap-1",children:["All Projects ",t.jsx(_,{className:"w-3 h-3"})]})]}),g?t.jsx("div",{className:"space-y-2",children:[1,2,3].map(n=>t.jsx("div",{className:"h-10 bg-muted/50 rounded-lg animate-pulse"},n))}):d&&d.length>0?t.jsx("div",{className:"space-y-1",children:d.map(n=>{var y,I;return t.jsxs(x,{to:`/projects/${n.id}`,className:"flex items-center justify-between p-3 rounded-xl hover:bg-muted/50 transition-colors group",children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[t.jsx("div",{className:"w-7 h-7 rounded-lg bg-primary/10 text-primary flex items-center justify-center text-[10px] font-bold shrink-0",children:((y=n.name)==null?void 0:y[0])||"P"}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate group-hover:text-primary transition-colors",children:n.name}),t.jsx("p",{className:"text-[10px] text-muted-foreground",children:n.city?`${n.city}, ${n.state}`:n.project_type||"—"})]})]}),t.jsxs("div",{className:"flex items-center gap-2 ml-2 shrink-0",children:[n.total_estimate>0&&t.jsxs("span",{className:"text-xs font-bold text-emerald-600",children:["$",(n.total_estimate/1e3).toFixed(0),"K"]}),t.jsx("span",{className:b("text-[9px] font-bold uppercase px-1.5 py-0.5 rounded-full",n.status==="approved"?"bg-emerald-100 text-emerald-700":n.status==="in_progress"?"bg-blue-100 text-blue-700":n.status==="review"?"bg-amber-100 text-amber-700":"bg-muted text-muted-foreground"),children:((I=n.status)==null?void 0:I.replace(/_/g," "))||"draft"}),t.jsx(_,{className:"w-3.5 h-3.5 text-muted-foreground"})]})]},n.id)})}):t.jsxs("div",{className:"text-center py-8",children:[t.jsx(j,{className:"w-8 h-8 text-muted-foreground
6/40 mx-auto mb-2"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"No projects yet"}),t.jsxs(f,{size:"sm",className:"mt-3 h-8 text-xs gap-1.5",onClick:()=>e("/projects"),children:[t.jsx(j,{className:"w-3.5 h-3.5"})," Create First Project"]})]})]})]}),t.jsxs("div",{className:"space-y-5",children:[t.jsxs("section",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-3",children:[t.jsxs("h2",{className:"font-bold text-base flex items-center gap-2",children:[t.jsx(D,{className:"w-4 h-4 text-primary"})," Platform Layers"]}),t.jsxs("span",{className:"text-xs text-muted-foreground",children:[w.filter(n=>n.status==="active").length,"/",w.length," active"]})]}),t.jsxs("div",{className:"space-y-1.5",children:[u.map(n=>t.jsx(_e,{layer:n},n.id)),!l&&t.jsxs("button",{onClick:()=>m(!0),className:"w-full text-xs text-primary font-medium py-2 hover:bg-primary/5 rounded-xl transition-colors flex items-center justify-center gap-1",children:["Show ",w.length-8," more layers ",t.jsx(ne,{className:"w-3 h-3"})]})]})]}),t.jsxs("section",{className:"bg-card border border-border rounded-2xl p-4",children:[t.jsxs("h2",{className:"font-bold text-sm mb-3 flex items-center gap-2",children:[t.jsx(O,{className:"w-4 h-4 text-primary"})," Quick Actions"]}),t.jsx("div",{className:"space-y-1.5",children:[{label:"New Project",path:"/projects",icon:j,color:"text-blue-600"},{label:"Generate Estimate",path:"/estimates",icon:S,color:"text-violet-600"},{label:"Bid Leveling",path:"/bid-leveling",icon:oe,color:"text-amber-600"},{label:"Pricing Standards",path:"/pricing",icon:M,color:"text-emerald-600"},{label:"Proposals",path:"/proposals",icon:G,color:"text-cyan-600"},{label:"Subcontractors",path:"/subcontractors",icon:B,color:"text-rose-600"},{label:"System Architecture",path:"/architecture",icon:v,color:"text-slate-600"},{label:"Schema Viewer",path:"/database",icon:U,color:"text-indigo-600"}].map(n=>{const y=n.icon;return t.jsxs(x,{to:n.path,className:"flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-muted/60 transition-colors group",children:[t.jsx(y,{className:b("w-4 h-4 shrink-0",n.color)}),t.jsx("span",{className:"text-xs font-medium group-hover:text-primary transition-colors",children:n.label}),t.jsx(_,{className:"w-3 h-3 text-muted-foreground ml-auto opacity-0 group-hover:opacity-100 transition-opacity"})]},n.path)})})]}),t.jsxs("section",{className:"bg-gradient-to-br from-purple-50 to-violet-50 border border-purple-200/60 rounded-2xl p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx($,{className:"w-4 h-4 text-purple-600"}),t.jsx("h2",{className:"font-bold text-sm text-purple-900",children:"AI Orchestration"}),t.jsx("span",{className:"ml-auto text-[9px] font-bold uppercase bg-purple-100 text-purple-700 px-1.5 py-0.5 rounded-full",children:"Active"})]}),t.jsx("p",{className:"text-[11px] text-purple-700/80 leading-relaxed mb-3",children:"6 specialized trade agents orchestrated by VegaAI. Cross-trade validation, anomaly detection, and optimization running."}),t.jsx("div",{className:"space-y-1.5",children:["Painting Agent","Flooring Agent","HVAC Agent","Plumbing Agent","Electrical Agent","Drywall Agent"].map(n=>t.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-purple-800",children:[t.jsx(le,{className:"w-3 h-3 text-purple-500 shrink-0"}),n]},n))}),t.jsx(x,{to:"/ai",children:t.jsxs(f,{size:"sm",variant:"outline",className:"w-full mt-3 h-7 text-[11px] border-purple-300 text-purple-700 hover:bg-purple-100 gap-1.5",children:[t.jsx(L,{className:"w-3 h-3"})," AI Assistant"]})})]})]})]}),t.jsxs("div",{className:"bg-gradient-to-r from-slate-800 to-slate-900 rounded-2xl p-6 text-white flex flex-col md:flex-row items-start md:items-center gap-4",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx(v,{className:"w-4 h-4 text-primary"}),t.jsx("span",{className:"text-xs font-semibold text-primary uppercase tracking-wide",children:"System Architecture"})]}),t.jsx("p",{className:"font-bold text-lg",children:"One Ecosystem. Many Engines."}),t.jsx("p",{className:"text-white/60 text-sm mt-1 leading-relaxed",children:"All 14 platform layers are active. Trade engines share auth, projects, rooms, pricing, and reporting. Each engine is independently deployable and maintainable."})]}),t.jsxs("div",{className:"flex flex-wrap gap-3 shrink-0",children:[t.jsxs(f,{className:"bg-primary hover:bg-primary/90 gap-2 text-sm h-9",onClick:()=>e("/architecture"),children:[t.jsx(v,{className:"w-4 h-4"})," Architecture Docs"]}),t.jsxs(f,{variant:"outline",className:"bg-white/10 border-white/20 text-white hover:bg-white/20 gap-2 text-sm h-9",onClick:()=>e("/system"),children:[t.jsx(D,{className:"w-4 h-4"})," System Dashboard"]})]})]})]})]})}export{Ke 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.