"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var use_window_size_change_exports = {};
__export(use_window_size_change_exports, {
  useWindowSizeChange: () => useWindowSizeChange
});
module.exports = __toCommonJS(use_window_size_change_exports);
var import_react = require("react");
var import_pubsub_js = require("pubsub-js");
var import_constants = require("../utils/constants.js");
const useWindowSizeChange = () => {
  (0, import_react.useEffect)(() => {
    if (window.ResizeObserver) {
      const observer = new ResizeObserver((entries) => {
        (0, import_pubsub_js.publish)(import_constants.HOST_WINDOW_RESIZED, entries && entries[0]);
      });
      observer.observe(window.document.documentElement);
      return () => {
        observer.unobserve(window.document.documentElement);
      };
    }
    return () => {
    };
  }, []);
};
