import e from"@babel/runtime/helpers/slicedToArray";import{shape as n,number as i,string as o,func as r}from"prop-types";import{useState as t,useMemo as l}from"react";import{Button as a,Dialog as d,DialogContent as s}from"@material-ui/core";import c from"../BHATable/index.js";import p from"../BHAComponentDetail/index.js";import m from"./styles.css.js";import{convertValue as u}from"../../../utils/index.js";import{jsxs as f,jsx as h}from"react/jsx-runtime";var v=function(n){var i,o,r,v=n.onDone,D=n.drillStringInfo,T=n.holeDepth,N=n.unit,j=t(),x=e(j,2),A=x[0],C=x[1],S=null===(i=D.data)||void 0===i?void 0:i.id,y=Math.floor(u(null===(o=D.data)||void 0===o?void 0:o.start_depth,"length","ft")),B=(null===(r=D.data)||void 0===r?void 0:r.components)||[],H=l((function(){return B.find((function(e){return e.id===A}))}),[B,A]);return f("div",{className:m.detailsPane,children:[f("header",{children:[h(a,{variant:"contained",className:m.detailDone,onClick:v,children:"Close"}),f("div",{className:m.detailTitleGroup,children:[h("span",{className:m.detailTitle,children:"BHA Details"}),h("span",{className:m.detailTitleSeparator,children:" · "}),f("span",{className:m.detailTitleMore,children:["BHA # ",S]}),h("span",{className:m.detailTitleSeparator,children:" · "}),h("span",{className:m.detailTitleMore,children:"".concat(y," - ").concat(T," ").concat(N)})]})]}),h(c,{components:B,onSelectComponent:function(e){var n=e.id;return C(n)}}),h(d,{open:!!A,onClose:function(){return C(null)},scroll:"paper",children:h(s,{children:h(p,{component:H,onDone:function(){return C(null)}})})})]})};v.propTypes={drillStringInfo:n().isRequired,holeDepth:i,unit:o.isRequired,onDone:r.isRequired},v.defaultProps={holeDepth:void 0};export{v as default};
//# sourceMappingURL=DrillstringDetail.js.map
