"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("zustand"),t=require("../../utils/tile-math.js");require("lodash"),require("../../stores/picker-props-store/PickerPropsStoreContext.js"),require("@babel/runtime/helpers/defineProperty"),require("@babel/runtime/helpers/objectWithoutProperties"),require("react/jsx-runtime"),require("../../viewport/ViewportProvider.js"),require("../../viewport/ViewportContext.js");var i=require("../../stores/picker-props-store/usePickerPropsStore.js"),s=require("../../stores/filter-store/useFilterStore.js"),u=require("./processQueue.js"),l=require("./filterTilesToFetch.js");exports.useHandleBoundsChange=function(o){var n=o.enabled,a=o.store,c=o.queueRef,d=o.getCachedTile,p=o.setCachedTile,f=r.useStore(a,(function(e){return e.getTileStatus})),T=r.useStore(a,(function(e){return e.setTileStatus})),h=r.useStore(a,(function(e){return e.addWellsToTile})),g=i.usePickerPropsStore((function(e){return e.addWellsUsabilityInfo})),q=i.usePickerPropsStore((function(e){return e.segment})),v=s.useFilterStore((function(e){var r;return null!==(r=e.filters.companyId)&&void 0!==r?r:null})),S=s.useFilterStore((function(e){var r;return null===(r=e.filters.drillingWells)||void 0===r||r})),P="drilling"===q&&S;return e.useCallback((function(e){if(n&&e){var r=t.getTilesForViewport(e);if(r.length>t.MAX_VIEWPORT_TILES_FOR_FETCH)c.current.pending=[];else{var i=l.filterTilesToFetch({visibleTiles:r,getTileStatus:f,getCachedTile:d,store:a,addWellsToTile:h});if(0!==i.length){var s=c.current;i.forEach((function(e){s.pending.includes(e)||s.inProgress.has(e)||s.pending.push(e)})),u.processQueue({queue:s,companyIds:v,drillingWells:P,addWellsUsabilityInfo:g,setCachedTile:p,addWellsToTile:h,setTileStatus:T})}}}}),[n,h,g,v,P,d,f,p,T,a,c])};
//# sourceMappingURL=useHandleBoundsChange.js.map
