import e from"@babel/runtime/helpers/defineProperty";import{shape as i,arrayOf as l,bool as t,func as n,number as s}from"prop-types";import a from"classnames";import{Chip as r}from"@material-ui/core";import c from"../BHATileIcon.js";import o from"./styles.css.js";import{getBHASchematic as m}from"../../../utils/bha.js";import{jsxs as d,jsx as h}from"react/jsx-runtime";var p=[{key:"tfa",label:"TFA"},{key:"cpl",label:"CPL at TD"},{key:"sp",label:"SP at TD"},{key:"ecd",label:"ECD at TD"}];function u(i){var l,t,n=i.isMobile,s=i.drillstring,u=i.isSelected,b=i.onSelect,v=i.height,f=i.isMetricsHidden,C=(null==s||null===(l=s.data)||void 0===l?void 0:l.components)||[],N=m(C);return d("div",{className:a(o.tileContainer,e({},o.selected,u)),onClick:function(){return b(s)},children:[d("div",{className:o.header,children:[d("div",{className:o.bhaTile,children:[h(r,{label:null==s||null===(t=s.data)||void 0===t?void 0:t.id,classes:{root:a(o.rootChip,e({},o.selectedChip,u)),label:o.chipLabel}}),h("span",{className:o.bhaCaption,children:"BHA"})]}),d("div",{className:o.componentsCount,children:["Components: ",C.length]})]}),C.length>0&&h("div",{className:a(o.schematic,e({},o.schematicMobile,n)),children:N.map((function(e,i){return h(c,{component:e,width:"calc(100% / ".concat(N.length," - 1px)"),height:v},"bha-tile-".concat(i))}))}),!f&&!n&&C.length>0&&h("div",{className:o.metricsContainer,children:p.map((function(e){return d("div",{className:o.metricItem,children:[d("div",{className:o.metricItemContent,children:[h("div",{className:o.metricItemLabel,children:e.label}),h("div",{className:o.metricItemValue,children:"0.0"})]}),"ecd"!==e.key&&h("div",{className:o.metricItemSplit})]},e.key)}))}),0===C.length&&h("div",{className:a(o.noComponents,e({},o.noComponentsMobile,n)),children:"No Components"})]})}u.propTypes={drillstring:i({data:i({components:l(i({}))})}),isSelected:t,onSelect:n.isRequired,height:s,isMetricsHidden:t,isMobile:t},u.defaultProps={drillstring:null,isSelected:!1,height:16,isMetricsHidden:!1,isMobile:!1};export{u as default};
