import{a5 as V,an as I,c as N,u as D,bg as b,j as A,ba as w,G as T,al as O,v as U,i as G,aS as J,aP as x,D as _}from"./index-26FXPGkN.js";var L=1/0;function B(s,e){return V(I(s,e),L)}const C="_comment_8d7vm_1",F="_copy_8d7vm_9",k="_message_8d7vm_47",z="_author_8d7vm_64",E="_action_8d7vm_72",Q="_edit_8d7vm_79",R="_time_8d7vm_86",v={comment:C,copy:F,message:k,author:z,action:E,edit:Q,time:R},M=s=>{var n;const e=N.c(23),{activity:t,description:a,actions:o}=s,{t:h}=D(),{formatDate:d}=b(),f=(n=t.Author)==null?void 0:n.Name;let i;e[0]!==f?(i=A.jsx("p",{className:v.author,children:f}),e[0]=f,e[1]=i):i=e[1];let y;e[2]!==t.Updated||e[3]!==h?(y=t.Updated&&A.jsx("p",{className:v.edit,children:h("activities.edit")}),e[2]=t.Updated,e[3]=h,e[4]=y):y=e[4];let r;e[5]!==a?(r=a&&A.jsxs("p",{className:v.action,children:[a.action," ",A.jsx("b",{children:a.predicate})]}),e[5]=a,e[6]=r):r=e[6];let c;e[7]!==i||e[8]!==y||e[9]!==r?(c=A.jsxs(T,{gap:4,children:[i,y,r]}),e[7]=i,e[8]=y,e[9]=r,e[10]=c):c=e[10];let l;e[11]!==t.Timestamp||e[12]!==d?(l=t.Timestamp&&d(t.Timestamp,{useTimezone:!0,format:"longWithTime"}),e[11]=t.Timestamp,e[12]=d,e[13]=l):l=e[13];let m;e[14]!==l?(m=A.jsx("p",{className:v.time,children:l}),e[14]=l,e[15]=m):m=e[15];let u;e[16]!==a?(u=a&&a.type&&A.jsx(w,{color:"gray.5",size:"sm",radius:"sm",children:a.type}),e[16]=a,e[17]=u):u=e[17];let p;return e[18]!==o||e[19]!==c||e[20]!==m||e[21]!==u?(p=A.jsxs(T,{gap:14,align:"center",children:[c,m,u,o]}),e[18]=o,e[19]=c,e[20]=m,e[21]=u,e[22]=p):p=e[22],p},P=(s,e)=>{const t=N.c(16);let a;t[0]!==s||t[1]!==e?(a={taskId:s,types:e},t[0]=s,t[1]=e,t[2]=a):a=t[2];const{data:o,isLoading:h}=O.useGetActivitiesQuery(a);let d;t[3]!==o?(d=U(B(o,q).filter(G)),t[3]=o,t[4]=d):d=t[4];let f;t[5]!==d?(f={ids:d},t[5]=d,t[6]=f):f=t[6];const{data:i,isLoading:y}=J.useGetByIdQuery(f);let r;t[7]!==i?(r=n=>(Array.isArray(n)?n:n?[n]:[]).map(j=>_(i,["Id",j])).filter(Boolean),t[7]=i,t[8]=r):r=t[8];const c=r;let l;t[9]!==o||t[10]!==c||t[11]!==i?(l=(o==null?void 0:o.map(n=>({...n,Author:_(i,["Id",n.AuthorId]),...n.Type===x.IActivityType.AssignTask?{Json:{...n.Json,Changes:n.Json.Changes.map(g=>({...g,OldValue:c(g.OldValue),NewValue:c(g.NewValue)}))}}:{}})))||[],t[9]=o,t[10]=c,t[11]=i,t[12]=l):l=t[12];const m=l,u=h||y;let p;return t[13]!==m||t[14]!==u?(p={data:m,isLoading:u},t[13]=m,t[14]=u,t[15]=p):p=t[15],p};function $(s){return[...Array.isArray(s.OldValue)?s.OldValue:[s.OldValue],...Array.isArray(s.NewValue)?s.NewValue:[s.NewValue]]}function q(s){return s.Type===x.IActivityType.AssignTask?[s.AuthorId,s.Json.Changes.map($)]:[s.AuthorId]}export{M as A,v as s,P as u};
