import{Cb as P,Ka as l,Sb as r,T as b,Wa as _,Za as h,_a as m,aa as u,ba as d,db as C,hb as s,ib as p,kb as y,lb as f,ma as x,mb as c,na as i,ub as g,zb as v}from"./chunk-MFMPTNOZ.js";function S(t){return t.map(n=>n.map(e=>`"${String(e??"").replace(/"/g,'""')}"`).join(",")).join(`\r
`)}var w="\uFEFF";function O(t){return new Blob([w+S(t)],{type:"text/csv;charset=utf-8"})}function R(t,n){let e=URL.createObjectURL(t),a=document.createElement("a");a.href=e,a.download=n,a.click(),URL.revokeObjectURL(e)}function T(t,n="csv"){return`${t}-${new Date().toISOString().slice(0,10)}.${n}`}function k(t,n){if(t&1){let e=y();s(0,"nav",0)(1,"button",1),f("click",function(){u(e);let o=c();return d(o.go(o.safePage()-1))}),g(2," \u2039 Previous "),p(),s(3,"span",2),g(4),p(),s(5,"button",1),f("click",function(){u(e);let o=c();return d(o.go(o.safePage()+1))}),g(6," Next \u203A "),p()()}if(t&2){let e=c();h("aria-label",e.label()),l(),m("disabled",e.safePage()<=1),l(3),v(" ",e.from(),"\u2013",e.to()," of ",e.total()," ",e.noun()," "),l(),m("disabled",e.safePage()>=e.pageCount())}}var M=class t{total=i.required();page=i.required();pageSize=i.required();noun=i("items");label=i("Pagination");pageChange=x();pageCount=r(()=>Math.max(1,Math.ceil(this.total()/this.pageSize())));safePage=r(()=>Math.min(Math.max(1,this.page()),this.pageCount()));from=r(()=>this.total()===0?0:(this.safePage()-1)*this.pageSize()+1);to=r(()=>Math.min(this.safePage()*this.pageSize(),this.total()));go(n){let e=Math.min(Math.max(1,n),this.pageCount());e!==this.safePage()&&this.pageChange.emit(e)}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=b({type:t,selectors:[["app-paginator"]],inputs:{total:[1,"total"],page:[1,"page"],pageSize:[1,"pageSize"],noun:[1,"noun"],label:[1,"label"]},outputs:{pageChange:"pageChange"},standalone:!0,features:[P],decls:1,vars:1,consts:[[1,"pager"],["type","button",1,"pager__btn",3,"click","disabled"],["aria-live","polite",1,"pager__range"]],template:function(e,a){e&1&&_(0,k,7,7,"nav",0),e&2&&C(a.pageCount()>1?0:-1)},styles:[".pager[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end;gap:12px;margin-top:12px;padding-top:12px;border-top:1px solid var(--line, #e7e5f2)}.pager__range[_ngcontent-%COMP%]{font-size:.82rem;color:var(--muted);font-variant-numeric:tabular-nums}.pager__btn[_ngcontent-%COMP%]{padding:6px 12px;border:1px solid var(--line, #e7e5f2);border-radius:999px;background:var(--surface, #fff);font-size:.82rem;font-weight:600;cursor:pointer}.pager__btn[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--brand-600, #5b3ce0);color:var(--brand-700, #4a2fc4)}.pager__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:default}"],changeDetection:0})};function F(t,n,e){let a=Math.max(1,Math.ceil(t.length/e)),o=Math.min(Math.max(1,n),a);return t.slice((o-1)*e,o*e)}export{O as a,R as b,T as c,M as d,F as e};
