import{r as j,j as e,a as o,f as c,gQ as N,gR as R,gS as _,gT as L,gU as z,gV as P,L as d,b$ as I,p as F,h as O,aO as U,e as $,m as W,g as v,ap as u,d as p,c as x,cC as w,T as B,b8 as y,eE as A,bP as M,bQ as S,ao as b,gP as V,fJ as J,h1 as Q,u as q,i as G,bl as H,h2 as Y,ei as g}from"./index-_eM6l4Nf.js";const K=({listData:s,...i})=>{const[n,t]=j.useState(!1),r=()=>{t(h=>!h)},[a,...l]=s;return e.jsxs(o,{...i,children:[e.jsxs(c,{pt:"20px",children:[a,", ..."]}),e.jsxs(N,{isOpen:n,onClose:r,children:[e.jsx(R,{children:e.jsx("div",{style:{marginTop:"15px"},children:e.jsxs(_,{onClick:()=>t(!0),children:["view all ",s.length," new features"]})})}),e.jsxs(L,{children:[e.jsx(z,{}),e.jsx(P,{p:"0",children:e.jsx(d,{maxHeight:"300px",overflow:"auto",children:e.jsx(I,{standalone:!0,padded:!1,children:l.map(h=>e.jsx(I.Row,{fontSize:"12px",p:"4px",sx:{p:"4px !important"},children:e.jsx(I.Cell,{children:e.jsx(c,{children:h})})},h))})})})]})]})]})},X=j.memo(K),Z=({activity:s})=>{const{titleData:i,listData:n}=j.useMemo(()=>F(O(U(":"),t=>{const[r,a]=t.split(":");return{titleData:`${r}:`,listData:a.split(",")}},$({titleData:v,listData:W([])})))(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:p.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:i}),n.length===1&&e.jsx(c,{ml:"5px",pt:"20px",children:n[0]}),n.length>1&&e.jsx(X,{listData:n,ml:"5px"})]}),e.jsx(o,{my:"12px",pr:"20px",children:e.jsx(w,{firstName:s.user.firstname,lastName:s.user.lastname})})]})},ee=({activity:s})=>{var n,t,r,a;const i=B((t=(n=s.job)==null?void 0:n.executions)==null?void 0:t.finalStatus,{SUCCEEDED:{value:"success",variant:"success"},UNDEFINED:{value:"running",variant:"default",loading:!0}})??{value:"error",variant:"fail"};return e.jsxs(o,{bg:"white",height:"56px",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(o,{alignItems:"center",ml:"20px",children:[e.jsx(d,{children:e.jsx(u,{icon:p.job,color:"gray",size:"sm"})}),e.jsx(x,{width:"110px",bold:!0,ml:"8px",gray:!0,children:"Job execution"}),e.jsx(d,{ml:"20px",width:"110px",children:e.jsx(y,{width:"fit-content",...i})}),e.jsxs(c,{ml:"20px",children:["#",(r=s.job)==null?void 0:r.executions.id]}),e.jsx(c,{ml:"20px",children:(a=s.job)==null?void 0:a.name})]}),e.jsx(o,{pr:"20px",children:e.jsx(w,{firstName:s.user.firstname,lastName:s.user.lastname})})]})},se=({rowsDeleted:s,rowsInserted:i,rowsUpdated:n,allRowsCount:t,...r})=>{const a=A(),l=j.useMemo(()=>Math.ceil(s/t*100),[t,s]),h=j.useMemo(()=>l+Math.ceil(n/t*100),[t,n,l]);return e.jsx(d,{...r,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:`${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:a.colors.labels.red,strokeWidth:"7",strokeDasharray:`${l}, 100`})]})})},k=1,D=.1,C=1,T=30,te=1e3*60*60*24,f=s=>s>1e3?`${Math.round(s/1e3)}k`:s,je=(s,i)=>{const t=(s-i)/te;return t>=T?D:t<=C?k:D+(T-t)*((k-D)/(T-C))},ne=({activity:s})=>{const{commit:i}=s,{rowsUpdated:n=0,rowsInserted:t=0,rowsDeleted:r=0,archived:a=!1,commitID:l}=i,h=j.useMemo(()=>M(+l,S.DATE_TIME.DATE_TIME_FULL),[l]),m=r+n+t;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(d,{children:e.jsx(u,{icon:p.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(se,{rowsUpdated:n,rowsDeleted:r,rowsInserted:t,allRowsCount:m})}),e.jsx(x,{ml:"20px",children:"commit"}),e.jsx(c,{ml:"5px",children:h}),e.jsx(c,{ml:"20px",children:f(t)}),e.jsx(x,{ml:"5px",children:"new rows,"}),e.jsx(c,{ml:"5px",children:f(n)}),e.jsx(x,{ml:"5px",children:"updated rows,"}),e.jsx(c,{ml:"5px",children:f(r)}),e.jsx(x,{ml:"5px",children:"deleted rows"})]}),a&&e.jsx(o,{children:e.jsx(b,{mt:"5px",mr:"35px",mainText:"This commit has been archived and cannot be referenced in incremental queries",children:e.jsx(d,{children:e.jsx(u,{icon:p.history,size:"sm"})})})})]})},re=({rowsProcessed:s,rowsSuccessful:i,rowsFailed:n,...t})=>{const r=A(),a=j.useMemo(()=>Math.ceil(i/s*100),[s,i]),l=j.useMemo(()=>a+Math.ceil(n/s*100),[s,n,a]);return e.jsx(d,{...t,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:r.colors.labels.red,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:r.colors.labels.green,strokeWidth:"7",strokeDasharray:`${a}, 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:r.colors.gray,strokeWidth:"7",strokeDasharray:"0, 100"})]})})},ie=({activity:s})=>{const{onlineIngestion:i}=s,{numEntries:n,results:t,id:r}=i,a=t.filter(m=>m.status==="UPSERTED").reduce((m,E)=>m+E.rows,0),l=t.filter(m=>m.status!=="UPSERTED").reduce((m,E)=>m+E.rows,0),h=a+l;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(d,{children:e.jsx(u,{icon:p.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(re,{rowsProcessed:h,rowsSuccessful:a,rowsFailed:l})}),e.jsx(x,{ml:"20px",children:"id"}),e.jsx(c,{ml:"5px",children:r}),e.jsx(c,{ml:"20px",children:f(a+l)}),e.jsx(x,{ml:"5px",children:"rows processed,"}),e.jsx(c,{ml:"5px",children:f(l)}),e.jsx(x,{ml:"5px",children:"failures,"}),n&&e.jsx(c,{ml:"5px",children:f(n)}),n&&e.jsx(x,{ml:"5px",children:"dataset size"})]})})},ae=({activity:s,onButtonClick:i})=>{const n=j.useMemo(()=>M(+(s.statistics.computationTime||s.statistics.commitTime),S.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(d,{children:e.jsx(u,{icon:p.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:n})]}),e.jsxs(o,{pr:"20px",alignItems:"center",children:[i&&e.jsx(d,{mr:"22px",ml:"13px",p:"5px",sx:{cursor:"pointer",backgroundColor:"white",transition:"all .4s ease",":hover":{backgroundColor:"grayShade3"},svg:{width:"16px",height:"16px"}},onClick:()=>i(+s.statistics.computationTime),children:e.jsx(b,{mainText:"open statistics",children:e.jsx(u,{icon:p.stats,size:"lg"})})}),e.jsx(d,{children:e.jsx(w,{firstName:s.user.firstname,lastName:s.user.lastname})})]})]})},le=s=>{const i=/An Expectation Suite was attached to the Feature Group. /,n=/The Expectation Suite was updated. */,t=/The Expectation Suite was deleted. /;let r;return i.test(s)?r="Attached Expectation Suite":n.test(s)?r="Updated Expectation Suite":t.test(s)?r="Deleted Expectation Suite":r="Something went wrong.",r},oe=({activity:s})=>(le(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(d,{children:e.jsx(u,{icon:p.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(w,{firstName:s.user.firstname,lastName:s.user.lastname})})]})),ce=async(s,i)=>{var n,t,r,a;try{await V.download(s,i,J.DATASET)}catch(l){const h=((t=(n=l==null?void 0:l.response)==null?void 0:n.data)==null?void 0:t.usrMsg)||((a=(r=l==null?void 0:l.response)==null?void 0:r.data)==null?void 0:a.errorMsg);Q.error({title:"Error",content:h})}},xe=({activity:s})=>{const{id:i}=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(d,{children:e.jsx(u,{icon:p.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(de,{success:s.validationReport.success})})]}),e.jsx(d,{width:"50px",children:e.jsx(b,{mainText:"Download",children:e.jsx(G,{icon:p.download,onClick:()=>ce(+i,s.validationReport.fullReportPath)})})}),e.jsx(o,{pr:"20px",children:e.jsx(w,{firstName:s.user.firstname,lastName:s.user.lastname})})]})},de=({success:s})=>s?e.jsx(y,{width:"fit-content",mode:"bordered",value:"success",variant:"success"}):e.jsx(y,{width:"fit-content",mode:"bordered",value:"fail",variant:"fail"}),{DATE_TIME_FULL:he}=S.DATE_TIME,pe=s=>{const n=new Map([[g.commit,ne],[g.job,ee],[g.metadata,Z],[g.onlineIngestion,ie],[g.statistics,ae],[g.expectations,oe],[g.validations,xe]]).get(s);return n||null},ue=({activities:s,actions:i,loading:n})=>e.jsx(d,{children:s.map((t,r)=>{const a=r!==s.length-1,l=pe(t.type);return e.jsx(b,{position:H.left,mainText:t.timestamp?M(t.timestamp,he):"",children:e.jsxs(d,{sx:{border:"1px solid",borderColor:"grayShade2",borderBottom:a?"none":""},children:[n&&e.jsx(Y,{children:e.jsx(o,{height:"56px"})}),!!l&&e.jsx(l,{activity:t,onButtonClick:i==null?void 0:i.get(t.type)})]})},`${t==null?void 0:t.timestamp}-${r}`)})});export{ue as A,ce as d,je as g};
