import{__assign as e}from'./../../../ext-esm/tslib/tslib.es6.js';import{jsxs as r,Fragment as t,jsx as o}from"react/jsx-runtime";import{memo as i,useContext as a}from"react";import l from"classnames";import{noop as n}from"lodash";import{Divider as d}from"@material-ui/core";import m from"@material-ui/icons/DragIndicator";import{getUnitDisplay as s}from"../../../utils/index.js";import c from"../../IconButton/index.js";import u from"../RealTimeSidebarContext.js";import{useStyles as p}from"./RealTimeBoxStyles.js";var f=i((function(i){var f,x=i.item,h=void 0===x?null:x,v=i.isDraggable,g=void 0===v||v,B=i.dragHandle,b=void 0===B?n:B,N=i.itemSelected,T=void 0===N?null:N,j=p(),D=a(u),C=D.handleOpenCloseDialog,I=D.handleChangeParamToEdit,y=h?h.unitTo||s(h.unitType):null,S=h?{borderLeft:"2px solid ".concat(h.color)}:null;return h?r(t,{children:[o("div",e({className:l(j.rtBox,(f={},f[j.rtBoxSelected]=!!T,f.notDraggable=!g,f)),"data-testid":"realtime_box"},{children:r(t,{children:[r("div",e({className:j.rtBoxInner,style:S,onClick:function(){C(!0),I(h.key)},"data-testid":"".concat(h.name,"_edit_item")},{children:[o("div",e({className:j.rtBoxTitle},{children:h.name})),r("div",e({className:j.rtBoxValue},{children:[h.value," ",o("span",{children:y})]}))]})),g&&b(o("div",e({className:j.rtBoxButtonContainer,"data-testid":"realTimeValuesItemDrag"},{children:o(c,e({tooltipProps:{title:"Drag to Reorder"}},{children:o(m,{className:j.dragIcon,color:"error"})}))})))]})})),g&&o(d,{className:j.divider})]}):null}));export{f as default};
