import e from"@babel/runtime/helpers/slicedToArray";import{jsxs as t,jsx as o}from"react/jsx-runtime";import{memo as n,useState as i}from"react";import{SortDirection as l}from"react-virtualized";import{TableRow as r,TableCell as s}from"@material-ui/core";import{ColumnType as c}from"../../../../constants.js";import{usePickerPropsStore as a}from"../../../../stores/picker-props-store/usePickerPropsStore.js";import{useViewStore as m}from"../../../../stores/view-store/useViewStore.js";import{SortableHeaderCell as d}from"../SortableHeaderCell/SortableHeaderCell.js";import{WellNameHeaderCell as u}from"../WellNameHeaderCell/WellNameHeaderCell.js";import{MetricsHeaderCells as f}from"../MetricsHeaderCells/MetricsHeaderCells.js";import y from"./OffsetWellsTableHead.module.css.js";var p="OffsetWellsTableHead",W=n((function(n){var W=n.columnsWithDict,h=n.metricsKeys,S=n.sortBy,v=n.sortDirection,D=n.indeterminate,b=n.isAllWellsSelected,C=n.onChangeSort,N=n.onUpdateMetricsKey,A=n.handleChangeAllOffsetWells,g=n.wellNameStyle,k=n.isImperial,K=n.isTaColumnVisible,x=n.isWellSectionColumnVisible,B=a((function(e){return e.open})),I=a((function(e){return e.isViewOnly})),H=m((function(e){return e.isWellNameExpand})),O=m((function(e){return e.toggleWellNameExpand})),_=i(!1),j=e(_,2),w=j[0],M=j[1],T=null==W?void 0:W.some((function(e){return e.key===c.company})),E=null==W?void 0:W.some((function(e){return e.key===c.interventionAsset})),V=null==W?void 0:W.some((function(e){return e.key===c.padName})),L=null==W?void 0:W.some((function(e){return e.key===c.formation})),P=null==W?void 0:W.some((function(e){return e.key===c.rig})),R=null==W?void 0:W.some((function(e){return e.key===c.distance})),U=function(e){C(e,e===S&&v===l.ASC?l.DESC:l.ASC)};if(!W)return null;var z=W.find((function(e){return e.key===c.taScore})),F=W.find((function(e){return e.key===c.wellSection}));return t(r,{className:y.tableRow,children:[o(u,{columnsWithDict:W,sortBy:S,sortDirection:v,indeterminate:D,isAllWellsSelected:b,handleChangeAllOffsetWells:A,wellNameStyle:g,isViewOnly:I,open:B,isWellNameExpand:H,toggleWellNameExpand:O,onSort:U}),T&&o(d,{testId:"".concat(p,"_company"),columnKey:c.company,label:"Company",columnsWithDict:W,sortBy:S,sortDirection:v,onSort:U}),E&&o(d,{testId:"".concat(p,"_interventionAsset"),columnKey:c.interventionAsset,label:"Intervention Asset",columnsWithDict:W,sortBy:S,sortDirection:v,onSort:U}),V&&o(d,{testId:"".concat(p,"_padName"),columnKey:c.padName,label:"Pad",columnsWithDict:W,sortBy:S,sortDirection:v,onSort:U}),L&&o(d,{testId:"".concat(p,"_formation"),columnKey:c.formation,label:"Formation",columnsWithDict:W,sortBy:S,sortDirection:v,onSort:U}),P&&o(d,{testId:"".concat(p,"_rig"),columnKey:c.rig,label:"Rig",columnsWithDict:W,sortBy:S,sortDirection:v,onSort:U}),R&&o(d,{testId:"".concat(p,"_distance"),columnKey:c.distance,label:"Distance (".concat(k?"miles":"km",")"),columnsWithDict:W,sortBy:S,sortDirection:v,onSort:U}),K&&o(s,{"data-testid":"".concat(p,"_ta"),className:y.headCell,style:{minWidth:(null==z?void 0:z.minWidth)||0,flex:(null==z?void 0:z.flex)||0},children:o("div",{className:y.nameWrapper,children:"TA %"})}),o(d,{testId:"".concat(p,"_LastActive"),columnKey:c.lastActive,label:"Last Active",columnsWithDict:W,sortBy:S,sortDirection:v,onSort:U}),o(f,{columnsWithDict:W,metricsKeys:h,sortBy:S,sortDirection:v,isMetricsMenuOpen:w,onSort:U,onUpdateMetricsKey:N,setIsMetricsMenuOpen:M}),x&&o(s,{"data-testid":"".concat(p,"_WellSection"),className:y.headCell,style:{minWidth:(null==F?void 0:F.minWidth)||0,flex:(null==F?void 0:F.flex)||0},children:o("span",{className:y.headerLabel,children:"Well Section"})})]})}));W.displayName="OffsetWellsTableHead";export{W as OffsetWellsTableHead};
//# sourceMappingURL=OffsetWellsTableHead.js.map
