PageSourceSearch

https://app.linedat.com/assets/DatasetCardsPage-CKigSOX8.js

js linedat.com collected 2026-10-07 21:25:17 UTC 51,232 bytes, 2 lines download raw bytes

1import{g as e,r as b,ap as D}from"./vendor-CHCeBm6R.js";import{u as qe,ar as A,B as C,S as Q,Y as g,I as w,K as Z,g as k,b as Re,ap as Me}from"./index-7iGGmx-N.js";import{b as Be,u as E,c as W}from"./vendor-data-DR7EPs97.js";import{P as Ve}from"./PlanFeaturePreview-UWG-RaHR.js";import{u as j}from"./vendor-i18n-C_D1kBm4.js";import{D as xe,q as ee,R as ze,X as L,L as O,aM as H,a9 as se,as as Oe,T as P,bw as ue}from"./vendor-icons-hMpdOQ4k.js";import"./vendor-markdown-BoPFqCCm.js";import"./vendor-descope-Cq-J52pI.js";import"./vendor-router-DqIx2F52.js";import"./vendor-radix-CxcqRzm9.js";import"./vendor-motion-dNKNWz8u.js";const J={draft:["published"],published:["needs_update","draft"],needs_update:["published","draft"]},He={draft:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300",published:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300",needs_update:"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300"},Qe=["draft","published","needs_update"],te=["rag_grounding","knowledge_base","fine_tuning","evaluation","training","other"],Ue=["rag_grounding","knowledge_base"];function X(s,d){var l,a;const t=s,r=(a=(l=t==null?void 0:t.response)==null?void 0:l.data)==null?void 0:a.detail;return typeof r=="string"?r:Array.isArray(r)?r.map(o=>{const x=o,p=Array.isArray(x.loc)?x.loc[x.loc.length-1]:"";return p?`${String(p)}: ${x.msg??""}`:x.msg??""}).filter(Boolean).join("; "):(t==null?void 0:t.message)??d}function me(s){var t;const d=s;return(t=d==null?void 0:d.response)==null?void 0:t.status}function pe(s){const d={};for(const t of Object.keys(s)){const r=s[t];r!==""&&r!==void 0&&r!==null&&(d[t]=r)}return d}const he=s=>s==null||typeof s=="string"&&s.trim()==="";function be(s){const d={...s},t=r=>Array.isArray(d[r])?d[r]:[];return d.coverage_bias=t("coverage_bias").filter(r=>!he(r.dimension)&&!he(r.excluded_or_underrepresented)),d}function fe({status:s,label:d}){return e.jsx("span",{className:k("inline-flex items-center px-2 py-0.5 rounded text-xs font-medium",He[s]),children:d})}function Ke({selectedIds:s,onChange:d,disabled:t}){const{t:r}=j(),[l,a]=b.useState(!1),[o,x]=b.useState(""),p=b.useRef(null),m=b.useRef(null),{data:h,isLoading:v}=E({queryKey:["assets","list",{search:o,page_size:50}],queryFn:()=>Re.list({search:o||void 0,page_size:50}),staleTime:3e4});b.useEffect(()=>{const c=i=>{p.current&&!p.current.contains(i.target)&&(a(!1),x(""))};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[]),b.useEffect(()=>{l&&m.current&&m.current.focus()},[l]);const N=(h==null?void 0:h.items)??[],y=c=>{s.includes(c)?d(s.filter(i=>i!==c)):d([...s,c])},u=N.filter(c=>s.includes(c.id));return e.jsxs("div",{ref:p,className:"relative",children:[e.jsx("button",{type:"button",disabled:t,onClick:()=>!t&&a(c=>!c),className:k("flex items-center justify-between w-full min-h-[36px] px-3 py-1.5 border border-border rounded-md bg-background text-sm text-left","hover:bg-accent/40 transition-colors focus:outline-none focus:ring-2 focus:ring-ring",t&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-ring"),children:v?e.jsx("span",{className:"text-muted-foreground text-xs",children:e.jsx(O,{className:"inline h-3 w-3 animate-spin mr-1"})}):s.length>0?e.jsxs("span",{className:"text-xs text-muted-foreground",children:[r("datasetCards.assetCount"),": ",e.jsx("span",{className:"font-semibold text-foreground",children:s.length})]}):e.jsx("span",{className:"text-muted-foreground text-sm",children:r("datasetCards.searchAssets")})}),u.length>0&&!l&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:u.map(c=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs bg-muted/60 border border-border",children:[c.name,!t&&e.jsx("button",{type:"button",onClick:()=>y(c.id),className:"ml-0.5 hover:text-destructive",children:e.jsx(L,{className:"h-2.5 w-2.5"})})]},c.id))}),l&&e.jsxs("div",{className:"absolute z-50 mt-1 w-full rounded-md border border-border bg-card shadow-lg",children:[e.jsx("div",{className:"p-2 border-b border-border",children:e.jsx(w,{ref:m,className:"h-7 text-xs",placeholder:r("datasetCards.searchAssets"),value:o,onChange:c=>x(c.target.value)})}),e.jsx("div",{className:"max-h-48 overflow-y-auto",children:N.length===0?e.jsx("p",{className:"text-xs text-muted-foreground px-3 py-2",children:r("datasetCards.noAssetsFound")}):N.map(c=>{const i=s.includes(c.id);return e.jsxs("button",{type:"button",className:k("w-full text-left px-3 py-2 text-xs hover:bg-muted/50 transition-colors flex items-center justify-between",i&&"bg-primary/5 font-medium"),onClick:()=>y(c.id),children:[e.jsx("span",{children:c.name}),i&&e.jsx(se,{className:"h-3 w-3 text-primary flex-shrink-0"})]},c.id)})})]})]})}function $e({selectedIds:s,onChange:d,disabled:t}){const{t:r}=j(),[l,a]=b.useState(!1),[o,x]=b.useState(""),p=b.useRef(null),m=b.useRef(null),{data:h,isLoading:v}=E({queryKey:["model-cards","list","",""],queryFn:()=>Me.list(),staleTime:6e4});b.useEffect(()=>{const i=f=>{p.current&&!p.current.contains(f.target)&&(a(!1),x(""))};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[]),b.useEffect(()=>{l&&m.current&&m.current.focus()},[l]);const N=(h==null?void 0:h.items)??[],y=o.trim()?N.filter(i=>i.title.toLowerCase().includes(o.toLowerCase())):N,u=i=>{s.includes(i)?d(s.filter(f=>f!==i)):d([...s,i])},c=N.filter(i=>s.includes(i.id));return e.jsxs("div",{ref:p,className:"relative",children:[e.jsx("button",{type:"button",disabled:t,onClick:()=>!t&&a(i=>!i),className:k("flex items-center justify-between w-full min-h-[36px] px-3 py-1.5 border border-border rounded-md bg-background text-sm text-left","hover:bg-accent/40 transition-colors focus:outline-none focus:ring-2 focus:ring-ring",t&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-ring"),children:v?e.jsx("span",{className:"text-muted-foreground text-xs",children:e.jsx(O,{className:"inline h-3 w-3 animate-spin mr-1"})}):s.length>0?e.jsxs("span",{className:"text-xs text-muted-foreground",children:[s.length," ",r("datasetCards.sectionLinkedModelCards").toLowerCase()]}):e.jsx("span",{className:"text-muted-foreground text-sm",children:r("datasetCards.searchModelCards")})}),c.length>0&&!l&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:c.map(i=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs bg-muted/60 border border-border font-mono",children:[i.reference_code,!t&&e.jsx("button",{type:"button",onClick:()=>u(i.id),className:"ml-0.5 hover:text-destructive",children:e.jsx(L,{className:"h-2.5 w-2.5"})})]},i.id))}),l&&e.jsxs("div",{className:"absolute z-50 mt-1 w-full rounded-md border border-border bg-card shadow-lg",children:[e.jsx("div",{className:"p-2 border-b border-border",children:e.jsx(w,{ref:m,className:"h-7 text-xs",placeholder:r("datasetCards.searchModelCards"),value:o,onChange:i=>x(i.target.value)})}),e.jsx("div",{className:"max-h-48 overflow-y-auto",children:y.length===0?e.jsx("p",{className:"text-xs text-muted-foreground px-3 py-2",children:r("datasetCards.noModelC
1ardsFound")}):y.map(i=>{const f=s.includes(i.id);return e.jsxs("button",{type:"button",className:k("w-full text-left px-3 py-2 text-xs hover:bg-muted/50 transition-colors flex items-center justify-between",f&&"bg-primary/5 font-medium"),onClick:()=>u(i.id),children:[e.jsxs("span",{children:[e.jsx("span",{className:"font-mono text-muted-foreground mr-2",children:i.reference_code}),i.title]}),f&&e.jsx(se,{className:"h-3 w-3 text-primary flex-shrink-0"})]},i.id)})})]})]})}function Ie({items:s,onChange:d,disabled:t}){const{t:r}=j(),l=()=>{d([...s,{dimension:"",excluded_or_underrepresented:"",rationale:""}])},a=(x,p)=>{d(s.map((m,h)=>h===x?{...m,...p}:m))},o=x=>{d(s.filter((p,m)=>m!==x))};return e.jsxs("div",{className:"space-y-2",children:[s.length>0&&e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_1fr_28px] gap-1 text-xs text-muted-foreground font-medium px-1",children:[e.jsxs("span",{children:[r("datasetCards.colDimension")," ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs("span",{children:[r("datasetCards.colExcluded")," ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx("span",{children:r("datasetCards.colRationale")}),e.jsx("span",{})]}),s.map((x,p)=>e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_1fr_28px] gap-1 items-start",children:[e.jsx("input",{className:"px-2 py-1.5 text-xs border border-border rounded bg-background",placeholder:r("datasetCards.dimensionPlaceholder"),value:x.dimension,disabled:t,onChange:m=>a(p,{dimension:m.target.value})}),e.jsx("input",{className:"px-2 py-1.5 text-xs border border-border rounded bg-background",placeholder:r("datasetCards.excludedPlaceholder"),value:x.excluded_or_underrepresented,disabled:t,onChange:m=>a(p,{excluded_or_underrepresented:m.target.value})}),e.jsx("input",{className:"px-2 py-1.5 text-xs border border-border rounded bg-background",placeholder:r("datasetCards.rationalePlaceholder"),value:x.rationale??"",disabled:t,onChange:m=>a(p,{rationale:m.target.value})}),t?e.jsx("span",{}):e.jsx("button",{type:"button",onClick:()=>o(p),className:"p-1 rounded text-muted-foreground hover:text-destructive transition-colors","aria-label":r("common.remove"),children:e.jsx(L,{className:"h-3.5 w-3.5"})})]},p)),!t&&e.jsxs("button",{type:"button",onClick:l,className:"text-xs text-primary hover:underline flex items-center gap-1",children:[e.jsx(ee,{className:"h-3 w-3"}),r("datasetCards.addCoverageBias")]})]})}function ge(){return{title:"",dataset_type:"rag_grounding",motivation:"",composition_description:"",coverage_bias:[],collection_process:"",preprocessing_description:"",intended_uses:"",out_of_scope_uses:"",distribution_description:"",license:"",maintenance_description:"",review_frequency_days:365,asset_ids:[],model_card_ids:[]}}function ms(){const{t:s}=j();return e.jsx(Ve,{feature:"aiGovernance",featureName:s("nav.datasetCards","Dataset Cards"),children:e.jsx(Ge,{})})}function Ge(){const{t:s}=j(),d=Be(),{canManageAIGovernance:t}=qe(),[r,l]=b.useState(""),[a,o]=b.useState(""),[x,p]=b.useState(!1),[m,h]=b.useState(null),[v,N]=b.useState(ge()),[y,u]=b.useState({}),[c,i]=b.useState(null),[f,S]=b.useState(null),[F,U]=b.useState({target_status:"published"}),[M,re]=b.useState(null),[K,B]=b.useState(null),ve=["dataset-cards","list",r,a],{data:$,isLoading:Ne,isError:ye,refetch:_e}=E({queryKey:ve,queryFn:()=>A.list({status:r||void 0,type:a||void 0}),staleTime:3e4}),{data:T,isLoading:Ce,isError:we,refetch:ke}=E({queryKey:["dataset-cards","missing-for-rag"],queryFn:()=>A.listMissingForRag(),staleTime:6e4}),ae=W({mutationFn:()=>{const n=pe(be(v));return A.create(n)},onSuccess:()=>{d.invalidateQueries({queryKey:["dataset-cards"]}),D.success(s("datasetCards.createSuccess")),z()},onError:n=>{D.error(s("datasetCards.createError"),{description:X(n,"")})}}),de=W({mutationFn:()=>{if(!m)throw new Error("no item");const n=pe(be(y));return A.update(m.id,n)},onSuccess:()=>{d.invalidateQueries({queryKey:["dataset-cards"]}),D.success(s("datasetCards.updateSuccess")),z()},onError:n=>{if(me(n)===400){D.error(s("datasetCards.publishedLocked"));return}D.error(s("datasetCards.updateError"),{description:X(n,"")})}}),V=W({mutationFn:()=>
1{if(!f)throw new Error("no item");return A.transition(f.id,F)},onSuccess:()=>{d.invalidateQueries({queryKey:["dataset-cards"]}),D.success(s("datasetCards.transitionSuccess")),S(null)},onError:n=>{var ie,oe;if(me(n)===409){const Y=n,ce=(oe=(ie=Y==null?void 0:Y.response)==null?void 0:ie.data)==null?void 0:oe.detail;D.error(s("datasetCards.transitionError"),{description:typeof ce=="string"?ce:""});return}D.error(s("datasetCards.transitionError"),{description:X(n,"")})}}),ne=()=>{N(ge()),h(null),p(!0)},Se=n=>{h(n),u({title:n.title,dataset_type:n.dataset_type,motivation:n.motivation??"",composition_description:n.composition_description??"",coverage_bias:n.coverage_bias??[],collection_process:n.collection_process??"",preprocessing_description:n.preprocessing_description??"",intended_uses:n.intended_uses??"",out_of_scope_uses:n.out_of_scope_uses??"",distribution_description:n.distribution_description??"",license:n.license??"",maintenance_description:n.maintenance_description??"",last_refreshed_at:n.last_refreshed_at??"",next_review_at:n.next_review_at??"",review_frequency_days:n.review_frequency_days,asset_ids:n.linked_asset_ids??[],model_card_ids:n.linked_model_card_ids??[],change_summary:""}),p(!0)},z=()=>{p(!1),h(null)},De=n=>{const R=J[n.status];S(n),U({target_status:R[0]??"draft",change_summary:""})},Fe=n=>{re(n),B(null)},Ae=(n,R)=>{B({from:n,to:R})},le=($==null?void 0:$.items)??[],I=ae.isPending||de.isPending,q=!m,Le=v.title.trim()!=="",Te=(y.title??"").trim()!=="",G=f?J[f.status]:[],Pe=!!F.target_status,Ee=(T==null?void 0:T.total)??0;return e.jsxs("div",{className:"flex-1 overflow-auto bg-muted/30",children:[e.jsxs("div",{className:"bg-card border-b border-border px-6 py-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:e.jsx(xe,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold",children:s("datasetCards.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("datasetCards.subtitle")})]})]}),t&&e.jsxs(C,{onClick:ne,children:[e.jsx(ee,{className:"w-4 h-4 mr-1"}),s("datasetCards.newCard")]})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-4 flex-wrap",children:[e.jsxs("select",{className:"px-3 py-1.5 text-sm border border-border rounded bg-background",value:r,onChange:n=>l(n.target.value),"aria-label":s("datasetCards.filterByStatus"),children:[e.jsx("option",{value:"",children:s("datasetCards.filterAllStatuses")}),Qe.map(n=>e.jsx("option",{value:n,children:s(`datasetCards.status_${n}`)},n))]}),e.jsxs("select",{className:"px-3 py-1.5 text-sm border border-border rounded bg-background",value:a,onChange:n=>o(n.target.value),"aria-label":s("datasetCards.filterByType"),children:[e.jsx("option",{value:"",children:s("datasetCards.filterAllTypes")}),te.map(n=>e.jsx("option",{value:n,children:s(`datasetCards.type_${n}`)},n))]})]})]}),e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsx(Ye,{isLoading:Ce,isError:we,items:(T==null?void 0:T.items)??[],total:Ee,onRefetch:ke,onCreateCard:t?ne:void 0}),Ne?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(n=>e.jsx(Q,{className:"h-24 w-full rounded-lg"},n))}):ye?e.jsxs("div",{className:"text-center py-16 text-muted-foreground",children:[e.jsx(ze,{className:"h-10 w-10 mx-auto mb-3 opacity-40"}),e.jsx("p",{className:"text-sm font-medium",children:s("common.errorLoading","Error al cargar")}),e.jsx(C,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>_e(),children:s("common.retry","Reintentar")})]}):le.length===0?e.jsxs("div",{className:"text-center py-16 text-muted-foreground",children:[e.jsx(xe,{className:"h-12 w-12 mx-auto mb-3 opacity-40"}),e.jsx("p",{className:"font-medium",children:s("datasetCards.empty")}),e.jsx("p",{className:"text-sm mt-1",children:s("datasetCards.emptyHint")})]}):e.jsx("div",{className:"space-y-3",children:le.map(n=>e.jsx(We,{item:n,canManage:t,onEdit:()=>Se(n),onTransition:()=>De(n),onHistory:()=>Fe(n),onDetail:()=>i(n)},n.id))})]}),x&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-card rounded-lg shadow-xl max-w-3xl w-full max-h-[90vh] overflow-auto",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border sticky top-0 bg-card z-10",children:[e.jsx("h3",{className:"text-base font-semibold",children:s(q?"datasetCards.newCard":"datasetCards.editTitle")}),e.jsx("button",{onClick:z,className:"p-1 rounded text-muted-foreground hover:text-foreground","aria-label":s("common.close","Cerrar"),children:e.jsx(L,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"p-6 space-y-5",children:q?e.jsx(Xe,{form:v,onCh
1ange:N}):e.jsx(Je,{form:y,onChange:u,isPublished:(m==null?void 0:m.status)==="published"})}),e.jsxs("div",{className:"flex items-center justify-end gap-2 px-6 py-4 bg-muted/50 border-t border-border sticky bottom-0 bg-card",children:[e.jsx(C,{variant:"ghost",onClick:z,disabled:I,children:s("common.cancel")}),e.jsxs(C,{onClick:()=>q?ae.mutate():de.mutate(),disabled:I||(q?!Le:!Te),children:[I&&e.jsx(O,{className:"h-3 w-3 mr-1 animate-spin"}),s(q?"datasetCards.create":"datasetCards.update")]})]})]})}),c&&e.jsx(Ze,{item:c,onClose:()=>i(null)}),f&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-card rounded-lg shadow-xl max-w-md w-full",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold",children:s("datasetCards.transitionTitle")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 font-mono",children:f.reference_code})]}),e.jsx("button",{onClick:()=>S(null),className:"p-1 rounded text-muted-foreground hover:text-foreground","aria-label":s("common.close","Cerrar"),children:e.jsx(L,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"p-6 space-y-4",children:G.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("datasetCards.noTransitions")}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs(g,{htmlFor:"tr-status",className:"text-xs",children:[s("datasetCards.transitionSelectStatus")," ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx("select",{id:"tr-status",className:"mt-1 w-full px-3 py-2 text-sm border border-border rounded bg-background",value:F.target_status,onChange:n=>U({...F,target_status:n.target.value,change_summary:""}),children:G.map(n=>e.jsx("option",{value:n,children:s(`datasetCards.status_${n}`)},n))})]}),e.jsxs("div",{children:[e.jsx(g,{htmlFor:"tr-summary",className:"text-xs",children:s("datasetCards.fieldChangeSummary")}),e.jsx(w,{id:"tr-summary",className:"mt-1 text-sm",placeholder:s("datasetCards.changeSummaryPlaceholder"),value:F.change_summary??"",onChange:n=>U({...F,change_summary:n.target.value})})]}),F.target_status==="published"&&e.jsx("div",{className:"rounded border border-amber-200 bg-amber-50/60 dark:border-amber-800 dark:bg-amber-950/20 px-3 py-2 text-xs text-amber-700 dark:text-amber-300",children:s("datasetCards.publishGateHint")})]})}),G.length>0&&e.jsxs("div",{className:"flex items-center justify-end gap-2 px-6 py-4 bg-muted/50 border-t border-border",children:[e.jsx(C,{variant:"ghost",onClick:()=>S(null),disabled:V.isPending,children:s("common.cancel")}),e.jsxs(C,{onClick:()=>V.mutate(),disabled:V.isPending||!Pe,children:[V.isPending&&e.jsx(O,{className:"h-3 w-3 mr-1 animate-spin"}),s("datasetCards.transitionButton")]})]})]})}),M&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-end sm:items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-card rounded-lg shadow-xl w-full max-w-xl max-h-[85vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("h3",{className:"text-base font-semibold",children:s("datasetCards.versionHistory")}),e.jsx(Z,{variant:"outline",className:"text-xs font-mono",children:M.reference_code})]}),e.jsx("button",{onClick:()=>{re(null),B(null)},className:"p-1 rounded text-muted-foreground hover:text-foreground","aria-label":s("common.close","Cerrar"),children:e.jsx(L,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex-1 overflow-auto p-6",children:K?e.jsx(es,{cardId:M.id,fromVersionId:K.from,toVersionId:K.to,onBack:()=>B(null)}):e.jsx(ss,{cardId:M.id,onCompare:Ae})})]})})]})}function Ye({isLoading:s,isError:d,items:t,total:r,onRefetch:l,onCreateCard:a}){const{t:o}=j();return s?e.jsx(Q,{className:"h-16 w-full rounded-lg"}):d?e.jsxs("div",{className:"rounded-lg border border-border bg-card px-4 py-3 flex items-center justify-between text-sm text-muted-foreground",children:[e.jsx("span",{children:o("datasetCards.missingBannerError")}),e.jsx(C,{variant:"outline",size:"sm",onClick:l,children:o("common.retry","Reintentar")}
1)]}):r===0?e.jsxs("div",{className:"rounded-lg border border-green-200 bg-green-50/60 dark:border-green-800 dark:bg-green-950/20 px-4 py-3 flex items-center gap-2",children:[e.jsx(se,{className:"h-4 w-4 text-green-600 dark:text-green-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-green-700 dark:text-green-300",children:o("datasetCards.missingBannerAllClear")})]}):e.jsxs("div",{className:"rounded-lg border border-red-200 bg-red-50/60 dark:border-red-800 dark:bg-red-950/20 px-4 py-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Oe,{className:"h-4 w-4 text-red-600 dark:text-red-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm font-semibold text-red-700 dark:text-red-300",children:o("datasetCards.missingBannerTitle",{count:r})})]}),e.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:o("datasetCards.missingBannerDescription")}),e.jsx("div",{className:"space-y-1 mt-1",children:t.map(x=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded bg-red-100/60 dark:bg-red-900/20 px-3 py-1.5",children:[e.jsx("span",{className:"text-xs text-red-800 dark:text-red-300 font-medium",children:x.name}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-red-600 dark:text-red-400 capitalize",children:x.lifecycle_status}),a&&e.jsxs(C,{size:"sm",variant:"outline",className:"h-6 text-xs border-red-300 text-red-700 hover:bg-red-100 dark:border-red-700 dark:text-red-300",onClick:a,children:[e.jsx(ee,{className:"h-3 w-3 mr-1"}),o("datasetCards.createCard")]})]})]},x.id))})]})}function We({item:s,canManage:d,onEdit:t,onTransition:r,onHistory:l,onDetail:a}){const{t:o}=j(),x=J[s.status],p=s.status==="published";return e.jsx("div",{className:"bg-card border border-border rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:s.reference_code}),e.jsx(fe,{status:s.status,label:o(`datasetCards.status_${s.status}`)}),e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-muted/60 border border-border",children:o(`datasetCards.type_${s.dataset_type}`)}),s.is_review_overdue&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium bg-red-100 text-red-700 dark:bg-red-950/40 dark:text-red-300 border border-red-300 dark:border-red-800",children:[e.jsx(P,{className:"h-3 w-3"}),o("datasetCards.reviewOverdueBadge")]}),e.jsx("h3",{className:"font-medium text-foreground",children:s.title})]}),e.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-muted-foreground flex-wrap",children:[e.jsxs("span",{children:[e.jsxs("span",{className:"font-medium",children:[o("datasetCards.assetCount"),":"]})," ",e.jsx("span",{className:"text-foreground font-semibold",children:s.asset_count})]}),s.corpus_quality_score!==null&&e.jsxs("span",{children:[e.jsxs("span",{className:"font-medium",children:[o("datasetCards.corpusQualityScore"),":"]})," ",e.jsxs("span",{className:k("font-semibold",s.corpus_quality_score>=70?"text-green-600 dark:text-green-400":s.corpus_quality_score>=40?"text-amber-600 dark:text-amber-400":"text-red-600 dark:text-red-400"),children:[s.corpus_quality_score.toFixed(0),"/100"]})]}),s.assets_without_quality_score>0&&e.jsxs("span",{className:"text-amber-600 dark:text-amber-400",children:[e.jsx(P,{className:"inline h-3 w-3 mr-0.5"}),o("datasetCards.assetsWithoutQuality"),": ",s.assets_without_quality_score]}),s.published_at&&e.jsxs("span",{children:[e.jsxs("span",{className:"font-medium",children:[o("datasetCards.publishedAt"),":"]})," ",new Date(s.published_at).toLocaleDateString()]}),s.next_review_at&&e.jsxs("span",{className:s.is_review_overdue?"text-red-600 dark:text-red-400":"",children:[e.jsxs("span",{className:"font-medium",children:[o("datasetCards.nextReviewAt"),":"]})," ",new Date(s.next_review_at).toLocaleDateString()]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx("button",{onClick:a,className:"px-2 py-1 text-xs rounded border border-border text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors",title:o("datasetCards.viewDetail"),children:o("datasetCards.viewDetail")}),e.jsx("button",{onClick:l,className:"p-1.5 rounded text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors",title:o("datasetCards.versionHistory"),children:e.jsx(H,{className:"h-3.5 w-3.5"})}),d&&e.jsxs(e.Fragment,{children:[x.length>0&&e.jsx("button",{onClick:r,className:"px-2 py-1 text-xs rounded border border-border text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors",title:o("datasetCards.transitionButton"),children:o("datasetCards.transitionTo")}),!p&&e.jsx("button",{onClick:t,className:"p-1.5 rounded text-muted-foreground hover:text-indigo-600 dark:hover:text-indigo-400 transition-colors",title:o("datasetCards.editTitle"),children:e.jsx(ue,{className:"h-3.5 w-3.5"})}),p&&e.jsx("span",{className:"p-1.5 rounded text-muted-foreground opacity-40 cursor-not-allowed",title:o("datasetCards.publishedLocked"),children:e.jsx(ue,{className:"h-3.5 w-3.5"})})]})]})]})})}function Xe({form:s,onChange:d}){const{t}=j();return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs(g,{htmlFor:"c-title",className:"text-xs",children:[t("datasetCards.fieldTitle")," ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(w,{id:"c-title",className:"mt-1",placeholder:t("datasetCards.titlePlaceholder"),value:s.title,onChange:r=>d({...s,title:r.target.value}),autoFocus:!0})]}),e.jsxs("div",{children:[e.jsx(g,{className:"text-xs",children:t("datasetCards.fieldDatasetType")}),e.jsx("select",{className:"mt-1 w-full px-3 py-2 text-sm border border-border rounded bg-background",value:s.dataset_type??"rag_grounding",onCh
1ange:r=>d({...s,dataset_type:r.target.value}),children:te.map(r=>e.jsx("option",{value:r,children:t(`datasetCards.type_${r}`)},r))})]}),e.jsx(je,{form:s,onChange:r=>d({...s,...r})})]})}function Je({form:s,onChange:d,isPublished:t}){const{t:r}=j();return t?e.jsx("div",{className:"rounded border border-amber-200 bg-amber-50/60 dark:border-amber-800 dark:bg-amber-950/20 px-4 py-3 text-sm text-amber-700 dark:text-amber-300",children:r("datasetCards.publishedLockedHint")}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs(g,{htmlFor:"u-title",className:"text-xs",children:[r("datasetCards.fieldTitle")," ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(w,{id:"u-title",className:"mt-1",value:s.title??"",onChange:l=>d({...s,title:l.target.value}),autoFocus:!0})]}),e.jsxs("div",{children:[e.jsx(g,{className:"text-xs",children:r("datasetCards.fieldDatasetType")}),e.jsx("select",{className:"mt-1 w-full px-3 py-2 text-sm border border-border rounded bg-background",value:s.dataset_type??"rag_grounding",onChange:l=>d({...s,dataset_type:l.target.value}),children:te.map(l=>e.jsx("option",{value:l,children:r(`datasetCards.type_${l}`)},l))})]}),e.jsx(je,{form:s,onChange:l=>d({...s,...l})}),e.jsxs("div",{children:[e.jsx(g,{htmlFor:"u-summary",className:"text-xs",children:r("datasetCards.fieldChangeSummary")}),e.jsx(w,{id:"u-summary",className:"mt-1 text-sm",placeholder:r("datasetCards.changeSummaryPlaceholder"),value:s.change_summary??"",onChange:l=>d({...s,change_summary:l.target.value})})]})]})}function je({form:s,onChange:d}){var r,l;const{t}=j();return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rounded border border-border bg-muted/20 p-4 space-y-3",children:[e.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:t("datasetCards.sectionMotivation")}),e.jsxs("div",{children:[e.jsx(g,{className:"text-xs",children:t("datasetCards.fieldMotivation")}),e.jsx("textarea",{rows:2,className:"mt-1 w-full px-3 py-2 text-sm border border-border rounded bg-background",placeholder:t("datasetCards.motivationPlaceholder"),value:s.motivation??"",onChange:a=>d({motivation:a.target.value})})]})]}),e.jsxs("div",{className:"rounded border border-border bg-muted/20 p-4 space-y-3",children:[e.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:t("datasetCards.sectionComposition")}),e.jsxs("div",{children:[e.jsx(g,{className:"text-xs",children:t("datasetCards.fieldCompositionDescription")}),e.jsx("textarea",{rows:2,className:"mt-1 w-full px-3 py-2 text-sm border border-border rounded bg-background",placeholder:t("datasetCards.compositionDescriptionPlaceholder"),value:s.composition_description??"",onChange:a=>d({composition_description:a.target.value})})]}),e.jsxs("div",{children:[e.jsx(g,{className:"text-xs",children:t("datasetCards.sectionLinkedAssets")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 mb-1",children:t("datasetCards.linkedAssetsHint")}),e.jsx(Ke,{selectedIds:s.asset_ids??[],onChange:a=>d({asset_ids:a})})]}),e.jsxs("div",{children:[e.jsx(g,{className:"text-xs",children:t("datasetCards.sectionCoverageBias")}),e.jsx("div",{className:"mt-2",children:e.jsx(Ie,{items:s.coverage_bias??[],onChange:a=>d({coverage_bias:a})})})]})]}),e.jsxs("div",{className:"rounded border border-border bg-muted/20 p-4 space-y-3",children:[e.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:t("datasetCards.sectionCollection")}),e.jsxs("div",{children:[e.jsx(g,{className:"text-xs",children:t("datasetCards.fieldCollectionProcess")}),e.jsx("textarea",{rows:2,className:"mt-1 w-full px-3 py-2 text-sm border border-border rounded bg-background",placeholder:t("datasetCards.collectionProcessPlaceholder"),value:s.collection_process??"",onChange:a=>d({collection_process:a.target.value})})]})]}),e.jsxs("div",{className:"rounded border border-border bg-muted/20 p-4 space-y-3",children:[e.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:t("datasetCards.sectionPreprocessing")}),e.jsxs("div",{children:[e.jsx(g,{className:"text-xs",children:t("datasetCards.fieldPreprocessingDescription")}),e.jsx("textarea",{rows:2,className:"mt-1 w-full px-3 py-2 text-sm border border-border rounded bg-background",placeholder:t("datasetCards.preprocessingDescriptionPlaceholder"),value:s.preprocessing_description??"",onChange:a=>d({preprocessing_description:a.target.value})})]})]}),e.jsxs("div",{className:"rounded border border-border bg-muted/20 p-4 space-y-3",children:[e.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:t("datasetCards.sectionUses")}),e.jsxs("div",{children:[e.jsx(g,{className:"text-xs",children:t("datasetCards.fieldIntendedUses")}),e.jsx("textarea",{rows:2,className:"mt-1 w-full px-3 py-2 text-sm border border-border rounded bg-background",placeholder:t("datasetCards.intendedUsesPlaceholder"),value:s.intended_uses??"",onChange:a=>d({intended_uses:a.target.value})})]}),e.jsxs("div",{children:[e.jsx(g,{className:"text-xs",children:t("datasetCards.fieldOutOfScopeUses")}),e.jsx("textarea",{rows:2,className:"mt-1 w-full px-3 py-2 text-sm border border-border rounded bg-background",placeholder:t("datasetCards.outOfScopeUsesPlaceholder"),value:s.out_of_scope_uses??"",onChange:a=>d({out_of_scope_uses:a.target.value})})]})]}),e.jsxs("div",{className:"rounded border border-border bg-muted/20 p-4 space-y-3",children:[e.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:t("datasetCards.sectionDistribution")}),e.jsxs("div",{children:[e.jsx(g,{className:"text-xs",children:t("datasetCards.fieldDistributionDescription")}),e.jsx("textarea",{rows:2,className:"mt-1 w-full px-3 py-2 text-sm border border-border rounded bg-background",placeholder:t("datasetCards.distributionDescriptionPlaceholder"),value:s.distribution_description??"",onChange:a=>d({distribution_description:a.target.value})})]}),e.jsxs("div",{children:[e.jsx(g,{className:"text-xs",children:t("datasetCards.fieldLicense")}),e.jsx(w,{className:"mt-1 text-sm",placeholder:t("datasetCards.licensePlaceholder"),value:s.license??"",onChange:a=>d({license:a.target.value})})]})]}),e.jsxs("div",{className:"rounded border border-border bg-muted/20 p-4 space-y-3",children:[e.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:t("datasetCards.sectionMaintenance")}),e.jsxs("div",{children:[e.jsx(g,{className:"text-xs",children:t("datasetCards.fieldMaintenanceDescription")}),e.jsx("textarea",{rows:2,className:"mt-1 w-full px-3 py-2 text-sm border border-border rounded bg-background",placeholder:t("datasetCards.maintenanceDescriptionPlaceholder"),value:s.maintenance_description??"",onChange:a=>d({maintenance_description:a.target.value})})]})]}),e.jsxs("div",{className:"rounded border border-border bg-muted/20 p-4 space-y-3",children:[e.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:t("datasetCards.sectionReview")}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx(g,{className:"text-xs",children:t("datasetCards.fieldLastRefreshedAt")}),e.jsx(w,{type:"date",className:"mt-1 text-sm",value:((r=s.last_refreshed_at)==null?void 0:r.substring(0,10))??"",onChange:a=>d({last_refreshed_at:a.target.value||void 0})})]}),e.jsxs("div",{children:[e.jsx(g,{className:"text-xs",children:t("datasetCards.fieldNextReviewAt")}),e.jsx(w,{type:"date",className:"mt-1 text-sm",value:((l=s.next_review_at)==null?void 0:l.substring(0,10))??"",onChange:a=>d({next_review_at:a.target.value||void 0})})]}),e.jsxs("div",{children:[e.jsx(g,{className:"text-xs",children:t("datasetCards.fieldReviewFrequencyDays")}),e.jsx(w,{type:"number",className:"mt-1 text-sm",min:1,value:s.review_frequency_days??365,onChange:a=>d({review_frequency_days:parseInt(a.target.value)||365})})]})]})]}),e.jsxs("div",{children:[e.jsx(g,{className:"text-xs",children:t("datasetCards.sectionLinkedModelCards")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 mb-1",children:t("datasetCards.linkedModelCardsHint")}),e.jsx($e,{selectedIds:s.model_card_ids??[],onChange:a=>d({model_card_ids:a})})]})]})}function Ze({item:s,onClose:d}){const{t}=j(),r=Ue.includes(s.dataset_type);return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-end sm:items-center justify-end z-50",children:e.jsxs("div",{className:"bg-card w-full sm:max-w-2xl h-full sm:h-auto sm:max-h-[90vh] flex flex-col shadow-2xl sm:rounded-l-xl overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border flex-shrink-0",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(Z,{variant:"outline",className:"text-xs font-mono",children:s.reference_code}),e.jsx(fe,{status:s.status,label:t(`datasetCards.status_${s.status}`)}),e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-muted/60 border border-border",children:t(`datasetCards.type_${s.dataset_type}`)}),s.is_review_overdue&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium bg-red-100 text-red-700 dark:bg-red-950/40 dark:text-red-300 border border-red-300 dark:border-red-800",children:[e.jsx(P,{className:"h-3 w-3"}),t("datasetCards.reviewOverdueBadge")]})]}),e.jsx("h3",{className:"text-base font-semibold mt-1",children:s.title})]}),e.jsx("button",{onClick:d,className:"p-1 rounded text-muted-foreground hover:text-foreground","aria-label":t("common.close","Cerrar"),children:e.jsx(L,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex-1 overflow-auto p-6 space-y-5",children:[s.is_review_overdue&&e.jsxs("div",{className:"flex items-center gap-2 rounded border border-red-200 bg-red-50/60 dark:border-red-800 dark:bg-red-950/20 px-3 py-2",children:[e.jsx(P,{className:"h-4 w-4 text-red-600 dark:text-red-400 flex-shrink-0"}),e.jsx("span",{className:"text-xs text-red-700 dark:text-red-300",children:t("datasetCards.reviewOverdueDetail")})]}),e.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-4",children:[e.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:t("datasetCards.sectionDerivedQuality")}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3 italic",children:t("datasetCards.derivedQualityNote")}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"rounded border border-border bg-card px-3 py-2 text-center",children:[e.jsx("p",{className:"text-2xl font-bold text-foreground",children:s.asset_count}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t("datasetCards.assetCount")})]}),e.jsx("div",{className:"rounded border border-border bg-card px-3 py-2 text-center",children:s.corpus_quality_score!==null?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:k("text-2xl font-bold",s.corpus_quality_score>=70?"text-green-600 dark:text-green-400":s.corpus_quality_score>
1=40?"text-amber-600 dark:text-amber-400":"text-red-600 dark:text-red-400"),children:[s.corpus_quality_score.toFixed(0),e.jsx("span",{className:"text-sm font-normal",children:"/100"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t("datasetCards.corpusQualityScore")})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-2xl font-bold text-muted-foreground",children:"—"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t("datasetCards.noQualityData")})]})}),e.jsx("div",{className:"rounded border border-border bg-card px-3 py-2 text-center",children:s.corpus_completeness!==null?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-2xl font-bold text-foreground",children:[s.corpus_completeness.toFixed(0),e.jsx("span",{className:"text-sm font-normal",children:"/100"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t("datasetCards.corpusCompleteness")})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-2xl font-bold text-muted-foreground",children:"—"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t("datasetCards.corpusCompleteness")})]})})]}),s.assets_without_quality_score>0&&e.jsxs("div",{className:"mt-3 flex items-center gap-2 rounded border border-amber-200 bg-amber-50/60 dark:border-amber-800 dark:bg-amber-950/20 px-3 py-2",children:[e.jsx(P,{className:"h-4 w-4 text-amber-600 dark:text-amber-400 flex-shrink-0"}),e.jsxs("span",{className:"text-xs text-amber-700 dark:text-amber-300",children:[t("datasetCards.assetsWithoutQuality"),": ",s.assets_without_quality_score," ",t("common.of","de")," ",s.asset_count]})]}),e.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:[e.jsxs("span",{className:"font-medium",children:[t("datasetCards.coveredDomains"),":"]})," ",s.covered_domain_ids.length]}),e.jsxs("span",{children:[e.jsxs("span",{className:"font-medium",children:[t("datasetCards.coveredDataSources"),":"]})," ",s.covered_data_source_ids.length]})]})]}),s.motivation&&e.jsx(_,{label:t("datasetCards.sectionMotivation"),children:e.jsx("p",{className:"text-sm",children:s.motivation})}),s.composition_description&&e.jsx(_,{label:t("datasetCards.sectionComposition"),children:e.jsx("p",{className:"text-sm",children:s.composition_description})}),s.coverage_bias&&s.coverage_bias.length>0&&e.jsx(_,{label:t("datasetCards.sectionCoverageBias"),children:e.jsx("div",{className:"rounded border border-border overflow-hidden",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{className:"bg-muted/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:t("datasetCards.colDimension")}),e.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:t("datasetCards.colExcluded")}),e.jsx("th",{className:"px-3 py-2 text-left font-medium text-muted-foreground",children:t("datasetCards.colRationale")})]})}),e.jsx("tbody",{children:s.coverage_bias.map((l,a)=>e.jsxs("tr",{className:"border-t border-border",children:[e.jsx("td",{className:"px-3 py-2 font-medium",children:l.dimension}),e.jsx("td",{className:"px-3 py-2",children:l.excluded_or_underrepresented}),e.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:l.rationale??"—"})]},a))})]})})}),s.linked_asset_ids.length>0&&e.jsxs(_,{label:t("datasetCards.sectionLinkedAssets"),children:[e.jsxs("p",{className:"text-xs text-muted-foreground mb-1",children:[t("datasetCards.assetCount"),": ",s.linked_assets.length]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:s.linked_assets.map(l=>e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs bg-muted/60 border border-border",children:l.name},l.id))})]}),r&&s.linked_asset_ids.length===0&&e.jsxs("div",{className:"flex items-center gap-2 rounded border border-amber-200 bg-amber-50/60 dark:border-amber-800 dark:bg-amber-950/20 px-3 py-2",children:[e.jsx(P,{className:"h-4 w-4 text-amber-600 dark:text-amber-400 flex-shrink-0"}),e.jsx("span",{className:"text-xs text-amber-700 dark:text-amber-300",children:t("datasetCards.linkedAssetsHint")})]}),s.collection_process&&e.jsx(_,{label:t("datasetCards.sectionCollection"),children:e.jsx("p",{className:"text-sm",children:s.collection_process})}),s.preprocessing_description&&e.jsx(_,{label:t("datasetCards.sectionPreprocessing"),children:e.jsx("p",{className:"text-sm",children:s.preprocessing_description})}),s.intended_uses&&e.jsx(_,{label:t("datasetCards.fieldIntendedUses"),children:e.jsx("p",{className:"text-sm",children:s.intended_uses})}),s.out_of_scope_uses&&e.jsx(_,{label:t("datasetCards.fieldOutOfScopeUses"),children:e.jsx("p",{className:"text-sm",children:s.out_of_scope_uses})}),(s.distribution_description||s.license)&&e.jsxs(_,{label:t("datasetCards.sectionDistribution"),children:[s.distribution_description&&e.jsx("p",{className:"text-sm",children:s.distribution_description}),s.license&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[e.jsxs("span",{className:"font-medium",children:[t("datasetCards.fieldLicense"),":"]})," ",s.license]})]}),s.maintenance_description&&e.jsx(_,{label:t("datasetCards.sectionMaintenance"),children:e.jsx("p",{className:"text-sm",children:s.maintenance_description})}),e.jsx(_,{label:t("datasetCards.sectionReview"),children:e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-xs",children:[s.last_refreshed_at&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-muted-foreground",children:[t("datasetCards.lastRefreshedAt"),":"]}),e.jsx("span",{children:new Date(s.last_refreshed_at).toLocaleDateString()})]}),s.published_at&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-muted-foreground",children:[t("datasetCards.publishedAt"),":"]}),e.jsx("span",{children:new Date(s.published_at).toLocaleDateString()})]}),s.next_review_at&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:k("text-muted-foreground",s.is_review_overdue&&"text-red-600 dark:text-red-400"),children:[t("datasetCards.nextReviewAt"),":"]}),e.jsx("span",{className:s.is_review_overdue?"text-red-600 dark:text-red-400 font-medium":"",children:new Date(s.next_review_at).toLocaleDateString()})]}),e.jsxs("span",{className:"text-muted-foreground",children:[t("datasetCards.reviewFrequencyDays"),":"]}),e.jsxs("span",{children:[s.review_frequency_days,"d"]})]})}),s.linked_model_cards.length>0&&e.jsx(_,{label:t("datasetCards.sectionLinkedModelCards"),children:e.jsx("div",{className:"flex flex-wrap gap-1",children:s.linked_model_cards.map(l=>e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs bg-muted/60 border border-border",children:l.title},l.id))})})]})]})})}function _({label:s,children:d}){return e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-muted-foreground mb-1",children:s}),d]})}function es({cardId:s,fromVersionId:d,toVersionId:t,onBack:r}){const{t:l}=j(),{data:a,isLoading:o,isError:x,refetch:p}=E({queryKey:["dataset-cards","versions","diff",s,d,t],queryFn:()=>A.diffVersions(s,d,t),staleTime:6e4}),m=a!=null&&a.changed_fields?[...a.changed_fields].sort((h,v)=>h.field.localeCompare(v.field)):[];return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[r&&e.jsxs(C,{variant:"ghost",size:"sm",onClick:r,children:["← ",l("policyVersions.diff.back")]}),e.jsx("h3",{className:"text-sm font-semibold",children:l("policyVersions.diff.title")})]}),a&&e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs rounded-lg border border-border overflow-hidden",children:[e.jsxs("div",{className:"bg-red-50/80 dark:bg-red-950/20 px-3 py-2",children:[e.jsx("span",{className:"font-medium text-muted-foreground block mb-0.5",children:l("policyVersions.diff.from")}),e.jsxs("span",{className:"font-semibold",children:["v",a.from_version.version_number]}),e.jsx("span",{className:"text-muted-foreground ml-2",children:new Date(a.from_version.valid_from).toLocaleDateString()})]}),e.jsxs("div",{className:"bg-green-50/80 dark:bg-green-950/20 px-3 py-2",children:[e.jsx("span",{className:"font-medium text-muted-foreground block mb-0.5",children:l("policyVersions.diff.to")}),e.jsxs("span",{className:"font-semibold",children:["v",a.to_version.version_number]}),e.jsx("span",{className:"text-muted-foreground ml-2",children:new Date(a.to_version.valid_from).toLocaleDateString()})]})]}),o&&e.jsx(Q,{className:"h-40 w-full"}),x&&e.jsxs("div",{className:"text-center py-10 text-muted-foreground",children:[e.jsx("p",{className:"text-sm",children:l("policyVersions.diff.errorLoading")}),e.jsx(C,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>p(),children:l("policyVersions.diff.retry")})]}),!o&&!x&&m.length===0&&e.jsx("div",{className:"text-center py-10 text-muted-foreground text-sm",children:l("policyVersions.diff.noDifferences")}),!o&&!x&&m.length>0&&e.jsx("div",{className:"rounded-lg border border-border overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-muted/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2.5 text-left text-xs font-medium text-muted-foreground w-1/4",children:l("policyVersions.diff.colField")}),e.jsx("th",{className:"px-3 py-2.5 text-left text-xs font-medium text-red-600 dark:text-red-400 w-[37.5%]",children:l("policyVersions.diff.colBefore")}),e.jsx("th",{className:"px-3 py-2.5 text-left text-xs font-medium text-green-700 dark:text-green-400 w-[37.5%]",children:l("policyVersions.diff.colAfter")})]})}),e.jsx("tbody",{children:m.map(h=>e.jsxs("tr",{className:"border-t border-border",children:[e.jsx("td",{className:"px-3 py-2.5 align-top",children:e.jsx("span",{className:"font-mono text-xs",children:h.field})}),e.jsx("td",{className:"px-3 py-2.5 align-top bg-red-50/60 dark:bg-red-950/20 text-xs",children:h.from===null||h.from===void 0?e.jsx("em",{className:"text-muted-foreground",children:"—"}):String(h.from)}),e.jsx("td",{className:"px-3 py-2.5 align-top bg-green-50/60 dark:bg-green-950/20 text-xs",children:h.to===null||h.to===void 0?e.jsx("em",{className:"text-muted-foreground",children:"—"}):String(h.to)})]},h.field))})]})})]})}function ss({cardId:s,onCompare:d}){var y;const{t}=j(),[r,l]=b.useState([]),{data:a,isLoading:o,isError:x,refetch:p}=E({queryKey:["dataset-cards","versions",s],queryFn:()=>A.listVersions(s),staleTime:3e4});if(o)return e.jsx("div",{className:"space-y-3",children:[1,2,3].map(u=>e.jsx(Q,{className:"h-16 w-full rounded-lg"},u))});if(x)return e.jsxs("div",{className:"text-center py-10 text-muted-foreground",children:[e.jsx(H,{className:"h-10 w-10 mx-auto mb-3 opacity-40"}),e.jsx("p",{className:"text-sm",children:t("policyVersions.timeline.errorLoading")}),e.jsx(C,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>p(),children:t("policyVersions.timeline.retry")})]});if(!((y=a==null?void 0:a.items)!=null&&y.length))return e.jsxs("div",{className:"text-center py-10 text-muted-foreground",children:[e.jsx(H,{className:"h-10 w-10 mx-auto mb-3 opacity-40"}),e.jsx("p",{className:"text-sm",children:t("policyVersions.timeline.empty")})]});const m=[...a.items].reverse(),h=u=>{l(c=>c.includes(u)?c.filter(i=>i!==u):c.length>=2?[c[1],u]:[...c,u])},v=r.length===2,N=()=>
1{if(!v)return;const u=a.items.find(S=>S.id===r[0]),c=a.items.find(S=>S.id===r[1]);if(!u||!c)return;const[i,f]=u.version_number<c.version_number?[u.id,c.id]:[c.id,u.id];d(i,f),l([])};return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:t("policyVersions.timeline.selectTwoHint")}),e.jsx(C,{size:"sm",variant:"outline",disabled:!v,onClick:N,children:t("policyVersions.timeline.compareSelected")})]}),m.map((u,c)=>{const i=u.valid_to===null,f=r.includes(u.id);return e.jsxs("div",{className:"flex gap-3 mb-1",children:[e.jsxs("div",{className:"flex flex-col items-center flex-shrink-0 w-6",children:[e.jsx("div",{className:k("h-6 w-6 rounded-full border-2 flex items-center justify-center flex-shrink-0 mt-2",i?"bg-primary border-primary text-primary-foreground":f?"bg-blue-100 border-blue-500 dark:bg-blue-900/30":"bg-background border-border")}),c<m.length-1&&e.jsx("div",{className:"w-0.5 flex-1 bg-border mt-1 min-h-[1rem]"})]}),e.jsxs("button",{type:"button",onClick:()=>h(u.id),className:k("flex-1 text-left rounded-lg border p-3 mb-3 transition-colors focus:outline-none focus:ring-2 focus:ring-ring",i?"border-primary bg-primary/5 dark:bg-primary/10":f?"border-blue-400 bg-blue-50 dark:bg-blue-900/20":"border-border bg-card hover:bg-muted/40"),children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-1",children:[e.jsxs(Z,{variant:i?"default":"outline",className:"text-xs",children:["v",u.version_number]}),i&&e.jsx("span",{className:"text-xs font-medium text-primary",children:t("policyVersions.timeline.current")})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[new Date(u.valid_from).toLocaleDateString(),u.valid_to&&e.jsxs(e.Fragment,{children:[" → ",new Date(u.valid_to).toLocaleDateString()]})]}),u.change_summary&&e.jsx("p",{className:"text-xs text-foreground mt-1",children:u.change_summary}),u.changed_by_email_at_time&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:u.changed_by_email_at_time})]})]},u.id)})]})}export{ms as default};
2//# sourceMappingURL=DatasetCardsPage-CKigSOX8.js.map

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.