"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),s=require("../utils/getClusterColorExpression.js"),r=require("./useMapStoreSelectors.js"),i=require("./useMapTooltipState.js");require("@babel/runtime/helpers/slicedToArray"),require("react"),require("geolib"),require("lodash/isEqual"),require("lodash/throttle"),require("../../../../../../utils/index.js"),require("../constants.js"),require("../../../../../../utils/convert.js"),require("@turf/circle"),require("@turf/bbox"),require("@mapbox/tilebelt"),require("@babel/runtime/helpers/toConsumableArray"),require("mapbox-gl");var t=require("./useWellMarkers.js");require("../../../../stores/selection-tool-store/SelectionToolStoreContext.js"),require("../../../../stores/selection-tool-store/SelectionToolStoreProvider.js"),require("zustand"),require("../../../../stores/viewport-store/ViewportStoreContext.js");var o=require("./useLoadingTilesGeoJSON.js"),l=require("./useSelectionToolOrchestration.js"),n=require("./useMapInteractionHandlers.js"),a=require("./useMapCameraControl.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=u(e);function d(e,s){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);s&&(i=i.filter((function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable}))),r.push.apply(r,i)}return r}function p(e){for(var s=1;s<arguments.length;s++){var r=null!=arguments[s]?arguments[s]:{};s%2?d(Object(r),!0).forEach((function(s){c.default(e,s,r[s])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))}))}return e}exports.useOffsetWellMapState=function(e){var u,c=e.subjectWell,d=e.wells,f=e.offsetWellIds,b=e.activeWellId,g=e.isClickable,S=r.useMapStoreSelectors(c),j=a.useMapCameraControl({mapRef:S.mapRef,subjectWellCoords:S.subjectWellCoords,subjectWell:c,isLoadAllWells:S.isLoadAllWells,isMapReady:S.isMapReady,selectionZone:e.selectionZone,shouldRecenter:e.shouldRecenter,onRecenterComplete:e.onRecenterComplete,radius:S.radius,selectionMode:S.selectionMode,circleGeoJSON:S.circleGeoJSON}),h=l.useSelectionToolOrchestration({mapRef:S.mapRef,isMapReady:S.isMapReady,wells:d,offsetWellIds:f,subjectWellId:null!==(u=null==c?void 0:c.id)&&void 0!==u?u:null,isViewOnly:S.isViewOnly,onBatchSelectWells:e.onBatchSelectWells,onSelectionZoneConfirm:e.onSelectionZoneConfirm,showSelectionResult:S.showSelectionResult}),O=i.useMapTooltipState({mapRef:S.mapRef,isViewOnly:S.isViewOnly,isClickable:g}),v=n.useMapInteractionHandlers({mapRef:S.mapRef,isViewOnly:S.isViewOnly,isRadiusToolActive:h.isRadiusToolActive,radiusDrawingHandlers:h.radiusDrawingHandlers,shouldSuppressClickRef:h.shouldSuppressClickRef,handleChangeOffsetWell:e.handleChangeOffsetWell,showTooltip:O.showTooltip,showClusterTooltip:O.showClusterTooltip,hideTooltip:O.hideTooltip,hoveredWell:O.hoveredWell,subjectWell:c,subjectWellCoords:S.subjectWellCoords,radiusState:h.radiusState,isRadiusDrawingDragging:h.isRadiusDrawingDragging,isRadiusHoveringEdge:h.isRadiusHoveringEdge,isRadiusHoveringInside:h.isRadiusHoveringInside,lassoState:h.lassoState,isLassoActive:h.isLassoActive,isDrawing:h.isDrawing,isEditingPolygon:h.isEditingPolygon,isEditingVertices:h.isEditingVertices,isShiftHeld:h.isShiftHeld,boxStateIsActive:h.boxState.isActive}),w=o.useLoadingTilesGeoJSON(),y=t.useWellMarkers({wells:d,offsetWellIds:f,activeWellId:b,subjectWell:c,mapStyle:S.mapStyle});return p(p(p(p(p(p(p({},S),j),h),v),O),y),{},{showGhostZone:!!e.selectionZone&&!h.isUserDrawing,isActiveWellIsSubjectWell:(null==c?void 0:c.id)===b,loadingTilesGeoJSON:w,clusterColorExpression:s.getClusterColorExpression(S.mapStyle)})};
//# sourceMappingURL=useOffsetWellMapState.js.map
