import{j as s,r as x}from"./vendor-react-wBh_31cN.js";import{B as c}from"./badge-UCnweWGd.js";import{u as j}from"./index-CT6Pb5Ny.js";import{a as g}from"./useProjectId-DeuaOE3U.js";import{c as h}from"./vendor-router-D1GqFWiT.js";import{cQ as f,R as m,aq as y,cg as v}from"./index-dNe6i2rS.js";import{C as l}from"./code-BwgxKro-.js";import{C as T}from"./code-input-W_9wcAaJ.js";import{V as d}from"./value-7N0Keti9.js";import{D as N}from"./data-table-Mt0DWBPO.js";import{T as b}from"./TagsEdit-BoqIfo85.js";const L=({features:e,isFetching:r})=>s.jsxs(c,{variant:"outline",children:[s.jsx("span",{className:"text-muted-foreground mr-1",children:"features"}),s.jsx("span",{children:r?"…":(e==null?void 0:e.length)??"0"})]}),K=({fvName:e,fvVersion:r,parentProjectId:t,featurestoreId:n})=>{const{fsId:i}=h(),{pId:a,skip:u}=g(t),{currentData:o,isFetching:p}=j({id:e,version:+r,pId:a,fsId:+i||n},{skip:u});return s.jsxs(c,{variant:"outline",children:[s.jsx("span",{className:"text-muted-foreground mr-1",children:"training data"}),p?"…":(o==null?void 0:o.count)??"0"]})},D=e=>x.useMemo(()=>Object.entries(e).map(([r,t])=>({key:r,value:t,isObject:f(t)==="Object"})),[e]),O=[{accessorKey:"key",header:"Property",cell:({row:e})=>s.jsx(d,{children:e.original.key})},{accessorKey:"value",header:"Value",cell:({row:e})=>e.original.isObject?s.jsx(T,{mode:"json",readOnly:!0,value:JSON.stringify(e.original.value,null,2),height:"auto",maxHeight:"200px"}):s.jsx(m,{gray:!0,children:JSON.stringify(e.original.value,null,2)})}],I=({tag:{tags:e,name:r,hasAdditionalRules:t,hasNestedTypes:n}})=>{const i=D(e);let a;return typeof e=="string"?a=s.jsx(l,{content:e,language:"json",copyButton:!0}):t||n?a=s.jsx(l,{content:JSON.stringify(e,null,2),language:"json",copyButton:!0}):a=s.jsx(N,{columns:O,data:i,emptyMessage:"No properties"}),s.jsxs("div",{className:"mb-4",children:[s.jsx("div",{className:"mb-1.5",children:s.jsx(d,{primary:!0,children:r})}),a]})},Q=({tags:e,isFetching:r,mode:t="view",setMode:n,tdVersion:i})=>r?s.jsx("div",{className:"relative h-[55px] w-full",children:s.jsx(y,{})}):t==="add"?s.jsx(b,{type:v.td,tags:e??[],onDone:()=>n==null?void 0:n("view"),tdVersion:i}):e!=null&&e.length?s.jsx("div",{className:"flex w-full flex-col",children:e.map(a=>s.jsx(I,{tag:a},a.name))}):s.jsx(m,{gray:!0,children:"No tag schemas attached"});export{L as F,Q as T,K as a};
