import e from"@babel/runtime/helpers/defineProperty";import t from"prop-types";import i from"moment";import{makeStyles as r,Box as n}from"@material-ui/core";import{convertValue as a,getUnitDisplay as o}from"../../../utils/index.js";import{isNativeDetected as m}from"../../../utils/mobileDetect.js";import{Regular14 as l}from"../../Typography.js";import s from"../../Attachment/index.js";import{formatMentionText as p}from"../../UserMention/utils/index.js";import u from"../../CollapsibleContent.js";import{FEED_ITEM_TYPES as d,GENERIC_DATA_COMMENTS_VALUES_TYPES as c,FEED_ITEM_TIME_FORMAT as f}from"../../../constants/feed.js";import{jsxs as h,jsx as v}from"react/jsx-runtime";var y=r((function(e){return{message:{lineHeight:"20px"},container:{marginBottom:4,lineHeight:"20px"},label:{color:e.palette.primary.text6}}})),b=function(e){var t=e.feedItem,r=y(),b=t.context,g=b[d.GENERIC_DATA_COMMENT],x=g.body,T=g.data,j=b.attachment,N=t.mentioned_users;return h(n,{whiteSpace:"pre-wrap",children:[x&&v(u,{children:v(l,{className:r.message,"data-testid":"".concat("GenericDataCommentFeedItem","_message"),variant:"body1",children:p(x,N,m)})}),v(n,{mt:1,mb:1,children:T&&Object.keys(T).map((function(e){var t,n,m,s,p,u;return h(l,{className:r.container,children:[h("span",{className:r.label,children:[T[e].label,": "]}),[c.string,c.number].includes(T[e].type)&&T[e].value,T[e].type===c.date&&i.unix(+(null==T||null===(t=T[e])||void 0===t?void 0:t.value)).format(f),T[e].type===c.convertable&&"".concat(a(null==T||null===(n=T[e])||void 0===n?void 0:n.value,null==T||null===(m=T[e])||void 0===m?void 0:m.unitType,null==T||null===(s=T[e])||void 0===s?void 0:s.from,o(null==T||null===(p=T[e])||void 0===p?void 0:p.unitType))," ").concat(o(null==T||null===(u=T[e])||void 0===u?void 0:u.unitType))]},e)}))}),j&&j.url&&v(s,{attachmentUrl:j.url,fileName:j.name,attachmentSize:j.size,size:"medium"})]})};b.propTypes={feedItem:t.shape({context:t.shape(e({},d.GENERIC_DATA_COMMENT,t.shape({body:t.string.isRequired,attachment:t.shape({url:t.string,size:t.number}),depth:t.oneOfType([t.string,t.number]),timestamp:t.string.isRequired,data:t.shape({})}).isRequired)).isRequired,mentioned_users:t.arrayOf(t.shape({}))}).isRequired};export{b as default};
//# sourceMappingURL=GenericDataCommentFeedItem.js.map
