"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/toConsumableArray"),r=require("react"),n=require("../../../constants.js"),o=require("../../../stores/picker-props-store/usePickerPropsStore.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=u(e),l=u(t);function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach((function(t){i.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var s=new Set([n.ColumnType.rig,n.ColumnType.distance,n.ColumnType.taScore]),f=new Set([n.ColumnType.interventionAsset,n.ColumnType.padName,n.ColumnType.formation]);exports.useTableColumns=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],u=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],c=o.usePickerPropsStore((function(e){return e.segment}));return r.useMemo((function(){if(!e)return null;var r=Math.min(e.length,3),o="intervention"===c,a=t?n.TableColumns:n.TableColumns.filter((function(e){return e.type!==n.ColumnType.company}));return u||(a=a.filter((function(e){return e.type!==n.ColumnType.wellSection}))),i||(a=a.filter((function(e){return e.type!==n.ColumnType.distance}))),(a=o?a.filter((function(e){return!s.has(e.type)})):a.filter((function(e){return!f.has(e.type)}))).reduce((function(t,o){return o.type===n.ColumnType.metrics?[].concat(l.default(t),l.default(e.map((function(e){return p(p({},o),{},{key:e,minWidth:o.minWidth[r],flex:o.flex})})))):[].concat(l.default(t),[p(p({},o),{},{minWidth:o.minWidth[r],flex:o.flex})])}),[])}),[e,t,u,i,c])};
//# sourceMappingURL=useTableColumns.js.map
