import{ba as h,u as j,r as f,j as e,L as g,q as t,gR as p,c as b,b9 as k,f as v,bt as S,bU as y,x as K}from"./index-DHiyXWqE.js";import{g as N}from"./index-BdIq0ego.js";import{u as B}from"./useKafkaSubjects-LEC0aH1G.js";const q=()=>{var r;const o=h(),{subjectName:s,id:i}=j(),{getSubjectByName:c,isLoading:l}=B(),[n,m]=f.useState(0),a=c(s),{data:u={}}=N({version:a==null?void 0:a.versions[n],subjectName:s,projectId:i},{skip:!a}),d=()=>o(K.project.settings.kafka.view);return l?e.jsx(g,{}):e.jsxs(t,{flexDirection:"column",children:[e.jsx(p,{mr:"auto",mode:"highlight",onClick:d,children:"<- back to all Kafka Schemas"}),e.jsxs(t,{my:"20px",alignItems:"center",children:[e.jsx(b,{fontSize:"18px",gray:!0,mr:"20px",bold:!0,children:s}),e.jsx(k,{value:"Kafka Schema",variant:"light",mode:"bordered",children:"Kafka Schema"})]}),e.jsx(v,{title:"Schema versions",children:e.jsxs(t,{flexDirection:"column",children:[e.jsx(S.Controlled,{mb:"8px",activeTab:n,tabs:(r=a==null?void 0:a.versions)==null?void 0:r.map(x=>({title:`version ${x}`})),onTabChange:m}),e.jsx(y,{copyButton:!0,downloadButton:!0,language:"json",minHeight:"320px",title:`${s}.avsc`,content:JSON.stringify(u,null,4)})]})})]})};export{q as default};
