"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),t=require("react");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(e);exports.useGridEdgeDetection=function(e){var r=e.minItemWidth,u=e.gap,i=t.useState(null),o=n.default(i,2),a=o[0],c=o[1],f=t.useState(0),s=n.default(f,2),l=s[0],d=s[1],v=t.useCallback((function(e){c(e)}),[]);t.useEffect((function(){if(a){d(a.offsetWidth);var e=new ResizeObserver((function(e){var t=e[0];t&&d(t.contentRect.width)}));return e.observe(a),function(){return e.disconnect()}}d(0)}),[a]);var b=t.useMemo((function(){return 0===l?1:Math.floor((l+u)/(r+u))}),[l,u,r]);return{containerRef:v,isAtRightEdge:t.useCallback((function(e,t){return(e+1)%b==0||e===t-1}),[b])}};
//# sourceMappingURL=useGridEdgeDetection.js.map
