"use strict";var e=require('./../../ext-esm/tslib/tslib.es6.js'),t=require("react/jsx-runtime"),i=require("react"),r=require("prop-types"),n=require("classnames"),a=require("react-draggable"),s=require("@material-ui/core/styles"),l=require("@material-ui/core");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=u(r),d=u(n),c=u(a),f=s.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(r){var n,a,s=r.children,u=r.cellName,o=r.nextCellName,p=r.widths,h=r.handleWidthsUpdate,v=f(),g=i.useState(!1),x=g[0],q=g[1],b=i.useState(),y=b[0],R=b[1],j=i.useState(),_=j[0],C=j[1];if(i.useEffect((function(){var e;R(m("content-".concat(u))+12),C(m("content-".concat(o))+12),h(((e={})[u]=m(u),e))}),[]),!s)return null;return t.jsx(l.TableCell,e.__assign({width:p[u],id:u},s.props,{children:t.jsxs("div",e.__assign({className:v.resizableColumnHeader},{children:[t.jsx("div",e.__assign({id:"content-".concat(u)},{children:null!==(a=null===(n=null==s?void 0:s.props)||void 0===n?void 0:n.children)&&void 0!==a?a:null})),t.jsx(c.default,e.__assign({axis:"x",onDrag:function(e,t){!function(e){var t,i=p[u]+e,r=p[o]-e;i<0||i<y||r<_||h(((t={})[u]=i,t[o]=r,t))}(t.deltaX)},position:{x:0},zIndex:999,onStart:function(){q(!0)},onStop:function(){var e;p[u]!==m(u)&&h(((e={})[u]=m(u),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:o.default.element.isRequired,cellName:o.default.string.isRequired,nextCellName:o.default.string.isRequired,widths:o.default.shape({}).isRequired,handleWidthsUpdate:o.default.func.isRequired};p.propTypes=h,module.exports=p;
