"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),n=require("../../stores/picker-props-store/usePickerPropsStore.js"),r=require("../../stores/view-store/useViewStore.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=i(e);exports.useRowInteractions=function(e){var i=e.data,o=e.isLimitedOffsetWells,c=e.maxOffsetWellNumber,l=e.metricsKeys,u=e.isWellSectionColumnVisible,a=e.handleChangeOffsetWell,f=e.setActiveWellId,d=e.onRowClick,h=e.registerRow,p=n.usePickerPropsStore((function(e){return e.isWDUser})),k=n.usePickerPropsStore((function(e){return e.isViewOnly})),w=r.useViewStore((function(e){return e.isMapHidden})),m=t.useState(i.checked),b=s.default(m,2),C=b[0],v=b[1],S=t.useCallback((function(e){h(i.id,e)}),[h,i.id]);t.useEffect((function(){v(i.checked)}),[i.checked]);var W=t.useMemo((function(){return k?"View only mode. To edit offsets, use ".concat(p?"Offset Well Selection app":"WellHub","."):o&&!i.checked?"App can't process more than (".concat(c-1,") Offset Wells."):""}),[k,o,i.checked,p,c]),M=t.useMemo((function(){return u?"wellSection":l.length>0?"lastMetric":"lastActive"}),[u,l.length]);return{isViewOnly:k,isMapHidden:w,isChecked:C,rowRef:S,handleChangeCheckbox:function(e){a(i,e),v(e)},checkboxTooltipText:W,lastCellColumn:M,handleMouseEnter:function(){f(i.id)},handleMouseLeave:function(){f(null)},handleRowClick:function(){w||null==d||d(i.id)}}};
//# sourceMappingURL=useRowInteractions.js.map
