(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4658],{72912:(e,l,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/version-diff/[id]",function(){return r(25309)}])},25309:(e,l,r)=>{"use strict";r.r(l),r.d(l,{default:()=>w});var t=r(77528),s=r(55456),n=r(74848),i=r(8640),a=r(81924),o=r(72748),c=r(29080),d=r(90407),f=r(28624),u=r(21005),h=r(97080),x=r(90657),v=r(86715),g=r(96540),j=r(82514),m=r.n(j);let w=()=>{let e=(0,v.useRouter)(),{id:l}=e.query,[r,j]=(0,g.useState)([]),[w,p]=(0,g.useState)({left:null,right:null}),[y,_]=(0,g.useState)(!0);(0,g.useEffect)(()=>{(async()=>{if(l)try{let r=await (0,a.TA)(l);j(r);let t=e.query.left?parseInt(e.query.left):null,s=e.query.right?parseInt(e.query.right):null;t&&s?p({left:t,right:s}):r.length>=2&&p({left:r[1].version,right:r[0].version})}catch(e){console.error("Error fetching workflow versions:",e)}finally{_(!1)}})()},[l,e.query]);let N=e=>r.find(l=>l.version===e),S=null!==w.left?N(w.left):null,k=null!==w.right?N(w.right):null;return(0,n.jsxs)("div",{className:"flex flex-col h-screen",children:[(0,n.jsx)(i.A,{activePage:"trace",associatedWorkflowId:l}),(0,n.jsx)("div",{className:"flex-1 p-6 overflow-auto",children:(0,n.jsxs)("div",{className:"max-w-7xl mx-auto space-y-6",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("h1",{className:"text-2xl font-bold",children:"Compare Workflow Versions"}),(0,n.jsx)(o.T,{variant:"light",onPress:()=>e.push("/workflows/".concat(l)),children:"Back to Workflow"})]}),y?(0,n.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,n.jsx)(c.o,{size:"lg"})}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(d.Z,{children:(0,n.jsx)(f.U,{children:(0,n.jsxs)("div",{className:"flex gap-4",children:[(0,n.jsx)("div",{className:"flex-1",children:(0,n.jsx)(u.d,{label:"Base Version",placeholder:"Select a version",selectedKeys:w.left?[w.left.toString()]:[],onChange:e=>p(l=>(0,s._)((0,t._)({},l),{left:parseInt(e.target.value)})),children:r.map((e,l)=>(0,n.jsx)(h.y,{value:e.version.toString(),children:"".concat(0===l?"Current Version":"Version ".concat(e.version)," (").concat((0,x.m)(new Date(e.created_at),{addSuffix:!0}),")")},e.version.toString()))})}),(0,n.jsx)("div",{className:"flex-1",children:(0,n.jsx)(u.d,{label:"Compare Version",placeholder:"Select a version",selectedKeys:w.right?[w.right.toString()]:[],onChange:e=>p(l=>(0,s._)((0,t._)({},l),{right:parseInt(e.target.value)})),children:r.map((e,l)=>(0,n.jsx)(h.y,{value:e.version.toString(),children:"".concat(0===l?"Current Version":"Version ".concat(e.version)," (").concat((0,x.m)(new Date(e.created_at),{addSuffix:!0}),")")},e.version.toString()))})})]})})}),S&&k&&(0,n.jsx)(d.Z,{children:(0,n.jsx)(f.U,{children:(0,n.jsx)(m(),{oldValue:JSON.stringify(S.definition,null,2),newValue:JSON.stringify(k.definition,null,2),splitView:!0,useDarkTheme:!1})})})]})]})})]})}}},e=>{var l=l=>e(e.s=l);e.O(0,[7998,8872,8660,7354,453,3427,657,2514,8640,636,6593,8792],()=>l(72912)),_N_E=e.O()}]);