"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../utils/disposables.js"),r=require("../utils/dom.js"),s=require("./use-latest-value.js");exports.useOnDisappear=function(i,n,u){let l=s.useLatestValue((e=>{let t=e.getBoundingClientRect();0===t.x&&0===t.y&&0===t.width&&0===t.height&&u()}));e.useEffect((()=>{if(!i)return;let e=null===n?null:r.isHTMLElement(n)?n:n.current;if(!e)return;let s=t.disposables();if("undefined"!=typeof ResizeObserver){let t=new ResizeObserver((()=>l.current(e)));t.observe(e),s.add((()=>t.disconnect()))}if("undefined"!=typeof IntersectionObserver){let t=new IntersectionObserver((()=>l.current(e)));t.observe(e),s.add((()=>t.disconnect()))}return()=>s.dispose()}),[n,l,i])};
//# sourceMappingURL=use-on-disappear.js.map
