{"version":3,"sources":["../../../src/components/ContentItem/index.js"],"names":["dayjs","extend","relativeTime","LOCALES","CommentItem","props","state","showInput","showPreviewer","previewerIndex","popoverVisible","handleToggleInput","bind","renderTextWithReply","hidePreviewer","handleVisibleChange","handleUserAvaClick","index","setState","visible","user_id","userAvaClick","app","text","content","newText","reply","user_name","commentId","replyId","action","showReply","onShowReply","page","medias","isSpeak","is_speak","locale","showHoverCard","showEdit","newContent","images","indexOf","IMAGE_SPLIT","split","pop","join","imageList","needClear","length","imgs","splice","type","IconColor","favor_count","showDivider","reply_count","userId","user_avatar","avatar","backgroundImage","cursor","intl","get","marginLeft","created","format","fromNow","__html","url","map","item","i","total","handleEdit","replyPage","sDeleteReply","id","sDeleteComment","sReplyFavor","favored","sCommentFavor","color","children","Component","propTypes","PropTypes","object","isRequired","oneOf","func","bool","defaultProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;AACA;;;;AAEA;;;;AACA;;AAEA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;AACA;;AACA;;AACA;;;;AACA;;;;;;;;;;;;;AAXA;;;AAaA;AACAA,gBAAMC,MAAN,CAAaC,sBAAb;;AAEA,IAAMC,UAAU;AACd,WAAS;AADK,CAAhB;;IAIMC,W;;;AACJ,uBAAYC,KAAZ,EAAmB;AAAA;;AAAA,0HACXA,KADW;;AAEjB,UAAKC,KAAL,GAAa;AACXC,iBAAW,KADA;AAEXC,qBAAe,KAFJ;AAGXC,sBAAgB,CAHL;AAIXC,sBAAgB;AAJL,KAAb;AAMA,UAAKC,iBAAL,GAAyB,MAAKA,iBAAL,CAAuBC,IAAvB,OAAzB;AACA,UAAKC,mBAAL,GAA2B,MAAKA,mBAAL,CAAyBD,IAAzB,OAA3B;AACA,UAAKJ,aAAL,GAAqB,MAAKA,aAAL,CAAmBI,IAAnB,OAArB;AACA,UAAKE,aAAL,GAAqB,MAAKA,aAAL,CAAmBF,IAAnB,OAArB;A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ACA;AACA;AACA1D,UAAQwD,oBAAUG,KAAV,CAAgB,CAAC,SAAD,EAAY,OAAZ,EAAqB,cAArB,CAAhB,CALc;AAMtBzD,eAAasD,oBAAUI,IAND;AAOtBnD,YAAU+C,oBAAUK;AAPE,CAAxB;;AAUAvF,YAAYwF,YAAZ,GAA2B;AACzB9D,UAAQ,SADiB;AAEzBE,eAAa,uBAAM,CAAE,CAFI;AAGzBO,YAAU;AAHe,CAA3B;;kBAMe,uBAAQnC,WAAR,C","file":"index.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { Icon, Tooltip, Popconfirm, Popover } from \"antd\";\nimport dayjs from \"dayjs\";\nimport \"dayjs/locale/zh-cn\";\n// import 'dayjs/locale/es';\nimport relativeTime from \"dayjs/plugin/relativeTime\";\nimport intl from \"react-intl-universal\";\nimport AvatarHoverCard from \"./AvatarHoverCard\";\nimport Comment from \"../../Comment\";\nimport CommentInput from \"../CommentInput\";\nimport avatar from \"../../avatar\";\nimport { renderContent } from \"../../helper\";\nimport { IMAGE_SPLIT } from \"../../constant\";\nimport \"./index.css\";\nimport ImagePreviewer from \"../ImagePreviewer/ImagePreviewer\";\nimport AudioPlayer from \"../AudioPlayer\";\n\n// dayjs.locale(\"zh-cn\");\ndayjs.extend(relativeTime);\n\nconst LOCALES = {\n \"zh-CN\": \"zh-cn\"\n};\n\nclass CommentItem extends Component {\n constructor(props) {\n super(props);\n this.state = {\n showInput: false,\n showPreviewer: false,\n previewerIndex: 0,\n popoverVisible: false\n };\n this.handleToggleInput = this.handleToggleInput.bind(this);\n this.renderTextWithReply = this.renderTextWithReply.bind(this);\n this.showPreviewer = this.showPreviewer.bind(this);\n this.hidePreviewer = this.hidePreviewer.bind(this);\n this.handleVisibleChange = this.handleVisibleChange.bind(this);\n this.handleUserAvaClick = this.handleUserAvaClick.bind(this);\n }\n\n showPreviewer(index) {\n this.setState({\n showPreviewer: true,\n previewerIndex: index\n });\n }\n\n hidePreviewer() {\n this.setState({\n showPreviewer: false\n });\n }\n\n handleToggleInput() {\n this.setState({ showInput: !this.state.showInput });\n }\n\n handleVisibleChange(visible) {\n this.setState({\n popoverVisible: visible\n });\n }\n\n handleUserAvaClick() {\n const { user_id } = this.props;\n const { userAvaClick } = this.props.app;\n if (userAvaClick) {\n userAvaClick(user_id);\n }\n }\n\n renderTextWithReply(text, content) {\n let newText = text;\n const { reply } = content;\n if (reply) {\n // newText = `${newText} //@${\n // reply.user_name\n // } ${reply.content}`;\n newText = `${newText} //@${reply.user_name} ${reply.content}`;\n // newText = (\n // \n // {newText}\n // @{reply.user_name}{reply.content}\n // \n // )\n if (reply.reply) {\n return this.renderTextWithReply(newText, reply);\n }\n }\n return newText;\n }\n\n render() {\n const {\n commentId,\n replyId,\n content,\n action,\n showReply,\n onShowReply,\n app,\n user_id,\n page\n } = this.props;\n const { medias, is_speak: isSpeak } = content;\n const { locale, showHoverCard, showEdit } = this.props.app;\n const { showInput } = this.state;\n let newContent = content.content;\n let images = \"\";\n if (newContent.indexOf(IMAGE_SPLIT) !== -1) {\n newContent = newContent.split(IMAGE_SPLIT);\n images = newContent.pop();\n newContent = newContent.join(\"\");\n }\n\n const imageList = images.split(\",\");\n\n // 在3, 7前需要换行\n const needClear =\n imageList.length === 5 ||\n imageList.length === 6 ||\n imageList.length === 9;\n const imgs = [...imageList];\n if (needClear) {\n if (imgs.length > 6) {\n imgs.splice(3, 0, { type: \"divider\" });\n imgs.splice(7, 0, { type: \"divider\" });\n } else {\n imgs.splice(3, 0, { type: \"divider\" });\n }\n }\n const IconColor = content.favor_count > 0 ? \"#71C135\" : \"#4a90e2\";\n const showDivider =\n content.reply_count ||\n (showEdit && app.userId === content.user_id) ||\n app.userId === content.user_id;\n return (\n