PageSourceSearch

https://smartmanageai.ai/assets/knowledge-engine-DE6pauTP.js

js smartmanageai.ai collected 2026-10-05 15:06:37 UTC 13,784 bytes, 3 lines download raw bytes

1import{r as o,j as e}from"./vendor-react-DKbe1Umz.js";import{u as F,a as G}from"./vendor-data-CjSe2wkl.js";import{y as J,u as K,B as f,A as V,E as _,F as P,G as R,I as Q,C as O,s as k,t as T,w as L,v as I,q as H,o as $,bd as X,be as Y,l as g,bf as ee,D as se,c as te,d as ae,e as ne,L as y,T as ie,n as re}from"./index-DZ74KeH3.js";import{T as le,a as oe,b as q,c as b,d as ce,e as C}from"./table-CAeITjOT.js";import{bH as de,b3 as me,cE as W,b7 as A,a8 as xe,Z as ue,n as he,ay as pe,bi as Z,cZ as je,F as z,d5 as ge,bb as ve,J as Ne}from"./vendor-ui-DMaW9-Ov.js";import"./vendor-charts-DWX9qznF.js";import"./vendor-dates-5UNeOyFW.js";import"./vendor-forms-C2vWC2ab.js";function fe({risk:s}){const t={high:"destructive",medium:"secondary",low:"outline"};return e.jsx(g,{variant:t[s],className:"text-[10px] uppercase",children:s})}function c({icon:s,title:t,children:a}){return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h4",{className:"text-sm font-semibold flex items-center gap-1.5 text-foreground",children:[e.jsx(s,{className:"h-3.5 w-3.5 text-primary"}),t]}),a]})}function ye({div:s}){return e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 pt-4",children:[s.scopeDescription&&e.jsx("div",{className:"md:col-span-2",children:e.jsx(c,{icon:z,title:"Scope Description",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:s.scopeDescription})})}),s.workStyles&&s.workStyles.length>0&&e.jsx(c,{icon:W,title:"Work Styles",children:e.jsx("div",{className:"flex flex-wrap gap-1",children:s.workStyles.map(t=>e.jsx(g,{variant:"secondary",className:"text-[11px]",children:t},t))})}),e.jsx(c,{icon:A,title:"Units of Measure",children:e.jsxs("div",{className:"space-y-1 text-sm",children:[s.primaryUnits&&s.primaryUnits.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground mr-1",children:"Primary:"}),e.jsx("span",{className:"font-mono",children:s.primaryUnits.join(", ")})]}),s.secondaryUnits&&s.secondaryUnits.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground mr-1",children:"Secondary:"}),e.jsx("span",{className:"font-mono",children:s.secondaryUnits.join(", ")})]})]})}),s.materials&&s.materials.length>0&&e.jsx(c,{icon:ge,title:`Materials (${s.materials.length})`,children:e.jsx("ul",{className:"text-sm space-y-1",children:s.materials.map((t,a)=>e.jsxs("li",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium",children:t.name}),t.notes&&e.jsx("span",{className:"text-muted-foreground text-xs",children:t.notes}),t.commonSizes&&e.jsxs("span",{className:"text-muted-foreground text-xs",children:["Sizes: ",t.commonSizes]})]},a))})}),s.equipment&&s.equipment.length>0&&e.jsx(c,{icon:ve,title:`Equipment (${s.equipment.length})`,children:e.jsx("ul",{className:"text-sm space-y-1",children:s.equipment.map((t,a)=>e.jsxs("li",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium",children:t.name}),t.notes&&e.jsx("span",{className:"text-muted-foreground text-xs",children:t.notes})]},a))})}),s.sourceDocuments&&s.sourceDocuments.length>0&&e.jsx(c,{icon:z,title:"Source Documents",children:e.jsx("ul",{className:"text-sm space-y-1",children:s.sourceDocuments.map((t,a)=>e.jsxs("li",{children:[e.jsx(g,{variant:"outline",className:"text-[10px] mr-1.5",children:t.type}),t.description]},a))})}),s.derivedQuantities&&s.derivedQuantities.length>0&&e.jsx("div",{className:"md:col-span-2",children:e.jsx(c,{icon:A,title:"Derived Quantity Formulas",children:e.jsx("div",{className:"space-y-3",children:s.derivedQuantities.map((t,a)=>e.jsxs("div",{className:"rounded-md border p-3 text-sm space-y-1",children:[e.jsx("div",{className:"font-medium",children:t.name}),e.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded block",children:t.formula}),e.jsxs("div",{className:"text-muted-foreground text-xs",children:["Inputs: ",e.jsx("span",{className:"font-mono",children:t.inputs.join(", ")})," → ",e.jsx("span",{className:"font-mono",children:t.outputUnit})]}),t.notes&&e.jsx("div",{className:"text-muted-foreground text-xs",children:t.notes})]},a))})})}),s.seamsAndGaps&&s.seamsAndGaps.length>0&&e.jsx("div",{className:"md:col-span-2",children:e.jsx(c,{icon:Ne,title:"Scope Seams & Gaps",children:e.jsx("div",{className:"space-y-2",children:s.seamsAndGaps.map((t,a)=>e.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[e.jsx(fe,{risk:t.risk}),e.jsx("span",{className:"text-muted-foreground",children:t.description})]},a))})})}),s.agentQuestions&&s.agentQuestions.length>0&&e.jsx("div",{className:"md:col-span-2",children:e.jsx(c,{icon:Z,title:"Agent Must-Ask Questions",children:e.jsx("ol",{className:"text-sm space-y-2 list-decimal list-inside",children:s.agentQuestions.map((t,a)=>e.jsxs("li",{className:"text-muted-foreground",children:[t.question,t.triggerCondition&&e.jsxs("span",{className:"ml-2 text-xs text-amber-600",children:["(",t.triggerCondition,")"]})]},a))})})})]})}function B({div:s,onDeleteOverride:t}){const[a,l]=o.useState(!1),i=!!s.orgId;return e.jsxs(X,{open:a,onOpenChange:l,children:[e.jsx(Y,{asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-md hover:bg-muted/50 cursor-pointer border border-transparent hover:border-border transition-colors",children:[a?e.jsx(ue,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):e.jsx(he,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsx("code",{className:"text-xs font-mono bg-muted px-1.5 py-0.5 rounded w-32 shrink-0",children:s.code}),e.jsx("span",{className:"font-medium text-sm flex-1 truncate",children:s.label}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s.calculateLate&&e.jsxs(g,{variant:"outline",className:"text-[10px] gap-0.5 text-amber-700 border-amber-300",children:[e.jsx(pe,{className:"h-2.5 w-2.5"})," Calculate Late"]}),i&&e.jsx(g,{variant:"secondary",className:"text-[10px]",children:"Org Override"}),s.agentQuestions&&s.agentQuestions.length>0&&e.jsxs(g,{variant:"outline",className:"text-[10px] gap-0.5",children:[e.jsx(Z,{className:"h-2.5 w-2.5"})," ",s.agentQuestions.length,"Q"]})]}),i&&t&&e.jsx(f,{size:"icon",variant:"ghost",className:"h-6 w-6 shrink-0 text-destructive hover:bg-destructive/10",onClick:u=>{u.stopPropagation(),t(s.id)},title:"Delete org override",children:e.jsx(je,{className:"h-3 w-3"})})]})}),e.jsx(ee,{children:e.jsx("div",{className:"px-10 pb-4",children:e.jsx(ye,{div:s})})})]})}function be({open:s,onClose:t}){const{toast:a}
1=K(),[l,i]=o.useState(""),[u,w]=o.useState("CSI"),[h,p]=o.useState(""),[v,N]=o.useState(""),d=G({mutationFn:async r=>(await $("PUT","/api/construction-knowledge/divisions/override",r)).json(),onSuccess:()=>{H.invalidateQueries({queryKey:["/api/construction-knowledge/divisions"]}),a({title:"Override created",description:"Org-level knowledge override saved."}),t(),i(""),p(""),N("")},onError:r=>{a({variant:"destructive",title:"Save failed",description:r.message})}}),m=()=>{const r=v.split(`
2`).filter(Boolean).map(j=>({question:j.trim()}));d.mutate({code:l,regime:u,label:h,agentQuestions:r.length?r:void 0})};return e.jsx(se,{open:s,onOpenChange:r=>!r&&t(),children:e.jsxs(te,{className:"max-w-lg",children:[e.jsx(ae,{children:e.jsx(ne,{children:"Create Org Knowledge Override"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(y,{children:"Division Code"}),e.jsx(Q,{value:l,onChange:r=>i(r.target.value),placeholder:"03 30 00"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(y,{children:"Regime"}),e.jsxs("select",{value:u,onChange:r=>w(r.target.value),className:"w-full border rounded-md px-3 py-2 text-sm bg-background",children:[e.jsx("option",{value:"CSI",children:"CSI"}),e.jsx("option",{value:"ODOT",children:"ODOT"}),e.jsx("option",{value:"MFG",children:"MFG"})]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(y,{children:"Label"}),e.jsx(Q,{value:h,onChange:r=>p(r.target.value),placeholder:"Cast-in-Place Concrete"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(y,{children:"Must-Ask Questions (one per line)"}),e.jsx(ie,{value:v,onChange:r=>N(r.target.value),placeholder:`What is the specified concrete PSI?
3Is rebar included in this scope?`,rows:5})]})]}),e.jsxs(re,{children:[e.jsx(f,{variant:"outline",onClick:t,children:"Cancel"}),e.jsx(f,{onClick:m,disabled:!l||!h||d.isPending,children:d.isPending?"Saving…":"Save Override"})]})]})})}function Ce({units:s}){const t=o.useMemo(()=>{const a=new Map;for(const l of s){const i=a.get(l.dimension)??[];i.push(l),a.set(l.dimension,i)}return a},[s]);return e.jsx("div",{className:"space-y-6",children:Array.from(t.entries()).map(([a,l])=>e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-muted-foreground mb-2 capitalize",children:a}),e.jsxs(le,{children:[e.jsx(oe,{children:e.jsxs(q,{children:[e.jsx(b,{className:"w-20",children:"Code"}),e.jsx(b,{children:"Label"}),e.jsx(b,{children:"SI Conversion"}),e.jsx(b,{children:"Notes"})]})}),e.jsx(ce,{children:l.map(i=>e.jsxs(q,{children:[e.jsx(C,{children:e.jsx("code",{className:"font-mono text-xs bg-muted px-1 py-0.5 rounded",children:i.code})}),e.jsx(C,{className:"text-sm",children:i.label}),e.jsx(C,{className:"text-sm text-muted-foreground",children:i.siConversionFactor!=null?`1 ${i.code} = ${i.siConversionFactor} ${i.siConversionUnit??""}`:"—"}),e.jsx(C,{className:"text-xs text-muted-foreground",children:i.notes??"—"})]},i.code))})]})]},a))})}function Qe(){var M,U,E;const{user:s}=J(),{toast:t}=K(),[a,l]=o.useState(""),[i,u]=o.useState("ALL"),[w,h]=o.useState(!1),p=F({queryKey:["/api/construction-knowledge/units"]}),v=F({queryKey:["/api/construction-knowledge/divisions"]}),N=G({mutationFn:async n=>(await $("DELETE",`/api/construction-knowledge/divisions/override/${n}`)).json(),onSuccess:()=>{H.invalidateQueries({queryKey:["/api/construction-knowledge/divisions"]}),t({title:"Override deleted",description:"Division reverted to platform defaults."})},onError:n=>{t({variant:"destructive",title:"Delete failed",description:n.message})}}),d=(s==null?void 0:s.role)==="ADMIN"||(s==null?void 0:s.role)==="SUPER_ADMIN",m=((M=v.data)==null?void 0:M.divisions)??[],r=o.useMemo(()=>m.filter(n=>{var x;if(i!=="ALL"&&n.regime!==i)return!1;if(a){const S=a.toLowerCase();return n.code.toLowerCase().includes(S)||n.label.toLowerCase().includes(S)||(((x=n.scopeDescription)==null?void 0:x.toLowerCase().includes(S))??!1)}return!0}),[m,i,a]),j=r.filter(n=>n.regime==="CSI"),D=r.filter(n=>n.regime==="ODOT");return e.jsxs("div",{className:"p-6 space-y-6 max-w-7xl mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[e.jsx(de,{className:"h-6 w-6 text-primary"}),"Construction Knowledge Engine"]}),e.jsxs("p",{className:"text-muted-foreground text-sm mt-1",children:["Part D — structured nine-field knowledge base for AI estimator division intelligence.",m.length>0&&e.jsxs("span",{className:"ml-2 text-xs",children:[m.filter(n=>n.orgId===null).length," built-in divisions ·"," ",m.filter(n=>n.orgId!==null).length," org overrides"]})]})]}),d&&e.jsxs(f,{onClick:()=>h(!0),size:"sm",children:[e.jsx(me,{className:"h-4 w-4 mr-1.5"})," Customize Division"]})]}),e.jsxs(V,{defaultValue:"divisions",children:[e.jsxs(_,{children:[e.jsxs(P,{value:"divisions",children:[e.jsx(W,{className:"h-4 w-4 mr-1.5"})," Divisions"]}),e.jsxs(P,{value:"units",children:[e.jsx(A,{className:"h-4 w-4 mr-1.5"})," Unit Dictionary"]})]}
3),e.jsxs(R,{value:"divisions",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsxs("div",{className:"relative flex-1 min-w-48",children:[e.jsx(xe,{className:"absolute left-3 top-2.5 h-4 w-4 text-muted-foreground pointer-events-none"}),e.jsx(Q,{placeholder:"Search by code or name…",value:a,onChange:n=>l(n.target.value),className:"pl-9"})]}),e.jsx("div",{className:"flex gap-1",children:["ALL","CSI","ODOT"].map(n=>e.jsx(f,{variant:i===n?"default":"outline",size:"sm",onClick:()=>u(n),children:n},n))})]}),v.isLoading?e.jsx("div",{className:"text-center py-12 text-muted-foreground text-sm",children:"Loading knowledge base…"}):r.length===0?e.jsx("div",{className:"text-center py-12 text-muted-foreground text-sm",children:"No divisions match your search."}):e.jsxs("div",{className:"space-y-8",children:[(i==="ALL"||i==="CSI")&&j.length>0&&e.jsxs(O,{children:[e.jsxs(k,{className:"pb-3",children:[e.jsxs(T,{className:"text-base",children:["CSI Masterformat Divisions (",j.length,")"]}),e.jsx(L,{children:"MasterFormat 2020 division structure"})]}),e.jsx(I,{className:"space-y-1 pt-0",children:j.map(n=>e.jsx(B,{div:n,onDeleteOverride:d?x=>N.mutate(x):void 0},n.id))})]}),(i==="ALL"||i==="ODOT")&&D.length>0&&e.jsxs(O,{children:[e.jsxs(k,{className:"pb-3",children:[e.jsxs(T,{className:"text-base",children:["ODOT Item Codes (",D.length,")"]}),e.jsx(L,{children:"Ohio DOT Construction & Material Specifications pay items"})]}),e.jsx(I,{className:"space-y-1 pt-0",children:D.map(n=>e.jsx(B,{div:n,onDeleteOverride:d?x=>N.mutate(x):void 0},n.id))})]})]})]}),e.jsx(R,{value:"units",className:"mt-4",children:e.jsxs(O,{children:[e.jsxs(k,{children:[e.jsx(T,{className:"text-base",children:"Universal Unit Dictionary"}),e.jsxs(L,{children:["Part D unit system — ",((U=p.data)==null?void 0:U.units.length)??0," codes covering all CSI and ODOT regimes."]})]}),e.jsx(I,{children:p.isLoading?e.jsx("div",{className:"text-center py-8 text-muted-foreground text-sm",children:"Loading…"}):e.jsx(Ce,{units:((E=p.data)==null?void 0:E.units)??[]})})]})})]}),e.jsx(be,{open:w,onClose:()=>h(!1)})]})}export{Qe 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.