"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/typeof"),t=require("@babel/runtime/helpers/slicedToArray"),r=require("lodash"),i=require("react"),u=require("../constants.js"),n=require("../utils/timePeriod.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=s(e),l=s(t);exports.useFilteredWells=function(e,t){var s=i.useState(null),o=l.default(s,2),c=o[0],f=o[1],d=/\sST0/g;return i.useEffect((function(){if(e){var i=e.filter((function(e){return Object.keys(t).every((function(r){return"object"!==a.default(t[r])||!(t[r].length>0&&!t[r].includes(e[r]))}))})),s=i;void 0!==t[u.FilterType.sideTracks]&&(s=i.filter((function(e){return!t[u.FilterType.sideTracks]||!e.name.match(d)})));var o=t.period,c=t.timeRangeFrom,m=t.timeRangeTo,b=n.getTimestampByPeriod(o,c,m),p=l.default(b,2),v=p[0],y=p[1],T=Number.isFinite(v)&&Number.isFinite(y)?s.filter((function(e){return e.lastActive>=v&&e.lastActive<=y})):s,q=t.radius,F=Number.isFinite(q)?T.filter((function(e){return e.distance<=q})):T;f(r.uniqBy(F,"id"))}}),[e,t]),c};
