"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),n=require("lodash"),t=require("../components/DevCenter/IsolatedDevCenterAppContainer/constants.js"),r=function(){var e;return null===(e=document.getElementById(t.ISOLATED_PAGE_APP_CONTAINER_ID))||void 0===e?void 0:e.firstElementChild};exports.useMatchAppContainerSize=function(i){var o=void 0===i?{}:i,u=o.width,l=o.height,a=e.useRef(r()),c=function(){var e,n=null===(e=a.current)||void 0===e?void 0:e.getBoundingClientRect();if(!n)return console.error("#".concat(t.ISOLATED_PAGE_APP_CONTAINER_ID,' component is not available. Check if you are not using "useMatchAppContainerSize" hook outside of DC app')),null;var r="number"!=typeof(null==u?void 0:u.min)||u.min<n.width,i="number"!=typeof(null==u?void 0:u.max)||u.max>n.width,o="number"!=typeof(null==l?void 0:l.min)||l.min<n.height,c="number"!=typeof(null==l?void 0:l.max)||l.max>n.height;return r&&i&&o&&c},s=e.useState(a.current?c():null),d=s[0],f=s[1],v=e.useCallback(n.throttle((function(){return f(c())}),200),[u,l]);return e.useEffect((function(){a.current||(a.current=r(),f(c()))}),[]),e.useEffect((function(){return window.addEventListener("resize",v),function(){window.removeEventListener("resize",v)}}),[]),d};
