"use strict";var e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/slicedToArray"),t=require("@material-ui/core"),o=require("lodash"),n=require("react"),i=require("../ChartWrapperContext.js"),a=require("../constants.js"),l=require("../effects/useZoom.js"),c=require("../effects/useChartModifier.js"),u=require("../effects/useChartTypeSwitch.js"),s=require("./AxisOverlay.js"),h=require("react/jsx-runtime");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var v=d(e),f=d(r);function m(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function p(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?m(Object(t),!0).forEach((function(r){v.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):m(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var C=t.makeStyles({container:{width:"100%",height:"100%",position:"relative"}}),y={zoomType:"xy",panning:{enabled:!0,type:"xy"}},b=function(e){var r,t,d,v,m,b,g,j,O=e.children,S=e.chartRef,Z=e.isAxesCoordinatesShown,x=void 0!==Z&&Z,q=e.onCustomizeScaleClick,E=void 0===q?null:q,w=e.onZoomChangeCallback,P=void 0===w?function(){}:w,T=e.chartOptions,k=void 0===T?{}:T,z=C(),A=n.useState({}),H=f.default(A,2),M=H[0],D=H[1],I=l.useZoom({chart:null===(r=S.current)||void 0===r?void 0:r.chart}),R=I.zoomStatus,B=I.zoomConfig,N=I.handleZoomEvent,_=I.handleResetZoom,G=I.isZoomEnabled,W=I.handleIsZoomEnabledChange,F=I.debouncedChartSelection;n.useEffect((function(){var e,r,t;o.isEmpty(null===(e=S.current)||void 0===e?void 0:e.chart)||D({marginBottom:null===(r=S.current)||void 0===r||null===(t=r.chart)||void 0===t?void 0:t.marginBottom})}),[]);var J=(null===(t=S.current)||void 0===t||null===(d=t.chart)||void 0===d||null===(v=d.plotBox)||void 0===v?void 0:v.height)<=a.MIN_CHART_HEIGHT;c.useChartModifier({chart:null===(m=S.current)||void 0===m?void 0:m.chart,chartOptions:o.merge({},y,k),isZoomEnabled:G,isMinHeightChart:J,onZoomChangeCallback:P,handleChartSelection:F,isAxesCoordinatesShown:x});var K=u.useChartTypeSwitch({chart:null===(b=S.current)||void 0===b?void 0:b.chart}),L=K.chartType,Q=K.handleChartTypeChange,U={chart:null===(g=S.current)||void 0===g?void 0:g.chart,chartType:L,zoomConfig:B,chartStyles:M,zoomStatus:R,isZoomEnabled:G,setChartStyles:D,handleChartTypeChange:Q,handleResetZoom:_,handleZoomEvent:N,isMinHeightChart:J,handleChartSelection:F,handleChangeChartStyles:function(e){D((function(r){return p(p({},r),e)}))},handleIsZoomEnabledChange:W};return h.jsx("div",{className:z.container,children:h.jsxs(i.Provider,{value:U,children:[O,E&&(null===(j=S.current)||void 0===j?void 0:j.chart.axes.map((function(e){return h.jsx(s,p({onCustomizeScaleClick:E},e),e.coll)})))]})})};b.defaultProps={onZoomChangeCallback:function(){}},module.exports=b;
//# sourceMappingURL=ChartWrapper.js.map
