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