1import{ae as C,r as i,g as x,j as e,C as S,x as T,I as y,ap as w,cz as _,am as c}from"./index-Ch9yA5uW.js";import{P as b}from"./PageHeader-BabG749J.js";import{E as k}from"./EmptyState-DufBUen1.js";import{T as E}from"./TasksModuleNav-CUo4SYvh.js";import{T as L,a as B,b as h,c as t,d as I,e as a}from"./table-CRYU_QgS.js";import"./layers-ISd83ovk.js";import"./layout-grid-CBYYPlQr.js";import"./calendar-days-CH5u3w5H.js";import"./award-D1AZC0ET.js";import"./timer-CeQ4ZTdy.js";import"./repeat-qm1_-ZJv.js";function G(){const{workspaceId:o}=C(),[d,j]=i.useState([]),[f,g]=i.useState({}),[N,p]=i.useState(!0),[l,v]=i.useState("");i.useEffect(()=>{o&&(async()=>{p(!0);const[s,n]=await Promise.all([x.from("task_blueprints").select("*").eq("workspace_id",o).order("category").order("name"),x.from("task_blueprint_steps").select("blueprint_id")]);j(s.data??[]);const r={};(n.data??[]).forEach(u=>{r[u.blueprint_id]=(r[u.blueprint_id]??0)+1}),g(r),p(!1)})()},[o]);const m=i.useMemo(()=>d.filter(s=>{var n,r;return!l||((n=s.name)==null?void 0:n.toLowerCase().includes(l.toLowerCase()))||((r=s.code)==null?void 0:r.toLowerCase().includes(l.toLowerCase()))}),[d,l]);return e.jsxs("div",{className:"space-y-4",children:[e.jsx(E,{}),e.jsx(b,{title:"Task Blueprints",description:"Reusable templates with checklist steps and downstream chains"}),e.jsx(S,{children:e.jsxs(T,{className:"pt-4 space-y-3",children:[e.jsx(y,{placeholder:"Search blueprints...",value:l,onChange:s=>v(s.target.value),className:"max-w-sm"}),N?e.jsx(w,{className:"h-64 w-full"}):m.length===0?e.jsx(k,{icon:_,title:"No blueprints",description:"Seed the default 24-blueprint library from Settings â Service Templates."}):e.jsxs(L,{children:[e.jsx(B,{children:e.jsxs(h,{children:[e.jsx(t,{children:"Code"}),e.jsx(t,{children:"Name"}),e.jsx(t,{children:"Category"}),e.jsx(t,{children:"Source"}),e.jsx(t,{className:"text-right",children:"Steps"}),e.jsx(t,{className:"text-right",children:"Default offset (days)"}),e.jsx(t,{className:"text-right",children:"Target hrs"}),e.jsx(t,{children:"Active"})]})}),e.jsx(I,{children:m.map(s=>e.jsxs(h,{children:[e.jsx(a,{className:"font-mono text-xs",children:s.code}),e.jsx(a,{className:"font-medium",children:s.name}),e.jsx(a,{children:e.jsx(c,{variant:"outline",children:s.category??"â"})}),e.jsx(a,{children:e.jsx(c,{variant:"secondary",children:s.source_type??"â"})}),e.jsx(a,{className:"text-right",children:f[s.id]??0}),e.jsx(a,{className:"text-right",children:s.default_due_offset_days??"â"}),e.jsx(a,{className:"text-right",children:s.target_hours??"â"}),e.jsx(a,{children:s.is_active?e.jsx(c,{children:"Active"}):e.jsx(c,{variant:"outline",children:"Inactive"})})]},s.id))})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Editing UI lives in Service Templates settings. This page is a read-only catalogue and audit view."})]})})]})}export{G 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.