"use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("classnames"),n=require("moment"),i=require("lodash"),r=require("@material-ui/core"),a=require("@material-ui/icons/ThumbUp"),s=require("@material-ui/icons/Comment"),o=require("../../../utils/nativeMessages.js"),u=require("../../../utils/mobileDetect.js"),l=require("../../CommentsInfo/index.js"),m=require("../../../utils/main.js"),c=require("react/jsx-runtime");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=d(e),f=d(t),x=d(n),g=d(a),C=d(s),h=r.makeStyles({reactionButton:{padding:8},reactions:{minHeight:48,marginTop:5,display:"flex",alignItems:"center",padding:"8px 16px 8px 24px",flexWrap:"wrap"},reactionsNative:{padding:"0 16px"},actions:{display:"flex",marginRight:30,alignItems:"center"}}),v=u.isNativeDetected?2:3;module.exports=function(e){var t=e.feedItem,n=e.currentUser,a=e.setOpenCommentInput,s=e.setOpenCommentList,d=e.openCommentInput,q=e.openCommentList,j=e.handleToggleLike,k=e.extraActions,N=r.useTheme(),y=h(),I=t.likes_count,B=t.comments.length,b=(t.likes||[]).find((function(e){var t;return(null===(t=e.user)||void 0===t?void 0:t.id)===n.id})),L=(t.likes||[]).map((function(e){return m.default.getUserFullName(e.user)})),F=i.uniq((t.comments||[]).map((function(e){return m.default.getUserFullName(e.user)}))),U=i.uniqBy((t.comments||[]).concat(t.likes||[]).map((function(e){return e.user})).sort((function(e){return x.default(e.created_at).unix()})),"id").slice(0,v),D=!d||!q;return c.jsx("div",{className:f.default(y.reactions,p.default({},y.reactionsNative,u.isNativeDetected)),children:c.jsxs("div",{className:y.actions,children:[c.jsx(r.IconButton,{"data-testid":"".concat("FeedPo","_likeButton"),"aria-label":"Like",onClick:j,className:y.reactionButton,children:c.jsx(g.default,{htmlColor:b?N.palette.primary.main:N.palette.grey[400]})}),c.jsx(r.IconButton,{"data-testid":"".concat("FeedPo","_commentButton"),"aria-label":"Comment",onClick:function(){u.isNativeDetected?o.notifyOpenFeedCommentInput(t.id):(a(D),s(D))},className:y.reactionButton,children:c.jsx(C.default,{htmlColor:N.palette.grey[400]})}),k,c.jsx(l,{likesCount:I,usersWhoLike:L,commentsCount:B,usersWhoCommented:F,activeUsersList:U,onCommentsClick:function(){return s(!q)},small:!0})]})})};
//# sourceMappingURL=Reactions.js.map
