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