import{aD as t,aF as e,bN as i,aC as o,b1 as s,bK as r,c3 as a,bM as n,bw as l,aT as c,aH as h,aR as f,c4 as v,a$ as p,b0 as d,br as u,b2 as g,b3 as b}from"./p-BTBbFFOR.js";import{I as m,V as y}from"./p-ULeawcYN.js";import{s as x}from"./p-C2rs7Hxy.js";import{C as j}from"./p-DVtUqkim.js";var R=function(t,e,i,o){var s,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var n=t.length-1;n>=0;n--)(s=t[n])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class C extends e{constructor(){super(),this.handleChange=()=>{if(this.inputRef.value){const t=i(o(this.inputRef.value,1),1,this.pageCount);this.inputRef.value=t.toString(),this.prevAndNextButtonRenderer.notifyParentPagination(t.toString())}}}render(){return"pageSelectorMobile"===this.type?this.renderPageSelectorMobile():this.renderPageSelectorMobileAndGoTo()}renderPageSelectorMobile(){return s("vega-flex",{alignItems:"center",justifyContent:"center",gap:"size-8"},this.prevAndNextButtonRenderer.render("prev"),s("vega-font",{variant:"font-field-label",color:"text-primary"},this.current.toString()),s("vega-font",{variant:"font-field-label",color:"text-primary"},"/"),s("vega-font",{variant:"font-field-label",color:"text-primary"},this.pageCount.toString()),this.prevAndNextButtonRenderer.render("next"))}renderPageSelectorMobileAndGoTo(){return s("vega-flex",{alignItems:"center",justifyContent:"center",gap:"size-8"},this.prevAndNextButtonRenderer.render("prev"),s("vega-form",{ref:t=>{r.addUniqueObserverToNode(t,a,this.handleChange)}},s("vega-input",{"data-vega-form":"pageSelectorMobile_goTo",size:"small",autocomplete:"on",showClearIcon:!1,style:{width:"54px"},maskConfig:{type:"number",options:{allowNegative:!1,precision:0}},value:this.current.toString(),ref:t=>{this.inputRef=t,r.addUniqueObserverToNode(t,n,this.handleChange)}})),s("vega-font",{variant:"font-field-label",color:"text-primary"},"/"),s("vega-font",{variant:"font-field-label",color:"text-primary"},this.pageCount.toString()),this.prevAndNextButtonRenderer.render("next"))}}R([t()],C.prototype,"host",void 0),R([t()],C.prototype,"type",void 0),R([t()],C.prototype,"current",void 0),R([t()],C.prototype,"pageCount",void 0),R([t()],C.prototype,"prevAndNextButtonRenderer",void 0);var w=function(t,e,i,o){var s,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var n=t.length-1;n>=0;n--)(s=t[n])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class M extends e{constructor(){super(),this.pagerButton=(t,e,i)=>s("vega-button-circle",{variant:"icon-only",icon:t,iconColor:"text-link",size:"small",disabled:e,ref:t=>{r.addUniqueObserverToNode(t,l,i)}}),this.renderPrevButton=()=>this.pagerButton("chevron-left",0===this.total||1===this.current,(()=>{this.notifyParentPagination((this.current-1).toString())})),this.renderNextButton=()=>this.pagerButton("chevron-right",0===this.total||this.current===this.pageCount,(()=>{this.notifyParentPagination((this.current+1).toString())}))}notifyParentPagination(t){const e=c(this.host,"vega-pagination");e&&h.notify(f.getSubject(e,v),{host:this.host,detail:t})}render(t){return"prev"===t?this.renderPrevButton():this.renderNextButton()}}w([t()],M.prototype,"host",void 0),w([t()],M.prototype,"current",void 0),w([t()],M.prototype,"total",void 0),w([t()],M.prototype,"pageCount",void 0);var O=function(t,e,i,o){var s,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var n=t.length-1;n>=0;n--)(s=t[n])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const S=class{constructor(t){d(this,t),this.globalSlimmers={},this.vegaComponentUsageRuntimeMetricsSlimmer=new y,this.childEventPrevent=new j([u],(()=>this.host)),this.pageSelectorMobileRenderer=new C,this.prevAndNextButtonRenderer=new M,this.pageCount=0,this.current=1,this.total=0}render(){return x(s(g,null,this.pageSelectorMobileRenderer.render()),this.host)}get host(){return b(this)}};O([m()],S.prototype,"globalSlimmers",void 0),O([p()],S.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),O([p()],S.prototype,"childEventPrevent",void 0),O([p()],S.prototype,"pageSelectorMobileRenderer",void 0),O([p()],S.prototype,"prevAndNextButtonRenderer",void 0),S.style=":host{display:inline-block}";export{S as vega_pagination_page_selector_mobile}