"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),r=require("./getTimestampByPeriod.js"),i=require("./isAssetVisibleToUser.js"),t=require("./isDrillingOnlyWell.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=n(e),l=/\sST0/,u=["status","companyId","rigName","programName","basin","county","area","formation","stringDesign","interventionAsset","padName"],a=function(e,i,n){var a,o;if(!i)return!0;var d=null==n?void 0:n.excludeKeys;if(!u.every((function(r){if(null!=d&&d.includes(r))return!0;var t=i[r];if(Array.isArray(t)&&t.length>0){var n=e[r],s=t.map(String);return null==n||"Null"===n?s.includes("Null"):Array.isArray(n)?n.some((function(e){return s.includes(String(e))})):s.includes(String(n))}return!0})))return!1;if("intervention"===(null==n?void 0:n.segment)){var v=i.status;if(Array.isArray(v)&&v.map(String).includes("active")&&"active"===e.status&&"intervention"!==e.wellState)return!1}if(i.sideTracks&&l.test(null!==(a=e.name)&&void 0!==a?a:""))return!1;if("intervention"!==(null==n?void 0:n.segment)&&i.drillingWells&&!t.isDrillingOnlyWell(e))return!1;if(i.activeInterventionWells&&(null===(o=e.interventionAsset)||void 0===o||!o.length))return!1;var c=i.period,m=i.timeRangeFrom,f=i.timeRangeTo,g=r.getTimestampByPeriod(c,m,f),y=s.default(g,2),p=y[0],A=y[1];if(null!==p&&null!==A&&Number.isFinite(p)&&Number.isFinite(A)){var T=e.lastActive;if(void 0===T||!(T>=p&&T<=A))return!1}return!0};exports.EXCLUDE_RIG_NAME_FILTER={excludeKeys:["rigName"]},exports.WELL_PROPERTY_FILTER_KEYS=u,exports.doesWellPassFilters=a,exports.doesWellPassVisibilityAndFilters=function(e,r,t,n){return i.isAssetVisibleToUser(e,t)&&a(e,r,n)};
//# sourceMappingURL=doesWellPassFilters.js.map
