var Z=Object.defineProperty;var N=(z)=>z;function m(z,A){this[z]=N.bind(null,A)}var i=(z,A)=>{for(var L in A)Z(z,L,{get:A[L],enumerable:!0,configurable:!0,set:m.bind(A,L)})};var V=(z,A)=>()=>(z&&(A=z(z=0)),A);import{defaultDocRegistry as n}from"@contractspec/lib.contracts-spec/docs";import{useMemo as D}from"react";function Y(z,A){return D(()=>{try{return n.list().filter(({block:I})=>{let G=I.id.toLowerCase().includes(z.toLowerCase())||I.title.toLowerCase().includes(z.toLowerCase()),X=A?.some((J)=>I.tags?.some((v)=>v.toLowerCase().includes(J.toLowerCase())));return G||X}).map(({block:I,route:G})=>({id:I.id,title:I.title,summary:I.summary,route:G}))}catch(F){return console.error("Failed to fetch related docs:",F),[]}},[z,A])}import{Breadcrumbs as _,CodeBlock as U,EmptyState as H,PageHeaderResponsive as $,StatusChip as T}from"@contractspec/lib.design-system";import{Card as w}from"@contractspec/lib.ui-kit-web/ui/card";import{Box as E,HStack as W,VStack as Q}from"@contractspec/lib.ui-kit-web/ui/stack";import{cn as M}from"@contractspec/lib.ui-kit-web/ui/utils";import{Code as K,Database as g,Zap as P}from"lucide-react";import{jsx as O,jsxs as q}from"react/jsx-runtime";function f({feature:z,operationKey:A,operation:L,spec:F,className:I}){let G=L??z.operations?.find((J)=>J.key===A),X=Y(G?.key||"",F?.meta?.tags);if(!G)return q(Q,{gap:"lg",className:M("mx-auto w-full max-w-5xl p-6",I),children:[O($,{title:"Operation Not Found",subtitle:`Operation ${A} not found in feature ${z.meta.key}`,breadcrumb:O(_,{items:[{label:"Features",href:"/features"},{label:z.meta.title||z.meta.key,href:`/features/${z.meta.key}`},{label:"Operations"}]})}),O(H,{title:"Operation not found",description:`The operation '${A}' could not be found in this feature.`,icon:O(P,{className:"h-12 w-12 text-muted-foreground"})})]});return q(Q,{gap:"lg",className:M("mx-auto w-full max-w-5xl p-6",I),children:[O($,{title:G.key,subtitle:`Operation defined in ${z.meta.title??z.meta.key}`,breadcrumb:O(_,{items:[{label:"Features",href:"/features"},{label:z.meta.title||z.meta.key,href:`/features/${z.meta.key}`},{label:"Operations",href:`/features/${z.meta.key}/operations`},{label:G.key}]})}),q(W,{gap:"sm",children:[O(T,{tone:"neutral",label:G.key,size:"sm",icon:O(P,{className:"h-3 w-3"})}),O(T,{tone:"neutral",label:`v${G.version}`,size:"sm"}),F?.meta?.stability?O(T,{tone:F.meta.stability==="stable"?"success":"warning",label:F.meta.stability,size:"sm"}):null]}),q("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-3",children:[O("div",{className:"space-y-6 lg:col-span-2",children:O(w,{className:"p-6",children:q(Q,{gap:"md",children:[q(W,{className:"items-center gap-2 border-b pb-2",children:[O(K,{className:"h-5 w-5 text-muted-foreground"}),O("h3",{className:"font-semibold text-lg",children:"Schema Definition"})]}),F?q(Q,{gap:"lg",children:[F.meta.description&&O("p",{className:"text-muted-foreground",children:F.meta.description}),q(E,{className:"flex-col gap-2",children:[O("span",{className:"font-medium text-muted-foreground text-sm uppercase tracking-wider",children:"Input Schema"}),O(U,{className:"w-full",code:JSON.stringify(F.io.input,null,2),language:"json"})]}),q(E,{className:"flex-col gap-2",children:[O("span",{className:"font-medium text-muted-foreground text-sm uppercase tracking-wider",children:"Output Schema"}),O(U,{className:"w-full",code:JSON.stringify(F.io.output,null,2),language:"json"})]})]}):q(Q,{gap:"md",children:[O("p",{className:"text-muted-foreground",children:"Full schema details are not available for this operation reference."}),O(U,{code:JSON.stringify(G,null,2),language:"json"})]})]})})}),O("div",{className:"space-y-6",children:O(w,{className:"p-6",children:q(Q,{gap:"md",children:[q(W,{className:"items-center gap-2 border-b pb-2",children:[O(g,{className:"h-5 w-5 text-muted-foreground"}),O("h3",{className:"font-semibold text-lg",children:"Metadata"})]}),q("dl",{className:"grid grid-cols-1 gap-4 text-sm",children:[q("div",{children:[O("dt",{className:"text-muted-foreground",children:"Key"}),O("dd",{className:"truncate font-medium",children:G.key})]}),q("div",{children:[O("dt",{className:"text-muted-foreground",children:"Version"}),O("dd",{className:"font-medium",children:G.version})]}),F?.meta?.context&&q("div",{children:[O("dt",{className:"text-muted-foreground",children:"Context"}),O("dd",{className:"font-medium",children:F.meta.context})]}),F?.meta?.owners&&q("div",{children:[O("dt",{className:"text-muted-foreground",children:"Owners"}),O("dd",{className:"flex flex-wrap gap-1 font-medium",children:F.meta.owners.map((J)=>O(T,{label:J,size:"sm",tone:"neutral"},J))})]}),F?.meta?.tags&&q("div",{children:[O("dt",{className:"text-muted-foreground",children:"Tags"}),O("dd",{className:"flex flex-wrap gap-1 font-medium",children:F.meta.tags.map((J)=>O(T,{label:`#${J}`,size:"sm",tone:"neutral"},J))})]})]})]})})})]})]})}export{f as FeatureOperationDetailTemplate};
