import{arrayOf as e,shape as t,string as r,bool as i}from"prop-types";import{makeStyles as o,withStyles as n,TableCell as a,TableBody as l,TableRow as d,Typography as c}from"@material-ui/core";import{Done as s}from"@material-ui/icons";import p from"classnames";import{jsxs as h,jsx as u}from"react/jsx-runtime";var b=o((function(e){return{wellCell:{minWidth:function(e){var t=e.isTablet,r=e.isMobile;return t||!r?"330px":"180px"},maxWidth:function(e){var t=e.isTablet,r=e.isMobile;return!t&&r&&"200px"},position:"sticky",left:0,zIndex:1,background:e.palette.background.b9},wellName:{display:"-webkit-box",alignItems:"center",overflow:"hidden",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflowWrap:"break-word"},iconCell:{textAlign:"center",width:"60px"},rightAlign:{textAlign:"center"},doneIcon:{height:"16px",color:e.palette.primary.light},shadow:{position:"sticky",zIndex:10,border:0,padding:0,margin:0,"&::after":{content:"' '",pointerEvents:"none",position:"absolute"}},topShadow:{height:0,top:"48px","&::after":{left:0,right:0,height:"16px",background:"linear-gradient(0deg, rgba(65, 65, 65, 0) 0%, ".concat(e.palette.background.b9," 100%)")}},bottomShadow:{height:0,bottom:"16px","&::after":{left:0,right:0,height:"16px",background:"linear-gradient(180deg, rgba(65, 65, 65, 0) 0%, ".concat(e.palette.background.b9," 100%)")}},rightShadow:{right:0,padding:"0 !important","&::after":{width:"16px",top:0,bottom:0,right:0,background:"linear-gradient(90deg, rgba(65, 65, 65, 0) 0%, ".concat(e.palette.background.b9," 100%)")}}}}));function g(e,t,r){return t[r]<e[r]?-1:t[r]>e[r]?1:0}function m(e,t){return"desc"===e?function(e,r){return g(e,r,t)}:function(e,r){return-g(e,r,t)}}var f=n({root:{boxSizing:"border-box",padding:"6px 8px !important"}})(a);function w(e){var t,r,i,o=e.rows,n=e.headCells,g=e.order,w=e.orderBy,x=e.isTablet,k=e.isMobile,v=b({isTablet:x,isMobile:k});return h(l,{children:[o.length>0&&u(d,{children:u(a,{colSpan:"100%",className:p(v.shadow,v.topShadow)})}),(t=o,r=m(g,w),i=t.map((function(e,t){return[e,t]})),i.sort((function(e,t){var i=r(e[0],t[0]);return 0!==i?i:e[1]-t[1]})),i.map((function(e){return e[0]}))).map((function(e,t){return h(d,{children:[u(f,{id:"enhanced-table-checkbox-".concat(t),scope:"row",className:v.wellCell,children:u(c,{variant:"body2",className:v.wellName,children:e.name})}),n.map((function(t){return u(f,{className:v.iconCell,children:e[t.id]?u(s,{className:v.doneIcon}):""},"offset-well-table-row-".concat(t.id))})),u(a,{colSpan:"100%",className:p(v.shadow,v.rightShadow)})]},e.id)})),o.length>0&&u(d,{children:u(a,{colSpan:"100%",className:p(v.shadow,v.bottomShadow)})})]})}w.propTypes={rows:e(t({})).isRequired,headCells:e(t({})).isRequired,order:r.isRequired,orderBy:r.isRequired,isTablet:i.isRequired,isMobile:i.isRequired};export{w as default};
