import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/slicedToArray";import{useRef as o,useState as n}from"react";import r from"moment";import i from"classnames";import{makeStyles as a,Grid as c,Typography as s}from"@material-ui/core";import l from"../../../Modal/Modal.js";import m from"../../../PostInput/PostInput.js";import p from"../../../IconButton/index.js";import{Regular14 as d}from"../../../Typography.js";import u from"../../../Icons/SendIcon.js";import{isSuggestionsListOpened as f}from"../../../UserMention/utils/index.js";import{MENTION_STYLE as h}from"../../../../constants/feed.js";import{jsxs as g,jsx as y}from"react/jsx-runtime";function b(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function v(t){for(var o=1;o<arguments.length;o++){var n=null!=arguments[o]?arguments[o]:{};o%2?b(Object(n),!0).forEach((function(o){e(t,o,n[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var j=a((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"}}}}));function w(e){var a=e.feedItem.context.pc_comment,b=a.body,w=a.attachment,x=a.data,O=a.data,P=O.holeDepth,N=O.timestamp,C=e.onClose,I=e.onSave,D=e.userCompanyId,M=j(),B=o(),H=n({body:b,attachment:w}),S=t(H,2),T=S[0],k=S[1],A=function(){I({context:{pc_comment:v(v({},T),{},{data:x})}})};return g(l,{open:!0,onClose:C,title:"Edit Comment",contentClassName:M.modal,actionsClassName:M.modalActions,onClick:function(e){e.stopPropagation()},actions:g(c,{container:!0,direction:"row",justify:"space-between",alignItems:"center",className:M.actions,children:[y(c,{item:!0,children:y(s,{variant:"caption",className:i(M.inputMain,M.cancelText,M.highlightedLabel),component:"div",gutterBottom:!0,onClick:C,children:"Cancel"})}),g(c,{item:!0,direction:"row",alignItems:"center",className:M.sendRow,children:[g(s,{variant:"caption",className:i(M.inputMain,M.inputHelper),component:"div",gutterBottom:!0,children:["Press ",y(s,{variant:"caption",color:"primary",className:i(M.inputMain,M.highlightedLabel),children:"Enter"})," to send"]}),y(p,{onClick:A,className:M.sendIcon,disabled:!T||!T.body&&!T.attachment,children:y(u,{})})]})]}),ref:B,children:[y(m,{initialValue:{body:b,attachment:w},userCompanyId:D,onChange:k,filePreviewWrapperClass:M.filePreviewWrapper,className:M.postInput,onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||f()||(e.preventDefault(),A())},mentionStyle:h,suggestionsPortalHost:B.current,allowSuggestionsAboveCursor:!0}),g("div",{className:M.info,children:[N&&g(d,{className:M.text,gutterBottom:!0,children:["Time:"," ",y("span",{className:M.value,children:r(1e3*N).format("MM/DD/YY, HH:mm")})]}),Number.isFinite(P)&&g(d,{className:M.text,gutterBottom:!0,children:["Hole Depth: ",g("span",{className:M.value,children:[P,"'"]})]})]})]})}export{w as default};
//# sourceMappingURL=PCCommentEdit.js.map
