(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4658],{59200:(e,l,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/version-diff/[id]",function(){return r(90948)}])},90948:(e,l,r)=>{"use strict";r.r(l),r.d(l,{default:()=>w});var t=r(3576),s=r(62701),n=r(37876),i=r(22196),a=r(14107),o=r(33810),c=r(33949),d=r(33566),f=r(9941),u=r(38892),h=r(89099),x=r(14232),v=r(48338),g=r.n(v),j=r(93010),m=r(7700);let w=()=>{let e=(0,h.useRouter)(),{id:l}=e.query,[r,v]=(0,x.useState)([]),[w,p]=(0,x.useState)({left:null,right:null}),[y,_]=(0,x.useState)(!0);(0,x.useEffect)(()=>{(async()=>{if(l)try{let r=await (0,m.TA)(l);v(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)(j.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)(i.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)(a.o,{size:"lg"})}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.Z,{children:(0,n.jsx)(c.U,{children:(0,n.jsxs)("div",{className:"flex gap-4",children:[(0,n.jsx)("div",{className:"flex-1",children:(0,n.jsx)(d.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)(f.y,{value:e.version.toString(),children:"".concat(0===l?"Current Version":"Version ".concat(e.version)," (").concat((0,u.m)(new Date(e.created_at),{addSuffix:!0}),")")},e.version.toString()))})}),(0,n.jsx)("div",{className:"flex-1",children:(0,n.jsx)(d.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)(f.y,{value:e.version.toString(),children:"".concat(0===l?"Current Version":"Version ".concat(e.version)," (").concat((0,u.m)(new Date(e.created_at),{addSuffix:!0}),")")},e.version.toString()))})})]})})}),S&&k&&(0,n.jsx)(o.Z,{children:(0,n.jsx)(c.U,{children:(0,n.jsx)(g(),{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,[5352,6361,2377,5892,9235,9177,8892,8338,3010,636,6593,8792],()=>l(59200)),_N_E=e.O()}]);