"use strict";var e=require('./../../ext-esm/tslib/tslib.es6.js'),t=require("react/jsx-runtime"),r=require("react"),i=require("prop-types"),n=require("classnames"),a=require("react-draggable"),l=require("@material-ui/core/styles"),u=require("@material-ui/core");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=o(i),d=o(n),c=o(a),f=l.makeStyles((function(e){return{resizableColumnHeader:{display:"flex",paddingRight:0,justifyContent:"space-between"},tableResizer:{width:6,borderRadius:10,opacity:.7,cursor:"col-resize",marginRight:-11,marginTop:-16,marginBottom:-16},hovered:{backgroundColor:e.palette.primary.main}}})),m=function(e){var t;return null===(t=document.getElementById(e))||void 0===t?void 0:t.offsetWidth};function p(i){var n,a,l=i.children,o=i.cellName,s=i.nextCellName,p=i.widths,h=i.handleWidthsUpdate,v=f(),g=r.useState(!1),x=g[0],q=g[1],b=r.useState(),y=b[0],R=b[1],j=r.useState(),C=j[0],z=j[1];if(r.useEffect((function(){var e;R(m("content-".concat(o))+12),z(m("content-".concat(s))+12),h(((e={})[o]=m(o),e))}),[]),!l)return null;return t.jsx(u.TableCell,e.__assign({width:p[o],id:o},l.props,{children:t.jsxs("div",{className:v.resizableColumnHeader,children:[t.jsx("div",{id:"content-".concat(o),children:null!==(a=null===(n=null==l?void 0:l.props)||void 0===n?void 0:n.children)&&void 0!==a?a:null}),t.jsx(c.default,{axis:"x",onDrag:function(e,t){!function(e){var t,r=p[o]+e,i=p[s]-e;r<0||r<y||i<C||h(((t={})[o]=r,t[s]=i,t))}(t.deltaX)},position:{x:0},zIndex:999,onStart:function(){q(!0)},onStop:function(){var e;p[o]!==m(o)&&h(((e={})[o]=m(o),e)),q(!1)},children:t.jsx("div",{className:d.default(v.tableResizer,x&&v.hovered),onMouseEnter:function(){return q(!0)},onMouseLeave:function(){return q(!1)}})})]})}))}var h={children:s.default.element.isRequired,cellName:s.default.string.isRequired,nextCellName:s.default.string.isRequired,widths:s.default.shape({}).isRequired,handleWidthsUpdate:s.default.func.isRequired};p.propTypes=h,module.exports=p;
