import t from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/slicedToArray";import{useRef as n,useState as o}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{convertValue as l,getUnitDisplay as m}from"../../../../utils/index.js";import p from"../../../Modal/Modal.js";import d from"../../../PostInput/PostInput.js";import u from"../../../IconButton/index.js";import{Regular14 as f}from"../../../Typography.js";import h from"../../../Icons/SendIcon.js";import{isSuggestionsListOpened as g}from"../../../UserMention/utils/index.js";import{MENTION_STYLE as b}from"../../../../constants/feed.js";import{jsxs as y,jsx as v}from"react/jsx-runtime";function x(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function N(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?x(Object(o),!0).forEach((function(n){t(e,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):x(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}var j=a((function(t){return{postInput:{paddingBottom:8},filePreviewWrapper:{width:"100%",marginLeft:0,maxHeight:251},modal:{maxWidth:450,width:"100vw"},actionsAdornment:{flex:1},info:{marginTop:16},text:{color:t.palette.primary.text6},value:{color:"#fff"},inputMain:{marginBottom:0,fontSize:"11px",color:t.palette.primary.text8},inputHelper:{display:"flex",paddingRight:5},cancelText:{cursor:"pointer"},highlightedLabel:{color:t.palette.primary.main},modalActions:{paddingTop:16},actions:{height:36},sendRow:{display:"flex"},sendIcon:{"&.Mui-disabled":{cursor:"not-allowed!important"}}}}));function w(t){var a,x=t.feedItem.context.dvd_comment,w=x.body,C=x.attachment,O=x.data,P=x.data,I=P.bitDepth,D=P.holeDepth,B=P.cost,M=P.timestamp,S=t.onClose,E=t.onSave,H=t.userCompanyId,T=j(),k=l(+I,"length","ft"),A=l(+D,"length","ft"),L=n(),W=o({body:w,attachment:C}),_=e(W,2),F=_[0],R=_[1],K=function(){E({context:{dvd_comment:N(N({},F),{},{data:O})}})};return y(p,{open:!0,onClose:S,title:"Edit Comment",contentClassName:T.modal,actionsClassName:T.modalActions,onClick:function(t){t.stopPropagation()},actions:y(c,{container:!0,direction:"row",justify:"space-between",alignItems:"center",className:T.actions,children:[v(c,{item:!0,children:v(s,{variant:"caption",className:i(T.inputMain,T.cancelText,T.highlightedLabel),"data-testid":"".concat("EditComment","_cancel"),component:"div",gutterBottom:!0,onClick:S,children:"Cancel"})}),y(c,{item:!0,direction:"row",alignItems:"center",className:T.sendRow,children:[y(s,{variant:"caption",className:i(T.inputMain,T.inputHelper),component:"div",gutterBottom:!0,children:["Press ",v(s,{variant:"caption",color:"primary",className:i(T.inputMain,T.highlightedLabel),children:"Enter"})," to send"]}),v(u,{onClick:K,className:T.sendIcon,"data-testid":"".concat("EditComment","_send"),disabled:!F||!F.body&&!F.attachment,children:v(h,{})})]})]}),ref:L,children:[v(d,{initialValue:{body:w,attachment:C},userCompanyId:H,onChange:R,filePreviewWrapperClass:T.filePreviewWrapper,className:T.postInput,onKeyDown:function(t){"Enter"!==t.key||t.shiftKey||g()||(t.preventDefault(),K())},mentionStyle:b,suggestionsPortalHost:L.current,allowSuggestionsAboveCursor:!0}),y("div",{className:T.info,children:[M&&y(f,{className:T.text,gutterBottom:!0,children:["Time:",v("span",{className:T.value,children:r(1e3*M).format("MM/DD/YY, HH:mm")})]}),Number.isFinite(B)&&y(f,{className:T.text,gutterBottom:!0,children:["Cost: ",y("span",{className:T.value,children:[" ",(a=B,a.toString().replace(/\B(?=(\d{3})+(?!\d))/g," "))]}),v("span",{className:T.currency,children:"$"})]}),Number.isFinite(k)&&y(f,{className:T.text,gutterBottom:!0,children:["Bit Depth:",v("span",{className:T.value,children:"".concat(k," ").concat(m("length"))})]}),Number.isFinite(A)&&y(f,{className:T.text,gutterBottom:!0,children:["Hole Depth:",v("span",{className:T.value,children:"".concat(A," ").concat(m("length"))})]})]})]})}export{w as default};
//# sourceMappingURL=DvdCommentEdit.js.map
