import{Bb as f,Db as b,Kc as g,Lc as p,Mb as r,Nb as s,Ob as C,Sb as P,Tb as T,Ub as N,Xc as x,Yb as _,Yc as d,Za as o,Zb as c,ib as v,mc as l,nc as z,oc as M,pc as y,va as u,wa as h,xd as I}from"./chunk-GJDGQISV.js";function L(n,S){if(n&1){let t=N();r(0,"span",5),_("click",function(){u(t);let e=c();return h(e.onFetchTotalData())}),r(1,"i",6),l(2,"?"),s()()}}function R(n,S){if(n&1&&(P(0),r(1,"span"),l(2),g(3,"number"),s(),T()),n&2){let t=c();o(2),z(p(3,1,t.totalData()))}}function F(n,S){if(n&1){let t=N();r(0,"div",4)(1,"a",7),_("click",function(){u(t);let e=c();return h(e.onNextPage())}),C(2,"i",8),l(3," Next "),s(),r(4,"a",9),_("click",function(){u(t);let e=c();return h(e.onConcatAllData())}),C(5,"i",10),l(6," Show All "),s()()}}var q=(()=>{class n{constructor(){this.fetchTotalData=x(),this.nextPage=x(),this.concatAllData=x(),this.nextPageDisabled=d(!1),this.pageNumber=d(1),this.totalData=d(0),this.pageSize=20,this.totalCurrentRow=d(0),this.isFetchTotalData=d(!1),this.goToLast=d(!1),this._detectedPageSize=0}getNumber(t,i=0){try{if(typeof t=="function"){let e=t();return typeof e=="number"?e:Number(e)||i}return typeof t=="number"?t:Number(t)||i}catch(e){return i}}getBool(t){try{return typeof t=="function"?!!t():!!t}catch(i){return!1}}get startRecord(){let t=this.getNumber(this.totalCurrentRow,0);if(!t||t<=0)return 0;if(this.getBool(this.goToLast))return this.getNumber(this.totalData,0)>0?1:0;let i=Math.max(1,this.getNumber(this.pageNumber,1)),e=Math.max(1,this.getNumber(this.pageSize,20));!this._detectedPageSize&&i===1&&t>e&&(this._detectedPageSize=t);let m=this._detectedPageSize&&this._detectedPageSize>e?this._detectedPageSize:e;return Math.max(0,i-1)*m+1}get endRecord(){let t=this.getNumber(this.totalCurrentRow,0);if(!t||t<=0)return 0;if(this.getBool(this.goToLast))return this.getNumber(this.totalData,0)>0?this.getNumber(this.totalData,0):t;let i=Math.max(1,this.getNumber(this.pageNumber,1)),e=Math.max(1,this.getNumber(this.pageSize,20)),m=this._detectedPageSize&&this._detectedPageSize>e?this._detectedPageSize:e,E=(i-1)*m,a=0;t<=m?a=t:(a=Math.max(0,t-E),a=Math.min(a,m),a===0&&(a=Math.min(m,t)));let D=E+a,w=this.getNumber(this.totalData,0);return w>0&&(D=Math.min(D,w)),D}onFetchTotalData(){this.fetchTotalData.emit()}onNextPage(){this.nextPage.emit()}onConcatAllData(){this.concatAllData.emit()}static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275cmp=v({type:n,selectors:[["infinite-pagination"]],inputs:{nextPageDisabled:[1,"nextPageDisabled"],pageNumber:[1,"pageNumber"],totalData:[1,"totalData"],pageSize:"pageSize",totalCurrentRow:[1,"totalCurrentRow"],isFetchTotalData:[1,"isFetchTotalData"],goToLast:[1,"goToLast"]},outputs:{fetchTotalData:"fetchTotalData",nextPage:"nextPage",concatAllData:"concatAllData"},decls:12,vars:12,consts:[[1,"d-flex","justify-content-between","mt-5"],[1,"me-auto","d-sm-block","collapse","mt-3"],[1,"fw-bold","fst-italic","hidden-xxs"],[2,"cursor","pointer"],[1,"btn-group"],[2,"cursor","pointer",3,"click"],["matTooltipPosition","above","matTooltip","Retrieve rows count",1,"border","p-3"],["role","button","matTooltipPosition","above","matTooltip","Load next page",1,"btn","btn-outline-secondary","btn-sm","text-primary",3,"click"],[1,"fa-solid","fa-arrow-right"],["role","button","matTooltipPosition","above","matTooltip","Load all products",1,"btn","btn-outline-secondary","btn-sm","text-primary",3,"click"],[1,"fa-solid","fa-share"]],template:function(i,e){i&1&&(r(0,"div",0)(1,"div",1)(2,"div",2),l(3),g(4,"number"),g(5,"number"),P(6),f(7,L,3,0,"span",3),T(),f(8,R,4,3,"ng-container"),l(9),g(10,"number"),s()(),f(11,F,7,0,"div",4),s()),i&2&&(o(3),y(" Showing ",p(4,6,e.startRecord)," - ",p(5,8,e.endRecord)," of "),o(4),b(e.isFetchTotalData()?-1:7),o(),b(e.isFetchTotalData()?8:-1),o(),M(" records ~ ",p(10,10,e.pageNumber())," Page "),o(2),b(!e.nextPageDisabled()&&!e.goToLast()?11:-1))},dependencies:[I],encapsulation:2})}}return n})();export{q as a};
