import React from 'react';
export var useWaitForElement = function useWaitForElement(selector, callback) {
  var deep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  React.useEffect(function () {
    var observer = new MutationObserver(function (mutations) {
      mutations.forEach(function (mutation) {
        mutation.addedNodes.forEach(function (node) {
          var element = node.querySelector(selector);
          if (element) {
            callback(element);
          }
        });
      });
    });
    observer.observe(document.body, {
      childList: true,
      subtree: deep
    });
    return function () {
      observer.disconnect();
    };
  }, []);
};
//# sourceMappingURL=useWaitForElement.js.map