PageSourceSearch

https://app.linedat.com/assets/AISuppliersPage-CydlzyFg.js

js linedat.com collected 2026-10-07 21:25:13 UTC 37,196 bytes, 4 lines download raw bytes

1import{g as e,r as v,ap as _}from"./vendor-CHCeBm6R.js";import{u as ke,an as C,B as N,S as z,Y as n,I as o,K as ne,g as B}from"./index-7iGGmx-N.js";import{b as Ce,u as K,c as H}from"./vendor-data-DR7EPs97.js";import{P as Fe}from"./PlanFeaturePreview-UWG-RaHR.js";import{u as k}from"./vendor-i18n-C_D1kBm4.js";import{i as se,q as Ae,R as Pe,X as $,L as re,as as de,aM as R,N as Te,T as te,ah as De,bw as qe}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 O={under_review:["active","terminated"],active:["suspended","terminated"],suspended:["active","terminated"],terminated:[]},Ee={under_review:"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300",active:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300",suspended:"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-300",terminated:"bg-gray-200 text-gray-500 dark:bg-gray-800 dark:text-gray-400"},Ue=["under_review","active","suspended","terminated"],ce=["model_provider","infrastructure","data_provider","integrator","saas_processor","other"],oe=["none","adequacy","scc","bcr","derogation"],ue=["adequate","adequate_with_measures","inadequate"],ae={name:"",supplier_type:"model_provider",slug:"",description:"",country:"",transfer_mechanism:void 0,adequacy_reference:"",sccs_signed_at:"",sccs_url:"",tia_done_at:"",tia_outcome:void 0,tia_url:"",dpa_signed_at:"",dpa_url:"",renewal_due_at:"",sub_processors:void 0,model_card_url:"",contact_email:"",owner_user_id:""};function Re(s){const a={};for(const d of Object.keys(s)){const l=s[d];l===""||l===void 0||l===null||Array.isArray(l)&&l.length===0||(a[d]=l)}return a}function Le(s){const a={};for(const d of Object.keys(s)){const l=s[d];l===""||l===void 0||l===null||Array.isArray(l)&&l.length===0||(a[d]=l)}return a}function ie(s,a){var t,r;const d=s,l=(r=(t=d==null?void 0:d.response)==null?void 0:t.data)==null?void 0:r.detail;return typeof l=="string"?l:Array.isArray(l)?l.map(g=>{const u=g,f=Array.isArray(u.loc)?u.loc[u.loc.length-1]:"";return f?`${String(f)}: ${u.msg??""}`:u.msg??""}).filter(Boolean).join("; "):(d==null?void 0:d.message)??a}function le(s){return s.split(`
2`).map(a=>a.trim()).filter(Boolean).map(a=>({name:a,country:null}))}function Ve(s){return s.map(a=>a.name).join(`
3`)}function Me({status:s,label:a}){return e.jsx("span",{className:B("inline-flex items-center px-2 py-0.5 rounded text-xs font-medium",Ee[s]),children:a})}function ts(){const{t:s}=k();return e.jsx(Fe,{feature:"aiGovernance",featureName:s("nav.aiSuppliers","AI Suppliers"),children:e.jsx(Ie,{})})}function Ie(){const{t:s}=k(),a=Ce(),{canManageAIGovernance:d}=ke(),[l,t]=v.useState(""),[r,g]=v.useState(!1),[u,f]=v.useState(null),[j,x]=v.useState(ae),[S,P]=v.useState({}),[y,c]=v.useState(""),[m,b]=v.useState(null),[p,w]=v.useState({target_status:"active"}),[T,Q]=v.useState(null),[L,D]=v.useState(null),pe=["ai-suppliers","list",l],{data:V,isLoading:xe,isError:he,refetch:ge}=K({queryKey:pe,queryFn:()=>C.list({status:l||void 0}),staleTime:3e4}),Y=H({mutationFn:()=>{const i={...j,sub_processors:y.trim()?le(y):void 0};return C.create(Re(i))},onSuccess:()=>{a.invalidateQueries({queryKey:["ai-suppliers"]}),_.success(s("aiSuppliers.createSuccess")),E()},onError:i=>{var A;const h=i;if(((A=h==null?void 0:h.response)==null?void 0:A.status)===409){_.error(s("aiSuppliers.slugConflict"));return}_.error(s("aiSuppliers.createError"),{description:ie(i,"")})}}),G=H({mutationFn:()=>{if(!u)throw new Error("no supplier");const i={...S,sub_processors:y.trim()?le(y):void 0};return C.update(u.id,Le(i))},onSuccess:()=>{a.invalidateQueries({queryKey:["ai-suppliers"]}),_.success(s("aiSuppliers.updateSuccess")),E()},onError:i=>{_.error(s("aiSuppliers.updateError"),{description:ie(i,"")})}}),q=H({mutationFn:()=>{if(!m)throw new Error("no supplier");return C.transition(m.id,p)},onSuccess:()=>{a.invalidateQueries({queryKey:["ai-suppliers"]}),_.success(s("aiSuppliers.transitionSuccess")),b(null)},onError:i=>{var W,Z,ee;const h=i,U=(W=h==null?void 0:h.response)==null?void 0:W.status;if(U===409){_.error(s("aiSuppliers.transitionError"));return}if(U===400&&p.target_status==="suspended"){_.error(s("aiSuppliers.suspendReasonRequired"));return}if(U===400&&p.target_status==="active"){_.error(s("aiSuppliers.activateNeedsDpa"));return}const A=(ee=(Z=h==null?void 0:h.response)==null?void 0:Z.data)==null?void 0:ee.detail;_.error(s("aiSuppliers.transitionError"),{description:typeof A=="string"?A:(h==null?void 0:h.message)??""})}}),fe=()=>{x(ae),c(""),f(null),g(!0)},je=i=>{f(i),P({name:i.name,description:i.description??"",supplier_type:i.supplier_type,country:i.country??"",transfer_mechanism:i.transfer_mechanism??void 0,adequacy_reference:i.adequacy_reference??"",sccs_signed_at:i.sccs_signed_at?i.sccs_signed_at.slice(0,10):"",sccs_url:i.sccs_url??"",tia_done_at:i.tia_done_at?i.tia_done_at.slice(0,10):"",tia_outcome:i.tia_outcome??void 0,tia_url:i.tia_url??"",dpa_signed_at:i.dpa_signed_at?i.dpa_signed_at.slice(0,10):"",dpa_url:i.dpa_url??"",renewal_due_at:i.renewal_due_at?i.renewal_due_at.slice(0,10):"",model_card_url:i.model_card_url??"",contact_email:i.contact_email??"",owner_user_id:i.owner_user_id??"",change_summary:""}),c(Array.isArray(i.sub_processors)?Ve(i.sub_processors):""),g(!0)},E=()=>{g(!1),f(null)},be=i=>{const h=O[i.status];b(i),w({target_status:h[0]??"terminated",reason:"",change_summary:""})},ve=i=>{Q(i),D(null)},_e=(i,h)=>{D({from:i,to:h})},X=(V==null?void 0:V.items)??[],M=Y.isPending||G.isPending,F=!u,Ne=j.name.trim()!=="",ye=(S.name??"").trim()!=="",I=m?O[m.status]:[],J=p.target_status==="suspended",Se=p.target_status==="active",we=!!p.target_status&&(!J||(p.reason??"").trim()!=="");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(se,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold",children:s("aiSuppliers.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("aiSuppliers.subtitle")})]})]}),d&&e.jsxs(N,{onClick:fe,children:[e.jsx(Ae,{className:"w-4 h-4 mr-1"}),s("aiSuppliers.newSupplier")]})]}),e.jsx("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:l,onCh
3ange:i=>t(i.target.value),"aria-label":s("aiSuppliers.filterByStatus"),children:[e.jsx("option",{value:"",children:s("aiSuppliers.filterAllStatuses")}),Ue.map(i=>e.jsx("option",{value:i,children:s(`aiSuppliers.status_${i}`)},i))]})})]}),e.jsx("div",{className:"p-6",children:xe?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(i=>e.jsx(z,{className:"h-24 w-full rounded-lg"},i))}):he?e.jsxs("div",{className:"text-center py-16 text-muted-foreground",children:[e.jsx(Pe,{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(N,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>ge(),children:s("common.retry","Reintentar")})]}):X.length===0?e.jsxs("div",{className:"text-center py-16 text-muted-foreground",children:[e.jsx(se,{className:"h-12 w-12 mx-auto mb-3 opacity-40"}),e.jsx("p",{className:"font-medium",children:s("aiSuppliers.empty")}),e.jsx("p",{className:"text-sm mt-1",children:s("aiSuppliers.emptyHint")})]}):e.jsx("div",{className:"space-y-3",children:X.map(i=>e.jsx(He,{supplier:i,canManage:d,onEdit:()=>je(i),onTransition:()=>be(i),onHistory:()=>ve(i)},i.id))})}),r&&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-2xl 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",children:[e.jsx("h3",{className:"text-base font-semibold",children:s(F?"aiSuppliers.newSupplier":"aiSuppliers.editTitle")}),e.jsx("button",{onClick:E,className:"p-1 rounded text-muted-foreground hover:text-foreground","aria-label":s("common.close","Cerrar"),children:e.jsx($,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"p-6 space-y-4",children:F?e.jsx($e,{form:j,onChange:x,subProcessorsText:y,onSubProcessorsChange:c}):e.jsx(Be,{form:S,onChange:P,subProcessorsText:y,onSubProcessorsChange:c})}),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(N,{variant:"ghost",onClick:E,disabled:M,children:s("common.cancel")}),e.jsxs(N,{onClick:()=>F?Y.mutate():G.mutate(),disabled:M||(F?!Ne:!ye),children:[M&&e.jsx(re,{className:"h-3 w-3 mr-1 animate-spin"}),s(F?"aiSuppliers.create":"aiSuppliers.update")]})]})]})}),m&&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("aiSuppliers.transitionTitle")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:m.name})]}),e.jsx("button",{onClick:()=>b(null),className:"p-1 rounded text-muted-foreground hover:text-foreground","aria-label":s("common.close","Cerrar"),children:e.jsx($,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"p-6 space-y-4",children:I.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("aiSuppliers.noTransitions")}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs(n,{htmlFor:"tr-status",className:"text-xs",children:[s("aiSuppliers.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:p.target_status,onChange:i=>w({...p,target_status:i.target.value,reason:""}),children:I.map(i=>e.jsx("option",{value:i,children:s(`aiSuppliers.status_${i}`)},i))})]}),Se&&m.dpa_missing&&e.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive",children:[e.jsx(de,{className:"h-3.5 w-3.5 mt-0.5 flex-shrink-0"}),e.jsx("span",{children:s("aiSuppliers.activateNeedsDpaHint")})]}),J&&e.jsxs("div",{children:[e.jsxs(n,{htmlFor:"tr-reason",className:"text-xs",children:[s("aiSuppliers.fieldTransitionReason")," ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx("textarea",{id:"tr-reason",rows:3,className:"mt-1 w-full px-3 py-2 text-sm border border-border rounded bg-background",placeholder:s("aiSuppliers.transitionReasonPlaceholder"),value:p.reason??"",onChange:i=>w({...p,reason:i.target.value})})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"tr-summary",className:"text-xs",children:s("aiSuppliers.fieldChangeSummary")}
3),e.jsx(o,{id:"tr-summary",className:"mt-1 text-sm",placeholder:s("aiSuppliers.changeSummaryPlaceholder"),value:p.change_summary??"",onChange:i=>w({...p,change_summary:i.target.value})})]})]})}),I.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(N,{variant:"ghost",onClick:()=>b(null),disabled:q.isPending,children:s("common.cancel")}),e.jsxs(N,{onClick:()=>q.mutate(),disabled:q.isPending||!we,children:[q.isPending&&e.jsx(re,{className:"h-3 w-3 mr-1 animate-spin"}),s("aiSuppliers.transitionButton")]})]})]})}),T&&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(R,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("h3",{className:"text-base font-semibold",children:s("aiSuppliers.versionHistory")}),e.jsx(ne,{variant:"outline",className:"text-xs font-mono",children:T.slug})]}),e.jsx("button",{onClick:()=>{Q(null),D(null)},className:"p-1 rounded text-muted-foreground hover:text-foreground","aria-label":s("common.close","Cerrar"),children:e.jsx($,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex-1 overflow-auto p-6",children:L?e.jsx(Oe,{supplierId:T.id,fromVersionId:L.from,toVersionId:L.to,onBack:()=>D(null)}):e.jsx(ze,{supplierId:T.id,onCompare:_e})})]})})]})}function He({supplier:s,canManage:a,onEdit:d,onTransition:l,onHistory:t}){const{t:r}=k(),u=O[s.status].length===0,f=s.is_platform_managed;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(Me,{status:s.status,label:r(`aiSuppliers.status_${s.status}`)}),e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-secondary text-secondary-foreground border border-border",children:r(`aiSuppliers.type_${s.supplier_type}`)}),f&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium bg-blue-100 text-blue-700 border border-blue-300 dark:bg-blue-900/20 dark:text-blue-400 dark:border-blue-800",children:[e.jsx(Te,{className:"h-3 w-3"}),r("aiSuppliers.platformManagedBadge")]}),e.jsx("h3",{className:"font-medium text-foreground",children:s.name}),s.slug&&e.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:["(",s.slug,")"]})]}),(s.dpa_missing||s.transfer_unprotected||s.is_expired)&&e.jsxs("div",{className:"flex flex-wrap gap-2 mt-2",children:[s.dpa_missing&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium bg-destructive/10 text-destructive border border-destructive/30",children:[e.jsx(de,{className:"h-3 w-3"}),r("aiSuppliers.flagDpaMissing")]}),s.transfer_unprotected&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium bg-amber-100 text-amber-700 border border-amber-300 dark:bg-amber-900/20 dark:text-amber-400 dark:border-amber-800",children:[e.jsx(te,{className:"h-3 w-3"}),r("aiSuppliers.flagTransferUnprotected")]}),s.is_expired&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium bg-orange-100 text-orange-700 border border-orange-300 dark:bg-orange-900/20 dark:text-orange-400 dark:border-orange-800",children:[e.jsx(te,{className:"h-3 w-3"}),r("aiSuppliers.flagExpired")]})]}),s.description&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:s.description}),e.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-muted-foreground flex-wrap",children:[s.country&&e.jsxs("span",{children:[e.jsxs("span",{className:"font-medium",children:[r("aiSuppliers.fieldCountry"),":"]})," ",s.country]}),s.transfer_mechanism&&e.jsxs("span",{children:[e.jsxs("span",{className:"font-medium",children:[r("aiSuppliers.fieldTransferMechanism"),":"]})," ",r(`aiSuppliers.transfer_${s.transfer_mechanism}`)]}),s.dpa_signed_at&&e.jsxs("span",{children:[e.jsxs("span",{className:"font-medium",children:[r("aiSuppliers.fieldDpaSignedAt"),":"]})," ",new Date(s.dpa_signed_at).toLocaleDateString()]}),s.renewal_due_at&&e.jsxs("span",{children:[e.jsxs("span",{className:"font-medium",children:[r("aiSuppliers.fieldRenewalDueAt"),":"]})," ",new Date(s.renewal_due_at).toLocaleDateString()]}),s.dpa_url&&e.jsxs("a",{href:s.dpa_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-primary hover:underline",children:[e.jsx(De,{className:"h-3 w-3"}),r("aiSuppliers.fieldDpaUrl")]}),s.contact_email&&e.jsxs("span",{children:[e.jsxs("span",{className:"font-medium",children:[r("aiSuppliers.fieldContactEmail"),":"]})," ",s.contact_email]}),s.suspended_reason&&e.jsxs("span",{className:"text-amber-600 dar
3k:text-amber-400",children:[r("aiSuppliers.suspendedReason"),": ",s.suspended_reason]})]}),f&&Array.isArray(s.sub_processors)&&s.sub_processors.length>0&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-border",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-1.5",children:r("aiSuppliers.subProcessors")}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.sub_processors.map((j,x)=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs bg-muted text-muted-foreground border border-border",children:[j.name,j.country&&e.jsx("span",{className:"font-mono text-xs opacity-70",children:j.country})]},x))})]})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx("button",{onClick:t,className:"p-1.5 rounded text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors",title:r("aiSuppliers.versionHistory"),children:e.jsx(R,{className:"h-3.5 w-3.5"})}),a&&!f&&e.jsxs(e.Fragment,{children:[!u&&e.jsx("button",{onClick:l,className:"px-2 py-1 text-xs rounded border border-border text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors",title:r("aiSuppliers.transitionButton"),children:r("aiSuppliers.transitionTo")}),e.jsx("button",{onClick:d,className:"p-1.5 rounded text-muted-foreground hover:text-indigo-600 dark:hover:text-indigo-400 transition-colors",title:r("aiSuppliers.editTitle"),children:e.jsx(qe,{className:"h-3.5 w-3.5"})})]})]})]})})}function me({dpaSignedAt:s,dpaUrl:a,onDpaSignedAtChange:d,onDpaUrlChange:l,renewalDueAt:t,onRenewalDueAtChange:r}){const{t:g}=k();return e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(n,{htmlFor:"f-dpa-signed",className:"text-xs",children:g("aiSuppliers.fieldDpaSignedAt")}),e.jsx(o,{id:"f-dpa-signed",type:"date",className:"mt-1 text-sm",value:s,onChange:u=>d(u.target.value)})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"f-dpa-url",className:"text-xs",children:g("aiSuppliers.fieldDpaUrl")}),e.jsx(o,{id:"f-dpa-url",className:"mt-1 text-sm",placeholder:"https://...",value:a,onChange:u=>l(u.target.value)})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"f-renewal",className:"text-xs",children:g("aiSuppliers.fieldRenewalDueAt")}),e.jsx(o,{id:"f-renewal",type:"date",className:"mt-1 text-sm",value:t,onChange:u=>r(u.target.value)})]})]})}function $e({form:s,onChange:a,subProcessorsText:d,onSubProcessorsChange:l}){const{t}=k();return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs(n,{htmlFor:"f-name",className:"text-xs",children:[t("aiSuppliers.fieldName")," ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(o,{id:"f-name",className:"mt-1",placeholder:t("aiSuppliers.namePlaceholder"),value:s.name,onChange:r=>a({...s,name:r.target.value}),autoFocus:!0})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"f-slug",className:"text-xs",children:t("aiSuppliers.fieldSlug")}),e.jsx(o,{id:"f-slug",className:"mt-1 font-mono text-xs",placeholder:t("aiSuppliers.slugPlaceholder"),value:s.slug??"",onChange:r=>a({...s,slug:r.target.value})})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"f-type",className:"text-xs",children:t("aiSuppliers.fieldType")}),e.jsx("select",{id:"f-type",className:"mt-1 w-full px-3 py-2 text-sm border border-border rounded bg-background",value:s.supplier_type,onChange:r=>a({...s,supplier_type:r.target.value}),children:ce.map(r=>e.jsx("option",{value:r,children:t(`aiSuppliers.type_${r}`)},r))})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"f-desc",className:"text-xs",children:t("aiSuppliers.fieldDescription")}),e.jsx("textarea",{id:"f-desc",rows:2,className:"mt-1 w-full px-3 py-2 text-sm border border-border rounded bg-background",value:s.description??"",onChange:r=>a({...s,description:r.target.value})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(n,{htmlFor:"f-country",className:"text-xs",children:t("aiSuppliers.fieldCountry")}),e.jsx(o,{id:"f-country",className:"mt-1 text-sm font-mono",placeholder:"US",maxLength:2,value:s.country??"",onChange:r=>a({...s,country:r.target.value.toUpperCase()})})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"f-transfer",className:"text-xs",children:t("aiSuppliers.fieldTransferMechanism")}),e.jsxs("select",{id:"f-transfer",className:"mt-1 w-full px-3 py-2 text-sm border border-border rounded bg-background",value:s.transfer_mechanism??"",onChange:r=>a({...s,transfer_mechanism:r.target.value?r.target.value:void 0}),children:[e.jsx("option",{value:"",children:"—"}),oe.map(r=>e.jsx("option",{value:r,children:t(`aiSuppliers.transfer_${r}`)},r))]})]})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"f-adequacy",className:"text-xs",children:t("aiSuppliers.fieldAdequacyReference")}),e.jsx(o,{id:"f-adequacy",className:"mt-1 text-sm",placeholder:t("aiSuppliers.adequacyReferencePlaceholder"),value:s.adequacy_reference??"",onChange:r=>a({...s,adequacy_reference:r.target.value})})]}),e.jsx(me,{dpaSignedAt:s.dpa_signed_at??"",dpaUrl:s.dpa_url??"",onDpaSignedAtChange:r=>a({...s,dpa_signed_at:r}),onDpaUrlChange:r=>a({...s,dpa_url:r}),renewalDueAt:s.renewal_due_at??"",onRenewalDueAtChange:r=>a({...s,renewal_due_at:r})}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(n,{htmlFor:"f-sccs-signed",className:"text-xs",children:t("aiSuppliers.fieldSccsSignedAt")}),e.jsx(o,{id:"f-sccs-signed",type:"date",className:"mt-1 text-sm",value:s.sccs_signed_at??"",onChange:r=>a({...s,sccs_signed_at:r.target.value})})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"f-sccs-url",className:"text-xs",children:t("aiSuppliers.fieldSccsUrl")}),e.jsx(o,{id:"f-sccs-url",className:"mt-1 text-sm",placeholder:"https://...",value:s.sccs_url??"",onChange:r=>a({...s,sccs_url:r.target.value})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(n,{htmlFor:"f-tia-done",className:"text-xs",children:t("aiSuppliers.fieldTiaDoneAt")}),e.jsx(o,{id:"f-tia-done",type:"date",className:"mt-1 text-sm",value:s.tia_done_at??"",onChange:r=>a({...s,tia_done_at:r.target.value})})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"f-tia-outcome",className:"text-xs",children:t("aiSuppliers.fieldTiaOutcome")}
3),e.jsxs("select",{id:"f-tia-outcome",className:"mt-1 w-full px-3 py-2 text-sm border border-border rounded bg-background",value:s.tia_outcome??"",onChange:r=>a({...s,tia_outcome:r.target.value?r.target.value:void 0}),children:[e.jsx("option",{value:"",children:"—"}),ue.map(r=>e.jsx("option",{value:r,children:t(`aiSuppliers.tia_${r}`)},r))]})]})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"f-tia-url",className:"text-xs",children:t("aiSuppliers.fieldTiaUrl")}),e.jsx(o,{id:"f-tia-url",className:"mt-1 text-sm",placeholder:"https://...",value:s.tia_url??"",onChange:r=>a({...s,tia_url:r.target.value})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(n,{htmlFor:"f-model-card",className:"text-xs",children:t("aiSuppliers.fieldModelCardUrl")}),e.jsx(o,{id:"f-model-card",className:"mt-1 text-sm",placeholder:"https://...",value:s.model_card_url??"",onChange:r=>a({...s,model_card_url:r.target.value})})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"f-email",className:"text-xs",children:t("aiSuppliers.fieldContactEmail")}),e.jsx(o,{id:"f-email",type:"email",className:"mt-1 text-sm",placeholder:"[email protected]",value:s.contact_email??"",onChange:r=>a({...s,contact_email:r.target.value})})]})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"f-subproc",className:"text-xs",children:t("aiSuppliers.fieldSubProcessors")}),e.jsx("textarea",{id:"f-subproc",rows:3,className:"mt-1 w-full px-3 py-2 text-sm border border-border rounded bg-background font-mono",placeholder:t("aiSuppliers.subProcessorsPlaceholder"),value:d,onChange:r=>l(r.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t("aiSuppliers.subProcessorsHint")})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"f-owner",className:"text-xs",children:t("aiSuppliers.fieldOwner")}),e.jsx(o,{id:"f-owner",className:"mt-1 text-sm font-mono text-xs",placeholder:t("aiSuppliers.ownerPlaceholder"),value:s.owner_user_id??"",onChange:r=>a({...s,owner_user_id:r.target.value})})]})]})}function Be({form:s,onChange:a,subProcessorsText:d,onSubProcessorsChange:l}){const{t}=k();return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs(n,{htmlFor:"u-name",className:"text-xs",children:[t("aiSuppliers.fieldName")," ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(o,{id:"u-name",className:"mt-1",value:s.name??"",onChange:r=>a({...s,name:r.target.value}),autoFocus:!0})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"u-type",className:"text-xs",children:t("aiSuppliers.fieldType")}),e.jsx("select",{id:"u-type",className:"mt-1 w-full px-3 py-2 text-sm border border-border rounded bg-background",value:s.supplier_type??"model_provider",onChange:r=>a({...s,supplier_type:r.target.value}),children:ce.map(r=>e.jsx("option",{value:r,children:t(`aiSuppliers.type_${r}`)},r))})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"u-desc",className:"text-xs",children:t("aiSuppliers.fieldDescription")}),e.jsx("textarea",{id:"u-desc",rows:2,className:"mt-1 w-full px-3 py-2 text-sm border border-border rounded bg-background",value:s.description??"",onChange:r=>a({...s,description:r.target.value})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(n,{htmlFor:"u-country",className:"text-xs",children:t("aiSuppliers.fieldCountry")}),e.jsx(o,{id:"u-country",className:"mt-1 text-sm font-mono",placeholder:"US",maxLength:2,value:s.country??"",onChange:r=>a({...s,country:r.target.value.toUpperCase()})})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"u-transfer",className:"text-xs",children:t("aiSuppliers.fieldTransferMechanism")}),e.jsxs("select",{id:"u-transfer",className:"mt-1 w-full px-3 py-2 text-sm border border-border rounded bg-background",value:s.transfer_mechanism??"",onChange:r=>a({...s,transfer_mechanism:r.target.value?r.target.value:void 0}),children:[e.jsx("option",{value:"",children:"—"}),oe.map(r=>e.jsx("option",{value:r,children:t(`aiSuppliers.transfer_${r}`)},r))]})]})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"u-adequacy",className:"text-xs",children:t("aiSuppliers.fieldAdequacyReference")}),e.jsx(o,{id:"u-adequacy",className:"mt-1 text-sm",placeholder:t("aiSuppliers.adequacyReferencePlaceholder"),value:s.adequacy_reference??"",onChange:r=>a({...s,adequacy_reference:r.target.value})})]}),e.jsx(me,{dpaSignedAt:s.dpa_signed_at??"",dpaUrl:s.dpa_url??"",onDpaSignedAtChange:r=>a({...s,dpa_signed_at:r}),onDpaUrlChange:r=>a({...s,dpa_url:r}),renewalDueAt:s.renewal_due_at??"",onRenewalDueAtChange:r=>a({...s,renewal_due_at:r})}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(n,{htmlFor:"u-sccs-signed",className:"text-xs",children:t("aiSuppliers.fieldSccsSignedAt")}),e.jsx(o,{id:"u-sccs-signed",type:"date",className:"mt-1 text-sm",value:s.sccs_signed_at??"",onChange:r=>a({...s,sccs_signed_at:r.target.value})})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"u-sccs-url",className:"text-xs",children:t("aiSuppliers.fieldSccsUrl")}),e.jsx(o,{id:"u-sccs-url",className:"mt-1 text-sm",placeholder:"https://...",value:s.sccs_url??"",onChange:r=>a({...s,sccs_url:r.target.value})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(n,{htmlFor:"u-tia-done",className:"text-xs",children:t("aiSuppliers.fieldTiaDoneAt")}),e.jsx(o,{id:"u-tia-done",type:"date",className:"mt-1 text-sm",value:s.tia_done_at??"",onChange:r=>a({...s,tia_done_at:r.target.value})})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"u-tia-outcome",className:"text-xs",children:t("aiSuppliers.fieldTiaOutcome")}
3),e.jsxs("select",{id:"u-tia-outcome",className:"mt-1 w-full px-3 py-2 text-sm border border-border rounded bg-background",value:s.tia_outcome??"",onChange:r=>a({...s,tia_outcome:r.target.value?r.target.value:void 0}),children:[e.jsx("option",{value:"",children:"—"}),ue.map(r=>e.jsx("option",{value:r,children:t(`aiSuppliers.tia_${r}`)},r))]})]})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"u-tia-url",className:"text-xs",children:t("aiSuppliers.fieldTiaUrl")}),e.jsx(o,{id:"u-tia-url",className:"mt-1 text-sm",placeholder:"https://...",value:s.tia_url??"",onChange:r=>a({...s,tia_url:r.target.value})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(n,{htmlFor:"u-model-card",className:"text-xs",children:t("aiSuppliers.fieldModelCardUrl")}),e.jsx(o,{id:"u-model-card",className:"mt-1 text-sm",placeholder:"https://...",value:s.model_card_url??"",onChange:r=>a({...s,model_card_url:r.target.value})})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"u-email",className:"text-xs",children:t("aiSuppliers.fieldContactEmail")}),e.jsx(o,{id:"u-email",type:"email",className:"mt-1 text-sm",placeholder:"[email protected]",value:s.contact_email??"",onChange:r=>a({...s,contact_email:r.target.value})})]})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"u-subproc",className:"text-xs",children:t("aiSuppliers.fieldSubProcessors")}),e.jsx("textarea",{id:"u-subproc",rows:3,className:"mt-1 w-full px-3 py-2 text-sm border border-border rounded bg-background font-mono",placeholder:t("aiSuppliers.subProcessorsPlaceholder"),value:d,onChange:r=>l(r.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t("aiSuppliers.subProcessorsHint")})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"u-owner",className:"text-xs",children:t("aiSuppliers.fieldOwner")}),e.jsx(o,{id:"u-owner",className:"mt-1 text-sm font-mono text-xs",placeholder:t("aiSuppliers.ownerPlaceholder"),value:s.owner_user_id??"",onChange:r=>a({...s,owner_user_id:r.target.value})})]}),e.jsxs("div",{children:[e.jsx(n,{htmlFor:"u-summary",className:"text-xs",children:t("aiSuppliers.fieldChangeSummary")}),e.jsx(o,{id:"u-summary",className:"mt-1 text-sm",placeholder:t("aiSuppliers.changeSummaryPlaceholder"),value:s.change_summary??"",onChange:r=>a({...s,change_summary:r.target.value})})]})]})}function Oe({supplierId:s,fromVersionId:a,toVersionId:d,onBack:l}){const{t}=k(),{data:r,isLoading:g,isError:u,refetch:f}=K({queryKey:["ai-suppliers","versions","diff",s,a,d],queryFn:()=>C.diffVersions(s,a,d),staleTime:6e4}),j=r!=null&&r.changed_fields?[...r.changed_fields].sort((x,S)=>x.field.localeCompare(S.field)):[];return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[l&&e.jsxs(N,{variant:"ghost",size:"sm",onClick:l,children:["← ",t("policyVersions.diff.back")]}),e.jsx("h3",{className:"text-sm font-semibold",children:t("policyVersions.diff.title")})]}),r&&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:t("policyVersions.diff.from")}),e.jsxs("span",{className:"font-semibold",children:["v",r.from_version.version_number]}),e.jsx("span",{className:"text-muted-foreground ml-2",children:new Date(r.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:t("policyVersions.diff.to")}),e.jsxs("span",{className:"font-semibold",children:["v",r.to_version.version_number]}),e.jsx("span",{className:"text-muted-foreground ml-2",children:new Date(r.to_version.valid_from).toLocaleDateString()})]})]}),g&&e.jsx(z,{className:"h-40 w-full"}),u&&e.jsxs("div",{className:"text-center py-10 text-muted-foreground",children:[e.jsx("p",{className:"text-sm",children:t("policyVersions.diff.errorLoading")}),e.jsx(N,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>f(),children:t("policyVersions.diff.retry")})]}),!g&&!u&&j.length===0&&e.jsx("div",{className:"text-center py-10 text-muted-foreground text-sm",children:t("policyVersions.diff.noDifferences")}),!g&&!u&&j.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:t("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:t("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:t("policyVersions.diff.colAfter")})]})}),e.jsx("tbody",{children:j.map(x=>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:x.field})}),e.jsx("td",{className:"px-3 py-2.5 align-top bg-red-50/60 dark:bg-red-950/20 text-xs",children:x.from===null||x.from===void 0?e.jsx("em",{className:"text-muted-foreground",children:"—"}):String(x.from)}),e.jsx("td",{className:"px-3 py-2.5 align-top bg-green-50/60 dark:bg-green-950/20 text-xs",children:x.to===null||x.to===void 0?e.jsx("em",{className:"text-muted-foreground",children:"—"}):String(x.to)})]},x.field))})]})})]})}function ze({supplierId:s,onCompare:a}){var y;const{t:d}=k(),[l,t]=v.useState([]),{data:r,isLoading:g,isError:u,refetch:f}=K({queryKey:["ai-suppliers","versions",s],queryFn:()=>C.listVersions(s),staleTime:3e4});if(g)return e.jsx("div",{className:"space-y-3",children:[1,2,3].map(c=>e.jsx(z,{className:"h-16 w-full rounded-lg"},c))});if(u)return e.jsxs("div",{className:"text-center py-10 text-muted-foreground",children:[e.jsx(R,{className:"h-10 w-10 mx-auto mb-3 opacity-40"}),e.jsx("p",{className:"text-sm",children:d("policyVersions.timeline.errorLoading")}),e.jsx(N,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>f(),children:d("policyVersions.timeline.retry")})]});if(!((y=r==null?void 0:r.items)!=null&&y.length))return e.jsxs("div",{className:"text-center py-10 text-muted-foreground",children:[e.jsx(R,{className:"h-10 w-10 mx-auto mb-3 opacity-40"}),e.jsx("p",{className:"text-sm",children:d("policyVersions.timeline.empty")})]});const j=[...r.items].reverse(),x=c=>{t(m=>m.includes(c)?m.filter(b=>b!==c):m.length>=2?[m[1],c]:[...m,c])},S=l.length===2,P=()=>{if(!S)return;const c=r.items.find(w=>w.id===l[0]),m=r.items.find(w=>w.id===l[1]);if(!c||!m)return;const[b,p]=c.version_number<m.version_number?[c.id,m.id]:[m.id,c.id];a(b,p),t([])};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:d("policyVersions.timeline.selectTwoHint")}),e.jsx(N,{size:"sm",variant:"outline",disabled:!S,onClick:P,children:d("policyVersions.timeline.compareSelected")})]}),j.map((c,m)=>{const b=c.valid_to===null,p=l.includes(c.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:B("h-6 w-6 rounded-full border-2 flex items-center justify-center flex-shrink-0 mt-2",b?"bg-primary border-primary text-primary-foreground":p?"bg-blue-100 border-blue-500 dark:bg-blue-900/30":"bg-background border-border")}),m<j.length-1&&e.jsx("div",{className:"w-0.5 flex-1 bg-border mt-1 min-h-[1rem]"})]}),e.jsxs("button",{type:"button",onClick:()=>x(c.id),className:B("flex-1 text-left rounded-lg border p-3 mb-3 transition-colors focus:outline-none focus:ring-2 focus:ring-ring",b?"border-primary bg-primary/5 dark:bg-primary/10":p?"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(ne,{variant:b?"default":"outline",className:"text-xs",children:["v",c.version_number]}),b&&e.jsx("span",{className:"text-xs font-medium text-primary",children:d("policyVersions.timeline.current")})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[new Date(c.valid_from).toLocaleDateString(),c.valid_to&&e.jsxs(e.Fragment,{children:[" → ",new Date(c.valid_to).toLocaleDateString()]})]}),c.change_summary&&e.jsx("p",{className:"text-xs text-foreground mt-1",children:c.change_summary}),c.changed_by_email_at_time&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:c.changed_by_email_at_time})]})]},c.id)})]})}export{ts as default};
4//# sourceMappingURL=AISuppliersPage-CydlzyFg.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.