Liferay.Loader.define("commerce-frontend-js@4.0.52/components/infinite_scroller/InfiniteScroller",["module","exports","require","@frontend-taglib-clay$clayui/loading-indicator","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=l(r("@frontend-taglib-clay$clayui/loading-indicator")),o=(l(r("liferay!frontend-js-react-web$prop-types")),function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=a();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var l=n?Object.getOwnPropertyDescriptor(e,o):null;l&&(l.get||l.set)?Object.defineProperty(r,o,l):r[o]=e[o]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react")));function a(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return a=function(){return e},e}function l(e){return e&&e.__esModule?e:{default:e}}var c=function({children:e,customLoader:t,maxHeight:r,onBottomTouched:a,scrollCompleted:l}){const[c,u]=(0,o.useState)(!1),i=(0,o.useRef)(null),[f,s]=(0,o.useState)(!1),d=(0,o.useRef)(null),p=(0,o.useCallback)((e=>{d.current=e,u(!0)}),[]),y=(0,o.useCallback)((e=>{i.current=e,s(!0)}),[]),b=(0,o.useCallback)((()=>{if(!d.current||!i.current||!IntersectionObserver)return;const e={root:d.current,rootMargin:"0px",threshold:1};new IntersectionObserver((e=>{1===e[0].intersectionRatio&&a()}),e).observe(i.current)}),[a]);return(0,o.useEffect)((()=>{c&&f&&!l&&b()}),[c,f,l,b]),o.default.createElement("div",{className:"inline-scroller",ref:p,style:r?{maxHeight:r}:null},e,!l&&(t?o.default.createElement(t,{ref:y}):o.default.createElement(n.default,{ref:y,small:!0})))};t.default=c}}));
//# sourceMappingURL=InfiniteScroller.js.map