import{$a as go,Ja as g,Ka as ff,Kr as Tu,N as Bn,S as Ahe,St as G,Yo as lf,_s as ph,gs as pf,io as hn,ta as al,x as Ae}from"./chunk-b0nJCs5_.js";var O=class l{el=g(Bn);percentLimit=ph(70);onItself=ph(!1,{transform:Tu});dataObservable=ph(void 0);nearOfBottom=Ahe();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 S=al(this.onItself()?this.container:window,`scroll`).pipe(ff(!0),pf(200,void 0,{leading:!0,trailing:!0}),G(()=>this.getScrollInfo()),lf((e,o)=>e.current===o.current),go());this.scrollDownSub=S.pipe(Ae(({current:e})=>this.isScrollingDown(e)),Ae(({current:e,maximumScroll:o})=>e/o>this.decimalLimit)).subscribe(()=>{this.nearOfBottom.emit()});let s=this.dataObservable();s&&s.pipe(Ae(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 i=this.lastCurrentBottom<t;return this.lastCurrentBottom=t,i}static ɵfac=function(i){return new(i||l)};static ɵdir=hn({type:l,selectors:[[``,`myInfiniteScroller`,``]],inputs:{percentLimit:[1,`percentLimit`],onItself:[1,`onItself`],dataObservable:[1,`dataObservable`]},outputs:{nearOfBottom:`nearOfBottom`}})};export{O as t};
//# debugId=54e948db-0aff-53d4-92b1-c35c2734b055
//# sourceMappingURL=chunk-xpAb-8o8.js.map