import{r as m,j as e,q as o,d as c,hK as z,hL as L,gR as P,hM as W,hN as _,hO as v,F as p,cc as D,p as O,g as U,aO as V,e as $,i as B,k as q,ao as u,v as j,c as x,cP as b,Q as G,b9 as M,eB as A,c1 as y,c2 as T,an as I,gU as H,gD as J,gz as K,u as Q,n as X,bu as Z,fI as Y,ef as w}from"./index-DNBEEyYo.js";const ee=({listData:s,...t})=>{const[r,n]=m.useState(!1),i=()=>{n(d=>!d)},[a,...l]=s;return e.jsxs(o,{...t,children:[e.jsxs(c,{pt:"20px",children:[a,", ..."]}),e.jsxs(z,{isOpen:r,onClose:i,children:[e.jsx(L,{children:e.jsx("div",{style:{marginTop:"15px"},children:e.jsxs(P,{onClick:()=>n(!0),children:["view all ",s.length," new features"]})})}),e.jsxs(W,{children:[e.jsx(_,{}),e.jsx(v,{p:"0",children:e.jsx(p,{maxHeight:"300px",overflow:"auto",children:e.jsx(D,{standalone:!0,padded:!1,children:l.map(d=>e.jsx(D.Row,{fontSize:"12px",p:"4px",sx:{p:"4px !important"},children:e.jsx(D.Cell,{children:e.jsx(c,{children:d})})},d))})})})]})]})]})},se=m.memo(ee),te=({activity:s})=>{const{titleData:t,listData:r}=m.useMemo(()=>O(U(V(":"),n=>{const[i,a]=n.split(":");return{titleData:`${i}:`,listData:a.split(",")}},$({titleData:B,listData:q([])})))(s.metadata),[s.metadata]);return e.jsxs(o,{justifyContent:"space-between",bg:"white",alignItems:"start",children:[e.jsxs(o,{alignItems:"start",ml:"20px",children:[e.jsxs(o,{mt:"20px",children:[e.jsx(u,{icon:j.creation,color:"gray",size:"sm"}),e.jsx(x,{width:"120px",bold:!0,ml:"8px",gray:!0,children:"Creation"})]}),e.jsx(c,{pt:"20px",ml:"140px",children:t}),r.length===1&&e.jsx(c,{ml:"5px",pt:"20px",children:r[0]}),r.length>1&&e.jsx(se,{listData:r,ml:"5px"})]}),e.jsx(o,{my:"12px",pr:"20px",children:e.jsx(b,{firstName:s.user.firstname,lastName:s.user.lastname})})]})},F=1,E=.1,N=1,S=30,ne=1e3*60*60*24,f=s=>s>1e3?`${Math.round(s/1e3)}k`:s,fe=(s,t)=>{const n=(s-t)/ne;return n>=S?E:n<=N?F:E+(S-n)*((F-E)/(S-N))},re=({activity:s})=>{var k,C,R;const{executions:t}=s.job??{},r=G((C=(k=s.job)==null?void 0:k.executions)==null?void 0:C.finalStatus,{SUCCEEDED:{value:"success",variant:"success"},UNDEFINED:{value:"running",variant:"default",loading:!0}})??{value:"error",variant:"fail"},n=t==null?void 0:t.totalIngestedRecords,i=t==null?void 0:t.ingestionStartCursorValue,a=t==null?void 0:t.lastIngestionCursorValue,l=i!=null&&String(i)!=="",d=n!=null,h=a!=null&&String(a)!=="",g=l&&h;return e.jsxs(o,{bg:"white",minHeight:"56px",py:"8px",alignItems:"flex-start",justifyContent:"space-between",children:[e.jsxs(o,{flexDirection:"column",ml:"20px",minWidth:0,children:[e.jsxs(o,{alignItems:"center",minWidth:0,children:[e.jsx(p,{children:e.jsx(u,{icon:j.job,color:"gray",size:"sm"})}),e.jsx(x,{width:"110px",bold:!0,ml:"8px",gray:!0,children:"Job execution"}),e.jsx(p,{ml:"20px",width:"110px",children:e.jsx(M,{width:"fit-content",...r})}),e.jsx(o,{ml:"20px",width:"54px",children:e.jsxs(c,{children:["#",t==null?void 0:t.id]})}),e.jsx(c,{ml:"20px",sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"500px"},children:(R=s.job)==null?void 0:R.name})]}),e.jsxs(o,{alignItems:"center",flexWrap:"wrap",mt:"6px",ml:"358px",children:[d&&e.jsxs(e.Fragment,{children:[e.jsx(x,{children:"Ingested"}),e.jsx(c,{ml:"5px",mr:"20px",color:"labels.gray",sx:{fontSize:"12px",fontWeight:400},children:f(n)})]}),g&&e.jsxs(e.Fragment,{children:[e.jsx(x,{children:"Start:"}),e.jsx(c,{ml:"5px",mr:"20px",color:"labels.gray",sx:{fontSize:"12px",fontWeight:400},children:String(i)}),e.jsx(x,{children:"Latest:"}),e.jsx(c,{ml:"5px",color:"labels.gray",sx:{fontSize:"12px",fontWeight:400},children:String(a)})]}),!g&&h&&e.jsxs(e.Fragment,{children:[e.jsx(x,{children:"Last cursor:"}),e.jsx(c,{ml:"5px",color:"labels.gray",sx:{fontSize:"12px",fontWeight:400},children:String(a)})]})]})]}),e.jsx(o,{pr:"20px",pt:"2px",children:e.jsx(b,{firstName:s.user.firstname,lastName:s.user.lastname})})]})},ie=({rowsDeleted:s,rowsInserted:t,rowsUpdated:r,allRowsCount:n,...i})=>{const a=A(),l=m.useMemo(()=>Math.ceil(s/n*100),[n,s]),d=m.useMemo(()=>l+Math.ceil(r/n*100),[n,r,l]);return e.jsx(p,{...i,children:e.jsxs("svg",{width:"22px",height:"22px",viewBox:"-5 -5 45 45",children:[e.jsx("path",{d:`M18 2.0845
      a 15.9155 15.9155 0 0 1 0 31.831
      a 15.9155 15.9155 0 0 1 0 -31.831`,fill:"none",stroke:a.colors.primary,strokeWidth:"7",strokeDasharray:"100, 100"}),e.jsx("path",{d:`M18 2.0845
      a 15.9155 15.9155 0 0 1 0 31.831
      a 15.9155 15.9155 0 0 1 0 -31.831`,fill:"none",stroke:a.colors.labels.orange,strokeWidth:"7",strokeDasharray:`${d}, 100`}),e.jsx("path",{d:`M18 2.0845
      a 15.9155 15.9155 0 0 1 0 31.831
      a 15.9155 15.9155 0 0 1 0 -31.831`,fill:"none",stroke:a.colors.labels.red,strokeWidth:"7",strokeDasharray:`${l}, 100`})]})})},ae=({activity:s})=>{const{commit:t}=s,{rowsUpdated:r=0,rowsInserted:n=0,rowsDeleted:i=0,archived:a=!1,commitID:l}=t,d=m.useMemo(()=>y(+l,T.DATE_TIME.DATE_TIME_FULL),[l]),h=i+r+n;return e.jsxs(o,{bg:a?"grayScale3":"white",height:"56px",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(o,{ml:"20px",sx:{alignItems:"center"},children:[e.jsx(p,{children:e.jsx(u,{icon:j.ingest,color:"gray",size:"sm"})}),e.jsx(x,{width:"110px",bold:!0,ml:"8px",gray:!0,children:"Offline ingestion"}),e.jsx(o,{alignItems:"center",width:"110px",ml:"20px",children:e.jsx(ie,{rowsUpdated:r,rowsDeleted:i,rowsInserted:n,allRowsCount:h})}),e.jsx(x,{ml:"20px",children:"commit"}),e.jsx(c,{ml:"5px",children:d}),e.jsx(c,{ml:"20px",children:f(n)}),e.jsx(x,{ml:"5px",children:"new rows,"}),e.jsx(c,{ml:"5px",children:f(r)}),e.jsx(x,{ml:"5px",children:"updated rows,"}),e.jsx(c,{ml:"5px",children:f(i)}),e.jsx(x,{ml:"5px",children:"deleted rows"})]}),a&&e.jsx(o,{children:e.jsx(I,{mt:"5px",mr:"35px",mainText:"This commit has been archived and cannot be referenced in incremental queries",children:e.jsx(p,{children:e.jsx(u,{icon:j.history,size:"sm"})})})})]})},le=({rowsSuccessful:s,rowsIgnored:t,rowsFailed:r,...n})=>{const i=A(),a=s+t+r,l=m.useMemo(()=>Math.ceil(s/a*100),[a,s]),d=m.useMemo(()=>l+Math.ceil(t/a*100),[a,t,l]),h=m.useMemo(()=>d+Math.ceil(r/a*100),[a,r,d]);return e.jsx(p,{...n,children:e.jsxs("svg",{width:"22px",height:"22px",viewBox:"-5 -5 45 45",children:[e.jsx("path",{d:`M18 2.0845
      a 15.9155 15.9155 0 0 1 0 31.831
      a 15.9155 15.9155 0 0 1 0 -31.831`,fill:"none",stroke:i.colors.labels.red,strokeWidth:"7",strokeDasharray:`${h}, 100`}),e.jsx("path",{d:`M18 2.0845
      a 15.9155 15.9155 0 0 1 0 31.831
      a 15.9155 15.9155 0 0 1 0 -31.831`,fill:"none",stroke:i.colors.labels.yellow,strokeWidth:"7",strokeDasharray:`${d}, 100`}),e.jsx("path",{d:`M18 2.0845
      a 15.9155 15.9155 0 0 1 0 31.831
      a 15.9155 15.9155 0 0 1 0 -31.831`,fill:"none",stroke:i.colors.labels.green,strokeWidth:"7",strokeDasharray:`${l}, 100`}),e.jsx("path",{d:`M18 2.0845
      a 15.9155 15.9155 0 0 1 0 31.831
      a 15.9155 15.9155 0 0 1 0 -31.831`,fill:"none",stroke:i.colors.gray,strokeWidth:"7",strokeDasharray:"0, 100"})]})})},oe=({activity:s})=>{const{onlineIngestion:t}=s,{numEntries:r,results:n,id:i}=t,a=n.filter(h=>h.status==="UPSERTED").reduce((h,g)=>h+g.rows,0),l=n.filter(h=>h.status==="IGNORED").reduce((h,g)=>h+g.rows,0),d=n.filter(h=>h.status==="FAILED").reduce((h,g)=>h+g.rows,0);return e.jsx(o,{bg:"white",height:"56px",alignItems:"center",justifyContent:"space-between",children:e.jsxs(o,{ml:"20px",sx:{alignItems:"center"},children:[e.jsx(p,{children:e.jsx(u,{icon:j.ingest,color:"gray",size:"sm"})}),e.jsx(x,{width:"110px",bold:!0,ml:"8px",gray:!0,children:"Online ingestion"}),e.jsx(o,{alignItems:"center",width:"110px",ml:"20px",children:e.jsx(le,{rowsSuccessful:a,rowsIgnored:l,rowsFailed:d})}),e.jsx(x,{ml:"20px",children:"id"}),e.jsx(c,{ml:"5px",children:i}),e.jsx(x,{ml:"20px"}),r&&e.jsx(x,{ml:"5px",children:"Dataset size:"}),r&&e.jsx(c,{ml:"5px",children:f(r)}),a>0&&e.jsxs(e.Fragment,{children:[e.jsx(x,{ml:"5px",children:"Upserted:"}),e.jsx(c,{ml:"5px",children:f(a)})]}),d>0&&e.jsxs(e.Fragment,{children:[e.jsx(x,{ml:"5px",children:"Failed:"}),e.jsx(c,{ml:"5px",children:f(d)})]}),l>0&&e.jsxs(e.Fragment,{children:[e.jsx(x,{ml:"5px",children:"Ignored:"}),e.jsx(c,{ml:"5px",children:f(l)})]})]})})},ce=({activity:s,onButtonClick:t})=>{const r=m.useMemo(()=>y(+(s.statistics.computationTime||s.statistics.commitTime),T.DATE_TIME.DATE_TIME_FULL),[s]);return e.jsxs(o,{bg:"white",height:"56px",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(o,{ml:"20px",sx:{alignItems:"center"},children:[e.jsx(p,{children:e.jsx(u,{icon:j.new_stats,color:"gray",size:"sm"})}),e.jsx(x,{width:"110px",bold:!0,ml:"8px",gray:!0,children:"New statistics"}),e.jsx(x,{ml:"150px",children:"commit"}),e.jsx(c,{ml:"5px",children:r})]}),e.jsxs(o,{pr:"20px",alignItems:"center",children:[t&&e.jsx(p,{mr:"22px",ml:"13px",p:"5px",sx:{cursor:"pointer",backgroundColor:"white",transition:"all .4s ease",":hover":{backgroundColor:"grayShade3"},svg:{width:"16px",height:"16px"}},onClick:()=>t(+s.statistics.computationTime),children:e.jsx(I,{mainText:"open statistics",children:e.jsx(u,{icon:j.stats,size:"lg"})})}),e.jsx(p,{children:e.jsx(b,{firstName:s.user.firstname,lastName:s.user.lastname})})]})]})},xe=s=>{const t=/An Expectation Suite was attached to the Feature Group. /,r=/The Expectation Suite was updated. */,n=/The Expectation Suite was deleted. /;let i;return t.test(s)?i="Attached Expectation Suite":r.test(s)?i="Updated Expectation Suite":n.test(s)?i="Deleted Expectation Suite":i="Something went wrong.",i},de=({activity:s})=>(xe(s.metadata),e.jsxs(o,{bg:"white",height:"56px",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(o,{alignItems:"center",ml:"20px",children:[e.jsx(p,{children:e.jsx(u,{icon:j.glass,color:"gray",size:"sm"})}),e.jsx(x,{width:"110px",bold:!0,ml:"8px",gray:!0,children:"Expectations"}),e.jsx(c,{ml:"20px",children:s.metadata})]}),e.jsx(o,{pr:"20px",children:e.jsx(b,{firstName:s.user.firstname,lastName:s.user.lastname})})]})),he=async(s,t)=>{var r,n,i,a;try{await H.download(s,t,J.DATASET)}catch(l){const d=((n=(r=l==null?void 0:l.response)==null?void 0:r.data)==null?void 0:n.usrMsg)||((a=(i=l==null?void 0:l.response)==null?void 0:i.data)==null?void 0:a.errorMsg);K.error({title:"Error",content:d})}},pe=({activity:s})=>{const{id:t}=Q();return s.validationReport.success,e.jsxs(o,{bg:"white",height:"56px",alignItems:"center",children:[e.jsxs(o,{flex:"1",alignItems:"center",ml:"20px",children:[e.jsx(p,{children:e.jsx(u,{icon:j.data_validation,size:"sm"})}),e.jsx(x,{width:"110px",bold:!0,ml:"8px",gray:!0,children:"Validation Report"}),e.jsx(c,{ml:"20px",children:"Data Validation Result :"}),e.jsx(c,{ml:"20px",children:e.jsx(me,{success:s.validationReport.success})})]}),e.jsx(p,{width:"50px",children:e.jsx(I,{mainText:"Download",children:e.jsx(X,{icon:j.download,onClick:()=>he(+t,s.validationReport.fullReportPath)})})}),e.jsx(o,{pr:"20px",children:e.jsx(b,{firstName:s.user.firstname,lastName:s.user.lastname})})]})},me=({success:s})=>s?e.jsx(M,{width:"fit-content",mode:"bordered",value:"success",variant:"success"}):e.jsx(M,{width:"fit-content",mode:"bordered",value:"fail",variant:"fail"}),{DATE_TIME_FULL:je}=T.DATE_TIME,ue=s=>{const r=new Map([[w.commit,ae],[w.job,re],[w.metadata,te],[w.onlineIngestion,oe],[w.statistics,ce],[w.expectations,de],[w.validations,pe]]).get(s);return r||null},we=({activities:s,actions:t,loading:r})=>e.jsx(p,{children:s.map((n,i)=>{const a=i!==s.length-1,l=ue(n.type);return e.jsx(I,{position:Z.left,mainText:n.timestamp?y(n.timestamp,je):"",children:e.jsxs(p,{sx:{border:"1px solid",borderColor:"grayShade2",borderBottom:a?"none":""},children:[r&&e.jsx(Y,{children:e.jsx(o,{height:"56px"})}),!!l&&e.jsx(l,{activity:n,onButtonClick:t==null?void 0:t.get(n.type)})]})},`${n==null?void 0:n.timestamp}-${i}`)})});export{we as A,he as d,fe as g};
