import r from"@babel/runtime/helpers/asyncToGenerator";import t from"@babel/runtime/helpers/slicedToArray";import e from"@babel/runtime/regenerator";import{useState as n,useRef as i,useCallback as s}from"react";import{fetchWellsByIds as o}from"../../api/wells/fetchWellsByIds.js";import"lodash";import"@babel/runtime/helpers/toConsumableArray";import"@babel/runtime/helpers/defineProperty";import"uuid";import"lodash/set";import"lodash/get";import"lodash/unset";import"moment";import"../../../../clients/jsonApi/index.js";import"../../../../clients/subscriptions/constants.js";import"../../../../clients/subscriptions.v1.js";import"../../../../clients/subscriptions/subscriptions-client.factory.js";import"../../../../clients/api/apiCore.js";import"../../../../clients/constants.js";import"../../../../clients/sso/auth0.js";import"../../../../clients/sso/oauth2.js";import"../../../../clients/api/rateLimiter.js";import"../../constants.js";import"../../api/shared/dataFormatter.js";import{usePickerPropsStore as a}from"../../stores/picker-props-store/usePickerPropsStore.js";var u=function(){var u=a((function(r){return r.addWellsUsabilityInfo})),c=n([]),p=t(c,2),l=p[0],m=p[1],f=n(!1),b=t(f,2),h=b[0],d=b[1],j=i(new Map),v=s(function(){var t=r(e.mark((function r(t){var n,i,s;return e.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(0!==t.length){r.next=2;break}return r.abrupt("return",[]);case 2:if(0!==(n=t.filter((function(r){return!j.current.has(r)}))).length){r.next=5;break}return r.abrupt("return",t.map((function(r){return j.current.get(r)})).filter((function(r){return void 0!==r})));case 5:return d(!0),r.prev=6,r.next=9,o(n);case 9:if(i=r.sent,"function"!=typeof u){r.next=16;break}return r.next=13,u(i);case 13:r.t0=r.sent,r.next=17;break;case 16:r.t0=i;case 17:return r.t0.forEach((function(r){j.current.set(r.id,r)})),s=t.map((function(r){return j.current.get(r)})).filter((function(r){return void 0!==r})),m((function(r){var t=new Set(r.map((function(r){return r.id}))),e=s.filter((function(r){return!t.has(r.id)}));return e.length>0?(null!=r?r:[]).concat(e):r})),r.abrupt("return",s);case 24:return r.prev=24,r.t1=r.catch(6),console.error("Error fetching searched wells:",r.t1),r.abrupt("return",[]);case 28:return r.prev=28,d(!1),r.finish(28);case 31:case"end":return r.stop()}}),r,null,[[6,24,28,31]])})));return function(r){return t.apply(this,arguments)}}(),[u]);return[l,h,v]};export{u as useSearchedWells};
//# sourceMappingURL=useSearchedWells.js.map
