import{H as u,M as f,P as b,T as d,Ua as O,aa as p,n as m,s as h,sa as g,sc as w,ta as o,ua as S,x as n}from"./chunk-EWB56PWF.js";import{i as c}from"./chunk-2T7OYDCL.js";var k=(()=>{let i=class i{el=p(S);percentLimit=o(70);onItself=o(!1,{transform:w});dataObservable=o(void 0);nearOfBottom=g();decimalLimit=0;lastCurrentBottom;scrollDownSub;container;checkScroll=!1;constructor(){this.decimalLimit=this.percentLimit()/100}ngAfterViewChecked(){this.checkScroll&&(this.checkScroll=!1,setTimeout(()=>{this.hasScroll()===!1&&this.nearOfBottom.emit()}))}ngOnInit(){this.initialize()}ngOnDestroy(){this.scrollDownSub&&this.scrollDownSub.unsubscribe()}initialize(){this.container=this.onItself()?this.el.nativeElement:document.documentElement;let t={leading:!0,trailing:!0},r=this.onItself()?this.container:window,B=h(r,"scroll").pipe(b(!0),d(200,void 0,t),m(()=>this.getScrollInfo()),u((e,l)=>e.current===l.current),f());this.scrollDownSub=B.pipe(n(({current:e})=>this.isScrollingDown(e)),n(({current:e,maximumScroll:l})=>e/l>this.decimalLimit)).subscribe(()=>{this.nearOfBottom.emit()});let a=this.dataObservable();a&&a.pipe(n(e=>e.length!==0)).subscribe(()=>this.checkScroll=!0)}getScrollInfo(){return{current:this.container.scrollTop,maximumScroll:this.getMaximumScroll()}}getMaximumScroll(){let t=this.onItself()?this.container.clientHeight:window.innerHeight;return this.container.scrollHeight-t}hasScroll(){return this.getMaximumScroll()>0}isScrollingDown(t){if(this.lastCurrentBottom===void 0)return this.lastCurrentBottom=t,!1;let r=this.lastCurrentBottom<t;return this.lastCurrentBottom=t,r}};c(i,"\u0275fac",function(r){return new(r||i)}),c(i,"\u0275dir",O({type:i,selectors:[["","myInfiniteScroller",""]],inputs:{percentLimit:[1,"percentLimit"],onItself:[1,"onItself"],dataObservable:[1,"dataObservable"]},outputs:{nearOfBottom:"nearOfBottom"}}));let s=i;return s})();export{k as a};
/**i18n:85d030b7fdd36d163c6d41dcef9178681a6baa573eb199e8b12fe27dbb057a98*/
//# sourceMappingURL=chunk-YL4KXGCV.js.map
