import{A as e,I as t,Kt as n,N as r,U as i,Wt as a,dt as o,et as s,f as c,lt as l,p as u,u as d,v as f,z as p}from"./runtime-core.esm-bundler.v79eHMSw.js";import{t as m}from"./_plugin-vue_export-helper.BDNMzG2s.js";var h=m({__name:`Pagination`,props:{total:{type:Number,default:0},page:{type:Number,default:1},perPage:{type:Number,default:10},pageSizes:{type:Array,default:()=>[10,25,50,100]},layout:{type:String,default:`prev, pager, next, sizes, total`},hideOnSinglePage:{type:Boolean,default:!0}},emits:[`update:page`,`update:perPage`,`change`],setup(m,{emit:h}){let g=m,_=h,v=o(null),y=o(!1),b=l({opacity:0,transform:`translateX(0)`,width:`0px`,height:`0px`,top:`0px`}),x=()=>{let e=v.value;if(!e)return;let t=e.querySelector(`.el-pager li.is-active`);if(!t){b.opacity=0;return}let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();b.transform=`translateX(${r.left-n.left}px)`,b.top=`${r.top-n.top}px`,b.width=`${r.width}px`,b.height=`${r.height}px`,b.opacity=1};s(()=>[g.page,g.total,g.perPage],()=>e(x)),t(async()=>{await e(),x(),await e(),y.value=!0,window.addEventListener(`resize`,x)}),r(()=>window.removeEventListener(`resize`,x));let S=e=>{_(`update:page`,e),_(`change`,{page:e,perPage:g.perPage})},C=e=>{_(`update:perPage`,e),_(`update:page`,1),_(`change`,{page:1,perPage:e})};return(e,t)=>{let r=i(`el-pagination`);return!m.hideOnSinglePage||m.total>m.perPage?(p(),u(`div`,{key:0,ref_key:`root`,ref:v,class:`smb2b-pager`},[d(`span`,{class:a([`smb2b-pager__pill`,{"is-ready":y.value}]),style:n(b)},null,6),f(r,{background:``,layout:m.layout,total:m.total,"page-size":m.perPage,"current-page":m.page,"page-sizes":m.pageSizes,onCurrentChange:S,onSizeChange:C},null,8,[`layout`,`total`,`page-size`,`current-page`,`page-sizes`])],512)):c(``,!0)}}},[[`__scopeId`,`data-v-88627349`]]);export{h as t};