"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/toConsumableArray"),r=require("../../../constants.js"),t=require("../../../utils/doesWellPassFilters.js"),n=require("./cascade-hierarchies.js"),a=require("./extractUniqueWellValues.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=l(e);exports.computeCascadedOptions=function(e,l,u,s,o){var c=u?r.FilterOptions:r.FilterOptions.filter((function(e){return e.value!==r.FilterType.company})),f=e.filter((function(e){return t.doesWellPassFilters(e,s,{excludeKeys:t.WELL_PROPERTY_FILTER_KEYS,segment:o})})),p=n.getCascadeMaps(o),d=p.hierarchies,v=p.upstream,y=function(e,r,t,n){var a=new Map;return t.forEach((function(t){var l=t.chain,i=e;l.forEach((function(t){n.has(t)?a.set(t,i):a.set(t,e);var l=r[t];if(Array.isArray(l)&&l.length>0){var u=l.map(String);i=i.filter((function(e){var r=e[t];return null==r||"Null"===r?u.includes("Null"):Array.isArray(r)?r.some((function(e){return u.includes(String(e))})):u.includes(String(r))}))}}))})),a}(f,s,d,v);return c.map((function(t){var n,u=t.value,s=t.label;if(u===r.FilterType.company)return{value:u,label:s,options:l||[]};var o,c=null!==(n=y.get(u))&&void 0!==n?n:e;return{value:u,label:s,options:(o=a.extractUniqueWellValues(c,u),i.default(o).sort().concat(["Null"]))}}))};
//# sourceMappingURL=computeCascadedOptions.js.map
