"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/helpers/slicedToArray"),r=require("@babel/runtime/regenerator"),a=require("react"),n=require("lodash"),u=require("../utils/apiCalls.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=s(e),c=s(t),f=s(r);exports.useFetchBicWellsData=function(e){var t=a.useState([]),r=c.default(t,2),s=r[0],i=r[1];return a.useEffect((function(){var t,r=(t=l.default(f.default.mark((function t(){var r,a,s;return f.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,!e){t.next=7;break}return t.next=4,u.fetchBicWellSections(e);case 4:t.t0=t.sent,t.next=8;break;case 7:t.t0=[];case 8:r=t.t0,a=!n.isEmpty(r)&&JSON.parse(r[0].data.filters)||void 0,s=!n.isEmpty(r)&&r[0].data.result&&JSON.parse(r[0].data.result)||void 0,i({filters:a,result:s}),t.next=17;break;case 14:t.prev=14,t.t1=t.catch(0),i(null);case 17:case"end":return t.stop()}}),t,null,[[0,14]])}))),function(){return t.apply(this,arguments)});r()}),[e]),s},exports.useFetchWellhubWells=function(e){var t=a.useState([]),r=c.default(t,2),s=r[0],i=r[1];return a.useEffect((function(){var t,r=(t=l.default(f.default.mark((function t(){var r,a;return f.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,u.fetchWellhubWells(e);case 3:r=t.sent,a=n.get(r[0],"data.offset_wells")||[],i(a),t.next=11;break;case 8:t.prev=8,t.t0=t.catch(0),i([]);case 11:case"end":return t.stop()}}),t,null,[[0,8]])}))),function(){return t.apply(this,arguments)});r()}),[e]),s},exports.useWells=function(e){var t=a.useRef(!0),r=a.useState(null),n=c.default(r,2),s=n[0],i=n[1];return a.useEffect((function(){function r(){return(r=l.default(f.default.mark((function t(){var r;return f.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,u.fetchWells(e);case 2:r=t.sent,i(r);case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}t.current&&(i(null),function(){r.apply(this,arguments)}(),t.current=!1)}),[e]),s};
//# sourceMappingURL=index.js.map
