"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),i=require("react-dom"),u=require("lodash"),n=require("@material-ui/core/styles"),o=require("@material-ui/pickers"),s=require("@date-io/moment"),l=require("moment"),a=require("../components/FiltersToggler.js"),c=require("../utils.js"),d=require("../constants.js"),f=require("../../../config/theme/index.js");require("@babel/runtime/helpers/typeof"),require("highcharts"),require("highcharts/highcharts-more"),require("highcharts-multicolor-series"),require("highcharts/modules/solid-gauge"),require("highcharts/modules/heatmap"),require("highcharts/modules/boost"),require("highcharts/modules/exporting"),require("highcharts/modules/xrange"),require("highcharts/modules/dumbbell"),require("highcharts/modules/pattern-fill"),require("dompurify"),require("../../../config/mapbox/index.js");var h=require("react/jsx-runtime");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=m(e),g=m(r),v=m(i),y=m(s),b=m(l);function q(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,i)}return t}function O(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?q(Object(t),!0).forEach((function(r){p.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):q(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}exports.useAppFilterTogglerWidth=function(){var e=t.useState(null),r=g.default(e,2),i=r[0],u=r[1];return t.useEffect((function(){var e=document.createElement("div");e.style.position="absolute",e.style.visibility="hidden",document.body.appendChild(e),v.default.render(h.jsx(n.MuiThemeProvider,{theme:f.darkTheme,children:h.jsx(a,{})}),e,(function(){var r=e.getBoundingClientRect();e.remove(),u(r.width)}))}),[]),i},exports.useComonentsWidth=function(e){var r=t.useRef({}),i=t.useState(null),s=g.default(i,2),l=s[0],a=s[1],c=t.useRef({});return t.useEffect((function(){var t=e.filter((function(e){return!!e}));u.isEqual(t,c.current)||(r.current={},t.forEach((function(e){var i=document.createElement("div");i.style.position="absolute",i.style.visibility="hidden",document.body.appendChild(i),e&&v.default.render(h.jsx(n.MuiThemeProvider,{theme:f.darkTheme,children:h.jsx(o.MuiPickersUtilsProvider,{libInstance:b.default,utils:y.default,children:e})}),i,(function(){var n=i.getBoundingClientRect();i.remove(),r.current=O(O({},r.current),{},p.default({},e.key,n.width)),Object.values(r.current).length===t.length&&(u.isEqual(l,r.current)||a(r.current))}))})),c.current=t)})),l},exports.useFilterLayout=function(e,r,i,u){var n=t.useState(null),o=g.default(n,2),s=o[0],l=o[1];return t.useEffect((function(){if(u&&r){var t=c.getStartComponent(e),n=c.getMiddleComponent(e),o=c.getEndComponents(e),s=t&&n&&!o,a=t&&!n&&o,f=t&&n&&o;if(t&&!n&&!o){var h=r[t.key];if(h<=u)return void l(d.LARGE_SIZE_LAYOUT);if(h<=u/2)return void l(d.MEDIUM_SIZE_LAYOUT)}else if(s||a){var m=r[t.key],p=s?r[n.key]:r[o.key];if(m+p<=u)return void l(d.LARGE_SIZE_LAYOUT);if(i+p<=u)return void l(d.MEDIUM_SIZE_LAYOUT)}else if(f){var g=r[t.key],v=r[n.key],y=r[o.key];if(g+v+y<=u)return void l(d.LARGE_SIZE_LAYOUT);if(i+v+y<=u)return void l(d.MEDIUM_SIZE_LAYOUT);if(i+y<=u)return void l(d.SMALL_SIZE_LAYOUT)}l(d.SMALL_SIZE_LAYOUT)}}),[r,u]),s};
