"use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("prop-types"),i=require("classnames"),s=require("lodash"),n=require("../CasingTileIcon.js"),a=require("./style.js"),l=require("../../../constants/casing.js"),r=require("../../../utils/index.js"),c=require("react/jsx-runtime");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=o(e),u=o(t),m=o(i),h=[{key:"tv",label:"Total Volume"},{key:"tpt",label:"Total Pumping Time"},{key:"lt",label:"Lead TOC"},{key:"tt",label:"Tail TOC"}];function p(e){var t=e.tileData,i=e.onSelect,o=e.isMobile,u=e.isMetricsHidden,p=a.useStyles({isMobile:o}),f=s.get(t,["data","components"])||[],j=function(e){var t=[],i=l.COMPONENT_FAMILIES.map((function(e){return e.type}));return e.forEach((function(e){var s=e.family;i.includes(s)&&t.push({family:s})})),t.slice(-8)}(f),g=r.convertValue(s.get(t,["data","outer_diameter"]),"shortLength","in");return c.jsxs("div",{className:p.tileContainer,onClick:function(){return i(t)},children:[c.jsxs("div",{className:p.header,children:[c.jsx("div",{className:p.casingTitle,children:c.jsxs("span",{className:p.bhaCaption,children:[g,"in"===r.getUnitPreference("shortLength")?'"':r.getUnitDisplay("shortLength")," Casing"]})}),c.jsxs("div",{className:p.componentsCount,children:["Components: ",f.length]})]}),f.length>0&&c.jsx("div",{className:m.default(p.schematic,d.default({},p.schematicMobile,o)),children:j.map((function(e,t){return c.jsx(n,{component:e,width:"calc(100% / ".concat(j.length," - 1px)")},"casing-tile-".concat(t))}))}),!u&&!o&&f.length>0&&c.jsx("div",{className:p.metricsContainer,children:h.map((function(e,t){return c.jsxs("div",{className:p.metricItem,children:[c.jsxs("div",{className:p.metricItemContent,children:[c.jsx("div",{className:p.metricItemLabel,children:e.label}),c.jsx("div",{className:p.metricItemValue,children:"0.0"})]}),t!==h.length-1&&c.jsx("div",{className:p.metricItemSplit})]},e.key)}))}),0===f.length&&c.jsx("div",{className:m.default(p.noComponents,d.default({},p.noComponentsMobile,o)),children:"No Components"})]})}p.propTypes={tileData:u.default.shape({}),onSelect:u.default.func.isRequired,isMobile:u.default.bool,isMetricsHidden:u.default.bool},p.defaultProps={tileData:{},isMobile:!1,isMetricsHidden:!0},module.exports=p;
