"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("lodash/debounce"),t=require("zustand"),u=require("../../stores/viewport-store/ViewportStoreContext.js"),n=require("../../stores/utils/useContextOrThrow.js"),s=require("../useTileCache/useTileCache.js"),i=require("./constants.js"),o=require("./useHandleBoundsChange.js"),c=require("./useCompanyIdResetEffect.js"),a=require("./useDrillingFilterResetEffect.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=l(r);exports.useViewportWells=function(){var r=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],l=n.useContextOrThrow(u.ViewportStoreContext),d=t.useStore(l,(function(e){return e.bounds})),C=t.useStore(l,(function(e){return e.clearTiles})),h=s.useTileCache(),q=h.getCachedTile,g=h.setCachedTile,p=h.clearCache,R=e.useRef({pending:[],inProgress:new Set}),T=e.useRef((function(){})),j=o.useHandleBoundsChange({enabled:r,store:l,queueRef:R,getCachedTile:q,setCachedTile:g});T.current=j;var E=e.useRef(f.default((function(e){T.current(e)}),i.DEBOUNCE_DELAY));e.useEffect((function(){E.current(d)}),[d]),c.useCompanyIdResetEffect({enabled:r,store:l,queueRef:R,clearCache:p,clearTiles:C,handleBoundsChangeRef:T}),a.useDrillingFilterResetEffect({enabled:r,store:l,queueRef:R,clearCache:p,clearTiles:C,handleBoundsChangeRef:T}),e.useEffect((function(){var e=E.current,r=R.current;return function(){e.cancel(),r.pending=[]}}),[])};
//# sourceMappingURL=useViewportWells.js.map
