"use strict";var e=require("@babel/runtime/helpers/defineProperty"),r=require("react/jsx-runtime"),i=require("react"),t=require("classnames"),a=require("lodash"),l=require("@material-ui/core"),n=require("@material-ui/icons/DragIndicator"),s=require("../../../utils/index.js"),d=require("../../IconButton/index.js"),o=require("../RealTimeSidebarContext.js"),u=require("./RealTimeBoxStyles.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=c(e),x=c(t),v=c(n),j=i.memo((function(e){var t,n=e.item,c=void 0===n?null:n,j=e.isDraggable,g=void 0===j||j,f=e.dragHandle,h=void 0===f?a.noop:f,p=e.itemSelected,B=void 0===p?null:p,q=e.classNames,T=u.useStyles(),N=i.useContext(o),b=N.handleOpenCloseDialog,y=N.handleChangeParamToEdit,D=c?c.unitTo||s.getUnitDisplay(c.unitType):null,C=c?{backgroundColor:c.color,marginRight:"transparent"===c.color?-2:4}:void 0;if(!c)return null;return r.jsxs(r.Fragment,{children:[r.jsx("div",{className:x.default(T.rtBox,null==q?void 0:q.item,(t={},m.default(t,T.rtBoxSelected,!!B),m.default(t,"notDraggable",!g),t)),"data-testid":"realtime_box",children:r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:T.rtBoxInner,onClick:function(){b(!0),y(c.key)},"data-testid":"".concat(c.name,"_edit_item"),children:[r.jsxs("div",{className:x.default(T.rtBoxTitle,null==q?void 0:q.itemTitle),children:[r.jsx("div",{className:x.default(T.rtBoxTitleBorder,null==q?void 0:q.itemTitleBorder),style:C}),r.jsx("div",{children:c.name})]}),r.jsxs("div",{className:x.default(T.rtBoxValue,null==q?void 0:q.itemValue),children:[c.value," ",r.jsx("span",{children:D})]})]}),g&&h(r.jsx("div",{className:T.rtBoxButtonContainer,"data-testid":"realTimeValuesItemDrag",children:r.jsx(d,{tooltipProps:{title:"Drag to Reorder"},children:r.jsx(v.default,{className:T.dragIcon,color:"error"})})}))]})}),g&&r.jsx(l.Divider,{className:x.default(T.divider,null==q?void 0:q.itemSeparator)})]})}));module.exports=j;
//# sourceMappingURL=RealTimeBox.js.map
