import{j as e}from"./sikshya-admin-sikshya-react-E_TY_un4.js";import{ad as o,ae as p}from"./sikshya-admin-sikshya-vendor-BVAk_Gwu.js";const N=20;function y(s,c,l=2){if(c<=1)return[1];const i=new Set;i.add(1),i.add(c);for(let t=s-l;t<=s+l;t++)t>=1&&t<=c&&i.add(t);const a=[...i].sort((t,r)=>t-r),n=[];for(let t=0;t<a.length;t++){const r=a[t],x=a[t-1];t>0&&r-x>1&&n.push("ellipsis"),n.push(r)}return n}const b="min-w-[2.25rem] shrink-0 rounded-lg border px-2.5 py-1.5 text-sm font-medium shadow-sm transition focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-slate-900 disabled:cursor-not-allowed disabled:opacity-50",u="border-slate-200 bg-white text-slate-700 hover:bg-slate-50 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700",j="border-brand-500 bg-brand-50 text-brand-800 dark:border-brand-500 dark:bg-brand-950/40 dark:text-brand-200";function $({page:s,totalPages:c,total:l,perPage:i,onPageChange:a,disabled:n,placement:t="bottom"}){if(l==null||l<1)return null;const r=Math.max(1,c??Math.ceil(l/i)),x=(s-1)*i+1,m=Math.min(s*i,l),h=y(s,r),f=t==="top"?"border-b border-slate-100 dark:border-slate-800":"border-t border-slate-100 dark:border-slate-800";return e.jsxs("div",{className:`flex flex-nowrap items-center gap-3 px-4 py-2.5 text-sm ${f}`,children:[e.jsxs("p",{className:"shrink-0 text-slate-600 dark:text-slate-400",children:[e.jsxs("span",{className:"font-medium text-slate-800 dark:text-slate-200",children:[x,"–",m]})," ",o("of","sikshya")," ",e.jsx("span",{className:"font-medium text-slate-800 dark:text-slate-200",children:l}),r>1?e.jsxs(e.Fragment,{children:[" · ",p(o("Page %1$d of %2$d","sikshya"),s,r)]}):null]}),r>1?e.jsx("div",{className:"flex min-w-0 flex-1 justify-end overflow-x-auto [-ms-overflow-style:none] [scrollbar-width:thin] [&::-webkit-scrollbar]:h-1 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-slate-300 dark:[&::-webkit-scrollbar-thumb]:bg-slate-600",children:e.jsxs("div",{className:"flex flex-nowrap items-center gap-1",children:[e.jsx("button",{type:"button",disabled:n||s<=1,onClick:()=>a(1),className:`${b} ${u}`,title:o("First page","sikshya"),children:o("First","sikshya")}),e.jsx("button",{type:"button",disabled:n||s<=1,onClick:()=>a(s-1),className:`${b} ${u}`,children:o("Previous","sikshya")}),h.map((d,k)=>d==="ellipsis"?e.jsx("span",{className:"shrink-0 px-1.5 text-slate-400 select-none dark:text-slate-500","aria-hidden":!0,children:"…"},`e-${k}`):e.jsx("button",{type:"button",disabled:n,onClick:()=>a(d),className:`${b} ${d===s?j:u}`,"aria-current":d===s?"page":void 0,children:d},d)),e.jsx("button",{type:"button",disabled:n||s>=r,onClick:()=>a(s+1),className:`${b} ${u}`,children:o("Next","sikshya")}),e.jsx("button",{type:"button",disabled:n||s>=r,onClick:()=>a(r),className:`${b} ${u}`,title:o("Last page","sikshya"),children:o("Last","sikshya")})]})}):null]})}export{N as D,$ as L};
