"use strict";(self.webpackChunk_surecart_surecart=self.webpackChunk_surecart_surecart||[]).push([[5230],{5230:function(t,a,i){i.r(a),i.d(a,{sc_pagination:function(){return h}});var e=i(3029),s=i(2901),n=i(7364),h=function(){return(0,s.A)((function t(a){(0,e.A)(this,t),(0,n.r)(this,a),this.scPrevPage=(0,n.c)(this,"scPrevPage",7),this.scNextPage=(0,n.c)(this,"scNextPage",7),this.page=1,this.perPage=0,this.total=0,this.totalShowing=0,this.totalPages=0,this.hasNextPage=void 0,this.hasPreviousPage=void 0,this.from=void 0,this.to=void 0}),[{key:"componentWillLoad",value:function(){this.handlePaginationChange()}},{key:"handlePaginationChange",value:function(){this.hasNextPage=this.total>1&&this.page<this.totalPages,this.hasPreviousPage=this.totalPages>1&&this.page>1,this.from=this.perPage*(this.page-1)+1,this.to=Math.min(this.from+this.totalShowing-1,this.total)}},{key:"render",value:function(){var t=this;return this.hasNextPage||this.hasPreviousPage?(0,n.h)("sc-flex",null,(0,n.h)("div",{class:"pagination-display"},wp.i18n.sprintf(wp.i18n.__("Displaying %1d to %2d of %3d items","surecart"),this.from,this.to,this.total)),(0,n.h)("sc-flex",null,(0,n.h)("sc-button",{onClick:function(){return t.scPrevPage.emit()},type:"text",disabled:!this.hasPreviousPage},(0,n.h)("sc-visually-hidden",null,wp.i18n.__("Display previous page of items","surecart")),(0,n.h)("span",{"aria-hidden":"true"},wp.i18n.__("Previous","surecart")),(0,n.h)("sc-icon",{"aria-hidden":"true",name:"arrow-left",slot:"prefix"})),(0,n.h)("sc-button",{onClick:function(){return t.scNextPage.emit()},type:"text",disabled:!this.hasNextPage},(0,n.h)("sc-visually-hidden",null,wp.i18n.__("Display next page of items","surecart")),(0,n.h)("span",{"aria-hidden":"true"},wp.i18n.__("Next","surecart")),(0,n.h)("sc-icon",{"aria-hidden":"true",name:"arrow-right",slot:"suffix"})))):null}}],[{key:"watchers",get:function(){return{total:["handlePaginationChange"],totalPages:["handlePaginationChange"],page:["handlePaginationChange"],perPage:["handlePaginationChange"],totalShowing:["handlePaginationChange"]}}}])}();h.style=":host{display:block}.pagination-display{opacity:0.8}"}}]);