"use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/slicedToArray"),r=require("react"),n=require("moment"),i=require("classnames"),a=require("@material-ui/core"),o=require("../../../Modal/Modal.js"),s=require("../../../PostInput/PostInput.js"),l=require("../../../IconButton/index.js"),c=require("../../../Typography.js"),p=require("../../../Icons/SendIcon.js"),u=require("../../../UserMention/utils/index.js"),d=require("../../../../constants/feed.js"),m=require("react/jsx-runtime");function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=f(e),g=f(t),y=f(n),j=f(i);function x(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?x(Object(r),!0).forEach((function(t){h.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):x(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var v=a.makeStyles((function(e){return{postInput:{paddingBottom:8},filePreviewWrapper:{width:"100%",marginLeft:0,maxHeight:251},modal:{maxWidth:450,width:"100vw"},actionsAdornment:{flex:1},info:{marginTop:16},text:{color:e.palette.primary.text6},value:{color:"#fff"},inputMain:{marginBottom:0,fontSize:"11px",color:e.palette.primary.text8},inputHelper:{display:"flex",paddingRight:5},cancelText:{cursor:"pointer"},highlightedLabel:{color:e.palette.primary.main},modalActions:{paddingTop:16},actions:{height:36},sendRow:{display:"flex"},sendIcon:{"&.Mui-disabled":{cursor:"not-allowed!important"}}}}));module.exports=function(e){var t=e.feedItem.context.pc_comment,n=t.body,i=t.attachment,f=t.data,h=t.data,x=h.holeDepth,w=h.timestamp,O=e.onClose,N=e.onSave,P=e.userCompanyId,I=v(),q=r.useRef(),C=r.useState({body:n,attachment:i}),T=g.default(C,2),M=T[0],S=T[1],D=function(){N({context:{pc_comment:b(b({},M),{},{data:f})}})};return m.jsxs(o,{open:!0,onClose:O,title:"Edit Comment",contentClassName:I.modal,actionsClassName:I.modalActions,onClick:function(e){e.stopPropagation()},actions:m.jsxs(a.Grid,{container:!0,direction:"row",justify:"space-between",alignItems:"center",className:I.actions,children:[m.jsx(a.Grid,{item:!0,children:m.jsx(a.Typography,{variant:"caption",className:j.default(I.inputMain,I.cancelText,I.highlightedLabel),component:"div",gutterBottom:!0,onClick:O,children:"Cancel"})}),m.jsxs(a.Grid,{item:!0,direction:"row",alignItems:"center",className:I.sendRow,children:[m.jsxs(a.Typography,{variant:"caption",className:j.default(I.inputMain,I.inputHelper),component:"div",gutterBottom:!0,children:["Press ",m.jsx(a.Typography,{variant:"caption",color:"primary",className:j.default(I.inputMain,I.highlightedLabel),children:"Enter"})," to send"]}),m.jsx(l,{onClick:D,className:I.sendIcon,disabled:!M||!M.body&&!M.attachment,children:m.jsx(p,{})})]})]}),ref:q,children:[m.jsx(s,{initialValue:{body:n,attachment:i},userCompanyId:P,onChange:S,filePreviewWrapperClass:I.filePreviewWrapper,className:I.postInput,onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||u.isSuggestionsListOpened()||(e.preventDefault(),D())},mentionStyle:d.MENTION_STYLE,suggestionsPortalHost:q.current,allowSuggestionsAboveCursor:!0}),m.jsxs("div",{className:I.info,children:[w&&m.jsxs(c.Regular14,{className:I.text,gutterBottom:!0,children:["Time:"," ",m.jsx("span",{className:I.value,children:y.default(1e3*w).format("MM/DD/YY, HH:mm")})]}),Number.isFinite(x)&&m.jsxs(c.Regular14,{className:I.text,gutterBottom:!0,children:["Hole Depth: ",m.jsxs("span",{className:I.value,children:[x,"'"]})]})]})]})};
