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