import{B as J,_ as P,o as s,c as u,t as R,m as d,R as w,e as L,p as v,i as l,j as b,r as c,k as N,w as A,n as k,F as C,g as T,l as V,D as E,U as M,h as I,f as _,z as U}from"./entry.34a578c3.js";import{_ as h}from"./BaseComponent.e1e84baf.js";import{A as z,a as H,b as q}from"./index.c0e2550b.js";import B from"./Dropdown.3eae76c5.js";import W from"./InputNumber.fbe9ea51.js";import{A as G}from"./index.a8280885.js";import"./BaseIcon.b286bbcb.js";import"./VirtualScroller.58ab5e54.js";import"./index.46a1bb0d.js";import"./FilterService.135160df.js";import"./index.4d55d4a3.js";import"./index.4dd5b555.js";import"./index.66a6f8d0.js";import"./index.ce4627a3.js";import"./OverlayEventBus.d3705ed3.js";import"./Portal.42ae168f.js";import"./Button.db04b804.js";import"./Badge.cc0a8028.js";import"./index.ea7d1718.js";import"./index.39e9cd06.js";import"./InputText.acfed15d.js";const K={paginator:({instance:e,key:a})=>["p-paginator p-component",{"p-paginator-default":!e.hasBreakpoints(),[`p-paginator-${a}`]:e.hasBreakpoints()}],start:"p-paginator-left-content",end:"p-paginator-right-content",firstPageButton:({instance:e})=>["p-paginator-first p-paginator-element p-link",{"p-disabled":e.$attrs.disabled}],firstPageIcon:"p-paginator-icon",previousPageButton:({instance:e})=>["p-paginator-prev p-paginator-element p-link",{"p-disabled":e.$attrs.disabled}],previousPageIcon:"p-paginator-icon",nextPageButton:({instance:e})=>["p-paginator-next p-paginator-element p-link",{"p-disabled":e.$attrs.disabled}],nextPageIcon:"p-paginator-icon",lastPageButton:({instance:e})=>["p-paginator-last p-paginator-element p-link",{"p-disabled":e.$attrs.disabled}],lastPageIcon:"p-paginator-icon",pages:"p-paginator-pages",pageButton:({props:e,pageLink:a})=>["p-paginator-page p-paginator-element p-link",{"p-highlight":a-1===e.page}],current:"p-paginator-current",rowPerPageDropdown:"p-paginator-rpp-options",jumpToPageDropdown:"p-paginator-page-options",jumpToPageInput:"p-paginator-page-input"},Q=J.extend({name:"paginator",classes:K}),X={name:"BasePaginator",extends:h,props:{totalRecords:{type:Number,default:0},rows:{type:Number,default:0},first:{type:Number,default:0},pageLinkSize:{type:Number,default:5},rowsPerPageOptions:{type:Array,default:null},template:{type:[Object,String],default:"FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown"},currentPageReportTemplate:{type:null,default:"({currentPage} of {totalPages})"},alwaysShow:{type:Boolean,default:!0}},style:Q,provide(){return{$parentInstance:this}}},Y={name:"CurrentPageReport",hostName:"Paginator",extends:h,props:{pageCount:{type:Number,default:0},currentPage:{type:Number,default:0},page:{type:Number,default:0},first:{type:Number,default:0},rows:{type:Number,default:0},totalRecords:{type:Number,default:0},template:{type:String,default:"({currentPage} of {totalPages})"}},computed:{text(){return this.template.replace("{currentPage}",this.currentPage).replace("{totalPages}",this.pageCount).replace("{first}",this.pageCount>0?this.first+1:0).replace("{last}",Math.min(this.first+this.rows,this.totalRecords)).replace("{rows}",this.rows).replace("{totalRecords}",this.totalRecords)}}};function Z(e,a,n,p,i,t){return s(),u("span",d({class:e.cx("current")},e.ptm("current")),R(t.text),17)}const ee=P(Y,[["render",Z]]),te={name:"FirstPageLink",hostName:"Paginator",extends:h,props:{template:{type:Function,default:null}},methods:{getPTOptions(e){return this.ptm(e,{context:{disabled:this.$attrs.disabled}})}},components:{AngleDoubleLeftIcon:z},directives:{ripple:w}};function ae(e,a,n,p,i,t){const r=L("ripple");return v((s(),u("button",d({class:e.cx("firstPageButton"),type:"button"},t.getPTOptions("firstPageButton"),{"data-pc-group-section":"pagebutton"}),[(s(),l(b(n.template||"AngleDoubleLeftIcon"),d({class:e.cx("firstPageIcon")},t.getPTOptions("firstPageIcon")),null,16,["class"]))],16)),[[r]])}const ne=P(te,[["render",ae]]),se={name:"JumpToPageDropdown",hostName:"Paginator",extends:h,emits:["page-change"],props:{page:Number,pageCount:Number,disabled:Boolean,templates:null},methods:{onChange(e){this.$emit("page-change",e)}},computed:{pageOptions(){let e=[];for(let a=0;a<this.pageCount;a++)e.push({label:String(a+1),value:a});return e}},components:{JTPDropdown:B}};function re(e,a,n,p,i,t){const r=c("JTPDropdown");return s(),l(r,{modelValue:n.page,options:t.pageOptions,optionLabel:"label",optionValue:"value","onUpdate:modelValue":a[0]||(a[0]=o=>t.onChange(o)),class:k(e.cx("jumpToPageDropdown")),disabled:n.disabled,unstyled:e.unstyled,pt:e.ptm("jumpToPageDropdown"),"data-pc-group-section":"pagedropdown"},N({_:2},[n.templates.jumptopagedropdownicon?{name:"dropdownicon",fn:A(o=>[(s(),l(b(n.templates.jumptopagedropdownicon),{class:k(o.class)},null,8,["class"]))]),key:"0"}:void 0]),1032,["modelValue","options","class","disabled","unstyled","pt"])}const oe=P(se,[["render",re]]),ie={name:"JumpToPageInput",hostName:"Paginator",extends:h,inheritAttrs:!1,emits:["page-change"],props:{page:Number,pageCount:Number,disabled:Boolean},data(){return{d_page:this.page}},watch:{page(e){this.d_page=e}},methods:{onChange(e){e!==this.page&&(this.d_page=e,this.$emit("page-change",e-1))}},computed:{inputArialabel(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.jumpToPageInputLabel:void 0}},components:{JTPInput:W}};function pe(e,a,n,p,i,t){const r=c("JTPInput");return s(),l(r,{ref:"jtpInput",modelValue:i.d_page,class:k(e.cx("jumpToPageInput")),"aria-label":t.inputArialabel,disabled:n.disabled,"onUpdate:modelValue":t.onChange,unstyled:e.unstyled,pt:e.ptm("jumpToPageInput")},null,8,["modelValue","class","aria-label","disabled","onUpdate:modelValue","unstyled","pt"])}const le=P(ie,[["render",pe]]),ge={name:"LastPageLink",hostName:"Paginator",extends:h,props:{template:{type:Function,default:null}},methods:{getPTOptions(e){return this.ptm(e,{context:{disabled:this.$attrs.disabled}})}},components:{AngleDoubleRightIcon:H},directives:{ripple:w}};function ue(e,a,n,p,i,t){const r=L("ripple");return v((s(),u("button",d({class:e.cx("lastPageButton"),type:"button"},t.getPTOptions("lastPageButton"),{"data-pc-group-section":"pagebutton"}),[(s(),l(b(n.template||"AngleDoubleRightIcon"),d({class:e.cx("lastPageIcon")},t.getPTOptions("lastPageIcon")),null,16,["class"]))],16)),[[r]])}const de=P(ge,[["render",ue]]),ce={name:"NextPageLink",hostName:"Paginator",extends:h,props:{template:{type:Function,default:null}},methods:{getPTOptions(e){return this.ptm(e,{context:{disabled:this.$attrs.disabled}})}},components:{AngleRightIcon:G},directives:{ripple:w}};function me(e,a,n,p,i,t){const r=L("ripple");return v((s(),u("button",d({class:e.cx("nextPageButton"),type:"button"},t.getPTOptions("nextPageButton"),{"data-pc-group-section":"pagebutton"}),[(s(),l(b(n.template||"AngleRightIcon"),d({class:e.cx("nextPageIcon")},t.getPTOptions("nextPageIcon")),null,16,["class"]))],16)),[[r]])}const Pe=P(ce,[["render",me]]),he={name:"PageLinks",hostName:"Paginator",extends:h,inheritAttrs:!1,emits:["click"],props:{value:Array,page:Number},methods:{getPTOptions(e,a){return this.ptm(a,{context:{active:e===this.page}})},onPageLinkClick(e,a){this.$emit("click",{originalEvent:e,value:a})},ariaPageLabel(e){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.pageLabel.replace(/{page}/g,e):void 0}},directives:{ripple:w}},fe=["aria-label","aria-current","onClick","data-p-highlight"];function be(e,a,n,p,i,t){const r=L("ripple");return s(),u("span",d({class:e.cx("pages")},e.ptm("pages")),[(s(!0),u(C,null,T(n.value,o=>v((s(),u("button",d({key:o,class:e.cx("pageButton",{pageLink:o}),type:"button","aria-label":t.ariaPageLabel(o),"aria-current":o-1===n.page?"page":void 0,onClick:f=>t.onPageLinkClick(f,o)},t.getPTOptions(o-1,"pageButton"),{"data-p-highlight":o-1===n.page}),[V(R(o),1)],16,fe)),[[r]])),128))],16)}const ye=P(he,[["render",be]]),ke={name:"PrevPageLink",hostName:"Paginator",extends:h,props:{template:{type:Function,default:null}},methods:{getPTOptions(e){return this.ptm(e,{context:{disabled:this.$attrs.disabled}})}},components:{AngleLeftIcon:q},directives:{ripple:w}};function we(e,a,n,p,i,t){const r=L("ripple");return v((s(),u("button",d({class:e.cx("previousPageButton"),type:"button"},t.getPTOptions("previousPageButton"),{"data-pc-group-section":"pagebutton"}),[(s(),l(b(n.template||"AngleLeftIcon"),d({class:e.cx("previousPageIcon")},t.getPTOptions("previousPageIcon")),null,16,["class"]))],16)),[[r]])}const Le=P(ke,[["render",we]]),ve={name:"RowsPerPageDropdown",hostName:"Paginator",extends:h,emits:["rows-change"],props:{options:Array,rows:Number,disabled:Boolean,templates:null},methods:{onChange(e){this.$emit("rows-change",e)}},computed:{rowsOptions(){let e=[];if(this.options)for(let a=0;a<this.options.length;a++)e.push({label:String(this.options[a]),value:this.options[a]});return e}},components:{RPPDropdown:B}};function _e(e,a,n,p,i,t){const r=c("RPPDropdown");return s(),l(r,{modelValue:n.rows,options:t.rowsOptions,optionLabel:"label",optionValue:"value","onUpdate:modelValue":a[0]||(a[0]=o=>t.onChange(o)),class:k(e.cx("rowPerPageDropdown")),disabled:n.disabled,unstyled:e.unstyled,pt:e.ptm("rowPerPageDropdown"),"data-pc-group-section":"pagedropdown"},N({_:2},[n.templates.rowsperpagedropdownicon?{name:"dropdownicon",fn:A(o=>[(s(),l(b(n.templates.rowsperpagedropdownicon),{class:k(o.class)},null,8,["class"]))]),key:"0"}:void 0]),1032,["modelValue","options","class","disabled","unstyled","pt"])}const Ce=P(ve,[["render",_e]]),Te={name:"Paginator",extends:X,inheritAttrs:!1,emits:["update:first","update:rows","page"],data(){return{d_first:this.first,d_rows:this.rows}},watch:{first(e){this.d_first=e},rows(e){this.d_rows=e},totalRecords(e){this.page>0&&e&&this.d_first>=e&&this.changePage(this.pageCount-1)}},mounted(){this.setPaginatorAttribute(),this.createStyle()},methods:{changePage(e){const a=this.pageCount;if(e>=0&&e<a){this.d_first=this.d_rows*e;const n={page:e,first:this.d_first,rows:this.d_rows,pageCount:a};this.$emit("update:first",this.d_first),this.$emit("update:rows",this.d_rows),this.$emit("page",n)}},changePageToFirst(e){this.isFirstPage||this.changePage(0),e.preventDefault()},changePageToPrev(e){this.changePage(this.page-1),e.preventDefault()},changePageLink(e){this.changePage(e.value-1),e.originalEvent.preventDefault()},changePageToNext(e){this.changePage(this.page+1),e.preventDefault()},changePageToLast(e){this.isLastPage||this.changePage(this.pageCount-1),e.preventDefault()},onRowChange(e){this.d_rows=e,this.changePage(this.page)},createStyle(){var e,a,n;if(this.hasBreakpoints()&&!this.isUnstyled){this.styleElement=document.createElement("style"),this.styleElement.type="text/css",E.setAttribute(this.styleElement,"nonce",(n=(a=(e=this.$primevue)==null?void 0:e.config)==null?void 0:a.csp)==null?void 0:n.nonce),document.head.appendChild(this.styleElement);let p="";const i=Object.keys(this.template),t={};i.sort((r,o)=>parseInt(r)-parseInt(o)).forEach(r=>{t[r]=this.template[r]});for(const[r,[o]]of Object.entries(Object.entries(t))){let f,y;o!=="default"&&typeof Object.keys(t)[r-1]=="string"?y=Number(Object.keys(t)[r-1].slice(0,-2))+1+"px":y=Object.keys(t)[r-1],f=Object.entries(t)[r-1]?`and (min-width:${y})`:"",o==="default"?p+=`
                            @media screen ${f} {
                                .paginator[${this.attributeSelector}],
                                    display: flex;
                                }
                            }
                        `:p+=`
.paginator[${this.attributeSelector}], .p-paginator-${o} {
    display: none;
}
@media screen ${f} and (max-width: ${o}) {
    .paginator[${this.attributeSelector}], .p-paginator-${o} {
        display: flex;
    }
    .paginator[${this.attributeSelector}],
    .p-paginator-default{
        display: none;
    }
}
                    `}this.styleElement.innerHTML=p}},hasBreakpoints(){return typeof this.template=="object"},setPaginatorAttribute(){this.$refs.paginator&&this.$refs.paginator.length>=0&&[...this.$refs.paginator].forEach(e=>{e.setAttribute(this.attributeSelector,"")})},getAriaLabel(e){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria[e]:void 0}},computed:{templateItems(){let e={};if(this.hasBreakpoints()){e=this.template,e.default||(e.default="FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown");for(const a in e)e[a]=this.template[a].split(" ").map(n=>n.trim());return e}return e.default=this.template.split(" ").map(a=>a.trim()),e},page(){return Math.floor(this.d_first/this.d_rows)},pageCount(){return Math.ceil(this.totalRecords/this.d_rows)},isFirstPage(){return this.page===0},isLastPage(){return this.page===this.pageCount-1},calculatePageLinkBoundaries(){const e=this.pageCount,a=Math.min(this.pageLinkSize,e);let n=Math.max(0,Math.ceil(this.page-a/2)),p=Math.min(e-1,n+a-1);const i=this.pageLinkSize-(p-n+1);return n=Math.max(0,n-i),[n,p]},pageLinks(){let e=[],a=this.calculatePageLinkBoundaries,n=a[0],p=a[1];for(var i=n;i<=p;i++)e.push(i+1);return e},currentState(){return{page:this.page,first:this.d_first,rows:this.d_rows}},empty(){return this.pageCount===0},currentPage(){return this.pageCount>0?this.page+1:0},attributeSelector(){return M()}},components:{CurrentPageReport:ee,FirstPageLink:ne,LastPageLink:de,NextPageLink:Pe,PageLinks:ye,PrevPageLink:Le,RowsPerPageDropdown:Ce,JumpToPageDropdown:oe,JumpToPageInput:le}};function De(e,a,n,p,i,t){const r=c("FirstPageLink"),o=c("PrevPageLink"),f=c("NextPageLink"),y=c("LastPageLink"),$=c("PageLinks"),O=c("CurrentPageReport"),S=c("RowsPerPageDropdown"),j=c("JumpToPageDropdown"),x=c("JumpToPageInput");return e.alwaysShow||t.pageLinks&&t.pageLinks.length>1?(s(),u("nav",U(d({key:0},e.ptmi("paginatorWrapper"))),[(s(!0),u(C,null,T(t.templateItems,(F,D)=>(s(),u("div",d({key:D,ref_for:!0,ref:"paginator",class:e.cx("paginator",{key:D})},e.ptm("root")),[e.$slots.start?(s(),u("div",d({key:0,class:e.cx("start")},e.ptm("start")),[I(e.$slots,"start",{state:t.currentState})],16)):_("",!0),(s(!0),u(C,null,T(F,m=>(s(),u(C,{key:m},[m==="FirstPageLink"?(s(),l(r,{key:0,"aria-label":t.getAriaLabel("firstPageLabel"),template:e.$slots.firstpagelinkicon,onClick:a[0]||(a[0]=g=>t.changePageToFirst(g)),disabled:t.isFirstPage||t.empty,unstyled:e.unstyled,pt:e.pt},null,8,["aria-label","template","disabled","unstyled","pt"])):m==="PrevPageLink"?(s(),l(o,{key:1,"aria-label":t.getAriaLabel("prevPageLabel"),template:e.$slots.prevpagelinkicon,onClick:a[1]||(a[1]=g=>t.changePageToPrev(g)),disabled:t.isFirstPage||t.empty,unstyled:e.unstyled,pt:e.pt},null,8,["aria-label","template","disabled","unstyled","pt"])):m==="NextPageLink"?(s(),l(f,{key:2,"aria-label":t.getAriaLabel("nextPageLabel"),template:e.$slots.nextpagelinkicon,onClick:a[2]||(a[2]=g=>t.changePageToNext(g)),disabled:t.isLastPage||t.empty,unstyled:e.unstyled,pt:e.pt},null,8,["aria-label","template","disabled","unstyled","pt"])):m==="LastPageLink"?(s(),l(y,{key:3,"aria-label":t.getAriaLabel("lastPageLabel"),template:e.$slots.lastpagelinkicon,onClick:a[3]||(a[3]=g=>t.changePageToLast(g)),disabled:t.isLastPage||t.empty,unstyled:e.unstyled,pt:e.pt},null,8,["aria-label","template","disabled","unstyled","pt"])):m==="PageLinks"?(s(),l($,{key:4,"aria-label":t.getAriaLabel("pageLabel"),value:t.pageLinks,page:t.page,onClick:a[4]||(a[4]=g=>t.changePageLink(g)),pt:e.pt},null,8,["aria-label","value","page","pt"])):m==="CurrentPageReport"?(s(),l(O,{key:5,"aria-live":"polite",template:e.currentPageReportTemplate,currentPage:t.currentPage,page:t.page,pageCount:t.pageCount,first:i.d_first,rows:i.d_rows,totalRecords:e.totalRecords,unstyled:e.unstyled,pt:e.pt},null,8,["template","currentPage","page","pageCount","first","rows","totalRecords","unstyled","pt"])):m==="RowsPerPageDropdown"&&e.rowsPerPageOptions?(s(),l(S,{key:6,"aria-label":t.getAriaLabel("rowsPerPageLabel"),rows:i.d_rows,options:e.rowsPerPageOptions,onRowsChange:a[5]||(a[5]=g=>t.onRowChange(g)),disabled:t.empty,templates:e.$slots,unstyled:e.unstyled,pt:e.pt},null,8,["aria-label","rows","options","disabled","templates","unstyled","pt"])):m==="JumpToPageDropdown"?(s(),l(j,{key:7,"aria-label":t.getAriaLabel("jumpToPageDropdownLabel"),page:t.page,pageCount:t.pageCount,onPageChange:a[6]||(a[6]=g=>t.changePage(g)),disabled:t.empty,templates:e.$slots,unstyled:e.unstyled,pt:e.pt},null,8,["aria-label","page","pageCount","disabled","templates","unstyled","pt"])):m==="JumpToPageInput"?(s(),l(x,{key:8,page:t.currentPage,onPageChange:a[7]||(a[7]=g=>t.changePage(g)),disabled:t.empty,unstyled:e.unstyled,pt:e.pt},null,8,["page","disabled","unstyled","pt"])):_("",!0)],64))),128)),e.$slots.end?(s(),u("div",d({key:1,class:e.cx("end")},e.ptm("end")),[I(e.$slots,"end",{state:t.currentState})],16)):_("",!0)],16))),128))],16)):_("",!0)}const Ke=P(Te,[["render",De]]);export{Ke as default};
