text: "use strict";
  
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports._rs = exports._el = void 0;
  exports.observe = observe;
  exports.unobserve = unobserve;
  
  var _resizeObserverPolyfill = _interopRequireDefault(require("resize-observer-polyfill"));
  
  // =============================== Const ===============================
  var elementListeners = new Map();
  
  function onResize(entities) {
    entities.forEach(function (entity) {
      var _elementListeners$get;
  
      var target = entity.target;
      (_elementListeners$get = elementListeners.get(target)) === null || _elementListeners$get === void 0 ? void 0 : _elementListeners$get.forEach(function (listener) {
        return listener(target);
      });
    });
  } // Note: ResizeObserver polyfill not support option to measure border-box resize
  
  
  var resizeObserver = new _resizeObserverPolyfill.default(onResize); // Dev env only
  
  var _el = process.env.NODE_ENV !== 'production' ? elementListeners : null; // eslint-disable-line
  
  
  exports._el = _el;
  
  var _rs = process.env.NODE_ENV !== 'production' ? onResize : null; // eslint-disable-line
  // ============================== Observe ==============================
  
  
  exports._rs = _rs;
  
  function observe(element, callback) {
    if (!elementListeners.has(element)) {
      elementListeners.set(element, new Set());
      resizeObserver.observe(element);
    }
  
    elementListeners.get(element).add(callback);
  }
  
  function unobserve(element, callback) {
    if (elementListeners.has(element)) {
      elementListeners.get(element).delete(callback);
  
      if (!elementListeners.get(element).size) {
        resizeObserver.unobserve(element);
        elementListeners.delete(element);
      }
    }
  }