import e from"@babel/runtime/helpers/asyncToGenerator";import r from"@babel/runtime/helpers/slicedToArray";import i from"@babel/runtime/regenerator";import{useState as t,useEffect as a}from"react";import{shape as o,number as n,string as l}from"prop-types";import{makeStyles as s}from"@material-ui/core";import u from"./components/AccuracyPlan.js";import m from"./components/ActualPointInfo.js";import d from"./components/Warning.js";import{fetchDirectionalAccuracyRecords as p}from"./api.js";import c from"../../../LoadingIndicator/LoadingIndicator.js";import{jsx as v,jsxs as f}from"react/jsx-runtime";var y=s({wrapper:{display:"flex",flexWrap:"wrap"}}),h=function(o){var n,l,s,h=o.feedItem,q=y(),w=t(!1),x=r(w,2),R=x[0],_=x[1],I=t(!1),b=r(I,2),g=b[0],j=b[1],A=t(null),T=r(A,2),P=T[0],W=T[1],L=t(""),N=r(L,2),k=N[0],z=N[1],C=t(""),D=r(C,2),G=D[0],S=D[1],B=t(null),E=r(B,2),F=E[0],H=E[1],J="active"===(null===(n=h.context)||void 0===n||null===(l=n.survey_station)||void 0===l||null===(s=l.well)||void 0===s?void 0:s.status);return a(e(i.mark((function e(){var r,t,a,o,n,l,s,u,m,d,c,v,f,y;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=null===(r=h.well)||void 0===r?void 0:r.id,s=null===(t=h.context)||void 0===t||null===(a=t.survey_station)||void 0===a||null===(o=a.data)||void 0===o?void 0:o.measured_depth,e.next=4,p({wellId:l,md:s});case 4:u=e.sent,m=null==u||null===(n=u[0])||void 0===n?void 0:n.data,_(!0),m&&(c=m.accuracy,v=m.cumulative_tvd_change||"",f=m.plan_name||"",y=null===(d=u[0])||void 0===d?void 0:d.timestamp,j(!0),W(c),z(v),S(f),H(y));case 8:case"end":return e.stop()}}),e)}))),[]),R?f("div",{className:q.wrapper,children:[g?v(u,{accuracyData:P,cumulativeTvdChange:k,initialPlanName:G,timestamp:F}):v(d,{isWellStatusActive:J}),v(m,{feedItem:h})]}):v(c,{})};h.propTypes={feedItem:o({context:o({survey_station:o({data:o({azimuth:n.isRequired,inclination:n.isRequired,measured_depth:n.isRequired}).isRequired,well:o({status:l.isRequired}).isRequired}).isRequired}).isRequired}).isRequired};export{h as default};
