import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/slicedToArray";import{useState as t}from"react";import{bool as i,arrayOf as n,shape as o,string as s,func as l}from"prop-types";import a from"classnames";import{get as c}from"lodash";import{Tooltip as d,Accordion as m,AccordionSummary as p,AccordionDetails as u}from"@material-ui/core";import f from"@material-ui/icons/ExpandMore";import b from"../BHATile/BHATile.js";import h from"./styles.css.js";import y from"../../Counter/index.js";import{jsxs as g,jsx as v}from"react/jsx-runtime";function O(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,i)}return t}function j(r){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?O(Object(i),!0).forEach((function(t){e(r,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(i)):O(Object(i)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(i,e))}))}return r}function B(i){var n=i.isMobile,o=i.drillstringsBySection,s=i.selectedBha,l=i.isMetricsHidden,O=i.onSelectBha,B=i.contentClassName,S=t({}),M=r(S,2),N=M[0],P=M[1];return g("div",{className:h.bhaListContainer,children:[v("div",{className:a(h.bhaList,B),children:o.map((function(r){var t,i;return v(d,{title:0===(null==r||null===(t=r.drillstrings)||void 0===t?void 0:t.length)?"No BHA in section":"",placement:"bottom-start",children:g(m,{expanded:!N[r.name],disabled:0===(null==r||null===(i=r.drillstrings)||void 0===i?void 0:i.length),classes:{root:h.accordionRoot},onChange:function(){return t=r,void P((function(r){return j(j({},r),{},e({},t.name,!r[t.name]))}));var t},children:[g(p,{expandIcon:v(f,{}),classes:{root:h.accordionSummaryRoot,content:h.accordionSummaryContent},children:[r.name,v(y,{size:"medium",label:null==r?void 0:r.drillstrings.length,className:h.counter})]}),v(u,{children:v("div",{className:h.sectionContent,children:r.drillstrings.map((function(e){return v("div",{className:h.tileWrapper,children:v(b,{drillstring:e,isSelected:c(s,"_id")===c(e,"_id"),isMetricsHidden:l,onSelect:O,isMobile:n})},c(e,"_id"))}))})})]})},r.name)}))}),v("div",{className:a(h.bottomGradient,e({},h.bottomGradientMobile,n))})]})}B.propTypes={isMobile:i,drillstringsBySection:n(o({name:s,drillstrings:n(o({_id:s,data:o({})}))})),selectedBha:o({_id:s}),isMetricsHidden:i,onSelectBha:l.isRequired,contentClassName:s},B.defaultProps={isMobile:!1,drillstringsBySection:[],selectedBha:null,isMetricsHidden:!0,contentClassName:null};export{B as default};
