import { d as createAstro, c as createComponent, m as maybeRenderHead, b as addAttribute, a as renderTemplate } from './astro/server_5mFihzcn.mjs';
import 'clsx';
/* empty css                         */

const $$Astro = createAstro("https://new.sambekiel.com");
const $$PaginationTab = createComponent(($$result, $$props, $$slots) => {
  const Astro2 = $$result.createAstro($$Astro, $$props, $$slots);
  Astro2.self = $$PaginationTab;
  const { searchParams, href } = Astro2.url;
  const { total_pages } = Astro2.props;
  const page = searchParams.get("page");
  const pageNo = Number(page) >= 1 && Number(page).toString().toLowerCase() !== "nan" ? Number(page) : 1;
  const prev = pageNo - 1;
  const next = pageNo + 1;
  return renderTemplate`${maybeRenderHead()}<div${addAttribute(["pagination flex flex-wrap gap-2"], "class:list")} data-astro-cid-22xspkgf> <a class="link"${addAttribute(href.replace(`page=${pageNo}`, `page=${1}`), "href")} data-astro-cid-22xspkgf>
&lAarr;</a> <a class="link"${addAttribute(href.replace(`page=${pageNo}`, `page=${prev >= 1 ? prev : 1}`), "href")} data-astro-cid-22xspkgf>
&larr;</a> ${Array(total_pages).fill(0).map((_, idx) => renderTemplate`<a class="link"${addAttribute(href.replace(`page=${pageNo}`, `page=${idx + 1}`), "href")}${addAttribute(idx + 1 === pageNo, "aria-current")} data-astro-cid-22xspkgf> ${" "} ${idx + 1} </a>`)} <a class="link"${addAttribute(href.replace(
    `page=${pageNo}`,
    `page=${next <= total_pages ? next : total_pages}`
  ), "href")} data-astro-cid-22xspkgf>
&rarr;</a> <a class="link"${addAttribute(href.replace(`page=${pageNo}`, `page=${total_pages}`), "href")} data-astro-cid-22xspkgf>
&rAarr;</a> </div> `;
}, "C:/projects/sambekiel_front/src/components/PaginationTab.astro", void 0);

export { $$PaginationTab as $ };
